diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index e4d52f360..9407b3906 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -1797,9 +1797,11 @@ void TLiquidazione_app::iva11_set_arr_pim(const TString& codatt) vtot += imp; ivav+=iva; } else - { //acquisti - atot += imp; ivaa+=iva; - } + //acquisti + if (tipodet != 9) // Evita di sommare gli quelli con tipo detraibilita' 9 (MI2209) + { + atot += imp; ivaa+=iva; + } } } diff --git a/cg/cg4303.cpp b/cg/cg4303.cpp index 600a5b718..830708056 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -397,12 +397,6 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) //}; -// defines per stabilire quale cazzo di metodo piace oggi alla prassi -// ------------------------------------------------------------------ -// Considera tutti i mesi del trimestre fino a quello indicato -// se lasciato indefinito usa solo il mese passato -#define OGGI_GLI_TIRA_DI_USARE_TRE_MESI - _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, bool stliq) { @@ -415,6 +409,7 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, TToken_string atts(codatts); const char* tmpatt; TString att; + const bool is_mens = _freqviva == "M"; real es_ni = 0.0; real vol_aff = 0.0;; @@ -422,19 +417,22 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, while ((tmpatt = atts.get()) != NULL) { att = tmpatt; -#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI - for (int m = (month == 13 ? 1 : (next_trim(month)-2)); m <= month; m++) - { -#else + if (!is_mens) // Trimestrali + for (int m = (month == 13 ? 1 : (next_trim(month)-2)); m <= month; m++) + { + if (!look_plm(m,att)) continue; + + vol_aff += _pam->get_real("R1"); + es_ni += _pum->get_real("R12"); + } + else + { // Mensili int m = month; -#endif if (!look_plm(m,att)) continue; vol_aff += _pam->get_real("R1"); es_ni += _pum->get_real("R12"); -#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI - } -#endif + } } // condizione 1 @@ -578,23 +576,25 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, **************************************************************************/ // scorri i bellissimi progressivi mensili + const int year = atoi((const char*)_year); for (_pim->first(); !_pim->eof(); _pim->next()) { - int year = atoi((const char*)_year); int ryear = atoi(*_pim_anno); int rmese = atoi(*_pim_mese); + int tipodet = atoi(*_pim_tipodet); // B3 significa che e' acq. o vendita valido per rimb. per aliquota if (!_pim->get_bool("B3")) continue; -#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI - if (year != ryear || - (month != 13 && (rmese < (next_trim(month)-2) || rmese > month))) - continue; -#else - if (year != ryear || (month != rmese)) - continue; -#endif + + if (!is_mens) // Trimestrali + { + if (year != ryear || + (month != 13 && (rmese < (next_trim(month)-2) || rmese > month))) + continue; + } else // Mensili + if (year != ryear || (month != rmese)) + continue; int tipomov = (tiporeg)_pim->get_long("I1"); @@ -608,10 +608,11 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts, ivav += iva; } else - { - atot += imp; - ivaa += iva; - } + if (tipodet != 9) // I progressivi con tipo detraibilita' a 9 vanno saltati (MI2209) + { + atot += imp; + ivaa += iva; + } } // finalmente