diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 92d38f4c0..6b679785e 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -8,6 +8,8 @@ #include "cg4300a.h" #include +real CG4300_App::CENTO(100.0); + inline CG4300_App& app() { return (CG4300_App&)main_app(); } @@ -158,7 +160,7 @@ bool CG4300_App::set_print(int n) { case 1: // liquidazione _isprint = TRUE; - if (set_liquidazione()) + while (set_liquidazione()) { if (_selected.ones() > 0l) { @@ -185,48 +187,56 @@ bool CG4300_App::set_print(int n) break; case 2: // estrazione deleghe _isprint = FALSE; - if (set_deleghe()) + while (set_deleghe()) { - /* if (_year != yy) - { - TString cond(format("ANNOES=%s",(const char*)_year)); - _cur->setfilter(cond); - } */ - TRectype & mov = _cur->curr(); - TRectype from(_cur->curr()); from.zero(); - TRectype to(mov); - TDate f(1, _recalc == one ? _month : 1, atoi(_year)); - TDate t(1, _month, atoi(_year)); - - t.set_end_month(); - from.put(MOV_DATAREG, f); - to.put(MOV_DATAREG, t); - _cur->setregion(from, to); - extract_deleghe(); - return FALSE; + if (_calcall || _selected.ones() > 0l) + { + /* if (_year != yy) + { + TString cond(format("ANNOES=%s",(const char*)_year)); + _cur->setfilter(cond); + } */ + TRectype & mov = _cur->curr(); + TRectype from(_cur->curr()); from.zero(); + TRectype to(mov); + TDate f(1, _recalc == one ? _month : 1, atoi(_year)); + TDate t(1, _month, atoi(_year)); + + t.set_end_month(); + from.put(MOV_DATAREG, f); + to.put(MOV_DATAREG, t); + _cur->setregion(from, to); + extract_deleghe(); + return FALSE; + } + else warning_box("Nessuna ditta selezionata!"); } break; case 3: // calcolo acconto _isprint = TRUE; - if (set_acconto()) + while (set_acconto()) { - /* if (_year != yy) - { - TString cond(format("ANNOES=%s",(const char*)_year)); - _cur->setfilter(cond); - }*/ - TRectype & mov = _cur->curr(); - TRectype from(_cur->curr()); from.zero(); - TRectype to(mov); - TDate f(1, _recalc == one ? _month : 1, atoi(_year)); - TDate t(1, _month, atoi(_year)); - - t.set_end_month(); - from.put(MOV_DATAREG, f); - to.put(MOV_DATAREG, t); - _cur->setregion(from, to); - recalc_acconti(); - return _isprint; + if (_calcall || _selected.ones() > 0l) + { + /* if (_year != yy) + { + TString cond(format("ANNOES=%s",(const char*)_year)); + _cur->setfilter(cond); + }*/ + TRectype & mov = _cur->curr(); + TRectype from(_cur->curr()); from.zero(); + TRectype to(mov); + TDate f(1, _recalc == one ? _month : 1, atoi(_year)); + TDate t(1, _month, atoi(_year)); + + t.set_end_month(); + from.put(MOV_DATAREG, f); + to.put(MOV_DATAREG, t); + _cur->setregion(from, to); + recalc_acconti(); + return _isprint; + } + else warning_box("Nessuna ditta selezionata!"); } break; } diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 9e8ceb5d9..a190e49cb 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -1,4 +1,4 @@ -// ------------------------------------------------------------ +S// ------------------------------------------------------------ // Calcolo liquidazioni // Part 2: calcolo // fv 21-1-94 @@ -116,7 +116,16 @@ bool CG4300_App::update_firm(int month, bool recalc) _isannual = (_month == 12 && !mens && !_isbenzinaro) || (_month == 13 && (mens || _isbenzinaro)); _isriepilogo = _month == 13; - _isvent = _pla->get_bool("B0"); + // _isvent = _pla->get_bool("B0"); + + TTable reg("REG"); + + for (reg.first(); !_isvent && reg.good(); reg.next()) + { + if (reg.get("S8") == attiv && reg.get_int("I0") == 2) + isvent = reg.get_bool("B3"); + } + if ((month != 13 || _isannual) && (calc || !recalc)) if (!update_att(month, cattiv)) @@ -459,7 +468,7 @@ void CG4300_App::recalc_att(int month, const char* codatt) else if (corrisp) { - real perc = _iva->get_real("R0")/100.00; + real perc = _iva->get_real("R0") / CENTO; lor += imponibile; lor += imposta; @@ -489,7 +498,7 @@ void CG4300_App::recalc_att(int month, const char* codatt) // calcola il lercio prorata real prorata; if (!_prorata.is_zero()) - prorata = acquisti_iva * (_prorata / 100.0); + prorata = acquisti_iva * (_prorata / CENTO); look_plm(month, codatt, TRUE); @@ -707,13 +716,13 @@ void CG4300_App::recalc_annual(const char* att) } } // calcolo prorata - real prorata = (es_b1/(vendite - cess_amm - es_b3)) * 100.0; + real prorata = (es_b1/(vendite - cess_amm - es_b3)) * CENTO; real conguaglio = 0.0; prorata.round(ROUND_LIRA); if (prorata != _prorata) { // calcolo conguaglio -- se positivo e' a debito - real topay = acq_iva * (prorata / 100.0); + real topay = acq_iva * (prorata / CENTO); conguaglio = topay - pro_pag; } // vediamo se la porca aliquota media acquisti e' superiore alla @@ -811,8 +820,8 @@ _DescrItem* CG4300_App::recalc_rimborso(int month, const char* codatts) d->_r3 = imp_a; d->_r4 = iva_v; d->_r5 = iva_a; - d->_r6 = alv * real(100.0); - d->_r7 = ala * real(100.0); + d->_r6 = alv * CENTO; + d->_r7 = ala * CENTO; } if (rimborsami) diff --git a/cg/cg4303.cpp b/cg/cg4303.cpp index bdfaa6a85..5dbce0f16 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -138,9 +138,9 @@ void CG4300_App::recalc_ventilation(int month, const char* codatt) if (_vend_arr.items() == 0) return; TString att(codatt); - look_pla(att); - _pla->put("B0","X"); - _pla->rewrite(); + // look_pla(att); + // _pla->put("B0","X"); + // _pla->rewrite(); _isvent = TRUE; // 1) ricalcola i pim dei mesi dal primo al corrente se necessario @@ -180,7 +180,7 @@ void CG4300_App::recalc_ventilation(int month, const char* codatt) look_iva(other); perc = _iva->get_real("R0"); } - add_ventilation(perc/100.0, lurd, *_pim_codiva); + add_ventilation(perc / CENTO, lurd, *_pim_codiva); } } } diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index c83c90a78..e535aa14a 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -558,14 +558,14 @@ void CG4300_App::set_firm(_DescrItem& d) else { if (d._s3 == "T") - tim_title << format(" del %dx Trimestre", d._f1/3); + tim_title << format(" del %d° Trimestre %s", d._f1/3, (const char *) _year); else tim_title << format(" del mese di %s %s", itom(d._f1), (const char*)_year); } reset_header(); - set_header(1,"Ditta %s %s@97gStudio@109gData @<@125gPag. @#", + set_header(1,"Ditta %s %s@109gData @<@125gPag. @#", (const char*)(d._s0), (const char*)(d._s1)); set_header(2,""); set_header(3,sep); @@ -605,13 +605,15 @@ void CG4300_App::set_att(_DescrItem& d) else { if (d._s4 == "T") - tim_title << format(" del %dx Trimestre", d._f1/3); + tim_title << format(" del %dx Trimestre %s", d._f1/3, (const char *) _year); else tim_title << format(" del mese di %s %s", itom(d._f1), (const char*)_year); } - TString tipatt = d._f0 ? "" : format("(att. %d)", d._f0); + TString tipatt; + if (d._f0) + tipatt.format("(att. %d)", d._f0); if (d._s3.empty()) { @@ -625,7 +627,7 @@ void CG4300_App::set_att(_DescrItem& d) (const char*)tipatt); reset_header(); - set_header(1,"Ditta %s %s@97gStudio@109gData @<@125gPag. @#", + set_header(1,"Ditta %s %s@109gData @<@125gPag. @#", (const char*)(d._s0), (const char*)(d._s1)); set_header(2,""); set_header(3,sep); @@ -866,10 +868,12 @@ void CG4300_App::set_grand(_DescrItem& d) { // trimestrale: interesse set_row(rw++,"@23gIVA DOVUTA@75g%r",&iva); - real ivi = iva * interesse_trimestrale(d._f2); + + real interesse = interesse_trimestrale(d._f2); + real ivi = iva * interesse / CENTO; ivi.round(ROUND_LIRA); real ivt = iva + ivi; ivt.round(ROUND_MILLELIRE); - set_row(rw++,"@23gInteresse 1.50 %%@75g%r",&ivi); + set_row(rw++,"@23gInteresse %6.2r %%@75g%r",&interesse, &ivi); if (ivt.is_zero() || ivt >= IVA_DA_RIPORTARE || d._f1) set_row(rw++,"@23gIVA DA VERSARE@75g%r",&ivt); @@ -903,7 +907,7 @@ void CG4300_App::set_grand(_DescrItem& d) set_row(rw++,"1) Soggetto con quota di operazioni esenti e non" " imponibili superiore al 50%%"); - real perc = (di._r0/di._r1) * real(100.0); + real perc = (di._r0/di._r1) * CENTO; TString sep(strlen(REAL_PICTURE)+2); sep.fill('-'); set_row(rw++,""); @@ -1088,7 +1092,7 @@ void CG4300_App::set_viaggio(_DescrItem& d) int ln = max(up.len(), dn.len()) + 2; TString den(ln); den.fill('-'); up.center_just(ln); dn.center_just(ln); - real rip = d._r7 * 100.0; rip.round(2); + real rip = d._r7 * CENTO; rip.round(2); // la bella frazioncina degli imponibili viaggi misti TString tmp2 = d._r1.string(REAL_PICTURE); tmp2.ltrim(); @@ -1238,7 +1242,7 @@ void CG4300_App::set_acconto_p(_DescrItem& d) void CG4300_App::set_acchead_p(_DescrItem& d) { reset_header(); - set_header(1,"Gestione IVA@97gStudio@109gData @<@125gPag. @#"); + set_header(1,"Gestione IVA@109gData @<@125gPag. @#"); set_header(3,sep); if (d._f0) // base anno in corso diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 4618b671c..031fb406e 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -17,10 +17,9 @@ bool CG4300_App::set_deleghe() for (;;) { - if (k == K_ESC) - break; - if (k == K_ENTER && (_calcall || _selected.ones() > 0l)) + if (k == K_ESC || k == K_ENTER) break; + k = m.run(); // _isprint = m.get_bool(CHK_CGB_PRINT); @@ -158,9 +157,7 @@ bool CG4300_App::set_acconto() for (;;) { - if (k == K_ESC) - break; - if (k == K_ENTER && (_calcall || _selected.ones() > 0l)) + if (k == K_ESC || k == K_ENTER) break; k = m.run();