Patch level : 2.2 291

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Riportate le patch fino alla 2.1 490

Controllare velib.h. il merge era impossibile
Controllare modaut.h e campo.aut. pack DT  Contabilità industriale conflittano


git-svn-id: svn://10.65.10.50/trunk@13668 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2006-01-09 01:15:53 +00:00
parent ac5d36ee3b
commit df66240d22
80 changed files with 2233 additions and 1337 deletions

View File

@ -1242,7 +1242,6 @@ bool TGestioneSoggetti::user_create()
_sttess2 = config.get_bool("StTess2"); _sttess2 = config.get_bool("StTess2");
_dataisc = config.get_bool("DataIsc"); _dataisc = config.get_bool("DataIsc");
_ctrlpass = config.get_bool("CtrlPass"); _ctrlpass = config.get_bool("CtrlPass");
if (_ctrlpass)
_permesso = richiesta_password(); _permesso = richiesta_password();
return TRUE; return TRUE;
} }
@ -1365,6 +1364,7 @@ int TGestioneSoggetti::read(TMask& m)
row.add(riga.get(DON_PROTIDEMIA)); // 14 row.add(riga.get(DON_PROTIDEMIA)); // 14
s.check_row(r-1); s.check_row(r-1);
} }
s.force_update();
} }
else else
if (err == _iseof || err == _isemptyfile) if (err == _iseof || err == _isemptyfile)
@ -1397,6 +1397,7 @@ int TGestioneSoggetti::read(TMask& m)
row.add(riga.get(CON_RESPONSAB)); row.add(riga.get(CON_RESPONSAB));
} }
TGestioneSoggetti::tipocon_set_sheet(s); TGestioneSoggetti::tipocon_set_sheet(s);
s.force_update();
} }
else else
if (err == _iseof || err == _isemptyfile) if (err == _iseof || err == _isemptyfile)
@ -1424,6 +1425,7 @@ int TGestioneSoggetti::read(TMask& m)
row.add(riga.get(IDO_RESPONSAB)); row.add(riga.get(IDO_RESPONSAB));
} }
TGestioneSoggetti::idosos_set_sheet(s); TGestioneSoggetti::idosos_set_sheet(s);
s.force_update();
} }
else else
if (err == _iseof || err == _isemptyfile) if (err == _iseof || err == _isemptyfile)
@ -1458,6 +1460,7 @@ int TGestioneSoggetti::read(TMask& m)
row.add(""); // denominazione gruppo aziendale row.add(""); // denominazione gruppo aziendale
s.check_row(r-1); s.check_row(r-1);
} }
s.force_update();
} }
else else
if (err == _iseof || err == _isemptyfile) if (err == _iseof || err == _isemptyfile)
@ -1483,6 +1486,7 @@ int TGestioneSoggetti::read(TMask& m)
row.add(riga.get(STO_CATISC)); row.add(riga.get(STO_CATISC));
row.add(riga.get(STO_MOTDIM)); row.add(riga.get(STO_MOTDIM));
} }
s.force_update();
} }
else else
if (err == _iseof || err == _isemptyfile) if (err == _iseof || err == _isemptyfile)
@ -2398,6 +2402,8 @@ bool TGestioneSoggetti::storico_notify(TSheet_field& s, int r, KEY k)
bool TGestioneSoggetti::richiesta_password() bool TGestioneSoggetti::richiesta_password()
{ {
if (_ctrlpass)
{
TMask& mask = *(app().get_mask()); TMask& mask = *(app().get_mask());
TMask msk("at0100e"); TMask msk("at0100e");
if (msk.run() == K_ENTER) if (msk.run() == K_ENTER)
@ -2415,6 +2421,9 @@ bool TGestioneSoggetti::richiesta_password()
mask.disable(F_IDONEITA); mask.disable(F_IDONEITA);
} }
} }
}
else
return TRUE;
return FALSE; return FALSE;
} }

View File

@ -431,11 +431,11 @@ void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
{ {
const TDate& datadon = recdon.get_date(DON_DATADON); const TDate& datadon = recdon.get_date(DON_DATADON);
const TDate& dataultdon = rec.get_date(SOG_DATAULTDON); const TDate& dataultdon = rec.get_date(SOG_DATAULTDON);
if (datadon > dataultdon)
{
TRectype* key = new TRectype(LF_DONAZ); TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, rec.get(SOG_CODICE)); key->put(DON_CODICE, rec.get(SOG_CODICE));
int err = _sdonazioni->read(key); int err = _sdonazioni->read(key);
if (datadon > dataultdon || _sdonazioni->rows() == 0)
{
TRectype recnew(recdon); TRectype recnew(recdon);
recnew.put(DON_CODICE, rec.get_long(SOG_CODICE)); recnew.put(DON_CODICE, rec.get_long(SOG_CODICE));
recnew.put(DON_PROGDON, _sdonazioni->rows()+1); recnew.put(DON_PROGDON, _sdonazioni->rows()+1);

View File

@ -14,6 +14,9 @@ extern "C"
#include "../xvaga/skeylink.h" #include "../xvaga/skeylink.h"
} }
static HINSTANCE _hInstance = NULL;
static int _dongle_type = 0;
void ErrorBox(LPCSTR str) void ErrorBox(LPCSTR str)
{ {
MessageBox(GetFocus(), str, "Installazione", MB_ICONSTOP|MB_OK); MessageBox(GetFocus(), str, "Installazione", MB_ICONSTOP|MB_OK);
@ -28,22 +31,22 @@ void WarningBox(LPCSTR str)
/* Gestione chiave Hardlock */ /* Gestione chiave Hardlock */
/****************************/ /****************************/
bool HardlockGarble(unsigned int* data) bool HardlockGarble(unsigned short* data)
{ {
HL_CODE(data, 1); HL_CODE(data, 1);
return TRUE; return TRUE;
} }
unsigned int HardlockLogin(int& year) unsigned short HardlockLogin(int& year)
{ {
unsigned int serno = 0xFFFF; unsigned short serno = 0xFFFF;
unsigned char REFKEY[16] = "CAMPOKEY"; unsigned char REFKEY[16] = "CAMPOKEY";
unsigned char VERKEY[16] = "ìpÙˆ¬cê<"; unsigned char VERKEY[16] = "ìpÙˆ¬cê<";
if (HL_LOGIN(26952, LOCAL_DEVICE, REFKEY, VERKEY) == STATUS_OK) if (HL_LOGIN(26952, LOCAL_DEVICE, REFKEY, VERKEY) == STATUS_OK)
{ {
unsigned int eprom[64]; memset(eprom, 0, sizeof(eprom)); unsigned short eprom[64]; memset(eprom, 0, sizeof(eprom));
HL_READBL((unsigned char*)eprom); HL_READBL((unsigned char*)eprom);
unsigned int data[4]; unsigned short data[4];
memcpy(data, eprom, sizeof(data)); memcpy(data, eprom, sizeof(data));
HardlockGarble(data); HardlockGarble(data);
if (data[0] == 0xFAE8) if (data[0] == 0xFAE8)
@ -72,9 +75,9 @@ void EncodeEutronPassword(char* str)
strcpy(str, tmp); strcpy(str, tmp);
} }
unsigned int EutronLogin(int& year) unsigned short EutronLogin(int& year)
{ {
unsigned int serno = 0xFFFF; unsigned short serno = 0xFFFF;
KEY_NET eutron_key; KEY_NET eutron_key;
memset(&eutron_key, 0, sizeof(KEY_NET)); memset(&eutron_key, 0, sizeof(KEY_NET));
@ -103,7 +106,7 @@ unsigned int EutronLogin(int& year)
smartlink(&eutron_key); smartlink(&eutron_key);
if (eutron_key.status == ST_OK) if (eutron_key.status == ST_OK)
{ {
serno = (unsigned int)atol((const char*)eutron_key.data+4); serno = (unsigned short)atol((const char*)eutron_key.data+4);
const unsigned short y = *(unsigned short*)(eutron_key.data+12); const unsigned short y = *(unsigned short*)(eutron_key.data+12);
if (y > 2000 && y < 3000) if (y > 2000 && y < 3000)
year = y; year = y;
@ -172,21 +175,29 @@ void ProgramName(char* name)
strcpy(name, "Campo"); strcpy(name, "Campo");
} }
bool DongleTest() int DongleTest()
{ {
_dongle_type = 0;
int yearKey = 0; int yearKey = 0;
unsigned int serno = HardlockLogin(yearKey); unsigned int serno = HardlockLogin(yearKey);
if (serno == 0xFFFF) if (serno == 0xFFFF)
{
serno = EutronLogin(yearKey); serno = EutronLogin(yearKey);
if (serno != 0xFFFF)
_dongle_type = 2; //chiave eutron
}
else
_dongle_type = 1; //chiave hardlock
if (serno == 0 || serno == 0xFFFF) if (serno == 0) // Chiave di sviluppo
return TRUE; // Chiave inesistente o invisibile = Prima installazione return _dongle_type;
if (serno == 0xFFFF) // Chiave inesistente o invisibile = Prima installazione o demo
return _dongle_type;
const int verYear = VersionYear(); const int verYear = VersionYear();
if (yearKey >= verYear) // Chiave già programmata con assistenza pagata if (yearKey < verYear) // Chiave già programmata con assistenza pagata
return TRUE; {
bool ok = FALSE; bool ok = FALSE;
ifstream keys("./program/zip/dninst.zip", ios::in | ios::nocreate); ifstream keys("./program/zip/dninst.zip", ios::in | ios::nocreate);
if (keys.good()) if (keys.good())
@ -227,7 +238,78 @@ bool DongleTest()
{ {
ErrorBox("Impossibile verificare il contratto di manutenzione"); ErrorBox("Impossibile verificare il contratto di manutenzione");
} }
return ok; }
return _dongle_type;
}
//allah!
int __stdcall DongleProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
::CheckRadioButton(hDlg, 100, 101, 100);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
_dongle_type = ::IsDlgButtonChecked(hDlg, 100) ? 2 : 1;
case IDCANCEL:
::EndDialog(hDlg, LOWORD(wParam));
return true;
default:
break;
}
break;
default:
break;
}
return false;
}
bool InstallDongle()
{
//metodo per richiedere il tipo di chiave e lanciare l'installazione dei servizi
int ret = ::DialogBox(_hInstance, "DONGLE", NULL, DongleProc);
if (ret != IDOK)
return false;
char path[256] = "";
if (_dongle_type == 1)
strcpy(path, "./chiavi/hardlock/hldrv32.exe");
else
strcpy(path, "./chiavi/eutron/sdi.exe");
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
path, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
return false;
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return true;
} }
unsigned int Run(LPCSTR app) unsigned int Run(LPCSTR app)
@ -286,8 +368,8 @@ LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
RECT rct; RECT rct;
const char* s1 = "Installa la versione commerciale protetta. E' necessario disporre di una chiave di protezione hardware."; const char* s1 = "Installa la versione normale";
const char* s2 = "Installa la versione Demo. La versione Demo è priva di protezione hardware ma soggetta ad alcune limitazioni."; const char* s2 = "Installa la versione dimostrativa";
const char* s4 = "Termina installazione"; const char* s4 = "Termina installazione";
const char* s5 = "Scelta installazione"; const char* s5 = "Scelta installazione";
@ -327,18 +409,35 @@ LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_COMMAND: case WM_COMMAND:
{ {
if (wParam == 1000) bool quit_program = false;
switch (LOWORD(wParam))
{ {
if (DongleTest()) case 2:
Run("program\\disk1\\setup.exe"); quit_program = true;
} break;
else if (wParam == 1001) case 1000: //installazione normale con chiave
if (_dongle_type == 0) //non trova una chiave funzionante...
{ {
Run("demo\\disk1\\setup.exe"); InstallDongle(); //chiede di installare la chiave...
DongleTest(); //verifica l'installazione della chiave..
if (_dongle_type == 0) //la chiave non c'e' proprio!
{ //forza l'installazione del modulo SY con chiave Eutron (finta)
int ret = ::MessageBox(hwnd, "ATTENZIONE! Chiave di protezione NON rilevata:\n"
"Si desidera installare ugualmente il modulo base ?",
"Installazione", MB_YESNO | MB_ICONQUESTION);
_dongle_type = ret == IDYES ? 2 : 0;
} }
else if (wParam != 2) }
return 0; if (_dongle_type != 0)
quit_program = Run("program\\disk1\\setup.exe") > 32;
break;
case 1001:
quit_program = Run("demo\\disk1\\setup.exe") > 32;
break;
default:
break;
}
if (quit_program) //esce dal programma di installazione
PostQuitMessage(0); PostQuitMessage(0);
} }
break; break;
@ -378,7 +477,7 @@ BOOL InitApplication (HINSTANCE hinst)
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA; wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hinst; wc.hInstance = hinst;
wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(103)); wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(9012));
wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1); wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
@ -400,9 +499,12 @@ int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nC
{ {
MSG msg; MSG msg;
if (!hinstPrev)
if (!InitApplication(hInst)) // Register window class if (!InitApplication(hInst)) // Register window class
return FALSE; return 0;
_hInstance = hInst;
_dongle_type = DongleTest(); //controlla se la chiave c'e' ed eventualmente quale e'
RECT rect; RECT rect;
GetWindowRect(GetDesktopWindow(),&rect); GetWindowRect(GetDesktopWindow(),&rect);
@ -418,13 +520,16 @@ int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nC
char prompt[128]; char prompt[128];
strcpy(prompt, name); strcpy(prompt, name);
UINT dwFlags = WS_CHILD | WS_VISIBLE;
/* Disegna i pulsanti */ /* Disegna i pulsanti */
CreateWindow("BUTTON",prompt, WS_CHILD | WS_VISIBLE, CreateWindow("BUTTON",prompt, dwFlags,
offx, offy, 300, 32, hwndDlg , (HMENU)1000, hInst, NULL ); offx, offy, 300, 32, hwndDlg , (HMENU)1000, hInst, NULL );
if (_dongle_type != 0) //se la chiave e' presente e funzionante non si puo' installare la DEMO
dwFlags |= WS_DISABLED;
strcat(prompt, " DEMO"); strcat(prompt, " DEMO");
CreateWindow("BUTTON", prompt, WS_CHILD | WS_VISIBLE, CreateWindow("BUTTON", prompt, dwFlags,
offx, offy+80, 300, 32, hwndDlg , (HMENU)1001, hInst, NULL ); offx, offy+80, 300, 32, hwndDlg , (HMENU)1001, hInst, NULL );

View File

@ -15,6 +15,7 @@
#include "batbver.h" #include "batbver.h"
#include "batbnoc.h" #include "batbnoc.h"
#include "batbnot.h" #include "batbnot.h"
#define F_PREZZO 107
#define REG_JOURNAL 5 #define REG_JOURNAL 5
#define REG_DICHINT 10 #define REG_DICHINT 10
@ -28,6 +29,8 @@
#define TAB_GRMERC "GMC" #define TAB_GRMERC "GMC"
#define TAB_NOMENCOMB "%NOC" #define TAB_NOMENCOMB "%NOC"
#define TAB_NOTECLI "%NOT" #define TAB_NOTECLI "%NOT"
#define TAB_PREST "PRS"
#define TAB_SPESE "SPP"
class TGeneric_table_app : public TTable_application class TGeneric_table_app : public TTable_application
{ {
@ -736,22 +739,36 @@ bool TGeneric_table_app::user_destroy()
int TGeneric_table_app::read(TMask& m) int TGeneric_table_app::read(TMask& m)
{ {
int err = Tab_application::read(m); int err = Tab_application::read(m);
if (get_tabname() == TAB_NOTECLI) const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
glue_string(); glue_string();
else
if (table_name == TAB_SPESE || table_name == TAB_PREST)
{
if (get_relation()->lfile().get_real("R10") == ZERO)
m.set(F_PREZZO, get_relation()->lfile().get("R0"));
}
return err; return err;
} }
int TGeneric_table_app::write(const TMask& m) int TGeneric_table_app::write(const TMask& m)
{ {
if (get_tabname() == TAB_NOTECLI) const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
fragment_string(); fragment_string();
else
if (table_name == TAB_SPESE || table_name == TAB_PREST)
get_relation()->lfile().put("R0", m.get(F_PREZZO));
return Tab_application::write(m); return Tab_application::write(m);
} }
int TGeneric_table_app::rewrite(const TMask& m) int TGeneric_table_app::rewrite(const TMask& m)
{ {
if (get_tabname() == TAB_REGISTRI && !m.get_bool(F_CONFIG)) const TString & table_name = get_tabname();
if (table_name == TAB_REGISTRI && !m.get_bool(F_CONFIG))
{ {
TString16 config; TString16 config;
config.format("REG%05ld", m.get_long(F_CODDITTA)); config.format("REG%05ld", m.get_long(F_CODDITTA));
@ -762,8 +779,11 @@ int TGeneric_table_app::rewrite(const TMask& m)
ini.set("Type", -1); ini.set("Type", -1);
} }
if (get_tabname() == TAB_NOTECLI) if (table_name == TAB_NOTECLI)
fragment_string(); fragment_string();
else
if (table_name == TAB_SPESE || table_name == TAB_PREST)
get_relation()->lfile().put("R0", m.get(F_PREZZO));
return Tab_application::rewrite(m); return Tab_application::rewrite(m);
} }

View File

@ -69,7 +69,10 @@ Descrizione = Provvigioni Agenti
Descrizione = Statistiche di Vendita Descrizione = Statistiche di Vendita
[dt] [dt]
Descrizione = Importazione documenti STORE Descrizione = Importazione documenti DI.TECH
[tp]
Descrizione = Trasferimento PACK
[_area_magazzino_produzione] [_area_magazzino_produzione]
Descrizione=AREA MAGAZZINO E PRODUZIONE Descrizione=AREA MAGAZZINO E PRODUZIONE

View File

@ -239,8 +239,12 @@ void TCalc_cesp_cms::utilizzo_per_cms(const TRectype& ammce_rec)
if (!doc_exist) if (!doc_exist)
{ {
doc_cesp.put(DOC_TIPODOC, _mask->get(F_TIPODOC)); doc_cesp.put(DOC_TIPODOC, _mask->get(F_TIPODOC));
doc_cesp.put(DOC_DATADOC, TDate(TODAY)); doc_cesp.put(DOC_DATADOC, _mask->get(F_GENERA_DOC));
} }
//completa la testata con i dati della maschera
doc_cesp.put(DOC_TIPOCF, 'F');
doc_cesp.put(DOC_CODCF, _mask->get(F_CODCF));
doc_cesp.put(DOC_NUMDOCRIF, _mask->get(F_NUMDOCRIF));
//ciclo su SALCECMS data una chiave idcespite + esercizio (si fa solo se salcecms non e' vuoto, //ciclo su SALCECMS data una chiave idcespite + esercizio (si fa solo se salcecms non e' vuoto,
@ -324,7 +328,7 @@ void TCalc_cesp_cms::delete_cespi_docs()
cur_doc.freeze(); cur_doc.freeze();
TProgind progind(items, "Eliminazione vecchi documenti in corso...", false, true); TProgind progind(items, "Eliminazione vecchi documenti in corso...", false, true);
for (cur_doc=0; cur_doc.pos()<items; ++cur_doc) for (cur_doc = 0; cur_doc.pos() < items; ++cur_doc)
{ {
progind.addstatus(1); progind.addstatus(1);
TDocumento doc(rec); TDocumento doc(rec);
@ -412,6 +416,8 @@ bool TCalc_cesp_cms::create()
_mask->set(F_TIPODOC, config_doc.get("TIPODOC")); _mask->set(F_TIPODOC, config_doc.get("TIPODOC"));
_mask->set(F_TIPORIGA, config_doc.get("TIPORIGA")); _mask->set(F_TIPORIGA, config_doc.get("TIPORIGA"));
_mask->set(F_CODIVA, config_doc.get("CODIVA")); _mask->set(F_CODIVA, config_doc.get("CODIVA"));
_mask->set(F_CODCF, config_doc.get("CODCF"));
_mask->set(F_NUMDOCRIF, config_doc.get("NUMDOCRIF"));
_mask->set(F_CMSGEN, config_doc.get("CMSGEN")); _mask->set(F_CMSGEN, config_doc.get("CMSGEN"));
return TSkeleton_application::create(); return TSkeleton_application::create();

View File

@ -21,3 +21,7 @@
#define F_CMSGEN 220 #define F_CMSGEN 220
#define F_DESCMSGEN 221 #define F_DESCMSGEN 221
#define F_CMSGROUP 222 #define F_CMSGROUP 222
#define F_CODCF 223
#define F_DESCF 224
#define F_NUMDOCRIF 225
#define F_GENERA_DOC 226

View File

@ -3,5 +3,7 @@ CODNUM=
TIPODOC= TIPODOC=
TIPORIGA= TIPORIGA=
CODIVA= CODIVA=
CODCF=
NUMDOCRIF=
CMSGEN= CMSGEN=

View File

@ -79,9 +79,15 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
DATE F_GENERA_DOC
BEGIN
PROMPT 1 4 "Data generazione documenti "
CHECKTYPE REQUIRED
END
STRING F_DA_IDCESPITE 10 STRING F_DA_IDCESPITE 10
BEGIN BEGIN
PROMPT 1 5 "Dal cespite " PROMPT 1 6 "Dal cespite "
FLAGS "UZ" FLAGS "UZ"
USE LF_SALCECMS SELECT NRIGA==1 USE LF_SALCECMS SELECT NRIGA==1
JOIN LF_CESPI INTO IDCESPITE==IDCESPITE JOIN LF_CESPI INTO IDCESPITE==IDCESPITE
@ -102,13 +108,13 @@ END
STRING F_DA_DESC 60 50 STRING F_DA_DESC 60 50
BEGIN BEGIN
PROMPT 26 5 "" PROMPT 26 6 ""
FLAGS "D" FLAGS "D"
END END
STRING F_A_IDCESPITE 10 STRING F_A_IDCESPITE 10
BEGIN BEGIN
PROMPT 1 6 "Al cespite " PROMPT 1 7 "Al cespite "
FLAGS "UZ" FLAGS "UZ"
COPY USE F_DA_IDCESPITE COPY USE F_DA_IDCESPITE
INPUT IDCESPITE F_A_IDCESPITE INPUT IDCESPITE F_A_IDCESPITE
@ -123,10 +129,15 @@ END
STRING F_A_DESC 60 50 STRING F_A_DESC 60 50
BEGIN BEGIN
PROMPT 26 6 "" PROMPT 26 7 ""
FLAGS "D" FLAGS "D"
END END
GROUPBOX DLG_NULL 78 8
BEGIN
PROMPT 0 8 "@bEstremi documento generato"
END
STRING F_CODNUM 4 STRING F_CODNUM 4
BEGIN BEGIN
PROMPT 1 9 "Numerazione " PROMPT 1 9 "Numerazione "
@ -192,14 +203,37 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
NUMBER F_CODCF 6
BEGIN
PROMPT 1 13 "Fornitore "
USE LF_CLIFO
INPUT TIPOCF "F"
INPUT CODCF F_CODCF
OUTPUT F_DESCF RAGSOC
CHECKTYPE NORMAL
FLAGS "DG"
END
STRING F_DESCF 50
BEGIN
PROMPT 24 13 ""
FLAGS "D"
END
STRING F_NUMDOCRIF 7
BEGIN
PROMPT 1 14 "Doc. rif. "
FLAGS "D"
END
GROUPBOX DLG_NULL 78 4 GROUPBOX DLG_NULL 78 4
BEGIN BEGIN
PROMPT 0 14 "@bCommessa spese generali" PROMPT 0 16 "@bCommessa spese generali"
END END
STRING F_CMSGEN 20 STRING F_CMSGEN 20
BEGIN BEGIN
PROMPT 1 15 "Codice Commessa " PROMPT 1 17 "Codice Commessa "
FLAGS "DUZ" FLAGS "DUZ"
KEY 1 KEY 1
USE CMS USE CMS
@ -213,7 +247,7 @@ END
STRING F_DESCMSGEN 50 STRING F_DESCMSGEN 50
BEGIN BEGIN
PROMPT 1 16 "Descrizione " PROMPT 1 18 "Descrizione "
FLAGS "D" FLAGS "D"
KEY 2 KEY 2
USE CMS KEY 2 USE CMS KEY 2
@ -226,12 +260,12 @@ END
BOOLEAN F_SOLOPERC BOOLEAN F_SOLOPERC
BEGIN BEGIN
PROMPT 1 18 "Utilizza solo le percentuali nel calcolo" PROMPT 35 20 "Utilizza solo le percentuali nel calcolo"
END END
BOOLEAN F_CMSGROUP BOOLEAN F_CMSGROUP
BEGIN BEGIN
PROMPT 1 19 "Raggruppamento per commessa" PROMPT 1 20 "Raggruppamento per commessa"
END END
ENDPAGE ENDPAGE

View File

@ -158,6 +158,7 @@
#define F_CODVALINTRA 247 #define F_CODVALINTRA 247
#define F_DESVALINTRA 248 #define F_DESVALINTRA 248
#define F_CODCAUSNC 249 #define F_CODCAUSNC 249
#define F_DATAECONAI 250
#define DLG_RIC 300 #define DLG_RIC 300
#define DLG_CST 301 #define DLG_CST 301

View File

@ -1325,12 +1325,20 @@ END
BOOLEAN F_ADDCONAI BOOLEAN F_ADDCONAI
BEGIN BEGIN
PROMPT 2 12 "Addebito CONAI" PROMPT 2 11 "Addebito CONAI"
FIELD LF_CFVEN->ADDCONAI FIELD LF_CFVEN->ADDCONAI
MESSAGE FALSE CLEAR,8@|ENABLE,F_CONAIASS MESSAGE FALSE CLEAR,8@|ENABLE,F_CONAIASS
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
END END
DATE F_DATAECONAI
BEGIN
PROMPT 2 12 "Data fine esenz.CONAI "
FIELD LF_CFVEN->DATAECONAI
GROUP 8
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
END
BOOLEAN F_CONAIASS BOOLEAN F_CONAIASS
BEGIN BEGIN
PROMPT 43 12 "Stampa contributo CONAI assolto" PROMPT 43 12 "Stampa contributo CONAI assolto"

View File

@ -121,6 +121,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(SK_CAMBIO, cambio_handler); m->set_handler(SK_CAMBIO, cambio_handler);
m->set_handler(SK_TOTDOCVAL, totdocval_handler); m->set_handler(SK_TOTDOCVAL, totdocval_handler);
m->set_handler(F_CODPAG, codpag_handler); m->set_handler(F_CODPAG, codpag_handler);
m->set_handler(F_LINKDOC, linkdoc_handler);
TSheet_field& cg = m->sfield(F_SHEETCG); TSheet_field& cg = m->sfield(F_SHEETCG);
cg.set_notify(cg_notify); cg.set_notify(cg_notify);
@ -138,6 +139,7 @@ TMask* TPrimanota_application::load_mask(int n)
cgm.set_handler(113, suspended_handler); // Contropartita cgm.set_handler(113, suspended_handler); // Contropartita
cgm.set_handler(213, sheet_clifo_handler); cgm.set_handler(213, sheet_clifo_handler);
cgm.set_handler(313, sheet_clifo_handler); cgm.set_handler(313, sheet_clifo_handler);
cgm.set_handler(CG_MASTRINO, sheet_mastrino_handler);
// Se esiste lo sheet delle rate // Se esiste lo sheet delle rate
if (is_fattura()) if (is_fattura())
@ -176,7 +178,8 @@ TMask* TPrimanota_application::load_mask(int n)
bool TPrimanota_application::user_create() bool TPrimanota_application::user_create()
{ {
open_files(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_RCAUSALI, LF_CLIFO, LF_PCON, 0); open_files(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_RCAUSALI, LF_CLIFO, LF_PCON, 0);
open_files(LF_ATTIV, LF_SALDI, LF_COMUNI, LF_OCCAS, LF_NDITTE, 0); open_files(LF_ATTIV, LF_COMUNI, LF_OCCAS, LF_NDITTE, 0);
open_files(LF_MOV, LF_RMOV, LF_RMOVIVA, LF_SALDI, 0);
open_files(LF_PARTITE, LF_SCADENZE, LF_PAGSCA, LF_AGENTI, 0); open_files(LF_PARTITE, LF_SCADENZE, LF_PAGSCA, LF_AGENTI, 0);
_incasso = new TDati_incasso; _incasso = new TDati_incasso;
@ -192,8 +195,11 @@ bool TPrimanota_application::user_create()
_pag = NULL; _pag = NULL;
_is_saldaconto = false; _is_saldaconto = false;
load_mask(0); TFilename tmp;
if (get_mask_swap_file(tmp))
xvt_fsys_removefile(tmp);
load_mask(0);
load_colors(); load_colors();
return true; return true;
@ -392,7 +398,7 @@ bool TPrimanota_application::changing_mask(int mode)
TMask* TPrimanota_application::get_mask(int mode) TMask* TPrimanota_application::get_mask(int mode)
{ {
int annoiva = 0; int annoiva = 0;
TString16 caus; TString4 caus;
_mode = mode; _mode = mode;
@ -421,12 +427,54 @@ TMask* TPrimanota_application::get_mask(int mode)
return load_mask(_iva == nessuna_iva ? 1 : 2); return load_mask(_iva == nessuna_iva ? 1 : 2);
} }
bool TPrimanota_application::get_mask_swap_file(TFilename& name) const
{
name.tempdir(); name.add("cg2100.ini");
return name.exist();
}
bool TPrimanota_application::force_mask_swap(const TCausale& old_caus, const TCausale& new_caus)
{
TMask& old = curr_mask();
// Resetto il flag di dirty per non chiedere di salvare cose inutili
for (int i = old.fields()-1; i >= 0; i--)
{
TMask_field& f = old.fld(i);
f.set_dirty(false);
}
if (old.dirty())
return false;
// Salvo la maschera corrente in un apposito file temporaneo "cg2100.ini"
TFilename tmp; get_mask_swap_file(tmp);
TConfig ini(tmp);
mask2ini(old, ini);
ini.set_paragraph("23");
ini.remove(MOV_NUMREG); // Tolgo numero di registrazione provvisorio
if (old_caus.iva() != nessuna_iva && new_caus.iva() != nessuna_iva)
{
// Salvo un campo virtuale col codice IVA
ini.set("CODIVA", old.get(F_CODIVA));
}
if (old_caus.iva() != new_caus.iva() || old_caus.corrispettivi() != new_caus.corrispettivi())
{
ini.remove(MOV_CODCF); // Tolgo il codice cliente, che potrebbe infornitorirsi
}
old.stop_run(K_ESC);
return true;
}
void TPrimanota_application::on_firm_change() void TPrimanota_application::on_firm_change()
{ {
TRelation_application::on_firm_change(); // May be useful, who knows? TRelation_application::on_firm_change(); // May be useful, who knows?
_rel->lfile().last(); _lastreg = 0;
_lastreg = _rel->lfile().get_long(MOV_NUMREG); // Init last registration number if (_rel->lfile().last() == NOERR)
_lastreg = _rel->curr().get_long(MOV_NUMREG); // Init last registration number
_esercizi.update(); // Init exercises _esercizi.update(); // Init exercises
} }
@ -512,8 +560,11 @@ void TPrimanota_application::init_mask(TMask& m)
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3) // Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3)
const bool valuta = _ges_val && is_saldaconto() && causale().valuta(); const bool valuta = _ges_val && is_saldaconto() && causale().valuta();
m.show(-3, valuta); m.show(-3, valuta);
_sal_dirty = false; // Azzero il flag di modifica del saldaconto
fill_sheet(m); // Riempe righe contabili coi conti della causale fill_sheet(m); // Riempe righe contabili coi conti della causale
m.hide(F_LINKDOC);
} }
void TPrimanota_application::init_query_mode(TMask& m) void TPrimanota_application::init_query_mode(TMask& m)
@ -531,6 +582,15 @@ void TPrimanota_application::init_query_mode(TMask& m)
} }
_incasso->_step = 0; // Azzera flag di incasso immediato _incasso->_step = 0; // Azzera flag di incasso immediato
TFilename tmp;
if (get_mask_swap_file(tmp))
{
TConfig ini(tmp, "23");
m.set(F_DATAREG, ini.get(MOV_DATAREG));
m.set(F_CODCAUS, ini.get(MOV_CODCAUS));
m.send_key(K_SPACE, DLG_NEWREC);
}
} }
@ -648,6 +708,21 @@ void TPrimanota_application::init_insert_mode(TMask& m)
// La preservo solo per l'incasso immediato // La preservo solo per l'incasso immediato
_as400 = false; // Un movimento nuovo non puo' essere trasferito da AS400 _as400 = false; // Un movimento nuovo non puo' essere trasferito da AS400
TFilename tmp;
if (get_mask_swap_file(tmp))
{
TConfig ini(tmp, "23");
ini2mask(ini, m, false);
// Controllo se e' stato salvato il campo virtuale col codice IVA
const TString& codiva = ini.get("CODIVA", "23");
if (!codiva.empty())
m.set(F_CODIVA, codiva, 3);
xvt_fsys_removefile(tmp);
}
} }
@ -703,10 +778,10 @@ void TPrimanota_application::init_modify_mode(TMask& m)
} }
} }
if (navigating())
{
const TRectype& mov = get_relation()->curr(); const TRectype& mov = get_relation()->curr();
if (!mov.empty()) if (!mov.empty())
{
if (navigating())
{ {
TString msg; TString msg;
if (mov.get_bool(MOV_STAMPATO)) if (mov.get_bool(MOV_STAMPATO))
@ -721,6 +796,10 @@ void TPrimanota_application::init_modify_mode(TMask& m)
warning_box(msg); warning_box(msg);
} }
} }
// Abilito il bottone di collegamento ai documenti se possibile
const long numdoc = mov.get_long(MOV_DNDOC);
m.show(F_LINKDOC, numdoc > 0 && has_module(VEAUT));
} }
} }
@ -1102,7 +1181,7 @@ int TPrimanota_application::write(const TMask& m)
// Genera incasso immediato se e' una fattura e non c'e' gestione saldaconto // Genera incasso immediato se e' una fattura e non c'e' gestione saldaconto
if (!m.get_bool(F_SOLAIVA) && !gestione_saldaconto()) if (!m.get_bool(F_SOLAIVA) && !gestione_saldaconto())
{ {
const TString causimm(causale().causale_inc_imm()); const TString4 causimm(causale().causale_inc_imm());
if (causimm.not_empty()) if (causimm.not_empty())
genera_incasso(causimm); genera_incasso(causimm);
} }
@ -1230,7 +1309,7 @@ void TPrimanota_application::genera_incasso(const char* causimm)
} }
else else
{ {
TCausale& caus = causale(); const TCausale& caus = causale();
m.set(F_DATADOC, _incasso->_datadoc); m.set(F_DATADOC, _incasso->_datadoc);
m.set(F_NUMDOC, _incasso->_numdoc); m.set(F_NUMDOC, _incasso->_numdoc);
TBill contro; caus.bill(2, contro); TBill contro; caus.bill(2, contro);
@ -1262,12 +1341,10 @@ void TPrimanota_application::genera_incasso(const char* causimm)
bool TPrimanota_application::is_percipient(long forn, char& tipper, long& codper) const bool TPrimanota_application::is_percipient(long forn, char& tipper, long& codper) const
{ {
TLocalisamfile fornitori(LF_CLIFO); TString16 key; key.format("F|%ld", forn);
fornitori.put("TIPOCF", "F"); const TRectype& fornitore = cache().get(LF_CLIFO, key);
fornitori.put("CODCF", forn); tipper = fornitore.get_char(CLI_TIPOAPER);
fornitori.read(); codper = fornitore.get_long(CLI_CODANAGPER);
tipper = fornitori.get_char(CLI_TIPOAPER);
codper = fornitori.get_long(CLI_CODANAGPER);
return codper > 0; return codper > 0;
} }
@ -1317,7 +1394,6 @@ long TPrimanota_application::calcola_m770(int tipo_coll, real& spese, real& comp
TImporto imp; imp = cgs().row(i); TImporto imp; imp = cgs().row(i);
ritfis += imp.valore(); ritfis += imp.valore();
} }
} }
if (tipo_coll == 3 || tipo_coll == 7) if (tipo_coll == 3 || tipo_coll == 7)
@ -1461,10 +1537,10 @@ bool TPrimanota_application::link_m770()
HIDDEN void ini2bill(TConfig& ini, TBill& bil, bool contro) HIDDEN void ini2bill(TConfig& ini, TBill& bil, bool contro)
{ {
char tipo = ini.get_char(contro ? "TIPOC" : "TIPO"); const char tipo = ini.get_char(contro ? "TIPOC" : "TIPO");
int gruppo = ini.get_int(contro ? "GRUPPOC" : "GRUPPO"); const int gruppo = ini.get_int(contro ? "GRUPPOC" : "GRUPPO");
int conto = ini.get_int(contro ? "CONTOC" : "CONTO"); const int conto = ini.get_int(contro ? "CONTOC" : "CONTO");
long sottoconto = ini.get_long(contro ? "SOTTOCONTC" : "SOTTOCONTO"); const long sottoconto = ini.get_long(contro ? "SOTTOCONTC" : "SOTTOCONTO");
bil.set(gruppo, conto, sottoconto, tipo); bil.set(gruppo, conto, sottoconto, tipo);
} }
@ -1493,7 +1569,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
{ {
set_not_empty(msk, F_CODCAUS, ini, MOV_CODCAUS); set_not_empty(msk, F_CODCAUS, ini, MOV_CODCAUS);
TString16 val = ini.get(MOV_DATAREG); TString16 val = ini.get(MOV_DATAREG);
if (val.empty()) if (val.blank())
val = TDate(TODAY).string(); val = TDate(TODAY).string();
msk.set(F_DATAREG, val); msk.set(F_DATAREG, val);
} }
@ -1784,8 +1860,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
} }
intro.set("Action", "Insert"); intro.set("Action", "Insert");
TString str; // Stringa jolly di lavoro TString4 str; str.format("%d", LF_RIEPRETT);
str.format("%d", LF_RIEPRETT);
intro.set_paragraph(str); intro.set_paragraph(str);
intro.set("TIPO", tipo == 'B' ? "B" : "D"); intro.set("TIPO", tipo == 'B' ? "B" : "D");
intro.set("ANNO", datareg.year()); intro.set("ANNO", datareg.year());

