Skudlerings
Ricomincia a dare risultati sensati (finalmente) git-svn-id: svn://10.65.10.50/trunk@897 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
24cc12f6dd
commit
0c61ac5a86
148
cg/cg4301.cpp
148
cg/cg4301.cpp
@ -880,16 +880,22 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
// Calcolo liq. mensili e liq. annuali
|
||||
{
|
||||
TToken_string atts(codatts);
|
||||
TToken_string tt(60);
|
||||
const char* tmpatt;
|
||||
|
||||
real risultato = 0.0;
|
||||
real vol_aff = 0.0;
|
||||
real debito_prec = 0.0;
|
||||
real detrazioni = 0.0;
|
||||
real versamenti = 0.0;
|
||||
real vers_int = 0.0;
|
||||
real rimborsi = 0.0;
|
||||
real rettifiche = 0.0;
|
||||
real rettifiche = 0.0;
|
||||
real res_debt = 0.0;
|
||||
real res_cred = 0.0;
|
||||
real cred_prec = 0.0;
|
||||
real debt_precd = 0.0;
|
||||
real acc_dec = 0.0;
|
||||
real iva_vend = 0.0;
|
||||
real iva_acq = 0.0;
|
||||
|
||||
// totali per agenzie viaggio
|
||||
real c_iCEE = 0.0;
|
||||
@ -910,7 +916,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
{
|
||||
TString att(tmpatt);
|
||||
|
||||
if (_isdifferita && is_first_month(month) && attc == 0)
|
||||
if (_isdifferita && is_first_month(month))
|
||||
{
|
||||
// usa i totali del mese di dicembre dell'anno
|
||||
// precedente
|
||||
@ -924,22 +930,33 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
}
|
||||
}
|
||||
if (differita)
|
||||
{
|
||||
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");
|
||||
_year = format("%d", atoi(_year)+1);
|
||||
{
|
||||
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
|
||||
tt = _lim->get("S0");
|
||||
iva_vend = tt.get(); iva_acq = tt.get();
|
||||
tt = _lim->get("S1");
|
||||
res_debt = tt.get(); res_cred = tt.get();
|
||||
tt = _lim->get("S2");
|
||||
cred_prec = tt.get(); debt_precd = tt.get();
|
||||
acc_dec = (const char*)_lim->get("S3");
|
||||
_year = format("%d", atoi(_year)+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int m = 1; m <= month; m++)
|
||||
for (int m = 1; m <= 12; m++)
|
||||
{
|
||||
// ciclo su tutti i mesi del caso (1 o 3;
|
||||
// tutti se annuale, compreso 13
|
||||
// tutti se annuale)
|
||||
if (!is_month_ok(m, month))
|
||||
continue;
|
||||
|
||||
@ -949,37 +966,48 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
// gia' conteggiato: prorata
|
||||
// da conteggiare: IVA vendite ag. viaggio
|
||||
// a debito: IVA vendite, debito precedente
|
||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||
// a credito: IVA acquisti, ulteriori detrazioni 1 e 2
|
||||
|
||||
iva_vend += _plm->get_real("R0");
|
||||
iva_acq += _plm->get_real("R1");
|
||||
risultato += (_plm->get_real("R0") - _plm->get_real("R1"));
|
||||
detrazioni+= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||
res_debt += _plm->get_real("R0");
|
||||
res_cred += _plm->get_real("R1");
|
||||
|
||||
// detrazioni solo non in regime agricolo
|
||||
if (!_isagricolo)
|
||||
{
|
||||
risultato -= (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||
|
||||
res_cred += (_plm->get_real("R3") + _plm->get_real("R4"));
|
||||
}
|
||||
/* se annuale, somma versamenti mesi 1-12
|
||||
* solo una volta (non per tutte le attivita')
|
||||
*/
|
||||
if (attc == 0 && month == 13 && m < 13)
|
||||
if (attc == 0 && month == 13)
|
||||
{
|
||||
// l'acconto a dicembre si conteggia a parte solo
|
||||
// nei casi previsti e non in annuale (vedi sotto)
|
||||
versamenti += versamenti_IVA(m , m == 12 ? "1" : "1|7");
|
||||
vers_int += versamenti_IVA(m,"5");
|
||||
// nei casi previsti e non in annuale (vedi sotto)
|
||||
real vs(versamenti_IVA(m , m == 12 ? "1" : "1|7"));
|
||||
real vi(versamenti_IVA(m,"5"));
|
||||
versamenti += vs;
|
||||
vers_int += vi;
|
||||
res_cred += vs + vi;
|
||||
}
|
||||
|
||||
/*
|
||||
* rimborso se chiesto e previsto
|
||||
*/
|
||||
if (attc == 0 && is_lim && m < 13)
|
||||
if (attc == 0 && is_lim)
|
||||
{
|
||||
risultato -= _lim->get_real("R1");
|
||||
rimborsi += _lim->get_real("R1");
|
||||
res_debt += _lim->get_real("R1");
|
||||
}
|
||||
/*
|
||||
* rettifiche gia' col loro bravo segno
|
||||
*/
|
||||
if (attc == 0 && is_lim && m < 13)
|
||||
if (attc == 0 && is_lim)
|
||||
{
|
||||
// benzinaro le conta solo in annuale,
|
||||
// non benzinaro solo in periodica
|
||||
@ -989,6 +1017,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
{
|
||||
risultato += _lim->get_real("R5");
|
||||
rettifiche += _lim->get_real("R5");
|
||||
if (_lim->get_real("R5").sign() < 0)
|
||||
res_cred += abs(_lim->get_real("R5"));
|
||||
else
|
||||
res_debt += abs(_lim->get_real("R5"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1011,12 +1043,6 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
|
||||
if (!(_isdifferita && is_first_month(month)))
|
||||
{
|
||||
// toglie credito precedente considerando rimborsi
|
||||
// e acconto versato e rettifiche, come da manuale
|
||||
risultato -= credito_prec(month);
|
||||
// vedi se c'era un debito precedente per debiti < 50.000
|
||||
risultato += debt_prec(month);
|
||||
|
||||
if (_isviaggio)
|
||||
{
|
||||
// calcolo credito costo, debito mensile, perc. ripart.
|
||||
@ -1037,16 +1063,44 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) *
|
||||
(aliquota_agvia()/CENTO);
|
||||
deb_mens.round(ROUND_LIRA);
|
||||
risultato += deb_mens;
|
||||
risultato += deb_mens;
|
||||
res_debt += deb_mens;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(_isdifferita && is_first_month(month)))
|
||||
{
|
||||
if (month < 13)
|
||||
{
|
||||
// toglie credito precedente
|
||||
cred_prec = credito_prec(month);
|
||||
risultato -= cred_prec;
|
||||
res_cred += cred_prec;
|
||||
// vedi se c'era un debito precedente per debiti < 50.000
|
||||
debt_precd = debt_prec(month);
|
||||
risultato += debt_precd;
|
||||
res_debt += debt_precd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// per l'annuale considera solo il credito a inizio anno
|
||||
cred_prec = credito_prec(1);
|
||||
risultato -= cred_prec;
|
||||
res_cred += cred_prec;
|
||||
}
|
||||
}
|
||||
|
||||
look_lim(month,TRUE);
|
||||
// azzeriamo tutto
|
||||
TString codtab = _lim->get("CODTAB");
|
||||
_lim->zero();
|
||||
_lim->put("CODTAB", codtab);
|
||||
|
||||
look_lim(month,TRUE);
|
||||
/*
|
||||
* versamenti effettuati: si conteggiano in R0,
|
||||
* sono >0 solo se andavano calcolati (vedi sopra)
|
||||
* sono > 0 solo se andavano calcolati (vedi sopra)
|
||||
*/
|
||||
risultato -= (versamenti + vers_int);
|
||||
/*
|
||||
@ -1054,15 +1108,20 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
*/
|
||||
if ((month == 12 && _isbenzinaro) ||
|
||||
(month >= 12 && _freqviva == "M"))
|
||||
{
|
||||
risultato -= versamenti_IVA(12,"7");
|
||||
|
||||
acc_dec = versamenti_IVA(12,"7");
|
||||
}
|
||||
|
||||
risultato.round(month == 13 ? ROUND_MILLELIRE : ROUND_LIRA);
|
||||
|
||||
_lim->put("R0",risultato);
|
||||
_lim->put("R2",cred_cost);
|
||||
_lim->put("R3",deb_mens);
|
||||
_lim->put("R4",perc_r);
|
||||
_lim->put("R6",detrazioni);
|
||||
|
||||
if (month == 13 && differita)
|
||||
if (month == 13 || differita)
|
||||
{
|
||||
// scrivi totali rettifiche e rimborsi
|
||||
// nella finale oppure se copiati da
|
||||
@ -1074,17 +1133,32 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
/*
|
||||
* Interessi dovuti solo da trimestrali in periodica,
|
||||
* non benzinari
|
||||
*/
|
||||
*/
|
||||
if (_freqviva == "T" && risultato.sign() > 0 &&
|
||||
month < 12 && !_isbenzinaro)
|
||||
{
|
||||
real interesse = interesse_trimestrale(_month);
|
||||
real ivi = risultato * interesse / CENTO; ivi.ceil(ROUND_LIRA);
|
||||
_lim->put("R7",ivi);
|
||||
real ivi = risultato * (interesse / CENTO);
|
||||
ivi.ceil(ROUND_LIRA);
|
||||
_lim->put("R7", ivi);
|
||||
_lim->put("R10",interesse_trimestrale(_month));
|
||||
}
|
||||
|
||||
_lim->put("R8", versamenti);
|
||||
_lim->put("R9", vers_int);
|
||||
|
||||
// scrivi: totali IVA vendite e acquisti, credito prec,
|
||||
// debito prec, acconto
|
||||
// cosi' si fa una volta sola in stampa
|
||||
|
||||
tt = iva_vend.string(); tt.add(iva_acq.string());
|
||||
_lim->put("S0", tt);
|
||||
tt = res_debt.string(); tt.add(res_cred.string());
|
||||
_lim->put("S1", tt);
|
||||
tt = cred_prec.string(); tt.add(debt_precd.string());
|
||||
_lim->put("S2", tt);
|
||||
tt = acc_dec.string();
|
||||
_lim->put("S3", tt);
|
||||
|
||||
_lim->put("B0","X");
|
||||
if (_isfinal)
|
||||
|
@ -33,6 +33,11 @@ bool TLiquidazione_app::is_month_ok(int x, int mtocalc)
|
||||
// aggiusta al trimestre il mese da calcolare
|
||||
mtocalc += 2 - ((mtocalc-1) % 3);
|
||||
ret = x >= (mtocalc - 3) && x <= mtocalc;
|
||||
}
|
||||
else if (!ret && mtocalc == 13)
|
||||
{
|
||||
// per l'annuale ritorna TRUE per tutti i mesi da liquidare
|
||||
ret = x <= 13;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -361,7 +366,7 @@ bool TLiquidazione_app::look_lia(bool create, int year)
|
||||
|
||||
real TLiquidazione_app::result_liq(int month)
|
||||
// risultato esatto della liquidazione del mese month, <0 a credito
|
||||
// >0 a debito; non comprende il conguaglio prorata (annuale)
|
||||
// > 0 a debito; non comprende il conguaglio prorata (annuale)
|
||||
{
|
||||
real r(0.0);
|
||||
// ulteriori detrazioni, acconti, versamenti,
|
||||
@ -371,6 +376,7 @@ real TLiquidazione_app::result_liq(int month)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
real TLiquidazione_app::debt_prec(int month)
|
||||
{
|
||||
real r(0.0);
|
||||
|
260
cg/cg4304.cpp
260
cg/cg4304.cpp
@ -574,85 +574,38 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
|
||||
_DescrItem* di)
|
||||
{
|
||||
if (!_isprint || !_canprint) return;
|
||||
if (_isannual || _isriepilogo) month = 12;
|
||||
if (!look_lim(month)) return;
|
||||
|
||||
_DescrItem* d = new _DescrItem(THE_END);
|
||||
TToken_string atts(codatts);
|
||||
const char* tmpatt;
|
||||
real conguaglio;
|
||||
|
||||
// gli diamo la stessa struttura di LIM
|
||||
d->_r0 = _lim->get_real("R0");
|
||||
d->_r1 = _lim->get_real("R1");
|
||||
d->_r2 = _lim->get_real("R2");
|
||||
d->_r3 = _lim->get_real("R3");
|
||||
d->_r4 = _lim->get_real("R4");
|
||||
d->_r5 = _lim->get_real("R5");
|
||||
d->_r6 = _lim->get_real("R6");
|
||||
d->_r7 = _lim->get_real("R7");
|
||||
d->_r8 = _lim->get_real("R8");
|
||||
d->_r9 = _lim->get_real("R9");
|
||||
d->_s0 = _lim->get("S0");
|
||||
d->_s1 = _lim->get("S1");
|
||||
d->_s2 = _lim->get("S2");
|
||||
d->_s3 = _lim->get("S3");
|
||||
d->_r11 = (const char*)_lim->get("R10"); // tasso di interesse
|
||||
|
||||
// serve per pagare anche meno di 50000 a dicembre
|
||||
d->_f1 = month == 12;
|
||||
d->_f2 = month;
|
||||
|
||||
while ((tmpatt = atts.get()) != NULL)
|
||||
{
|
||||
TString att(tmpatt);
|
||||
for (int mm = 1; mm <= 12; mm++)
|
||||
{
|
||||
if (!is_month_ok(mm, month)) continue;
|
||||
look_plm(mm, att);
|
||||
d->_r0 += _plm->get_real("R0"); // IVA vendite
|
||||
d->_r1 += _plm->get_real("R1"); // IVA acquisti
|
||||
d->_r2 += _plm->get_real("R3"); // Detrazioni 1
|
||||
d->_r2 += _plm->get_real("R4"); // Detrazioni 2
|
||||
d->_r1 -= _plm->get_real("R2"); // pro-rata
|
||||
}
|
||||
// ev. conguaglio prorata
|
||||
if (_isannual || _isriepilogo)
|
||||
{
|
||||
if (month == 13)
|
||||
{
|
||||
TToken_string a(codatts);
|
||||
for (int i = 0; i < a.items(); i++)
|
||||
{
|
||||
TString att = a.get();
|
||||
look_pla(att);
|
||||
conguaglio += _pla->get_real("R10");
|
||||
}
|
||||
// r10 = conguaglio prorata
|
||||
d->_r10 += _pla->get_real("R10");
|
||||
}
|
||||
}
|
||||
look_lim(month);
|
||||
|
||||
d->_r3 += _lim->get_real("R0"); // risultato
|
||||
d->_r4 += _lim->get_real("R1"); // rimborso
|
||||
|
||||
if (_lim->get("S7") == "D")
|
||||
d->_r5 += abs(_lim->get_real("R5")); // rettifiche a debito
|
||||
else
|
||||
d->_r6 += abs(_lim->get_real("R5")); // rettifiche a credito
|
||||
|
||||
d->_f0 = _freqviva == "T";
|
||||
|
||||
// r7 = credito precedente
|
||||
d->_r7 = credito_prec(month);
|
||||
|
||||
// r11 = ulteriori detrazioni
|
||||
d->_r11 = _lim->get_real("R6");
|
||||
|
||||
// se ci sono stati versamenti IVA li riporta in _s2
|
||||
// e _s3 (integrativi): sono != 0 solo in annuale
|
||||
d->_s2 = versamenti_IVA(month,"1").string();
|
||||
d->_s3 = versamenti_IVA(month,"5").string();
|
||||
|
||||
// vedi se c'era un debito precedente e schiaffa in r10
|
||||
if (!is_first_month(month))
|
||||
{
|
||||
if (look_lim(previous_month(month)))
|
||||
{
|
||||
real r = _lim->get_real("R0");
|
||||
if (_lim->get_real("R5").sign() > 0)
|
||||
r += _plm->get_real("R5");
|
||||
// non considera il rimborso in quanto se e' a debito
|
||||
// non c'e' rimborso, e se e' rettificato pure
|
||||
if (r.sign() > 0 && r < IVA_DA_RIPORTARE)
|
||||
d->_r10 += r;
|
||||
}
|
||||
}
|
||||
|
||||
if (_isannual || _isriepilogo)
|
||||
{
|
||||
look_lia();
|
||||
|
||||
// r8 = acconto dicembre
|
||||
d->_r8 = _lia->get_real("R4");
|
||||
// r9 = conguaglio prorata
|
||||
d->_r9 = conguaglio;
|
||||
}
|
||||
|
||||
// aggiunge eventuale satellite per rimborso infraannuale
|
||||
if (di != NULL) d->_arr.add(di);
|
||||
|
||||
@ -1012,131 +965,128 @@ void TLiquidazione_app::set_ptm(_DescrItem& d)
|
||||
|
||||
void TLiquidazione_app::set_grand(_DescrItem& d)
|
||||
{
|
||||
real& risultato = d._r0;
|
||||
real& rimborso = d._r1;
|
||||
real& cred_cost = d._r2;
|
||||
real& deb_mens = d._r3;
|
||||
real& rettifiche = d._r5;
|
||||
real& detrazioni = d._r6;
|
||||
real& interessi = d._r7;
|
||||
real& versamenti = d._r8;
|
||||
real& vers_int = d._r9;
|
||||
TToken_string tt(d._s0);
|
||||
real iva_vend(tt.get(0));
|
||||
real iva_acq(tt.get(1));
|
||||
tt = d._s1;
|
||||
real res_debt(tt.get(0));
|
||||
real res_cred(tt.get(1));
|
||||
tt = d._s2;
|
||||
real cred_prec(tt.get(0));
|
||||
real debt_prec(tt.get(1));
|
||||
real acc_dec(d._s3);
|
||||
|
||||
real rett_debt(0.0);
|
||||
real rett_cred(0.0);
|
||||
real& interesse = d._r11;
|
||||
|
||||
if (rettifiche.sign() > 0) rett_debt = rettifiche;
|
||||
if (rettifiche.sign() < 0) rett_cred = rettifiche;
|
||||
|
||||
set_row(1,""); set_row(2,""); set_row(3,""); set_row(4,"");
|
||||
set_row(5,"@11g@bCALCOLO LIQUIDAZIONE D'IMPOSTA@r");
|
||||
set_row(6,""); int rw = 7;
|
||||
set_row(rw++," @66gCredito@84gDebito"); set_row(rw++,"");
|
||||
set_row(rw++,"@11gIva sulle operazioni di vendita@75g%r", &(d._r0));
|
||||
set_row(rw++,"@11gIva sulle operazioni di vendita@75g%r", &iva_vend);
|
||||
set_row(rw++,"%s@11gRettifiche IVA a debito@75g%r",
|
||||
_is_visliq ? "$[r]" : "", &(d._r5));
|
||||
_is_visliq ? "$[r]" : "", &rett_debt);
|
||||
set_row(rw++,"%s@11gIva chiesta a rimborso@75g%r",
|
||||
_is_visliq ? "$[r]" : "", &(d._r4));
|
||||
real rd = d._r0 + d._r5 + d._r4;
|
||||
real vers;
|
||||
|
||||
_is_visliq ? "$[r]" : "", &rimborso);
|
||||
|
||||
// conguaglio prorata
|
||||
if (d._r9.sign() < 0)
|
||||
if (d._r10.sign() > 0)
|
||||
{
|
||||
real r = abs(d._r9);
|
||||
set_row(rw++,"@11gConguaglio pro-rata@58g%r", &r);
|
||||
real r = abs(d._r10);
|
||||
set_row(rw++,"@11gConguaglio pro-rata@75g%r", &r);
|
||||
res_debt += d._r10;
|
||||
risultato += d._r10;
|
||||
}
|
||||
|
||||
// debito liq. precedente < 50000
|
||||
if (d._r10 > ZERO)
|
||||
{
|
||||
rd += d._r10;
|
||||
set_row(rw++,"@11gDebito da liquidazione precedente@75g%r", &(d._r10));
|
||||
}
|
||||
if (debt_prec > ZERO)
|
||||
set_row(rw++,"@11gDebito da liquidazione precedente@75g%r", &debt_prec);
|
||||
|
||||
set_row(rw++,"@11gRISULTATO@75g%r", &rd);
|
||||
set_row(rw++,"@11gIva sulle operazioni di acquisto@58g%r", &(d._r1));
|
||||
set_row(rw++,"@11gRISULTATO@75g%r", &res_debt);
|
||||
set_row(rw++,"@11gIva sulle operazioni di acquisto@58g%r", &iva_acq);
|
||||
if (_isannual)
|
||||
set_row(rw++,"@11gCredito inizio anno@58g%r", &cred_prec);
|
||||
else
|
||||
set_row(rw++,"@11gCredito precedente@58g%r", &cred_prec);
|
||||
|
||||
// credito precedente scorporato dell'acconto
|
||||
d._r7 -= d._r8;
|
||||
set_row(rw++,"@11gCredito precedente@58g%r", &(d._r7));
|
||||
|
||||
if ((_is_visliq && _month == 12) || !(d._r8.is_zero()))
|
||||
if (!acc_dec.is_zero())
|
||||
set_row(rw++,"%s@11gVersamento acconto dicembre@58g%r",
|
||||
_is_visliq ? "$[r]" : "", &(d._r8));
|
||||
_is_visliq ? "$[r]" : "", &acc_dec);
|
||||
|
||||
if (!(d._r11.is_zero()))
|
||||
set_row(rw++,"@11gUlteriori detrazioni@58g%r", &(d._r11));
|
||||
if (!detrazioni.is_zero())
|
||||
set_row(rw++,"@11gUlteriori detrazioni@58g%r", &detrazioni);
|
||||
|
||||
set_row(rw++,"%s@11gRettifiche IVA a credito@58g%r",
|
||||
_is_visliq ? "$[r]" : "", &(d._r6));
|
||||
real rc = d._r1 + d._r7 + d._r8 + d._r6 -d._r11;
|
||||
|
||||
// conguaglio prorata
|
||||
if (d._r9.sign() < 0) rc -= d._r9;
|
||||
_is_visliq ? "$[r]" : "", &rett_cred);
|
||||
|
||||
// versamenti effettuati
|
||||
if (!d._s2.empty())
|
||||
if (!versamenti.is_zero())
|
||||
{
|
||||
real unixtihavoluto(d._s2);
|
||||
vers = unixtihavoluto;
|
||||
rc += vers;
|
||||
set_row(rw++,"@11gVersamenti effettuati@58g%r", &vers);
|
||||
set_row(rw++,"@11gVersamenti effettuati@58g%r", &versamenti);
|
||||
}
|
||||
// versamenti integrativi
|
||||
if (!d._s3.empty())
|
||||
if (!vers_int.is_zero())
|
||||
{
|
||||
real unixtihavoluto(d._s3);
|
||||
vers = unixtihavoluto;
|
||||
rc += vers;
|
||||
set_row(rw++,"@11gVersamenti integrativi@58g%r", &vers);
|
||||
set_row(rw++,"@11gVersamenti integrativi@58g%r", &vers_int);
|
||||
}
|
||||
|
||||
set_row(rw++,"@11gRISULTATO@58g%r", &rc);
|
||||
if (d._r10.sign() < 0)
|
||||
{
|
||||
real r = abs(d._r10);
|
||||
set_row(rw++,"@11gConguaglio pro-rata@58g%r", &r);
|
||||
res_cred += d._r10;
|
||||
risultato -= d._r10;
|
||||
}
|
||||
set_row(rw++,"@11gRISULTATO@58g%r", &res_cred);
|
||||
|
||||
real iva = rd - rc;
|
||||
char how = iva.sign() < 0 ? 'c' : 'd';
|
||||
iva = abs(iva);
|
||||
iva.ceil(_isannual ? ROUND_MILLELIRE : ROUND_LIRA);
|
||||
|
||||
// se non c'e' nulla da versare stampa solo una riga vuota
|
||||
// Serve, non toglierla, stronzo.
|
||||
if (iva.is_zero())
|
||||
if (risultato.is_zero())
|
||||
set_row(rw++,"");
|
||||
else
|
||||
{
|
||||
if (how == 'c')
|
||||
{
|
||||
if (risultato.sign() < 0)
|
||||
{
|
||||
real iva = abs(risultato);
|
||||
set_row(rw++,"@23gCREDITO ATTUALE@58g%r",&iva);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d._f0)
|
||||
{
|
||||
real iva = risultato + interessi;
|
||||
if (!iva.is_zero())
|
||||
{
|
||||
// trimestrale: interesse
|
||||
real interesse = interesse_trimestrale(d._f2);
|
||||
real ivi = iva * interesse / CENTO; ivi.ceil(ROUND_LIRA);
|
||||
real ivt = iva + ivi;
|
||||
ivt.ceil(_isannual ? ROUND_MILLELIRE : ROUND_LIRA);
|
||||
|
||||
if (!iva.is_zero())
|
||||
if (!interessi.is_zero())
|
||||
{
|
||||
set_row(rw++,"@23gIVA DOVUTA@75g%r",&iva);
|
||||
set_row(rw++,"@23gInteresse %6.2r %%@75g%r",&interesse, &ivi);
|
||||
|
||||
if (ivt.is_zero() || ivt >= IVA_DA_RIPORTARE || d._f1)
|
||||
set_row(rw++,"@23gIVA DA VERSARE@75g%r",&ivt);
|
||||
else
|
||||
set_row(rw++,"@23gIVA DA VERSARE@85g0 (%s < 50.000)",
|
||||
(const char*)ivt.string("."));
|
||||
}
|
||||
else set_row(rw++,"");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!iva.is_zero())
|
||||
{
|
||||
if (iva >= IVA_DA_RIPORTARE || d._f1)
|
||||
set_row(rw++,"@23gIVA DA VERSARE@75g%r",&iva);
|
||||
else
|
||||
set_row(rw++,"@23gIVA DA VERSARE@85g0 (%s < 50.000)",
|
||||
(const char*)iva.string("."));
|
||||
set_row(rw++,"@23gIVA DOVUTA@75g%r",&risultato);
|
||||
set_row(rw++,"@23gInteresse %6.2r %%@75g%r",&interesse, &interessi);
|
||||
}
|
||||
else set_row(rw++,"");
|
||||
}
|
||||
if (iva >= IVA_DA_RIPORTARE || _isannual)
|
||||
set_row(rw++,"@23gIVA DA VERSARE@75g%r",&iva);
|
||||
else
|
||||
set_row(rw++,"@23gIVA DA VERSARE@85g0 (%s < 50.000)",
|
||||
(const char*)iva.string("."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rapportini per rimborso infraannuale
|
||||
if (d._arr.items() > 0)
|
||||
{
|
||||
_DescrItem& di = (_DescrItem&)d._arr[0];
|
||||
|
||||
set_print_zero(TRUE);
|
||||
|
||||
set_row(rw++,"");
|
||||
set_row(rw++,"");
|
||||
set_row(rw++, " PROSPETTO DI RIMBORSO");
|
||||
|
Loading…
x
Reference in New Issue
Block a user