Liquidapalle
git-svn-id: svn://10.65.10.50/trunk@1629 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0311244569
commit
d7f4126c1f
@ -245,6 +245,21 @@ bool TLiquidazione_app::user_create()
|
||||
}
|
||||
|
||||
if (need_refresh) _recalc = ever;
|
||||
|
||||
// determina attivita' prevalente e istanzia cazzuole
|
||||
// per vedere che Kazzo di liquidazione calcolare
|
||||
TString attprev = _nditte->curr().get("CODATTPREV");
|
||||
TLocalisamfile& atts = _nditte->lfile(LF_ATTIV);
|
||||
atts.zero();
|
||||
atts.put("CODDITTA",ditta);
|
||||
atts.put("CODATT", attprev);
|
||||
if (atts.read() != NOERR) atts.zero();
|
||||
// istanzia benzinaro
|
||||
_isbenzinaro = atts.get_bool("ART74/4");
|
||||
|
||||
// riaggiusta relazione
|
||||
_nditte->read();
|
||||
|
||||
|
||||
for (int mese = 1; mese < _month; mese++) // fino a 13 compreso
|
||||
if (is_month_plain(mese) || _recalc == ever)
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
word _f0, _f1, _f2,
|
||||
_f3;
|
||||
TString _s0, _s1, _s2,
|
||||
_s3, _s4;
|
||||
_s3, _s4, _s5;
|
||||
real _r0, _r1, _r2,
|
||||
_r3, _r4, _r5,
|
||||
_r6, _r7, _r8,
|
||||
|
1810
cg/cg4301.cpp
1810
cg/cg4301.cpp
File diff suppressed because it is too large
Load Diff
531
cg/cg4303.cpp
531
cg/cg4303.cpp
@ -1,524 +1,3 @@
|
||||
<<<<<<< cg4303.cpp
|
||||
// -----------------------------------------------------------------
|
||||
// Calcolo liquidazione
|
||||
// part 4: casi particolari
|
||||
// fv 2-2-94
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
#include "cg4300.h"
|
||||
|
||||
void TLiquidazione_app::add_plafond(int month, const char* codatt, int type,
|
||||
real& howmuch, bool intra)
|
||||
{
|
||||
look_ppa(month,codatt,type);
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
real r0 = _ppa_r->get_real("R0");
|
||||
real r1 = _ppa_r->get_real("R1");
|
||||
real r2 = _ppa_r->get_real("R2");
|
||||
|
||||
if (intra) r1 += howmuch;
|
||||
else r0 += howmuch;
|
||||
|
||||
if (r2 < (r0+r1))
|
||||
describe_error("Acquisti in eccesso rispetto al plafond disponibile",
|
||||
att.cut(5));
|
||||
_ppa_r->put("R0",r0);
|
||||
_ppa_r->put("R1",r1);
|
||||
_ppa->rewrite();
|
||||
}
|
||||
|
||||
void TLiquidazione_app::zero_plafond (int month, const char* codatt)
|
||||
{
|
||||
for (int jj = 1; jj <= 3; jj++) // three types of plafond
|
||||
{
|
||||
real r;
|
||||
look_ppa(month,codatt,jj,TRUE);
|
||||
if (is_first_month(month))
|
||||
{
|
||||
r = (jj == 1 ? _p8 : (jj == 2 ? _p8b : _p9));
|
||||
}
|
||||
else
|
||||
{
|
||||
long rn = _ppa->recno();
|
||||
|
||||
// se non c'e' quello del mese prima c'e' poco da fare,
|
||||
// si ricalcola tutto
|
||||
if (!look_ppa(previous_month(month),codatt,jj))
|
||||
// mazza che bella chiamata ricorsiva
|
||||
{
|
||||
if (_recalc != needed)
|
||||
{
|
||||
describe_error("Progressivi plafond non ricalcolati per "
|
||||
"i mesi precedenti: possibili errori",
|
||||
codatt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!update_att(previous_month(month),codatt, FALSE))
|
||||
describe_error("Progressivi plafond non ricalcolati per "
|
||||
"i mesi precedenti: possibili errori",
|
||||
codatt);
|
||||
look_ppa(previous_month(month),codatt,jj);
|
||||
}
|
||||
}
|
||||
r = _ppa_r->get_real("R2") -
|
||||
_ppa_r->get_real("R0") -
|
||||
_ppa_r->get_real("R1");
|
||||
|
||||
_ppa->readat(rn);
|
||||
}
|
||||
_ppa_r->put("R2",r);
|
||||
_ppa_r->put("R0","");
|
||||
_ppa_r->put("R1","");
|
||||
_ppa->rewrite();
|
||||
} // for tipo esenzione plafond
|
||||
}
|
||||
|
||||
// ricalcolo dei corrispettivi
|
||||
void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
|
||||
{
|
||||
if (_corr_arr.items() == 0) return;
|
||||
// ricalcola (solo per il mese in corso!) operando sull'array
|
||||
for (int i = 0; i < _corr_arr.items(); i++)
|
||||
{
|
||||
_CorrItem* ci = (_CorrItem*)&_corr_arr[i];
|
||||
if (ci->_month != month || ci->_codatt != codatt)
|
||||
continue;
|
||||
|
||||
real imposta = (abs(ci->_totale) * ci->_aliquota)/(ci->_aliquota + 1.00);
|
||||
imposta.ceil();
|
||||
if (ci->_totale.sign() < 0) imposta = -imposta;
|
||||
real imponibile = ci->_totale - imposta;
|
||||
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
ive += imposta;
|
||||
_plm->put("R0",ive);
|
||||
_plm->rewrite();
|
||||
// .. e il volume di affari nei pam
|
||||
real vaf = _pam->get_real("R1");
|
||||
vaf += imponibile;
|
||||
_pam->put("R1", vaf);
|
||||
_pam->rewrite();
|
||||
|
||||
// Aggiorno i luridi pim
|
||||
look_pim(month, codatt, ci->_codreg, "", ci->_codiva, ci->_tipodet, TRUE);
|
||||
|
||||
imponibile += _pim->get_real("R0");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
_pim->rewrite();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ricalcolo della malefica ventilazione
|
||||
void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
{
|
||||
if (!_isvent || _isagricolo || _isviaggio || _vend_arr.items() == 0) return;
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
// 1) ricalcola i pim dei mesi dal primo al corrente se necessario
|
||||
recalc rcl = _recalc;
|
||||
_recalc = needed;
|
||||
for (int m = 1; m < month; m++)
|
||||
update_att(m,codatt, FALSE);
|
||||
_recalc = rcl;
|
||||
|
||||
_vent_arr.destroy();
|
||||
|
||||
for (m = 1; m <= month; m++)
|
||||
{
|
||||
// aggiunge gli acquisti del mese m operando sui pim
|
||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||
{
|
||||
if (_year != *_pim_anno) continue;
|
||||
|
||||
// se e' acquisto beni per rivendita
|
||||
int tipocr = atoi(*_pim_tipocr);
|
||||
int mese = atoi(*_pim_mese);
|
||||
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;
|
||||
|
||||
|
||||
/*
|
||||
* caso particolare SENSU Vladimiro (1995) #MI3001
|
||||
* questi vengono pero' conteggiati nel totale
|
||||
* acquisti per rivendita
|
||||
*/
|
||||
if (tipocr == 5 && tipodet == 3)
|
||||
continue;
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
if (tipocr == 1 && (mese == m) &&
|
||||
att == (const char*)(*_pim_codatt))
|
||||
{
|
||||
if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES")
|
||||
{
|
||||
real lurd = _pim->get_real("R0");
|
||||
lurd += _pim->get_real("R1");
|
||||
real perc = _iva->get_real("R0");
|
||||
TString other = _iva->get("S6");
|
||||
if (!other.empty())
|
||||
{
|
||||
// ventila a un altro codice
|
||||
look_iva(other);
|
||||
perc = _iva->get_real("R0");
|
||||
}
|
||||
add_ventilation(perc / CENTO, lurd, *_pim_codiva, other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2) calcola totale acquisti su tutte le aliquote
|
||||
real totacq = 0.0;
|
||||
real totven = 0.0;
|
||||
|
||||
for (int j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem& vv = (_VentItem&)_vent_arr[j];
|
||||
totacq += vv._totale;
|
||||
}
|
||||
|
||||
// 3) ricalcola (solo per il mese in corso!) operando sull'array
|
||||
for (int i = 0; i < _vend_arr.items(); i++)
|
||||
{
|
||||
_VendItem* vi = (_VendItem*)&_vend_arr[i];
|
||||
if (vi->_month != month)
|
||||
continue;
|
||||
|
||||
// questo serve solo per il prospettino di m.
|
||||
totven += vi->_totale;
|
||||
|
||||
// 3.2) calcola percentuali di ripartizione e prepara l'affettatrice
|
||||
TDistrib dst(vi->_totale,ROUND_LIRA);
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
dst.add(vv->_totale/totacq);
|
||||
}
|
||||
|
||||
// 3.3) affetta l'importo
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
real imponibile = dst.get();
|
||||
real div(1.0); div += vv->_aliquota;
|
||||
real imposta = imponibile - (imponibile/div);
|
||||
imposta.ceil(ROUND_LIRA);
|
||||
imponibile -= imposta;
|
||||
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
ive += imposta;
|
||||
_plm->put("R0",ive);
|
||||
_plm->rewrite();
|
||||
// .. e il volume di affari nei pam
|
||||
real vaf = _pam->get_real("R1");
|
||||
vaf += imponibile;
|
||||
_pam->put("R1", vaf);
|
||||
_pam->rewrite();
|
||||
|
||||
// Aggiorno i luridi pim
|
||||
look_pim(month, codatt, vi->_codreg, "0", vv->_codiva, vi->_tipodet, TRUE);
|
||||
|
||||
imponibile += _pim->get_real("R0");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
_pim->put("S4", vv->_other);
|
||||
// segnale per comodita'
|
||||
_pim->put("B1","X");
|
||||
_pim->rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
// memorizza totali per il prospettino di m.
|
||||
look_plm(month, codatt);
|
||||
|
||||
// PAM e PUM
|
||||
_pam->put("R2",totacq);
|
||||
_pam->put("R3",totven);
|
||||
_pam->rewrite();
|
||||
}
|
||||
|
||||
|
||||
// questa serve per il rimborso secondo le
|
||||
// nuove cazzonorme
|
||||
class rObj : public TObject
|
||||
{
|
||||
public:
|
||||
real _imp;
|
||||
real _iva;
|
||||
real _perc;
|
||||
|
||||
rObj() {}
|
||||
virtual ~rObj() {}
|
||||
};
|
||||
|
||||
|
||||
// defines per stabilire quale cazzo di metodo piace oggi alla prassi
|
||||
// ------------------------------------------------------------------
|
||||
// Considera tutti i mesi del trimestre fino a quello indicato
|
||||
// se lasciato indefinito usa solo il mese passato
|
||||
#define OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
|
||||
_DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
bool stliq)
|
||||
{
|
||||
// calcola condizioni per il diritto al rimborso infracazzuale
|
||||
// chiamata soltanto per i trimestri anche se annuale
|
||||
// aggiornata a normative per anno liq. > 1994
|
||||
|
||||
bool rimborsami = FALSE;
|
||||
_DescrItem* d = NULL;
|
||||
TToken_string atts(codatts);
|
||||
const char* tmpatt;
|
||||
TString att;
|
||||
|
||||
real es_ni = 0.0;
|
||||
real vol_aff = 0.0;;
|
||||
|
||||
while ((tmpatt = atts.get()) != NULL)
|
||||
{
|
||||
att = tmpatt;
|
||||
#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
for (int m = (month == 13 ? 1 : (next_trim(month)-2)); m <= month; m++)
|
||||
{
|
||||
#else
|
||||
int m = month;
|
||||
#endif
|
||||
if (!look_plm(m,att)) continue;
|
||||
|
||||
vol_aff += _pam->get_real("R1");
|
||||
es_ni += _pum->get_real("R12");
|
||||
#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// condizione 1
|
||||
real prc = es_ni/vol_aff; prc.round(2);
|
||||
|
||||
if (stliq && !vol_aff.is_zero() && prc > MIN_PARTE_ESENTE)
|
||||
{
|
||||
rimborsami = TRUE;
|
||||
d = new _DescrItem(RIMBORSO);
|
||||
d->_f0 = TRUE;
|
||||
d->_r0 = es_ni;
|
||||
d->_r1 = vol_aff;
|
||||
}
|
||||
|
||||
// ---------------------- condizione 2
|
||||
// u' casinu pazzescu d'u nuiu guvernu
|
||||
|
||||
real vtot = 0.0;
|
||||
real atot = 0.0;
|
||||
real ivav = 0.0;
|
||||
real ivaa = 0.0;
|
||||
|
||||
real alv = 0.0; // aliquota media vendite
|
||||
real ala = 0.0; // aliquota media acquisti
|
||||
|
||||
/***********************************************************************
|
||||
Sembra che sia stato annullato subito dopo che ho finito di scrivere
|
||||
queste 150 righe di casino
|
||||
***********************************************************************
|
||||
// due array dove ficcare i totali per
|
||||
// codiva in ordine di imponibile
|
||||
TArray varr, aarr;
|
||||
|
||||
// scorri i bellissimi progressivi mensili rimborso
|
||||
for (_rmb->first(); !_rmb->eof(); _rmb->next())
|
||||
{
|
||||
int year = atoi((const char*)_year);
|
||||
int ryear = atoi((const char*)(*_rmb_anno));
|
||||
int rmese = atoi((const char*)(*_rmb_mese));
|
||||
|
||||
if (year != ryear || (rmese < (month - 2) || rmese > month))
|
||||
continue;
|
||||
|
||||
real imp = _rmb->get("R0");
|
||||
real iva = _rmb->get("R1");
|
||||
real per = _rmb->get("R2");
|
||||
|
||||
rObj* rb = new rObj;
|
||||
rb->_imp = imp;
|
||||
rb->_iva = iva;
|
||||
rb->_perc = per;
|
||||
|
||||
TArray& arr = (tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita ? varr : aarr;
|
||||
|
||||
for (int i = 0; i < arr.items(); i++)
|
||||
{
|
||||
rObj& robj = (rObj&)arr[i];
|
||||
if (robj._imp < imp)
|
||||
break;
|
||||
}
|
||||
arr.insert(rb, i);
|
||||
|
||||
// totali imponibili
|
||||
if ((tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita)
|
||||
vtot += imp;
|
||||
else
|
||||
atot += imp;
|
||||
}
|
||||
|
||||
// se ci sono due o piu' imponibili uguali devo
|
||||
// sostituire l'imposta con la media delle aliquote
|
||||
// ciclo uguale sui due array
|
||||
for (int w = 0; w < 2; w++)
|
||||
{
|
||||
TArray& arr = w == 0 ? varr : aarr;
|
||||
for (int i = 0; i < arr.items(); i++)
|
||||
{
|
||||
rObj& robj = (rObj&)arr[i];
|
||||
real impref = robj._imp;
|
||||
real perc = robj._perc;
|
||||
|
||||
for (int j = i+1; j < arr.items(); j++)
|
||||
{
|
||||
rObj& rbj = (rObj&)arr[j];
|
||||
if (rbj._imp != impref)
|
||||
break;
|
||||
perc += rbj._perc;
|
||||
}
|
||||
// riaggiustesbimo
|
||||
if (j > i+1)
|
||||
{
|
||||
// funzionerebbe comunque ma risparmiamo una
|
||||
// divisione per 1
|
||||
real ndiv(j-i);
|
||||
perc /= ndiv;
|
||||
for (; i < j; i++)
|
||||
{
|
||||
rObj& rbj = (rObj&)arr[i];
|
||||
rbj._iva = rbj._imp * (perc/CENTO);
|
||||
rbj._iva.round(ROUND_LIRA);
|
||||
}
|
||||
i --;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 51 per cento
|
||||
vtot *= PERC_IMP_RIMBORSABILE;
|
||||
atot *= PERC_IMP_RIMBORSABILE;
|
||||
|
||||
for (w = 0; w < 2; w++)
|
||||
{
|
||||
TArray& arr = w == 0 ? varr : aarr;
|
||||
real timp = w == 0 ? vtot : atot;
|
||||
real tiva = 0.0;
|
||||
|
||||
for (int i = 0; i < arr.items(); i++)
|
||||
{
|
||||
rObj& robj = (rObj&)arr[i];
|
||||
if (timp >= robj._imp)
|
||||
{
|
||||
tiva += robj._iva;
|
||||
timp -= robj._imp;
|
||||
}
|
||||
else
|
||||
{
|
||||
real perc = timp/robj._imp;
|
||||
if (!perc.is_zero())
|
||||
{
|
||||
real ttiv = robj._iva * perc;
|
||||
ttiv.round(ROUND_LIRA);
|
||||
tiva += ttiv;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (w == 0) ivav = tiva;
|
||||
else ivaa = tiva;
|
||||
}
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
// scorri i bellissimi progressivi mensili
|
||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||
{
|
||||
int year = atoi((const char*)_year);
|
||||
int ryear = atoi(*_pim_anno);
|
||||
int rmese = atoi(*_pim_mese);
|
||||
|
||||
// B3 significa che e' acq. o vendita valido per rimb. per aliquota
|
||||
if (!_pim->get_bool("B3")) continue;
|
||||
|
||||
#ifdef OGGI_GLI_TIRA_DI_USARE_TRE_MESI
|
||||
if (year != ryear ||
|
||||
(month != 13 && (rmese < (next_trim(month)-2) || rmese > month)))
|
||||
continue;
|
||||
#else
|
||||
if (year != ryear || (month != rmese))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
int tipomov = (tiporeg)_pim->get_long("I1");
|
||||
|
||||
real imp = _pim->get("R0");
|
||||
real iva = _pim->get("R1");
|
||||
|
||||
// totali imponibili
|
||||
if (tipomov == vendita)
|
||||
{
|
||||
vtot += imp;
|
||||
ivav += iva;
|
||||
}
|
||||
else
|
||||
{
|
||||
atot += imp;
|
||||
ivaa += iva;
|
||||
}
|
||||
}
|
||||
|
||||
// finalmente
|
||||
alv = ivav/vtot; alv.round(4);
|
||||
ala = ivaa/atot; ala.round(4);
|
||||
|
||||
// vedi condizioni
|
||||
rimborsami = ala > alv;
|
||||
if (rimborsami)
|
||||
{
|
||||
// vedi di quanto ala eccede alv; deve essere > 10%
|
||||
real ecc = ((ala/alv) - real(1.0));
|
||||
rimborsami = (ecc >= SOGLIA_MAGGIORE_ALIQUOTA_DEL_CAZZO_PER_AVER_DIRITTO_AL_RIMBORSO);
|
||||
}
|
||||
|
||||
if (stliq && rimborsami)
|
||||
{
|
||||
if (d == NULL) d = new _DescrItem(RIMBORSO);
|
||||
d->_f1 = TRUE;
|
||||
d->_r2 = vtot;
|
||||
d->_r3 = atot;
|
||||
d->_r4 = ivav;
|
||||
d->_r5 = ivaa;
|
||||
d->_r6 = alv * CENTO;
|
||||
d->_r7 = ala * CENTO;
|
||||
}
|
||||
|
||||
if (rimborsami && is_month_ok_strict(month))
|
||||
{
|
||||
look_lim(month);
|
||||
_lim->put("B2", "X");
|
||||
_lim->rewrite();
|
||||
}
|
||||
return d;
|
||||
}
|
||||
=======
|
||||
// -----------------------------------------------------------------
|
||||
// Calcolo liquidazione
|
||||
// part 4: casi particolari
|
||||
@ -733,6 +212,8 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
}
|
||||
|
||||
// 3.3) affetta l'importo
|
||||
real tlor = 0.0;
|
||||
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
@ -746,7 +227,14 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
real delta = totale - imponibile - imposta;
|
||||
if (!delta.is_zero())
|
||||
imposta += delta;
|
||||
|
||||
tlor += imponibile + imposta;
|
||||
|
||||
// quadratura generale (solo per unita', che peraltro
|
||||
// dovrebbe essere l'unica possibile stronzata
|
||||
if ((totven - tlor) == real(1.0))
|
||||
imposta += real(1.0);
|
||||
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
@ -1057,4 +545,3 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
}
|
||||
return d;
|
||||
}
|
||||
>>>>>>> 1.41
|
||||
|
107
cg/cg4304.cpp
107
cg/cg4304.cpp
@ -337,8 +337,6 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
|
||||
d->_r6 += _plm->get_real("R11"); // acquisti misti parte fuori CEE
|
||||
}
|
||||
|
||||
// percentuale ripartizione
|
||||
d->_r7 = _lim->get_real("R4");
|
||||
// credito di costo precedente (CHECK annuale)
|
||||
d->_r8 = credito_costo_prec(month);
|
||||
|
||||
@ -676,7 +674,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
||||
{
|
||||
real v1 = _pla->get_real("R14");
|
||||
real v2(_pla->get("S1"));
|
||||
real v = v1 + v2;
|
||||
real ris = v1 + v2;
|
||||
real e1 = _pla->get_real("R1");
|
||||
real e2 = _pla->get_real("R2");
|
||||
real e3 = _pla->get_real("R3");
|
||||
@ -685,8 +683,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
||||
real ppg = _pla->get_real("R12"); // pro-rata pagato
|
||||
|
||||
// calcola nuovo prorata per ogni attivita' (miste: 1+2)
|
||||
real ris = v - am - e3;
|
||||
|
||||
real pr(0.0);
|
||||
if (!ris.is_zero())
|
||||
pr = (e1/ris) * CENTO;
|
||||
@ -753,6 +749,8 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
|
||||
d->_s1 = _lim->get_real("R11").string();
|
||||
d->_s2 = _lim->get_real("R12").string();
|
||||
d->_s3 = _lim->get_real("R13").string();
|
||||
d->_s4 = _lim->get("S0");
|
||||
d->_s5 = _lim->get("S1");
|
||||
d->_r11 = (const char*)_lim->get("R10"); // tasso di interesse
|
||||
|
||||
d->_f1 = is_first_month(month);
|
||||
@ -1356,7 +1354,15 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!_is_visliq)
|
||||
{
|
||||
// descrizione rettifiche
|
||||
if (!(d._s4.empty() && d._s5.empty())) rw++;
|
||||
if (!d._s4.empty()) { set_row(rw++, "%t", &(d._s4)); }
|
||||
if (!d._s5.empty()) { set_row(rw++, "%t", &(d._s5)); }
|
||||
}
|
||||
|
||||
// rapportini per rimborso infraannuale
|
||||
// non si stampano se la stampa serve per la visualizz.
|
||||
//modifica del 07/07/1995
|
||||
@ -1619,14 +1625,32 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
|
||||
void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
{
|
||||
// the longest & stronzest
|
||||
|
||||
// Nel corso della scrittura di questa funzione
|
||||
// Berlusconi + Fini + Bossi hanno vinto le elezioni
|
||||
// Il moderno imprenditore illuminato dalla fiamma tricolore
|
||||
// ha rincoglionito gli imbecilli con la TV e gli stronzi con la P2
|
||||
// Che la rovina, la galera e la giustizia rossa
|
||||
// possano aver campo su tutto
|
||||
// ... lungo commento cancellato
|
||||
|
||||
real& corr_CEE = d._r0;
|
||||
real& corr_misCEE = d._r1;
|
||||
real& corr_noCEE = d._r2;
|
||||
real& acq_CEE = d._r3;
|
||||
real& acq_misCEE = d._r4;
|
||||
real& acq_noCEE = d._r5;
|
||||
real& acq_misnoCEE = d._r6;
|
||||
real& cred_cos = d._r8;
|
||||
|
||||
real perc_r = (acq_misCEE * CENTO)/(acq_misCEE + acq_misnoCEE); perc_r.round(2);
|
||||
real ivm = (corr_misCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA);
|
||||
real tc = (corr_CEE + ivm);
|
||||
real ta = (acq_CEE + acq_misCEE);
|
||||
real bi = tc - ta - cred_cos;
|
||||
|
||||
real tcc = corr_CEE + corr_noCEE + corr_misCEE;
|
||||
real tco = acq_CEE + acq_noCEE + acq_misCEE + acq_misnoCEE;
|
||||
real tma = acq_CEE + acq_misCEE;
|
||||
// real rip = perc_r; rip.round(2);
|
||||
// real cim = (d._r1 * d._r7)/CENTO; cim.round(ROUND_LIRA);
|
||||
|
||||
|
||||
set_print_zero(TRUE);
|
||||
|
||||
set_bookmark("Prospetto 74 ter", _att_bookmark);
|
||||
@ -1635,32 +1659,30 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
set_row(2,"@54gRIEPILOGO 74 TER");
|
||||
set_row(3,"");
|
||||
set_row(4,"Ammontare dei corrispettivi relativi a viaggi eseguiti"
|
||||
" interamente nella CEE .....................@100g%r", &(d._r0));
|
||||
" interamente nella CEE .....................@100g%r", &(corr_CEE));
|
||||
set_row(5,"Ammontare dei corrispettivi relativi a viaggi misti (dentro"
|
||||
" e fuori CEE) ......................... @100g%r", &(d._r1));
|
||||
" e fuori CEE) ......................... @100g%r", &(corr_misCEE));
|
||||
set_row(6,"Ammontare dei corrispettivi relativi a viaggi eseguiti"
|
||||
" interamente fuori CEE ..................... @100g%r", &(d._r2));
|
||||
" interamente fuori CEE ..................... @100g%r", &(corr_noCEE));
|
||||
|
||||
real tc = d._r0 + d._r1 + d._r2;
|
||||
|
||||
set_row(7,"");
|
||||
set_row(8,"@56gTotale corrispettivi@100g%r", &tc);
|
||||
set_row(8,"@56gTotale corrispettivi@100g%r", &tcc);
|
||||
set_row(9,"");
|
||||
|
||||
set_row(10,"Ammontare dei costi relativi a viaggi interamente"
|
||||
" svolti nella CEE ............................... @100g%r",
|
||||
&(d._r3));
|
||||
&(acq_CEE));
|
||||
set_row(11,"Ammontare dei costi relativi a viaggi misti (per la"
|
||||
" parte CEE) ................................... @100g%r",
|
||||
&(d._r4));
|
||||
&(acq_misCEE));
|
||||
set_row(12,"Ammontare dei costi relativi a viaggi interamente"
|
||||
" svolti fuori CEE ............................... @100g%r",
|
||||
&(d._r5));
|
||||
&(acq_noCEE));
|
||||
set_row(13,"Ammontare dei costi relativi a viaggi misti (per la"
|
||||
" parte fuori CEE) .............................@100g%r",
|
||||
&(d._r6));
|
||||
&(acq_misnoCEE));
|
||||
|
||||
real tco = d._r3 + d._r4 + d._r5 + d._r6;
|
||||
|
||||
set_row(14,"");
|
||||
set_row(15,"@64gTotale costi@100g%r", &tco);
|
||||
@ -1671,21 +1693,20 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
set_row(18,"");
|
||||
|
||||
// la bella frazioncina della percentuale di ripartizione
|
||||
TString tmp(d._r4.string(REAL_PICTURE)); tmp.ltrim();
|
||||
TString tmp(acq_misCEE.string(REAL_PICTURE)); tmp.ltrim();
|
||||
TString up = tmp;
|
||||
up << " x 100";
|
||||
TString dn = tmp;
|
||||
tmp = d._r6.string(REAL_PICTURE); tmp.ltrim();
|
||||
tmp = acq_misnoCEE.string(REAL_PICTURE); tmp.ltrim();
|
||||
dn << " + " << tmp;
|
||||
int ln = max(up.len(), dn.len()) + 2;
|
||||
TString den(ln); den.fill('-');
|
||||
up.center_just(ln); dn.center_just(ln);
|
||||
real rip = d._r7; rip.round(2);
|
||||
|
||||
// la bella frazioncina degli imponibili viaggi misti
|
||||
TString tmp2 = d._r1.string(REAL_PICTURE); tmp2.ltrim();
|
||||
TString tmp2 = corr_misCEE.string(REAL_PICTURE); tmp2.ltrim();
|
||||
TString up2 = tmp2;
|
||||
up2 << " x " << rip.string(2);
|
||||
up2 << " x " << perc_r.string(2);
|
||||
TString dn2 = "100";
|
||||
int ln2 = max(up2.len(), 3) + 2;
|
||||
TString den2(ln2); den2.fill('-');
|
||||
@ -1698,24 +1719,23 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
int rem2 = pos1+ den.len() + 11;
|
||||
int pos2 = rem2 + 20;
|
||||
|
||||
real cim = (d._r1 * d._r7)/CENTO; cim.round(ROUND_LIRA);
|
||||
|
||||
set_row(19,format("@%dg%%t@%dg%%t", pos1, pos2),
|
||||
&up, &up2);
|
||||
set_row(20,format("@%dgPerc. rip. = %%t = %%5.2r; @%dg"
|
||||
"Imp. viaggi misti = %%t = @100g%%r",
|
||||
rem1, rem2),
|
||||
&den, &rip, &den2, &cim);
|
||||
&den, &perc_r, &den2, &ivm);
|
||||
set_row(21,format("@%dg%%t@%dg%%t", pos1, pos2),
|
||||
&dn, &dn2);
|
||||
|
||||
real tmr = d._r0 + cim;
|
||||
real tmr = corr_CEE + ivm;
|
||||
|
||||
// whew, come dicono su Topolino
|
||||
|
||||
tmp = d._r0.string(REAL_PICTURE); tmp.ltrim();
|
||||
tmp = corr_CEE.string(REAL_PICTURE); tmp.ltrim();
|
||||
up = "("; up << tmp << " + ";
|
||||
tmp = cim.string(REAL_PICTURE); tmp.ltrim();
|
||||
tmp = ivm.string(REAL_PICTURE); tmp.ltrim();
|
||||
up << tmp << ")";
|
||||
den.fill('.',59-up.len());
|
||||
set_row(23,"Ammontare dei corrispettivi imponibili@40g%t %t@100g%r",
|
||||
@ -1724,18 +1744,15 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
// se e' l'annuale non ha senso altro
|
||||
if (d._f1) return;
|
||||
|
||||
real tma = d._r3 + d._r4;
|
||||
tmp = d._r3.string(REAL_PICTURE); tmp.ltrim();
|
||||
tmp = acq_CEE.string(REAL_PICTURE); tmp.ltrim();
|
||||
up = "("; up << tmp << " + ";
|
||||
tmp = d._r4.string(REAL_PICTURE); tmp.ltrim();
|
||||
tmp = acq_misCEE.string(REAL_PICTURE); tmp.ltrim();
|
||||
up << tmp << ")";
|
||||
den.fill('.',59-up.len());
|
||||
set_row(24,"Ammontare dei costi deducibili@40g%t %t@100g%r",
|
||||
&up, &den, &tma);
|
||||
den.fill('.',60);
|
||||
set_row(25,"Credito di costo precedente @40g%t@100g%r", &den, &(d._r8));
|
||||
|
||||
real bil = tmr - tma - d._r8;
|
||||
set_row(25,"Credito di costo precedente @40g%t@100g%r", &den, &(cred_cos));
|
||||
|
||||
tmp = tmr.string(REAL_PICTURE); tmp.ltrim();
|
||||
up = "["; up << tmp << " - (";
|
||||
@ -1745,17 +1762,17 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
up << tmp << ")]";
|
||||
den.fill('.',59-up.len());
|
||||
|
||||
set_row(26,"Base imponibile lorda@40g%t %t@100g%r", &up, &den, &bil);
|
||||
set_row(26,"Base imponibile lorda@40g%t %t@100g%r", &up, &den, &bi);
|
||||
set_row(27,"");
|
||||
|
||||
if (bil.sign() > 0)
|
||||
if (bi.sign() > 0)
|
||||
{
|
||||
real aliva = aliquota_agvia();
|
||||
real alcnt = aliquota_agvia() + CENTO;
|
||||
real dovuta = (bil/(alcnt/CENTO)) * (aliva/CENTO);
|
||||
real alcnt = aliva + CENTO;
|
||||
real dovuta = (bi/(alcnt/CENTO)) * (aliva/CENTO);
|
||||
dovuta.ceil(ROUND_LIRA); // ceil voluto da MI3074
|
||||
|
||||
tmp = bil.string(REAL_PICTURE); tmp.ltrim();
|
||||
tmp = bi.string(REAL_PICTURE); tmp.ltrim();
|
||||
up = tmp;
|
||||
up << " x " << aliva.string(5,2);
|
||||
dn = alcnt.string();
|
||||
@ -1769,11 +1786,11 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
|
||||
set_row(29,"IVA A DEBITO@40g%t %t@100g%r", &den, &tmp, &dovuta);
|
||||
set_row(30,"@40g%t", &dn);
|
||||
}
|
||||
else if (bil.sign() < 0)
|
||||
else if (bi.sign() < 0)
|
||||
{
|
||||
bil = abs(bil);
|
||||
bi = abs(bi);
|
||||
set_row(28,"");
|
||||
set_row(29,"CREDITO DI COSTO DA RIPORTARE@100g%r", &bil);
|
||||
set_row(29,"CREDITO DI COSTO DA RIPORTARE@100g%r", &bi);
|
||||
}
|
||||
|
||||
set_print_zero(FALSE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user