From 69df03a53716565a240daf1733da2fbf619a82ee Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 13 Jun 1995 09:32:56 +0000 Subject: [PATCH] corretto errore stampa liquidazione in coda ai registri git-svn-id: svn://10.65.10.50/trunk@1473 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg4301.cpp | 195 +++++++++++++++++++++++++------------------------- 1 file changed, 98 insertions(+), 97 deletions(-) diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 3a5a9066c..e07ab4e85 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -148,7 +148,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) look_lim(liq_month(month), TRUE); if (_isregis && _lim->get_bool("B1")) - return TRUE; + return TRUE; TConfig cnf(CONFIG_DITTA, "cg"); _isdifferita = cnf.get_bool("GeLiDi") && _month != 13; @@ -207,7 +207,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) if (!(_month == 13 && month > 1)) { _vend_arr.destroy(); - _corr_arr.destroy(); + _corr_arr.destroy(); } cattivs = ""; @@ -258,11 +258,12 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) for (_reg->first(); _reg->good(); _reg->next()) { - if (codatt == _reg->get("S8") && _reg->get_int("I0") == 2) + if (codatt == _reg->get("S8")) { - if (!_isvent) _isvent = _reg->get_bool("B3"); if (!riepliq) riepliq = _reg->get_bool("B6"); - if (!stliq) stliq = _reg->get_bool("B7"); + if (!stliq) stliq = _reg->get_bool("B7"); + if (_reg->get_int("I0") == 2) + if (!_isvent) _isvent = _reg->get_bool("B3"); } } @@ -359,17 +360,17 @@ bool TLiquidazione_app::update_att(int month, const char* codatt, void TLiquidazione_app::zero_firm(int month) { - for (_rmb->first(); !_rmb->eof(); _rmb->next()) - { - if (atoi((const char*)(*_rmb_mese)) == month && - _year == (const char*)(*_rmb_anno)) - { - _rmb->put("R0",""); - _rmb->put("R1",""); - _rmb->put("R2",""); - _rmb->rewrite(); - } - } + for (_rmb->first(); !_rmb->eof(); _rmb->next()) + { + if (atoi((const char*)(*_rmb_mese)) == month && + _year == (const char*)(*_rmb_anno)) + { + _rmb->put("R0",""); + _rmb->put("R1",""); + _rmb->put("R2",""); + _rmb->rewrite(); + } + } } void TLiquidazione_app::zero_att(int month, const char* codatt) @@ -497,7 +498,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) const bool sreg = !isreg; const bool rs8 = _reg_r->get("S8") != trueatt; const bool cmt = !_cur->is_first_match(LF_RMOVIVA); - const bool sosp_imp = _reg->get_bool("B1"); + const bool sosp_imp = _reg->get_bool("B1"); const TRectype& rcs = _cur->curr(LF_CAUSALI); const bool fattrit = rcs.get_bool("RITFATT"); @@ -531,8 +532,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real asimp_iva = 0.0; // imposta acquisti sosp. imposta real vsimp_imp = 0.0; // imponibile vendite sosp. imposta real vsimp_iva = 0.0; // imposta vendite sosp. imposta - real rit_imp = 0.0; // imponibile fatture in ritardo - real rit_iva = 0.0; // IVA fatture in ritardo + real rit_imp = 0.0; // imponibile fatture in ritardo + real rit_iva = 0.0; // IVA fatture in ritardo TString codiva = _iva->get("CODTAB"); TString tipoiva = _iva->get("S1"); @@ -593,25 +594,25 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (sosp_imp) // sospensione di imposta { - if (tipomov == vendita) - { - vsimp_imp = imponibile; - vsimp_iva = imposta; - } - else - { - asimp_imp = imponibile; - asimp_iva = imposta; - } - assp_imp += asimp_imp; - assp_iva += asimp_iva; - vssp_imp += vsimp_imp; - vssp_iva += vsimp_iva; + if (tipomov == vendita) + { + vsimp_imp = imponibile; + vsimp_iva = imposta; + } + else + { + asimp_imp = imponibile; + asimp_iva = imposta; + } + assp_imp += asimp_imp; + assp_iva += asimp_iva; + vssp_imp += vsimp_imp; + vssp_iva += vsimp_iva; } else if (fattrit && month != 13) { - rit_imp = imponibile; - rit_iva = imposta; + rit_imp = imponibile; + rit_iva = imposta; } else if (!fattrit) // normale { @@ -681,31 +682,31 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) // operazioni per calcolo rimborso infracazzuale // Scudler 1995 - if (ivarimb) - { - bool ok = _isagricolo ? tipoagr == 2 : FALSE; - - if (tipomov == acquisto && !ok) - ok = (tipocr == 0 || tipocr == 1 || tipocr == 5 || tipocr == 9); + if (ivarimb) + { + bool ok = _isagricolo ? tipoagr == 2 : FALSE; + + if (tipomov == acquisto && !ok) + ok = (tipocr == 0 || tipocr == 1 || tipocr == 5 || tipocr == 9); - if (tipomov == vendita && !ok) - ok = tipoiva != "NS" && tipodoc != "CR" && - tipodoc != "SC" && tipodoc != "RF" && tipocr != 4; + if (tipomov == vendita && !ok) + ok = tipoiva != "NS" && tipodoc != "CR" && + tipodoc != "SC" && tipodoc != "RF" && tipocr != 4; if (ok) - { - // aggiurna tabedda - look_rmb(month, codiva, tipomov, TRUE); - real imp = _rmb->get_real("R0"); - real iva = _rmb->get_real("R1"); - imp += imponibile; - iva += imposta; - _rmb->put("R0", imp); - _rmb->put("R1", iva); - _rmb->put("R2", _iva->get_real("R0")); - _rmb->rewrite(); - } - } + { + // aggiurna tabedda + look_rmb(month, codiva, tipomov, TRUE); + real imp = _rmb->get_real("R0"); + real iva = _rmb->get_real("R1"); + imp += imponibile; + iva += imposta; + _rmb->put("R0", imp); + _rmb->put("R1", iva); + _rmb->put("R2", _iva->get_real("R0")); + _rmb->rewrite(); + } + } // operazioni esenti if (tipoiva == "ES") @@ -894,15 +895,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (tipomov == vendita) { - fsi += vsimp_imp; - fsv += vsimp_iva; + fsi += vsimp_imp; + fsv += vsimp_iva; } else { - fsi += asimp_imp; - fsv += asimp_iva; - bdi += bolld_imp; - bdv += bolld_iva; + fsi += asimp_imp; + fsv += asimp_iva; + bdi += bolld_imp; + bdv += bolld_iva; } if (liq && tipomov == vendita && !corrisp) @@ -1007,7 +1008,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) * e assegnarli al codice IVA A35 in caso di liq. annuale */ adf += imponibile; - adi += imposta; + adi += imposta; } if (corrisp && !true_corrisp) @@ -1225,8 +1226,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) _year = format("%d", atoi(_year)-1); if (!look_lim(12)) { - _year = yr; - differita = FALSE; + _year = yr; + differita = FALSE; } } if (differita) @@ -1330,7 +1331,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) /* totalizza importi 74 ter */ if (_isviaggio) { - // somma totali per calcolo successivo + // somma totali per calcolo successivo c_iCEE += _plm->get_real("R5"); c_eCEE += _plm->get_real("R6"); a_iCEE += _plm->get_real("R7"); @@ -1379,7 +1380,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (month < 13) { // toglie credito precedente - cred_prec = credito_prec(month); + cred_prec = credito_prec(month); risultato -= cred_prec; res_cred += cred_prec; // vedi se c'era un debito precedente per debiti < 50.000 @@ -1407,26 +1408,26 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) int tipoatt = att[att.len() -1] - '0'; if (tipoatt == 1) // su PLA l'attivita' e' sempre 1 { - look_pla(att); - real vf1 = _pla->get_real("R14"); - real vf2(_pla->get("S1")); - real iaq = _pla->get_real("R11"); // IVA acquisti - real ppg = _pla->get_real("R12"); // pro-rata pagato - - vol_aff_1 += vf1; - vol_aff_2 += vf2; - vol_aff_t = vf1 + vf2; - vol_aff_l += _pla->get_real("R0"); // volume affari lordo - - real es_b1 = _pla->get_real("R1"); - real es_b2 = _pla->get_real("R2"); - real es_b3 = _pla->get_real("R3"); - real csamm = _pla->get_real("R4"); - - // calcola nuovo prorata per ogni attivita' (miste: 1+2) - real ris = vol_aff_t - csamm - es_b3; - real prorata(0.0); - if (!ris.is_zero()) + look_pla(att); + real vf1 = _pla->get_real("R14"); + real vf2(_pla->get("S1")); + real iaq = _pla->get_real("R11"); // IVA acquisti + real ppg = _pla->get_real("R12"); // pro-rata pagato + + vol_aff_1 += vf1; + vol_aff_2 += vf2; + vol_aff_t = vf1 + vf2; + vol_aff_l += _pla->get_real("R0"); // volume affari lordo + + real es_b1 = _pla->get_real("R1"); + real es_b2 = _pla->get_real("R2"); + real es_b3 = _pla->get_real("R3"); + real csamm = _pla->get_real("R4"); + + // calcola nuovo prorata per ogni attivita' (miste: 1+2) + real ris = vol_aff_t - csamm - es_b3; + real prorata(0.0); + if (!ris.is_zero()) prorata = (es_b1/ris) * CENTO; real conguaglio = 0.0; prorata.round(ROUND_LIRA); @@ -1437,7 +1438,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) conguaglio = topay - ppg; conguaglio.round(ROUND_LIRA); } - _pla->put("R9", conguaglio); + _pla->put("R9", conguaglio); _pla->put("R10",prorata); tot_cong += conguaglio; _pla->rewrite(); @@ -1448,7 +1449,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) look_pla(att, TRUE); _pla->put("R8", prorata); _pla->rewrite(); - _year = yr; + _year = yr; } } @@ -1512,11 +1513,11 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (month == 13 || differita) { - // scrivi totali rettifiche e rimborsi - // nella finale oppure se copiati da - // anno precedente - _lim->put("R1",rimborsi); - _lim->put("R5",rettifiche); + // scrivi totali rettifiche e rimborsi + // nella finale oppure se copiati da + // anno precedente + _lim->put("R1",rimborsi); + _lim->put("R5",rettifiche); } /* @@ -1606,8 +1607,8 @@ void TLiquidazione_app::recalc_annual(const char* att) _reg->get_bool("B1")) // sospensione di imposta continue; - if (tipoatt == 1) volaff1 += _pim->get_real("R0"); - else volaff2 += _pim->get_real("R0"); + if (tipoatt == 1) volaff1 += _pim->get_real("R0"); + else volaff2 += _pim->get_real("R0"); } // calcola esenti, cessioni, lordo vendite, prorata pagato