Corretti errori riepilogativo
git-svn-id: svn://10.65.10.50/trunk@2639 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
52e9cf519d
commit
ea57887099
276
cg/cg4400.cpp
276
cg/cg4400.cpp
@ -470,9 +470,9 @@ bool CG4400_application::cerca_libro_gio(TString& datas, bool* good)
|
||||
if (tiporeg == 5) //libro giornale
|
||||
{
|
||||
const TDate& data = _tabreg->get_date("D3");
|
||||
if (data <= _data_a)
|
||||
if (data < _data_a)
|
||||
{
|
||||
// datas = format("%02/%02d/%4d", data.day(), data.month(), data.year());
|
||||
// datas = format("%02/%02d/%4d", data.day(), data.month(), data.year());
|
||||
datas = data; // Meglio cosi'
|
||||
*good = FALSE;
|
||||
return FALSE;
|
||||
@ -1656,7 +1656,7 @@ int CG4400_application::stampa_acquisti(int row)
|
||||
if (tot_impostap != ZERO)
|
||||
set_row(rw, "@98g%r", &tot_impostap);
|
||||
}
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
rw+=2;
|
||||
}
|
||||
if (riga._tipodet != tdetprec)
|
||||
@ -1687,7 +1687,7 @@ int CG4400_application::stampa_acquisti(int row)
|
||||
if (tot_impostap != ZERO)
|
||||
set_row(rw, "@98g%r", &tot_impostap);
|
||||
}
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
rw+=2;
|
||||
}
|
||||
if (riga._tipodet != tdetprec)
|
||||
@ -1719,7 +1719,7 @@ int CG4400_application::stampa_acquisti(int row)
|
||||
if (tot_impostap != ZERO)
|
||||
set_row(rw, "@98g%r", &tot_impostap);
|
||||
}
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
rw+=2;
|
||||
}
|
||||
if (riga._tipodet != tdetprec)
|
||||
@ -2228,10 +2228,11 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
if (codcf != 0l && _stampa_ind_comp)
|
||||
{
|
||||
//set_row(_r, "@38g%-.27s", (const char*)ragsoc);
|
||||
if (viacf.not_empty()) //se la via non e' vuota non puo' essere vuoto il comune
|
||||
if (viacf.not_empty())
|
||||
{
|
||||
set_row (/*_r+1*/ i++, "@38g%-.23s %-3s",(const char *)viacf, (const char *)civcf);
|
||||
set_row (/*_r+2*/ i++, "@38g%s %-.21s", (const char *)capcf, (const char *)comune);
|
||||
if (comune.not_empty())
|
||||
set_row (/*_r+2*/ i++, "@38g%s %-.21s", (const char *)capcf, (const char *)comune);
|
||||
riga = /*_r+3*/ i;
|
||||
}
|
||||
else if (comune.not_empty())
|
||||
@ -3172,8 +3173,7 @@ void CG4400_application::stampa_liq_mesi_succ()
|
||||
if (!printer().isopen())
|
||||
printer().open();
|
||||
*/
|
||||
// _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione)
|
||||
_datareg = TDate(1, m, _annoes); // Meglio cosi'
|
||||
_datareg = TDate(1, m, _annoes);
|
||||
TFilename t;
|
||||
t.temp("iva");
|
||||
|
||||
@ -3605,7 +3605,8 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
int a, tipo;
|
||||
TString16 codtab, codreg, codatt;
|
||||
TPrintrow row;
|
||||
TRiga_array vect;
|
||||
TRiga_array vect;
|
||||
TRigaiva_array vect_det;
|
||||
bool stampato = FALSE;
|
||||
if (!printer().isopen()) printer().open();
|
||||
for (_tabreg->first(); !_tabreg->eof(); _tabreg->next())
|
||||
@ -3624,7 +3625,8 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
TTable pim("PIM");
|
||||
TString80 chiave,ctab;
|
||||
TString16 creg,codiva;
|
||||
vect.destroy();
|
||||
vect.destroy();
|
||||
vect_det.destroy();
|
||||
//Riepilogo del periodo
|
||||
chiave << _annoes << _tabreg->get("S8");
|
||||
pim.zero();
|
||||
@ -3639,10 +3641,11 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
int mese = atoi(ctab.mid(13,2));
|
||||
if (codreg == creg.trim() && is_mese_ok(mese,m))
|
||||
{
|
||||
codiva = ctab.mid(16,4);
|
||||
codiva = ctab.mid(16,4);
|
||||
int tipodet = atoi(ctab.mid(20,1));
|
||||
real impon = pim.get_real("R0");
|
||||
real impos = pim.get_real("R1");
|
||||
real impol = pim.get_real("R2");
|
||||
real impol = pim.get_real("R2");
|
||||
if (_tabreg->get_bool("B0"))
|
||||
{
|
||||
TToken_string cs(pim.get("S2"));
|
||||
@ -3658,7 +3661,10 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
impon += fatt_rit.get(0);
|
||||
impos += fatt_rit.get(1);
|
||||
if (impon != ZERO || impos != ZERO || impol != ZERO)
|
||||
vect.add_riga(impon,impos,impol,ZERO,ZERO,ZERO,codiva);
|
||||
vect.add_riga(impon,impos,impol,ZERO,ZERO,ZERO,codiva);
|
||||
if (tipo == 2) //registro acquisti
|
||||
if (impon != ZERO || impos != ZERO)
|
||||
vect_det.add_riga(impon,impos,ZERO,ZERO,codiva,tipodet,0,TRUE);
|
||||
}
|
||||
}
|
||||
//Riepilogo progressivi (solo se stampa di bollato)
|
||||
@ -3678,9 +3684,11 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
ctab = pim.get("CODTAB");
|
||||
creg = ctab.mid(10,3);
|
||||
int mese = atoi(ctab.mid(13,2));
|
||||
|
||||
if (codreg == creg.trim() && mese == i)
|
||||
{
|
||||
codiva = ctab.mid(16,4);
|
||||
int tipodet = atoi(ctab.mid(20,1));
|
||||
real impon = pim.get_real("R0");
|
||||
real impos = pim.get_real("R1");
|
||||
real impol = pim.get_real("R2");
|
||||
@ -3700,6 +3708,9 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
impos += fatt_rit.get(1);
|
||||
if (impon != ZERO || impos != ZERO || impol != ZERO)
|
||||
vect.add_riga(ZERO,ZERO,ZERO,impon,impos,impol,codiva);
|
||||
if (tipo == 2)
|
||||
if (impon != ZERO || impos != ZERO)
|
||||
vect_det.add_riga(ZERO,ZERO,impon,impos,codiva,tipodet,0,TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3772,7 +3783,7 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
row.reset();
|
||||
printer().print(row);
|
||||
|
||||
stampa_pims(row, vect, tipo);
|
||||
stampa_pims(row, vect, vect_det, tipo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3780,7 +3791,7 @@ bool CG4400_application::stampa_riepilogo(int m)
|
||||
}
|
||||
|
||||
void CG4400_application::stampa_pims(TPrintrow& riga, TRiga_array& vect,
|
||||
int t)
|
||||
TRigaiva_array& vect_det, int t)
|
||||
{
|
||||
real t_impon, t_impos, t_impol, t_imponp, t_imposp, t_impolp;
|
||||
t_impon = t_impos = t_impol = t_imponp = t_imposp = t_impolp = ZERO;
|
||||
@ -3839,7 +3850,238 @@ void CG4400_application::stampa_pims(TPrintrow& riga, TRiga_array& vect,
|
||||
if (t_impolp != ZERO)
|
||||
riga.put(t_impolp.string("###.###.###.###"),116);
|
||||
}
|
||||
printer().print(riga);
|
||||
printer().print(riga);
|
||||
|
||||
//stampa tipi di indetraibilita' se registro acquisti
|
||||
if (t == 2)
|
||||
{
|
||||
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap;
|
||||
int tdetprec = -1;
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
vect_det.sort(compare_fields);
|
||||
for (int s=0; s<vect_det.items(); s++)
|
||||
{
|
||||
TRigaiva& r = (TRigaiva&)vect_det[s];
|
||||
switch (r._tipodet)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (tdetprec == 3 || tdetprec == 9)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
}
|
||||
if (r._tipodet != tdetprec)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("----- Indetraibile su op.es. -----", 0);
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
riga.put("Cod.", 0);
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
riga.put("iva Descrizione", 0);
|
||||
riga.put("Imponibile", 34);
|
||||
riga.put("Imposta", 53);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
riga.put("Imponibile", 87);
|
||||
riga.put("Imposta", 107);
|
||||
}
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
}
|
||||
riga.put(format("%-4s",(const char*)r._codiva),0);
|
||||
TString descr = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)descr),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib += r._imponibile;
|
||||
tot_imposta += r._imposta;
|
||||
tot_imponibp += r._imponibilep;
|
||||
tot_impostap += r._impostap;
|
||||
tdetprec = r._tipodet;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if (tdetprec == 1 || tdetprec == 9)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
}
|
||||
if (r._tipodet != tdetprec)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("----- Passaggi interni -----",0);
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
riga.put("Cod.", 0);
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
riga.put("iva Descrizione", 0);
|
||||
riga.put("Imponibile", 34);
|
||||
riga.put("Imposta", 53);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
riga.put("Imponibile", 87);
|
||||
riga.put("Imposta", 107);
|
||||
}
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
}
|
||||
riga.put(format("%-4s",(const char*)r._codiva),0);
|
||||
TString descr = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)descr),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib += r._imponibile;
|
||||
tot_imposta += r._imposta;
|
||||
tot_imponibp += r._imponibilep;
|
||||
tot_impostap += r._impostap;
|
||||
tdetprec = r._tipodet;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if (tdetprec == 1 || tdetprec == 3)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
|
||||
}
|
||||
if (r._tipodet != tdetprec)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("----- N.D. 9 - acquisti indeducibili per ART.19 -----", 0);
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
riga.put("Cod.", 0);
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
riga.put("iva Descrizione", 0);
|
||||
riga.put("Imponibile", 34);
|
||||
riga.put("Imposta", 53);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
riga.put("Imponibile", 87);
|
||||
riga.put("Imposta", 107);
|
||||
}
|
||||
printer().print(riga);
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
}
|
||||
riga.put(format("%-4s",(const char*)r._codiva),0);
|
||||
TString descr = descr_iva(r._codiva);
|
||||
riga.put(format("%-.23s",(const char*)descr),5);
|
||||
if (r._imponibile != ZERO)
|
||||
riga.put((r._imponibile).string("###.###.###.###"),29);
|
||||
if (r._imposta != ZERO)
|
||||
riga.put((r._imposta).string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (r._imponibilep != ZERO)
|
||||
riga.put((r._imponibilep).string("###.###.###.###"),82);
|
||||
if (r._impostap != ZERO)
|
||||
riga.put((r._impostap).string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
tot_imponib += r._imponibile;
|
||||
tot_imposta += r._imposta;
|
||||
tot_imponibp += r._imponibilep;
|
||||
tot_impostap += r._impostap;
|
||||
tdetprec = r._tipodet;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (vect_det.items() > 0)
|
||||
if (tdetprec == 1 || tdetprec == 3 || tdetprec == 9)
|
||||
{
|
||||
riga.reset();
|
||||
printer().print(riga);
|
||||
riga.put("TOTALE", 0);
|
||||
if (tot_imponib != ZERO)
|
||||
riga.put(tot_imponib.string("###.###.###.###"),29);
|
||||
if (tot_imposta != ZERO)
|
||||
riga.put(tot_imposta.string("###.###.###.###"),45);
|
||||
if (_tipo_stampa != 1)
|
||||
{
|
||||
if (tot_imponibp != ZERO)
|
||||
riga.put(tot_imponibp.string("###.###.###.###"),82);
|
||||
if (tot_impostap != ZERO)
|
||||
riga.put(tot_impostap.string("###.###.###.###"),99);
|
||||
}
|
||||
printer().print(riga);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cg4400 (int argc, char * argv[])
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
bool look_lia(long ditta = 0l);
|
||||
bool ricalcola(int);
|
||||
bool stampa_riepilogo(int);
|
||||
void stampa_pims(TPrintrow&, TRiga_array&, int);
|
||||
void stampa_pims(TPrintrow&, TRiga_array&, TRigaiva_array&, int);
|
||||
void set_choice_limits(TMask&);
|
||||
void build_ditte_sheet();
|
||||
void cerca_reg(const TString&, byte*);
|
||||
|
Loading…
x
Reference in New Issue
Block a user