Corretto errore MI3538 sull'arrotondamento importi in annuale.

Se l'importo e' compreso tra 0 e 500 va arrotondato alle 1000
inferiori, da 501 a 999 va arrotondato alle 1000 superiori.


git-svn-id: svn://10.65.10.50/trunk@4106 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1997-01-30 16:39:10 +00:00
parent 8966a87447
commit 3331b0f3c4
5 changed files with 89 additions and 36 deletions

@ -329,7 +329,7 @@ bool TLiquidazione_app::user_create()
end_wait();
}
else delete pnd;
return _is_interactive;
}

@ -432,6 +432,11 @@ public:
// gli interessi se interesse = TRUE
real versamenti_IVA(int month, const char* types, bool interesse = FALSE);
// Funzione personale di arrotondamento alle 1000 LIRE per l'annuale.
// Risolve il seguente problema: da 0 a 500 lire arrotonda alle mille inferiori
// da 501 a 999 arrotonda alle mille superiori.
void round_mille_lire(real& d);
// supporto stampa
void describe_firm(int month);
void describe_att(int month, const char* codatt, bool isresult, char flags);

@ -2260,10 +2260,12 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
if (prorata > 0.0)
{
topay = (iaq + ppg) * (prorata / CENTO);
topay.round(ROUND_MILLELIRE);
//topay.round(ROUND_MILLELIRE);
round_mille_lire(topay);
}
conguaglio = topay - ppg;
conguaglio.round(ROUND_MILLELIRE);
//conguaglio.round(ROUND_MILLELIRE);
round_mille_lire(conguaglio);
}
if (prorata < 0.0) prorata = 0.0;
_pla->put("R9", conguaglio);
@ -2420,18 +2422,31 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
if (month == 13)
{
// molto codice duplicato, ma ne val la pena (vedi sopra)
iva_vend.round(ROUND_MILLELIRE);
iva_acq.round(ROUND_MILLELIRE);
detrazioni.round(ROUND_MILLELIRE);
versamenti.round(ROUND_MILLELIRE);
vers_int.round(ROUND_MILLELIRE);
rimborsi.round(ROUND_MILLELIRE);
rettifiche.round(ROUND_MILLELIRE);
deb_mens.round(ROUND_MILLELIRE);
cred_prec.round(ROUND_MILLELIRE);
tot_cong.round(ROUND_MILLELIRE);
acc_dec.round(ROUND_MILLELIRE);
debt_precd.round(ROUND_MILLELIRE);
//iva_vend.round(ROUND_MILLELIRE);
//iva_acq.round(ROUND_MILLELIRE);
//detrazioni.round(ROUND_MILLELIRE);
//versamenti.round(ROUND_MILLELIRE);
//vers_int.round(ROUND_MILLELIRE);
//rimborsi.round(ROUND_MILLELIRE);
//rettifiche.round(ROUND_MILLELIRE);
//deb_mens.round(ROUND_MILLELIRE);
//cred_prec.round(ROUND_MILLELIRE);
//tot_cong.round(ROUND_MILLELIRE);
//acc_dec.round(ROUND_MILLELIRE);
//debt_precd.round(ROUND_MILLELIRE);
round_mille_lire(iva_vend);
round_mille_lire(iva_acq);
round_mille_lire(detrazioni);
round_mille_lire(versamenti);
round_mille_lire(vers_int);
round_mille_lire(rimborsi);
round_mille_lire(rettifiche);
round_mille_lire(deb_mens);
round_mille_lire(cred_prec);
round_mille_lire(tot_cong);
round_mille_lire(acc_dec);
round_mille_lire(debt_precd);
res_cred = iva_acq + versamenti + vers_int + cred_prec + acc_dec;
res_debt = iva_vend + rimborsi + debt_precd; // Tolto la somma di deb_mens, perche' gia' presente in iva_vend

@ -731,7 +731,8 @@ real TLiquidazione_app::versamenti_IVA(int month, const char* types, bool intr)
real importo_dovuto_arrotondato(_del->get_real("R0"));
real work(importo_dovuto_non_arrotondato);
work.round(ROUND_MILLELIRE);
//work.round(ROUND_MILLELIRE);
round_mille_lire(work);
if (_month == 13 && _freqviva == "T" && importo_dovuto_arrotondato == work)
ret += importo_dovuto_non_arrotondato; // Questo e' l'importo lordo non arrotondato!!
else
@ -758,6 +759,12 @@ real TLiquidazione_app::versamenti_IVA(int month, const char* types, bool intr)
return ret;
}
void TLiquidazione_app::round_mille_lire(real& d)
{
if (d % 500.0 == ZERO) d -= 1.0;
d.round(ROUND_MILLELIRE);
}
// Ritorna il parametro della liquidazione differita per la ditta corrente, cosi come
// e' scritto sui parametri liquidazione (LIA)
// Se si passa 0 (default) vede prende la ditta correntemente in corso di calcolo