View File

@ -40,6 +40,7 @@
#define F_DESPAG 123 #define F_DESPAG 123
#define F_ANNORIF 124 #define F_ANNORIF 124
#define F_NUMRIF 125 #define F_NUMRIF 125
#define F_LINKDOC 126
#define F_PROVVISORIO 129 #define F_PROVVISORIO 129
#define F_OCCASEDIT 131 #define F_OCCASEDIT 131
#define F_SOLAIVA 132 #define F_SOLAIVA 132
@ -75,6 +76,8 @@
#define CG_SOTTOCONTO 106 #define CG_SOTTOCONTO 106
#define CG_DESCR 109 #define CG_DESCR 109
#define CG_ROWTYPE 115 #define CG_ROWTYPE 115
#define CG_MASTRINO 116
// Campi ripetuti sulla seconda pagina // Campi ripetuti sulla seconda pagina

View File

@ -124,13 +124,18 @@ END
STRING F_NUMDOC 7 STRING F_NUMDOC 7
BEGIN BEGIN
PROMPT 56 7 "Documento n. " PROMPT 50 7 "Documento n. "
FIELD NUMDOC FIELD NUMDOC
FLAGS "U" FLAGS "U"
WARNING "La causale impone di specificare il numero documento" WARNING "La causale impone di specificare il numero documento"
MESSAGE COPY,K_NUMDOC MESSAGE COPY,K_NUMDOC
END END
BUTTON F_LINKDOC 3 1
BEGIN
PROMPT 73 7 "Doc."
END
NUMBER F_ANNOIVA 4 NUMBER F_ANNOIVA 4
BEGIN BEGIN
FLAGS "H" FLAGS "H"

View File

@ -139,12 +139,17 @@ END
STRING F_NUMDOC 7 STRING F_NUMDOC 7
BEGIN BEGIN
PROMPT 57 6 "Documento n. " PROMPT 50 6 "Documento n. "
FIELD NUMDOC FIELD NUMDOC
FLAGS "U" FLAGS "U"
WARNING "La causale o il saldaconto richiedono il numero documento" WARNING "La causale o il saldaconto richiedono il numero documento"
END END
BUTTON F_LINKDOC 3 1
BEGIN
PROMPT 73 6 "Doc."
END
LIST F_SOLAIVA 1 3 LIST F_SOLAIVA 1 3
BEGIN BEGIN
PROMPT 1 7 "Movimento di sola IVA " PROMPT 1 7 "Movimento di sola IVA "

View File

@ -1,4 +1,5 @@
#include <colors.h> #include <colors.h>
#include <execp.h>
#include <msksheet.h> #include <msksheet.h>
#include <progind.h> #include <progind.h>
#include <tabutil.h> #include <tabutil.h>
@ -12,6 +13,8 @@
#include <clifo.h> #include <clifo.h>
#include <cfven.h> #include <cfven.h>
#include <pconti.h> #include <pconti.h>
#include <doc.h>
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Funzioni di decodifica/calcolo // Funzioni di decodifica/calcolo
@ -37,7 +40,7 @@ TipoIVA TPrimanota_application::cau2IVA(const char* cod, int annoiva)
// Certified 99% // Certified 99%
const real& TPrimanota_application::cod2IVA(const TMask& m) const real& TPrimanota_application::cod2IVA(const TMask& m)
{ {
static TString16 _codiva; // Ultimo codice iva decodificato static TString4 _codiva; // Ultimo codice iva decodificato
static real _percent; // Percentuale dell'ultimo codice iva static real _percent; // Percentuale dell'ultimo codice iva
// Tipo Costo Ricavo // Tipo Costo Ricavo
if (app().iva() == iva_acquisti && m.get_int(103) == 3) if (app().iva() == iva_acquisti && m.get_int(103) == 3)
@ -47,7 +50,7 @@ const real& TPrimanota_application::cod2IVA(const TMask& m)
if (_codiva != codiva) if (_codiva != codiva)
{ {
_codiva = codiva; _codiva = codiva;
TCodiceIVA c(_codiva); const TCodiceIVA c(_codiva);
_percent = c.percentuale(); _percent = c.percentuale();
} }
@ -1819,6 +1822,49 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
return true; return true;
} }
bool TPrimanota_application::sheet_mastrino_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
const TString& tipo = m.get(CG_TIPO);
const short id_sotto = CG_SOTTOCONTO + (tipo.blank() ? 0 : (tipo == "C" ? 100 : 200));
TPrimanota_application& a = app();
const TMask& cm = a.curr_mask();
int anno = cm.get_int(F_ANNOES);
if (anno <= 0)
{
TDate date = cm.get(F_DATACOMP);
if (!date.ok())
date = cm.get_date(F_DATAREG);
anno = a._esercizi.date2esc(date);
}
TFilename ininame; ininame.tempdir(); ininame.add("mastrino.ini");
if (anno > 0 && !m.field(id_sotto).empty())
{
TConfig ini(ininame, "Transaction");
ini.set("Action", "Modify");
ini.set_paragraph("23");
ini.set(RMV_ANNOES, anno);
ini.set(RMV_TIPOC, tipo);
ini.set(RMV_GRUPPO, m.get(CG_GRUPPO));
ini.set(RMV_CONTO, m.get(CG_CONTO));
ini.set(RMV_SOTTOCONTO, m.get(id_sotto));
}
if (ininame.exist())
{
TString cmd;
cmd << "cg3 -5 -i" << ininame;
TExternal_app app(cmd);
app.run();
}
}
return true;
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Handlers dei campi della testata // Handlers dei campi della testata
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -1895,7 +1941,7 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
if (f.to_check(key)) if (f.to_check(key))
{ {
const TString cau = f.get(); const TString& cau = f.get();
const int ann = m.get_int(F_ANNOIVA); const int ann = m.get_int(F_ANNOIVA);
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo
@ -1917,14 +1963,26 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
bool ok = suspended_handler(f, key); bool ok = suspended_handler(f, key);
if (!ok) return false; if (!ok) return false;
const int ann = f.mask().get_int(F_ANNOIVA);
const TString cau(f.get()); const TMask& m = f.mask();
const int ann = m.get_int(F_ANNOIVA);
const TString& cau = f.get();
const TCausale c(cau, ann); const TCausale c(cau, ann);
if (!c.ok()) return false; if (!c.ok()) return false;
ok = app().causale().similar(c); ok = app().causale().similar(c);
if (!ok)
return false; // L'errore viene gia' segnalato dalla similar const TString& msg = c.compatible(k);
if (msg.not_empty()) // La causale non e' compatibile
{
if (m.insert_mode() && !app()._sal_dirty)
{
// Cambio la maschera al volo
if (app().force_mask_swap(k, c))
return true;
}
return error_box(msg);
}
if (key == K_TAB) if (key == K_TAB)
{ {
@ -3003,3 +3061,19 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
} }
return true; return true;
} }
// Handler del bottone di collegamento ai documenti
bool TPrimanota_application::linkdoc_handler(TMask_field& f, KEY key)
{
if (key == K_SPACE)
{
const TRectype& mov = app().get_relation()->curr();
TRectype doc(LF_DOC);
doc.put(DOC_PROVV, mov.get(MOV_DPROVV));
doc.put(DOC_ANNO, mov.get(MOV_DANNO));
doc.put(DOC_CODNUM,mov.get(MOV_DCODNUM));
doc.put(DOC_NDOC, mov.get(MOV_DNDOC));
doc.edit();
}
return true;
}

View File

@ -54,6 +54,7 @@ class TPrimanota_application : public TRelation_application
TMask* _msk[4]; // Maschere di query, cg, iva, occasionali TMask* _msk[4]; // Maschere di query, cg, iva, occasionali
int _mode; // Modo maschera corrente int _mode; // Modo maschera corrente
bool _as400; // Movimento trasferito da as400? bool _as400; // Movimento trasferito da as400?
bool _sal_dirty; // Il saldaconto e' stato "toccato"?
TipoIVA _iva; // Tipo di IVA corrente TipoIVA _iva; // Tipo di IVA corrente
TCausale* _causale; // Causale corrente TCausale* _causale; // Causale corrente
@ -108,6 +109,7 @@ class TPrimanota_application : public TRelation_application
static bool descr_handler(TMask_field& f, KEY k); static bool descr_handler(TMask_field& f, KEY k);
static bool sheet_clifo_handler(TMask_field& f, KEY k); static bool sheet_clifo_handler(TMask_field& f, KEY k);
static bool sheet_mastrino_handler(TMask_field& f, KEY k);
static bool iva_sottoconto_handler(TMask_field& f, KEY k); static bool iva_sottoconto_handler(TMask_field& f, KEY k);
static bool imponibile_handler(TMask_field& f, KEY key); static bool imponibile_handler(TMask_field& f, KEY key);
static bool detrazione_handler(TMask_field& f, KEY key); static bool detrazione_handler(TMask_field& f, KEY key);
@ -130,6 +132,7 @@ class TPrimanota_application : public TRelation_application
static bool codcab_handler(TMask_field& f, KEY key); static bool codcab_handler(TMask_field& f, KEY key);
static bool tipopag_handler(TMask_field& f, KEY key); static bool tipopag_handler(TMask_field& f, KEY key);
static bool prorata_handler(TMask_field& f, KEY k); static bool prorata_handler(TMask_field& f, KEY k);
static bool linkdoc_handler(TMask_field& f, KEY k);
static bool ratalit_handler(TMask_field& f, KEY key); static bool ratalit_handler(TMask_field& f, KEY key);
static bool rataval_handler(TMask_field& f, KEY key); static bool rataval_handler(TMask_field& f, KEY key);
@ -154,6 +157,9 @@ protected: // TApplication
virtual void ini2mask(TConfig& ini, TMask& msk, bool query); virtual void ini2mask(TConfig& ini, TMask& msk, bool query);
virtual void mask2ini(const TMask& msk, TConfig& ini); virtual void mask2ini(const TMask& msk, TConfig& ini);
bool get_mask_swap_file(TFilename& name) const;
bool force_mask_swap(const TCausale& old_caus, const TCausale& new_caus);
protected: // TRelation_application protected: // TRelation_application
virtual bool user_create(); virtual bool user_create();
virtual bool user_destroy(); virtual bool user_destroy();

View File

@ -10,7 +10,6 @@
#include <causali.h> #include <causali.h>
#include <rcausali.h> #include <rcausali.h>
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Causale // Causale
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -23,6 +22,7 @@ TCausale::TCausale(const char* cod, int year)
{ {
if (*cod) if (*cod)
read(cod, year); read(cod, year);
} }
@ -35,7 +35,7 @@ bool TCausale::read(const char* cod, int year)
_sezione_clifo = _sezione_ritsoc = ' '; _sezione_clifo = _sezione_ritsoc = ' ';
_corrisp = false; _corrisp = false;
if (*cod > ' ') if (cod && *cod > ' ')
{ {
_rec = cache().get(LF_CAUSALI, cod); _rec = cache().get(LF_CAUSALI, cod);
if (_rec.empty()) if (_rec.empty())
@ -187,21 +187,20 @@ char TCausale::sezione(int riga) const
return sez; return sez;
} }
char TCausale::sezione_clifo() char TCausale::sezione_clifo() const
{ {
if (_sezione_clifo == ' ') if (_sezione_clifo <= ' ')
_sezione_clifo = sezione(1); (char&)_sezione_clifo = sezione(1);
return _sezione_clifo; return _sezione_clifo;
} }
char TCausale::sezione_ritsoc() char TCausale::sezione_ritsoc() const
{ {
if (_sezione_ritsoc == ' ') if (_sezione_ritsoc <= ' ')
{ {
if (_rec.get_int(CAU_TIPOMOV) <= 2) // Fatture o Pagamenti?
_sezione_ritsoc = sezione(9); // Fatture const int tm = _rec.get_int(CAU_TIPOMOV);
else (char&)_sezione_ritsoc = sezione(tm <= 2 ? 9 : 14);
_sezione_ritsoc = sezione(14); // Pagamenti
} }
return _sezione_ritsoc; return _sezione_ritsoc;
} }
@ -247,21 +246,34 @@ void TCausale::calcIVA()
_corrisp = c; _corrisp = c;
} }
bool TCausale::similar(const TCausale& c) const const TString& TCausale::compatible(const TCausale& c) const
{ {
const char* err = ""; const char* err = NULL;
if (sezionale() != c.sezionale()) err = TR("il segnale di sezionale"); if (sezionale() != c.sezionale())
if (intra() != c.intra()) err = TR("la gestione dei movimenti intra"); err = TR("il segnale di sezionale");
if (valuta() != c.valuta()) err = TR("la gestione valuta"); if (intra() != c.intra())
if (valintra() != c.valintra()) err = TR("la gestione valuta intracomunitaria"); err = TR("la gestione dei movimenti intra");
if (corrispettivi() != c.corrispettivi()) err = TR("la gestione dei corrispettivi"); if (valuta() != c.valuta())
if (iva() != c.iva()) err = TR("il tipo di IVA"); err = TR("la gestione valuta");
if (tipomov() != c.tipomov()) err = TR("il tipo di movimento"); if (valintra() != c.valintra())
err = TR("la gestione valuta intracomunitaria");
if (corrispettivi() != c.corrispettivi())
err = TR("la gestione dei corrispettivi");
if (iva() != c.iva())
err = TR("il tipo di IVA");
if (tipomov() != c.tipomov())
err = TR("il tipo di movimento");
if (*err) if (err != NULL)
return error_box(FR("La causale e' diversa per %s"), err); {
TString& msg = get_tmp_string();
msg.format(FR("La causale e' incompatibile per %s"), err);
return msg;
}
return EMPTY_STRING;
return true;
} }
bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
@ -288,6 +300,3 @@ bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
return c.ok(); return c.ok();
} }

View File

@ -54,13 +54,14 @@ public:
char link_cespiti() const; char link_cespiti() const;
bool link_analitica() const; bool link_analitica() const;
bool similar(const TCausale& c) const; const TString& compatible(const TCausale& c) const;
char sezione(int riga) const; char sezione(int riga) const;
char sezione_clifo(); char sezione_clifo() const;
char sezione_ritsoc(); char sezione_ritsoc() const ;
char sezione_ritfis(); char sezione_ritfis();
virtual bool read(const char* cod, int year); virtual bool read(const char* cod, int year);
TCausale(const char* code = "", int year = 0); TCausale(const char* code = "", int year = 0);

