Cacarelle liquidazzione IVA, altre cacarelle rimangono da cacare

git-svn-id: svn://10.65.10.50/trunk@1367 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1995-05-17 10:32:50 +00:00
parent b62750d4a9
commit 5e540e903e
7 changed files with 184 additions and 98 deletions

View File

@ -199,6 +199,7 @@ class TLiquidazione_app : public TPrint_application
long _n_ditte; // numero ditte long _n_ditte; // numero ditte
bool _comp_acconto; // stiamo calcolando l'acconto bool _comp_acconto; // stiamo calcolando l'acconto
TArray _nomiditte; // array descr. ditte per sheet TArray _nomiditte; // array descr. ditte per sheet
bool _proper_recalc; // vedi nel testo
TProgind* _prind; TProgind* _prind;
int _row; int _row;

View File

@ -101,10 +101,17 @@ bool TLiquidazione_app::recalc_all()
_recalc = ever; _recalc = ever;
} }
for (int m = 1; m <= _month; m++) // fino a 13 compreso for (int m = 1; m <= _month; m++) // fino a 13 compreso
if (is_month_ok(m, _month) || _recalc == ever) if (is_month_ok(m, _month) || _recalc == ever)
{ {
if (_prind->iscancelled()) break; if (_prind->iscancelled()) break;
// questo serve ad evitare che il ricalcolo mesi precedenti
// per l'annuale segua le stesse regole del ricalcolo annuale
// propriamente inteso
_proper_recalc = m == 13;
update_firm(m); update_firm(m);
} }
@ -184,8 +191,14 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
(const char*)_nditte_r->get("RAGSOC"), (const char*)_nditte_r->get("RAGSOC"),
(const char*)desatt); (const char*)desatt);
if (_prind) _prind->set_text(buf); if (_prind) _prind->set_text(buf);
// se ricalcola l'annuale si tiene tutte le vendite e corrispettivi di
// tutti i lerci mesi
if (!(_month == 13 && month > 1))
{
_vend_arr.destroy(); _vend_arr.destroy();
_corr_arr.destroy(); _corr_arr.destroy();
}
cattivs = ""; cattivs = "";
@ -273,7 +286,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
// rimborso infraannuale // rimborso infraannuale
_DescrItem* rimb_d = NULL; _DescrItem* rimb_d = NULL;
if (month == _month && is_trim(month)) if (month == _month)
{ {
// unica nel suo genere, recalc_rimborso ritorna // unica nel suo genere, recalc_rimborso ritorna
// un bel descritem (NULL se non si rimborsa un cas) // un bel descritem (NULL se non si rimborsa un cas)
@ -284,7 +297,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
if (month == _month) if (month == _month)
{ {
describe_firm(month); describe_firm(month);
describe_liq(_month, atts, rimb_d); describe_liq(_month, atts, _isregis ? NULL : rimb_d);
} }
} }
return ok || calc; return ok || calc;
@ -308,16 +321,13 @@ bool TLiquidazione_app::update_att(int month, const char* codatt,
{ {
zero_att(month,codatt); zero_att(month,codatt);
recalc_att(month,codatt); recalc_att(month,codatt);
if (month == 13) if (!_isagricolo)
recalc_annual(codatt);
else if (!_isagricolo)
{ {
// nei PIM della 13a vanno solo alcune stranezze,
// mi rifiuto di pensare che vadano ventilate
// o corrispettivizzicizzate
recalc_ventilation(month, codatt); recalc_ventilation(month, codatt);
recalc_corrispettivi(month, codatt); recalc_corrispettivi(month, codatt);
} }
if (month == 13)
recalc_annual(codatt);
} }
return ok || calc; return ok || calc;
} }
@ -364,6 +374,23 @@ void TLiquidazione_app::zero_att(int month, const char* codatt)
_pim->rewrite(); _pim->rewrite();
} }
} }
if (look_plm(month, codatt))
{
// zero PLM, POM, PAM, PUM
TString codtab(_plm->get("CODTAB"));
_plm->zero();
_pom->zero();
_pam->zero();
_pum->zero();
_plm->put("CODTAB", codtab);
_pom->put("CODTAB", codtab);
_pam->put("CODTAB", codtab);
_pum->put("CODTAB", codtab);
_plm->rewrite();
_pam->rewrite();
_pom->rewrite();
_pum->rewrite();
}
if (_isplafond && month != 13) if (_isplafond && month != 13)
zero_plafond(month,codatt); zero_plafond(month,codatt);
} }
@ -403,6 +430,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real corr_misCEE = 0.0; real corr_misCEE = 0.0;
real acq_misCEE = 0.0; real acq_misCEE = 0.0;
real acq_misnoCEE = 0.0; real acq_misnoCEE = 0.0;
real agr_1i = 0.0;
real agr_2i = 0.0;
real agr_1 = 0.0; real agr_1 = 0.0;
real agr_2 = 0.0; real agr_2 = 0.0;
real agr_3 = 0.0; real agr_3 = 0.0;
@ -527,7 +556,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
* In liq. annuale si totalizzano * In liq. annuale si totalizzano
* solo le stranezze che seguono * solo le stranezze che seguono
*/ */
if (_month == 13) if (_month == 13 && _proper_recalc)
{ {
// si contano soltanto le vendite. // si contano soltanto le vendite.
bool okc = tipomov == vendita; bool okc = tipomov == vendita;
@ -728,9 +757,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
if (tipomov == vendita) if (tipomov == vendita)
{ {
if (tipoagr == 1 || tipoagr == 3) if (tipoagr == 1 || tipoagr == 3)
{
agr_1 += imposta; agr_1 += imposta;
agr_1i += imponibile;
}
else if (tipoagr == 2) else if (tipoagr == 2)
{
agr_2 += imposta; agr_2 += imposta;
agr_2i += imponibile;
}
} }
else if (tipodet == 0) else if (tipodet == 0)
{ {
@ -1052,6 +1087,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
_plm->put("R9", agr_5); _plm->put("R9", agr_5);
_plm->put("R10", agr_6); _plm->put("R10", agr_6);
_plm->put("R11", agr_7); _plm->put("R11", agr_7);
_pum->put("R10", agr_1i);
_pum->put("R11", agr_2i);
// Il porco agricoltore spende poco e paga meno // Il porco agricoltore spende poco e paga meno
vendite_iva = agr_2; vendite_iva = agr_2;
@ -1060,7 +1097,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
// nuovo calcolo IVA detraibile // nuovo calcolo IVA detraibile
if (!agr_7.is_zero()) if (!agr_7.is_zero())
{ {
real pdetr = (agr_2 / (agr_1 + agr_2)); real pdetr = (agr_2i / (agr_1i + agr_2i));
pdetr.round(2);
acquisti_iva += agr_7 * pdetr; acquisti_iva += agr_7 * pdetr;
acquisti_iva.round(ROUND_LIRA); acquisti_iva.round(ROUND_LIRA);
} }
@ -1307,9 +1345,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
{ {
deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) * deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) *
(aliquota_agvia()/CENTO); (aliquota_agvia()/CENTO);
deb_mens.round(ROUND_LIRA); deb_mens.ceil(ROUND_LIRA); // ceil voluto MI3074
risultato += deb_mens; risultato += deb_mens;
res_debt += deb_mens; res_debt += deb_mens;
iva_vend += deb_mens;
} }
} }
} }

