Patch level : xx.502
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 10.05 patch 502 git-svn-id: svn://10.65.10.50/trunk@8388 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
974b558363
commit
16258dc547
402
ba/autorun.cpp
402
ba/autorun.cpp
@ -1,173 +1,229 @@
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
typedef unsigned char bool ;
|
||||
|
||||
HBITMAP _logoaga,_logoprassi;
|
||||
|
||||
/*
|
||||
* MainWndProc
|
||||
*
|
||||
* Purpose:
|
||||
* Window procedure for main window. The main window is a dialog.
|
||||
*
|
||||
*/
|
||||
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_ERASEBKGND:
|
||||
{
|
||||
HDC hdc = (HDC) wParam;
|
||||
HPEN hpen, hpenOld ;
|
||||
RECT rect;
|
||||
GetWindowRect(hwnd,&rect);
|
||||
const int ysize=rect.bottom-rect.top;
|
||||
for (int y=rect.bottom-1; y>=rect.top; y--)
|
||||
{
|
||||
const int blu=192-int(long(y)*192/ysize);
|
||||
hpen = CreatePen(PS_SOLID,1,RGB(0,0,blu));
|
||||
hpenOld = SelectObject(hdc, hpen);
|
||||
|
||||
MoveTo(hdc,rect.left,y);
|
||||
LineTo(hdc,rect.right,y);
|
||||
|
||||
SelectObject(hdc, hpenOld);
|
||||
DeleteObject(hpen);
|
||||
}
|
||||
|
||||
HBITMAP hbmp=_logoaga;
|
||||
HBRUSH hbr, hbrPrevious;
|
||||
|
||||
hbr = CreatePatternBrush(hbmp);
|
||||
|
||||
UnrealizeObject(hbr);
|
||||
hbrPrevious = SelectObject(hdc, hbr);
|
||||
|
||||
//PatBlt(hdc, 0, 0,200 , 200, PATCOPY); // non funziona un cazzo
|
||||
|
||||
SelectObject(hdc, hbrPrevious);
|
||||
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
if (wParam == 1000)
|
||||
{
|
||||
ShellExecute(hwnd,"open", "setup.exe","", "eurocamp\\disk1\\", SW_SHOWNORMAL);
|
||||
}
|
||||
else if (wParam == 1001)
|
||||
{
|
||||
ShellExecute(hwnd,"open", "setup.exe","", "eurodemo\\disk1\\", SW_SHOWNORMAL);
|
||||
}
|
||||
else if (wParam == 1002)
|
||||
{
|
||||
ShellExecute(hwnd,"open", "setup.exe","", "ce\\", SW_SHOWNORMAL);
|
||||
}
|
||||
else if (wParam != 2)
|
||||
return 0;
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefDlgProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InitApplication
|
||||
*
|
||||
* Purpose:
|
||||
* Registers window class
|
||||
*
|
||||
* Parameters:
|
||||
* hinst hInstance of application
|
||||
*
|
||||
* Return Value:
|
||||
* TRUE if initialization succeeded, FALSE otherwise.
|
||||
*/
|
||||
BOOL InitApplication (HINSTANCE hinst)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
|
||||
wc.lpfnWndProc = MainWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = DLGWINDOWEXTRA;
|
||||
wc.hInstance = hinst;
|
||||
wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_APPLICATION));
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "MainWndClass";
|
||||
|
||||
return RegisterClass(&wc);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* WinMain
|
||||
*
|
||||
* Purpose:
|
||||
* Main entry point of application.
|
||||
*
|
||||
*/
|
||||
|
||||
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
if (!hinstPrev)
|
||||
if (!InitApplication(hInst)) // Register window class
|
||||
return FALSE;
|
||||
|
||||
_logoaga=LoadBitmap(hInst, MAKEINTRESOURCE(104));
|
||||
_logoprassi=LoadBitmap(hInst, MAKEINTRESOURCE(105));
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(GetDesktopWindow(),&rect);
|
||||
HWND hwndDlg=CreateWindow("MainWndClass","Scelta installazione",WS_VISIBLE| WS_CAPTION |WS_OVERLAPPEDWINDOW ,
|
||||
rect.left,rect.top,rect.right,rect.bottom,NULL,NULL,hInst,NULL );
|
||||
// SendMessage(hwndDlg, WM_SETFONT, 8, (long)"Arial");
|
||||
const int offx=(rect.right - rect.left-570)/2;
|
||||
const int offy=(rect.bottom - rect.top-260)/2;
|
||||
CreateWindow("STATIC","",WS_CHILD| WS_VISIBLE,
|
||||
offx+160,offy-10,410,220+10, hwndDlg ,NULL,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Installa EuroCampo",
|
||||
WS_CHILD| WS_VISIBLE,offx ,offy,150,30, hwndDlg ,1000,hInst,NULL );
|
||||
CreateWindow("STATIC","Installa EuroCampo in versione commerciale protetta. E' necessario disporre di una chiave di protezione hardware. ",
|
||||
WS_CHILD| WS_VISIBLE ,offx+170,offy,400,60, hwndDlg ,NULL,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Installa EuroDemo",
|
||||
WS_CHILD| WS_VISIBLE,offx ,offy+80,150,30, hwndDlg ,1001,hInst,NULL );
|
||||
CreateWindow("STATIC","Installa EuroCampo in versione Demo. La versione Demo e' priva di protezione hardware ma e' soggetta ad alcune limitazioni.",
|
||||
WS_CHILD| WS_VISIBLE,offx+170,offy+80,400,60, hwndDlg ,NULL,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Installa Cespiti",
|
||||
WS_CHILD| WS_VISIBLE,offx ,offy+160,150,30, hwndDlg ,1002,hInst,NULL );
|
||||
CreateWindow("STATIC","Installazione pacchetto ""Cespiti"". E' necessario avere installato EuroCampo con il pacchetto ""Base"".",
|
||||
WS_CHILD| WS_VISIBLE,offx+170,offy+160,400,60, hwndDlg ,NULL,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Esci",
|
||||
WS_CHILD| WS_VISIBLE,offx,offy+240,150,30, hwndDlg ,2,hInst,NULL );
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
DeleteObject(_logoaga);
|
||||
DeleteObject(_logoprassi);
|
||||
return (msg.wParam);
|
||||
}
|
||||
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef unsigned char bool ;
|
||||
|
||||
HBITMAP _logoaga,_logoprassi;
|
||||
|
||||
|
||||
void DrawBitMap (HDC hdc, HBITMAP hb, int x, int y)
|
||||
{
|
||||
BITMAP bm;
|
||||
HDC hdcmem;
|
||||
POINT ptsize, ptorg;
|
||||
|
||||
hdcmem = CreateCompatibleDC(hdc);
|
||||
SelectObject(hdcmem, hb);
|
||||
SetMapMode(hdcmem, GetMapMode(hdc));
|
||||
GetObject(hb, sizeof(BITMAP), (LPSTR)&bm);
|
||||
ptsize.x = bm.bmWidth;
|
||||
ptsize.y = bm.bmHeight;
|
||||
ptorg.x = ptorg.y = 0;
|
||||
|
||||
DPtoLP(hdc, &ptorg, 1);
|
||||
BitBlt(hdc, x, y, ptsize.x, ptsize.y, hdcmem, ptorg.x, ptorg.y, SRCCOPY);
|
||||
DeleteDC(hdcmem);
|
||||
}
|
||||
|
||||
/*
|
||||
* MainWndProc
|
||||
*
|
||||
* Purpose:
|
||||
* Window procedure for main window. The main window is a dialog.
|
||||
*
|
||||
*/
|
||||
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_ERASEBKGND:
|
||||
{
|
||||
/* Repaint lo sfondo quando necessario*/
|
||||
HDC hdc = (HDC) wParam;
|
||||
HPEN hpenOld = SelectObject(hdc, GetStockObject(NULL_PEN));
|
||||
RECT rect; GetClientRect(hwnd,&rect);
|
||||
const int ysize=rect.bottom-rect.top;
|
||||
const int step = 4;
|
||||
for (int y=rect.bottom; y>=rect.top-step; y-=step)
|
||||
{
|
||||
const int blu=192-int(long(y)*192/ysize);
|
||||
HBRUSH hbrush = CreateSolidBrush(RGB(0,0,blu));
|
||||
HBRUSH hbrushOld = SelectObject(hdc, hbrush);
|
||||
Rectangle(hdc, rect.left, y, rect.right, y+step+1);
|
||||
SelectObject(hdc, hbrushOld);
|
||||
DeleteObject(hbrush);
|
||||
}
|
||||
SelectObject(hdc, hpenOld);
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rct;
|
||||
const char* s1 = "Installa EuroCampo in versione commerciale protetta. E' necessario disporre di una chiave di protezione hardware.";
|
||||
const char* s2 = "Installa EuroCampo in versione Demo. La versione Demo è priva di protezione hardware ma soggetta ad alcune limitazioni.";
|
||||
const char* s3 = "Installazione pacchetto \"Cespiti\". E' necessario avere installato EuroCampo con il pacchetto \"Base\".";
|
||||
const char* s4 = "Scelta installazione";
|
||||
|
||||
HDC hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
GetWindowRect(GetDesktopWindow(),&rct);
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
|
||||
const int offx=(rct.right - rct.left-570)/2;
|
||||
const int offy=(rct.bottom - rct.top-260)/2;
|
||||
rct.left = offx+230;
|
||||
rct.top = offy;
|
||||
rct.right = rct.left+350;
|
||||
rct.bottom = offy+60;
|
||||
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
DrawText(hdc, s1, strlen(s1), &rct, DT_LEFT|DT_WORDBREAK);
|
||||
rct.top += 80; rct.bottom += 80;
|
||||
DrawText(hdc, s2, strlen(s2), &rct, DT_LEFT|DT_WORDBREAK);
|
||||
rct.top += 80; rct.bottom += 80;
|
||||
DrawText(hdc, s3, strlen(s3), &rct, DT_LEFT|DT_WORDBREAK);
|
||||
|
||||
|
||||
/* Titolo con ombreggiatura */
|
||||
HFONT hfont = CreateFont(64, 0, 0, 0, FW_BOLD, TRUE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, "Arial");
|
||||
HFONT hfontOld = SelectObject(hdc, hfont);
|
||||
|
||||
SetTextColor(hdc, RGB(0,0,0));
|
||||
TextOut(hdc, 20, 20, s4, strlen(s4));
|
||||
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
TextOut(hdc, 16, 16, s4, strlen(s4));
|
||||
|
||||
SelectObject(hdc, hfontOld);
|
||||
DeleteObject(hfont);
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
HINSTANCE ret = 10000;
|
||||
if (wParam == 1000)
|
||||
{
|
||||
ret = WinExec("eurocamp\\disk1\\setup.exe", SW_SHOWNORMAL);
|
||||
}
|
||||
else if (wParam == 1001)
|
||||
{
|
||||
ret = WinExec("eurodemo\\disk1\\setup.exe", SW_SHOWNORMAL);
|
||||
}
|
||||
else if (wParam == 1002)
|
||||
{
|
||||
ret = WinExec("ce\\setup.exe", SW_SHOWNORMAL);
|
||||
}
|
||||
else if (wParam != 2)
|
||||
return 0;
|
||||
|
||||
if (ret <= 32)
|
||||
{
|
||||
char s[64];
|
||||
|
||||
wsprintf(s,"Valore ritornato da WinExec : %d", (int)ret);
|
||||
MessageBox(NULL, s, "Errore", MB_OK);
|
||||
}
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
break;
|
||||
case WM_CHAR:
|
||||
if (wParam == VK_ESCAPE)
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefDlgProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* InitApplication
|
||||
*
|
||||
* Purpose:
|
||||
* Registers window class
|
||||
*
|
||||
* Parameters:
|
||||
* hinst hInstance of application
|
||||
*
|
||||
* Return Value:
|
||||
* TRUE if initialization succeeded, FALSE otherwise.
|
||||
*/
|
||||
BOOL InitApplication (HINSTANCE hinst)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
|
||||
wc.lpfnWndProc = MainWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = DLGWINDOWEXTRA;
|
||||
wc.hInstance = hinst;
|
||||
wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(103));
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "MainWndClass";
|
||||
|
||||
return RegisterClass(&wc);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* WinMain
|
||||
*
|
||||
* Purpose:
|
||||
* Main entry point of application.
|
||||
*
|
||||
*/
|
||||
|
||||
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
if (!hinstPrev)
|
||||
if (!InitApplication(hInst)) // Register window class
|
||||
return FALSE;
|
||||
|
||||
_logoaga=LoadBitmap(hInst, MAKEINTRESOURCE(104));
|
||||
_logoprassi=LoadBitmap(hInst, MAKEINTRESOURCE(105));
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(GetDesktopWindow(),&rect);
|
||||
HWND hwndDlg=CreateWindow("MainWndClass","Scelta installazione",WS_VISIBLE| WS_CAPTION |WS_DLGFRAME | WS_SYSMENU ,
|
||||
rect.left,rect.top,rect.right,rect.bottom,NULL,NULL,hInst,NULL );
|
||||
|
||||
const int offx=(rect.right - rect.left-570)/2;
|
||||
const int offy=(rect.bottom - rect.top-260)/2;
|
||||
|
||||
/* Disegna i pulsanti */
|
||||
CreateWindow("BUTTON","Installa EuroCampo",
|
||||
WS_CHILD| WS_VISIBLE ,offx ,offy,200,30, hwndDlg ,1000,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Installa EuroDemo",
|
||||
WS_CHILD| WS_VISIBLE ,offx ,offy+80,200,30, hwndDlg ,1001,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Installa Cespiti",
|
||||
WS_CHILD| WS_VISIBLE,offx ,offy+160,200,30, hwndDlg ,1002,hInst,NULL );
|
||||
|
||||
CreateWindow("BUTTON","Esci",
|
||||
WS_CHILD| WS_VISIBLE,offx,offy+240,200,30, hwndDlg ,2,hInst,NULL );
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
DeleteObject(_logoaga);
|
||||
DeleteObject(_logoprassi);
|
||||
return (msg.wParam);
|
||||
}
|
||||
|
||||
|
104
ba/ba0.cpp
104
ba/ba0.cpp
@ -8,6 +8,7 @@
|
||||
#include <execp.h>
|
||||
#include <isam.h>
|
||||
#include <msksheet.h>
|
||||
#include <os_dep.h>
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <stack.h>
|
||||
@ -17,10 +18,6 @@
|
||||
|
||||
#include <nditte.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <compobj.h>
|
||||
#include <ver.h>
|
||||
|
||||
#include "ba0.h"
|
||||
#include "ba0100a.h"
|
||||
#include "ba0400a.h"
|
||||
@ -199,7 +196,7 @@ TColor_mask::TColor_mask()
|
||||
{
|
||||
TConfig color(CONFIG_USER, "Colors");
|
||||
_color = color.list_variables();
|
||||
set(113, color.get_bool("Campi3D"));
|
||||
set(113, color.get_bool("Campi3D") ? "X" : "");
|
||||
|
||||
for (int f = fields()-1; f >= 0; f--)
|
||||
{
|
||||
@ -654,7 +651,7 @@ bool TMenuitem::enabled() const
|
||||
for (int e = 0; ext[e]; e++)
|
||||
{
|
||||
name.ext(ext[e]);
|
||||
if (fexist(name))
|
||||
if (name.exist())
|
||||
break;
|
||||
}
|
||||
yes = ext[e] != NULL;
|
||||
@ -678,23 +675,7 @@ bool TMenuitem::perform_submenu() const
|
||||
TSubmenu* mnu = menu().find(_action);
|
||||
bool ok = mnu != NULL && mnu->enabled();
|
||||
if (ok)
|
||||
{
|
||||
/* Cristina 6/11/97
|
||||
if (mnu->items() == 1)
|
||||
{
|
||||
if (mnu->query_firm())
|
||||
ok = main_app().set_firm();
|
||||
if (ok)
|
||||
{
|
||||
const TMenuitem& mi = mnu->item(0);
|
||||
ok = mi.enabled() && mi.perform();
|
||||
}
|
||||
}
|
||||
else
|
||||
*/
|
||||
menu().jumpto(mnu);
|
||||
}
|
||||
|
||||
menu().jumpto(mnu);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -727,9 +708,10 @@ bool TMenuitem::perform_program() const
|
||||
if (ok)
|
||||
{
|
||||
prefix().set(NULL); // Chiude prefix
|
||||
const bool maintenance_app = _action.compare("ba1", 3, TRUE) == 0;
|
||||
TExternal_app a(_action);
|
||||
a.run(FALSE,3);
|
||||
|
||||
const bool maintenance_app = _action.compare("ba1", 3, TRUE) == 0;
|
||||
if (maintenance_app)
|
||||
{
|
||||
char line1[16],line2[16];
|
||||
@ -753,7 +735,7 @@ bool TMenuitem::perform_program() const
|
||||
}
|
||||
else strcpy(line2,"");
|
||||
if (strcmp(line1,line2) == 0)
|
||||
if (!yesno_box("La conversione non sembra procedere. Continuo?"))
|
||||
if (!yesno_box("La conversione non sembra procedere. Continuare?"))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1303,7 +1285,14 @@ HIDDEN bool pwd_handler(TMask_field& fld, KEY key)
|
||||
#endif
|
||||
|
||||
bool TMenu_application::check_user()
|
||||
{
|
||||
{
|
||||
TString utente(user());
|
||||
|
||||
#ifdef _DEMO_
|
||||
user() = utente = dongle().administrator();
|
||||
const bool ok = TRUE;
|
||||
#else
|
||||
|
||||
TMask m("ba0100a");
|
||||
#ifdef DBG
|
||||
m.set_handler(F_USER, pwd_handler);
|
||||
@ -1311,7 +1300,7 @@ bool TMenu_application::check_user()
|
||||
#endif
|
||||
|
||||
TLocalisamfile users(LF_USER);
|
||||
TString utente(user()), pwd;
|
||||
TString pwd;
|
||||
|
||||
bool ok = FALSE;
|
||||
for (int i = 0 ; i < 3 && !ok; i++)
|
||||
@ -1403,16 +1392,10 @@ bool TMenu_application::check_user()
|
||||
users.read(_isequal, _lock);
|
||||
users.put("CONNECTED", "X");
|
||||
users.rewrite();
|
||||
|
||||
enable_menu_item(OPTIONS_MENU);
|
||||
enable_menu_item(PREFERRED_MENU);
|
||||
|
||||
customize_colors(); // Aggiorna set di colori
|
||||
reload_images(); // Ritrasparentizza immagini
|
||||
xvt_dwin_invalidate_rect(TASK_WIN, NULL); // Ridisegna sfondo
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _DEMO_
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -1422,6 +1405,12 @@ bool TMenu_application::check_user()
|
||||
prawin.set("User", utente);
|
||||
}
|
||||
|
||||
enable_menu_item(OPTIONS_MENU);
|
||||
enable_menu_item(PREFERRED_MENU);
|
||||
|
||||
customize_colors(); // Aggiorna set di colori
|
||||
reload_images(); // Ritrasparentizza immagini
|
||||
xvt_dwin_invalidate_rect(TASK_WIN, NULL); // Ridisegna sfondo
|
||||
load_preferences();
|
||||
}
|
||||
|
||||
@ -1461,38 +1450,7 @@ static int get_module_version(TConfig& cfg, void* jolly)
|
||||
|
||||
bool TMenu_application::test_network()
|
||||
{
|
||||
word winver = LOWORD(GetVersion());
|
||||
if (LOBYTE(winver)==3 && HIBYTE(winver)==95)
|
||||
{
|
||||
char * VREDIRNAME = "vredir.vxd";
|
||||
DWORD handle;
|
||||
BYTE infoBuffer[512];
|
||||
|
||||
DWORD dwSize = GetFileVersionInfoSize(VREDIRNAME,&handle);
|
||||
if (dwSize)
|
||||
{
|
||||
GetFileVersionInfo(VREDIRNAME,handle,dwSize,infoBuffer);
|
||||
long *language;
|
||||
void * lpBuffer;
|
||||
char szName[128];
|
||||
UINT Size;
|
||||
if (VerQueryValue(infoBuffer, "\\VarFileInfo\\Translation", (void **)&language, &Size) && Size!=0)
|
||||
{
|
||||
sprintf(szName, "\\StringFileInfo\\%04x%04x\\FileVersion",LOWORD(*language), HIWORD(*language));
|
||||
if (VerQueryValue(infoBuffer, szName, &lpBuffer, &Size) && Size!=0)
|
||||
{
|
||||
TToken_string v((const char *)lpBuffer,'.');
|
||||
int subver=atoi(v.get(2));
|
||||
if (subver >=1111 && subver <=1115)
|
||||
return error_box("La versione %s del driver di rete '%s' contiene un bug riconosciuto da Microsoft. Consultare la documentazione sul sito AGA per eliminare questo inconveniente.",(const char *)lpBuffer, VREDIRNAME);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
message_box("Non riesco a determinare la versione del driver di rete '%s'",VREDIRNAME);
|
||||
}
|
||||
return TRUE;
|
||||
return os_test_network_version();
|
||||
}
|
||||
|
||||
bool TMenu_application::test_programs()
|
||||
@ -1577,12 +1535,8 @@ bool TMenu_application::create()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _DEMO_
|
||||
if (!check_user())
|
||||
return FALSE;
|
||||
#else
|
||||
enable_menu_item(OPTIONS_MENU);
|
||||
#endif
|
||||
|
||||
set_perms();
|
||||
test_temp();
|
||||
@ -1598,7 +1552,7 @@ bool TMenu_application::create()
|
||||
TFilename menu = (argc() < 2) ? "baprassi" : argv(1);
|
||||
menu.ext("men");
|
||||
_menu.read(menu);
|
||||
dispatch_e_menu(MENU_ITEM(1));
|
||||
dispatch_e_menu(MENU_ITEM(1));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -2272,8 +2226,7 @@ void TMenu_application::update_preferred()
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
const char* src = mi->child[i].text;
|
||||
pm[i].text = xvt_mem_zalloc(strlen(src)+1);
|
||||
strcpy(pm[i].text, src);
|
||||
pm[i].text = xvt_str_duplicate(src);
|
||||
}
|
||||
xvt_res_free_menu_tree(mi->child);
|
||||
mi->child = pm;
|
||||
@ -2286,8 +2239,7 @@ void TMenu_application::update_preferred()
|
||||
m.tag = MENU_ITEM(50+i);
|
||||
m.enabled = TRUE;
|
||||
const char* src = _preferred.row(i).get(0);
|
||||
m.text = xvt_mem_zalloc(strlen(src)+1);
|
||||
strcpy(m.text, src);
|
||||
m.text = xvt_str_duplicate(src);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2470,7 +2422,7 @@ int TMenu_application::do_tree()
|
||||
CHECK(_mask == NULL, "Two masks are better than one?");
|
||||
_mask = &mask;
|
||||
|
||||
const int twidth = 50;
|
||||
const int twidth = 54;
|
||||
const int bwidth = mask.columns() - twidth - 8;
|
||||
|
||||
TMenu_tree tree(_menu);
|
||||
|
@ -6,7 +6,7 @@ STRING F_USER 8
|
||||
BEGIN
|
||||
PROMPT 4 1 "Utente "
|
||||
FLAGS "U"
|
||||
USE LF_USER SELECT ISGROUP=""
|
||||
USE LF_USER SELECT ISGROUP!="X"
|
||||
INPUT USERNAME F_USER
|
||||
DISPLAY "Utente@8" USERNAME
|
||||
DISPLAY "Gruppo@8" GROUPNAME
|
||||
|
@ -92,7 +92,7 @@ END
|
||||
|
||||
BOOLEAN 113
|
||||
BEGIN
|
||||
PROMPT 2 -3 "Campi 3D"
|
||||
PROMPT 2 -1 "Campi 3D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 14 8
|
||||
|
110
ba/ba1700.cpp
110
ba/ba1700.cpp
@ -198,7 +198,7 @@ int TInstaller_mask::precheck_modules(bool only_newer)
|
||||
((release > currrelease) ||
|
||||
(release == currrelease
|
||||
&& (only_newer ? patchlevel>row(r).get_int(C_CURRPATCH): patchlevel>=row(r).get_int(C_CURRPATCH)) ))
|
||||
&& main_app().has_module(modnumber) )
|
||||
&& main_app().has_module(modnumber,CHK_DONGLE) )
|
||||
{
|
||||
// checca il modulo o la patch se ho installata la stessa versione
|
||||
const bool chk = row(r).get_char(C_ISPATCH) == ' ' || release == row(r).get(C_CURRRELEASE) ;
|
||||
@ -548,7 +548,7 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
|
||||
TToken_string dirs((const char * )(dest.path()),'\\');
|
||||
// file contains non existent subdir specification ?
|
||||
TFilename subdir;
|
||||
for (int c=0; c < dirs.items(); c++)
|
||||
for (int c=0; c < dirs.items()-1; c++)
|
||||
{
|
||||
subdir.add(dirs.get(c));
|
||||
if (subdir.right(1) == ":" )
|
||||
@ -672,6 +672,7 @@ KEY TInstaller_mask::askdisk(TString & path, TFilename & cmdline, int d, int dis
|
||||
|
||||
bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
{
|
||||
bool cancelled=FALSE;
|
||||
bool ok = FALSE;
|
||||
TString msg; // stringa per i messaggi
|
||||
TString16 lastrelease; // release che sto installando
|
||||
@ -684,22 +685,6 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
const bool internet = get_internet_path(path);
|
||||
if (internet)
|
||||
parse_internet_path(http_server,http_path );
|
||||
/* {
|
||||
http_server = get(F_PATH);
|
||||
if (http_server.compare("http://", 7, TRUE) == 0)
|
||||
http_server.ltrim(7);
|
||||
|
||||
const int slash = http_server.find('/');
|
||||
if (slash > 0)
|
||||
{
|
||||
http_path = http_server.mid(slash);
|
||||
if (http_path.right(1) != "/")
|
||||
http_path << '/';
|
||||
http_server.cut(slash);
|
||||
}
|
||||
else
|
||||
http_path = http_default_path;
|
||||
}*/
|
||||
|
||||
const bool is_a_patch=(patchlevel > 0);
|
||||
TFilename ininame = path;
|
||||
@ -795,12 +780,6 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
if (ok)
|
||||
{
|
||||
const long required = fsize(cmdline) * (dischi-d+1) * 4;
|
||||
/*
|
||||
struct _diskfree_t drive;
|
||||
_dos_getdiskfree(0, &drive);
|
||||
const unsigned requested_clusters = unsigned(required / drive.sectors_per_cluster / drive.bytes_per_sector) + 1;
|
||||
if (requested_clusters >= drive.avail_clusters)
|
||||
*/
|
||||
if (!os_test_disk_free_space(tempdir, required))
|
||||
{
|
||||
ok = yesno_box("Lo spazio su disco potrebbe essere insufficiente:\n"
|
||||
@ -909,8 +888,8 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
if (ok)
|
||||
{
|
||||
msg.cut(0);
|
||||
msg << "Copia in corso del modulo '" << module << "'...";
|
||||
TProgind pi(files, msg, FALSE, TRUE);
|
||||
msg << "Copia del modulo '" << module << "' in corso ...";
|
||||
TProgind pi(files, msg, TRUE, TRUE);
|
||||
TFilename src, dst;
|
||||
for (int f = 0; f < files && ok; f++)
|
||||
{
|
||||
@ -924,7 +903,9 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
if (dst=="ba0.exe")
|
||||
dst="ba0.ex_";
|
||||
ok = fcopy(src, dst);
|
||||
cancelled = pi.iscancelled();
|
||||
}
|
||||
ok &= !cancelled;
|
||||
}
|
||||
|
||||
if (ok) // marca sull'install.ini di destinazione l'avvenuta installazione del modulo
|
||||
@ -1140,7 +1121,11 @@ bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
|
||||
{
|
||||
if (_curr_mask->items() == 1)
|
||||
_curr_mask->check(0);
|
||||
if (_curr_mask->one_checked())
|
||||
const bool check_on = _curr_mask->check_enabled();
|
||||
_curr_mask->enable_check(TRUE);
|
||||
const bool some = _curr_mask->one_checked();
|
||||
_curr_mask->enable_check(check_on);
|
||||
if (some)
|
||||
_curr_mask->install_selection();
|
||||
else
|
||||
error_box("Selezionare uno piu' moduli da installare.");
|
||||
@ -1154,7 +1139,11 @@ bool TInstaller_mask::quit_handler(TMask_field& f, KEY k)
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TInstaller_mask & m=(TInstaller_mask &) f.mask();
|
||||
if (m.one_checked())
|
||||
const bool check_on = _curr_mask->check_enabled();
|
||||
_curr_mask->enable_check(TRUE);
|
||||
const bool some = _curr_mask->one_checked();
|
||||
_curr_mask->enable_check(check_on);
|
||||
if (some)
|
||||
return noyes_box("Alcuni moduli sono selezionati per l'installazione.\nConfermi l'uscita?");
|
||||
}
|
||||
return TRUE;
|
||||
@ -1272,8 +1261,14 @@ TInstaller_mask::~TInstaller_mask()
|
||||
|
||||
class TInstaller : public TSkeleton_application
|
||||
{
|
||||
|
||||
protected:
|
||||
bool testdatabase() const ;
|
||||
TInstaller_mask * _m;
|
||||
|
||||
protected:
|
||||
virtual bool create();
|
||||
bool testdatabase() const;
|
||||
bool testprograms() const;
|
||||
virtual bool use_files() const { return FALSE; }
|
||||
virtual void main_loop();
|
||||
};
|
||||
@ -1284,7 +1279,53 @@ bool TInstaller::testdatabase() const
|
||||
return ini.get("TestDatabase","Main",-1,"Y") != "N";
|
||||
}
|
||||
|
||||
bool TInstaller::testprograms() const
|
||||
{
|
||||
TConfig ini(CONFIG_INSTALL);
|
||||
char c = ini.get("TestPrograms","Main",-1,"N")[0];
|
||||
return c == 'X' || c == 'Y';
|
||||
}
|
||||
|
||||
bool TInstaller::create()
|
||||
{
|
||||
if (testprograms())
|
||||
{
|
||||
_m = new TInstaller_mask() ;
|
||||
_m->disable_check();
|
||||
_m->disable(F_PATH);
|
||||
_m->disable(F_UPDATE);
|
||||
_m->disable(DLG_USER);
|
||||
return TSkeleton_application::create();
|
||||
} else {
|
||||
return error_box("L'utente %s non è abilitato all'uso di questo programma", (const char *)user());
|
||||
}
|
||||
}
|
||||
|
||||
void TInstaller::main_loop()
|
||||
{
|
||||
_m->run();
|
||||
if (_m->installed() && testdatabase()) // Almeno 1 modulo installato ?
|
||||
{
|
||||
// Lancia conversione: ba1 -0 -C -uPRASSI
|
||||
TExternal_app conversion("ba1 -0 -C");
|
||||
conversion.run();
|
||||
}
|
||||
}
|
||||
|
||||
class TExtendedInstaller : public TInstaller
|
||||
{
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
bool TExtendedInstaller::create()
|
||||
{
|
||||
_m = new TInstaller_mask() ;
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
void TExtendedInstaller::main_loop()
|
||||
{
|
||||
TInstaller_mask m;
|
||||
m.run();
|
||||
@ -1296,13 +1337,16 @@ void TInstaller::main_loop()
|
||||
}
|
||||
}
|
||||
|
||||
#define PROGNAME "Installer"
|
||||
int ba1700(int argc, char* argv[])
|
||||
{
|
||||
if (user() == ::dongle().administrator())
|
||||
if (user() != ::dongle().administrator())
|
||||
{
|
||||
TInstaller app;
|
||||
app.run(argc, argv, "Installer");
|
||||
} else
|
||||
error_box("L'utente %s non e' abilitato all'esecuzione di questo programma", (const char*)user());
|
||||
app.run(argc, argv, PROGNAME);
|
||||
} else {
|
||||
TExtendedInstaller app;
|
||||
app.run(argc, argv, PROGNAME);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,6 +98,11 @@ bool ba4300_handler(TMask& m, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (k == (K_SHIFT+K_F7) && m.mode() == MODE_MOD)
|
||||
{
|
||||
m.enable(FLD_GD1_VALUTA);
|
||||
return TRUE;
|
||||
}
|
||||
if (k != K_F5 && k != K_F6 && k != K_F7 && k != K_F8 && k != K_F3)
|
||||
return TRUE;
|
||||
if (m.mode() == MODE_MOD || m.mode() == MODE_INS)
|
||||
@ -393,6 +398,7 @@ void TDitte_application::init_modify_mode(TMask& m)
|
||||
m.disable(FLD_GD1_TIPOA);
|
||||
m.disable(FLD_GD1_CODANAGR);
|
||||
m.disable(FLD_GD1_CODANAGR_ANAGR_RAGSOC);
|
||||
m.disable(FLD_GD1_VALUTA); // La valuta si decide solo in creazione
|
||||
if (filtered())
|
||||
{
|
||||
m.show(FLD_GD1_CODDITTAH);
|
||||
|
@ -245,7 +245,7 @@ BEGIN
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT FLD_GD1_VALUTA CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -419,23 +419,19 @@ BEGIN
|
||||
ITEM "T|Trimestrale"
|
||||
END
|
||||
|
||||
NUMBER F_PROG_DARE 15
|
||||
CURRENCY F_PROG_DARE 18
|
||||
BEGIN
|
||||
PROMPT 1 7 "Progressivo dare "
|
||||
HELP "Progressivo dare del giornale"
|
||||
FIELD PROGDARE
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
GROUP 6
|
||||
END
|
||||
|
||||
NUMBER F_TOT_INCASSI 15
|
||||
CURRENCY F_TOT_INCASSI 18
|
||||
BEGIN
|
||||
PROMPT 1 7 "Totale incassi "
|
||||
HELP "Progressivo degli incassi effettuati"
|
||||
FIELD TOTINC
|
||||
FLAGS "R"
|
||||
PICTURE "."
|
||||
GROUP 5
|
||||
END
|
||||
|
||||
@ -449,13 +445,11 @@ BEGIN
|
||||
MESSAGE TRUE DISABLE,F_STAMPA_LIQUIDAZIONE|"X",F_STAMPA_LIQUIDAZIONE
|
||||
END
|
||||
|
||||
NUMBER F_TOT_PAGAMENTI 15
|
||||
CURRENCY F_TOT_PAGAMENTI 18
|
||||
BEGIN
|
||||
PROMPT 42 7 "Totale pagamenti "
|
||||
HELP "Progressivo dei pagamenti effettuati"
|
||||
FIELD TOTPAG
|
||||
FLAGS "R"
|
||||
PICTURE "."
|
||||
GROUP 5
|
||||
END
|
||||
|
||||
@ -467,13 +461,11 @@ BEGIN
|
||||
HELP "Indicare se stampare a fine periodo la liquidazione"
|
||||
END
|
||||
|
||||
NUMBER F_PROG_AVERE 15
|
||||
CURRENCY F_PROG_AVERE 18
|
||||
BEGIN
|
||||
PROMPT 1 9 "Progressivo avere "
|
||||
HELP "Progressivo avere del giornale"
|
||||
FIELD PROGAVERE
|
||||
FLAGS "R"
|
||||
PICTURE "."
|
||||
GROUP 6
|
||||
END
|
||||
|
||||
|
@ -97,10 +97,10 @@ END
|
||||
|
||||
NUMBER FLD_TABCAM_R10 15 5
|
||||
BEGIN
|
||||
PROMPT 20 10 "Cambio "
|
||||
PROMPT 20 30 "Cambio "
|
||||
FIELD R10
|
||||
PICTURE ".5"
|
||||
FLAGS "HU"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
BOOLEAN FLD_TABCAM_B1
|
||||
|
@ -18,11 +18,11 @@ NUMBER F_CODICE 7
|
||||
BEGIN
|
||||
PROMPT 4 2 "Codice "
|
||||
FIELD CODTAB
|
||||
FLAG "U"
|
||||
FLAG "UZ"
|
||||
KEY 1
|
||||
USE CDC
|
||||
INPUT CODTAB F_CODICE
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Codice@7" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
OUTPUT F_DESCRIZIONE S0
|
||||
|
@ -52,7 +52,7 @@ BEGIN
|
||||
OUTPUT F_ANNO CODTAB[1,4]
|
||||
OUTPUT F_CODICE CODTAB[5,7]
|
||||
OUTPUT F_DESCR S0
|
||||
CHECKTYPE REQUIRED
|
||||
CHECKTYPE REQUIRED
|
||||
MESSAGE COPY,20@
|
||||
MESSAGE FALSE COPY,20@
|
||||
END
|
||||
@ -76,7 +76,7 @@ BEGIN
|
||||
FLAGS "GUZ"
|
||||
KEY 1
|
||||
GROUP 1
|
||||
CHECKTYPE REQUIRED
|
||||
CHECKTYPE REQUIRED
|
||||
MESSAGE COPY,21@
|
||||
END
|
||||
|
||||
@ -93,11 +93,11 @@ BEGIN
|
||||
DISPLAY "Codice" CODTAB[5,7]
|
||||
DISPLAY "Tipo" I0
|
||||
COPY OUTPUT F_CODICE
|
||||
CHECKTYPE REQUIRED
|
||||
CHECKTYPE REQUIRED
|
||||
MESSAGE COPY,22@
|
||||
HELP "Descrizione del registro"
|
||||
WARNING "La descrizione e' obbligatoria"
|
||||
END
|
||||
END
|
||||
|
||||
NUMBER F_CODLIB 2
|
||||
BEGIN
|
||||
@ -109,7 +109,7 @@ BEGIN
|
||||
INPUT CODTAB F_CODLIB
|
||||
DISPLAY "Codice libro" CODTAB
|
||||
DISPLAY "Descrizione @50" S0
|
||||
OUTPUT F_CODLIB CODTAB
|
||||
OUTPUT F_CODLIB CODTAB
|
||||
OUTPUT F_DESCR S0
|
||||
CHECKTYPE NORMAL
|
||||
HELP "Codice del libro sociale a cui fa riferimento il registro"
|
||||
@ -178,7 +178,7 @@ NUMBER F_CODULC 3
|
||||
BEGIN
|
||||
PROMPT 35 9 "Unita' locale "
|
||||
FLAGS "R"
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA GRP_INCASSI GRP_GIORNALE GRP_LSOCIALI GRP_GIORNMAG
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA GRP_INCASSI GRP_GIORNALE GRP_LSOCIALI GRP_GIORNMAG
|
||||
FIELD I7
|
||||
USE LF_UNLOC
|
||||
JOIN LF_COMUNI TO LF_UNLOC KEY 1 INTO COM=COMULC
|
||||
@ -194,8 +194,8 @@ BEGIN
|
||||
WARNING "Unita' locale non prevista per questa ditta"
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN ba4 -3
|
||||
END
|
||||
|
||||
END
|
||||
|
||||
NUMBER F_PAGSTAMP 5
|
||||
BEGIN
|
||||
PROMPT 1 11 "Pagine stampate "
|
||||
@ -236,7 +236,7 @@ BEGIN
|
||||
FIELD S6
|
||||
HELP "Codice del libro unico a cui fa riferimento"
|
||||
FLAGS "UZ"
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
USE %LBU
|
||||
INPUT CODTAB[1,4] F_ANNO
|
||||
INPUT CODTAB[5,7] F_CODLBU
|
||||
@ -248,7 +248,7 @@ BEGIN
|
||||
WARNING "Libro unico assente"
|
||||
CHECKTYPE NORMAL
|
||||
VALIDATE NOT_EMPTY_CHECK_FIELD
|
||||
END
|
||||
END
|
||||
|
||||
BOOLEAN F_CONFIG
|
||||
BEGIN
|
||||
@ -297,7 +297,7 @@ BEGIN
|
||||
PROMPT 1 3 "Descrizione "
|
||||
GROUP 22
|
||||
FLAGS "D"
|
||||
END
|
||||
END
|
||||
|
||||
BOOLEAN F_REGSOSP
|
||||
BEGIN
|
||||
@ -324,16 +324,16 @@ BOOLEAN F_STAMPA_CREDITO_ANNO_PREC
|
||||
BEGIN
|
||||
PROMPT 48 5 "Stampa credito anno precedente"
|
||||
HELP "Indicare se si vuole la stampa del credito IVA dell'anno precedente"
|
||||
FIELD B4
|
||||
FIELD B4
|
||||
GROUP GRP_ACQUISTI GRP_NOGIORNMAG
|
||||
END
|
||||
|
||||
BOOLEAN F_CORRISP
|
||||
BOOLEAN F_CORRISP
|
||||
BEGIN
|
||||
PROMPT 48 5 "Registro corrispettivi"
|
||||
HELP "Indicare se si tratta di registro dei corrispettivi"
|
||||
FIELD B0
|
||||
GROUP GRP_VENDITE
|
||||
GROUP GRP_VENDITE
|
||||
END
|
||||
|
||||
LIST F_TIPO_DESC_COSTI_RICAVI 1 10
|
||||
@ -368,56 +368,50 @@ BEGIN
|
||||
PROMPT 1 7 "Stampa reg. riepilogativo "
|
||||
HELP "Intervallo per fare il riepilogo"
|
||||
FIELD S9
|
||||
GROUP GRP_RIEPIVA
|
||||
GROUP GRP_RIEPIVA
|
||||
ITEM "M|Mensile"
|
||||
ITEM "T|Trimestrale"
|
||||
END
|
||||
|
||||
NUMBER F_PROG_DARE 18
|
||||
CURRENCY F_PROG_DARE 18
|
||||
BEGIN
|
||||
PROMPT 1 7 "Progressivo dare "
|
||||
HELP "Progressivo dare del giornale"
|
||||
FIELD R1
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
GROUP GRP_GIORNALE GRP_SOLOGIORNALE
|
||||
GROUP GRP_GIORNALE GRP_SOLOGIORNALE
|
||||
END
|
||||
|
||||
NUMBER F_TOT_INCASSI 18
|
||||
CURRENCY F_TOT_INCASSI 18
|
||||
BEGIN
|
||||
PROMPT 1 7 "Totale incassi "
|
||||
HELP "Progressivo degli incassi effettuati"
|
||||
FIELD R0
|
||||
FLAGS "R"
|
||||
PICTURE "."
|
||||
GROUP GRP_INCASSI
|
||||
FIELD R0
|
||||
GROUP GRP_INCASSI
|
||||
END
|
||||
|
||||
BOOLEAN F_STAMPA_RIEPIL_SUL_REGISTRO
|
||||
BEGIN
|
||||
PROMPT 48 7 "Stampa riepilogo liquidazione"
|
||||
FIELD B6
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
HELP "Indicare se stampare il riepilogo IVA delle aliquote utilizzate"
|
||||
MESSAGE FALSE ENABLE,F_STAMPA_LIQUIDAZIONE
|
||||
MESSAGE TRUE DISABLE,F_STAMPA_LIQUIDAZIONE|"X",F_STAMPA_LIQUIDAZIONE
|
||||
END
|
||||
|
||||
NUMBER F_TOT_PAGAMENTI 18
|
||||
CURRENCY F_TOT_PAGAMENTI 18
|
||||
BEGIN
|
||||
PROMPT 42 7 "Totale pagamenti "
|
||||
HELP "Progressivo dei pagamenti effettuati"
|
||||
FIELD R1
|
||||
FLAGS "R"
|
||||
PICTURE "."
|
||||
GROUP GRP_INCASSI GRP_NOGIORNALE
|
||||
GROUP GRP_INCASSI GRP_NOGIORNALE
|
||||
END
|
||||
|
||||
|
||||
BOOLEAN F_STAMPA_LIQUIDAZIONE
|
||||
BEGIN
|
||||
PROMPT 1 9 "Stampa liquidazione"
|
||||
FIELD B7
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
HELP "Indicare se stampare a fine periodo la liquidazione"
|
||||
END
|
||||
|
||||
@ -425,17 +419,16 @@ BOOLEAN F_STAMPA_PLAFONDS
|
||||
BEGIN
|
||||
PROMPT 48 9 "Stampa plafonds "
|
||||
FIELD S10
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
END
|
||||
|
||||
NUMBER F_PROG_AVERE 18
|
||||
CURRENCY F_PROG_AVERE 18
|
||||
BEGIN
|
||||
PROMPT 1 9 "Progressivo avere "
|
||||
HELP "Progressivo avere del giornale"
|
||||
FIELD R2
|
||||
FLAGS "R"
|
||||
GROUP GRP_GIORNALE
|
||||
FIELD R2
|
||||
PICTURE "."
|
||||
GROUP GRP_GIORNALE GRP_SOLOGIORNALE
|
||||
END
|
||||
|
||||
BOOLEAN F_STAMPA_COSTI_RICAVI
|
||||
@ -444,16 +437,16 @@ BEGIN
|
||||
FIELD B2
|
||||
GROUP GRP_INCASSI GRP_NOGIORNMAG
|
||||
END
|
||||
|
||||
|
||||
LIST F_MESE_STAMPA_ULTIMA_LIQ 10
|
||||
BEGIN
|
||||
PROMPT 1 11 "Mese stampa ultima liquidazione "
|
||||
HELP "Mese in cui e' stata stampata l'ultima liquidazione"
|
||||
FIELD I4
|
||||
FLAGS "M"
|
||||
ITEM "00|Nessuno"
|
||||
ITEM "00|Nessuno"
|
||||
ITEM "13|Annuale"
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
|
||||
END
|
||||
|
||||
BOOLEAN F_VENTIL
|
||||
@ -469,7 +462,7 @@ BEGIN
|
||||
PROMPT 1 11 "Stampa sullo stesso registro"
|
||||
HELP "Indicare se il nuovo esercizio viene stampato sullo stesso registro"
|
||||
FIELD B8
|
||||
GROUP GRP_GIORNALE
|
||||
GROUP GRP_GIORNALE
|
||||
END
|
||||
|
||||
NUMBER F_ULTIMO_NUM_PROT 7
|
||||
@ -477,7 +470,7 @@ BEGIN
|
||||
PROMPT 1 13 "Ultimo numero di protocollo "
|
||||
FIELD I5
|
||||
FLAGS "R"
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI
|
||||
HELP "Ultimo numero di protocollo"
|
||||
END
|
||||
|
||||
@ -486,7 +479,7 @@ BEGIN
|
||||
PROMPT 1 15 "Ultima data di registrazione "
|
||||
HELP "Date dell'ultima registrazione stampata"
|
||||
FIELD D2
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_INCASSI GRP_GIORNALE
|
||||
GROUP GRP_VENDITE GRP_ACQUISTI GRP_INCASSI GRP_GIORNALE
|
||||
END
|
||||
|
||||
DATE F_ULTIMA_DATA_DI_STAMPA
|
||||
|
71
cg/CGP3.URL
Executable file
71
cg/CGP3.URL
Executable file
@ -0,0 +1,71 @@
|
||||
#include <default.url>
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -0
|
||||
* ---------------------------------------------------- */
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -1
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -2
|
||||
* ---------------------------------------------------- */
|
||||
|
||||
MENUBAR MENU_BAR(2)
|
||||
|
||||
MENU MENU_BAR(2)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Scelta parametri"
|
||||
ITEM BAR_ITEM(2) "~Ricalcolo"
|
||||
ITEM BAR_ITEM(3) "~Disco"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -3
|
||||
*
|
||||
* cg3400.cpp Stampa libro giornale
|
||||
* ----------------------------------------------------*/
|
||||
|
||||
MENUBAR MENU_BAR(3)
|
||||
|
||||
MENU MENU_BAR(3)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -4
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(4)
|
||||
|
||||
MENU MENU_BAR(4)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -5
|
||||
*
|
||||
* cg3600.cpp Mastrini a video
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(5)
|
||||
|
||||
MENU MENU_BAR(5)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
SUBMENU M_FONT "~Opzioni"
|
||||
|
||||
MENU M_FONT
|
||||
ITEM MENU_ITEM(1) "~Colori righe"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -6
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(6)
|
||||
|
||||
MENU MENU_BAR(6)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
24
cg/cg0.cpp
24
cg/cg0.cpp
@ -1,25 +1,21 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
#include "cg0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
|
||||
#include "cg0.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int op = argc < 2 ? 0 : atoi(argv[1]+1)+1;
|
||||
int res = 1;
|
||||
const int op = argc < 2 ? 0 : argv[1][1]-'0';
|
||||
switch (op)
|
||||
{
|
||||
case 1: res = cg0100(argc,argv); break;
|
||||
case 2: res = cg0200(argc,argv); break;
|
||||
case 3: res = cg0300(argc,argv); break;
|
||||
case 4: res = cg0400(argc,argv); break;
|
||||
case 5: res = cg0500(argc,argv); break;
|
||||
case 6: res = cg0600(argc,argv); break;
|
||||
default: error_box(usage, argv[0]); break;
|
||||
case 1: cg0200(argc,argv); break; // Clienti/Fornitori
|
||||
case 2: cg0300(argc,argv); break; // Progressivi allegati
|
||||
case 3: cg0400(argc,argv); break; // Progressivi IVA
|
||||
case 4: cg0500(argc,argv); break; // Causali contabili
|
||||
case 5: cg0600(argc,argv); break; // Tabelle contabii
|
||||
default: cg0100(argc,argv); break; // Piano deoi conti
|
||||
}
|
||||
exit(res);
|
||||
return res;
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cg0100.h"
|
||||
|
||||
TOOLBAR "" 0 20 0 2
|
||||
TOOLBAR "" 0 19 0 2
|
||||
|
||||
#include <toolbar.h>
|
||||
|
||||
|
@ -126,12 +126,14 @@ bool TClifo_application::get_next_key(TToken_string& key)
|
||||
|
||||
HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
|
||||
TMask& msk = f.mask() ;
|
||||
if (msk.query_mode() || !f.to_check(key))
|
||||
return TRUE;
|
||||
|
||||
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
|
||||
if ( !f.empty() && !clifo.empty() )
|
||||
return ok;
|
||||
|
||||
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO);
|
||||
if (!f.empty() && !clifo.empty())
|
||||
{
|
||||
clifo.zero() ;
|
||||
const char t1 = msk.get(F_TIPOCF)[0] ;
|
||||
@ -147,22 +149,23 @@ HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
|
||||
|
||||
if (clifo.good() && (t1 != t || s1 != s))
|
||||
{
|
||||
f.error_box("Codice fiscale gia' utilizzato per il codice : %c/%ld",
|
||||
t, s);
|
||||
return FALSE;
|
||||
f.message_box("Codice fiscale gia' utilizzato per il codice %c/%ld",
|
||||
t, s);
|
||||
}
|
||||
}
|
||||
return TRUE ;
|
||||
|
||||
return ok ;
|
||||
}
|
||||
|
||||
HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& msk = f.mask() ;
|
||||
|
||||
if (msk.query_mode() || !f.to_check(key)) return TRUE;
|
||||
|
||||
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
|
||||
bool ok = TRUE;
|
||||
|
||||
TMask& msk = f.mask() ;
|
||||
if (msk.query_mode() || !f.to_check(key))
|
||||
return ok;
|
||||
|
||||
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
|
||||
if ( f.get().not_empty() && !clifo.empty() )
|
||||
{
|
||||
clifo.zero() ;
|
||||
@ -175,17 +178,17 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
|
||||
clifo.read() ;
|
||||
clifo.setkey(1) ;
|
||||
const char t = clifo.get_char(CLI_TIPOCF);
|
||||
const TFixed_string s = clifo.get(CLI_CODCF);
|
||||
const TFixed_string s1(msk.get(F_CODCF));
|
||||
const long s = clifo.get_long(CLI_CODCF);
|
||||
const long s1 = msk.get_long(F_CODCF);
|
||||
|
||||
if (clifo.good() && (t1 != t || s1 != s))
|
||||
{
|
||||
f.error_box("Partita iva gia' definita per il codice : %c/%s",
|
||||
t, (const char*) s);
|
||||
return FALSE ;
|
||||
f.message_box("Partita iva gia' utilizzata per il codice %c/%ld",
|
||||
t, s);
|
||||
}
|
||||
}
|
||||
return TRUE ;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
HIDDEN bool cofi_handler(TMask_field& f, KEY key)
|
||||
@ -695,6 +698,8 @@ bool TClifo_application::user_create() // initvar e arrmask
|
||||
_mov = new TLocalisamfile(LF_MOV);
|
||||
_mov->setkey(3);
|
||||
}
|
||||
else
|
||||
_mov = NULL;
|
||||
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_fis = new TLocalisamfile(LF_ANAGFIS);
|
||||
|
@ -40,9 +40,9 @@ BEGIN
|
||||
KEY 1 2 4 5 6
|
||||
HELP "Indicare se cliente oppure fornitore"
|
||||
ITEM "C|Clienti"
|
||||
MESSAGE CLEAR,4@|COPY,1@|HIDE,DLG_CST|SHOW,DLG_RIC|ENABLE,7@
|
||||
MESSAGE CLEAR,4@|COPY,1@|HIDE,DLG_CST|SHOW,DLG_RIC
|
||||
ITEM "F|Fornitori"
|
||||
MESSAGE ENABLE,4@|COPY,1@|SHOW,DLG_CST|HIDE,DLG_RIC|DISABLE,7@
|
||||
MESSAGE ENABLE,4@|COPY,1@|SHOW,DLG_CST|HIDE,DLG_RIC
|
||||
END
|
||||
|
||||
NUMBER F_CODCF 6
|
||||
|
@ -1,6 +1,7 @@
|
||||
//********************************
|
||||
//* Riepilogo Progressivi IVA *
|
||||
//********************************
|
||||
#include <currency.h>
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <tabutil.h>
|
||||
@ -206,13 +207,24 @@ const char* TProgressivi_iva::desc_attivita(const char* codatt)
|
||||
|
||||
void TProgressivi_iva::lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota)
|
||||
{
|
||||
imposta = (abs(totale) * aliquota)/(aliquota + 1.00);
|
||||
imposta.ceil();
|
||||
if (totale.sign() < 0) imposta = -imposta;
|
||||
imponibile = totale - imposta;
|
||||
real delta = totale - imponibile - imposta;
|
||||
if (!delta.is_zero())
|
||||
imposta += delta;
|
||||
const int dec = TCurrency::get_firm_dec();
|
||||
if (dec == 0) // Lire
|
||||
{
|
||||
imposta = (abs(totale) * aliquota)/(aliquota + 1.00);
|
||||
imposta.ceil();
|
||||
if (totale.sign() < 0) imposta = -imposta;
|
||||
imponibile = totale - imposta;
|
||||
// Qui si entra nel regno del mistero: delta e' SEMPRE zero
|
||||
const real delta = totale - imponibile - imposta;
|
||||
if (!delta.is_zero())
|
||||
imposta += delta;
|
||||
}
|
||||
else // Euro
|
||||
{
|
||||
imposta = (totale * aliquota)/(aliquota + 1.00);
|
||||
imposta.round(dec);
|
||||
imponibile = totale - imposta;
|
||||
}
|
||||
}
|
||||
|
||||
const char* TProgressivi_iva::desc_iva(const TString& cod)
|
||||
|
@ -310,7 +310,7 @@ END
|
||||
|
||||
LIST F_COLL_CESP 1 40
|
||||
BEGIN
|
||||
PROMPT 2 16 "Collegamento cespiti "
|
||||
PROMPT 2 16 "Collegamento cespiti "
|
||||
FIELD COLLCESP
|
||||
ITEM " |Nessuno"
|
||||
ITEM "A|Acquisto cespite"
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "../ba/batbesc.h"
|
||||
#include "cglib01.h"
|
||||
|
||||
class CGTab_application : public Tab_application
|
||||
class CGTTable_application : public TTable_application
|
||||
{
|
||||
// ------------- specifiche tabella esercizi ----
|
||||
static bool dataini_handler(TMask_field& f, KEY k);
|
||||
@ -30,13 +30,13 @@ public:
|
||||
virtual bool check_autorization() const
|
||||
{return FALSE;}
|
||||
|
||||
static CGTab_application& app() { return (CGTab_application&)main_app(); }
|
||||
static CGTTable_application& app() { return (CGTTable_application&)main_app(); }
|
||||
|
||||
CGTab_application() : Tab_application() {}
|
||||
virtual ~CGTab_application() {}
|
||||
CGTTable_application() : TTable_application() {}
|
||||
virtual ~CGTTable_application() {}
|
||||
};
|
||||
|
||||
bool CGTab_application::protected_record(TRectype &rec)
|
||||
bool CGTTable_application::protected_record(TRectype &rec)
|
||||
{
|
||||
if (get_tabname() == "ESC")
|
||||
{
|
||||
@ -48,12 +48,12 @@ bool CGTab_application::protected_record(TRectype &rec)
|
||||
if (saldi.read(_isgteq) == NOERR && cod == rec.get("CODTAB"))
|
||||
return TRUE;
|
||||
}
|
||||
return Tab_application::protected_record(rec);
|
||||
return TTable_application::protected_record(rec);
|
||||
}
|
||||
|
||||
bool CGTab_application::user_create()
|
||||
bool CGTTable_application::user_create()
|
||||
{
|
||||
bool ok = Tab_application::user_create();
|
||||
bool ok = TTable_application::user_create();
|
||||
if (ok)
|
||||
{
|
||||
if (get_tabname() == "ESC")
|
||||
@ -65,15 +65,15 @@ bool CGTab_application::user_create()
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CGTab_application::user_destroy()
|
||||
bool CGTTable_application::user_destroy()
|
||||
{
|
||||
return Tab_application::user_destroy();
|
||||
return TTable_application::user_destroy();
|
||||
}
|
||||
|
||||
|
||||
// - esercizi-specific --------------------------------------------------------
|
||||
|
||||
bool CGTab_application::dataini_handler(TMask_field& f, KEY k)
|
||||
bool CGTTable_application::dataini_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER && f.mask().is_running() && !f.mask().query_mode())
|
||||
{
|
||||
@ -86,7 +86,7 @@ bool CGTab_application::dataini_handler(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CGTab_application::check_esercizio(TString& cod, TDate s1, TDate f1)
|
||||
bool CGTTable_application::check_esercizio(TString& cod, TDate s1, TDate f1)
|
||||
{
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// chiamata prima di registrare. Controlla:
|
||||
@ -158,7 +158,7 @@ bool CGTab_application::check_esercizio(TString& cod, TDate s1, TDate f1)
|
||||
}
|
||||
|
||||
|
||||
void CGTab_application::check_sheet()
|
||||
void CGTTable_application::check_sheet()
|
||||
{
|
||||
// crea 'nu bellu shit co'tutte le informazion e un messaggino
|
||||
// di error se ce n'e' bisogn
|
||||
@ -200,7 +200,7 @@ void CGTab_application::check_sheet()
|
||||
as.run();
|
||||
}
|
||||
|
||||
bool CGTab_application::checkbut_handler(TMask_field& f, KEY k)
|
||||
bool CGTTable_application::checkbut_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE && f.mask().is_running())
|
||||
app().check_sheet();
|
||||
@ -211,7 +211,7 @@ bool CGTab_application::checkbut_handler(TMask_field& f, KEY k)
|
||||
|
||||
int cg0600(int argc, char* argv[])
|
||||
{
|
||||
CGTab_application a;
|
||||
CGTTable_application a;
|
||||
|
||||
a.run(argc, argv, "Gestione tabelle contabili");
|
||||
return 0;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = (argc > 1) ? atoi(argv[1]+1) : -1;
|
||||
const int n = argc > 1 ? argv[1][1]-'0' : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
@ -22,8 +22,8 @@ int main(int argc,char** argv)
|
||||
default:
|
||||
cg1100(argc,argv); break; // Stampa Piano dei conti
|
||||
}
|
||||
exit(n < 0); // Altrimenti non esce mai!
|
||||
return n < 0;
|
||||
exit(0); // Altrimenti non esce mai!
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
19
cg/cg1300.h
19
cg/cg1300.h
@ -2,15 +2,16 @@
|
||||
#define __CG1300_H
|
||||
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_ANNO 103
|
||||
#define F_REG 104
|
||||
#define F_PROT 105
|
||||
#define F_PASS 106
|
||||
#define F_DA 107
|
||||
#define F_A 108
|
||||
#define F_DENATTV 109
|
||||
#define F_DENATTN 110
|
||||
#define F_RAGSOC 102
|
||||
#define F_ANNO 103
|
||||
#define F_REG 104
|
||||
#define F_PROT 105
|
||||
#define F_PASS 106
|
||||
#define F_DA 107
|
||||
#define F_A 108
|
||||
#define F_DENATTV 109
|
||||
#define F_DENATTN 110
|
||||
#define F_MODE 111
|
||||
#endif // __CG1300_H
|
||||
|
||||
|
||||
|
@ -1,64 +1,86 @@
|
||||
#include "cg1300.h"
|
||||
|
||||
PAGE "Rinumerazione numero protocollo" -1 -1 72 12
|
||||
PAGE "Rinumerazione numero protocollo" -1 -1 62 12
|
||||
|
||||
GROUPBOX DLG_NULL 60 3
|
||||
BEGIN
|
||||
PROMPT 1 0 "@bDitta"
|
||||
END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
PROMPT 2 1 ""
|
||||
FLAGS "FD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 1 2 "Ragione sociale "
|
||||
PROMPT 9 1 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 60 3
|
||||
BEGIN
|
||||
PROMPT 1 3 "@bRegistro IVA"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 1 4 "Anno "
|
||||
HELP "Anno di riferimento"
|
||||
VALIDATE FIXLEN_FUNC 4
|
||||
PROMPT 2 4 "Anno "
|
||||
FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
//WARNING "Indicare l'anno"
|
||||
END
|
||||
|
||||
STRING F_REG 3
|
||||
BEGIN
|
||||
PROMPT 1 5 "Codice registro "
|
||||
USE REG SELECT (I0<"3") && (CODTAB[1,4]==#103)
|
||||
INPUT CODTAB[1,4] F_ANNO
|
||||
PROMPT 31 4 "Codice "
|
||||
USE REG SELECT (I0<"3") && (CODTAB[1,4]==#F_ANNO)
|
||||
INPUT CODTAB[1,4] F_ANNO SELECT
|
||||
INPUT CODTAB[5,7] F_REG
|
||||
DISPLAY "Anno " CODTAB[1,4]
|
||||
DISPLAY "Codice " CODTAB[5,7]
|
||||
DISPLAY "Descrizione @40" S0
|
||||
OUTPUT F_ANNO CODTAB[1,4]
|
||||
OUTPUT F_REG CODTAB[5,7]
|
||||
OUTPUT F_DA D3
|
||||
FLAGS "U"
|
||||
VALIDATE ZEROFILL_FUNC 3
|
||||
CHECKTYPE REQUIRED
|
||||
//WARNING "Indicare il codice registro"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_MODE 1 60
|
||||
BEGIN
|
||||
PROMPT 1 6 "@bRiparti da "
|
||||
ITEM "U|Ultima stampa"
|
||||
MESSAGE CLEAR,F_PROT
|
||||
ITEM "N|Numero specificato"
|
||||
MESSAGE ENABLE,F_PROT
|
||||
ITEM "A|Inizio anno"
|
||||
MESSAGE CLEAR,F_PROT
|
||||
END
|
||||
|
||||
DATE F_DA
|
||||
BEGIN
|
||||
PROMPT 31 7 "Data "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_PROT 5
|
||||
BEGIN
|
||||
PROMPT 1 6 "Numero di protocollo "
|
||||
HELP "Numero progressivo di protocollo IVA"
|
||||
NUM_EXPR (#F_PROT>0)
|
||||
WARNING "Inserire un numero maggiore di zero"
|
||||
PROMPT 31 8 "Numero "
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
173
cg/cg1303.cpp
173
cg/cg1303.cpp
@ -1,72 +1,58 @@
|
||||
//***********************************
|
||||
//* Rinumerazione numero protocollo *
|
||||
//***********************************
|
||||
#include <mov.h>
|
||||
#include <partite.h>
|
||||
#include <mask.h>
|
||||
#include <progind.h>
|
||||
#include <tabutil.h>
|
||||
#include <relation.h>
|
||||
|
||||
#include "cg1300.h"
|
||||
#include "cg1303.h"
|
||||
|
||||
#include <mov.h>
|
||||
#include <partite.h>
|
||||
|
||||
|
||||
HIDDEN TAgg_nprot& app() { return (TAgg_nprot&) main_app(); }
|
||||
|
||||
bool TAgg_nprot::filtra_mov(const TRelation* r)
|
||||
HIDDEN bool filtra_mov(const TRelation* r)
|
||||
{
|
||||
TLocalisamfile& mov = r->lfile();
|
||||
|
||||
const TRectype& mov = r->curr();
|
||||
const int annoiva = mov.get_int(MOV_ANNOIVA);
|
||||
const TString16 reg = mov.get(MOV_REG);
|
||||
|
||||
if (app()._anno == annoiva && app()._reg == reg)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
const TString& reg = mov.get(MOV_REG);
|
||||
TAgg_nprot& a = app();
|
||||
return a.anno() == annoiva && a.reg() == reg;
|
||||
}
|
||||
|
||||
bool TAgg_nprot::create()
|
||||
{
|
||||
TApplication::create();
|
||||
|
||||
_tabreg = new TTable("REG");
|
||||
|
||||
dispatch_e_menu (BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TAgg_nprot::destroy()
|
||||
{
|
||||
delete _tabreg;
|
||||
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
bool TAgg_nprot::menu(MENU_TAG m)
|
||||
void TAgg_nprot::main_loop()
|
||||
{
|
||||
TMask msk("cg1300b");
|
||||
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
int annoiva = conf.get_int("AnLiIv");
|
||||
|
||||
msk.set(F_ANNO, annoiva);
|
||||
|
||||
/*
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
int annoiva = conf.get_int("AnLiIv");
|
||||
msk.set(F_ANNO, annoiva);
|
||||
*/
|
||||
|
||||
while (msk.run() == K_ENTER)
|
||||
{
|
||||
_anno = msk.get_int(F_ANNO);
|
||||
_reg = msk.get(F_REG);
|
||||
_prot = msk.get_long(F_PROT);
|
||||
|
||||
rinumera_prot();
|
||||
rinumera_prot(msk.get(F_MODE)[0], msk.get_long(F_PROT));
|
||||
|
||||
msk.reset(F_REG);
|
||||
msk.reset(F_PROT);
|
||||
//return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int TAgg_nprot::rinumera_prot()
|
||||
bool TAgg_nprot::rinumera_prot(char mode, long last_prot)
|
||||
{
|
||||
TConfig cnf(CONFIG_DITTA,"cg");
|
||||
const bool sc_enabled = cnf.get_bool("GesSal");
|
||||
TTable reg("REG");
|
||||
TString16 s; s.format("%04d%s", _anno, (const char*)_reg);
|
||||
reg.put("CODTAB", s);
|
||||
if (reg.read() != NOERR)
|
||||
return error_box("Impossibile leggere il registro %s del %d",
|
||||
(const char*)_reg, _anno);
|
||||
|
||||
TRelation rel (LF_MOV);
|
||||
rel.add(LF_PARTITE,"NREG=NUMREG",2);
|
||||
@ -74,53 +60,69 @@ int TAgg_nprot::rinumera_prot()
|
||||
TLocalisamfile& mov = rel.lfile();
|
||||
TLocalisamfile& part= rel.lfile(LF_PARTITE);
|
||||
|
||||
//TString80 filter;
|
||||
//filter.format("ANNOIVA=%04d && REG=\"%s\"", _anno, (const char*)_reg);
|
||||
//TCursor cursor(&rel, filter, 2);
|
||||
|
||||
TCursor cursor(&rel, "", 2);
|
||||
cursor.set_filterfunction(filtra_mov);
|
||||
|
||||
cursor = 0L;
|
||||
const long nitems = cursor.items();
|
||||
|
||||
//TProgind p(nitems ? nitems : 1, "Elaborazione in corso..." , TRUE, TRUE, 70);
|
||||
TProgind* p = NULL;
|
||||
|
||||
if (nitems > 0L)
|
||||
p = new TProgind (nitems, "Elaborazione in corso..." , TRUE, TRUE, 70);
|
||||
if (nitems == 0)
|
||||
return warning_box("Non ci sono movimenti da rinumerare");
|
||||
|
||||
TConfig cnf(CONFIG_DITTA,"cg");
|
||||
const bool sc_enabled = cnf.get_bool("GesSal");
|
||||
|
||||
cursor.freeze();
|
||||
cursor = 0L;
|
||||
|
||||
TProgind p(nitems, "Elaborazione in corso..." , FALSE, TRUE);
|
||||
|
||||
long protiva, uprotiva;
|
||||
|
||||
for (; cursor.pos() < cursor.items(); ++cursor)
|
||||
if (mode == 'N' || mode == 'U')
|
||||
{
|
||||
if (p) p->addstatus(1);
|
||||
protiva = mov.get_long(MOV_PROTIVA);
|
||||
uprotiva = mov.get_long(MOV_UPROTIVA);
|
||||
if (protiva != _prot && uprotiva != _prot) continue;
|
||||
else
|
||||
for (; cursor.pos() < nitems; ++cursor)
|
||||
{
|
||||
if (uprotiva != 0l)
|
||||
_prot = uprotiva;
|
||||
break;
|
||||
}
|
||||
}
|
||||
p.addstatus(1);
|
||||
protiva = mov.get_long(MOV_PROTIVA);
|
||||
uprotiva = mov.get_long(MOV_UPROTIVA);
|
||||
|
||||
if (mode == 'U')
|
||||
{
|
||||
if (mov.get_bool(MOV_REGST))
|
||||
{
|
||||
last_prot = uprotiva > protiva ? uprotiva : protiva;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode == 'N')
|
||||
{
|
||||
if (protiva != last_prot && uprotiva != last_prot)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if (uprotiva != 0l)
|
||||
last_prot = uprotiva;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (protiva != _prot && uprotiva != _prot) //sono alla fine del file
|
||||
{
|
||||
delete p;
|
||||
return message_box("Non trovato record con protocollo indicato: rinumerazione non avvenuta");
|
||||
}
|
||||
|
||||
++cursor;
|
||||
if (last_prot > 0)
|
||||
{
|
||||
if (protiva != last_prot && uprotiva != last_prot) //sono alla fine del file
|
||||
return error_box("Non esiste la registrazione con protocollo %ld:\nrinumerazione non avvenuta", last_prot);
|
||||
++cursor;
|
||||
}
|
||||
}
|
||||
|
||||
long nprot,uprot,dprot;
|
||||
dprot = uprot = 0L;
|
||||
nprot = _prot;
|
||||
nprot = last_prot;
|
||||
|
||||
for (; cursor.pos() < cursor.items(); ++cursor)
|
||||
for (; cursor.pos() < nitems; ++cursor)
|
||||
{
|
||||
if (p) p->addstatus(1);
|
||||
p.addstatus(1);
|
||||
protiva = mov.get_long(MOV_PROTIVA);
|
||||
uprotiva = mov.get_long(MOV_UPROTIVA);
|
||||
|
||||
@ -135,29 +137,18 @@ int TAgg_nprot::rinumera_prot()
|
||||
mov.rewrite();
|
||||
// Aggiorna il nr di prot. iva sul file partite
|
||||
if (sc_enabled && rel.is_first_match(LF_PARTITE))
|
||||
{
|
||||
do
|
||||
{
|
||||
part.put(PART_PROTIVA,nprot);
|
||||
part.rewrite();
|
||||
} while (rel.next_match(LF_PARTITE));
|
||||
}
|
||||
}
|
||||
|
||||
TTable reg("REG");
|
||||
TString16 s; s.format("%04d%s", _anno, (const char*)_reg);
|
||||
reg.zero();
|
||||
reg.put("CODTAB", s);
|
||||
if (reg.read() == NOERR)
|
||||
{
|
||||
reg.put("I5", nprot + dprot);
|
||||
reg.rewrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete p;
|
||||
return error_box("Impossibile leggere il registro %s anno %s",
|
||||
(const char*)_reg, (const char*)_anno);
|
||||
}
|
||||
delete p;
|
||||
reg.put("I5", nprot + dprot);
|
||||
reg.rewrite();
|
||||
|
||||
return message_box("Rinumerazione numero protocollo completata");
|
||||
}
|
||||
|
||||
|
28
cg/cg1303.h
28
cg/cg1303.h
@ -1,29 +1,19 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <progind.h>
|
||||
#include <urldefid.h>
|
||||
#include <config.h>
|
||||
|
||||
class TAgg_nprot : public TApplication
|
||||
class TAgg_nprot : public TSkeleton_application
|
||||
{
|
||||
TTable* _tabreg;
|
||||
TString16 _reg;
|
||||
int _anno;
|
||||
long _prot;
|
||||
TString16 _reg;
|
||||
|
||||
protected:
|
||||
static bool filtra_mov(const TRelation*);
|
||||
virtual void main_loop();
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
public:
|
||||
int anno() const { return _anno; }
|
||||
const TString& reg() const { return _reg; }
|
||||
|
||||
int rinumera_prot();
|
||||
bool rinumera_prot(char mode, long last_prot);
|
||||
|
||||
TAgg_nprot() : _reg("") {};
|
||||
virtual ~TAgg_nprot() {};
|
||||
TAgg_nprot() { }
|
||||
virtual ~TAgg_nprot() { }
|
||||
};
|
@ -19,6 +19,7 @@
|
||||
// - leggi_file_tmp();
|
||||
// - UltimaData();
|
||||
|
||||
#include <currency.h>
|
||||
#include <mask.h>
|
||||
#include <progind.h>
|
||||
#include <printapp.h>
|
||||
@ -183,20 +184,6 @@ HIDDEN inline TStampa_bilanci& app() { return (TStampa_bilanci&)main_app(); }
|
||||
|
||||
TDate InizioEsercizio(int anno)
|
||||
{
|
||||
/*
|
||||
TTable TabEs ("ESC");
|
||||
TString16 codtab;
|
||||
TDate inizio_es;
|
||||
|
||||
TabEs.zero();
|
||||
codtab.format ("%04d", anno);
|
||||
TabEs.put ("CODTAB", codtab);
|
||||
TabEs.read();
|
||||
if (TabEs.good())
|
||||
inizio_es= TabEs.get_date ("D0");
|
||||
|
||||
return inizio_es;
|
||||
*/
|
||||
TEsercizi_contabili esc;
|
||||
TDate inizio_es;
|
||||
if (esc.exist(anno))
|
||||
@ -2539,9 +2526,15 @@ void TStampa_bilanci::leggi_files_avere(TIsamtempfile* file)
|
||||
_cambiato_conto_2 = FALSE;
|
||||
}
|
||||
|
||||
#define POINTLESS_PICTURE "###############"
|
||||
#define TOTAL_PICTURE "###.###.###.###.###"
|
||||
|
||||
HIDDEN void total2string(const real& tot, TString& str)
|
||||
{
|
||||
TCurrency cur(tot);
|
||||
str = cur.string(TRUE);
|
||||
str.right_just(strlen(TOTAL_PICTURE));
|
||||
}
|
||||
|
||||
bool TStampa_bilanci::preprocess_print(int file, int counter)
|
||||
{
|
||||
if (_bilancio == 1)
|
||||
@ -2580,7 +2573,8 @@ bool TStampa_bilanci::preprocess_print(int file, int counter)
|
||||
_mov_dare_tot = ZERO;
|
||||
_mov_avere_tot = ZERO;
|
||||
_saldo_finale_tot = ZERO;
|
||||
}
|
||||
}
|
||||
set_magic_currency(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3288,16 +3282,16 @@ void TStampa_bilanci::stampa_totali()
|
||||
set_row(_i++, (const char*)dep);
|
||||
set_row(_i++, (const char*)dep);
|
||||
set_row(_i++, (const char*)dep);
|
||||
TString pal (_tot_dare.string(TOTAL_PICTURE));
|
||||
TString bal (_tot_avere.string(TOTAL_PICTURE));
|
||||
set_row(_i++, "@39gTOTALE@48g%s@102gTOTALE@112g%s",
|
||||
TString pal; total2string(_tot_dare, pal);
|
||||
TString bal; total2string(_tot_avere, bal);
|
||||
set_row(_i++, "@39gTOTALE@48g%s@102gTOTALE@113g%s",
|
||||
(const char*)pal, (const char*)bal);
|
||||
TString sb (sbilancio.string(TOTAL_PICTURE));
|
||||
TString pa (pareggio.string(TOTAL_PICTURE));
|
||||
TString sb; total2string(sbilancio, sb);
|
||||
TString pa; total2string(pareggio, pa);
|
||||
if (_tot_dare > _tot_avere)
|
||||
{
|
||||
set_row(_i++, "@80gSBILANCIO ESERCIZIO IN CORSO@112g%s", (const char*)sb);
|
||||
set_row(_i++, "@91gTOTALE A PAREGGIO@112g%s",(const char*)pa);
|
||||
set_row(_i++, "@80gSBILANCIO ESERCIZIO IN CORSO@113g%s", (const char*)sb);
|
||||
set_row(_i++, "@91gTOTALE A PAREGGIO@113g%s",(const char*)pa);
|
||||
}
|
||||
if (_tot_dare < _tot_avere)
|
||||
{
|
||||
@ -3339,9 +3333,9 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2)
|
||||
set_row(_i++, (const char*)dep);
|
||||
set_row(_i++, (const char*)dep);
|
||||
set_row(_i++, (const char*)dep);
|
||||
TString pal (_tot_dare.string(TOTAL_PICTURE));
|
||||
TString bal (_tot_avere.string(TOTAL_PICTURE));
|
||||
set_row(_i++, "@39gTOTALE@48g%s@102gTOTALE@112g%s",
|
||||
TString pal; total2string(_tot_dare, pal);
|
||||
TString bal; total2string(_tot_avere, bal);
|
||||
set_row(_i++, "@39gTOTALE@48g%s@102gTOTALE@113g%s",
|
||||
(const char*)pal, (const char*)bal);
|
||||
if (sbilancio > ZERO) //ho un utile => va stampato tra le passivita'
|
||||
{
|
||||
@ -3349,15 +3343,15 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2)
|
||||
pareggio = _tot_avere + sbilancio + sbilprec;
|
||||
if (sbilprec != ZERO)
|
||||
{
|
||||
TString sb (sbilprec.string(TOTAL_PICTURE));
|
||||
set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@112g%s",
|
||||
TString sb; total2string(sbilprec, sb);
|
||||
set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@113g%s",
|
||||
(const char*)sb);
|
||||
}
|
||||
TString pal (sbilancio.string(TOTAL_PICTURE));
|
||||
TString bal (pareggio.string(TOTAL_PICTURE));
|
||||
set_row(_i++, "@80gSBILANCIO ESERCIZIO IN CORSO@112g%s",
|
||||
TString pal; total2string(sbilancio, pal);
|
||||
TString bal; total2string(pareggio, bal);
|
||||
set_row(_i++, "@80gSBILANCIO ESERCIZIO IN CORSO@113g%s",
|
||||
(const char*)pal);
|
||||
set_row(_i++, "@91gTOTALE A PAREGGIO@112g%s",(const char*)bal);
|
||||
set_row(_i++, "@91gTOTALE A PAREGGIO@113g%s",(const char*)bal);
|
||||
}
|
||||
else if (sbilancio < ZERO) //ho una perdita => va stampato tra le attivita'
|
||||
{
|
||||
@ -3365,13 +3359,13 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2)
|
||||
pareggio = _tot_dare + sbilancio + sbilprec;
|
||||
if (sbilprec != ZERO)
|
||||
{
|
||||
TString sb (sbilprec.string(TOTAL_PICTURE));
|
||||
TString sb; total2string(sbilprec, sb);
|
||||
set_row(_i++, "@15gSBILANCIO ESERCIZIO PRECEDENTE@48g%s",
|
||||
(const char*)sb);
|
||||
}
|
||||
|
||||
TString pal (sbilancio.string(TOTAL_PICTURE));
|
||||
TString bal (pareggio.string(TOTAL_PICTURE));
|
||||
TString pal; total2string(sbilancio, pal);
|
||||
TString bal; total2string(pareggio, bal);
|
||||
set_row(_i++, "@17gSBILANCIO ESERCIZIO IN CORSO@48g%s",
|
||||
(const char*)pal);
|
||||
set_row(_i++, "@28gTOTALE A PAREGGIO@48g%s",(const char*)bal);
|
||||
@ -3381,19 +3375,19 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2)
|
||||
sbilprec = -sbilprec;
|
||||
if (sbilprec > ZERO) //va stampato sotto le passivita'
|
||||
{
|
||||
TString pal (sbilprec.string(TOTAL_PICTURE));
|
||||
TString pal; total2string(sbilprec, pal);
|
||||
pareggio = _tot_avere + sbilprec;
|
||||
TString bal (pareggio.string(TOTAL_PICTURE));
|
||||
set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@112g%s",
|
||||
TString bal; total2string(pareggio, bal);
|
||||
set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@113g%s",
|
||||
(const char*)pal);
|
||||
set_row(_i++, "@96gTOTALE A PAREGGIO@112g%s", (const char*)bal);
|
||||
set_row(_i++, "@96gTOTALE A PAREGGIO@113g%s", (const char*)bal);
|
||||
}
|
||||
else if (sbilprec < ZERO)
|
||||
{
|
||||
sbilprec = -sbilprec;
|
||||
pareggio = _tot_dare + sbilprec;
|
||||
TString pal (sbilprec.string(TOTAL_PICTURE));
|
||||
TString bal (pareggio.string(TOTAL_PICTURE));
|
||||
TString pal; total2string(sbilprec, pal);
|
||||
TString bal; total2string(pareggio, bal);
|
||||
set_row(_i++, "@15gSBILANCIO ESERCIZIO PRECEDENTE@48g%s", (const char*)pal);
|
||||
set_row(_i++, "@28gTOTALE A PAREGGIO@48g%s", (const char*)bal);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
class TRiga_sez_opp : public TObject
|
||||
{
|
||||
TToken_string * _str;
|
||||
TToken_string* _str;
|
||||
|
||||
public:
|
||||
int gruppo() { return atoi(_str->get(0)); }
|
||||
@ -109,19 +109,17 @@ void Righe_sez_opp::add(int g, int c, long s,
|
||||
const char * sezione, const char * lettera,
|
||||
const char * num_rom, int num, real saldo, real saldo_raf)
|
||||
{
|
||||
TRiga_sez_opp * riga;
|
||||
TString key = format("%s%s%s%d",sezione,lettera,num_rom,num);
|
||||
TString80 key; key.format("%s%s%s%d",sezione,lettera,num_rom,num);
|
||||
|
||||
if (!is_key((const char *) key))
|
||||
TRiga_sez_opp* riga = (TRiga_sez_opp*)objptr(key);
|
||||
if (riga == NULL)
|
||||
{
|
||||
riga = new TRiga_sez_opp (g, c, s, sezione, lettera, num_rom, num, saldo, saldo_raf);
|
||||
TAssoc_array::add(key,riga);
|
||||
}
|
||||
else
|
||||
{
|
||||
riga = (TRiga_sez_opp*) objptr ((const char*) key);
|
||||
riga->incrementa_saldo(saldo,saldo_raf);
|
||||
// add(key,riga,TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -713,7 +711,7 @@ bool TStampa_IVdirettiva::tipo_stampa(TMask_field& f,KEY k)
|
||||
if (tipo_stampa == 2)
|
||||
if (anno == 0)
|
||||
{
|
||||
error_box("Nella stampa all' ultima immissione l' anno esercizio e' obbligatorio");
|
||||
error_box("Nella stampa all'ultima immissione l'anno esercizio e' obbligatorio");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -2115,6 +2113,7 @@ bool TStampa_IVdirettiva::set_print(int)
|
||||
else
|
||||
set_real_picture("####.###.###.###");
|
||||
}
|
||||
set_magic_currency(TRUE);
|
||||
|
||||
set_print_zero(TRUE);
|
||||
|
||||
|
@ -187,7 +187,7 @@ bool TPrimanota_application::user_create()
|
||||
{
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_RCAUSALI, LF_CLIFO, LF_PCON, 0);
|
||||
open_files(LF_ATTIV, LF_SALDI, LF_COMUNI, LF_OCCAS, LF_NDITTE, 0);
|
||||
open_files(LF_SCADENZE, LF_PAGSCA, 0);
|
||||
open_files(LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
|
||||
|
||||
_incasso = new TDati_incasso;
|
||||
|
||||
@ -484,6 +484,8 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
|
||||
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRLIRE, F_CORRVAL (GROUP 4)
|
||||
m.show(-4, causale().valintra());
|
||||
if (m.insert_mode() && causale().valintra() && !causale().intra())
|
||||
m.set(F_SOLAIVA, "X", TRUE); // Propone movimento di sola iva
|
||||
|
||||
m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard
|
||||
|
||||
@ -1688,7 +1690,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
|
||||
if (!causale().intra())
|
||||
return FALSE;
|
||||
|
||||
// Controlla l'esistenza del programma cespiti
|
||||
// Controlla l'esistenza del programma intra
|
||||
if (!fexist("in0.exe"))
|
||||
return FALSE;
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
#define CG_GRUPPO 104
|
||||
#define CG_CONTO 105
|
||||
#define CG_SOTTOCONTO 106
|
||||
#define CG_DESCR 109
|
||||
#define CG_CDC 115
|
||||
#define CG_ROWTYPE 116
|
||||
|
||||
@ -122,6 +123,7 @@
|
||||
#define SK_DATACAMBIO 303
|
||||
#define SK_CAMBIO 304
|
||||
#define SK_TIPORIGA 305
|
||||
#define SK_CONTROEURO 306
|
||||
|
||||
// copie 2a pag.
|
||||
#define K_CODDITTA 401
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cg2100.h"
|
||||
|
||||
TOOLBAR "" 0 20 0 2
|
||||
TOOLBAR "" 0 19 0 3
|
||||
#include <toolbar.h>
|
||||
ENDPAGE
|
||||
|
||||
@ -14,7 +14,7 @@ END
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 2 "Codice "
|
||||
FLAGS "FRD"
|
||||
FLAGS "FD"
|
||||
USE LF_NDITTE
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
|
@ -187,7 +187,7 @@ END
|
||||
|
||||
DATE SK_DATACAMBIO
|
||||
BEGIN
|
||||
PROMPT 22 11 "Data cambio "
|
||||
PROMPT 17 11 "Data cambio "
|
||||
FIELD DATACAM
|
||||
FLAGS "R"
|
||||
USE CAM
|
||||
@ -202,17 +202,26 @@ BEGIN
|
||||
CHECKTYPE SEARCH
|
||||
END
|
||||
|
||||
NUMBER SK_CAMBIO 15 5
|
||||
NUMBER SK_CAMBIO 15 6
|
||||
BEGIN
|
||||
PROMPT 52 11 "Cambio "
|
||||
PROMPT 44 11 "Cambio "
|
||||
FIELD CAMBIO
|
||||
FLAGS "RU"
|
||||
GROUP 3 5
|
||||
PICTURE ".5"
|
||||
PICTURE ".6"
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "E' stata specificata una valuta senza il cambio relativo"
|
||||
END
|
||||
|
||||
/*
|
||||
BOOLEAN SK_CONTROEURO
|
||||
BEGIN
|
||||
PROMPT 70 11 "Euro"
|
||||
FIELD CONTROEURO
|
||||
GROUP 3 5
|
||||
END
|
||||
*/
|
||||
|
||||
CURRENCY F_TOTALE 18
|
||||
BEGIN
|
||||
PROMPT 2 12 "Importo movimento "
|
||||
|
@ -146,7 +146,7 @@ END
|
||||
|
||||
STRING F_TIPODOC 2
|
||||
BEGIN
|
||||
PROMPT 32 6 "Tipo documento "
|
||||
PROMPT 31 6 "Tipo documento "
|
||||
FIELD TIPODOC
|
||||
FLAGS "D"
|
||||
END
|
||||
@ -426,7 +426,7 @@ END
|
||||
|
||||
DATE SK_DATACAMBIO
|
||||
BEGIN
|
||||
PROMPT 28 13 "Data cambio "
|
||||
PROMPT 18 13 "Data cambio "
|
||||
FIELD DATACAM
|
||||
FLAGS "R"
|
||||
USE CAM
|
||||
@ -435,17 +435,18 @@ BEGIN
|
||||
INPUT CODTAB[4,11] SK_DATACAMBIO
|
||||
DISPLAY "Cod" CODTAB[1,3]
|
||||
DISPLAY "Data@10" D0
|
||||
DISPLAY "Cambio@18" R10
|
||||
DISPLAY "Cambio@18R" S4
|
||||
DISPLAY "Valuta@50" 104@->S0
|
||||
OUTPUT SK_DATACAMBIO D0
|
||||
OUTPUT SK_CAMBIO R10
|
||||
OUTPUT SK_CAMBIO S4
|
||||
// OUTPUT SK_CONTROEURO B1
|
||||
GROUP 3
|
||||
CHECKTYPE SEARCH
|
||||
END
|
||||
|
||||
NUMBER SK_CAMBIO 15 5
|
||||
BEGIN
|
||||
PROMPT 55 13 "Cambio "
|
||||
PROMPT 44 13 "Cambio "
|
||||
FIELD CAMBIO
|
||||
FLAGS "RU"
|
||||
GROUP 3
|
||||
@ -454,6 +455,15 @@ BEGIN
|
||||
WARNING "Inserire il cambio o eliminare il codice valuta"
|
||||
END
|
||||
|
||||
/*
|
||||
BOOLEAN SK_CONTROEURO
|
||||
BEGIN
|
||||
PROMPT 71 13 "Euro"
|
||||
FIELD CONTROEURO
|
||||
GROUP 3
|
||||
END
|
||||
*/
|
||||
|
||||
CURRENCY F_TOTALE 18
|
||||
BEGIN
|
||||
PROMPT 1 14 "Totale documento "
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define P_DATACAMBIO 110
|
||||
#define P_CAMBIO 111
|
||||
#define P_RESIDUOVAL 112
|
||||
#define P_CONTROEURO 113
|
||||
|
||||
#define P_SHOWALL 180
|
||||
#define P_NUOVO 182
|
||||
|
@ -19,7 +19,7 @@ ENDPAGE
|
||||
|
||||
PAGE "PARTITE" -1 -1 77 20
|
||||
|
||||
STRING P_DESCR 70
|
||||
STRING P_DESCR 78
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
FLAGS "D"
|
||||
@ -33,23 +33,25 @@ END
|
||||
|
||||
DATE P_DATACAMBIO
|
||||
BEGIN
|
||||
PROMPT 18 2 "Data cambio "
|
||||
PROMPT 15 2 "Data cambio "
|
||||
FLAGS "DR"
|
||||
USE CAM
|
||||
INPUT CODTAB[1,3] P_VALUTA SELECT
|
||||
INPUT CODTAB[4,11] P_DATACAMBIO
|
||||
DISPLAY "Valuta" CODTAB[1,3]
|
||||
DISPLAY "Data@10" D0
|
||||
DISPLAY "Cambio@18" R10
|
||||
DISPLAY "Cambio@18R" S4
|
||||
// DISPLAY "Contro Euro" B1
|
||||
OUTPUT P_DATACAMBIO D0
|
||||
OUTPUT P_CAMBIO R10
|
||||
OUTPUT P_CAMBIO S4
|
||||
// OUTPUT P_CONTROEURO B1
|
||||
CHECKTYPE SEARCH
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
NUMBER P_CAMBIO 15 5
|
||||
BEGIN
|
||||
PROMPT 48 2 "Cambio "
|
||||
PROMPT 43 2 "Cambio "
|
||||
FLAGS "DU"
|
||||
GROUP 3
|
||||
PICTURE ".5"
|
||||
@ -57,6 +59,14 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
/*
|
||||
BOOLEAN P_CONTROEURO
|
||||
BEGIN
|
||||
PROMPT 73 2 "Euro"
|
||||
GROUP 3
|
||||
END
|
||||
*/
|
||||
|
||||
NUMBER P_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 1 3 "Partita "
|
||||
|
112
cg/cg2102.cpp
112
cg/cg2102.cpp
@ -56,9 +56,19 @@ const real& TPrimanota_application::cod2IVA(const TMask& m)
|
||||
// Certified 99% Non sono sicurissimo degli imponibili negativi
|
||||
real TPrimanota_application::scorpora(real& imponibile, const real& percent)
|
||||
{
|
||||
real imposta = abs(imponibile) * percent / (percent + 100.0);
|
||||
imposta.ceil(TCurrency::get_firm_dec());
|
||||
if (imponibile.sign() < 0) imposta = -imposta;
|
||||
real imposta;
|
||||
const int dec = TCurrency::get_firm_dec();
|
||||
if (dec == 0) // Gestione Lire
|
||||
{
|
||||
imposta = abs(imponibile) * percent / (percent + 100.0);
|
||||
imposta.ceil();
|
||||
if (imponibile.sign() < 0) imposta = -imposta;
|
||||
}
|
||||
else
|
||||
{ // Gestione Euro
|
||||
imposta = imponibile * percent / (percent + 100.0);
|
||||
imposta.round(dec);
|
||||
}
|
||||
imponibile -= imposta;
|
||||
return imposta;
|
||||
}
|
||||
@ -94,7 +104,7 @@ bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
const TEdit_field& c = (const TEdit_field&)f;
|
||||
const TBrowse* b = c.browse();
|
||||
CHECKD(b, "Can't check suspension of a edit-field without a USE ", f.dlg());
|
||||
CHECKD(b, "Can't check suspension of an edit-field without a USE ", f.dlg());
|
||||
const TLocalisamfile& i = b->cursor()->file();
|
||||
// Tabella File
|
||||
const char* sf = i.tab() ? "B2" : "SOSPESO";
|
||||
@ -117,7 +127,7 @@ bool TPrimanota_application::detraibile(TToken_string& row)
|
||||
if (a.iva() == iva_vendite) // Vendite sempre detraibili
|
||||
return TRUE;
|
||||
|
||||
const int tipo_det = row.get_int(2); // Leggi tipo detraibilita
|
||||
const int tipo_det = row.get_int(2); // Leggi tipo detraibilita
|
||||
if (tipo_det != 0)
|
||||
return FALSE;
|
||||
|
||||
@ -582,8 +592,11 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
if (!saldo.get_num().is_zero())
|
||||
{
|
||||
const char* ss = saldo.string(TRUE);
|
||||
if (*ss == '-') ss++;
|
||||
return f.error_box("Il movimento e' sbilanciato di %s lire.", ss);
|
||||
if (*ss == '-') ss++;
|
||||
|
||||
const TRectype & rec = cache().get("%VAL", TCurrency::get_firm_val());
|
||||
const char * name = rec.empty() ? "Lire" : (const char *) rec.get("S0");
|
||||
return f.error_box("Il movimento e' sbilanciato di %s %s.", ss, name);
|
||||
}
|
||||
|
||||
TMask& m = f.mask();
|
||||
@ -872,6 +885,8 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
case K_SPACE:
|
||||
if (tipo == 'G')
|
||||
old_spesa = row;
|
||||
else
|
||||
old_spesa.valore() = ZERO;
|
||||
break;
|
||||
case K_TAB:
|
||||
if (!selecting)
|
||||
@ -880,7 +895,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
if (row.empty_items())
|
||||
{
|
||||
selecting = TRUE;
|
||||
cg.select(r); // Vado alla prima colonna delle righe vuote
|
||||
cg.select(r, 1); // Vado alla prima colonna delle righe vuote
|
||||
selecting = FALSE;
|
||||
}
|
||||
}
|
||||
@ -888,6 +903,8 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
case K_DEL:
|
||||
if (tipo == 'G')
|
||||
{
|
||||
if (old_spesa.is_zero())
|
||||
old_spesa = row;
|
||||
row.add("", 0);
|
||||
row.add("", 1);
|
||||
}
|
||||
@ -1064,7 +1081,7 @@ TSheet_field& TPrimanota_application::ivas() const
|
||||
}
|
||||
|
||||
// Gestione del campo imponibile sullo sheet iva
|
||||
// Certified 90%
|
||||
// Certified 99%
|
||||
bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB && f.dirty())
|
||||
@ -1074,7 +1091,8 @@ bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)
|
||||
if (iva.empty())
|
||||
{
|
||||
iva = app().curr_mask().get(F_CODIVA);
|
||||
m.set(102, iva);
|
||||
if (iva.not_empty())
|
||||
m.set(102, iva, TRUE);
|
||||
}
|
||||
if (iva.not_empty() && !app().causale().corrispettivi())
|
||||
{
|
||||
@ -1100,10 +1118,10 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
|
||||
if (key == K_TAB && f.dirty())
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
|
||||
TCodiceIVA iva(f.get());
|
||||
|
||||
if (m.get_int(107) == 0)
|
||||
{
|
||||
TCodiceIVA iva(f.get());
|
||||
TBill b; app().IVA2bill(iva, b);
|
||||
|
||||
char cr[2] = { b.tipo_cr() + '0', '\0' };
|
||||
@ -1118,6 +1136,13 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
|
||||
m.set(id+1, b.descrizione());
|
||||
}
|
||||
|
||||
if (app().iva() == iva_acquisti)
|
||||
{
|
||||
const int det = iva.detraibilita();
|
||||
if (det > 0)
|
||||
m.set(103, det);
|
||||
}
|
||||
|
||||
TMask_field& im = m.field(101);
|
||||
im.set_dirty();
|
||||
im.on_hit();
|
||||
@ -1241,7 +1266,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
static int oldpos,oldposiva;
|
||||
static TImporto oldimp, oldiva;
|
||||
static bool selecting = FALSE;
|
||||
|
||||
|
||||
TPrimanota_application& a = app();
|
||||
if (a._as400)
|
||||
return TRUE;
|
||||
@ -1257,7 +1282,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
if (!selecting && row.empty_items())
|
||||
{
|
||||
selecting = TRUE;
|
||||
iva.select(r); // Vado alla prima colonna delle righe vuote
|
||||
iva.select(r, 1); // Vado alla prima colonna delle righe vuote
|
||||
selecting = FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -1430,7 +1455,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
if (a.is_fattura() && m.insert_mode())
|
||||
{
|
||||
TPagamento& pag = a.pagamento();
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
const bool inv = cambio.in_valuta();
|
||||
real imposta, imponibile;
|
||||
if (inv)
|
||||
@ -2225,6 +2250,10 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
|
||||
if (iva.codice() != row.get(1))
|
||||
{
|
||||
row.add(iva.codice(), 1); // Aggiorna codice IVA
|
||||
|
||||
const int det = iva.detraibilita();
|
||||
if (det > 0) row.add(det, 2);
|
||||
|
||||
TBill bill; // Aggiorna conto della prima riga IVA
|
||||
a.IVA2bill(iva, bill);
|
||||
bill.add_to(row, 4, 0x7);
|
||||
@ -2250,7 +2279,7 @@ void TPrimanota_application::gioca_cambi(int force)
|
||||
|
||||
if ( (force == 0x1 || totale.is_zero()) && !(totval.is_zero() || cambio.is_zero()) )
|
||||
{
|
||||
const TValuta cam(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
const TValuta cam(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
const real new_totale = cam.val2lit(totval);
|
||||
if (new_totale != totale)
|
||||
m.set(F_TOTALE, new_totale, TRUE);
|
||||
@ -2258,7 +2287,7 @@ void TPrimanota_application::gioca_cambi(int force)
|
||||
|
||||
if ( (force == 0x2 || totval.is_zero()) && !(totale.is_zero() || cambio.is_zero()) )
|
||||
{
|
||||
const TValuta cam(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
const TValuta cam(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
const real new_totval = cam.lit2val(totale);
|
||||
if (new_totval != totval)
|
||||
m.set(SK_TOTDOCVAL, new_totval, TRUE);
|
||||
@ -2266,7 +2295,16 @@ void TPrimanota_application::gioca_cambi(int force)
|
||||
|
||||
if ( (force == 0x4 || cambio.is_zero()) && !(totale.is_zero() || totval.is_zero()) )
|
||||
{
|
||||
real new_cambio = totale / totval; new_cambio.round(5);
|
||||
real new_cambio = totale / totval;
|
||||
if (m.id2pos(SK_CONTROEURO) >= 0)
|
||||
m.reset(SK_CONTROEURO);
|
||||
|
||||
bool dummy_contro_euro;
|
||||
const real& fc = TCurrency::get_firm_change(dummy_contro_euro);
|
||||
if (fc > ZERO && fc != 1.0)
|
||||
new_cambio *= fc;
|
||||
|
||||
new_cambio.round(6);
|
||||
if (new_cambio != cambio)
|
||||
m.set(SK_CAMBIO, new_cambio, TRUE);
|
||||
}
|
||||
@ -2306,13 +2344,13 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
|
||||
|
||||
if (ok)
|
||||
{
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
if (cambio.in_valuta())
|
||||
{
|
||||
const real totval(m.get(SK_TOTDOCVAL));
|
||||
const TCurrency totlit(cambio.val2lit(totval));
|
||||
if (totale != totlit)
|
||||
ok = f.yesno_box("Il totale documento in lire dovrebbe essere %s: continuare ugualmente?",
|
||||
ok = f.yesno_box("Il totale documento dovrebbe essere %s: continuare ugualmente?",
|
||||
totlit.string(TRUE));
|
||||
}
|
||||
}
|
||||
@ -2449,23 +2487,24 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
|
||||
if (key == K_TAB && f.focusdirty())
|
||||
{
|
||||
if (m.get(F_CORRVALUTA).empty())
|
||||
{
|
||||
const real cambio = m.get(F_CAMBIOINTRA);
|
||||
if (cambio != ZERO && m.get(F_CORRVALUTA).empty())
|
||||
{
|
||||
real c(f.get());
|
||||
c /= cambio;
|
||||
m.set(F_CORRVALUTA, c.string());
|
||||
}
|
||||
{
|
||||
const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO);
|
||||
const real corrlit = f.get();
|
||||
real corrval = cambio.lit2val(corrlit);
|
||||
m.set(F_CORRVALUTA, corrval);
|
||||
}
|
||||
}
|
||||
|
||||
if (key == K_ENTER)
|
||||
{
|
||||
const real im(m.get_real(F_IMPONIBILI));
|
||||
const real im(m.get(F_IMPONIBILI));
|
||||
const real cl(f.get());
|
||||
if (im != cl)
|
||||
warning_box("Il corrispettivo in lire e' diverso dal totale degli imponibili");
|
||||
if (im != cl)
|
||||
{
|
||||
const TRectype& rec = cache().get("%VAL", TCurrency::get_firm_val());
|
||||
const char* name = rec.empty() ? "Lire" : (const char*)rec.get("S0");
|
||||
warning_box("Il corrispettivo in %s e' diverso dal totale degli imponibili", name);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -2480,13 +2519,10 @@ bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key)
|
||||
TMask& m = f.mask();
|
||||
if (m.get(F_CORRLIRE).empty())
|
||||
{
|
||||
const real cambio = m.get(F_CAMBIOINTRA);
|
||||
if (cambio != ZERO)
|
||||
{
|
||||
real c = f.get();
|
||||
c *= cambio;
|
||||
m.set(F_CORRLIRE, c.string());
|
||||
}
|
||||
const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO);
|
||||
const real corrval = f.get();
|
||||
real corrlit = cambio.val2lit(corrval);
|
||||
m.set(F_CORRLIRE, corrlit);
|
||||
}
|
||||
} else
|
||||
if (key == K_ENTER && f.get().empty())
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <prefix.h>
|
||||
#include <recarray.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "cg2103.h"
|
||||
@ -32,14 +31,19 @@ bool TCausale::read(const char* cod, int year)
|
||||
_corrisp = FALSE;
|
||||
|
||||
if (*cod > ' ')
|
||||
{
|
||||
{
|
||||
int err;
|
||||
/*
|
||||
TLocalisamfile caus(LF_CAUSALI);
|
||||
caus.put(CAU_CODCAUS, cod);
|
||||
|
||||
int err = caus.read();
|
||||
err = caus.read();
|
||||
if (err != NOERR)
|
||||
return FALSE;
|
||||
_rec = caus.curr();
|
||||
*/
|
||||
_rec = cache().get(LF_CAUSALI, cod);
|
||||
if (_rec.empty())
|
||||
return FALSE;
|
||||
|
||||
TLocalisamfile rcaus(LF_RCAUSALI);
|
||||
rcaus.put(CAU_CODCAUS, cod);
|
||||
@ -60,7 +64,7 @@ bool TCausale::read(const char* cod, int year)
|
||||
if (row(riga) == NULL) add(rcaus.curr(), riga);
|
||||
*/
|
||||
|
||||
const TString codreg(caus.get(CAU_REG));
|
||||
const TString16 codreg(_rec.get(CAU_REG));
|
||||
const bool ok = _reg.read(codreg, year); // Read register
|
||||
if (!ok && codreg.not_empty())
|
||||
return error_box("Non esiste il registro '%s' del %d",
|
||||
@ -97,10 +101,14 @@ const char* TCausale::desc_agg(int num) const
|
||||
const TString& cod = rec->get(RCA_CODDESC);
|
||||
if (cod.not_empty())
|
||||
{
|
||||
/*
|
||||
TTable da("%DPN");
|
||||
da.put("CODTAB", cod);
|
||||
if (da.read() == NOERR)
|
||||
deag = da.get("S0");
|
||||
*/
|
||||
const TRectype& da = cache().get("%DPN", cod);
|
||||
deag = da.get("S0");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,10 +281,13 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
||||
const TString is = curr.string(TRUE);
|
||||
curr.set_num(totlit);
|
||||
const TString ts = curr.string(TRUE);
|
||||
ok = yesno_box("Il totale in lire delle rate e' %s mentre\n"
|
||||
const TRectype & rec = cache().get("%VAL", TCurrency::get_firm_val());
|
||||
const char * name = rec.empty() ? "Lire" : (const char *) rec.get("S0");
|
||||
|
||||
ok = yesno_box("Il totale in %s delle rate e' %s mentre\n"
|
||||
"il totale del documento e' %s.\n"
|
||||
"Si desidera registrare ugualmente?",
|
||||
(const char*)is, (const char*)ts);
|
||||
name, (const char*)is, (const char*)ts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -404,10 +407,6 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
||||
key = K_TAB; // Forza la successiva activate_numrif
|
||||
|
||||
ok = f.error_box("Il numero di riferimento partita e' obbligatorio!");
|
||||
/*
|
||||
"Se possibile esso verra' proposto, ma potra'\n"
|
||||
"essere modificato prima di registrare il movimento.");
|
||||
*/
|
||||
}
|
||||
|
||||
if (key == K_TAB && a.is_fattura())
|
||||
@ -453,6 +452,7 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
|
||||
TEdit_field& dc = m.efield(SK_DATACAMBIO);
|
||||
if (dc.get().empty()) // Inizializza data cambio se assente
|
||||
dc.set(m.get(F_DATADOC));
|
||||
|
||||
if (f.focusdirty())
|
||||
{
|
||||
dc.set_dirty();
|
||||
@ -463,11 +463,11 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
|
||||
TCursor& cur = *dc.browse()->cursor();
|
||||
if (cur.items() == 0) // Uso cambio standard
|
||||
{
|
||||
TCurrency std(1.0, val); // Converto un Marco ...
|
||||
std.change_to_firm_val(); // ... in lire
|
||||
dc.set("31-12-1998"); // Data di passaggio all'Euro
|
||||
TCurrency std(1e6, val); // Converto un Marco ...
|
||||
std.change_to_base_val(); // ... in lire
|
||||
dc.set(cache().get("%VAL", val, "D0"));
|
||||
m.enable(SK_CAMBIO);
|
||||
m.set(SK_CAMBIO, std.get_num(), TRUE);
|
||||
m.set(SK_CAMBIO, real(std.get_num() / 1e6), TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,6 +486,8 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
m.set(SK_CAMBIO, "", TRUE);
|
||||
m.set(SK_TOTDOCVAL, "", TRUE);
|
||||
if (m.id2pos(SK_CONTROEURO) >= 0)
|
||||
m.set(SK_CONTROEURO, "", TRUE);
|
||||
}
|
||||
m.enable(SK_CAMBIO, full);
|
||||
m.enable(SK_TOTDOCVAL, full);
|
||||
@ -649,7 +651,7 @@ bool TPrimanota_application::ratalit_handler(TMask_field& f, KEY key)
|
||||
const TPagamento& pag = app().pagamento();
|
||||
if (pag.in_valuta())
|
||||
{
|
||||
const TValuta v(m, FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO);
|
||||
const TValuta v(m, FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO, SK_CONTROEURO);
|
||||
const real other(f.mask().get(103));
|
||||
const char* s = v.val2lit(other).string();
|
||||
f.set(s);
|
||||
@ -665,7 +667,7 @@ bool TPrimanota_application::rataval_handler(TMask_field& f, KEY key)
|
||||
TPagamento& pag = app().pagamento();
|
||||
if (pag.in_valuta())
|
||||
{
|
||||
const TValuta v(app().curr_mask(), FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO);
|
||||
const TValuta v(app().curr_mask(), FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO, SK_CONTROEURO);
|
||||
const real other(f.mask().get(102));
|
||||
TString80 s(v.lit2val(other).string());
|
||||
f.set(s);
|
||||
@ -717,7 +719,7 @@ void TPrimanota_application::set_totale_pagamento(bool update)
|
||||
const real imponibile = m.get_real(F_TOTALE) - imposta;
|
||||
const real spese = ZERO;
|
||||
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
if (cambio.in_valuta())
|
||||
{
|
||||
const real imposval = cambio.lit2val(imposta);
|
||||
@ -918,7 +920,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
const TString desc(m.get(F_DESCR));
|
||||
const TString codpag(m.get(F_CODPAG));
|
||||
const TString codcaus(causale().codice());
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
const TString agente(m.get(FS_AGENTE));
|
||||
const char sezione = get_cgs_imp(0).sezione(); // Dare/Avere
|
||||
|
||||
@ -1138,13 +1140,29 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
||||
// Importo della contropartita
|
||||
if (!new_importo.is_zero() && new_conto.ok())
|
||||
{
|
||||
const int new_riga = bill2pos(new_conto, 'I');
|
||||
int new_riga = bill2pos(new_conto, 'I');
|
||||
if (new_riga < 0)
|
||||
{
|
||||
const int tp = somma.get_int(PART_TIPOPAG);
|
||||
const int da = p.tipopag2causale(tp);
|
||||
const TString descagg(causale().desc_agg(da));
|
||||
set_cgs_row(new_riga, new_importo, new_conto, descagg, 'I');
|
||||
new_riga = set_cgs_row(new_riga, new_importo, new_conto, descagg, 'I');
|
||||
|
||||
TToken_string& cli_row = sheet.row(riga_contabile-1);
|
||||
TBill contro; contro.get(cli_row, 9, 0x3);
|
||||
if (!contro.ok()) // Completa controparita della riga cliente se necessario
|
||||
new_conto.add_to(cli_row, 9, 0x3);
|
||||
TString80 descr = cli_row.get(CG_DESCR-FIRST_FIELD);
|
||||
if (descr.blank()) // Compila descrizione della riga cliente se necessario
|
||||
{
|
||||
descr = somma.get(PART_DESCR);
|
||||
cli_row.add(descr, CG_DESCR-FIRST_FIELD);
|
||||
}
|
||||
|
||||
// Compila contropartita della nuova riga
|
||||
TBill clifo; clifo.get(cli_row, 2, 0x3);
|
||||
TToken_string& new_row = sheet.row(new_riga);
|
||||
clifo.add_to(new_row, 9, 0x3);
|
||||
}
|
||||
else
|
||||
add_cgs_imp(new_riga, new_importo);
|
||||
|
134
cg/cg2105.cpp
134
cg/cg2105.cpp
@ -23,7 +23,7 @@
|
||||
|
||||
class TGame_mask : public TMask
|
||||
{
|
||||
const TBill _conto; // Conto fisso del cliente/fornitore
|
||||
TBill _conto; // Conto fisso del cliente/fornitore
|
||||
long _numreg; // Numero movimento contabile
|
||||
int _numrig; // Riga contabile corrente (prima = 1!)
|
||||
TImporto _importo; // Importo su riga contabile
|
||||
@ -32,8 +32,6 @@ class TGame_mask : public TMask
|
||||
bool _changed; // Flag di modifica partite
|
||||
bool _valfirst; // La colonna della valuta precede le lire
|
||||
|
||||
TDecoder _causali; // Decodificatore delle causali
|
||||
|
||||
protected:
|
||||
static bool annopart_handler(TMask_field& f, KEY k);
|
||||
static bool numpart_handler(TMask_field& f, KEY k);
|
||||
@ -86,6 +84,7 @@ public:
|
||||
const TImporto& residuo(bool val) const { return val ? _resval : _residuo; }
|
||||
bool changed() const { return _changed; }
|
||||
|
||||
void init(const TBill& bill, long numreg, int riga);
|
||||
TGame_mask(const TBill& bill, long numreg, int riga);
|
||||
virtual ~TGame_mask() {}
|
||||
};
|
||||
@ -100,11 +99,10 @@ class TPay_mask : public TMask
|
||||
{
|
||||
TDate _datadoc;
|
||||
real _da_pagare, _pagabile;
|
||||
const TGame_mask& _parent;
|
||||
const TGame_mask* _parent;
|
||||
|
||||
tipo_movimento _tipomov;
|
||||
|
||||
TDecoder _causale;
|
||||
bool _assigned;
|
||||
bool _can_solder;
|
||||
|
||||
@ -134,7 +132,8 @@ public:
|
||||
|
||||
void attiva_valuta(bool on);
|
||||
|
||||
TPay_mask(const TGame_mask& parent, int mode);
|
||||
void init(const TGame_mask* parent, int mode);
|
||||
TPay_mask(const TGame_mask* parent, int mode);
|
||||
virtual ~TPay_mask();
|
||||
};
|
||||
|
||||
@ -142,12 +141,11 @@ public:
|
||||
const char* const PAYMASK = "sc0100b";
|
||||
#else
|
||||
const char* const PAYMASK = "cg2100s";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TPay_mask::TPay_mask(const TGame_mask& parent, int mod)
|
||||
: TMask(PAYMASK), _parent(parent),
|
||||
_causale(LF_CAUSALI, CAU_DESCR)
|
||||
{
|
||||
void TPay_mask::init(const TGame_mask* parent, int mod)
|
||||
{
|
||||
_parent = parent;
|
||||
set_mode(mod);
|
||||
enable(DLG_DELREC, edit_mode());
|
||||
|
||||
@ -179,20 +177,22 @@ TPay_mask::TPay_mask(const TGame_mask& parent, int mod)
|
||||
set_handler(E_DESCR, descr_handler);
|
||||
set_handler(S_DESCAGG, descr_handler);
|
||||
|
||||
const char a = TPartita::allineamento_richiesto(parent.conto().tipo());
|
||||
const char a = TPartita::allineamento_richiesto(parent->conto().tipo());
|
||||
field(E_NUMRIF).set_justify(a == 'R');
|
||||
|
||||
disable(E_ANNORIF);
|
||||
disable(E_NUMRIF);
|
||||
#endif
|
||||
}
|
||||
|
||||
TPay_mask::TPay_mask(const TGame_mask* parent, int mod)
|
||||
: TMask(PAYMASK)
|
||||
{
|
||||
init(parent, mod);
|
||||
}
|
||||
|
||||
TPay_mask::~TPay_mask()
|
||||
{
|
||||
#ifdef __EXTRA__
|
||||
xvt_statbar_set("Estratto conto", TRUE);
|
||||
#endif
|
||||
}
|
||||
{ }
|
||||
|
||||
void TPay_mask::attiva_valuta(bool in_valuta)
|
||||
{
|
||||
@ -265,7 +265,7 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
||||
if (desfat.empty()) // Se e' vuota ...
|
||||
{
|
||||
desfat = fatt.get(PART_CODCAUS);
|
||||
desfat = _causale.decode(desfat); // ... usa descrizione causale
|
||||
desfat = cache().get(LF_CAUSALI, desfat, CAU_DESCR); // ... usa descrizione causale
|
||||
}
|
||||
set(S_DESCR, desfat);
|
||||
|
||||
@ -313,7 +313,7 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
||||
_da_pagare += oldimp;
|
||||
|
||||
#ifndef __EXTRA__
|
||||
_pagabile = _parent.residuo(in_valuta).valore();
|
||||
_pagabile = _parent->residuo(in_valuta).valore();
|
||||
|
||||
TReal_field& resp = (TReal_field&)field(S_RESIDUOPAG);
|
||||
resp.set_decimals(in_valuta ? 3 : 0);
|
||||
@ -375,9 +375,9 @@ void TPay_mask::gioca_cambi(int force)
|
||||
const real totval = get(S_IMPORTOVAL);
|
||||
|
||||
#ifdef __EXTRA__
|
||||
const TValuta cambio(*this, E_VALUTA, E_DATACAMBIO, E_CAMBIO);
|
||||
const TValuta cambio(*this, E_VALUTA, E_DATACAMBIO, E_CAMBIO, E_CONTROEURO);
|
||||
#else
|
||||
const TValuta cambio(_parent, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
const TValuta cambio(*_parent, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO);
|
||||
#endif
|
||||
|
||||
if ( (force == 0x1 || totale.is_zero()) && !(totval.is_zero() || cambio.in_lire()) )
|
||||
@ -543,6 +543,8 @@ protected:
|
||||
static bool tipomov_handler(TMask_field& f, KEY k);
|
||||
|
||||
public:
|
||||
void init(char tipocf, bool fatt, bool edit);
|
||||
|
||||
TNew_mask(char tipocf, bool fatt, bool edit);
|
||||
virtual ~TNew_mask() {}
|
||||
};
|
||||
@ -559,9 +561,10 @@ bool TNew_mask::tipomov_handler(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TNew_mask::TNew_mask(char tipocf, bool fatt, bool edit)
|
||||
: TMask("cg2100n"), _allow_fatt(fatt)
|
||||
{
|
||||
void TNew_mask::init(char tipocf, bool fatt, bool edit)
|
||||
{
|
||||
_allow_fatt = fatt;
|
||||
|
||||
TMask_field& tipomov = field(P_NUOVO);
|
||||
#ifdef __EXTRA__
|
||||
tipomov.set_handler(tipomov_handler);
|
||||
@ -579,6 +582,12 @@ TNew_mask::TNew_mask(char tipocf, bool fatt, bool edit)
|
||||
|
||||
const char a = TPartita::allineamento_richiesto(tipocf);
|
||||
field(P_NUMERO).set_justify(a == 'R');
|
||||
}
|
||||
|
||||
TNew_mask::TNew_mask(char tipocf, bool fatt, bool edit)
|
||||
: TMask("cg2100n")
|
||||
{
|
||||
init(tipocf, fatt, edit);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -599,10 +608,12 @@ void TGame_mask::append_conto(TString& s) const
|
||||
s << ' ' << conto().sottoconto();
|
||||
}
|
||||
|
||||
TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
|
||||
: TMask("cg2100p"), _conto(bill), _numreg(numreg), _numrig(riga),
|
||||
_changed(FALSE), _valfirst(FALSE), _causali(LF_CAUSALI, CAU_DESCR)
|
||||
{
|
||||
void TGame_mask::init(const TBill& bill, long numreg, int riga)
|
||||
{
|
||||
_conto = bill;
|
||||
_numreg = numreg; _numrig = riga;
|
||||
_changed = FALSE;
|
||||
|
||||
TString descr(80);
|
||||
append_conto(descr);
|
||||
descr << ' ' << ((TBill&)_conto).descrizione();
|
||||
@ -626,7 +637,7 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
|
||||
else
|
||||
{
|
||||
TMask& cm = app().curr_mask(); // Legge valuta dal movimento
|
||||
val.get(cm, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
val.get(cm, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
|
||||
if (cm.id2pos(F_ANNORIF) > 0) // Se in testata c'e' l'anno di riferimento
|
||||
{
|
||||
@ -653,6 +664,12 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
|
||||
fill_partite(); // Riempie sheet partite
|
||||
}
|
||||
|
||||
TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
|
||||
: TMask("cg2100p"), _valfirst(FALSE)
|
||||
{
|
||||
init(bill, numreg, riga);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Handlers dei campi e della maschera principale
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -720,7 +737,7 @@ bool TGame_mask::cambio_handler(TMask_field& f, KEY k)
|
||||
const bool needed = app().partite().mov2rig(gm._numreg, gm._numrig) > 0;
|
||||
if (needed && yesno_box("Aggiornare gli importi dei pagamenti?"))
|
||||
{
|
||||
const TValuta val(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
const TValuta val(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO);
|
||||
gm.aggiorna_valuta(val);
|
||||
}
|
||||
gm.aggiorna_residuo();
|
||||
@ -747,7 +764,7 @@ void TGame_mask::aggiorna_residuo()
|
||||
_residuo.normalize(sez);
|
||||
set(P_RESIDUO, _residuo.valore());
|
||||
|
||||
const TValuta cambio(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
const TValuta cambio(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO);
|
||||
if (cambio.in_valuta())
|
||||
{
|
||||
// Importo della riga contabile senza differenza cambi
|
||||
@ -1192,7 +1209,7 @@ int TGame_mask::nuova_riga(TPartita& partita, tipo_movimento tm) const
|
||||
part.put(PART_DATAREG, s);
|
||||
#else
|
||||
// Setta il cambio corrente
|
||||
const TValuta valuta(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
const TValuta valuta(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO);
|
||||
valuta.put(part);
|
||||
|
||||
TMask& cm = app().curr_mask();
|
||||
@ -1281,7 +1298,7 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov
|
||||
bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const int nriga = m.get_int(101); // Numero riga fattura
|
||||
|
||||
@ -1314,7 +1331,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
|
||||
#ifndef __EXTRA__
|
||||
const TValuta parval(game.riga(nriga));
|
||||
const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO);
|
||||
if (parval != curval)
|
||||
{
|
||||
TString c = parval.codice();
|
||||
@ -1432,8 +1449,13 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||
const bool allow_fatt = TRUE;
|
||||
#else
|
||||
const bool allow_fatt = FALSE;
|
||||
#endif
|
||||
TMask* new_game = new TNew_mask(gm.conto().tipo(), allow_fatt, TRUE);
|
||||
#endif
|
||||
|
||||
static TNew_mask* new_game = NULL;
|
||||
if (new_game == NULL)
|
||||
new_game = new TNew_mask(gm.conto().tipo(), allow_fatt, TRUE);
|
||||
else
|
||||
new_game->init(gm.conto().tipo(), allow_fatt, TRUE);
|
||||
|
||||
tipo_movimento tm;
|
||||
|
||||
@ -1454,7 +1476,7 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||
numero = new_game->get(P_NUMERO);
|
||||
|
||||
// Distruzione maschera di richiesta
|
||||
delete new_game; new_game = NULL;
|
||||
// delete new_game; new_game = NULL;
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
@ -1523,7 +1545,7 @@ void TGame_mask::add_descrizione(TToken_string& s, const TRiga_partite& riga, in
|
||||
{
|
||||
const TString& caus = riga.get(PART_CODCAUS);
|
||||
if (caus.not_empty())
|
||||
s.add(_causali.decode(caus), pos);
|
||||
s.add(cache().get(LF_CAUSALI, caus, CAU_DESCR));
|
||||
else
|
||||
s.add("", pos);
|
||||
}
|
||||
@ -1533,7 +1555,7 @@ void TGame_mask::add_descrizione(TToken_string& s, const TRiga_partite& riga, in
|
||||
|
||||
TImporto TGame_mask::get_importo(TToken_string& s, int pos) const
|
||||
{
|
||||
const TFixed_string imp(s.get(pos));
|
||||
TFixed_string imp(s.get(pos)); imp.replace(',', '.');
|
||||
const real i(imp);
|
||||
const char sez = imp.right(1)[0];
|
||||
return TImporto(sez, i);
|
||||
@ -1758,9 +1780,16 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
||||
const bool nuovo = oldpag.get(PAGSCA_ACCSAL) != "S" &&
|
||||
oldpag.get_real(PAGSCA_IMPORTO).is_zero() &&
|
||||
oldpag.get_real(PAGSCA_RITENUTE).is_zero();
|
||||
|
||||
|
||||
/*
|
||||
TPay_mask m(this, nuovo ? MODE_INS : MODE_MOD);
|
||||
*/
|
||||
// We must create masks on the heap
|
||||
TPay_mask* pm = new TPay_mask(*this, nuovo ? MODE_INS : MODE_MOD);
|
||||
static TPay_mask* pm = NULL;
|
||||
if (pm == NULL)
|
||||
pm = new TPay_mask(this, nuovo ? MODE_INS : MODE_MOD);
|
||||
else
|
||||
pm->init(this, nuovo ? MODE_INS : MODE_MOD);
|
||||
TPay_mask& m = *pm;
|
||||
|
||||
if (nriga == TPartita::UNASSIGNED)
|
||||
@ -1783,7 +1812,7 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
||||
}
|
||||
|
||||
KEY key = m.run();
|
||||
|
||||
|
||||
if (key == K_DEL)
|
||||
{
|
||||
const bool truly = yesno_box("Confermare l'eliminazione");
|
||||
@ -1819,7 +1848,12 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
||||
app().notify_edit_pagamento(p, newpag, val);
|
||||
#endif
|
||||
}
|
||||
delete pm; // Perche' commentarla ?
|
||||
|
||||
// delete pm; // commentata in quanto statica
|
||||
#ifdef __EXTRA__
|
||||
xvt_statbar_set("Estratto conto", TRUE);
|
||||
#endif
|
||||
|
||||
return key != K_ESC;
|
||||
}
|
||||
|
||||
@ -1854,13 +1888,21 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
||||
if (curr_mask().insert_mode())
|
||||
numreg = NUMREG_PROVVISORIO;
|
||||
|
||||
partite().update_reg(pn->curr());
|
||||
partite().update_reg(pn->curr());
|
||||
|
||||
// Esecuzione maschera di selezione partite
|
||||
TGame_mask* mask = new TGame_mask(b, numreg, riga+1);
|
||||
TGame_mask* mask = NULL;
|
||||
|
||||
if (mask == NULL)
|
||||
mask = new TGame_mask(b, numreg, riga+1);
|
||||
else
|
||||
mask->init(b, numreg, riga+1);
|
||||
|
||||
mask->run();
|
||||
|
||||
const bool changed = mask->changed();
|
||||
delete mask;
|
||||
|
||||
// delete mask;
|
||||
|
||||
if (changed)
|
||||
{
|
||||
|
@ -397,6 +397,8 @@ bool TPrimanota_application::easydoc_installed()
|
||||
{
|
||||
// check autorization
|
||||
if (!has_module(AIAUT))
|
||||
{
|
||||
_EasyDocPath = " ";
|
||||
return FALSE;
|
||||
return os_get_image_editor_path(_EasyDocPath);
|
||||
}
|
||||
@ -404,7 +406,7 @@ bool TPrimanota_application::easydoc_installed()
|
||||
// Il documento attuale e' connesso a easydoc?
|
||||
bool TPrimanota_application::easydoc_connected()
|
||||
{
|
||||
return _EasyDocPath.not_empty();
|
||||
return !_EasyDocPath.blank();
|
||||
}
|
||||
|
||||
bool TPrimanota_application::run_easydoc(const char* azione) const
|
||||
|
@ -14,11 +14,11 @@ BEGIN
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT 108 CODTAB
|
||||
OUTPUT 109 S0
|
||||
OUTPUT CG_DESCR S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING 109 50
|
||||
STRING CG_DESCR 50
|
||||
BEGIN
|
||||
PROMPT 12 2 ""
|
||||
USE %DPN KEY 2
|
||||
@ -316,9 +316,10 @@ END
|
||||
NUMBER 115 7
|
||||
BEGIN
|
||||
PROMPT 2 13 "******* "
|
||||
FLAGS "UZ"
|
||||
USE CDC
|
||||
INPUT CODTAB 115
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Codice@7" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT 115 CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
|
@ -20,7 +20,7 @@ BEGIN
|
||||
FLAGS "D"
|
||||
VALIDATE REQIF_FUNC 1 102
|
||||
WARNING "E' necessario specificare anche un importo in valuta"
|
||||
DRIVENBY -SK_VALUTA
|
||||
DRIVENBY -FS_VALUTA
|
||||
END
|
||||
|
||||
NUMBER 104 6 2
|
||||
|
@ -98,7 +98,7 @@ BEGIN
|
||||
INPUT CODTAB[4,11] FS_DATACAMBIO
|
||||
DISPLAY "Valuta" CODTAB[1,3]
|
||||
DISPLAY "Data@10" D0
|
||||
DISPLAY "Cambio@18" R10
|
||||
DISPLAY "Cambio@18" S4
|
||||
OUTPUT FS_DATACAMBIO D0
|
||||
OUTPUT FS_CAMBIO R10
|
||||
CHECKTYPE NORMAL
|
||||
|
@ -754,9 +754,9 @@ void TListaMov_application::set_page(int file, int count)
|
||||
_nr = 1;
|
||||
set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG));
|
||||
set_row(_nr,"@30g@22s",FLD(LF_RMOV,RMV_DESCR));
|
||||
set_row(_nr,"@54g@pn",FLD(LF_RMOV,RMV_GRUPPO,"###"));
|
||||
set_row(_nr,"@58g@pn",FLD(LF_RMOV,RMV_CONTO,"###"));
|
||||
set_row(_nr,"@62g@pn",FLD(LF_RMOV,RMV_SOTTOCONTO,"######"));
|
||||
set_row(_nr,"@54g@3,rn",FLD(LF_RMOV,RMV_GRUPPO));
|
||||
set_row(_nr,"@58g@3,rn",FLD(LF_RMOV,RMV_CONTO));
|
||||
set_row(_nr,"@62g@6,rn",FLD(LF_RMOV,RMV_SOTTOCONTO));
|
||||
set_row(_nr,"@69g#.20t",&_descr);
|
||||
_appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
|
||||
if (_appoggio=='D')
|
||||
@ -1156,11 +1156,11 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
||||
uprotiva = uprotiva.mid(i);
|
||||
set_row(2, "@24g/@25g%s", (const char*) uprotiva);
|
||||
}
|
||||
set_row(2, "@33g@d", FLD(LF_MOV,MOV_DATADOC));
|
||||
set_row(2,"@42g@6,rs",FLD(LF_MOV,MOV_NUMDOC));
|
||||
set_row(2,"@49g@3s",FLD(LF_MOV,MOV_CODCAUS));
|
||||
set_row(2,"@53g@2s",FLD(LF_MOV,MOV_TIPODOC));
|
||||
set_row(2,"@56g%-.12s", (const char *)_descr_doc);
|
||||
set_row(2, "@32g@d", FLD(LF_MOV,MOV_DATADOC));
|
||||
set_row(2,"@41g@6,rs",FLD(LF_MOV,MOV_NUMDOC));
|
||||
set_row(2,"@48g@3s",FLD(LF_MOV,MOV_CODCAUS));
|
||||
set_row(2,"@52g@2s",FLD(LF_MOV,MOV_TIPODOC));
|
||||
set_row(2,"@55g%-.12s", (const char *)_descr_doc);
|
||||
set_row(2,"@67g@n",FLD(LF_MOV,MOV_TOTDOC));
|
||||
set_row(2,"@84g@n",FLD(LF_RMOVIVA,RMI_IMPONIBILE));
|
||||
set_row(2,"@101g@4s",FLD(LF_RMOVIVA,RMI_CODIVA));
|
||||
@ -2426,8 +2426,8 @@ void TListaMov_application::preprocess_header()
|
||||
}
|
||||
sep.fill('-');
|
||||
set_header (++soh, (const char *) sep);
|
||||
set_header (++soh, "Numero Data Cod Prot. M Documento@49gCod Tp @75gTotale@101gCd Tp T O@129gNo");
|
||||
set_header (++soh, "Regis. Operaz. Reg Num. L Data@42gNumero@49gCau Dc @56gDescrizione@75gDocumento@90gImponibile@101gIv Det A I@121gImposta@129gAll");
|
||||
set_header (++soh, "Numero Data Cod Prot. M Documento@48gCod Tp @75gTotale@101gCd Tp T O@129gNo");
|
||||
set_header (++soh, "Regis. Operaz. Reg Num. L Data@41gNumero@48gCau Dc @55gDescrizione@75gDocumento@90gImponibile@101gIv Det A I@121gImposta@129gAll");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
10
cg/cg4.cpp
10
cg/cg4.cpp
@ -1,19 +1,13 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#define __MAIN__
|
||||
#include "cg4.h"
|
||||
|
||||
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5|6|7|8}";
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = argc > 1 ? atoi(argv[1]+1) : -1;
|
||||
|
||||
const int n = argc > 1 ? argv[1][1]-'0' : 0;
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
cg4100(argc,argv); break; // Rinumerazione
|
||||
case 1:
|
||||
cg4200(argc,argv); break; // Copia archivi
|
||||
case 2:
|
||||
@ -33,7 +27,7 @@ int main(int argc,char** argv)
|
||||
case 9:
|
||||
cg4a00(argc,argv); break; // Gestione Autotrasportatori
|
||||
default:
|
||||
error_box(usage, argv[0]);
|
||||
cg4100(argc,argv); break; // Rinumerazione
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
|
@ -4,6 +4,7 @@
|
||||
// fv 21-1-94
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include <currency.h>
|
||||
#include <defmask.h>
|
||||
#include <mailbox.h>
|
||||
#include <prefix.h>
|
||||
@ -52,7 +53,8 @@ real _ProrataItem::calc_prorata(const real& acq, const char * year)
|
||||
{
|
||||
real perc = _percentuali.objptr(year) ? (real&) *_percentuali.objptr(year) : ZERO;
|
||||
real prorata = (acq * perc) / 100.0;
|
||||
prorata.round(ROUND_LIRA);
|
||||
// prorata.round(ROUND_LIRA);
|
||||
prorata.round(TCurrency::get_firm_dec());
|
||||
return prorata;
|
||||
}
|
||||
|
||||
@ -303,7 +305,8 @@ bool TLiquidazione_app::user_create()
|
||||
if (pnd) pnd->addstatus(1);
|
||||
|
||||
TApplication::set_firm(__firm);
|
||||
set_real_picture(REAL_PICTURE);
|
||||
set_real_picture(REAL_PICTURE);
|
||||
set_magic_currency(TRUE);
|
||||
|
||||
if (!_is_interactive)
|
||||
{
|
||||
|
@ -2725,11 +2725,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
if (prorata > 0.0)
|
||||
{
|
||||
topay = (iaq + ppg) * (prorata / CENTO);
|
||||
//topay.round(ROUND_MILLELIRE);
|
||||
round_mille_lire(topay);
|
||||
}
|
||||
conguaglio = topay - ppg;
|
||||
//conguaglio.round(ROUND_MILLELIRE);
|
||||
round_mille_lire(conguaglio);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include <config.h>
|
||||
#include <currency.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "cg4300.h"
|
||||
@ -205,20 +206,29 @@ void TLiquidazione_app::add_corrisp(int month, const char* codreg, real& r,
|
||||
|
||||
void TLiquidazione_app::lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota)
|
||||
{
|
||||
/* *** Questo e' stato preso da recalc_corrispettivi() */
|
||||
imposta = (abs(totale) * aliquota)/(aliquota + 1.00);
|
||||
imposta.ceil();
|
||||
if (totale.sign() < 0) imposta = -imposta;
|
||||
imponibile = totale - imposta;
|
||||
// quadratura del cerchione
|
||||
real delta = totale - imponibile - imposta;
|
||||
if (!delta.is_zero())
|
||||
imposta += delta;
|
||||
const int dec = TCurrency::get_firm_dec();
|
||||
if (dec == 0) // Lire
|
||||
{
|
||||
imposta = (abs(totale) * aliquota)/(aliquota + 1.00);
|
||||
imposta.ceil();
|
||||
if (totale.sign() < 0) imposta = -imposta;
|
||||
imponibile = totale - imposta;
|
||||
// Qui si entra nel regno del mistero: delta e' SEMPRE zero
|
||||
const real delta = totale - imponibile - imposta;
|
||||
if (!delta.is_zero())
|
||||
imposta += delta;
|
||||
}
|
||||
else // Euro
|
||||
{
|
||||
imposta = (totale * aliquota)/(aliquota + 1.00);
|
||||
imposta.round(dec);
|
||||
imponibile = totale - imposta;
|
||||
}
|
||||
}
|
||||
|
||||
void TLiquidazione_app::lordo2netto(real& imponibile, real& imposta, const real& aliquota)
|
||||
{
|
||||
real totale(imponibile);
|
||||
const real totale = imponibile;
|
||||
lordo2netto(totale, imponibile, imposta, aliquota);
|
||||
}
|
||||
|
||||
@ -896,8 +906,14 @@ real TLiquidazione_app::versamenti_IVA(int month, const char* types, bool intr)
|
||||
|
||||
void TLiquidazione_app::round_mille_lire(real& d)
|
||||
{
|
||||
if (d % real(500.0) == ZERO) d -= 1.0;
|
||||
d.round(ROUND_MILLELIRE);
|
||||
const int dec = TCurrency::get_firm_dec();
|
||||
if (dec == 0) // lire
|
||||
{
|
||||
if (d % real(500.0) == ZERO) d -= 1.0;
|
||||
d.round(ROUND_MILLELIRE);
|
||||
}
|
||||
else // Non si sa ancora come gestire l'euro
|
||||
d.round(dec);
|
||||
}
|
||||
|
||||
// Ritorna il parametro della liquidazione differita per la ditta corrente, cosi come
|
||||
@ -908,7 +924,7 @@ bool TLiquidazione_app::is_differita(long firm, int year)
|
||||
{
|
||||
long d = (firm == 0) ? _nditte->lfile().get_long("CODDITTA") : firm;
|
||||
int y = (year == 0) ? atoi(_year) : year;
|
||||
if (look_lia(d, FALSE, atoi(_year)))
|
||||
if (look_lia(d, atoi(_year) > 0))
|
||||
return _lia->get_bool("B1");
|
||||
else
|
||||
return FALSE;
|
||||
|
127
cg/cg4400.cpp
127
cg/cg4400.cpp
@ -2,6 +2,8 @@
|
||||
// Stampa registri IVA
|
||||
// Usurpatore di Liberta'...
|
||||
// Nemico ed Oscuro Messo di Malvagita'...
|
||||
#include <currency.h>
|
||||
|
||||
#include "cg4.h"
|
||||
#include "cg4400.h"
|
||||
#include "cg4400a.h"
|
||||
@ -1047,10 +1049,10 @@ bool TStampa_registri_app::user_create()
|
||||
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte",
|
||||
"@1|Cod.@5R|Ragione Sociale@50|Vers.");
|
||||
|
||||
|
||||
_n_ditte = 0l;
|
||||
__firm = TApplication::get_firm();
|
||||
|
||||
|
||||
TDate oggi(TODAY);
|
||||
_annoes = oggi.year();
|
||||
|
||||
@ -1747,6 +1749,14 @@ void TStampa_registri_app::set_page_tot_reg()
|
||||
stampa_plafonds(rr);
|
||||
}
|
||||
|
||||
HIDDEN void print_real(TPrintrow& row, const real& num, int pos)
|
||||
{
|
||||
const TCurrency cur(num);
|
||||
TString80 str = cur.string(TRUE);
|
||||
str.right_just(15);
|
||||
row.put(str, pos);
|
||||
}
|
||||
|
||||
bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
|
||||
{
|
||||
TTable pla ("%PLA");
|
||||
@ -1817,7 +1827,7 @@ bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
|
||||
pr.print(riga);
|
||||
riga.put((const char*)mese, 0);
|
||||
riga.put("Disponibile", 35);
|
||||
riga.put(disponibile.string("###.###.###.###"), 55);
|
||||
print_real(riga, disponibile, 55);
|
||||
pr.print(riga);
|
||||
}
|
||||
else
|
||||
@ -1864,11 +1874,13 @@ bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
|
||||
pr.print(riga);
|
||||
riga.reset();
|
||||
riga.put("Utilizzato all'interno",0);
|
||||
riga.put(pri.string("###.###.###.###"),55);
|
||||
print_real(riga, pri, 55);
|
||||
|
||||
|
||||
pr.print(riga);
|
||||
riga.reset();
|
||||
riga.put("Utilizzato per l'importazione",0);
|
||||
riga.put(pre.string("###.###.###.###"),55);
|
||||
print_real(riga, pre, 55);
|
||||
pr.print(riga);
|
||||
}
|
||||
else
|
||||
@ -1912,11 +1924,12 @@ bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
|
||||
pr.print(riga);
|
||||
riga.reset();
|
||||
riga.put("Utilizzato all'interno",0);
|
||||
riga.put(pri.string("###.###.###.###"),55);
|
||||
print_real(riga, pri, 55);
|
||||
|
||||
pr.print(riga);
|
||||
riga.reset();
|
||||
riga.put("Utilizzato per l'importazione",0);
|
||||
riga.put(pre.string("###.###.###.###"),55);
|
||||
print_real(riga, pre, 55);
|
||||
pr.print(riga);
|
||||
}
|
||||
else
|
||||
@ -1960,11 +1973,11 @@ bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
|
||||
pr.print(riga);
|
||||
riga.reset();
|
||||
riga.put("Utilizzato all'interno",0);
|
||||
riga.put(pri.string("###.###.###.###"),55);
|
||||
print_real(riga, pri, 55);
|
||||
pr.print(riga);
|
||||
riga.reset();
|
||||
riga.put("Utilizzato per l'importazione",0);
|
||||
riga.put(pre.string("###.###.###.###"),55);
|
||||
print_real(riga, pre, 55);
|
||||
pr.print(riga);
|
||||
}
|
||||
else
|
||||
@ -1981,7 +1994,7 @@ bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
|
||||
riga.reset();
|
||||
pr.print(riga);
|
||||
riga.put("Riporto",35);
|
||||
riga.put(disponibile.string("###.###.###.###"),55);
|
||||
print_real(riga, disponibile, 55);
|
||||
pr.print(riga);
|
||||
}
|
||||
else
|
||||
@ -2353,9 +2366,11 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
||||
if (riga <= rr) riga = ++rr;
|
||||
|
||||
if (corrval != ZERO)
|
||||
{
|
||||
TString vall (corrval.string("###.###.###.###,@@@"));
|
||||
set_row(riga, "@24gCodice valuta %-3s Corrispettivo in valuta %s", (const char*) codval, (const char*) vall);
|
||||
{
|
||||
TCurrency curr(corrval, codval);
|
||||
TString80 vall = curr.string(TRUE);
|
||||
vall.right_just(19);
|
||||
set_row(riga, "@24gCodice valuta %-3s Corrispettivo in valuta %s", (const char*) codval, (const char*) vall);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -3260,6 +3275,7 @@ bool TStampa_registri_app::set_print(int n)
|
||||
set_choice_limits(m);
|
||||
|
||||
set_real_picture("###.###.###.###");
|
||||
set_magic_currency(TRUE);
|
||||
|
||||
while (ok = set_ditte(m))
|
||||
{
|
||||
@ -3805,21 +3821,21 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
TString80 d = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)d),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
print_real(riga, r._imponibile, 29);
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
print_real(riga, r._imposta, 45);
|
||||
if (treg == vendita && _tabreg->get_bool("B0"))
|
||||
if (r._implordo != ZERO)
|
||||
riga.put((r._implordo).string("###.###.###.###"),65);
|
||||
print_real(riga, r._implordo, 65);
|
||||
if (_tipo_stampa != prova && !print_prec)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
print_real(riga, r._imponibilep, 82);
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
print_real(riga, r._impostap, 99);
|
||||
if (treg == vendita && _tabreg->get_bool("B0"))
|
||||
if (r._implordop != ZERO)
|
||||
riga.put((r._implordop).string("###.###.###.###"),116);
|
||||
print_real(riga, r._implordop, 116);
|
||||
}
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
@ -3834,21 +3850,21 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (t_impon != ZERO)
|
||||
riga.put(t_impon.string("###.###.###.###"),29);
|
||||
print_real(riga, t_impon, 29);
|
||||
if (t_impos != ZERO)
|
||||
riga.put(t_impos.string("###.###.###.###"),45);
|
||||
print_real(riga, t_impos, 45);
|
||||
if (treg == vendita && _tabreg->get_bool("B0"))
|
||||
if (t_impol != ZERO)
|
||||
riga.put(t_impol.string("###.###.###.###"),65);
|
||||
print_real(riga, t_impol, 65);
|
||||
if (_tipo_stampa != prova && !print_prec)
|
||||
{
|
||||
if (t_imponp != ZERO)
|
||||
riga.put(t_imponp.string("###.###.###.###"),82);
|
||||
print_real(riga, t_imponp, 82);
|
||||
if (t_imposp != ZERO)
|
||||
riga.put(t_imposp.string("###.###.###.###"),99);
|
||||
print_real(riga, t_imposp, 99);
|
||||
if (treg == vendita && _tabreg->get_bool("B0"))
|
||||
if (t_impolp != ZERO)
|
||||
riga.put(t_impolp.string("###.###.###.###"),116);
|
||||
print_real(riga, t_impolp, 116);
|
||||
}
|
||||
printer().print(riga);
|
||||
|
||||
@ -3872,15 +3888,16 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
print_real(riga, tot_imponib, 29);
|
||||
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
print_real(riga, tot_imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
print_real(riga, tot_imponibp, 82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
print_real(riga, tot_impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
@ -3911,15 +3928,15 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
TString descr = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)descr),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
print_real(riga, r._imponibile, 29);
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
print_real(riga, r._imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
print_real(riga, r._imponibilep, 82);
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
print_real(riga, r._impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib += r._imponibile;
|
||||
@ -3937,15 +3954,16 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
print_real(riga, tot_imponib, 29);
|
||||
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
print_real(riga, tot_imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
print_real(riga, tot_imponibp, 82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
print_real(riga, tot_impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
@ -3976,15 +3994,16 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
TString descr = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)descr),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
print_real(riga, r._imponibile, 29);
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
print_real(riga, r._imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
print_real(riga, r._imponibilep, 82);
|
||||
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
print_real(riga, r._impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib += r._imponibile;
|
||||
@ -4002,15 +4021,16 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
print_real(riga, tot_imponib, 29);
|
||||
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
print_real(riga, tot_imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
print_real(riga, tot_imponibp, 82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
print_real(riga, tot_impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
@ -4041,15 +4061,16 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
TString descr = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)descr),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
print_real(riga, r._imponibile, 29);
|
||||
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
print_real(riga, r._imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
print_real(riga, r._imponibilep, 82);
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
print_real(riga, r._impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib += r._imponibile;
|
||||
@ -4069,15 +4090,15 @@ void TStampa_registri_app::stampa_progressivi(TRiga_array& vect,
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
print_real(riga, tot_imponib, 29);
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
print_real(riga, tot_imposta, 45);
|
||||
if (_tipo_stampa != prova)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
print_real(riga, tot_imponibp, 82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
print_real(riga, tot_impostap, 99);
|
||||
}
|
||||
printer().print(riga);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ bool TAp_eser::mask_newanno (TMask_field& f, KEY k)
|
||||
TString16 codtab; codtab.format ("%04d", newanno);
|
||||
TTable TabEs("ESC");
|
||||
TabEs.put ("CODTAB", codtab);
|
||||
if (TabEs.read() != NOERR)
|
||||
if (TabEs.read() == NOERR)
|
||||
{
|
||||
f.warning_box ("Il codice inserito e' gia' presente nella tabella degli esercizi!");
|
||||
return FALSE;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <relapp.h>
|
||||
#include <config.h>
|
||||
#include <msksheet.h>
|
||||
#include <prefix.h>
|
||||
#include <tabutil.h>
|
||||
#ifndef __CGLIB03_H
|
||||
#include "cglib03.h"
|
||||
@ -18,6 +19,7 @@ class GesAcc_app : public TRelation_application
|
||||
TTable* _lim;
|
||||
|
||||
private:
|
||||
static bool msk_ditta(TMask_field& f, KEY k);
|
||||
static bool msk_credito(TMask_field&, KEY);
|
||||
static bool msk_acconto(TMask_field&, KEY);
|
||||
|
||||
@ -45,6 +47,7 @@ bool GesAcc_app::user_create()
|
||||
_mask = new TMask("cg4700a");
|
||||
_mask->set_handler(F_ACCONTO, msk_acconto);
|
||||
_mask->set_handler(F_CREDITO, msk_credito);
|
||||
_mask->set_handler(F_CODDITTA, msk_ditta);
|
||||
|
||||
set_search_field(F_CODDITTA);
|
||||
|
||||
@ -60,6 +63,18 @@ bool GesAcc_app::user_destroy()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool GesAcc_app::msk_ditta(TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
TFirm fr(atol(f.get()));
|
||||
TMask& m = f.mask();
|
||||
|
||||
m.set(F_CODVAL, fr.codice_valuta());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool GesAcc_app::msk_credito(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
|
11
cg/cg4700.h
11
cg/cg4700.h
@ -1,5 +1,6 @@
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_ANNO 103
|
||||
#define F_ACCONTO 104
|
||||
#define F_CREDITO 105
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_ANNO 103
|
||||
#define F_ACCONTO 104
|
||||
#define F_CREDITO 105
|
||||
#define F_CODVAL 106
|
||||
|
@ -83,10 +83,17 @@ BEGIN
|
||||
ADD NONE
|
||||
END
|
||||
|
||||
STRING F_CODVAL 3
|
||||
BEGIN
|
||||
PROMPT 0 0 ""
|
||||
FLAGS "HD"
|
||||
END
|
||||
|
||||
CURRENCY F_ACCONTO 15
|
||||
BEGIN
|
||||
PROMPT 1 7 "Acconto dovuto "
|
||||
HELP "Introdurre l'acconto dovuto"
|
||||
DRIVENBY F_CODVAL
|
||||
FIELD R4
|
||||
END
|
||||
|
||||
@ -94,6 +101,7 @@ CURRENCY F_CREDITO 15
|
||||
BEGIN
|
||||
PROMPT 1 9 "Credito utilizzato "
|
||||
HELP "Introdurre il credito utilizzato"
|
||||
DRIVENBY F_CODVAL
|
||||
FIELD R6
|
||||
END
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
//Creazione versamenti per acconti
|
||||
#include <applicat.h>
|
||||
#include <currency.h>
|
||||
#include <mask.h>
|
||||
#include <tabutil.h>
|
||||
#include <relation.h>
|
||||
@ -115,7 +116,7 @@ bool VersAcc_app::create()
|
||||
|
||||
TDate oggi(TODAY);
|
||||
_year = oggi.year();
|
||||
|
||||
|
||||
begin_wait();
|
||||
build_nomiditte();
|
||||
build_ditte_sheet();
|
||||
@ -358,11 +359,14 @@ void VersAcc_app::print()
|
||||
TToken_string& tt = (TToken_string&)_desc[i];
|
||||
|
||||
TParagraph_string rs (tt.get(1),30);
|
||||
|
||||
|
||||
row.reset();
|
||||
row.put(tt.get(0),0);
|
||||
|
||||
const real imp(real::ita2eng(tt.get(2)));
|
||||
row.put(imp.string("###.###.###.###"),38);
|
||||
TCurrency cur(imp);
|
||||
|
||||
row.put(cur.string(TRUE),38);
|
||||
if (tt.get_int(7) == 0)
|
||||
{
|
||||
row.put(tt.get(3),55);
|
||||
|
@ -1,18 +1,13 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#include "cg5.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = (argc > 1) ? atoi(argv[1]+1) : -1;
|
||||
const int n = (argc > 1) ? argv[1][1]-'0' : 0;
|
||||
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
cg5000(argc,argv) ; break;
|
||||
case 1:
|
||||
cg5100(argc,argv) ; break;
|
||||
case 2:
|
||||
@ -26,7 +21,7 @@ int main(int argc,char** argv)
|
||||
case 6:
|
||||
cg5600(argc,argv) ; break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ;
|
||||
cg5000(argc,argv) ; break;
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
|
@ -2,7 +2,9 @@
|
||||
// modifica parametri contabilita' relativi alla liquidazione
|
||||
|
||||
#include <config.h>
|
||||
#include <currency.h>
|
||||
#include <msksheet.h>
|
||||
#include <prefix.h>
|
||||
#include <relapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <urldefid.h>
|
||||
@ -28,9 +30,11 @@ class TParaliq_app : public TRelation_application
|
||||
|
||||
protected: // Applicat
|
||||
virtual void on_config_change();
|
||||
static bool ditta_handler(TMask_field& f, KEY k);
|
||||
static bool gelidi_handler(TMask_field& f, KEY k);
|
||||
static bool agrmin_handler(TMask_field& f, KEY k);
|
||||
static bool credres_handler(TMask_field& f, KEY k);
|
||||
static bool credpreccost_handler(TMask_field& f, KEY k);
|
||||
|
||||
protected: // Relapp
|
||||
virtual bool user_create();
|
||||
@ -64,6 +68,18 @@ public:
|
||||
|
||||
inline TParaliq_app& app() { return (TParaliq_app&) main_app(); }
|
||||
|
||||
bool TParaliq_app::ditta_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
TFirm fr(atol(f.get()));
|
||||
TMask& m = f.mask();
|
||||
|
||||
m.set(F_CODVAL, fr.codice_valuta());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TParaliq_app::gelidi_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k==K_SPACE)
|
||||
@ -124,6 +140,23 @@ bool TParaliq_app::credres_handler(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TParaliq_app::credpreccost_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
real r(f.get());
|
||||
TCurrency cur(r, f.mask().get(F_CODVAL));
|
||||
const int ndec = cur.decimals(); // Decimali di questa valuta per gli importi
|
||||
|
||||
// Arrotondamento alle migliaia nel caso il numero
|
||||
// di decimali della ditta sia zero (come per le lire)
|
||||
// altrimenti al numero di decimali impostato
|
||||
r.round(ndec == 0 ? -3 : ndec);
|
||||
f.set(r.string());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TParaliq_app::check_registers(int year)
|
||||
{
|
||||
// controlla che per ogni data attivita' esistano almeno un registro
|
||||
@ -229,12 +262,15 @@ bool TParaliq_app::user_create()
|
||||
_msk->set_handler(F_AGRMIN,agrmin_handler);
|
||||
_msk->set_handler(F_CRED_RES,credres_handler);
|
||||
_msk->set_handler(F_MESE_RES_AL,credres_handler);
|
||||
_msk->set_handler(F_CRED_PREC,credpreccost_handler);
|
||||
_msk->set_handler(F_CRED_COST,credpreccost_handler);
|
||||
_msk->set_handler(F_CODDITTA,ditta_handler);
|
||||
((TSheet_field&)_msk->field(F_SHEET_PLA)).set_notify(sheet_action);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TParaliq_app::user_destroy()
|
||||
{
|
||||
{
|
||||
delete _rel;
|
||||
delete _attiv;
|
||||
delete _ditte;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define F_AGRMIN 309
|
||||
#define F_CRED_RES 310
|
||||
#define F_MESE_RES_AL 311
|
||||
#define F_CODVAL 312
|
||||
|
||||
#define F_CODATT 101
|
||||
#define F_DESATT 150
|
||||
|
@ -57,6 +57,12 @@ BEGIN
|
||||
ADD NONE
|
||||
END
|
||||
|
||||
STRING F_CODVAL 3
|
||||
BEGIN
|
||||
PROMPT 0 0 ""
|
||||
FLAGS "HD"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 75 6
|
||||
BEGIN
|
||||
PROMPT 2 4 "Parametri ditta"
|
||||
@ -77,14 +83,13 @@ BEGIN
|
||||
FIELD B1
|
||||
END
|
||||
|
||||
NUMBER F_CRED_PREC 15
|
||||
CURRENCY F_CRED_PREC 18
|
||||
BEGIN
|
||||
PROMPT 4 6 "Credito precedente "
|
||||
HELP "Eventuale credito di imposta dell'anno precedente"
|
||||
FIELD R0
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
NUM_CALC ROUND(#THIS_FIELD,-3)
|
||||
DRIVENBY F_CODVAL
|
||||
END
|
||||
|
||||
BOOLEAN F_AGRMIN
|
||||
@ -93,22 +98,21 @@ BEGIN
|
||||
FIELD B2
|
||||
END
|
||||
|
||||
NUMBER F_CRED_COST 15
|
||||
CURRENCY F_CRED_COST 18
|
||||
BEGIN
|
||||
PROMPT 4 7 "Credito di costo "
|
||||
HELP "Eventuale credito di costo dell'anno precedente"
|
||||
FIELD R5
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
NUM_CALC ROUND(#THIS_FIELD,-3)
|
||||
DRIVENBY F_CODVAL
|
||||
END
|
||||
|
||||
NUMBER F_CRED_RES 15
|
||||
CURRENCY F_CRED_RES 18
|
||||
BEGIN
|
||||
PROMPT 4 8 "Credito residuo "
|
||||
FIELD R15
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
DRIVENBY F_CODVAL
|
||||
NUM_EXPR #THIS<=#F_CRED_PREC
|
||||
WARNING "L'importo non puo' essere maggiore del Credito Precedente"
|
||||
END
|
||||
@ -161,7 +165,6 @@ LIST F_TIPOATT 26
|
||||
BEGIN
|
||||
PROMPT 4 3 "Tipo "
|
||||
HELP "Tipo di attivita' della ditta"
|
||||
FLAGS "U"
|
||||
ITEM " |Altre"
|
||||
ITEM "E|Mista evid."
|
||||
ITEM "S|Serv. o mista gen."
|
||||
@ -170,38 +173,34 @@ END
|
||||
NUMBER F_PRORATA 6 2
|
||||
BEGIN
|
||||
PROMPT 4 5 "% Pro-Rata "
|
||||
HELP "Percentuale di pro-rata"
|
||||
PICTURE ".2"
|
||||
NUM_EXPR {(#F_PRORATA>=0.0)&&(#F_PRORATA<=100.0)}
|
||||
WARNING "Percentuale non valida (0-100%)"
|
||||
FLAGS "R"
|
||||
FLAGS "U"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_P8 15
|
||||
CURRENCY F_P8 15
|
||||
BEGIN
|
||||
PROMPT 4 7 "Plafond art. 8 "
|
||||
HELP "Ammontare plafond articolo 8"
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
DRIVENBY -F_CODVAL
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_P8B 15
|
||||
CURRENCY F_P8B 15
|
||||
BEGIN
|
||||
PROMPT 4 9 "Plafond art. 8 bis "
|
||||
HELP "Ammontare plafond articolo 8 bis"
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
DRIVENBY -F_CODVAL
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_P9 15
|
||||
CURRENCY F_P9 15
|
||||
BEGIN
|
||||
PROMPT 4 11 "Plafond art. 9 "
|
||||
HELP "Ammontare plafond articolo 9"
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
DRIVENBY -F_CODVAL
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <mailbox.h>
|
||||
#include <execp.h>
|
||||
#include <progind.h>
|
||||
#include <urldefid.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
@ -57,8 +56,6 @@ void Visliq_app::set_freqviva()
|
||||
|
||||
bool Visliq_app::create()
|
||||
{
|
||||
TApplication::create();
|
||||
|
||||
_firm = get_firm();
|
||||
TDate oggi(TODAY);
|
||||
_year = oggi.year();
|
||||
@ -89,9 +86,7 @@ bool Visliq_app::create()
|
||||
build_ditte_sheet();
|
||||
end_wait();
|
||||
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
|
||||
return TRUE;
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool Visliq_app::destroy()
|
||||
@ -260,15 +255,6 @@ const char* Visliq_app::link_handler(TMask& m,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool Visliq_app::menu(MENU_TAG m)
|
||||
{
|
||||
if (m == BAR_ITEM(1))
|
||||
return vis_liq();
|
||||
|
||||
return TApplication::menu(m);
|
||||
}
|
||||
|
||||
// handlers
|
||||
bool Visliq_app::set_ditta(TMask_field& f, KEY k)
|
||||
{
|
||||
@ -463,11 +449,10 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
|
||||
bool Visliq_app::vis_liq()
|
||||
void Visliq_app::main_loop()
|
||||
{
|
||||
long ditta = get_firm();
|
||||
set_freqviva();
|
||||
KEY k;
|
||||
|
||||
TMask m("cg5500a");
|
||||
_mask = &m;
|
||||
@ -479,32 +464,28 @@ bool Visliq_app::vis_liq()
|
||||
set_mask_freq(m);
|
||||
_year = m.get_int(F_YEAR);
|
||||
|
||||
while ((k = m.run()) != K_ESC)
|
||||
KEY k;
|
||||
while ((k = m.run()) == K_ENTER)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
if (m.get(F_CODDITTA).empty() || m.get(F_RAGSOC).empty())
|
||||
{
|
||||
if (m.get(F_CODDITTA).empty() || m.get(F_RAGSOC).empty())
|
||||
{
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
long dtt = m.get_long(F_CODDITTA);
|
||||
|
||||
set_firm(dtt);
|
||||
int month = m.get_int(_freqviva == "M" ? F_MONTHS : F_TRIMS);
|
||||
if (month == 13) _is_annual = TRUE;
|
||||
else _is_annual = FALSE;
|
||||
if (month == 0)
|
||||
vis_all();
|
||||
else
|
||||
vis_one(month);
|
||||
_mask = &m;
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
long dtt = m.get_long(F_CODDITTA);
|
||||
|
||||
set_firm(dtt);
|
||||
int month = m.get_int(_freqviva == "M" ? F_MONTHS : F_TRIMS);
|
||||
if (month == 13) _is_annual = TRUE;
|
||||
else _is_annual = FALSE;
|
||||
if (month == 0)
|
||||
vis_all();
|
||||
else
|
||||
vis_one(month);
|
||||
_mask = &m;
|
||||
}
|
||||
|
||||
set_firm(ditta);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -789,7 +770,7 @@ bool Visliq_app::vis_one(int m)
|
||||
|
||||
if (k == K_INS || k == K_SAVE)
|
||||
{
|
||||
recalc_liq_data(vsw, rimborso, rettifica, vers,
|
||||
recalc_liq_data(&vsw, rimborso, rettifica, vers,
|
||||
acconto, desc1, desc2, date, abi,
|
||||
cab, con);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
class TSheet_field;
|
||||
class TViswin;
|
||||
|
||||
class Visliq_app : public TApplication
|
||||
class Visliq_app : public TSkeleton_application
|
||||
{
|
||||
TString _freqviva;
|
||||
int _year;
|
||||
@ -49,7 +49,6 @@ class Visliq_app : public TApplication
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool menu(MENU_TAG);
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
@ -107,11 +106,11 @@ public:
|
||||
void recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field* sv);
|
||||
|
||||
// workhorses
|
||||
bool vis_liq();
|
||||
virtual void main_loop();
|
||||
bool vis_all();
|
||||
bool vis_one(int);
|
||||
|
||||
Visliq_app() : TApplication(), _vers_sheet(NULL), _liq_sheet(NULL) {}
|
||||
Visliq_app() : _vers_sheet(NULL), _liq_sheet(NULL) {}
|
||||
virtual ~Visliq_app() {}
|
||||
};
|
||||
|
||||
|
@ -8,10 +8,10 @@ PAGE "Visualizzazione Liquidazione" -1 -1 72 8
|
||||
|
||||
NUMBER F_YEAR 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "Anno liquidazione "
|
||||
FLAGS "AR"
|
||||
PROMPT 1 1 "Anno liquidazione "
|
||||
FLAGS "AR"
|
||||
END
|
||||
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 3 "Codice ditta "
|
||||
@ -28,43 +28,43 @@ END
|
||||
|
||||
LIST F_MONTHS 30
|
||||
BEGIN
|
||||
PROMPT 1 5 "Mese liquidazione "
|
||||
ITEM " |Prospetto complessivo"
|
||||
ITEM "1|Gennaio"
|
||||
ITEM "2|Febbraio"
|
||||
ITEM "3|Marzo"
|
||||
ITEM "4|Aprile"
|
||||
ITEM "5|Maggio"
|
||||
ITEM "6|Giugno"
|
||||
ITEM "7|Luglio"
|
||||
ITEM "8|Agosto"
|
||||
ITEM "9|Settembre"
|
||||
ITEM "10|Ottobre"
|
||||
ITEM "11|Novembre"
|
||||
ITEM "12|Dicembre"
|
||||
ITEM "13|Annuale"
|
||||
PROMPT 1 5 "Mese liquidazione "
|
||||
ITEM " |Prospetto complessivo"
|
||||
ITEM "1|Gennaio"
|
||||
ITEM "2|Febbraio"
|
||||
ITEM "3|Marzo"
|
||||
ITEM "4|Aprile"
|
||||
ITEM "5|Maggio"
|
||||
ITEM "6|Giugno"
|
||||
ITEM "7|Luglio"
|
||||
ITEM "8|Agosto"
|
||||
ITEM "9|Settembre"
|
||||
ITEM "10|Ottobre"
|
||||
ITEM "11|Novembre"
|
||||
ITEM "12|Dicembre"
|
||||
ITEM "13|Annuale"
|
||||
END
|
||||
|
||||
LIST F_TRIMS 30
|
||||
BEGIN
|
||||
PROMPT 1 5 "Trim. liq. "
|
||||
ITEM " |Prospetto complessivo"
|
||||
ITEM "3|1° Trimestre"
|
||||
ITEM "6|2° Trimestre"
|
||||
ITEM "9|3° Trimestre"
|
||||
ITEM "12|4° Trimestre"
|
||||
ITEM "13|Annuale"
|
||||
FLAGS "H"
|
||||
PROMPT 1 5 "Trim. liq. "
|
||||
ITEM " |Prospetto complessivo"
|
||||
ITEM "3|1° Trimestre"
|
||||
ITEM "6|2° Trimestre"
|
||||
ITEM "9|3° Trimestre"
|
||||
ITEM "12|4° Trimestre"
|
||||
ITEM "13|Annuale"
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -118,7 +118,7 @@ CURRENCY F_ACCONTO 15
|
||||
BEGIN
|
||||
PROMPT 3 17 "Acconto versato: "
|
||||
GROUP 3
|
||||
FLAGS "R"
|
||||
FLAGS "RH"
|
||||
END
|
||||
|
||||
/* gruppo 4: edit delega */
|
||||
@ -134,7 +134,7 @@ CURRENCY F_DELIMP 15
|
||||
BEGIN
|
||||
PROMPT 26 17 "Importo versato "
|
||||
GROUP 4
|
||||
FLAGS "R"
|
||||
FLAGS "RH"
|
||||
END
|
||||
|
||||
NUMBER F_DELABI 5
|
||||
|
@ -518,6 +518,15 @@ void TInv_cont::apri_file_temp()
|
||||
_trmov = new TIsamtempfile(LF_RMOV, tmprmov, FALSE);
|
||||
else
|
||||
_trmov = new TIsamtempfile(LF_RMOV, tmprmov, TRUE);
|
||||
TString80 tmpoccas = "%";
|
||||
tmpoccas << firm2dir(0);
|
||||
tmpoccas << "\\" << TEMP_OCC;
|
||||
tmp = tmpoccas.mid(1);
|
||||
tmp << ".dbf";
|
||||
if (tmp.exist())
|
||||
_toccas = new TIsamtempfile(LF_OCCAS, tmpoccas, FALSE);
|
||||
else
|
||||
_toccas = new TIsamtempfile(LF_OCCAS, tmpoccas, TRUE);
|
||||
}
|
||||
if (sigla == 'U')
|
||||
{
|
||||
@ -530,15 +539,6 @@ void TInv_cont::apri_file_temp()
|
||||
_triva = new TIsamtempfile(LF_RMOVIVA, tmpriva, FALSE);
|
||||
else
|
||||
_triva = new TIsamtempfile(LF_RMOVIVA, tmpriva, TRUE);
|
||||
TString80 tmpoccas = "%";
|
||||
tmpoccas << firm2dir(0);
|
||||
tmpoccas << "\\" << TEMP_OCC;
|
||||
tmp = tmpoccas.mid(1);
|
||||
tmp << ".dbf";
|
||||
if (tmp.exist())
|
||||
_toccas = new TIsamtempfile(LF_OCCAS, tmpoccas, FALSE);
|
||||
else
|
||||
_toccas = new TIsamtempfile(LF_OCCAS, tmpoccas, TRUE);
|
||||
}
|
||||
if (sigla == 'B')
|
||||
{
|
||||
@ -754,14 +754,17 @@ bool TInv_cont::tabella_ditta()
|
||||
_data = ind.get_date("D0");
|
||||
|
||||
_files = "";
|
||||
if (ind.get_bool("B0") && (_caus->items() != 0) )
|
||||
_files << "W";
|
||||
|
||||
// Si mette prima l'invio del piano dei conti, e poi delle anagrafiche in modo che eventuali ricezioni
|
||||
// possano aggiornare correttamente il tipoconto memorizzato nelle causali
|
||||
if (ind.get_bool("B2") && (_pcon->items() != 0) )
|
||||
_files << "P";
|
||||
|
||||
if (ind.get_bool("B1") && (_clifo->items() != 0) )
|
||||
_files << "A";
|
||||
|
||||
if (ind.get_bool("B2") && (_pcon->items() != 0) )
|
||||
_files << "P";
|
||||
if (ind.get_bool("B0") && (_caus->items() != 0) )
|
||||
_files << "W";
|
||||
|
||||
if (ind.get_bool("B3") && (_mov->items() != 0) )
|
||||
_files << "Z";
|
||||
|
135
cg/cglib01.cpp
135
cg/cglib01.cpp
@ -61,14 +61,7 @@ void TEsercizi_contabili::update()
|
||||
void TEsercizi_contabili::check()
|
||||
{
|
||||
if (_firm != prefix().get_codditta())
|
||||
{
|
||||
#ifdef DBG
|
||||
if (_firm != 0)
|
||||
error_box("Questo programma carinissimo usa gli esercizi,\n"
|
||||
"purtroppo non tiene conto del cambio ditta!");
|
||||
#endif
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
int TEsercizi_contabili::date2index(const TDate& d) const
|
||||
@ -183,8 +176,10 @@ bool TRegistro::read(const char* cod, int year)
|
||||
const TDate oggi(TODAY);
|
||||
year = oggi.year();
|
||||
}
|
||||
if (cod == NULL)
|
||||
cod = "";
|
||||
|
||||
int err = ~NOERR;
|
||||
/* int err = ~NOERR;
|
||||
|
||||
TTable reg("REG");
|
||||
reg.setkey(1);
|
||||
@ -198,9 +193,12 @@ bool TRegistro::read(const char* cod, int year)
|
||||
|
||||
if (err != NOERR)
|
||||
_rec.zero();
|
||||
*/
|
||||
TString16 chiave; chiave.format("%04d%s", year, cod);
|
||||
_rec = cache().get("REG", chiave);
|
||||
read_att();
|
||||
|
||||
return err == NOERR;
|
||||
return !_rec.empty();
|
||||
}
|
||||
|
||||
bool TRegistro::reread()
|
||||
@ -277,6 +275,7 @@ bool TRegistro::read_att()
|
||||
if (!_att.empty())
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
TLocalisamfile attiv(LF_ATTIV);
|
||||
attiv.setkey(1);
|
||||
attiv.put("CODDITTA", prefix().get_codditta());
|
||||
@ -284,25 +283,35 @@ bool TRegistro::read_att()
|
||||
const int err = attiv.read();
|
||||
_att = attiv.curr();
|
||||
if (err != NOERR)
|
||||
_att.zero();
|
||||
|
||||
TString16 chiave; // Ditta - Anno - Attivita' - Tipo Attivita' (fissata a 1)
|
||||
_att.zero();
|
||||
*/
|
||||
TString16 chiave;
|
||||
chiave << prefix().get_codditta() << '|' << attivita();
|
||||
|
||||
_att = cache().get(LF_ATTIV, chiave);
|
||||
// Ditta - Anno - Attivita' - Tipo Attivita' (fissata a 1)
|
||||
chiave.format("%05ld", prefix().get_codditta());
|
||||
chiave << year(); // non fare << year() << attivita()
|
||||
chiave << attivita() << "1";
|
||||
|
||||
|
||||
_prorata.destroy();
|
||||
|
||||
/*
|
||||
TTable pla("%PLA");
|
||||
pla.put("CODTAB", chiave);
|
||||
if (pla.read() == NOERR)
|
||||
{
|
||||
*/
|
||||
const TRectype & pla = cache().get("%PLA", chiave);
|
||||
|
||||
if (!pla.empty())
|
||||
{
|
||||
chiave.format("%d", year());
|
||||
_prorata.add(chiave, pla.get_real("R8"));
|
||||
_att.put("TIPOATT", pla.get("S7")); // Aggiorna tipo attivita'
|
||||
}
|
||||
|
||||
return err == NOERR;
|
||||
return !_att.empty();
|
||||
}
|
||||
|
||||
bool TRegistro::agenzia_viaggi()
|
||||
@ -450,30 +459,82 @@ TCodiceIVA::TCodiceIVA(const char* cod) : TRectype(LF_TABCOM)
|
||||
|
||||
bool TCodiceIVA::read(const char* cod)
|
||||
{
|
||||
int err = ~NOERR;
|
||||
if (cod && *cod)
|
||||
{
|
||||
TTable iva("%IVA");
|
||||
iva.put("CODTAB", cod);
|
||||
err = iva.read();
|
||||
TRectype::operator=(iva.curr());
|
||||
}
|
||||
if (err != NOERR)
|
||||
zero();
|
||||
return err == NOERR;
|
||||
if (cod == NULL)
|
||||
cod = "";
|
||||
|
||||
*this = cache().get("%IVA", cod);
|
||||
return !this->empty();
|
||||
}
|
||||
|
||||
real TCodiceIVA::scorpora(real& imponibile) const
|
||||
real TCodiceIVA::imposta(const real & imponibile, int ndec, const char * codval) const
|
||||
{
|
||||
const real percent = percentuale();
|
||||
|
||||
switch (ndec)
|
||||
{
|
||||
case AUTO_DECIMALS:
|
||||
ndec = TCurrency(ZERO, codval).decimals();
|
||||
break;
|
||||
case AUTO_PRICES_DECIMALS:
|
||||
ndec = TPrice(ZERO, codval).decimals();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
real iva = imponibile * percent / 100.0;
|
||||
if (ndec < 20)
|
||||
{
|
||||
if (ndec == 0)
|
||||
{
|
||||
if (imponibile > ZERO)
|
||||
iva.ceil(ndec);
|
||||
else
|
||||
iva.floor(ndec);
|
||||
}
|
||||
else
|
||||
iva.round(ndec);
|
||||
}
|
||||
return iva;
|
||||
}
|
||||
|
||||
real TCodiceIVA::scorpora(real & imponibile, int ndec, const char* codval) const
|
||||
{
|
||||
const real percent = percentuale();
|
||||
|
||||
real imposta = abs(imponibile) * percent / (percent + 100.0);
|
||||
// imposta.ceil();
|
||||
imposta.ceil(TCurrency::get_firm_dec());
|
||||
switch (ndec)
|
||||
{
|
||||
case AUTO_DECIMALS:
|
||||
ndec = TCurrency(ZERO, codval).decimals();
|
||||
break;
|
||||
case AUTO_PRICES_DECIMALS:
|
||||
ndec = TPrice(ZERO, codval).decimals();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
real iva = (imponibile * percent) / (percent + 100.0);
|
||||
|
||||
if (imponibile.sign() < 0) imposta = -imposta;
|
||||
imponibile -= imposta;
|
||||
return imposta;
|
||||
if (ndec < 20)
|
||||
{
|
||||
if (ndec == 0)
|
||||
{
|
||||
if (imponibile > ZERO)
|
||||
iva.ceil(ndec);
|
||||
else
|
||||
iva.floor(ndec);
|
||||
}
|
||||
else
|
||||
iva.round(ndec);
|
||||
}
|
||||
imponibile -= iva;
|
||||
return iva;
|
||||
}
|
||||
|
||||
real TCodiceIVA::lordo(const real & imponibile, int ndec, const char * codval) const
|
||||
{
|
||||
return imponibile + imposta(imponibile, ndec, codval);
|
||||
}
|
||||
|
||||
bool handler_data_cambio(TMask_field& f, KEY k)
|
||||
@ -486,11 +547,15 @@ bool handler_data_cambio(TMask_field& f, KEY k)
|
||||
const TRectype& rec = b.cursor()->curr();
|
||||
const TString16 codval = rec.get("CODTAB").left(3);
|
||||
const TString& firmval = TCurrency::get_firm_val();
|
||||
real cambio = rec.get("R10");
|
||||
real cambio = rec.get("S4");
|
||||
if (cambio.is_zero())
|
||||
cambio = rec.get_real("R10");
|
||||
if (codval.not_empty() && codval != firmval && cambio > ZERO)
|
||||
{
|
||||
TDecoder val("%val", "R10");
|
||||
const real base = val.decode(firmval);
|
||||
const TRectype& val = cache().get("%VAL", firmval);
|
||||
real base = val.get("S4");
|
||||
if (base.is_zero())
|
||||
base = val.get_real("R10");
|
||||
if (base > ZERO && base != 1.0)
|
||||
{
|
||||
TToken_string out_fields = b.get_output_fields();
|
||||
|
17
cg/cglib01.h
17
cg/cglib01.h
@ -132,20 +132,27 @@ public:
|
||||
virtual ~TLibro_giornale() {}
|
||||
};
|
||||
|
||||
class TCodiceIVA : private TRectype
|
||||
class TCodiceIVA : public TRectype
|
||||
{
|
||||
void copy(const TRectype & iva) { TRectype::operator =(iva); }
|
||||
public: // TObject
|
||||
virtual bool ok() const { return !empty(); }
|
||||
|
||||
public:
|
||||
TCodiceIVA & operator =(const TCodiceIVA & iva) { copy(iva) ; return *this;}
|
||||
TObject* dup() const { return new TCodiceIVA(*this); }
|
||||
bool read(const char* codice);
|
||||
const TString& codice() const { return get("CODTAB"); }
|
||||
real percentuale() const { return get_real("R0"); }
|
||||
const TString& descrizione() const { return get("S0"); }
|
||||
const real percentuale() const { return get_real("R0"); }
|
||||
const TString& tipo() const { return get("S1"); }
|
||||
int detraibilita() const { return get_int("I1"); }
|
||||
|
||||
real scorpora(real& imponibile) const; // Scorpora dall'imponibile l'imposta e la ritorna
|
||||
real imposta(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola l'imposta sull'imponibile l'imposta e la ritorna
|
||||
real scorpora(real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Scorpora dall'imponibile l'imposta e la ritorna
|
||||
real lordo(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola il lordo dell'imponibile l'imposta e la ritorna
|
||||
|
||||
TCodiceIVA(const char* codice = NULL);
|
||||
TCodiceIVA(const TRectype & rec) : TRectype(rec) {}
|
||||
TCodiceIVA(const TCodiceIVA & iva) : TRectype(iva) {}
|
||||
virtual ~TCodiceIVA() {}
|
||||
};
|
||||
|
||||
|
@ -849,6 +849,15 @@ void TTransfer_file::fill_index(TString& sigle_file,TString& nrec_file)
|
||||
|
||||
if (sigla == 'Z' || sigla == 'U' || sigla == 'B')
|
||||
_last_mov++;
|
||||
|
||||
// A causa di errori di invio da parte del sistema
|
||||
// a volte si possono riscontrare GPF.
|
||||
// La riga commentata sottostante viene lasciata come
|
||||
// possibile correzione (che alla PRASSI ovviamente non vogliono)
|
||||
// da sostituire a quella analoga poco piu' sotto.
|
||||
// In pratica viene tolto l'and con nrec != 0
|
||||
//
|
||||
// if (sigla != ' ')
|
||||
|
||||
if (sigla != ' ' && nrec != 0)
|
||||
{
|
||||
@ -944,17 +953,32 @@ int TTransfer_file::dataes(const TDate& d, int* prevesc, TDate& finesp)
|
||||
|
||||
char TTransfer_file::TipoConto(int g, int c)
|
||||
{
|
||||
TLocalisamfile pcon (LF_PCON);
|
||||
char tipo = ' ';
|
||||
|
||||
pcon.setkey(1);
|
||||
pcon.zero();
|
||||
pcon.put(PCN_GRUPPO, g);
|
||||
pcon.put(PCN_CONTO, c);
|
||||
pcon.put(PCN_SOTTOCONTO, 0l);
|
||||
if (pcon.read() == NOERR)
|
||||
tipo = pcon.get_char(PCN_TMCF);
|
||||
if (g != 0 && c != 0)
|
||||
{
|
||||
TLocalisamfile pcon (LF_PCON);
|
||||
|
||||
pcon.setkey(1);
|
||||
pcon.zero();
|
||||
pcon.put(PCN_GRUPPO, g);
|
||||
pcon.put(PCN_CONTO, c);
|
||||
pcon.put(PCN_SOTTOCONTO, 0l);
|
||||
if (pcon.read() == NOERR)
|
||||
tipo = pcon.get_char(PCN_TMCF);
|
||||
else // Se non lo trova sul piano dei conti standard, prova su quello temporaneo
|
||||
if (_tpcon != NULL) // Valido solo se si sta trasferendo anche il piano dei conti
|
||||
{
|
||||
_tpcon->put(PCN_GRUPPO, g);
|
||||
_tpcon->put(PCN_CONTO, c);
|
||||
_tpcon->put(PCN_SOTTOCONTO, 0l);
|
||||
if (_tpcon->read() == NOERR)
|
||||
tipo = _tpcon->get_char(PCN_TMCF);
|
||||
}
|
||||
}
|
||||
|
||||
if (tipo == '\0')
|
||||
tipo = ' ';
|
||||
return tipo;
|
||||
}
|
||||
|
||||
@ -3063,6 +3087,14 @@ bool TTransfer_file::ordina_trasfer(const char* orig)
|
||||
const word letti = fread((char*)(const char*)buffer, 1, size, i);
|
||||
buffer.cut(256);
|
||||
|
||||
// A causa di errori di invio da parte del sistema
|
||||
// a volte si possono riscontrare GPF.
|
||||
// La righe commentate sottostanti vengono lasciate come
|
||||
// possibile correzione (che alla PRASSI ovviamente non vogliono)
|
||||
//
|
||||
// if (buffer[0] == ' ' && buffer[1] == ' ')
|
||||
// buffer.ltrim();
|
||||
|
||||
ok = (letti == size);
|
||||
if (!ok) break;
|
||||
|
||||
@ -3104,7 +3136,7 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
|
||||
// conto i dischetti per l'apertura
|
||||
TString sigle,nrec;
|
||||
long nrec_cau,nrec_clifo,nrec_pcon,nrec_mov,nrec_moviva,nrec_salda;
|
||||
bool is_delete = FALSE;
|
||||
bool is_delete = FALSE, tpcon_valid = FALSE;
|
||||
|
||||
const char* const rflag = "rb";
|
||||
const char* const wflag = "ab";
|
||||
@ -3142,6 +3174,8 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
|
||||
}
|
||||
if ( (pos = sigle.find('P')) >= 0)
|
||||
{
|
||||
tpcon_valid = TRUE;
|
||||
|
||||
_tmppcon = "%";
|
||||
_tmppcon << path();
|
||||
_tmppcon << "\\" << TEMP_PCON;
|
||||
@ -3209,12 +3243,15 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
|
||||
bool ok = TRUE;
|
||||
|
||||
scrivi_header(dest,wflag);
|
||||
if (sigle.find('W') >= 0)
|
||||
scrivi_causali(nrec_cau);
|
||||
if (sigle.find('A') >= 0)
|
||||
scrivi_clifo(nrec_clifo);
|
||||
if (sigle.find('P') >= 0)
|
||||
scrivi_pcon(nrec_pcon);
|
||||
if (sigle.find('A') >= 0)
|
||||
scrivi_clifo(nrec_clifo);
|
||||
|
||||
_tpcon = tpcon_valid ? new TIsamtempfile(LF_PCON, _tmppcon, FALSE, FALSE) : NULL; // Non crearlo, non cancellarlo
|
||||
|
||||
if (sigle.find('W') >= 0)
|
||||
scrivi_causali(nrec_cau);
|
||||
if (sigle.find('Z') >= 0)
|
||||
scrivi_PN(nrec_mov);
|
||||
if (sigle.find('U') >= 0)
|
||||
@ -3226,6 +3263,9 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
|
||||
if (is_delete)
|
||||
delete _toccas;
|
||||
|
||||
if (tpcon_valid)
|
||||
delete _tpcon;
|
||||
|
||||
delete _ttab;
|
||||
|
||||
return ok;
|
||||
|
@ -447,6 +447,7 @@ NUMBER F_CDC 7
|
||||
BEGIN
|
||||
PROMPT 44 12 "Centro di costo "
|
||||
USE CDC
|
||||
FLAGS "UZ"
|
||||
INPUT CODTAB F_CDC
|
||||
DISPLAY "Codice@7" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
|
@ -4041,13 +4041,21 @@ bool TStampaBilanciCDC_application::user_create()
|
||||
_cdc_sheet = new TArray_sheet(-1, -1, -4, -4, "Selezione Centri di Costo",
|
||||
"@1|Codice@7R|Descrizione@50");
|
||||
|
||||
// Siccome sulla tabella dei centri di costo i codici sono memorizzati come stringa
|
||||
// ed allineati a sinistra e siccome la PRASSI (Cinzia) non vuole conversioni
|
||||
// E' necessario ordinare l'array letto in memoria.
|
||||
|
||||
TString_array& ac = _cdc_sheet->rows_array();
|
||||
for (_cdc_table->first(); !_cdc_table->eof(); _cdc_table->next())
|
||||
{
|
||||
TToken_string* tt = new TToken_string();
|
||||
tt->add(""); tt->add(_cdc_table->get("CODTAB")); tt->add(_cdc_table->get("S0"));
|
||||
_cdc_sheet->add(tt);
|
||||
TToken_string *t = new TToken_string;
|
||||
t->add("");
|
||||
t->add(_cdc_table->get("CODTAB"));
|
||||
t->add(_cdc_table->get("S0"));
|
||||
ac.add(t);
|
||||
}
|
||||
|
||||
|
||||
_tmp_saldi_att = NULL;
|
||||
_tmp_saldi_pass = NULL;
|
||||
_tmp_saldi_costi = NULL;
|
||||
|
@ -71,13 +71,13 @@ END
|
||||
NUMBER F_CDC_FR 7
|
||||
BEGIN
|
||||
PROMPT 40 6 "Da c. di costo "
|
||||
FLAGS "B"
|
||||
FLAGS "BUZ"
|
||||
END
|
||||
|
||||
NUMBER F_CDC_TO 7
|
||||
BEGIN
|
||||
PROMPT 40 7 "A c. di costo "
|
||||
FLAGS "B"
|
||||
FLAGS "BUZ"
|
||||
END
|
||||
|
||||
STRING F_SELECTED 5
|
||||
|
@ -1665,8 +1665,6 @@ void TPagamento::set_rate_auto()
|
||||
if (_tpr > 0 && _tpr < 4)
|
||||
set_imprata(0, importo_rata(0,v) + importo_da_non_dividere(v), v);
|
||||
}
|
||||
|
||||
// adjust_fixed_scad(); // Gia' fatto dalla set_inizio
|
||||
}
|
||||
|
||||
const real& TPagamento::importo_da_dividere(bool v) const
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
// gestisce da se' casi con e senza valuta
|
||||
void set_numero_rate(int n, int sscad = -1, int rdiff = 1);
|
||||
|
||||
void set_inizio(const TDate& d, bool rispetta_date = FALSE); // resetta tutto
|
||||
void set_inizio(const TDate& d, bool rispetta_date = FALSE); // resetta tutto
|
||||
const TDate& get_inizio() const { return _inizio; }
|
||||
const TDate& get_datadoc() const { return _datadoc; }
|
||||
|
||||
@ -174,8 +174,6 @@ public:
|
||||
void set_code(const char* c) { _code = c; }
|
||||
void set_roundval(int n) { _roundval = n; }
|
||||
|
||||
const TDate& get_inizio() const { return _inizio; }
|
||||
|
||||
bool in_valuta() const { return _in_valuta; }
|
||||
const real& cambio() const { return _cambio; }
|
||||
|
||||
|
117
cg/cgsaldac.cpp
117
cg/cgsaldac.cpp
@ -54,7 +54,6 @@ void TTree_rectype::copy_key_to_row(TRectype& row) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TRectype& TTree_rectype::new_row(int r)
|
||||
{
|
||||
if (r <= 0)
|
||||
@ -64,7 +63,6 @@ TRectype& TTree_rectype::new_row(int r)
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
int TTree_rectype::fill_array()
|
||||
{
|
||||
TRectype* row = (TRectype*)_recarr.key().dup();
|
||||
@ -111,13 +109,13 @@ int TTree_rectype::remove(TBaseisamfile& f) const
|
||||
// Valuta
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TValuta::TValuta(const char* cod, const TDate& dat, const real& cam)
|
||||
: _cod(cod), _dat(dat), _cam(cam)
|
||||
TValuta::TValuta(const char* cod, const TDate& dat, const real& cam, bool eur)
|
||||
: _cod(cod), _dat(dat), _cam(cam), _eur(eur)
|
||||
{
|
||||
adjust();
|
||||
}
|
||||
|
||||
TValuta::TValuta() : _cod(""), _dat(TODAY), _cam(1.0)
|
||||
TValuta::TValuta() : _cod(""), _dat(TODAY), _cam(ZERO), _eur(FALSE)
|
||||
{
|
||||
adjust();
|
||||
}
|
||||
@ -125,20 +123,18 @@ TValuta::TValuta() : _cod(""), _dat(TODAY), _cam(1.0)
|
||||
void TValuta::adjust()
|
||||
{
|
||||
const TCurrency firm_cur(ZERO, "_FIRM");
|
||||
_declit = _decval = firm_cur.decimals();
|
||||
|
||||
const TCurrency this_cur(ZERO, _cod);
|
||||
const TCurrency this_cur(ZERO, _cod, _eur);
|
||||
if (this_cur.same_value_as(firm_cur))
|
||||
{
|
||||
_cod.cut(0);
|
||||
_cam = 1.0;
|
||||
_cam = ZERO;
|
||||
_eur = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cam <= ZERO)
|
||||
_cam = 1.0;
|
||||
if (_cam < ZERO)
|
||||
_cam = ZERO;
|
||||
_cod = this_cur.get_value();
|
||||
_decval = this_cur.decimals();
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,6 +149,10 @@ void TValuta::get(const TRectype& rec)
|
||||
_cod = rec.get("CODVAL");
|
||||
_dat = rec.get("DATACAM");
|
||||
_cam = rec.get_real("CAMBIO");
|
||||
if (rec.exist("CONTROEURO"))
|
||||
_eur = rec.get_bool("CONTROEURO");
|
||||
else
|
||||
_eur = FALSE;
|
||||
adjust();
|
||||
}
|
||||
|
||||
@ -169,30 +169,40 @@ void TValuta::put(TRectype& rec) const
|
||||
rec.put("CODVAL", _cod);
|
||||
rec.put("DATACAM", _dat);
|
||||
rec.put("CAMBIO", _cam);
|
||||
if (rec.exist("CONTROEURO"))
|
||||
rec.put("CONTROEURO", _eur);
|
||||
}
|
||||
}
|
||||
|
||||
void TValuta::set(TMask& m, short v, short d, short c) const
|
||||
void TValuta::set(TMask& m, short v, short d, short c, short e) const
|
||||
{
|
||||
if (in_lire())
|
||||
{
|
||||
m.reset(v);
|
||||
m.reset(d);
|
||||
m.reset(c);
|
||||
if (e && m.id2pos(e) >= 0)
|
||||
m.reset(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.set(v, _cod);
|
||||
m.set(d, _dat.string());
|
||||
m.set(c, _cam.string());
|
||||
if (e && m.id2pos(e) >= 0)
|
||||
m.set(e, _eur ? "X" : "");
|
||||
}
|
||||
}
|
||||
|
||||
void TValuta::get(const TMask& m, short v, short d, short c)
|
||||
void TValuta::get(const TMask& m, short v, short d, short c, short e)
|
||||
{
|
||||
_cod = m.get(v);
|
||||
_dat = m.get(d);
|
||||
_cam = m.get_real(c);
|
||||
if (e && m.id2pos(e) >= 0)
|
||||
_eur = m.get_bool(e);
|
||||
else
|
||||
_eur = FALSE;
|
||||
adjust();
|
||||
}
|
||||
|
||||
@ -200,35 +210,36 @@ void TValuta::set(const TValuta& v)
|
||||
{
|
||||
_cod = v._cod;
|
||||
_dat = v._dat;
|
||||
_cam = v._cam;
|
||||
_cam = v._cam;
|
||||
_eur = v._eur;
|
||||
}
|
||||
|
||||
real TValuta::lit2val(const real& lit) const
|
||||
{
|
||||
real val(lit);
|
||||
val /= _cam;
|
||||
val.round(_decval);
|
||||
return val;
|
||||
TCurrency cur(lit, "_FIRM");
|
||||
cur.change_value(_cod, _cam, _eur);
|
||||
return cur.get_num();
|
||||
}
|
||||
|
||||
real TValuta::val2lit(const real& val) const
|
||||
{
|
||||
real lit(val);
|
||||
lit *= _cam;
|
||||
lit.round(_declit);
|
||||
return lit;
|
||||
TCurrency cur(val, _cod, _cam, _eur);
|
||||
cur.change_to_firm_val();
|
||||
return cur.get_num();
|
||||
}
|
||||
|
||||
void TValuta::val2lit(real& val) const
|
||||
{
|
||||
val *= _cam;
|
||||
val.round(_declit);
|
||||
TCurrency cur(val, _cod, _cam, _eur);
|
||||
cur.change_to_firm_val();
|
||||
val = cur.get_num();
|
||||
}
|
||||
|
||||
void TValuta::lit2val(real& lit) const
|
||||
{
|
||||
lit /= _cam;
|
||||
lit.round(_decval);
|
||||
TCurrency cur(lit, "_FIRM");
|
||||
cur.change_value(_cod, _cam, _eur);
|
||||
lit = cur.get_num();
|
||||
}
|
||||
|
||||
void TValuta::val2lit(TImporto& imp) const
|
||||
@ -462,10 +473,11 @@ bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta&
|
||||
old_abb = old_abbuono; // Vecchio abbuono in lire
|
||||
if (in_val)
|
||||
{
|
||||
// old_abb.valore() *= sum.get_real(PART_CAMBIO);
|
||||
// old_abb.valore().round();
|
||||
TCurrency cur(old_abb.valore(), "_FIRM");
|
||||
cur *= sum.get_real(PART_CAMBIO);
|
||||
const TString4 codval = sum.codice_valuta();
|
||||
const bool contro = ((TRectype&)sum).exist(PART_CONTROEURO) && sum.get_bool(PART_CONTROEURO);
|
||||
TCurrency cur(old_abb.valore(), codval,
|
||||
sum.get_real(PART_CAMBIO), contro);
|
||||
cur.change_to_firm_val();
|
||||
old_abb.valore() = cur.get_num();
|
||||
}
|
||||
|
||||
@ -482,10 +494,11 @@ bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta&
|
||||
new_abb = new_abbuono; // Calcola nuovo abbuono in lire
|
||||
if (in_valuta())
|
||||
{
|
||||
// new_abb.valore() *= sum.get_real(PART_CAMBIO);
|
||||
// new_abb.valore().round();
|
||||
TCurrency cur(new_abb.valore(), "_FIRM");
|
||||
cur *= sum.get_real(PART_CAMBIO);
|
||||
const TString4 codval = sum.codice_valuta();
|
||||
const bool contro = ((TRectype&)sum).exist(PART_CONTROEURO) && sum.get_bool(PART_CONTROEURO);
|
||||
TCurrency cur(new_abb.valore(), codval,
|
||||
sum.get_real(PART_CAMBIO), contro);
|
||||
cur.change_to_firm_val();
|
||||
new_abb.valore() = cur.get_num();
|
||||
}
|
||||
|
||||
@ -714,15 +727,13 @@ int TRiga_partite::ultima_rata_con_abbuoni_diffcam() const
|
||||
// Determina il codice valuta
|
||||
const TString& TRiga_partite::codice_valuta() const
|
||||
{
|
||||
const TString& cod = get(PART_CODVAL);
|
||||
return cod;
|
||||
return get(PART_CODVAL);
|
||||
}
|
||||
|
||||
// Determina se una riga e' in valuta in base al codice valuta
|
||||
bool TRiga_partite::in_valuta() const
|
||||
{
|
||||
const TString& cod = get(PART_CODVAL);
|
||||
return cod.not_empty();
|
||||
return codice_valuta().not_empty();
|
||||
}
|
||||
|
||||
// Calcola l'importo in lire o in valuta su di una riga di partita
|
||||
@ -920,17 +931,11 @@ void TPartita::carica_allineamento()
|
||||
|
||||
char TPartita::allineamento_richiesto(char tipocf)
|
||||
{
|
||||
char all;
|
||||
// Controlla se e' gia' stato caricato l'allineamento
|
||||
if (_cli_align <= ' ' || _for_align <= ' ')
|
||||
{
|
||||
#ifdef DBG
|
||||
warning_box("Questa applicazione usa le partite ma ignora i "
|
||||
"parametri ditta relativi al loro allineamento: "
|
||||
"continuiamo pure cosi', facciamoci del male!");
|
||||
#endif
|
||||
carica_allineamento();
|
||||
}
|
||||
|
||||
char all;
|
||||
switch (tipocf)
|
||||
{
|
||||
case 'C': all = _cli_align; break;
|
||||
@ -1291,13 +1296,13 @@ bool TPartita::elimina_pagamento(int nriga, int nrata, int nrigp)
|
||||
{
|
||||
if (nriga == UNASSIGNED)
|
||||
{
|
||||
TRectype old_pag(_unassigned.row(nrigp));
|
||||
old_pag.put(PAGSCA_ACCSAL, "A");
|
||||
old_pag.zero(PAGSCA_IMPORTO);
|
||||
old_pag.zero(PAGSCA_IMPORTOVAL);
|
||||
old_pag.zero(PAGSCA_RITENUTE);
|
||||
const TValuta val;
|
||||
modifica_pagamento(old_pag, val, TRUE);
|
||||
TRectype old_pag(_unassigned.row(nrigp));
|
||||
old_pag.put(PAGSCA_ACCSAL, "A");
|
||||
old_pag.zero(PAGSCA_IMPORTO);
|
||||
old_pag.zero(PAGSCA_IMPORTOVAL);
|
||||
old_pag.zero(PAGSCA_RITENUTE);
|
||||
const TValuta val;
|
||||
modifica_pagamento(old_pag, val, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1595,7 +1600,7 @@ TImporto TPartita::importo_pagato_unassigned(bool val, int mode) const
|
||||
const TRectype& pag = _unassigned.row(p); // Riga pagamento
|
||||
const TRiga_partite& sum = riga(pag.get_int(PAGSCA_NRIGP)); // Riga partite
|
||||
const char sez = sum.sezione();
|
||||
const int tipo = sum.get_int(PART_TIPOPAG);
|
||||
// const int tipo = sum.get_int(PART_TIPOPAG);
|
||||
|
||||
if (mode & 0x1)
|
||||
totale += TImporto(sez, pag.get_real(imp_field));
|
||||
@ -2061,4 +2066,4 @@ TRiga_partite* TPartite_array::mov2rig(long numreg, int numrig)
|
||||
return &game->riga(r);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -62,14 +62,15 @@ public:
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Valuta ///////////////////////////////////////////////////////////
|
||||
// Valuta
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TValuta : public TSortable
|
||||
{
|
||||
TString16 _cod;
|
||||
TString4 _cod;
|
||||
TDate _dat;
|
||||
real _cam;
|
||||
int _declit, _decval;
|
||||
bool _eur;
|
||||
|
||||
protected: // TSortable
|
||||
virtual int compare(const TSortable& s) const;
|
||||
@ -96,15 +97,15 @@ public:
|
||||
void get(const TRectype& rec);
|
||||
void put(TRectype& rec) const;
|
||||
|
||||
void set(TMask& m, short v, short d, short c) const;
|
||||
void get(const TMask& m, short v, short d, short c);
|
||||
void set(TMask& m, short v, short d, short c, short e = 0) const;
|
||||
void get(const TMask& m, short v, short d, short c, short e = 0);
|
||||
|
||||
const TValuta& operator =(const TValuta& v) { set(v); return *this; }
|
||||
|
||||
TValuta();
|
||||
TValuta(const char* cod, const TDate& dat, const real& cam);
|
||||
TValuta(const char* cod, const TDate& dat, const real& cam, bool eur = FALSE);
|
||||
TValuta(const TRectype& rec) { get(rec); }
|
||||
TValuta(const TMask& m, short v, short d, short c) { get(m, v, d, c); }
|
||||
TValuta(const TMask& m, short v, short d, short c, short e = 0) { get(m, v, d, c, e); }
|
||||
TValuta(const TValuta& v) { set(v); }
|
||||
virtual ~TValuta() {}
|
||||
};
|
||||
|
227
db/db0500.cpp
227
db/db0500.cpp
@ -4,6 +4,8 @@
|
||||
#include <relapp.h>
|
||||
#include <sheet.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <modaut.h>
|
||||
|
||||
#include "db0.h"
|
||||
#include "../mg/mglib.h"
|
||||
@ -17,22 +19,24 @@
|
||||
|
||||
#include <defmask.h>
|
||||
|
||||
bool query_string(const char* prompt, TString& str, int width = 50, const char* flags= "")
|
||||
bool copy_on_code(const char * oldcode, TString& newcode, int width = 50, const char* flags= "")
|
||||
{
|
||||
int maskwidth = width+2;
|
||||
int maskwidth = width+18;
|
||||
if (maskwidth < 26)
|
||||
maskwidth = 26;
|
||||
if (maskwidth > 78)
|
||||
maskwidth = 78;
|
||||
|
||||
TMask m(prompt, 1, maskwidth, 5);
|
||||
m.add_string(DLG_USER, 0, "", 1, 1, width, flags, width > 76 ? 76 : width);
|
||||
TMask m("Copia codice", 1, maskwidth, 5);
|
||||
m.add_string(DLG_USER+1, 0, "Vecchio codice ", 1, 1, width, "D", width > 76 ? 76 : width);
|
||||
m.add_string(DLG_USER, 0, "Nuovo codice ", 1, 2, width, flags, width > 76 ? 76 : width);
|
||||
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
||||
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
||||
m.set(DLG_USER, str);
|
||||
m.set(DLG_USER+1, oldcode);
|
||||
m.set(DLG_USER, newcode);
|
||||
bool ok = m.run() == K_ENTER;
|
||||
if (ok)
|
||||
str = m.get(DLG_USER);
|
||||
newcode = m.get(DLG_USER);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -80,6 +84,7 @@ TDistinta_app& app()
|
||||
|
||||
class TDistinta_sheet : public TSheet
|
||||
{
|
||||
TCodgiac_livelli _livgiac;
|
||||
TArray _data;
|
||||
|
||||
protected:
|
||||
@ -88,7 +93,7 @@ protected:
|
||||
|
||||
public:
|
||||
TArray& rows_array() { return _data; }
|
||||
TDistinta_sheet();
|
||||
TDistinta_sheet(int numlev);
|
||||
virtual ~TDistinta_sheet() { }
|
||||
};
|
||||
|
||||
@ -98,15 +103,27 @@ void TDistinta_sheet::get_row(long n, TToken_string& row)
|
||||
row.cut(0);
|
||||
row.add(re.tipo());
|
||||
row.add(re.articolo());
|
||||
row.add(re.giacenza());
|
||||
if (_livgiac.enabled(1))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),1));
|
||||
if (_livgiac.enabled(2))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),2));
|
||||
if (_livgiac.enabled(3))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),3));
|
||||
if (_livgiac.enabled(4))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),4));
|
||||
row.add(re.um());
|
||||
row.add(re.val().string(0, 5));
|
||||
row.add(re.livello());
|
||||
row.add(re.ordinamento());
|
||||
}
|
||||
|
||||
TDistinta_sheet::TDistinta_sheet()
|
||||
: TSheet(-1, -1, 0, 20, "Esplosione", "Tipo|Codice@20|Liv. Giacenza@15|UM|Quantita'@18R|Liv.@R|Sort@8R")
|
||||
TDistinta_sheet::TDistinta_sheet(int numlev)
|
||||
: TSheet(-1, -1, 76, 20, "Esplosione",
|
||||
numlev == 4 ? "Tipo|Codice@20|Liv.1@10|Liv.2@6|Liv.3@6|Liv.4@6|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
numlev == 3 ? "Tipo|Codice@20|Liv.1@10|Liv.2@6|Liv.3@6|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
numlev == 2 ? "Tipo|Codice@20|Liv.1@10|Liv.2@6|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
numlev == 1 ? "Tipo|Codice@20|Liv.1@10|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
"Tipo|Codice@20|UM|Quantita'@18R|Liv.@R|Sort@8R" )
|
||||
{
|
||||
}
|
||||
|
||||
@ -118,7 +135,9 @@ class TQuery_mask : public TAutomask
|
||||
{
|
||||
TDistinta_tree& _tree;
|
||||
TToken_string _curr;
|
||||
TCodgiac_livelli _livgiac;
|
||||
|
||||
bool redraw_tree(TField_event e);
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
@ -133,13 +152,15 @@ public:
|
||||
void TQuery_mask::restart_tree()
|
||||
{
|
||||
_tree.restart();
|
||||
int d =get_int(F_MIN_DEPTH);
|
||||
d = (d == 0 ? 3 : d);
|
||||
while (!_tree.is_leaf())
|
||||
{
|
||||
if (_tree.is_cyclic())
|
||||
break;
|
||||
_tree.expand();
|
||||
_tree.goto_firstson();
|
||||
if (_tree.has_rbrother())
|
||||
if (_tree.has_rbrother() && _tree.curr_depth() >= d)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -152,18 +173,27 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_VAR_LIV1:
|
||||
case F_VAR_LIV2:
|
||||
case F_VAR_LIV3:
|
||||
case F_VAR_LIV4:
|
||||
case F_CODICE:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TString strliv,oldstrliv;
|
||||
for (int l=0; l < 4 ; l++)
|
||||
_livgiac.pack_grpcode(strliv,get(F_VAR_LIV1+l), l+1);
|
||||
|
||||
TTree_field& tf = tfield(F_TREE);
|
||||
const TCodice_articolo val = o.get();
|
||||
const TCodice_articolo val = get(F_CODICE);
|
||||
if (val.not_empty() && _tree.has_root())
|
||||
{
|
||||
long pos = _tree.find_node(val);
|
||||
if (pos <= 0)
|
||||
_tree.curr_giaclev(oldstrliv);
|
||||
if (pos <= 0 || pos == 1 && strliv != oldstrliv)
|
||||
{
|
||||
if (_tree.set_root(val))
|
||||
restart_tree();
|
||||
if (_tree.set_root(val,"",1.0,strliv))
|
||||
redraw_tree(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -183,8 +213,8 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_tree.set_root(val))
|
||||
restart_tree();
|
||||
if (val.empty() || _tree.set_root(val,"",1.0,strliv))
|
||||
redraw_tree(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -195,8 +225,7 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
if (sk >= 0 && sk <= 5)
|
||||
{
|
||||
_tree.set_sort_key(sk);
|
||||
if (e == fe_modify)
|
||||
restart_tree();
|
||||
redraw_tree(e);
|
||||
}
|
||||
else
|
||||
error_box("Chiave di ordinamento errata: %d", sk);
|
||||
@ -229,7 +258,7 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
if (dist.read() == NOERR)
|
||||
{
|
||||
TString newcode;
|
||||
if (query_string("Nuovo codice", newcode, 20, "U"))
|
||||
if (copy_on_code(dist.get("CODDIST"),newcode, 20, "U"))
|
||||
{
|
||||
if (newcode.not_empty() && newcode != oldcode)
|
||||
{
|
||||
@ -288,7 +317,9 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
TCodice_articolo art = get(F_CODICE);
|
||||
if (art.not_empty())
|
||||
{
|
||||
_tree.set_root(art);
|
||||
TString strliv;
|
||||
_tree.curr_giaclev(strliv);
|
||||
_tree.set_root(art,"",1.0,strliv);
|
||||
restart_tree();
|
||||
}
|
||||
if (_tree.goto_root())
|
||||
@ -305,7 +336,7 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
m.set(F_VIRTUALI, "X");
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
TDistinta_sheet a;
|
||||
TDistinta_sheet a(_livgiac.last_level());
|
||||
a.set_caption(caption);
|
||||
int sk = m.get_int(F_SORT);
|
||||
int md = m.get_int(F_MAXDEPTH);
|
||||
@ -326,20 +357,51 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
}
|
||||
break;
|
||||
case F_VAR_IMPIANTO:
|
||||
case F_VAR_LINEA:
|
||||
if (e == fe_modify || e == fe_init)
|
||||
{
|
||||
_tree.set_global("_IMPIANTO",o.get());
|
||||
if (_tree.goto_root())
|
||||
restart_tree();
|
||||
switch (o.dlg()) {
|
||||
case F_VAR_IMPIANTO:
|
||||
_tree.set_global("_IMPIANTO",o.get()); break;
|
||||
case F_VAR_LINEA:
|
||||
_tree.set_global("_LINEA",o.get()); break;
|
||||
}
|
||||
redraw_tree(e);
|
||||
}
|
||||
break;
|
||||
case F_HIDE_GHOST:
|
||||
if (e == fe_modify)
|
||||
if (e == fe_modify || e == fe_init)
|
||||
{
|
||||
const char ig=*o.get();
|
||||
_tree.set_ignore_ghost(ig > ' ');
|
||||
if (_tree.goto_root())
|
||||
restart_tree();
|
||||
redraw_tree(e);
|
||||
}
|
||||
break;
|
||||
case F_SHOW_QTA:
|
||||
if (e == fe_modify || e == fe_init)
|
||||
{
|
||||
const char v=*o.get();
|
||||
_tree.set_qta_on_descr(v > ' ');
|
||||
redraw_tree(e);
|
||||
}
|
||||
break;
|
||||
case F_DESCR_SEP:
|
||||
if (e == fe_modify || e == fe_init)
|
||||
{
|
||||
const char v=*o.get();
|
||||
_tree.set_descr_separator(v);
|
||||
redraw_tree(e);
|
||||
}
|
||||
break;
|
||||
case F_SHOW_LIV1:
|
||||
case F_SHOW_LIV2:
|
||||
case F_SHOW_LIV3:
|
||||
case F_SHOW_LIV4:
|
||||
if (e == fe_modify || e == fe_init)
|
||||
{
|
||||
const char v=*o.get();
|
||||
_tree.set_livgiac_on_descr(o.dlg() - F_SHOW_LIV1 +1, v > ' ');
|
||||
redraw_tree(e);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -348,9 +410,42 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TQuery_mask::redraw_tree(TField_event e)
|
||||
{
|
||||
if (e == fe_modify && _tree.goto_root())
|
||||
{
|
||||
if (get(F_CODICE).blank())
|
||||
{
|
||||
TCodice_articolo c; _tree.curr_code(c);
|
||||
set(F_CODICE, c);
|
||||
return on_field_event((TOperable_field &)field(F_CODICE), fe_modify, 0l);
|
||||
}
|
||||
restart_tree();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
TQuery_mask::TQuery_mask(TDistinta_tree& dt)
|
||||
: TAutomask("db0500a"), _tree(dt)
|
||||
{
|
||||
if (!app().has_module(MRAUT))
|
||||
{
|
||||
hide(F_VAR_IMPIANTO);
|
||||
hide(F_VAR_LINEA);
|
||||
}
|
||||
for (int l=0; l<4; l++)
|
||||
{
|
||||
show(F_VAR_LIV1+l, _livgiac.enabled(l+1));
|
||||
show(F_SHOW_LIV1+l, _livgiac.enabled(l+1));
|
||||
if (_livgiac.enabled(l+1))
|
||||
{
|
||||
field(F_VAR_LIV1+l).set_prompt(_livgiac.name(l+1));
|
||||
field(F_SHOW_LIV1+l).set_prompt(format("Mostra %s",(const char *)_livgiac.name(l+1)));
|
||||
}
|
||||
}
|
||||
|
||||
TTree_field& tree = tfield(F_TREE);
|
||||
tree.set_tree(&_tree);
|
||||
}
|
||||
@ -362,6 +457,7 @@ TQuery_mask::TQuery_mask(TDistinta_tree& dt)
|
||||
class TDistinta_mask : public TAutomask
|
||||
{
|
||||
TDistinta_tree& _tree;
|
||||
TCodgiac_livelli *_livelli_giac;
|
||||
|
||||
void set_um_rif(int row);
|
||||
|
||||
@ -374,11 +470,46 @@ protected:
|
||||
bool test_row(const TToken_string& row);
|
||||
void load_um();
|
||||
|
||||
static void sheetrighe_get(TSheet_field &fld_righe, int item);
|
||||
static void sheetrighe_put(TSheet_field &fld_righe, int item);
|
||||
|
||||
public:
|
||||
TDistinta_mask(TDistinta_tree& dt);
|
||||
virtual ~TDistinta_mask() { }
|
||||
};
|
||||
|
||||
void TDistinta_mask::sheetrighe_get(TSheet_field &fld_righe, int item)
|
||||
{
|
||||
TDistinta_mask &m=(TDistinta_mask &)fld_righe.mask();
|
||||
// prende il record della riga corrente dal record array
|
||||
TRectype &rec= fld_righe.record()->row(item, TRUE);
|
||||
TToken_string &row= fld_righe.row(item-1);
|
||||
// codici di livello
|
||||
row.add(m._livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,1),fld_righe.cid2index(F_LIV1) );
|
||||
row.add(m._livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,2),fld_righe.cid2index(F_LIV2) );
|
||||
row.add(m._livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,3),fld_righe.cid2index(F_LIV3) );
|
||||
row.add(m._livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,4),fld_righe.cid2index(F_LIV4) );
|
||||
}
|
||||
void TDistinta_mask::sheetrighe_put(TSheet_field &fld_righe, int item)
|
||||
{
|
||||
TDistinta_mask &m=(TDistinta_mask &)fld_righe.mask();
|
||||
TToken_string &row= fld_righe.row(item-1);
|
||||
|
||||
TRectype &recrighe= fld_righe.record()->row(item, TRUE);
|
||||
// codici livello
|
||||
if (m._livelli_giac->enabled())
|
||||
{
|
||||
TString16 packedcode;
|
||||
m._livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV1)),1);
|
||||
m._livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV2)),2);
|
||||
m._livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV3)),3);
|
||||
m._livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV4)),4);
|
||||
recrighe.put("LIVELLO", packedcode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TDistinta_mask::load_um()
|
||||
{
|
||||
// *****************************
|
||||
@ -578,6 +709,20 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_TIPOCOMP:
|
||||
if (e == fe_init && o.focusdirty() &&
|
||||
( *o.get()=='D' || *o.get()=='V'))
|
||||
{
|
||||
// introduzione di una distinta virtuale: il default è l'ereditarietà dei livelli di giac
|
||||
TMask & m = sfield(F_SHEET).sheet_mask();
|
||||
for (int l=0; l < 4; l++)
|
||||
{
|
||||
if (m.get(F_LIV1+l).blank())
|
||||
m.set(F_TIPOLIV1+l,"E");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case F_CODART:
|
||||
case F_CODLAV:
|
||||
case F_CODDIS:
|
||||
@ -630,7 +775,8 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
|
||||
{
|
||||
const char* name = expr.varname(v);
|
||||
if (var.decode(name).empty())
|
||||
return m.error_box("La variabile %s non e' definita in tabella", name);
|
||||
if (!_tree.is_global(name))
|
||||
return m.error_box("La variabile %s non e' definita in tabella", name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -823,15 +969,22 @@ TDistinta_mask::TDistinta_mask(TDistinta_tree& dt)
|
||||
}
|
||||
}
|
||||
|
||||
TCodgiac_livelli cgl;
|
||||
for (i = 4; i > 0; i--)
|
||||
_livelli_giac = new TCodgiac_livelli();
|
||||
for (i = 3; i >= 0; i--)
|
||||
{
|
||||
const short id = F_LIV1+i-1;
|
||||
cgl.set_sheetcolumn(sf,id,i);
|
||||
const short id = F_LIV1+i*2;
|
||||
_livelli_giac->set_sheetcolumn(sf,id,i+1);
|
||||
if (!_livelli_giac->enabled(i+1))
|
||||
{
|
||||
sf.delete_column(id+1);
|
||||
sf.sheet_mask().hide(id+1);
|
||||
}
|
||||
}
|
||||
TSheet_field& su = sfield(F_UNITA);
|
||||
su.set_lines_record(*(new TRecord_array(LF_UMART, "NRIGA")));
|
||||
|
||||
sf.set_userget(sheetrighe_get);
|
||||
sf.set_userput(sheetrighe_put);
|
||||
cache().test_file_changes(LF_TAB);
|
||||
}
|
||||
|
||||
@ -957,6 +1110,9 @@ int TDistinta_app::read(TMask& m)
|
||||
int equal = row.find('=');
|
||||
if (equal > 0)
|
||||
row[equal] = SAFE_PIPE_CHR;
|
||||
row.insert(format(" %c",SAFE_PIPE_CHR),0);
|
||||
if (_tree.is_global(row.get(1)))
|
||||
row[0]='G';
|
||||
}
|
||||
}
|
||||
|
||||
@ -971,8 +1127,13 @@ void TDistinta_app::parms2rel(const TMask& m)
|
||||
FOR_EACH_SHEET_ROW(parms, r, row)
|
||||
{
|
||||
var = row->get(0);
|
||||
const char typ = var[0];
|
||||
var = row->get();
|
||||
if (!var.blank())
|
||||
{
|
||||
if (typ == 'G')
|
||||
if (!_tree.is_global(var))
|
||||
error_box("La variabile %s non e' una delle variabili globali. Consultare la documentazione del modulo Distinta Base",(const char *)var);
|
||||
memo.add(var);
|
||||
memo << '=';
|
||||
memo << row->get();
|
||||
|
69
db/db0500a.h
69
db/db0500a.h
@ -11,23 +11,30 @@
|
||||
#define F_COPY 507
|
||||
#define F_EXPLODE 508
|
||||
#define F_HIDE_GHOST 509
|
||||
#define F_SHOW_QTA 510
|
||||
#define F_SHOW_LIV1 511
|
||||
#define F_SHOW_LIV2 512
|
||||
#define F_SHOW_LIV3 513
|
||||
#define F_SHOW_LIV4 514
|
||||
#define F_DESCR_SEP 515
|
||||
#define F_MIN_DEPTH 516
|
||||
|
||||
#define F_DESCR 520
|
||||
#define F_ARTPROD 521
|
||||
#define F_ARTACQ 522
|
||||
#define F_PREZZO 523
|
||||
#define F_UM 524
|
||||
#define F_PESO 525
|
||||
#define F_UMP 526
|
||||
#define F_UMART1ST 527
|
||||
#define F_FCUMART 528
|
||||
#define F_MASTER 529
|
||||
|
||||
#define F_DESCR 510
|
||||
#define F_ARTPROD 511
|
||||
#define F_ARTACQ 512
|
||||
#define F_PREZZO 513
|
||||
#define F_UM 514
|
||||
#define F_PESO 515
|
||||
#define F_UMP 516
|
||||
#define F_UMART1ST 517
|
||||
#define F_FCUMART 518
|
||||
#define F_MASTER 519
|
||||
|
||||
#define F_SHEET 520
|
||||
#define F_UNITA 521
|
||||
#define F_PARAMS 522
|
||||
#define F_SHEET 530
|
||||
#define F_UNITA 531
|
||||
#define F_PARAMS 532
|
||||
|
||||
// settaggio variabili globali
|
||||
#define F_VAR_IMPIANTO 550
|
||||
#define F_VAR_LINEA 551
|
||||
#define F_VAR_MAG 552
|
||||
@ -45,18 +52,22 @@
|
||||
#define F_CODDIS 302
|
||||
#define F_CODVAR 402
|
||||
#define F_LIV1 103
|
||||
#define F_LIV2 104
|
||||
#define F_LIV3 105
|
||||
#define F_LIV4 106
|
||||
#define F_UMEXPR 107
|
||||
#define F_EXPR 108
|
||||
#define F_DESCOMP 109
|
||||
#define F_SORT1 110
|
||||
#define F_SORT2 111
|
||||
#define F_SORT3 112
|
||||
#define F_SORT4 113
|
||||
#define F_SORT5 114
|
||||
#define F_SORT0 115
|
||||
#define F_TIPOLIV1 104
|
||||
#define F_LIV2 105
|
||||
#define F_TIPOLIV2 106
|
||||
#define F_LIV3 107
|
||||
#define F_TIPOLIV3 108
|
||||
#define F_LIV4 109
|
||||
#define F_TIPOLIV4 110
|
||||
#define F_UMEXPR 111
|
||||
#define F_EXPR 112
|
||||
#define F_DESCOMP 113
|
||||
#define F_SORT1 114
|
||||
#define F_SORT2 115
|
||||
#define F_SORT3 116
|
||||
#define F_SORT4 117
|
||||
#define F_SORT5 118
|
||||
#define F_SORT0 119
|
||||
|
||||
#define FU_UM 101
|
||||
#define FU_FC 102
|
||||
@ -64,8 +75,10 @@
|
||||
#define FU_RIF 104
|
||||
#define FU_DESC 105
|
||||
|
||||
#define FV_PARAM 101
|
||||
#define FV_VALUE 102
|
||||
#define FV_TYPE 101
|
||||
#define FV_USERVAR 102
|
||||
#define FV_PARAM 202
|
||||
#define FV_VALUE 103
|
||||
|
||||
#define F_MATBASE 101
|
||||
#define F_MAXDEPTH 102
|
||||
|
159
db/db0500a.uml
159
db/db0500a.uml
@ -104,36 +104,9 @@ BEGIN
|
||||
DEFAULT NONE
|
||||
END
|
||||
|
||||
STRING F_VAR_IMPIANTO 5
|
||||
BEGIN
|
||||
FLAGS "UF"
|
||||
PROMPT 2 3 "Impianto "
|
||||
USE IMP
|
||||
INPUT CODTAB F_VAR_IMPIANTO
|
||||
DISPLAY "Codice " CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_VAR_IMPIANTO CODTAB
|
||||
MESSAGE CHECK, F_VAR_LINEA
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
STRING F_VAR_LINEA 5
|
||||
BEGIN
|
||||
FLAGS "UF"
|
||||
PROMPT 20 3 "Linea "
|
||||
USE LNP
|
||||
INPUT CODTAB F_VAR_LINEA
|
||||
DISPLAY "Codice " CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Impianto" S6
|
||||
OUPUT F_VAR_LINEA CODTAB
|
||||
OUPUT F_VAR_IMPIANTO S6
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
NUMBER F_SORT 1
|
||||
BEGIN
|
||||
PROMPT 2 4 "Ordinamento "
|
||||
PROMPT 2 3 "Ordinamento "
|
||||
USE ORD
|
||||
INPUT CODTAB F_SORT
|
||||
DISPLAY "Codice ordinamento" CODTAB
|
||||
@ -146,18 +119,91 @@ BEGIN
|
||||
DEFAULT NONE
|
||||
END
|
||||
|
||||
STRING F_SORTDESC 50
|
||||
STRING F_SORTDESC 30
|
||||
BEGIN
|
||||
PROMPT 24 4 ""
|
||||
PROMPT 24 3 ""
|
||||
FLAGS "D"
|
||||
DEFAULT NONE
|
||||
END
|
||||
|
||||
BOOL F_HIDE_GHOST
|
||||
STRING F_VAR_IMPIANTO 5
|
||||
BEGIN
|
||||
FLAGS "Fh"
|
||||
PROMPT 2 5 "Nascondi le distinte virtuali non di produzione"
|
||||
DEFAULT NONE
|
||||
FLAGS "UF"
|
||||
PROMPT 2 4 "Impianto "
|
||||
USE IMP
|
||||
INPUT CODTAB F_VAR_IMPIANTO
|
||||
DISPLAY "Codice " CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_VAR_IMPIANTO CODTAB
|
||||
MESSAGE CHECK, F_VAR_LINEA
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
STRING F_VAR_LINEA 5
|
||||
BEGIN
|
||||
FLAGS "UF"
|
||||
PROMPT 20 4 "Linea "
|
||||
USE LNP
|
||||
INPUT CODTAB F_VAR_LINEA
|
||||
DISPLAY "Codice " CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Impianto" S6
|
||||
OUPUT F_VAR_LINEA CODTAB
|
||||
OUPUT F_VAR_IMPIANTO S6
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
|
||||
STRING F_VAR_LIV1 10
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 2 5 "Livello 1"
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "1"
|
||||
INPUT CODTAB[2,20] F_VAR_LIV1
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_VAR_LIV1 CODTAB[2,20]
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
STRING F_VAR_LIV2 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 24 5 "Livello 2"
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "2"
|
||||
INPUT CODTAB[2,20] F_VAR_LIV2
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_VAR_LIV2 CODTAB[2,20]
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
STRING F_VAR_LIV3 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 44 5 "Livello 3"
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "3"
|
||||
INPUT CODTAB[2,20] F_VAR_LIV3
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_VAR_LIV3 CODTAB[2,20]
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
STRING F_VAR_LIV4 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 64 5 "Livello 4"
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "4"
|
||||
INPUT CODTAB[2,20] F_VAR_LIV4
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_VAR_LIV4 CODTAB[2,20]
|
||||
CHECKTYPE FORCED
|
||||
END
|
||||
|
||||
TREE F_TREE -3 -1
|
||||
@ -167,4 +213,49 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Visualizza" -1 -1 80 20
|
||||
BOOL F_HIDE_GHOST
|
||||
BEGIN
|
||||
FLAGS "FD"
|
||||
PROMPT 2 2 "Nascondi le distinte virtuali non di produzione"
|
||||
DEFAULT NONE
|
||||
END
|
||||
GROUPBOX DLG_NULL 78 8
|
||||
BEGIN
|
||||
PROMPT 1 3 "@bDescrizione"
|
||||
END
|
||||
STRING F_DESCR_SEP 1
|
||||
BEGIN
|
||||
PROMPT 2 4 "Separatore descrizione "
|
||||
END
|
||||
BOOL F_SHOW_QTA
|
||||
BEGIN
|
||||
PROMPT 2 5 "Mostra quantita'"
|
||||
END
|
||||
BOOL F_SHOW_LIV1
|
||||
BEGIN
|
||||
PROMPT 2 6 "Mostra livello giacenza 1"
|
||||
END
|
||||
BOOL F_SHOW_LIV2
|
||||
BEGIN
|
||||
PROMPT 2 7 "Mostra livello giacenza 2"
|
||||
END
|
||||
BOOL F_SHOW_LIV3
|
||||
BEGIN
|
||||
PROMPT 2 8 "Mostra livello giacenza 3"
|
||||
END
|
||||
BOOL F_SHOW_LIV4
|
||||
BEGIN
|
||||
PROMPT 2 9 "Mostra livello giacenza 4"
|
||||
END
|
||||
|
||||
NUMBER F_MIN_DEPTH 1
|
||||
BEGIN
|
||||
PROMPT 2 11 "Espandi almeno al livello "
|
||||
END
|
||||
|
||||
|
||||
ENDPAGE
|
||||
|
||||
|
||||
ENDMASK
|
||||
|
119
db/db0500b.uml
119
db/db0500b.uml
@ -173,7 +173,8 @@ BEGIN
|
||||
OUTPUT F_UMP CODTAB
|
||||
FIELD UMP
|
||||
GROUP 1
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
NUMBER F_SORT 1
|
||||
@ -202,9 +203,13 @@ BEGIN
|
||||
ITEM "Tipo@4"
|
||||
ITEM "Codice@20"
|
||||
ITEM "Liv1"
|
||||
ITEM "Tipo.L1"
|
||||
ITEM "Liv2"
|
||||
ITEM "Tipo.L2"
|
||||
ITEM "Liv3"
|
||||
ITEM "Tipo.L3"
|
||||
ITEM "Liv4"
|
||||
ITEM "Tipo.L4"
|
||||
ITEM "UM@3"
|
||||
ITEM "Espressione@30"
|
||||
ITEM "Descrizione@50"
|
||||
@ -257,6 +262,7 @@ SPREADSHEET F_PARAMS
|
||||
BEGIN
|
||||
FLAGS "|"
|
||||
PROMPT 0 10 ""
|
||||
ITEM "Tipo"
|
||||
ITEM "Variabile@20"
|
||||
ITEM "Valore@120"
|
||||
END
|
||||
@ -265,9 +271,9 @@ ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Distinta" -1 -1 68 15
|
||||
PAGE "Distinta" -1 -1 74 18
|
||||
|
||||
GROUPBOX DLG_NULL 66 6
|
||||
GROUPBOX DLG_NULL 66 9
|
||||
BEGIN
|
||||
PROMPT 1 0 "Componente"
|
||||
END
|
||||
@ -288,7 +294,7 @@ END
|
||||
|
||||
STRING F_CODART 20
|
||||
BEGIN
|
||||
PROMPT 35 1 "Codice "
|
||||
PROMPT 2 2 "Codice "
|
||||
USE LF_ANAMAG
|
||||
INPUT CODART F_CODART
|
||||
DISPLAY "Codice@20" CODART
|
||||
@ -302,7 +308,7 @@ END
|
||||
|
||||
STRING F_CODLAV 20
|
||||
BEGIN
|
||||
PROMPT 35 1 "Codice "
|
||||
PROMPT 2 2 "Codice "
|
||||
USE LAV
|
||||
INPUT CODTAB F_CODLAV
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
@ -315,7 +321,7 @@ END
|
||||
|
||||
STRING F_CODDIS 20
|
||||
BEGIN
|
||||
PROMPT 35 1 "Codice "
|
||||
PROMPT 2 2 "Codice "
|
||||
USE LF_DIST SELECT VIRTUALE=="X"
|
||||
INPUT CODDIST F_CODDIS
|
||||
DISPLAY "Codice@20" CODDIST
|
||||
@ -328,7 +334,7 @@ END
|
||||
|
||||
STRING F_CODVAR 20
|
||||
BEGIN
|
||||
PROMPT 35 1 "Codice "
|
||||
PROMPT 2 2 "Codice "
|
||||
USE VAR
|
||||
INPUT CODTAB F_CODVAR
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
@ -339,9 +345,26 @@ BEGIN
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING F_DESCOMP 50
|
||||
BEGIN
|
||||
PROMPT 2 3 "Descrizione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
LISTBOX F_TIPOLIV1 10
|
||||
BEGIN
|
||||
FIELD TIPO_LIV[1]
|
||||
PROMPT 2 4 ""
|
||||
ITEM " |Imposta"
|
||||
MESSAGE ENABLE,F_LIV1
|
||||
ITEM "E|Eredita"
|
||||
MESSAGE CLEAR,F_LIV1
|
||||
//TBI: ITEM "V|Variabile"
|
||||
END
|
||||
|
||||
STRING F_LIV1 10
|
||||
BEGIN
|
||||
PROMPT 2 2 "Livello 1 "
|
||||
PROMPT 16 4 "Livello 1 "
|
||||
FLAGS "U"
|
||||
USE GCG
|
||||
INPUT CODTAB[1,1] "1"
|
||||
@ -353,10 +376,20 @@ BEGIN
|
||||
MESSAGE EMPTY RESET,F_LIV2|RESET,F_LIV3|RESET,F_LIV4
|
||||
END
|
||||
|
||||
LISTBOX F_TIPOLIV2 10
|
||||
BEGIN
|
||||
FIELD TIPO_LIV[2]
|
||||
PROMPT 2 5 ""
|
||||
ITEM " |Imposta"
|
||||
MESSAGE ENABLE,F_LIV2
|
||||
ITEM "E|Eredita"
|
||||
MESSAGE CLEAR,F_LIV2
|
||||
END
|
||||
|
||||
STRING F_LIV2 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 36 2 "Livello 2 "
|
||||
PROMPT 16 5 "Livello 2 "
|
||||
USE GCG
|
||||
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||
INPUT CODTAB[1,1] "2"
|
||||
@ -367,10 +400,20 @@ BEGIN
|
||||
MESSAGE EMPTY RESET,F_LIV3|RESET,F_LIV4
|
||||
END
|
||||
|
||||
LISTBOX F_TIPOLIV3 10
|
||||
BEGIN
|
||||
FIELD TIPO_LIV[3]
|
||||
PROMPT 2 6 ""
|
||||
ITEM " |Imposta"
|
||||
MESSAGE ENABLE,F_LIV3
|
||||
ITEM "E|Eredita"
|
||||
MESSAGE CLEAR,F_LIV3
|
||||
END
|
||||
|
||||
STRING F_LIV3 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 2 3 "Livello 3 "
|
||||
PROMPT 16 6 "Livello 3 "
|
||||
USE GCG
|
||||
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||
INPUT CODTAB[1,1] "3"
|
||||
@ -381,10 +424,20 @@ BEGIN
|
||||
MESSAGE EMPTY RESET,F_LIV4
|
||||
END
|
||||
|
||||
LISTBOX F_TIPOLIV4 10
|
||||
BEGIN
|
||||
FIELD TIPO_LIV[4]
|
||||
PROMPT 2 7 ""
|
||||
ITEM " |Imposta"
|
||||
MESSAGE ENABLE,F_LIV4
|
||||
ITEM "E|Eredita"
|
||||
MESSAGE CLEAR,F_LIV4
|
||||
END
|
||||
|
||||
STRING F_LIV4 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 36 3 "Livello 4 "
|
||||
PROMPT 16 7 "Livello 4 "
|
||||
USE GCG
|
||||
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||
INPUT CODTAB[1,1] "4"
|
||||
@ -394,20 +447,14 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESCOMP 50
|
||||
BEGIN
|
||||
PROMPT 2 4 "Descrizione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 66 4
|
||||
BEGIN
|
||||
PROMPT 1 6 "Formula"
|
||||
PROMPT 1 9 "Formula"
|
||||
END
|
||||
|
||||
STRING F_UMEXPR 2
|
||||
BEGIN
|
||||
PROMPT 2 7 "Unita' di misura "
|
||||
PROMPT 2 10 "Unita' di misura "
|
||||
USE LF_UMART KEY 2 SELECT CODART==#F_CODART
|
||||
JOIN LF_ANAMAG INTO CODART==CODART
|
||||
INPUT CODART F_CODART SELECT
|
||||
@ -424,7 +471,7 @@ END
|
||||
|
||||
STRING F_EXPR 50 62
|
||||
BEGIN
|
||||
PROMPT 2 8 ""
|
||||
PROMPT 2 11 ""
|
||||
FIELD EXPR
|
||||
FLAGS "U"
|
||||
CHECKTYPE REQUIRED
|
||||
@ -433,47 +480,47 @@ END
|
||||
|
||||
GROUPBOX DLG_NULL 66 3
|
||||
BEGIN
|
||||
PROMPT 1 10 "Criteri d'ordinamento"
|
||||
PROMPT 1 13 "Criteri d'ordinamento"
|
||||
END
|
||||
|
||||
NUMBER F_SORT1 8
|
||||
BEGIN
|
||||
PROMPT 2 11 "1 "
|
||||
PROMPT 2 14 "1 "
|
||||
FIELD SORT1
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
NUMBER F_SORT2 8
|
||||
BEGIN
|
||||
PROMPT 15 11 "2 "
|
||||
PROMPT 15 14 "2 "
|
||||
FIELD SORT2
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
NUMBER F_SORT3 8
|
||||
BEGIN
|
||||
PROMPT 28 11 "3 "
|
||||
PROMPT 28 14 "3 "
|
||||
FIELD SORT3
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
NUMBER F_SORT4 8
|
||||
BEGIN
|
||||
PROMPT 41 11 "4 "
|
||||
PROMPT 41 14 "4 "
|
||||
FIELD SORT4
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
NUMBER F_SORT5 8
|
||||
BEGIN
|
||||
PROMPT 54 11 "5 "
|
||||
PROMPT 54 14 "5 "
|
||||
FIELD SORT5
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
NUMBER F_SORT0 8
|
||||
BEGIN
|
||||
PROMPT 80 11 "0 "
|
||||
PROMPT 80 14 "0 "
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
@ -563,19 +610,33 @@ ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
PAGE "Variabili" -1 -1 70 5
|
||||
|
||||
STRING FV_PARAM 20
|
||||
LIST FV_TYPE 7
|
||||
BEGIN
|
||||
PROMPT 1 1 "Variabile "
|
||||
ITEM " |utente"
|
||||
MESSAGE SHOW,FV_USERVAR|HIDE,FV_PARAM
|
||||
ITEM "G|globale"
|
||||
MESSAGE HIDE,FV_USERVAR|SHOW,FV_PARAM
|
||||
END
|
||||
|
||||
STRING FV_USERVAR 20
|
||||
BEGIN
|
||||
PROMPT 22 1 ""
|
||||
USE VAR
|
||||
INPUT CODTAB FV_PARAM
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
DISPLAY "Numerico@B" B0
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT FV_PARAM CODTAB
|
||||
OUTPUT FV_USERVAR CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "U"
|
||||
END
|
||||
STRING FV_PARAM 20
|
||||
BEGIN
|
||||
PROMPT 22 1 ""
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING FV_VALUE 120 55
|
||||
BEGIN
|
||||
|
10
db/db1.cpp
10
db/db1.cpp
@ -1,5 +1,4 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "db1.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
@ -7,12 +6,9 @@ int main(int argc, char** argv)
|
||||
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
db1200(argc, argv);
|
||||
break;
|
||||
default:
|
||||
db1100(argc, argv);
|
||||
break;
|
||||
case 1: db1200(argc, argv); break; // Stampa Anagrafica
|
||||
case 2: db1300(argc, argv); break; // Implosione
|
||||
default: db1100(argc, argv); break; // Esplosione
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
|
1
db/db1.h
1
db/db1.h
@ -3,5 +3,6 @@
|
||||
|
||||
int db1100(int argc, char* argv[]);
|
||||
int db1200(int argc, char* argv[]);
|
||||
int db1300(int argc, char* argv[]);
|
||||
|
||||
#endif
|
||||
|
@ -7,8 +7,3 @@
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
@ -47,7 +47,7 @@ struct _ParmStruct
|
||||
TDate _from_date, _to_date, _obs_date;
|
||||
long _from_doc, _to_doc;
|
||||
int _year, _periods, _det_lev, _ordering;
|
||||
bool _last_qta, _vis_art, _vis_lav, _vis_vir, _fabbisogno,
|
||||
bool _last_qta, _vis_art, _vis_lav, _vis_vir, _vis_gho, _fabbisogno,
|
||||
_val_magmb, _val_depmb, _cfr_scmin, _separate_dists, _det_ord_for;
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@ struct _CallBackStruct
|
||||
{
|
||||
_ParmStruct* _p;
|
||||
TAssoc_array* _a;
|
||||
} ;
|
||||
};
|
||||
|
||||
static TString __key;
|
||||
static TDate __current_period;
|
||||
|
459
db/db1300.cpp
Executable file
459
db/db1300.cpp
Executable file
@ -0,0 +1,459 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
|
||||
#include "dblib.h"
|
||||
|
||||
#include "db1300a.h"
|
||||
#include "db0500a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TXmas_tree
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TXmas_tree : public TDistinta_tree
|
||||
{
|
||||
TIsamtempfile _dist, _rdist;
|
||||
// TAssoc_array _ass_dist, _ass_rdist;
|
||||
|
||||
protected:
|
||||
virtual const TRectype& find_head(const TCodice_articolo& art) const;
|
||||
virtual const TRectype* find_child(const TCodice_articolo& art, int child) const;
|
||||
|
||||
public:
|
||||
void add_branch(TDistinta_tree& dt);
|
||||
|
||||
TXmas_tree();
|
||||
virtual ~TXmas_tree() { }
|
||||
};
|
||||
|
||||
const TRectype& TXmas_tree::find_head(const TCodice_articolo& art) const
|
||||
{
|
||||
TRectype& rec = _dist.curr();
|
||||
rec.put("CODDIST", art);
|
||||
const int err = ((TXmas_tree*)this)->_dist.read();
|
||||
if (err != NOERR)
|
||||
rec.zero();
|
||||
return rec;
|
||||
}
|
||||
|
||||
const TRectype* TXmas_tree::find_child(const TCodice_articolo& art, int child) const
|
||||
{
|
||||
/*
|
||||
TString80 key; key << art << '|' << child;
|
||||
TRectype* rec = (TRectype*)_ass_rdist.objptr(key);
|
||||
if (rec == NULL)
|
||||
{
|
||||
TLocalisamfile& righe = (TLocalisamfile&)_rdist;
|
||||
righe.put("CODDIST", art);
|
||||
righe.put("NRIG", child);
|
||||
const int err = righe.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
rec = new TRectype(righe.curr());
|
||||
((TXmas_tree*)this)->_ass_rdist.add(key, rec);
|
||||
}
|
||||
}
|
||||
return rec;
|
||||
*/
|
||||
TLocalisamfile& righe = (TLocalisamfile&)_rdist;
|
||||
righe.put("CODDIST", art);
|
||||
righe.put("NRIG", child);
|
||||
const int err = righe.read();
|
||||
return err == NOERR ? &righe.curr() : NULL;
|
||||
}
|
||||
|
||||
void TXmas_tree::add_branch(TDistinta_tree& dt)
|
||||
{
|
||||
TString old_node; dt.curr_id(old_node); // Memorizza posizione
|
||||
|
||||
while (dt.has_father())
|
||||
{
|
||||
const real qta = dt.last_qta();
|
||||
if (qta.is_zero())
|
||||
break; // Inutile proseguire
|
||||
TCodice_um um; dt.curr_um(um);
|
||||
TCodice_articolo art; dt.curr_code(art);
|
||||
if (find_head(art).empty())
|
||||
{
|
||||
TRectype& rec = _dist.curr();
|
||||
rec = cache().get(LF_DIST, art);
|
||||
if (rec.empty())
|
||||
{
|
||||
rec.put("CODDIST", art);
|
||||
}
|
||||
rec.write(_dist);
|
||||
}
|
||||
|
||||
dt.goto_father();
|
||||
TCodice_articolo father; dt.curr_code(father);
|
||||
TString80 level; dt.curr_giaclev(level);
|
||||
const TRectype* child = NULL;
|
||||
for (int c = 1; ; c++)
|
||||
{
|
||||
child = find_child(art, c);
|
||||
if (child == NULL)
|
||||
break;
|
||||
if (child->get("CODCOMP") != father)
|
||||
continue;
|
||||
if (!level.blank() && child->get("LIVELLO") != level)
|
||||
continue;
|
||||
if (child->get_real("EXPR") == qta)
|
||||
break;
|
||||
}
|
||||
if (child == NULL)
|
||||
{
|
||||
TRectype& curr = _rdist.curr();
|
||||
curr.put("CODDIST", art);
|
||||
curr.put("NRIG", c);
|
||||
curr.put("TIPO", "A");
|
||||
curr.put("CODCOMP", father);
|
||||
curr.put("LIVELLO", level);
|
||||
curr.put("UM", um);
|
||||
curr.put("EXPR", qta);
|
||||
curr.write(_rdist);
|
||||
}
|
||||
}
|
||||
|
||||
dt.goto_node(old_node); // Ripristina posizione
|
||||
}
|
||||
|
||||
TXmas_tree::TXmas_tree()
|
||||
: _dist(LF_DIST, NULL, TRUE, TRUE), _rdist(LF_RDIST, NULL, TRUE, TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TDistinta_sheet
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TDistinta_sheet : public TSheet
|
||||
{
|
||||
TCodgiac_livelli _livgiac;
|
||||
TArray _data;
|
||||
|
||||
protected:
|
||||
virtual void get_row(long n, TToken_string& row);
|
||||
virtual long get_items() const { return _data.items(); }
|
||||
|
||||
public:
|
||||
TArray& rows_array() { return _data; }
|
||||
TDistinta_sheet(int numlev);
|
||||
virtual ~TDistinta_sheet() { }
|
||||
};
|
||||
|
||||
void TDistinta_sheet::get_row(long n, TToken_string& row)
|
||||
{
|
||||
const TRiga_esplosione& re = (const TRiga_esplosione&)_data[int(n)];
|
||||
row.cut(0);
|
||||
row.add(re.tipo());
|
||||
row.add(re.articolo());
|
||||
if (_livgiac.enabled(1))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),1));
|
||||
if (_livgiac.enabled(2))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),2));
|
||||
if (_livgiac.enabled(3))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),3));
|
||||
if (_livgiac.enabled(4))
|
||||
row.add(_livgiac.unpack_grpcode(re.giacenza(),4));
|
||||
row.add(re.um());
|
||||
row.add(re.val().string(0, 5));
|
||||
row.add(re.livello());
|
||||
row.add(re.ordinamento());
|
||||
}
|
||||
|
||||
TDistinta_sheet::TDistinta_sheet(int numlev)
|
||||
: TSheet(-1, -1, 76, 20, "Implosione",
|
||||
numlev == 4 ? "Tipo|Codice@20|Liv.1@10|Liv.2@6|Liv.3@6|Liv.4@6|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
numlev == 3 ? "Tipo|Codice@20|Liv.1@10|Liv.2@6|Liv.3@6|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
numlev == 2 ? "Tipo|Codice@20|Liv.1@10|Liv.2@6|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
numlev == 1 ? "Tipo|Codice@20|Liv.1@10|UM|Quantita'@18R|Liv.@R|Sort@8R" :
|
||||
"Tipo|Codice@20|UM|Quantita'@18R|Liv.@R|Sort@8R")
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Display_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TDisplay_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TDisplay_mask() : TAutomask("db1300b") { }
|
||||
virtual ~TDisplay_mask() { }
|
||||
};
|
||||
|
||||
bool TDisplay_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_EXPLODE:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TXmas_tree& tree = (TXmas_tree&)*tfield(F_TREE).tree();
|
||||
if (tree.goto_root())
|
||||
{
|
||||
TCodice_articolo art; tree.curr_code(art);
|
||||
TString80 caption; caption << "Lista d'implosione " << art;
|
||||
TMask m("db0500c");
|
||||
m.set_caption(caption);
|
||||
m.set(F_ARTICOLI, "X");
|
||||
m.set(F_LAVORAZIONI, "X");
|
||||
m.set(F_VIRTUALI, "X");
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
TCodgiac_livelli livgiac;
|
||||
TDistinta_sheet a(livgiac.last_level());
|
||||
a.set_caption(caption);
|
||||
int sk = m.get_int(F_SORT);
|
||||
int md = m.get_int(F_MAXDEPTH);
|
||||
TExplosion_grouping gr = TExplosion_grouping(m.get_int(F_GROUPMODE));
|
||||
bool mb = m.get_bool(F_MATBASE);
|
||||
|
||||
TString16 fi;
|
||||
if (m.get_bool(F_ARTICOLI)) fi << 'A';
|
||||
if (m.get_bool(F_LAVORAZIONI)) fi << 'L';
|
||||
if (m.get_bool(F_VIRTUALI)) fi << 'V';
|
||||
if (m.get_bool(F_GHOST)) fi << 'G';
|
||||
|
||||
if (tree.goto_root())
|
||||
{
|
||||
TIndwin iw(0, "Elaborazione in corso...", FALSE, FALSE);
|
||||
tree.explode(a.rows_array(), mb, gr, md, fi, sk);
|
||||
}
|
||||
a.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Implosion_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TImplosion_mask : public TAutomask
|
||||
{
|
||||
TXmas_tree* _xmas;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
void implode();
|
||||
void display();
|
||||
|
||||
TImplosion_mask();
|
||||
virtual ~TImplosion_mask();
|
||||
};
|
||||
|
||||
bool TImplosion_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_RESETVARS:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TSheet_field& vars = sfield(F_VARS);
|
||||
if (vars.items() > 0)
|
||||
{
|
||||
vars.destroy();
|
||||
delete _xmas;
|
||||
_xmas = new TXmas_tree;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct TImplosion_parameters
|
||||
{
|
||||
TCodice_articolo _art;
|
||||
TString80 _liv;
|
||||
TXmas_tree* _xmas;
|
||||
};
|
||||
|
||||
HIDDEN bool implode_callback(TTree& tree, void* jolly, word flags)
|
||||
{
|
||||
if (flags == SCAN_PRE_ORDER)
|
||||
{
|
||||
TImplosion_parameters* ip = (TImplosion_parameters*)jolly;
|
||||
TDistinta_tree& dt = (TDistinta_tree&)tree;
|
||||
TCodice_articolo code; dt.curr_code(code);
|
||||
if (code == ip->_art)
|
||||
{
|
||||
if (ip->_liv.blank())
|
||||
ip->_xmas->add_branch(dt);
|
||||
else
|
||||
{
|
||||
TString80 curliv; dt.curr_giaclev(curliv);
|
||||
if (ip->_liv == curliv)
|
||||
ip->_xmas->add_branch(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TImplosion_mask::implode()
|
||||
{
|
||||
TRelation rel(LF_DIST);
|
||||
TRectype dist_f(LF_DIST), dist_t(LF_DIST);
|
||||
dist_f.put("CODDIST", get(F_DA_ARTICOLO));
|
||||
dist_t.put("CODDIST", get(F_AD_ARTICOLO));
|
||||
TCursor cur(&rel, "", 1, &dist_f, &dist_t);
|
||||
|
||||
long items = 0;
|
||||
if (get_bool(F_USECATMER))
|
||||
{
|
||||
rel.add(LF_ANAMAG, "CODART==CODDIST");
|
||||
const TString& cm = get(F_CATMER);
|
||||
const int cmlen = cm.len();
|
||||
TString filter;
|
||||
filter << LF_ANAMAG << "->GRMERC";
|
||||
if (cmlen > 0 && cmlen < 5)
|
||||
filter << "[1," << cmlen << ']';
|
||||
filter << "=\"" << cm << '"';
|
||||
cur.setfilter(filter, TRUE);
|
||||
TIndwin iw(0, "Creazione lista articoli da esplodere...", FALSE, FALSE);
|
||||
items = cur.items();
|
||||
}
|
||||
else
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
items = cur.items();
|
||||
}
|
||||
|
||||
cur.freeze();
|
||||
|
||||
TString caption;
|
||||
caption << "Esplosione di " << items << " articoli in corso...";
|
||||
TProgind pi(items, caption, TRUE, TRUE);
|
||||
|
||||
TSheet_field& vars = sfield(F_VARS);
|
||||
const TRectype& curr = cur.curr();
|
||||
|
||||
TString livello;
|
||||
TCodgiac_livelli livgiac;
|
||||
|
||||
TDistinta_tree dt;
|
||||
|
||||
TImplosion_parameters ip;
|
||||
ip._art = get(F_ARTICOLO);
|
||||
ip._xmas = _xmas;
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
if (pi.iscancelled()) break;
|
||||
if (vars.items() == 0) vars.row(-1); // Crea almeno una riga vuota
|
||||
// Scansione di tutte le righe abilitate
|
||||
FOR_EACH_SHEET_ROW(vars, r, row) if (vars.cell_enabled(r, 0))
|
||||
{
|
||||
dt.clear_globals();
|
||||
dt.set_global("_IMPIANTO", row->get(0));
|
||||
dt.set_global("_LINEA", row->get(1));
|
||||
dt.set_global("_MAGAZZINO", row->get(2));
|
||||
dt.set_global("_DEPOSITO", row->get(3));
|
||||
vars.check_row(r);
|
||||
livgiac.pack_maskgrpcodes(livello, vars.sheet_mask(), 105, 4);
|
||||
dt.set_root(curr.get("CODDIST"), "", 1.0, livello);
|
||||
dt.scan_depth_first(implode_callback, &ip);
|
||||
}
|
||||
}
|
||||
FOR_EACH_SHEET_ROW(vars, r, row)
|
||||
vars.disable_cell(r, -1);
|
||||
vars.force_update();
|
||||
pi.set_text("Espansione dell'albero di implosione...");
|
||||
do_events();
|
||||
|
||||
livgiac.pack_maskgrpcodes(livello, *this, F_LEV1, 4);
|
||||
_xmas->set_root(ip._art, "", 1.0, livello);
|
||||
_xmas->expand_all();
|
||||
}
|
||||
|
||||
void TImplosion_mask::display()
|
||||
{
|
||||
TDisplay_mask* m = new TDisplay_mask;
|
||||
TTree_field& tf = m->tfield(F_TREE);
|
||||
tf.set_tree(_xmas);
|
||||
m->run();
|
||||
delete m;
|
||||
}
|
||||
|
||||
TImplosion_mask::TImplosion_mask() : TAutomask("db1300a")
|
||||
{
|
||||
_xmas = new TXmas_tree;
|
||||
|
||||
TCodgiac_livelli liv;
|
||||
liv.set_sheet_columns(sfield(F_VARS), 105);
|
||||
}
|
||||
|
||||
TImplosion_mask::~TImplosion_mask()
|
||||
{ delete _xmas; }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Implosion Application
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TImplosion : public TSkeleton_application
|
||||
{
|
||||
TImplosion_mask* _impl;
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual void on_firm_change();
|
||||
virtual void main_loop();
|
||||
virtual bool destroy();
|
||||
|
||||
void reset_tree();
|
||||
};
|
||||
|
||||
bool TImplosion::create()
|
||||
{
|
||||
open_files(LF_TAB, LF_TABCOM, LF_DIST, LF_RDIST, LF_ANAMAG, LF_UMART, NULL);
|
||||
_impl = new TImplosion_mask;
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
void TImplosion::on_firm_change()
|
||||
{
|
||||
TCodgiac_livelli livgiac;
|
||||
for (int i = 1; i <= 4; i++)
|
||||
_impl->enable(F_LEV1+i-1, livgiac.enabled(i));
|
||||
}
|
||||
|
||||
void TImplosion::main_loop()
|
||||
{
|
||||
while (_impl->run() != K_QUIT)
|
||||
{
|
||||
_impl->implode();
|
||||
_impl->display();
|
||||
}
|
||||
}
|
||||
|
||||
bool TImplosion::destroy()
|
||||
{
|
||||
delete _impl;
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
int db1300(int argc, char* argv[])
|
||||
{
|
||||
TImplosion bum;
|
||||
bum.run(argc, argv, "Implosione");
|
||||
return 0;
|
||||
}
|
23
db/db1300a.h
Executable file
23
db/db1300a.h
Executable file
@ -0,0 +1,23 @@
|
||||
#define F_DISTTYPE 201
|
||||
#define F_ARTICOLO 202
|
||||
#define F_ARTDESCR 203
|
||||
#define F_DISTINTA 204
|
||||
#define F_DISDESCR 205
|
||||
#define F_LAVORAZIONE 206
|
||||
#define F_LAVDESCR 207
|
||||
#define F_LEV1 210
|
||||
#define F_LEV2 211
|
||||
#define F_LEV3 212
|
||||
#define F_LEV4 213
|
||||
|
||||
#define F_VARS 300
|
||||
#define F_RESETVARS 301
|
||||
#define F_IMPIANTO 101
|
||||
#define F_LINEA 102
|
||||
#define F_MAGAZZINO 103
|
||||
#define F_DEPOSITO 104
|
||||
|
||||
#define F_USECATMER 220
|
||||
#define F_CATMER 221
|
||||
#define F_DA_ARTICOLO 222
|
||||
#define F_AD_ARTICOLO 223
|
352
db/db1300a.uml
Executable file
352
db/db1300a.uml
Executable file
@ -0,0 +1,352 @@
|
||||
#include "db1300a.h"
|
||||
|
||||
TOOLBAR "" 0 -3 0 3
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -11 ""
|
||||
END
|
||||
|
||||
BUTTON F_RESETVARS 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -11 "~Azzera"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -11 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Implosione" -1 -1 60 20
|
||||
|
||||
GROUPBOX DLG_NULL 78 4
|
||||
BEGIN
|
||||
PROMPT 1 0 "@bCodice da implodere"
|
||||
END
|
||||
|
||||
LIST F_DISTTYPE 1 12
|
||||
BEGIN
|
||||
PROMPT 2 1 ""
|
||||
ITEM "A|Articolo"
|
||||
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@|SHOW,4@
|
||||
ITEM "D|Distinta"
|
||||
MESSAGE HIDE,1@|SHOW,2@|HIDE,3@|SHOW,4@
|
||||
ITEM "L|Lavorazione"
|
||||
MESSAGE HIDE,1@|HIDE,2@|SHOW,3@|HIDE,4@
|
||||
END
|
||||
|
||||
STRING F_ARTICOLO 20
|
||||
BEGIN
|
||||
PROMPT 18 1 ""
|
||||
USE LF_ANAMAG
|
||||
INPUT CODART F_ARTICOLO
|
||||
DISPLAY "Codice@20" CODART
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_ARTICOLO CODART
|
||||
OUTPUT F_ARTDESCR DESCR
|
||||
CHECKTYPE REQUIRED
|
||||
ADD RUN ve2 -3
|
||||
FLAGS "U"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_ARTDESCR 50 32
|
||||
BEGIN
|
||||
KEY 2
|
||||
PROMPT 44 1 ""
|
||||
USE LF_ANAMAG KEY 2
|
||||
INPUT DESCR F_ARTDESCR
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Codice@20" CODART
|
||||
COPY OUTPUT F_ARTICOLO
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN ve2 -3
|
||||
FLAGS "U"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_DISTINTA 20
|
||||
BEGIN
|
||||
PROMPT 18 1 ""
|
||||
USE LF_DIST SELECT VIRTUALE="X"
|
||||
INPUT CODDIST F_DISTINTA
|
||||
DISPLAY "Codice@20" CODDIST
|
||||
DISPLAY "Desrizione@50" DESCR
|
||||
OUTPUT F_DISTINTA CODDIST
|
||||
CHECKTYPE REQUIRED
|
||||
ADD RUN db0 -4
|
||||
MESSAGE COPY,F_ARTICOLO
|
||||
FLAGS "U"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_LAVORAZIONE 20
|
||||
BEGIN
|
||||
PROMPT 18 1 ""
|
||||
USE LAV
|
||||
INPUT CODTAB F_LAVORAZIONE
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_LAVORAZIONE CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
MESSAGE COPY,F_ARTICOLO
|
||||
FLAGS "U"
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
STRING F_LEV1 10
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 2 2 "Liv. 1 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "1"
|
||||
INPUT CODTAB[2,20] F_LEV1
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_LEV1 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
STRING F_LEV2 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 25 2 "Liv. 2 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "2"
|
||||
INPUT CODTAB[2,20] F_LEV2
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_LEV2 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
STRING F_LEV3 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 44 2 "Liv. 3 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "3"
|
||||
INPUT CODTAB[2,20] F_LEV3
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_LEV3 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
STRING F_LEV4 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 63 2 "Liv. 4 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "4"
|
||||
INPUT CODTAB[2,20] F_LEV4
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_LEV4 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 1 4 "@bVariabili d'ambiente"
|
||||
END
|
||||
|
||||
SPREADSHEET F_VARS 78 8
|
||||
BEGIN
|
||||
PROMPT 1 5 ""
|
||||
ITEM "Impianto"
|
||||
ITEM "Linea"
|
||||
ITEM "Magazzino"
|
||||
ITEM "Deposito"
|
||||
ITEM "Liv. 1@10"
|
||||
ITEM "Liv. 2@6"
|
||||
ITEM "Liv. 3@6"
|
||||
ITEM "Liv. 4@6"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 4
|
||||
BEGIN
|
||||
PROMPT 1 15 "@bProdotti Finiti"
|
||||
END
|
||||
|
||||
BOOLEAN F_USECATMER
|
||||
BEGIN
|
||||
PROMPT 2 16 "Per categoria merceologica"
|
||||
MESSAGE FALSE HIDE,F_CATMER
|
||||
MESSAGE TRUE SHOW,F_CATMER
|
||||
END
|
||||
|
||||
STRING F_CATMER 5
|
||||
BEGIN
|
||||
PROMPT 34 16 ""
|
||||
FLAG "U"
|
||||
USE GMC
|
||||
INPUT CODTAB F_CATMER
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CATMER CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DA_ARTICOLO 20
|
||||
BEGIN
|
||||
PROMPT 2 17 "Dal "
|
||||
COPY USE F_ARTICOLO
|
||||
INPUT CODART F_DA_ARTICOLO
|
||||
COPY DISPLAY F_ARTICOLO
|
||||
OUTPUT F_DA_ARTICOLO CODART
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN ve2 -3
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING F_AD_ARTICOLO 20
|
||||
BEGIN
|
||||
PROMPT 42 17 "Al "
|
||||
COPY USE F_ARTICOLO
|
||||
INPUT CODART F_AD_ARTICOLO
|
||||
COPY DISPLAY F_ARTICOLO
|
||||
OUTPUT F_AD_ARTICOLO CODART
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN ve2 -3
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Variabili" -1 -1 60 8
|
||||
|
||||
STRING F_IMPIANTO 5
|
||||
BEGIN
|
||||
FLAGS "UF"
|
||||
PROMPT 1 1 "Impianto "
|
||||
USE IMP
|
||||
INPUT CODTAB F_IMPIANTO
|
||||
DISPLAY "Codice " CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT F_IMPIANTO CODTAB
|
||||
MESSAGE CHECK, F_LINEA
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_LINEA 5
|
||||
BEGIN
|
||||
FLAGS "UF"
|
||||
PROMPT 36 1 "Linea "
|
||||
USE LNP
|
||||
INPUT CODTAB F_LINEA
|
||||
DISPLAY "Codice " CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Impianto" S6
|
||||
OUPUT F_LINEA CODTAB
|
||||
OUPUT F_IMPIANTO S6
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_MAGAZZINO 3
|
||||
BEGIN
|
||||
PROMPT 1 2 "Magazzino "
|
||||
USE MAG SELECT CODTAB[4,5]=""
|
||||
INPUT CODTAB F_MAGAZZINO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_MAGAZZINO CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DEPOSITO 2
|
||||
BEGIN
|
||||
PROMPT 36 2 "Deposito "
|
||||
USE MAG SELECT CODTAB[4,5]!=""
|
||||
INPUT CODTAB[1,3] F_MAGAZZINO
|
||||
INPUT CODTAB[4,5] F_DEPOSITO
|
||||
DISPLAY "Magazzino" CODTAB[1,3]
|
||||
DISPLAY "Deposito" CODTAB[4,5]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_MAGAZZINO CODTAB[1,3]
|
||||
OUTPUT F_DEPOSITO CODTAB[4,5]
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING 105 10
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 1 3 "Liv. 1 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "1"
|
||||
INPUT CODTAB[2,20] 105
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT 105 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
STRING 106 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 36 3 "Liv. 2 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "2"
|
||||
INPUT CODTAB[2,20] 106
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT 106 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
STRING 107 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 1 4 "Liv. 3 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "3"
|
||||
INPUT CODTAB[2,20] 107
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT 107 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
STRING 108 6
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 36 4 "Liv. 4 "
|
||||
USE GCG
|
||||
INPUT CODTAB[1] "4"
|
||||
INPUT CODTAB[2,20] 108
|
||||
DISPLAY "Codice " CODTAB[2,20]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUPUT 108 CODTAB[2,20]
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
26
db/db1300b.uml
Executable file
26
db/db1300b.uml
Executable file
@ -0,0 +1,26 @@
|
||||
#include "db0500a.h"
|
||||
|
||||
TOOLBAR "" 0 -3 0 3
|
||||
|
||||
BUTTON F_EXPLODE 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 "~Lista"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -11 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Implosione" -1 -1 60 20
|
||||
|
||||
TREE F_TREE -3 -1
|
||||
BEGIN
|
||||
PROMPT 0 1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -12,7 +12,7 @@ int main(int argc, char** argv)
|
||||
case 1:
|
||||
dbcv01(argc, argv); break;
|
||||
default:
|
||||
dbcv00(argc, argv); break;
|
||||
dbcv02(argc, argv); break;
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
|
@ -3,5 +3,6 @@
|
||||
|
||||
int dbcv00(int argc, char* argv[]);
|
||||
int dbcv01(int argc, char* argv[]);
|
||||
int dbcv02(int argc, char* argv[]);
|
||||
|
||||
#endif
|
||||
|
1139
db/dbcv00.cpp
1139
db/dbcv00.cpp
File diff suppressed because it is too large
Load Diff
37
db/dbcv00a.h
37
db/dbcv00a.h
@ -3,13 +3,42 @@
|
||||
#define F_BOMS 103
|
||||
#define F_DIVS 104
|
||||
#define F_ANNO 105
|
||||
#define F_RESETMORTI 106
|
||||
#define F_EAN 107
|
||||
#define F_ICLAS 108
|
||||
#define F_ORDPROD 120
|
||||
#define F_ORDACQ 121
|
||||
#define F_ORDCLI 122
|
||||
#define F_MOVMAG 123
|
||||
#define F_CREAMAG3 124
|
||||
#define F_SOLOGHOST 125
|
||||
#define F_CHANGEGMC 126
|
||||
#define F_SOLOGHOST 124
|
||||
#define F_CHANGEGMC 125
|
||||
|
||||
#define F_SERVICE 126
|
||||
#define F_DOSERVICE 127
|
||||
|
||||
#define F_ERASE_ARTS 130
|
||||
#define F_CHECKDEADARTS 131
|
||||
|
||||
#define F_MOVMAG_FROMD 150
|
||||
#define F_MOVMAG_TOD 151
|
||||
#define F_MOVMAG_FILE 152
|
||||
#define F_MOVMAG_SE 153
|
||||
#define F_MOVMAG_TS 154
|
||||
|
||||
#define S_CODIMP 200
|
||||
#define S_MOVMAG_FILE 201
|
||||
#define S_LASTBOLLA 202
|
||||
#define S_MOVMAG_FROMD 203
|
||||
#define S_MOVMAG_TOD 204
|
||||
|
||||
#define G_ARTICOLI 10
|
||||
#define G_DISTINTE 20
|
||||
#define G_MOVMAG 30
|
||||
#define G_SERVICE 100
|
||||
#define G_SERVICE_1 101
|
||||
#define G_SERVICE_2 102
|
||||
#define G_SERVICE_3 103
|
||||
#define G_SERVICE_8 108
|
||||
#define G_SERVICE_10 110
|
||||
#define G_SERVICE_11 114
|
||||
#define G_SERVICE_12 115
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
#include "dbcv00a.h"
|
||||
#define G_ARTICOLI 10
|
||||
#define G_DISTINTE 20
|
||||
#define G_MOVMAG 30
|
||||
|
||||
TOOLBAR "" 0 19 0 0
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 "~OK"
|
||||
PICTURE BMP_OK
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
@ -19,7 +21,7 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Importazione Distinta base" -1 -1 80 20
|
||||
PAGE "Archivi" -1 -1 80 20
|
||||
|
||||
STRING DLG_PROFILE 70
|
||||
BEGIN
|
||||
@ -33,70 +35,103 @@ BEGIN
|
||||
PROMPT 1 1 "Percorso dei files DBF di BPCS "
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 2
|
||||
BOOL F_CHECKDEADARTS
|
||||
BEGIN
|
||||
PROMPT 1 3 "Chiedi conferma per le distinte risalenti al "
|
||||
END
|
||||
BOOL F_RESETMORTI
|
||||
BEGIN
|
||||
PROMPT 1 4 "Azzera file articoli da ignorare"
|
||||
END
|
||||
BOOL F_CREAMAG3
|
||||
BEGIN
|
||||
PROMPT 42 4 "Crea i magazzini terzisti"
|
||||
PROMPT 1 3 "Utilizza il file degli articoli defunti"
|
||||
END
|
||||
|
||||
BOOL F_ARTS
|
||||
BOOL F_ARTS
|
||||
BEGIN
|
||||
PROMPT 1 6 "Carica gli articoli"
|
||||
PROMPT 1 4 "Carica gli articoli"
|
||||
MESSAGE TRUE SHOW,G_ARTICOLI@
|
||||
MESSAGE FALSE HIDE,G_ARTICOLI@
|
||||
MESSAGE FALSE HIDE,G_ARTICOLI@|RESET,G_ARTICOLI@
|
||||
END
|
||||
BOOL F_CHANGEGMC
|
||||
BEGIN
|
||||
PROMPT 38 6 "Ricarica solo i gr.merc."
|
||||
MESSAGE TRUE DISABLE,F_EAN
|
||||
MESSAGE FALSE ENABLE,F_EAN
|
||||
PROMPT 3 5 "Ricarica solo i gr.merc."
|
||||
MESSAGE TRUE DISABLE,F_EAN |CLEAR,F_ERASE_ARTS
|
||||
MESSAGE FALSE ENABLE,F_EAN |ENABLE,F_ERASE_ARTS
|
||||
GROUP G_ARTICOLI
|
||||
END
|
||||
BOOL F_ERASE_ARTS
|
||||
BEGIN
|
||||
PROMPT 38 5 "Azzera l'archivio"
|
||||
GROUP G_ARTICOLI
|
||||
END
|
||||
|
||||
LIST F_EAN 40
|
||||
LIST F_ICLAS 45
|
||||
BEGIN
|
||||
PROMPT 3 7 ""
|
||||
ITEM " |Non caricare i codici EAN"
|
||||
ITEM "8|Carica codici EAN 8"
|
||||
ITEM "13|Carica codici EAN 13"
|
||||
GROUP G_ARTICOLI
|
||||
END
|
||||
LIST F_ICLAS 40
|
||||
BEGIN
|
||||
PROMPT 3 8 ""
|
||||
PROMPT 3 6 ""
|
||||
ITEM " |Non caricare il campo ICLAS"
|
||||
ITEM "S|Carica ICLAS come sotto cat.merc."
|
||||
ITEM "C|Carica ICLAS come cat.merc."
|
||||
GROUP G_ARTICOLI
|
||||
END
|
||||
LIST F_EAN 30
|
||||
BEGIN
|
||||
PROMPT 40 6 ""
|
||||
ITEM " |Non caricare i codici EAN"
|
||||
ITEM "8|Carica codici EAN 8"
|
||||
ITEM "13|Carica codici EAN 13"
|
||||
GROUP G_ARTICOLI
|
||||
END
|
||||
|
||||
BOOL F_BOMS
|
||||
BEGIN
|
||||
PROMPT 1 10 "Carica le distinte"
|
||||
PROMPT 1 7 "Carica le distinte"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 2
|
||||
BEGIN
|
||||
PROMPT 3 8 "Chiedi conferma per le distinte risalenti al "
|
||||
END
|
||||
|
||||
BOOL F_DIVS
|
||||
BEGIN
|
||||
PROMPT 40 10 "Carica i divisori"
|
||||
PROMPT 40 7 "Carica i divisori"
|
||||
END
|
||||
|
||||
BOOL F_MOVMAG
|
||||
BEGIN
|
||||
PROMPT 1 12 "Carica le movimentazioni di magazzino"
|
||||
PROMPT 1 9 "Carica i movimenti di magazzino"
|
||||
MESSAGE TRUE SHOW, G_MOVMAG@
|
||||
MESSAGE FALSE HIDE, G_MOVMAG@
|
||||
END
|
||||
BOOL F_MOVMAG_SE
|
||||
BEGIN
|
||||
PROMPT 3 10 "Carica mov. Segrate"
|
||||
MESSAGE FALSE "X", F_MOVMAG_TS
|
||||
GROUP G_MOVMAG
|
||||
END
|
||||
BOOL F_MOVMAG_TS
|
||||
BEGIN
|
||||
PROMPT 40 10 "Carica mov. Trieste"
|
||||
MESSAGE FALSE "X", F_MOVMAG_SE
|
||||
GROUP G_MOVMAG
|
||||
END
|
||||
STRING F_MOVMAG_FILE 20
|
||||
BEGIN
|
||||
PROMPT 3 11 "Nome file: "
|
||||
GROUP G_MOVMAG
|
||||
END
|
||||
DATE F_MOVMAG_FROMD
|
||||
BEGIN
|
||||
PROMPT 3 12 "Dalla data:"
|
||||
GROUP G_MOVMAG
|
||||
END
|
||||
DATE F_MOVMAG_TOD
|
||||
BEGIN
|
||||
PROMPT 43 12 "alla data:"
|
||||
GROUP G_MOVMAG
|
||||
END
|
||||
|
||||
BOOL F_ORDACQ
|
||||
BEGIN
|
||||
PROMPT 1 14 "Carica gli ordini di acquisto"
|
||||
PROMPT 1 16 "Carica gli ordini di acquisto"
|
||||
END
|
||||
BOOL F_ORDCLI
|
||||
BEGIN
|
||||
PROMPT 1 16 "Carica gli ordini cliente"
|
||||
PROMPT 1 17 "Carica gli ordini cliente"
|
||||
END
|
||||
BOOL F_ORDPROD
|
||||
BEGIN
|
||||
|
138
db/dbcv01.cpp
138
db/dbcv01.cpp
@ -1,26 +1,128 @@
|
||||
#include "dbcv.h"
|
||||
#include "dbcv01a.h"
|
||||
#include "dbcv09.h"
|
||||
/*#include <applicat.h>
|
||||
#include <execp.h>
|
||||
#include <utility.h>
|
||||
#include <tabutil.h>
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include "..\mg\anamag.h"
|
||||
#include "..\mg\mag.h"
|
||||
#include "..\include\doc.h"
|
||||
#include "..\include\rdoc.h"*/
|
||||
#include <filetext.h>
|
||||
|
||||
#define BPCS_ANAGRAFICA "iiml01"
|
||||
#define BPCS_IMPORTEX "iimsl01"
|
||||
#define BPCS_DISTINTE "mbml01"
|
||||
#define BPCS_DIVISORI "cicl01"
|
||||
#define BPCS_MOVMAG "ithl01"
|
||||
#define BPCS_ORDACQ "acq_ord"
|
||||
#define BPCS_FIRMORD "ord_cli"
|
||||
#define BPCS_SHOPORDS "ord_prod"
|
||||
|
||||
class TCrea_dbf : public TSkeleton_application
|
||||
{
|
||||
TMask * _m;
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
void txt2dbf(const char * dbf,const char *txt, const char *ini=NULL);
|
||||
protected:
|
||||
virtual void main_loop() ;
|
||||
};
|
||||
|
||||
bool TCrea_dbf::create()
|
||||
{
|
||||
_m = new TMask("dbcv01a.msk");
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
bool TCrea_dbf::destroy()
|
||||
{
|
||||
delete _m;
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
void TCrea_dbf::txt2dbf(const char * dbf,const char *txt,const char *ini )
|
||||
{
|
||||
long lineno=0L;
|
||||
TIndwin iw(80, format("Ricostruzione file DBF da file di testo BPCS ..."),FALSE,FALSE);
|
||||
TImport_file dest(_m->get(F_PATH),dbf);
|
||||
TFilename txtname(_m->get(F_PATH)),ininame(_m->get(F_PATH));
|
||||
txtname.add(txt);txtname.ext("txt");
|
||||
if (ini)
|
||||
ininame.add(ini);
|
||||
else
|
||||
ininame.add(txt);
|
||||
ininame.ext("ini");
|
||||
TFile_text source(txtname, ininame);
|
||||
dest.zap();
|
||||
TRecord_text rec;
|
||||
source.open();
|
||||
while (source.read(rec)!=EOF)
|
||||
{
|
||||
if ((lineno%TICK) == 0)
|
||||
{
|
||||
iw.set_text(format("Importazione %s : linea %ld",txt, lineno));
|
||||
do_events();
|
||||
}
|
||||
TTracciato_record *tr=source.t_rec(rec.type());
|
||||
if (tr)
|
||||
{
|
||||
TArray& a_tc = tr->tracciati_campo();
|
||||
int items = a_tc.items();
|
||||
TString valore;
|
||||
dest.zero();
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
const TTracciato_campo& tc = tr->get(i);
|
||||
TFieldref field(tc.field());
|
||||
if (field.name().not_empty())
|
||||
{
|
||||
valore = rec.row(i);
|
||||
valore.trim();
|
||||
dest.put(field.name(),valore);
|
||||
}
|
||||
}
|
||||
dest.write();
|
||||
}
|
||||
lineno++;
|
||||
}
|
||||
source.close();
|
||||
}
|
||||
|
||||
void TCrea_dbf::main_loop()
|
||||
{
|
||||
while (_m->run()!=K_QUIT)
|
||||
{
|
||||
// anagrafiche
|
||||
if (_m->get_bool(F_ARTS))
|
||||
{
|
||||
txt2dbf(BPCS_IMPORTEX,"iims_aga");
|
||||
txt2dbf(BPCS_ANAGRAFICA, "iim_aga");
|
||||
}
|
||||
if (_m->get_bool(F_BOMS))
|
||||
txt2dbf(BPCS_DISTINTE,"mbm_aga");
|
||||
if (_m->get_bool(F_DIVS ))
|
||||
txt2dbf(BPCS_DIVISORI,"cic_aga");
|
||||
// magazzino
|
||||
if (_m->get_bool(F_MOVMAG))
|
||||
{
|
||||
TFilename txtname(_m->get(F_MOVMAG_FILE));
|
||||
TFilename dbfname(txtname);
|
||||
if (txtname.blank())
|
||||
{
|
||||
txtname = "ith_aga";
|
||||
dbfname = BPCS_MOVMAG;
|
||||
} else {
|
||||
TFilename s(_m->get(F_PATH)),d(_m->get(F_PATH));
|
||||
s.add(BPCS_MOVMAG);
|
||||
s.ext("dbf");
|
||||
d.add(dbfname.name());
|
||||
d.ext("dbf");
|
||||
if (!d.exist())
|
||||
{
|
||||
fcopy(s,d);
|
||||
s.ext("cdx");
|
||||
d.ext("cdx");
|
||||
fcopy(s,d);
|
||||
}
|
||||
}
|
||||
txt2dbf(dbfname,txtname,"ith_aga");
|
||||
}
|
||||
// ordini
|
||||
if (_m->get_bool(F_ORDACQ))
|
||||
txt2dbf(BPCS_ORDACQ,"ord_acq");
|
||||
if (_m->get_bool(F_ORDPROD))
|
||||
txt2dbf(BPCS_SHOPORDS,"ord_prod");
|
||||
if (_m->get_bool(F_ORDCLI))
|
||||
txt2dbf(BPCS_FIRMORD,"ord_cli" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int dbcv01(int argc, char* argv[])
|
||||
|
14
db/dbcv01a.h
Executable file
14
db/dbcv01a.h
Executable file
@ -0,0 +1,14 @@
|
||||
#define F_PATH 101
|
||||
#define F_ARTS 102
|
||||
#define F_BOMS 103
|
||||
#define F_DIVS 104
|
||||
#define F_ORDPROD 120
|
||||
#define F_ORDACQ 121
|
||||
#define F_ORDCLI 122
|
||||
#define F_MOVMAG 123
|
||||
#define F_MOVMAG_FILE 124
|
||||
|
||||
#define G_ARTICOLI 10
|
||||
#define G_DISTINTE 20
|
||||
#define G_MOVMAG 30
|
||||
|
80
db/dbcv01a.uml
Executable file
80
db/dbcv01a.uml
Executable file
@ -0,0 +1,80 @@
|
||||
#include "dbcv01a.h"
|
||||
TOOLBAR "" 0 19 0 0
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 ""
|
||||
PICTURE BMP_OK
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -11 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
PICTURE BMP_QUIT
|
||||
PICTURE BMP_QUITDN
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Importazione DBF" -1 -1 80 20
|
||||
|
||||
STRING DLG_PROFILE 70
|
||||
BEGIN
|
||||
FLAGS "HG"
|
||||
PROMPT 1 1 ""
|
||||
PSELECT
|
||||
END
|
||||
|
||||
STRING F_PATH 40
|
||||
BEGIN
|
||||
PROMPT 1 1 "Percorso dei files TXT e DBF di BPCS "
|
||||
END
|
||||
|
||||
BOOL F_ARTS
|
||||
BEGIN
|
||||
PROMPT 1 3 "Anagrafica Articoli"
|
||||
END
|
||||
|
||||
BOOL F_BOMS
|
||||
BEGIN
|
||||
PROMPT 1 4 "Distinte"
|
||||
END
|
||||
|
||||
BOOL F_DIVS
|
||||
BEGIN
|
||||
PROMPT 1 5 "CIC/Divisori"
|
||||
END
|
||||
|
||||
BOOL F_ORDPROD
|
||||
BEGIN
|
||||
PROMPT 1 6 "Ordini produzione rilasciati"
|
||||
END
|
||||
|
||||
BOOL F_ORDCLI
|
||||
BEGIN
|
||||
PROMPT 1 7 "Ordini produzione pianificati"
|
||||
END
|
||||
|
||||
BOOL F_ORDACQ
|
||||
BEGIN
|
||||
PROMPT 1 8 "Ordini acquisto"
|
||||
END
|
||||
|
||||
BOOL F_MOVMAG
|
||||
BEGIN
|
||||
PROMPT 1 9 "MOv. magazzino"
|
||||
MESSAGE TRUE SHOW,G_MOVMAG@
|
||||
MESSAGE FALSE HIDE,G_MOVMAG@
|
||||
END
|
||||
|
||||
STRING F_MOVMAG_FILE 20
|
||||
BEGIN
|
||||
PROMPT 3 10 "Nome file: "
|
||||
GROUP G_MOVMAG
|
||||
END
|
||||
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
877
db/dbcv02.cpp
Executable file
877
db/dbcv02.cpp
Executable file
@ -0,0 +1,877 @@
|
||||
#include "dbcv.h"
|
||||
#include "dbcv09.h"
|
||||
#include "dbcv02a.h"
|
||||
|
||||
#include <automask.h>
|
||||
#include <applicat.h>
|
||||
#include <relation.h>
|
||||
#include <execp.h>
|
||||
#include "..\mg\anamag.h"
|
||||
#include "..\mg\mag.h"
|
||||
#include "..\include\doc.h"
|
||||
#include "..\include\rdoc.h"
|
||||
#include "..\db\dblib.h"
|
||||
|
||||
typedef void (*SET_DOC_FUN)(TImport_file & import,TConfig &trans);
|
||||
typedef bool (*FILTER_FUN)(TImport_file & import);
|
||||
|
||||
bool unevadi_orc(TMask &m, const TString & codimp)
|
||||
{
|
||||
TString8 codnum=codimp;
|
||||
codnum<< "OC";
|
||||
TRelation *r= new TRelation(LF_DOC);
|
||||
r->add(LF_RIGHEDOC,"CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC");
|
||||
TCursor c(r);
|
||||
TRectype frec(LF_DOC);
|
||||
frec.put("CODNUM",codnum);
|
||||
frec.put("PROVV","D");
|
||||
frec.put("ANNO" ,"1999");
|
||||
c.setregion(frec,frec);
|
||||
c.freeze();
|
||||
|
||||
const long items=c.items();
|
||||
TProgind info(items,"Reset evasione commesse cliente...",FALSE,TRUE);
|
||||
for (long i= 0; i< items ; i++)
|
||||
{
|
||||
c=i;
|
||||
info.addstatus(1);
|
||||
TRelation *r =c.relation();
|
||||
TLocalisamfile & righe = c.relation()->lfile(LF_RIGHEDOC);
|
||||
bool ok = r->is_first_match(LF_RIGHEDOC);
|
||||
while (ok)
|
||||
{
|
||||
if (righe.get_bool("RIGAEVASA") ||righe.get_real("QTAEVASA")!=ZERO )
|
||||
{
|
||||
righe.put("RIGAEVASA"," ");
|
||||
righe.put("QTAEVASA","0.0");
|
||||
righe .rewrite();
|
||||
}
|
||||
ok = r->next_match(LF_RIGHEDOC);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool evadi_orc(TCursor & c, TAssoc_array & evasioni)
|
||||
{
|
||||
const long items=c.items();
|
||||
TProgind info(items,"Evasione commesse cliente...",FALSE,TRUE);
|
||||
for (long i= 0; i< items ; i++)
|
||||
{
|
||||
c=i;
|
||||
info.addstatus(1);
|
||||
TRelation *r =c.relation();
|
||||
TLocalisamfile & righe = c.relation()->lfile(LF_RIGHEDOC);
|
||||
bool ok = r->is_first_match(LF_RIGHEDOC);
|
||||
while (ok)
|
||||
{
|
||||
const TString codprod = righe.get("CODARTMAG");
|
||||
real *qta=NULL;
|
||||
if (evasioni.is_key(codprod))
|
||||
qta=(real*)evasioni.objptr(codprod);
|
||||
if (!righe.get_bool("RIGAEVASA") && qta!=NULL)
|
||||
{
|
||||
real q(righe.get_real("QTA"));
|
||||
real qevasa(righe.get_real("QTAEVASA"));
|
||||
if (*qta>ZERO && q>qevasa)
|
||||
{
|
||||
if (q-qevasa>*qta)
|
||||
{
|
||||
qevasa+=*qta;
|
||||
*qta = 0;
|
||||
} else {
|
||||
*qta -= q;
|
||||
qevasa=q;
|
||||
righe.put("RIGAEVASA","X");
|
||||
}
|
||||
righe.put("QTAEVASA",qevasa);
|
||||
righe .rewrite();
|
||||
}
|
||||
}
|
||||
ok = r->next_match(LF_RIGHEDOC);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool evadi_orc(TMask & m, const TString & codimp)
|
||||
{
|
||||
if (!yesno_box("I movimenti 00 e T-04 sul mag. 25 verranno usati per evadere le commesse. Procedo?"))
|
||||
return FALSE;
|
||||
TFilename source(m.get(S_MOVMAG_FILE));
|
||||
if (source.blank())
|
||||
source=BPCS_MOVMAG;
|
||||
TDate fromdate(m.get(S_MOVMAG_FROMD));
|
||||
TDate todate(m.get(S_MOVMAG_TOD));
|
||||
TImport_file movmag(m.get(F_PATH),source);
|
||||
bool ok = TRUE;
|
||||
if (noyes_box("Attenzione: l'operazione non e' ripetibile;assicurarsi che la situazione del pending delle commesse sia relativa alla bolla indicata. Procedo?"))
|
||||
{
|
||||
const int expmag= codimp == "SE" ? 25 : 27;
|
||||
|
||||
TString8 codnum=codimp;
|
||||
codnum<< "OC";
|
||||
TRelation *r= new TRelation(LF_DOC);
|
||||
r->add(LF_RIGHEDOC,"CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC");
|
||||
TCursor c(r,"!DOCEVASO");
|
||||
TRectype frec(LF_DOC);
|
||||
frec.put("CODNUM",codnum);
|
||||
frec.put("PROVV","D");
|
||||
frec.put("ANNO" ,"1999");
|
||||
c.setregion(frec,frec);
|
||||
c.freeze();
|
||||
|
||||
long lastbolla(m.get_int(S_LASTBOLLA)),nobolla;
|
||||
TProgind info(movmag.items(),"Estrazione ultime consegne...",FALSE,TRUE);
|
||||
|
||||
TAssoc_array evasioni;
|
||||
movmag.first();
|
||||
while(!movmag.eof())
|
||||
{
|
||||
info.addstatus(1);
|
||||
const TDate dmov = movmag.get_date("TTDTE");
|
||||
if (movmag.get_int("TWHS")==expmag &&
|
||||
(!fromdate.ok() || dmov >= fromdate) &&
|
||||
(!todate.ok() || dmov <= todate) )
|
||||
{
|
||||
TString codprod(movmag.get("TPROD"));
|
||||
real qta(movmag.get_real("TQTY"));
|
||||
TString com(movmag.get("TCOM"));
|
||||
nobolla = -1;
|
||||
if (movmag.get("TTYPE")=="T")
|
||||
{
|
||||
if (movmag.get("TRES")=="04" && com.len()==15)
|
||||
nobolla=atol(com.mid(7));
|
||||
else
|
||||
if (yesno_box("Includo il trasferimento del %s, %s per %s,\n '%s'",
|
||||
(const char *)dmov,(const char *)codprod,(const char *)qta.string(),(const char *)com))
|
||||
nobolla=lastbolla+1; // non so come filtrarla !!!
|
||||
}
|
||||
else if (movmag.get("TTYPE")=="00")
|
||||
{
|
||||
if (yesno_box("Includo il carico da terzi del %s, %s per %s,\n '%s'",
|
||||
(const char *)dmov,(const char *)codprod,(const char *)qta.string(),(const char *)com))
|
||||
nobolla=lastbolla+1; // non so come filtrarla !!!
|
||||
}
|
||||
if (nobolla>lastbolla)
|
||||
{
|
||||
// evadi
|
||||
if (evasioni.is_key(codprod))
|
||||
qta+=(real&)evasioni.find(codprod);
|
||||
evasioni.add(codprod, qta, TRUE);
|
||||
}
|
||||
}
|
||||
movmag.next();
|
||||
}
|
||||
ok = evadi_orc(c, evasioni);
|
||||
}
|
||||
return FALSE;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
void crea_mag3()
|
||||
{
|
||||
TString codmag;TString desc;
|
||||
TTable mag("MAG");
|
||||
mag.put("CODTAB","SE1");
|
||||
mag.put("B0","X");
|
||||
mag.put("S0","Magazzino di Segrate (ex mag. 26,91 e 93)");
|
||||
force_write(mag);
|
||||
|
||||
mag.put("CODTAB","TS1");
|
||||
mag.put("B0","X");
|
||||
mag.put("S0","Magazzino di Trieste (ex mag. 28 e 92)");
|
||||
force_write(mag);
|
||||
|
||||
mag.put("CODTAB","PR1");
|
||||
mag.put("B0","X");
|
||||
mag.put("S0","Magazzino di Parma");
|
||||
force_write(mag);
|
||||
|
||||
mag.put("CODTAB","PD1");
|
||||
mag.put("B0","X");
|
||||
mag.put("S0","Magazzino di Padova");
|
||||
force_write(mag);
|
||||
const char *codimp[] = {"SE","TS","PR","PD"};
|
||||
const char *descimp[] = {"Segrate","Trieste","Parma","Padova"};
|
||||
for (int t=0 ; t<99;t++)
|
||||
for (int i=0 ; i<4;i++)
|
||||
{
|
||||
mag.zero();
|
||||
long l=-1;
|
||||
if (t==0)
|
||||
{
|
||||
codmag.format("%s1PF", codimp[i]);
|
||||
desc = "Deposito prodotti finiti ";
|
||||
desc << descimp[i];
|
||||
l=0;
|
||||
}
|
||||
else
|
||||
if (i<2)
|
||||
{
|
||||
l = method2location(t);
|
||||
desc=descr_method(t);
|
||||
desc << " (ex locazione " << l << ")";
|
||||
codmag.format("%s1%02d", codimp[i], t);
|
||||
}
|
||||
if (l >= 0)
|
||||
{
|
||||
mag.put("CODTAB",codmag);
|
||||
mag.put("S0",desc);
|
||||
force_write(mag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void crea_linee3()
|
||||
{
|
||||
TTable lnp("LNP");
|
||||
TString8 code;
|
||||
TString8 codimp;
|
||||
for (int imp=0; imp<4; imp++)
|
||||
{
|
||||
switch (imp)
|
||||
{
|
||||
case 0: codimp ="SE"; break;
|
||||
case 1: codimp ="TS"; break;
|
||||
case 2: codimp ="PD"; break;
|
||||
case 3: codimp ="PR"; break;
|
||||
}
|
||||
for (int terz=1; terz<99; terz++)
|
||||
{
|
||||
code =format("X%02d",terz);
|
||||
code << codimp;
|
||||
lnp.put("CODTAB",code);
|
||||
if (lnp.read()==NOERR)
|
||||
{
|
||||
lnp.put("S0",format("%s (%s)",descr_method(terz), (const char *)codimp)) ;
|
||||
lnp.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool find_wrongcycle()
|
||||
{
|
||||
TIndwin iw(80, "Ricerca errori sui cicli di lavoro ...",FALSE,FALSE);
|
||||
bool some_done=FALSE;
|
||||
int err;
|
||||
long distno=1L;
|
||||
TString cod="";
|
||||
TLocalisamfile umart(LF_UMART);
|
||||
TRelation r(new TLocalisamfile(LF_RDIST));
|
||||
r.add(LF_DIST,"CODDIST==CODDIST");
|
||||
r.add(LF_UMART,"CODART==CODDIST|UM=UM",2,LF_DIST);
|
||||
r.add(LF_UMART,"CODART==CODDIST",1,LF_DIST,LF_UMART);
|
||||
err = r.first();
|
||||
while (err == NOERR)
|
||||
{
|
||||
if ((distno%TICK)==1)
|
||||
{
|
||||
iw.set_text(format("Ricerca errori riga n. %ld", distno));
|
||||
do_events();
|
||||
}
|
||||
distno++;
|
||||
if (r.lfile().get("TIPO")=="L" )
|
||||
{
|
||||
long expr=atol(r.lfile().get("EXPR")), newexpr;
|
||||
bool ask=FALSE;
|
||||
if (r.update()==NOERR)
|
||||
{
|
||||
long divisore=r.lfile(LF_UMART).get_long("FC");
|
||||
TString lav(r.lfile().get("CODCOMP"));
|
||||
if (expr < divisore && lav.left(5)!="ACQUA")
|
||||
{
|
||||
TString codice(r.lfile().get("CODDIST"));
|
||||
// caso sospetto
|
||||
TString4 main_um(r.lfile(-LF_UMART).get("UM"));
|
||||
int formato=lav.find(format("_X"));
|
||||
if (formato<0)
|
||||
formato=lav.find(format(".X"));
|
||||
if (formato<0)
|
||||
formato=lav.find(format(" X12"));
|
||||
newexpr=divisore;
|
||||
if (formato>0)
|
||||
{
|
||||
// lav in casse
|
||||
int pzxca=atoi(lav.sub(formato+2));
|
||||
if (pzxca>0)
|
||||
{
|
||||
if (main_um=="PZ")
|
||||
newexpr/=atoi(lav.sub(formato+2));
|
||||
ask=TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (main_um=="PZ")
|
||||
ask=TRUE;
|
||||
}
|
||||
if (ask)
|
||||
{
|
||||
if (yesno_box("Il codice %s espresso in '%s'(=%ld %s) \ncontiene la lavorazione %s in quantita' %ld; \nsostituisco con %ld?", (const char *)codice,
|
||||
(const char *)r.lfile(LF_DIST).get("UM"),
|
||||
divisore,
|
||||
(const char *)main_um,
|
||||
(const char *)lav, expr,newexpr))
|
||||
{
|
||||
r.lfile().put("EXPR",newexpr);
|
||||
r.lfile().rewrite();
|
||||
}
|
||||
} else {
|
||||
message_box("Il codice %s espresso in '%s'(=%ld %s) \ncontiene la lavorazione %s in quantita' %ld", (const char *)codice,
|
||||
(const char *)r.lfile(LF_DIST).get("UM"),
|
||||
divisore,
|
||||
(const char *)main_um,
|
||||
(const char *)lav, expr,newexpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
err = r.next();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
class TMov_diff_inv : public TConfig
|
||||
{
|
||||
int _nriga;
|
||||
public:
|
||||
void set_header(const char *imp_filter);
|
||||
int righe () {return _nriga;}
|
||||
bool max_righe () {return _nriga > 99 ;}
|
||||
void locate_bpcs_stock(const TString &codice , int mag , long loc, TImport_file &mag_bpcs, real &giac) ;
|
||||
int compare_stocks(TLocalisamfile &mag, const real & bpcs_stock, bool giac);
|
||||
TMov_diff_inv (int num);
|
||||
} ;
|
||||
|
||||
TMov_diff_inv::TMov_diff_inv (int num) :
|
||||
TConfig (format("ND_%05d.ini",num)) , _nriga(0)
|
||||
{}
|
||||
|
||||
void TMov_diff_inv ::locate_bpcs_stock(const TString &codice , int mag , long loc, TImport_file &mag_bpcs, real & giac)
|
||||
{
|
||||
int direction = 0;
|
||||
long diff = 0;
|
||||
do {
|
||||
diff = codice.compare(mag_bpcs.get("CODICE"));
|
||||
if (diff == 0)
|
||||
diff = mag - mag_bpcs.get_int("MAG");
|
||||
if (diff == 0)
|
||||
diff = loc - mag_bpcs.get_long("LOC");
|
||||
if (diff > 0 && direction != -1)
|
||||
{
|
||||
direction = +1;
|
||||
if (mag_bpcs.next()!=NOERR)
|
||||
direction = 0;
|
||||
}
|
||||
if (diff < 0 && direction != 1)
|
||||
{
|
||||
direction = -1;
|
||||
if (mag_bpcs.prev()!=NOERR)
|
||||
direction = 0;
|
||||
}
|
||||
} while (diff*direction>0 && direction != 0 );
|
||||
if (diff != 0)
|
||||
giac = ZERO;
|
||||
else
|
||||
giac = mag_bpcs.get_real("QTY");
|
||||
}
|
||||
int TMov_diff_inv ::compare_stocks(TLocalisamfile &mag, const real & val_bpcs, bool giac)
|
||||
{
|
||||
if (!giac)
|
||||
return _nriga;
|
||||
TRectype newmag = mag.curr();
|
||||
if (mag.read() != NOERR)
|
||||
mag.curr() = newmag;
|
||||
real val(mag.get_real("GIAC"));
|
||||
if (!giac)
|
||||
val = (mag.get_real("VEN"));
|
||||
real diff = (val_bpcs - val);
|
||||
if (!diff.is_zero())
|
||||
{
|
||||
set_paragraph(format("34,%d", ++_nriga));
|
||||
set("TIPORIGA", "01");
|
||||
set("CODART", mag.get("CODART"));
|
||||
set("CODARTMAG", mag.get("CODART"));
|
||||
set("DESCR", cache().get(LF_ANAMAG,mag.get("CODART")).get("DESCR"));
|
||||
set("CODMAG", mag.get("CODMAG"));
|
||||
TToken_string um_key(mag.get("CODART"));
|
||||
um_key.add("1");
|
||||
set("UMQTA", cache().get(LF_UMART,um_key).get("UM"));
|
||||
set("QTA", diff.string());
|
||||
set("CODCAUS", giac ? "CAR" : "");
|
||||
}
|
||||
return _nriga;
|
||||
}
|
||||
|
||||
void TMov_diff_inv ::set_header(const char * imp_filter)
|
||||
{
|
||||
TDate today(TODAY);
|
||||
set_paragraph("Transaction");
|
||||
set("Action","INSERT");
|
||||
set("Mode","AUTO");
|
||||
set_paragraph("33");
|
||||
TString8 codimp = imp_filter ;
|
||||
codimp << "DI";
|
||||
set("CODNUM",codimp);
|
||||
set("CAUSMAG","");
|
||||
set("NOTE","\"Differenze inventariali rilevate per confronto con gli archivi di BPCS\"");
|
||||
set("DATADOC",today.string());
|
||||
}
|
||||
void sinchro_stock(const TMask & m, const char * imp_filter)
|
||||
{
|
||||
if (!yesno_box(format("Confermi l'allineamento giacenze per %s ?",imp_filter)))
|
||||
return ;
|
||||
TDate today(TODAY);
|
||||
TIndwin info(60,format("Allineamento giacenze per %s...",imp_filter),FALSE,FALSE);
|
||||
TImport_file mag_bpcs(m.get(F_PATH),BPCS_STOCK);
|
||||
TLocalisamfile mag(LF_MAG);
|
||||
TString codart,codmag, coddep, codimp;
|
||||
long terzista;
|
||||
int nummag, movimenti = 0;
|
||||
bool ok;
|
||||
|
||||
delete_files("ND_*.ini");
|
||||
TMov_diff_inv *action;
|
||||
action = new TMov_diff_inv(movimenti++);
|
||||
action->set_header(imp_filter);
|
||||
|
||||
mag.setkey(2);
|
||||
ok = mag_bpcs.first()==NOERR;
|
||||
while (ok)
|
||||
{
|
||||
codart = mag_bpcs.get("CODICE");
|
||||
nummag = mag_bpcs.get_int("MAG");
|
||||
num_mag2main_imp(nummag, codimp);
|
||||
if (codimp == imp_filter)
|
||||
{
|
||||
terzista = location2method(mag_bpcs.get_int("LOC"));
|
||||
num_mag2cod_imp(nummag, codmag);
|
||||
if (terzista)
|
||||
codmag << format("3%02d",terzista);
|
||||
else
|
||||
codmag << "1";
|
||||
mag.put("ANNOES", today.year());
|
||||
mag.put("CODART", codart);
|
||||
mag.put("CODMAG", codmag);
|
||||
if (mag.read()!=NOERR)
|
||||
{
|
||||
int nriga = 0;
|
||||
mag.put("ANNOES", today.year());
|
||||
mag.put("CODART", codart);
|
||||
mag.put("NRIGA", ++nriga);
|
||||
mag.setkey(1);
|
||||
while (mag.read()==NOERR)
|
||||
mag.put("NRIGA", ++nriga);
|
||||
mag.zero(' ');
|
||||
mag.put("ANNOES", today.year());
|
||||
mag.put("CODART", codart);
|
||||
mag.put("NRIGA", nriga);
|
||||
mag.put("CODMAG", codmag);
|
||||
mag.write();
|
||||
mag.setkey(2);
|
||||
}
|
||||
}
|
||||
ok = mag_bpcs.next()==NOERR;
|
||||
}
|
||||
|
||||
real bpcsstock;
|
||||
mag_bpcs.first();
|
||||
mag.setkey(1);
|
||||
mag.zero();
|
||||
mag.put("ANNOES", today.year());
|
||||
ok = mag.read(_isgteq)==NOERR;
|
||||
// magazzino Eurocampo vs mag BPCS
|
||||
while (ok)
|
||||
{
|
||||
codart = mag.get("CODART");
|
||||
codmag = mag.get("CODMAG");
|
||||
coddep = codmag.sub(3);
|
||||
codimp = codmag.left(2);
|
||||
codmag.cut(3);
|
||||
nummag = cod_mag2num_mag(codmag);
|
||||
if (codimp == imp_filter && nummag>0)
|
||||
{
|
||||
terzista = method2location(atoi(coddep));
|
||||
action->locate_bpcs_stock(codart, nummag, terzista, mag_bpcs, bpcsstock);
|
||||
action->compare_stocks(mag, bpcsstock, TRUE);
|
||||
if (FALSE && nummag < 30)
|
||||
{
|
||||
action->locate_bpcs_stock( codart, nummag-1 ,0 , mag_bpcs, bpcsstock);
|
||||
action->compare_stocks(mag, bpcsstock, FALSE);
|
||||
}
|
||||
}
|
||||
if (action->max_righe())
|
||||
{
|
||||
TExternal_app gestdoc(format("ve0.exe -1 -i%s",(const char *)action->name()));
|
||||
delete action;
|
||||
gestdoc.run();
|
||||
action = new TMov_diff_inv(movimenti++);
|
||||
action->set_header(imp_filter);
|
||||
}
|
||||
|
||||
ok = mag.next()==NOERR;
|
||||
}
|
||||
|
||||
|
||||
if (action->righe())
|
||||
{
|
||||
TExternal_app gestdoc(format("ve0.exe -1 -i%s",(const char *)action->name()));
|
||||
delete action;
|
||||
gestdoc.run();
|
||||
}
|
||||
}
|
||||
|
||||
void unlink_numdoc(const char *codnum, int anno)
|
||||
{
|
||||
TRelation *r = new TRelation(LF_DOC);
|
||||
r->add(LF_RIGHEDOC,"PROVV==PROVV|ANNO==ANNO|CODNUM==CODNUM|NDOC==NDOC");
|
||||
TCursor c(r);
|
||||
TRectype from(LF_DOC),to(LF_DOC);
|
||||
from.put("PROVV","D");
|
||||
from.put("ANNO",anno);
|
||||
from.put("CODNUM",codnum);
|
||||
to = from;
|
||||
c.setregion(from,to);
|
||||
const long items=c.items();
|
||||
TProgind info(items,format("Scollegamento documenti %s anno %d...",codnum,anno),FALSE,TRUE);
|
||||
for (long i=items-1; i>=0 ; i--)
|
||||
{
|
||||
c = i;
|
||||
info.addstatus(1);
|
||||
TLocalisamfile &doc=r->lfile();
|
||||
TLocalisamfile &rdoc=r->lfile(LF_RIGHEDOC);
|
||||
if (doc.get_long("MOVMAG")!=0L)
|
||||
{
|
||||
doc.put("MOVMAG",0);
|
||||
doc.rewrite();
|
||||
}
|
||||
if (r->is_first_match(LF_RIGHEDOC))
|
||||
do {
|
||||
if (rdoc.get_long("MOVMAG")!=0L)
|
||||
{
|
||||
rdoc.put("MOVMAG",0);
|
||||
rdoc.rewrite();
|
||||
}
|
||||
} while (r->next_match(LF_RIGHEDOC));
|
||||
}
|
||||
}
|
||||
|
||||
void unlink_docs()
|
||||
{
|
||||
unlink_numdoc("SEBA",1998);
|
||||
unlink_numdoc("SEBA",1999);
|
||||
unlink_numdoc("SEBE",1998);
|
||||
unlink_numdoc("SEBE",1999);
|
||||
unlink_numdoc("SEBP",1998);
|
||||
unlink_numdoc("SEBP",1999);
|
||||
unlink_numdoc("SEBT",1998);
|
||||
unlink_numdoc("SEBT",1999);
|
||||
unlink_numdoc("SEBU",1998);
|
||||
unlink_numdoc("SEBU",1999);
|
||||
unlink_numdoc("SEBV",1998);
|
||||
unlink_numdoc("SEBV",1999);
|
||||
unlink_numdoc("SEDI",1998);
|
||||
unlink_numdoc("SEDI",1999);
|
||||
unlink_numdoc("SEFA",1998);
|
||||
unlink_numdoc("SEFA",1999);
|
||||
unlink_numdoc("SEMM",1998);
|
||||
unlink_numdoc("SEMM",1999);
|
||||
unlink_numdoc("SEMP",1998);
|
||||
unlink_numdoc("SEMP",1999);
|
||||
unlink_numdoc("SEOC",1998);
|
||||
unlink_numdoc("SEOC",1999);
|
||||
unlink_numdoc("SEOF",1998);
|
||||
unlink_numdoc("SEOF",1999);
|
||||
unlink_numdoc("SEOP",1998);
|
||||
unlink_numdoc("SEOP",1999);
|
||||
unlink_numdoc("SERF",1998);
|
||||
unlink_numdoc("SERF",1999);
|
||||
}
|
||||
|
||||
void kill_blank_mag(const TMask & m, const char * codmag)
|
||||
{
|
||||
TLocalisamfile mag(LF_MAG),mag2(LF_MAG);
|
||||
mag2.setkey(2);
|
||||
TString codart;
|
||||
int anno;
|
||||
int err = mag.first();
|
||||
while (err==NOERR)
|
||||
{
|
||||
anno = mag.get_int("ANNOES");
|
||||
codart = mag.get("CODART");
|
||||
mag2.put("ANNOES",anno);
|
||||
mag2.put("CODMAG",codmag);
|
||||
mag2.put("CODART",codart);
|
||||
if (mag2.read()==NOERR)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
err= mag.next();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool unify_magcode(const char * field, TLocalisamfile & file, bool only3=FALSE)
|
||||
{
|
||||
TString codmag = file.get(field);
|
||||
if (codmag.blank())
|
||||
return FALSE;
|
||||
if (!only3 && codmag[2]=='1' && codmag[3]=='\0')
|
||||
{
|
||||
codmag.overwrite("PF",3); // deposito produzione finiti
|
||||
}
|
||||
else if (codmag[2]=='3'&& codmag[3]!='\0')
|
||||
{
|
||||
codmag[2]='1';
|
||||
} else if (codmag==" PF")
|
||||
{
|
||||
codmag="";
|
||||
} else
|
||||
return FALSE;
|
||||
file.put(field,codmag);
|
||||
if (file.rewrite()!=NOERR)
|
||||
file.write();
|
||||
do_events();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void unify_mags_reset_bar(TProgind & pi, const char * msg2, long max)
|
||||
{
|
||||
const char * msg = "Unificazione magazzini interni e terzisti: ";
|
||||
pi.set_text(format("%s%s",msg,msg2));
|
||||
pi.setstatus(0);
|
||||
pi.setmax(max);
|
||||
}
|
||||
void unify_mags(const TMask & m)
|
||||
{
|
||||
TTable impianti("IMP"), linee("LNP"),tabmag("MAG");
|
||||
TString codmag;
|
||||
TLocalisamfile mag(LF_MAG),
|
||||
rmovmag(LF_RMOVMAG),
|
||||
rdoc(LF_RIGHEDOC);
|
||||
TProgind info(80,"",FALSE,TRUE);
|
||||
message_box("Modificare a mano la tabella magazzini");
|
||||
unify_mags_reset_bar(info, "tabella impianti", impianti.items());
|
||||
impianti.setkey(2);
|
||||
int err = impianti.first();
|
||||
while (err==NOERR)
|
||||
{
|
||||
unify_magcode("S7", impianti);
|
||||
unify_magcode("S8", impianti);
|
||||
err = impianti.next();
|
||||
info.addstatus(1);
|
||||
}
|
||||
unify_mags_reset_bar(info, "tabella linee di produzione", linee.items());
|
||||
linee.setkey(2);
|
||||
err = linee.first();
|
||||
while (err==NOERR)
|
||||
{
|
||||
unify_magcode("S7", linee);
|
||||
unify_magcode("S8", linee);
|
||||
err = linee.next();
|
||||
info.addstatus(1);
|
||||
}
|
||||
unify_mags_reset_bar(info, "giacenze", mag.items());
|
||||
err = mag.first();
|
||||
while (err==NOERR)
|
||||
{
|
||||
unify_magcode("CODMAG", mag);
|
||||
err = mag.next();
|
||||
info.addstatus(1);
|
||||
}
|
||||
unify_mags_reset_bar(info, "movimenti di magazzino", rmovmag.items());
|
||||
err = rmovmag.first();
|
||||
while (err==NOERR)
|
||||
{
|
||||
unify_magcode("CODMAG", rmovmag);
|
||||
err = rmovmag.next();
|
||||
info.addstatus(1);
|
||||
}
|
||||
unify_mags_reset_bar(info, "righe documenti", rmovmag.items());
|
||||
err = rdoc.first();
|
||||
while (err==NOERR)
|
||||
{
|
||||
unify_magcode("CODMAG", rdoc);
|
||||
unify_magcode("CODMAGC", rdoc);
|
||||
err = rdoc.next();
|
||||
info.addstatus(1);
|
||||
}
|
||||
}
|
||||
|
||||
void checkexplosions(const TMask & m)
|
||||
{
|
||||
TLocalisamfile movmag(LF_MOVMAG),
|
||||
rmovmag(LF_RMOVMAG);
|
||||
TArray boom;
|
||||
TAssoc_array movs, arts;
|
||||
TDistinta_tree search;
|
||||
TString desc,codcaus,key, grmerc;
|
||||
TLocalisamfile anamag(LF_ANAMAG);
|
||||
int err = rmovmag.last();
|
||||
TProgind info(rmovmag.items(),"Controllo scarichi errati da esplosioni distinte",FALSE,TRUE);
|
||||
while (err==NOERR)
|
||||
{
|
||||
movmag.put("ANNOES","1999");
|
||||
movmag.put("NUMREG",rmovmag.get("NUMREG"));
|
||||
movmag.read();
|
||||
desc = movmag.get("DESCR");
|
||||
codcaus = rmovmag.get("CAUS");
|
||||
if (codcaus.blank())
|
||||
codcaus = movmag.get("CODCAUS");
|
||||
|
||||
key = rmovmag.get("CODART");
|
||||
anamag.put("CODART",key);
|
||||
if (!arts.is_key(key))
|
||||
{
|
||||
if (anamag.read()!=NOERR)
|
||||
{
|
||||
message_box("Articolo '%s' mancante ",
|
||||
(const char *)rmovmag.get("CODART"));
|
||||
arts.add(key, grmerc);
|
||||
grmerc = "~";
|
||||
}
|
||||
else
|
||||
grmerc = anamag.get("GRMERC");
|
||||
}
|
||||
else
|
||||
grmerc = (TString &)arts[key];
|
||||
if (grmerc[0] == '~' || codcaus.left(3)=="SCC")
|
||||
{
|
||||
if (grmerc[0] == '~' || grmerc[0]=='F')
|
||||
{
|
||||
if (!arts.is_key(key))
|
||||
{
|
||||
if (search.set_root(key))
|
||||
{
|
||||
search.explode(boom,FALSE, RAGGR_EXP_NONE, 1, "A");
|
||||
if (boom.items() <= 0)
|
||||
message_box("Distinta di %s priva di componenti", (const char *)key);
|
||||
} else
|
||||
message_box("Distinta di %s mancante ", (const char *)key);
|
||||
arts.add(key, grmerc);
|
||||
}
|
||||
key = format("%ld",rmovmag.get_long("NUMREG"));
|
||||
if (!movs.is_key(key))
|
||||
{
|
||||
message_box("Errore nel movimento %ld (%s)",
|
||||
rmovmag.get_long("NUMREG"),
|
||||
(const char *)desc );
|
||||
movs.add(key,key);
|
||||
}
|
||||
}
|
||||
}
|
||||
err = rmovmag.prev();
|
||||
info.addstatus(1);
|
||||
}
|
||||
}
|
||||
class TCover_services : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
virtual void main_loop() ;
|
||||
};
|
||||
|
||||
class TService_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
public:
|
||||
TService_mask() :TAutomask("dbcv02a.msk"){}
|
||||
};
|
||||
bool TService_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_OK:
|
||||
if (e == fe_button)
|
||||
{
|
||||
switch (get_int(F_SERVICE))
|
||||
{
|
||||
case 1:
|
||||
if (noyes_box("Confermi la cancellazione del file degli articoli da escludere ?"))
|
||||
{
|
||||
TSupport_file morti(LF_DIST, ANAGRAFICA_MORTI);
|
||||
morti.zap();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
crea_mag3();
|
||||
break;
|
||||
case 3:
|
||||
crea_linee3();
|
||||
break;
|
||||
case 4:
|
||||
if (noyes_box("Rinumero le righe delle distinte?"))
|
||||
rinumera_dist();
|
||||
break;
|
||||
case 5:
|
||||
if (noyes_box("Rinumero le unita' di misura?"))
|
||||
rinumera_ums();
|
||||
break;
|
||||
case 6:
|
||||
if (noyes_box("Le lavorazioni presenti sui finiti verrano spostate sulle varianti di impianto. Confermi?"))
|
||||
if (sposta_lavs() && yesno_box("Rinumero le righe di lavorazione?"))
|
||||
rinumera_dist();
|
||||
break;
|
||||
case 7:
|
||||
build2levmsp();
|
||||
break;
|
||||
case 8:
|
||||
setformulavar();
|
||||
break;
|
||||
case 9:
|
||||
//check_mag_locations(get(F_PATH),source);
|
||||
break;
|
||||
case 10:
|
||||
evadi_orc(*this, get(S_CODIMP));
|
||||
break;
|
||||
case 11:
|
||||
unevadi_orc(*this, get(S_CODIMP));
|
||||
break;
|
||||
case 12:
|
||||
find_wrongcycle();
|
||||
break;
|
||||
case 13:
|
||||
sinchro_stock(*this, "SE");
|
||||
sinchro_stock(*this, "TS");
|
||||
break;
|
||||
case 14:
|
||||
unlink_docs();
|
||||
break;
|
||||
case 15:
|
||||
kill_blank_mag(*this,"SE1");
|
||||
break;
|
||||
case 16:
|
||||
unify_mags(*this);
|
||||
break;
|
||||
case 17:
|
||||
checkexplosions(*this);
|
||||
break;
|
||||
case 100:
|
||||
if (noyes_box("Esporto le lavorazioni?"))
|
||||
//exportlavs();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TCover_services ::main_loop()
|
||||
{
|
||||
TService_mask m;
|
||||
while (m.run()!=K_QUIT);
|
||||
}
|
||||
|
||||
|
||||
int dbcv02(int argc, char* argv[])
|
||||
{
|
||||
TString name;
|
||||
TCover_services dt;
|
||||
dt.run(argc, argv, "Utilita' di conversione BPCS");
|
||||
return 0;
|
||||
}
|
30
db/dbcv02a.h
Executable file
30
db/dbcv02a.h
Executable file
@ -0,0 +1,30 @@
|
||||
#define F_PATH 101
|
||||
#define F_SERVICE 126
|
||||
|
||||
#define F_ERASE_ARTS 130
|
||||
#define F_CHECKDEADARTS 131
|
||||
|
||||
#define F_MOVMAG_FROMD 150
|
||||
#define F_MOVMAG_TOD 151
|
||||
#define F_MOVMAG_FILE 152
|
||||
#define F_MOVMAG_SE 153
|
||||
#define F_MOVMAG_TS 154
|
||||
|
||||
#define S_CODIMP 200
|
||||
#define S_MOVMAG_FILE 201
|
||||
#define S_LASTBOLLA 202
|
||||
#define S_MOVMAG_FROMD 203
|
||||
#define S_MOVMAG_TOD 204
|
||||
|
||||
#define G_ARTICOLI 10
|
||||
#define G_DISTINTE 20
|
||||
#define G_MOVMAG 30
|
||||
#define G_SERVICE 100
|
||||
#define G_SERVICE_1 101
|
||||
#define G_SERVICE_2 102
|
||||
#define G_SERVICE_3 103
|
||||
#define G_SERVICE_8 108
|
||||
#define G_SERVICE_10 110
|
||||
#define G_SERVICE_11 114
|
||||
#define G_SERVICE_12 115
|
||||
|
105
db/dbcv02a.uml
Executable file
105
db/dbcv02a.uml
Executable file
@ -0,0 +1,105 @@
|
||||
#include "dbcv00a.h"
|
||||
#define G_ARTICOLI 10
|
||||
#define G_DISTINTE 20
|
||||
#define G_MOVMAG 30
|
||||
|
||||
TOOLBAR "" 0 19 0 0
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 "~OK"
|
||||
PICTURE BMP_OK
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -11 "~Fine"
|
||||
MESSAGE EXIT,K_QUIT
|
||||
PICTURE BMP_QUIT
|
||||
PICTURE BMP_QUITDN
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Servizi" -1 -1 80 20
|
||||
|
||||
STRING DLG_PROFILE 70
|
||||
BEGIN
|
||||
FLAGS "HG"
|
||||
PROMPT 1 1 ""
|
||||
PSELECT
|
||||
END
|
||||
|
||||
STRING F_PATH 40
|
||||
BEGIN
|
||||
PROMPT 1 1 "Percorso dei files DBF di BPCS "
|
||||
END
|
||||
|
||||
LIST F_SERVICE 60
|
||||
BEGIN
|
||||
PROMPT 1 2 "Servizio: "
|
||||
ITEM "1|Azzera file articoli da ignorare"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "2|Crea i magazzini terzisti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "3|Completa le linee prod. terzisti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "4|Rinumera le distinte"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "5|Rinumera le UMS"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "6|Sposta le lavorazioni sui finiti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "7|Setta flag Master sugli articoli"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "8|Imposta la formula delle varianti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
// ITEM "9|Controlla locazioni sconosciute "
|
||||
// MESSAGE HIDE, G_SERVICE@ |SHOW, G_SERVICE_9@
|
||||
ITEM "10|Evadi ordini cliente"
|
||||
MESSAGE HIDE, G_SERVICE@ |SHOW, G_SERVICE_10@
|
||||
ITEM "11|Reset evasione ordini cliente"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "12|Ricerca errori nel ciclo di lavoro"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "13|Allineamento giacenze"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "14|Scollegamento mov.mag da documenti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "16|Unifica magazzini terzisti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
ITEM "17|Controlla esplosioni movimenti"
|
||||
MESSAGE HIDE, G_SERVICE@
|
||||
END
|
||||
|
||||
STRING S_CODIMP 2
|
||||
BEGIN
|
||||
FLAGS "U"
|
||||
PROMPT 3 3 "Codice impianto : "
|
||||
GROUP G_SERVICE G_SERVICE_10
|
||||
END
|
||||
STRING S_MOVMAG_FILE 20
|
||||
BEGIN
|
||||
PROMPT 3 4 "Nome file di magazzino: "
|
||||
GROUP G_SERVICE G_SERVICE_9 G_SERVICE_10
|
||||
END
|
||||
DATE S_MOVMAG_FROMD
|
||||
BEGIN
|
||||
PROMPT 3 5 "Dalla data:"
|
||||
GROUP G_SERVICE G_SERVICE_10
|
||||
END
|
||||
DATE S_MOVMAG_TOD
|
||||
BEGIN
|
||||
PROMPT 43 5 "alla data:"
|
||||
GROUP G_SERVICE G_SERVICE_10
|
||||
END
|
||||
|
||||
NUM S_LASTBOLLA 5
|
||||
BEGIN
|
||||
PROMPT 3 6 "Ultima n.bolla BPCS Cover compresa nel pending "
|
||||
GROUP G_SERVICE G_SERVICE_10
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
754
db/dbcv09.cpp
754
db/dbcv09.cpp
@ -1,7 +1,82 @@
|
||||
#include "dblib.h"
|
||||
#include "dbcv09.h"
|
||||
#include "dbcv00a.h"
|
||||
#include <relation.h>
|
||||
#include "..\mg\anamag.h"
|
||||
|
||||
void delete_files(const char *wild)
|
||||
{
|
||||
TString_array transactions;
|
||||
list_files(wild, transactions);
|
||||
FOR_EACH_ARRAY_ROW(transactions, row, name)
|
||||
remove(*name);
|
||||
}
|
||||
// ******************************************
|
||||
bool force_write(TLocalisamfile & f)
|
||||
{
|
||||
int err=f.write();
|
||||
if (err != NOERR) // fallisce se c'e' gia'
|
||||
err=f.rewrite();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
// ******************************************
|
||||
int location2metod(long location)
|
||||
long method2location(int method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
case 0: return 0;
|
||||
case 1: return 1530;
|
||||
case 2: return 59;
|
||||
case 3: return 2008;
|
||||
case 4: return 63;
|
||||
case 5: return 872;
|
||||
case 6: return 66;
|
||||
case 7: return 1700;
|
||||
case 8: return 115;
|
||||
case 9: return 935;
|
||||
case 10: return 911;
|
||||
case 11: return 1812;
|
||||
case 12: return 230;
|
||||
case 13: return 433;
|
||||
case 14: return 272;
|
||||
case 15: return 1382;
|
||||
case 16: return 467;
|
||||
case 17: return 1352;
|
||||
case 18: return 233;
|
||||
case 19: return 498;
|
||||
case 20: return 651;
|
||||
case 21: return 511;
|
||||
case 22: return 519;
|
||||
case 23: return 2017;
|
||||
case 24: return 798;
|
||||
case 25: return 582;
|
||||
case 26: return 618;
|
||||
case 27: return 1190;
|
||||
case 28: return 1360;
|
||||
case 29: return 1727;
|
||||
case 30: return 2081;
|
||||
case 31: return 1330;
|
||||
case 32: return 565;
|
||||
case 33: return 2079;
|
||||
case 34: return 2194;
|
||||
case 35: return 229;
|
||||
case 36: return 2280;
|
||||
case 37: return 60;
|
||||
case 38: return 50037;
|
||||
case 39: return 1154;
|
||||
case 40: return 2153;
|
||||
case 41: return 1569; // M&M srl
|
||||
case 42: return 1569;
|
||||
case 43: return 2237;
|
||||
case 44: return 2668; // rotolito
|
||||
case 45: return -3; // sconfezionamento
|
||||
}
|
||||
return -99; // terzista generico
|
||||
}
|
||||
|
||||
int location2method(long location)
|
||||
{
|
||||
switch (location)
|
||||
{
|
||||
@ -49,18 +124,53 @@ int location2metod(long location)
|
||||
case -1: return 41; // M&M srl
|
||||
case 1569: return 42;
|
||||
case 2237: return 43;
|
||||
case -2: return 44; // rotolito
|
||||
case 2668: return 44; // ??
|
||||
case -3: return 45; // sconfezionamento
|
||||
|
||||
}
|
||||
return 99; // terzista generico
|
||||
}
|
||||
|
||||
void delete_boms(bool lavsexcl,bool onlylavs)
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
TIndwin info(60,"Cancellazione distinte...",FALSE,FALSE);
|
||||
TLocalisamfile dist(LF_DIST);
|
||||
TLocalisamfile rdist(LF_RDIST);
|
||||
// distinte
|
||||
for (long i=dist.items(); i>0; i--)
|
||||
{
|
||||
dist.readat(i);
|
||||
const bool is_lav=!cache().get("LAV",dist.get("CODDIST")).empty();
|
||||
if (lavsexcl==!is_lav || onlylavs==is_lav)
|
||||
{
|
||||
// non e' una lavorazione
|
||||
dist.remove();
|
||||
}
|
||||
if ((i%TICK)==0)
|
||||
do_events();
|
||||
}
|
||||
// righe distinte
|
||||
for (i=rdist.items(); i>0; i--)
|
||||
{
|
||||
rdist.readat(i);
|
||||
const bool is_lav=!(rdist.get("TIPO")!="L");
|
||||
if (lavsexcl==!is_lav || onlylavs==is_lav)
|
||||
{
|
||||
// non e' una lavorazione
|
||||
rdist.remove();
|
||||
}
|
||||
if ((i%TICK)==0)
|
||||
do_events();
|
||||
}
|
||||
}
|
||||
|
||||
const char * descr_method(int method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
case 1: return ("Areosol lab. Italia");
|
||||
case 2: return ("Areosol serivce Italia");
|
||||
case 2: return ("Areosol service Italia");
|
||||
case 3: return ("Bertoncini");
|
||||
case 4: return ("Bregaglio");
|
||||
case 5: return ("CABL service");
|
||||
@ -97,7 +207,7 @@ const char * descr_method(int method)
|
||||
case 36: return ("Brelil");
|
||||
case 37: return ("Akronimex");
|
||||
case 38: return ("Globol UK");
|
||||
case 39: return ("LIto Sestese");
|
||||
case 39: return ("Lito Sestese");
|
||||
case 40: return ("Serialfa");
|
||||
case 41: return ("M&M"); // M&M srl
|
||||
case 42: return ("M&M srl");
|
||||
@ -112,13 +222,15 @@ void num_mag2main_imp(int magno, TString & codimp)
|
||||
{
|
||||
switch (magno)
|
||||
{
|
||||
case 91:
|
||||
case 93:
|
||||
case 26:
|
||||
case 91: // magazzino terzisti (suddiviso in locazioni)
|
||||
case 93: // magazzino terzisti (suddiviso in locazioni)
|
||||
case 25: // magazzino DI FATTURAZIONE
|
||||
case 26: // magazzino interno
|
||||
codimp="SE";
|
||||
break;
|
||||
case 92:
|
||||
case 28:
|
||||
case 92: // magazzino terzisti (suddiviso in locazioni)
|
||||
case 27: // magazzino DI FATTURAZIONE
|
||||
case 28: // magazzino interno
|
||||
codimp="TS";
|
||||
break;
|
||||
default:
|
||||
@ -246,7 +358,7 @@ void codimp2codmagdep(TString &codimp,int terzista, TString &codmag)
|
||||
{
|
||||
if (terzista>0)
|
||||
{
|
||||
codimp << format("3%02d",terzista);
|
||||
codimp = "XT";
|
||||
codmag = codimp;
|
||||
} else {
|
||||
codmag = codimp;
|
||||
@ -262,12 +374,14 @@ void num_mag2cod_imp(int magno, TString & codimp)
|
||||
case 93:
|
||||
codimp="SE3";
|
||||
break;
|
||||
case 25:
|
||||
case 26:
|
||||
codimp="SE";
|
||||
break;
|
||||
case 92:
|
||||
codimp="TS3";
|
||||
break;
|
||||
case 27:
|
||||
case 28:
|
||||
codimp="TS";
|
||||
break;
|
||||
@ -276,14 +390,77 @@ void num_mag2cod_imp(int magno, TString & codimp)
|
||||
}
|
||||
}
|
||||
|
||||
int cod_mag2num_mag(const TString & codmag)
|
||||
{
|
||||
if (codmag=="SE3")
|
||||
return 91;
|
||||
if (codmag=="SE1")
|
||||
return 26;
|
||||
if (codmag=="TS3")
|
||||
return 92;
|
||||
if (codmag=="TS1")
|
||||
return 28;
|
||||
if (!codmag.blank())
|
||||
error_box("Che cazzo di magazzino è %s?", (const char *)codmag);
|
||||
return -1;
|
||||
}
|
||||
void set_workcenter_code(TString & stdwrkc, const char * codimp, long wrkc, int bomm)
|
||||
{
|
||||
int type=int (wrkc/100);
|
||||
if ( type == 1010 || (bomm != 0 && bomm != 99)) // non e' una linea di confezionamento di Segrate o terzista
|
||||
{
|
||||
int lineno;
|
||||
if (type == 1010 )
|
||||
{
|
||||
lineno=int (wrkc - type*100);
|
||||
stdwrkc = codimp;
|
||||
} else {
|
||||
lineno= 100;
|
||||
stdwrkc="X";
|
||||
}
|
||||
switch (lineno)
|
||||
{
|
||||
// centri di lavoro interni all'impianto
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 14:
|
||||
stdwrkc << format("%03d", lineno);
|
||||
break;
|
||||
case 15:
|
||||
stdwrkc << "999";
|
||||
break;
|
||||
// centri di lavoro dei terzisti
|
||||
case 100:
|
||||
stdwrkc << format("%02d", bomm);
|
||||
stdwrkc << codimp;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
stdwrkc="";
|
||||
}
|
||||
}
|
||||
|
||||
void add_stdlabors(const char * item, long wrkc, int bomm)
|
||||
{
|
||||
int type=int (wrkc/100);
|
||||
if ( type == 1010 || (bomm != 0 && bomm != 99)) // non e' una linea di confezionamento di Segrate o terzista
|
||||
{
|
||||
// ************
|
||||
// lav su SEGRATE
|
||||
TString8 postcode("SE");
|
||||
if (bomm != 0 )
|
||||
postcode.format("X%02d%s", bomm, "SE");
|
||||
TString tmpcode(item);
|
||||
tmpcode << "__" << postcode;
|
||||
TLocalisamfile rdist(LF_RDIST);
|
||||
TString stdlav;
|
||||
rdist.put("CODDIST",item);
|
||||
rdist.put("CODDIST",tmpcode);
|
||||
rdist.read(_isgteq);
|
||||
int nrig=0;
|
||||
while (!rdist.eof() && rdist.get("CODDIST")==item)
|
||||
@ -296,56 +473,60 @@ void add_stdlabors(const char * item, long wrkc, int bomm)
|
||||
{
|
||||
// nessuna lavorazione precedentemente inserita
|
||||
int lineno;
|
||||
if (type == 1010 )
|
||||
lineno=int (wrkc - type*100);
|
||||
else
|
||||
if (bomm != 0 )
|
||||
lineno= 100;
|
||||
else
|
||||
lineno=int (wrkc - type*100);
|
||||
int pzxca;
|
||||
switch (lineno)
|
||||
{
|
||||
case 1:
|
||||
stdlav="L_ALCOL1";
|
||||
tmpcode="SE_ALCOL1";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 2:
|
||||
stdlav="L_DOCCIA";
|
||||
tmpcode="SE_DOCCIA";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 4:
|
||||
stdlav="L_GLYSOL";
|
||||
tmpcode="SE_GLYSOL";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 5:
|
||||
stdlav="L_BRYLCR";
|
||||
tmpcode="SE_BRYLCR";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 6:
|
||||
stdlav="L_BAGNOS";
|
||||
tmpcode="SE_BAGNOS";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 7:
|
||||
stdlav="L_SAPONE";
|
||||
tmpcode="SE_SAPONE";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 8:
|
||||
stdlav="L_SAPRIC";
|
||||
tmpcode="SE_SAPRIC";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 9:
|
||||
stdlav="L_DENTIF";
|
||||
pzxca=12;
|
||||
tmpcode="SE_DENTIF";
|
||||
pzxca=24;
|
||||
break;
|
||||
case 10:
|
||||
stdlav="L_PENTO";
|
||||
tmpcode="SE_PENTO";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 14:
|
||||
stdlav="L_ALCOL2";
|
||||
tmpcode="SE_ALC.EDT";
|
||||
pzxca=12;
|
||||
break;
|
||||
case 15:
|
||||
tmpcode="SE_MANGEN";
|
||||
pzxca=0;
|
||||
break;
|
||||
// lavorazioni terzisti
|
||||
case 100:
|
||||
stdlav="L_RICONF";
|
||||
tmpcode="SE_RICONF";
|
||||
pzxca=12;
|
||||
break;
|
||||
default:
|
||||
@ -358,9 +539,12 @@ void add_stdlabors(const char * item, long wrkc, int bomm)
|
||||
TToken_string key(item);
|
||||
key.add("1",1);
|
||||
if (cache().get(LF_UMART,key).get("UM")=="CA")
|
||||
stdlav<< "_CA" << pzxca;
|
||||
else
|
||||
stdlav<< "_SL";
|
||||
{
|
||||
if (pzxca)
|
||||
tmpcode<< "_X" << pzxca;
|
||||
}
|
||||
else if (cache().get(LF_UMART,key).get("UM")=="PZ")
|
||||
tmpcode<< "_SL";
|
||||
real fc;
|
||||
if (cache().get(LF_UMART,key).get("UM")==um)
|
||||
{
|
||||
@ -369,37 +553,285 @@ void add_stdlabors(const char * item, long wrkc, int bomm)
|
||||
key.add("2",1);
|
||||
fc=cache().get(LF_UMART,key).get_real("FC");
|
||||
}
|
||||
if (!cache().get("LAV",stdlav).empty())
|
||||
if (cache().get("LAV",tmpcode).empty())
|
||||
{
|
||||
rdist.put("CODDIST",item);
|
||||
rdist.put("NRIG",nrig+1);
|
||||
rdist.put("TIPO","L");
|
||||
rdist.put("CODCOMP",stdlav);
|
||||
rdist.put("UM",um);
|
||||
rdist.put("EXPR",fc.string());
|
||||
rdist.write();
|
||||
} else {
|
||||
error_box("Impossibile trovare la lavorazione %s per l'articolo %s. Inserimento automatico", (const char *)stdlav, item);
|
||||
cache().discard("LAV",stdlav);
|
||||
TTable ttt("LAV");
|
||||
ttt.put("CODTAB",stdlav);
|
||||
ttt.put("S0","???");
|
||||
ttt.write();
|
||||
if (noyes_box("Impossibile trovare la lavorazione %s per l'articolo %s. Inserimento automatico?", (const char *)tmpcode, item))
|
||||
{
|
||||
cache().discard("LAV",tmpcode);
|
||||
TTable ttt("LAV");
|
||||
ttt.put("CODTAB",tmpcode);
|
||||
ttt.put("S0","???");
|
||||
ttt.put("S6",cache().get(LF_UMART,key).get("UM"));
|
||||
ttt.write();
|
||||
}
|
||||
}
|
||||
rdist.put("CODDIST",item);
|
||||
rdist.put("NRIG",nrig+1);
|
||||
rdist.put("TIPO","L");
|
||||
rdist.put("CODCOMP",tmpcode);
|
||||
rdist.put("UM",um);
|
||||
rdist.put("EXPR",fc.string());
|
||||
rdist.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void round_date(TDate& date, bool up)
|
||||
bool sposta_lavs()
|
||||
{
|
||||
TIndwin iw(80, "Spostamento lavorazioni sulle varianti fantasma di impianto",FALSE,FALSE);
|
||||
int err;
|
||||
int nrig,oldnrig;
|
||||
long distno=1L;
|
||||
TString cod="";
|
||||
TLocalisamfile rdist(LF_RDIST);
|
||||
err = rdist.read(_isfirst);
|
||||
bool some_moved=FALSE;
|
||||
while (err == NOERR)
|
||||
{
|
||||
cod = rdist.get("CODDIST");
|
||||
if ((distno%TICK)==1)
|
||||
{
|
||||
iw.set_text(format("Riga distinta n. %ld", distno));
|
||||
do_events();
|
||||
}
|
||||
distno++;
|
||||
oldnrig=rdist.get_int("NRIG");
|
||||
if (*rdist.get("TIPO") == 'L' && cod.find("__")<=0)
|
||||
{
|
||||
// lavorazione
|
||||
TString newcod(cod);
|
||||
TString codlav(rdist.get("CODCOMP"));
|
||||
TString4 codimp(codlav.left(2));
|
||||
newcod << "__";
|
||||
if (codimp == "L_")
|
||||
{
|
||||
newcod << "SE";
|
||||
codlav = codlav.sub(1);
|
||||
codlav.insert("SE");
|
||||
rdist.put("CODCOMP", codlav);
|
||||
}
|
||||
else
|
||||
newcod << codimp;
|
||||
rdist.put("CODDIST", newcod);
|
||||
rdist.put("NRIG", 100+oldnrig);
|
||||
rdist.write();
|
||||
rdist.put("CODDIST", cod);
|
||||
rdist.put("NRIG", oldnrig);
|
||||
rdist.remove();
|
||||
some_moved=TRUE;
|
||||
}
|
||||
rdist.put("NRIG",oldnrig+1);
|
||||
err = rdist.read(_isgteq);
|
||||
nrig++;
|
||||
}
|
||||
return some_moved;
|
||||
}
|
||||
|
||||
bool build2levmsp()
|
||||
{
|
||||
if (!noyes_box("La presenza di varianti non di stabilimento identifichera' una distinta NON master. Confermi?"))
|
||||
return FALSE;
|
||||
|
||||
TIndwin iw(80, "Creazione articoli MASTER per MSP a 2 livelli",FALSE,FALSE);
|
||||
int err;
|
||||
bool oldmaster,master;
|
||||
long artdist=1L, numdist=1L;
|
||||
TString8 variante;
|
||||
TString cod="";
|
||||
TString distinta="",codvariant="";
|
||||
TLocalisamfile dist(LF_DIST),dist2(LF_DIST);
|
||||
err = dist.read(_isfirst);
|
||||
while (err == NOERR)
|
||||
{
|
||||
cod = dist.get("CODDIST");
|
||||
if ((numdist%TICK)==1)
|
||||
{
|
||||
iw.set_text(format("Distinta articolo n. %ld/%ld", artdist,numdist));
|
||||
do_events();
|
||||
}
|
||||
numdist++;
|
||||
int var=cod.find("__");
|
||||
if (var <=0) // non variante
|
||||
{
|
||||
distinta=cod;
|
||||
|
||||
oldmaster=cache().get(LF_DIST,distinta).get_bool("MASTER");
|
||||
if (cache().get(LF_ANAMAG,distinta).get("GRMERC")[0]=='B')
|
||||
master=FALSE;
|
||||
else
|
||||
master=TRUE;
|
||||
|
||||
codvariant=distinta;
|
||||
codvariant << "__";
|
||||
var = codvariant.len();
|
||||
dist2.put("CODDIST",codvariant);
|
||||
err = dist2.read(_isgteq);
|
||||
while (master && err == NOERR)
|
||||
{
|
||||
cod = dist2.get("CODDIST");
|
||||
if (cod.left(var)!=codvariant)
|
||||
break;
|
||||
if (cod[var+2]>'\0') // variante non di stabilimento
|
||||
master=FALSE;
|
||||
|
||||
err = dist2.next();
|
||||
}
|
||||
if (master!=oldmaster)
|
||||
{
|
||||
dist2.put("CODDIST",distinta);
|
||||
dist2.read();
|
||||
dist2.put("MASTER",master);
|
||||
dist2.rewrite();
|
||||
}
|
||||
cache().discard(LF_DIST,distinta);
|
||||
}
|
||||
err = dist.next();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
bool rinumera_dist()
|
||||
{
|
||||
TIndwin iw(80, "Rinumerazione progr. righe distinte ...",FALSE,FALSE);
|
||||
bool some_done=FALSE;
|
||||
int err;
|
||||
int nrig,oldnrig;
|
||||
long distno=1L;
|
||||
TString cod="";
|
||||
TLocalisamfile rdist(LF_RDIST);
|
||||
err = rdist.read(_isfirst);
|
||||
while (err == NOERR)
|
||||
{
|
||||
if (cod != rdist.get("CODDIST"))
|
||||
{
|
||||
if ((distno%TICK)==1)
|
||||
{
|
||||
iw.set_text(format("Rinumerazione distinta n. %ld", distno));
|
||||
do_events();
|
||||
}
|
||||
cod = rdist.get("CODDIST");
|
||||
nrig=1;
|
||||
distno++;
|
||||
}
|
||||
oldnrig=rdist.get_int("NRIG");
|
||||
if (oldnrig != nrig)
|
||||
{
|
||||
rdist.put("NRIG",nrig);
|
||||
err = rdist.write();
|
||||
rdist.put("NRIG",oldnrig);
|
||||
err = rdist.remove();
|
||||
some_done=TRUE;
|
||||
rdist.put("NRIG",oldnrig+1);
|
||||
err = rdist.read(_isgteq);
|
||||
} else
|
||||
err = rdist.next();
|
||||
nrig++;
|
||||
}
|
||||
return some_done;
|
||||
}
|
||||
|
||||
bool rinumera_ums()
|
||||
{
|
||||
TIndwin iw(80, "Rinumerazione unita' di misura ...",FALSE,FALSE);
|
||||
bool some_done=FALSE;
|
||||
int err;
|
||||
int nrig,oldnrig=0L;
|
||||
long distno=1L;
|
||||
TString cod="";
|
||||
TLocalisamfile umart(LF_UMART);
|
||||
err = umart.read(_isfirst);
|
||||
while (err == NOERR)
|
||||
{
|
||||
oldnrig=umart.get_int("NRIGA");
|
||||
if (cod != umart.get("CODART"))
|
||||
{
|
||||
if ((distno%TICK)==1)
|
||||
{
|
||||
iw.set_text(format("Rinumerazione UMS: riga %ld", distno));
|
||||
do_events();
|
||||
}
|
||||
cod = umart.get("CODART");
|
||||
nrig=1;
|
||||
}
|
||||
if (oldnrig != nrig)
|
||||
{
|
||||
umart.put("NRIGA",nrig);
|
||||
err = umart.write();
|
||||
umart.put("NRIGA",oldnrig);
|
||||
err = umart.remove();
|
||||
some_done=TRUE;
|
||||
}
|
||||
umart.put("NRIGA",oldnrig+1);
|
||||
err = umart.read(_isgteq);
|
||||
nrig++;
|
||||
}
|
||||
return some_done;
|
||||
}
|
||||
|
||||
|
||||
// Imposta la formula delle varianti sui finiti e semilavorati
|
||||
void setformulavar()
|
||||
{
|
||||
TIndwin iw(80, "Impostazione formula delle varianti ...",FALSE,FALSE);
|
||||
int err;
|
||||
long distno=1L;
|
||||
TLocalisamfile dist(LF_DIST);
|
||||
err = dist.read(_isfirst);
|
||||
TString varvar;
|
||||
TString cod(' ',20);
|
||||
while (err == NOERR)
|
||||
{
|
||||
if ((distno%TICK)==1)
|
||||
{
|
||||
iw.set_text(format("Impostazione formula distinta n. %ld", distno));
|
||||
do_events();
|
||||
}
|
||||
cod=dist.get("CODDIST");
|
||||
if (cod.find("__")<0)
|
||||
{
|
||||
const TRectype &ana=cache().get(LF_ANAMAG,cod);
|
||||
if (!ana.empty())
|
||||
{
|
||||
varvar="VARIANTE=_DISTINTA+\"__\"+";
|
||||
// se non e' un fantasma lo definisce come variante (distinta contenente una riga di tipo variabile)
|
||||
// se e' un finito, anche varianti di sconfezionamento
|
||||
if (ana.get(ANAMAG_GRMERC)[0]=='F')
|
||||
//varvar << "IF(_IMPIANTO==\"XT\",_LINEA,IF(_LINEA?=\"??9??\",_LINEA,_IMPIANTO))" ;
|
||||
varvar << "IF((_IMPIANTO==\"XT\")||(_LINEA?=\"??9??\"),_LINEA,_IMPIANTO)" ;
|
||||
else
|
||||
varvar << "IF(_IMPIANTO==\"XT\",_LINEA,_IMPIANTO)" ;
|
||||
if (varvar != dist.get("PARAMETRI"))
|
||||
{
|
||||
dist.put("PARAMETRI",varvar);
|
||||
dist.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
err = dist.read(_isnext);
|
||||
distno++;
|
||||
}
|
||||
}
|
||||
|
||||
void round_date(TDate& date, const int bucket_size, bool up)
|
||||
{
|
||||
// Dimensione del bucke in giorni
|
||||
const int bucket_size = 7;
|
||||
|
||||
// Riporta la data al primo lunedi prima dell'inizio
|
||||
const int wday = date.wday();
|
||||
if (wday > 1) date -= wday-1;
|
||||
|
||||
//TDate begin("01-01-1999");
|
||||
TDate begin(TODAY);
|
||||
begin.set_day(1);
|
||||
const int wday2 = begin.wday();
|
||||
if (wday2 > 1)
|
||||
begin -= wday2-1; // primo lunedi' considerato
|
||||
|
||||
int bucks=int((date-begin) / bucket_size);
|
||||
|
||||
date=begin;
|
||||
date+=bucket_size*bucks;
|
||||
|
||||
if (up) // Arrotonda alla fine del bucket
|
||||
date += (bucket_size - 1);
|
||||
else // Arrotonda all'inizio del bucket
|
||||
@ -408,33 +840,213 @@ void round_date(TDate& date, bool up)
|
||||
|
||||
|
||||
|
||||
void crea_mag3()
|
||||
bool check_mag_locations(const TString &path,const TFilename &source)
|
||||
{
|
||||
TString codmag;TString desc;
|
||||
TTable mag("MAG");
|
||||
mag.put("CODTAB","SE3");
|
||||
mag.put("B0","X");
|
||||
mag.put("S0","Terzisti di Segrate (ex mag. 91-93)");
|
||||
mag.write();
|
||||
TImport_file movmag(path,source);
|
||||
movmag.first();
|
||||
long l;
|
||||
do {
|
||||
l= movmag.get_long("TLOCT");
|
||||
if (location2method(l)==99)
|
||||
if (yesno_box("Locazione %ld sconosciuta. Interrompo?",l))
|
||||
return FALSE;
|
||||
} while (!movmag.next());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
mag.put("CODTAB","TS3");
|
||||
mag.put("B0","X");
|
||||
mag.put("S0","Terzisti di Trieste (ex mag. 92)");
|
||||
mag.write();
|
||||
for (int t=1 ; t<45;t++)
|
||||
bool bonifica_vendite(TMask &m, const TString & codimp)
|
||||
{
|
||||
TString8 codnum=codimp;
|
||||
codnum<< "MM";
|
||||
TRelation *r= new TRelation(LF_DOC);
|
||||
r->add(LF_RIGHEDOC,"CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC");
|
||||
TCursor c(r);
|
||||
TRectype frec(LF_DOC);
|
||||
frec.put("CODNUM",codnum);
|
||||
frec.put("PROVV","D");
|
||||
frec.put("ANNO" ,"1999");
|
||||
c.setregion(frec,frec);
|
||||
c.freeze();
|
||||
|
||||
const long items=c.items();
|
||||
TProgind info(items,"Eliminazione causali di riga dalle bolle di vendita...",FALSE,TRUE);
|
||||
for (long i= 0; i< items ; i++)
|
||||
{
|
||||
desc=descr_method(t);
|
||||
|
||||
codmag.format("SE3%02d",t);
|
||||
mag.put("CODTAB",codmag);
|
||||
mag.put("S0",desc);
|
||||
mag.write();
|
||||
|
||||
codmag.format("TS3%02d",t);
|
||||
mag.put("CODTAB",codmag);
|
||||
mag.put("S0",desc);
|
||||
mag.write();
|
||||
c=i;
|
||||
info.addstatus(1);
|
||||
TRelation *r =c.relation();
|
||||
TLocalisamfile & teste = c.relation()->lfile(LF_DOC);
|
||||
TLocalisamfile & righe = c.relation()->lfile(LF_RIGHEDOC);
|
||||
if (teste.get("CAUSMAG")=="VNENT")
|
||||
{
|
||||
bool ok = r->is_first_match(LF_RIGHEDOC);
|
||||
while (ok)
|
||||
{
|
||||
real q=righe.get("QTA");
|
||||
if (righe.get("CAUSMAG")=="SCAR")
|
||||
q=-q;
|
||||
|
||||
righe.put("CAUSMAG"," ");
|
||||
righe.put("QTA",q);
|
||||
righe .rewrite();
|
||||
ok = r->next_match(LF_RIGHEDOC);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// **************************************
|
||||
|
||||
TImport_file::TImport_file(const char *path, const char * name)
|
||||
{
|
||||
TFilename fname(path);
|
||||
fname.add(name);
|
||||
_f = new TExternisamfile(fname, TRUE, TRUE);
|
||||
_f->setkey(1);
|
||||
}
|
||||
void TImport_file::zero(const char filler)
|
||||
{
|
||||
_f->zero(filler);
|
||||
}
|
||||
|
||||
void TImport_file::put(const char *field, const char * val)
|
||||
{
|
||||
_f->put(field,val);
|
||||
}
|
||||
TString & TImport_file::get(const char *field)
|
||||
{
|
||||
_sbuffer = _f->get(field);
|
||||
return _sbuffer.trim();
|
||||
}
|
||||
TString & TImport_file::get_codice(const char *field)
|
||||
{
|
||||
_sbuffer = _f->get(field);
|
||||
_sbuffer.trim();
|
||||
|
||||
return _sbuffer;
|
||||
}
|
||||
const real & TImport_file::get_real(const char *field)
|
||||
{
|
||||
get(field).replace(',','.');
|
||||
_rbuffer=real(_sbuffer);
|
||||
return _rbuffer;
|
||||
}
|
||||
const long TImport_file::get_long(const char *field)
|
||||
{
|
||||
const long l= _f->get_long(field);
|
||||
return l;
|
||||
}
|
||||
const TDate & TImport_file::get_date(const char *field)
|
||||
{
|
||||
_dbuffer=_f->get_long(field);
|
||||
return _dbuffer;
|
||||
}
|
||||
|
||||
bool TImport_file::first()
|
||||
{
|
||||
return _f->first();
|
||||
}
|
||||
bool TImport_file::prev()
|
||||
{
|
||||
return _f->prev();
|
||||
}
|
||||
bool TImport_file::next()
|
||||
{
|
||||
return _f->next();
|
||||
}
|
||||
bool TImport_file::eof()
|
||||
{
|
||||
return _f->eof();
|
||||
}
|
||||
|
||||
long TImport_file::items()
|
||||
{
|
||||
return _f->items();
|
||||
}
|
||||
|
||||
|
||||
int TImport_file::read()
|
||||
{
|
||||
int err = _f->read(_isgteq);
|
||||
return err;
|
||||
}
|
||||
int TImport_file::write()
|
||||
{
|
||||
return _f->write();
|
||||
}
|
||||
void TImport_file::zap(bool pack)
|
||||
{
|
||||
int err;
|
||||
_f->first();
|
||||
for (;!_f->eof(); _f->next())
|
||||
{
|
||||
err=_f->remove();
|
||||
}
|
||||
/* for (long i=_f->items(); i>0; i--)
|
||||
{
|
||||
_f->readat(i);
|
||||
err=_f->remove();
|
||||
}
|
||||
if (pack)
|
||||
_f->pack();*/
|
||||
}
|
||||
|
||||
|
||||
// **************************************
|
||||
void TSupport_file::zap()
|
||||
{
|
||||
int err;
|
||||
for (long i=_f->items(); i>0; i--)
|
||||
{
|
||||
_f->readat(i);
|
||||
err=_f->remove();
|
||||
}
|
||||
}
|
||||
int TSupport_file::read(TRectype & r)
|
||||
{
|
||||
CHECK(r.num() == _f->num(),"TIpo record inconsistente");
|
||||
TString k(r.build_key(1));
|
||||
r = _cache->get(k);
|
||||
if (r.empty())
|
||||
return _iskeynotfound;
|
||||
return NOERR;
|
||||
}
|
||||
int TSupport_file::write()
|
||||
{
|
||||
TString k(_f->curr().build_key(1));
|
||||
_cache->discard(k);
|
||||
return _f->write();
|
||||
}
|
||||
|
||||
void TSupport_file::put(const char * field, const char * value)
|
||||
{
|
||||
_f->put(field,value);
|
||||
}
|
||||
|
||||
TSupport_file::TSupport_file (int logicnum,const char * radix)
|
||||
{
|
||||
_f = new TIsamtempfile(logicnum,radix,FALSE,FALSE);
|
||||
_cache= new TRecord_cache(_f);
|
||||
}
|
||||
TSupport_file::~TSupport_file()
|
||||
{
|
||||
delete _f;
|
||||
delete _cache;
|
||||
}
|
||||
|
||||
// **************************************
|
||||
TTimed_skipbox:: TTimed_skipbox(const char * message,int seconds,int x,int y)
|
||||
: TTimed_breakbox(message,seconds,x,y)
|
||||
{
|
||||
hide(DLG_OK);
|
||||
hide(DLG_CANCEL);
|
||||
add_button(DLG_CANCEL, 0, "~Ignora", -22, -1, 12, 2,"",0);
|
||||
add_button(DLG_OK, 0, "Im~porta", -12, -1, 12, 2,"",0);
|
||||
}
|
||||
|
||||
TTimed_skipbox::~TTimed_skipbox()
|
||||
{}
|
||||
|
||||
|
91
db/dbcv09.h
91
db/dbcv09.h
@ -2,18 +2,103 @@
|
||||
#include <strings.h>
|
||||
#include <tabutil.h>
|
||||
#include <recarray.h>
|
||||
#include <progind.h>
|
||||
#include <mask.h>
|
||||
|
||||
#define ANAGRAFICA_MORTI "iimdead"
|
||||
#define BPCS_ANAGRAFICA "iiml01"
|
||||
#define BPCS_IMPORTEX "iimsl01"
|
||||
#define BPCS_DISTINTE "mbml01"
|
||||
#define BPCS_DIVISORI "cicl01"
|
||||
#define BPCS_MOVMAG "ithl01"
|
||||
#define BPCS_ORDACQ "ord_acq"
|
||||
#define BPCS_FIRMORD "ord_cli"
|
||||
#define BPCS_SHOPORDS "ord_prod"
|
||||
#define BPCS_STOCK "mgfinale"
|
||||
|
||||
#define TICK 50
|
||||
|
||||
void delete_files(const char *wildcard);
|
||||
bool force_write(TLocalisamfile & f);
|
||||
// individua il metodo a partire dalla locazione di magazzino (codice dep)
|
||||
int location2metod(long location) ;
|
||||
int location2method(long location) ;
|
||||
long method2location(int method) ;
|
||||
// codifica il nome del terzista
|
||||
const char * descr_method(int method) ;
|
||||
// aggiunge le lavorazioni standard
|
||||
void add_stdlabors(const char * item, long wrkc, int bomm) ;
|
||||
|
||||
void set_workcenter_code(TString & stdwrkc, const char * codimp, long wrkc, int bomm) ;
|
||||
|
||||
bool check_mag_locations(const TString &path,const TFilename &source);
|
||||
void crea_mag3();
|
||||
void round_date(TDate& date, bool up=FALSE) ;
|
||||
void crea_linee3();
|
||||
bool rinumera_dist();
|
||||
bool rinumera_ums();
|
||||
bool sposta_lavs();
|
||||
bool build2levmsp();
|
||||
void setformulavar();
|
||||
bool evadi_orc(TMask &, const TString &codimp);
|
||||
bool unevadi_orc(TMask &, const TString & codimp);
|
||||
bool find_wrongcycle();
|
||||
|
||||
void round_date(TDate& date, const int bucket_size, bool up=FALSE) ;
|
||||
const char * check_clasdog(long stdo);
|
||||
void complete_gmc(TString & gmc,const char *iclas);
|
||||
void codimp2codmagdep(TString &codimp,int terzista, TString &codmag);
|
||||
void num_mag2cod_imp(int magno, TString & codimp);
|
||||
|
||||
void num_mag2main_imp(int magno, TString & codimp);
|
||||
int cod_mag2num_mag(const TString & codmag);
|
||||
|
||||
class TImport_file : public TObject
|
||||
{
|
||||
TExternisamfile *_f;
|
||||
real _rbuffer;
|
||||
TString _sbuffer;
|
||||
TDate _dbuffer;
|
||||
public:
|
||||
// record functs
|
||||
void zero(const char filler=' ');
|
||||
void put(const char *field, const char * val);
|
||||
TString & get(const char *field);
|
||||
const long get_long(const char *field);
|
||||
const int get_int(const char *field) {return int(get_long(field));}
|
||||
const real & get_real(const char *field);
|
||||
const TDate & get_date(const char *field);
|
||||
TString & get_codice(const char *field);
|
||||
// movements
|
||||
bool first();
|
||||
bool next();
|
||||
bool prev();
|
||||
bool eof();
|
||||
long items();
|
||||
int write();
|
||||
int read();
|
||||
void zap(bool pack=FALSE);
|
||||
|
||||
TImport_file(const char *path, const char * name);
|
||||
};
|
||||
|
||||
class TSupport_file : public TObject
|
||||
{
|
||||
TIsamtempfile * _f;
|
||||
TRecord_cache *_cache;
|
||||
public:
|
||||
void zap();
|
||||
void put(const char * field, const char * value);
|
||||
int read(TRectype & r);
|
||||
int read()
|
||||
{return read(_f->curr());}
|
||||
int write();
|
||||
TSupport_file (int logicnum,const char * radix);
|
||||
virtual ~TSupport_file ();
|
||||
};
|
||||
|
||||
|
||||
class TTimed_skipbox: public TTimed_breakbox
|
||||
{
|
||||
public:
|
||||
TTimed_skipbox(const char * message,int seconds,int x=40,int y=10);
|
||||
~TTimed_skipbox();
|
||||
};
|
||||
|
||||
|
331
db/dblib.cpp
331
db/dblib.cpp
@ -2,7 +2,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <urldefid.h>
|
||||
#include <lffiles.h>
|
||||
#include <utility.h>
|
||||
#include "tabutil.h"
|
||||
|
||||
@ -17,10 +16,6 @@
|
||||
// TQuantita'
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TDecoder* TQuantita::_umart1 = NULL;
|
||||
TDecoder* TQuantita::_umart2 = NULL;
|
||||
TDecoder* TQuantita::_umdist = NULL;
|
||||
|
||||
real TQuantita::get_factor(const TCodice_um& um) const
|
||||
{
|
||||
real fc = 1.0;
|
||||
@ -30,16 +25,17 @@ real TQuantita::get_factor(const TCodice_um& um) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_umart2 == NULL)
|
||||
static TDecoder* umart2 = NULL;
|
||||
if (umart2 == NULL)
|
||||
{
|
||||
_umart2 = new TDecoder(LF_UMART, UMART_FC, 2);
|
||||
_umart2->test_file_changes();
|
||||
_umart2->set_items_limit(256);
|
||||
umart2 = new TDecoder(LF_UMART, UMART_FC, 2);
|
||||
umart2->test_file_changes();
|
||||
umart2->set_items_limit(256);
|
||||
}
|
||||
|
||||
TString80 code;
|
||||
code << _articolo << '|' << (um.empty() ? _um : um);
|
||||
const TString& val = _umart2->decode(code);
|
||||
const TString& val = umart2->decode(code);
|
||||
if (val.not_empty())
|
||||
fc = real(val);
|
||||
}
|
||||
@ -48,26 +44,12 @@ real TQuantita::get_factor(const TCodice_um& um) const
|
||||
|
||||
real TQuantita::find_umbase(TCodice_um& um)
|
||||
{
|
||||
if (_umart1 == NULL)
|
||||
{
|
||||
_umart1 = new TDecoder(LF_UMART, UMART_UM, 1);
|
||||
_umart1->test_file_changes();
|
||||
_umart1->set_items_limit(256);
|
||||
}
|
||||
|
||||
TString80 code;
|
||||
code << _articolo << "|1";
|
||||
const TString& new_um = _umart1->decode(code);
|
||||
const TString& new_um = cache().get(LF_UMART, code, UMART_UM);
|
||||
if (new_um.blank())
|
||||
{
|
||||
if (_umdist == NULL)
|
||||
{
|
||||
_umdist = new TDecoder(LF_DIST, UMART_UM, 1);
|
||||
_umdist->test_file_changes();
|
||||
_umdist->set_items_limit(256);
|
||||
}
|
||||
um = _umdist->decode(_articolo);
|
||||
}
|
||||
// um = cache().get(LF_DIST, _articolo, UMART_UM); // Inutile, gia' contemplato prima!
|
||||
um = cache().get("LAV", _articolo, "S6");
|
||||
else
|
||||
um = new_um;
|
||||
return 1.0;
|
||||
@ -75,16 +57,8 @@ real TQuantita::find_umbase(TCodice_um& um)
|
||||
|
||||
real TQuantita::find_umdist(TCodice_um& um)
|
||||
{
|
||||
if (_umdist == NULL)
|
||||
{
|
||||
_umdist = new TDecoder(LF_DIST, UMART_UM, 1);
|
||||
_umdist->test_file_changes();
|
||||
_umdist->set_items_limit(256);
|
||||
}
|
||||
um = _umdist->decode(_articolo);
|
||||
if (um.blank())
|
||||
find_umbase(um);
|
||||
return get_factor(um);
|
||||
um = cache().get(LF_DIST, _articolo, UMART_UM);
|
||||
return um.blank() ? find_umbase(um) : get_factor(um);
|
||||
}
|
||||
|
||||
void TQuantita::set_articolo(const TCodice_articolo& art,
|
||||
@ -273,7 +247,7 @@ int TLavorazione::write(TBaseisamfile& f) const
|
||||
((TLavorazione *)this)->put_linee();
|
||||
return TRectype::write(f) ;
|
||||
}
|
||||
// @cmember Riscrive il record sul fil
|
||||
// @cmember Riscrive il record sul file
|
||||
int TLavorazione::rewrite(TBaseisamfile& f) const
|
||||
{
|
||||
((TLavorazione *)this)->put_linee();
|
||||
@ -470,6 +444,25 @@ bool TDistinta_tree::isola_codice(TString& code) const
|
||||
return code.not_empty();
|
||||
}
|
||||
|
||||
bool TDistinta_tree::father_code(TCodice_articolo& code) const
|
||||
{
|
||||
const int it = _path.items();
|
||||
_path.get(it - 2, _tmp);
|
||||
isola_codice(_tmp);
|
||||
code = _tmp;
|
||||
return code.not_empty();
|
||||
}
|
||||
|
||||
bool TDistinta_tree::father_giaclev(TString& code, int levnum) const
|
||||
{
|
||||
const int it = _path.items();
|
||||
_path.get(it - 2, _tmp);
|
||||
_tmp.get(1, code);
|
||||
if (levnum>0)
|
||||
code = livgiac().unpack_grpcode(code, levnum).trim();
|
||||
return code.not_empty();
|
||||
}
|
||||
|
||||
bool TDistinta_tree::curr_code(TCodice_articolo& code) const
|
||||
{
|
||||
_path.get(-2, _tmp);
|
||||
@ -477,24 +470,13 @@ bool TDistinta_tree::curr_code(TCodice_articolo& code) const
|
||||
code = _tmp;
|
||||
return code.not_empty();
|
||||
}
|
||||
/*
|
||||
bool TDistinta_tree::curr_father(TCodice_articolo& code) const
|
||||
{
|
||||
const int level=_path.items();
|
||||
code.cut(0);
|
||||
if (level==1)
|
||||
return FALSE;
|
||||
_path.get(level-1, _tmp);
|
||||
isola_codice(_tmp);
|
||||
code = _tmp;
|
||||
return code.not_empty();
|
||||
}*/
|
||||
|
||||
|
||||
bool TDistinta_tree::curr_giac(TString& code) const
|
||||
bool TDistinta_tree::curr_giaclev(TString& code, int levnum) const
|
||||
{
|
||||
_path.get(-2, _tmp);
|
||||
_tmp.get(1, code);
|
||||
if (levnum>0)
|
||||
code = livgiac().unpack_grpcode(code, levnum).trim();
|
||||
return code.not_empty();
|
||||
}
|
||||
|
||||
@ -518,6 +500,13 @@ const char* TDistinta_tree::curr_um(TCodice_um& code) const
|
||||
return code;
|
||||
}
|
||||
|
||||
real TDistinta_tree::last_qta() const
|
||||
{
|
||||
_path.get(-2, _tmp);
|
||||
real val; _tmp.get(5, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
real TDistinta_tree::curr_qta() const
|
||||
{
|
||||
real tot = 1.0;
|
||||
@ -629,33 +618,64 @@ TObject* TDistinta_tree::curr_node() const
|
||||
|
||||
const TString& TDistinta_tree::describe(const TCodice_articolo& codart) const
|
||||
{
|
||||
const TString& da = ((TDecoder&)_mag).decode(codart);
|
||||
if (da.not_empty())
|
||||
return da;
|
||||
static TString80 descr;
|
||||
describe(codart, descr);
|
||||
return descr;
|
||||
}
|
||||
|
||||
const TString& dl = ((TDecoder&)_lav).decode(codart);
|
||||
if (dl.not_empty())
|
||||
return dl;
|
||||
bool TDistinta_tree::describe(const TCodice_articolo& codart, TString& descr) const
|
||||
{
|
||||
// descr = ((TDecoder&)_mag).decode(codart);
|
||||
descr = cache().get(LF_ANAMAG, codart, ANAMAG_DESCR);
|
||||
if (descr.not_empty())
|
||||
return TRUE;
|
||||
|
||||
// descr = ((TDecoder&)_lav).decode(codart);
|
||||
descr = cache().get("LAV", codart, "S0");
|
||||
if (descr.not_empty())
|
||||
return TRUE;
|
||||
|
||||
const TString& dd = cache().get(LF_DIST,codart, "DESCR");
|
||||
return dd;
|
||||
const TRectype& rec = find_head(codart);
|
||||
descr = rec.get("DESCR");
|
||||
return !rec.empty();
|
||||
}
|
||||
|
||||
bool TDistinta_tree::get_livgiac_on_descr(int l) const
|
||||
{
|
||||
if (livgiac().enabled(l))
|
||||
return _livgiac_on_descr[l-1];
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool TDistinta_tree::set_livgiac_on_descr(int l, bool on)
|
||||
{
|
||||
if (livgiac().enabled(l))
|
||||
return _livgiac_on_descr[l-1]=on;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool TDistinta_tree::get_description(TString& desc) const
|
||||
{
|
||||
TCodice_articolo codart; curr_code(codart);
|
||||
desc = describe(codart);
|
||||
if (desc.empty())
|
||||
{
|
||||
desc = codart;
|
||||
desc << " - ???";
|
||||
}
|
||||
if (!describe(codart, desc))
|
||||
desc = "???";
|
||||
else
|
||||
{
|
||||
desc.insert(" - ", 0);
|
||||
desc.insert(codart, 0);
|
||||
for (int l = 1; l <= livgiac().last_level(); l++) if (get_livgiac_on_descr(l))
|
||||
{
|
||||
TString16 giaclev; curr_giaclev(giaclev,l);
|
||||
if (!giaclev.empty() )
|
||||
desc << " " << livgiac().name(l) << " " << giaclev;
|
||||
}
|
||||
if (get_qta_on_descr())
|
||||
{
|
||||
TCodice_um code; curr_um(code);
|
||||
desc << ' ' << get_descr_separator() << ' '
|
||||
<< curr_qta().string() << ' ' << code;
|
||||
}
|
||||
}
|
||||
|
||||
desc.insert(format(" %c ",get_descr_separator()), 0);
|
||||
desc.insert(codart, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -682,25 +702,26 @@ TImage* TDistinta_tree::image(bool selected) const
|
||||
|
||||
void TDistinta_tree::restart()
|
||||
{
|
||||
/*
|
||||
_vars.destroy();
|
||||
_mag.destroy();
|
||||
_lav.destroy();
|
||||
rec_cache(LF_RDIST).destroy();
|
||||
|
||||
*/
|
||||
shrink_all();
|
||||
}
|
||||
|
||||
bool TDistinta_tree::set_root(const TQuantita& qta)
|
||||
bool TDistinta_tree::set_root(const TQuantita& qta, const char* livgiac)
|
||||
{
|
||||
const bool ok = find(qta.articolo(), 1) != NULL;
|
||||
const bool ok = find_child(qta.articolo(), 1) != NULL;
|
||||
if (ok)
|
||||
{
|
||||
_tmp = qta.articolo();
|
||||
_tmp.add(' ');
|
||||
_tmp = qta.articolo(); // codice
|
||||
_tmp.add(livgiac); // livgiac
|
||||
_tmp.add('0');
|
||||
_tmp.add('0');
|
||||
_tmp.add(qta.um());
|
||||
_tmp.add(qta.val().string());
|
||||
_tmp.add(qta.um()); // unita' di misura
|
||||
_tmp.add(qta.val().string()); // quantita
|
||||
_tmp.add(get_type(qta.articolo()));
|
||||
|
||||
_root = _tmp;
|
||||
@ -710,14 +731,15 @@ bool TDistinta_tree::set_root(const TQuantita& qta)
|
||||
}
|
||||
|
||||
bool TDistinta_tree::set_root(const TCodice_articolo& art,
|
||||
const char* um, real qta)
|
||||
const char* um, real qta,
|
||||
const char* livgiac)
|
||||
{
|
||||
bool ok = find(art, 1) != NULL;
|
||||
bool ok = find_child(art, 1) != NULL;
|
||||
if (ok)
|
||||
{
|
||||
const TCodice_um umart = um;
|
||||
const TQuantita q(art, umart, qta);
|
||||
ok = set_root(q);
|
||||
ok = set_root(q, livgiac);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -725,8 +747,9 @@ bool TDistinta_tree::set_root(const TCodice_articolo& art,
|
||||
bool TDistinta_tree::set_root(const TRectype & rec)
|
||||
{
|
||||
const int logicnum = rec.num();
|
||||
TCodice_um umart;
|
||||
TCodice_articolo art;
|
||||
TCodice_um umart;
|
||||
TString16 livgiac;
|
||||
real qta;
|
||||
clear_globals();
|
||||
|
||||
@ -734,10 +757,12 @@ bool TDistinta_tree::set_root(const TRectype & rec)
|
||||
{
|
||||
case LF_RIGHEDOC:
|
||||
art = rec.get(RDOC_CODARTMAG);
|
||||
if (art.empty())
|
||||
art = rec.get(RDOC_CODART);
|
||||
umart = rec.get(RDOC_UMQTA);
|
||||
qta = rec.get_real(RDOC_QTA);
|
||||
livgiac = rec.get(RDOC_LIVELLO);
|
||||
set_global("_MAGAZZINO", rec.get(RDOC_CODMAG));
|
||||
set_global("_LIVELLO", rec.get(RDOC_LIVELLO));
|
||||
set_global("_LINEA", rec.get(RDOC_LINEA));
|
||||
set_global("_IMPIANTO", rec.get(RDOC_IMPIANTO));
|
||||
break;
|
||||
@ -745,16 +770,16 @@ bool TDistinta_tree::set_root(const TRectype & rec)
|
||||
art = rec.get(RMOVMAG_CODART);
|
||||
umart = rec.get(RMOVMAG_UM);
|
||||
qta = rec.get_real(RMOVMAG_QUANT);
|
||||
livgiac = rec.get(RMOVMAG_LIVGIAC);
|
||||
set_global("_MAGAZZINO", rec.get(RMOVMAG_CODMAG));
|
||||
set_global("_LIVELLO", rec.get(RMOVMAG_LIVGIAC));
|
||||
set_global("_LINEA", ZERO);
|
||||
set_global("_IMPIANTO", ZERO);
|
||||
set_global("_LINEA", rec.get(RMOVMAG_LINEA));
|
||||
set_global("_IMPIANTO", rec.get(RMOVMAG_IMPIANTO));
|
||||
break;
|
||||
default:
|
||||
NFCHECK("set root con un record (file n. %d) non previsto", logicnum);
|
||||
break;
|
||||
}
|
||||
return set_root(art, umart, qta);
|
||||
return set_root(art, umart, qta, livgiac);
|
||||
}
|
||||
|
||||
bool TDistinta_tree::has_root() const
|
||||
@ -781,7 +806,7 @@ bool TDistinta_tree::is_cyclic(const TToken_string& path) const
|
||||
if (last > 0)
|
||||
{
|
||||
path.get(-2, _tmp);
|
||||
TCodice_articolo mycod; _tmp.get(0, mycod);
|
||||
TCodice_articolo mycod; _tmp.get(0, mycod); mycod.trim();
|
||||
for (int i = last-1; i >= 0; i--)
|
||||
{
|
||||
path.get(i, _tmp);
|
||||
@ -822,7 +847,6 @@ static int compare_rdist_key(const TObject** o1, const TObject** o2)
|
||||
{
|
||||
const TToken_string* s1 = (const TToken_string *)(*o1);
|
||||
const TToken_string* s2 = (const TToken_string *)(*o2);
|
||||
|
||||
|
||||
const TRectype& r1 = cache().get(LF_RDIST,*s1);
|
||||
const TRectype& r2 = cache().get(LF_RDIST,*s2);
|
||||
@ -843,8 +867,13 @@ static int compare_rdist_key(const TObject** o1, const TObject** o2)
|
||||
return sk1 == sk2 ? 0 : (sk1 > sk2 ? +1 : -1);
|
||||
}
|
||||
|
||||
const TRectype& TDistinta_tree::find_head(const TCodice_articolo& art) const
|
||||
{
|
||||
const TRectype& rec = cache().get(LF_DIST, art);
|
||||
return rec;
|
||||
}
|
||||
|
||||
const TRectype* TDistinta_tree::find(const TCodice_articolo& father, int child) const
|
||||
const TRectype* TDistinta_tree::find_child(const TCodice_articolo& father, int child) const
|
||||
{
|
||||
TString80 key = father;
|
||||
key << '|' << child;
|
||||
@ -857,7 +886,7 @@ int TDistinta_tree::build_children_pointers(const TCodice_articolo& father, TPoi
|
||||
{
|
||||
for (int nrig = 1; ; nrig++)
|
||||
{
|
||||
const TRectype* rec = find(father, nrig);
|
||||
const TRectype* rec = find_child(father, nrig);
|
||||
if (rec == NULL)
|
||||
break;
|
||||
children.add((TRectype*)rec);
|
||||
@ -871,12 +900,13 @@ int TDistinta_tree::build_children_pointers(const TCodice_articolo& father, TPoi
|
||||
return total;
|
||||
}
|
||||
|
||||
/*
|
||||
int TDistinta_tree::build_children_list(const TCodice_articolo& father, TArray& children) const
|
||||
{
|
||||
TToken_string key;
|
||||
for (int nrig = 1; ; nrig++)
|
||||
{
|
||||
const TRectype* rec = find(father, nrig);
|
||||
const TRectype* rec = find_child(father, nrig);
|
||||
if (rec == NULL)
|
||||
break;
|
||||
key.add(father,0);
|
||||
@ -891,6 +921,7 @@ int TDistinta_tree::build_children_list(const TCodice_articolo& father, TArray&
|
||||
}
|
||||
return total;
|
||||
}
|
||||
*/
|
||||
|
||||
bool TDistinta_tree::has_son() const
|
||||
{
|
||||
@ -905,9 +936,10 @@ bool TDistinta_tree::has_son() const
|
||||
return FALSE;
|
||||
|
||||
TCodice_articolo key; curr_code(key);
|
||||
_curr = find(key, 1);
|
||||
TString16 livgiac; curr_giaclev(livgiac);
|
||||
_curr = find_child(key, 1);
|
||||
// Se ci sono almeno due figli ed e' necessario ordinare
|
||||
if (_sort > 0 && find(key, 2) != NULL)
|
||||
if ((_sort > 0) && find_child(key, 2) != NULL)
|
||||
{
|
||||
TPointer_array children;
|
||||
const int total = build_children_pointers(key, children);
|
||||
@ -916,35 +948,59 @@ bool TDistinta_tree::has_son() const
|
||||
return _curr != NULL;
|
||||
}
|
||||
|
||||
|
||||
void TDistinta_tree::add_child()
|
||||
{
|
||||
TCodice_articolo comp = _curr->get("CODCOMP");
|
||||
TString tmp,tmp2;
|
||||
if (_curr->get_char("TIPO") == 'V') // Espando la variabile
|
||||
{
|
||||
TString cod = get_string(comp);
|
||||
if (cod.blank() || cod.len() > comp.size())
|
||||
cod = "???";
|
||||
comp = cod;
|
||||
tmp = get_string(comp);
|
||||
if (tmp.blank() || tmp.len() > comp.size())
|
||||
tmp = "???";
|
||||
comp = tmp;
|
||||
}
|
||||
_path.add(comp); // 0 - Codice articolo
|
||||
|
||||
_path << TREE_SEPARATOR << _curr->get("LIVELLO");// Livello giacenza
|
||||
_path << TREE_SEPARATOR;
|
||||
tmp = _curr->get("LIVELLO");
|
||||
if (livgiac().enabled())
|
||||
{
|
||||
TString fgiaclev; father_giaclev(fgiaclev);
|
||||
//const bool ghost = find_head(comp).get_bool("VIRTUALE") && !find_head(comp).get_bool("ARTPROD");
|
||||
/*if (//ghost || // eredita sempre con i ghost
|
||||
_curr->get("TIPO_LIV")[0]!=' ' ||
|
||||
_curr->get("TIPO_LIV")[1]!=' ' ||
|
||||
_curr->get("TIPO_LIV")[2]!=' ' ||
|
||||
_curr->get("TIPO_LIV")[3]!=' ' )*/
|
||||
{
|
||||
// ereditarieta'
|
||||
for (int l= 0 ; l < 4; l++) if (livgiac().enabled(l+1))
|
||||
{
|
||||
tmp2 = livgiac().unpack_grpcode(tmp, l+1);
|
||||
if (_curr->get("TIPO_LIV")[l]=='E' /*|| ghost && tmp2.empty() */)
|
||||
{
|
||||
tmp2 = livgiac().unpack_grpcode(fgiaclev, l+1);
|
||||
livgiac().pack_grpcode(tmp, tmp2 , l+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_path << tmp; // 1 Livello giacenza
|
||||
long num = _curr->get_long("NRIG");
|
||||
_path << TREE_SEPARATOR << num; // Numero componente
|
||||
_path << TREE_SEPARATOR << num; // 2 Numero componente
|
||||
if (_sort > 0)
|
||||
{
|
||||
TString16 field; field << "SORT" << _sort;
|
||||
num = _curr->get_long(field);
|
||||
}
|
||||
_path << TREE_SEPARATOR << num; // Numero ordinamento
|
||||
_path << TREE_SEPARATOR << num; // 3 Numero ordinamento
|
||||
|
||||
_path << TREE_SEPARATOR << _curr->get("UM"); // Unita' di misura
|
||||
_path << TREE_SEPARATOR << _curr->get("UM"); // 4 Unita' di misura
|
||||
|
||||
const TString& expr = _curr->get("EXPR");
|
||||
const real qta = evaluate_numexpr(expr);
|
||||
_path << TREE_SEPARATOR << qta; // Quantita'
|
||||
_path << TREE_SEPARATOR << qta; // 5 Quantita'
|
||||
_path << TREE_SEPARATOR << get_type(comp); // 6 - Articolo, Lavorazione, Virtuale, Ghost
|
||||
|
||||
push_vars();
|
||||
@ -977,6 +1033,7 @@ bool TDistinta_tree::has_rbrother() const
|
||||
TString80 key; _path.get(last-1, key);
|
||||
isola_codice(key);
|
||||
const TCodice_articolo father(key);
|
||||
const TString16 livgiac;
|
||||
curr_comp(key);
|
||||
|
||||
if (_sort > 0)
|
||||
@ -1002,7 +1059,7 @@ bool TDistinta_tree::has_rbrother() const
|
||||
else
|
||||
{
|
||||
const int brother = atoi(key) + 1;
|
||||
_curr = find(father, brother);
|
||||
_curr = find_child(father, brother);
|
||||
}
|
||||
|
||||
return _curr != NULL;
|
||||
@ -1028,6 +1085,7 @@ bool TDistinta_tree::has_lbrother() const
|
||||
TString80 key; _path.get(last-1, key);
|
||||
isola_codice(key);
|
||||
const TCodice_articolo father(key);
|
||||
const TString16 livgiac;
|
||||
curr_comp(key);
|
||||
|
||||
if (_sort > 0)
|
||||
@ -1054,7 +1112,7 @@ bool TDistinta_tree::has_lbrother() const
|
||||
{
|
||||
const int brother = atoi(key) - 1;
|
||||
if (brother > 0)
|
||||
_curr = find(father, brother);
|
||||
_curr = find_child(father, brother);
|
||||
else
|
||||
_curr = NULL;
|
||||
}
|
||||
@ -1096,7 +1154,7 @@ bool TDistinta_tree::is_root() const
|
||||
bool TDistinta_tree::is_leaf() const
|
||||
{
|
||||
TCodice_articolo key; curr_code(key);
|
||||
const TRectype* first_son = find(key, 1);
|
||||
const TRectype* first_son = find_child(key, 1);
|
||||
return first_son == NULL;
|
||||
}
|
||||
|
||||
@ -1105,7 +1163,8 @@ bool TDistinta_tree::is_mag(const char* c) const
|
||||
TCodice_articolo code = c;
|
||||
if (code.blank())
|
||||
curr_code(code);
|
||||
const TString& desc = ((TDistinta_tree*)this)->_mag.decode(code);
|
||||
// const TString& desc = ((TDistinta_tree*)this)->_mag.decode(code);
|
||||
const TString& desc = cache().get(LF_ANAMAG, code, ANAMAG_DESCR);
|
||||
return desc.not_empty();
|
||||
}
|
||||
|
||||
@ -1114,7 +1173,8 @@ bool TDistinta_tree::is_lav(const char* c) const
|
||||
TCodice_articolo code = c;
|
||||
if (code.blank())
|
||||
curr_code(code);
|
||||
const TString& desc = ((TDistinta_tree*)this)->_lav.decode(code);
|
||||
// const TString& desc = ((TDistinta_tree*)this)->_lav.decode(code);
|
||||
const TString& desc = cache().get("LAV", code, "S0");
|
||||
return desc.not_empty();
|
||||
}
|
||||
|
||||
@ -1131,9 +1191,9 @@ char TDistinta_tree::get_type(const char* c) const
|
||||
type = 'L'; // Lavorazione
|
||||
else
|
||||
{
|
||||
if (find(c, 1)) // E' una distinta
|
||||
if (find_child(c, 1)) // E' una distinta
|
||||
{
|
||||
const TString& artprod = cache().get(LF_DIST, c, "ARTPROD");
|
||||
const TString& artprod = find_head(c).get("ARTPROD");
|
||||
if (artprod.blank())
|
||||
type = 'G'; // Distinta fantasma
|
||||
else
|
||||
@ -1154,7 +1214,8 @@ void TDistinta_tree::set_sort_key(int k)
|
||||
|
||||
TTypeexp TDistinta_tree::get_var_type(const char* var)
|
||||
{
|
||||
const TString& vt = _vars.decode(var);
|
||||
// const TString& vt = _vars.decode(var);
|
||||
const TString& vt = cache().get("VAR", var, "B0");
|
||||
return vt.blank() ? _strexpr : _numexpr;
|
||||
}
|
||||
|
||||
@ -1163,6 +1224,17 @@ void TDistinta_tree::pop_vars()
|
||||
_stack.pop();
|
||||
}
|
||||
|
||||
bool TDistinta_tree::is_global(const char* var)
|
||||
{
|
||||
const char * gvars[] = {"_IMPIANTO","_LINEA","_MAGAZZINO","_DISTINTA",
|
||||
"_RADICE", "_LIVELLO","_LIV1","_LIV2","_LIV3",
|
||||
"_LIV4",NULL};
|
||||
const char ** gvar=gvars;
|
||||
for (; *gvar; gvar++)
|
||||
if (strcmp(*gvar, var)==0)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
void TDistinta_tree::clear_globals()
|
||||
{
|
||||
_globals.destroy();
|
||||
@ -1195,7 +1267,7 @@ TObject * TDistinta_tree::get_global(const char* name, word classname)
|
||||
if (!val || ((real *)val)->is_zero())
|
||||
val = global_default_real(name);
|
||||
}
|
||||
return val;
|
||||
return val;
|
||||
}
|
||||
|
||||
TObject * TDistinta_tree::global_default_str(const char* name)
|
||||
@ -1272,8 +1344,26 @@ const TString& TDistinta_tree::get_string(const char* var)
|
||||
curr_code(_varvalue);
|
||||
return _varvalue;
|
||||
}
|
||||
if (strcmp(var, "_RADICE")==0)
|
||||
{
|
||||
static TString80 _codice;
|
||||
_codice = _root;
|
||||
isola_codice(_codice);
|
||||
return _codice;
|
||||
}
|
||||
if (strncmp(var, "_LIV",4)==0)
|
||||
{
|
||||
switch (var[4]) {
|
||||
case 'E': curr_giaclev(_varvalue); break;
|
||||
case '1': curr_giaclev(_varvalue,1);break;
|
||||
case '2': curr_giaclev(_varvalue,2);break;
|
||||
case '3': curr_giaclev(_varvalue,3);break;
|
||||
case '4': curr_giaclev(_varvalue,4);break;
|
||||
}
|
||||
return _varvalue;
|
||||
}
|
||||
TObject* val = get_global(var, CLASS_STRING);
|
||||
if (val)
|
||||
if (val)
|
||||
return (const TString&)*val;
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
@ -1347,7 +1437,7 @@ void TDistinta_tree::push_vars()
|
||||
vars->add("_GHOST", real(1.0));
|
||||
|
||||
TCodice_articolo art; curr_code(art);
|
||||
const TString& memo_field = cache().get(LF_DIST, art, "PARAMETRI");
|
||||
const TString& memo_field = find_head(art).get("PARAMETRI");
|
||||
if (!memo_field.blank())
|
||||
{
|
||||
TString var, expr;
|
||||
@ -1497,15 +1587,24 @@ int TDistinta_tree::explode(TArray& boom,
|
||||
return boom.items();
|
||||
}
|
||||
|
||||
TCodgiac_livelli &TDistinta_tree::livgiac() const
|
||||
{
|
||||
if (_livgiac==NULL)
|
||||
((TDistinta_tree *)this)->_livgiac = new TCodgiac_livelli();
|
||||
return *_livgiac;
|
||||
}
|
||||
TDistinta_tree::TDistinta_tree()
|
||||
: _sort(0), _max_depth(0), _ignore_ghost(FALSE),
|
||||
_vars("VAR", "B0"), _mag(LF_ANAMAG, "DESCR"),
|
||||
_lav("LAV")
|
||||
// _vars("VAR", "B0"), _mag(LF_ANAMAG, "DESCR"), _lav("LAV"),
|
||||
_livgiac(NULL),_qta_on_descr(FALSE),_descr_sep('-')
|
||||
{
|
||||
memset(_livgiac_on_descr, 0, sizeof(_livgiac_on_descr));
|
||||
}
|
||||
|
||||
TDistinta_tree::~TDistinta_tree()
|
||||
{
|
||||
if (_livgiac)
|
||||
delete _livgiac;
|
||||
}
|
||||
|
||||
|
||||
@ -1571,7 +1670,7 @@ void TRiga_esplosione::init(const TDistinta_tree& tree)
|
||||
TCodice_um um; tree.curr_um(um);
|
||||
real val = tree.curr_qta();
|
||||
set(art, um, val);
|
||||
tree.curr_giac(_giac);
|
||||
tree.curr_giaclev(_giac);
|
||||
_tipo = tree.curr_type();
|
||||
_sort = tree.curr_sort();
|
||||
_mat_base = FALSE;
|
||||
|
51
db/dblib.h
51
db/dblib.h
@ -13,6 +13,11 @@
|
||||
#include <tree.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MGLIB_H
|
||||
#include "..\mg\mglib.h"
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCodice_articolo
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -81,11 +86,12 @@ public:
|
||||
|
||||
class TLavorazione : public TRectype
|
||||
{
|
||||
|
||||
TString16 _codimp ;
|
||||
TToken_string _linee ;
|
||||
|
||||
protected:
|
||||
TObject* dup() const { return new TLavorazione(*this); }
|
||||
|
||||
public:
|
||||
const char * codice() const {return get("CODTAB");}
|
||||
const char * descr() const {return get("S0");}
|
||||
@ -142,10 +148,6 @@ class TQuantita : public TSortable
|
||||
real _conv; // Fattore di conversione alla base
|
||||
real _val; // Valore attuale
|
||||
|
||||
static TDecoder* _umart1; // Decoder per trovare unita' base articolo
|
||||
static TDecoder* _umart2; // Decoder per trovare conversione
|
||||
static TDecoder* _umdist; // Decoder per trovare unita' base distinta
|
||||
|
||||
protected:
|
||||
virtual int compare(const TSortable& s) const;
|
||||
virtual TObject* dup() const { return new TQuantita(*this); }
|
||||
@ -234,8 +236,12 @@ class TDistinta_tree : public TBidirectional_tree
|
||||
TToken_string _path;
|
||||
int _sort, _max_depth;
|
||||
bool _ignore_ghost;
|
||||
bool _livgiac_on_descr[4];
|
||||
bool _qta_on_descr;
|
||||
char _descr_sep;
|
||||
|
||||
TDecoder _vars, _mag, _lav;
|
||||
// TDecoder _vars, _mag, _lav;
|
||||
TCodgiac_livelli *_livgiac;
|
||||
|
||||
static const TRectype* _curr;
|
||||
static TToken_string _tmp;
|
||||
@ -243,14 +249,20 @@ class TDistinta_tree : public TBidirectional_tree
|
||||
TStack _stack;
|
||||
TAssoc_array _globals;
|
||||
|
||||
private:
|
||||
TCodgiac_livelli &livgiac() const;
|
||||
|
||||
protected:
|
||||
bool isola_codice(TString& code) const;
|
||||
|
||||
void add_child();
|
||||
void kill_child();
|
||||
const TRectype* find(const TCodice_articolo& father, int child) const;
|
||||
|
||||
virtual const TRectype& find_head(const TCodice_articolo& art) const;
|
||||
virtual const TRectype* find_child(const TCodice_articolo& father, int child) const;
|
||||
|
||||
int build_children_pointers(const TCodice_articolo& father, TPointer_array& children) const;
|
||||
int build_children_list(const TCodice_articolo& father, TArray& children) const;
|
||||
// int build_children_list(const TCodice_articolo& father, TArray& children) const;
|
||||
|
||||
TTypeexp get_var_type(const char* var);
|
||||
const TString& get_string(const char* var);
|
||||
@ -270,6 +282,10 @@ protected: // TTree
|
||||
TObject * get_global(const char* name, word classname);
|
||||
TObject * global_default_str(const char* name);
|
||||
TObject * global_default_real(const char* name);
|
||||
|
||||
const TString& describe(const TCodice_articolo& codart) const;
|
||||
bool describe(const TCodice_articolo& codart, TString& descr) const;
|
||||
|
||||
public:
|
||||
static TLavorazione * find_labor(TRiga_esplosione *l);
|
||||
virtual bool goto_root();
|
||||
@ -287,19 +303,25 @@ public:
|
||||
virtual TImage* image(bool selected) const;
|
||||
virtual TObject* curr_node() const;
|
||||
|
||||
bool set_root(const TQuantita& qta);
|
||||
bool set_root(const TCodice_articolo& art, const char* um = "", real qta = 1.0);
|
||||
bool set_root(const TQuantita& qta, const char * livgiac ="");
|
||||
bool set_root(const TCodice_articolo& art, const char* um = "", real qta = 1.0, const char*livgiac="");
|
||||
bool set_root(const TRectype & rec);
|
||||
|
||||
long find_node(const TCodice_articolo& str, word flags = SCAN_PRE_ORDER);
|
||||
|
||||
void set_sort_key(int k);
|
||||
int get_sort_key() const { return _sort; }
|
||||
bool get_ignore_ghost() { return _ignore_ghost; }
|
||||
bool get_ignore_ghost() const { return _ignore_ghost; }
|
||||
bool get_livgiac_on_descr(int l) const ;
|
||||
bool get_qta_on_descr() const {return _qta_on_descr;}
|
||||
char get_descr_separator() const {return _descr_sep;}
|
||||
|
||||
void set_max_depth(int m) { _max_depth = m; }
|
||||
int get_max_depth() const { return _max_depth; }
|
||||
bool set_ignore_ghost(bool i) { return _ignore_ghost = i; }
|
||||
bool set_livgiac_on_descr(int l, bool on) ;
|
||||
bool set_qta_on_descr(bool on) {return _qta_on_descr=on;}
|
||||
char set_descr_separator(char on) {return _descr_sep=on;}
|
||||
|
||||
void restart(); // reset all and go to root
|
||||
int explode(TArray& boom, bool mat_base = FALSE,
|
||||
@ -307,12 +329,15 @@ public:
|
||||
int max_depth = 0, const char* filter = NULL,
|
||||
int sort_key = 0);
|
||||
|
||||
bool father_code(TCodice_articolo& code) const;
|
||||
bool father_giaclev(TString& code, int levnum=0) const;
|
||||
bool curr_code(TCodice_articolo& code) const;
|
||||
bool curr_giac(TString& code) const;
|
||||
bool curr_giaclev(TString& code, int levnum=0) const;
|
||||
int curr_comp(TString& code) const;
|
||||
long curr_sort() const;
|
||||
const char* curr_um(TCodice_um& code) const;
|
||||
real curr_qta() const;
|
||||
real last_qta() const;
|
||||
int curr_depth() const;
|
||||
char curr_type() const;
|
||||
|
||||
@ -329,8 +354,8 @@ public:
|
||||
bool is_mag(const char* c = NULL) const;
|
||||
bool is_lav(const char* c = NULL) const;
|
||||
char get_type(const char* c = NULL) const;
|
||||
const TString& describe(const TCodice_articolo& codart) const;
|
||||
|
||||
bool is_global(const char* var);
|
||||
void clear_globals();
|
||||
void set_global(const char* var, const char* val);
|
||||
void set_global(const char* var, const real& val);
|
||||
|
@ -1,3 +1,3 @@
|
||||
112
|
||||
0
|
||||
$dist|0|0|132|0|Distinte|||
|
||||
$dist|0|0|133|0|Distinte|||
|
||||
|
@ -1,5 +1,5 @@
|
||||
112
|
||||
12
|
||||
13
|
||||
CODDIST|1|20|0|Codice distinta
|
||||
VIRTUALE|8|1|0|Distinta virtuale (non e' un articolo)
|
||||
ARTPROD|8|1|0|Articolo di produzione
|
||||
@ -11,6 +11,7 @@ UM|1|3|0|Unita' di misura
|
||||
PREZZO|4|18|2|Costo di produzione
|
||||
LEADTIME|6|4|0|Lead time espresso in giorni lavorativi per MRP
|
||||
LEADHOURS|3|5|0|Lead time espresso in ore lavorative per MRP
|
||||
MASTER|8|1|0|Flag di articolo master ("critico")
|
||||
PARAMETRI|11|10|0|Elenco delle variabili
|
||||
1
|
||||
CODDIST|
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user