diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index b07f9c6de..63ae55ea9 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -172,7 +172,7 @@ bool TLiquidazione_app::user_create() // calcola liquidazione printer().setdate(printdate); - _recalc = one; + _recalc = needed; TApplication::set_firm(ditta); if (!look_lia()) return FALSE; diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index adfe82b08..9bb3db579 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -108,6 +108,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) bool calc = (_recalc == ever || (_recalc == one && month == _month)); if (!calc && _recalc != never) calc = !ok; bool gheravergot = FALSE; + bool quater = FALSE; TToken_string atts; TToken_string cattivs; @@ -120,7 +121,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) { TString16 codatt = _nditte->curr(LF_ATTIV).get("CODATT"); TString80 desatt = _nditte->curr(LF_ATTIV).get("DESCR"); - + quater = _nditte->curr().get_bool("FLIVA11Q"); // attivita' mista: ce ne sono in realta' due // viene calcolato nel ciclo su tipoatt (che viene ripetuto solo // se diventa TRUE); @@ -201,7 +202,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) while (_nditte->next_match(LF_ATTIV)); // se quater stampa riepilogo - if (atts.items() > 1 && month == _month) + if (/* atts.items() > 1*/ quater && month == _month) describe_att(month,atts); // occorre poterla chiamare altre volte con mesi diversi @@ -530,8 +531,14 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real imp = _pim_r->get_real("R0"); // imponibile real ivp = _pim_r->get_real("R1"); // IVA su imp. - real lor = _pim_r->get_real("R2"); // lordo - + real lor = _pim_r->get_real("R2"); // lordo + // le maledette fatture con scontrino sono sul registro dei + // corrispettivi, ma vanno riportate nelle vendite in stampa; + // dunque, le sommiamo in R5 e R6 di PIM anche se continuiamo + // a riportare il totale in R0 e R1. La stampa (describe_pim) + // dovra' scorporare + real ifs = _pim_r->get_real("R5"); // imponibile fatture con scontrino + real vfs = _pim_r->get_real("R6"); // IVA fatt. con scontrino if (liq && tipomov == vendita && !corrisp) // i corrispettivi sono gestiti a parte { @@ -550,7 +557,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (corrisp) { // l'ultimo casino - if (tipodoc == "CR" || tipodoc == "RF" || tipodoc == "SC") + if (tipodoc == "CR" || tipodoc == "RF" || tipodoc == "SC" || + tipodoc == "SN" || tipodoc == "CN") { // questi sono corrispettivi davvero; comportamento normale if (tipoiva == "VE") // da ventilare @@ -589,7 +597,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) imp += imponibile; ivp += imposta; } - lor -= imponibile + imposta; + lor -= imponibile + imposta; + ifs += imponibile; + vfs += imposta; } else // vendite normali a tutti gli effetti { @@ -600,12 +610,13 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) } imp += imponibile; ivp += imposta; + ifs += imponibile; + vfs += imposta; _pim_r->put("I0",NETTO); } } // if corrisp else // non corrisp - { - // imponibile e imposta separata + { // imponibile e imposta separata imp += imponibile; ivp += imposta; _pim_r->put("I0",NETTO); @@ -613,7 +624,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) _pim_r->put("R0",imp); _pim_r->put("R1",ivp); - _pim_r->put("R2",lor); + _pim_r->put("R2",lor); + _pim_r->put("R5",ifs); + _pim_r->put("R6",vfs); _pim->rewrite(); } while (_cur->next_match(LF_RMOVIVA)); diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index c46e0b0f8..c02cb52ab 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -364,15 +364,16 @@ real TLiquidazione_app::credito_prec(int month) *_lim_mese = 12; if (_lim->read() == NOERR) // considera anche il rimborso - c = _lim->get_real("R0") - _lim->get_real("R1"); + c = _lim->get_real("R0") + _lim->get_real("R1"); // e le eventuali rettifiche real rett = _lim->get_real("R5"); - c += -rett; + c += rett; // e le ulteriori detrazioni real detr = _lim->get_real("R6"); - c += detr; + c -= detr; // e l'acconto versato a dicembre - _del->zero(); + _del->zero(); + TString ditta = _nditte->curr().get("CODDITTA"); *_del_ditta = ditta; *_del_anno = yr; @@ -391,9 +392,12 @@ real TLiquidazione_app::credito_prec(int month) } // toglie il rimborso chiesto c = _lim->get_real("R0") + _lim->get_real("R1"); + // e le eventuali rettifiche real rett = _lim->get_real("R5"); - if (rett.sign() > 0) - c -= rett; + c += rett; + // e le ulteriori detrazioni + real detr = _lim->get_real("R6"); + c -= detr; } look_lim(month); diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index 479c36213..34ed3796b 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -386,11 +386,16 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt) if (corrisp) { // usa R0 e R1 visto che la ventilazione e' gia' - // stata calcolata - d->_r2 += _pim->get_real("R0"); - d->_r3 += _pim->get_real("R1"); - t2 += _pim->get_real("R0"); - t3 += _pim->get_real("R1"); + // stata calcolata + real ifs(_pim->get_real("R5")); + real vfs(_pim->get_real("R6")); + + d->_r2 += _pim->get_real("R0") - ifs; + d->_r3 += _pim->get_real("R1") - vfs; + t2 += _pim->get_real("R0") - ifs; + t3 += _pim->get_real("R1") - vfs; + t0 += ifs; + t1 += vfs; } else { @@ -557,9 +562,9 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts, d->_r3 += _lim->get_real("R0"); // risultato d->_r4 += _lim->get_real("R1"); // rimborso if (_lim->get("S7") == "D") - d->_r5 += _lim->get_real("R5"); // rettifiche a debito + d->_r5 += abs(_lim->get_real("R5")); // rettifiche a debito else - d->_r6 += _lim->get_real("R5"); // rettifiche a credito + d->_r6 += abs(_lim->get_real("R5")); // rettifiche a credito d->_f0 = _freqviva == "T"; diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index 788f45937..be5c4df93 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -335,7 +335,7 @@ bool Visliq_app::vis_one(int m) // ricalcolo liquidazione TMessage msg; TFilename f; - f.temp(); + f.temp("prliq"); TToken_string body(36); body.add(_year); @@ -382,20 +382,17 @@ bool Visliq_app::vis_one(int m) msk.field(F_ACCONTO).set(acconto.string()); long line; - CURSOR oldcur = get_cursor(TASK_WIN); TExternal_app liq("cg4 -2"); { TProgind(10l,"Estrazione liquidazione\nPrego attendere", FALSE,FALSE); liq.run(); - set_cursor(TASK_WIN,CURSOR_WAIT); - if (liq.error()) { beep(); - set_cursor(TASK_WIN, oldcur); return FALSE; - } + } + begin_wait(); line = brw.set_text(f, "CALCOLO LIQUIDAZIONE D'IMPOSTA"); brw.goto_pos(brw.lines()-16l, 9); @@ -418,8 +415,8 @@ bool Visliq_app::vis_one(int m) if (lrisd == -1l || lrisc == -1l) return FALSE; if (lvers == -1l) lvers = lrisc+1l; - set_cursor(TASK_WIN, oldcur); - + end_wait(); + for(;;) { KEY k = msk.run(); @@ -524,8 +521,9 @@ bool Visliq_app::vis_one(int m) { _lim->put("B0", ""); _lim->rewrite(); - vsw->refresh(); - } + } + if (write_lim || write_lia) + vsw->refresh(); } else if (k == K_ESC || k == K_END) break; }