diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index 05ceafcea..11dfc9c0a 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -1227,7 +1227,11 @@ void TLiquidazione_app::set_pim_head(_DescrItem& d) void TLiquidazione_app::set_pim(_DescrItem& d) { // succede con le autocazzate non residenti non movimentate eccetera - if ((d._r0 + d._r1 + d._r2 + d._r3 + d._r4 + d._r5) == ZERO) + const bool a = (d._r0 + d._r1) == ZERO; + const bool b = (d._r2 + d._r3) == ZERO; + const bool c = (d._r4 + d._r5) == ZERO; + + if (a && b && c) return; int rw = 1; @@ -1540,6 +1544,12 @@ void TLiquidazione_app::set_grand(_DescrItem& d) real iva = abs(risultato); if (_isannual || _isriepilogo) iva.round(ROUND_MILLELIRE); set_row(rw++,"@23gCREDITO ATTUALE@58g%r",&iva); + if (_is_visliq) + { // se chiamata dalla visualizzazione mette 2 righe vuote se non vi sono interessi + // poiche' con le rettifiche a credito/debito posso volerle visualizzare + set_row(rw++,""); + set_row(rw++,""); + } } else { @@ -1551,8 +1561,14 @@ void TLiquidazione_app::set_grand(_DescrItem& d) if (!interessi.is_zero()) { set_row(rw++,"@23gIVA DOVUTA@75g%r",&risultato); - set_row(rw++,"@23gInteresse %6.2r %%@75g%r",&interesse, &interessi); + set_row(rw++,"@23gInteresse @33g%6.2r @41g%%@75g%r",&interesse, &interessi); } + else + if (_is_visliq) + { // vedi sopra... + set_row(rw++,""); + set_row(rw++,""); + } if (iva >= IVA_DA_RIPORTARE || _isannual || _isriepilogo) set_row(rw++,"@23gIVA DA VERSARE@75g%r",&iva); else diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index a584ed23c..634fabd25 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -937,23 +937,48 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver vsw->replace(lrettd, " ", 75); } - if (risul.sign() < 0) + if (risul.sign() < 0) // Significa che in questo momento il risultato e' a credito { real rabs = abs(risul); ln.overwrite("CREDITO ATTUALE", 23); ln.overwrite(rabs.string("###.###.###.###"), 58); - } - else if (risul.sign() > 0) - { - // aggiorna l'interesse solo se c'era dall'inizio, non - // se si e' passati da credito a debito (this is a limit - // and not a feature) - if (lintr > 0) - vsw->replace(lintr, intr.string("###.###.###.###"), 75); - if (livdv > 0) + if (lintr > 0) // Quindi niente riga "Interessi " ... { - vsw->replace(livdv, risul.string("###.###.###.###"), 75); - risul += intr; + vsw->replace(lintr," ",23); + vsw->replace(lintr," ",33); + vsw->replace(lintr," ",41); + vsw->replace(lintr," ",75); + } + if (livdv > 0) // ...ed "IVA DOVUTA" + { + vsw->replace(livdv," ",23); + vsw->replace(livdv," ",75); + } + } + else if (risul.sign() > 0) // ... altrimenti siamo a debito, in tal caso si hanno gli interessi (solo trimestrali of course) + { + const bool print_intr = _freqviva == "T" && intr != 0.0; + if (print_intr) + { + if (lintr == -1) + { + lintr = lrisc + 2; + vsw->replace(lintr, "Interesse", 23); + vsw->replace(lintr, itt.stringa(6,2), 33); + vsw->replace(lintr, "%", 43); + } + if (livdv == -1) + { + livdv = lrisc + 1; + vsw->replace(livdv, "IVA DOVUTA", 23); + } + if (lintr > 0) + vsw->replace(lintr, intr.string("###.###.###.###"), 75); + if (livdv > 0) + { + vsw->replace(livdv, risul.string("###.###.###.###"), 75); + risul += intr; + } } ln.overwrite("IVA DA VERSARE", 23); ln.overwrite(risul.string("###.###.###.###"), 75); @@ -1119,6 +1144,7 @@ void Visliq_app::read_general(TMask& m) TString abi(5); TString cab(5); TString cnc(5); + const int step = _freqviva == "M" ? 1 : 3; TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1); TSheet_field& sv = (TSheet_field&)m.field(F_VISLIQ2); @@ -1126,25 +1152,27 @@ void Visliq_app::read_general(TMask& m) m.field(F_CREDPREC).set(_lia->get_real("R0").string()); // set sheet - for (int i = 1; i <= 12; i++) + for (int i = step; i < 13; i+=step) { + int row = (i/step) - 1; + if (!is_month_ok(i)) continue; if (!look_lim(i)) { - if (sh.items() < i) - sh.row(i-1) = *(new TToken_string("||||||")); + if (sh.items() < row) + sh.row(row) = *(new TToken_string("||||||")); else - sh.row(i-1) = "||||||"; + sh.row(row) = "||||||"; - sh.disable_cell(i-1, -1); + sh.disable_cell(row, -1); continue; } TToken_string* tt; - if (sh.items() < i) tt = new TToken_string(80); - else tt = &(sh.row(i-1)); + if (sh.items() < row) tt = new TToken_string(80); + else tt = &(sh.row(row)); real r0abs = abs(_lim->get_real("R0")); real r5abs = abs(_lim->get_real("R5")); @@ -1159,7 +1187,7 @@ void Visliq_app::read_general(TMask& m) tt->add(r5abs.string(),4); tt->add(sr5 == 0 ? "" : (sr5 > 0 ? "D" : "C"),5); - sh.row(i-1) = (*tt); + sh.row(row) = (*tt); } // calcola versamenti