diff --git a/ef/ef0500.cpp b/ef/ef0500.cpp index 071bb81f8..e7a0b7355 100755 --- a/ef/ef0500.cpp +++ b/ef/ef0500.cpp @@ -249,7 +249,7 @@ void TEmissione::floppy() ribaini.overwrite("0", 2); // Elimino tipo pagamaneto if (!ribaini.exist()) // se non esiste ribaini = "riba.ini"; // utilizzo quello generico - if (!ribaini.custom_path()) // se non esiste ancora! + if (!ribaini.custom_path()) // se non esiste ancora! { error_box(FR("Impossibile leggere il file %s"), (const char*)ribaini); return; diff --git a/ef/ef0a00.cpp b/ef/ef0a00.cpp index a271ce0ea..7c253276d 100755 --- a/ef/ef0a00.cpp +++ b/ef/ef0a00.cpp @@ -31,11 +31,12 @@ protected: public: bool calc_residual(const TRiga_scadenze& scad, real& impres, real& imppag, - char& accsal, int& rdist, int& reff, bool& partially_unassigned, int& tipopag) const; - bool fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& partially_unassigned, bool force = FALSE); + char& accsal, int& rdist, int& reff, + bool& partially_unassigned, int& tipopag, bool is_old = false) const; + bool fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& partially_unassigned, bool force, bool is_new); bool fill_rate(); int insert_row(const TToken_string& row); - bool fill_distinta(bool clear_all = FALSE); + bool fill_distinta(bool clear_all = false); void sort_sheet(); void update_total(); @@ -54,7 +55,8 @@ public: bool TPE_mask::calc_residual(const TRiga_scadenze& scad, real& impres, real& imppag, char& accsal, int& rdist, int& reff, - bool& partially_unassigned, int& tipopag) const + bool& partially_unassigned, int& tipopag, + bool is_old) const { tipopag = scad.get_int(SCAD_TIPOPAG); const bool valuta = scad.in_valuta(); @@ -126,10 +128,11 @@ bool TPE_mask::calc_residual(const TRiga_scadenze& scad, cur.freeze(); const TRectype& riga = cur.curr(); const TRectype& effe = cur.curr(LF_EFFETTI); + TString8 key = get(F_TIPODIST); key << get(F_DIST); for (cur = 0L; cur.pos() < items; ++cur) { - if (effe.get(EFF_TIPODIST) == get(F_TIPODIST) && - effe.get(EFF_NDIST) == get(F_DIST)) + TString8 effkey = effe.get(EFF_TIPODIST); effkey << effe.get(EFF_NDIST); + if (effkey == key) { rdist = effe.get_int(EFF_NRIGADIST); reff = riga.get_int(REFF_NRIGATR); @@ -142,6 +145,8 @@ bool TPE_mask::calc_residual(const TRiga_scadenze& scad, if (riga.get_char(REFF_ACCSAL) == 'S') { impres = ZERO; + if (is_old) + return true; // Devo farla vedere break; } impres -= riga.get_real(valuta ? REFF_IMPORTOVAL : REFF_IMPORTO); @@ -167,15 +172,16 @@ void TPE_mask::update_total() enable(DLG_SAVEREC); } -bool TPE_mask::fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& partially_unassigned, bool force) +bool TPE_mask::fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& partially_unassigned, bool force, bool is_old) { const int tipopageff = get_int(F_TIPOPAGEFF); int tipopag; real impres, imppag; char accsal; int rigadist, rigaeff; row.cut(0); - bool ok = calc_residual(rs, impres, imppag, accsal, rigadist, rigaeff, partially_unassigned, tipopag) || force; - ok = (ok && (tipopag == tipopageff || tipopageff == 0)); + bool ok = calc_residual(rs, impres, imppag, accsal, rigadist, rigaeff, partially_unassigned, tipopag, is_old) || force; + if (ok) + ok = tipopag == tipopageff || tipopageff == 0; if (ok) { row.add(imppag.string()); @@ -193,15 +199,15 @@ bool TPE_mask::fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& part row.add(rigaeff); switch (tipopag) { - case 1:row.add("Rimessa Diretta"); break; - case 2:row.add("Tratta"); break; - case 3:row.add("Ricevuta Bancaria"); break; - case 4:row.add("Cessione"); break; - case 5:row.add("Pagherò"); break; - case 6:row.add("Lettera di credito"); break; - case 7:row.add("Tratta accettata"); break; - case 8:row.add("Rapporti interbancari diretti"); break; - case 9:row.add("Bonifico"); break; + case 1:row.add(TR("Rimessa Diretta")); break; + case 2:row.add(TR("Tratta")); break; + case 3:row.add(TR("Ricevuta Bancaria")); break; + case 4:row.add(TR("Cessione")); break; + case 5:row.add(TR("Pagherò")); break; + case 6:row.add(TR("Lettera di credito")); break; + case 7:row.add(TR("Tratta accettata")); break; + case 8:row.add(TR("Rapporti interbancari diretti")); break; + case 9:row.add(TR("Bonifico")); break; default: break; } } @@ -363,7 +369,7 @@ bool TPE_mask::fill_rate() if (data >= dadata && (!adata.ok() || data <= adata)) { bool partially_unassigned; - if (fill_row(rs, row, partially_unassigned)) + if (fill_row(rs, row, partially_unassigned, false, false)) { const int numrow = sheet.items(); sheet.row(numrow) = row; @@ -377,7 +383,7 @@ bool TPE_mask::fill_rate() } // for ogni fattura } // for ogni partita } // if ci sono partite - return fill_distinta(FALSE); + return fill_distinta(false); } bool TPE_mask::fill_distinta(bool clear_all) @@ -411,7 +417,7 @@ bool TPE_mask::fill_distinta(bool clear_all) { TRiga_scadenze& rs = game.rata(nriga, nrata); bool partially_unassigned; - if (fill_row(rs, row, partially_unassigned, dist_cont)) + if (fill_row(rs, row, partially_unassigned, dist_cont, clear_all)) { const int numrow = insert_row(row); if (partially_unassigned) @@ -786,7 +792,7 @@ bool TPE_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) "per cui non è possibile modificarla", (const char*)ef.get()); show(F_UNCONTABIL); } - ok = fill_distinta(TRUE); + ok = fill_distinta(true); } } _is_new = !ok; // Memorizza se è una distinta nuova @@ -915,7 +921,7 @@ bool TPE_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) if (check_fields()) { save_rate(); - fill_distinta(TRUE); + fill_distinta(true); disable(F_TIPOPAG); } }