View File

@ -558,12 +558,9 @@ real TLiquidazione_app::credito_costo_prec(int month)
real c(0.0); real c(0.0);
if (is_first_month(month)) if (is_first_month(month))
{ {
int yr = atoi(_year)-1; // credito inizio anno
_lim->zero(); if (look_lia())
*_lim_anno = yr; c = _lia->get_real("R5");
*_lim_mese = 12;
if (_lim->read() == NOERR)
c = _lim->get_real("R2");
} }
else else
{ {

View File

@ -111,7 +111,7 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
// ricalcolo della malefica ventilazione // ricalcolo della malefica ventilazione
void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
{ {
if (!_isvent || _vend_arr.items() == 0) return; if (!_isvent || _isagricolo || _isviaggio || _vend_arr.items() == 0) return;
TString att(codatt); TString att(codatt);
@ -129,10 +129,16 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
// aggiunge gli acquisti del mese m operando sui pim // aggiunge gli acquisti del mese m operando sui pim
for (_pim->first(); !_pim->eof(); _pim->next()) for (_pim->first(); !_pim->eof(); _pim->next())
{ {
if (_year != *_pim_anno) continue;
// se e' acquisto beni per rivendita // se e' acquisto beni per rivendita
int tipocr = atoi(*_pim_tipocr); int tipocr = atoi(*_pim_tipocr);
int mese = atoi(*_pim_mese); int mese = atoi(*_pim_mese);
int tipodet = atoi(*_pim_tipodet); int tipodet = atoi(*_pim_tipodet);
look_iva(*_pim_codiva);
// base di riparto solo se non esente, non soggetto, non imponibile
TString16 tipoiva(_iva->get("S1"));
TString16 reg = *_pim_codreg;
/* /*
* se non si e' settato il ricalcolo nei parametri ditta * se non si e' settato il ricalcolo nei parametri ditta
@ -152,13 +158,10 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
continue; continue;
TString att(codatt); TString att(codatt);
if (tipocr == 1 && mese == m && att == (const char*)(*_pim_codatt))
if (tipocr == 1 && (mese == m) &&
att == (const char*)(*_pim_codatt))
{ {
look_iva(*_pim_codiva);
// base di riparto solo se non esente, non soggetto, non imponibile
TString tipoiva(_iva->get("S1"));
if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES") if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES")
{ {
real lurd = _pim->get_real("R0"); real lurd = _pim->get_real("R0");
@ -183,8 +186,8 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
for (int j = 0; j < _vent_arr.items(); j++) for (int j = 0; j < _vent_arr.items(); j++)
{ {
_VentItem* vv = (_VentItem*)&_vent_arr[j]; _VentItem& vv = (_VentItem&)_vent_arr[j];
totacq += vv->_totale; totacq += vv._totale;
} }
// 3) ricalcola (solo per il mese in corso!) operando sull'array // 3) ricalcola (solo per il mese in corso!) operando sull'array
@ -235,10 +238,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
_pim->rewrite(); _pim->rewrite();
} }
} }
// memorizza totali per il prospettino di m. // memorizza totali per il prospettino di m.
look_plm(month, codatt); look_plm(month, codatt);
// TBI PAM e PUM // PAM e PUM
_pam->put("R2",totacq); _pam->put("R2",totacq);
_pam->put("R3",totven); _pam->put("R3",totven);
_pam->rewrite(); _pam->rewrite();

View File

@ -194,16 +194,12 @@ void TLiquidazione_app::describe_plafond(int month, const char* codatt)
void TLiquidazione_app::describe_ventilation(int month, const char* codatt) void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
{ {
if (!_isvent) return; if (!_isvent || _isagricolo || _isviaggio) return;
_DescrItem* d = new _DescrItem(VENTILA); _DescrItem* d = new _DescrItem(VENTILA);
TString att(codatt); TString att(codatt);
look_plm(month, att); look_plm(month, att);
real r0 = _pam->get("R2");
real r1 = _pam->get("R3");
d->_r0 = r0; d->_r1 = r1;
for (_pim->first(); !_pim->eof(); _pim->next()) for (_pim->first(); !_pim->eof(); _pim->next())
{ {
@ -220,6 +216,9 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
real imponibile = _pim->get_real("R0"); real imponibile = _pim->get_real("R0");
real imposta = _pim->get_real("R1"); real imposta = _pim->get_real("R1");
tiporeg tipomov = (tiporeg)_reg->get_long("I0"); tiporeg tipomov = (tiporeg)_reg->get_long("I0");
TString tipoiva = _iva->get("S1");
if (_year != *_pim_anno) continue;
if (imponibile.is_zero() && imposta.is_zero()) continue; if (imponibile.is_zero() && imposta.is_zero()) continue;
@ -228,6 +227,10 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
if (tipodet == 1 || tipodet == 3 || tipodet == 9) if (tipodet == 1 || tipodet == 3 || tipodet == 9)
continue; continue;
// questi non si devono vedere perche' so' bbrutti
if (tipoiva == "NS" || tipoiva == "ES" || tipoiva == "NI")
continue;
if (mese <= month) if (mese <= month)
{ {
if (tipocr == 1 && tipomov == acquisto) if (tipocr == 1 && tipomov == acquisto)
@ -243,6 +246,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
if (vd == NULL) { vd = new _vDesc; } if (vd == NULL) { vd = new _vDesc; }
vd->_acq += (imponibile+imposta); vd->_acq += (imponibile+imposta);
d->_r0 += (imponibile+imposta);
if (vd->_codiva.empty()) if (vd->_codiva.empty())
{ {
@ -250,7 +254,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
d->_arr.add(vd); d->_arr.add(vd);
} }
} }
else if (is_month_ok(mese,month) && corrisp else if ((is_month_ok(mese,month) || month == 13) && corrisp
&& _pim->get_bool("B1") && && _pim->get_bool("B1") &&
tipocr == 0 && tipomov == vendita) tipocr == 0 && tipomov == vendita)
// non sono sicurissimo della above condition // non sono sicurissimo della above condition
@ -268,6 +272,8 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
vd->_vnd += imponibile; vd->_vnd += imponibile;
vd->_viv += imposta; vd->_viv += imposta;
d->_r1 += imponibile+imposta;
if (vd->_codiva.empty()) if (vd->_codiva.empty())
{ {
vd->_codiva = *_pim_codiva; vd->_codiva = *_pim_codiva;
@ -276,6 +282,9 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
} }
} }
} }
if (d->_r1.is_zero() || d->_r0.is_zero())
delete d;
else
_descr_arr.add(d); _descr_arr.add(d);
} }
@ -298,6 +307,8 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
d->_r4 += _plm->get_real("R9"); d->_r4 += _plm->get_real("R9");
d->_r5 += _plm->get_real("R10"); d->_r5 += _plm->get_real("R10");
d->_r6 += _plm->get_real("R11"); d->_r6 += _plm->get_real("R11");
d->_r7 += _pum->get_real("R10");
d->_r8 += _pum->get_real("R11");
} }
_descr_arr.add(d); _descr_arr.add(d);
} }
@ -519,6 +530,27 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
} }
_descr_arr.add(ads); _descr_arr.add(ads);
} }
// ag. viaggio: iva dovuta 74 ter la vogliono in mezzo ai progressivi
look_lim(month);
real iva74t = _lim->get_real("R3");
if (iva74t.sign() > 0)
{
_DescrItem* ads = new _DescrItem(PIM_ROW);
ads->_s0 = "74TER"; // cosi' vollero
ads->_s1 = "IVA "; // cosi' vollero
ads->_s2 = " dovuta - 74 ter"; // cosi' vollero
ads->_r1 = iva74t;
t1 += iva74t;
if (isfirst)
{
isfirst = FALSE;
ads->_f0 = TRUE;
}
_descr_arr.add(ads);
}
// prepara una bella riga di totali // prepara una bella riga di totali
if (/* !isfirst */ TRUE) if (/* !isfirst */ TRUE)
{ {
@ -531,6 +563,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
_DescrItem* t = new _DescrItem(MISC_LIQ); _DescrItem* t = new _DescrItem(MISC_LIQ);
t->_f1 = isfirst; // per il form feed t->_f1 = isfirst; // per il form feed
TToken_string ttm("0|0|0");
for (int m = 1; m <= month && m < 13; m++) for (int m = 1; m <= month && m < 13; m++)
{ {
if (!is_month_ok(m,month)) continue; if (!is_month_ok(m,month)) continue;
@ -540,6 +574,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
{ {
TString att(tmpatt); TString att(tmpatt);
look_plm(m, att); look_plm(m, att);
real ad1, ad2;
d->_r6 += _pom->get_real("R0"); // acq. intracomunitari d->_r6 += _pom->get_real("R0"); // acq. intracomunitari
d->_r7 += _pom->get_real("R1"); // inded. art 19 d->_r7 += _pom->get_real("R1"); // inded. art 19
@ -556,9 +591,16 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
t->_r9 += _pum->get_real("R1"); // IVA su cessioni ammort. t->_r9 += _pum->get_real("R1"); // IVA su cessioni ammort.
t->_r10 += _pum->get_real("R4"); // tot. esenti IVA t->_r10 += _pum->get_real("R4"); // tot. esenti IVA
t->_r11 += _plm->get_real("R2"); // pro-rata indetraibile t->_r11 += _plm->get_real("R2"); // pro-rata indetraibile
t->_s0 = (_plm->get_real("R12")).string(); // % pro-rata
t->_s0 << "|" << _pom->get_real("R11").string(); // imp. acq. amm. indetr. ad1 = real(ttm.get(1));
t->_s0 << "|" << _pom->get_real("R12").string(); // IVA acq. amm. indetr ad2 = real(ttm.get(2));
ad1 += _pom->get_real("R11");
ad2 += _pom->get_real("R12");
ttm.add(_plm->get("R12"), 0); // % pro-rata
ttm.add(ad1.string(),1); // imp. acq. amm. indetr.
ttm.add(ad2.string(),2); // IVA acq. amm. indetr
t->_s0 = ttm;
t->_f0 = !_prorata.is_zero(); // flag per segnalare l'esistenza t->_f0 = !_prorata.is_zero(); // flag per segnalare l'esistenza
d->_r9 += _pom->get_real("R9"); // acq. inded. su ricavi esenti d->_r9 += _pom->get_real("R9"); // acq. inded. su ricavi esenti
d->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti d->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti
@ -591,7 +633,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
vnsi += _pam->get_real("R8"); vnsi += _pam->get_real("R8");
vnsv += _pam->get_real("R9"); vnsv += _pam->get_real("R9");
tt = aqsi.string(); tt = "";
tt.add(aqsi.string());
tt.add(aqsv.string()); tt.add(aqsv.string());
tt.add(vnsi.string()); tt.add(vnsi.string());
tt.add(vnsv.string()); tt.add(vnsv.string());
@ -601,10 +644,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
} // for (mese ok) } // for (mese ok)
// ag. viaggio: iva dovuta 74 ter
look_lim(month);
d->_s2 = _lim->get_real("R3").string();
// annual follows in _arr // annual follows in _arr
if (month == 13 && ref != "ALL") if (month == 13 && ref != "ALL")
{ {
@ -904,26 +943,28 @@ void TLiquidazione_app::set_plafond(_DescrItem& d)
void TLiquidazione_app::set_pim(_DescrItem& d) void TLiquidazione_app::set_pim(_DescrItem& d)
{ {
int rw = 1;
if (d._s1 == "A35") if (d._s1 == "A35")
{
d._s2 = "Artt.17c3/74c1"; d._s2 = "Artt.17c3/74c1";
} else if (d._s0 == "74TER")
rw++;
else else
{ {
look_iva(d._s1); look_iva(d._s1);
d._s2 = _iva->get("S0"); d._s2 = _iva->get("S0");
} }
if (d._f0) // e' il primo if (d._f0) // e' il primo
{ {
// intestazioncina // intestazioncina
set_bookmark("Riepilogo progressivi", _att_bookmark); set_bookmark("Riepilogo progressivi", _att_bookmark);
set_row(1," Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI"); set_row(rw++," Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI");
set_row(2," IVA Descrizione@30gImponibile@49gImposta@63gImponibile" set_row(rw++," IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
"@82gImposta@96gImponibile@115gImposta"); "@82gImposta@96gImponibile@115gImposta");
set_row(3,""); set_row(rw++,"");
} }
set_row(d._f0 ? 4 : 1,"%4s %-20s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r", set_row(rw++,"%4s %-20s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
(const char*)d._s1, (const char*)d._s1,
(const char*)d._s2, (const char*)d._s2,
&(d._r0), &(d._r0),
@ -1051,14 +1092,14 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
&(d._r4), &(d._r4),
&(d._r5)); &(d._r5));
} }
if (! (d._r0.is_zero() && d._r1.is_zero())) if (! (ammindi.is_zero() && ammindv.is_zero()))
{ {
printed = TRUE; printed = TRUE;
set_row(row++, "Acquisto beni ammortizzabili IVA detraibile@50g%r@69g%r", set_row(row++, "Acquisto beni ammortizzabili IVA detraibile@50g%r@69g%r",
&ammindi, &ammindi,
&ammindv); &ammindv);
} }
if (! (ammindi.is_zero() && ammindv.is_zero())) if (! (d._r0.is_zero() && d._r1.is_zero()))
{ {
printed = TRUE; printed = TRUE;
set_row(row++, "Acquisto beni ammortizzabili IVA indetraibile@50g%r@69g%r", set_row(row++, "Acquisto beni ammortizzabili IVA indetraibile@50g%r@69g%r",
@ -1421,6 +1462,8 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
real& agr_5 = d._r4; real& agr_5 = d._r4;
real& agr_6 = d._r5; real& agr_6 = d._r5;
real& agr_7 = d._r6; real& agr_7 = d._r6;
real& agr_1i = d._r7;
real& agr_2i = d._r8;
real ara = agr_5 + agr_6; real ara = agr_5 + agr_6;
real arn = agr_3 + agr_4; real arn = agr_3 + agr_4;
@ -1444,28 +1487,30 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
if (/*agr_7.sign() > 0*/ TRUE) if (/*agr_7.sign() > 0*/ TRUE)
{ {
real pdetr = (agr_2 / (agr_1 + agr_2)); real pdetr = (agr_2i / (agr_1i + agr_2i));
pdetr.round(2);
real ivadt = agr_7 * pdetr; real ivadt = agr_7 * pdetr;
pdetr *= CENTO; pdetr.round(2); pdetr *= CENTO;
pdetr.round(ROUND_LIRA);
ivadt.round(ROUND_LIRA); ivadt.round(ROUND_LIRA);
TString up = agr_2.string("."); TString up = agr_2i.string(".");
up << " x 100"; up << " x 100";
TString dn = agr_1.string("."); TString dn = agr_1i.string(".");
dn << " + " << agr_2.string("."); dn << " + " << agr_2i.string(".");
int ln = max(up.len(), dn.len()) + 2; int ln = max(up.len(), dn.len()) + 2;
TString den(ln); den.fill('-'); TString den(ln); den.fill('-');
up.center_just(ln); dn.center_just(ln); up.center_just(ln); dn.center_just(ln);
set_row(13, ""); set_row(13, "");
set_row(14, "@31g%s", (const char*)up); set_row(14, "@31g%s", (const char*)up);
set_row(15, "Percentuale di detraibilita'@31g%s = @64g%s", set_row(15, "Percentuale di detraibilita'@31g%s = @54g%r",
(const char*)den, (const char*)den,
(const char*)pdetr.string("##,##")); &pdetr);
set_row(16, "@31g%s", (const char*)dn); set_row(16, "@31g%s", (const char*)dn);
up = agr_7.string("."); up = agr_7.string(".");
up << " x " << pdetr.string(".2"); up << " x " << pdetr.string(".");
dn = "100"; dn = "100";
if ((max(up.len(), dn.len()) + 2) > ln) if ((max(up.len(), dn.len()) + 2) > ln)
ln = max(up.len(), dn.len()) + 2; ln = max(up.len(), dn.len()) + 2;
@ -1491,7 +1536,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
// Nel corso della scrittura di questa funzione // Nel corso della scrittura di questa funzione
// Berlusconi + Fini + Bossi hanno vinto le elezioni // Berlusconi + Fini + Bossi hanno vinto le elezioni
// Il moderno imprenditore illuminato dalla fiamma tricolore // Il moderno imprenditore illuminato dalla fiamma tricolore
// ha rincoglionito gli imbecilli con la TV // ha rincoglionito gli imbecilli con la TV e gli stronzi con la P2
// Che la rovina, la galera e la giustizia rossa // Che la rovina, la galera e la giustizia rossa
// possano aver campo su tutto // possano aver campo su tutto
@ -1551,7 +1596,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
real rip = d._r7; rip.round(2); real rip = d._r7; rip.round(2);
// la bella frazioncina degli imponibili viaggi misti // la bella frazioncina degli imponibili viaggi misti
TString tmp2 = d._r3.string(REAL_PICTURE); tmp2.ltrim(); TString tmp2 = d._r1.string(REAL_PICTURE); tmp2.ltrim();
TString up2 = tmp2; TString up2 = tmp2;
up2 << " x " << rip.string(2); up2 << " x " << rip.string(2);
TString dn2 = "100"; TString dn2 = "100";
@ -1605,9 +1650,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
real bil = tmr - tma - d._r8; real bil = tmr - tma - d._r8;
bool iscred = bil.sign() < 0;
bil = abs(bil);
tmp = tmr.string(REAL_PICTURE); tmp.ltrim(); tmp = tmr.string(REAL_PICTURE); tmp.ltrim();
up = "["; up << tmp << " - ("; up = "["; up << tmp << " - (";
tmp = tma.string(REAL_PICTURE); tmp.ltrim(); tmp = tma.string(REAL_PICTURE); tmp.ltrim();
@ -1616,18 +1658,15 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
up << tmp << ")]"; up << tmp << ")]";
den.fill('.',59-up.len()); den.fill('.',59-up.len());
set_row(26,"Base imponibile lorda@40g%t %t@100g%r", &up, &den, &bil);
set_row(27,""); set_row(27,"");
set_row(26,"");
set_row(iscred ? 28 : 26,"%s@40g%t %t@100g%r",
iscred ? "CREDITO DI COSTO " : "Base imponibile lorda",
&up, &den, &bil);
if (bil.sign() > 0 && !iscred) if (bil.sign() > 0)
{ {
real aliva = aliquota_agvia(); real aliva = aliquota_agvia();
real alcnt = aliquota_agvia() + CENTO; real alcnt = aliquota_agvia() + CENTO;
real dovuta = (bil/(alcnt/CENTO)) * (aliva/CENTO); real dovuta = (bil/(alcnt/CENTO)) * (aliva/CENTO);
dovuta.round(ROUND_LIRA); dovuta.ceil(ROUND_LIRA); // ceil voluto da MI3074
tmp = bil.string(REAL_PICTURE); tmp.ltrim(); tmp = bil.string(REAL_PICTURE); tmp.ltrim();
up = tmp; up = tmp;
@ -1643,6 +1682,12 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
set_row(29,"IVA A DEBITO@40g%t %t@100g%r", &den, &tmp, &dovuta); set_row(29,"IVA A DEBITO@40g%t %t@100g%r", &den, &tmp, &dovuta);
set_row(30,"@40g%t", &dn); set_row(30,"@40g%t", &dn);
} }
else if (bil.sign() < 0)
{
bil = abs(bil);
set_row(28,"");
set_row(29,"CREDITO DI COSTO DA RIPORTARE@100g%r", &bil);
}
set_print_zero(FALSE); set_print_zero(FALSE);
set_auto_ff(TRUE); set_auto_ff(TRUE);

View File

@ -1913,7 +1913,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
printer().formfeed(); printer().formfeed();
_intesta_liq = FALSE; _intesta_liq = FALSE;
reset_print(); reset_print();
fremove(t); remove(t);
} }
} }
_st_liq[m] = TRUE; _st_liq[m] = TRUE;
@ -2415,7 +2415,7 @@ void CG4400_application::liq_b0_settato()
printer().footerlen(0); printer().footerlen(0);
merge_export_file(f,FALSE,TRUE); merge_export_file(f,FALSE,TRUE);
_intesta_liq = FALSE; _intesta_liq = FALSE;
fremove(f); remove(f);
} }
} }
@ -2484,7 +2484,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
printer().footerlen(0); printer().footerlen(0);
merge_export_file(_t,FALSE,TRUE); merge_export_file(_t,FALSE,TRUE);
_intesta_liq = FALSE; _intesta_liq = FALSE;
fremove(_t); remove(_t);
} }
//_t = NULL; Come ho potuto scrivere cio?! //_t = NULL; Come ho potuto scrivere cio?!
} }
@ -2738,7 +2738,7 @@ void CG4400_application::no_movimenti()
merge_export_file(f,FALSE,TRUE); merge_export_file(f,FALSE,TRUE);
printer().formfeed(); printer().formfeed();
_intesta_liq = FALSE; _intesta_liq = FALSE;
fremove(f); remove(f);
} }
} }
} }
@ -2954,7 +2954,7 @@ void CG4400_application::stampa_liq_mesi_succ()
printer().footerlen(0); printer().footerlen(0);
merge_export_file(t,FALSE,TRUE); merge_export_file(t,FALSE,TRUE);
_intesta_liq = FALSE; _intesta_liq = FALSE;
fremove(t); remove(t);
} }
} }
} }