diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 1fb91bbc2..36b27bba1 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -525,24 +525,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) tipodoc == "IN" || tipodoc == "PG"); /* - * check date: se si calcola l'acconto, solo da 1/12 a 20/12 | 1/10 a 20/12 + * check date: se si calcola l'acconto, solo da 1/12 a 20/12 */ int accmonth = _isdifferita ? 11 : 12; - //if (_comp_acconto && date.month() != accmonth && date.day() > 20) - // continue; - if (_comp_acconto && _freqviva == "M" && date.month() != accmonth) - continue; - - if (_comp_acconto && _freqviva == "T") - if (date.month() != 10 && date.month() != 11 && date.month() != 12) - continue; if (_comp_acconto && date.month() == accmonth && date.day() > 20) - continue; + continue; bool corrisp = _reg->get_bool("B0"); tiporeg tipomov = (tiporeg)_reg->get_long("I0"); - + do { look_iva(_rmoviva->get("CODIVA")); diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 7cef14ef5..b82750d26 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -497,19 +497,41 @@ else if (_basecalc == incorso) // that's pazzesc but as it turns out there's no better way _comp_acconto = TRUE; // force recalc of current month - _recalc = one; - // insozza il water - update_firm(12); - + _recalc = one; + int need_refresh = FALSE; + for (int mese = 1; mese < _month; mese++) + if (is_month_ok_strict(mese) && (!look_lim(mese) || !_lim->get_bool("B0"))) + { + need_refresh = TRUE; + break; + } + if (need_refresh && yesno_box("Alcuni mesi precedenti non " + "risultano ricalcolati. E' consigliabile il ricalcolo. " + "Si desidera eseguirlo?")) + _recalc = ever; + + for (int m = 1; m <= _month; m++) + if (is_month_plain(m) || _recalc == ever) + { + if (_prind->iscancelled()) break; + update_firm(m); + } + // calcola l'acconto if (look_lim(12)) //posiziona anche la tabella lam { // TBC trimestrali, differite bc = result_liq(12); // somma i non fatturati/non annotati - bc += inf + ina; + bc += inf + ina; cre = _lim->get_real("R12"); - deb = _lim->get_real("R13"); + + //quando calcolo la 12° ci vado a sommare il + //versa. dovuto all'acconto + //allora devo ricalcolarmi l'effettivo credito + cre -= _lim->get_real("R11"); + + deb = _lim->get_real("R13") + inf + ina; if (bc.sign() > 0) acc = bc; // 11/09/1995 @@ -549,7 +571,12 @@ else error = 1; // pulisci il water _comp_acconto = FALSE; _isprint = FALSE; - update_firm(12); + /* + update_firm(12); + */ + for (int i = 1; i <= _month; i++) + if (is_month_plain(i)) + update_firm(i); _isprint = TRUE; }