Corretto errore MI3459: corretta in generale la liquidazione differita.
git-svn-id: svn://10.65.10.50/trunk@3599 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2caafb668b
commit
ed8af9c3b3
@ -586,8 +586,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
TString codiva = _iva->get("CODTAB");
|
||||
TString tipoiva = _iva->get("S1");
|
||||
TString riga11_v = _iva->get("S0");
|
||||
int tipoes_v = (int)_iva->get_long("I3");
|
||||
int tipoes_a = (int)_iva->get_long("I4");
|
||||
//TString tipoes_v = _iva->get("S2");
|
||||
//TString tipoes_a = _iva->get("S9");
|
||||
int tipoes_v = (int)_iva->get_long("I3");
|
||||
int tipoes_a = (int)_iva->get_long("I4");
|
||||
int tipoagr = atoi(_iva->get("S4"));
|
||||
int tipoag = atoi(_iva->get("S5"));
|
||||
int tipopla = atoi(_iva->get("S3"));
|
||||
@ -1377,42 +1379,19 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
{
|
||||
TString att(tmpatt);
|
||||
|
||||
if (_isdifferita && is_first_month(month))
|
||||
if (_isdifferita && is_first_month(month+deltam))
|
||||
{
|
||||
// usa i totali del mese di dicembre dell'anno
|
||||
// precedente
|
||||
differita = TRUE;
|
||||
TString yr(_year);
|
||||
_year = format("%d", atoi(_year)-1);
|
||||
if (!look_lim(12))
|
||||
if (!look_lim(12)) //controlla solamente, il vero posizionamento lo fa dopo
|
||||
{
|
||||
_year = yr;
|
||||
differita = FALSE;
|
||||
}
|
||||
}
|
||||
if (differita)
|
||||
{
|
||||
if (attc == 0)
|
||||
{
|
||||
risultato = result_liq(12);
|
||||
deb_mens = _lim->get_real("R3");
|
||||
detrazioni = _lim->get_real("R6");
|
||||
perc_r = _lim->get_real("R4");
|
||||
cred_cost = _lim->get_real("R2");
|
||||
rettifiche = _lim->get_real("R5");
|
||||
rimborsi = _lim->get_real("R1");
|
||||
// leggi anche tutti gli altri totali
|
||||
acc_dec = _lim->get_real("R11");
|
||||
res_cred = _lim->get_real("R12");
|
||||
res_debt = _lim->get_real("R13");
|
||||
iva_vend = _lam->get_real("R0");
|
||||
iva_acq = _lam->get_real("R1");
|
||||
cred_prec = _lam->get_real("R2");
|
||||
debt_precd = _lam->get_real("R3");
|
||||
_year = format("%d", atoi(_year)+1);
|
||||
}
|
||||
}
|
||||
else // puo' essere: differita e mese > 1 o non differita e mese qualunque
|
||||
{
|
||||
for (int m = 1; m <= 13; m++)
|
||||
{
|
||||
@ -1421,8 +1400,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
if (!is_month_ok(m, month))
|
||||
continue;
|
||||
|
||||
look_plm(m, att);
|
||||
bool is_lim = look_lim(m);
|
||||
look_plm(differita ? 12 : m, att);
|
||||
bool is_lim = look_lim(_isdifferita ? m+deltam : m);
|
||||
|
||||
// gia' conteggiato: prorata
|
||||
// da conteggiare: IVA vendite ag. viaggio
|
||||
@ -1508,7 +1487,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
} // fine ciclo sul mese
|
||||
|
||||
// counter attivita' per evitare troppi versamenti
|
||||
attc++;
|
||||
attc++;
|
||||
if (differita)
|
||||
_year = format("%d", atoi(_year)+1);
|
||||
} // fine else
|
||||
|
||||
if (!(_isdifferita && is_first_month(month+deltam)))
|
||||
@ -1541,27 +1522,24 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
}
|
||||
} // end ciclo su attivita'
|
||||
|
||||
if (!(_isdifferita && is_first_month(month+deltam)))
|
||||
if (month < 13) // va bene anche se differita sommando deltam (che e' 0 normalmente)
|
||||
{
|
||||
// toglie credito precedente
|
||||
cred_prec = credito_prec(month+deltam);
|
||||
risultato -= cred_prec;
|
||||
res_cred += cred_prec;
|
||||
// vedi se c'era un debito precedente per debiti < 50.000
|
||||
debt_precd = debt_prec(month+deltam);
|
||||
risultato += debt_precd;
|
||||
res_debt += debt_precd;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (month < 13) // va bene anche se differita sommando deltam (che e' 0 normalmente)
|
||||
{
|
||||
// toglie credito precedente
|
||||
cred_prec = credito_prec(month+deltam);
|
||||
risultato -= cred_prec;
|
||||
res_cred += cred_prec;
|
||||
// vedi se c'era un debito precedente per debiti < 50.000
|
||||
debt_precd = debt_prec(month+deltam);
|
||||
risultato += debt_precd;
|
||||
res_debt += debt_precd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// per l'annuale considera solo il credito a inizio anno
|
||||
cred_prec = credito_prec(_freqviva == "M" ? 1 : 3);
|
||||
risultato -= cred_prec;
|
||||
res_cred += cred_prec;
|
||||
}
|
||||
}
|
||||
// per l'annuale considera solo il credito a inizio anno
|
||||
cred_prec = credito_prec(_freqviva == "M" ? 1 : 3);
|
||||
risultato -= cred_prec;
|
||||
res_cred += cred_prec;
|
||||
}
|
||||
|
||||
|
||||
if (month == 13)
|
||||
|
Loading…
x
Reference in New Issue
Block a user