View File

@ -1997,6 +1997,7 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
{ {
cgs().force_update(); // Aggiornamento righe contabili cgs().force_update(); // Aggiornamento righe contabili
calcola_saldo(); calcola_saldo();
_sal_dirty = true;
} }
return changed; return changed;
} }

View File

@ -41,7 +41,12 @@ END
CURRENCY CG_AVERE 18 CURRENCY CG_AVERE 18
BEGIN BEGIN
PROMPT 38 4 "Avere " PROMPT 27 4 "Avere "
END
BUTTON CG_MASTRINO 8 1
BEGIN
PROMPT 56 4 "Mastrino"
END END
LIST CG_TIPO 1 10 LIST CG_TIPO 1 10

View File

@ -2725,20 +2725,20 @@ void TMastrini_application::ricerca_dati_ditta()
if (len <= 31) if (len <= 31)
{ {
if (len <= 26) if (len <= 26)
_indulc << " " << _civulc; _indulc << ' ' << _civulc;
else else
_indulc << " " << _civulc.mid(0,5); _indulc << ' ' << _civulc.mid(0,5);
} }
else else
{ {
_indulc = _indulc.mid(0,31); _indulc = _indulc.mid(0,31);
_indulc << " " << _civulc.mid(0,5); _indulc << ' ' << _civulc.mid(0,5);
} }
_capulc= unloc.get(ULC_CAPULC); _capulc= unloc.get(ULC_CAPULC);
_comulc= unloc.get(ULC_COMULC); _comulc= unloc.get(ULC_COMULC);
key.format("|%s", (const char *) _comulc); key.format("|%s", (const char *) _comulc);
const TRectype & comuni = cache().get(LF_COMUNI, key); const TRectype& comuni = cache().get(LF_COMUNI, key);
_com = comuni.get(COM_DENCOM); _com = comuni.get(COM_DENCOM);
_prov = comuni.get(COM_PROVCOM); _prov = comuni.get(COM_PROVCOM);

View File

