diff --git a/cg/cg4600.cpp b/cg/cg4600.cpp index 701fdb018..f6714ba4b 100755 --- a/cg/cg4600.cpp +++ b/cg/cg4600.cpp @@ -571,44 +571,41 @@ void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectyp char sezione = ' '; real totale = tot_saldo; - if (totale != ZERO) - { - rmov.zero(); - rmov.put(RMV_ANNOES, anno); - rmov.put(RMV_NUMREG, _numreg); - rmov.put(RMV_NUMRIG, numrig); - rmov.put(RMV_DATAREG, datareg); - rmov.put(RMV_GRUPPO, tc.gruppo()); - rmov.put(RMV_CONTO, tc.conto()); - rmov.put(RMV_SOTTOCONTO, tc.sottoconto()); + rmov.zero(); + rmov.put(RMV_ANNOES, anno); + rmov.put(RMV_NUMREG, _numreg); + rmov.put(RMV_NUMRIG, numrig); + rmov.put(RMV_DATAREG, datareg); + rmov.put(RMV_GRUPPO, tc.gruppo()); + rmov.put(RMV_CONTO, tc.conto()); + rmov.put(RMV_SOTTOCONTO, tc.sottoconto()); - if (totale > ZERO) - { - sez_rmov = 'A'; - sezione = 'D'; - } - else - if (totale < ZERO) - { - sez_rmov = 'D'; - sezione = 'A'; - totale = -totale; - } - - if (sezione_opposta) - { - rmov.put(RMV_SEZIONE, sez_rmov); - _sld->aggiorna(tc,TImporto(sez_rmov,totale)); //Aggiorno anche i saldi con - // l'oggetto TSaldo_agg - } - else - { - rmov.put(RMV_SEZIONE, sezione); - _sld->aggiorna(tc,TImporto(sezione,totale)); //Aggiorno anche i saldi con - //l'oggetto TSaldo_agg - } - rmov.put(RMV_IMPORTO, totale); + if (totale > ZERO) + { + sez_rmov = 'A'; + sezione = 'D'; } + else + if (totale < ZERO) + { + sez_rmov = 'D'; + sezione = 'A'; + totale = -totale; + } + + if (sezione_opposta) + { + rmov.put(RMV_SEZIONE, sez_rmov); + _sld->aggiorna(tc,TImporto(sez_rmov,totale)); //Aggiorno anche i saldi con + // l'oggetto TSaldo_agg + } + else + { + rmov.put(RMV_SEZIONE, sezione); + _sld->aggiorna(tc,TImporto(sezione,totale)); //Aggiorno anche i saldi con + //l'oggetto TSaldo_agg + } + rmov.put(RMV_IMPORTO, totale); } void CG4600_application::costi() @@ -663,7 +660,8 @@ void CG4600_application::costi() if (j >= 1) { numrig++; - rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); + if (tot_saldo != ZERO) + rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); tot_saldo = ZERO; } @@ -692,7 +690,8 @@ void CG4600_application::costi() // con una sezione opposta al risultato (della somma). // numrig++; - rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); + if (tot_saldo != ZERO) + rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); _pn->write(); _pn->destroy_rows(0); //Azzero l'oggetto pn. @@ -811,7 +810,8 @@ void CG4600_application::ricavi() if (j >= 1) { numrig++; - rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); + if (tot_saldo != ZERO) + rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); tot_saldo = ZERO; } @@ -840,7 +840,8 @@ void CG4600_application::ricavi() // con una sezione opposta al risultato (della somma). // numrig++; - rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); + if (tot_saldo != ZERO) + rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcproper,tot_saldo,FALSE); _pn->write(); _pn->destroy_rows(0); //Azzero l'oggetto pn. @@ -1048,7 +1049,8 @@ void CG4600_application::chiudi_attivita() if (j >= 1) { numrig++; - rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura + if (tot_saldo != ZERO) + rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura tot_saldo = ZERO; } @@ -1079,7 +1081,8 @@ void CG4600_application::chiudi_attivita() // con una sezione opposta al risultato (della somma). // numrig++; - rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura + if (tot_saldo != ZERO) + rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura _pn->write(); _pn->destroy_rows(0); //Azzero l'oggetto pn. @@ -1198,7 +1201,8 @@ void CG4600_application::chiudi_passivita() if (j >= 1) { numrig++; - rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura + if (tot_saldo != ZERO) + rmov_proper(_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura tot_saldo = ZERO; } @@ -1227,7 +1231,8 @@ void CG4600_application::chiudi_passivita() // con una sezione opposta al risultato (della somma). // numrig++; - rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura + if (tot_saldo != ZERO) + rmov_proper (_annoesch,numrig,_dataregch,_pn->cg(j),_tcbilch,tot_saldo,FALSE); //Chiusura _pn->write(); _pn->destroy_rows(0); //Azzero l'oggetto pn. @@ -1397,7 +1402,8 @@ void CG4600_application::apri_attivita() if (j >= 1) { numrig++; - rmov_proper(_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Apertura + if (tot_saldo != ZERO) + rmov_proper(_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Apertura tot_saldo = ZERO; } @@ -1423,8 +1429,9 @@ void CG4600_application::apri_attivita() // Aggiungo un ulteriore riga di movimento contenente la somma // di tutti i saldi aventi lo stesso sottoconto, indicandola // con una sezione opposta al risultato (della somma). - - rmov_proper (_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Chiusura + + if (tot_saldo != ZERO) + rmov_proper (_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Chiusura _pn->write(); _pn->destroy_rows(0); //Azzero l'oggetto pn. @@ -1539,7 +1546,8 @@ void CG4600_application::apri_passivita() if (j >= 1) { numrig++; - rmov_proper(_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Apertura + if (tot_saldo != ZERO) + rmov_proper(_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Apertura tot_saldo = ZERO; } @@ -1565,8 +1573,9 @@ void CG4600_application::apri_passivita() // Aggiungo un ulteriore riga di movimento contenente la somma // di tutti i saldi aventi lo stesso sottoconto, indicandola // con una sezione opposta al risultato (della somma). - - rmov_proper (_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Apertura + + if (tot_saldo != ZERO) + rmov_proper (_annoesap,numrig,_dataregap,_pn->cg(j),_tcbilap,tot_saldo,TRUE); //Apertura _pn->write(); _pn->destroy_rows(0); //Azzero l'oggetto pn.