Correzione alla stampa riepilogo progressivi relativamente allo
scorporo dei corrispettivi (campo R3 in PIM). git-svn-id: svn://10.65.10.50/trunk@4138 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0b6a298ced
commit
2d4a8bddba
@ -125,6 +125,7 @@ class TProgressivi_iva : public TPrintapp
|
|||||||
bool _st_inizio_anno, _prima_pagina;
|
bool _st_inizio_anno, _prima_pagina;
|
||||||
TIva_array _iva_array,_iva1_array;
|
TIva_array _iva_array,_iva1_array;
|
||||||
TGen_array _gen_array,_gen1_array;
|
TGen_array _gen_array,_gen1_array;
|
||||||
|
TAssoc_array _corr_array;
|
||||||
TString _cap,_cofi,_paiva,_ragsoc,_comunefis,_provfis,_viafis,_codivamsk,_codattmsk;
|
TString _cap,_cofi,_paiva,_ragsoc,_comunefis,_provfis,_viafis,_codivamsk,_codattmsk;
|
||||||
TString _datast, _cod_att;
|
TString _datast, _cod_att;
|
||||||
Importi _mesi[13];
|
Importi _mesi[13];
|
||||||
@ -143,6 +144,7 @@ public:
|
|||||||
virtual bool preprocess_page(int,int);
|
virtual bool preprocess_page(int,int);
|
||||||
virtual print_action postprocess_page(int,int);
|
virtual print_action postprocess_page(int,int);
|
||||||
|
|
||||||
|
void lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota);
|
||||||
void cerca_i_pim();
|
void cerca_i_pim();
|
||||||
void azzera_mesi();
|
void azzera_mesi();
|
||||||
void get_dati_ditta();
|
void get_dati_ditta();
|
||||||
@ -179,6 +181,17 @@ const char* TProgressivi_iva::desc_attivita(const char* codatt)
|
|||||||
return TMP;
|
return TMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TProgressivi_iva::lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota)
|
||||||
|
{
|
||||||
|
imposta = (abs(totale) * aliquota)/(aliquota + 1.00);
|
||||||
|
imposta.ceil();
|
||||||
|
if (totale.sign() < 0) imposta = -imposta;
|
||||||
|
imponibile = totale - imposta;
|
||||||
|
real delta = totale - imponibile - imposta;
|
||||||
|
if (!delta.is_zero())
|
||||||
|
imposta += delta;
|
||||||
|
}
|
||||||
|
|
||||||
const char* TProgressivi_iva::desc_iva(const TString& cod)
|
const char* TProgressivi_iva::desc_iva(const TString& cod)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -256,10 +269,15 @@ void TProgressivi_iva::look_pim()
|
|||||||
{
|
{
|
||||||
TTable pim("PIM");
|
TTable pim("PIM");
|
||||||
TTable reg("REG");
|
TTable reg("REG");
|
||||||
|
TTable tabiva("%IVA");
|
||||||
TString80 codtab;
|
TString80 codtab;
|
||||||
TString16 codatt,codiva,tipoiva,codreg;
|
TString16 codatt,codiva,tipoiva,codreg;
|
||||||
TToken_string a13("",'!');
|
TToken_string a13("",'!');
|
||||||
real imponibile, imposta,afi,afv,a13i,a13v;
|
real imponibile, imposta,afi,afv,a13i,a13v;
|
||||||
|
real corr_item,*cp,aliquota;
|
||||||
|
bool is_key;
|
||||||
|
|
||||||
|
_corr_array.destroy();
|
||||||
|
|
||||||
for (pim.first(); !pim.eof(); pim.next())
|
for (pim.first(); !pim.eof(); pim.next())
|
||||||
{
|
{
|
||||||
@ -296,6 +314,13 @@ void TProgressivi_iva::look_pim()
|
|||||||
if (reg.read() != NOERR) reg.zero();
|
if (reg.read() != NOERR) reg.zero();
|
||||||
const bool corrisp = reg.get_bool("B0");
|
const bool corrisp = reg.get_bool("B0");
|
||||||
|
|
||||||
|
is_key = _corr_array.is_key(codiva);
|
||||||
|
corr_item = ZERO;
|
||||||
|
real& ci = is_key ? (real&) _corr_array[codiva] : corr_item;
|
||||||
|
ci += pim.get_real("R3"); // accumula i corrispettivi
|
||||||
|
if (!is_key)
|
||||||
|
_corr_array.add(codiva,ci);
|
||||||
|
|
||||||
while (classify_pim(pim.curr(), imponibile, imposta, tipo, TRUE))
|
while (classify_pim(pim.curr(), imponibile, imposta, tipo, TRUE))
|
||||||
{
|
{
|
||||||
switch(tipo)
|
switch(tipo)
|
||||||
@ -355,6 +380,19 @@ void TProgressivi_iva::look_pim()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Scorpora i corrispettivi
|
||||||
|
for (cp = (real*) _corr_array.first_item(); cp != NULL; cp = (real*) _corr_array.succ_item())
|
||||||
|
{
|
||||||
|
codiva = _corr_array.get_hashobj()->key();
|
||||||
|
tabiva.put("CODTAB",codiva);
|
||||||
|
if (tabiva.read() == NOERR) aliquota = tabiva.get_real("R0");
|
||||||
|
else aliquota = ZERO;
|
||||||
|
lordo2netto(*cp,imponibile,imposta,aliquota/100.0);
|
||||||
|
if (_mese != 13)
|
||||||
|
_gen_array.add_riga(codiva,imponibile,imposta,ZERO,ZERO,ZERO,ZERO);
|
||||||
|
if (_st_inizio_anno || _mese == 13) //lo metto in un array a parte
|
||||||
|
_gen1_array.add_riga(codiva,imponibile,imposta,ZERO,ZERO,ZERO,ZERO);
|
||||||
|
}
|
||||||
_gen_array.sort(compare_rows); // ordinamento per codice iva
|
_gen_array.sort(compare_rows); // ordinamento per codice iva
|
||||||
_gen1_array.sort(compare_rows); // ordinamento per codice iva
|
_gen1_array.sort(compare_rows); // ordinamento per codice iva
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user