@ -48,7 +48,7 @@ public:
void destroy() { _data.destroy(); } void destroy() { _data.destroy(); }
long insert(TObject* obj, long pos) { return _data.insert(obj, pos); } long insert(TObject* obj, long pos) { return _data.insert(obj, pos); }
long append(TObject* obj, long pos = -1); long append(TObject* obj, long pos = -1);
bool remove(long pos) { _data.remove(pos, TRUE); return TRUE; } bool remove(long pos) { _data.remove(pos, true); return true; }
const TObject& obj(long index) const const TObject& obj(long index) const
{ const TObject* o = _data.objptr(index); CHECK(o, "Null list item"); return *o; } { const TObject* o = _data.objptr(index); CHECK(o, "Null list item"); return *o; }
@ -300,13 +300,13 @@ void TMastrino::read(const TBill& conto,
// vanno dall'inizio dell'esercizio al giorno precedente // vanno dall'inizio dell'esercizio al giorno precedente
// la data di inizio stampa // la data di inizio stampa
TBalance saldo(_conto, ae, TRUE, provvis); TBalance saldo(_conto, ae, true, provvis);
_pdare_ini = saldo.progressivo_dare_iniziale(); _pdare_ini = saldo.progressivo_dare_iniziale();
_pavere_ini = saldo.progressivo_avere_iniziale(); _pavere_ini = saldo.progressivo_avere_iniziale();
// Valori dei saldi finali: // Valori dei saldi finali:
// Comprendono i movimenti di apertura, chiusura ed i progressivi attuali // Comprendono i movimenti di apertura, chiusura ed i progressivi attuali
saldo.read(_conto, ae, FALSE, provvis); saldo.read(_conto, ae, false, provvis);
_pdare_fin = saldo.progressivo_dare_finale(); _pdare_fin = saldo.progressivo_dare_finale();
_pavere_fin = saldo.progressivo_avere_finale(); _pavere_fin = saldo.progressivo_avere_finale();
@ -342,10 +342,11 @@ void TMastrino::read(const TBill& conto,
const TRecnotype totrows = cur.items(); const TRecnotype totrows = cur.items();
cur.freeze(); cur.freeze();
TString caption; TString caption(80);
caption = FR("Caricamento mastrino"); caption.format(FR("Caricamento mastrino %03d.%03d.%06ld"),
caption << ' ' << _conto.gruppo() << '.' << _conto.conto() << '.' << _conto.sottoconto(); _conto.gruppo(), _conto.conto(), _conto.sottoconto());
TProgind pi(totrows, caption, FALSE, TRUE); TProgind pi(totrows, caption, false, true);
for (cur = 0L; cur.pos() < totrows; ++cur) for (cur = 0L; cur.pos() < totrows; ++cur)
{ {
@ -462,7 +463,7 @@ TImporto TMastrino::saldo_periodo() const
bool TMastrino::expandable(long rec) const bool TMastrino::expandable(long rec) const
{ {
bool e = FALSE; bool e = false;
if (rec >= 0 && rec < items()) if (rec >= 0 && rec < items())
{ {
if (row(rec).tipo() == riga_mastrino) if (row(rec).tipo() == riga_mastrino)
@ -470,7 +471,7 @@ bool TMastrino::expandable(long rec) const
if (rec < items()-1) if (rec < items()-1)
e = row(rec+1).tipo() != riga_contropartita; e = row(rec+1).tipo() != riga_contropartita;
else else
e = TRUE; e = true;
} }
} }
return e; return e;
@ -528,7 +529,7 @@ bool TMastrino::expand(long rec)
// Elimina le righe di contropartita di una riga del mastrino // Elimina le righe di contropartita di una riga del mastrino
bool TMastrino::collapse(long rec) bool TMastrino::collapse(long rec)
{ {
bool ok = TRUE; // Posso eliminare? bool ok = true; // Posso eliminare?
if (row(rec).tipo() != riga_mastrino) // Se non sono su una riga mastrino ... if (row(rec).tipo() != riga_mastrino) // Se non sono su una riga mastrino ...
rec = pred(rec, riga_mastrino); // ... mi sposto sulla precedente riga mastrino rec = pred(rec, riga_mastrino); // ... mi sposto sulla precedente riga mastrino
else else
@ -558,8 +559,8 @@ public:
TString& set(const char* txt); TString& set(const char* txt);
TString& set(long num); TString& set(long num);
void set_icon(int id); void set_icon(int id);
void show_button(bool on = TRUE); void show_button(bool on = true);
void hide_button() { show_button(FALSE); } void hide_button() { show_button(false); }
void set_back_color(COLOR col); void set_back_color(COLOR col);
void set_fore_color(COLOR col); void set_fore_color(COLOR col);
void set_colors(COLOR back, COLOR fore); void set_colors(COLOR back, COLOR fore);
@ -588,9 +589,9 @@ public:
virtual long items() const; virtual long items() const;
virtual void cell_request(long rec, short id, TGrid_cell& cell); virtual void cell_request(long rec, short id, TGrid_cell& cell);
virtual bool on_record(long rec) { return TRUE; } virtual bool on_record(long rec) { return true; }
virtual bool off_record(long rec) { return TRUE; } virtual bool off_record(long rec) { return true; }
virtual bool on_resize_column(short cid, int new_size) { return TRUE; } virtual bool on_resize_column(short cid, int new_size) { return true; }
virtual void on_dbl_cell(long rec, short id) { } virtual void on_dbl_cell(long rec, short id) { }
virtual void on_grid_button() { } virtual void on_grid_button() { }
virtual void on_record_button(long rec) { } virtual void on_record_button(long rec) { }
@ -685,9 +686,9 @@ TGrid_control::TGrid_control(
TGrid_field* owner) TGrid_field* owner)
: _grid(owner), _cur_rec(-1), _columns_order(0) : _grid(owner), _cur_rec(-1), _columns_order(0)
{ {
_read_only = FALSE; _read_only = false;
bool auto_num = FALSE; bool auto_num = false;
bool multi_line = FALSE; bool multi_line = false;
int lines_in_cell = 1; int lines_in_cell = 1;
for (const char* f = flags; *f; f++) for (const char* f = flags; *f; f++)
@ -695,13 +696,13 @@ TGrid_control::TGrid_control(
switch(*f) switch(*f)
{ {
case 'A': case 'A':
auto_num = TRUE; auto_num = true;
break; break;
case 'D': case 'D':
_read_only = TRUE; _read_only = true;
break; break;
case 'M': case 'M':
multi_line = TRUE; multi_line = true;
lines_in_cell = (int)xi_get_pref(XI_PREF_DEFAULT_MAX_LINES_IN_CELL); lines_in_cell = (int)xi_get_pref(XI_PREF_DEFAULT_MAX_LINES_IN_CELL);
break; break;
case '2': case '2':
@ -796,18 +797,18 @@ TGrid_control::TGrid_control(
#else #else
l->min_heading_height = xi_button_calc_height_font_id(xvt_default_font()) * lines_in_header; l->min_heading_height = xi_button_calc_height_font_id(xvt_default_font()) * lines_in_header;
#endif #endif
l->sizable_columns = TRUE; l->sizable_columns = true;
l->movable_columns = TRUE; l->movable_columns = true;
l->fixed_columns = fixed_columns; l->fixed_columns = fixed_columns;
l->max_lines_in_cell = lines_in_cell; l->max_lines_in_cell = lines_in_cell;
l->scroll_bar = TRUE; l->scroll_bar = true;
l->scroll_bar_button = TRUE; l->scroll_bar_button = true;
l->white_space_color = MASK_DARK_COLOR; l->white_space_color = MASK_DARK_COLOR;
l->rule_color = MASK_DARK_COLOR; l->rule_color = MASK_DARK_COLOR;
if (_read_only) if (_read_only)
{ {
l->single_select = TRUE; l->single_select = true;
} }
else else
{ {
@ -821,8 +822,8 @@ TGrid_control::TGrid_control(
coldef->app_data = (long)this; coldef->app_data = (long)this;
XI_COLUMN_DEF* cd = coldef->v.column; XI_COLUMN_DEF* cd = coldef->v.column;
cd->heading_platform = TRUE; cd->heading_platform = true;
cd->column_platform = TRUE; cd->column_platform = true;
for (h = new_header.get(0), i = 0; h; h = new_header.get(), i++) for (h = new_header.get(0), i = 0; h; h = new_header.get(), i++)
{ {
@ -836,8 +837,8 @@ TGrid_control::TGrid_control(
coldef->app_data = (long)this; coldef->app_data = (long)this;
cd = coldef->v.column; cd = coldef->v.column;
cd->heading_platform = TRUE; cd->heading_platform = true;
cd->center_heading = TRUE; cd->center_heading = true;
if (multi_line) if (multi_line)
cd->wrap_text = _type[i] != 'R'; cd->wrap_text = _type[i] != 'R';
} }
@ -960,7 +961,7 @@ bool TGrid_control::select(long rec)
else else
{ {
ok = _cur_rec >= 0 && _cur_rec < items() && _grid->off_record(_cur_rec); ok = _cur_rec >= 0 && _cur_rec < items() && _grid->off_record(_cur_rec);
sel = FALSE; sel = false;
} }
if (ok) if (ok)
@ -1077,7 +1078,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
update_selection(xiev); update_selection(xiev);
} }
else else
refused = TRUE; refused = true;
break; break;
case XIE_GET_LAST: case XIE_GET_LAST:
xiev->v.rec_request.data_rec = items()-1; xiev->v.rec_request.data_rec = items()-1;
@ -1093,7 +1094,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
update_selection(xiev); update_selection(xiev);
} }
else else
refused = TRUE; refused = true;
} }
break; break;
case XIE_GET_PERCENT: case XIE_GET_PERCENT:
@ -1107,7 +1108,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
// Rifiuta di spostare una colonna nelle o dalle colonne fisse // Rifiuta di spostare una colonna nelle o dalle colonne fisse
if (xiev->v.column.in_fixed || if (xiev->v.column.in_fixed ||
xiev->v.column.col_nbr < xi_get_fixed_columns(xiev->v.column.list)) xiev->v.column.col_nbr < xi_get_fixed_columns(xiev->v.column.list))
refused = TRUE; refused = true;
else else
_columns_order = 1; _columns_order = 1;
break; break;
@ -1117,7 +1118,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (_grid->on_resize_column(cid, xiev->v.column.new_col_width)) if (_grid->on_resize_column(cid, xiev->v.column.new_col_width))
_columns_order = 1; _columns_order = 1;
else else
refused = TRUE; refused = true;
} }
break; break;
case XIE_SELECT: case XIE_SELECT:
@ -1134,7 +1135,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (rec == _cur_rec) // Aggiunto a 32 bit if (rec == _cur_rec) // Aggiunto a 32 bit
_grid->on_record_button(rec); _grid->on_record_button(rec);
if (_read_only) if (_read_only)
refused = TRUE; refused = true;
} }
else else
{ {
@ -1142,13 +1143,13 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{ {
const short cid = col2cid(xiev->v.select.column); const short cid = col2cid(xiev->v.select.column);
_grid->on_dbl_cell(rec, cid); _grid->on_dbl_cell(rec, cid);
refused = TRUE; refused = true;
} }
_cur_rec = rec; // Assegno solo ora il record corrente _cur_rec = rec; // Assegno solo ora il record corrente
} }
} }
else else
refused = TRUE; refused = true;
} }
} }
break; break;
@ -1175,7 +1176,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
} }
} }
else else
refused = TRUE; // Ogni tanto succede refused = true; // Ogni tanto succede
} }
break; break;
case XIE_ON_ROW: case XIE_ON_ROW:
@ -1186,12 +1187,12 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (_grid->on_record(rec)) if (_grid->on_record(rec))
_cur_rec = rec; _cur_rec = rec;
else else
refused = TRUE; refused = true;
} }
else else
{ {
NFCHECK("You are entering an invalid row: %d", xiev->v.xi_obj->v.row); NFCHECK("You are entering an invalid row: %d", xiev->v.xi_obj->v.row);
refused = TRUE; refused = true;
} }
} }
break; break;
@ -1371,7 +1372,7 @@ void TGrid_control::save_columns_order() const
RCT rct; xi_get_rect(column[i], (XinRect*)&rct); RCT rct; xi_get_rect(column[i], (XinRect*)&rct);
order << ',' << rct.right - rct.left; order << ',' << rct.right - rct.left;
} }
config.set("Browse", order, NULL, TRUE, id()); config.set("Browse", order, NULL, true, id());
} }
else else
config.remove("Browse", id()); config.remove("Browse", id());
@ -1483,7 +1484,7 @@ bool TGrid_field::parse_item(TScanner& scanner)
if (scanner.key() == "IT") if (scanner.key() == "IT")
{ {
_ctl_data._park.add(scanner.string()); _ctl_data._park.add(scanner.string());
return TRUE; return true;
} }
return TMask_field::parse_item(scanner); return TMask_field::parse_item(scanner);
} }
@ -1491,7 +1492,7 @@ bool TGrid_field::parse_item(TScanner& scanner)
bool TGrid_field::handler(XI_EVENT* xiev) bool TGrid_field::handler(XI_EVENT* xiev)
{ {
return FALSE; return false;
} }
long TGrid_field::items() const long TGrid_field::items() const
@ -1584,7 +1585,7 @@ void TRow_mask::update()
COLOR back, fore; COLOR back, fore;
m.get_cur_colors(back, fore); m.get_cur_colors(back, fore);
_pixmap = TRUE; _pixmap = true;
set_pen(COLOR_BLACK); set_pen(COLOR_BLACK);
RCT rct; field(100).get_rect(rct); RCT rct; field(100).get_rect(rct);
@ -1595,7 +1596,7 @@ void TRow_mask::update()
set_brush(fore); set_brush(fore);
frame(rct.left, 2*rct.top - rct.bottom - CHARY/2, rct.right, rct.top - CHARY/2, 0); frame(rct.left, 2*rct.top - rct.bottom - CHARY/2, rct.right, rct.top - CHARY/2, 0);
_pixmap = FALSE; _pixmap = false;
} }
@ -1668,7 +1669,7 @@ bool TColor_mask::color_handler(TMask_field& f, KEY k)
m.set_focus(); m.set_focus();
} }
} }
return TRUE; return true;
} }
bool TColor_mask::reset_handler(TMask_field& f, KEY k) bool TColor_mask::reset_handler(TMask_field& f, KEY k)
@ -1685,7 +1686,7 @@ bool TColor_mask::reset_handler(TMask_field& f, KEY k)
s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, -1); s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, -1);
s.force_update(); s.force_update();
} }
return TRUE; return true;
} }
void TColor_mask::get_colors(COLOR& mb, COLOR& mf, COLOR& cb, COLOR& cf) const void TColor_mask::get_colors(COLOR& mb, COLOR& mf, COLOR& cb, COLOR& cf) const
@ -1786,7 +1787,7 @@ void TMastrini_grid::destroy()
HIDDEN const char* real2string(const real& r) HIDDEN const char* real2string(const real& r)
{ {
TCurrency cur(r); TCurrency cur(r);
return cur.string(TRUE); return cur.string(true);
} }
HIDDEN void set_imp(TMask_field& f, const TImporto& imp) HIDDEN void set_imp(TMask_field& f, const TImporto& imp)
@ -1859,7 +1860,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
cell.set(mov.get(MOV_DESCR)); cell.set(mov.get(MOV_DESCR));
if (cell.empty()) if (cell.empty())
{ {
TBill uncle(rmov,TRUE); TBill uncle(rmov,true);
cell.set(uncle.descrizione()); cell.set(uncle.descrizione());
} }
} }
@ -1947,7 +1948,7 @@ bool TMastrini_grid::on_record(long rec)
gm.set(F_TOTRIG_DAR, riga.dare()); gm.set(F_TOTRIG_DAR, riga.dare());
gm.set(F_TOTRIG_AVE, riga.avere()); gm.set(F_TOTRIG_AVE, riga.avere());
return TRUE; return true;
} }
void TMastrini_grid::on_dbl_cell(long rec, short id) void TMastrini_grid::on_dbl_cell(long rec, short id)
@ -1970,7 +1971,7 @@ void TMastrini_grid::on_grid_button()
TProgind* pi = NULL; TProgind* pi = NULL;
if (total > 50) if (total > 50)
pi = new TProgind(total, TR("Aggiornamento contropartite ..."), FALSE, TRUE, 48); pi = new TProgind(total, TR("Aggiornamento contropartite ..."), false, true, 48);
else else
begin_wait(); begin_wait();
@ -2086,7 +2087,9 @@ void TMastrini_grid::update_mask() const
gm.set(F_TOTATT_DAR, _mastrino.progressivo_dare_finale()); gm.set(F_TOTATT_DAR, _mastrino.progressivo_dare_finale());
gm.set(F_TOTATT_AVE, _mastrino.progressivo_avere_finale()); gm.set(F_TOTATT_AVE, _mastrino.progressivo_avere_finale());
gm.enable(DLG_LINK, _mastrino.items() > 0); const bool can_link = main_app().argc() <= 2; // NON sono stato chiamato dalla prima nota
gm.enable(DLG_LINK, can_link && _mastrino.items() > 0);
gm.enable(DLG_NEWREC, can_link);
} }
void TMastrini_grid::load_colors() void TMastrini_grid::load_colors()
@ -2168,7 +2171,7 @@ bool TGrid_mask::link_handler(TMask_field& f, KEY k)
if (rec >= 0 && rec < grid.items()) if (rec >= 0 && rec < grid.items())
grid.on_record_button(rec); grid.on_record_button(rec);
} }
return TRUE; return true;
} }
bool TGrid_mask::new_handler(TMask_field& f, KEY k) bool TGrid_mask::new_handler(TMask_field& f, KEY k)
@ -2184,7 +2187,7 @@ bool TGrid_mask::new_handler(TMask_field& f, KEY k)
grid.reread(); grid.reread();
} }
} }
return TRUE; return true;
} }
bool TGrid_mask::on_key(KEY k) bool TGrid_mask::on_key(KEY k)
@ -2227,7 +2230,7 @@ bool TGrid_mask::on_key(KEY k)
if (rec != grid().selected()) if (rec != grid().selected())
{ {
grid().select(rec); grid().select(rec);
return TRUE; return true;
} }
return TMask::on_key(k); return TMask::on_key(k);
@ -2348,12 +2351,12 @@ bool TQuery_mask::esercizio_handler(TMask_field& f, KEY k)
return error_box(FR("Esercizio inesistente: %d"), anno); return error_box(FR("Esercizio inesistente: %d"), anno);
} }
} }
return TRUE; return true;
} }
bool TQuery_mask::data_handler(TMask_field& f, KEY k) bool TQuery_mask::data_handler(TMask_field& f, KEY k)
{ {
bool ok = TRUE; bool ok = true;
if (k == K_ENTER) if (k == K_ENTER)
{ {
const TQuery_mask& qm = (const TQuery_mask&)f.mask(); const TQuery_mask& qm = (const TQuery_mask&)f.mask();
@ -2372,7 +2375,7 @@ bool TQuery_mask::data_handler(TMask_field& f, KEY k)
{ {
if (codice_esercizio == 0) if (codice_esercizio == 0)
return error_box(TR("E' necessario specificare almeno una data.")); return error_box(TR("E' necessario specificare almeno una data."));
return TRUE; return true;
} }
const TDate d = f.get(); const TDate d = f.get();
@ -2405,7 +2408,7 @@ bool TQuery_mask::find_handler(TMask_field& f, KEY k)
} }
qm.field(id).on_key(K_F9); qm.field(id).on_key(K_F9);
} }
return TRUE; return true;
} }
void TQuery_mask::do_query(TGrid_mask& gm) void TQuery_mask::do_query(TGrid_mask& gm)
@ -2441,8 +2444,6 @@ class TMastrini_video : public TApplication
TQuery_mask* _qm; TQuery_mask* _qm;
TGrid_mask* _gm; TGrid_mask* _gm;
TArray _file;
protected: protected:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
@ -2456,6 +2457,7 @@ bool TMastrini_video::create()
{ {
xvtil_statbar_set("", TRUE); xvtil_statbar_set("", TRUE);
open_files(LF_RMOV, LF_MOV, LF_CAUSALI, 0); open_files(LF_RMOV, LF_MOV, LF_CAUSALI, 0);
open_files(LF_SALDI, LF_PCON, 0); open_files(LF_SALDI, LF_PCON, 0);
@ -2463,7 +2465,7 @@ bool TMastrini_video::create()
_gm = new TGrid_mask; _gm = new TGrid_mask;
dispatch_e_menu(BAR_ITEM(1)); dispatch_e_menu(BAR_ITEM(1));
return TRUE; return true;
} }
bool TMastrini_video::destroy() bool TMastrini_video::destroy()
@ -2471,9 +2473,7 @@ bool TMastrini_video::destroy()
delete _gm; delete _gm;
delete _qm; delete _qm;
_file.destroy(); return true;
return TRUE;
} }
bool TMastrini_video::menu(MENU_TAG mt) bool TMastrini_video::menu(MENU_TAG mt)
@ -2482,12 +2482,33 @@ bool TMastrini_video::menu(MENU_TAG mt)
{ {
TQuery_mask& qm = *_qm; TQuery_mask& qm = *_qm;
const TEsercizi_contabili esercizi; if (argc() > 2)
const int codice_esercizio = esercizi.date2esc(TDate(TODAY));
if (codice_esercizio > 0)
{ {
const TEsercizio& esercizio = esercizi.esercizio(codice_esercizio); TFilename ininame = argv(2)+2;
qm.set(F_ESERCIZIO, codice_esercizio); if (ininame.exist())
{
TConfig ini(ininame, "23");
qm.set(F_ESERCIZIO, ini.get(RMV_ANNOES));
qm.set(F_TIPO, ini.get(RMV_TIPOC));
qm.set(F_GRUPPO, ini.get(RMV_GRUPPO));
qm.set(F_CONTO, ini.get(RMV_CONTO));
qm.set(F_SOTTOCONTO, ini.get(RMV_SOTTOCONTO));
qm.set(F_CLIENTE, ini.get(RMV_SOTTOCONTO));
qm.set(F_FORNITORE, ini.get(RMV_SOTTOCONTO));
qm.send_key(K_SPACE, DLG_OK);
}
}
const TEsercizi_contabili esercizi;
int codesc = qm.get_int(F_ESERCIZIO);
if (codesc <= 0)
codesc = esercizi.last();
if (esercizi.exist(codesc))
{
const TEsercizio& esercizio = esercizi.esercizio(codesc);
qm.set(F_ESERCIZIO, codesc);
qm.set(F_DADATA, esercizio.inizio()); qm.set(F_DADATA, esercizio.inizio());
qm.set(F_ADATA, esercizio.fine()); qm.set(F_ADATA, esercizio.fine());
} }
@ -2496,6 +2517,7 @@ bool TMastrini_video::menu(MENU_TAG mt)
while (key != K_QUIT) while (key != K_QUIT)
{ {
/* Ca$$ata tipica della Prassi /* Ca$$ata tipica della Prassi
qm.reset(F_SOTTOCONTO); // Azzera sottoconto qm.reset(F_SOTTOCONTO); // Azzera sottoconto
qm.reset(F_CLIENTE); // Azzera cliente qm.reset(F_CLIENTE); // Azzera cliente
qm.reset(F_FORNITORE); // Azzera fornitore qm.reset(F_FORNITORE); // Azzera fornitore
@ -2514,14 +2536,14 @@ bool TMastrini_video::menu(MENU_TAG mt)
} }
} }
return FALSE; return false;
} }
else else
{ {
_gm->grid().set_colors(); _gm->grid().set_colors();
} }
return TRUE; return true;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -2535,4 +2557,3 @@ int cg3600(int argc, char* argv[])
return 0; return 0;
} }

View File

@ -201,7 +201,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
TString buf(256); TString buf(256);
do do
{ {
TString16 codatt = _nditte->curr(LF_ATTIV).get("CODATT"); const TString8 codatt = _nditte->curr(LF_ATTIV).get("CODATT");
TString80 desatt = _nditte->curr(LF_ATTIV).get("DESCR"); TString80 desatt = _nditte->curr(LF_ATTIV).get("DESCR");
quater = _nditte->curr().get_bool("FLIVA11Q"); quater = _nditte->curr().get_bool("FLIVA11Q");
@ -245,7 +245,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
_isservizio = _pla->get("S7") == "S"; _isservizio = _pla->get("S7") == "S";
_mixed = _pla->get("S7") == "M" || _pla->get("S7") == "E"; _mixed = _pla->get("S7") == "M" || _pla->get("S7") == "E";
TString yr(_year); const TString4 yr(_year);
TAssoc_array& pa = _prorata.perc_array(); TAssoc_array& pa = _prorata.perc_array();
pa.destroy(); pa.destroy();

View File

@ -40,23 +40,23 @@ inline TStampa_registri_app& app() { return (TStampa_registri_app&)main_app(); }
bool TStampa_registri_app::filter_func (const TRelation * r) bool TStampa_registri_app::filter_func (const TRelation * r)
{ {
const TRectype& mov = r->curr(LF_MOV); const TRectype& mov = r->curr(LF_MOV);
TString16 codreg = mov.get(MOV_REG); const TString4 codreg = mov.get(MOV_REG);
TDate datareg = mov.get_date(MOV_DATAREG); const int annoiva = mov.get_int(MOV_ANNOIVA);
int annoiva = mov.get_int(MOV_ANNOIVA);
bool regst = mov.get_bool(MOV_REGST);
if (codreg != (app()._codreg) || annoiva != (app()._annoes)) if (codreg != (app()._codreg) || annoiva != (app()._annoes))
return FALSE; return FALSE;
if (app()._tipo_stampa != prova) //stampa di bollato if (app()._tipo_stampa != prova) //stampa di bollato
{ {
const bool regst = mov.get_bool(MOV_REGST);
if (regst) //il movimento e' gia'
return FALSE; //stato stampato in forma definitiva
const tipo_sospensione ts = (tipo_sospensione) r->lfile("REG").get_int("I9"); const tipo_sospensione ts = (tipo_sospensione) r->lfile("REG").get_int("I9");
if (ts == liquidazione) // Movimento valido solo ai fini della liquidazione if (ts == liquidazione) // Movimento valido solo ai fini della liquidazione
return FALSE; return FALSE;
if (regst) //il movimento e' gia'
return FALSE; //stato stampato in forma definitiva
} }
const TDate datareg = mov.get_date(MOV_DATAREG);
if (datareg.month() < app()._stampa_mese) if (datareg.month() < app()._stampa_mese)
app()._stampa_mese = datareg.month(); app()._stampa_mese = datareg.month();
return TRUE; return TRUE;

View File

@ -210,7 +210,7 @@ void TParaliq_app::check_registers(int year)
{ {
// controlla che per ogni data attivita' esistano almeno un registro // controlla che per ogni data attivita' esistano almeno un registro
// acquisti, vendite e giornale; warning appropriato in caso negativo // acquisti, vendite e giornale; warning appropriato in caso negativo
TSheet_field& sf = (TSheet_field&)_msk->field(F_SHEET_PLA); TSheet_field& sf = _msk->sfield(F_SHEET_PLA);
const byte R_ACQ = 0x01; const byte R_ACQ = 0x01;
const byte R_VEN = 0x02; const byte R_VEN = 0x02;
const byte R_ALL = R_ACQ | R_VEN; const byte R_ALL = R_ACQ | R_VEN;
@ -256,7 +256,7 @@ void TParaliq_app::check_registers(int year)
void TParaliq_app::init_array(TMask& m, bool update) void TParaliq_app::init_array(TMask& m, bool update)
{ {
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); TSheet_field& sf = m.sfield(F_SHEET_PLA);
const long newditta = m.get_long(F_CODDITTA); const long newditta = m.get_long(F_CODDITTA);
TRelation att(LF_ATTIV); TRelation att(LF_ATTIV);
TRectype & r = att.curr(); TRectype & r = att.curr();
@ -310,7 +310,7 @@ bool TParaliq_app::user_create()
_msk->set_handler(F_CRED_COST,credpreccost_handler); _msk->set_handler(F_CRED_COST,credpreccost_handler);
_msk->set_handler(F_CODDITTA,ditta_handler); _msk->set_handler(F_CODDITTA,ditta_handler);
_msk->set_handler(F_UTCR_IVA,utcred_handler); _msk->set_handler(F_UTCR_IVA,utcred_handler);
((TSheet_field&)_msk->field(F_SHEET_PLA)).set_notify(sheet_action); _msk->sfield(F_SHEET_PLA).set_notify(sheet_action);
return TRUE; return TRUE;
} }
@ -330,7 +330,6 @@ bool TParaliq_app::sheet_action(TSheet_field& s, int r, KEY k)
void TParaliq_app::init_query_mode(TMask& m) void TParaliq_app::init_query_mode(TMask& m)
{ {
// svuota tutto // svuota tutto
TSheet_field& sh = (TSheet_field&)m.field(F_SHEET_PLA);
m.disable(DLG_DELREC); m.disable(DLG_DELREC);
} }
@ -369,7 +368,7 @@ int TParaliq_app::rewrite(const TMask& m)
// scrive tutte le righe di %PLA a partire dalle righe sheet // scrive tutte le righe di %PLA a partire dalle righe sheet
static int oldyear; static int oldyear;
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); TSheet_field& sf = m.sfield(F_SHEET_PLA);
const long firm = m.get_long(F_CODDITTA); const long firm = m.get_long(F_CODDITTA);
const int year = m.get_int(F_YEAR); const int year = m.get_int(F_YEAR);
const char freq = m.get(F_FREQ_VERS)[0]; const char freq = m.get(F_FREQ_VERS)[0];
@ -477,7 +476,7 @@ int TParaliq_app::read(TMask& m)
const long firm = m.get_long(F_CODDITTA); const long firm = m.get_long(F_CODDITTA);
const int year = m.get_int(F_YEAR); const int year = m.get_int(F_YEAR);
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); TSheet_field& sf = m.sfield(F_SHEET_PLA);
TString16 ctab; TString16 ctab;
TToken_string tt(80); TToken_string tt(80);
TRelation relpla(TAB_PLA); TRelation relpla(TAB_PLA);

View File

@ -318,11 +318,12 @@ void TInv_cont::main_loop()
break; break;
} }
floppy = mask->get(F_FLOPPY); floppy = mask->get(F_FLOPPY);
floppy << ':';
num_disk = calcola_numero_dischi(*mask,floppy); num_disk = calcola_numero_dischi(*mask,floppy);
percorso = mask->get(F_PATH); percorso = mask->get(F_PATH);
if (percorso.not_empty()) if (percorso.not_empty())
{ {
floppy << ":/" << percorso; floppy << SLASH << percorso;
if (floppy.exist()) if (floppy.exist())
ok = TRUE; ok = TRUE;
else else
@ -340,11 +341,8 @@ void TInv_cont::main_loop()
const TFilename from(_trasf); // File da splittare const TFilename from(_trasf); // File da splittare
TFilename work; TFilename work = floppy;
if (percorso.not_empty()) work.add(from.name()); // File su dischetto
work << floppy << "/" << from.name(); // File su dischetto
else
work << floppy << ":/" << from.name(); // File su dischetto
FILE* i = fopen(from, "rb"); FILE* i = fopen(from, "rb");

View File

@ -13,6 +13,7 @@
#include "cg7.h" #include "cg7.h"
#include "cg7100a.h" #include "cg7100a.h"
#include <clifo.h>
#include <mov.h> #include <mov.h>
#include <rmov.h> #include <rmov.h>
#include <rmoviva.h> #include <rmoviva.h>
@ -25,12 +26,12 @@ protected:
virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str); virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str);
public: public:
TInvio_file(const TString& file_name, const TString& config_name); TInvio_file(const TString& file_name);
virtual ~TInvio_file() { } virtual ~TInvio_file() { }
}; };
TInvio_file::TInvio_file(const TString& file_name, const TString& config_name) TInvio_file::TInvio_file(const TString& file_name)
: TFile_text(file_name, config_name) : TFile_text(file_name, "zucchett.ini")
{ {
} }
@ -145,7 +146,7 @@ void TInvio_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TSt
} }
else if (code == "_CAUSALE") else if (code == "_CAUSALE")
{ {
TFilename configname = "zucchett.ini"; TFilename configname = "cg7100a.ini";
TConfig configfile(configname); TConfig configfile(configname);
TToken_string causali = configfile.get("STANDARD", "CAUSALI"); TToken_string causali = configfile.get("STANDARD", "CAUSALI");
const char sezione = cur.curr(LF_RMOV).get_char(RMV_SEZIONE); const char sezione = cur.curr(LF_RMOV).get_char(RMV_SEZIONE);
@ -176,7 +177,7 @@ void TInvio_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TSt
else if (code == "_OPZIONI") else if (code == "_OPZIONI")
{ {
TString in(s.get()); TString in(s.get());
TFilename configname = "zucchett.ini"; TFilename configname = "cg7100a.ini";
TConfig configfile(configname); TConfig configfile(configname);
valore = configfile.get(in, "OPZIONI"); valore = configfile.get(in, "OPZIONI");
} }
@ -254,81 +255,20 @@ void TInvio_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TSt
if (valore[0] != '-' && valore[0] != '+') if (valore[0] != '-' && valore[0] != '+')
valore = "+"; valore = "+";
} }
else if (code == "_GIUFIS")
{
const char tipopers = cur.curr(LF_CLIFO).get_char(CLI_TIPOPERS);
valore = (tipopers == 'F') ? " " : "S";
}
else if (code == "_BLACKLIST")
{
const bool sospeso = cur.curr(LF_CLIFO).get_bool(CLI_SOSPESO);
valore = (sospeso == true) ? "S" : " ";
}
else NFCHECK("Macro non definita: %s", (const char *)code); else NFCHECK("Macro non definita: %s", (const char *)code);
str = valore; str = valore;
} }
bool TInvio::create()
{
open_files(LF_CAUSALI, LF_CLIFO, LF_PCON, LF_MOV, LF_RMOV, LF_RMOVIVA, 0);
_msk = new TInvio_mask();
_trasfile = NULL;
return TSkeleton_application::create();
}
bool TInvio::destroy()
{
if (_trasfile)
delete _trasfile;
delete _msk;
return TSkeleton_application::destroy();
}
void TInvio::main_loop()
{
TFilename configname = "zucchett.ini";
TConfig configfile(configname);
_msk->set(F_NUMEROINVIO, configfile.get_int("NUMEROINVIO","OPZIONI")+1);
_msk->set(F_DATAINI, configfile.get("DATA","OPZIONI"));
_msk->set(F_DESTINAZIONE, configfile.get("PERCORSO","OPZIONI"));
while (_msk->run()!=K_QUIT)
{
_totale = FALSE;
_finemov = FALSE;
configfile.set("NUMEROINVIO", _msk->get(F_NUMEROINVIO),"OPZIONI");
configfile.set("DATA", _msk->get_date(F_DATAFIN),"OPZIONI");
configfile.set("PERCORSO", _msk->get(F_DESTINAZIONE),"OPZIONI");
configfile.set_paragraph("CAUSALI");
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
const char tipoinvio = _msk->get(F_TIPOINVIO)[0];
if (tipoinvio == 'Z')
invio_zucchetti();
}
}
void TInvio::invio_zucchetti()
{
TFilename configname = "zucchett.ini";
TConfig configfile(configname);
TFilename filename = _msk->get(F_DESTINAZIONE);
filename.add(configfile.get("NOMEFILE", "OPZIONI"));
if (fexist(filename))
remove(filename);
_trasfile = new TInvio_file(filename, configname);
_trasfile->open(filename,'w');
i_zucchetti_testa();
if (_msk->get_bool(F_CAUSALI))
i_zucchetti_causali();
if (_msk->get_bool(F_CLIFOR))
i_zucchetti_clifor();
if (_msk->get_bool(F_CONTI))
i_zucchetti_conti();
if (_msk->get_bool(F_MOVCONT))
i_zucchetti_movcont();
if (_msk->get_bool(F_MOVIVA))
{
i_zucchetti_moviva('V');
i_zucchetti_moviva('A');
}
i_zucchetti_coda();
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
}
void TInvio::i_zucchetti_testa() void TInvio::i_zucchetti_testa()
{ {
// cursore fittizio // cursore fittizio
@ -376,7 +316,7 @@ void TInvio::i_zucchetti_testa()
} }
} }
TRecord_text rec; TRecord_text rec;
rec.set_type("T"); rec.set_type("I");
_trasfile->autoload(rec, cur); _trasfile->autoload(rec, cur);
_trasfile->write(rec); _trasfile->write(rec);
} }
@ -600,10 +540,87 @@ long TInvio::i_zucchetti_clifor(const bool invio)
return cur_items+cur_items; return cur_items+cur_items;
} }
//metodone globale che chiama, come un menu, i vari sottometodi in base alle scelte sulla maschera
void TInvio::invio_zucchetti()
{
//prende i parametri dal file di configurazione dell'applicazione
TFilename configname = "cg7100a.ini";
TConfig configfile(configname);
//prepara il file su cui scrivere, ovvero il _trasfile
TFilename filename = _msk->get(F_DESTINAZIONE);
filename.add(configfile.get("NOMEFILE", "OPZIONI"));
if (fexist(filename))
remove(filename);
_trasfile = new TInvio_file(filename);
_trasfile->open(filename,'w');
i_zucchetti_testa();
if (_msk->get_bool(F_CAUSALI))
i_zucchetti_causali();
if (_msk->get_bool(F_CLIFOR))
i_zucchetti_clifor();
if (_msk->get_bool(F_CONTI))
i_zucchetti_conti();
if (_msk->get_bool(F_MOVCONT))
i_zucchetti_movcont();
if (_msk->get_bool(F_MOVIVA))
{
i_zucchetti_moviva('V');
i_zucchetti_moviva('A');
}
i_zucchetti_coda();
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
}
bool TInvio::create()
{
_msk = new TInvio_mask();
_trasfile = NULL;
return TSkeleton_application::create();
}
bool TInvio::destroy()
{
if (_trasfile)
delete _trasfile;
delete _msk;
return TSkeleton_application::destroy();
}
void TInvio::main_loop()
{
TFilename configname = "cg7100a.ini";
configname.custom_path();
TConfig configfile(configname);
_msk->set(F_NUMEROINVIO, configfile.get_int("NUMEROINVIO","OPZIONI")+1);
_msk->set(F_DATAINI, configfile.get("DATA","OPZIONI"));
_msk->set(F_DESTINAZIONE, configfile.get("PERCORSO","OPZIONI"));
while (_msk->run() != K_QUIT)
{
_totale = false;
_finemov = false;
configfile.set("NUMEROINVIO", _msk->get(F_NUMEROINVIO),"OPZIONI");
configfile.set("DATA", _msk->get_date(F_DATAFIN),"OPZIONI");
configfile.set("PERCORSO", _msk->get(F_DESTINAZIONE),"OPZIONI");
configfile.set_paragraph("CAUSALI");
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
const char tipoinvio = _msk->get(F_TIPOINVIO)[0];
if (tipoinvio == 'Z')
invio_zucchetti();
}
}
int cg7100(int argc, char **argv) int cg7100(int argc, char **argv)
{ {
TInvio a; TInvio a;
a.run(argc, argv, "Invio dati contabilità"); a.run(argc, argv, "Invio dati contabilità Zucchetti");
return 0; return 0;
} }

10
cg/cg7100a.ini Executable file
View File

@ -0,0 +1,10 @@
[OPZIONI]
CODICEDITTA = 000106
DATA =
NOMEFILE = im000000
NUMEROINVIO =
PERCORSO =
[CAUSALI]
STANDARD=021|020

View File

@ -2,13 +2,6 @@
PAGE "Invio dati contabilita'" -1 -1 78 20 PAGE "Invio dati contabilita'" -1 -1 78 20
//STRING 30 70 50
// BEGIN
// FLAGS "G"
// PROMPT 10 -5 "Profilo "
// PSELECT
//END
GROUPBOX DLG_NULL 76 3 GROUPBOX DLG_NULL 76 3
BEGIN BEGIN
PROMPT 2 1 "@bDitta corrente" PROMPT 2 1 "@bDitta corrente"

View File

@ -1191,5 +1191,6 @@ int cg7200(int argc, char **argv)
{ {
TInvioP a; TInvioP a;
a.run(argc, argv, "Invio dati contabilità a Proforma"); a.run(argc, argv, "Invio dati contabilità a Proforma");
return 0; return 0;
} }

View File

@ -802,7 +802,7 @@ void TSaldo_agg::registra()
if (saldi.read(_isequal, _lock) != NOERR) if (saldi.read(_isequal, _lock) != NOERR)
{ {
saldi.zero(); saldi.zero();
saldi.put(SLD_ANNOES, atoi(hobj->key().left(4))); saldi.put(SLD_ANNOES, annoes);
saldi.put(SLD_GRUPPO, tcon.gruppo()); saldi.put(SLD_GRUPPO, tcon.gruppo());
saldi.put(SLD_CONTO, tcon.conto()); saldi.put(SLD_CONTO, tcon.conto());
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto()); saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());

View File

@ -466,6 +466,41 @@ TImporto TRiga_scadenze::residuo(bool val, int mode) const
return residuo; return residuo;
} }
TImporto TRiga_scadenze::esposto(bool valuta, const TDate & data_scad, const TDate & data_rischio, bool & sbf) const
{
TImporto esposto;
const bool rischio = data_scad != data_rischio;
TDate data(get(SCAD_DATASCAD));
const int lasts = last();
sbf = false;
for (int p = first(); p <= lasts; p = succ(p))
{
const TRiga_partite & pag = riga().partita().riga(p);
const int tp = pag.get_int(PART_TIPOPAG);
if (tp >= 2 && tp <= 7)
{
const char sez = pag.sezione();
const TImporto imp(sez, pag.get_real(valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO));
TDate datapag(pag.get(PART_DATAPAG));
if (data.ok() && datapag > data)
datapag = datapag;
if (rischio && datapag > data_rischio && datapag <= data_scad)
{
esposto += imp;
sbf = true;
}
else
if (datapag > data_scad)
esposto += imp;
}
}
return esposto;
}
bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta& valuta,
char& old_ap, TImporto& old_abb, TImporto& old_diffcam, char& old_ap, TImporto& old_abb, TImporto& old_diffcam,

View File

@ -150,6 +150,7 @@ public:
TImporto importo_pagato(bool val, int mode = 0xF) const; TImporto importo_pagato(bool val, int mode = 0xF) const;
TImporto importo(bool val) const; TImporto importo(bool val) const;
TImporto residuo(bool val, int mode = 0xF) const; // Differenza delle due funzioni precedenti TImporto residuo(bool val, int mode = 0xF) const; // Differenza delle due funzioni precedenti
TImporto esposto(bool valuta, const TDate & data_scad, const TDate & data_rischio, bool & sbf) const ;
bool esistono_abbuoni_diffcam() const; bool esistono_abbuoni_diffcam() const;

View File

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

View File

@ -1,5 +1,5 @@
17 17
73 74
TIPOCF|1|1|0|Tipo <C>liente, <F>ornitore TIPOCF|1|1|0|Tipo <C>liente, <F>ornitore
CODCF|3|6|0|Codice CODCF|3|6|0|Codice
CODINDDOC|2|3|0|Codice indirizzo documenti CODINDDOC|2|3|0|Codice indirizzo documenti
@ -69,6 +69,7 @@ ESCAR|4|6|2|Percentuale di esenzione CONAI carta
ESPLA|4|6|2|Percentuale di esenzione CONAI plastica ESPLA|4|6|2|Percentuale di esenzione CONAI plastica
ESLEG|4|6|2|Percentuale di esenzione CONAI legno ESLEG|4|6|2|Percentuale di esenzione CONAI legno
ESVET|4|6|2|Percentuale di esenzione CONAI vetro ESVET|4|6|2|Percentuale di esenzione CONAI vetro
DATAECONAI|5|8|0|Data di fine esnzion CONAI
CONAIASS|8|1|0|Stampa contributo CONAI assolto CONAIASS|8|1|0|Stampa contributo CONAI assolto
TIPODOCFAT|1|4|0|Tipo documento TIPODOCFAT|1|4|0|Tipo documento
CODCAUS|1|3|0|Causale Contabile CODCAUS|1|3|0|Causale Contabile

File diff suppressed because it is too large Load Diff

View File

@ -57,6 +57,7 @@ public:
virtual long objects( ) const pure; virtual long objects( ) const pure;
// @cmember Ritorna true se il contenitore e' vuoto // @cmember Ritorna true se il contenitore e' vuoto
virtual bool empty() const virtual bool empty() const
{ return objects( ) == 0; } { return objects( ) == 0; }
// @cmember Cerca il successivo elemento che soddisfa la <t OPERATION_FUNCTION> // @cmember Cerca il successivo elemento che soddisfa la <t OPERATION_FUNCTION>

View File

@ -9,6 +9,7 @@ cg Contabilita' Generale
ci Contabilita' Industriale ci Contabilita' Industriale
mi Modello IVA 11 mi Modello IVA 11
dt Importazione documenti STORE dt Importazione documenti STORE
tp Trasferimento Pack
ce Cespiti ce Cespiti
rs Report di Stampa rs Report di Stampa
sc Saldaconto sc Saldaconto

View File

@ -74,4 +74,6 @@
#define CFV_CODCAUS "CODCAUS" #define CFV_CODCAUS "CODCAUS"
#define CFV_CODCAUSNC "CODCAUSNC" #define CFV_CODCAUSNC "CODCAUSNC"
#define CFV_CONAIASS "CONAIASS" #define CFV_CONAIASS "CONAIASS"
#define CFV_DATAECONAI "DATAECONAI"
#define CFV_ADDCONAI "ADDCONAI"
#endif #endif

View File

@ -2,6 +2,7 @@
#include <cfiles.h> #include <cfiles.h>
#include <csort.h> #include <csort.h>
#include <stdio.h>
#define MOSTMEM 51200 #define MOSTMEM 51200
#define LEASTMEM 10240 #define LEASTMEM 10240
@ -383,16 +384,15 @@ static void dumpbuff()
static FILE *wopen(char* name) /* nome del file temporaneo */ static FILE *wopen(char* name) /* nome del file temporaneo */
{ {
FILE *fp; FILE* fp = NULL;
char* tmp = _tempnam(".", "srt");
/* if (tmp != NULL)
char s[42]; {
static int n = 0; strcpy(name, tmp);
sprintf(s, "srt%02d", ++n); free(tmp);
TMPFNAME(name,s); }
*/ else
tmpnam(name); tmpnam(name);
fp = fopen(name, "wb+"); fp = fopen(name, "wb+");
if (fp == NULL) if (fp == NULL)
xvt_dm_post_fatal_exit("Can't open SORT file"); xvt_dm_post_fatal_exit("Can't open SORT file");

View File

@ -215,6 +215,7 @@ void TMask::read_mask(
} }
} }
} }
} }
} }
@ -2076,10 +2077,11 @@ bool TMask::load(
TToken_string t(256); TToken_string t(256);
char* buffer = t.get_buffer(); char* buffer = t.get_buffer();
while (fgets(buffer, t.size(), f) != NULL && t != "[EOM]") while (fgets(buffer, t.size(), f) != NULL && t != "[EOM]")
{ {
if (t.not_empty()) if (t.not_empty())
{ {
t.cut(t.len() - 1); t.rtrim();
const int pos = id2pos(t.get_int(0)); const int pos = id2pos(t.get_int(0));
if (pos >= 0) fld(pos).set(t.get()); if (pos >= 0) fld(pos).set(t.get());
} }
@ -2233,6 +2235,23 @@ int TMask::load_profile(int num, bool reset)
return num; return num;
} }
bool TMask::kill_profile(int num)
{
TFilename prof;
make_profile_name(prof);
TConfig ini(prof, "Main");
if (num <= 0)
num = ini.get_int(user());
TString16 name; name << num;
const bool ok = ini.set_paragraph(name);
if (ok)
ini.remove_all();
return ok;
}
const char* TMask::get_caption(TString& str) const const char* TMask::get_caption(TString& str) const
{ {
char* title = str.get_buffer(128); char* title = str.get_buffer(128);

View File

@ -399,6 +399,8 @@ public:
int save_profile(int num = 0, const char* desc = NULL) const; int save_profile(int num = 0, const char* desc = NULL) const;
// @cmember Carica il profilo <p num> // @cmember Carica il profilo <p num>
int load_profile(int num = 0, bool reset = TRUE); int load_profile(int num = 0, bool reset = TRUE);
// @cmember Elimina il profilo <p num>
bool kill_profile(int num);
// @cmember Ritorna il primo campo dirty // @cmember Ritorna il primo campo dirty
short dirty() const; short dirty() const;

View File

@ -12,6 +12,8 @@
#define CIAUT 8 #define CIAUT 8
#define MIAUT 9 #define MIAUT 9
#define DTAUT 10 #define DTAUT 10
#define TPAUT 10
#define CEAUT 11 #define CEAUT 11
#define RSAUT 12 #define RSAUT 12
#define SCAUT 13 #define SCAUT 13

View File

@ -520,6 +520,7 @@ protected:
bool connect(); bool connect();
public: public:
const TString & Server() const { return _server; }
virtual bool Execute(const char* cmd); virtual bool Execute(const char* cmd);
bool WriteLine(const char* cmd); bool WriteLine(const char* cmd);
@ -729,17 +730,17 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
{ {
bool ok = FALSE; bool ok = FALSE;
TSocket_connection* conn = (TSocket_connection*)GetConnection(id);
TString buf(4096); TString buf(8*1024);
buf << "GET " << remote << " HTTP/1.0\r\n" buf << "GET " << remote << " HTTP/1.1\r\n"
<< "User-Agent: Campo\r\n"; << "User-Agent: Campo\r\n"
<< "Host: " << conn->Server() << "\r\n";
if (authorization && *authorization) if (authorization && *authorization)
buf << "Authorization: " << authorization << "\r\n"; buf << "Authorization: " << authorization << "\r\n";
buf << "\r\n"; buf << "\r\n";
if (WriteLine(id, buf)) if (WriteLine(id, buf))
{ {
long size = 0; long size = 0;
for (int r = 0; ; r++) for (int r = 0; ; r++)
@ -760,13 +761,16 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
{ {
buf.cut(0) << remote << " - " << (size / 1024 + 1) << " KBytes"; buf.cut(0) << remote << " - " << (size / 1024 + 1) << " KBytes";
TProgind pi(size, buf, TRUE, TRUE); TProgind pi(size, buf, TRUE, TRUE);
long total = 0; long total = 0;
skstream* cur_socket = conn->GetSocket();
skstream* cur_socket = ((TSocket_connection*)GetConnection(id))->GetSocket();
while (!cur_socket->eof()) while (!cur_socket->eof())
{ {
cur_socket->read(buf.get_buffer(), buf.size()); int nchars = buf.size();
if (size >0 && nchars > size - total)
nchars = size - total;
cur_socket->read(buf.get_buffer(), nchars);
const int count = cur_socket->gcount(); const int count = cur_socket->gcount();
if (count > 0) if (count > 0)
{ {
@ -775,9 +779,11 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
pi.setstatus(total); pi.setstatus(total);
if (pi.iscancelled()) if (pi.iscancelled())
break; break;
if (size > 0 && total >= size)
break;
} }
} }
ok = pi.isfinished(); ok = size = 0 ? cur_socket->eof() != 0 : total >= size;
} }
else else
error_box("Impossibile scrivere il file %s", local); error_box("Impossibile scrivere il file %s", local);

View File

@ -1290,7 +1290,9 @@ const char *real::ita2eng (const char *s)
bool real::is_null(const char *s) bool real::is_null(const char *s)
{ {
bool z = TRUE; bool z = TRUE;
if (s != NULL) for (const char* n = s; *n; n++) if (s && *s)
{
for (const char* n = s; *n; n++)
{ {
if (strchr("123456789", *n) != NULL) if (strchr("123456789", *n) != NULL)
{ {
@ -1300,25 +1302,23 @@ bool real::is_null(const char *s)
if (strchr(" ,-.0", *n) == NULL) if (strchr(" ,-.0", *n) == NULL)
break; break;
} }
}
return z; return z;
} }
bool real::is_natural (const char *s) bool real::is_natural (const char *s)
{ {
bool ok = s && *s != '\0'; bool ok = false;
if (ok) if (s && *s)
{ {
while (*s == ' ') while (*s == ' ')
s++; // Remove leading spaces before s++; // Remove leading spaces before
if (*s) if (*s)
{ {
while (isdigit(*s)) while (isdigit(*s))
s++; s++;
ok = *s == '\0'; ok = *s == '\0';
} }
else
ok = FALSE;
} }
return ok; return ok;
} }

View File

@ -180,5 +180,5 @@ const TString& logic2table(int logic_num);
int table2logic(const TString& name); int table2logic(const TString& name);
TRecordset* create_recordset(const TString& sql); TRecordset* create_recordset(const TString& sql);
#endif
#endif

View File

@ -956,7 +956,7 @@ bool TRelation_application::save(bool check_dirty)
const int mode = _mask->mode(); const int mode = _mask->mode();
if (check_dirty) if (check_dirty)
{ {
const int dirty = _mask->dirty(); const short dirty = _mask->dirty();
if (mode == MODE_QUERY) if (mode == MODE_QUERY)
{ {

View File

@ -23,6 +23,7 @@ CODFISC|1|16|0|Codice Fiscale
MATRICOLA|1|8|0|Matricola MATRICOLA|1|8|0|Matricola
PLURIMAND|8|1|0|Plurimandatario PLURIMAND|8|1|0|Plurimandatario
DATACESS|5|8|0|Data cessazione rapporto DATACESS|5|8|0|Data cessazione rapporto
2 3
CODAGE| CODAGE|
UPPER(RAGSOC)|X UPPER(RAGSOC)|X
CODFORN|X

View File

@ -19,6 +19,8 @@ int main(int argc,char** argv)
pr0600(argc,argv); break; // gestione archivi percentuali di provvigione pr0600(argc,argv); break; // gestione archivi percentuali di provvigione
case 6: case 6:
pr0700(argc,argv); break; // gestione provvigioni agenti pr0700(argc,argv); break; // gestione provvigioni agenti
case 7:
pr0800(argc,argv); break; // aggiornamento maturato
default: default:
pr0100(argc,argv); break; // gestione tabelle pr0100(argc,argv); break; // gestione tabelle
} }

View File

@ -8,6 +8,7 @@ int pr0400(int argc, char** argv);
int pr0500(int argc, char** argv); int pr0500(int argc, char** argv);
int pr0600(int argc, char** argv); int pr0600(int argc, char** argv);
int pr0700(int argc, char** argv); int pr0700(int argc, char** argv);
int pr0800(int argc, char** argv);
#endif // __PR0_H #endif // __PR0_H

225
pr/pr0800.cpp Executable file
View File

@ -0,0 +1,225 @@
// Programma di gestione provvigioni
#include <applicat.h>
#include <automask.h>
#include <msksheet.h>
#include <recset.h>
#include "../cg/cgsaldac.h"
#include "../ve/velib.h"
#include "prlib.h"
#include <modaut.h>
#include <mov.h>
#include <doc.h>
#include "provv.h"
#include "pr0800a.h"
#include "pr0.h"
class TAggiornamento_maturato_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
void load_params();
void save_params();
TAggiornamento_maturato_mask() : TAutomask("pr0800a") {}
virtual ~TAggiornamento_maturato_mask() {}
};
bool TAggiornamento_maturato_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_A_CODAGE:
if (e == fe_close)
{
const long a_cod = atol(o.get());
const long da_cod = get_long(F_DA_CODAGE);
if (a_cod > 0L && da_cod > a_cod)
return error_box("Codice agente finale minore del codice agente iniziale");
}
break;
default:
break;
}
return true;
}
class TAggiornamento_maturato_app : public TSkeleton_application
{
protected:
virtual bool create();
virtual bool destroy();
void aggiorna_maturato(TAggiornamento_maturato_mask &m);
virtual void main_loop();
};
static inline TAggiornamento_maturato_app& app() { return (TAggiornamento_maturato_app&) main_app(); }
////////////////////////////////////////////////////////////////////////////////////////
// Da fare :
// - Quando si elimina l'ultima riga dello spreadsheet si posiziona sulla prima senza
// mandare un K_TAB per aggiornare le rate
// - Browse dei documenti in ricerca, quando si seleziona setta giustamente focusdirty() e manda
// un K_TAB. Quando si tenta di uscire dal campo si ha ancora il campo focusdirty()
// - Cercare di implementare scarico/saldo righe provvigionali per agente in base ad una
// impostata
// - Ultimo ma non meno importante (da ritenersi visualmente valido) lo riempimento fisso
// degli sheet (documenti e rate) in modo da evitare il fastidiosissimo sfarfallio in
// inserimento righe con elementi vuoti
////////////////////////////////////////////////////////////////////////////////////////
bool TAggiornamento_maturato_app::create()
{
const bool saldaconto = has_module(SCAUT, CHK_DONGLE);
if (!saldaconto)
return error_box("Questo programma necessita del saldaconto");
open_files(LF_PROVV, LF_TABCOM, LF_DOC, LF_PARTITE, LF_SCADENZE, LF_PAGSCA, LF_TAB, 0);
return TSkeleton_application::create();
}
bool TAggiornamento_maturato_app::destroy()
{
return TSkeleton_application::destroy();
}
bool filter_func(const TRelation* rel)
{
const real importo_rata = rel->curr().get(PROV_IMPRATA);
const real importo_pagato = rel->curr().get(PROV_PAGATO);
if ((importo_rata > ZERO) && (importo_rata <= importo_pagato))
return false;
else
return true;
}
bool scan_func(const TRelation& rel, void* pJolly)
{
TAggiornamento_maturato_mask * m = (TAggiornamento_maturato_mask *) pJolly;
const TDate data_scad(m->get(F_DATA_SCAD));
TDate data_rischio(data_scad); data_rischio -= m->get_long(F_GIORNI_RISCHIO);
bool sbf = false;
TRectype & rec = rel.curr();
const int anno = rec.get_int(PROV_ANNO);
const TString16 codnum(rec.get(PROV_CODNUM)) ;
const long ndoc = rec.get_long(PROV_NDOC);
TString key;
key.format("D|%d|%s|%ld", anno, (const char *) codnum, ndoc);
const long nreg = atol(cache().get(LF_DOC, key, DOC_NUMREG));
if (nreg > 0)
{
TPartite_array p;
p.add_numreg(nreg);
if (p.items() > 0)
{
const TPartita & part = *(p.first());
const int nriga = part.prima_fattura(nreg);
if (nriga >= 0)
{
bool changed_record = false;
TRiga_partite & r = part.riga(nriga);
const int nrata = rec.get_int(PROV_NRATA);
const real importo_rata(rec.get_real(PROV_IMPRATA));
const real importo_pagato(rec.get_real(PROV_PAGATO));
const real provvigione_rata(rec.get_real(PROV_IMPPROVV));
const real provvigione_pagata(rec.get_real(PROV_PROVVPAG));
if (nrata > 0)
{
TRiga_scadenze & s = r.rata(nrata);
TImporto pagato(s.importo_pagato(false));
pagato -= s.esposto(false, data_scad, data_rischio, sbf);
pagato.normalize('A');
if (pagato.valore() >= importo_rata)
{
const real importo_maturato = importo_rata - importo_pagato;
const real provvigione_maturata = provvigione_rata - provvigione_pagata;
rec.put(PROV_SALDATA, "X");
rec.put(PROV_PAGMAT, importo_maturato);
rec.put(PROV_PROVVMAT, provvigione_maturata);
changed_record = true;
}
else
{
const real importo_maturato = pagato.valore() - importo_pagato;
if (importo_maturato > ZERO)
{
real provvigione_maturata = provvigione_rata * (importo_maturato / importo_rata);
rec.put(PROV_PAGMAT, importo_maturato);
rec.put(PROV_PROVVMAT, provvigione_maturata);
changed_record = true;
}
}
}
else
{
const TDate data_mat = rec.get_date(PROV_DATASCAD);
if (data_mat <= data_scad)
{
changed_record = true;
rec.put(PROV_SALDATA, "X");
rec.put(PROV_PAGMAT, importo_rata);
rec.put(PROV_PROVVMAT, provvigione_rata);
}
}
if (changed_record)
{
TLocalisamfile provv(LF_PROVV);
provv.curr() = rec;
int err = provv.read(_isequal, _lock);
if (err == NOERR)
err = rec.rewrite(provv);
if (err != NOERR)
return yesno_box("Errore %d nell' aggioramento agente %ld, Continuare ugualmente", err, rec.get_long(PROV_CODAGE));
}
}
}
}
return true;
}
void TAggiornamento_maturato_app::aggiorna_maturato(TAggiornamento_maturato_mask &m)
{
TCursor c(new TRelation(LF_PROVV), "(ANNO!=\"\")&&(CODNUM!=\"\")&&(NDOC!=\"\")&&(SALDATA!=\"X\")");
TRectype from(LF_PROVV);
TRectype to(LF_PROVV);
const TString16 da_cod(m.get(F_DA_CODAGE));
const TString16 a_cod(m.get(F_A_CODAGE));
if (da_cod > 0)
from.put(PROV_CODAGE, da_cod);
if (a_cod > 0)
to.put(PROV_CODAGE, a_cod);
c.setregion(from, to);
c.set_filterfunction(filter_func);
c.scan(scan_func, &m, TR("Aggiornamento provvigioni maturate"));
}
void TAggiornamento_maturato_app::main_loop()
{
TAggiornamento_maturato_mask m;
while (m.run() == K_ENTER)
aggiorna_maturato(m);
}
int pr0800(int argc, char** argv)
{
TAggiornamento_maturato_app a;
a.run(argc, argv, TR("Aggiornamento provvigioni maturate"));
return 0;
}

8
pr/pr0800a.h Executable file
View File

@ -0,0 +1,8 @@
// campi maschera pr0800a.uml
#define F_DA_CODAGE 201
#define F_DA_RAGSOC 202
#define F_A_CODAGE 203
#define F_A_RAGSOC 204
#define F_DATA_SCAD 205
#define F_GIORNI_RISCHIO 206

89
pr/pr0800a.uml Executable file
View File

@ -0,0 +1,89 @@
#include "pr0800a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -11 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Aggiornamento Maturato" -1 -1 78 8
GROUPBOX DLG_NULL 80 6
BEGIN
PROMPT 1 1 "Agente"
FLAGS "R"
END
STRING F_DA_CODAGE 5
BEGIN
PROMPT 2 2 "Da Codice "
FLAGS "UZ"
USE LF_AGENTI
INPUT CODAGE F_DA_CODAGE
DISPLAY "Codice@8R" CODAGE
DISPLAY "Descrizione@60" RAGSOC
OUTPUT F_DA_CODAGE CODAGE
OUTPUT F_DA_RAGSOC RAGSOC
CHECKTYPE NOPRMAL
ADD RUN PR0 -4
END
STRING F_DA_RAGSOC 50
BEGIN
PROMPT 2 3 "Da Ragione sociale "
USE LF_AGENTI KEY 2
INPUT RAGSOC F_DA_RAGSOC
DISPLAY "Descrizione@60" RAGSOC
DISPLAY "Codice@8R" CODAGE
COPY OUTPUT F_DA_CODAGE
CHECKTYPE NORMAL
ADD RUN PR0 -4
END
STRING F_A_CODAGE 5
BEGIN
PROMPT 2 4 "A Codice "
FLAGS "UZ"
COPY USE F_DA_CODAGE
INPUT CODAGE F_A_CODAGE
COPY DISPLAY F_DA_CODAGE
OUTPUT F_A_CODAGE CODAGE
OUTPUT F_A_RAGSOC RAGSOC
CHECKTYPE NORMAL
ADD RUN PR0 -4
END
STRING F_A_RAGSOC 50
BEGIN
PROMPT 2 5 "A Ragione sociale "
COPY USE F_DA_RAGSOC
INPUT RAGSOC F_A_RAGSOC
COPY DISPLAY F_DA_RAGSOC
COPY OUTPUT F_A_CODAGE
CHECKTYPE NORMAL
ADD RUN PR0 -4
END
DATE F_DATA_SCAD
BEGIN
PROMPT 2 8 "Data scadenza "
CHECKTYPE REQUIRED
END
NUMBER F_GIORNI_RISCHIO 2
BEGIN
PROMPT 2 10 "Giorni rischio "
END
ENDPAGE
ENDMASK

View File

@ -6,8 +6,9 @@ Flags = ""
Item_01 = "Archivi e tabelle", [PRMENU_002] Item_01 = "Archivi e tabelle", [PRMENU_002]
Item_02 = "Stampa archivi e tabelle", [PRMENU_003] Item_02 = "Stampa archivi e tabelle", [PRMENU_003]
Item_03 = "Provvigioni", "pr0 -6", "F" Item_03 = "Provvigioni", "pr0 -6", "F"
Item_04 = "Stampa provvigioni", [PRMENU_004] Item_04 = "Aggiornamento maturato", "pr0 -7", "F"
Item_05 = "Configurazione modulo", [PRMENU_010] Item_05 = "Stampa provvigioni", [PRMENU_004]
Item_06 = "Configurazione modulo", [PRMENU_010]
[PRMENU_002] [PRMENU_002]
Caption = "Archivi e tabelle" Caption = "Archivi e tabelle"

View File

@ -20,7 +20,7 @@
#define NUMERO_FASCE 5 #define NUMERO_FASCE 5
#define LIMITI {30,60,90,120,150,30,60,90,120,150} #define LIMITI {30,60,90,120,150,30,60,90,120,150}
enum tipo_st {clienti=0, fornitori=1, altri=2}; enum tipo_st {clienti=0, fornitori=1};
class TLineTotal : public TObject //Oggetto di base per i TAssoc_array dei totali class TLineTotal : public TObject //Oggetto di base per i TAssoc_array dei totali
{ {
@ -121,9 +121,10 @@ public:
virtual bool user_destroy(); virtual bool user_destroy();
virtual bool set_print(int); virtual bool set_print(int);
virtual void set_page (int file, int counter); virtual void set_page (int file, int counter);
void print_totali_rows(int& nriga, bool what); void print_totali_rows(int nriga, bool what);
void print_totali(int& nriga); void print_totali(int& nriga);
void print_header(); void print_header();
int calc_last_column();
void update_totals(bool what, real& esp, void update_totals(bool what, real& esp,
real& s1,real& s2,real& s3,real& s4,real& s5, real& s6, real& s1,real& s2,real& s3,real& s4,real& s5, real& s6,
real& ns1,real& ns2,real& ns3,real& ns4,real& ns5, real& ns6); real& ns1,real& ns2,real& ns3,real& ns4,real& ns5, real& ns6);
@ -145,7 +146,7 @@ void TProspettoScadenze::print_real(TString& dest, const real& num)
const TString& val = stampa_in_valuta ? _codval : EMPTY_STRING; const TString& val = stampa_in_valuta ? _codval : EMPTY_STRING;
const TCurrency cur(num, val); const TCurrency cur(num, val);
dest = cur.string(TRUE); dest = cur.string(TRUE);
dest.right_just(13); dest.right_just(10);
} }
bool TProspettoScadenze::fil_function(const TRelation *r) bool TProspettoScadenze::fil_function(const TRelation *r)
@ -280,9 +281,6 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
char norm='D'; char norm='D';
if (_tipost == fornitori) if (_tipost == fornitori)
norm = 'A'; norm = 'A';
else
if (_tipost == altri && bill.find())
norm = bill.sezione();
pag.normalize((norm=='D') ? 'A' : 'D'); scd.normalize(norm); bf.normalize((norm=='D') ? 'A' : 'D'); pag.normalize((norm=='D') ? 'A' : 'D'); scd.normalize(norm); bf.normalize((norm=='D') ? 'A' : 'D');
real res,a,b; a = pag.valore(); b = scd.valore(); //buonf += bf.valore(); real res,a,b; a = pag.valore(); b = scd.valore(); //buonf += bf.valore();
res = b - a; res = b - a;
@ -349,11 +347,11 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
if (d <= (TDate&)_s_date[4]) if (d <= (TDate&)_s_date[4])
s6 += res; s6 += res;
residuo += res; residuo += res;
}
bool sbf; bool sbf;
TImporto esp = rp.esposto(_stvaluta, _limscad, _limbf, sbf); TImporto esp = rs.esposto(_stvaluta, _limscad, _limbf, sbf);
esposto += esp.valore(); esposto += esp.valore();
} }
}
// Aggiorna i totali... // Aggiorna i totali...
if (s1!=ZERO || s2!=ZERO || s3!=ZERO || s4!= ZERO || s5!= ZERO || s6!=ZERO || if (s1!=ZERO || s2!=ZERO || s3!=ZERO || s4!= ZERO || s5!= ZERO || s6!=ZERO ||
@ -370,13 +368,8 @@ void TProspettoScadenze::calcola_saldo()
TLineTotal *ll = (TLineTotal *) a.objptr(_codval); TLineTotal *ll = (TLineTotal *) a.objptr(_codval);
TSaldo saldo; TSaldo saldo;
int g,c; int g,c;
long s; const long s = atol(_cod_pre);
if (_tipost == altri)
{
}
else
{
s = atol(_cod_pre);
for (int i = 0; i < _conti_cf.items(); i++) for (int i = 0; i < _conti_cf.items(); i++)
{ {
TToken_string& cf = (TToken_string&)_conti_cf[i]; TToken_string& cf = (TToken_string&)_conti_cf[i];
@ -399,7 +392,6 @@ void TProspettoScadenze::calcola_saldo()
at.add(_codval, lt); at.add(_codval, lt);
} }
lt->_sl += ll->_sl; lt->_sl += ll->_sl;
}
} }
bool TProspettoScadenze::preprocess_page(int file, int counter) bool TProspettoScadenze::preprocess_page(int file, int counter)
@ -440,18 +432,8 @@ bool TProspettoScadenze::preprocess_page(int file, int counter)
if (sin_tot.items() > 0) if (sin_tot.items() > 0)
{ {
print_totali(nriga); print_totali(nriga);
return TRUE; return true;
} }
//if (_end_printed)
//{
// TAssoc_array& gen_tot = (TAssoc_array&) _t[1];
// if (gen_tot.items() > 0)
// {
// nriga++;
// print_totali_rows(nriga,1);
// }
// return TRUE; // Go back, print and exit!
//}
} }
_des.trim(); _des.trim();
_cod_pre = _cod; _cod_pre = _cod;
@ -494,22 +476,23 @@ print_action TProspettoScadenze::postprocess_print(int file, int counter)
{ {
print_action rt = NEXT_PAGE; print_action rt = NEXT_PAGE;
if (!_end_printed) if (!_end_printed)
{
if ((file == LF_PARTITE)) if ((file == LF_PARTITE))
{ {
rt = REPEAT_PAGE; rt = REPEAT_PAGE;
_end_printed = TRUE; _end_printed = true;
} }
if (_end_printed) if (_end_printed)
{ {
TAssoc_array& gen_tot = (TAssoc_array&) _t[1]; TAssoc_array& gen_tot = (TAssoc_array&) _t[1];
if (gen_tot.items() > 0) if (gen_tot.items() > 0)
{ {
int nriga = 1; print_totali_rows(1,1);
print_totali_rows(nriga,1); print_one(0);
}
} }
//return REPEAT_PAGE; // Go back, print and exit!
} }
return rt; return rt;
} }
@ -586,16 +569,11 @@ bool TProspettoScadenze::set_print(int)
{ {
reset_files(); reset_files();
reset_print(); reset_print();
if (_m->get_who() == 'P')
_tipost = altri;
else
{
if (_m->get_who() == 'C') if (_m->get_who() == 'C')
_tipost = clienti; _tipost = clienti;
else else
_tipost = fornitori; _tipost = fornitori;
riempi_conti_mastro(_m->get_who()); riempi_conti_mastro(_m->get_who());
}
if (_m->get_key() == 1) if (_m->get_key() == 1)
_ordcod = TRUE; _ordcod = TRUE;
else else
@ -646,21 +624,6 @@ bool TProspettoScadenze::set_print(int)
add_file(LF_PARTITE); add_file(LF_PARTITE);
add_file(LF_CLIFO,LF_PARTITE); add_file(LF_CLIFO,LF_PARTITE);
break; break;
case altri:
filter_to.put("TIPOC", "A"); // Sporco trucco per selezionare solo i conti
if (_ordcod) // Per codice...
{
select_cursor(_cur3);
get_cursor(_cur3)->setregion(filter_from, filter_to); // Filtro per i conti normali!
}
else // ... e descrizione
{
select_cursor(_cur4);
get_cursor(_cur4)->setregion(filter_from, filter_to); // Filtro per i conti normali!
}
add_file(LF_PARTITE);
add_file(LF_PCON,LF_PARTITE);
break;
default: break; default: break;
} // End of inner switch } // End of inner switch
@ -687,7 +650,7 @@ bool TProspettoScadenze::set_print(int)
return rt; return rt;
} }
void TProspettoScadenze::print_totali_rows(int& nriga, bool what) void TProspettoScadenze::print_totali_rows(int nriga, bool what)
// If what is 0 prints single total... else prints also general total // If what is 0 prints single total... else prints also general total
{ {
reset_print(); reset_print();
@ -704,7 +667,7 @@ void TProspettoScadenze::print_totali_rows(int& nriga, bool what)
TString value; TString value;
TLineTotal& v = (TLineTotal&)xassoc[k]; TLineTotal& v = (TLineTotal&)xassoc[k];
int pos = 60; int pos = 40;
TString rw(255); TString rw(255);
rw = ""; rw = "";
@ -713,134 +676,141 @@ void TProspettoScadenze::print_totali_rows(int& nriga, bool what)
if (v._s6 != ZERO) if (v._s6 != ZERO)
{ {
print_real(value, v._s6); print_real(value, v._s6);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_sfasce >= 5) if (_sfasce >= 5)
pos = pos + 16; pos = pos + 11;
if (v._s5 != ZERO) if (v._s5 != ZERO)
{ {
print_real(value, v._s5); print_real(value, v._s5);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_sfasce >= 4) if (_sfasce >= 4)
pos = pos + 16; pos = pos + 11;
if (v._s4 != ZERO) if (v._s4 != ZERO)
{ {
print_real(value, v._s4); print_real(value, v._s4);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_sfasce >= 3) if (_sfasce >= 3)
pos = pos + 16; pos = pos + 11;
if (v._s3 != ZERO) if (v._s3 != ZERO)
{ {
print_real(value, v._s3); print_real(value, v._s3);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_sfasce >= 2) if (_sfasce >= 2)
pos = pos + 16; pos = pos + 11;
if (v._s2 != ZERO) if (v._s2 != ZERO)
{ {
print_real(value, v._s2); print_real(value, v._s2);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_sfasce >= 1) if (_sfasce >= 1)
pos = pos + 16; pos = pos + 11;
} }
if (v._s1 != ZERO) if (v._s1 != ZERO)
{ {
print_real(value, v._s1); print_real(value, v._s1);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
pos = pos + 16; pos = pos + 11;
if (_nsinfasce) if (_nsinfasce)
{ {
if (v._ns1 != ZERO) if (v._ns1 != ZERO)
{ {
print_real(value, v._ns1); print_real(value, v._ns1);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_nsfasce >= 1) if (_nsfasce >= 1)
pos = pos + 16; pos = pos + 11;
if (v._ns2 != ZERO) if (v._ns2 != ZERO)
{ {
print_real(value, v._ns2); print_real(value, v._ns2);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_nsfasce >= 2) if (_nsfasce >= 2)
pos = pos + 16; pos = pos + 11;
if (v._ns3 != ZERO) if (v._ns3 != ZERO)
{ {
print_real(value, v._ns3); print_real(value, v._ns3);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_nsfasce >= 3) if (_nsfasce >= 3)
pos = pos + 16; pos = pos + 11;
if (v._ns4 != ZERO) if (v._ns4 != ZERO)
{ {
print_real(value, v._ns4); print_real(value, v._ns4);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_nsfasce >= 4) if (_nsfasce >= 4)
pos = pos + 16; pos = pos + 11;
if (v._ns5 != ZERO) if (v._ns5 != ZERO)
{ {
print_real(value, v._ns5); print_real(value, v._ns5);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
if (_nsfasce >= 5) if (_nsfasce >= 5)
pos = pos + 16; pos = pos + 11;
} }
if (v._ns6 != ZERO) if (v._ns6 != ZERO)
{ {
print_real(value, v._ns6); print_real(value, v._ns6);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
pos = pos + 16; pos = pos + 11;
const real tot = v._s1+v._s2+v._s3+v._s4+v._s5+v._s6+v._ns1+v._ns2+v._ns3+v._ns4+v._ns5+v._ns6; const real tot = v._s1+v._s2+v._s3+v._s4+v._s5+v._s6+v._ns1+v._ns2+v._ns3+v._ns4+v._ns5+v._ns6;
if (tot != ZERO) if (tot != ZERO)
{ {
print_real(value, tot); print_real(value, tot);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
pos = pos + 16; pos = pos + 11;
//if (v._es != ZERO) if (v._es != ZERO)
//{ {
// print_real(value, v._es); print_real(value, v._es);
// rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
//} }
//pos = pos + 16; pos = pos + 11;
if (v._sl != ZERO) if (v._sl != ZERO)
{ {
print_real(value, v._sl); print_real(value, v._sl);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
} }
pos = pos + 16; pos = pos + 13;
if (!what) const real diff = v._sl + v._es - tot;
{
const real diff = tot - v._sl;
if (diff != ZERO) if (diff != ZERO)
{ {
print_real(value, diff); print_real(value, diff);
rw << format("@%dg%15s", pos, (const char*) value); rw << format("@%dg%10s", pos, (const char*) value);
}
} }
if (rw.not_empty()) if (rw.not_empty())
{ {
if (!what) if (!what)
rw.insert(format("%6s@8g%s", (const char*) _cod_pre, (const char*) _des_pre)); {
TString s = _des_pre.left(25);
rw.insert(format("%6s@8g%-25s", (const char*) _cod_pre, (const char*) s));
}
else else
rw.insert("TOTALE GENERALE"); {
TString meno;
const int last_column = calc_last_column();
meno.fill('-', last_column);
set_row(nriga++, meno);
rw.insert("@8gTOTALE GENERALE");
}
set_row(nriga, rw); set_row(nriga, rw);
} }
} }
@ -857,8 +827,10 @@ void TProspettoScadenze::print_header()
// Setta le righe dell'intestazione // Setta le righe dell'intestazione
{ {
int soh = 1; int soh = 1;
const int last_column = calc_last_column();
const long firm = get_firm(); const long firm = get_firm();
TString rw(255); TString rw(last_column);
TString meno(last_column);
reset_header (); reset_header ();
TLocalisamfile ditte(LF_NDITTE); TLocalisamfile ditte(LF_NDITTE);
@ -873,8 +845,8 @@ void TProspettoScadenze::print_header()
TString limop = _limop.string(); TString limop = _limop.string();
TString limscad = _limscad.string(); TString limscad = _limscad.string();
set_header (soh++, "Ditta : %ld %s@158gData@163g%s @190gPag. @#", set_header (soh++, "Ditta : %ld %s@%ldgData %s @%ldgPag. @#",
firm, (const char *)s, (const char *)datas); firm, (const char *)s, last_column - 30, (const char *)datas, last_column - 10);
switch (_tipost) switch (_tipost)
{ {
@ -883,71 +855,77 @@ void TProspettoScadenze::print_header()
{ {
TString s1,s2, s3; TString s1,s2, s3;
int o = 0; // Offset per scaglioni. int o = 0; // Offset per scaglioni.
if (_tipost==fornitori) if (_tipost==fornitori)
set_header(soh++,"@72g** PROSPETTO SCADENZE FORNITORI **"); set_header(soh++,"@%ldg** PROSPETTO SCADENZE FORNITORI **", (last_column - 35) / 2);
else else
set_header(soh++,"@73g** PROSPETTO SCADENZE CLIENTI **"); set_header(soh++,"@%ldg** PROSPETTO SCADENZE CLIENTI **", (last_column - 34) / 2);
set_header (soh++,"@68gAl %s - Operazioni al %s",(const char*)limscad, (const char*)limop); set_header (soh++,"@%ldgAl %s - Operazioni al %s", (last_column - 40) / 2, (const char*)limscad, (const char*)limop);
rw.cut(0); meno.fill('-', last_column);
rw.fill('-'); set_header(soh++,(const char *)meno);
set_header(soh++, (const char *) rw);
set_header(soh,"CODICE@8gC O G N O M E E N O M E "); set_header(soh,"CODICE@8gC O G N O M E E N O M E ");
int limiti[2][NUMERO_FASCE] = LIMITI; int limiti[2][NUMERO_FASCE] = LIMITI;
int row = 0; int row = 0;
if (_tipost==fornitori) if (_tipost==fornitori)
row = 1; row = 1;
int pos = 60; int pos = 40;
rw = "";
rw.cut(0);
if (_sinfasce) if (_sinfasce)
{ {
for (int i = _sfasce-1; i >= 0; i--) for (int i = _sfasce-1; i >= 0; i--)
{ {
rw << format("@%dg%12d gg", pos, limiti[row][i]); rw << format("@%dg%7d gg", pos, limiti[row][i] + 30);
pos = pos + 16; pos = pos + 11;
} }
rw << format("@%dg%15s", pos, "0 gg"); rw << format("@%dg%10s", pos, "30 gg");
set_header(soh, format("@%dg%15s", 60+((pos-60)/2), "SCADUTO")); set_header(soh, format("@%dg%10s", 40+((pos-40)/2), "SCADUTO"));
} }
else else
set_header(soh, format("@%dg%15s", pos, "SCADUTO")); set_header(soh, format("@%dg%10s", pos, "SCADUTO"));
pos = pos + 16; pos = pos + 11;
const int pos_ascad = pos; const int pos_ascad = pos;
if (_nsinfasce) if (_nsinfasce)
{ {
for (int i = 0; i < _nsfasce; i++) for (int i = 0; i < _nsfasce; i++)
{ {
rw << format("@%dg%12d gg", pos, limiti[row][i]); rw << format("@%dg%7d gg", pos, limiti[row][i]);
pos = pos + 16; pos = pos + 11;
} }
set_header(soh, format("@%dg%15s", pos_ascad+((pos-pos_ascad)/2)-5, "A SCADERE")); set_header(soh, format("@%dg%11s", pos_ascad+((pos-pos_ascad)/2)-5, " A SCADERE"));
} }
else else
set_header(soh, format("@%dg%15s", pos, "A SCADERE")); set_header(soh, format("@%dg%11s", pos, " A SCADERE"));
pos = pos + 16; pos = pos + 11;
set_header(soh, format("@%dg%15s", pos, "TOTALE")); set_header(soh, format("@%dg%11s", pos, " TOTALE"));
pos = pos + 16; pos = pos + 11;
//set_header(soh, format("@%dg%15s", pos, "ESPOSTO")); set_header(soh, format("@%dg%11s", pos, " ESPOSTO"));
//pos = pos + 16; pos = pos + 11;
set_header(soh, format("@%dg%15s", pos, "SALDO")); set_header(soh, format("@%dg%11s", pos, " SALDO"));
pos = pos + 16; pos = pos + 13;
set_header(soh, format("@%dg%15s", pos, "DIFFERENZA")); set_header(soh, format("@%dg%11s", pos, "DIFFERENZA"));
set_header(++soh,(const char *)rw); set_header(++soh,(const char *)rw);
break; break;
} }
case altri: // Piano dei conti
{
set_header(soh++,"@79g** SCADENZE **");
set_header (soh++,"@68gAl %s - Operazioni al %s",(const char*)limscad, (const char*)limop);
rw.fill('-');
set_header(soh++, (const char *) rw);
set_header(soh++,"CONTO@16gD E S C R I Z I O N E");
set_header(soh++,(const char *)rw);
break;
}
default: default:
break; break;
} }
set_header(soh,""); set_header(++soh, (const char *) meno);
}
int TProspettoScadenze::calc_last_column()
// Setta le righe dell'intestazione
{
int pos = 110;
if (_sinfasce)
for (int i = _sfasce-1; i >= 0; i--)
pos = pos + 11;
if (_nsinfasce)
for (int i = 0; i < _nsfasce; i++)
pos = pos + 11;
return pos;
} }
void TProspettoScadenze::set_page(int file, int counter) void TProspettoScadenze::set_page(int file, int counter)
@ -957,7 +935,7 @@ void TProspettoScadenze::set_page(int file, int counter)
TProspettoScadenze::TProspettoScadenze() TProspettoScadenze::TProspettoScadenze()
{ {
_rel1=_rel2=NULL; _rel1 = _rel2 = NULL;
} }
int sc2600(int argc, char** argv) int sc2600(int argc, char** argv)

View File

@ -1,3 +1,4 @@
#include <colmask.h>
#include <execp.h> #include <execp.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>

View File

@ -14,7 +14,6 @@ JOIN %ABE TO 33 ALIAS 206 INTO CODTAB==ASPBENI1
JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP
JOIN %TIP TO 33 ALIAS 208 INTO CODTAB==TIPODOC JOIN %TIP TO 33 ALIAS 208 INTO CODTAB==TIPODOC
JOIN %BAN TO 33 ALIAS 209 INTO CODTAB==CODABIA JOIN %BAN TO 33 ALIAS 209 INTO CODTAB==CODABIA
JOIN %NDO TO 33 ALIAS 210 INTO CODTAB==CODNOTESP1
END END
@ -1184,7 +1183,7 @@ STRING 167 40 2
BEGIN BEGIN
KEY "note documento" KEY "note documento"
PROMPT 2 22 "" PROMPT 2 22 ""
FIELD 210@->S0 FIELD NOTE
END END
END END

View File

@ -14,7 +14,6 @@ JOIN %ABE TO 33 ALIAS 206 INTO CODTAB==ASPBENI1
JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP
JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA
JOIN %TIP TO 33 ALIAS 210 INTO CODTAB==TIPODOC JOIN %TIP TO 33 ALIAS 210 INTO CODTAB==TIPODOC
JOIN %NDO TO 33 ALIAS 211 INTO CODTAB==CODNOTESP1
END END
@ -37,7 +36,6 @@ BEGIN
208@->* "Tabella banche agenzia" 208@->* "Tabella banche agenzia"
209@->* "Tabella valute" 209@->* "Tabella valute"
210@->* "Tabella tipo documento" 210@->* "Tabella tipo documento"
211@->* "Tabella note documento"
END END
GENERAL GENERAL
@ -1208,7 +1206,7 @@ STRING 172 50 1
BEGIN BEGIN
KEY "note documento" KEY "note documento"
PROMPT 2 23 "" PROMPT 2 23 ""
FIELD 211@->S0 FIELD NOTE
END END

View File

@ -13,6 +13,8 @@ Item_07 = "Statistiche di vendita", <svmenu.men>
Item_08 = "Servizi", [ACQVEN_021] Item_08 = "Servizi", [ACQVEN_021]
Item_09 = "Configurazione", [ACQVEN_020] Item_09 = "Configurazione", [ACQVEN_020]
Item_10 = "Importazione documenti STORE", <dtmenu.men> Item_10 = "Importazione documenti STORE", <dtmenu.men>
Item_11 = "Trasferimento PACK", <tpmenu.men>
[ACQVEN_001] [ACQVEN_001]
Caption = "Archivi e tabelle di base" Caption = "Archivi e tabelle di base"

View File

@ -11,7 +11,6 @@ JOIN %VET TO 33 ALIAS 205 INTO CODTAB==CODVETT1
JOIN %ABE TO 33 ALIAS 206 INTO CODTAB==ASPBENI1 JOIN %ABE TO 33 ALIAS 206 INTO CODTAB==ASPBENI1
JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP
JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA
JOIN %NDO TO 33 ALIAS 209 INTO CODTAB==CODNOTESP1
END END
DESCRIPTION DESCRIPTION
@ -28,7 +27,6 @@ BEGIN
206@->* "Tabella aspetto beni" 206@->* "Tabella aspetto beni"
207@->* "Tabella causali di trasporto" 207@->* "Tabella causali di trasporto"
208@->* "Tabella banche agenzia" 208@->* "Tabella banche agenzia"
209@->* "Tabella note documento"
END END
GENERAL GENERAL
@ -722,7 +720,7 @@ STRING 123 50 1
BEGIN BEGIN
KEY "note documento" KEY "note documento"
PROMPT 2 10 "" PROMPT 2 10 ""
FIELD 209@->S0 FIELD NOTE
END END
END END

View File

@ -11,7 +11,6 @@ JOIN %VET TO 33 ALIAS 205 INTO CODTAB==CODVETT1
JOIN %ABE TO 33 ALIAS 206 INTO CODTAB==ASPBENI1 JOIN %ABE TO 33 ALIAS 206 INTO CODTAB==ASPBENI1
JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP
JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA
JOIN %NDO TO 33 ALIAS 209 INTO CODTAB==CODNOTESP1
END END
DESCRIPTION DESCRIPTION
@ -28,7 +27,6 @@ BEGIN
206@->* "Tabella aspetto beni" 206@->* "Tabella aspetto beni"
207@->* "Tabella causali di trasporto" 207@->* "Tabella causali di trasporto"
208@->* "Tabella banche agenzia" 208@->* "Tabella banche agenzia"
209@->* "Tabella note documento"
END END
GENERAL GENERAL
@ -724,7 +722,7 @@ STRING 123 50 1
BEGIN BEGIN
KEY "note documento" KEY "note documento"
PROMPT 2 9 "" PROMPT 2 9 ""
FIELD 209@->S0 FIELD NOTE
END END
END END

View File

@ -55,6 +55,7 @@ class TViswin;
#define RIGA_SCONTI 'C' #define RIGA_SCONTI 'C'
#define RIGA_OMAGGI 'O' #define RIGA_OMAGGI 'O'
#define RIGA_DESCRIZIONI 'D' #define RIGA_DESCRIZIONI 'D'
#define RIGA_RETTIFICHE 'T'
#define MAX_IVA_SLICES 5 #define MAX_IVA_SLICES 5

View File

@ -19,8 +19,7 @@ TCodice_numerazione::TCodice_numerazione(const TRectype& rec)
{ } { }
TCodice_numerazione::~TCodice_numerazione() TCodice_numerazione::~TCodice_numerazione()
{ { }
}
const TString& TCodice_numerazione::tipo_doc(int i) const const TString& TCodice_numerazione::tipo_doc(int i) const
{ {
@ -210,7 +209,7 @@ bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & v
{ {
if (signal) // Se richiesto segnala l'errore if (signal) // Se richiesto segnala l'errore
warning_box( "Espressione di sconto non valida. Errore sul carattere %c.", errorchar); warning_box( "Espressione di sconto non valida. Errore sul carattere %c.", errorchar);
val_perc = 1.0; // Azzera la sequenza di percentuali val_perc = UNO; // Azzera la sequenza di percentuali
goodexp = ""; goodexp = "";
} }
} }
@ -220,14 +219,12 @@ bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & v
real prezzo_scontato(const real& prezzo, const char * sconto) real prezzo_scontato(const real& prezzo, const char * sconto)
{ {
real scontato = prezzo; real scontato = prezzo;
if (sconto && *sconto) if (sconto && *sconto)
{ {
TString80 exp; TString80 exp;
real val_sconto; real val_sconto;
scontoexpr2perc(sconto, FALSE , exp, val_sconto); scontoexpr2perc(sconto, FALSE , exp, val_sconto);
scontato *= val_sconto;
scontato = val_sconto * prezzo;
} }
return scontato; return scontato;
} }

View File

@ -143,6 +143,7 @@ void TTipo_riga_documento::read_formule()
_field_provv = profile.get("PROVV"); _field_provv = profile.get("PROVV");
_field_qta = profile.get("QTA"); // Non dare un default: ingannerebbe il tipo documento _field_qta = profile.get("QTA"); // Non dare un default: ingannerebbe il tipo documento
_field_qtaevasa = profile.get("QTAEVASA"); // Non dare un default: ingannerebbe il tipo documento _field_qtaevasa = profile.get("QTAEVASA"); // Non dare un default: ingannerebbe il tipo documento
_field_imposta = profile.get("IMPOSTA");
_incrp = profile.get_int("VARP+"); _incrp = profile.get_int("VARP+");
_decrp = profile.get_int("VARP-"); _decrp = profile.get_int("VARP-");
@ -160,13 +161,13 @@ TFormula_documento * TTipo_riga_documento::succ_formula(bool restart)
if (formula.not_empty()) if (formula.not_empty())
{ {
char *expr = NULL; char *expr = NULL;
const int p = formula.find("="); const int p = formula.find('=');
if (p > 0) if (p > 0)
{ {
expr = (char *) (const char *) formula + p; expr = (char*)(const char*)formula + p;
*expr = '\0'; expr++; *expr = '\0'; expr++;
} }
TFormula_documento * o = (TFormula_documento*)_formule_riga.objptr(formula); TFormula_documento* o = (TFormula_documento*)_formule_riga.objptr(formula);
if (o == NULL) if (o == NULL)
{ {
o = new TFormula_documento(_riga, formula, expr); o = new TFormula_documento(_riga, formula, expr);
@ -262,7 +263,7 @@ const TSpesa_prest & TRiga_documento::spesa() const
const TCodiceIVA & TRiga_documento::iva(const char *codice) const TCodiceIVA & TRiga_documento::iva(const char *codice)
{ {
TCodiceIVA * v = (TCodiceIVA *) _ive.objptr(codice); TCodiceIVA * v = (TCodiceIVA *)_ive.objptr(codice);
if (v == NULL) if (v == NULL)
{ {
v = new TCodiceIVA(codice); v = new TCodiceIVA(codice);
@ -581,10 +582,24 @@ real TRiga_documento::iva(int ndec) const
{ {
real zanicchi; real zanicchi;
if (!is_sconto()) if (!is_sconto())
{
if (is_omaggio())
zanicchi = iva_omaggio(ndec);
else
{ {
if (ndec == AUTO_DECIMALS) if (ndec == AUTO_DECIMALS)
ndec = doc().decimals(); ndec = doc().decimals();
zanicchi = is_omaggio() ? iva_omaggio(ndec) : iva().imposta(imponibile(), ndec); const TString& field = tipo().imposta();
if (field.not_empty())
{
zanicchi = get_real(field);
zanicchi.round(ndec);
}
else
{
zanicchi = iva().imposta(imponibile(), ndec);
}
}
} }
return zanicchi; return zanicchi;
} }

View File

@ -10,6 +10,7 @@
#include "vepriv.h" #include "vepriv.h"
#include "veuml.h" #include "veuml.h"
#include <cfven.h>
#include "../cg/cg2103.h" #include "../cg/cg2103.h"
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#include "../mg/mglib.h" #include "../mg/mglib.h"
@ -106,16 +107,13 @@ TRiepilogo_iva& TRiepilogo_iva::copy(const TRiepilogo_iva& a)
TRiepilogo_iva::TRiepilogo_iva(const TCodiceIVA & codiva) : _codiva(codiva) TRiepilogo_iva::TRiepilogo_iva(const TCodiceIVA & codiva) : _codiva(codiva)
{ {
const TString & t =_codiva.tipo(); const TString& t =_codiva.tipo();
if (t == "VE") if (t == "VE")
_tipo = 2; _tipo = 2; else
else
if (t == "ES") if (t == "ES")
_tipo = 4; _tipo = 4; else
else
if (t == "NI") if (t == "NI")
_tipo = 8; _tipo = 8; else
else
if (t == "NS") if (t == "NS")
_tipo = 16; _tipo = 16;
else else
@ -146,8 +144,8 @@ HIDDEN TAgenti_cache * _agenti = NULL;
long TDocumento::_firm = -1; long TDocumento::_firm = -1;
TAssoc_array TDocumento::_tipi; TAssoc_array TDocumento::_tipi;
TAssoc_array TDocumento::_numerazioni; TAssoc_array TDocumento::_numerazioni;
TString16 TDocumento::_codiva_spese; TString4 TDocumento::_codiva_spese;
TString16 TDocumento::_codiva_bolli; TString4 TDocumento::_codiva_bolli;
short TDocumento::_has_mag = 3; short TDocumento::_has_mag = 3;
short TDocumento::_has_stat_ven = 3; short TDocumento::_has_stat_ven = 3;
short TDocumento::_has_provv = 3; short TDocumento::_has_provv = 3;
@ -616,7 +614,7 @@ void TDocumento::copy_contents(const TDocumento& src)
TRiga_documento& TDocumento::insert_row(int row, const char *tipo) TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
{ {
TRiga_documento & r = (TRiga_documento &) TMultiple_rectype::insert_row(row); // ok TRiga_documento & r = (TRiga_documento &) TMultiple_rectype::insert_row(row); // ok
if (tipo) if (tipo && *tipo)
r.set_tipo(tipo); r.set_tipo(tipo);
return r; return r;
} }
@ -624,7 +622,7 @@ TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
TRiga_documento& TDocumento::new_row(const char *tipo) TRiga_documento& TDocumento::new_row(const char *tipo)
{ {
TRiga_documento & r = (TRiga_documento&)TMultiple_rectype::new_row(); // ok TRiga_documento & r = (TRiga_documento&)TMultiple_rectype::new_row(); // ok
if (tipo) if (tipo && *tipo)
r.set_tipo(tipo); r.set_tipo(tipo);
return r; return r;
} }
@ -796,10 +794,12 @@ void TDocumento::dirty_fields()
f != NULL; f = (TDocumento_variable_field *) succ_variable_field()) f != NULL; f = (TDocumento_variable_field *) succ_variable_field())
f->set_dirty(); f->set_dirty();
dirty_tabella_iva(); dirty_tabella_iva();
for (int i = loaded_rows(); i > 0; i--) TRecord_array& righe = body(LF_RIGHEDOC);
for (int i = righe.last_row(); i > 0; i = righe.pred_row(i))
{ {
TRiga_documento & r = (TRiga_documento &) row(i); TRiga_documento & r = (TRiga_documento &) row(i);
r.dirty_fields(false); r.dirty_fields(false);
} }
_dirty_deny = true; _dirty_deny = true;
} }
@ -1692,8 +1692,8 @@ void TDocumento::update_tabella_iva()
const bool doc_al_lordo = tipo().calcolo_lordo(); const bool doc_al_lordo = tipo().calcolo_lordo();
const int ndec = decimals(); const int ndec = decimals();
const bool fatt_comm = tipo().fattura_commerciale(); const bool fatt_comm = tipo().fattura_commerciale();
TString4 codiva_es;
TString4 codiva_es;
iva_esente(codiva_es); iva_esente(codiva_es);
for (int i = items; i > 0; i--) for (int i = items; i > 0; i--)
{ {
@ -1713,7 +1713,7 @@ void TDocumento::update_tabella_iva()
const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE); const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE);
// Aggiorna o aggiunge l'elemento se non esiste // Aggiorna o aggiunge l'elemento se non esiste
const TCodiceIVA & iva = r.iva(); const TCodiceIVA & iva = r.iva();
const TString16 cod(iva.codice()); const TString4 cod(iva.codice());
if (cod.not_empty()) if (cod.not_empty())
{ {
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) table.objptr(cod); TRiepilogo_iva * aliquota = (TRiepilogo_iva *) table.objptr(cod);
@ -1889,6 +1889,7 @@ real TDocumento::imposta(bool spese, int ndec) const
real TDocumento::totale_doc() const real TDocumento::totale_doc() const
{ {
/* A pag.1 c'e' scritto di non fare cosi'
const TString16 field(tipo().totale_doc()); const TString16 field(tipo().totale_doc());
if (field.not_empty()) if (field.not_empty())
@ -1902,6 +1903,21 @@ real TDocumento::totale_doc() const
r += bolli(real(r - ritenute()), ndec); r += bolli(real(r - ritenute()), ndec);
return r; return r;
} }
*/
// Cosi' e' piu' ordinato, strutturato e veloce
real r;
const TString& field = tipo().totale_doc();
if (field.blank())
{
const int ndec = decimals();
r = imponibile() + imposta();
r += spese_incasso(ndec);
r += bolli(real(r - ritenute()), ndec);
}
else
r = get_real(field);
return r;
} }
real TDocumento::totale_netto() const real TDocumento::totale_netto() const
@ -2128,7 +2144,8 @@ TRecord_array& TDocumento::body(int logicnum) const
const TString80 codcos(get(DOC_CODCOSTO)); const TString80 codcos(get(DOC_CODCOSTO));
const bool order = is_ordine(); const bool order = is_ordine();
for (int i = r.rows(); i > 0; i--) for (int i = r.last_row(); i > 0; i = r.pred_row(i))
{ {
TRectype& rec = r[i]; TRectype& rec = r[i];
TRecfield dcons(rec, RDOC_DATACONS); TRecfield dcons(rec, RDOC_DATACONS);
@ -2176,7 +2193,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
sh->destroy(i - 1); sh->destroy(i - 1);
} }
} }
TString16 cod_iva_cli; TString4 cod_iva_cli;
const int nspese = spese_aut.items(); const int nspese = spese_aut.items();
if (nspese > 0) if (nspese > 0)
{ {
@ -2247,8 +2264,13 @@ real TDocumento::calc_conai_qta(int type)
{ {
const char * const __conai_art_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"}; const char * const __conai_art_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
const char * const __conai_cf_names[] = {"ESACC", "ESALL", "ESCAR", "ESPLA", "ESLEG", "ESVET"}; const char * const __conai_cf_names[] = {"ESACC", "ESALL", "ESCAR", "ESPLA", "ESLEG", "ESVET"};
const real perc_esenz = clifor().vendite().get_real(__conai_cf_names[type]); real perc_esenz = clifor().vendite().get_real(__conai_cf_names[type]);
real qta = ZERO; real qta = ZERO;
const TDate datadoc = get_date(DOC_DATADOC);
const TDate dataes = clifor().vendite().get_date(CFV_DATAECONAI);
if (dataes.ok() && datadoc > dataes)
perc_esenz = ZERO;
if (perc_esenz < 100.0) if (perc_esenz < 100.0)
{ {
@ -2259,16 +2281,15 @@ real TDocumento::calc_conai_qta(int type)
TArticolo_giacenza * art = r.articolo(); TArticolo_giacenza * art = r.articolo();
if (art != NULL) if (art != NULL)
{ {
const real row_qta = r.get_real(RDOC_QTA); const TString16 um = r.get(RDOC_UMQTA);
const real row_qta = art->convert_to_um(r.get_real(RDOC_QTA), NULL, um);
qta += row_qta*art->get_real(__conai_art_names[type]); qta += row_qta*art->get_real(__conai_art_names[type]);
} }
} }
if (qta > ZERO) if (qta > ZERO)
{
// qta *= (1 - perc_esenz/100.0);
qta = qta * (100 - perc_esenz) / 100.0; // More precise! qta = qta * (100 - perc_esenz) / 100.0; // More precise!
} }
}
return qta; return qta;
} }
@ -2322,7 +2343,7 @@ void TDocumento::update_conai()
// Genera nuove righe // Genera nuove righe
if (cli_add_conai) if (cli_add_conai)
{ {
const TString16 cod_iva_cli = clifor().vendite().get("ASSFIS"); const TString4 cod_iva_cli = clifor().vendite().get("ASSFIS");
TSpesa_prest sp; TSpesa_prest sp;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
@ -2389,7 +2410,7 @@ bool TDocumento::is_nota_credito() const
swap = TRUE; swap = TRUE;
else else
{ {
const TString16 codcaus(tipo().causale()); const TString4 codcaus(tipo().causale());
if (codcaus.not_empty()) if (codcaus.not_empty())
{ {
TLocalisamfile caus(LF_CAUSALI); TLocalisamfile caus(LF_CAUSALI);

View File

@ -806,9 +806,7 @@ TObject* TExpr_documento::dup() const
TFormula_documento::TFormula_documento(TTipo_formula tipo, const char* codice, const char * expr, bool numexpr) TFormula_documento::TFormula_documento(TTipo_formula tipo, const char* codice, const char * expr, bool numexpr)
: TRectype(LF_TABCOM), _expr(NULL) : TRectype(LF_TABCOM), _expr(NULL)
{ {
_tab = tipo == _documento ? "FRD" : "FRR"; settab(tipo == _documento ? "FRD" : "FRR");
settab(_tab);
_tab.insert("%");
if (codice && *codice) if (codice && *codice)
read(codice, expr, numexpr); read(codice, expr, numexpr);
} }
@ -816,15 +814,19 @@ TFormula_documento::TFormula_documento(TTipo_formula tipo, const char* codice, c
TFormula_documento::TFormula_documento(const TRectype& rec) TFormula_documento::TFormula_documento(const TRectype& rec)
: TRectype(rec), _expr(NULL) : TRectype(rec), _expr(NULL)
{ {
_tab = "%";
_tab << rec.get("COD");
const TTypeexp et = expr_type(); const TTypeexp et = expr_type();
_expr = new TExpr_documento(expr_string(), et); _expr = new TExpr_documento(expr_string(), et);
} }
TObject* TFormula_documento::dup() const
{
return new TFormula_documento(*this);
}
TFormula_documento::~TFormula_documento() TFormula_documento::~TFormula_documento()
{ {
if (_expr) delete _expr; if (_expr)
delete _expr;
} }
int TFormula_documento::read(const char* codice, const char * expr, bool numexpr) int TFormula_documento::read(const char* codice, const char * expr, bool numexpr)
@ -846,7 +848,8 @@ int TFormula_documento::read(const char* codice, const char * expr, bool numexpr
} }
else else
{ {
TTable t(_tab); TString4 cod; cod << '%' << get("COD");
TTable t(cod);
err = TRectype::read(t); err = TRectype::read(t);
} }

View File

@ -8,6 +8,7 @@
#include "velib04.h" #include "velib04.h"
#include "../ca/calib01.h" #include "../ca/calib01.h"
#include "../cg/cg2103.h" #include "../cg/cg2103.h"
#include "../cg/cglib02.h" #include "../cg/cglib02.h"
#include "../cg/cgsaldac.h" #include "../cg/cgsaldac.h"
@ -64,6 +65,7 @@ bool TMovimentoPN_VE::detraibile(TRectype& rec) const
int TMovimentoPN_VE::bill2pos(const TBill& conto, char tipo) int TMovimentoPN_VE::bill2pos(const TBill& conto, char tipo)
{ {
const int items = cg_items(); const int items = cg_items();
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)
{ {
TRectype& s = cg(i); TRectype& s = cg(i);
@ -442,7 +444,7 @@ bool TMovimentoPN_VE::movement_ok()
int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus) int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
{ {
const int righe = iva_items(); const int righe = iva_items();
TRectype& head = lfile().curr(); const TRectype& head = curr();
set_caus(&caus); set_caus(&caus);
for (int i=0; i<righe; i++) for (int i=0; i<righe; i++)
@ -1114,8 +1116,8 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
key.add(doc.get(DOC_TIPOCF)); key.add(doc.get(DOC_TIPOCF));
key.add(doc.get(DOC_CODCF)); key.add(doc.get(DOC_CODCF));
const TRectype& cfven = cache().get(LF_CFVEN, key); const TRectype& cfven = cache().get(LF_CFVEN, key);
const TString& caus_cli = cfven.get(doc.is_nota_credito() ? CFV_CODCAUSNC : CFV_CODCAUS);
const TString& caus_cli = cfven.get(doc.is_nota_credito() ? CFV_CODCAUSNC : CFV_CODCAUS);
if (caus_cli.not_empty()) if (caus_cli.not_empty())
codcaus = caus_cli; // La causale del cliente prevale su quella del tipo documento codcaus = caus_cli; // La causale del cliente prevale su quella del tipo documento
@ -1192,6 +1194,9 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
TDate datacam(doc.get_date(DOC_DATACAMBIO)); TDate datacam(doc.get_date(DOC_DATACAMBIO));
real cambio(doc.cambio()); real cambio(doc.cambio());
TString4 codval(doc.valuta()); codval.trim(); TString4 codval(doc.valuta()); codval.trim();
codval.trim();
if (!doc.in_valuta()) if (!doc.in_valuta())
{ {
codval = ""; codval = "";
@ -1249,6 +1254,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
const TString4 codpag(doc.get(DOC_CODPAG)); const TString4 codpag(doc.get(DOC_CODPAG));
if (sc_enabled(data_reg) || codpag.not_empty()) // La condizione di pagamento va controllata if (sc_enabled(data_reg) || codpag.not_empty()) // La condizione di pagamento va controllata
{ // se e' abilitato il saldaconto o se e' stata inserita { // se e' abilitato il saldaconto o se e' stata inserita
_cpg->put("CODTAB",codpag); _cpg->put("CODTAB",codpag);
if (_cpg->read() != NOERR) if (_cpg->read() != NOERR)
{ {
@ -1296,7 +1302,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
if (_caus->iva() == iva_acquisti) if (_caus->iva() == iva_acquisti)
{ {
const TString16 tdoc_cont(doc.tipo().totale_doc_cont()); const TString& tdoc_cont = doc.tipo().totale_doc_cont();
if (tdoc_cont.not_empty()) if (tdoc_cont.not_empty())
totdocval.set_num(doc.get_real(tdoc_cont)); totdocval.set_num(doc.get_real(tdoc_cont));
@ -1324,10 +1330,9 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
if (_caus->valintra() && codvali.empty()) if (_caus->valintra() && codvali.empty())
{ {
codvali = TCurrency::get_firm_val(); codvali = TCurrency::get_firm_val();
if (codvali.empty()) if (codvali.empty())
codvali = TCurrency::get_euro_val(); codvali = TCurrency::get_euro_val();
cambioi = 1.00; cambioi = UNO;
} }
mov_rec.put(MOV_CODVALI,codval); mov_rec.put(MOV_CODVALI,codval);
@ -1528,8 +1533,8 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
} }
// Dati del cliente... // Dati del cliente...
TString16 tipocf(doc.get(DOC_TIPOCF)); const TString4 tipocf(doc.get(DOC_TIPOCF));
long codcf = doc.get_long(DOC_CODCF); const long codcf = doc.get_long(DOC_CODCF);
TString80 occas; TString80 occas;
{ {
TLocalisamfile& cli_file = _clifo->lfile(); TLocalisamfile& cli_file = _clifo->lfile();
@ -1817,45 +1822,47 @@ error_type TContabilizzazione::add_spese_inbo(TDocumento& doc, const int ndec)
real tot_netto, sp_incasso, sp_bolli; real tot_netto, sp_incasso, sp_bolli;
real iva_sp_incasso, iva_sp_bolli; real iva_sp_incasso, iva_sp_bolli;
const real rit = doc.ritenute(); const real rit = doc.ritenute();
bool is_cli = doc.get_char(DOC_TIPOCF) == 'C'; const bool is_cli = doc.get_char(DOC_TIPOCF) == 'C';
// Aggiunge le spese d'incasso // Aggiunge le spese d'incasso
tot_netto = doc.totale_netto(); tot_netto = doc.totale_netto();
sp_incasso = doc.spese_incasso(ndec, _netto); sp_incasso = doc.spese_incasso(ndec, _netto);
TString16 codiva_es; TString4 codiva_es;
doc.iva_esente(codiva_es); doc.iva_esente(codiva_es);
if (sp_incasso != 0.0) if (!sp_incasso.is_zero())
calculate_spese(sp_incasso,iva_sp_incasso,ndec,true,is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_spese(), doc); calculate_spese(sp_incasso,iva_sp_incasso,ndec,true,is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_spese(), doc);
// Aggiunge le spese bolli // Aggiunge le spese bolli
tot_netto += sp_incasso + iva_sp_incasso - rit; tot_netto += sp_incasso + iva_sp_incasso - rit;
sp_bolli = doc.bolli(tot_netto, ndec, _netto); sp_bolli = doc.bolli(tot_netto, ndec, _netto);
if (sp_bolli != 0) if (!sp_bolli.is_zero())
calculate_spese(sp_bolli, iva_sp_bolli, ndec, false, is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_bolli(), doc); calculate_spese(sp_bolli, iva_sp_bolli, ndec, false, is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_bolli(), doc);
return _error; return _error;
} }
// Aggiorna le righe di sconto (importo o a percentuale) // Aggiorna le righe di sconto (importo o a percentuale)
error_type TContabilizzazione::adjust_sconto_rows(TDocumento& doc) error_type TContabilizzazione::adjust_sconto_rows(TDocumento& doc)
{ {
TAssoc_array aa = doc.tabella_iva(); // no reference
const TRiepilogo_iva* riep;
TString16 cod; // Codice IVA corrente
real sconto;
const int ndec = doc.decimals();
if (!_sco_imp_bill.ok() || !_sco_perc_bill.ok()) if (!_sco_imp_bill.ok() || !_sco_perc_bill.ok())
{ {
_error = sconto_error; _error = sconto_error;
return _error; return _error;
} }
TAssoc_array aa = doc.tabella_iva(); // no reference
real sconto;
const int ndec = doc.decimals();
// Scorre tutti gli elementi della tabella IVA del documento (elementi per codice iva) // Scorre tutti gli elementi della tabella IVA del documento (elementi per codice iva)
for (riep = (TRiepilogo_iva*) aa.first_item(); riep != NULL; riep = (TRiepilogo_iva*) aa.succ_item()) for (const TRiepilogo_iva* riep = (const TRiepilogo_iva*) aa.first_item();
riep != NULL; riep = (const TRiepilogo_iva*) aa.succ_item())
{ {
cod = riep->cod_iva().codice(); // Codice IVA const TString4 cod = riep->cod_iva().codice(); // Codice IVA corrente
for (int i = 0; i < 2; i++) // Ciclo per sconto a percentuale (i == 0) e ad importo (i == 1) for (int i = 0; i < 2; i++) // Ciclo per sconto a percentuale (i == 0) e ad importo (i == 1)
{ {
//Importo sconto (sconto_perc() o sconto_imp()) //Importo sconto (sconto_perc() o sconto_imp())
@ -1863,7 +1870,7 @@ error_type TContabilizzazione::adjust_sconto_rows(TDocumento& doc)
//Somma alla riga corrispondente o la crea se non esiste gia' //Somma alla riga corrispondente o la crea se non esiste gia'
//I conti per aggiustare l'iva vengono fatti in adjust_iva_rows() //I conti per aggiustare l'iva vengono fatti in adjust_iva_rows()
const bool perc = i == 0; const bool perc = i == 0;
TBill& conto = perc ? _sco_perc_bill : _sco_imp_bill; const TBill& conto = perc ? _sco_perc_bill : _sco_imp_bill;
sconto = perc ? -riep->sconto_perc() : -riep->sconto_imp(); sconto = perc ? -riep->sconto_perc() : -riep->sconto_imp();
if (sconto != ZERO) if (sconto != ZERO)
{ {
@ -1967,7 +1974,7 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
for (i = 0; i < items; i++) for (i = 0; i < items; i++)
{ {
TRectype& ie = _movimento->iva(i); const TRectype& ie = _movimento->iva(i);
if (ie.get(RMI_CODIVA) == codiva) // Se il codice IVA e' uguale if (ie.get(RMI_CODIVA) == codiva) // Se il codice IVA e' uguale
{ {
gd_iva.add(ie.get_real(RMI_IMPOSTA)); // Aggiunge al TGeneric_distrib l'imposta corrente gd_iva.add(ie.get_real(RMI_IMPOSTA)); // Aggiunge al TGeneric_distrib l'imposta corrente
@ -2003,7 +2010,7 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
{ {
TRectype& rigaiva = _movimento->iva(0); TRectype& rigaiva = _movimento->iva(0);
TCodiceIVA iva(rigaiva.get(RMI_CODIVA)); const TCodiceIVA iva(rigaiva.get(RMI_CODIVA));
if (_caus->intra()) if (_caus->intra())
{ {
@ -2020,10 +2027,9 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
} }
if (_caus->intra()) if (_caus->intra())
{ {
real ritfis = ZERO; real ritfis;
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)
ritfis += _movimento->iva(i).get_real(RMI_IMPOSTA); ritfis += _movimento->iva(i).get_real(RMI_IMPOSTA);
_movimento->curr().put(MOV_RITFIS, ritfis); _movimento->curr().put(MOV_RITFIS, ritfis);
} }
} }
@ -2039,7 +2045,7 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc)
TRectype& head = _movimento->curr(); TRectype& head = _movimento->curr();
TToken_string key; TToken_string key;
TString_array key_arr; TString_array key_arr;
TString16 codiva; TString4 codiva;
TBill cur_conto; TBill cur_conto;
char tipo; char tipo;
int gruppo; int gruppo;
@ -2049,17 +2055,15 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc)
const long numreg = head.get_long(MOV_NUMREG); const long numreg = head.get_long(MOV_NUMREG);
real cambio = head.get_real(MOV_CAMBIO); real cambio = head.get_real(MOV_CAMBIO);
real imponibile,imposta; real imponibile,imposta;
TString16 valuta(doc.valuta()); const TString4 valuta(doc.valuta());
_righe_iva->get_keys(key_arr); _righe_iva->get_keys(key_arr);
key_arr.sort(); key_arr.sort();
TRectype & cur = (TRectype &) (*_righe_iva)[key_arr.row(0)];
for (int i = 0, nr = 0; i < items; i++) for (int i = 0, nr = 0; i < items; i++)
{ {
key = key_arr.row(i); key = key_arr.row(i);
cur = (TRectype &) (*_righe_iva)[key]; const TRectype& cur = (const TRectype &)(*_righe_iva)[key];
codiva = cur.get(RMI_CODIVA); codiva = cur.get(RMI_CODIVA);
tipo = cur.get_char(RMI_TIPOC); tipo = cur.get_char(RMI_TIPOC);
gruppo = cur.get_int(RMI_GRUPPO); gruppo = cur.get_int(RMI_GRUPPO);
@ -2107,14 +2111,14 @@ error_type TContabilizzazione::create_total_doc_row(TDocumento& doc)
// Crea la riga contabile di totale documento // Crea la riga contabile di totale documento
{ {
TRectype& rec_cg = _movimento->cg(0); TRectype& rec_cg = _movimento->cg(0);
TRectype& head = _movimento->lfile().curr(); TRectype& head = _movimento->curr();
const int annoes = head.get_int(MOV_ANNOES); const int annoes = head.get_int(MOV_ANNOES);
const long numreg = head.get_long(MOV_NUMREG); const long numreg = head.get_long(MOV_NUMREG);
TDate datareg(head.get_date(MOV_DATAREG)); const TDate datareg(head.get_date(MOV_DATAREG));
real totdoc(head.get_real(MOV_TOTDOC)); real totdoc(head.get_real(MOV_TOTDOC));
TLocalisamfile& cli_file = _clifo->lfile(); const TRectype& cli_file = _clifo->curr();
TString16 tipocf(cli_file.get(CLI_TIPOCF)); char tipocf = cli_file.get_char(CLI_TIPOCF);
long codcf = cli_file.get_long(CLI_CODCF); long codcf = cli_file.get_long(CLI_CODCF);
int gruppo = 0, conto = 0; int gruppo = 0, conto = 0;
@ -2122,7 +2126,7 @@ error_type TContabilizzazione::create_total_doc_row(TDocumento& doc)
if (search_clifo_bill(catven) == no_error) if (search_clifo_bill(catven) == no_error)
{ {
tipocf[0] = _co_cliente.tipo(); tipocf = _co_cliente.tipo();
gruppo = _co_cliente.gruppo(); gruppo = _co_cliente.gruppo();
conto = _co_cliente.conto(); conto = _co_cliente.conto();
codcf = _co_cliente.sottoconto(); codcf = _co_cliente.sottoconto();
@ -2136,7 +2140,7 @@ error_type TContabilizzazione::create_total_doc_row(TDocumento& doc)
TConto contro; TConto contro;
if (_movimento->iva_items() > 0) if (_movimento->iva_items() > 0)
{ {
TRectype& first_iva_row = _movimento->iva(0); const TRectype& first_iva_row = _movimento->iva(0);
contro.get(first_iva_row); contro.get(first_iva_row);
} }
@ -2149,7 +2153,7 @@ error_type TContabilizzazione::create_total_doc_row(TDocumento& doc)
contro.put(rec_cg, true); contro.put(rec_cg, true);
rec_cg.put(RMV_IMPORTO,totdoc); rec_cg.put(RMV_ROWTYPE,"T"); rec_cg.put(RMV_IMPORTO,totdoc); rec_cg.put(RMV_ROWTYPE,"T");
if (tipocf == " ") if (tipocf <= ' ')
{ {
head.zero(MOV_TIPO); head.zero(MOV_TIPO);
head.zero(MOV_CODCF); head.zero(MOV_CODCF);
@ -2197,8 +2201,9 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
{ {
const char tipo = r.tipo().tipo(); const char tipo = r.tipo().tipo();
// Le righe omaggio senza addebito IVA vanno saltate // Le righe omaggio senza addebito IVA vanno saltate
const bool riga_omaggio = tipo == 'O' && r.get_bool(RDOC_ADDIVA); const bool riga_omaggio = tipo == RIGA_OMAGGI && r.get_bool(RDOC_ADDIVA);
if ((tipo != RIGA_DESCRIZIONI && tipo != RIGA_SCONTI) || riga_omaggio) if ((tipo != RIGA_DESCRIZIONI && tipo != RIGA_SCONTI && tipo != RIGA_RETTIFICHE) || riga_omaggio)
{ {
const bool spesa = r.tipo().tipo() == RIGA_SPESEDOC; const bool spesa = r.tipo().tipo() == RIGA_SPESEDOC;
char tipo_rit = '\0'; char tipo_rit = '\0';
@ -2328,7 +2333,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
} }
} }
TRegistro & registro = _caus->reg(); const TRegistro& registro = _caus->reg();
const bool iva_mov = registro.ok(); const bool iva_mov = registro.ok();
if (!iva_mov) if (!iva_mov)
@ -2336,7 +2341,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
const int cgitems = _movimento->cg_items(); const int cgitems = _movimento->cg_items();
for (int i = cgitems - 1 ; i >= 0; i--) for (int i = cgitems - 1 ; i >= 0; i--)
{ {
TRectype & rec_cg = _movimento->cg(i); TRectype& rec_cg = _movimento->cg(i);
rec_cg.zero(RMV_ROWTYPE); rec_cg.zero(RMV_ROWTYPE);
} }
_movimento->destroy_iva_row(); _movimento->destroy_iva_row();
@ -2344,9 +2349,10 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
return _error; return _error;
} }
error_type TContabilizzazione::compile_rows_mov_re(TDocumento& doc)
// Compila le righe // Compila le righe
error_type TContabilizzazione::compile_rows_mov_re(TDocumento& doc)
{ {
const int rows = doc.rows(); const int rows = doc.rows();
const int ndec = doc.decimals(); const int ndec = doc.decimals();
@ -2357,12 +2363,13 @@ error_type TContabilizzazione::compile_rows_mov_re(TDocumento& doc)
const TString4 tiporiga = r.get(RDOC_TIPORIGA); const TString4 tiporiga = r.get(RDOC_TIPORIGA);
if (valid_row_type(tiporiga)) // controlla l'esistenza della riga if (valid_row_type(tiporiga)) // controlla l'esistenza della riga
{ {
TBill conto;
const char tipo = r.tipo().tipo(); const char tipo = r.tipo().tipo();
// Le righe omaggio senza addebito IVA vanno saltate // Le righe omaggio senza addebito IVA vanno saltate
const bool riga_omaggio = tipo == 'O' && r.get_bool(RDOC_ADDIVA); const bool riga_omaggio = tipo == RIGA_OMAGGI && r.get_bool(RDOC_ADDIVA);
if ((tipo != 'D' && tipo != 'C') && !riga_omaggio) if ((tipo != RIGA_DESCRIZIONI && tipo != RIGA_SCONTI && tipo != RIGA_RETTIFICHE) && !riga_omaggio)
{ {
TBill conto;
search_costo_ricavo(conto,r); // l'errore eventuale viene settato qui dentro search_costo_ricavo(conto,r); // l'errore eventuale viene settato qui dentro
if (good()) if (good())
_righe_iva->add(r, conto); _righe_iva->add(r, conto);
@ -2415,7 +2422,7 @@ error_type TContabilizzazione::change_doc_status(TDocumento& doc)
error_type TContabilizzazione::write_scadenze(TDocumento& doc) error_type TContabilizzazione::write_scadenze(TDocumento& doc)
// Scrive le scadenze. Liberamente tratto da cg2104.cpp. // Scrive le scadenze. Liberamente tratto da cg2104.cpp.
{ {
TRectype& head = _movimento->curr(); const TRectype& head = _movimento->curr();
const long nreg = head.get_long(MOV_NUMREG); const long nreg = head.get_long(MOV_NUMREG);
// const real change(head.get_real(MOV_CAMBIO)); // const real change(head.get_real(MOV_CAMBIO));
@ -3561,7 +3568,7 @@ void TContabilizzazione::aggiorna_saldi(TSaldo_agg& saldo, TMovimentoPN& mv, boo
for (int i = 0; i < cgitems; i++) for (int i = 0; i < cgitems; i++)
{ {
const TRectype& r = mv.cg(i); const TRectype& r = mv.cg(i);
TBill conto; conto.get(r); const TBill conto(r);
TImporto import(r.get_char(RMV_SEZIONE), r.get_real(RMV_IMPORTO)); TImporto import(r.get_char(RMV_SEZIONE), r.get_real(RMV_IMPORTO));
saldo.aggiorna(conto, import, save); saldo.aggiorna(conto, import, save);
} }
@ -3827,6 +3834,7 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
p.links().add("Movimento Analitico |r|w", 1); p.links().add("Movimento Analitico |r|w", 1);
p.setlinkhandler(link_handler); p.setlinkhandler(link_handler);
_viswin = new TViswin(NULL, TR("Contabilizzazione documenti"), false, true, true); _viswin = new TViswin(NULL, TR("Contabilizzazione documenti"), false, true, true);
_viswin->open_modal(); _viswin->open_modal();
const clock_t start_time = clock(); const clock_t start_time = clock();

View File

@ -1,4 +1,5 @@
#include <automask.h> #include <automask.h>
#include <colmask.h>
#include <dongle.h> #include <dongle.h>
#include <execp.h> #include <execp.h>
#include <modaut.h> #include <modaut.h>
@ -27,6 +28,7 @@
#include "doc.h" #include "doc.h"
#include "rdoc.h" #include "rdoc.h"
class TOriginal_row_mask : public TAutomask class TOriginal_row_mask : public TAutomask
{ {
@ -999,6 +1001,7 @@ void TDocumento_mask::mask2doc()
if (fr) if (fr)
fr->write(f.get(), doc()); fr->write(f.get(), doc());
} }
} }
TVariable_mask* TDocumento_mask::riga_mask(int numriga) TVariable_mask* TDocumento_mask::riga_mask(int numriga)

View File

@ -466,7 +466,6 @@ ENDIF
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0
OUTPUT FR_CODPRS CODTAB OUTPUT FR_CODPRS CODTAB
OUTPUT FR_DESCRPRS S0 OUTPUT FR_DESCRPRS S0
OUTPUT FR_PREZZO R0
OUTPUT FR_QTA R1 OUTPUT FR_QTA R1
OUTPUT FR_PERCSP R2 OUTPUT FR_PERCSP R2
OUTPUT FR_UMQTASP S7 OUTPUT FR_UMQTASP S7

10
ve/verig15.ini Executable file
View File

@ -0,0 +1,10 @@
#Profilo di riga tipo spese imballo
[MAIN]
CALCOLI=*
CAMPICALC=
IMPONIBILE=0
IMPOSTA=PREZZO
[HANDLERS]
NHANDLER = 0

17
ve/verig15.uml Executable file
View File

@ -0,0 +1,17 @@
#include "verigdef.h"
#define FULL_SCREEN
#define MASK_TITLE1 "Rettifiche IVA"
#define PAGE_2
DEFINE_FIELD(DESCR)
DEFINE_FIELD(VALORE)
DEFINE_FIELD(CODIVA)
F_POS(CODIVA, 2, 13,"Cod. IVA " )
DEFINE_FIELD(DESIVA)
F_POS(DESIVA, 22, 13,"" )
DEFINE_FIELD(CODCMS)
#include "verig.uml"

View File

@ -85,3 +85,4 @@ TRI|10|Risorse|||||||R||||||||||||||||||||||||||||||||||||||||||||| | | | | | |
TRI|11|Attrezzature|||||||A||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TRI|11|Attrezzature|||||||A||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | |
TRI|13|Merce con provvigione fissa|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TRI|13|Merce con provvigione fissa|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | |
TRI|14|Merce con ricerca per codice corrispondente|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TRI|14|Merce con ricerca per codice corrispondente|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | |
TRI|15|Rettifica IVA|||||||T||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | |

View File

@ -10,7 +10,7 @@ declare
NUMBER nHandle, nResult, nReinstall, nNewInstall; NUMBER nHandle, nResult, nReinstall, nNewInstall;
STRING szText, szModifiedPath, szDongle, szInstType,szReinstallPath,szCampoIni; STRING szText, szModifiedPath, szDongle, szInstType,szReinstallPath,szCampoIni;
BOOL bSetupStandard, bInstallModules, bInstallEnv, bInstallFirm, bInstallDemo, bInstallDemoData, bInstallNetWrk, bInstallNetWrkChk; BOOL bSetupStandard, bInstallModules, bInstallEnv, bInstallFirm, bInstallDemo, bInstallDemoData, bInstallNetWrkChk;
BOOL bInstallData, bInstallPrg, bUseDongleServer, bInstallServer, bXPServicesInstalled; BOOL bInstallData, bInstallPrg, bUseDongleServer, bInstallServer, bXPServicesInstalled;
// Function declarations. // Function declarations.
prototype _SetupScreen(); prototype _SetupScreen();
@ -40,16 +40,17 @@ Step_start:
#define SPACE_REQUIRED 120000 // Disk space in bytes. #define SPACE_REQUIRED 120000 // Disk space in bytes.
#ifdef __DEMO__ #ifdef __DEMO__
#define APP_NAME "OneRed Demo" #define APP_NAME "Campo Demo"
#define PROGRAM_FOLDER_NAME "OneRed Demo" #define PROGRAM_FOLDER_NAME "Campo Demo"
#else #else
#define APP_NAME "OneRed" #define APP_NAME "Campo"
#define PROGRAM_FOLDER_NAME "OneRed" #define PROGRAM_FOLDER_NAME "Campo"
#endif #endif
#define APPBASE_PATH "\\" #define APPBASE_PATH "\\"
#define COMPANY_NAME "A.G.A. Informatica srl" #define COMPANY_NAME "A.G.A. Informatica srl"
#define PRODUCT_NAME "OneRed" #define PRODUCT_NAME "Campo"
#define PRODUCT_VERSION "2.2 " #define PRODUCT_VERSION "2.2 "
#define DEINSTALL_KEY "SampleDeinstKey" #define DEINSTALL_KEY "SampleDeinstKey"
#define PRODUCT_KEY "ba0.exe" #define PRODUCT_KEY "ba0.exe"
#define DATATYPE_FILE "datatype." #define DATATYPE_FILE "datatype."
@ -124,23 +125,17 @@ Step_chooseDongleServer:
goto Step_choosedata; goto Step_choosedata;
endif; endif;
Step_chooseNTDongle: //Step_chooseNTDongle:
_SelectDongleXP(nDirection); // _SelectDongleXP(nDirection);
if nDirection=BACK then // if nDirection=BACK then
goto Step_chooseDongleServer; // goto Step_chooseDongleServer;
endif; // endif;
Step_whereDongleServer: Step_whereDongleServer:
_FindAutoStartFolder(nDirection); _FindAutoStartFolder(nDirection);
_SelectDongleServerDestination(nDirection); _SelectDongleServerDestination(nDirection);
if nDirection=BACK then if nDirection=BACK then
goto Step_chooseNTDongle; goto Step_chooseDongleServer;
endif;
if nDirection=NEXT then
if bInstallNetWrk then
goto Step_installnet;
endif;
endif; endif;
// *********************************** // ***********************************
@ -194,34 +189,34 @@ Step_LaunchServer:
exit; exit;
// *********************************** // ***********************************
// * network installation (OneRed WST) // * network installation
Step_installnet: //Step_installnet:
_ConfirmInstallation(nDirection); // _ConfirmInstallation(nDirection);
if nDirection=BACK then // if nDirection=BACK then
goto Step_whereDongleServer; // goto Step_whereDongleServer;
endif; // endif;
Step_installKeyServices: //Step_installKeyServices:
_InstallDongleXP(nDirection); // _InstallDongleXP(nDirection);
if nDirection=BACK then // if nDirection=BACK then
goto Step_whereDongleServer; // goto Step_whereDongleServer;
endif; // endif;
nStep_installData: //nStep_installData:
_InstallData(nDirection); // _InstallData(nDirection);
if (nDirection=BACK) then // if (nDirection=BACK) then
goto Step_whereDongleServer; // goto Step_whereDongleServer;
endif; // endif;
Step_installwrkst: //Step_installwrkst:
_NewNetWorkPlace(nDirection); // _NewNetWorkPlace(nDirection);
if (nDirection=BACK) then // if (nDirection=BACK) then
goto Step_whereDongleServer; // goto Step_whereDongleServer;
endif; // endif;
_ProgramEpilogue(); // _ProgramEpilogue();
exit; // exit;
#include "setup1.rul" #include "setup1.rul"
#include "setup2.rul" #include "setup2.rul"
@ -229,4 +224,3 @@ Step_installwrkst:
#include "setup4.rul" #include "setup4.rul"
#include "winsub.rul" #include "winsub.rul"
#include "sddialog.rul" #include "sddialog.rul"

View File

@ -41,11 +41,10 @@ end;
function _SelectSetupMode(nRetv ) function _SelectSetupMode(nRetv )
STRING szMsg[512]; STRING szMsg[512];
BOOL zInstallDemo,zInstallNetWrk,zInstallNetWrkChk; BOOL zInstallDemo,zInstallNetWrkChk;
begin begin
zInstallDemo = bInstallDemo; zInstallDemo = bInstallDemo;
zInstallNetWrk = bInstallNetWrk;
zInstallNetWrkChk = bInstallNetWrkChk; zInstallNetWrkChk = bInstallNetWrkChk;
#ifdef __DEMO__ #ifdef __DEMO__
@ -70,9 +69,7 @@ begin
"&in postazione singola (o server)", "&in postazione singola (o server)",
bInstallEnv, bInstallEnv,
"in rete con &programmi su disco &locale", "in rete con &programmi su disco &locale",
bInstallNetWrkChk, bInstallNetWrkChk
"in rete con programmi su disco di &rete",
bInstallNetWrk
); );
endif; endif;
if bInstallNetWrkChk then if bInstallNetWrkChk then
@ -80,15 +77,11 @@ begin
endif; endif;
#endif #endif
if (( zInstallDemo!=bInstallDemo) || (zInstallNetWrk!=bInstallNetWrk)|| (zInstallNetWrkChk!=bInstallNetWrkChk) ) then if (( zInstallDemo!=bInstallDemo) || (zInstallNetWrkChk!=bInstallNetWrkChk) ) then
if bInstallDemo then if bInstallDemo then
bInstallPrg = TRUE; bInstallPrg = TRUE;
bInstallData=TRUE; bInstallData=TRUE;
bInstallDemoData=TRUE; bInstallDemoData=TRUE;
elseif bInstallNetWrk then
bInstallPrg = FALSE;
bInstallData= FALSE;
bInstallDemoData=FALSE;
else else
bInstallPrg = TRUE; bInstallPrg = TRUE;
endif; endif;
@ -117,7 +110,8 @@ begin
//se non esiste una precedente installazione->nuova installazione;necessiterá di un path di default per l'installazione //se non esiste una precedente installazione->nuova installazione;necessiterá di un path di default per l'installazione
if (szConfigPath = "") then if (szConfigPath = "") then
bNuovaInst = ! _FindExistingInst(szConfigPath); // bNuovaInst = ! _FindExistingInst(szConfigPath); //ricerca precedenti installazioni
bNuovaInst = TRUE; //se non e' stato scelto un aggiornamento e' comunque una nuova installazione!
if bNuovaInst then if bNuovaInst then
bInstallData=TRUE; bInstallData=TRUE;
szConfigPath= DEFAULT_LOCALPATH; szConfigPath= DEFAULT_LOCALPATH;
@ -194,20 +188,16 @@ begin
_IsNetworkDrive(szDataPath, bRemoteData); _IsNetworkDrive(szDataPath, bRemoteData);
bInstallNetWrkChk = FALSE; bInstallNetWrkChk = FALSE;
bInstallNetWrk = FALSE;
bInstallEnv = ! bRemoteExe; bInstallEnv = ! bRemoteExe;
//distingue tra dati in remoto e campo wst //distingue tra dati in remoto e campo wst
if (bRemoteData) then if (bRemoteData) then
bInstallNetWrk = bRemoteExe;
bInstallNetWrkChk = !bRemoteExe; bInstallNetWrkChk = !bRemoteExe;
endif; endif;
//non esiste campo.ini -> e' una installazione
else else
//path dei dati in caso di installazione non WST
if (!bInstallNetWrk) then
szDataPath = szConfigPath ^ "DATI\\"; szDataPath = szConfigPath ^ "DATI\\";
endif;
endif; endif;
@ -217,15 +207,10 @@ begin
NumToStr(szPar, nNewInstall); NumToStr(szPar, nNewInstall);
endif; endif;
//se e' una installazione di rete scrivo su campo.stp l'indirizzo del campo.ini utilizzato //scrive su campo.stp..
if (bInstallNetWrk) then
WriteProfString("C:\\Campo.stp", szPar, "CampoIni", szCampoIni);
else
//in caso non sia una installazione di rete non devo scrivere nulla sul campo.stp...
WriteProfString("C:\\Campo.stp", szPar, "CampoIni", ""); WriteProfString("C:\\Campo.stp", szPar, "CampoIni", "");
//..e l'application path e' lo stesso del campo.ini (ovvio,ba0.exe e' assieme a campo.ini) //..e l'application path e' lo stesso del campo.ini (ovvio,ba0.exe e' assieme a campo.ini)
szAppPath = szConfigPath; szAppPath = szConfigPath;
endif;
return; return;
end; end;
@ -261,8 +246,8 @@ begin
repeat repeat
// Windows 95/98/ME or NT/2000/XP platforms // Windows 95/98/ME or NT/2000/XP platforms
if (bInstallNetWrk || bInstallNetWrkChk) then if (bInstallNetWrkChk) then
szMsg= "Setup installera' la postazione di lavoro in rete.\nE' possibile installare anche l'area dati, il server di rete per le chiavi di protezione."; szMsg= "Setup installera' la postazione di lavoro.\nE' possibile installare anche l'area dati, il server di rete per le chiavi di protezione.";
nRetv = AskOptions(NONEXCLUSIVE,szMsg, nRetv = AskOptions(NONEXCLUSIVE,szMsg,
"Installa l'area dati", bInstallData , "Installa l'area dati", bInstallData ,
"Installa i Server", bInstallServer "Installa i Server", bInstallServer
@ -277,7 +262,7 @@ begin
); );
endif; endif;
until nRetv!=NEXT || bInstallData || bInstallPrg || bInstallNetWrk || bInstallServer; until nRetv!=NEXT || bInstallData || bInstallPrg || bInstallServer;
//viene aggiornato il file campo.stp con i valori relativi all'installazione del master server e del server di chiavi //viene aggiornato il file campo.stp con i valori relativi all'installazione del master server e del server di chiavi
if (nReinstall > 0) then if (nReinstall > 0) then
@ -308,27 +293,19 @@ function _SelectNetConfig(nDirection )
NUMBER nHandle; NUMBER nHandle;
BOOL ok; BOOL ok;
begin begin
if ((!bInstallNetWrk) && !(bInstallNetWrkChk && bInstallPrg)) then if (!(bInstallNetWrkChk && bInstallPrg)) then
return; return;
endif; endif;
if (bInstallNetWrk) then
szNetAppPath=szAppPath;
else
if (szAppRefPath = "") then if (szAppRefPath = "") then
GetProfString(szCampoIni, "Main", "Program", szAppRefPath); GetProfString(szCampoIni, "Main", "Program", szAppRefPath);
endif; endif;
szNetAppPath=szAppRefPath; szNetAppPath=szAppRefPath;
endif;
if (bInstallNetWrk) then
szText = szText + "Inserire il percorso completo del direttorio di rete che contiene i files del programma. ";
szText = szText + "Se tali files mancano, installarli secondo la modalita' 'postazione singola'. ";
szText = szText + "Le installazioni sulle altre macchine della rete andranno effettuate secondo la modalita' 'postazione di rete'.";
else
szText = szText + "Inserire il percorso completo del direttorio di rete che contiene i files del programma. "; szText = szText + "Inserire il percorso completo del direttorio di rete che contiene i files del programma. ";
szText = szText + "Se tali files mancano, installarli secondo la modalita' 'postazione singola'. "; szText = szText + "Se tali files mancano, installarli secondo la modalita' 'postazione singola'. ";
szText = szText + "Ogni postazione di rete verifichera' eventuali aggiornamenti di questa installazione "; szText = szText + "Ogni postazione di rete verifichera' eventuali aggiornamenti di questa installazione ";
szText = szText + "aggiornandosi automaticamente."; szText = szText + "aggiornandosi automaticamente.";
endif;
if (szNetAppPath = "") then if (szNetAppPath = "") then
szNetAppPath = DEFAULT_NETPATH; szNetAppPath = DEFAULT_NETPATH;
@ -352,18 +329,10 @@ begin
ok = TRUE; ok = TRUE;
endif; endif;
endwhile; endwhile;
if (bInstallNetWrk) then
szAppPath = szNetAppPath;
if (nReinstall > 0) then
NumToStr(szPar, nReinstall);
else
NumToStr(szPar, nNewInstall);
endif;
WriteProfString("C:\\Campo.stp", szPar, "Program", szAppPath);
else
szAppRefPath =szNetAppPath; szAppRefPath =szNetAppPath;
StrRemoveLastSlash(szAppRefPath); StrRemoveLastSlash(szAppRefPath);
endif;
end; end;
//________________________________________________________________________________________________________________________ //________________________________________________________________________________________________________________________
@ -377,7 +346,7 @@ function _SelectDataDestination(nRetv)
begin begin
// ricontrolla la presenza di una installazione // ricontrolla la presenza di una installazione
// e determina la posizione della directory "DATI" // e determina la posizione della directory "DATI"
if bInstallData || bInstallPrg || bInstallNetWrk then if bInstallData || bInstallPrg then
if bInstallData then if bInstallData then
sMsg = "Setup installerà l'area dati nel seguente direttorio."; sMsg = "Setup installerà l'area dati nel seguente direttorio.";
else else
@ -499,7 +468,7 @@ function _SelectDongleXP(nDirection)
begin begin
#ifndef __DEMO__ #ifndef __DEMO__
bLocal = !(bInstallNetWrk || bInstallNetWrkChk); //in caso di installazione in postazione singola o server (chiave locale) bLocal = !(bInstallNetWrkChk); //in caso di installazione in postazione singola o server (chiave locale)
if ( szOSName="Windows NT" && ((!bUseDongleServer) || bLocal) ) then //se ho win NT/2000/XP ed ho una chiave locale... if ( szOSName="Windows NT" && ((!bUseDongleServer) || bLocal) ) then //se ho win NT/2000/XP ed ho una chiave locale...
bJunk = nReinstall > 0; bJunk = nReinstall > 0;
go_on=FALSE; go_on=FALSE;
@ -622,7 +591,7 @@ begin
szTempore = szDongleServerName; szTempore = szDongleServerName;
// se l'installazione e' del tipo avanzata/installazione locale server e si vuole installare il server // se l'installazione e' del tipo avanzata/installazione locale server e si vuole installare il server
// di autorizzazioni, propone di default localhost, in quanto il server autorizzazioni e' in locale // di autorizzazioni, propone di default localhost, in quanto il server autorizzazioni e' in locale
if ((!bInstallNetWrkChk) && (!bInstallNetWrk) && (nReinstall <= 0) ) then if ((!bInstallNetWrkChk) && (nReinstall <= 0) ) then
szTempore = "localhost"; szTempore = "localhost";
endif; endif;
@ -672,13 +641,11 @@ begin
listInfo = ListCreate(STRINGLIST); listInfo = ListCreate(STRINGLIST);
Msg = "Si e' scelto di installare "; Msg = "Si e' scelto di installare ";
if bInstallNetWrk then if bInstallPrg then
Msg =Msg +"una postazione di rete";
elseif bInstallPrg then
if bInstallDemo then if bInstallDemo then
Msg =Msg +"programma in versione demo"; Msg =Msg +"il programma in versione demo";
else else
Msg =Msg +"programma in versione commerciale"; Msg =Msg +"il programma in versione commerciale";
endif; endif;
else else
Msg =Msg +"l'area dati"; Msg =Msg +"l'area dati";
@ -687,13 +654,6 @@ begin
// directory dei programmi (locale o di rete) // directory dei programmi (locale o di rete)
if bInstallNetWrk then
szInfo="Direttorio della postazione di rete: ";
ListAddString(listInfo, szInfo, AFTER);
szInfo=" " + szConfigPath;
ListAddString(listInfo, szInfo, AFTER);
szInfo="Direttorio dei programmi in rete: ";
else
if (bInstallNetWrkChk) then if (bInstallNetWrkChk) then
szInfo="Installazione di rete di riferimento:"; szInfo="Installazione di rete di riferimento:";
ListAddString(listInfo, szInfo, AFTER); ListAddString(listInfo, szInfo, AFTER);
@ -703,7 +663,7 @@ begin
else else
szInfo="Direttorio dei programmi: "; szInfo="Direttorio dei programmi: ";
endif; endif;
endif;
ListAddString(listInfo, szInfo, AFTER); ListAddString(listInfo, szInfo, AFTER);
szInfo=" " + szAppPath; szInfo=" " + szAppPath;
ListAddString(listInfo, szInfo, AFTER); ListAddString(listInfo, szInfo, AFTER);
@ -838,7 +798,7 @@ function _InstallInitialFiles(nRetv)
begin begin
if (bInstallPrg) then if (bInstallPrg) then
_InstallDongleXP(direction); //_InstallDongleXP(direction);
if (bInstallEnv || bInstallDemo) then if (bInstallEnv || bInstallDemo) then
_ForceAttrib4Dll( ); _ForceAttrib4Dll( );
@ -887,14 +847,15 @@ begin
Enable(STATUS); Enable(STATUS);
SetStatusWindow( 0, "Scompattamento in corso..." ); SetStatusWindow( 0, "Scompattamento in corso..." );
// ***Eliminata con nuova gestione installazione chiavi! Programma hardlock hldrv32.exe
//hardlock.vxd in winsys.z va solo su sistemi win95/98 //hardlock.vxd in winsys.z va solo su sistemi win95/98
if (szOSName != "Windows NT") then // if (szOSName != "Windows NT") then
TARGETDIR = WINDIR ^ "SYSTEM"; // TARGETDIR = WINDIR ^ "SYSTEM";
if ( CompressGet( "WINSYS.Z", "*.*", INCLUDE_SUBDIR ) < 0) then // if ( CompressGet( "WINSYS.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
szText = STR_ERR_DECOMPRESS + " la libreria WINSYS."; // szText = STR_ERR_DECOMPRESS + " la libreria WINSYS.";
_Errore( szText ); // _Errore( szText );
endif; // endif;
endif; // endif;
StatusUpdate( ON, 100 ); StatusUpdate( ON, 100 );
FileSetEndDefine ( "SYS"); FileSetEndDefine ( "SYS");
@ -1020,7 +981,7 @@ begin
return; return;
endif; endif;
_InstallDongleXP(nDirection); //_InstallDongleXP(nDirection);
//server di controllo dei vari servers possibili //server di controllo dei vari servers possibili
szTempore = szAppPath ^ "\\servers\\lerch.exe"; szTempore = szAppPath ^ "\\servers\\lerch.exe";

View File

@ -33,7 +33,7 @@ begin
szTestProg = ""; szTestProg = "";
//SOLO se e' una installazione locale puo' fare il test del database (con conversione!) //SOLO se e' una installazione locale puo' fare il test del database (con conversione!)
if (( ! bInstallNetWrkChk) && ( ! bInstallNetWrk )) then if (!bInstallNetWrkChk) then
szTestData = "X"; szTestData = "X";
szTestProg = "N"; szTestProg = "N";
endif; endif;
@ -72,7 +72,7 @@ function _UpdateSysFiles( )
STRING szTemp[_MAX_LENGTH], szWin_Ini[_MAX_LENGTH]; STRING szTemp[_MAX_LENGTH], szWin_Ini[_MAX_LENGTH];
begin begin
if (!bNuovaInst) && (!bInstallNetWrk) then if (!bNuovaInst) then
return; return;
endif; endif;
@ -185,13 +185,14 @@ begin
FileSetBeginDefine ( "WIN"); FileSetBeginDefine ( "WIN");
if (szOSName != "Windows NT") then // ***Eliminata con nuova gestione installazione chiavi! Programma hardlock hldrv32.exe
TARGETDIR = WINDIR ^ "SYSTEM"; //if (szOSName != "Windows NT") then
if ( CompressGet( "WINSYS.Z", "*.*", INCLUDE_SUBDIR ) < 0) then // TARGETDIR = WINDIR ^ "SYSTEM";
szText = STR_ERR_DECOMPRESS + " la libreria WINSYS."; // if ( CompressGet( "WINSYS.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
_Errore( szText ); // szText = STR_ERR_DECOMPRESS + " la libreria WINSYS.";
endif; // _Errore( szText );
endif; // endif;
//endif;
FileSetEndDefine ( "WIN"); FileSetEndDefine ( "WIN");
FileSetBeginDefine ( "SYS"); FileSetBeginDefine ( "SYS");
@ -332,16 +333,14 @@ begin
// Mostra Program Manager // Mostra Program Manager
AppCommand( PROGMAN, CMD_RESTORE ); AppCommand( PROGMAN, CMD_RESTORE );
// Aggiunge il gruppo di programmi ed i programmi // Aggiunge il gruppo di programmi ed i programmi
szFolder="OneRed"; szFolder="Campo";
ShowGroup (szFolder , SW_NORMAL ); ShowGroup (szFolder , SW_NORMAL );
if ( TRUE) then if ( TRUE) then
// Aggiunge i link Program Manager // Aggiunge i link Program Manager
if bInstallDemo then if bInstallDemo then
szItemName = "OneRed Demo"; szItemName = "Campo Demo";
elseif bInstallNetWrk then
szItemName = "OneRed WST";
else else
szItemName = "OneRed"; szItemName = "Campo";
endif; endif;
szCmdLine = szAppPath ^ "\\BA0.EXE"; szCmdLine = szAppPath ^ "\\BA0.EXE";
szIconPath = szCmdLine; szIconPath = szCmdLine;

View File

@ -65,9 +65,8 @@ end;
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________
function _FindExistingInst(szPrevPath ) function _FindExistingInst(szPrevPath )
begin begin
if (! bInstallNetWrk) then //modifica del 04-06-2003;tolta la ricerca local inst in caso di installazione wst
_CercaFileOvunque( "CAMPO.AUT",szPrevPath); _CercaFileOvunque( "CAMPO.AUT",szPrevPath);
endif;
if (szPrevPath!="") then if (szPrevPath!="") then
ParsePath(szPrevPath,szPrevPath,PATH); ParsePath(szPrevPath,szPrevPath,PATH);
return TRUE; return TRUE;

View File

@ -2210,6 +2210,7 @@ wxFont& TFontId::Font(wxDC* dc, WINDOW win) const
{ {
const int nFontSize = nBest-i; const int nFontSize = nBest-i;
wxFont courier(nFontSize, wxFIXED, wxNORMAL, wxNORMAL, FALSE, DEFAULT_FONT_NAME); wxFont courier(nFontSize, wxFIXED, wxNORMAL, wxNORMAL, FALSE, DEFAULT_FONT_NAME);
dc->SetFont(courier); dc->SetFont(courier);
int tw, th; dc->GetTextExtent(str, &tw, &th); int tw, th; dc->GetTextExtent(str, &tw, &th);
if (tw > nTarget10 && bPrevGood) if (tw > nTarget10 && bPrevGood)
@ -2220,6 +2221,7 @@ wxFont& TFontId::Font(wxDC* dc, WINDOW win) const
bPrevGood = tw <= nTarget10; bPrevGood = tw <= nTarget10;
} }
#endif #endif
dPrintScale = double(nBest) / double(nSize); dPrintScale = double(nBest) / double(nSize);
#ifdef LINUX #ifdef LINUX
dPrintScale /= 10.0; // * wxPostScriptDC::GetResolution()) / 72.0); dPrintScale /= 10.0; // * wxPostScriptDC::GetResolution()) / 72.0);

View File

@ -106,17 +106,16 @@ ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void*
wxDbColInf* columns = NULL; wxDbColInf* columns = NULL;
short numcols = 0; short numcols = 0;
if (db->ExecSql(sql, &columns, numcols)) if (db->ExecSql(sql, &columns, numcols) && numcols > 0)
{ {
const size_t BUF_SIZE = 1024*64; const size_t BUF_SIZE = 1024*64;
char* buffer = new char[BUF_SIZE]; // Valore di un singolo campo char* buffer = new char[BUF_SIZE]; // Valore di un singolo campo
const size_t MAX_COL = 256; char** values = new char*[numcols]; // Lista dei valori del record corrente
char** values = new char*[MAX_COL]; // Lista dei valori del record corrente memset(values, 0, numcols*sizeof(char*));
memset(values, 0, MAX_COL*sizeof(char*));
char** names = new char*[MAX_COL*2]; // Lista dei nomi dei campi e dei tipi char** names = new char*[numcols*2]; // Lista dei nomi dei campi e dei tipi
memset(names, 0, MAX_COL*2*sizeof(char*)); memset(names, 0, numcols*2*sizeof(char*));
short c; short c;
for (c = 0; c < numcols; c++) for (c = 0; c < numcols; c++)
@ -136,7 +135,7 @@ ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void*
} }
wxArrayString data; wxArrayString data;
for (nCount = 0; db->GetNext(); nCount++) if (cb != NULL) for (nCount = 0; db->GetNext(); nCount++)
{ {
data.Empty(); // Svuota l'array data.Empty(); // Svuota l'array
for (c = 0; c < numcols; c++) for (c = 0; c < numcols; c++)
@ -164,17 +163,16 @@ ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void*
db->GetData(c+1, SQL_C_CHAR, buffer, BUF_SIZE, &cbReturned); db->GetData(c+1, SQL_C_CHAR, buffer, BUF_SIZE, &cbReturned);
break; break;
} }
if (cbReturned != SQL_NULL_DATA) if (cbReturned == SQL_NULL_DATA)
buffer[0] = '\0';
data.Add(buffer); data.Add(buffer);
else
break;
} }
catch (...) catch (...)
{ {
break; break;
} }
} }
for (c = 0; c < numcols; c++) for (c = 0; c < (short)data.GetCount(); c++)
values[c] = (char*)data[c].c_str(); values[c] = (char*)data[c].c_str();
const int err = cb(jolly, numcols, values, names); const int err = cb(jolly, numcols, values, names);
if (err != 0) if (err != 0)