Patch level : main 102

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Riportata la versione 1.7 aga patch 102 sul main trunk


git-svn-id: svn://10.65.10.50/trunk@9769 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2001-06-25 10:41:20 +00:00
parent 500f43af19
commit d5861b30c0
123 changed files with 6325 additions and 6782 deletions

View File

@ -1,229 +1,447 @@
#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);
}
#include <windows.h>
#include <shellapi.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
extern "C"
{
#include "../include/hlapi_c.h"
#include "../include/skeytsr.h"
}
typedef unsigned char bool;
/*
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);
}
*/
void ErrorBox(LPCSTR str)
{
MessageBox(GetFocus(), str, "Installazione", MB_ICONSTOP|MB_OK);
}
void WarningBox(LPCSTR str)
{
MessageBox(GetFocus(), str, "Installazione", MB_ICONEXCLAMATION|MB_OK);
}
/****************************/
/* Gestione chiave Hardlock */
/****************************/
bool HardlockGarble(unsigned int* data)
{
HL_CODE(EYECAST data, 1);
return TRUE;
}
unsigned int HardlockLogin(int& year)
{
unsigned int serno = 0xFFFF;
char REFKEY[16] = "CAMPOKEY";
char VERKEY[16] = "ìpÙˆ¬cê<";
if (HL_LOGIN(26952, LOCAL_DEVICE, REFKEY, VERKEY) == STATUS_OK)
{
unsigned int eprom[64]; memset(eprom, 0, sizeof(eprom));
HL_READBL(EYECAST eprom);
unsigned int data[4];
memcpy(data, eprom, sizeof(data));
HardlockGarble(data);
if (data[0] == 0xFAE8)
serno = data[1];
else
serno = 0;
memcpy(data, &eprom[60], sizeof(data));
if (HardlockGarble(data));
year = (int)data[0];
}
return serno;
}
/**************************/
/* Gestione chiave Eutron */
/**************************/
void EncodeEutronPassword(char* str)
{
const char* const key = "QSECOFR-";
char tmp[16];
for (int i = 0; str[i]; i++)
tmp[i] = str[i] + (i < 8 ? key[i] : str[i - 8]);
tmp[i] = '\0';
strcpy(str, tmp);
}
/*
bool EutronGarble(KEY_NET& eutron_key, unsigned int* data)
{
eutron_key.net_command = NET_KEY_ACCESS;
eutron_key.command = SCRAMBLING_MODE;
memcpy(eutron_key.data, data, 8);
smartlink(&eutron_key);
return eutron_key.status == ST_OK;
}
*/
unsigned int EutronLogin(int& year)
{
unsigned int serno = 0xFFFF;
KEY_NET eutron_key;
memset(&eutron_key, 0, sizeof(KEY_NET));
eutron_key.net_command = NET_KEY_OPEN;
eutron_key.command = LOCATING_MODE;
const char* chiaro = "AGA.CAMPO";
char cifrato[16];
strcpy(cifrato, chiaro);
EncodeEutronPassword(cifrato);
memset(eutron_key.label, 0, LABEL_LENGTH);
strcpy((char*)eutron_key.label, chiaro);
memset(eutron_key.password, 0, PASSWORD_LENGTH);
strcpy((char*)eutron_key.password, cifrato);
smartlink(&eutron_key);
if (eutron_key.status == ST_OK)
{
eutron_key.net_command = NET_KEY_ACCESS;
memcpy(&eutron_key.command, BLOCK_READING_MODE, 2);
int* pointer = (int*)(&eutron_key.data[0]);
int* number = (int*)(&eutron_key.data[2]);
*pointer = 0; // Posizione in cui leggere
*number = 8; // Words da leggere
smartlink(&eutron_key);
if (eutron_key.status == ST_OK)
{
serno = (unsigned int)atol((const char*)eutron_key.data+4);
const int y = *(int*)(eutron_key.data+12);
if (y > 2000 && y < 3000)
year = y;
}
}
return serno;
}
/***********************************/
/* Gestione cifratura lista codici */
/***********************************/
static char key[16] = "";
void BuildKey()
{
for (int i = 0; i < 8; i++)
key[i] = 'A'+ rand()%26;
}
void DecodeString(char* data)
{
char __tmp_string[256];
BuildKey();
for (int i = 0; data[i]; i++)
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
__tmp_string[i] = '\0';
strcpy(data, __tmp_string);
}
int ThisYear()
{
int anno = 2001;
time_t lt;
if (time(&lt) == 0)
{
struct tm* timeloc = localtime(&lt) ;
if (timeloc != NULL)
anno = timeloc->tm_year + 1900;
}
return anno;
}
int VersionYear()
{
char ver[32];
GetPrivateProfileString("ba", "Versione", "", ver, sizeof(ver), "./eurocamp/zip/install.ini");
ver[4] = '\0';
return atoi(ver);
}
bool DongleTest()
{
int yearKey = 0;
unsigned int serno = HardlockLogin(yearKey);
if (serno == 0xFFFF)
serno = EutronLogin(yearKey);
if (serno == 0 || serno == 0xFFFF)
return TRUE; // Chiave inesistente o invisibile = Prima installazione
const int verYear = VersionYear();
if (yearKey >= verYear) // Chiave già programmata con assistenza pagata
return TRUE;
bool ok = FALSE;
ifstream keys("./eurocamp/zip/dninst.zip", ios::in | ios::nocreate);
if (keys.good())
{
char line[256];
keys.getline(line, sizeof(line));
srand(883);
DecodeString(line);
const int ass_year = atoi(line);
srand(ass_year);
while (!keys.eof())
{
keys.getline(line, sizeof(line));
DecodeString(line);
unsigned int sn = (unsigned int)atol(line);
if (sn == serno || line[0] == '*')
{
ok = TRUE;
break;
}
}
if (ok)
{
wsprintf(line, "Il contratto di manutenzione %d verrà attivato automaticamente", ass_year);
WarningBox(line);
}
else
{
wsprintf(line, "È necessario contattare l'assistenza tecnica A.G.A.\n"
"per l'abilitazione del contratto di manutenzione %d", ass_year);
WarningBox(line);
}
}
else
{
ErrorBox("Impossibile verificare il contratto di manutenzione");
}
return ok;
}
HINSTANCE Run(LPCSTR app)
{
HINSTANCE ret = WinExec(app, SW_SHOWNORMAL);
if (ret <= 32)
{
char s[128];
wsprintf(s,"Impossibile eseguire\n%s\nErrore %d", app, (int)ret);
ErrorBox(s);
}
return ret;
}
/*
* 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 = "Termina installazione";
const char* s5 = "Scelta installazione";
HDC hdc = BeginPaint(hwnd, &ps);
GetWindowRect(GetDesktopWindow(),&rct);
SetBkMode(hdc, TRANSPARENT);
const int offx=(rct.right - rct.left-640)/2;
const int offy=(rct.bottom - rct.top-260)/2;
rct.left = offx+300;
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);
rct.top += 80; rct.bottom += 80;
DrawText(hdc, s4, strlen(s4), &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, s5, strlen(s5));
SetTextColor(hdc, RGB(255,255,255));
TextOut(hdc, 16, 16, s5, strlen(s5));
SelectObject(hdc, hfontOld);
DeleteObject(hfont);
EndPaint(hwnd, &ps);
}
break;
case WM_COMMAND:
{
if (wParam == 1000)
{
if (DongleTest())
Run("eurocamp\\disk1\\setup.exe");
}
else if (wParam == 1001)
{
Run("eurodemo\\disk1\\setup.exe");
}
else if (wParam == 1002)
{
Run("ce\\setup.exe");
}
else if (wParam != 2)
return 0;
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;
RECT rect;
GetWindowRect(GetDesktopWindow(),&rect);
HWND hwndDlg=CreateWindow("MainWndClass","Scelta installazione",WS_VISIBLE| WS_CAPTION | WS_SYSMENU | WS_MAXIMIZE,
rect.left,rect.top,rect.right,rect.bottom,NULL,NULL,hInst,NULL );
const int offx=(rect.right - rect.left-640)/2;
const int offy=(rect.bottom - rect.top-260)/2;
/* Disegna i pulsanti */
CreateWindow("BUTTON","Installazione EUROCAMPO",
WS_CHILD| WS_VISIBLE ,offx ,offy,256,32, hwndDlg ,1000,hInst,NULL );
CreateWindow("BUTTON","Installazione EUROCAMPO Demo",
WS_CHILD| WS_VISIBLE ,offx ,offy+80,256,32, hwndDlg ,1001,hInst,NULL );
CreateWindow("BUTTON","Installazione Cespiti",
WS_CHILD| WS_VISIBLE,offx ,offy+160,256,32, hwndDlg ,1002,hInst,NULL );
CreateWindow("BUTTON","Uscita",
WS_CHILD| WS_VISIBLE,offx,offy+240,256,32, hwndDlg ,2,hInst,NULL );
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

View File

@ -1174,6 +1174,7 @@ protected: // TApplication
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual long handler(WINDOW win, EVENT* ep);
virtual bool test_assistance_year() const;
protected:
bool main_loop();
@ -1216,6 +1217,11 @@ bool TMenu_application::_find_button = FALSE;
inline TMenu_application& app()
{ return (TMenu_application&)main_app(); }
bool TMenu_application::test_assistance_year() const
{
return TRUE;
}
bool TMenu_application::menu_item_handler(TMask_field&f, KEY k)
{
if (k == K_SPACE)
@ -1642,7 +1648,13 @@ bool TMenu_application::create()
if (!check_user())
return FALSE;
if (!TApplication::test_assistance_year())
{
TExternal_app app("ba1 -4");
app.run();
}
set_perms();
test_temp();

View File

@ -262,8 +262,10 @@ class TAttivazione_moduli : public TSkeleton_application
protected:
virtual bool create() ;
virtual bool destroy() ;
// virtual bool use_files() const { return FALSE; }
virtual void main_loop();
virtual bool use_files() const { return FALSE; }
virtual bool menu(MENU_TAG);
virtual bool test_assistance_year() const;
void garble(word k[4]) const;
void garble(word n, TString& str) const;
@ -279,7 +281,6 @@ protected:
int build_sheet(bool on = TRUE);
void build_key_column();
bool burn_dongle();
static void keyext(const TString & s, word * v);
@ -700,7 +701,7 @@ bool TAttivazione_moduli::assist_handler(TMask_field& fld, KEY key)
if (key == K_TAB && fld.focusdirty())
{
const int year = atoi(fld.get());
if (year > 1997 && year <= 2997)
if (year >= 1997 && year <= 2997)
{
TString16 str;
app().garble_year(year, str);
@ -733,11 +734,11 @@ bool TAttivazione_moduli::change_assist_handler(TMask_field& fld, KEY key)
if (m.run() == K_ENTER)
{
const word year = m.get_int(101);
word year = m.get_int(101);
if (dongle.type() == _user_dongle)
{
if (year >= dongle.year_assist() && year <= 2997)
{
if (year >= 1997 && year <= 2997)
{
if (m.field(102).empty())
{
app()._wanted_assist = year;
@ -749,8 +750,11 @@ bool TAttivazione_moduli::change_assist_handler(TMask_field& fld, KEY key)
{
TString16 str;
app().garble_year(year, str);
if (str == m.get(102))
bool ok = str == m.get(102);
if (ok)
{
if (year <= 1997)
year = 0;
dongle.set_year_assist(year);
fld.mask().set(F_ASSIST, year);
}
@ -1251,6 +1255,7 @@ void TAttivazione_moduli::print_answer()
printer().open();
form.update_serno(_msk->get(F_SN));
form.update_dongle(::dongle());
form.update_os();
}
str.format("%3d", ++found);
@ -1403,11 +1408,25 @@ void TAttivazione_moduli::print()
print_answer();
}
// Questo programma non deve bloccarsi per l'anno di assistenza!
bool TAttivazione_moduli::test_assistance_year() const
{
return TRUE;
}
bool TAttivazione_moduli::create()
{
bool ok = ::dongle().login(TRUE);
if (!ok)
return FALSE;
ok = TApplication::test_assistance_year();
if (!ok)
{
ok = update_assistance_year();
if (ok)
return FALSE;
}
_im = new TInformazione_moduli;

View File

@ -33,4 +33,6 @@ public:
virtual ~TInformazione_moduli() {};
};
bool update_assistance_year();
#endif

181
ba/ba1501.cpp Executable file
View File

@ -0,0 +1,181 @@
#include <applicat.h>
#include <config.h>
#include <dongle.h>
#include <os_dep.h>
#include <scanner.h>
#include <utility.h>
#include "ba1500.h"
HIDDEN void build_key(char* dninst_key)
{
for (int i = 0; i < 8; i++)
dninst_key[i] = 'A'+ rand() % 26;
}
HIDDEN void decode_string(char* dninst_key, char* data)
{
build_key(dninst_key);
for (int i = 0; data[i]; i++)
__tmp_string[i] = data[i] - (i < 8 ? dninst_key[i] : __tmp_string[i - 8]);
__tmp_string[i] = '\0';
strcpy(data, __tmp_string);
}
#ifdef DBG
HIDDEN void encode_string(char* dninst_key, char* data)
{
build_key(dninst_key);
for (int i = 0; data[i]; i++)
__tmp_string[i] = data[i] + (i < 8 ? dninst_key[i] : data[i - 8]);
__tmp_string[i] = '\0';
strcpy(data, __tmp_string);
}
HIDDEN bool build_dninst(const TFilename& name)
{
TFilename src = name; src.ext("txt");
ifstream inf(src, ios::in | ios::nocreate);
if (inf.good())
{
char dninst_key[8] = "";
ofstream ouf(name, ios::out | ios::binary);
char line[256];
int year = 0;
while (!inf.eof())
{
inf.getline(line, sizeof(line));
if (year == 0)
{
srand(883);
year = atoi(line);
CHECKD(year >= 1997 && year <= 2997, "Anno errato:", year);
}
encode_string(dninst_key, line);
ouf << line << '\n';
if (year > 0)
{
srand(year);
year = -1;
}
}
return TRUE;
}
return FALSE;
}
#endif
HIDDEN bool show_error(const char* str)
{
int app_year, dum1, dum2, dum3;
TApplication::get_version_info(app_year, dum1, dum2, dum3);
TString msg;
msg << "Impossibile aggiornare automaticamente l'assistenza "
<< app_year << ":\n" << str << '.';
return error_box(msg);
}
HIDDEN int module2number(const TString& mod)
{
static TAssoc_array* ass = NULL;
if (ass == NULL)
{
TString8 num;
TScanner scanner("prassi.aut");
ass = new TAssoc_array;
for (int aut = 0; scanner.line() != ""; aut++)
{
num.format("%d", aut);
const char* cod = scanner.token().left(2);
ass->add(cod, num);
}
}
int n = 0;
if (mod.len() == 2)
{
const TString* num = (const TString*)ass->objptr(mod);
if (num)
n = atoi(*num);
}
return n;
}
bool update_assistance_year()
{
const TFilename keys_name = "dninst.zip";
TFilename remote_name;
if (remote_name.empty()) // Dummy test
{
TConfig ini("install.ini", "Main");
remote_name = ini.get("DiskPath");
if (os_is_removable_drive(remote_name))
message_box("Assicuratevi che il CD di installazione sia nel lettore %c:", remote_name[0]);
remote_name.add(keys_name);
if (remote_name.exist())
fcopy(remote_name, keys_name);
#ifdef DBG
else
build_dninst(remote_name);
#endif
}
TScanner keys(keys_name);
bool ok = FALSE;
if (keys.ok())
{
const int serno = get_serial_number();
int sn = 0;
char dninst_key[8] = "";
TString& anno = keys.line();
srand(883);
decode_string(dninst_key, anno.get_buffer());
const int ass_year = atoi(anno);
srand(ass_year);
while (!keys.eof())
{
TString& line = keys.line();
if (line.empty())
break;
decode_string(dninst_key, line.get_buffer());
sn = atoi(line);
if (sn == serno || line[0] == '*')
{
/*
TToken_string moduli(line, ';');
TString8 mod;
FOR_EACH_TOKEN(moduli, tok)
{
mod = tok;
const int nmod = module2number(mod);
if (nmod > 0)
dongle().deactivate(nmod);
}
*/
dongle().set_year_assist(ass_year);
if (dongle().burn())
{
message_box("Il contratto %d è stato attivato automaticamente", ass_year);
return TRUE;
}
else
{
show_error("errore di scrittura sulla chiave di protezione");
return FALSE;
}
}
}
show_error("il numero di serie di questa postazione non è presente sul database");
}
else
show_error("il database dei numeri di serie non è accessibile");
return FALSE;
}

View File

@ -206,10 +206,11 @@ int TInstaller_mask::precheck_modules(bool only_newer)
&& 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) != 'X' || release == row(r).get(C_CURRRELEASE) ;
const bool chk = row(r).get_char(C_ISPATCH) != 'X' || release == row(r).get(C_CURRRELEASE);
check(r,chk );
}
}
force_update(); // Indispensabile per vedere le righe aggiornate
return tot;
}
@ -337,7 +338,7 @@ bool TInstaller_mask::autoload()
TString_array modules;
if (fexist(ininame))
if (ininame.exist())
{
// Presente il file ini generale "install.ini"
TInstall_ini ini(ininame);
@ -421,30 +422,27 @@ bool TInstaller_mask::autoload()
const TString16 module = ininame.mid(pos-6, 2);
TConfig ini(ininame, module);
ini.write_protect();
const int patchlevel = ini.get_int("Patch");
const int maxrows=int(items());
bool found=FALSE;
for (int r = maxrows-1; r >=0 && !found; r--)
found=(module == row(r).get(C_CODE) );
if (found)
for (int r = int(items()-1); r >=0; r--)
if (module == row(r).get(C_CODE))
break;
if (r >= 0)
{
TString16 patchversion = ini.get("Versione");
if (patchversion == mask_rows.row(r+1).get(C_RELEASE) // se le versioni corrispondono ...
&& patchlevel > atoi(mask_rows.row(r+1).get(C_PATCH)) ) // ..e il patchlevel è superiore
const TString16 patchversion = ini.get("Versione");
const int patchlevel = ini.get_int("Patch");
TToken_string& row = mask_rows.row(r);
if (patchversion == row.get(C_RELEASE) // se le versioni corrispondono ...
&& patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore
{
TString16 patch; patch.format("%03d", patchlevel); //aggiunge zeri per avere 3 cifre sempre
mask_rows.row(r+1).add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo
if (*mask_rows.row(r+1).get(C_ISPATCH)==' ') // se era un modulo ...
mask_rows.row(r+1).add("+", C_ISPATCH); // .....setta la presenza di patches
force_update(r+1);
row.add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo
if (*row.get(C_ISPATCH)<=' ') // se era un modulo ...
row.add("+", C_ISPATCH); // .....setta la presenza di patches
}
} else
}
else
add_module(ini, module, TRUE);
}
update_version();
const bool ok = precheck_modules() > 0;
if (!ok)
@ -1061,7 +1059,7 @@ void TInstaller_mask::install_selection()
const TString oldver = row->get(C_CURRRELEASE);
const int oldpatch = row->get_int(C_CURRPATCH);
if (version2year(newver) < 1997)
if (version2year(newver) < 1998)
{
error_box("Il modulo '%s' non ha una versione valida.", (const char*)modulo);
continue;
@ -1269,16 +1267,17 @@ TInstaller_mask::~TInstaller_mask()
class TInstaller : public TSkeleton_application
{
protected:
TInstaller_mask * _m;
protected:
virtual bool create();
virtual bool use_files() const { return FALSE; }
virtual bool test_assistance_year() const;
virtual void main_loop();
bool testdatabase() const;
bool testprograms() const;
virtual bool use_files() const { return FALSE; }
virtual void main_loop();
};
bool TInstaller::testdatabase() const
@ -1294,8 +1293,21 @@ bool TInstaller::testprograms() const
return c == 'X' || c == 'Y';
}
bool TInstaller::test_assistance_year() const
{
// Per il momento lascia continuare: ci pensa poi la create
return TRUE;
}
bool TInstaller::create()
{
if (!TApplication::test_assistance_year())
{
TExternal_app attivazione("ba1 -4");
attivazione.run();
dongle().login(); // Rilegge anno assistenza
}
if (testprograms())
{
_m = new TInstaller_mask() ;
@ -1304,9 +1316,9 @@ bool TInstaller::create()
_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());
}
}
return error_box("L'utente %s non è abilitato all'uso di questo programma", (const char *)user());
}
void TInstaller::main_loop()
@ -1331,6 +1343,13 @@ protected:
bool TExtendedInstaller::create()
{
if (!TApplication::test_assistance_year())
{
TExternal_app attivazione("ba1 -4");
attivazione.run();
dongle().login(); // Rilegge anno assistenza
}
_m = new TInstaller_mask() ;
return TSkeleton_application::create();
}

View File

@ -7,8 +7,10 @@ int main(int argc, char** argv)
switch (r)
{
case 0:
default:
case 1:
ba7200(argc, argv) ; break;
case 0:
default:
ba7100(argc, argv) ; break;
}

View File

@ -712,11 +712,19 @@ void adjust_long_lines(const TFilename& tmp)
adjusted = TRUE;
dst << l;
org.line();
while (l.right(1)[0] != '\'')
char s = l[0];
if (s == '\'' || s == '"')
{
dst << l;
org.line();
char c = l.right(1)[0];
while (c != '\'' && c != '"')
{
dst << l;
org.line();
c = l.right(1)[0];
}
}
else
dst << '\n';
}
dst << l << '\n';
}
@ -802,9 +810,7 @@ bool TMailer_mask::save_sheet_line(int& err, int nrow)
return FALSE;
}
// const TString old_mailto = set_ini_var(CONFIG_INSTALL, "Main", "MailTo", "");
TMail_message& full_msg = _box.msg(nrow);
bool ok = exec_app(err, appname, full_msg);
if (!ok && err == _iskeynotfound)
{

176
ba/ba7200.cpp Executable file
View File

@ -0,0 +1,176 @@
#include <applicat.h>
#include <automask.h>
#include <defmask.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
#include <utility.h>
#include "ba7200a.h"
///////////////////////////////////////////////////////////
// Main app
///////////////////////////////////////////////////////////
class TCopia_dati_app : public TSkeleton_application
{
bool copy_dir(const char* src, const char* dst) const;
public:
virtual void main_loop();
};
inline TCopia_dati_app& app() { return (TCopia_dati_app&)main_app(); }
///////////////////////////////////////////////////////////
// Step 1
///////////////////////////////////////////////////////////
class TCopia_dati_mask : public TAutomask
{
public:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
TCopia_dati_mask() : TAutomask("ba7200a") { }
};
bool TCopia_dati_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F01_DATIL:
if (e == fe_close || e == fe_modify)
{
const TFilename n = o.get();
const bool esiste = n.exist();
if (strlen(n.name()) > 8)
return error_box("L'area dati ha un nome troppo lungo: %s", (const char*)n.name());
if (esiste)
return error_box("L'area dati in Lire esiste già");
} else
if (e == fe_init)
{
TFilename src, dst;
src = prefix().get_studio();
src.rtrim(1);
set(F01_DATI, src);
dst << src << "l";
set(F01_DATIL, dst);
}
break;
default:
break;
}
return TRUE;
}
int list_dirs(
const char* filelist, // @parm Stringa contenente la maschera di estrazione
TString_array& result) // @parm Array da riempire con la lista dei file
{
TWait_cursor hourglass;
TFilename dir(filelist);
for (int i = dir.len()-1; i >= 0; i--)
if (dir[i] == '/' || dir[i] == '\\' || dir[i] == ':') break;
TFilename mask(dir.mid(i+1));
dir.cut(i > 0 ? i+1 : 0);
DIRECTORY curdir;
xvt_fsys_get_dir(&curdir);
if (dir.not_empty())
{
DIRECTORY directory; xvt_fsys_convert_str_to_dir(dir.get_buffer(), &directory);
BOOLEAN ok = xvt_fsys_set_dir(&directory);
if (!ok)
{
error_box("Impossibile entrare in %s", (const char*)dir);
return 0;
}
}
SLIST files = xvt_fsys_list_files(DIR_TYPE, "", TRUE);
const int count = xvt_slist_count(files);
for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e))
{
const char* f = xvt_slist_get(files, e, NULL);
if (*f != '.' && f[1] != ':')
{
if (dir.not_empty())
{
mask = dir;
mask.add(f);
result.add(mask);
}
else
result.add(f);
}
}
xvt_slist_destroy(files);
xvt_fsys_set_dir(&curdir);
return count;
}
bool TCopia_dati_app::copy_dir(const char* src, const char* dst) const
{
bool ok = TRUE;
if (!fexist(dst))
make_dir(dst);
TString_array files;
TFilename file1, file2;
file1 = src; file1.add("*.*");
list_dirs(file1, files);
FOR_EACH_ARRAY_ROW(files, d, dir)
{
file1 = *dir;
file2 = dst; file2.add(file1.name());
ok &= copy_dir(file1, file2);
}
files.destroy();
file1 = src; file1.add("*.*");
list_files(file1, files);
TString str;
str << "Copia da " << src << " a " << dst << "...";
TProgind pi(files.items(), str, FALSE, TRUE);
FOR_EACH_ARRAY_ROW(files, i, file)
{
pi.addstatus(1);
file1 = *file;
file2 = dst; file2.add(file1.name());
ok &= fcopy(file1, file2);
}
return ok;
}
///////////////////////////////////////////////////////////
// Main
///////////////////////////////////////////////////////////
void TCopia_dati_app::main_loop()
{
TCopia_dati_mask m;
if (m.run() == K_ENTER)
{
prefix().set(NULL);
const char* dir1 = m.get(F01_DATI);
const char* dir2 = m.get(F01_DATIL);
copy_dir(dir1, dir2);
}
}
int ba7200(int argc, char* argv[])
{
TCopia_dati_app ma;
ma.run(argc, argv, "Copia Studio");
return 0;
}

4
ba/ba7200a.h Executable file
View File

@ -0,0 +1,4 @@
#define F01_DATI 101
#define F01_DATIL 102

41
ba/ba7200a.uml Executable file
View File

@ -0,0 +1,41 @@
#include "ba7200a.h"
TOOLBAR "" 0 -3 0 3
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -11 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -11 ""
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Copia area dati in Lire" 0 0 80 018
GROUPBOX DLG_NULL 80 4
BEGIN
PROMPT 1 0 "@bAree dati"
END
STRING F01_DATI 80 59
BEGIN
PROMPT 2 1 "Area dati origine "
FLAGS "D"
END
STRING F01_DATIL 80 59
BEGIN
PROMPT 2 2 "Area dati destin. "
CHECKTYPE REQUIRED
WARNING "E' necessario specificare l'area dati di destinazione"
END
ENDPAGE
ENDMASK

View File

@ -53,7 +53,22 @@ void zero_import(TRectype& rec, const char* str)
}
}
HIDDEN const TString& build_name(int logicnum, bool euro, long firm)
void keep_import(TRectype& rec, const char* str)
{
if (str && *str)
{
TAssoc_array old;
TToken_string list = str;
FOR_EACH_TOKEN(list, tok)
old.add(tok, rec.get(tok));
rec.zero();
FOR_EACH_ASSOC_STRING(old, obj, key, val)
rec.put(key, val);
}
}
const TString& build_name(int logicnum, bool euro, long firm)
{
TFilename dati, datie;
app().get_aree_dati(dati, datie);
@ -61,6 +76,9 @@ HIDDEN const TString& build_name(int logicnum, bool euro, long firm)
TDir d; d.get(logicnum, _nolock, _nordir, _sysdirop);
TString8 ditta = "com";
TFilename name = d.filename();
TFilename n = name.name();
if (!d.is_com())
{
if (firm < 0)
@ -68,18 +86,33 @@ HIDDEN const TString& build_name(int logicnum, bool euro, long firm)
if (firm > 0)
ditta.format("%05ldA", firm);
}
TFilename name = d.filename();
else
{
const TFilename n1 = d.name();
if (n1[0] != '%')
{
ditta.cut(0);
n = n1;
n.ext("dbf");
}
}
static TFilename _filename;
_filename = euro ? datie : dati;
_filename.add(ditta);
_filename.add(name.name());
_filename.add(n);
_filename.insert("%", 0);
return _filename;
}
bool dbf_exists(int logicnum, bool euro, long firm)
{
TFilename n = build_name(logicnum, euro, firm);
if (n[0] == '%') n.ltrim(1);
return fexist(n);
}
///////////////////////////////////////////////////////////
// Base app
///////////////////////////////////////////////////////////
@ -139,17 +172,21 @@ bool TEuro_app::goto_lire(long ditta)
}
bool TEuro_app::save_round_bill(const TBill& b) const
{
TFilename lit, eur;
bool ok = get_aree_dati(lit, eur);
{
bool ok = b.ok();
if (ok)
{
eur.add("config/prassis.ini");
TConfig prassis(eur, "Euro");
TString16 str;
str.format("%d,%d,%ld", b.gruppo(), b.conto(), b.sottoconto());
prassis.set("RoundBill", str);
TFilename lit, eur;
ok = get_aree_dati(lit, eur);
if (ok)
{
eur.add("config/prassis.ini");
TConfig prassis(eur, "Euro");
TString16 str;
str.format("%d,%d,%ld", b.gruppo(), b.conto(), b.sottoconto());
prassis.set("RoundBill", str);
}
}
return ok;
}
@ -203,12 +240,28 @@ bool TEuro_app::is_com_file(int lf) const
return d.is_com();
}
void TEuro_app::zap_file(int lf, bool euro) const
void TEuro_app::zap_file(int lf, bool euro, const char* filter) const
{
TFilename name = build_name(lf, euro, -1);
if (name[0] == '%') name.ltrim(1);
TExternisamfile f(name);
f.zap();
if (name.exist())
{
if (filter && *filter)
{
TRelation rel(lf);
rel.replace(new TEuroisamfile(lf, euro));
TCursor cur(&rel, filter);
const long items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
rel.remove();
}
else
{
TExternisamfile f(name);
f.zap();
}
}
}
/*
@ -230,25 +283,28 @@ void TEuro_app::zap_table(const char * tab, bool euro)
}
*/
void TEuro_app::convert_file(int lf, const char* cnv, const char* res, record_handler rh, void* jolly)
void TEuro_app::convert_file(int lf, const char* cnv, const char* res, record_handler rh, void* jolly, const char* filter)
{
if (!dbf_exists(lf, FALSE, -1)) // Non esiste il file da convertire
return; // per cui...
// Cursore su file in lire
TRelation rel(lf);
TCursor cur(&rel);
TCursor cur(&rel, filter);
TRectype& curr = rel.curr();
zap_file(lf, TRUE, filter); // Azzera file in euro
zap_file(lf, TRUE); // Azzera file in euro
// File destinazione in euro
TEuroisamfile fileur(lf, TRUE);
TRectype& receur = fileur.curr();
TString str;
str << "Conversione " << rel.lfile().description() << " ...";
TToken_string conv(cnv);
TToken_string azze(res);
const long items = cur.items();
cur.freeze();
TProgind pi(items, str, FALSE, TRUE);
@ -258,7 +314,7 @@ void TEuro_app::convert_file(int lf, const char* cnv, const char* res, record_ha
receur = curr;
convert_import(receur, conv);
zero_import(receur, azze);
bool do_write = TRUE;
if (rh != NULL)
do_write = rh(receur, jolly);
@ -338,6 +394,22 @@ bool TEuro_app::data_adozione_euro(long firm, TDate& adozione, bool& inizio) con
}
bool TEuro_app::create()
{
old_study = prefix().get_studio();
return TSkeleton_application::create();
}
bool TEuro_app::destroy()
{
if (old_study != prefix().get_studio())
{
TConfig ini(CONFIG_INSTALL, "Main");
ini.set("Study", old_study);
}
return TSkeleton_application::destroy();
}
///////////////////////////////////////////////////////////
// TEuroisamfile
///////////////////////////////////////////////////////////
@ -358,16 +430,16 @@ int main(int argc, char** argv)
int a = argc > 1 ? argv[1][1]-'0' : 0;
switch (a)
{
case 1: baeur01(argc, argv); break;
case 2: baeur02(argc, argv); break;
case 3: baeur03(argc, argv); break;
case 4: baeur04(argc, argv); break;
case 1: baeur01(argc, argv); break; // Conversione ditte
case 2: baeur02(argc, argv); break; // Conversione saldi infrannuale
case 3: baeur03(argc, argv); break; // Chiusura/Apertura conti in Euro
case 4: baeur04(argc, argv); break; // Conversione documenti
case 5: baeur05(argc, argv); break;
case 6: baeur06(argc, argv); break;
case 7: baeur07(argc, argv); break;
case 8: baeur08(argc, argv); break;
case 9: baeur09(argc, argv); break;
default: baeur00(argc, argv); break;
case 9: baeur09(argc, argv); break; // Ricalcolo saldi Lire/Euro
default: baeur00(argc, argv); break; // Creazioe area dati euro
}
return 0;
}

View File

@ -16,21 +16,27 @@ class TBill;
// Handler personalizzato. Se ritorna true rewrite, altrimenti remove
typedef bool (*record_handler)(TRectype& rec, void* jolly);
typedef void (*zap_function)(int lf, bool euro, void * jolly);
class TEuro_app : public TSkeleton_application
{
TFilename old_study;
protected:
bool goto_lire(long ditta = -1);
bool goto_euro(long ditta = -1);
bool copy_dir(const char* src, const char* dst) const;
void convert_file(int lf, const char* cnv, const char* res,
record_handler rh = NULL, void* jolly = NULL);
void zap_file(int lf, bool euro) const;
void zap_table(const char * tab, bool euro);
record_handler rh = NULL, void* jolly = NULL, const char* filter = NULL);
void zap_file(int lf, bool euro = TRUE, const char* filter = NULL) const;
void zap_table(const char * tab, bool euro = TRUE);
bool is_com_file(int lf) const;
bool is_firm_file(int lf) const { return !is_com_file(lf); }
virtual bool create();
virtual bool destroy();
public:
bool get_aree_dati(TFilename& lit, TFilename& eur) const;
bool data_adozione_euro(long firm, TDate& adozione, bool& inizio) const;
@ -69,6 +75,7 @@ public:
void add(const TBill& bill, const TImporto& imp);
TImporto save(const TDate& datareg, const TString& caus, const TString& desc,
const TBill& contro, bool adeuro, bool convert, bool invert);
TImporto calc_bil(bool convert, bool invert); // Sommatoria delle righe
};
class TCG_movs : public TArray
@ -84,6 +91,9 @@ public:
bool dir_equal(const char* dir1, const char* dir2);
void convert_import(TRectype& rec, const char* str);
void zero_import(TRectype& rec, const char* str);
void keep_import(TRectype& rec, const char* str);
const TString& build_name(int logicnum, bool euro, long firm);
bool dbf_exists(int logicnum, bool euro = FALSE, long firm = -1);
const real EURO(1936.27);

View File

@ -207,17 +207,13 @@ HIDDEN bool tabcom_handler(TRectype& curr, void* jolly)
{
const int anno = atoi(curr.get("CODTAB").mid(5, 4));
if (anno >= 2001)
zero_import(curr, "R0|R1|R2|R3|R5|R15"); // Azzera crediti residui vari
keep_import(curr, "COD|CODTAB|B1|B2|S7|S8|S9"); // Azzera quasi tutto
else
update = FALSE;
}
if (cod == "PLA")
{
const int anno = atoi(curr.get("CODTAB").mid(5, 4));
if (anno >= 2001)
zero_import(curr, "R5|R6|R7|R8"); // Azzera prorata
else
update = FALSE;
update = FALSE;
}
if (cod == "VAL")
{
@ -334,6 +330,9 @@ void TEuro00_app::convert_ditte(const TString& eur)
TTabcom_data data;
data._eur = eur;
convert_file(LF_NDITTE, NULL, NULL, ditte_handler, &data);
zap_file(LF_TAB1100A, TRUE);
zap_file(LF_TAB1100B, TRUE);
}
void TEuro00_app::convert_anag()

View File

@ -29,6 +29,8 @@
class TEuro01_app : public TEuro_app
{
TAssoc_array _schede_passate;
protected:
void convert_saldi(const TDate& adozione, const TBill& arrotino);
void convert_partite();
@ -37,6 +39,9 @@ protected:
public:
KEY convert_firm(long ditta);
bool has_mag() const;
bool has_percip() const;
TAssoc_array & passate() { return _schede_passate;}
virtual void main_loop();
};
@ -67,7 +72,7 @@ void TEuro03_mask::fill_ditte()
const long items = cur.items();
cur.freeze();
TSheet_field& ditte = sfield(F03_DITTE);
TSheet_field& ditte = sfield(F10_DITTE);
ditte.destroy();
for (cur = 0L; cur.pos() < items; ++cur)
@ -76,7 +81,6 @@ void TEuro03_mask::fill_ditte()
if (prefix().exist(ditta))
{
TToken_string& row = ditte.row(-1);
row.add(" ");
row.add(ditta);
row.add(curr.get(NDT_RAGSOC));
@ -95,16 +99,29 @@ void TEuro03_mask::fill_ditte()
col = COLOR_RED;
}
else
{
TString str; str << "Adotta l'Euro dal " << dde;
{
TString str;
if (ini.get("ConversionOK").not_empty())
{
str << "Adotta l'Euro dal " << dde;
col = COLOR_GREEN;
}
else
{
str << "Conversione incompleta: ripetere l'operazione";
col = COLOR_CYAN;
}
row.add(str);
col = COLOR_GREEN;
}
}
else
{
row.add("X", 0);
row.add("Non presente in Euro");
if (field(F10_DITTA).empty())
{
set(F10_DITTA, ditta);
set(F10_RAGSOC, row.get(1));
}
}
if (col != COLOR_BLACK)
{
@ -121,11 +138,38 @@ bool TEuro03_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
{
switch (o.dlg())
{
case F03_DITTE:
case F10_DITTA:
if (e == fe_modify || e == fe_close)
{
TSheet_field& s = sfield(F10_DITTE);
TEdit_field& f = efield(F10_DITTA);
const long ditta = atol(o.get());
for (int r = s.items()-1; r >= 0; r--)
{
TToken_string& row = s.row(r);
const long d = row.get_long(0);
if (d == ditta)
{
set(F10_RAGSOC, row.get());
break;
}
}
if (r < 0)
return error_box(f.get_warning());
}
break;
case F10_DITTE:
if (e == fe_init)
fill_ditte();
if (e == se_query_add || e == se_query_del)
return FALSE;
if (e == se_enter)
{
TSheet_field& s = sfield(F10_DITTE);
TToken_string& r = s.row((int)jolly);
set(F10_DITTA, r.get(0));
set(F10_RAGSOC, r.get());
}
break;
default:
break;
@ -158,37 +202,34 @@ bool TEuro11_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
const int codesc = esc.date2esc(d);
if (codesc <= 0)
return error_box("E' necessario aprire l'esercizio per l'anno %d", d.year());
/* TLocalisamfile sch(LF_SCHPERC);
if (sch.items() > 0L)
{
bool inizio;
data_adozione_euro(-1L, d, inizio);
if (!inizio)
return error_box("La conversione dei percipienti puó essere effettuata solo a inizio esercizio");
}
*/
if (d.day() != 1)
warning_box("Si consiglia di specificare una data di inizio mese/trimestre");
if (dongle().active(MGAUT))
if (d != esc[codesc].inizio())
{
TConfig c(CONFIG_DITTA, "mg");
if (c.get_bool("GESMAG") && d != esc[codesc].inizio())
if (app().has_percip() && get_bool(F11_SOLOAPERTE))
return error_box("Se sono presenti percipienti e si convertono solo le schede aperte\nla conversione deve essere effettuata a inizio esercizio.");
if (d != esc[codesc].inizio() && app().has_mag())
{
const int prevesc = esc.date2prevesc(d);
if (prevesc > 0)
{
const TDate& cm = esc[prevesc].chiusura_mag();
if (!cm.ok())
return error_box("E' necessario chiudere il magazzino nel %d", prevesc);
return error_box("E' necessario chiudere il magazzino nell'esercizio %d", prevesc);
}
}
}
}
break;
default: break;
case F11_DIFF_S:
if (e == fe_close && o.empty())
{
TLocalisamfile pcon(LF_PCON);
if (pcon.first() == NOERR)
return error_box("E' necessario specificare un conto per gli arrotondamenti");
}
break;
default: break;
}
return TRUE;
}
@ -204,6 +245,12 @@ struct TMag_data
TString _zero_fields;
};
struct TPerc_data
{
bool _soloaperte;
TDate _adozione;
};
static bool mag_handler(TRectype& rec, void* jolly)
{
TMag_data& mag = *(TMag_data*)jolly;
@ -238,7 +285,7 @@ struct TTab_data
int _codes_rif, _annoes_rif;
};
/* static bool perc_handler(TRectype& rec, void* jolly)
static bool perc_handler(TRectype& rec, void* jolly)
{
return app().get_firm() == rec.get_long("CODDITTA");
}
@ -247,11 +294,71 @@ static bool sch_handler(TRectype& rec, void* jolly)
{
bool ok = perc_handler(rec, jolly);
if (ok)
{
{
TPerc_data & d = *(TPerc_data*)jolly;
if (d._soloaperte)
{
real pagato = ZERO;
TRectype keypag(LF_RPAG);
TLocalisamfile sch(LF_SCPERC);
TRectype recsch(rec);
recsch.read(sch);
real totale = recsch.get_real("COMPENSO");
totale += recsch.get_real("SPESE");
keypag.put("CODDITTA", rec.get("CODDITTA"));
keypag.put("TIPOA", rec.get("TIPOA"));
keypag.put("CODANAGR", rec.get("CODANAGR"));
keypag.put("NPROG", rec.get("NPROG"));
TRecord_array pag_scheda(keypag, "NRIGA");
const int rows = pag_scheda.rows();
TDate& adozione = d._adozione;
for (int i = 1 ; i <= rows; i++)
{
const TRectype & rpag = pag_scheda[i];
const TDate datapag = rpag.get_date("DATAPAG");
const int rver = rpag.get_int("NUMVERS");
if (datapag <= adozione && rver > 0)
{
pagato += rpag.get_real("COMPENSO");
pagato += rpag.get_real("SPESA");
}
}
ok = totale > pagato;
}
if (ok)
{
TString80 key(rec.get("CODDITTA"));
key << "|" << rec.get("TIPOA");
key << "|" << rec.get("CODANAGR");
key << "|" << rec.get("NPROG");
app().passate().add(key, key);
}
}
return ok;
} */
}
static bool to_sch_handler(TRectype& rec, void* jolly)
{
bool ok = perc_handler(rec, jolly);
if (ok)
{
TString80 key(rec.get("CODDITTA"));
key << "|" << rec.get("TIPOA");
key << "|" << rec.get("CODANAGR");
key << "|" << rec.get("NPROG");
ok = app().passate().objptr(key) != NULL;
}
return ok;
}
static bool tab_handler(TRectype& rec, void* jolly)
{
@ -260,12 +367,6 @@ static bool tab_handler(TRectype& rec, void* jolly)
if (cod == "CAM")
return FALSE;
if (cod == "ESC")
{
TTab_data* data = (TTab_data*)jolly;
const int ese = rec.get_int("CODTAB");
return ese >= data->_codes_rif;
}
if (cod == "REG")
{
TTab_data* data = (TTab_data*)jolly;
@ -336,6 +437,30 @@ static bool conv_rcondv(TRectype& rec, void* jolly)
if (is_firm_value(val))
convert_import(rec, "PREZZO");
return TRUE;
}
bool TEuro01_app::has_mag() const
{
TConfig c(CONFIG_DITTA, "mg");
bool yes = c.get_bool("GESMAG") && dbf_exists(LF_MOVMAG);
if (yes)
{
TLocalisamfile mm(LF_MOVMAG);
yes = mm.first() == NOERR;
}
return yes;
}
bool TEuro01_app::has_percip() const
{
bool yes = dbf_exists(LF_SCPERC);
if (yes)
{
TLocalisamfile sp(LF_SCPERC);
yes = sp.first() == NOERR;
}
return yes;
}
KEY TEuro01_app::convert_firm(long ditta)
@ -348,12 +473,23 @@ KEY TEuro01_app::convert_firm(long ditta)
TFilename litf = lit; litf.add(firm);
TFilename eurf = eur; eurf.add(firm);
const bool already_present = eurf.exist();
TFilename europrassid;
europrassid = eurf; europrassid.add("prassid.ini");
bool already_present = eurf.exist();
if (already_present)
{
TConfig prassid(europrassid, "Euro");
already_present = prassid.get("ConversionOK").not_empty();
}
bool do_copy = !already_present;
bool do_saldi = !already_present;
bool do_partite = !already_present;
bool do_vendite = !already_present;
bool do_magazzino = !already_present;
bool do_percip = !already_present;
bool solo_aperte = FALSE;
TDate adozione;
TBill arrotino;
@ -370,20 +506,23 @@ KEY TEuro01_app::convert_firm(long ditta)
m.set(F11_PARTITE, do_partite ? "X" : "");
m.set(F11_VENDITE, do_vendite ? "X" : "");
m.set(F11_MAGAZZINO, do_magazzino ? "X" : "");
m.set(F11_PERCIPIENTI, do_percip ? "X" : "");
if (already_present)
{
TFilename ini = eurf; ini.add("prassid.ini");
TConfig prassid(ini, "Euro");
TConfig prassid(europrassid, "Euro");
adozione = prassid.get("DataAdozione");
m.set(F11_ADOZIONE, adozione);
}
m.enable(-1, already_present); // Abilita i vari checkbox
if (load_round_bill(arrotino))
{
arrotino.set(m, F11_DIFF_G, F11_DIFF_C, F11_DIFF_S);
m.field(F11_DIFF_S).check(STARTING_CHECK);
else
{
m.reset(F11_DIFF_G);
m.reset(F11_DIFF_C);
m.reset(F11_DIFF_S);
}
k = m.run();
@ -394,16 +533,22 @@ KEY TEuro01_app::convert_firm(long ditta)
do_partite = m.get_bool(F11_PARTITE);
do_vendite = m.get_bool(F11_VENDITE);
do_magazzino = m.get_bool(F11_MAGAZZINO);
do_percip = m.get_bool(F11_PERCIPIENTI);
solo_aperte = m.get_bool(F11_SOLOAPERTE);
}
if (k == K_ENTER)
{
if (do_copy && already_present)
do_copy = yesno_box("Si conferma la sovrascrittura della ditta %ld in Euro?", ditta);
if (already_present && !yesno_box("Si conferma la sovrascrittura della ditta %ld in Euro?", ditta))
return k;
TEsercizi_contabili esc;
const int codes_rif = esc.date2prevesc(adozione);
const int annoes_rif = adozione.year()-1;
TTab_data data;
data._codes_rif = codes_rif;
data._annoes_rif = annoes_rif;
if (do_copy)
{
TCurrency::force_cache_update(); // Chiude cache valute
@ -416,15 +561,11 @@ KEY TEuro01_app::convert_firm(long ditta)
TConfig prassid(ini, "Euro");
prassid.set("DataAdozione", adozione.string());
}
save_round_bill(arrotino);
prefix().set("."); // Riapre files ditta
// prefix().set("."); // Riapre files ditta
set_firm(ditta);
TTab_data data;
data._codes_rif = codes_rif;
data._annoes_rif = annoes_rif;
convert_file(LF_TAB, NULL, NULL, tab_handler, (void*)&data);
if (is_firm_file(LF_CLIFO))
@ -437,28 +578,41 @@ KEY TEuro01_app::convert_firm(long ditta)
zap_file(LF_RMOV, TRUE); // Cancella righe di prima nota dell'area euro
zap_file(LF_RMOVIVA, TRUE); // Cancella righe iva dell'area euro
zap_file(LF_REFFETTI, TRUE);
zap_file(LF_EFFETTI, TRUE);
zap_file(LF_CESS, TRUE);
zap_file(LF_INTRA, TRUE);
zap_file(LF_RINTRA, TRUE);
zap_file(LF_RIEPRETT, TRUE);
/* convert_file(LF_PERC, NULL, NULL, perc_handler, (void*)&data);
convert_file(LF_SCHPERC, NULL, NULL, sch_handler, (void*)&data);
convert_file(LF_RVER, NULL, NULL, sch_handler, (void*)&data);
convert_file(LF_RPAG, NULL, NULL, sch_handler, (void*)&data); */
}
if (do_saldi)
convert_saldi(adozione, arrotino); // Converti saldi
{
const int eser = esc.date2esc(adozione);
const TDate iniz_eser = esc[eser].inizio();
if (adozione == iniz_eser)
{
convert_saldi(adozione, arrotino); // Converti saldi anno precedente
}
else
{
zap_file(LF_SALDI, TRUE);
TString16 cmd; cmd.format("baeur -2 %ld", ditta);
TExternal_app app(cmd); // Conversione saldi infrannuale
app.run();
}
}
if (do_partite)
convert_partite(); // Converti partite
if (do_vendite)
{
zap_file(LF_REFFETTI, TRUE);
zap_file(LF_EFFETTI, TRUE);
zap_file(LF_CESS, TRUE);
zap_file(LF_PROVV, TRUE);
zap_file(LF_DOC, TRUE);
zap_file(LF_RIGHEDOC, TRUE);
@ -484,15 +638,44 @@ KEY TEuro01_app::convert_firm(long ditta)
mag._fields << "VALRIM|VALACQ|VALENT|VALVEN|VALUSC|VALORDF|VALORDC|VALSCARTI|";
mag._fields << "USERVAL1|USERVAL2|USERVAL3|USERVAL4|USERVAL5|USERVAL6";
convert_file(LF_MAG, "", "", mag_handler, (void*)&mag);
convert_file(LF_MAG, "", "ORDC|VALORDC|ORDF|VALORDF", mag_handler, (void*)&mag);
convert_file(LF_MOVMAG, "", "", movmag_handler, (void*)&mag);
convert_file(LF_RMOVMAG, "PREZZO", "", righemovmag_handler, (void*)&mag);
convert_file(LF_STOMAG, "VALORE|ULTCOS1|COSTSTD|COSTOMEDIO|PRZLIST", "");
convert_file(LF_DIST, "PREZZO", "");
if (dbf_exists(LF_ANAMAG) && dbf_exists(LF_STOMAG) && dbf_exists(LF_MOVMAG))
{
TExternal_app app("baeur -6 S");
app.run();
}
}
TExternal_app app("baeur -6 S");
app.run();
if (do_percip)
{
TString16 filter;
filter << "CODDITTA=" << get_firm();
TLocalisamfile rp(LF_RPAG);
TPerc_data d;
d._soloaperte = solo_aperte;
d._adozione = adozione;
_schede_passate.destroy();
convert_file(LF_PERC, "FATTBIL", NULL, perc_handler, NULL, filter);
convert_file(LF_SCPERC,"COMPENSO|SPESE|IVA|TOTALE|TOTRIT|RITSOC|RITOPE|RITVER", NULL, sch_handler, (void*)&d, filter);
convert_file(LF_RVER, "RITENUTA", NULL, to_sch_handler, NULL, filter);
TString flds;
flds << "IMPONIBILE|RITENUTA|COMPENSO|NETTO|SPESA|CTSSNPERC|CTSSNCOMP|RITLORDA|CONTROBB|DETFAMIL|DETLAVDIP|TOTDET|";
flds << "IMPCPA|SOMREGCONV|UTPAGATI|UTSPETT|RITUTPAG|RITUTSPE|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO";
convert_file(LF_RPAG, flds, NULL, to_sch_handler, NULL, filter);
}
if (adozione.ok()) // Dummy test
{
TConfig prassid(europrassid, "Euro");
prassid.set("ConversionOK", "X");
}
}
@ -525,8 +708,8 @@ static bool saldi_handler(TRectype& rec, void* jolly)
saldo.normalize();
rec.put(SLD_FLAGSALINI, saldo.sezione());
rec.put(SLD_SALDO, saldo.valore());
convert_import(rec, "SALDO|FLAGSALFIN|SALDOFIN");
zero_import(rec, "PDARE|PAVERE|PDAREPRO|PAVEREPRO");
convert_import(rec, SLD_SALDO);
zero_import(rec, "PDARE|PAVERE|PDAREPRO|PAVEREPRO|FLAGSALFIN|SALDOFIN|DATAULMOV|NUMULTMOV");
sld._sld += TImporto(saldo.sezione(), rec.get_real(SLD_SALDO)); // Somma saldo in euro
return TRUE;
}
@ -581,7 +764,7 @@ bool partite_handler(TRectype& rec, void* jolly)
return FALSE;
TSaldac_data* data = (TSaldac_data*)jolly;
const TString16 codval = rec.get(PART_CODVAL);
if (::is_firm_value(codval))
{
@ -598,17 +781,30 @@ bool partite_handler(TRectype& rec, void* jolly)
if (impval != ZERO)
{
const real impeur = rec.get(PART_IMPORTO);
const real cambio = impeur / impval;
rec.put(PART_CAMBIO, cambio);
const real old_cambio = rec.get(PART_CAMBIO);
real new_cambio = impval / impeur;
new_cambio.round(5);
if (abs(old_cambio - new_cambio) > 0.001) // Non era già contro euro
rec.put(PART_CAMBIO, new_cambio);
}
}
if (rec.get_int(PART_TIPOMOV) > 1)
{
// Riempe il campo totale documento per i pagamenti (In contabilità viene lasciato vuoto)
rec.put(PART_IMPTOTDOC, rec.get(PART_IMPORTO));
}
rec.put(PART_INVIATA, "X");
return TRUE;
}
bool scadenze_handler(TRectype& rec, void* jolly)
{
TSaldac_data* sd = (TSaldac_data*)jolly;
// Controlla se la riga di partita corrispondente esiste in euro
TEuroisamfile part(LF_PARTITE, TRUE);
TRectype& curr = part.curr();
curr.zero();
@ -621,6 +817,13 @@ bool scadenze_handler(TRectype& rec, void* jolly)
curr.put(PART_NRIGA, rec.get(SCAD_NRIGA));
if (part.read() != NOERR)
return FALSE;
if (!rec.get_real(SCAD_IMPORTOVAL).is_zero())
{
const TString4 codval = part.get(PART_CODVAL);
if (::is_firm_value(codval) || ::is_euro_value(codval))
rec.zero(SCAD_IMPORTOVAL);
}
const int nrata = rec.get_int(SCAD_NRATA);
if (nrata == 1)
@ -630,14 +833,12 @@ bool scadenze_handler(TRectype& rec, void* jolly)
// I problemi di arrotondamento dovrei averli solo con tante rate
if (nrata > 1)
{
TLocalisamfile scad(LF_SCADENZE, FALSE);
TLocalisamfile scad(LF_SCADENZE);
scad.curr() = rec;
scad.curr().put(SCAD_NRATA, nrata+1);
if (scad.read() != NOERR) // Sono l'ultima rata
{
real toteur = part.get(PART_IMPTOTDOC);
toteur /= EURO;
toteur.round(2);
const real toteur = part.get(PART_IMPTOTDOC);
const real diff = toteur - sd->_totrate;
if (diff != ZERO)
{
@ -654,6 +855,7 @@ bool pagamenti_handler(TRectype& rec, void* jolly)
{
TSaldac_data* sd = (TSaldac_data*)jolly;
// Controlla se la partita di appartenenza esiste in euro
TEuroisamfile part(LF_PARTITE, TRUE);
TRectype& curr = part.curr();
curr.zero();
@ -662,26 +864,32 @@ bool pagamenti_handler(TRectype& rec, void* jolly)
curr.put(PART_CONTO, rec.get(PAGSCA_CONTO));
curr.put(PART_SOTTOCONTO, rec.get(PAGSCA_SOTTOCONTO));
curr.put(PART_ANNO, rec.get(PAGSCA_ANNO));
curr.put(PART_NUMPART, rec.get(PAGSCA_NUMPART));
curr.put(PART_NRIGA, rec.get(PAGSCA_NRIGA));
if (part.read() != NOERR)
curr.put(PART_NUMPART, rec.get(PAGSCA_NUMPART));
const TRectype sample(curr);
if (part.read(_isgteq) != NOERR || part.curr() != sample)
return FALSE;
// Ero in lire (ora sono in euro) devo convertire gli abbuoni
// Ero in lire (ora sono in euro) devo convertire gli abbuoni a lire ad euro
// Se ero in valuta devo lasciar stare gli abbuoni
if (curr.get_real(PART_IMPORTOVAL) == ZERO)
convert_import(rec, PAGSCA_ABBUONI);
else
{
// Le differenze cambio sono già convertite sempre automaticamente in quanto erano sempre in lire
}
return TRUE;
}
void TEuro01_app::convert_partite()
{
TLocalisamfile partlit(LF_PARTITE); // Serve ad avere disponibile il tracciato record
TSaldac_data data;
convert_file(LF_PARTITE, "IMPORTO|IMPOSTA|SPESE|RITENUTE", PART_NREG, partite_handler, &data);
TLocalisamfile part(LF_PARTITE); // Serve ad avere disponibile il tracciato record
convert_file(LF_PARTITE, "IMPTOTDOC|IMPORTO|IMPOSTA|SPESE|RITENUTE|DIFFCAM", PART_NREG, partite_handler, &data);
convert_file(LF_SCADENZE, "IMPORTO", NULL, scadenze_handler, &data);
convert_file(LF_PAGSCA, "IMPORTO|RITENUTE", NULL, pagamenti_handler, &data);
convert_file(LF_PAGSCA, "IMPORTO|RITENUTE|DIFFCAM", NULL, pagamenti_handler, &data);
}
///////////////////////////////////////////////////////////
@ -698,33 +906,15 @@ bool TEuro01_app::create()
void TEuro01_app::main_loop()
{
KEY k = K_ENTER;
while (k == K_ENTER)
{
TString_array lista;
if (goto_lire())
{
TEuro03_mask m;
k = m.run();
if (k == K_ENTER)
{
TSheet_field& ditte = m.sfield(F03_DITTE);
lista = ditte.rows_array();
}
}
if (lista.items() > 0)
{
FOR_EACH_ARRAY_ROW(lista, r, row) if (*row->get(0) > ' ')
{
const long ditta = row->get_long(1);
KEY t = convert_firm(ditta);
if (t == K_ESC)
break;
}
}
else
break;
long ditta = 0L;
if (goto_lire())
{
TEuro03_mask m;
if (m.run() == K_ENTER)
ditta = m.get_long(F10_DITTA);
}
if (ditta > 0L)
convert_firm(ditta);
}
int baeur01(int argc, char* argv[])

View File

@ -1,11 +1,13 @@
#include <applicat.h>
#include <automask.h>
#include <progind.h>
#include <recarray.h>
#include "baeur.h"
#include "baeur20.h"
#include "../cg/cglib01.h"
#include <causali.h>
#include <mov.h>
#include <pconti.h>
#include <rmov.h>
@ -17,9 +19,6 @@
class TEuro02_app : public TEuro_app
{
protected:
virtual bool create();
public:
virtual void main_loop();
};
@ -88,6 +87,7 @@ void TCG_mov::update_saldo(const TRectype& mov, const TRectype& rmov, TLocalisam
curr.put(SLD_GRUPPO, zio.gruppo());
curr.put(SLD_CONTO, zio.conto());
curr.put(SLD_SOTTOCONTO, zio.sottoconto());
curr.put(SLD_FLSCA, "");
const bool found = saldi.read() == NOERR;
if (!found)
{
@ -96,15 +96,50 @@ void TCG_mov::update_saldo(const TRectype& mov, const TRectype& rmov, TLocalisam
curr.put(SLD_GRUPPO, zio.gruppo());
curr.put(SLD_CONTO, zio.conto());
curr.put(SLD_SOTTOCONTO, zio.sottoconto());
curr.put(SLD_FLSCA, "");
}
curr.put(SLD_NUMULTMOV, mov.get(MOV_NUMREG));
curr.put(SLD_DATAULMOV, mov.get(MOV_DATAREG));
const char* field = rmov.get_char(RMV_SEZIONE) == 'D' ? "PDARE" : "PAVERE";
const real importo = rmov.get_real(RMV_IMPORTO);
real saldo = curr.get(field);
saldo += importo;
curr.put(field, saldo);
const TDate sld_datareg = curr.get(SLD_DATAULMOV);
const TDate mov_datareg = mov.get(MOV_DATAREG);
if (mov_datareg >= sld_datareg)
{
curr.put(SLD_NUMULTMOV, mov.get(MOV_NUMREG));
curr.put(SLD_DATAULMOV, mov_datareg);
}
const TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
const TString4 caus = mov.get(MOV_CODCAUS);
const char movap = cache().get(LF_CAUSALI, caus, CAU_MOVAP)[0];
switch (movap)
{
case 'A':
{
TImporto saldo(curr.get_char(SLD_FLAGSALINI), curr.get_real(SLD_SALDO));
saldo += importo;
saldo.normalize();
curr.put(SLD_FLAGSALINI, saldo.sezione());
curr.put(SLD_SALDO, saldo.valore());
}
break;
case 'C':
{
TImporto saldo(curr.get_char(SLD_FLAGSALFIN), curr.get_real(SLD_SALDOFIN));
saldo += importo;
saldo.normalize();
curr.put(SLD_FLAGSALFIN, saldo.sezione());
curr.put(SLD_SALDOFIN, saldo.valore());
}
break;
default:
{
const char* field = importo.sezione() == 'D' ? SLD_PDARE : SLD_PAVERE;
real saldo = curr.get(field);
saldo += importo.valore();
curr.put(field, saldo);
}
break;
}
if (found)
saldi.rewrite();
else
@ -114,7 +149,9 @@ void TCG_mov::update_saldo(const TRectype& mov, const TRectype& rmov, TLocalisam
// Salva un movimento di primanota, eventualmente spezzandolo su piu' records se necessario
TImporto TCG_mov::save(const TDate& datareg, const TString& caus, const TString& desc,
const TBill& contro, bool adeuro, bool convert, bool invert)
{
{
TProgind pi(items(), desc, FALSE, TRUE);
// Apro comunque i file in lire per avere i tracciati
TLocalisamfile lmov(LF_MOV, adeuro);
TLocalisamfile lrmov(LF_RMOV, adeuro);
@ -139,7 +176,6 @@ TImporto TCG_mov::save(const TDate& datareg, const TString& caus, const TString&
TLocalisamfile& saldi = *psaldi;
TImporto bilancio;
for (int i = 0; i < items(); i += MAX_CG_ROWS)
{
const int first_row = i;
@ -150,8 +186,9 @@ TImporto TCG_mov::save(const TDate& datareg, const TString& caus, const TString&
crea_testata(mov, caus, datareg, desc);
TImporto totale;
int written = 0;
for (int r = 0; r < last_row; r++)
{
for (int r = i; r < last_row; r++)
{
pi.addstatus(1);
const TCG_rmov& riga = row(r);
TImporto imp = riga._importo;
if (convert)
@ -186,6 +223,7 @@ TImporto TCG_mov::save(const TDate& datareg, const TString& caus, const TString&
if (written > 0)
{
crea_riga(mov.curr(), rmov.curr(), ++written);
totale.normalize();
rmov.put(RMV_SEZIONE, totale.sezione() == 'D' ? 'A' : 'D');
rmov.put(RMV_IMPORTO, totale.valore());
contro.put(rmov.curr(), FALSE);
@ -198,7 +236,6 @@ TImporto TCG_mov::save(const TDate& datareg, const TString& caus, const TString&
update_saldo(mov.curr(), rmov.curr(), saldi);
// Scrittura testata
totale.normalize();
mov.put(MOV_TOTDOC, totale.valore());
mov.write();
}
@ -216,6 +253,30 @@ TImporto TCG_mov::save(const TDate& datareg, const TString& caus, const TString&
return bilancio;
}
TImporto TCG_mov::calc_bil(bool convert, bool invert)
{
TImporto bilancio;
for (int i = items()-1; i >= 0; i--)
{
const TCG_rmov& riga = row(i);
TImporto imp = riga._importo;
if (convert)
{
real euro = imp.valore() / EURO;
euro.round(2);
imp.set(imp.sezione(), euro);
}
if (imp.is_zero())
continue;
if (invert)
imp.swap_section();
bilancio += imp;
}
bilancio.normalize();
return bilancio;
}
int TCG_movs::indbil(int g, int c) const
{
TString16 key;
@ -348,21 +409,26 @@ void TEuro20_mask::on_firm_change()
// Main
///////////////////////////////////////////////////////////
bool TEuro02_app::create()
{
set_firm();
bool ok = goto_lire(get_firm());
if (ok)
ok = TSkeleton_application::create();
return ok;
}
struct TSaldi_data : public TObject
{
int _anno;
TCG_movs _movs;
};
static bool saldi_handler(TRectype& rec, void* jolly)
{
TCG_movs* movs = (TCG_movs*)jolly;
{
TSaldi_data* sd = (TSaldi_data*)jolly;
const int anno = rec.get_int(SLD_ANNOES);
if (anno != sd->_anno)
return FALSE;
const int gruppo = rec.get_int(SLD_GRUPPO);
const int conto = rec.get_int(SLD_CONTO);
const long sottoconto = rec.get_long(SLD_SOTTOCONTO);
if (gruppo <= 0 || conto <= 0 || sottoconto <= 0)
return error_box("Il file dei saldi contiene il conto errato %d %d %ld", gruppo, conto, sottoconto);
TImporto saldo, pdare, pavere;
saldo.set(rec.get_char(SLD_FLAGSALINI), rec.get_real(SLD_SALDO));
pdare.set('D', rec.get_real(SLD_PDARE));
@ -370,31 +436,39 @@ static bool saldi_handler(TRectype& rec, void* jolly)
saldo += pdare;
saldo += pavere;
saldo.normalize();
if (saldo.is_zero())
return FALSE;
if (gruppo <= 0 || conto <= 0 || sottoconto <= 0)
return error_box("Il file dei saldi contiene il conto errato %d %d %ld", gruppo, conto, sottoconto);
movs->add(gruppo, conto, sottoconto, saldo.sezione(), saldo.valore());
return TRUE;
if (!saldo.is_zero())
{
sd->_movs.add(gruppo, conto, sottoconto, saldo.sezione(), saldo.valore());
}
return FALSE;
}
void TEuro02_app::main_loop()
{
{
const long f = argc() > 2 ? atol(argv(2)) : -1;
goto_lire(f);
if (f <= 0L)
set_firm();
TEuro20_mask msk;
msk.on_firm_change(); // Preimposta data adozione euro ed altro
if (msk.run() == K_ENTER)
{
TCG_movs movs;
convert_file(LF_SALDI, "", "", saldi_handler, &movs);
TSaldi_data sd;
const TDate adozione = msk.get(F20_ADOZIONE);
TEsercizi_contabili esc;
sd._anno = esc.date2esc(adozione);
convert_file(LF_SALDI, "", "", saldi_handler, &sd);
TBill contro;
contro.get(msk, F20_CONTROG_C, F20_CONTROC_C, F20_CONTROS_C);
movs.save(adozione, msk.get(F20_CAUS_C), msk.get(F20_DESC_C), contro, FALSE, FALSE, TRUE);
sd._movs.save(adozione, msk.get(F20_CAUS_C), msk.get(F20_DESC_C), contro, FALSE, FALSE, TRUE);
contro.get(msk, F20_CONTROG_A, F20_CONTROC_A, F20_CONTROS_A);
TImporto bil_eur = movs.save(adozione, msk.get(F20_CAUS_A), msk.get(F20_DESC_A), contro, TRUE, TRUE, FALSE);
TImporto bil_eur = sd._movs.save(adozione, msk.get(F20_CAUS_A), msk.get(F20_DESC_A), contro, TRUE, TRUE, FALSE);
TBill arrotino;
arrotino.get(msk, F20_DIFF_G, F20_DIFF_C, F20_DIFF_S);
@ -402,7 +476,8 @@ void TEuro02_app::main_loop()
if (!bil_eur.is_zero())
{
TCG_mov mov;
TCG_mov mov;
bil_eur.swap_section();
mov.add(arrotino, bil_eur);
mov.save(adozione, msk.get(F20_CAUS_A), msk.get(F20_DESC_A), contro, TRUE, FALSE, FALSE);
}

View File

@ -30,12 +30,13 @@ struct TChiusura_data
class TEuro03_app : public TEuro_app
{
protected:
virtual bool create();
virtual void main_loop();
public:
void close_saldi_prec(const TDate& dc);
void scan_saldi(int indbil, record_handler rh, void* jolly);
void salva_movimento_lit(const real& imp, const TBill& c1, const TBill& c2, TChiusura_data& data);
void salva_movimento_lit(const real& imp, const TBill& c1, const TBill& c2,
TChiusura_data& data, const TString& desc);
void salva_movimento_eur(const real& imp, const TBill& c1, const TBill& c2,
TChiusura_data& data, const TString& desc);
@ -95,13 +96,15 @@ void TEuro30_mask::on_firm_change()
set(F30_DATI, dati);
set(F30_DATIE, datie);
TEsercizi_contabili esc;
set(F30_DATA_A, apertura);
set(F30_ANNO_A, apertura.year());
set(F30_ANNO_A, esc.date2esc(apertura));
chiusura = apertura; --chiusura;
set(F30_DATA_C, chiusura);
set(F30_ANNO_C, chiusura.year());
set(F30_ANNO_C, esc.date2esc(chiusura));
if (!adotta || !inizio)
{
disable(DLG_OK);
@ -159,18 +162,29 @@ void TEuro30_mask::on_firm_change()
// Main
///////////////////////////////////////////////////////////
bool TEuro03_app::create()
void TEuro03_app::close_saldi_prec(const TDate& dc)
{
set_firm();
bool ok = goto_lire(get_firm());
if (ok)
ok = TSkeleton_application::create();
return ok;
TEsercizi_contabili esc;
const int annoes = esc.date2esc(dc);
TLocalisamfile saldilit(LF_SALDI); // Apre tracciati file!
TEuroisamfile saldi(LF_SALDI, TRUE);
for (int err = saldi.first(); err == NOERR; err = saldi.next())
{
const int anno = saldi.get_int(SLD_ANNOES);
if (anno == annoes)
{
saldi.put(SLD_SALDOFIN, saldi.get(SLD_SALDO));
saldi.put(SLD_FLAGSALFIN, saldi.get_char(SLD_FLAGSALINI) == 'A' ? 'D' : 'A');
saldi.rewrite();
}
if (anno > annoes)
break;
}
}
void TEuro03_app::scan_saldi(int indbil, record_handler rh, void* jolly)
{
const TChiusura_data& data = *(TChiusura_data*)jolly;
TChiusura_data& data = *(TChiusura_data*)jolly;
TRelation rel(LF_SALDI);
TRectype& rec = rel.curr();
@ -179,7 +193,7 @@ void TEuro03_app::scan_saldi(int indbil, record_handler rh, void* jolly)
const long items = cur.items();
cur.freeze();
TString caption;
caption << "Scansione saldi dell'anno " << data._anno_c
<< " con indicatore di bilancio " << indbil;
@ -215,7 +229,7 @@ HIDDEN bool saldi_handler(TRectype& rec, void* jolly)
const long s = rec.get_long(SLD_SOTTOCONTO);
const int indbil = data._movs.indbil(g, c);
TSaldo sld;
TSaldo sld; // Incrociare le dita: si usa l'oggetto TSaldo
sld.ultima_immissione_bilancio(data._anno_c, g, c, s, indbil, 1);
real saldo = sld.saldo();
@ -238,36 +252,40 @@ HIDDEN bool saldi_handler(TRectype& rec, void* jolly)
void TEuro03_app::chiusura_costi(TChiusura_data& data)
{
scan_saldi(3, saldi_handler, &data);
data._movs.mov(3).save(data._data_c, data._caus_c, EMPTY_STRING,
const TString desc = "Chiusura costi";
data._movs.mov(3).save(data._data_c, data._caus_c, desc,
data._proper, FALSE, FALSE, FALSE);
}
void TEuro03_app::chiusura_ricavi(TChiusura_data& data)
{
scan_saldi(4, saldi_handler, &data);
data._movs.mov(4).save(data._data_c, data._caus_c, EMPTY_STRING,
const TString desc = "Chiusura ricavi";
data._movs.mov(4).save(data._data_c, data._caus_c, desc,
data._proper, FALSE, FALSE, FALSE);
}
void TEuro03_app::salva_movimento_lit(const real& imp, const TBill& c1, const TBill& c2, TChiusura_data& data)
void TEuro03_app::salva_movimento_lit(const real& imp, const TBill& c1, const TBill& c2,
TChiusura_data& data, const TString& desc)
{
TImporto i1('D', imp); i1.normalize();
TCG_mov mov;
mov.add(c1, i1);
mov.save(data._data_c, data._caus_c, EMPTY_STRING, c2, FALSE, FALSE, FALSE);
mov.save(data._data_c, data._caus_c, desc, c2, FALSE, FALSE, FALSE);
}
void TEuro03_app::chiusura_conto_economico(TChiusura_data& data)
{
{
const TString desc = "Chiusura conto economico";
if (data._totale_saldo > 0)
{
salva_movimento_lit(data._totale_saldo, data._pereco, data._proper, data);
salva_movimento_lit(data._totale_saldo, data._perpat, data._pereco, data);
salva_movimento_lit(data._totale_saldo, data._pereco, data._proper, data, desc);
salva_movimento_lit(data._totale_saldo, data._perpat, data._pereco, data, desc);
}
else
{
salva_movimento_lit(data._totale_saldo, data._utieco, data._proper, data);
salva_movimento_lit(data._totale_saldo, data._utipat, data._utieco, data);
salva_movimento_lit(data._totale_saldo, data._utieco, data._proper, data, desc);
salva_movimento_lit(data._totale_saldo, data._utipat, data._utieco, data, desc);
}
}
@ -289,20 +307,26 @@ void TEuro03_app::chiusura_passivita(TChiusura_data& data)
void TEuro03_app::chiusura_conti_ordine(TChiusura_data& data)
{
scan_saldi(5, saldi_handler, &data);
data._movs.mov(5).save(data._data_c, data._caus_c, EMPTY_STRING,
data._bilchi, FALSE, FALSE, FALSE);
// scan_saldi(5, saldi_handler, &data);
const TImporto saldo = data._movs.mov(5).calc_bil(FALSE, FALSE);
if (!saldo.is_zero())
{
const TString desc = "Chiusura conti d'ordine";
data._movs.mov(5).save(data._data_c, data._caus_c, desc,
data._bilchi, FALSE, FALSE, FALSE);
}
}
void TEuro03_app::chiusura_conto_patrimoniale(TChiusura_data& data)
{
const TString desc = "Chiusura conto patrimoniale";
if (data._totale_saldo > 0)
{
salva_movimento_lit(data._totale_saldo, data._utipat, data._bilchi, data);
salva_movimento_lit(data._totale_saldo, data._utipat, data._bilchi, data, desc);
}
else
{
salva_movimento_lit(data._totale_saldo, data._perpat, data._bilchi, data);
salva_movimento_lit(data._totale_saldo, data._perpat, data._bilchi, data, desc);
}
}
@ -331,9 +355,13 @@ TImporto TEuro03_app::apertura_passivita(TChiusura_data& data)
void TEuro03_app::apertura_conti_ordine(TChiusura_data& data)
{
const TString desc = "Apertura conti d'ordine";
data._movs.mov(5).save(data._data_a, data._caus_a, desc,
data._difarr, TRUE, TRUE, TRUE);
const TImporto saldo = data._movs.mov(5).calc_bil(TRUE, FALSE);
if (!saldo.is_zero())
{
const TString desc = "Apertura conti d'ordine";
data._movs.mov(5).save(data._data_a, data._caus_a, desc,
data._difarr, TRUE, TRUE, TRUE);
}
}
///////////////////////////////////////////////////////////
@ -341,7 +369,10 @@ void TEuro03_app::apertura_conti_ordine(TChiusura_data& data)
///////////////////////////////////////////////////////////
void TEuro03_app::main_loop()
{
{
goto_lire();
set_firm();
TEuro30_mask msk;
msk.on_firm_change();
if (msk.run() == K_ENTER)
@ -365,6 +396,9 @@ void TEuro03_app::main_loop()
data._difarr.get(msk, F30_DIFARR_G, F30_DIFARR_C, F30_DIFARR_S);
save_round_bill(data._difarr);
// Scandisco i conti d'ordine fintanto che sono puliti!
scan_saldi(5, saldi_handler, &data);
data._totale_saldo = ZERO;
chiusura_costi(data);
chiusura_ricavi(data);
@ -375,15 +409,16 @@ void TEuro03_app::main_loop()
chiusura_passivita(data);
chiusura_conti_ordine(data);
close_saldi_prec(data._data_c); // Simula chiusura anche area euro
TImporto bilancio;
bilancio += apertura_attivita(data);
bilancio += apertura_passivita(data);
apertura_conti_ordine(data); // La cui somma DEVE essere a ZERO (Per non devo sommarla)
apertura_conti_ordine(data); // La cui somma DEVE essere a ZERO
// Apertura capitale netto
if (!bilancio.is_zero())
{
const TString desc = "Apertura capitale netto";
const TString desc = "Rilevazione arrotondamenti";
bilancio.normalize('D');
salva_movimento_eur(bilancio.valore(), data._bilape, data._difarr, data, desc);
}

View File

@ -97,13 +97,20 @@ class TNum_data : public TObject
bool TEuro04_app::create()
{
bool ok = goto_lire(get_firm());
goto_lire();
if (!set_firm())
return FALSE;
const long ditta = get_firm();
if (!dbf_exists(LF_DOC, TRUE))
return error_box("Non esistono gli archivi della ditta %ld nell'area in Euro", ditta);
TEuro_app::create();
open_files(LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART,
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON,
LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, 0);
if (ok)
ok = TSkeleton_application::create();
return ok;
return TRUE;
}
static bool doc_handler(TRectype& rec, void* jolly)

View File

@ -18,7 +18,6 @@
class TEuro05_app : public TEuro_app
{
protected:
virtual bool create();
virtual void main_loop();
void convert_last_mag_eser(int eser);
void convert_last_sto_eser(int eser);
@ -32,14 +31,6 @@ inline TEuro05_app& app() { return (TEuro05_app&)main_app(); }
// Main
///////////////////////////////////////////////////////////
bool TEuro05_app::create()
{
bool ok = goto_lire(get_firm());
if (ok)
ok = TSkeleton_application::create();
return ok;
}
void TEuro05_app::convert_last_mag_eser(int eser)
{
// Cursore su file in lire
@ -79,6 +70,7 @@ void TEuro05_app::convert_last_mag_eser(int eser)
pi.addstatus(1);
receur = curr;
convert_import(receur, fields);
zero_import(receur, "ORDC|VALORDC|ORDF|VALORDF");
fileur.write();
}
}
@ -124,9 +116,18 @@ void TEuro05_app::convert_last_sto_eser(int eser)
}
void TEuro05_app::main_loop()
{
{
goto_lire();
if (!set_firm())
return;
const long firm = get_firm();
if (!dbf_exists(LF_MAG, TRUE))
{
error_box("Non esistono gli archivi della ditta %ld nell'area in Euro", firm);
return;
}
TDate apertura(1,1,2002);
const long firm = get_firm();
TFilename dati, datie;
get_aree_dati(dati, datie);

View File

@ -65,22 +65,18 @@ bool TArticolo_euro::adjust_storico(const int anno)
*tot -= val;
}
for (i = 1; i <= sto_items; i++)
for (i = 1; i <= mag_items; i++)
{
TRectype & rec = s[i];
TString16 codmag(rec.get(STOMAG_CODMAG));
real val = rec.get_real(STOMAG_VALORE);
real qta = rec.get_real(STOMAG_QUANT);
val *= qta;
TRectype & rec = m[i];
TString16 codmag(rec.get(MAG_CODMAG));
real val = rec.get_real(MAG_VALRIM);
real * corr = (real *)values.objptr(codmag);
if (corr != NULL & *corr != ZERO)
{
corr->round(TCurrency::get_firm_dec(FALSE));
val -= *corr;
val /= qta;
val.round(TCurrency::get_firm_dec(TRUE));
rec.put(STOMAG_VALORE, val);
val += *corr;
rec.put(MAG_VALRIM, val);
updated = TRUE;
*corr = ZERO;
}
@ -97,7 +93,6 @@ class TEuro06_app : public TEuro_app
{
protected:
virtual bool create();
virtual bool destroy();
virtual void main_loop();
void update_stomag();
@ -111,20 +106,16 @@ inline TEuro06_app& app() { return (TEuro06_app&)main_app(); }
///////////////////////////////////////////////////////////
bool TEuro06_app::create()
{
bool ok = goto_euro(get_firm());
open_files(LF_STOMAG, LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART,
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON,
LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0);
if (ok)
ok = TSkeleton_application::create();
return ok;
}
{
if (!dbf_exists(LF_ANAMAG) || !dbf_exists(LF_STOMAG) || !dbf_exists(LF_MOVMAG))
return FALSE;
bool TEuro06_app::destroy()
{
goto_lire(get_firm());
return TSkeleton_application::destroy();
TEuro_app::create();
bool ok = goto_euro(get_firm());
open_files(LF_TAB, LF_TABCOM, LF_STOMAG, LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, 0);
open_files(LF_SCONTI, LF_UMART, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON, 0);
open_files(LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0);
return ok;
}
void TEuro06_app::update_stomag()
@ -187,8 +178,8 @@ void TEuro06_app::main_loop()
const int annoes = esc.date2esc(apertura);
TString16 codes; codes << annoes;
rebuild_balances(codes);
update_stomag();
rebuild_balances(codes);
}
else
if (command == "D")
@ -219,8 +210,6 @@ void TEuro06_app::main_loop()
real change = curr_doc.get_real(DOC_CAMBIO);
change.round(dec);
curr_doc.put(DOC_CAMBIO, change);
const int err = curr_doc.rewrite();
}
}
else
@ -228,11 +217,11 @@ void TEuro06_app::main_loop()
{
curr_doc.dirty_fields();
curr_doc.put(DOC_CONTROEURO, "");
const int err = curr_doc.rewrite();
}
}
real tot = curr_doc.totale_doc();
curr_doc.dirty_fields();
curr_doc.rewrite();
}
}
}

View File

@ -59,7 +59,7 @@ bool TInventario_euro::goto_lire(long ditta)
bool TInventario_euro::create()
{
goto_lire();
return TStampa_inventario:: create();
return TStampa_inventario::create();
}
void TInventario_euro::set_def_valuta(TForm_inventario & f)

View File

@ -1,4 +1,5 @@
#include <automask.h>
#include <execp.h>
#include <saldi.h>
@ -14,7 +15,8 @@
class TApertura_saldi_euro : public TEuro_app
{
protected:
protected:
bool has_movs() const;
void convert_saldi(const TDate& adozione, const TBill& arrotino);
public:
@ -124,8 +126,8 @@ static bool saldi_handler(TRectype& rec, void* jolly)
saldo.normalize();
rec.put(SLD_FLAGSALINI, saldo.sezione());
rec.put(SLD_SALDO, saldo.valore());
convert_import(rec, "SALDO|FLAGSALFIN|SALDOFIN");
zero_import(rec, "PDARE|PAVERE|PDAREPRO|PAVEREPRO");
convert_import(rec, "SALDO");
zero_import(rec, "PDARE|PAVERE|PDAREPRO|PAVEREPRO|FLAGSALFIN|SALDOFIN|DATAULMOV|NUMULTMOV");
sld._sld += TImporto(saldo.sezione(), rec.get_real(SLD_SALDO)); // Somma saldo in euro
return TRUE;
}
@ -165,8 +167,16 @@ void TApertura_saldi_euro::convert_saldi(const TDate& adozione, const TBill& arr
}
}
bool TApertura_saldi_euro::has_movs() const
{
TEuroisamfile s(LF_MOV, TRUE);
int err = s.first();
return err == NOERR;
}
void TApertura_saldi_euro::main_loop()
{
goto_lire();
if (set_firm())
{
TEuro90_mask m;
@ -176,12 +186,22 @@ void TApertura_saldi_euro::main_loop()
m.set(F11_DATI, lit);
m.set(F11_DATIE, eur);
m.on_firm_change();
while (m.run() == K_ENTER)
if (m.run() == K_ENTER)
{
const bool was_full = has_movs();
TDate adozione = m.get(F11_ADOZIONE);
TBill arrotino;
arrotino.get(m, F11_DIFF_G, F11_DIFF_C, F11_DIFF_S);
convert_saldi(adozione, arrotino);
if (was_full && yesno_box("Esistono movimenti contabili:\nSi desidera ricalcolare i saldi?"))
{
goto_euro();
TExternal_app app("cg4 -0");
app.run();
goto_lire();
}
}
}
}

View File

@ -1,9 +1,10 @@
#define F03_DITTE 201
#define F10_DITTA 201
#define F10_RAGSOC 202
#define F10_DITTE 203
#define S03_SEL 101
#define S03_DITTA 102
#define S03_RAGSOC 103
#define S03_NOTE 104
#define S10_DITTA 101
#define S10_RAGSOC 102
#define S10_NOTE 103

View File

@ -16,13 +16,25 @@ ENDPAGE
PAGE "Selezione Ditte" 0 0 80 018
SPREADSHEET F03_DITTE
NUMBER F10_DITTA 5
BEGIN
PROMPT 0 1 ""
ITEM "@1"
PROMPT 1 1 "Ditta da convertire "
CHECKTYPE REQUIRED
WARNING "Specificare una ditta tra quelle elencate di seguito"
END
STRING F10_RAGSOC 50
BEGIN
PROMPT 28 1 ""
FLAGS "D"
END
SPREADSHEET F10_DITTE
BEGIN
PROMPT 0 2 ""
ITEM "Ditta"
ITEM "Ragione Sociale@50"
ITEM "Note@30"
ITEM "Note@50"
END
ENDPAGE
@ -31,23 +43,18 @@ ENDMASK
PAGE "Ditta" -1 -1 64 6
BOOLEAN S03_SEL
BEGIN
PROMPT 1 1 "Richiesta conversione"
END
NUMBER S03_DITTA 5
NUMBER S10_DITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "D"
END
STRINGA S03_RAGSOC 50
STRINGA S10_RAGSOC 50
BEGIN
PROMPT 1 3 "Rag. Soc. "
END
STRING S03_NOTE 50
STRING S10_NOTE 50
BEGIN
PROMPT 1 4 "Note "
END

View File

@ -9,10 +9,13 @@
#define F11_DIFF_S 203
#define F11_DIFF_D 204
#define F11_COPY 301
#define F11_SALDI 302
#define F11_PARTITE 303
#define F11_VENDITE 304
#define F11_MAGAZZINO 305
#define F11_COPY 301
#define F11_SALDI 302
#define F11_PARTITE 303
#define F11_VENDITE 304
#define F11_MAGAZZINO 305
#define F11_PERCIPIENTI 306
#define F11_CESPITI 307
#define F11_SOLOAPERTE 308

View File

@ -59,6 +59,7 @@ BEGIN
DISPLAY "Fine Esercizio" D1
OUTPUT F11_ADOZIONE D0
CHECKTYPE SEARCH
ADD NONE
END
GROUPBOX DLG_NULL 78 3
@ -91,8 +92,8 @@ BEGIN
OUTPUT F11_DIFF_C CONTO
OUTPUT F11_DIFF_S SOTTOCONTO
OUTPUT F11_DIFF_D DESCR
CHECKTYPE REQUIRED
WARNING "E' necessario specificare il conto per gli arrotondamenti"
CHECKTYPE NORMAL
WARNING "Specificare il conto per gli arrotondamenti valido"
ADD RUN cg0 -0
END
@ -106,12 +107,12 @@ BEGIN
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F11_DIFF_S
CHECKTYPE REQUIRED
CHECKTYPE NORMAL
WARNING "E' necessario specificare il conto per gli arrotondamenti"
ADD RUN cg0 -0
END
GROUPBOX DLG_NULL 78 7
GROUPBOX DLG_NULL 78 8
BEGIN
PROMPT 1 10 "@bOperazioni"
END
@ -119,31 +120,46 @@ END
BOOLEAN F11_COPY
BEGIN
PROMPT 2 11 "Copia e conversione ditta da lire ad euro"
GROUP 1
GROUP 1
MESSAGE TRUE "X",2@|DISABLE,2@
MESSAGE FALSE RESET,2@|ENABLE,2@
END
BOOLEAN F11_SALDI
BEGIN
PROMPT 2 12 "Apertura saldi esercizio precedente in euro"
GROUP 1
GROUP 1 2
END
BOOLEAN F11_PARTITE
BEGIN
PROMPT 2 13 "Copia e conversione partite aperte"
GROUP 1
GROUP 1 2
END
BOOLEAN F11_VENDITE
BEGIN
PROMPT 2 14 "Conversione documenti di vendita"
GROUP 1
PROMPT 2 14 "Azzeramento documenti e conversione anagrafiche di vendita"
GROUP 1 2
END
BOOLEAN F11_MAGAZZINO
BEGIN
PROMPT 2 15 "Conversione Magazzino"
GROUP 1
GROUP 1 2
END
BOOLEAN F11_PERCIPIENTI
BEGIN
PROMPT 2 16 "Conversione Percipienti"
GROUP 1 2
MESSAGE TRUE ENABLE,F11_SOLOAPERTE
MESSAGE FALSE CLEAR,F11_SOLOAPERTE
END
BOOLEAN F11_SOLOAPERTE
BEGIN
PROMPT 42 16 "Converti solo le schede aperte"
END
ENDMASK

View File

@ -113,12 +113,10 @@ Picture = <ba00.bmp>
Module = 0
Item_01 = "Creazione nuova area dati in Euro", "baeur -0"
Item_02 = "Conversione ditte in Euro", "baeur -1"
Item_03 = "Ricalcolo saldi Lire/Euro", "baeur -9", "F"
Item_04 = "Conversione saldi infrannuale", "baeur -2", "F"
Item_05 = "Chiusura/Apertura in Euro", "baeur -3", "F"
Item_06 = "Conversione documenti", "baeur -4", "F"
Item_07 = "Apertura magazzino", "baeur -5", "F"
Item_08 = "Stampe magazzino",[PRASSI_884], ""
Item_03 = "Chiusura/Apertura in Euro", "baeur -3", "F"
Item_04 = "Apertura magazzino", "baeur -5", "F"
Item_05 = "Stampe magazzino",[PRASSI_884], ""
Item_06 = "Manutenzione",[PRASSI_885], ""
[PRASSI_884]
Caption = "Stampe magazzino in Euro"
@ -127,6 +125,16 @@ Module = 32
Item_01 = "Stampa inventario", "baeur -7"
Item_02 = "Stampa storico", "baeur -8"
[PRASSI_885]
Caption = "Manutenzione"
Picture = <ba00.bmp>
Module = 0
Item_01 = "Ricalcolo saldi Lire/Euro", "baeur -9", "F"
Item_02 = "Conversione saldi infrannuale", "baeur -2", "FP"
Item_03 = "Conversione documenti", "baeur -4", "F"
Item_04 = "Copia area dati Lire", "ba7 -1", "F"

View File

@ -2,12 +2,10 @@
Caption = "Amministrazione"
Picture = <cg00.bmp>
Module = 0
Item_01 = "Contabilita' semplificata", <csprassi.men>
Item_02 = "Contabilita' generale", <cgprassi.men>
Item_04 = "Gestione cespiti", "cesp -t /cPRAWIN.INI", ""
Item_05 = "Gestione percipienti", <77prassi.men>
Item_06 = "Contabilita analitica", <procomm.men>
Item_07 = "Bilanci e Analisi", <abprassi.men>
Item_08 = "Dichiarazione IVA", "miva -t", ""
Item_09 = "Elenchi INTRA comunitari", <inprassi.men>
Item_01 = "Contabilita' generale", <cgprassi.men>
Item_02 = "Gestione cespiti", "cesp -t /cPRAWIN.INI", ""
Item_03 = "Gestione percipienti", <77prassi.men>
Item_04 = "Contabilita analitica", <procomm.men>
Item_05 = "Bilanci e Analisi", <abprassi.men>
Item_06 = "Elenchi INTRA comunitari", <inprassi.men>

View File

@ -174,6 +174,7 @@ protected:
virtual bool protected_record(TRectype& rec);
virtual void init_query_mode(TMask& m);
virtual void init_query_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
};
TString& TCEtables::get_mask_name(TString& name) const
@ -263,8 +264,14 @@ void TCEtables::init_query_mode(TMask& m)
{
if (get_tabname() == "CCE")
{
m.show(F_CODESER,TRUE);
m.show(F_CODESERCONT,FALSE);
// m.show(F_CODESER,TRUE);
// m.show(F_CODESERCONT,FALSE);
m.disable(DLG_ATTIV);
}
if (get_tabname() == "CCB")
{
m.show(F_CODSP_CCB,TRUE);
m.show(F_CODATT_CCB,FALSE);
}
}
@ -272,8 +279,21 @@ void TCEtables::init_query_insert_mode(TMask& m)
{
if (get_tabname() == "CCE")
{
m.show(F_CODESER,FALSE);
m.show(F_CODESERCONT,TRUE);
// m.show(F_CODESER,FALSE);
// m.show(F_CODESERCONT,TRUE);
}
if (get_tabname() == "CCB")
{
m.show(F_CODSP_CCB,FALSE);
m.show(F_CODATT_CCB,TRUE);
}
}
void TCEtables::init_modify_mode(TMask& m)
{
if (get_tabname() == "CCE")
{
m.enable(DLG_ATTIV);
}
}

View File

@ -29,25 +29,6 @@ bool CE0_App::user_create( )
}
return TRUE;
}
/*
bool CE0_App::preprocess_config (TMask& mask, TConfig& config)
{
if (_current == 'P')
{
TTable tab("CCE");
for (int err = tab.first() ; err == NOERR; err = tab.next())
{
if (tab.get_bool("B6"))
{
mask.set(F_ESERCORR,tab.get("CODTAB"));
break;
}
}
}
return TRUE;
}
*/
int ce0400 (int argc, char* argv[])
{

View File

@ -1,39 +1,277 @@
#include <automask.h>
#include <defmask.h>
#include <recarray.h>
#include <relapp.h>
#include <sheet.h>
#include <utility.h>
#include "ce0.h"
#include "ce2101.h"
#include "celib.h"
#include "ce0500a.h"
#include "../cg/cglib01.h"
#include "cespi.h"
#include "salce.h"
#include "ammce.h"
class TQuery_mask : public TAutomask
{
{
int _staat;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void on_search_event(TOperable_field& o);
int calcola_stato_attivita();
bool cespite_ok() const;
public:
TQuery_mask() : TAutomask("ce0500a") { }
int stato_attivita() const { return _staat; }
TQuery_mask();
};
void TQuery_mask::on_search_event(TOperable_field& o)
{
TToken_string order, fields, header;
if (o.dlg() >= F_SEARCH3)
{
order.add(CESPI_STABILIM); header.add("Stabilimento");
order.add(CESPI_REPARTO); header.add("Reparto@10");
}
if (o.dlg() >= F_SEARCH2)
{
order.add(CESPI_CODIMP); header.add("Impianto@10");
}
if (o.dlg() >= F_SEARCH1)
{
order.add(CESPI_CODCAT); header.add("Cat");
order.add(CESPI_DTCOMP); header.add("Data Acq.@10");
}
order.add(CESPI_IDCESPITE); header.add("Codice@10");
fields = order;
fields.add(CESPI_DESC); header.add("Descrizione@50");
TRelation rel(LF_CESPI);
TString filter;
if (!field(F_IMPIANTO).empty())
filter << CESPI_CODIMP << "==" << get(F_IMPIANTO);
TSorted_cursor cur(&rel, order, filter);
TCursor_sheet sht(&cur, fields, "Cespiti", header, 0, 1);
if (sht.run() == K_ENTER)
{
TToken_string& row = sht.row();
const int cod_pos = row.items()-2;
set(F_IDCESPITE, row.get(cod_pos), TRUE);
stop_run(K_AUTO_ENTER);
}
}
int TQuery_mask::calcola_stato_attivita()
{
const int ese = get_int(F_ESERCIZIO);
const int gru = get_int(F_GRUPPO);
const char* spe = get(F_SPECIE);
TString16 str;
str.format("%04d%02d%-4s", ese, gru, spe);
const TRectype& curr_ccb = cache().get("CCB", str);
if (curr_ccb.get_bool("B1")) // Bollato stampato
_staat = 3;
else
{
TEsercizi_contabili esc;
str.format("%04d%02d%-4s", esc.pred(ese), gru, spe);
const TRectype& prev_ccb = cache().get("CCB", str);
_staat = prev_ccb.get_bool("B1") ? 2 : 1;
}
TDitta_cespiti& dc = ditta_cespiti();
dc.set_attivita(ese, gru, spe);
return _staat;
}
bool TQuery_mask::cespite_ok() const
{
TLocalisamfile cespi(LF_CESPI);
cespi.put(CESPI_IDCESPITE, get(F_IDCESPITE));
bool ok = cespi.read() == NOERR;
return ok;
}
bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_ESERCIZIO:
case F_GRUPPO:
case F_SPECIE:
if (e == fe_init || e == fe_modify)
{
const bool can_create = calcola_stato_attivita() != 3; // Bollato non stampato
enable(DLG_NEWREC, can_create && !field(F_CATEGORIA).empty());
enable(DLG_DELREC, can_create);
}
break;
case F_SEARCH1:
case F_SEARCH2:
case F_SEARCH3:
if (e == fe_button)
on_search_event(o);
break;
case F_CATEGORIA:
case F_DESC_CAT:
{
TDitta_cespiti& dc = ditta_cespiti();
bool ok = dc.on_category_event(o, e, jolly);
if (ok)
{
if (e == fe_modify && !o.empty() && stato_attivita() == 2)
{
const TRectype& cac = dc.categoria(0, NULL, get_int(F_CATEGORIA));
const int fine_validita = cac.get_date("D1").year();
if (fine_validita > 0 && fine_validita < get_int(F_ESERCIZIO))
return error_box("Categoria scaduta nell'esercizio %d", fine_validita);
}
if (e == fe_init || e == fe_modify)
{
const bool bollati = stato_attivita() == 3;
enable(DLG_NEWREC, !bollati && !o.empty());
}
if (e == fe_close && o.empty() && !cespite_ok())
return error_box("È necessario specificare la categoria del nuovo cespite");
}
}
break;
case F_IDCESPITE:
case F_IDCESPITE_I:
if (e == fe_close)
{
if (stato_attivita() == 3 && !cespite_ok())
return error_box("E' stato stampato il bollato dell'anno:\nnon sono permessi inserimenti");
}
if (e == fe_modify && !o.empty() && cespite_ok())
{
TLocalisamfile salce(LF_SALCE);
salce.put(SALCE_IDCESPITE, get(F_IDCESPITE));
salce.put(SALCE_CODES, get(F_ESERCIZIO));
salce.put(SALCE_TPSALDO, 1);
if (salce.read() != NOERR)
return yesno_box("Non esistono saldi per l'anno selezionato:\nSi desidera continuare ugualmente?");
}
break;
default:
break;
}
return TRUE;
}
TQuery_mask::TQuery_mask() : TAutomask("ce0500a")
{
first_focus(F_IDCESPITE);
}
class TEdit_mask : public TAutomask
{
TTipo_cespite _tipo;
int _staat;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
void set_stato_attivita(int sa) { _staat = sa; }
int stato_attivita() const { return _staat; }
void set_tipo_cespite(TTipo_cespite tc) { _tipo = tc; }
TTipo_cespite tipo_cespite() const { return _tipo; }
TEdit_mask() : TAutomask("ce0500b") { }
};
bool TEdit_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
return TRUE;
{
bool ok = TRUE;
switch (o.dlg())
{
case F_CATEGORIA:
if (e == fe_init)
{
TDitta_cespiti& dc = ditta_cespiti();
dc.on_category_event(o, e, jolly);
}
break;
case F_DTCOMP:
if (e == fe_modify || e == fe_close)
{
const TDate dtcomp = o.get();
TDitta_cespiti& dc = ditta_cespiti();
TDate iniz, fine;
const int ese = dc.esercizio_corrente(iniz, fine);
if (insert_mode() && stato_attivita() == 2)
{
if (dtcomp < iniz)
return error_box("La data appartiene ad un esercizio già stampato su bollato");
const TRectype& cac = dc.categoria(0, NULL, get_int(F_CATEGORIA));
iniz = cac.get("D0");
if (iniz.ok() && dtcomp < iniz)
return error_box("La data è precedente all'inizio della validità della categoria");
fine = cac.get("D1");
if (fine.ok() && dtcomp > fine)
return error_box("La data è succesiva alla fine della validità della categoria");
}
if (dc.esercizio_costituzione() && dtcomp < iniz)
return error_box("Non è possibile specificare una data antecedente all'eserczio di costituzione");
}
break;
case F_DTFUNZ:
if (e == fe_modify || e == fe_close)
{
TDitta_cespiti& dc = ditta_cespiti();
const TDate dtcomp = field(F_DTCOMP).get();
const TDate dtfunz = o.get();
if (dtfunz < dtcomp)
return error_box("La data di entrata in funzione deve essere successiva a quella di aquisizione");
if (dtfunz.ok() && !dtcomp.ok())
return error_box("La data di entrata in funzione non puo' essere inserita senza specificare quella di aquisizione");
if (_tipo != tc_materiale && dtfunz != dtcomp)
{
if (dtcomp.year() >= dc.anno_tuir())
return error_box("In base alla normativa del TUIR, le date di acquisizione e di entrata in funzione devono coincidere");
}
if (dtfunz.ok())
{
const TRectype& cac = dc.categoria(0, NULL, get_int(F_CATEGORIA));
const TDate iniz = cac.get("D0");
if (iniz.ok() && dtfunz < iniz)
return error_box("La data è precedente all'inizio della validità della categoria");
const TDate fine = cac.get("D1");
if (fine.ok() && dtcomp > fine)
return error_box("La data è succesiva alla fine della validità della categoria");
set(F_TUIR, dtfunz.year() >= dc.anno_tuir() ? "X" : "");
}
}
break;
default:
break;
}
return ok;
}
class TAnacespi : public TRelation_application
{
TRelation* _cespiti;
int _rel_year;
TQuery_mask* _qmask;
TEdit_mask* _emask;
@ -47,6 +285,17 @@ protected:
virtual TMask* get_mask(int mode);
// @cmember Ritorna la relazione da modificare
virtual TRelation* get_relation() const;
void protect_fields(TMask& m, TToken_string& enabling) const;
void init_mask(TMask& m);
virtual const char* get_next_key();
virtual bool protected_record(TRectype& rec);
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual int read(TMask& m);
};
bool TAnacespi::changing_mask(int)
@ -59,15 +308,177 @@ TMask* TAnacespi::get_mask(int mode)
return mode == MODE_QUERY ? (TMask*)_qmask : (TMask*)_emask;
}
// get_relation più complessa della storia di campo
TRelation* TAnacespi::get_relation() const
{
{
const int year = _qmask->get_int(F_ESERCIZIO);
TRelation*& csp = ((TAnacespi*)this)->_cespiti;
if (year != _rel_year && csp != NULL)
{
delete csp;
csp = NULL;
}
if (csp == NULL)
{
// Crea nuova relazione su cespi
csp = new TRelation(LF_CESPI);
((TAnacespi*)this)->_rel_year = year; // Memorizza anno utilizzato
// Collega salce
TString80 expr1;
expr1 << SALCE_IDCESPITE << "==" << CESPI_IDCESPITE;
if (year > 0)
expr1 << '|' << SALCE_CODES << "==" << year;
csp->add(LF_SALCE, expr1);
// Collega i tre tipi di ammce
TString80 expr2;
for (int a = 1; a <= 3; a++)
{
expr2 = expr1;
expr2 << '|' << AMMCE_TPAMM << "==" << a;
csp->add(LF_AMMCE, expr2, 1, 0, LF_AMMCE+100*(a-1));
}
// Attiva il salvataggio anche di salce e ammce
csp->write_enable();
}
return _cespiti;
}
void TAnacespi::init_query_mode(TMask& m)
{
ditta_cespiti().init_mask(m);
}
bool TAnacespi::protected_record(TRectype& rec)
{
const TDate dtalien = rec.get(CESPI_DTALIEN);
return dtalien.ok();
}
void TAnacespi::init_mask(TMask& m)
{
TDitta_cespiti& dc = ditta_cespiti();
dc.init_mask(m);
const bool can_edit = !dc.bollato_stampato() && m.field(F_DTALIEN).empty();
m.enable(DLG_SAVEREC, can_edit);
m.enable(DLG_DELREC, can_edit);
_emask->set_stato_attivita(_qmask->stato_attivita());
const TRectype& cac = dc.categoria(0, NULL, _qmask->get_int(F_CATEGORIA));
const int tc = cac.get_int("I0");
_emask->set_tipo_cespite(tc==0 ? tc_materiale : (tc==1 ? tc_immateriale : tc_pluriennale));
const bool mat_only = _emask->tipo_cespite() == tc_materiale;
m.show(F_LEASING, mat_only);
m.show(F_ANNIRIC, mat_only);
m.show(F_USATO, mat_only);
}
void TAnacespi::init_insert_mode(TMask& m)
{
init_mask(m);
m.enable(F_DTALIEN);
m.set(F_TUIR, "X");
m.set(F_SPEMAN, _emask->tipo_cespite() == tc_materiale ? 2 : 1);
m.set(F_ESCLPR, _emask->tipo_cespite() != tc_pluriennale ? "X" : "");
}
void TAnacespi::protect_fields(TMask& m, TToken_string& enabling) const
{
for (int f = m.fields()-1; f >= 0; f--)
{
TMask_field& fld = m.fld(f);
const short id = fld.dlg();
if (id > 100 && id < 1000 && fld.is_editable() && fld.enabled_default())
{
const bool on = enabling.empty() || enabling.get_pos(fld.dlg()) >= 0;
fld.enable(on);
}
}
}
void TAnacespi::init_modify_mode(TMask& m)
{
init_mask(m);
m.disable(F_DTALIEN);
TDitta_cespiti& dc = ditta_cespiti();
TDate iniz, fine;
const int ese = dc.esercizio_corrente(iniz, fine);
const TDate dtacq = m.get(F_DTCOMP);
const TDate dtfunz = m.get(F_DTFUNZ);
TToken_string enabling;
switch (_qmask->stato_attivita())
{
case 2:
if (dtacq.ok())
{
if (dtacq < iniz)
{
if (!dtfunz.ok() || dtfunz >= iniz)
{
enabling.add(F_DTFUNZ);
enabling.add(F_SPEMAN);
enabling.add(F_USOPROM);
}
else
{
enabling.add(F_SPEMAN);
enabling.add(F_USOPROM);
}
}
}
else
{
if (!dtfunz.ok())
{
enabling.add(F_DTCOMP);
enabling.add(F_DTFUNZ);
enabling.add(F_SPEMAN);
enabling.add(F_USOPROM);
}
}
break;
case 3:
if (!dtfunz.ok() || dtfunz >= iniz)
{
enabling.add(F_DTFUNZ);
}
break;
default:
break;
}
protect_fields(m, enabling);
}
const char* TAnacespi::get_next_key()
{
real num = 1;
TLocalisamfile cespi(LF_CESPI);
if (cespi.last() == NOERR)
num = cespi.get_real(CESPI_IDCESPITE) + 1;
return format("%d|%s", F_IDCESPITE, num.string());
}
int TAnacespi::read(TMask& m)
{
int err = TRelation_application::read(m);
return err;
}
bool TAnacespi::user_create()
{
open_files(LF_TABCOM, LF_TAB, LF_CESPI, LF_SALCE, 0);
_cespiti = new TRelation(LF_CESPI);
open_files(LF_TABCOM, LF_TAB, LF_CESPI, LF_SALCE, LF_AMMCE, 0);
_cespiti = NULL;
_rel_year = 0;
_qmask = new TQuery_mask;
_emask = new TEdit_mask;
return TRUE;
@ -75,9 +486,9 @@ bool TAnacespi::user_create()
bool TAnacespi::user_destroy()
{
delete _cespiti;
delete _emask;
delete _qmask;
delete _cespiti;
return TRUE;
}

76
ce/ce0500a.h Executable file
View File

@ -0,0 +1,76 @@
#define F_DITTA 101
#define F_RAGSOC 102
#define F_ESERCIZIO 103
#define F_INIZIO_ES 104
#define F_FINE_ES 105
#define F_SELECT 106
#define F_GRUPPO 107
#define F_SPECIE 108
#define F_DESC_GRSP 109
#define F_CATEGORIA 110
#define F_DESC_CAT 111
#define F_IMPIANTO 112
#define F_DESC_IMP 113
#define F_SEARCH1 117
#define F_SEARCH2 118
#define F_SEARCH3 119
#define F_IDCESPITE 120
#define F_DESC 121
#define F_IDCESPITE_I 122
#define F_DESC_I 123
#define F_LOCALIZZ 130
#define F_LOCALIZZ_DESC 131
#define F_DTCOMP 132
#define F_TUIR 133
#define F_DTFUNZ 134
#define F_DTALIEN 135
#define F_AMMPROP 136
#define F_ESCLPR 137
#define F_VEIDIP 138
#define F_LEASING 139
#define F_USATO 140
#define F_SPEMAN 150
#define F_VEICOLO 151
#define F_DESC_VEICOLO 152
#define F_USOPROM 153
#define F_DESC_USOPROM 154
#define F_ANNIRIC 155
#define F_ELEMENTI 202
#define F_COSTO 203
#define F_VNONAMM 204
#define F_PLUSREIN 205
#define F_RIV75 206
#define F_RIV83 207
#define F_RIV90 208
#define F_ANNI_90 209
#define F_RIV91 210
#define F_ANNI_91 211
#define F_RIVGF 212
#define F_RIVGC 213
#define F_NORMALE 302
#define F_ACCELERATO 303
#define F_ANTICIPATO 304
#define F_QPERSE 305
#define F_FPRIVATO 306
#define F_QPERSEPRIV 307
#define F_NORMALE2 402
#define F_ACCELERATO2 403
#define F_ANTICIPATO2 404
#define F_QPERSE2 405
#define F_FPRIVATO2 406
#define F_QPERSEPRIV2 407
#define F_NORMALE3 502
#define F_ACCELERATO3 503
#define F_ANTICIPATO3 504
#define F_QPERSE3 505
#define F_FPRIVATO3 506
#define F_QPERSEPRIV3 507

244
ce/ce0500a.uml Executable file
View File

@ -0,0 +1,244 @@
#include "ce0500a.h"
TOOLBAR "Toolbar" 0 -3 0 3
#include <toolbar.h>
ENDPAGE
PAGE "Anagrafica cespiti" -1 -1 78 18
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 0 1 "@bParametri ditta"
END
NUMBER F_DITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 26 2 ""
USE LF_NDITTE
INPUT CODDITTA F_DITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
FLAGS "D"
END
NUMBER F_ESERCIZIO 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "AZ"
USE CCE
JOIN ESC ALIAS 104 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Inizio esercizio" 104@->D0
DISPLAY "Fine esercizio" 104@->D1
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_INIZIO_ES 104@->D0
OUTPUT F_FINE_ES 104@->D1
CHECKTYPE REQUIRED
END
DATE F_INIZIO_ES
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "D"
END
DATE F_FINE_ES
BEGIN
PROMPT 50 3 "Fine "
FLAGS "D"
END
RADIOBUTTON F_SELECT 1 75
BEGIN
PROMPT 1 3 ""
FLAGS "Z"
ITEM "A|Attività"
MESSAGE SHOW,1@|HIDE,2@
ITEM "I|Impianto"
MESSAGE SHOW,2@|HIDE,1@
END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 1 5 "Gruppo "
FLAGS "Z"
GROUP 1
END
STRING F_SPECIE 4
BEGIN
PROMPT 16 5 "Specie "
FLAGS "_"
USE CCB
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@50" 400@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_DESC_GRSP 400@->S0
CHECKTYPE NORMAL
GROUP 1
END
STRING F_DESC_GRSP 60 45
BEGIN
PROMPT 31 5 ""
FLAGS "D"
GROUP 1
END
NUMBER F_IMPIANTO 10
BEGIN
PROMPT 1 5 "Impianto "
FLAGS "Z"
USE CIM
INPUT CODTAB F_IMPIANTO
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_IMPIANTO CODTAB
OUTPUT F_DESC_IMP S0
CHECKTYPE FORCED
GROUP 2
END
STRING F_DESC_IMP 50 45
BEGIN
PROMPT 26 5 ""
FLAGS "Z"
USE CIM KEY 2
INPUT S0 F_DESC_IMP
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@10" CODTAB
COPY OUTPUT F_IMPIANTO
CHECKTYPE REQUIRED
GROUP 2
END
NUMBER F_CATEGORIA 2
BEGIN
PROMPT 1 7 "Categoria "
FLAGS "BZ"
DRIVENBY F_GRUPPO
DRIVENBY F_SPECIE
FIELD CODCAT
WARNING "E' necessario specificare una categoria valida"
END
STRING F_DESC_CAT 60 58
BEGIN
PROMPT 16 7 ""
FLAGS "B"
DRIVENBY F_GRUPPO
DRIVENBY F_SPECIE
END
NUMBER F_IDCESPITE 10
BEGIN
PROMPT 1 8 "Cespite "
FLAGS "Z"
USE LF_CESPI SELECT (CODCGRA=#F_GRUPPO)&&(CODSPA=#F_SPECIE)
INPUT IDCESPITE F_IDCESPITE
DISPLAY "Codice@10" IDCESPITE
DISPLAY "Desc@50" DESC
DISPLAY "Cat." CODCAT
DISPLAY "Impianto@10" CODIMP
DISPLAY "Stabilimento@30" STABILIM
DISPLAY "Reparto@30" REPARTO
DISPLAY "Data Acq.@10" DTCOMP
DISPLAY "Data Ali.@10" DTALIEN
OUTPUT F_IDCESPITE IDCESPITE
OUTPUT F_DESC DESC
OUTPUT F_CATEGORIA CODCAT
CHECKTYPE REQUIRED
FIELD IDCESPITE
KEY 1
GROUP 1
END
STRING F_DESC 50
BEGIN
PROMPT 24 8 ""
USE LF_CESPI KEY 2 SELECT (CODCGRA=#F_GRUPPO)&&(CODSPA=#F_SPECIE)
INPUT DESC F_DESC
DISPLAY "Desc@50" DESC
DISPLAY "Codice@10" IDCESPITE
DISPLAY "Cat." CODCAT
DISPLAY "Impianto@10" CODIMP
DISPLAY "Stabilimento@30" STABILIM
DISPLAY "Reparto@30" REPARTO
DISPLAY "Data Acq.@10" DTCOMP
DISPLAY "Data Ali.@10" DTALIEN
COPY OUTPUT F_IDCESPITE
CHECKTYPE REQUIRED
FIELD DESC
KEY 2
GROUP 1
END
NUMBER F_IDCESPITE_I 10
BEGIN
PROMPT 1 8 "Cespite "
FLAGS "Z"
USE LF_CESPI SELECT CODIMP=#F_IMPIANTO
INPUT IDCESPITE F_IDCESPITE_I
COPY DISPLAY F_IDCESPITE
OUTPUT F_IDCESPITE_I IDCESPITE
OUTPUT F_DESC DESC_I
OUTPUT F_CATEGORIA CODCAT
CHECKTYPE REQUIRED
MESSAGE COPY F_IDCESPITE
FIELD IDCESPITE
KEY 1
GROUP 2
END
STRING F_DESC_I 50
BEGIN
PROMPT 24 8 ""
USE LF_CESPI KEY 2 SELECT CODIMP=#F_IMPIANTO
INPUT DESC F_DESC_I
COPY DISPLAY F_DESC
COPY OUTPUT F_IDCESPITE_I
CHECKTYPE REQUIRED
MESSAGE COPY F_DESC
FIELD DESC
KEY 2
GROUP 2
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 15 "@bRicerce alternative"
END
BUTTON F_SEARCH1 22 2
BEGIN
PROMPT 2 16 "Per categoria"
END
BUTTON F_SEARCH2 22 2
BEGIN
PROMPT 28 16 "Per impianto"
END
BUTTON F_SEARCH3 22 2
BEGIN
PROMPT 54 16 "Per stabilimento"
END
ENDPAGE
ENDMASK

607
ce/ce0500b.uml Executable file
View File

@ -0,0 +1,607 @@
#include "ce0500a.h"
TOOLBAR "Toolbar" 0 -3 0 3
#include <toolbar.h>
ENDPAGE
PAGE "Cespite" -1 -1 78 18
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 0 1 "@bParametri ditta"
END
NUMBER F_DITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 26 2 ""
USE LF_NDITTE
INPUT CODDITTA F_DITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
FLAGS "DG"
MESSAGE COPY,1@
END
NUMBER F_ESERCIZIO 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "DGZ"
USE ESC
INPUT CODTAB F_ESERCIZIO
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_INIZIO_ES D0
OUTPUT F_FINE_ES D1
CHECKTYPE REQUIRED
MESSAGE COPY,2@
END
DATE F_INIZIO_ES
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "DG"
MESSAGE COPY,3@
END
DATE F_FINE_ES
BEGIN
PROMPT 50 3 "Fine "
FLAGS "DG"
MESSAGE COPY,4@
END
NUMBER F_IDCESPITE 10
BEGIN
PROMPT 1 5 "Cespite "
FLAGS "DZ"
FIELD IDCESPITE
KEY 1
END
STRING F_DESC 50
BEGIN
PROMPT 26 5 ""
CHECKTYPE REQUIRED
FIELD DESC
MESSAGE COPY,5@
END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 1 6 "Gruppo "
FLAGS "DZ"
FIELD CODCGRA
END
STRING F_SPECIE 4
BEGIN
PROMPT 16 6 "Specie "
FLAGS "_DG"
USE CCB
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@50" 400@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_DESC_GRSP 400@->S0
CHECKTYPE NORMAL
FIELD CODSPA
END
STRING F_DESC_GRSP 60 45
BEGIN
PROMPT 31 6 ""
FLAGS "D"
END
NUMBER F_CATEGORIA 2
BEGIN
PROMPT 1 7 "Categoria "
FLAGS "DGZ"
FIELD CODCAT
END
STRING F_DESC_CAT 60
BEGIN
PROMPT 16 7 ""
FLAGS "D"
END
NUMBER F_IMPIANTO 10
BEGIN
PROMPT 1 8 "Impianto "
FLAGS "Z"
USE CIM
INPUT CODTAB F_IMPIANTO
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_IMPIANTO CODTAB
OUTPUT F_DESC_IMP S0
CHECKTYPE NORMAL
FIELD CODIMP
END
STRING F_DESC_IMP 50 44
BEGIN
PROMPT 30 8 ""
FLAGS "Z"
USE CIM KEY 2
INPUT S0 F_DESC_IMP
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@10" CODTAB
COPY OUTPUT F_IMPIANTO
CHECKTYPE NORMAL
END
NUMBER F_LOCALIZZ 10
BEGIN
PROMPT 1 9 "Localizzazione "
FLAGS "Z"
USE LOC
INPUT CODTAB F_LOCALIZZ
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "Unità Locale" I0
OUTPUT F_LOCALIZZ CODTAB
OUTPUT F_LOCALIZZ_DESC S0
CHECKTYPE NORMAL
FIELD CODLOC
END
STRING F_LOCALIZZ_DESC 50 44
BEGIN
PROMPT 30 9 ""
USE LOC KEY 2
INPUT S0 F_LOCALIZZ_DESC
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@10" CODTAB
DISPLAY "Unità Locale" I0
COPY OUTPUT F_LOCALIZZ
CHECKTYPE NORMAL
END
DATE F_DTCOMP
BEGIN
PROMPT 1 10 "Data completamento/acquisizione "
FIELD DTCOMP
END
BOOLEAN F_TUIR
BEGIN
PROMPT 52 10 "Gestione secondo TUIR"
FIELD TUIR
END
DATE F_DTFUNZ
BEGIN
PROMPT 1 11 "Data di entrata in funzione "
FIELD DTFUNZ
END
DATE F_DTALIEN
BEGIN
PROMPT 46 11 "Data di alienazione "
FIELD DTALIEN
END
BOOLEAN F_AMMPROP
BEGIN
PROMPT 1 12 "Ammortamento proporzionale da entrata in funzione"
FIELD AMMPROP
END
BOOLEAN F_ESCLPR
BEGIN
PROMPT 1 13 "Esclusione da rinvio a conseguimento ricavi"
FIELD ESCLPR
END
BOOLEAN F_VEIDIP
BEGIN
PROMPT 1 14 "Veicolo in uso promiscuo a dipendente"
FIELD VEIDIP
END
BOOLEAN F_LEASING
BEGIN
PROMPT 1 15 "Cespite oggetto di leasing"
FIELD LEASING
MESSAGE FALSE HIDE,F_ANNIRIC
MESSAGE TRUE SHOW,F_ANNIRIC
END
NUMBER F_ANNIRIC 3
BEGIN
PROMPT 40 15 "Anni di durata del leasing "
FIELD ANNIRIC
END
BOOLEAN F_USATO
BEGIN
PROMPT 1 16 "Cespite acquistato usato"
FIELD USATO
END
LIST F_SPEMAN 1 24
BEGIN
PROMPT 1 17 "Gestione spese manutenzione "
ITEM "1|Escluso"
ITEM "2|Incluso 5%"
ITEM "3|Incluso 25%"
ITEM "4|Articolo 14 legge 449/97"
FIELD TPSPEMAN
END
NUMBER F_VEICOLO 1
BEGIN
PROMPT 1 18 "Tipo di veicolo "
SHEET "Tipo@4R|Descrizione@70"
INPUT F_VEICOLO
ITEM "1|Nessuno"
ITEM "2|Autovettura, Autocaravan, ecc..."
ITEM "3|Motociclo"
ITEM "4|Ciclomotore"
ITEM "5|Altro, (Aeromobili da turismo, Navi e imbarcazioni da diporto, Altri veicoli)"
OUTPUT F_VEICOLO
OUTPUT F_DESC_VEICOLO
FIELD FLGTPVEI
END
STRING F_DESC_VEICOLO 80 54
BEGIN
PROMPT 22 18 ""
FLAGS "D"
END
NUMBER F_USOPROM 1
BEGIN
PROMPT 1 19 "Uso promiscuo "
SHEET "Tipo@4R|Descrizione@60"
INPUT F_USOPROM
ITEM "1|Deducibilita 100% - Esclusivamente strumentale"
ITEM "2|Deducibilita 50% - Uso promiscuo"
ITEM "3|Deducibilita 80% - Uso promiscuo agenti/rappresentanti"
OUTPUT F_USOPROM
OUTPUT F_DESC_USOPROM
FIELD USOPROM
END
STRING F_DESC_USOPROM 54
BEGIN
PROMPT 22 19 ""
FLAGS "D"
END
ENDPAGE
PAGE "Saldi" -1 -1 78 18
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 0 1 "@bCespite"
END
NUMBER DLG_NULL 6
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING DLG_NULL 50
BEGIN
PROMPT 26 2 ""
FLAGS "D"
GROUP 1
END
NUMBER DLG_NULL 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "DZ"
GROUP 2
END
DATE DLG_NULL
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "D"
GROUP 3
END
DATE DLG_NULL
BEGIN
PROMPT 50 3 "Fine "
FLAGS "D"
GROUP 4
END
NUMBER DLG_NULL 10
BEGIN
PROMPT 1 4 "Cespite "
FLAGS "DZ"
FIELD IDCESPITE
END
STRING DLG_NULL 50
BEGIN
PROMPT 26 4 ""
FLAGS "DZ"
GROUP 5
END
NUMBER F_ELEMENTI 4
BEGIN
PROMPT 1 6 "Elementi "
FIELD LF_SALCE->NUMELE
END
CURRENCY F_COSTO 15
BEGIN
PROMPT 1 7 "Costo storico "
FIELD LF_SALCE->CSTO
END
CURRENCY F_VNONAMM 15
BEGIN
PROMPT 1 8 "Valore non ammortizzabile "
FIELD LF_SALCE->VNONAMM
END
CURRENCY F_PLUSREIN 15
BEGIN
PROMPT 1 9 "Plusvalenza reinvestita "
FIELD LF_SALCE->PLUSREIN
END
CURRENCY F_RIV75 15
BEGIN
PROMPT 1 10 "Rivalutazione L. 576/75 "
FIELD LF_SALCE->RIV75
END
CURRENCY F_RIV83 15
BEGIN
PROMPT 1 11 "Rivalutazione L. 72/83 "
FIELD LF_SALCE->RIV83
END
CURRENCY F_RIV90 15
BEGIN
PROMPT 1 12 "Rivalutazione L. 408/90 "
FIELD LF_SALCE->RIV90
END
NUMBER F_ANNI_90 2
BEGIN
PROMPT 1 13 "Anni post rivalutazione L. 408/90 "
FIELD LF_SALCE->ANNIPOST90
END
CURRENCY F_RIV91 15
BEGIN
PROMPT 1 14 "Rivalutazione L. 413/91 "
FIELD LF_SALCE->RIV91
END
NUMBER F_ANNI_91 2
BEGIN
PROMPT 1 15 "Anni post rivalutazione L. 413/91 "
FIELD LF_SALCE->ANNIPOST91
END
CURRENCY F_RIVGF 15
BEGIN
PROMPT 1 16 "Rivalutazione generica fiscale "
FIELD LF_SALCE->RIVGF
END
CURRENCY F_RIVGC 15
BEGIN
PROMPT 1 17 "Rivalutazione generica civilistica "
FIELD LF_SALCE->RIVGC
END
ENDPAGE
PAGE "Fondi" -1 -1 78 18
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 0 1 "@bCespite"
END
NUMBER DLG_NULL 6
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING DLG_NULL 50
BEGIN
PROMPT 26 2 ""
FLAGS "D"
GROUP 1
END
NUMBER DLG_NULL 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "DZ"
GROUP 2
END
DATE DLG_NULL
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "D"
GROUP 3
END
DATE DLG_NULL
BEGIN
PROMPT 50 3 "Fine "
FLAGS "D"
GROUP 4
END
NUMBER DLG_NULL 10
BEGIN
PROMPT 1 4 "Cespite "
FLAGS "DZ"
FIELD IDCESPITE
END
STRING DLG_NULL 50
BEGIN
PROMPT 26 4 ""
FLAGS "DZ"
GROUP 5
END
TEXT DLG_NULL
BEGIN
PROMPT 1 6 "@bTipo ammortamento"
END
TEXT DLG_NULL
BEGIN
PROMPT 25 6 "@bFiscale"
END
TEXT DLG_NULL
BEGIN
PROMPT 43 6 "@bGestionale"
END
TEXT DLG_NULL
BEGIN
PROMPT 63 6 "@bCivilistico"
END
CURRENCY F_NORMALE 15
BEGIN
PROMPT 1 7 "Normale "
FIELD LF_AMMCE->QNOR
END
CURRENCY F_ACCELERATO 15
BEGIN
PROMPT 1 8 "Accelerato "
FIELD LF_AMMCE->QACC
END
CURRENCY F_ANTICIPATO 15
BEGIN
PROMPT 1 9 "Anticipato "
FIELD LF_AMMCE->QANT
END
CURRENCY F_QPERSE 15
BEGIN
PROMPT 1 11 "Quote perse "
FIELD LF_AMMCE->QPERSE
END
CURRENCY F_FPRIVATO 15
BEGIN
PROMPT 1 12 "Fondo amm. privato "
FIELD LF_AMMCE->FPRIVATO
END
CURRENCY F_QPERSEPRIV 15
BEGIN
PROMPT 1 13 "Quote perse private "
FIELD LF_AMMCE->QPPRIVATE
END
#define LF_AMMCE2 LF_AMMCE+100
CURRENCY F_NORMALE2 15
BEGIN
PROMPT 41 7 ""
FIELD LF_AMMCE2->QNOR
END
CURRENCY F_ACCELERATO2 15
BEGIN
PROMPT 41 8 ""
FIELD LF_AMMCE2->QACC
END
CURRENCY F_ANTICIPATO2 15
BEGIN
PROMPT 41 9 ""
FIELD LF_AMMCE2->QANT
END
CURRENCY F_QPERSE2 15
BEGIN
PROMPT 41 11 ""
FIELD LF_AMMCE2->QPERSE
END
CURRENCY F_FPRIVATO2 15
BEGIN
PROMPT 41 12 ""
FIELD LF_AMMCE2->FPRIVATO
END
CURRENCY F_QPERSEPRIV2 15
BEGIN
PROMPT 41 13 ""
FIELD LF_AMMCE2->QPPRIVATE
END
#define LF_AMMCE3 LF_AMMCE+200
CURRENCY F_NORMALE3 15
BEGIN
PROMPT 61 7 ""
FIELD LF_AMMCE3->QNOR
END
CURRENCY F_ACCELERATO3 15
BEGIN
PROMPT 61 8 ""
FIELD LF_AMMCE3->QACC
END
CURRENCY F_ANTICIPATO3 15
BEGIN
PROMPT 61 9 ""
FIELD LF_AMMCE3->QANT
END
CURRENCY F_QPERSE3 15
BEGIN
PROMPT 61 11 ""
FIELD LF_AMMCE3->QPERSE
END
CURRENCY F_FPRIVATO3 15
BEGIN
PROMPT 61 12 ""
FIELD LF_AMMCE3->FPRIVATO
END
CURRENCY F_QPERSEPRIV3 15
BEGIN
PROMPT 61 13 ""
FIELD LF_AMMCE3->QPPRIVATE
END
ENDPAGE
ENDMASK

View File

@ -119,7 +119,7 @@ public:
int conv_inifile(const TFilename& ofname, const char* ofpar, int nflogicnum);
int conv_tab(const TFilename& ofname, const char* cod);
int conv_par(const TFilename& ofname, const char* ofpar, int which_config);
int get_codesc(const TDate& date, const bool fatal = TRUE);
int get_codesc(const TDate& date, const bool fatal = FALSE);
const char conv_imptmc(int cod);
TConversione_cespiti() {}
virtual ~TConversione_cespiti() {}
@ -235,7 +235,7 @@ void TConversione_cespiti::open_log()
TFilename log;
log << "ceconv.log";
_log = fopen(log,"a");
_log = fopen(log,"w");
if (_log == NULL)
fatal_box("Non posso aprire il file di log della conversione(%s)", (const char *) log);
}
@ -757,7 +757,7 @@ int TConversione_cespiti::conv_par(const TFilename& ofname, const char* ofpar, i
newconfig.set(key,atol(tmp.mid(6,6)));
}
else if (fieldvalue.sub(0,4) == "!_ES")
newconfig.set(key,get_codesc(oldfile->get_date(fieldvalue.mid(5)),FALSE));
newconfig.set(key,get_codesc(oldfile->get_date(fieldvalue.mid(5))));
else if (fieldvalue.sub(0,4) == "!_AN")
{
TString80 tmp;

16
ce/ce1.cpp Executable file
View File

@ -0,0 +1,16 @@
#include <xvt.h>
#include "ce1.h"
int main(int argc,char** argv)
{
const int r = (argc > 1) ? (argv[1][1]-'0') : 0;
switch (r)
{
case 1:
ce1100(argc,argv) ; break;
default:
ce1100(argc,argv) ; break;
}
return 0;
}

7
ce/ce1.h Executable file
View File

@ -0,0 +1,7 @@
#ifndef __CE1_H
#define __CE1_H
int ce1100(int argc, char* argv[]);
#endif // __CE1_H

3
ce/ce1.url Executable file
View File

@ -0,0 +1,3 @@
#include <default.url>
#include <mainmenu.url>

490
ce/ce1100.cpp Executable file
View File

@ -0,0 +1,490 @@
#include <defmask.h>
#include <recarray.h>
#include <relapp.h>
#include <sheet.h>
#include <utility.h>
#include "ce0.h"
#include "ce2101.h"
#include "celib.h"
#include "ce1101a.h"
#include "ce1101b.h"
#include "../cg/cglib01.h"
#include "cespi.h"
#include "salce.h"
#include "ammce.h"
//-----------------------------------------------------------------------------------------------------------------------//
//Maschera di selezione
class TQuery_mask : public TAutomask
{
int _staat;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void on_search_event(TOperable_field& o);
int calcola_stato_attivita();
bool cespite_ok() const;
public:
int stato_attivita() const { return _staat; }
TQuery_mask();
};
void TQuery_mask::on_search_event(TOperable_field& o)
{
TToken_string order, fields, header;
if (o.dlg() >= F_SEARCH3)
{
order.add(CESPI_STABILIM); header.add("Stabilimento");
order.add(CESPI_REPARTO); header.add("Reparto@10");
}
if (o.dlg() >= F_SEARCH2)
{
order.add(CESPI_CODIMP); header.add("Impianto@10");
}
if (o.dlg() >= F_SEARCH1)
{
order.add(CESPI_CODCAT); header.add("Cat");
order.add(CESPI_DTCOMP); header.add("Data Acq.@10");
}
order.add(CESPI_IDCESPITE); header.add("Codice@10");
fields = order;
fields.add(CESPI_DESC); header.add("Descrizione@50");
TRelation rel(LF_CESPI);
TString filter;
if (!field(F_IMPIANTO).empty())
filter << CESPI_CODIMP << "==" << get(F_IMPIANTO);
TSorted_cursor cur(&rel, order, filter);
TCursor_sheet sht(&cur, fields, "Cespiti", header, 0, 1);
if (sht.run() == K_ENTER)
{
TToken_string& row = sht.row();
const int cod_pos = row.items()-2;
set(F_IDCESPITE, row.get(cod_pos), TRUE);
stop_run(K_AUTO_ENTER);
}
}
int TQuery_mask::calcola_stato_attivita()
{
const int ese = get_int(F_ESERCIZIO);
const int gru = get_int(F_GRUPPO);
const char* spe = get(F_SPECIE);
TString16 str;
str.format("%04d%02d%-4s", ese, gru, spe);
const TRectype& curr_ccb = cache().get("CCB", str);
if (curr_ccb.get_bool("B1")) // Bollato stampato
_staat = 1;
TDitta_cespiti& dc = ditta_cespiti();
dc.set_attivita(ese, gru, spe);
return _staat;
}
bool TQuery_mask::cespite_ok() const
{
TLocalisamfile cespi(LF_CESPI);
cespi.put(CESPI_IDCESPITE, get(F_IDCESPITE));
bool ok = cespi.read() == NOERR;
return ok;
}
bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_ESERCIZIO:
case F_GRUPPO:
case F_SPECIE:
/* if (e == fe_close)
{
const bool can_edit = calcola_stato_attivita() != 1; // Bollato non stampato (se =1 -> bollato stampato)
enable(DLG_NEWREC, can_edit);
} */
break;
case F_SEARCH1:
case F_SEARCH2:
case F_SEARCH3:
if (e == fe_button)
on_search_event(o);
break;
case F_IDCESPITE:
case F_IDCESPITE_I:
if (e == fe_close)
{
if (!cespite_ok())
return error_box("Inserire un cespite valido"); //controlla che esista il cespite
if (stato_attivita() == 1)
return error_box("E' stato stampato il bollato dell'anno:\nnon sono permesse forzature"); //il bollato é stato stampato
TLocalisamfile salce(LF_SALCE); // controlla che esista almeno un saldo
salce.put(SALCE_IDCESPITE, get(F_IDCESPITE));
salce.put(SALCE_CODES, get(F_ESERCIZIO));
salce.put(SALCE_TPSALDO, 1);
if (salce.read() != NOERR)
return error_box("Non esistono saldi per l'anno selezionato");
TLocalisamfile ammce(LF_AMMCE); // controlla che esista almeno un ammortamento (sennó che forzamo?)
ammce.put(AMMCE_IDCESPITE, get(F_IDCESPITE));
ammce.put(AMMCE_CODES, get(F_ESERCIZIO));
ammce.put(AMMCE_TPSALDO, 1);
ammce.put(AMMCE_TPAMM, 1);
if (ammce.read() != NOERR)
return error_box("Non esistono ammortamenti per l'anno selezionato");
TCespite ces (get(F_IDCESPITE)); // controlla che la categoria del cespite sia ammortizzabile
const TRectype& categoria = ces.categoria();
bool non_ammortizzabile = categoria.get_bool("B0");
if (non_ammortizzabile)
return error_box("La categoria del cespite selezionato non é ammortizzabile");
}
break;
default:
break;
}
return TRUE;
}
TQuery_mask::TQuery_mask() : TAutomask("ce1101a")
{
first_focus(F_IDCESPITE);
}
//-----------------------------------------------------------------------------------------------------------------------//
//Maschera di forzatura
class TForce_mask : public TAutomask
{
TTipo_cespite _tipo;
int _staat;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
void set_stato_attivita(int sa) { _staat = sa; }
int stato_attivita() const { return _staat; }
void set_tipo_cespite(TTipo_cespite tc) { _tipo = tc; }
TTipo_cespite tipo_cespite() const { return _tipo; }
TForce_mask() : TAutomask("ce1101b") { }
};
bool TForce_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
bool ok = TRUE;
/* switch (o.dlg())
{
case F_CATEGORIA:
if (e == fe_init)
{
TDitta_cespiti& dc = ditta_cespiti();
dc.on_category_event(o, e, jolly);
}
break;
case F_DTCOMP:
if (e == fe_modify || e == fe_close)
{
const TDate dtcomp = o.get();
TDitta_cespiti& dc = ditta_cespiti();
TDate iniz, fine;
const int ese = dc.esercizio_corrente(iniz, fine);
if (insert_mode() && stato_attivita() == 2)
{
if (dtcomp < iniz)
return error_box("La data appartiene ad un esercizio già stampato su bollato");
const TRectype& cac = dc.categoria(0, NULL, get_int(F_CATEGORIA));
iniz = cac.get("D0");
if (iniz.ok() && dtcomp < iniz)
return error_box("La data è precedente all'inizio della validità della categoria");
fine = cac.get("D1");
if (fine.ok() && dtcomp > fine)
return error_box("La data è succesiva alla fine della validità della categoria");
}
if (dc.esercizio_costituzione() && dtcomp < iniz)
return error_box("Non è possibile specificare una data antecedente all'eserczio di costituzione");
}
break;
case F_DTFUNZ:
if (e == fe_modify || e == fe_close)
{
TDitta_cespiti& dc = ditta_cespiti();
const TDate dtcomp = field(F_DTCOMP).get();
const TDate dtfunz = o.get();
if (dtfunz < dtcomp)
return error_box("La data di entrata in funzione deve essere successiva a quella di aquisizione");
if (dtfunz.ok() && !dtcomp.ok())
return error_box("La data di entrata in funzione non puo' essere inserita senza specificare quella di aquisizione");
if (_tipo != tc_materiale && dtfunz != dtcomp)
{
if (dtcomp.year() >= dc.anno_tuir())
return error_box("In base alla normativa del TUIR, le date di acquisizione e di entrata in funzione devono coincidere");
}
if (dtfunz.ok())
{
const TRectype& cac = dc.categoria(0, NULL, get_int(F_CATEGORIA));
const TDate iniz = cac.get("D0");
if (iniz.ok() && dtfunz < iniz)
return error_box("La data è precedente all'inizio della validità della categoria");
const TDate fine = cac.get("D1");
if (fine.ok() && dtcomp > fine)
return error_box("La data è succesiva alla fine della validità della categoria");
set(F_TUIR, dtfunz.year() >= dc.anno_tuir() ? "X" : "");
}
}
break;
default:
break;
} */
return ok;
}
//-----------------------------------------------------------------------------------------------------------------------//
//Applicazione
class TForza_amm_cespi : public TRelation_application
{
TRelation* _cespiti;
int _rel_year;
TQuery_mask* _qmask;
TForce_mask* _fmask;
protected:
// @cmember Inizializzazione dei dati dell'utente
virtual bool user_create();
// @cmember Distruzione dei dati dell'utente
virtual bool user_destroy();
virtual bool changing_mask(int mode);
// @cmember Richiede la maschera da usare
virtual TMask* get_mask(int mode);
// @cmember Ritorna la relazione da modificare
virtual TRelation* get_relation() const;
void protect_fields(TMask& m, TToken_string& enabling) const;
void init_mask(TMask& m);
virtual const char* get_next_key();
virtual bool protected_record(TRectype& rec);
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual int read(TMask& m);
};
bool TForza_amm_cespi::changing_mask(int)
{
return TRUE;
}
TMask* TForza_amm_cespi::get_mask(int mode)
{
return mode == MODE_QUERY ? (TMask*)_qmask : (TMask*)_fmask;
}
// get_relation più complessa della storia di campo
TRelation* TForza_amm_cespi::get_relation() const
{
const int year = _qmask->get_int(F_ESERCIZIO);
TRelation*& csp = ((TForza_amm_cespi*)this)->_cespiti;
if (year != _rel_year && csp != NULL)
{
delete csp;
csp = NULL;
}
if (csp == NULL)
{
// Crea nuova relazione su cespi
csp = new TRelation(LF_CESPI);
((TForza_amm_cespi*)this)->_rel_year = year; // Memorizza anno utilizzato
// Collega salce
TString80 expr1;
expr1 << SALCE_IDCESPITE << "==" << CESPI_IDCESPITE;
if (year > 0)
expr1 << '|' << SALCE_CODES << "==" << year;
csp->add(LF_SALCE, expr1);
// Collega i tre tipi di ammce
TString80 expr2;
for (int a = 1; a <= 3; a++)
{
expr2 = expr1;
expr2 << '|' << AMMCE_TPAMM << "==" << a;
csp->add(LF_AMMCE, expr2, 1, 0, LF_AMMCE+100*(a-1));
}
// Attiva il salvataggio anche di salce e ammce
csp->write_enable();
}
return _cespiti;
}
void TForza_amm_cespi::init_query_mode(TMask& m)
{
ditta_cespiti().init_mask(m);
}
bool TForza_amm_cespi::protected_record(TRectype& rec)
{
const TDate dtalien = rec.get(CESPI_DTALIEN);
return dtalien.ok();
}
void TForza_amm_cespi::init_mask(TMask& m)
{
TDitta_cespiti& dc = ditta_cespiti();
dc.init_mask(m);
const bool can_edit = !dc.bollato_stampato() ;//&& m.field(F_DTALIEN).empty();
m.enable(DLG_SAVEREC, can_edit);
m.enable(DLG_DELREC, can_edit);
_fmask->set_stato_attivita(_qmask->stato_attivita());
const TRectype& cac = dc.categoria(0, NULL, _qmask->get_int(F_CATEGORIA));
const int tc = cac.get_int("I0");
_fmask->set_tipo_cespite(tc==0 ? tc_materiale : (tc==1 ? tc_immateriale : tc_pluriennale));
const bool mat_only = _fmask->tipo_cespite() == tc_materiale;
// m.show(F_LEASING, mat_only);
// m.show(F_ANNIRIC, mat_only);
// m.show(F_USATO, mat_only);
}
void TForza_amm_cespi::init_insert_mode(TMask& m)
{
init_mask(m);
// m.enable(F_DTALIEN);
// m.set(F_TUIR, "X");
// m.set(F_SPEMAN, _fmask->tipo_cespite() == tc_materiale ? 2 : 1);
// m.set(F_ESCLPR, _fmask->tipo_cespite() != tc_pluriennale ? "X" : "");
}
void TForza_amm_cespi::protect_fields(TMask& m, TToken_string& enabling) const
{
for (int f = m.fields()-1; f >= 0; f--)
{
TMask_field& fld = m.fld(f);
const short id = fld.dlg();
if (id > 100 && id < 1000 && fld.is_editable() && fld.enabled_default())
{
const bool on = enabling.empty() || enabling.get_pos(fld.dlg()) >= 0;
fld.enable(on);
}
}
}
void TForza_amm_cespi::init_modify_mode(TMask& m)
{
init_mask(m);
/* m.disable(F_DTALIEN);
TDitta_cespiti& dc = ditta_cespiti();
TDate iniz, fine;
const int ese = dc.esercizio_corrente(iniz, fine);
const TDate dtacq = m.get(F_DTCOMP);
const TDate dtfunz = m.get(F_DTFUNZ);
TToken_string enabling;
switch (_qmask->stato_attivita())
{
case 2:
if (dtacq.ok())
{
if (dtacq < iniz)
{
if (!dtfunz.ok() || dtfunz >= iniz)
{
enabling.add(F_DTFUNZ);
enabling.add(F_SPEMAN);
enabling.add(F_USOPROM);
}
else
{
enabling.add(F_SPEMAN);
enabling.add(F_USOPROM);
}
}
}
else
{
if (!dtfunz.ok())
{
enabling.add(F_DTCOMP);
enabling.add(F_DTFUNZ);
enabling.add(F_SPEMAN);
enabling.add(F_USOPROM);
}
}
break;
case 3:
if (!dtfunz.ok() || dtfunz >= iniz)
{
enabling.add(F_DTFUNZ);
}
break;
default:
break;
}
protect_fields(m, enabling); */
}
const char* TForza_amm_cespi::get_next_key()
{
real num = 1;
TLocalisamfile cespi(LF_CESPI);
if (cespi.last() == NOERR)
num = cespi.get_real(CESPI_IDCESPITE) + 1;
return format("%d|%s", F_IDCESPITE, num.string());
}
int TForza_amm_cespi::read(TMask& m)
{
int err = TRelation_application::read(m);
return err;
}
bool TForza_amm_cespi::user_create()
{
open_files(LF_TABCOM, LF_TAB, LF_CESPI, LF_SALCE, LF_AMMCE, 0);
_cespiti = NULL;
_rel_year = 0;
_qmask = new TQuery_mask;
_fmask = new TForce_mask;
return TRUE;
}
bool TForza_amm_cespi::user_destroy()
{
delete _fmask;
delete _qmask;
delete _cespiti;
return TRUE;
}
int ce1100(int argc, char* argv[])
{
TForza_amm_cespi a;
a.run(argc, argv, "Forzatura ammortamento su cespiti");
return 0;
}

23
ce/ce1101a.h Executable file
View File

@ -0,0 +1,23 @@
//campi maschera ce1101a.uml
#define F_DITTA 101
#define F_RAGSOC 102
#define F_ESERCIZIO 103
#define F_INIZIO_ES 104
#define F_FINE_ES 105
#define F_SELECT 106
#define F_GRUPPO 107
#define F_SPECIE 108
#define F_DESC_GRSP 109
#define F_IMPIANTO 112
#define F_DESC_IMP 113
#define F_SEARCH1 117
#define F_SEARCH2 118
#define F_SEARCH3 119
#define F_IDCESPITE 120
#define F_DESC 121
#define F_IDCESPITE_I 122
#define F_DESC_I 123

232
ce/ce1101a.uml Executable file
View File

@ -0,0 +1,232 @@
#include "ce1101a.h"
TOOLBAR "Toolbar" 0 -3 0 3
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Selezione cespiti" -1 -1 78 18
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 0 1 "@bParametri ditta"
END
NUMBER F_DITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 26 2 ""
USE LF_NDITTE
INPUT CODDITTA F_DITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
FLAGS "D"
END
NUMBER F_ESERCIZIO 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "AZ"
USE CCE
JOIN ESC ALIAS 104 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Inizio esercizio" 104@->D0
DISPLAY "Fine esercizio" 104@->D1
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_INIZIO_ES 104@->D0
OUTPUT F_FINE_ES 104@->D1
CHECKTYPE REQUIRED
END
DATE F_INIZIO_ES
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "D"
END
DATE F_FINE_ES
BEGIN
PROMPT 50 3 "Fine "
FLAGS "D"
END
RADIOBUTTON F_SELECT 1 75
BEGIN
PROMPT 1 3 ""
FLAGS "Z"
ITEM "A|Attività"
MESSAGE SHOW,1@|HIDE,2@
ITEM "I|Impianto"
MESSAGE SHOW,2@|HIDE,1@
END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 1 5 "Gruppo "
FLAGS "Z"
GROUP 1
END
STRING F_SPECIE 4
BEGIN
PROMPT 16 5 "Specie "
FLAGS "_"
USE CCB
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@50" 400@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_DESC_GRSP 400@->S0
CHECKTYPE NORMAL
GROUP 1
END
STRING F_DESC_GRSP 60 45
BEGIN
PROMPT 31 5 ""
FLAGS "D"
GROUP 1
END
NUMBER F_IMPIANTO 10
BEGIN
PROMPT 1 5 "Impianto "
FLAGS "Z"
USE CIM
INPUT CODTAB F_IMPIANTO
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_IMPIANTO CODTAB
OUTPUT F_DESC_IMP S0
CHECKTYPE FORCED
GROUP 2
END
STRING F_DESC_IMP 50 45
BEGIN
PROMPT 26 5 ""
FLAGS "Z"
USE CIM KEY 2
INPUT S0 F_DESC_IMP
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@10" CODTAB
COPY OUTPUT F_IMPIANTO
CHECKTYPE REQUIRED
GROUP 2
END
NUMBER F_IDCESPITE 10
BEGIN
PROMPT 1 8 "Cespite "
FLAGS "Z"
USE LF_CESPI SELECT (CODCGRA=#F_GRUPPO)&&(CODSPA=#F_SPECIE)
INPUT IDCESPITE F_IDCESPITE
DISPLAY "Codice@10" IDCESPITE
DISPLAY "Desc@50" DESC
DISPLAY "Cat." CODCAT
DISPLAY "Impianto@10" CODIMP
DISPLAY "Stabilimento@30" STABILIM
DISPLAY "Reparto@30" REPARTO
DISPLAY "Data Acq.@10" DTCOMP
DISPLAY "Data Ali.@10" DTALIEN
OUTPUT F_IDCESPITE IDCESPITE
OUTPUT F_DESC DESC
CHECKTYPE REQUIRED
FIELD IDCESPITE
KEY 1
GROUP 1
END
STRING F_DESC 50
BEGIN
PROMPT 24 8 ""
USE LF_CESPI KEY 2 SELECT (CODCGRA=#F_GRUPPO)&&(CODSPA=#F_SPECIE)
INPUT DESC F_DESC
DISPLAY "Desc@50" DESC
DISPLAY "Codice@10" IDCESPITE
DISPLAY "Cat." CODCAT
DISPLAY "Impianto@10" CODIMP
DISPLAY "Stabilimento@30" STABILIM
DISPLAY "Reparto@30" REPARTO
DISPLAY "Data Acq.@10" DTCOMP
DISPLAY "Data Ali.@10" DTALIEN
COPY OUTPUT F_IDCESPITE
CHECKTYPE REQUIRED
FIELD DESC
KEY 2
GROUP 1
END
NUMBER F_IDCESPITE_I 10
BEGIN
PROMPT 1 8 "Cespite "
FLAGS "Z"
USE LF_CESPI SELECT CODIMP=#F_IMPIANTO
INPUT IDCESPITE F_IDCESPITE_I
COPY DISPLAY F_IDCESPITE
OUTPUT F_IDCESPITE_I IDCESPITE
OUTPUT F_DESC DESC_I
CHECKTYPE REQUIRED
MESSAGE COPY F_IDCESPITE
FIELD IDCESPITE
KEY 1
GROUP 2
END
STRING F_DESC_I 50
BEGIN
PROMPT 24 8 ""
USE LF_CESPI KEY 2 SELECT CODIMP=#F_IMPIANTO
INPUT DESC F_DESC_I
COPY DISPLAY F_DESC
COPY OUTPUT F_IDCESPITE_I
CHECKTYPE REQUIRED
MESSAGE COPY F_DESC
FIELD DESC
KEY 2
GROUP 2
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 15 "@bRicerce alternative"
END
BUTTON F_SEARCH1 22 2
BEGIN
PROMPT 2 16 "Per categoria"
END
BUTTON F_SEARCH2 22 2
BEGIN
PROMPT 28 16 "Per impianto"
END
BUTTON F_SEARCH3 22 2
BEGIN
PROMPT 54 16 "Per stabilimento"
END
ENDPAGE
ENDMASK

43
ce/ce1101b.h Executable file
View File

@ -0,0 +1,43 @@
//campi maschera ce1101b.uml
#define F_DITTA 101
#define F_RAGSOC 102
#define F_ESERCIZIO 103
#define F_INIZIO_ES 104
#define F_FINE_ES 105
#define F_SITUAZIONE 106
#define F_GRUPPO 107
#define F_SPECIE 108
#define F_DESC_GRSP 109
#define F_CATEGORIA 110
#define F_DESC_CAT 111
#define F_IMPIANTO 112
#define F_DESC_IMP 113
#define F_FORZATURA 114
#define F_SEARCH1 117
#define F_SEARCH2 118
#define F_SEARCH3 119
#define F_IDCESPITE 120
#define F_DESC 121
#define F_IDCESPITE_I 122
#define F_DESC_I 123
#define F_AMMNOR 130
#define F_AMMACC 131
#define F_AMMANT 132
#define F_QUOTE_PERSE 133
#define F_PRIVATO 134
#define F_QUOTE_PRIV 135
#define F_P_AMMNOR 136
#define F_P_AMMACC 137
#define F_P_AMMANT 138
#define F_RIS_AMMNOR 140
#define F_RIS_AMMACC 141
#define F_RIS_AMMANT 142
#define F_RIS_QUOTE_PERSE 143
#define F_RIS_PRIVATO 144
#define F_RIS_QUOTE_PRIV 145
#define F_RESIDUO 146

286
ce/ce1101b.uml Executable file
View File

@ -0,0 +1,286 @@
#include "ce1101b.h"
TOOLBAR "Toolbar" 0 -2 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -13 -1 ""
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Forzatura ammortamento sul cespite" -1 -1 78 18
GROUPBOX DLG_NULL 78 7
BEGIN
PROMPT 0 1 "@bParametri ditta"
END
NUMBER F_DITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 26 2 ""
FLAGS "D"
USE LF_NDITTE
INPUT CODDITTA F_DITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
END
NUMBER F_ESERCIZIO 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "DAZ"
USE CCE
JOIN ESC ALIAS 104 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_INIZIO_ES 104@->D0
OUTPUT F_FINE_ES 104@->D1
CHECKTYPE REQUIRED
END
DATE F_INIZIO_ES
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "D"
END
DATE F_FINE_ES
BEGIN
PROMPT 50 3 "Fine "
FLAGS "D"
END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 1 4 "Gruppo "
FLAGS "DZ"
//// GROUP 1
END
STRING F_SPECIE 4
BEGIN
PROMPT 16 4 "Specie "
FLAGS "_D"
USE CCB
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO
INPUT CODTAB[7,10] F_SPECIE
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_DESC_GRSP 400@->S0
CHECKTYPE NORMAL
//// GROUP 1
END
STRING F_DESC_GRSP 60 45
BEGIN
PROMPT 31 4 ""
FLAGS "D"
//// GROUP 1
END
NUMBER F_IDCESPITE 10
BEGIN
PROMPT 1 5 "Cespite "
FLAGS "DZ"
USE LF_CESPI SELECT (CODCGRA=#F_GRUPPO)&&(CODSPA=#F_SPECIE)
INPUT IDCESPITE F_IDCESPITE
OUTPUT F_IDCESPITE IDCESPITE
OUTPUT F_DESC DESC
CHECKTYPE REQUIRED
FIELD IDCESPITE
KEY 1
//// GROUP 1
END
STRING F_DESC 50
BEGIN
PROMPT 24 5 ""
FLAGS "D"
USE LF_CESPI KEY 2 SELECT (CODCGRA=#F_GRUPPO)&&(CODSPA=#F_SPECIE)
INPUT DESC F_DESC
COPY OUTPUT F_IDCESPITE
CHECKTYPE REQUIRED
FIELD DESC
KEY 2
//// GROUP 1
END
NUMBER F_CATEGORIA 2
BEGIN
PROMPT 1 6 "Categoria "
FLAGS "DBZ"
DRIVENBY F_GRUPPO
DRIVENBY F_SPECIE
FIELD CODCAT
END
STRING F_DESC_CAT 60 58
BEGIN
PROMPT 16 6 ""
FLAGS "DB"
DRIVENBY F_GRUPPO
DRIVENBY F_SPECIE
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 0 8 "@bSituazione"
END
RADIOBUTTON F_SITUAZIONE 1 75
BEGIN
PROMPT 1 8 ""
FLAGS "Z"
ITEM "F|Fiscale"
MESSAGE SHOW,1@
ITEM "C|Civilistica"
MESSAGE HIDE,1@
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 0 11 "@bForzatura"
END
RADIOBUTTON F_FORZATURA 1 75
BEGIN
PROMPT 1 11 ""
FLAGS "Z"
ITEM "N|Nessuna"
// MESSAGE SHOW,1@|HIDE,2@
ITEM "Q|Quote"
// MESSAGE SHOW,2@|HIDE,1@
ITEM "P|Percentuali"
// MESSAGE SHOW,2@|HIDE,1@
END
GROUPBOX DLG_NULL 78 9
BEGIN
PROMPT 0 14 "@b Valori Forzati Valori Risultanti"
END
CURRENCY F_AMMNOR 15
BEGIN
PROMPT 1 15 "Normale "
END
CURRENCY F_AMMACC 15
BEGIN
PROMPT 1 16 "Accelerato "
END
CURRENCY F_AMMANT 15
BEGIN
PROMPT 1 17 "Anticipato "
END
NUMBER F_QUOTE_PERSE 15
BEGIN
PROMPT 1 18 "Quote perse "
GROUP 1
END
NUMBER F_PRIVATO 15
BEGIN
PROMPT 1 19 "Privato "
GROUP 1
END
NUMBER F_QUOTE_PRIV 15
BEGIN
PROMPT 1 20 "Quote per priv. "
GROUP 1
END
NUMBER F_P_AMMNOR 6 2
BEGIN
PROMPT 35 15 ""
END
TEXT -1
BEGIN
PROMPT 42 15 "%"
END
NUMBER F_P_AMMACC 6 2
BEGIN
PROMPT 35 16 ""
END
TEXT -1
BEGIN
PROMPT 42 16 "%"
END
NUMBER F_P_AMMANT 6 2
BEGIN
PROMPT 35 17 ""
END
TEXT -1
BEGIN
PROMPT 42 17 "%"
END
CURRENCY F_RIS_AMMNOR 15
BEGIN
PROMPT 55 15 ""
END
CURRENCY F_RIS_AMMACC 15
BEGIN
PROMPT 55 16 ""
END
CURRENCY F_RIS_AMMANT 15
BEGIN
PROMPT 55 17 ""
END
CURRENCY F_RIS_QUOTE_PERSE 15
BEGIN
PROMPT 55 18 ""
GROUP 1
END
CURRENCY F_RIS_PRIVATO 15
BEGIN
PROMPT 55 19 ""
GROUP 1
END
CURRENCY F_RIS_QUOTE_PRIV 15
BEGIN
PROMPT 55 20 ""
GROUP 1
END
CURRENCY F_RESIDUO 15
BEGIN
PROMPT 45 21 "Residuo "
END
ENDPAGE
ENDMASK

View File

@ -128,6 +128,7 @@ bool TCalcamm::destroy()
void TCalcamm::main_loop()
{
const bool batch = argc() > 2 && *argv(2) == 'A';
KEY k = K_ENTER;
while (k == K_ENTER)
{
@ -135,16 +136,25 @@ void TCalcamm::main_loop()
dc.init_mask(*_mask);
_mask->field(F_SPECIE).check(RUNNING_CHECK);
_mask->recalc_spese();
k = _mask->run();
if (!batch)
k = _mask->run();
if (k == K_ENTER)
{
const int ese = _mask->get_int(F_ESERCIZIO);
const TString& gru = _mask->get(F_GRUPPO);
const int gru = _mask->get_int(F_GRUPPO);
const TString& spe = _mask->get(F_SPECIE);
dc.set_attivita(ese, gru, spe);
calcola_ammortamenti();
bool ok = TRUE;
if (dc.bollato_stampato())
ok = error_box("Non è possibile effettuare il calcolo degli ammortamenti:\n"
"il bollato della attività corrente è già stato stampato");
if (ok)
calcola_ammortamenti();
}
if (batch)
break;
}
}

View File

@ -149,7 +149,6 @@ END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 0 15 "@bSpese di manutenzione eccedenti"
FLAGS "D"
END
CURRENCY F_SPME_MATGEN 18

View File

@ -207,21 +207,13 @@ void TCespite::save_amm() const
}
// Ritorna il record della categoria del cespite
// Certified 90%
// Certified 100%
const TRectype& TCespite::categoria() const
{
const int gruppo = get_int(CESPI_CODCGRA);
const TString4 specie = get(CESPI_CODSPA);
const int categ = get_int(CESPI_CODCAT);
TString8 key;
key.format("%02d%-4s%02d", gruppo, (const char*)specie, categ);
const TRectype& cac = cache().get("%CAC", key);
if (!cac.empty())
return cac;
key.overwrite(" ");
const TRectype& cac2 = cache().get("%CAC", key);
return cac2;
return ditta_cespiti().categoria(gruppo, specie, categ);
}
// Tipo del cespite: 0 = Materiale, 1 = Immateriale, 2 = Pluriennale
@ -351,88 +343,111 @@ real TCespite::val_amm(int tipo_sit) const
}
// Calcola il residuo ammortizzabile di un cespite in base a quanto scritto in SALPRO e AMMPRO
// Certified 50%
// Certified 75%
real TCespite::res_amm(int tipo_sit) const
{
real resamm = val_amm(tipo_sit);
resamm -= _ammpro.get_real(AMMCE_QNORP);
resamm += _ammpro.get_real(AMMCE_QANTP);
resamm += _ammpro.get_real(AMMCE_QACCP);
resamm += _ammpro.get_real(AMMCE_QPERSEP);
resamm -= _ammpro.get_real(AMMCE_QPPRIVATEP);
resamm -= _ammpro.get_real(AMMCE_FPRIVATOP);
const real valamm = val_amm(tipo_sit); // Valore ammortizzabile
real fondo; // Fondo ammortamento
fondo += _ammpro.get_real(AMMCE_QNORP);
fondo += _ammpro.get_real(AMMCE_QANTP);
fondo += _ammpro.get_real(AMMCE_QACCP);
fondo += _ammpro.get_real(AMMCE_QPERSEP);
fondo += _ammpro.get_real(AMMCE_QPPRIVATEP);
fondo += _ammpro.get_real(AMMCE_FPRIVATOP);
const real resamm = valamm - fondo; // Residuo da ammortizzare
return resamm;
}
// Cerca nella tabella dei limiti l'ultima data precedente alla fine esercizio passata come parametro
// Certified 90%
TRectype& date2limit(const TDate& d)
{
static TAssoc_array limits;
// const TString16 key = d.string(ANSI); // Non serve l'intera data: tabella del c....
TString16 key; key.format("%04d", d.year());
TRectype* lim = (TRectype*)limits.objptr(key);
if (lim == NULL)
{
TTable clm("%CLM");
bool ok = clm.last() == NOERR;
if (ok)
{
TDate datalim = clm.get("CODTAB");
ok = d >= datalim;
while (!ok)
{
if (clm.prev() != NOERR)
break;
datalim = clm.get("CODTAB");
ok = d >= datalim;
}
}
lim = new TRectype(clm.curr());
if (!ok) // Should never happen!
lim->zero();
limits.add(key, lim);
}
return *lim;
}
// Calcola il limite massimo ammortizzabile per il tipo di veicolo
// Certified 10%
// Certified 90%
real TCespite::get_limit() const
{
real limite = -1.0; // Partiamo con limite non valido < ZERO
real limite = -1.0; // Partiamo con limite non valido che in realtà e' considerato +infinito
const int tipo_veicolo = get_int(CESPI_FLGTPVEI);
if (tipo_veicolo > 0) // Mi pare inutile cercare limiti se non è un veicolo!
// Mi pare inutile cercare limiti se è un veicolo senza limiti!
if (tipo_veicolo > 1 && tipo_veicolo < 5)
{
TTable clm("%CLM");
if (clm.first() == NOERR)
{
TDate inies, fines;
ditta_cespiti().esercizio_corrente(inies, fines);
const TDate datalim(clm.get("CODTAB"));
bool ok = inies > datalim || fines >= datalim;
if (!ok)
TDate inies, fines;
ditta_cespiti().esercizio_corrente(inies, fines);
const TRectype& clm = date2limit(fines);
// Questo if contiene la funzione fox cerca_limite
// Stabilisce il limite in base al tipo di veicolo ed al suo uso
if (!clm.empty())
{
switch(tipo_veicolo)
{
clm.put("CODTAB", fines.string(ANSI));
ok = clm.read(_isgteq) == NOERR;
}
// Questo if contiene la funzione fox cerca_limite
// Stabilisce il limite in base al tipo di veicolo ed al suo uso
if (ok)
{
switch(tipo_veicolo)
case 2: // Autoveicolo
{
case 2:
{
const int uso_promiscuo = get_int(CESPI_USOPROM);
if (uso_promiscuo == 2 || uso_promiscuo == 4)
limite = clm.get_real("R1"); else
if (uso_promiscuo == 3 || uso_promiscuo == 5)
limite = clm.get_real("R2");
}
break;
case 3: limite = clm.get_real("R3"); break;
case 4: limite = clm.get_real("R4"); break;
default: break;
const int uso_promiscuo = get_int(CESPI_USOPROM);
if (uso_promiscuo == 2 || uso_promiscuo == 4)
limite = clm.get_real("R0"); else
if (uso_promiscuo == 3 || uso_promiscuo == 5)
limite = clm.get_real("R1");
}
}
}
break;
case 3: limite = clm.get_real("R2"); break; // Motociclo
case 4: limite = clm.get_real("R3"); break; // Ciclomotore
default: break;
}
}
}
return limite;
}
// Calcola spese manutenzione da scrivere su SALPRO
// Certified 50%
// Certified 75%
real TCespite::calcola_spese_manutenzione(const real& valamm)
{
const TDitta_cespiti& cce = ditta_cespiti();
real vspmanu = valamm;
real limite = get_limit();
if (vspmanu < limite || limite < ZERO)
limite = vspmanu;
if (!cce.esercizio_costituzione())
{
const real coeff = cce.coefficiente_durata_esercizio();
if (coeff != 1.0)
vspmanu = coeff * limite;
real limite = get_limit();
if (vspmanu < limite || limite < ZERO)
limite = vspmanu;
vspmanu = coeff * limite;
}
const int usoprom = get_int(CESPI_USOPROM);
if (usoprom == 2 || usoprom == 4)
vspmanu *= 0.5; else
vspmanu = vspmanu * 0.50; else // 50%
if (usoprom == 3 || usoprom == 5)
vspmanu *= 0.8;
vspmanu = vspmanu * 0.80; // 80%
return vspmanu;
}
@ -450,7 +465,7 @@ void TCespite::prepara_saldi(int tipo_sit, bool is_valid)
if ((tpspeman == 2 || tpspeman == 3) && inies.year() > cce.anno_tuir())
{
const real valamm = val_amm(tipo_sit);
real vspmanu = calcola_spese_manutenzione(valamm);
real vspmanu = calcola_spese_manutenzione(valamm); // Non arrotondare qui! Altrove serve così com'è
cce.arrotonda(vspmanu);
_salpro.put(SALCE_VSPMANU, vspmanu);
}
@ -711,7 +726,7 @@ real TCespite::calc_quota(const real& valamm, const real& perric,
{
quota = residuo;
if (valamm > ZERO)
pereff = quota / coeff_durata * 100.0 / valamm;
pereff = (quota * 100.0) / (coeff_durata * valamm);
else
pereff = ZERO;
}
@ -722,7 +737,7 @@ real TCespite::calc_quota(const real& valamm, const real& perric,
// Calcolo delle quote perse
// Certified 50%
real TCespite::calc_quote_perse(const real& valamm, const real& peric, const real& residuo,
const real& quotamm, bool amm_rit, bool mov_vend, const TDate& dtmov)
const real& quotamm, bool mov_vend, const TDate& dtmov)
{
const TDitta_cespiti& cce = ditta_cespiti();
const real coeff_durata = cce.coefficiente_durata_esercizio();
@ -739,11 +754,18 @@ real TCespite::calc_quote_perse(const real& valamm, const real& peric, const rea
}
cce.arrotonda(quota);
real quote_perse;
if (quota < residuo && quota > quotamm && !amm_rit)
quote_perse = quota - quotamm;
if (quota < residuo)
{
const bool amm_rit = _ammini.get_bool(AMMCE_AMMRIT);
if (quota > quotamm && !amm_rit)
quota -= quotamm;
else
quota = ZERO;
}
else
quota = ZERO;
return quote_perse;
return quota;
}
void TCespite::agg_quota(int tipo_sit, const real& movvalamm, TRectype& rec, const char* field, bool calcq)
@ -769,15 +791,17 @@ void TCespite::agg_quota(int tipo_sit, const real& movvalamm, TRectype& rec, con
if (tipo_veicolo >= 2 && tipo_veicolo <= 4)
{
clim = get_limit();
if (mva < clim || clim < ZERO)
if (clim < ZERO || mva < clim)
clim = mva;
}
else
clim = mva;
const TDitta_cespiti& cce = ditta_cespiti();
const real quotat = rec.get(field);
const real limcsto = clim / mva;
const real campo = quotat * limcsto * perc;
real campo = quotat * limcsto * perc;
cce.arrotonda(campo);
rec.put(field, campo);
if (strcmp(field, "QNOR") == 0)
rec.put("FPRIVATO", quotat - campo);
@ -786,9 +810,10 @@ void TCespite::agg_quota(int tipo_sit, const real& movvalamm, TRectype& rec, con
if (calcq)
{
const real quotap = rec.get("QPERSE");
const real qp = quotap * limcsto * perc;
real qp = quotap * limcsto * perc;
cce.arrotonda(qp);
rec.put("QPERSE", qp);
rec.put("QPRIVATE", quotap - qp);
rec.put("QPPRIVATE", quotap - qp);
}
}
}
@ -921,9 +946,8 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm
ammmv.put(AMMMV_PENOR, per_eff);
// Calcolare quote perse
const bool ammrit = _ammini.get_bool(AMMCE_AMMRIT);
const TDate dtmov = tmv.get(MOVCE_DTMOV);
const real quote_perse = calc_quote_perse(valamm, per_eff, resamm, qnor, ammrit, TRUE, dtmov);
const real quote_perse = calc_quote_perse(valamm, per_eff, resamm, qnor, TRUE, dtmov);
ammmv.put(AMMMV_QPERSE, quote_perse);
if (tipo_sit == 1 && get_int(CESPI_USOPROM) > 1)
@ -995,7 +1019,7 @@ void TCespite::calc_anni(TRectype& ammmv, const TRectype& tmv, const TRectype& t
return;
}
const int tc = tipo();
const TTipo_cespite tc = tipo();
const int vincolo = get_int(CESPI_VINCOLO);
if ((tc == tc_pluriennale && vincolo == 2) ||
(tc == tc_immateriale && anniric > 0) ||
@ -1052,8 +1076,9 @@ void TCespite::elabora_mov_neg(TRelation& rel, TRectype& tmv, TRectype& tmvam, i
if (is_valid && ditta_cespiti().ammortamento_parti_vendute())
{
const TRectype& tmc = cache().get("%TMC", tmv.get(MOVCE_TPDOC));
if (tmv.get_bool("B4")) // Possibile ammortamento su movimento
const TString4 tpmov = tmv.get(MOVCE_CODMOV); // Tipo movimento da non confondere col tipo documento!
const TRectype& tmc = cache().get("%TMC", tpmov);
if (tmc.get_bool("B4")) // Possibile ammortamento su movimento
amm_mov_ven(rel, tmv, tmvam, tipo_sit);
else
{
@ -1087,7 +1112,8 @@ void TCespite::scansione_movimenti(int tipo_sit, const TDate& data_limite, bool
TString filtro;
filtro << "(IDRET==\"\")";
filtro << "&&(ANSI(DTMOV)>=\"" << inies.string(ANSI) << "\")";
filtro << "&&(ANSI(DTMOV)<=\"" << data_limite.string(ANSI) << "\")";
if (data_limite.ok())
filtro << "&&(ANSI(DTMOV)<=\"" << data_limite.string(ANSI) << "\")";
TCursor cur(&rel, filtro, 2, &movsem, &movsem);
const long items = cur.items();
if (items > 0) // Continua solo se esistono movimenti
@ -1139,7 +1165,7 @@ void TCespite::scansione_movimenti(int tipo_sit, const TDate& data_limite, bool
{
const real valamm = mov_val_amm(tmv);
real vspmanu = calcola_spese_manutenzione(valamm);
const TDate dtmov = movsem.get_date(MOVCE_DTMOV);
const TDate dtmov = movsem.get_date(MOVCE_DTMOV); // ???
const real giorni_residui = fines - dtmov + (segno=='-' ? 0 : 1);
const real giorni_esercizio = fines - inies + 1;
vspmanu = vspmanu * giorni_residui / giorni_esercizio;
@ -1319,8 +1345,7 @@ void TCespite::calc_amm_residui(int tipo_sit, bool is_valid)
_ammpro.put(AMMCE_QNOR, qnor);
_ammpro.put(AMMCE_PNOR, per_eff);
const bool ammrit = _ammini.get_bool(AMMCE_AMMRIT);
const real quote_perse = calc_quote_perse(valamm, pmat, resamm, qnor, ammrit, FALSE, TDate(TODAY));
const real quote_perse = calc_quote_perse(valamm, pmat, resamm, qnor, FALSE, TDate());
_ammpro.put(AMMCE_QPERSE, quote_perse);
const int uso_promiscuo = get_int(CESPI_USOPROM);
@ -1345,7 +1370,8 @@ void TCespite::calc_amm_residui(int tipo_sit, bool is_valid)
else
zero_fields(_ammpro, AMMCE_PACC, AMMCE_QACC, NULL);
if (tc != tc_materiale || _salini.get(SALCE_ANNIAMM) > 2)
const int anniamm = _salini.get_int(SALCE_ANNIAMM);
if (tc != tc_materiale || anniamm > 2)
{
zero_fields(_ammpro, AMMCE_PANT, AMMCE_QANT, NULL);
}
@ -1383,25 +1409,25 @@ void TCespite::calc_amm_residui(int tipo_sit, bool is_valid)
const int vincolo = get_int(CESPI_VINCOLO);
real qnor; // Valore non calcolato
if ((tc == tc_materiale && vincolo == 2 && _ammini.get_real(AMMCE_PNOR).is_zero()) ||
if ((tc == tc_pluriennale && vincolo == 2 && _ammini.get_real(AMMCE_PNOR).is_zero()) ||
(tc == tc_immateriale && anniric > 0) || (tc == tc_materiale && anniric > 0))
{
if (anniric > anniamm)
qnor = resamm / (anniric - anniamm);
} else
if (tc == tc_immateriale && vincolo == 3)
if (tc == tc_pluriennale && vincolo == 3)
{
if (anniric > anniamm)
qnor = val_amm(tipo_sit) / anniric;
} else
if (tc == tc_immateriale && vincolo == 1)
if (tc == tc_pluriennale && vincolo == 1)
{
if (anniric > 0)
qnor = val_amm(tipo_sit) / anniric;
else
qnor = val_amm(tipo_sit) * _ammini.get_real(AMMCE_PNOR) / 100.0;
} else
if (tc == tc_immateriale && vincolo == 2 && _ammini.get_real(AMMCE_PNOR) > ZERO)
if (tc == tc_pluriennale && vincolo == 2 && _ammini.get_real(AMMCE_PNOR) > ZERO)
{
if (anniric > anniamm)
qnor = val_amm(tipo_sit) * _ammini.get_real(AMMCE_PNOR) / 100.0;
@ -1478,14 +1504,21 @@ void TCespite::agg_spe_man(int tipo_sit, bool is_valid)
bool TCespite::calc_amm(int tipo_sit, bool recalc_spe_man, const TDate& data_limite)
{
log("* Inizio calcolo situazione %d cespite %s", tipo_sit, (const char*)get(CESPI_IDCESPITE));
const TString16 idcespite = get(CESPI_IDCESPITE); // Keep it handy for debug purposes
log("* Inizio calcolo situazione %d cespite %s", tipo_sit, (const char*)idcespite);
#ifdef DBG
if (tipo_sit == 1 && atol(idcespite) == 28L)
tipo_sit = 1; // Put your breakpoint here
#endif
const bool is_valid = valido(tipo_sit);
prepara_saldi(tipo_sit, is_valid);
scansione_movimenti(tipo_sit, data_limite, is_valid);
calc_amm_residui(tipo_sit, is_valid);
if (recalc_spe_man)
agg_spe_man(tipo_sit, is_valid);
log("* Fine calcolo situazione %d cespite %s", tipo_sit, (const char*)get(CESPI_IDCESPITE));
log("* Fine calcolo situazione %d cespite %s", tipo_sit, (const char*)idcespite);
log("");
return is_valid;

View File

@ -23,7 +23,6 @@ protected:
void read_amm(int esercizio, int tipo);
void save_amm() const;
const TRectype& categoria() const;
void set_msg05(const char* msg);
bool valido(int tipo_sit);
@ -47,7 +46,7 @@ protected:
real calc_quota(const real& valamm, const real& perric, const real& residuo,
real& pereff, TRelation* mov = NULL);
real calc_quote_perse(const real& valamm, const real& peric, const real& residuo,
const real& quotamm, bool amm_rit, bool mov_vend, const TDate& dtmov);
const real& quotamm, bool mov_vend, const TDate& dtmov);
void agg_quota(int tipo_sit, const real& valamm, TRectype& rec, const char* field, bool calcq);
void incr_field(TRectype& dst, const char* fdst, const TRectype& src, const char* fsrc, char segno) const;
@ -59,7 +58,9 @@ protected:
public:
bool calc_amm(int tipo_sit, bool calc_spe_man, const TDate& data_limite);
TTipo_cespite tipo() const; // 1 = Materiale, 2 = Immateriale, 3 = Pluriennale
const TRectype& categoria() const;
TTipo_cespite tipo() const;
int read(const char* id);
TCespite();

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <execp.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
@ -130,9 +131,9 @@ bool TRegistro_cespiti::attivita_handler(TMask_field& f, KEY k)
if (f.to_check(k) || (k == K_TAB && !m.is_running()))
{
const int esercizio = m.get_int(F_ESERCIZIO);
const TString16 gruppo = m.get(F_GRUPPO);
const int gruppo = m.get_int(F_GRUPPO);
const TString16 specie = m.get(F_SPECIE);
TString80 key; key.format("%4d%s%s",esercizio, (const char*) gruppo, (const char*) specie);
TString80 key; key.format("%4d%02d%s",esercizio, gruppo, (const char*) specie);
const TRectype& ccb = cache().get("CCB", key);
TDate dataultcalc = ccb.get_date("D0");
m.set(F_DATAULTCALC, dataultcalc);
@ -164,19 +165,30 @@ bool TRegistro_cespiti::attivita_handler(TMask_field& f, KEY k)
void TRegistro_cespiti::main_loop()
{
while (_mask->run() == K_ENTER)
{
{
// Aggiunto da Guy
if (_mask->get_bool(F_CALCOLO))
{
const int es = _mask->get_int(F_ESERCIZIO);
const int gr = _mask->get_int(F_GRUPPO);
const TString& sp = _mask->get(F_SPECIE);
ditta_cespiti().set_attivita(es, gr, sp); // Fissa attività per calcolo
TExternal_app cal("ce2 -0 A");
cal.run(); // Esegue programma di calcolo in batch
}
TRectype darec(LF_CESPI),arec(LF_CESPI);
TString filtro;
// filtro sulla attivitá e categorie
const int esercizio = _mask->get_int(F_ESERCIZIO);
const int catini = _mask->get_int(F_CATINI);
const int catfin = _mask->get_int(F_CATFIN);
darec.put(CESPI_CODCGRA, _mask->get_int(F_GRUPPO));
const TString4 catini = _mask->get(F_CATINI);
const TString4 catfin = _mask->get(F_CATFIN);
darec.put(CESPI_CODCGRA, _mask->get(F_GRUPPO));
darec.put(CESPI_CODSPA, _mask->get(F_SPECIE));
darec.put(CESPI_CODCAT, _mask->get_int(F_CATINI));
arec.put(CESPI_CODCGRA, _mask->get_int(F_GRUPPO));
darec.put(CESPI_CODCAT, catini);
arec.put(CESPI_CODCGRA, _mask->get(F_GRUPPO));
arec.put(CESPI_CODSPA, _mask->get(F_SPECIE));
arec.put(CESPI_CODCAT, _mask->get_int(F_CATFIN));
arec.put(CESPI_CODCAT, catfin);
// filtro sulle date di acquisizione e alienazione
const TDate datainizio = _mask->get_date(F_DATAINIZIO);
const TDate datafine = _mask->get_date(F_DATAFINE);
@ -248,11 +260,13 @@ void TRegistro_cespiti::header_registro()
_form->find_field('H', first_page, FR_DATAINIZIO).set(_mask->get(F_DATAINIZIO));
_form->find_field('H', first_page, FR_DATAFINE).set(_mask->get(F_DATAFINE));
TString80 key; key.format("%04d",_mask->get_int(F_ESERCIZIO));
const TRectype& cce = cache().get("CCE", key);
_form->find_field('H', first_page, FR_NUMGIORNI).set(cce.get("I3"));
_form->find_field('H', first_page, FR_NUMGIOSOL).set(cce.get("I3"));
long giorni = (_mask->get_date(F_DATAFINE) - _mask->get_date(F_DATAINIZIO) + 1);
key.format("%3d",giorni);
_form->find_field('H', first_page, FR_NUMGIOSOL).set(key);
_form->find_field('H', first_page, FR_NUMGIORNI).set(key);
_form->find_field('H', first_page, FR_LIBROCESPITI).enable(_bollato);
_form->set_testata();
_form->set_piede();
@ -343,20 +357,10 @@ void TRegistro_cespiti::stampa_movimento(TRectype& recmovce, TRectype& recmovam,
if (recmovce.get_char(MOVCE_SEGNO)=='-')
{
section.find_field(FR_MV_SEGNO).set("-1");
// section.find_field(FR_MV_QNORMENO).enable();
// section.find_field(FR_MV_QACCMENO).enable();
// section.find_field(FR_MV_QANTMENO).enable();
// section.find_field(FR_MV_MINUSVALENZA).enable();
// section.find_field(FR_MV_PLUSVALENZA).enable();
}
else
{
section.find_field(FR_MV_SEGNO).set("1");
// section.find_field(FR_MV_QNORMENO).disable();
// section.find_field(FR_MV_QACCMENO).disable();
// section.find_field(FR_MV_QANTMENO).disable();
// section.find_field(FR_MV_MINUSVALENZA).disable();
// section.find_field(FR_MV_PLUSVALENZA).disable();
}
section.update();

View File

@ -1314,10 +1314,10 @@ SECTION FOOTER EVEN 6
PROMPT 16 2 "TOTALI CATEGORIA"
END
NUMERO FR_TC_ELEM 3
NUMERO FR_TC_ELEM 4
BEGIN
KEY "Elementi"
PICTURE "###"
PICTURE "####"
PROMPT 100 2 ""
MESSAGE ADD,F0->FR_TG_ELEM
GROUP 1
@ -1545,10 +1545,10 @@ SECTION FOOTER ODD 6
PROMPT 16 2 "TOTALI GENERALI"
END
NUMERO FR_TG_ELEM 3
NUMERO FR_TG_ELEM 4
BEGIN
KEY "Elementi"
PICTURE "###"
PICTURE "####"
PROMPT 100 2 ""
END

View File

@ -120,7 +120,7 @@ END
STRING F_CATINI 2
BEGIN
PROMPT 2 7 "Da categoria "
USE %CAC SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
USE %CAC // SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
INPUT CODTAB[1,2] F_GRUPPO
INPUT CODTAB[3,6] F_SPECIE
INPUT CODTAB[7,8] F_CATINI
@ -136,7 +136,7 @@ END
STRING F_D_CATINI 60 50
BEGIN
PROMPT 22 7 ""
USE %CAC SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
USE %CAC // SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
INPUT S0 F_D_CATINI
DISPLAY "Descrizione@50" S0
DISPLAY "Categoria" CODTAB[7,8]
@ -149,7 +149,7 @@ END
STRING F_CATFIN 2
BEGIN
PROMPT 2 8 "A categoria "
USE %CAC SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
USE %CAC // SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
INPUT CODTAB[1,2] F_GRUPPO
INPUT CODTAB[3,6] F_SPECIE
INPUT CODTAB[7,8] F_CATFIN
@ -165,7 +165,7 @@ END
STRING F_D_CATFIN 60 50
BEGIN
PROMPT 22 8 ""
USE %CAC SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
USE %CAC // SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
INPUT S0 F_D_CATFIN
DISPLAY "Descrizione@50" S0
DISPLAY "Categoria" CODTAB[7,8]

View File

@ -1,5 +1,4 @@
#include <applicat.h>
#include <automask.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
@ -70,6 +69,9 @@ bool TStampastorico_mask::on_field_event(TOperable_field& o, TField_event e, lon
{
switch (o.dlg())
{
case F_CATCESP:
case F_DESCRCAT:
return ditta_cespiti().on_category_event(o, e, jolly); //ultimo ritrovato per selezionare la categoria (da celib)
case F_SITFISC :
if (e == fe_close)
{

View File

@ -144,28 +144,19 @@ END
NUMBER F_CATCESP 2
BEGIN
PROMPT 19 11 " "
USE %CAC SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
INPUT CODTAB[1,2] F_GRUPPO
INPUT CODTAB[3,6] F_SPECIE
INPUT CODTAB[7,8] F_CATCESP
DISPLAY "Gruppo" CODTAB[1,2]
DISPLAY "Specie" CODTAB[3,6]
DISPLAY "Categoria" CODTAB[7,8]
DISPLAY "Descrizione@50" S0
OUTPUT F_CATCESP CODTAB[7,8]
OUTPUT F_DESCRCAT S0
FLAGS "BZ"
DRIVENBY F_GRUPPO
DRIVENBY F_SPECIE
WARNING "Categoria errata"
END
STRING F_DESCRCAT 60 45
BEGIN
PROMPT 30 11 ""
USE %CAC SELECT ((CODTAB[1,2]==#F_GRUPPO) && (CODTAB[3,6]==#F_SPECIE)) || (CODTAB[1,6]==" ")
INPUT S0 F_DESCRCAT
DISPLAY "Descrizione@50" S0
DISPLAY "Categoria" CODTAB[7,8]
DISPLAY "Gruppo" CODTAB[1,2]
DISPLAY "Specie" CODTAB[3,6]
COPY OUTPUT F_CATCESP
FLAGS "B"
DRIVENBY F_GRUPPO
DRIVENBY F_SPECIE
WARNING "Categoria errata"
END
NUMBER F_IMPCESP 10

View File

@ -1,24 +1,34 @@
#include <applicat.h>
#include <automask.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
#include <utility.h>
#include "ce3.h"
#include "celib.h"
#include "..\cg\cglib01.h"
#include "ce2101.h"
#include "ce3300a.h"
#include "ce3300.h"
#include "celib.h"
#include "ammce.h"
#include "ammmv.h"
#include "cespi.h"
#include "movam.h"
#include "movce.h"
#include "salce.h"
//===============================================================================================//
//-----FORM--------------------------------------------------------------------------------------//
class TForm_prospettocesp : public TForm_cespiti
{
{
public:
virtual bool validate(TForm_item &cf, TToken_string &s);
void set_testata() {set_header(1,TRUE);}
void set_pedata() {set_footer(1,FALSE); set_footer(1,TRUE);}
TPrint_section& get_body() {return section('B', odd_page);}
TForm_prospettocesp();
virtual ~TForm_prospettocesp();
@ -37,8 +47,8 @@ bool TForm_prospettocesp::validate(TForm_item &cf, TToken_string &s)
return TForm_cespiti::validate(cf,s); //richiama la validate standard della classe genitore (TForm_cespiti)
}
//-----AUTOMASK---------------------------------------------------------------------------------//
//==============================================================================================//
//-----AUTOMASK---------------------------------------------------------------------------------//
class TStampaprospetto_mask : public TAutomask
{
TRelation * _rel;
@ -74,8 +84,63 @@ bool TStampaprospetto_mask::on_field_event(TOperable_field& o, TField_event e, l
return TRUE;
}
//-----SKELETON APPLICATION------------------------------------------------------------------------------------------//
//=======================================================================================================================//
struct TTotali : public TObject
{
real _tot_csto;
real _tot_riv;
real _tot_riveser;
real _tot_acqincr;
real _tot_cesselim2;
real _tot_fondinieser;
real _tot_incr;
real _tot_cesselim3;
real _tot_reinplus;
real _tot_ammnor;
real _tot_ammacc;
real _tot_ammant;
void azzera();
TTotali& operator += (const TTotali& t);
};
void TTotali::azzera()
{
_tot_csto = 0;
_tot_riv = 0;
_tot_riveser = 0;
_tot_acqincr = 0;
_tot_cesselim2 = 0;
_tot_fondinieser = 0;
_tot_incr = 0;
_tot_cesselim3 = 0;
_tot_reinplus = 0;
_tot_ammnor = 0;
_tot_ammacc = 0;
_tot_ammant = 0;
}
//-----------------------------------------------------------------------------------------------------------------------//
TTotali& TTotali::operator += (const TTotali& t)
{
_tot_csto += t._tot_csto;
_tot_riv += t._tot_riv;
_tot_riveser += t._tot_riveser;
_tot_acqincr += t._tot_acqincr;
_tot_cesselim2 += t._tot_cesselim2;
_tot_fondinieser += t._tot_fondinieser;
_tot_incr += t._tot_incr;
_tot_cesselim3 += t._tot_cesselim3;
_tot_reinplus += t._tot_reinplus;
_tot_ammnor += t._tot_ammnor;
_tot_ammacc += t._tot_ammacc;
_tot_ammant += t._tot_ammant;
return *this; //ritorna se stesso, quindi i valori dei totali
}
//=======================================================================================================================//
//-----SKELETON APPLICATION----------------------------------------------------------------------------------------------//
class TStampa_prospetto : public TSkeleton_application
{
TStampaprospetto_mask * _mask;
@ -86,18 +151,32 @@ protected:
virtual bool destroy();
virtual void main_loop();
void print_header( const int tipo );
void print_footer();
void set_intestazione( const int tipo, const int ordinamento);
void set_pavimentazione();
void stampa_totali_cat(const TString& codicecat, const TString& descrcat); //stampa sul form i valori totali per categoria
void stampa_totali_tipo(TTipo_cespite tcesp); //stampa sul form i valori totali per tipo cespite (materiale, immateriale, pluriennale)
void stampa_totali_generali(); //stampa sul form i valori totali per tutti i cespiti
void fill_body(const TTotali& tot); //riempie il campo body con tutti i totali
void print_body(); //stampa effettivamente il body
void set_field(int id, const real& val); //mette in un campo del body odd un valore numerico
void set_field(int id, const char* val); //mette in un campo del body odd una stringa
void aggiorna_totali(TCursor& cur, const int tipo, TTipo_cespite tcesp); //calcola effettivamente i totali di ciascuna categoria
public:
TStampa_prospetto() {}
private:
TDate _dataini;
TDate _datafine;
TTotali _cat, _mtr, _gen; //sono i tre set di totali (categoria, materiali, generali)
};
bool TStampa_prospetto::create()
{
open_files(LF_CESPI, LF_SALCE, LF_AMMCE, LF_MOVCE, LF_AMMMV, 0);
_mask = new TStampaprospetto_mask;
_form = new TForm_prospettocesp();
_form = new TForm_prospettocesp;
return TSkeleton_application::create();
}
@ -109,94 +188,393 @@ bool TStampa_prospetto::destroy()
return TSkeleton_application::destroy();
}
void TStampa_prospetto::print_header( const int tipo )
//------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::set_intestazione( const int tipo, const int ordinamento)
{
_form->find_field('H', odd_page, FF_CODDITTA).set(_mask->get(F_CODDITTA));
_form->find_field('H', odd_page, FF_DESCRDITTA).set(_mask->get(F_DESCRDITTA));
_form->find_field('H', odd_page, FF_GRUPPO).set(_mask->get(F_GRUPPO));
_form->find_field('H', odd_page, FF_D_GRUPPO).set(_mask->get(F_D_GRUPPO));
_form->find_field('H', odd_page, FF_SPECIE).set(_mask->get(F_SPECIE));
_form->find_field('H', odd_page, FF_D_SPECIE).set(_mask->get(F_D_SPECIE));
// scrive l'header first, contenente i dati della ditta e dell'esercizio
_form->find_field('H', first_page, FR_CODDITTA).set(_mask->get(F_CODDITTA));
_form->find_field('H', first_page, FR_RAGSOC).set(_mask->get(F_DESCRDITTA));
_form->find_field('H', first_page, FR_GRUPPO).set(_mask->get(F_GRUPPO));
_form->find_field('H', first_page, FR_D_GRUPPO).set(_mask->get(F_D_GRUPPO));
_form->find_field('H', first_page, FR_SPECIE).set(_mask->get(F_SPECIE));
_form->find_field('H', first_page, FR_D_SPECIE).set(_mask->get(F_D_SPECIE));
_form->find_field('H', first_page, FR_DATAINIZIO).set(_dataini);
_form->find_field('H', first_page, FR_DATAFINE).set(_datafine);
switch(tipo) //in base al(ai) tipo(i) di situazione cambia una riga dell'header
// in base all'ordinamento (per categoria o per impianto) scrive la riga con codice e descrizione
if (ordinamento == 0)
{
_form->find_field('H', first_page, FR_INT_COD).set("Cat.");
_form->find_field('H', first_page, FR_INT_DESC).set("Descrizione categoria");
}
else
{
_form->find_field('H', first_page, FR_INT_COD).set("Imp.");
_form->find_field('H', first_page, FR_INT_DESC).set(" Descr. impianto");
}
//in base al(ai) tipo(i) di situazione cambia una riga dell'header
switch(tipo)
{
case 1:
_form->find_field('H', odd_page, FF_SITUAZIONE).set("fiscale");
_form->find_field('H', first_page, FR_SITUAZIONE).set("fiscale");
break;
case 2:
_form->find_field('H', odd_page, FF_SITUAZIONE).set("civilistica");
_form->find_field('H', first_page, FR_SITUAZIONE).set("civilistica");
break;
case 3:
_form->find_field('H', odd_page, FF_SITUAZIONE).set("gestionale");
_form->find_field('H', first_page, FR_SITUAZIONE).set("gestionale");
break;
}
_form->set_testata();
}
void TStampa_prospetto::print_footer()
//-----------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::set_pavimentazione()
{
_form->set_pedata();
}
//-----------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::print_body()
{
set_pavimentazione(); // stampa il fondo pagina
TPrint_section& body = _form->get_body();
body.update();
if (body.height() > printer().rows_left())
printer().formfeed();
for (word i = 0; i < body.height(); i++) // stampa le righe del body
printer().print(body.row(i));
}
//-----------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::stampa_totali_cat(const TString& codicecat, const TString& descrcat )
{
// scrive codice e descrizione della categoria di cui stampa i valori
set_field(FR_TC_CAT,codicecat);
set_field(FR_TC_D_CAT,descrcat);
// riempie il body con i totali per categoria
fill_body(_cat);
/////////////////////////////////////THE ROUTINE LIVES HERE!!!///////////////////////////////
// stampa effettivamente il body sul form
print_body();
// somma sui totali materiali
_mtr += _cat;
_gen += _cat;
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::stampa_totali_tipo(TTipo_cespite tcesp)
{
// scrive il tipo di cespiti di cui calcola il totale
set_field(FR_TC_CAT,"");
TString80 tipodescr = "TOTALI BENI ";
switch (tcesp)
{
case tc_pluriennale: tipodescr << "PLURIENNALI"; break;
case tc_immateriale: tipodescr << "IMMATERIALI"; break;
default: tipodescr << "MATERIALI"; break;
}
set_field(FR_TC_D_CAT,tipodescr);
// riempie il body con i totali per tipologia cespite (per situazione)
fill_body(_mtr);
// stampa effettivamente il body sul form
print_body();
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::stampa_totali_generali()
{
// scrive TOTALI GENERALI
set_field(FR_TC_CAT,"");
set_field(FR_TC_D_CAT,"TOTALI GENERALI");
// riempie il body con i totali generali per situazione selezionata
fill_body(_gen);
// stampa effettivamente il body sul form
print_body();
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::set_field(int id, const real& val)
{
_form->find_field('B', odd_page, id).set(val.string());
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::set_field(int id, const char* val)
{
_form->find_field('B', odd_page, id).set(val);
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::fill_body(const TTotali& tot)
{
// riempie il body odd, contenente i totali; lo fa chiamando la set_field per ogni campo
set_field(FR_TC_CSTO,tot._tot_csto);
set_field(FR_TC_TOTRIV,tot._tot_riv);
real tempval1 = tot._tot_csto+tot._tot_riv;
set_field(FR_TC_VALINIES,tempval1);
set_field(FR_TC_RIVALES,tot._tot_riveser);
set_field(FR_TC_ACQINCR,tot._tot_acqincr);
set_field(FR_TC_CESSELIM2,tot._tot_cesselim2);
tempval1 += tot._tot_riveser + tot._tot_acqincr - tot._tot_cesselim2;
set_field(FR_TC_VALBIL,tempval1);
set_field(FR_TC_FONDINIES,tot._tot_fondinieser);
set_field(FR_TC_INCR,tot._tot_incr);
set_field(FR_TC_CESSELIM3,tot._tot_cesselim3);
set_field(FR_TC_REINPLUS,tot._tot_reinplus);
set_field(FR_TC_AMMNOR,tot._tot_ammnor);
set_field(FR_TC_AMMACC,tot._tot_ammacc);
set_field(FR_TC_AMMANT,tot._tot_ammant);
real tempval2 = tot._tot_fondinieser + tot._tot_incr - tot._tot_cesselim3 + tot._tot_reinplus + tot._tot_ammnor + tot._tot_ammacc +tot._tot_ammant;
set_field(FR_TC_FONDBIL,tempval2);
tempval2 = tempval1 - tempval2;
set_field(FR_TC_RESBIL,tempval2);
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::aggiorna_totali(TCursor& cur, const int tipo, TTipo_cespite tcesp)
{
// valori della riga 1 (dipendenti da tipo solo le rivgf/rivgc)
TRectype& recsalce = cur.curr(LF_SALCE);
real csto = recsalce.get(SALCE_CSTO);
if (tipo == 1)
{
real vnonamm1 = recsalce.get(SALCE_VNONAMM);
_cat._tot_csto += csto - vnonamm1;
}
else
_cat._tot_csto += csto;
real riv75 = recsalce.get(SALCE_RIV75);
real riv83 = recsalce.get(SALCE_RIV83);
real riv90 = recsalce.get(SALCE_RIV90);
real riv91 = recsalce.get(SALCE_RIV91);
if (tipo == 1)
{
real rivgf = recsalce.get(MOVCE_RIVGF);
_cat._tot_riv += riv75 + riv83 + riv90 + riv91 + rivgf;
}
else
{
real rivgc = recsalce.get(MOVCE_RIVGC);
_cat._tot_riv += riv75 + riv83 + riv90 + riv91 + rivgc;
}
// valori della riga 2 (e, giá che si fa la scansione dei movimenti, anche i valori dei movam della riga 3)
// (i valori della riga 2 non dipendono da tipo, mentre quelli della riga 3 si, in quanto hanno movam)
TRectype recmovce(LF_MOVCE);
recmovce.put(MOVCE_IDCESPITE, cur.curr().get(CESPI_IDCESPITE));
TRelation relmovce(LF_MOVCE);
// viene aggiunta la relazione su movam (che contiene il filtro su tpamm dovuto al tipo di situazione scelto nella maschera)..
TString expr;
expr << "IDCESPITE==IDCESPITE|IDMOV==IDMOV|TPAMM==" << tipo;
relmovce.add(LF_MOVAM, expr);
//.. e quindi viene aggiunta la relazione su ammmv (che contiene il filtro su tpamm dovuto al tipo di situazione scelto nella
// maschera) utilizzando la stessa espressione di filtro, in quanto la chiave di ammmv é identica a quella di movam (olé!)
relmovce.add(LF_AMMMV, expr);
TCursor curmovce (&relmovce, "", 2, &recmovce, &recmovce);
long num1 = curmovce.items();
curmovce.freeze();
real amv_ammnor;
real amv_ammacc;
real amv_ammant;
for (curmovce=0; curmovce.pos()<num1; ++curmovce)
{
const TRectype& mov = curmovce.curr();
const TRectype& amm = curmovce.curr(LF_MOVAM);
const TRectype& amv = curmovce.curr(LF_AMMMV);
const TDate dtmov = mov.get(MOVCE_DTMOV);
if (dtmov >= _dataini && dtmov <= _datafine)
{
const TString& tmc = cache().get("TMC", mov.get(MOVCE_CODMOV), "S6"); //prende il valore del campo S6 nella tabella tipi movimento
const real segno = mov.get_char(MOVCE_SEGNO) == '-' ? -1 : +1 ;
riv75 = mov.get_real(MOVCE_RIV75);
riv83 = mov.get_real(MOVCE_RIV83);
riv90 = mov.get_real(MOVCE_RIV90);
riv91 = mov.get_real(MOVCE_RIV91);
csto = mov.get_real(MOVCE_CSTO);
// inquietante modo di selezionare la rivg (rivgf o rivgc) in base al tipo senza usare una if else!
real rivg = mov.get_real(tipo == 1 ? MOVCE_RIVGF : MOVCE_RIVGC);
real vnonamm2 = mov.get_real(MOVCE_VNONAMM);
real qnor = amm.get_real(MOVAM_QNOR);
real qacc = amm.get_real(MOVAM_QACC);
real qant = amm.get_real(MOVAM_QANT);
if (tmc == "3")
_cat._tot_riveser += riv75 + riv83 + riv90 + riv91 + rivg;
if (tmc == "1" || (tmc == "" && segno == '+'))
_cat._tot_acqincr += csto - vnonamm2 + riv75 + riv83 + riv90 + riv91 + rivg;
_cat._tot_incr += qnor + qacc + qant;
if (tmc == "2" || (tmc == "" && segno == '-'))
_cat._tot_cesselim2 += csto - vnonamm2 + riv75 + riv83 + riv90 + riv91 + rivg;
_cat._tot_cesselim3 += qnor + qant + qacc;
_cat._tot_reinplus += mov.get_real(MOVCE_PLUSREIN);
// solo nei casi con tipo =2 e/o 3 viene preso l'ammortamento da ammmv (che verrá poi sommato nella riga 4, piú sotto, a quello
// preso da ammce); l'ammortamento viene preso qui in quanto é relativo ai movimenti che vengono qui scanditi
if (tipo != 1)
{
amv_ammnor += amv.get_real(AMMMV_QNOR);
amv_ammacc += amv.get_real(AMMMV_QACC);
amv_ammant += amv.get_real(AMMMV_QANT);
}
} //fine controllo sulle date
} //fine scansione sui movimenti
// valori delle righe 3 e 4 di ammce (questi valori dipendono dal tipo di situazione selezionato nella maschera)
// record con chiave idcespite,codes,tpamm
TRectype recammce(LF_AMMCE);
recammce.put(AMMCE_IDCESPITE, cur.curr().get(CESPI_IDCESPITE));
recammce.put(AMMCE_CODES, _mask->get(F_ESERCIZIO));
// filtro sul tpamm (va messo per non prendere tutti gli ammortamenti (dei 3 tipi) assieme)
expr.cut(0);
expr << AMMCE_TPAMM << "=" << tipo;
TRelation relammce(LF_AMMCE);
TCursor curammce (&relammce, expr, 1, &recammce, &recammce);
long num2 = curammce.items();
curammce.freeze();
// scandisce gli ammce del cespite (al massimo 2 per ogni codes, ovvero iniziale e finale)
for (curammce=0; curammce.pos()<num2; ++curammce)
{
const TRectype& amm = curammce.curr();
// se tpsaldo = 1 (inizio) gli ammortamenti sono....
if (amm.get_int(AMMCE_TPSALDO) == 1)
{
real qnor = amm.get_real(AMMCE_QNOR);
real qacc = amm.get_real(AMMCE_QACC);
real qant = amm.get_real(AMMCE_QANT);
_cat._tot_fondinieser += qnor + qant +qacc;
}
// se invece tpsaldo = 2 (fine) gli ammortamenti sono....
else
{
_cat._tot_ammnor += amm.get_real(AMMCE_QNOR);
_cat._tot_ammacc += amm.get_real(AMMCE_QACC);
_cat._tot_ammant += amm.get_real(AMMCE_QANT);
// se, mentre tpsaldo=2, ho anche tpamm =2 e/o 3, gli ammortamenti devono tenere conto anche di quelli sui movimenti, calcolati
// durante la scansione dei movimenti
if (tipo != 1)
{
_cat._tot_ammnor += amv_ammnor;
_cat._tot_ammacc += amv_ammacc;
_cat._tot_ammant += amv_ammant;
}
}
} // fine scansione sugli ammce
} // fine routine
//-----------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::main_loop()
{
_mask->set(F_SITFISC,"X");
while (_mask->run() == K_ENTER)
{
/* TRectype rec(LF_CESPI);
TString filtro;
TCursor& cursore = *_form->cursor();
{
// record su esercizio,gruppo,specie
TRectype rec(LF_CESPI);
const int esercizio = _mask->get_int(F_ESERCIZIO);
filtro.format("STR(%d->CODES <= %d)",LF_SALCE, esercizio); //filtro:codes(nel file salce)<=esercizio(dato dalla maschera)
TString80 key; key.format("%4d",esercizio);
const TRectype& cce = cache().get("CCE", key);
_ammvenduti = cce.get_bool("B3");
rec.put(CESPI_CODCGRA, _mask->get(F_GRUPPO));
rec.put(CESPI_CODSPA, _mask->get(F_SPECIE));
// relazione su lf_cespi e lf_salce
TRelation relcespi(LF_CESPI);
TString espr;
espr << "IDCESPITE==IDCESPITE|CODES==" << esercizio;
relcespi.add(LF_SALCE,espr);
// filtro su esercizio gruppo specie e data acquisto cespite sia <= alla data fine esercizio selezionato
TString filtro;
_dataini = _mask->get_date(F_INIZIO_ES);
_datafine = _mask->get_date(F_FINE_ES);
filtro << "(CODCGRA=\"" << _mask->get(F_GRUPPO)<< "\")&&" ;
filtro << "(CODSPA=\"" << _mask->get(F_SPECIE)<< "\")&&" ;
filtro << "(" << LF_SALCE << "->CODES=" << esercizio << ")&&" ;
filtro << "(ANSI(" << LF_CESPI << "->DTCOMP)<=" << _datafine.string(ANSI) << ")";
const int r = _mask->get_int(F_TIPOSTAMPA); //in base al tipo di stampa selezionato setta il cursore
switch (r)
{
case 0:
cursore.setkey(1); // setta la chiave (nel caso si fosse scelta in precedenza la 2)
if (!_mask->field(F_CODCESP).empty())
rec.put("IDCESPITE", _mask->get(F_CODCESP));
break;
case 1:
cursore.setkey(2); // setta la chiave 2
rec.put("CODCGRA", _mask->get_int(F_GRUPPO));
rec.put("CODSPA", _mask->get(F_SPECIE));
if (!_mask->field(F_CATCESP).empty())
rec.put("CODCAT", _mask->get_int(F_CATCESP));
break;
case 2:
if (!_mask->field(F_IMPCESP).empty())
filtro << format (" && (%d->CODIMP == \"%s\")", LF_CESPI, (const char *) _mask->get(F_IMPCESP)); //estende il filtro con il campo CODIMP
break;
default:
break;
}
cursore.setregion(rec,rec);
cursore.setfilter(filtro,TRUE);
// prepara il cursore di tipo sorted perché ho due tipi di ordinamento possibili: per categoria e per impianto
const int ordinamento = _mask->get_int(F_ORDINA);
TString ordin = ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP;
ordin << "|" <<CESPI_IDCESPITE;
TSorted_cursor sortcur (&relcespi, ordin, filtro, 1, &rec, &rec);
sortcur.setregion(rec,rec);
sortcur.setfilter(filtro,TRUE);
long num = cursore.items();
cursore.freeze();
long num = sortcur.items();
sortcur.freeze();
printer().open();
for (cursore=0; cursore.pos()<num; ++cursore)
// scansione sulle 3 possibili situazioni stampabili
for (int j = 1; j <= 3; j++)
{
if (_mask->get_bool(F_SITFISC))
print_percespite(1);
if (_mask->get_bool(F_SITCIV))
print_percespite(2);
if (_mask->get_bool(F_SITGEST))
print_percespite(3);
}
// stampa solo le situazioni selezionate
if (j == 1 && !_mask->get_bool(F_SITFISC))
continue;
if (j == 2 && !_mask->get_bool(F_SITCIV))
continue;
if (j == 3 && !_mask->get_bool(F_SITGEST))
continue;
// setta l'intestazione del form...
set_intestazione(j, ordinamento);
// ed il fondo pagina
set_pavimentazione();
// gestione categorie ed effettivo main loop di stampa
// azzera i totali generali (se mai non lo fossero)
_gen.azzera();
// scansiona sui 3 tipi di cespite (materiale, immateriale, pluriennale)
for (int i = 0; i <= 2; i++)
{
const TTipo_cespite tipocespite = (TTipo_cespite)i; // trasforma l'intero i in un tipo cespite
TString16 currcodcat = "@@"; //codice categoria iniziale (non si puó metterlo nullo perché potrebbe esistere)
TString80 currdescat = "";
_mtr.azzera(); // azzeratore tipi cespite (materiali, immateriali, pluriennali)
for (sortcur=0; sortcur.pos()<num; ++sortcur) //scansione su tutti i cespiti della categoria indicata in precedenza
{
const TCespite ces(sortcur.curr());
if (ces.tipo() == tipocespite) //considera solo i cespiti del tipo attualmente selezionato
{
const TString16 codcat = sortcur.curr().get(ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP);
if (codcat != currcodcat) //cambia categoria
{
if (currcodcat != "@@")
stampa_totali_cat(currcodcat,currdescat); //serve per stampare l'ultima categoria (perché ogni categoria viene stampata quando inizia la scansione della successiva)
_cat.azzera();
currcodcat = codcat;
if (ordinamento == 0) //se ordinato (ed aggregato) per categoria...
currdescat = ces.categoria().get("S0");
else //se ordinato (ed aggregato) per impianto...
currdescat = cache().get("CIM", currcodcat, "S0");
}
aggiorna_totali (sortcur, j, tipocespite);
}
} // fine scansione cespiti della categoria selezionata
if (currcodcat != "@@")
stampa_totali_cat(currcodcat,currdescat);
stampa_totali_tipo(tipocespite);
} // fine scansione tipi cespite
stampa_totali_generali();
// salta una pagina al termine della situazione stampata
printer().formfeed();
} // fine scansione su situazione da stampare (civilistica,fiscale,gestionale)
printer().close();
cursore.freeze(FALSE); */
}
}
}

View File

@ -1,64 +1,72 @@
// campi form prospetto cespiti
#define FF_CODDITTA 1
#define FF_DESCRDITTA 2
#define FF_GRUPPO 3
#define FF_D_GRUPPO 4
#define FF_SPECIE 5
#define FF_D_SPECIE 6
#define FF_CODCAT 7
#define FF_DESCRCAT 8
#define FF_CODCESP 9
#define FF_DESCRCESP 10
#define FF_ACQ 11
#define FF_ENTFUNZ 12
#define FF_SITUAZIONE 13
#define FF_DATASIT 14
#define FF_DESCRGR 15
#define FF_SEGNO 16
//-------------------------------------
// campi form prospetto cespiti (ce3300)
//-------------------------------------
#define FF_DATAUNO 20
#define FF_DESCRUNO 21
#define FF_TIPODOCUNO 22
#define FF_NUMDOCUNO 23
#define FF_NUMELEUNO 25
#define FF_VALOREUNO 26
#define FF_FONDIUNO 27
#define FR_CODDITTA 1
#define FR_RAGSOC 2
#define FR_GRUPPO 3
#define FR_D_GRUPPO 4
#define FR_SPECIE 5
#define FR_D_SPECIE 6
#define FR_DATAINIZIO 7
#define FR_DATAFINE 8
#define FR_SITUAZIONE 9
#define FR_INT_COD 10
#define FR_INT_DESC 11
#define FF_TOTELEM 31
#define FF_TOTVALORE 32
#define FF_TOTAMMO 33
#define FF_MINUS 35
#define FF_MINUSVEN 36
#define FR_TC_CAT 21
#define FR_TC_D_CAT 22
#define FR_TC_CSTO 23
#define FR_TC_TOTRIV 24
#define FR_TC_VALINIES 25
#define FR_TC_RIVALES 26
#define FR_TC_ACQINCR 27
#define FR_TC_CESSELIM2 28
#define FR_TC_VALBIL 29
#define FR_TC_FONDINIES 30
#define FR_TC_INCR 31
#define FR_TC_CESSELIM3 32
#define FR_TC_REINPLUS 33
#define FR_TC_AMMNOR 34
#define FR_TC_AMMACC 35
#define FR_TC_AMMANT 36
#define FR_TC_FONDBIL 37
#define FR_TC_RESBIL 38
#define FF_DATE 40
#define FF_PAGE 41
#define FR_TT_CAT 41
#define FR_TT_D_CAT 42
#define FR_TT_CSTO 43
#define FR_TT_TOTRIV 44
#define FR_TT_VALINIES 45
#define FR_TT_RIVALES 46
#define FR_TT_ACQINCR 47
#define FR_TT_CESSELIM2 48
#define FR_TT_VALBIL 49
#define FR_TT_FONDINIES 50
#define FR_TT_INCR 51
#define FR_TT_CESSELIM3 52
#define FR_TT_REINPLUS 53
#define FR_TT_AMMNOR 54
#define FR_TT_AMMACC 55
#define FR_TT_AMMANT 56
#define FR_TT_FONDBIL 57
#define FR_TT_RESBIL 58
#define FF_PENOR 50
#define FF_PEANT 51
#define FF_PEACC 52
#define FF_ALINOR 53
#define FF_ALIANT 54
#define FF_ALIACC 55
#define FF_QNOR 56
#define FF_QANT 57
#define FF_QACC 58
#define FF_VPENOR 60
#define FF_VPEANT 61
#define FF_VPEACC 62
#define FF_VALINOR 63
#define FF_VALIANT 64
#define FF_VALIACC 65
#define FF_VQNOR 66
#define FF_VQANT 67
#define FF_VQACC 68
#define FF_TPNOR 70
#define FF_TPANT 71
#define FF_TPACC 72
#define FF_TALINOR 73
#define FF_TALIANT 74
#define FF_TALIACC 75
#define FF_TQNOR 76
#define FF_TQANT 77
#define FF_TQACC 78
#define FR_TG_CAT 61
#define FR_TG_D_CAT 62
#define FR_TG_CSTO 63
#define FR_TG_TOTRIV 64
#define FR_TG_VALINIES 65
#define FR_TG_RIVALES 66
#define FR_TG_ACQINCR 67
#define FR_TG_CESSELIM2 68
#define FR_TG_VALBIL 69
#define FR_TG_FONDINIES 70
#define FR_TG_INCR 71
#define FR_TG_CESSELIM3 72
#define FR_TG_REINPLUS 73
#define FR_TG_AMMNOR 74
#define FR_TG_AMMACC 75
#define FR_TG_AMMANT 76
#define FR_TG_FONDBIL 77
#define FR_TG_RESBIL 78

View File

@ -1,568 +1,346 @@
#include "ce3300.h"
//------RELAZIONE----------------------------------------------//
USE LF_CESPI
JOIN LF_SALCE INTO IDCESPITE==IDCESPITE
JOIN LF_MOVCE KEY 2 ALIAS 105 INTO IDCESPITE==IDCESPITE
JOIN LF_MOVAM TO LF_MOVCE INTO IDCESPITE==IDCESPITE IDMOV==IDMOV
JOIN LF_AMMMV TO LF_MOVCE ALIAS 107 INTO IDCESPITE==IDCESPITE IDMOV==IDMOV
JOIN LF_AMMCE TO LF_SALCE INTO IDCESPITE==IDCESPITE CODES==CODES TPSALDO==TPSALDO
JOIN %CAC ALIAS 101 INTO CODTAB[1,2]==CODCGRA|CODTAB[3,6]==CODSPA|CODTAB[7,8]==CODCAT
JOIN ESC TO LF_SALCE ALIAS 102 INTO CODTAB==CODES
JOIN %TMC TO LF_MOVCE ALIAS 103 INTO CODTAB==CODMOV
END
DESCRIPTION
BEGIN
136->* "Ammortamento cespiti"
137->* "Ammortamenti su movimenti"
139->* "Anagrafica cespiti"
142->* "Movimenti cespiti"
143->* "Saldi cespiti"
END
GENERAL
BEGIN
OFFSET 0 1
FONT "Courier New"
SIZE 10
// OFFSET 0 1
// FONT "Courier New"
// SIZE 10
END
SECTION GRAPHIC
BEGIN
END
//------------------------intestazione------------------------------------------------//
SECTION HEADER ODD 12
SECTION HEADER FIRST 12
STRINGA -1
BEGIN
KEY "titolo"
PROMPT 1 1 "ALLEGATO AL BILANCIO FISCALE"
END
STRINGA FF_CODDITTA 20
BEGIN
KEY "codice ditta"
PROMPT 1 3 "Ditta "
PICTURE "#####"
END
STRINGA FF_DESCRDITTA 50
BEGIN
KEY "descriz ditta"
PROMPT 20 3 ""
END
NUMERO FF_GRUPPO 12
BEGIN
KEY "codice gruppo"
PROMPT 1 4 "Gruppo "
PICTURE "#####"
END
STRINGA FF_D_GRUPPO 50
BEGIN
KEY "descrizione gruppo"
PROMPT 20 4 ""
END
STRINGA FF_SPECIE 12
BEGIN
KEY "codice specie"
PROMPT 1 5 "Specie "
PICTURE "#####"
END
STRINGA FF_D_SPECIE 50
BEGIN
KEY "descrizione specie"
PROMPT 20 5 ""
END
STRINGA -1
BEGIN
KEY "riga di separazione"
PROMPT 1 6 "================================================================================================================================="
END
NUMERO FF_CODCAT 12
BEGIN
KEY "codice categoria"
PROMPT 1 7 "Categoria "
FIELD LF_CESPI->CODCAT
END
STRINGA FF_DESCRCAT 60
BEGIN
KEY "descrizione categoria"
PROMPT 20 7 ""
MESSAGE _DESCAT,FF_GRUPPO,FF_SPECIE,FF_CODCAT
END
STRINGA -1
BEGIN
KEY "costo storico"
PROMPT 64 7 "Costo storico"
END
/*
NUMERO FF_CODCESP 12
BEGIN
KEY "codice cespite"
PROMPT 1 8 "Cespite "
FIELD LF_CESPI->IDCESPITE
END
STRINGA FF_DESCRCESP 50
BEGIN
KEY "descrizione cespite"
PROMPT 20 8 ""
FIELD LF_CESPI->DESC
END
DATA FF_ACQ
STRINGA -1
BEGIN
KEY "Data acquisizione"
PROMPT 1 9 "Data acquisizione "
FIELD LF_CESPI->DTCOMP
END
KEY "titolo"
PROMPT 36 1 "ALLEGATO AL BILANCIO FISCALE"
END
DATA FF_ENTFUNZ
BEGIN
KEY "Data entrata in funzione"
PROMPT 35 9 "Data entrata in funzione "
FIELD LF_CESPI->DTFUNZ
END
STRINGA FR_CODDITTA
BEGIN
KEY "Codice ditta"
PROMPT 1 2 "Ditta "
PICTURE "#####"
END
STRINGA FR_RAGSOC
BEGIN
KEY "Ragione sociale"
PROMPT 15 2 ""
END
STRINGA FR_GRUPPO
BEGIN
KEY "Gruppo"
PROMPT 1 3 "Gruppo "
PICTURE "#####"
END
STRINGA FF_SITUAZIONE 19
BEGIN
KEY "tipo situazione"
PROMPT 1 10 "Situazione "
END
STRINGA FR_D_GRUPPO
BEGIN
KEY "Descrizione Gruppo"
PROMPT 15 3 ""
END
DATA FF_DATASIT
BEGIN
KEY "data situazione"
PROMPT 24 10 " al "
FIELD 102@->D1
END
STRINGA FR_SPECIE
BEGIN
KEY "Specie"
PROMPT 1 4 "Specie "
PICTURE "#####"
END
STRINGA -1
BEGIN
KEY "Data movimento"
PROMPT 1 12 "Data mov. "
END
STRINGA FR_D_SPECIE
BEGIN
KEY "Descrizione Specie"
PROMPT 15 4 ""
END
DATA FR_DATAINIZIO
BEGIN
KEY "Data inizio esercizio"
PROMPT 1 5 "Esercizio "
END
DATA FR_DATAFINE
BEGIN
KEY "Data fine esercizio"
PROMPT 25 5 " - "
END
STRINGA -1
BEGIN
KEY "Descrizione movimento"
PROMPT 12 12 "Descrizione"
END
STRINGA -1
BEGIN
KEY "tipo situaz. da stampare"
PROMPT 1 6 "Situazione "
END
STRINGA -1
BEGIN
KEY "Documento di riferimento"
PROMPT 33 12 "Rif. Doc."
END
STRINGA FR_SITUAZIONE
BEGIN
KEY "tipo situaz. da stampare"
PROMPT 12 6 ""
END
STRINGA -1
BEGIN
PROMPT 1 7 "==================================================================================================================================================="
END
STRINGA FR_INT_COD
BEGIN
KEY "Intestazione stampa"
PROMPT 1 8 ""
END
STRINGA -1
BEGIN
KEY "Elementi"
PROMPT 45 12 "Elem."
END
STRINGA FR_INT_DESC
BEGIN
KEY "Intestazione stampa"
PROMPT 8 8 ""
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 64 8 "Costo storico"
END
STRINGA -1
BEGIN
KEY "Valore"
PROMPT 50 12 " Valore"
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 106 8 "Tot. rivalutazioni"
END
STRINGA -1
BEGIN
KEY "Fondo ammortamento"
PROMPT 66 12 " F.do amm."
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 130 8 "Val. inizio eser."
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 59 9 "Rival. esercizio"
END
STRINGA -1
BEGIN
KEY "Tipo aliquota"
PROMPT 82 12 " Aliq. tipo"
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 82 9 "Acq/incrementi"
END
STRINGA -1
BEGIN
KEY "Ammortamenti su eliminati"
PROMPT 95 12 "Amm. eliminati"
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 106 9 "Cessioni/Elimin."
END
STRINGA -1
BEGIN
KEY "Pluvalenze/Minusvalenze"
PROMPT 115 12 "Plus/minus"
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 128 9 "Valore a bilancio"
END
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 55 10 "Fondo inizio eser."
END
//--------------------------------------------------------
SECTION BODY FIRST 1
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 84 10 "Incrementi"
END
DATA FF_DATAUNO
BEGIN
KEY "data"
PROMPT 1 1 ""
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 104 10 "Cessioni/Elimin."
END
STRINGA FF_DESCRUNO 20 2
BEGIN
KEY "descrizione"
PROMPT 12 1 ""
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 127 10 "Reinvest. Plusv."
END
STRINGA FF_TIPODOCUNO 2
BEGIN
KEY "tipo docum. rif."
PROMPT 33 1 ""
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 34 11 "Amm. normale"
END
STRINGA FF_NUMDOCUNO 7
BEGIN
KEY "numero docum. rif."
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 56 11 "Amm. accelerato"
END
NUMERO FF_NUMELEUNO 3
BEGIN
KEY "numero elementi"
PROMPT 45 1 ""
MESSAGE COPY,F0->FF_TOTELEM
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 77 11 "Amm. anticipato"
END
VALUTA FF_VALOREUNO 15
BEGIN
KEY "valore"
PROMPT 50 1 ""
MESSAGE COPY,F0->FF_TOTVALORE
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 102 11 "Fondo a bilancio"
END
VALUTA FF_FONDIUNO 15
BEGIN
KEY "fondo ammortamento"
PROMPT 66 1 ""
MESSAGE COPY,F0->FF_TOTAMMO
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 123 11 "Residuo a bilancio"
END
END
//----------------------------------------------------------------------
SECTION BODY ODD 1
DATA -1
BEGIN
KEY "data movimento"
PROMPT 1 1 ""
FIELD LF_MOVCE->DTMOV
END
STRINGA -1 20 2
BEGIN
KEY "descrizione"
PROMPT 12 1 ""
FIELD LF_MOVCE->DESC
END
STRINGA -1 2
BEGIN
KEY "tipo docum. rif."
PROMPT 33 1 ""
FIELD LF_MOVCE->TPDOC
END
STRINGA -1 7
BEGIN
KEY "numero docum. rif."
PROMPT 36 1 ""
FIELD LF_MOVCE->NDOC
END
NUMERO -1 3
BEGIN
KEY "numero elementi"
PROMPT 45 1 ""
FIELD LF_MOVCE->NUMELE
MESSAGE ADD,F->FF_TOTELEM
END
VALUTA -1 15
BEGIN
KEY "valore"
PROMPT 50 1 ""
MESSAGE _NUMEXPR,LF_MOVCE->CSTO-LF_MOVCE->VNONAMM+LF_MOVCE->RIV75+LF_MOVCE->RIV83+LF_MOVCE->RIV90+LF_MOVCE->RIV91+LF_MOVCE->RIVGF
MESSAGE ADD,F->FF_TOTVALORE
END
VALUTA -1 15
BEGIN
KEY "fondo ammortamento"
PROMPT 66 1 ""
MESSAGE _NUMEXPR,LF_MOVAM->QNOR+LF_MOVAM->QACC+LF_MOVAM->QANT
MESSAGE ADD,F->FF_TOTAMMO
END
NUMERO -1 7
BEGIN
KEY "aliquota normale"
PROMPT 82 1 ""
PICTURE "##@,@@@"
FIELD LF_AMMMV->PENOR
MESSAGE ENABLE,1@
MESSAGE EMPTY DISABLE,1@
GROUP 1
END
NUMERO -1 7
BEGIN
KEY "aliquota anticipata"
PROMPT 82 1 ""
PICTURE "##@,@@@"
FIELD LF_AMMMV->PEANT
MESSAGE ENABLE,2@
MESSAGE EMPTY DISABLE,2@
GROUP 2
END
NUMERO -1 7
BEGIN
KEY "aliquota accelerata"
PROMPT 82 1 ""
PICTURE "##@,@@@"
FIELD LF_AMMMV->PEACC
MESSAGE ENABLE,3@
MESSAGE EMPTY DISABLE,3@
GROUP 3
END
STRINGA FF_ALINOR
BEGIN
KEY "normale"
FLAG "H"
PROMPT 90 1 "nor"
GROUP 1
END
STRINGA FF_ALIANT
BEGIN
KEY "anticipata"
FLAG "H"
PROMPT 90 1 "ant"
GROUP 2
END
STRINGA FF_ALIACC
BEGIN
KEY "accelerata"
PROMPT 90 1 "acc"
GROUP 3
END
VALUTA -1 15
BEGIN
KEY "ammortamento eliminato normale"
PROMPT 94 1 ""
FIELD LF_AMMMV->QNOR
GROUP 1
END
VALUTA -1 15
BEGIN
KEY "ammortamento eliminato anticipato"
PROMPT 94 1 ""
FIELD LF_AMMMV->QANT
GROUP 2
END
VALUTA -1 15
BEGIN
KEY "ammortamento eliminato accelerato"
PROMPT 94 1 ""
FIELD LF_AMMMV->QACC
GROUP 3
END
VALUTA -1 15
BEGIN
KEY "minusvalenza"
PROMPT 110 1 "-"
FIELD LF_AMMMV->MINUS
MESSAGE ENABLE,4@
MESSAGE EMPTY DISABLE,4@
GROUP 4
END
VALUTA -1 15
BEGIN
KEY "plusvalenza"
PROMPT 110 1 ""
FIELD LF_AMMMV->PLUS
MESSAGE ENABLE,5@
MESSAGE EMPTY DISABLE,5@
GROUP 5
END
END
//-----------------------------------------------------------------
SECTION BODY EVEN 1
DATA -1
BEGIN
KEY "data fine esercizio"
PROMPT 1 1 ""
FIELD ESC->D1
END
STRINGA -1 20 2
BEGIN
KEY "descrizione"
PROMPT 12 1 "Quote d'ammortamento"
END
VALUTA -1 15
BEGIN
KEY "fondo ammortamento normale"
PROMPT 66 1 ""
FIELD LF_AMMCE->QNOR
MESSAGE ENABLE,6@
MESSAGE EMPTY DISABLE,6@
GROUP 6
END
VALUTA -1 15
BEGIN
KEY "fondo ammortamento anticipato"
PROMPT 66 1 ""
FIELD LF_AMMCE->QANT
MESSAGE ENABLE,7@
MESSAGE EMPTY DISABLE,7@
GROUP 7
END
VALUTA -1 15
BEGIN
KEY "fondo ammortamento accelerato"
PROMPT 66 1 ""
FIELD LF_AMMCE->QACC
MESSAGE ENABLE,8@
MESSAGE EMPTY DISABLE,8@
GROUP 8
END
NUMERO -1 7
BEGIN
KEY "aliquota normale"
PROMPT 82 1 ""
PICTURE "##@,@@@"
FIELD LF_AMMCE->PNOR
// MESSAGE ENABLE,6@
// MESSAGE EMPTY DISABLE,6@
GROUP 6
END
NUMERO -1 7
BEGIN
KEY "aliquota anticipata"
PROMPT 82 1 ""
PICTURE "##@,@@@"
FIELD LF_AMMCE->PANT
// MESSAGE ENABLE,7@,2@
// MESSAGE EMPTY DISABLE,7@
GROUP 7
END
NUMERO -1 7
BEGIN
KEY "aliquota accelerata"
PROMPT 82 1 ""
PICTURE "##@,@@@"
FIELD LF_AMMCE->PACC
// MESSAGE ENABLE,8@,3@
// MESSAGE EMPTY DISABLE,8@
GROUP 8
END
STRINGA -1
BEGIN
KEY "normale"
FLAG "H"
PROMPT 90 1 "nor"
GROUP 6
END
STRINGA -1
BEGIN
KEY "anticipata"
FLAG "H"
PROMPT 90 1 "ant"
GROUP 7
END
STRINGA -1
BEGIN
KEY "accelerata"
PROMPT 90 1 "acc"
GROUP 8
END
END
//-------------------------------------------------------
SECTION FOOTER ODD 1
STRINGA -1
BEGIN
KEY "totale"
PROMPT 1 1 "TOTALE"
END
NUMERO FF_TOTELEM 4
BEGIN
KEY "totale numero elementi"
PROMPT 45 1 ""
END
VALUTA FF_TOTVALORE 15
BEGIN
KEY "valore"
PROMPT 50 1 ""
END
VALUTA FF_TOTAMMO 15
BEGIN
KEY "fondo ammortamento"
PROMPT 66 1 ""
END
END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 12 "==================================================================================================================================================="
END
END //section header first
//--------------------------------------------------------------//
SECTION BODY ODD 5
STRINGA FR_TC_CAT 10
BEGIN
KEY "codice categoria"
PROMPT 1 1 ""
END
STRINGA FR_TC_D_CAT 55
BEGIN
KEY "descrizione categoria"
PROMPT 12 1 ""
END
VALUTA FR_TC_CSTO 15
BEGIN
KEY "costo storico"
PROMPT 62 1 ""
END
VALUTA FR_TC_TOTRIV 15
BEGIN
KEY "totale rivalutazioni"
PROMPT 109 1 ""
END
VALUTA FR_TC_VALINIES 15
BEGIN
KEY "valore inizio esercizio"
PROMPT 132 1 ""
END
VALUTA FR_TC_RIVALES 15
BEGIN
KEY "rivalutazione esercizio"
PROMPT 60 2 ""
END
VALUTA FR_TC_ACQINCR 15
BEGIN
KEY "acquisti/incrementi"
PROMPT 81 2 ""
END
VALUTA FR_TC_CESSELIM2 15
BEGIN
KEY "cessioni/elimin. riga 2"
PROMPT 107 2 ""
END
VALUTA FR_TC_VALBIL 15
BEGIN
KEY "valore a bilancio"
PROMPT 130 2 ""
END
VALUTA FR_TC_FONDINIES 15
BEGIN
KEY "fondo inizio esercizio"
PROMPT 58 3 ""
END
VALUTA FR_TC_INCR 15
BEGIN
KEY "incrementi"
PROMPT 79 3 ""
END
VALUTA FR_TC_CESSELIM3 15
BEGIN
KEY "cessioni/elimin. riga 3"
PROMPT 105 3 ""
END
VALUTA FR_TC_REINPLUS 15
BEGIN
KEY "reinvest. plusv."
PROMPT 128 3 ""
END
VALUTA FR_TC_AMMNOR 15
BEGIN
KEY "ammortamento normale"
PROMPT 31 4 ""
END
VALUTA FR_TC_AMMACC 15
BEGIN
KEY "ammortamento accelerato"
PROMPT 56 4 ""
END
VALUTA FR_TC_AMMANT 15
BEGIN
KEY "ammortamento anticipato"
PROMPT 77 4 ""
END
VALUTA FR_TC_FONDBIL 15
BEGIN
KEY "fondo a bilancio"
PROMPT 103 4 ""
END
VALUTA FR_TC_RESBIL 15
BEGIN
KEY "residuo a bilancio"
PROMPT 126 4 ""
END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 5 "---------------------------------------------------------------------------------------------------------------------------------------------------"
END
END //section body odd
//-------------------------------------------------------------//
//vero footer di pagina!//
SECTION FOOTER FIRST 4
DATA FF_DATE
BEGIN
KEY "Data"
PROMPT 1 2 "Data "
MESSAGE _TODAY
END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 1 "---------------------------------------------------------------------------------------------------------------------------------------------------"
END
NUMERO FF_PAGE 7
BEGIN
KEY "Nr. pagina"
PROMPT 30 2 "Pagina "
MESSAGE _PAGENO
END
STRINGA -1
BEGIN
KEY "Data"
PROMPT 1 2 "Data Stampa "
MESSAGE _TODAY
END
NUMERO -1 7
BEGIN
KEY "Nr. pagina"
PROMPT 130 2 "Pagina n. "
MESSAGE _PAGENO
END
END */
END // section footer last (footer pagina)
END // form

View File

@ -1,15 +1,16 @@
// campi maschera ce3300a.msk
// campi maschera ce3300a
#define F_CODDITTA 101
#define F_DESCRDITTA 102
#define F_GRUPPO 103
#define F_SPECIE 104
#define F_D_SPECIE 105
#define F_ESERCIZIO 106
#define F_INIZIO_ES 107
#define F_FINE_ES 108
#define F_SITFISC 110
#define F_SITCIV 111
#define F_SITGEST 112
#define F_ORDINA 113
#define F_D_GRUPPO 114
#define F_CODDITTA 101
#define F_DESCRDITTA 102
#define F_ESERCIZIO 103
#define F_INIZIO_ES 104
#define F_FINE_ES 105
#define F_GRUPPO 106
#define F_D_GRUPPO 107
#define F_SPECIE 108
#define F_D_SPECIE 109
#define F_SITFISC 120
#define F_SITCIV 121
#define F_SITGEST 122
#define F_ORDINA 123

View File

@ -64,7 +64,7 @@ BEGIN
DISPLAY "Descrizione@60" 106@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_D_GRUPPO 106@->S0
CHECKTYPE NORMAL
CHECKTYPE REQUIRED
END
STRING F_D_GRUPPO 60 55
@ -77,15 +77,14 @@ STRING F_SPECIE 4
BEGIN
PROMPT 2 5 "Specie "
FLAGS "_"
USE CCB
JOIN %CAT ALIAS 400 INTO CODTAB==CODTAB[5,10]
INPUT CODTAB[1,4] F_ESERCIZIO
INPUT CODTAB[5,6] F_GRUPPO
USE CCB KEY 1
JOIN %CAT ALIAS 400 INTO CODTAB[1,2]==CODTAB[5,6] CODTAB[3,6]==CODTAB[7,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO SELECT
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@50" 400@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_D_SPECIE 400@->S0
CHECKTYPE REQUIRED

View File

@ -1,5 +1,6 @@
#include <prefix.h>
#include <recarray.h>
#include <sheet.h>
#include "celib.h"
@ -31,8 +32,7 @@ void TDitta_cespiti::load_default()
_data_primi_ricavi = dit.get("CADTR");
_anno_tuir = dit.get_int("CATSU");
str.format("%04d", _esercizio);
_cce = cache().get("CCE", str);
load_records();
}
void TDitta_cespiti::update_when_needed()
@ -41,7 +41,17 @@ void TDitta_cespiti::update_when_needed()
load_default();
}
void TDitta_cespiti::set_attivita(int esercizio, const TString& gruppo, const TString& specie)
void TDitta_cespiti::load_records()
{
TString16 str;
str.format("%04d", _esercizio);
_cce = cache().get("CCE", str);
str.format("%04d%2s%4s", _esercizio, (const char*)_gruppo, (const char*)_specie);
_ccb = cache().get("CCB", str);
}
void TDitta_cespiti::set_attivita(int esercizio, int gruppo, const char* specie)
{
if (esercizio <= 0)
{
@ -50,10 +60,10 @@ void TDitta_cespiti::set_attivita(int esercizio, const TString& gruppo, const TS
}
else
_esercizio = esercizio;
_gruppo = gruppo;
_specie = specie;
_gruppo.format("%02d", gruppo);
_specie.format("%-4s", (const char*)specie);
TConfig dit(CONFIG_DITTA);
TConfig dit(CONFIG_DITTA, "ce");
dit.set("CODESCORR", _esercizio);
dit.set("GRUPPOCORR", _gruppo);
TString16 str; str << '"' << _specie << '"';
@ -61,17 +71,27 @@ void TDitta_cespiti::set_attivita(int esercizio, const TString& gruppo, const TS
_data_primi_ricavi = dit.get("CADTR");
_anno_tuir = dit.get_int("CATSU");
_ditta = prefix().get_codditta();
str.format("%d", _esercizio);
_cce = cache().get("CCE", str);
load_records();
}
void TDitta_cespiti::get_attivita(int& esercizio, TString& gruppo, TString& specie)
const TRectype& TDitta_cespiti::get_attivita() const
{
return _ccb;
}
const TRectype& TDitta_cespiti::get_attivita(int& esercizio, TString& gruppo, TString& specie) const
{
esercizio = _esercizio;
gruppo = _gruppo;
specie = _specie;
return get_attivita();
}
bool TDitta_cespiti::bollato_stampato() const
{
return _ccb.get_bool("B1");
}
int TDitta_cespiti::esercizio_corrente(TDate& inies, TDate& fines) const
@ -90,7 +110,7 @@ void TDitta_cespiti::init_mask(TMask& m)
TBit_array found;
bool started = FALSE;
bool finished = FALSE;
for (int i = 0; !finished && i < 12; i++)
for (int i = 0; !finished && i < 18; i++)
{
TMask_field& f = m.fld(i);
if (started)
@ -184,8 +204,117 @@ bool TDitta_cespiti::esente_art14() const
return _cce.get_bool("B7");
}
const TRectype& TDitta_cespiti::categoria(int gr, const char* sp, int ca) const
{
TString16 key;
if (ca >= 41)
key.format(" %02d", ca);
else
{
if (gr <= 0)
gr = atoi(_gruppo);
if (sp == NULL || *sp < ' ')
sp = _specie;
key.format("%02d%-4s%02d", gr, sp, ca);
}
const TRectype& cac = cache().get("%CAC", key);
return cac;
}
static TString8 _cac_filter;
static bool cac_filter_func(const TRelation* rel)
{
const TString& grsp = rel->curr().get("CODTAB");
if (grsp[0] == ' ')
return TRUE;
return _cac_filter.compare(grsp, 6) == 0;
}
bool TDitta_cespiti::on_category_event(TOperable_field& o, TField_event e, long jolly)
{
if (e != fe_init && e != fe_button && e != fe_close)
return TRUE;
TEdit_field& fld = (TEdit_field&)o;
const bool by_code = fld.is_kind_of(CLASS_REAL_FIELD);
TOperable_field* fgrp = fld.driver(0);
TOperable_field* fspe = fld.driver(1);
int gruppo = fgrp ? atoi(fgrp->get()) : 0;
TString4 specie = fspe ? (const char*)fspe->get() : "";
if (gruppo <= 0 || specie.blank())
{
int anno;
TString4 sg, ss;
get_attivita(anno, sg, ss);
if (gruppo <= 0) gruppo = atoi(sg);
if (specie.blank()) specie = ss;
}
if (e == fe_button)
{
const char* fields = by_code ? "CODTAB[7,8]|S0" : "S0|CODTAB[7,8]";
const char* header = by_code ? "Categoria|Descrizione@60" : "Descrizione@60|Categoria";
const char* sorter = by_code ? "CODTAB[7,8]" : "S0";
TRelation rel("%CAC");
TSorted_cursor cur(&rel, sorter, "", by_code ? 1 : 2);
_cac_filter.format("%02d%-4s", gruppo, (const char*)specie);
cur.set_filterfunction(cac_filter_func);
long recno = 0L;
if (!fld.empty())
{
TRectype& rec = rel.curr();
rec.zero();
if (by_code)
{
TString8 key = fld.get();
key.right_just(8);
rec.put("CODTAB", key);
}
else
rec.put("S0", fld.get());
recno = cur.read();
}
TCursor_sheet sht(&cur, fields, "Categorie dei cespiti", header, 0, 1);
sht.select(recno);
if (sht.run() == K_ENTER)
{
TMask& m = fld.mask();
const int pos = m.id2pos(fld.dlg());
TMask_field& fout = m.fld(pos + (by_code ? +1 : -1));
TToken_string& row = sht.row();
fld.set(row.get(0));
fout.set(row.get(1));
}
} else
if (e == fe_init && by_code && !o.empty())
{
const int cat = atoi(fld.get());
const TRectype& cac = categoria(gruppo, specie, cat);
if (!cac.empty())
{
TMask& m = fld.mask();
const int pos = m.id2pos(fld.dlg());
TMask_field& fout = m.fld(pos + (by_code ? +1 : -1));
fout.set(cac.get("S0"));
}
} else
if (e == fe_close && by_code && !o.empty())
{
const int cat = atoi(o.get());
const TRectype& cac = categoria(gruppo, specie, cat);
if (cac.empty())
return fld.error_box(fld.get_warning());
}
return TRUE;
}
// Inizializza una ditta cespiti vuota
TDitta_cespiti::TDitta_cespiti() : _cce(LF_TAB)
TDitta_cespiti::TDitta_cespiti() : _cce(LF_TAB), _ccb(LF_TAB)
{
load_default();
}
@ -213,19 +342,12 @@ bool TForm_cespiti::validate(TForm_item& fld, TToken_string& val)
const TString8 fsp = val.get();
const TString8 fca = val.get();
TString4 gruppo = fld.find_field(fgr).get(); gruppo.right_just(2, '0');
TString4 specie = fld.find_field(fsp).get();
TString4 categoria = fld.find_field(fca).get(); categoria.right_just(2, '0');
TString16 key; key << gruppo << specie << categoria;
const TRectype& cac = cache().get("%CAC", key);
if (cac.empty())
{
key.overwrite(" ");
const TRectype& cac2 = cache().get("%CAC", key);
fld.set(cac2.get("S0"));
}
else
fld.set(cac.get("S0"));
const int gruppo = atoi(fld.find_field(fgr).get());
const char* specie = fld.find_field(fsp).get();
const int categoria = atoi(fld.find_field(fca).get());
const TRectype& cac = ditta_cespiti().categoria(gruppo, specie, categoria);
fld.set(cac.get("S0"));
return TRUE;
}
return TForm::validate(fld,val);
}
@ -233,3 +355,5 @@ bool TForm_cespiti::validate(TForm_item& fld, TToken_string& val)
TForm_cespiti::TForm_cespiti(const char* name) : TForm(name)
{
}

View File

@ -9,8 +9,8 @@
#include <isam.h>
#endif
#ifndef __MASK_H
#include <mask.h>
#ifndef __AUTOMASK_H
#include <automask.h>
#endif
class TDitta_cespiti
@ -19,17 +19,20 @@ class TDitta_cespiti
int _esercizio, _anno_tuir;
TString4 _gruppo, _specie;
TDate _data_primi_ricavi;
TRectype _cce;
TRectype _cce, _ccb;
protected:
void load_default();
void update_when_needed();
void load_records();
public:
void set_attivita(int esercizio, const TString& gruppo, const TString& specie);
void get_attivita(int& esercizio, TString& gruppo, TString& specie);
void set_attivita(int esercizio, int gruppo, const char* specie);
const TRectype& get_attivita(int& esercizio, TString& gruppo, TString& specie) const;
const TRectype& get_attivita() const;
int esercizio_corrente() const { return _esercizio; }
int esercizio_corrente(TDate& inies, TDate& fines) const;
const TRectype& categoria(int gr, const char* sp, int ca) const;
const TDate& data_primi_ricavi() const { return _data_primi_ricavi; }
bool rinvio_ammortamento_ai_primi_ricavi() const;
@ -39,12 +42,14 @@ public:
bool professionista() const;
bool esercizio_costituzione() const;
real coefficiente_durata_esercizio() const;
bool bollato_stampato() const;
int anno_tuir() const { return _anno_tuir; }
void init_mask(TMask& m);
void arrotonda(real &n) const;
bool on_category_event(TOperable_field& fld, TField_event e, long jolly = 0L);
TDitta_cespiti();
};

View File

@ -115,8 +115,8 @@ Picture = <ce00.bmp>
Module = 11
Flags = ""
Item_01 = "Scheda storico cespite", "ce3 -1", ""
Item_02 = "Prospetto cespiti", "", ""
Item_03 = "Prospettto rivalutazioni", "", ""
Item_02 = "Prospetto cespiti", "ce3 -2", ""
Item_03 = "Prospetto rivalutazioni", "", ""
Item_04 = "Registro cespiti", "ce3 -0", ""
[PRASSICE_012]

View File

@ -7,6 +7,7 @@
#define F_CODGR_CCB 105
#define F_DESCRGR_CCB 106
#define F_CODSP_CCB 107
#define F_CODATT_CCB 108
#define F_LEASING 110
#define F_BOLLATO 111

View File

@ -18,11 +18,11 @@ END
NUMBER F_CODESER_CCB 4
BEGIN
PROMPT 2 1 "Codice esercizio "
FLAGS "Z"
FLAGS "PZ"
KEY 1
USE CCE
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB
FIELD CODTAB
FIELD CODTAB[1,4]
INPUT CODTAB F_CODESER_CCB
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Data inizio esercizio" 105@->D0
@ -50,66 +50,54 @@ BEGIN
PROMPT 2 2 "Gruppo "
FIELD CODTAB[5,6]
FLAGS "Z"
KEY 1
USE %CGR
INPUT CODTAB F_CODGR_CCB
DISPLAY "Codice Gruppo"CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODGR_CCB CODTAB
OUTPUT F_DESCRGR_CCB S0
KEY 1
CHECKTYPE REQUIRED
END
STRING F_DESCRGR_CCB 60 50
STRING F_CODSP_CCB 4 //campo per l'inserimento di una specie esistente
BEGIN
PROMPT 20 2 ""
USE %CGR KEY 2
INPUT CODTAB F_CODGR_CCB
INPUT S0 F_DESCRGR_CCB
DISPLAY "Descrizione@60" S0
DISPLAY "Codice" CODTAB
OUTPUT F_CODGR_CCB CODTAB
OUTPUT F_DESCRGR_CCB S0
END
STRING F_CODSP_CCB 4
BEGIN
PROMPT 2 3 "Specie "
PROMPT 15 2 "Specie "
FIELD CODTAB[7,10]
FLAGS "_"
KEY 1
USE CCB
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB[1,4]
JOIN %CAT ALIAS 106 INTO CODTAB[1,2]==CODTAB[5,6] CODTAB[3,6]==CODTAB[7,10]
INPUT CODTAB[1,4] F_CODESER_CCB SELECT
INPUT CODTAB[5,6] F_CODGR_CCB
INPUT CODTAB[7,10] F_CODSP_CCB
DISPLAY "Codice esercizio" CODTAB[1,4]
DISPLAY "Data inizio" 105@->D0
DISPLAY "Data fine" 105@->D1
DISPLAY "Codice Gruppo" CODTAB[5,6]
DISPLAY "Codice Specie" CODTAB[7,10]
DISPLAY "Descrizione @50" 106@->S0
OUTPUT F_CODESER_CCB CODTAB[1,4]
OUTPUT F_DATAINI_CCB 105@->D0
OUTPUT F_DATAFINE_CCB 105@->D1
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@50" 106@->S0
OUTPUT F_CODGR_CCB CODTAB[5,6]
OUTPUT F_CODSP_CCB CODTAB[7,10]
OUTPUT F_DESCRSP_CCB 106@->S0
CHECKTYPE REQUIRED
CHECKTYPE FORCED
GROUP GR_SEARCH
END
STRING F_DESCRSP_CCB 60 50
STRING F_CODATT_CCB 4 //campo per l'inserimento di una nuova specie da attivitá giá esistenti
BEGIN
PROMPT 20 3 ""
USE %CAT KEY 2
INPUT S0 F_DESCRSP_CCB
DISPLAY "Descrizione @50" S0
DISPLAY "Codice gruppo" CODTAB[1,2]
DISPLAY "Codice specie" CODTAB[3,6]
OUTPUT F_CODSP_CCB CODTAB[3,6]
PROMPT 15 2 "Specie "
FLAGS "H_"
KEY 1
USE %CAT
INPUT CODTAB[1,2] F_CODGR_CCB
INPUT CODTAB[3,6] F_CODATT_CCB
DISPLAY "Gruppo" CODTAB[1,2]
DISPLAY "Specie" CODTAB[3,6]
DISPLAY "Descrizione@50" S0
OUTPUT F_CODGR_CCB CODTAB[1,2]
OUTPUT F_CODATT_CCB CODTAB[3,6]
OUTPUT F_DESCRSP_CCB S0
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODSP_CCB
GROUP GR_SEARCH
END
STRING F_DESCRSP_CCB 60
BEGIN
PROMPT 2 3 "Descrizione "
FLAGS "D"
END
BOOLEAN F_LEASING

View File

@ -6,7 +6,6 @@
#define F_TIPOCONTAB 104
#define F_ESERCOST 105
#define F_DIT_PROF 106
#define F_ESERCORR 107
#define F_RINV_AMM 108
#define F_ES_ART14 109
#define DLG_ATTIV 110

View File

@ -25,20 +25,29 @@ BEGIN
PROMPT 2 1 "Codice esercizio "
FLAGS "Z"
KEY 1
USE CCE
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB
FIELD CODTAB
/* USE CCE
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB
INPUT CODTAB F_CODESER
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Data inizio esercizio" 105@->D0
DISPLAY "Data fine esercizio" 105@->D1
OUTPUT F_CODESER CODTAB
OUTPUT F_DATAINI 105@->D0
OUTPUT F_DATAFINE 105@->D1
CHECKTYPE REQUIRED
OUTPUT F_DATAFINE 105@->D1 */
USE ESC
INPUT CODTAB F_CODESER
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio" D1
OUTPUT F_CODESER CODTAB
OUTPUT F_DATAINI D0
OUTPUT F_DATAFINE D1
CHECKTYPE FORCED
END
NUMBER F_CODESERCONT 4
/*NUMBER F_CODESERCONT 4
BEGIN
PROMPT 2 1 "Codice esercizio "
FLAGS "HZ"
@ -53,7 +62,7 @@ BEGIN
OUTPUT F_DATAFINE D1
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODESER
END
END */
DATE F_DATAINI
BEGIN

View File

@ -975,10 +975,9 @@ BEGIN
COPY OUTPUT F_CODBANPR
END
NUMBER F_IMPMINEFF 10
CURRENCY F_IMPMINEFF 10
BEGIN
PROMPT 2 6 "Importo minimo effetti "
PICTURE "."
FIELD LF_CFVEN->IMPMINEFF
END

View File

@ -100,7 +100,7 @@ BEGIN
DISPLAY "Data@10" D0
DISPLAY "Cambio@18" S4
OUTPUT FS_DATACAMBIO D0
OUTPUT FS_CAMBIO R10
OUTPUT FS_CAMBIO S4
CHECKTYPE NORMAL
GROUP 3
END

View File

@ -13,6 +13,7 @@
#include "cg2101.h"
#include "cg2103.h"
#include "cg4a00a.h"
#include "cglib01.h"
static int __anno;
@ -206,7 +207,6 @@ bool TGestAutoTrasp_mask::on_field_event(TOperable_field& o, TField_event e, lon
case F_DADATA:
if (e == fe_modify || e == fe_init)
{
__anno = e == fe_modify ? atoi(o.get().right(4)) : 0;
set(F_ANNO, __anno);
@ -351,7 +351,10 @@ void TGestAutoTrasp_mask::write_movs()
s = tt.get(F_CAUDEF - F_CAUMOV);
}
TDate dataop(get_date(F_DATAOP));
const TDate dataop = get(F_DATAOP);
TEsercizi_contabili esc;
const int annoes = esc.date2esc(dataop);
// Riutilizzo del cursore
const TRecnotype cur_items = _cur->items();
@ -384,7 +387,6 @@ void TGestAutoTrasp_mask::write_movs()
{
// Il prossimo numero di registrazione è...
long nr = get_last_nreg();
long nsosp = mpn_sosp_rec.get_long(MOV_NUMREG);
// Azzera le righe dei movimenti da scrivere
@ -398,6 +400,8 @@ void TGestAutoTrasp_mask::write_movs()
mpn_definitivo_rec.put(MOV_PROTIVA, def_caus.reg().protocol()+1);
mpn_definitivo_rec.put(MOV_DATAREG, dataop);
mpn_definitivo_rec.put(MOV_DATACOMP, dataop);
mpn_definitivo_rec.put(MOV_ANNOES, annoes);
mpn_definitivo_rec.put(MOV_ANNOIVA, dataop.year());
mpn_definitivo_rec.put(MOV_CODCAUS, def_caus.codice());
mpn_definitivo_rec.put(MOV_REG, def_caus.reg().name());
mpn_definitivo_rec.put(MOV_TIPODOC, def_caus.tipo_doc());
@ -414,6 +418,8 @@ void TGestAutoTrasp_mask::write_movs()
mpn_storno_rec.put(MOV_PROTIVA, storno_caus.reg().protocol()+1);
mpn_storno_rec.put(MOV_DATAREG, dataop);
mpn_storno_rec.put(MOV_DATACOMP, dataop);
mpn_storno_rec.put(MOV_ANNOES, annoes);
mpn_storno_rec.put(MOV_ANNOIVA, dataop.year());
mpn_storno_rec.put(MOV_CODCAUS, storno_caus.codice());
mpn_storno_rec.put(MOV_REG, storno_caus.reg().name());
mpn_storno_rec.put(MOV_TIPODOC, storno_caus.tipo_doc());
@ -430,9 +436,11 @@ void TGestAutoTrasp_mask::write_movs()
vv.put(RMI_NUMREG, nr);
vv.zero(RMI_RIGAIMP);
vv.put(RMI_ANNOES, annoes);
ff.put(RMI_NUMREG, nr+1);
ff.zero(RMI_RIGAIMP);
ff.put(RMI_ANNOES, annoes);
}
// Se è effettivamente una causale di storno, cambia il segno al totale documento ed alle righe IVA
@ -441,7 +449,9 @@ void TGestAutoTrasp_mask::write_movs()
// Scrive il movimento di storno solo IVA sul reg in sospensione
while ((err = mpn_storno.write()) == _isreinsert)
mpn_storno_rec.put(MOV_NUMREG, ++nr); // Gestisce la rinumerazione
{
mpn_storno_rec.put(MOV_NUMREG, ++nr); // Gestisce la rinumerazione
}
if (err == NOERR)
{

View File

@ -811,8 +811,7 @@ bool TBill::find()
{
const long sotto = _sottoconto;
_sottoconto = 0L;
ok = read(pcon);
if (ok)
if (read(pcon))
_tipo = char(toupper(pcon.get_char(PCN_TMCF)));
_sottoconto = sotto;
}

View File

@ -1,3 +1,3 @@
17
0
$cfven|0|0|411|0|Clienti/Fornitori per vendite|||
$cfven|0|0|423|0|Clienti/Fornitori per vendite|||

View File

@ -34,7 +34,7 @@ CODCABPR|10|5|0|CAB banca di presentazione effetti
CODINDEFF|2|3|0|Indirizzo effetti
EMEFFRICH|8|1|0|Emissione effetti a richiesta
RAGGEFF|8|1|0|Raggruppa gli effetti del cliente/fornitore
IMPMINEFF|3|6|0|Importo minimo effetti
IMPMINEFF|4|18|3|Importo minimo effetti
NONACCEFF|1|50|0|Periodi di non accettazione effetti
NONSCADEFF|1|25|0|Scadenze effetti non accettati
ADDBOLLI|8|1|0|Addebito bolli

View File

@ -273,7 +273,7 @@ bool TDisplay_mask::on_field_event(TOperable_field& o, TField_event e, long joll
TTree_field& tf = tfield(F_TREE);
const int code = atoi(o.get());
TXmas_tree* tree = (TXmas_tree*)_xmas.first_item();
for (int i = 0; i < code; i++)
for (int i = 1; i < code; i++)
tree = (TXmas_tree*)_xmas.succ_item();
if (tf.tree() != tree)
{
@ -341,23 +341,31 @@ TDisplay_mask::TDisplay_mask(TAssoc_array& xmas)
: TAutomask("db1300b"), _xmas(xmas)
{
TTree_field& tf = tfield(F_TREE);
TList_field& lf = (TList_field&)field(F_CODICE);
lf.replace_items("", "");
TList_sheet* ls = efield(F_CODICE).sheet();
TString_array& rows = ls->rows_array();
rows.destroy();
TString16 code;
TString str;
TToken_string disp;
int i = 0;
FOR_EACH_ASSOC_OBJECT(_xmas, obj, key, item)
{
code.format("%03d", i++);
code.format("%03d", ++i);
disp = key; disp.replace('|', ' ');
disp.insert("|", 0); disp.insert(code, 0);
lf.add_item(disp);
TXmas_tree* albero = (TXmas_tree*)item;
albero->goto_root();
albero->get_description(str);
disp.add(str);
rows.add(disp);
if (item && tf.tree() == NULL)
{
tf.set_tree((TXmas_tree*)item);
lf.set(code);
tf.set_tree(albero);
set(F_CODICE, code);
}
}
}

View File

@ -21,10 +21,13 @@ ENDPAGE
PAGE "Implosione" -1 -1 60 20
LIST F_CODICE 3 40
NUMBER F_CODICE 3
BEGIN
PROMPT 1 0 "Articolo "
ITEM "000|Dummy"
PROMPT 1 0 "Risultato elaborazione "
FLAGS "Z"
SHEET "Codice|Articolo@30|Descrizione@50"
INPUT F_CODICE
OUTPUT F_CODICE
END
TREE F_TREE -3 -1

View File

@ -48,6 +48,8 @@ protected:
bool user_destroy();
virtual TMask* get_mask(int mode) {return _msk;}
virtual bool changing_mask(int mode) {return FALSE;}
void enable_controeuro();
public:
virtual TRelation* get_relation() const {return _rel;}
TVariazione_effetti() {};
@ -57,6 +59,17 @@ public:
// restituisce un riferimento all' applicazione
inline TVariazione_effetti& app() {return (TVariazione_effetti&)main_app();}
void TVariazione_effetti::enable_controeuro()
{
static int ce = -1;
if (ce < 0)
{
TConfig ini(CONFIG_DITTA, "ve");
ce = ini.get_bool("CONTROEURO");
}
_msk->enable(F_CONTROEURO, ce);
}
// quando si va in query mode resetta i due campi della maschera
// relativi ai totali
void TVariazione_effetti::init_query_mode(TMask&)
@ -64,6 +77,7 @@ void TVariazione_effetti::init_query_mode(TMask&)
_msk->reset(F_TOTIMP);
_msk->reset(F_TOTIMPVAL);
_msk->enable(F_TIPOCF);
enable_controeuro();
}
// quando si va in insert mode resetta i due campi della maschera relativi
@ -77,11 +91,13 @@ void TVariazione_effetti::init_insert_mode(TMask&)
righe_sheet().row(0) = riga;
righe_sheet().set_dirty();
_msk->enable(F_TIPOCF);
enable_controeuro();
}
void TVariazione_effetti::init_modify_mode(TMask&)
{
_msk->disable(F_TIPOCF);
enable_controeuro();
}
// ritorna il prossimo numero valido di chiave

View File

@ -35,6 +35,7 @@
#define F_EFFCOMP 229
#define F_SHEET_EFF 230
#define F_TIPOCF 231
#define F_CONTROEURO 232
// Identificatori campi per lo spreadsheet dei Cessionari
#define F_RAGSOC 101

View File

@ -144,6 +144,8 @@ BEGIN
DISPLAY "Codice" CODTAB
DISPLAY "Nome@50" S0
OUTPUT F_CODVAL CODTAB
OUTPUT F_CONTROEURO B1
OUTPUT F_CAMBIO S4
CHECKTYPE NORMAL
END
@ -157,9 +159,10 @@ BEGIN
INPUT CODTAB[4,11] F_DATACAM
DISPLAY "Valuta@9" CODTAB[1,3]
DISPLAY "Data@12" D0
DISPLAY "Cambio@19" R10
DISPLAY "Cambio@19" S4
OUTPUT F_DATACAM D0
OUTPUT F_CAMBIO R10
OUTPUT F_CONTROEURO B1
OUTPUT F_CAMBIO S4
CHECKTYPE SEARCH
GROUP 1
END
@ -175,9 +178,15 @@ BEGIN
GROUP 1
END
BOOLEAN F_CONTROEURO
BEGIN
PROMPT 40 8 "Controeuro "
FIELD CONTROEURO
END
BOOLEAN F_ULTRATA
BEGIN
PROMPT 46 8 "Ultima rata"
PROMPT 56 8 "Ultima rata"
FIELD ULTRATA
END

View File

@ -599,8 +599,21 @@ void TApplication::check_parameters(
argc--;
}
}
if (user().empty())
user() = "GUEST";
}
bool TApplication::test_assistance_year() const
{
#ifndef _DEMO_
const int dongle_year = dongle().year_assist();
int app_year, dum1, dum2, dum3;
bool ok = TApplication::get_version_info(app_year, dum1, dum2, dum3);
if (ok)
ok = app_year <= dongle_year;
return ok;
#else
return TRUE;
#endif // _DEMO_
}
// @doc EXTERNAL
@ -651,7 +664,7 @@ void TApplication::run(
}
if (!test_assistance_year())
{
error_box("Probabilmente e' scaduto il contratto di assistenza");
error_box("Probabilmente e' necessario attivare il contratto di assistenza");
return;
}

View File

@ -101,6 +101,8 @@ protected:
virtual void on_config_change();
// @cmember Chiamata ogni volta che l'utente cambia ditta
virtual void on_firm_change();
virtual bool test_assistance_year() const;
// @cmember Setta i permessi di utilizzo dei moduli
void set_perms();

View File

@ -148,7 +148,7 @@ public:
// eventualmente specificata da <p section>
TAssoc_array& list_variables(const char* section = NULL);
// @cmember Chaima cfgcb per ogni paragrafo
// @cmember Chiama cfgcb per ogni paragrafo
int for_each_paragraph(CONFIG_CALLBACK cfgcb, void* jolly);
// @cmember Ritorna il nome del file di configurazione

View File

@ -374,6 +374,7 @@ bool TDongle::hardlock_login(bool test_all_keys)
}
else
{
_year_assist = 0;
_dirty = TRUE;
}
}

View File

@ -1260,9 +1260,9 @@ void TForm_number::real2currency(const real& r, TString& str) const
TCurrency c(r);
c.set_price(_flag.price != 0);
const TExchange& oe = form().output_exchange();
if (!c.get_exchange().same_value_as(oe))
c.change_value(oe);
const TExchange* oe = form().output_exchange();
if (oe && !c.get_exchange().same_value_as(*oe))
c.change_value(*oe);
const TString& pic = picture();
const int piclen = pic.len();
@ -1468,9 +1468,9 @@ bool TForm_currency::update()
TCurrency curr = get_currency();
if (!_driver)
{
const TExchange& oe = form().output_exchange();
if (!curr.get_exchange().same_value_as(oe))
curr.change_value(oe);
const TExchange* oe = form().output_exchange();
if (oe != NULL && !curr.get_exchange().same_value_as(*oe))
curr.change_value(*oe);
}
// Niente apply_format(), la picture viene ignorata per i TForm_currency
@ -1505,9 +1505,15 @@ bool TForm_currency::update()
d = z.decimals();
}
else
{
const TCurrency z(ZERO, form().output_exchange(), _flag.price != 0);
d = z.decimals();
{
const TExchange* oe = form().output_exchange();
if (oe != NULL)
{
const TCurrency z(ZERO, *oe, _flag.price != 0);
d = z.decimals();
}
else
d = TCurrency::get_firm_dec(_flag.price != 0);
}
if (d > 0)
@ -4411,6 +4417,7 @@ void TForm::init()
_dirty= FALSE;
_msg_add_enabled = TRUE;
_magic_currency = FALSE;
_exchange = NULL;
}
// @doc EXTERNAL
@ -4651,7 +4658,9 @@ int TForm::matches_done(int file)
void TForm::set_output_exchange(const char* codval, real exchange, exchange_type et)
{
_exchange.set(codval, exchange, et);
if (_exchange == NULL)
_exchange = new TExchange;
_exchange->set(codval, exchange, et);
}
TForm::TForm()
@ -4678,4 +4687,6 @@ TForm::~TForm()
if (_rel_desc)
delete _rel_desc;
}
if (_exchange)
delete _exchange;
}

View File

@ -154,7 +154,7 @@ class TForm : public TObject
// @cmember:(INTERNAL) Codice divisa impiegata per stampa prezzi ed importi
TString16 _curr_codval;
// @cmember:(INTERNAL) Cambio da applicare in output per stampa prezzi ed importi
TExchange _exchange;
TExchange* _exchange;
// @cmember:(INTERNAL) Handler di default della testata di stampa
static void header_handler(TPrinter& p);
@ -332,7 +332,7 @@ public:
{ return _magic_currency; }
void set_output_exchange(const char* codval, real exchange = ZERO, exchange_type et = _exchange_undefined);
const TExchange& output_exchange() const { return _exchange; }
const TExchange* output_exchange() const { return _exchange; }
void enable_message_add(bool on) { _msg_add_enabled = on; }
void disable_message_add() { enable_message_add(FALSE); }

View File

@ -716,6 +716,10 @@ protected: // TEditable
// @access Public Members
public:
// @cmember Ritorna TRUE se il campo e' vuoto
virtual bool empty() const { return _str.blank(); }
virtual word size() const { return 1; }
// @cmember Costruttore
TBoolean_field(TMask* mask);

View File

@ -727,7 +727,7 @@ int TSpreadsheet::insert(
static bool ininsert = FALSE;
TMask & m = owner().mask();
if (ininsert || items() >= 999)
if (ininsert || items() >= 9999)
return -1;
ininsert = TRUE;

View File

@ -254,7 +254,7 @@ unsigned long os_get_disk_size(const char* path)
return bytes;
}
void os_exec_help_command(MENU_TAG tag, const char* key)
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(key);
@ -299,13 +299,16 @@ void os_exec_help_command(MENU_TAG tag, const char* key)
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild)
{
const int exitcode = WinExec(path, showchild ? SW_SHOWNORMAL : SW_HIDE);
word exitcode = ::WinExec(path, showchild ? SW_SHOWNORMAL : SW_HIDE);
if (exitcode < 32)
{
switch (exitcode)
{
{
case 0:
exitcode = 8;
case 8:
error_box("Risorse insufficienti per eseguire '%s'", (const char*)path); break;
error_box("Memoria o risorse insufficienti per eseguire '%s'", (const char*)path); break;
default:
error_box("Impossibile eseguire '%s': %d", (const char*)path, exitcode); break;
}
@ -318,10 +321,13 @@ int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchil
if (iconizetask)
{
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
was_maximized = IsZoomed(hwnd);
TTemp_window tw(TASK_WIN);
tw.iconize();
tw.deactivate();
if (hwnd)
{
was_maximized = IsZoomed(hwnd);
TTemp_window tw(TASK_WIN);
tw.iconize();
tw.deactivate();
}
}
const char* szModule = path.name();
@ -348,7 +354,7 @@ int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchil
xvt_app_process_pending_events();
}
if (iconizetask)
if (iconizetask && TASK_WIN)
{
TTemp_window tw(TASK_WIN);
if (was_maximized)
@ -373,11 +379,11 @@ bool os_spawn_by_menu()
TaskFindHandle(&te, te.hTaskParent);
bool yes = stricmp(te.szModule, "BA0") == 0 ||
#ifdef DBG
stricmp(te.szModule, "CVW4") == 0 ||
stricmp(te.szModule, "MSVC") == 0 ||
stricmp(te.szModule, "CVW4") == 0 ||
stricmp(te.szModule, "MSVC") == 0 ||
#endif
stricmp(te.szModule, "Explorer") == 0 ||
stricmp(te.szModule, "PROGMAN") == 0;
stricmp(te.szModule, "Explorer") == 0 ||
stricmp(te.szModule, "PROGMAN") == 0;
return yes;
}

View File

@ -366,7 +366,7 @@ bool TRelation_application::autonum(
for (const char* n = k.get(0); n && *n; n = k.get())
{
const short id = atoi(n);
CHECKD (id > 0, "Identificatore di autonumerazione errato: ", id);
CHECKD (id > 0 && m->id2pos(id) >= 0, "Identificatore di autonumerazione errato: ", id);
const char* val = k.get();
TMask_field& f = m->field(id);
if (rec || f.empty())
@ -1792,8 +1792,7 @@ void TRelation_application::sheet2ini(TSheet_field &sheet,TConfig& ini)
void TRelation_application::mask2ini(const TMask& m, TConfig& ini)
{
ini.set("Firm", get_firm(), "Transaction");
const TLocalisamfile& lfile = get_relation()->lfile();
int year, release, tag, patch;
if (get_version_info(year, release, tag, patch))
{
@ -1802,6 +1801,8 @@ void TRelation_application::mask2ini(const TMask& m, TConfig& ini)
ini.set("Version", ver);
}
const TLocalisamfile& lfile = get_relation()->lfile();
TString16 defpar;
defpar.format("%d", lfile.num());
ini.set_paragraph(defpar);

View File

@ -1685,17 +1685,17 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
// indichi eventualmente la direzione dell'ordinamento
char versus = (s.right(1)=="-") ? 'd' : 'a';
if (s.right(1) == "-" || s.right(1) == "+")
s.cut(s.len()-1);
s.rtrim(1);
TFieldref f(s,0);
// Il controllo del file e' automatico in f.len()
int n = f.file();
int flen = f.len(n<0 ? relation()->lfile(n).curr() : relation()->curr());
_sort->addsortkey(abspos+f.from(),flen,versus);
const int n = f.file();
const int flen = f.len(relation()->curr(n));
_sort->addsortkey(abspos,flen,versus);
CHECKS(flen!=0,"Field can not have null length: ",(const char *) s);
const TRectype& r = relation()->lfile(n).curr();
abspos+=r.length(f.name());
CHECKD(abspos<=256,"Cannot exceed 256 bytes-key %d",abspos);
const TRectype& r = relation()->curr(n);
abspos += flen;
CHECKD(abspos<=256, "Sort key too long: ", abspos);
}
_sort->init();
@ -1790,15 +1790,10 @@ const char* TSorted_cursor::fill_sort_key(char* k)
for (TString80 s = _order_expr.get(0); s.not_empty(); s = _order_expr.get())
{
const bool is_up = is_upper(s);
const int p = s.find('[');// Qui estrae il nome del campo:
if (p >= 0) // rimane solo l'indicazione del file (eventuale)
s.cut(p); // ed il nome del campo:
else // UPPER(20->RAGSOC[1,30]+) --->> 20->RAGSOC
{
const char last = s.right(1)[0];
if (last == '-' || last == '+')
s.rtrim(1);
}
const char last = s.right(1)[0];
if (last == '-' || last == '+')
s.rtrim(1);
const TFieldref f(s,0);
sf = f.read(*relation());
const TRectype& frec = curr(f.file());
@ -2546,7 +2541,7 @@ TFieldtypes TRelation_description::field_type()
// @rdesc Ritorna se ha trovato il campo da settare
bool TRelation_description::set_field_description(
const char* field, // @parm Campo a cui assegnare la descrizione
const char* des) // @parm Descrizione da assgnare al campo
const char* des) // @parm Descrizione da assegnare al campo
{
TString_array& fld = (TString_array&)_fields[_cur_file];

View File

@ -592,8 +592,8 @@ void xvt_statbar_refresh()
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
{
CHECK(_statbar, "NULL statbar");
statbar_set_title(_statbar, NULL);
if (_statbar);
statbar_set_title(_statbar, NULL);
}
///////////////////////////////////////////////////////////

View File

@ -130,7 +130,7 @@ public:
virtual bool ok() const;
const char* default_name() const { return "TRA77000"; }
const char* default_name() const { return "TRA701"; }
TTrasferimentoDylog& operator<<(const TRecordDylog& rec)
{ write(rec); return *this; }
@ -339,8 +339,12 @@ long TFormDylog::trasfer(long codditta, TTrasferimentoDylog& file, const char* t
if (stricmp(td, "T0") == 0)
{
cur.curr().zero();
for (int i = 1; i < 8; i++)
transfer_section(body, rec, file, i*108);
for (int i = 1; i < 3; i++)
transfer_section(body, rec, file, i*99);
TPrint_section& body2 = section('B', even_page);
for (i = 0; i < 5; i++)
transfer_section(body2, rec, file, 297+i*108);
}
file << rec;
@ -455,8 +459,6 @@ void TRecordDylog::set(const char* val, char tipo, int pos, int len)
str = "0";
lenstr = 1;
}
else
str.rtrim(3);
} else
// Controlla booleani
if (len == 1 && lenstr <= 1 && (str[0] == 'X' || str[0] <= ' '))

View File

@ -70,6 +70,15 @@ END
SECTION BODY ODD 10
STRINGA 1
BEGIN
KEY "COD.FIS"
PROMPT 10 1 ""
FIELD 216@->COFI
SPECIAL STRING TRASFER "SF0201" ""
SPECIAL STRING DYLOG "AN,0,16" ""
END
LISTA 99
BEGIN
KEY "Tipo anagrafica"
@ -85,15 +94,6 @@ BEGIN
SPECIAL STRING DYLOG "NU,16,1" ""
END
STRINGA 1
BEGIN
KEY "COD.FIS"
PROMPT 10 1 ""
FIELD 216@->COFI
SPECIAL STRING TRASFER "SF0201" ""
SPECIAL STRING DYLOG "AN,0,16" ""
END
STRINGA 2
BEGIN
KEY "COGNOME"
@ -114,16 +114,6 @@ BEGIN
SPECIAL STRING DYLOG "AN,41,20" ""
END
STRINGA 102
BEGIN
KEY "RAGSOC GIURIDICHE"
PROMPT 42 1 ""
FIELD 216@->RAGSOC
GROUP 2
SPECIAL STRING TRASFER "SF0202" ""
SPECIAL STRING DYLOG "AN,151,60" ""
END
STRINGA 4
BEGIN
KEY "SESSO"
@ -131,7 +121,17 @@ BEGIN
FIELD 218@->SESSO
GROUP 1
SPECIAL STRING TRASFER "SF0204" ""
SPECIAL STRING DYLOG "AN,69,1" ""
SPECIAL STRING DYLOG "AN,61,1" ""
END
STRINGA 102
BEGIN
KEY "RAGSOC GIURIDICHE"
PROMPT 42 1 ""
FIELD 216@->RAGSOC
GROUP 2
SPECIAL STRING TRASFER "SF0202" ""
SPECIAL STRING DYLOG "AN,161,60" ""
END
STRINGA 5
@ -140,9 +140,9 @@ BEGIN
PROMPT 63 3 ""
FIELD 218@->DATANASC
PICTURE "##^ ##^ ####"
GROUP 1
SPECIAL STRING TRASFER "SF0205" ""
SPECIAL STRING DYLOG "NU,61,8" ""
SPECIAL STRING DYLOG "NU,62,8" ""
GROUP 1
END
STRINGA 6
@ -152,7 +152,7 @@ BEGIN
FIELD 313@->DENCOM
GROUP 1
SPECIAL STRING TRASFER "SF0206" ""
SPECIAL STRING DYLOG "AN,70,21" ""
SPECIAL STRING DYLOG "AN,70,25" ""
END
STRINGA 7
@ -162,7 +162,7 @@ BEGIN
FIELD 313@->PROVCOM
GROUP 1
SPECIAL STRING TRASFER "SF0207" ""
SPECIAL STRING DYLOG "AN,91,2" ""
SPECIAL STRING DYLOG "AN,95,2" ""
END
STRINGA 8
@ -170,221 +170,265 @@ BEGIN
KEY "COMUNE DI RESIDENZA FISCALE"
PROMPT 25 5 ""
FIELD 513@->DENCOM
MESSAGE EMPTY ENABLE,3@|DISABLE,4@
MESSAGE ENABLE,4@|DISABLE,3@|COPY,208
SPECIAL STRING TRASFER "SF0208" ""
SPECIAL STRING DYLOG "AN,93,21" ""
GROUP 1
END
STRINGA 80
BEGIN
KEY "COMUNE DI RESIDENZA"
PROMPT 25 5 ""
FIELD 413@->DENCOM
GROUP 1 3
SPECIAL STRING TRASFER "SF0208" ""
SPECIAL STRING DYLOG "AN,128,21" ""
SPECIAL STRING DYLOG "AN,97,25" ""
GROUP 1
MESSAGE COPY,208
END
STRINGA 9
STRINGA 7
BEGIN
KEY "PROV. RESIDENZA"
PROMPT 71 5 ""
FIELD 513@->PROVCOM
FIELD 413@->PROVCOM
SPECIAL STRING TRASFER "SF0209" ""
SPECIAL STRING DYLOG "AN,149,2" ""
MESSAGE COPY,209
KEY "PROV DI RESIDENZA FISCALE"
PROMPT 126 3 ""
FIELD 513@->PROVCOM
FIELD 413@->PROVCOM
GROUP 1
SPECIAL STRING TRASFER "SF0207" ""
SPECIAL STRING DYLOG "AN,122,2" ""
MESSAGE COPY,209
END
STRINGA 101
BEGIN
KEY "VIA RES."
KEY "VIA RES. FISC."
FIELD 216@->INDRF[1,35]
FIELD 216@->INDRES[1,35]
FLAGS "H"
MESSAGE COPY,10
MESSAGE COPY,10
END
STRINGA 102
BEGIN
KEY "NUM.CIV DI RESIDENZA"
KEY "NUM.CIV DI RESIDENZA FISC."
FLAGS "H"
FIELD 216@->CIVRF
FIELD 216@->CIVRES
MESSAGE APPEND,10
MESSAGE APPEND,10
END
STRINGA 10
BEGIN
KEY "VIA RES. + NUMCIVRES"
PROMPT 78 5 ""
GROUP 1 3
SPECIAL STRING TRASFER "SF0210" ""
SPECIAL STRING DYLOG "AN,116,35" ""
MESSAGE COPY,210
END
STRINGA 103
BEGIN
KEY "VIA RES. FISC."
FIELD 216@->INDRF[1,35]
FLAGS "H"
MESSAGE COPY,100
END
STRINGA 104
BEGIN
KEY "NUM.CIV DI RESIDENZA FISC."
FLAGS "H"
FIELD 216@->CIVRF
MESSAGE APPEND,100
END
STRINGA 100
BEGIN
KEY "VIA RF + NUMCIVRF"
PROMPT 78 5 ""
GROUP 4
SPECIAL STRING DYLOG "AN,248,35" ""
SPECIAL STRING DYLOG "AN,124,35" ""
GROUP 1
MESSAGE COPY,210
END
LISTA 11
NUMBER 11
BEGIN
KEY "FLAG DI NON RESIDENTE"
PROMPT 10 7 ""
ITEM "| " MESSAGE HIDE,5@|"0",97
ITEM "X|X" MESSAGE SHOW,5@|"1",97
FIELD 216@->SOGGNRES
SPECIAL STRING TRASFER "SF0211" ""
KEY "CODICE REGIONE"
PROMPT 78 5 ""
FIELD 513@->CODREG
SPECIAL STRING DYLOG "NU,159,2" ""
MESSAGE COPY,211
GROUP 1
END
NUMBER 97
BEGIN
SPECIAL STRING DYLOG "NU,304,1" ""
STRINGA 205
BEGIN
KEY "DATA NASCITA GIURIDICA (sempre 0)"
PROMPT 63 3 ""
PICTURE "##^ ##^ ####"
SPECIAL STRING TRASFER "SF0205" ""
SPECIAL STRING DYLOG "NU,62,8" ""
GROUP 2
END
STRINGA 208
BEGIN
KEY "COMUNE DI RESIDENZA GIURIDICHE"
GROUP 2
SPECIAL STRING DYLOG "AN,211,21" ""
SPECIAL STRING DYLOG "AN,221,25" ""
END
STRINGA 209
BEGIN
KEY "PROV. RESIDENZA GIURIDICHE"
GROUP 2
SPECIAL STRING DYLOG "AN,232,2" ""
SPECIAL STRING DYLOG "AN,246,2" ""
END
STRINGA 210
BEGIN
KEY "INDIRIZZO GIURIDICHE"
GROUP 2
SPECIAL STRING DYLOG "AN,234,35" ""
SPECIAL STRING DYLOG "AN,248,35" ""
END
STRINGA 211
BEGIN
KEY "CODICE REGIONE GIURIDICHE"
GROUP 2
SPECIAL STRING DYLOG "AN,283,2" ""
END
STRINGA 12
BEGIN
KEY "STATO ESTERO DI RES."
PROMPT 14 7 ""
FIELD 104@->S0
GROUP 5
SPECIAL STRING TRASFER "SF0212" ""
SPECIAL STRING DYLOG "AN,270,35" ""
KEY "CODICE STATO ESTERO DI RES."
PROMPT 75 7 ""
FIELD 216@->STATORES
SPECIAL STRING TRASFER "SF0213" ""
SPECIAL STRING DYLOG "NU,285,3" ""
END
STRINGA 13
BEGIN
KEY "CODICE STATO ESTERO DI RES."
PROMPT 75 7 ""
FIELD 216@->STATORES
GROUP 5
SPECIAL STRING TRASFER "SF0213" ""
SPECIAL STRING DYLOG "NU,305,3" ""
END
STRINGA 14
BEGIN
KEY "CODICE FISCALE ESTERO"
PROMPT 90 7 ""
FIELD 216@->COFIEST
GROUP 5
SPECIAL STRING TRASFER "SF0214" ""
SPECIAL STRING DYLOG "AN,308,20" ""
SPECIAL STRING DYLOG "AN,288,20" ""
END
STRINGA 15
STRINGA 14
BEGIN
KEY "CAUSALE"
PROMPT 13 9 ""
FIELD CAUSALE
SPECIAL STRING TRASFER "SF0215" ""
SPECIAL STRING DYLOG "AN,328,1" ""
SPECIAL STRING DYLOG "AN,308,1" ""
END
NUMBER 16
STRINGA 15
BEGIN
KEY "TITOLO"
PROMPT 16 9 ""
SPECIAL STRING TRASFER "SF0215" ""
SPECIAL STRING DYLOG "AN,309,1" ""
END
NUMERO 16
BEGIN
KEY "ANNO"
PROMPT 16 9 ""
SPECIAL STRING TRASFER "SF0215" ""
SPECIAL STRING DYLOG "NU,310,4" ""
END
NUMERO 17
BEGIN
KEY "TOTALE"
PROMPT 27 9 ""
FIELD TOTALE
PICTURE "###.###.###^^^"
SPECIAL STRING TRASFER "SF0216" ""
SPECIAL STRING DYLOG "NU,329,11" ""
SPECIAL STRING DYLOG "NU,314,11" ""
END
NUMBER 17
NUMBER 18
BEGIN
KEY "SOMME NON SOGGETTE A RITENUTA"
PROMPT 47 9 ""
FIELD SOMME
PICTURE "###.###.###^^^"
SPECIAL STRING TRASFER "SF0217" ""
SPECIAL STRING DYLOG "NU,340,11" ""
SPECIAL STRING DYLOG "NU,325,11" ""
END
NUMBER 18
NUMBER 19
BEGIN
KEY "SOMREGCONV"
PROMPT 66 9 ""
FIELD SOMREGCONV
PICTURE "###.###.###^^^"
SPECIAL STRING TRASFER "SF0218" ""
SPECIAL STRING DYLOG "NU,351,11" ""
SPECIAL STRING DYLOG "NU,336,11" ""
END
NUMBER 19
NUMBER 20
BEGIN
KEY "IMPONIBILE"
PROMPT 88 9 ""
FIELD IMPONIBILE
PICTURE "###.###.###^^^"
SPECIAL STRING TRASFER "SF0219" ""
SPECIAL STRING DYLOG "NU,362,11" ""
SPECIAL STRING DYLOG "NU,347,11" ""
END
NUMBER 20
NUMBER 21
BEGIN
KEY "IMPORTO"
PROMPT 109 9 ""
FIELD IMPORTO
PICTURE "###.###.###^^^"
SPECIAL STRING TRASFER "SF0220" ""
SPECIAL STRING DYLOG "NU,373,11" ""
SPECIAL STRING DYLOG "NU,358,11" ""
END
NUMBER 21
NUMBER 22
BEGIN
KEY "RITENUTE SOSPESE"
PROMPT 109 9 ""
// FIELD IMPORTO
PICTURE "###.###.###^^^"
SPECIAL STRING TRASFER "SF0221" ""
SPECIAL STRING DYLOG "NU,384,11" ""
SPECIAL STRING DYLOG "NU,369,11" ""
END
NUMBER 23
BEGIN
KEY "ADDIZIONALE REGIONALE"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,380,11" ""
END
NUMBER 24
BEGIN
KEY "ADDIZIONALE REGIONALE SOSPESA"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,391,11" ""
END
NUMBER 25
BEGIN
KEY "IMPONIBILE ANNI PRECEDENTI"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,402,11" ""
END
NUMBER 26
BEGIN
KEY "RITENUTE ANNI PRECEDENTI"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,413,11" ""
END
NUMBER 27
BEGIN
KEY "POSIZIONE ASSICURATIVA TERRITORIALE"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,424,10" ""
END
NUMBER 28
BEGIN
KEY "DATA INIZIO E DATA FINE"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,434,8" ""
END
NUMBER 31
BEGIN
KEY "TIPO PERSONA RAPPRESENTANTE ESTERO (0)"
PROMPT 109 9 ""
SPECIAL STRING DYLOG "NU,462,1" ""
END
NUMERO 35
BEGIN
KEY "DATA DI NASCITA ESTERA"
SPECIAL STRING DYLOG "NU,508,8" ""
END
NUMERO 41
BEGIN
KEY "CODICE STATO ESTERO"
SPECIAL STRING DYLOG "NU,605,3" ""
END
NUMERO 410
BEGIN
KEY "CODICE STATO ESTERO ???"
SPECIAL STRING DYLOG "NU,730,3" ""
END
END

View File

@ -3,6 +3,7 @@ JOIN 6 TO 63 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR
JOIN 8 TO 6 ALIAS 108 INTO CODANAGR=CODANAGR
JOIN 13 TO 108@ ALIAS 113 INTO STATO=="" COM==COMNASC
JOIN 13 TO 106@ ALIAS 213 INTO STATO==STATORES COM==COMRES
JOIN 13 TO 106@ ALIAS 313 INTO STATO=="" COM==COMRF
END
DESCRIPTION
@ -74,7 +75,7 @@ BEGIN
PROMPT 126 2 ""
FIELD 108@->SESSO
SPECIAL STRINGA TRASFER "SC0205" ""
SPECIAL STRINGA DYLOG "AN,69,1" ""
SPECIAL STRINGA DYLOG "AN,61,1" ""
END
STRING 5
@ -83,7 +84,7 @@ BEGIN
PROMPT 112 2 ""
FIELD 108@->DATANASC
SPECIAL STRINGA TRASFER "SC0204" ""
SPECIAL STRINGA DYLOG "NU,61,8" ""
SPECIAL STRINGA DYLOG "NU,62,8" ""
END
STRING 6
@ -92,7 +93,7 @@ BEGIN
PROMPT 9 4 ""
FIELD 113@->DENCOM
SPECIAL STRINGA TRASFER "SC0206" ""
SPECIAL STRINGA DYLOG "AN,70,21" ""
SPECIAL STRINGA DYLOG "AN,70,25" ""
GROUP 1
END
@ -102,7 +103,7 @@ BEGIN
PROMPT 46 4 ""
FIELD 113@->PROVCOM
SPECIAL STRINGA TRASFER "SC0207" ""
SPECIAL STRINGA DYLOG "AN,91,2" ""
SPECIAL STRINGA DYLOG "AN,95,2" ""
GROUP 1
END
@ -110,9 +111,10 @@ STRING 8
BEGIN
KEY "COMUNE DI RESIDENZA"
PROMPT 52 4 ""
FIELD 313@->DENCOM
FIELD 213@->DENCOM
SPECIAL STRINGA TRASFER "SC0208" ""
SPECIAL STRINGA DYLOG "AN,93,21" ""
SPECIAL STRINGA DYLOG "AN,97,25" ""
GROUP 1
END
@ -120,15 +122,18 @@ STRING 9
BEGIN
KEY "PROV. RESIDENZA"
PROMPT 88 4 ""
FIELD 313@->PROVCOM
FIELD 213@->PROVCOM
SPECIAL STRINGA TRASFER "SC0209" ""
SPECIAL STRINGA DYLOG "AN,114,2" ""
SPECIAL STRINGA DYLOG "AN,122,2" ""
GROUP 1
END
STRING 101
BEGIN
KEY "VIA RES."
PROMPT 93 4 ""
FIELD 106@->INDRF[1,30]
FIELD 106@->INDRES[1,30]
FLAGS "H"
MESSAGE COPY,10
@ -140,6 +145,7 @@ BEGIN
KEY "NUM.CIV"
PROMPT 93 4 ""
FLAGS "H"
FIELD 106@->CIVRF
FIELD 106@->CIVRES
MESSAGE APPEND,10
MESSAGE APPEND,210
@ -150,7 +156,7 @@ BEGIN
KEY "VIA RES. + numcivres"
PROMPT 93 4 ""
SPECIAL STRINGA TRASFER "SC0210" ""
SPECIAL STRINGA DYLOG "AN,116,35" ""
SPECIAL STRINGA DYLOG "AN,124,35" ""
GROUP 1
END
@ -159,25 +165,27 @@ BEGIN
KEY "RAGIONE SOCIALE"
PROMPT 42 2 ""
FIELD 106@->RAGSOC
SPECIAL STRINGA DYLOG "AN,151,60" ""
SPECIAL STRINGA DYLOG "AN,159,60" ""
GROUP 2
END
STRING 208
BEGIN
KEY "COMUNE DI RESIDENZA FISCALE"
KEY "COMUNE DI RESIDENZA GIRIDICO"
PROMPT 52 4 ""
FIELD 313@->DENCOM
FIELD 213@->DENCOM
SPECIAL STRINGA DYLOG "AN,211,21" ""
SPECIAL STRINGA DYLOG "AN,219,25" ""
GROUP 2
END
STRING 209
BEGIN
KEY "PROV. RESIDENZA FISCALE"
KEY "PROV. RESIDENZA GIRIDICO"
PROMPT 88 4 ""
FIELD 313@->PROVCOM
FIELD 213@->PROVCOM
SPECIAL STRINGA DYLOG "AN,232,2" ""
SPECIAL STRINGA DYLOG "AN,244,2" ""
GROUP 2
END
@ -185,7 +193,7 @@ STRING 210
BEGIN
KEY "VIA RES. + numcivres"
PROMPT 93 4 ""
SPECIAL STRINGA DYLOG "AN,234,35" ""
SPECIAL STRINGA DYLOG "AN,246,35" ""
GROUP 2
END
@ -194,7 +202,7 @@ BEGIN
KEY "CAUSALE Quadro SE"
PROMPT 10 1 ""
FIELD CAUSALE
SPECIAL STRINGA DYLOG "AN,269,1" ""
SPECIAL STRINGA DYLOG "AN,281,1" ""
END
NUMBER 12
@ -202,7 +210,7 @@ BEGIN
KEY "AMMONTARE LORDO CORRISPOSTO"
PROMPT 37 6 ""
FIELD TOTALE
SPECIAL STRINGA DYLOG "NU,270,11" ""
SPECIAL STRINGA DYLOG "NU,282,11" ""
END
NUMBER 13
@ -210,7 +218,7 @@ BEGIN
KEY "SPESE ANTICIPATE"
PROMPT 37 6 ""
FIELD SPESEANT
SPECIAL STRINGA DYLOG "NU,281,11" ""
SPECIAL STRINGA DYLOG "NU,293,11" ""
END
NUMBER 14
@ -218,7 +226,7 @@ BEGIN
KEY "QUOTA PROVVIGIONI"
PROMPT 37 6 ""
FIELD QUOTAPRO
SPECIAL STRINGA DYLOG "NU,292,11" ""
SPECIAL STRINGA DYLOG "NU,304,11" ""
END
NUMBER 15
@ -226,7 +234,7 @@ BEGIN
KEY "IMPONIBILE"
PROMPT 37 6 ""
FIELD IMPONIBILE
SPECIAL STRINGA DYLOG "NU,303,11" ""
SPECIAL STRINGA DYLOG "NU,315,11" ""
END
NUMBER 16
@ -234,14 +242,14 @@ BEGIN
KEY "RITENUTEOPERATE"
PROMPT 37 6 ""
FIELD IMPORTO
SPECIAL STRINGA DYLOG "NU,314,11" ""
SPECIAL STRINGA DYLOG "NU,326,11" ""
END
NUMBER 17
BEGIN
KEY "RITENUTE SOSPESE"
PROMPT 37 6 ""
SPECIAL STRINGA DYLOG "NU,325,11" ""
SPECIAL STRINGA DYLOG "NU,337,11" ""
END
END

View File

@ -30,8 +30,8 @@ NUMERO 1
BEGIN
KEY "ANNO RIFERIMENTO"
PROMPT 42 2 ""
FIELD QLAP[3,4]
SPECIAL STRINGA DYLOG "NU,2,2" ""
FIELD QLAP
SPECIAL STRINGA DYLOG "NU,2,4" ""
END
NUMERO 2
@ -39,44 +39,44 @@ BEGIN
KEY "RITENUTE"
PROMPT 79 2 ""
FIELD QLRITEFF
SPECIAL STRINGA DYLOG "NU,4,11" ""
SPECIAL STRINGA DYLOG "NU,6,11" ""
END
NUMERO 3
BEGIN
KEY "RITENUTE NON VERSATE PER ECCESSO"
KEY "RITENUTE NON VERSATE PER ECCESSO E RESTITUZIONI"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,15,11" ""
SPECIAL STRINGA DYLOG "NU,17,11" ""
END
NUMERO 4
BEGIN
KEY "RITENUTE NON VERSATE PER RESTITUZIONI"
KEY "RITENUTE NON VERSATE PER CREDITI"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,26,11" ""
SPECIAL STRINGA DYLOG "NU,28,11" ""
END
NUMERO 5
BEGIN
KEY "RITENUTE NON VERSATE PER CREDITI"
KEY "TOTALE IMPORTO VERSATO"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,37,11" ""
FIELD QLRITVER
SPECIAL STRINGA DYLOG "NU,39,11" ""
END
NUMERO 6
BEGIN
KEY "TOTALE IMPORTO VERSATO"
KEY "INTERESSI VERSATI"
PROMPT 79 2 ""
FIELD QLRITVER
SPECIAL STRINGA DYLOG "NU,48,11" ""
SPECIAL STRINGA DYLOG "NU,50,11" ""
END
STRINGA 8
STRINGA 7
BEGIN
KEY "NOTE"
PROMPT 79 2 ""
FIELD QLNOTE
SPECIAL STRINGA DYLOG "AN,70,20" ""
SPECIAL STRINGA DYLOG "AN,61,10" ""
END
STRINGA 10
@ -84,7 +84,7 @@ BEGIN
KEY "CODICE TRIBUTO"
PROMPT 79 2 ""
FIELD QLCT
SPECIAL STRINGA DYLOG "AN,91,4" ""
SPECIAL STRINGA DYLOG "AN,82,4" ""
END
STRINGA 11
@ -92,13 +92,13 @@ BEGIN
KEY "ARTICOLO"
PROMPT 79 2 ""
FIELD QLAB
SPECIAL STRINGA DYLOG "AN,95,2" ""
SPECIAL STRINGA DYLOG "NU,86,2" ""
END
NUMERO 12
BEGIN
KEY "Codice regione"
SPECIAL STRINGA DYLOG "NU,97,2" ""
SPECIAL STRINGA DYLOG "NU,88,2" ""
END
LISTA 130
@ -119,7 +119,85 @@ STRINGA 13
BEGIN
KEY "Tesoreria/F24"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "AN,99,1" ""
SPECIAL STRINGA DYLOG "AN,90,1" ""
END
NUMERO 14
BEGIN
KEY "DATA VERSAMENTO"
PROMPT 79 2 ""
FIELD QLDV
SPECIAL STRINGA DYLOG "NU,91,8" ""
END
END
SECTION BODY EVEN 2
NUMERO 1
BEGIN
KEY "MESE RIFERIMENTO"
PROMPT 9 2 ""
FIELD QLMP
SPECIAL STRINGA DYLOG "NU,0,2" ""
END
NUMERO 1
BEGIN
KEY "ANNO RIFERIMENTO"
PROMPT 42 2 ""
FIELD QLAP
SPECIAL STRINGA DYLOG "NU,2,4" ""
END
NUMERO 2
BEGIN
KEY "RITENUTE"
PROMPT 79 2 ""
FIELD QLRITEFF
SPECIAL STRINGA DYLOG "NU,6,11" ""
END
NUMERO 3
BEGIN
KEY "RITENUTE NON VERSATE PER ECCESSO E RESTITUZIONI"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,17,11" ""
END
NUMERO 4
BEGIN
KEY "RITENUTE NON VERSATE PER CREDITI"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,28,11" ""
END
NUMERO 5
BEGIN
KEY "TOTALE IMPORTO VERSATO"
PROMPT 79 2 ""
FIELD QLRITVER
SPECIAL STRINGA DYLOG "NU,39,11" ""
END
NUMERO 6
BEGIN
KEY "INTERESSI VERSATI"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,50,11" ""
END
NUMERO 7
BEGIN
KEY "???"
PROMPT 79 2 ""
SPECIAL STRINGA DYLOG "NU,61,11" ""
END
NUMERO 12
BEGIN
KEY "Codice regione"
SPECIAL STRINGA DYLOG "NU,97,2" ""
END
NUMERO 14
@ -132,4 +210,3 @@ END
END

View File

@ -590,16 +590,26 @@ void TStampa_inventario::setprint_permagazzini()
m2 = _mask->get(F_ACATMER); if (m2.not_empty()) m2.left_just(3);
_form->find_field('B',odd_page,"H_CATMER").show();
_form->find_field('B',odd_page,"TOT_CATMER").show();
if (!totdep)
espr1.format("ANNOES|CODMAG[1,3]|%d->GRMERC|CODART|LIVELLO|CODMAG[4,5]", LF_ANAMAG);
else
espr1.format("ANNOES|CODMAG|%d->GRMERC|CODART|LIVELLO", LF_ANAMAG);
_form->set_ordering(mg_cat_merc);
// espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->GRMERC[1,3]", LF_ANAMAG);
espr2.format("%d->GRMERC[1,3]", LF_ANAMAG);
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
int index_grmerc = 3;
if (subordine == 'S')
{
index_grmerc = 5;
if (!totdep)
espr1.format("ANNOES|CODMAG[1,3]|%d->GRMERC[1,%d]|CODART|LIVELLO|CODMAG[4,5]", LF_ANAMAG, index_grmerc);
else
espr1.format("ANNOES|CODMAG|%d->GRMERC[1,%d]|CODART|LIVELLO", LF_ANAMAG, index_grmerc);
_form->set_ordering(mg_cat_merc);
espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->GRMERC[1,3]", LF_ANAMAG);
// espr2.format("%d->GRMERC[1,3]", LF_ANAMAG);
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
TString16 fmerc;
if (subordine == 'S')
{
fmerc = "GRMERC";
_form->find_field('B',odd_page,"H_SCATMER").show();
_form->find_field('B',odd_page,"TOT_SCATMER").show();
m1 << _mask->get(F_DASCATMER);
@ -607,21 +617,22 @@ void TStampa_inventario::setprint_permagazzini()
}
else
{
fmerc = "GRMERC[1,3]";
_form->find_field('B',odd_page,"H_SCATMER").hide();
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
}
if (m1.not_empty())
{
espr2.format("&&(%d->GRMERC >= \"%s\")", LF_ANAMAG, (const char*)m1);
espr2.format("&&(%d->%s >= \"%s\")", LF_ANAMAG, (const char *)fmerc, (const char*)m1);
cfilter << espr2;
}
if (m2.not_empty())
{
espr2.format("&&(%d->GRMERC <= \"%s\")", LF_ANAMAG, (const char*)m2);
espr2.format("&&(%d->%s <= \"%s\")", LF_ANAMAG, (const char *)fmerc, (const char*)m2);
cfilter << espr2;
}
// espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->GRMERC", LF_ANAMAG);
espr2.format("%d->GRMERC", LF_ANAMAG);
espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->GRMERC", LF_ANAMAG);
// espr2.format("%d->%s", LF_ANAMAG, (const char *)fmerc);
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition(espr2,_strexpr);
}
break;
@ -707,7 +718,10 @@ void TStampa_inventario::setprint_perarticoli()
m2 = _mask->get(F_ACATMER);
_form->find_field('B',odd_page,"H_CATMER").show();
_form->find_field('B',odd_page,"TOT_CATMER").show();
espr1.format("ANNOES|%d->GRMERC|CODART|LIVELLO|CODMAG", LF_ANAMAG);
if (subordine == 'S')
espr1.format("ANNOES|%d->GRMERC|CODART|LIVELLO|CODMAG", LF_ANAMAG);
else
espr1.format("ANNOES|%d->GRMERC[1,3]|CODART|LIVELLO|CODMAG", LF_ANAMAG);
_form->set_ordering(mg_cat_merc);
espr2.format("%d->GRMERC[1,3]", LF_ANAMAG);
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
@ -888,6 +902,7 @@ void TStampa_inventario::setprint_perarticoli_all()
_form->find_field('B',odd_page,"H_SCATMER").hide();
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("CODART",_strexpr);
sortexp.format("ANNOES|%d->GRMERC[1,3]|CODART|LIVELLO|CODMAG", LF_ANAMAG);
}
}
break;
@ -940,12 +955,16 @@ void TStampa_inventario::setprint_perarticoli_all()
TIsamtempfile* temp_mag = new TIsamtempfile(LF_MAG, "tmpmag", FALSE, TRUE); // Non crearlo, auto cancella il file
rel = new TRelation(temp_mag);
}
else
rel = new TRelation(LF_MAG);
if (subordine == 'M')
rel->add(LF_ANAMAG, "CODART==CODART");
// !?!?!! ATTENZIONE : Modifica temporanea
mag= new TSortedfile(LF_MAG,rel,sortexp,"",1);
// il filtro viene qui settato DOPO la creazione del Sortedfile a causa di una bug
// sulla libreria nei TSorted_file / TCursor
mag->cursor().setfilter(filter);
mag->cursor().setfilter(filter, subordine == 'M');
// FINE MODIFICA ; rimettere il filtro nel costruttore quando il bug sarà risolto
_cur->relation()->replace(mag,1,joinexp);

View File

@ -187,6 +187,7 @@ TMRP_line & TMRP_line::operator=(const TMRP_line & a)
_sons=a._sons;
_qta_sons=a._qta_sons;
_req_per_bucket=a._req_per_bucket;
_final_product = a._final_product;
_articolo_giac= new TArticolo_giacenza(a._articolo_giac->codice());
@ -344,7 +345,8 @@ TMRP_line::TMRP_line(const char* art, const char* giac,
long codcli)
: _codart(art), _livgiac(giac),
_codmag(mag), _codmag_coll(magc),
_codimp(imp), _codlin(lin), _codclifor(codcli)
_codimp(imp), _codlin(lin), _codclifor(codcli),
_final_product(FALSE)
{
if (_articolo_giac==NULL)
_articolo_giac= new TArticolo_giacenza();
@ -1311,6 +1313,8 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket)
else
delete r;
} while (nref >= 0 /*&& q > ZERO*/);
if (line.final_product())
s.set_back_and_fore_color(COLOR_RED, -1, pos);
return pos;
}
@ -1939,6 +1943,7 @@ bool TMatResPlanning::load_gross_requirements()
// nuova linea
line = _articles.find(art, liv, mag, "", imp, lin, 0L, TRUE);
line->set_description(riga.get(RDOC_DESCR));
line->set_final_product();
}
TString8 codnum = doc.get(DOC_CODNUM);
long docnum = doc.get_long(DOC_NDOC);
@ -1970,6 +1975,7 @@ bool TMatResPlanning::explode_articles()
TDistinta_tree distinta; // albero distinta
TArray boom; // array per i figli
int level = 1;
bool finiti = TRUE;
TProgind* pi = NULL;
// Inizializza la cache delle lavorazioni
@ -1982,7 +1988,8 @@ bool TMatResPlanning::explode_articles()
if (pi && pi->isfinished())
{
delete pi;
pi = NULL;
pi = NULL;
finiti = FALSE;
}
if (pi == NULL)
{
@ -2001,6 +2008,7 @@ bool TMatResPlanning::explode_articles()
distinta.set_global("_LINEA" , line.codlin());
if (distinta.set_root(line.articolo(), "", 1.0 , line.livgiac()))
{
line.set_final_product(FALSE);
distinta.explode(boom, FALSE, RAGGR_EXP_UMBASE, 1, "AV");
for (int i = 0; i < boom.items(); i++)
{
@ -2907,6 +2915,7 @@ bool TMatResPlanning::emit_orders()
const long forn = prod ? 0 : riga.get_long(sf.cid2index(F_FORNITORE));
const long numdoc = riga.get_long(sf.cid2index(F_DOCNUM));
real qta(riga.get(sf.cid2index(F_QUANTITA)));
const TString16 realcodnum = riga.get(sf.cid2index(F_DOCCODNUM));
riga.add(" ",sf.cid2index(F_OK));
if (qta.is_zero())
@ -2955,8 +2964,13 @@ bool TMatResPlanning::emit_orders()
if (docs.items() >= 200)
save_orders(docs);
const TString& codnum = m.get(prod ? F_NUM_PROD : F_NUM_FORN );
TString16 codnum = m.get(prod ? F_NUM_PROD : F_NUM_FORN );
const TString& tipdoc = m.get(prod ? F_TIPO_PROD: F_TIPO_FORN );
if (numdoc)
{
if (codnum != realcodnum)
codnum = realcodnum;
}
doc = new TDocumento('D', datadoc.year(), codnum, 0);
doc->set_tipo(tipdoc);
TRectype& testata = doc->head();

View File

@ -95,7 +95,8 @@ class TMRP_line : public TSortable
TString8 _codmag_coll;
TString8 _codimp;
TString8 _codlin;
long _codclifor;
long _codclifor;
bool _final_product;
static TArticolo_giacenza *_articolo_giac;
static TString16 _substr;
protected:
@ -196,6 +197,8 @@ public:
bool find_ad_excepts(bool anticipi, bool posticipi, TExceptions_array &e);
bool find_extra_excepts(bool fixed, TExceptions_array &e);
void print_exception(int from, int to, const real &diff, int header) const;
bool final_product() const { return _final_product; }
void set_final_product(bool f = TRUE) { _final_product = f;}
// capacity review

View File

@ -491,6 +491,17 @@ bool TPlanning_mask::carica_documenti()
const int bucket_fr = round_date(date_fr, FALSE);
TDate date_to = get(F_ADATA);
const int bucket_to = round_date(date_to, TRUE);
const TString80 f_art(get(F_FRART));
const bool f_art_fill = !f_art.empty();
TString80 t_art(get(F_TOART));
const bool t_art_fill = !t_art.empty();
TString16 f_grm(get(F_FRGRM)); f_grm.rpad(3);
f_grm << get(F_FRSGM); f_grm.trim();
const bool f_grm_fill = !f_grm.empty();
TString16 t_grm(get(F_TOGRM)); t_grm.rpad(3);
t_grm << get(F_FRSGM); t_grm.trim();
const bool t_grm_fill = !t_grm.empty();
const bool filtered = f_art_fill || t_art_fill || f_grm_fill || t_grm_fill;
const int year_fr = date_fr.year() - (get_bool(F_DOC_YEAR_PREC) ? 1 : 0);
const int year_to = date_to.year();
@ -562,10 +573,22 @@ bool TPlanning_mask::carica_documenti()
const TRiga_documento& riga = doc[r];
if (riga.is_articolo())
{
const TCodice_articolo art = riga.get(RDOC_CODARTMAG);
const real qta = riga.qtaresidua();
if (qta > ZERO)
bool ok = qta > ZERO;
if (ok && filtered)
{
if (ok && f_art_fill)
ok = art >= f_art;
if (ok && t_art_fill)
ok = art <= t_art;
if (ok && f_grm_fill)
ok = cache().get(LF_ANAMAG, art, ANAMAG_GRMERC) >= f_grm;
if (ok && t_grm_fill)
ok = cache().get(LF_ANAMAG, art, ANAMAG_GRMERC) <= t_grm;
}
if (ok)
{
const TCodice_articolo art = riga.get(RDOC_CODARTMAG);
const TString16 liv = livelli_giacenza().enabled() ? riga.get(RDOC_LIVELLO) : "";
const long cli = (ignore_cli && (tn & _Doc_vincoli)) ||ignore_allcli ? 0 : doc.get_long(DOC_CODCF) ;
const TString8 mag = ignore_mag && (tn & _Doc_vincoli) ? "" : riga.get(RDOC_CODMAG);
@ -650,7 +673,7 @@ bool TPlanning_mask::carica_documenti()
// - stesso impianto e linea
// - stessa linea
TMSP_constraint* TPlanning_mask::find_constraint(const TMSP_line& l, bool force_insert)
{
{
const bool ignore_mag=get_bool(F_NOMAG_IN);
const bool ignore_imp=get_bool(F_NOIMP_IN);
const bool ignore_lin=get_bool(F_NOLIN_IN);
@ -859,6 +882,21 @@ void TPlanning_mask::fill_sheet()
{
TMSP_line& line = _articles[i];
TMSP_constraint* curr_constraint = find_constraint(line,TRUE);
int new_row = -1;
for (int nrow = int (sf.items()) - 1; nrow >=0; nrow--)
{
if (sf.cell_disabled(nrow, F_BUCKET1-FIRST_FIELD))
{
last_constraint = _constraints.find(sf.row(nrow));
if (last_constraint == curr_constraint)
{
new_row = nrow + 1;
break;
}
}
}
if (last_constraint != curr_constraint)
{
// aggiunge la linea di vincolo
@ -871,10 +909,11 @@ void TPlanning_mask::fill_sheet()
copy_sheet_row(rowgiac,consrow);
rowgiac.add("** Giacenza teorica",F_DESCART-FIRST_FIELD);
sf.disable_cell(sf.items()-1, -1);
last_constraint = curr_constraint;
// last_constraint = curr_constraint;
curr_constraint->set_on_sheet();
// int new_row=sf.items();
}
const int new_row=sf.items();
sf.insert(new_row);
TToken_string& row = sf.row(new_row);
line.fill_sheet_row(row, *this);
disable_codes(new_row);
@ -916,7 +955,8 @@ void TPlanning_mask::fill_sheet()
r = r-2;
art.read(codart);
r=init_bucket0(art, r);
}
}
sortMSPsheet();
sf.force_update();
}
@ -1014,7 +1054,7 @@ void TPlanning_mask::add_or_sub_propose(char sign, bool scheduled)
msprow2codes(row,codcli,codart,liv, mag, magc, codimp, codlin, codum);
if (!sf.cell_disabled(art_row, F_BUCKET1-FIRST_FIELD))
{
{
line_found=(a.codclifor()==codcli && a.articolo()==codart && a.livgiac()==liv
&& a.codimp()==codimp && a.codlin()==codlin && a.codmagdep()==mag );
if (line_found)
@ -2377,8 +2417,9 @@ int TPlanning_mask::salva_cella(int r, int b, TPlan_docs &doc_rows, TToken_strin
new_val -= moved;
mrpline->record(b-1).add_unsched_ord(moved);
}
// new_val -= sr;
}
}
}
TMRP_docref *rdr=line.first_rigaref(b);
bool found=FALSE;
while (rdr || found==FALSE && new_val.sign() > 0)
@ -2478,7 +2519,8 @@ int TPlanning_mask::salva_cella(int r, int b, TPlan_docs &doc_rows, TToken_strin
//if (new_anno==anno && new_codnum==codnum && new_numdoc==numdoc)
new_val -= old;
}
} else
}
else
found = TRUE;
rdr=line.next_rigaref(b);
} // ciclo di aggiornamento dei riferimenti ai docs
@ -2510,10 +2552,10 @@ int TPlanning_mask::salva_documenti(TExceptions_array &excepts, TSheet_field & s
const bool ordiniXscadenza = get_bool(F_DIVIDEBYDATE);
if (ordiniXscadenza && ordiniXarticolo)
if (!noyes_box("E' stato scelto di generare un ordine diverso per ogni articolo e scadenza. Confermi ?"))
if (!noyes_box("E' stato scelto di generare un ordine diverso per ogni articolo e scadenza: confermare?"))
return 0;
if (!(ordiniXscadenza || ordiniXarticolo))
if (!noyes_box("E' stato scelto di generare un unico ordine per ogni articolo e scadenza. Confermi ?"))
if (!noyes_box("E' stato scelto di generare un unico ordine per ogni articolo e scadenza: confermare?"))
return 0;
TProgind pi(LAST_BUCKET*sf.items(), "Emissione documenti" , FALSE, TRUE);
@ -2541,7 +2583,7 @@ int TPlanning_mask::salva_documenti(TExceptions_array &excepts, TSheet_field & s
if (row->get_long(F_BUCKET0+b-FIRST_FIELD)!=0L && !error_on_row.is_key(key))
{
error_box("Riga %d: manca l'indicazione del codice %s",r+1,get(F_TIPOCF)[0] == 'F' ? "fornitore" : "cliente");
error_on_row.add(key,new TString(""));
error_on_row.add(key,NULL);
}
}
if (ordiniXarticolo)
@ -2569,7 +2611,15 @@ int TPlanning_mask::salva_documenti(TExceptions_array &excepts, TSheet_field & s
if (row->get_long(F_CLIENTE-FIRST_FIELD) || cache().get("%TIP",save_opt.row(saveit).get(F_TIPO_PLAN-FIRST_FIELD)).get_bool("B5"))
salva_cella(r, b, doc_rows, save_opt.row(saveit));
else
error_box("Riga %d: manca l'indicazione del codice %s",r+1,get(F_TIPOCF)[0] == 'F' ? "fornitore" : "cliente");
{
TString8 key;
key.format("%d",r);
if (row->get_long(F_BUCKET0+b-FIRST_FIELD)!=0L && !error_on_row.is_key(key))
{
error_box("Riga %d: manca l'indicazione del codice %s",r+1,get(F_TIPOCF)[0] == 'F' ? "fornitore" : "cliente");
error_on_row.add(key,NULL);
}
}
}
long recs = 0L;
if (ordiniXarticolo)
@ -2633,7 +2683,7 @@ bool TPlanning_mask::on_savefields_event(long jolly)
}
bool TPlanning_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
const char * confirm_msg="Le modifiche non registrate sulle attuali %d linee di articoli verranno perse. Confermi?";
const char * confirm_msg="Le modifiche non registrate sulle attuali %d linee di articoli verranno perse: confermare?";
switch (o.dlg())
{
case F_DADATA:

View File

@ -87,6 +87,12 @@
#define F_CATVEN_CV 257
#define F_TIPOCF 258
#define F_DOC_YEAR_PREC 259
#define F_FRART 261
#define F_TOART 262
#define F_FRGRM 263
#define F_FRSGM 264
#define F_TOGRM 265
#define F_TOSGM 266
// filtri di salvataggio
#define F_SAVE_OPT 260

View File

@ -186,7 +186,7 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 2 16 "Considera i documenti dell'anno precedente"
PROMPT 2 15 "Considera i documenti dell'anno precedente"
END
BOOLEAN F_NOCLI_IN
@ -228,7 +228,80 @@ END
BOOLEAN F_DOC_YEAR_PREC
BEGIN
PROMPT 50 16 ""
PROMPT 50 15 ""
END
STRING F_FRART 20
BEGIN
PROMPT 2 17 "Da articolo "
FLAG "U"
USE LF_ANAMAG
INPUT CODART F_FRART
DISPLAY "Codice@20" CODART
DISPLAY "Descrizione@50" DESCR
OUTPUT F_FRART CODART
CHECKTYPE NORMAL
END
STRING F_TOART 20
BEGIN
PROMPT 40 17 "A articolo "
FLAGS "U"
COPY USE F_FRART
INPUT CODART F_TOART
COPY DISPLAY F_FRART
OUTPUT F_TOART CODART
CHECKTYPE NORMAL
END
STRING F_FRGRM 3
BEGIN
PROMPT 2 18 "Da Gr. merc. "
FLAG "U"
USE GMC KEY 1 SELECT CODTAB[4,5]==""
INPUT CODTAB F_FRGRM
DISPLAY "Codice" CODTAB[1,3]
DISPLAY "Descrizione@50" S0
OUTPUT F_FRGRM CODTAB[1,3]
CHECKTYPE NORMAL
END
STRING F_FRSGM 2
BEGIN
PROMPT 30 18 ""
FLAG "U"
USE GMC
INPUT CODTAB[1,3] F_FRGRM
INPUT CODTAB[4,5] F_FRSGM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_FRGRM CODTAB[1.3]
OUTPUT F_FRSGM CODTAB[4,5]
CHECKTYPE NORMAL
END
STRING F_TOGRM 3
BEGIN
PROMPT 42 18 "Da Gr. merc. "
FLAG "U"
COPY USE F_FRGRM
INPUT CODTAB F_TOGRM
COPY DISPLAY F_FRGRM
OUTPUT F_TOGRM CODTAB[1,3]
CHECKTYPE NORMAL
END
STRING F_TOSGM 2
BEGIN
PROMPT 70 18 ""
FLAG "U"
COPY USE F_FRSGM
INPUT CODTAB[1,3] F_TOGRM
INPUT CODTAB[4,5] F_TOSGM
COPY DISPLAY F_FRGRM
OUTPUT F_TOGRM CODTAB[1,3]
OUTPUT F_TOSGM CODTAB[4,5]
CHECKTYPE NORMAL
END
ENDPAGE

View File

@ -203,10 +203,12 @@ bool TRiga_articolo::find_block(const TSheet_field& sf, const int riga, int &fir
int TRiga_articolo::order_compare( const TToken_string &r1 , const TToken_string &r2 , int level, bool ascending)
{
TString str0, str1;
TString80 str0, str1;
int cmp = 0;
if (level>=0)
{
for (int i = 2; i <= level && cmp == 0; i++)
{
r1.get(i, str0);
@ -216,14 +218,14 @@ int TRiga_articolo::order_compare( const TToken_string &r1 , const TToken_strin
} else {
// ordinamenti non standard
short f;
short fields_ACL[] = {F_PRIORITA, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_CLIENTE, F_SORTCODIMP, F_SORTCODLIN,F_PRIORITA};
short fields_ALC[] = {F_PRIORITA, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_SORTCODIMP, F_SORTCODLIN, F_CLIENTE,F_PRIORITA};
short fields_LAC[] = {F_PRIORITA, F_SORTCODIMP, F_SORTCODLIN, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_CLIENTE,F_PRIORITA};
short fields_LCA[] = {F_PRIORITA, F_SORTCODIMP, F_SORTCODLIN, F_CLIENTE, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4,F_PRIORITA};
short fields_CLA[] = {F_PRIORITA, F_CLIENTE, F_SORTCODIMP, F_SORTCODLIN, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4,F_PRIORITA};
short fields_CAL[] = {F_PRIORITA, F_CLIENTE, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_SORTCODIMP, F_SORTCODLIN,F_PRIORITA};
short fields_CA[] = {F_PRIORITA, F_CLIENTE, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_PRIORITA, F_PRIORITA, F_PRIORITA};
short fields_AC[] = {F_PRIORITA, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_CLIENTE, F_PRIORITA, F_PRIORITA, F_PRIORITA};
static const short fields_ACL[] = {F_PRIORITA, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_CLIENTE, F_SORTCODIMP, F_SORTCODLIN,F_PRIORITA};
static const short fields_ALC[] = {F_PRIORITA, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_SORTCODIMP, F_SORTCODLIN, F_CLIENTE,F_PRIORITA};
static const short fields_LAC[] = {F_PRIORITA, F_SORTCODIMP, F_SORTCODLIN, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_CLIENTE,F_PRIORITA};
static const short fields_LCA[] = {F_PRIORITA, F_SORTCODIMP, F_SORTCODLIN, F_CLIENTE, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4,F_PRIORITA};
static const short fields_CLA[] = {F_PRIORITA, F_CLIENTE, F_SORTCODIMP, F_SORTCODLIN, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4,F_PRIORITA};
static const short fields_CAL[] = {F_PRIORITA, F_CLIENTE, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_SORTCODIMP, F_SORTCODLIN,F_PRIORITA};
static const short fields_CA[] = {F_PRIORITA, F_CLIENTE, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_PRIORITA, F_PRIORITA, F_PRIORITA};
static const short fields_AC[] = {F_PRIORITA, F_ARTICOLO,F_LIV1,F_LIV2,F_LIV3,F_LIV4, F_CLIENTE, F_PRIORITA, F_PRIORITA, F_PRIORITA};
for (int ii = 0; ii < 8 && cmp == 0; ii++)
{
const int i = ii + (-level <= SORT_BY_PRIORITY ? 0 : 1);

View File

@ -52,7 +52,7 @@ class TStampaScadenzario : public TPrintapp
TPString *_descrizione,*_ragsoc,*_des_conto; // Descrizione (da LF_PARTITE), ragione sociale (da LF_CLIFO)
// Descrizione conto (da LF_PCON)
TString _imp_scad,_imp_pag,_rimdir,_riba,_altri, // Valori calcolati in preprocess_page: rimesse dirette, Ri.ba e altri
_cur_gr_s, _cur_co_s, _cur_codcf_s; // _imp_scad e _imp_pag vengono anch'essi calcolati in preprocess_page.
_cur_gr_s,_cur_co_s,_cur_codcf_s, _abipr,_cabpr; // _imp_scad e _imp_pag vengono anch'essi calcolati in preprocess_page.
TDate _datai, _dataf, _datas, // Data inizio, fine e stampa
_cur_data; // Data di scadenza riferita al record corrente
long _cur_codcf; // Cli/Fo riferito al record corrente
@ -411,7 +411,18 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
{
TBill bill(rc);
if (!_m->selected(bill))
return FALSE;
return FALSE;
// Controlla eventuale filtro sulla banca di presentazione
if (_tipost == fornitori && _abipr.not_empty())
{
const TString16 abi = rc.get(SCAD_CODABIPR);
if (_abipr != abi)
return FALSE;
const TString16 cab = rc.get(SCAD_CODCABPR);
if (_cabpr.not_empty() && _cabpr != cab)
return FALSE;
}
_descrizione->restart();
if (scad_changed(tipoc,gruppo,conto,codcf,annop,nump))
@ -773,6 +784,8 @@ bool TStampaScadenzario::set_print(int)
_datai = (const char *)(_m->get(F_DATASCADENZAI));
_dataf = (const char *)(_m->get(F_DATASCADENZAF));
_datas = (const char *)(_m->get(F_DATASTAMPA));
_abipr = _m->get(F_DA_ABI);
_cabpr = _m->get(F_DA_CAB);
// N.B I cursori sono tutti TSorted_cursor; alcuni di questi(_cur11 e _cur41) referenziano a campi di sort
// presenti anche su altri file (LF_CLIFO o LF_PCON), percio' e' necessario che il metodo filtercursor()
@ -988,7 +1001,10 @@ void TStampaScadenzario::set_page_clifo(int nriga)
set_row(nriga,"@77g@4,rs/@1n",FLD(LF_SCADENZE,SCAD_CODPAG),FLD(LF_SCADENZE,SCAD_TIPOPAG));
set_row(nriga,"@86g@4n",FLD(LF_SCADENZE,SCAD_NRATA));
if (_tipost == fornitori)
{
set_row(nriga,"@91g@5pn",FLD(LF_SCADENZE,SCAD_CODABIPR,"@@@@@"));
set_row(nriga+1,"@91g@5pn",FLD(LF_SCADENZE,SCAD_CODCABPR,"@@@@@"));
}
set_row(nriga,"@97g#t", &_codval);
set_row(nriga,"@101g#18t",&_imp_scad);
set_row(nriga,"@120g#18t",&_imp_pag);

View File

@ -10,3 +10,7 @@
#define F_VALUTA 108
#define F_RIEPILOGO 109
#define F_DA_ABI 201
#define F_DA_CAB 202
#define F_DA_BAN 203

Some files were not shown because too many files have changed in this diff Show More