From 0d6378daccbc765161184fbbf9b090dd25c14b4d Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 15 Jan 1996 18:56:45 +0000 Subject: [PATCH] Correzioni da verificare da parte di ferdinando git-svn-id: svn://10.65.10.50/trunk@2457 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg2104.cpp | 63 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/cg/cg2104.cpp b/cg/cg2104.cpp index 6b743270b..1565d9fae 100755 --- a/cg/cg2104.cpp +++ b/cg/cg2104.cpp @@ -37,10 +37,10 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k) TString16 banca; bool doit = TRUE, m_imp = FALSE, m_perc = FALSE, m_pag = FALSE; - bool m_scad = FALSE, m_tipo = FALSE, m_ulc = FALSE, mod = FALSE; + bool m_scad = FALSE, m_tipo = FALSE, m_ulc = FALSE, mod = FALSE, m_implit = FALSE; word ahiahi = P_OK; - TString news(10), newi(15), newp(15), newt(1), newu(1); + TString news(10), newi(15), newp(15), newil(15), newt(1), newu(1); bool recalc = msk->get_bool(FS_RECALC); bool mcomm = msk->get_bool(FS_MCOMM); @@ -62,13 +62,18 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k) newp = ns.get(3); // Percentuale newt = ns.get(4); // Tipo pagamento newu = ns.get(5); // Ulteriore classificazione + if (in_valuta) + { + newil = ns.get(1); + m_implit = real(newil) != real(ts.get(1)); + } // qui viene il bello, si fa per dire if (news != ts.get(0)) // modificata data scadenza mod = m_scad = TRUE; - if (newp != ts.get(3)) // modificata percentuale + if (real(newp) != real(ts.get(3))) // modificata percentuale mod = m_perc = TRUE; - if (newi != ts.get(impos)) // modificato importo + if (real(newi) != real(ts.get(impos))) // modificato importo { // se si modifica la percentuale l'importo non viene cagato if ((recalc && !m_perc) || (!recalc)) @@ -82,8 +87,8 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k) else if (m_tipo) { // forza reset di ulc se si e' modificato il tipo rata m_ulc = TRUE; - newu = ""; - } + newu = ""; + } break; case K_DEL: @@ -137,7 +142,7 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k) // see if rdiff changed msk->set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2"); msk->set(FS_NRATE, pag.n_rate()); - } + } if (!recalc) { ahiahi = P_OK; @@ -166,7 +171,14 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k) } if (mod) rws.row(r) = ps.row(r); + } + if (in_valuta && m_implit) + { + TToken_string& trw = pag.rata(r); + + trw.add(newil, 7); } + if (ahiahi) // any error? Rimetti le righe com'erano prima { if (recalc) @@ -209,11 +221,12 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key) ok = error_box(s); } + const bool in_valuta = m.get(SK_VALUTA).not_empty(); + real imp; + if (key == K_ENTER && m.edit_mode()) { - const bool in_valuta = m.get(SK_VALUTA).not_empty(); const real tot = m.get(in_valuta ? SK_TOTDOCVAL : F_TOTALE); - real imp; for (int r = pag.n_rate()-1; r >= 0; r--) imp += pag.tpay_rata(r); if (imp != tot) @@ -232,20 +245,20 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key) ok = FALSE; // Permette di guardare il risultato prima di registrare } } + } - if (in_valuta) - { - const real totlit = m.get(F_TOTALE); - imp = ZERO; - for (int r = pag.n_rate()-1; r >= 0; r--) - imp += pag.tlit_rata(r); - if (imp != totlit) - { - const TString is(imp.string(".")); - const TString ts(totlit.string(".")); - warning_box("Il totale in lire delle rate e' %s mentre\n" - "il totale del documento e' %s."); - } + if (key == K_ENTER && in_valuta) + { + const real totlit = m.get(F_TOTALE); + imp = ZERO; + for (int r = pag.n_rate()-1; r >= 0; r--) + imp += pag.tlit_rata(r); + if (imp != totlit) + { + const TString is(imp.string(".")); + const TString ts(totlit.string(".")); + ok = error_box("Il totale in lire delle rate e' %s mentre\n" + "il totale del documento e' %s.", (const char *)ts, (const char *)is); } } } @@ -517,7 +530,7 @@ bool TPrimanota_application::ratalit_handler(TMask_field& f, KEY key) TPagamento& pag = app().pagamento(); if (pag.in_valuta()) { - TValuta v("", TDate(), pag.cambio()); + TValuta v("VAL", TDate(), pag.cambio()); const real other(f.mask().get(103)); TString16 s(v.val2lit(other).string()); f.set(s); @@ -532,8 +545,8 @@ bool TPrimanota_application::rataval_handler(TMask_field& f, KEY key) { TPagamento& pag = app().pagamento(); if (pag.in_valuta()) - { - TValuta v("", TDate(), pag.cambio()); + { + TValuta v("VAL", TDate(), pag.cambio()); const real other(f.mask().get(102)); TString16 s(v.lit2val(other).string()); f.set(s);