@ -390,21 +390,30 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
// Solita minchiatina dell'arrotondamento alle 1000 lirette se siamo in annuale
if (month == 13)
{
d->_r0.round(ROUND_MILLELIRE);
d->_r1.round(ROUND_MILLELIRE);
d->_r2.round(ROUND_MILLELIRE);
d->_r3.round(ROUND_MILLELIRE);
d->_r4.round(ROUND_MILLELIRE);
d->_r5.round(ROUND_MILLELIRE);
d->_r6.round(ROUND_MILLELIRE);
d->_r8.round(ROUND_MILLELIRE);
//d->_r0.round(ROUND_MILLELIRE);
//d->_r1.round(ROUND_MILLELIRE);
//d->_r2.round(ROUND_MILLELIRE);
//d->_r3.round(ROUND_MILLELIRE);
//d->_r4.round(ROUND_MILLELIRE);
//d->_r5.round(ROUND_MILLELIRE);
//d->_r6.round(ROUND_MILLELIRE);
//d->_r8.round(ROUND_MILLELIRE);
round_mille_lire(d->_r0);
round_mille_lire(d->_r1);
round_mille_lire(d->_r2);
round_mille_lire(d->_r3);
round_mille_lire(d->_r4);
round_mille_lire(d->_r5);
round_mille_lire(d->_r6);
round_mille_lire(d->_r8);
}
d->_r7 = (d->_r4 * CENTO)/(d->_r4 + d->_r6); d->_r7.round(2); // percentuale
d->_r9 = (d->_r1 * d->_r7)/CENTO;
if (month==13)
d->_r9.round(ROUND_MILLELIRE);
//d->_r9.round(ROUND_MILLELIRE);
round_mille_lire(d->_r9);
else
d->_r9.round(ROUND_LIRA);
@ -415,7 +424,9 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
if (d->_r10.sign() > 0)
{
d->_r11 = (d->_r10/(alcnt/CENTO)) * (aliva/CENTO); // iva dovuta
if (month == 13) d->_r11.round(ROUND_MILLELIRE);
if (month == 13)
//d->_r11.round(ROUND_MILLELIRE);
round_mille_lire(d->_r11);
else d->_r11.ceil(ROUND_LIRA);
}
if (month == 13)
@ -816,19 +827,26 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
if (pr > 0.0)
{
topay = (iaq + ppg) * (pr / CENTO);
topay.round(ROUND_MILLELIRE);
//topay.round(ROUND_MILLELIRE);
round_mille_lire(topay);
}
co = topay - ppg;
co.round(ROUND_MILLELIRE);
//co.round(ROUND_MILLELIRE);
round_mille_lire(co);
}
_DescrItem* dd = new _DescrItem(ANNUAL);
// MonsterFish: arrotonda alle 1000 LIRE B1,B2,B3,B4
e1.round(ROUND_MILLELIRE);
e2.round(ROUND_MILLELIRE);
e3.round(ROUND_MILLELIRE);
ris.round(ROUND_MILLELIRE);
//e1.round(ROUND_MILLELIRE);
//e2.round(ROUND_MILLELIRE);
//e3.round(ROUND_MILLELIRE);
//ris.round(ROUND_MILLELIRE);
round_mille_lire(e1);
round_mille_lire(e2);
round_mille_lire(e3);
round_mille_lire(ris);
// prorata
if (!pr.is_zero())
dd->_f0 |= IS_PRORATA;
@ -920,7 +938,9 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
if (_lim->get_real("R0") > ZERO)
{
real iva = _lim->get_real("R0") + _lim->get_real("R14");
if (month == 13) iva.round(ROUND_MILLELIRE);
if (month == 13)
//iva.round(ROUND_MILLELIRE);
round_mille_lire(iva);
if (iva >= IVA_DA_RIPORTARE)
_stampa_vers = TRUE;
}
@ -1585,7 +1605,9 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
if (risultato.sign() < 0)
{
real iva = abs(risultato);
if (_isannual || _isriepilogo) iva.round(ROUND_MILLELIRE);
if (_isannual || _isriepilogo)
//iva.round(ROUND_MILLELIRE);
round_mille_lire(iva);
set_row(rw++,"@23gCREDITO ATTUALE@58g%r",&iva);
if (_is_visliq)
{ // se chiamata dalla visualizzazione mette 2 righe vuote se non vi sono interessi
@ -1596,9 +1618,13 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
}
else
{
if (_month == 13) interessi.round(ROUND_MILLELIRE);
if (_month == 13)
//interessi.round(ROUND_MILLELIRE);
round_mille_lire(interessi);
real iva = risultato + interessi;
if (_isannual || _isriepilogo) iva.round(ROUND_MILLELIRE);
if (_isannual || _isriepilogo)
// iva.round(ROUND_MILLELIRE);
round_mille_lire(iva);
if (!iva.is_zero())
{
if (!interessi.is_zero())