Patch level : 12.0 344

Files correlati     : 
Commento            : Sistemato log e controllo sulle fatture

git-svn-id: svn://10.65.10.50/branches/R_10_00@23603 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
mtollari 2017-02-10 09:37:04 +00:00
parent 388880bbba
commit da36c82ed8
2 changed files with 48 additions and 56 deletions

View File

@ -66,11 +66,9 @@ const real TLi_manager::getPlaRes()
// Trovo tutti i documenti che mi interessano e sottraggo l'imponibile al plafond // Trovo tutti i documenti che mi interessano e sottraggo l'imponibile al plafond
din.read('D', tipocf, codcli, year, tipi, stati, iniDicInt, ad); din.read('D', tipocf, codcli, year, tipi, stati, iniDicInt, ad);
int i = 0;
for(; i < din.items(); i++)
{
int j = 1; // Le righe partono da 1?
for(int i = 0; i < din.items(); i++)
{
TAssoc_array tabIva = din[i].tabella_iva(true); TAssoc_array tabIva = din[i].tabella_iva(true);
TString numerazione = din[i].numerazione(); TString numerazione = din[i].numerazione();
int numdoc = din[i].numero(); int numdoc = din[i].numero();
@ -88,15 +86,15 @@ const real TLi_manager::getPlaRes()
bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr) bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr)
{ {
bool ok = true; bool err = false;
real resPlafond = getPlaRes(); real resPlafond = getPlaRes();
real testPlafond = getPlaRes();
real totFatt;
int i = 0; int i = 0;
// Faccio un ragionamento identico a getPlaRes, ma in input ho la lista di documenti appena elaborati // Faccio un ragionamento identico a getPlaRes, ma in input ho la lista di documenti appena elaborati
for(; i < dout.items(); i++) for(int i = 0; i < dout.items(); i++)
{ {
int j = 1; // Le righe partono da 1?
TAssoc_array tabIva = dout[i].tabella_iva(true); TAssoc_array tabIva = dout[i].tabella_iva(true);
TString numerazione = dout[i].numerazione(); TString numerazione = dout[i].numerazione();
int numdoc = dout[i].numero(); int numdoc = dout[i].numero();
@ -105,25 +103,19 @@ bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr)
if(totali->cod_iva() == codiva) if(totali->cod_iva() == codiva)
{ {
resPlafond -= totali->imp_orig(); resPlafond -= totali->imp_orig();
totFatt += totali->imp_orig();
}
} }
if(resPlafond < 0) if(resPlafond < 0)
{ {
ok = false; err = true; // Alzo il flag dell'errore
break;
} TString msgerr;
} msgerr << "Sforato plafond cliente N." << dout[i].codcf() << "\nPlafond rimanente: " << resPlafond + totFatt << "\nTotale fatture generate: " << totFatt << "\nSforato di: " << resPlafond << "\n";
if(i < dout.items()) lerr.log(2, msgerr); // 2 <- Errore
{
TString msgerr; msgerr << "\nSforato plafond cliente N." << dout[i].codcf();
lerr.log(2, msgerr);
}
for(; i < dout.items(); i++)
{
TString msgerr; msgerr << "Errore doc. tipo: " << dout[i].tipo() << " N." << dout[i].numero() << " data: " << dout[i].data();
lerr.log(2, msgerr); // 2 -> Errore
} }
return ok; return err;
} }
// TIPOCF, CODCLI, ANNO // TIPOCF, CODCLI, ANNO

View File

@ -398,7 +398,7 @@ bool TFatturazione_bolle_app::test_dicint(const TMask& m)
TString msg(80); TString msg(80);
iw.set_max(tot_cli); iw.set_max(tot_cli);
TLog_report lerr(TR("Errori controllo plafond")); TLog_report lerr(TR("Errori controllo plafond\n"));
bool err = false; bool err = false;
for (int c = 0; c < tot_cli; c++) for (int c = 0; c < tot_cli; c++)
@ -420,7 +420,7 @@ bool TFatturazione_bolle_app::test_dicint(const TMask& m)
TLista_documenti dout; TLista_documenti dout;
if (eld.elabora(din, dout, data_elab)) if (eld.elabora(din, dout, data_elab))
{ {
err = currentCli.testPlafond(dout, lerr); err |= currentCli.testPlafond(dout, lerr);
} }
} }
} }