Correzione errore MI6283, relativo alla liquidazione di una ditta con
attivita' agricola e non. git-svn-id: svn://10.65.10.50/trunk@5456 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
37b5973cdb
commit
04969f4a47
@ -2063,13 +2063,24 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
real vol_aff_l = 0.0;
|
real vol_aff_l = 0.0;
|
||||||
real tot_cong = 0.0;
|
real tot_cong = 0.0;
|
||||||
|
|
||||||
bool differita = FALSE;
|
bool differita = FALSE;
|
||||||
|
bool almeno_una_agricola = FALSE;
|
||||||
|
bool almeno_una_normale = FALSE;
|
||||||
int attc = 0; // counter attivita'
|
int attc = 0; // counter attivita'
|
||||||
|
|
||||||
|
TLocalisamfile& attiv = _nditte->lfile(LF_ATTIV);
|
||||||
|
|
||||||
while ((tmpatt = atts.get()) != NULL)
|
while ((tmpatt = atts.get()) != NULL)
|
||||||
{
|
{
|
||||||
TString att(tmpatt);
|
TString att(tmpatt);
|
||||||
|
|
||||||
|
// Reperisce il flag di regime agricolo per ogni attivita'...
|
||||||
|
attiv.put(ATT_CODATT,att);
|
||||||
|
attiv.read();
|
||||||
|
const bool attivita_agricola = attiv.get_bool(ATT_REGAGR);
|
||||||
|
almeno_una_agricola |= attivita_agricola;
|
||||||
|
almeno_una_normale |= !attivita_agricola;
|
||||||
|
|
||||||
if (_isdifferita && is_first_month(month+deltam))
|
if (_isdifferita && is_first_month(month+deltam))
|
||||||
{
|
{
|
||||||
// usa i totali del mese di dicembre dell'anno
|
// usa i totali del mese di dicembre dell'anno
|
||||||
@ -2100,7 +2111,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
// a debito: IVA vendite, debito precedente
|
// a debito: IVA vendite, debito precedente
|
||||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||||
|
|
||||||
if (!_isagricolo)
|
if (!attivita_agricola)
|
||||||
{
|
{
|
||||||
iva_vend += _plm->get_real("R0");
|
iva_vend += _plm->get_real("R0");
|
||||||
iva_acq += _plm->get_real("R1");
|
iva_acq += _plm->get_real("R1");
|
||||||
@ -2112,7 +2123,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
{
|
{
|
||||||
// Tiene aggiornata l'iva vendite
|
// Tiene aggiornata l'iva vendite
|
||||||
iva_vend += _plm->get_real("R6") + _plm->get_real("R5");
|
iva_vend += _plm->get_real("R6") + _plm->get_real("R5");
|
||||||
// Tiene aggiornata l'iva acquisti, che andra' rettificata all'uscita
|
// Tiene aggiornata l'iva acquisti, che andra' rettificata all'uscita del mese
|
||||||
// secondo la formula:
|
// secondo la formula:
|
||||||
// iva_acq = iva_acq + iva detraibile calcolata
|
// iva_acq = iva_acq + iva detraibile calcolata
|
||||||
// l'iva detraibile calcolata e' a sua volta fatta cosi'
|
// l'iva detraibile calcolata e' a sua volta fatta cosi'
|
||||||
@ -2128,7 +2139,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||||
|
|
||||||
// detrazioni solo non in regime agricolo
|
// detrazioni solo non in regime agricolo
|
||||||
if (!_isagricolo)
|
if (!attivita_agricola)
|
||||||
{
|
{
|
||||||
risultato -= (_plm->get_real("R3") + _plm->get_real("R4"));
|
risultato -= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||||
res_cred += (_plm->get_real("R3") + _plm->get_real("R4"));
|
res_cred += (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||||
@ -2231,23 +2242,22 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (attivita_agricola)
|
||||||
|
{
|
||||||
|
real perc; // percentuale di deducibilita'
|
||||||
|
real iva_ded; // iva deducibile
|
||||||
|
|
||||||
|
perc = imp_agr2 /(imp_agr1 + imp_agr2);
|
||||||
|
perc.round(2);
|
||||||
|
iva_ded = acq_noCEE * perc;
|
||||||
|
iva_ded.round(ROUND_LIRA);
|
||||||
|
iva_acq += iva_ded;
|
||||||
|
res_debt += iva_vend;
|
||||||
|
res_cred += iva_acq;
|
||||||
|
risultato += (iva_vend - iva_acq);
|
||||||
|
} // __ end of agricolo
|
||||||
} // end ciclo su attivita'
|
} // end ciclo su attivita'
|
||||||
|
|
||||||
if (_isagricolo)
|
|
||||||
{
|
|
||||||
real perc; // percentuale di deducibilita'
|
|
||||||
real iva_ded; // iva deducibile
|
|
||||||
|
|
||||||
perc = imp_agr2 /(imp_agr1 + imp_agr2);
|
|
||||||
perc.round(2);
|
|
||||||
iva_ded = acq_noCEE * perc;
|
|
||||||
iva_ded.round(ROUND_LIRA);
|
|
||||||
iva_acq += iva_ded;
|
|
||||||
res_debt += iva_vend;
|
|
||||||
res_cred += iva_acq;
|
|
||||||
risultato += (iva_vend - iva_acq);
|
|
||||||
} // __ end of _isagricolo
|
|
||||||
|
|
||||||
if (month < 13) // va bene anche se differita sommando deltam (che e' 0 normalmente)
|
if (month < 13) // va bene anche se differita sommando deltam (che e' 0 normalmente)
|
||||||
{
|
{
|
||||||
// toglie credito precedente
|
// toglie credito precedente
|
||||||
@ -2397,8 +2407,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
_lim->put("R2",cred_cost);
|
_lim->put("R2",cred_cost);
|
||||||
_lim->put("R3",deb_mens);
|
_lim->put("R3",deb_mens);
|
||||||
_lim->put("R4",perc_r);
|
_lim->put("R4",perc_r);
|
||||||
|
|
||||||
if (!_isagricolo)
|
if (almeno_una_normale)
|
||||||
_lim->put("R6",detrazioni);
|
_lim->put("R6",detrazioni);
|
||||||
else // per evitare sbagli nei ricalcoli esterni
|
else // per evitare sbagli nei ricalcoli esterni
|
||||||
_lim->put("R6","");
|
_lim->put("R6","");
|
||||||
@ -2487,7 +2497,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
|||||||
if (rettifiche.sign() > 0) res_debt += rettifiche;
|
if (rettifiche.sign() > 0) res_debt += rettifiche;
|
||||||
else res_cred -= rettifiche;
|
else res_cred -= rettifiche;
|
||||||
|
|
||||||
if (!_isagricolo) res_cred += detrazioni;
|
if (almeno_una_normale)
|
||||||
|
res_cred += detrazioni;
|
||||||
|
|
||||||
risultato = res_debt - res_cred;
|
risultato = res_debt - res_cred;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user