From 13018463138a9bf78178c2f5daa3c1512dc587fa Mon Sep 17 00:00:00 2001 From: villa Date: Thu, 27 Oct 1994 11:47:11 +0000 Subject: [PATCH] Zozzerie varie liquidazione git-svn-id: svn://10.65.10.50/trunk@471 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg4300.cpp | 8 +++--- cg/cg4301.cpp | 36 +++++++++++++++++++-------- cg/cg4302.cpp | 69 ++++++++++++++++++++++++++------------------------- cg/cg4303.cpp | 2 +- cg/cg4304.cpp | 6 +++-- 5 files changed, 69 insertions(+), 52 deletions(-) diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 95c81ccb5..2603b4174 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -169,10 +169,10 @@ bool CG4300_App::set_print(int n) 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)); + TRectype& mov = _cur->curr(); + TRectype from(_cur->curr()); from.zero(); + TRectype to(mov); + TDate f(1, 1, atoi(_year)); TDate t(1, _month, atoi(_year)); t.set_end_month(); diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 5d58efd81..af1eac5ce 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -29,7 +29,11 @@ bool CG4300_App::recalc_all() if (_selected[l]) { TApplication::set_firm(_nditte->curr().get_long("CODDITTA")); - _prind->addstatus(1); + _prind->addstatus(1); + + // trimestrali impropriamente selezionate per mesi intermedi + if (!is_month_ok(_month)) continue; + int need_refresh = FALSE; if (_recalc != ever) { @@ -51,7 +55,17 @@ bool CG4300_App::recalc_all() if (is_month_ok(m)) update_firm(m); } - update_firm(_month); + update_firm(_month); + + // se ci sono altri mesi dopo quello calcolato, invalida il + // flag 'calcolato' del primo, per causare il ricalcolo dei + // successivi (evitando problemi per credito precedente) + for (int m = _month+1; m <= 13; m++) + if (is_month_ok(m) && look_lim(m)) + { + _lim->put("B0",""); + break; + } } } if (!_prind->iscancelled()) _prind->addstatus(1); @@ -726,18 +740,18 @@ void CG4300_App::recalc_annual(const char* att) describe_error("Attivita' non ricalcolata: " "possibili errori",att); look_ptm(i,aaa); look_plm(i,aaa); - real vend = _ptm->get("S3"); + real vend(_ptm->get("S3")); ven_lrd += vend; // lordo vendite // non entra l'IVA per calcolo volume affari vendite += (vend - _plm->get_real("R0")); - real eb3 = _ptm->get("S0"); + real eb3(_ptm->get("S0")); es_b1 += _ptm->get_real("R13"); es_b2 += _ptm->get_real("R14"); es_b3 += eb3; acq_iva += _plm->get_real("R1"); cess_amm += _ptm->get_real("R10"); pro_pag += _plm->get_real("R2"); - real aax = _ptm->get("S2"); + real aax(_ptm->get("S2")); acq += aax - // rilevanti per aliquota media _ptm->get_real("R3") - // toglie ammortizz. etc _ptm->get_real("R5") - // non detraibili non ci sono @@ -793,13 +807,13 @@ _DescrItem* CG4300_App::recalc_rimborso(int month, const char* codatts) att = tmpatt; look_plm(month,att); look_ptm(month,att); - real tvol = _ptm->get("S3"); + real tvol(_ptm->get("S3")); vol_aff += tvol; - real esni = _plm->get("S1"); + real esni(_plm->get("S1")); es_ni += esni; iva_a += _plm->get_real("R1"); iva_v += _plm->get_real("R0"); - real aax = _ptm->get("S2"); + real aax(_ptm->get("S2")); imp_a += aax - // rilevanti per aliquota media _ptm->get_real("R3") - // toglie ammortizz. etc _ptm->get_real("R5") - // non detraibili non ci sono @@ -817,13 +831,13 @@ _DescrItem* CG4300_App::recalc_rimborso(int month, const char* codatts) look_ptm(m,att); - real tvol = _ptm->get("S3"); + real tvol(_ptm->get("S3")); vol_aff += tvol; - real esni = _plm->get("S1"); + real esni(_plm->get("S1")); es_ni += esni; iva_a += _plm->get_real("R1"); iva_v += _plm->get_real("R0"); - real aax = _ptm->get("S2"); + real aax(_ptm->get("S2")); imp_a += aax - // rilevanti per aliquota media _ptm->get_real("R3") - // toglie ammortizz. etc _ptm->get_real("R5") - // non detraibili non ci sono diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 1e4ccd986..3f5b1bc3b 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -353,45 +353,46 @@ real CG4300_App::credito_prec(int month) if (is_first_month(month)) { look_lia(); - if (_lia->status() == NOERR) - { - c = _lia->get_real("R0"); - if (!c.is_zero()) return c; - } - int yr = atoi(_year) - 1; - _lim->zero(); - *_lim_anno = yr; - *_lim_mese = 12; - if (_lim->read() == NOERR) + if (_lia->status() == NOERR) + { + c = _lia->get_real("R0"); + if (!c.is_zero()) return c; + } + int yr = atoi(_year) - 1; + _lim->zero(); + *_lim_anno = yr; + *_lim_mese = 12; + if (_lim->read() == NOERR) // considera anche il rimborso c = _lim->get_real("R0") - _lim->get_real("R1"); - // e le eventuali rettifiche a debito - real rett = _lim->get_real("R5"); - if (rett.sign() > 0) + // e le eventuali rettifiche a debito + real rett = _lim->get_real("R5"); + if (rett.sign() > 0) c -= rett; - // e l'acconto versato a dicembre - _del->zero(); - TString ditta = _nditte->curr().get("CODDITTA"); - *_del_ditta = ditta; - *_del_anno = yr; - *_del_mese = 12; - *_del_tipo = 7; - if (_del->read() == NOERR) + // e l'acconto versato a dicembre + _del->zero(); + TString ditta = _nditte->curr().get("CODDITTA"); + *_del_ditta = ditta; + *_del_anno = yr; + *_del_mese = 12; + *_del_tipo = 7; + if (_del->read() == NOERR) c -= _del->get_real("R0"); - } + } else - { - bool ok = look_lim(previous_month(month)); - if (!ok || !_lim->get_bool("B0")) - { - update_firm(previous_month(month), FALSE); - look_lim(previous_month(month)); - } - c = _lim->get_real("R0") - _lim->get_real("R1"); - real rett = _lim->get_real("R5"); - if (rett.sign() > 0) - c -= rett; - } + { + bool ok = look_lim(previous_month(month)); + if (!ok || !_lim->get_bool("B0")) + { + update_firm(previous_month(month), FALSE); + look_lim(previous_month(month)); + } + // toglie il rimborso chiesto + c = _lim->get_real("R0") + _lim->get_real("R1"); + real rett = _lim->get_real("R5"); + if (rett.sign() > 0) + c -= rett; + } look_lim(month); if (c.sign() < 0) c = abs(c); else c = real(0.0); diff --git a/cg/cg4303.cpp b/cg/cg4303.cpp index 13bb35775..b1eb5118b 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -168,7 +168,7 @@ void CG4300_App::recalc_ventilation(int month, const char* codatt) // soltanto normali ed esenti IVA sono base di riparto if (_iva->get("S1").empty() || - _iva->get("S1") == "ES") + _iva->get("S1") == "ES") { real lurd = _pim->get_real("R0"); lurd += _pim->get_real("R1"); diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index f07478c55..784a20423 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -126,8 +126,8 @@ void CG4300_App::describe_ventilation(int month, const char* codatt) TString att(codatt); look_ptm(month, att); - real r0 = _ptm->get("S4"); - real r1 = _ptm->get("S5"); + real r0(_ptm->get("S4")); + real r1(_ptm->get("S5")); d->_r0 = r0; d->_r1 = r1; for (_pim->first(); !_pim->eof(); _pim->next()) @@ -145,6 +145,8 @@ void CG4300_App::describe_ventilation(int month, const char* codatt) real imposta = _pim->get_real("R1"); tiporeg tipomov = (tiporeg)_reg->get_long("I0"); + if (imponibile.is_zero() && imposta.is_zero()) continue; + if (mese <= month) { if (tipocr == 1 && tipomov == acquisto)