Corretti errori su giornale e mastrini
git-svn-id: svn://10.65.10.50/trunk@841 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fac1cd3d63
commit
d15ac0013b
@ -870,8 +870,9 @@ bool TMastrini_application::preprocess_page(int file, int counter)
|
||||
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
|
||||
TString descr_contr = tc.descrizione();
|
||||
set_row (1,"@42g%.18s", (const char*) _descrcaus);
|
||||
set_row (1,"@61g%.23s", (const char*) descr_contr);
|
||||
}
|
||||
if (descr_contr != "Sconosciuto")
|
||||
set_row (1,"@61g%.23s", (const char*) descr_contr);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (_numcarat == 2) // Stampa 198 caratteri
|
||||
@ -902,7 +903,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
|
||||
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
|
||||
TString descr_contr = tc.descrizione();
|
||||
set_row (1,"@42g%.25s", (const char*) _descrcaus);
|
||||
set_row (1,"@68g%.32s", (const char*) descr_contr);
|
||||
if (descr_contr != "Sconosciuto")
|
||||
set_row (1,"@68g%.32s", (const char*) descr_contr);
|
||||
}
|
||||
}
|
||||
|
||||
|
415
cg/cg3400.cpp
415
cg/cg3400.cpp
@ -52,6 +52,8 @@ HIDDEN enum descr { causale, conto, operazione };
|
||||
|
||||
class TContoOccas : public TBill
|
||||
{
|
||||
long _s;
|
||||
char _t;
|
||||
TString16 _occfpi;
|
||||
TString80 _descrizione;
|
||||
|
||||
@ -67,6 +69,7 @@ public:
|
||||
|
||||
const TContoOccas& TContoOccas::set(int g, int c, long s, char t,const char* d, int r, const char* occfpi)
|
||||
{
|
||||
_s = s; _t = t;
|
||||
TBill::set(g,c,s,t,d,r);
|
||||
_occfpi = occfpi;
|
||||
return *this;
|
||||
@ -74,8 +77,21 @@ const TContoOccas& TContoOccas::set(int g, int c, long s, char t,const char* d,
|
||||
|
||||
const TString& TContoOccas::descrizione()
|
||||
{
|
||||
bool really_occas = FALSE;
|
||||
|
||||
if (_occfpi.empty())
|
||||
if (_occfpi.not_empty())
|
||||
{
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.zero();
|
||||
clifo.put(CLI_CODCF, (long)_s);
|
||||
clifo.put(CLI_TIPOCF, _t);
|
||||
|
||||
const bool clifo_ok = (clifo.read() == NOERR);
|
||||
|
||||
if (clifo_ok) really_occas = clifo.get_bool(CLI_OCCAS);
|
||||
}
|
||||
|
||||
if (_occfpi.empty() || !really_occas)
|
||||
_descrizione = TBill::descrizione();
|
||||
else
|
||||
{
|
||||
@ -110,9 +126,13 @@ private:
|
||||
int _ae; // anno esercizio di ALLA_DATA
|
||||
int _tipo; // tipo del registro
|
||||
int _annoEsMov; // anno esercizio letto da mov
|
||||
TString16 _reg;
|
||||
int _anno_iva;
|
||||
bool _stampa_definitiva;
|
||||
bool _MovGiaStampato;
|
||||
long _num_rig;
|
||||
real _importo;
|
||||
char _sezione;
|
||||
// TParagraph_string* _descr_conto;
|
||||
|
||||
public:
|
||||
@ -163,7 +183,7 @@ public:
|
||||
virtual bool user_destroy();
|
||||
|
||||
void set_rows (int file, int counter);
|
||||
void setta_righe_indirizzo(char tipocf, long codcf, int rdesc);
|
||||
int setta_righe_indirizzo(char tipocf, long codcf, int rdesc);
|
||||
int setta_righe_iva();
|
||||
int setta_righe_valuta(int start_riga);
|
||||
int setta_righe_descr(TParagraph_string&, enum descr);
|
||||
@ -187,6 +207,8 @@ public:
|
||||
const char* get_descr_caus (const char * codcaus);
|
||||
TRectype& look_com (const char * cod);
|
||||
const char* get_codiva_des(const char* codiva);
|
||||
void get_date_aep(int aep, TDate* in, TDate* fin);
|
||||
void update_totals (char sezione, real& importo);
|
||||
|
||||
CG3400_application() {};
|
||||
virtual ~CG3400_application() {};
|
||||
@ -417,11 +439,13 @@ void CG3400_application::set_totali_giorno(const TDate& data, const int righeiva
|
||||
TString td(_tot_dare_gg.string(REAL_PICTURE));
|
||||
TString ta(_tot_avere_gg.string(REAL_PICTURE));
|
||||
|
||||
sprintf(dep, "@b@%dgTotale operazioni del %s @%dg%s @%dg%s",
|
||||
sprintf(dep, "@b@%dgTotale operazioni del %s %c @%dg%s %c @%dg%s",
|
||||
_stampa_width == 132 ? DARE132-STACC : DARE198-STACC,
|
||||
data.string(),
|
||||
_stampa_width == 132 ? 'D' : ' ',
|
||||
_stampa_width == 132 ? DARE132 : DARE198,
|
||||
(const char*)td,
|
||||
_stampa_width == 132 ? 'A' : ' ',
|
||||
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||
(const char*)ta
|
||||
);
|
||||
@ -435,11 +459,13 @@ void CG3400_application::set_totali_giorno(const TDate& data, const int righeiva
|
||||
TString tdp(_tot_dare_gg_ap.string(REAL_PICTURE));
|
||||
TString tap(_tot_avere_gg_ap.string(REAL_PICTURE));
|
||||
|
||||
sprintf (dep, "@b@%dgTotale operazioni del %s Anno precedente @%dg%s @%dg%s",
|
||||
sprintf (dep, "@b@%dgTotale operazioni del %s Anno precedente %c @%dg%s %c @%dg%s",
|
||||
_stampa_width == 132 ? DARE132-STACC : DARE198-STACC,
|
||||
data.string(),
|
||||
_stampa_width == 132 ? 'D' : ' ',
|
||||
_stampa_width == 132 ? DARE132 : DARE198,
|
||||
(const char*)tdp,
|
||||
_stampa_width == 132 ? 'A' : ' ',
|
||||
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||
(const char*)tap
|
||||
);
|
||||
@ -530,7 +556,7 @@ void CG3400_application::preprocess_footer()
|
||||
_stampa_width == 132 ? 'D' : ' ',
|
||||
(const char *) dts,
|
||||
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||
_stampa_width == 132 ? 'D' : ' ',
|
||||
_stampa_width == 132 ? 'A' : ' ',
|
||||
(const char *) ats
|
||||
);
|
||||
|
||||
@ -573,14 +599,20 @@ int CG3400_application::stampa_intestazione_ditta()
|
||||
set_header (++r, "Ditta: %s %s %s %s %s", (const char *)_ragsoc,
|
||||
(const char *)_viafis, (const char *)_cap,
|
||||
(const char *)_comunefis, (const char *)_provfis);
|
||||
|
||||
intes.format ("Partita iva %s @24gCodice fiscale %s @%dg%s @%dgData @>",
|
||||
(const char*)_paiva, (const char*)_cofi,
|
||||
_stampa_width == 132 ? 102 : 168,
|
||||
_stampa_definitiva ? "" : "LIBRO DI PROVA",
|
||||
_stampa_width == 132 ? 117 : 183
|
||||
);
|
||||
|
||||
|
||||
if (_stampa_definitiva)
|
||||
intes.format ("Partita iva %s @24gCodice fiscale %s",
|
||||
(const char*)_paiva, (const char*)_cofi,
|
||||
_stampa_width == 132 ? 102 : 168
|
||||
);
|
||||
else
|
||||
intes.format ("Partita iva %s @24gCodice fiscale %s @%dg%s @%dgData @>",
|
||||
(const char*)_paiva, (const char*)_cofi,
|
||||
_stampa_width == 132 ? 102 : 168,
|
||||
"LIBRO DI PROVA",
|
||||
_stampa_width == 132 ? 117 : 183
|
||||
);
|
||||
|
||||
set_header (++r, "%s", (const char*)intes);
|
||||
r++;
|
||||
return r;
|
||||
@ -710,10 +742,12 @@ void CG3400_application::preprocess_header()
|
||||
TString avere(riporto_avere.string(RIP_TOT_PIC));
|
||||
// RIP_TOT_PIC adesso e' lunga 15
|
||||
|
||||
riporto.format("@b@%dgRiporto: @%dg%15s @%dg%15s",
|
||||
riporto.format("@b@%dgRiporto: %c @%dg%15s %c @%dg%15s",
|
||||
_stampa_width == 132 ? 84 : DARE198-11,
|
||||
_stampa_width == 132 ? 'D' : ' ',
|
||||
_stampa_width == 132 ? DARE132 : DARE198,
|
||||
(const char *) dare,
|
||||
(const char *) dare,
|
||||
_stampa_width == 132 ? 'A' : ' ',
|
||||
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||
(const char *) avere
|
||||
);
|
||||
@ -749,7 +783,7 @@ bool CG3400_application::preprocess_print(int file, int counter)
|
||||
|
||||
// _gia_settata_riga_mov = FALSE; // Stampa o no la riga di mov (solo se
|
||||
// NO stampa giornale_iva_unico
|
||||
_num_rig = 0;
|
||||
|
||||
_iva_array.destroy();
|
||||
|
||||
_nprog_mov = _nprog_da;
|
||||
@ -826,26 +860,79 @@ print_action CG3400_application::postprocess_page(int file, int counter)
|
||||
|
||||
break;
|
||||
|
||||
case LF_RMOVIVA:
|
||||
case LF_RMOV:
|
||||
// Sposto qui per evitare di aggiornare i progressivi con una riga della
|
||||
// pagina dopo
|
||||
update_totals(_sezione, _importo);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
void CG3400_application::update_totals (char sezione, real& importo)
|
||||
{
|
||||
#ifdef DBG
|
||||
TString dgap(_tot_dare_gg_ap.string());
|
||||
TString dgpp(_tot_dare_progr_ap.string());
|
||||
TString dgac(_tot_dare_gg.string());
|
||||
TString dgpc(_tot_dare_progr.string());
|
||||
TString agap(_tot_avere_gg_ap.string());
|
||||
TString agpp(_tot_avere_progr_ap.string());
|
||||
TString agac(_tot_avere_gg.string());
|
||||
TString agpc(_tot_avere_progr.string());
|
||||
#endif
|
||||
|
||||
if (sezione == 'D')
|
||||
{
|
||||
if (_annoEsMov != _ae) {
|
||||
_tot_dare_gg_ap += importo; // prog. anno precedente
|
||||
_tot_dare_progr_ap += importo;
|
||||
}
|
||||
else {
|
||||
_tot_dare_gg += importo; // prog. giornalieri
|
||||
_tot_dare_progr += importo; // prog. generali
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_annoEsMov != _ae) {
|
||||
_tot_avere_gg_ap += importo;
|
||||
_tot_avere_progr_ap += importo;
|
||||
}
|
||||
else {
|
||||
_tot_avere_gg += importo;
|
||||
_tot_avere_progr += importo;
|
||||
}
|
||||
}
|
||||
#ifdef DBG
|
||||
dgap = _tot_dare_gg_ap.string();
|
||||
dgpp = _tot_dare_progr_ap.string();
|
||||
dgac = _tot_dare_gg.string();
|
||||
dgpc = _tot_dare_progr.string();
|
||||
agap = _tot_avere_gg_ap.string();
|
||||
agpp = _tot_avere_progr_ap.string();
|
||||
agac = _tot_avere_gg.string();
|
||||
agpc = _tot_avere_progr.string();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CG3400_application::set_rows (int file, int counter)
|
||||
{
|
||||
TString16 datadoc, datareg, reg, numdoc, frm, caus;
|
||||
TString16 datadoc_str, datareg_str, numdoc, frm, caus;
|
||||
TDate datadoc, datareg;
|
||||
TString80 mov_descr, rmv_descr;
|
||||
TParagraph_string descr_conto("", 50);
|
||||
TContoOccas tc;
|
||||
long numreg, protiva;
|
||||
int r = 1, rdes=1;
|
||||
int r = 1;
|
||||
int g, c;
|
||||
long s;
|
||||
char sezione;
|
||||
real importo;
|
||||
static char cf;
|
||||
static char cf = ' ';
|
||||
static int rdes = 1;
|
||||
|
||||
switch (file)
|
||||
{
|
||||
@ -855,45 +942,59 @@ void CG3400_application::set_rows (int file, int counter)
|
||||
{
|
||||
*/
|
||||
reset_row(1);
|
||||
reset_row(2);
|
||||
datareg = _cur->file(LF_MOV).get("DATAREG");
|
||||
datadoc = _cur->file(LF_MOV).get("DATADOC");
|
||||
reset_row(2);
|
||||
|
||||
datareg = _cur->file(LF_MOV).get_date("DATAREG");
|
||||
datadoc = _cur->file(LF_MOV).get_date("DATADOC");
|
||||
datareg_str = datareg.string();
|
||||
// "Fai vedere lo stesso ..-..-.... anche se non c'e' la data..."
|
||||
if (datareg_str.empty())
|
||||
datareg_str = " - - ";
|
||||
datadoc_str = datadoc.string();
|
||||
if (datadoc_str.empty())
|
||||
datadoc_str = " - - ";
|
||||
numdoc = _cur->file(LF_MOV).get("NUMDOC");
|
||||
numreg = _cur->file(LF_MOV).get_long("NUMREG");
|
||||
mov_descr = _cur->file(LF_MOV).get("DESCR");
|
||||
reg = _cur->file(LF_MOV).get(MOV_REG);
|
||||
protiva = _cur->file(LF_MOV).get_long(MOV_PROTIVA);
|
||||
|
||||
// Usati in setta_righe_iva per determinare tipo attivita'
|
||||
_reg = _cur->file(LF_MOV).get(MOV_REG);
|
||||
_anno_iva = _cur->file(LF_MOV).get_int(MOV_ANNOIVA);
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
protiva = _cur->file(LF_MOV).get_long(MOV_PROTIVA);
|
||||
caus = _cur->file(LF_MOV).get(MOV_CODCAUS);
|
||||
_occfpi = _cur->file(LF_MOV).get(MOV_OCFPI);
|
||||
_annoEsMov = _cur->file(LF_MOV).get_int(MOV_ANNOES);
|
||||
|
||||
|
||||
if (_stampa_definitiva)
|
||||
{
|
||||
set_row(r,"Operazione n. %-7ld", _nprog_mov);
|
||||
set_row(r," del %s", (const char*)datareg);
|
||||
set_row(r," documento n. %-7s",(const char*)numdoc);
|
||||
set_row(r," del %s %s",(const char*)datadoc,(const char*)mov_descr);
|
||||
set_row(r," del %s", (const char*)datareg_str); // XX/XX/XXXX
|
||||
set_row(r," doc. n. %-7s",(const char*)numdoc);
|
||||
set_row(r," del %s %-50s",(const char*)datadoc_str,
|
||||
(const char*)mov_descr);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(r,"Operazione n. %7ld", numreg);
|
||||
set_row(r," del %s", (const char*) datareg);
|
||||
set_row(r," documento n. %-7s", (const char*) numdoc);
|
||||
set_row(r," del %s %s", (const char*)datadoc,(const char*)mov_descr);
|
||||
set_row(r,"Operazione n. %-7ld", numreg);
|
||||
set_row(r," del %s", (const char*) datareg_str);
|
||||
set_row(r," doc. n. %-7s", (const char*) numdoc);
|
||||
set_row(r," del %s %-50s", (const char*)datadoc_str,(const char*)mov_descr);
|
||||
}
|
||||
|
||||
if (_annoEsMov != _ae)
|
||||
set_row(r," Comp. %04d", _annoEsMov);
|
||||
if (reg.not_empty())
|
||||
set_row(r, " (R.IVA %3s Prot. %ld) ", (const char*)reg,protiva);
|
||||
|
||||
|
||||
if (_MovGiaStampato && !_stampa_definitiva)
|
||||
set_row(r,format("@%dg*",_stampa_width == 132 ? 131 : 197));
|
||||
|
||||
if (caus.not_empty())
|
||||
{
|
||||
TString80 desc_caus(get_descr_caus(caus));
|
||||
set_row(r+1, "@37gCausale %s %s", (const char*) caus, (const char*) desc_caus);
|
||||
set_row(r+1, "@36gCausale %3s %-50s", (const char*) caus, (const char*) desc_caus);
|
||||
if (_reg.not_empty())
|
||||
set_row(r+1, " (R.IVA %3s Prot. %ld) ", (const char*)_reg,protiva);
|
||||
}
|
||||
|
||||
/**************
|
||||
@ -913,20 +1014,22 @@ void CG3400_application::set_rows (int file, int counter)
|
||||
_num_rig++;
|
||||
// if (!_libro_giornale_iva_unico) _nprog_mov++;
|
||||
|
||||
reset_row(1);
|
||||
|
||||
if (cf > ' ') { // Per pulire le righe di indirizzo eventualmente settate prima.
|
||||
reset_row(2); reset_row(3);reset_row(4);
|
||||
}
|
||||
reset_print();
|
||||
|
||||
g = _cur->file(LF_RMOV).get_int("GRUPPO");
|
||||
c = _cur->file(LF_RMOV).get_int("CONTO");
|
||||
s = _cur->file(LF_RMOV).get_long("SOTTOCONTO");
|
||||
cf = _cur->file(LF_RMOV).get_char(RMV_TIPOC);
|
||||
|
||||
if (cf != 'C' && cf != 'F')
|
||||
cf = ' ';
|
||||
|
||||
numreg = _cur->file(LF_RMOV).get_long("NUMREG");
|
||||
datareg = _cur->file(LF_RMOV).get("DATAREG");
|
||||
sezione = _cur->file(LF_RMOV).get_char (RMV_SEZIONE);
|
||||
importo = _cur->file(LF_RMOV).get_real (RMV_IMPORTO);
|
||||
|
||||
_sezione = _cur->file(LF_RMOV).get_char (RMV_SEZIONE);
|
||||
_importo = _cur->file(LF_RMOV).get_real (RMV_IMPORTO);
|
||||
|
||||
rmv_descr = _cur->file(LF_RMOV).get(RMV_DESCR);
|
||||
|
||||
/*
|
||||
@ -935,6 +1038,7 @@ void CG3400_application::set_rows (int file, int counter)
|
||||
*/
|
||||
r=1;
|
||||
|
||||
// Num. progressivo di operazione. Azzerato in preprocess_page
|
||||
if (!_stampa_definitiva) set_row (r, "%7ld", _num_rig);
|
||||
|
||||
set_row (r, "@8g%-50s", (const char*) rmv_descr);
|
||||
@ -962,56 +1066,35 @@ void CG3400_application::set_rows (int file, int counter)
|
||||
|
||||
tc.set(g,c,s,cf,NULL,-1,_occfpi);
|
||||
|
||||
/*if (_stampa_width == 132)
|
||||
if (_stampa_width == 132)
|
||||
descr_conto.set_width (WCONTO132);
|
||||
else // se a 198 non spezzo le descrizioni
|
||||
descr_conto.set_width(198);*/
|
||||
else // se a 198 non spezzo le descrizioni
|
||||
descr_conto.set_width(198);
|
||||
|
||||
descr_conto = tc.descrizione();
|
||||
|
||||
tmp = tc.descrizione();
|
||||
descr_conto = tmp;
|
||||
if (_stampa_width == 132)
|
||||
rdes = setta_righe_descr (descr_conto, conto);
|
||||
else
|
||||
{
|
||||
rdes = 2;
|
||||
frm.format("@%dg%%-%ds", POSCONTO,50);
|
||||
set_row (r, frm, (const char*) tmp);
|
||||
set_row (r, frm, (const char*) descr_conto);
|
||||
}
|
||||
|
||||
if (cf > ' ')
|
||||
if (_libro_cronologico)
|
||||
setta_righe_indirizzo(cf, s, rdes);
|
||||
|
||||
if (sezione == 'D')
|
||||
{
|
||||
if (_annoEsMov != _ae) {
|
||||
_tot_dare_gg_ap += importo; // prog. anno precedente
|
||||
_tot_dare_progr_ap += importo;
|
||||
}
|
||||
else {
|
||||
_tot_dare_gg += importo; // prog. giornalieri
|
||||
_tot_dare_progr += importo; // prog. generali
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_annoEsMov != _ae) {
|
||||
_tot_avere_gg_ap += importo;
|
||||
_tot_avere_progr_ap += importo;
|
||||
}
|
||||
else {
|
||||
_tot_avere_gg += importo;
|
||||
_tot_avere_progr += importo;
|
||||
}
|
||||
}
|
||||
|
||||
rdes = setta_righe_indirizzo(cf, s, rdes);
|
||||
|
||||
// NB Totali aggiornati in postprocess_page (update_totals())
|
||||
|
||||
if (_stampa_width == 132)
|
||||
{
|
||||
set_row (r, "@112g%r", &importo);
|
||||
set_row (r, "@128g%c", sezione);
|
||||
set_row (r, "@112g%r", &_importo);
|
||||
set_row (r, "@128g%c", _sezione);
|
||||
}
|
||||
else // stampa_width == 198
|
||||
set_row (r, sezione == 'D' ? "@150g%r" : "@174g%r", &importo);
|
||||
set_row (r, _sezione == 'D' ? "@150g%r" : "@174g%r", &_importo);
|
||||
|
||||
if (_MovGiaStampato && !_stampa_definitiva)
|
||||
set_row(r,format("@%dg*",_stampa_width == 132 ? 131 : 197));
|
||||
@ -1040,7 +1123,7 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
|
||||
case LF_MOV:
|
||||
|
||||
_annoEsMov = 0;
|
||||
_annoEsMov = _anno_iva = 0;
|
||||
_iva_array.destroy();
|
||||
|
||||
if (!_cur->is_first_match(LF_RMOV)) return FALSE;
|
||||
@ -1053,7 +1136,9 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
*_RecArrivoA = _cur->file(LF_MOV).curr();
|
||||
|
||||
// if (_libro_giornale_iva_unico) _nprog_mov++;
|
||||
_nprog_mov++;
|
||||
_nprog_mov++;
|
||||
// Il numero di operazione deve ripartire da 0 per ogni movimento
|
||||
_num_rig = 0;
|
||||
|
||||
_data_corr = _cur->file(LF_MOV).get_date(MOV_DATAREG);
|
||||
|
||||
@ -1161,30 +1246,47 @@ const char* CG3400_application::get_codiva_des(const char* codiva)
|
||||
int CG3400_application::setta_righe_iva()
|
||||
{
|
||||
int r=0, j;
|
||||
TString80 rig;
|
||||
|
||||
for (j = 0; j < _iva_array.items(); j++)
|
||||
{
|
||||
TRigaiva& riga = (TRigaiva&)_iva_array[j];
|
||||
r = j+1;
|
||||
set_row(r, "Imponibile@12g%r", &riga._imponibile);
|
||||
set_row(r, "@31gImposta@39g%r", &riga._imposta);
|
||||
set_row(r, "@58gCod.Iva@68g%3s", (const char*)riga._codiva);
|
||||
set_row(r, "@28gImposta@36g%r", &riga._imposta);
|
||||
// set_row(r, "@58gCod.Iva@68g%3s", (const char*)riga._codiva);
|
||||
set_row(r, "@53gCod.Iva %3s", (const char*)riga._codiva);
|
||||
const TString80 codiva_des(get_codiva_des(riga._codiva));
|
||||
const int tipoatt = riga._tipoatt;
|
||||
set_row(r, "@73g%20s", (const char*)codiva_des);
|
||||
if (_stampa_width == 132)
|
||||
set_row(r, "@65g%-.20s", (const char*)codiva_des);
|
||||
else
|
||||
set_row(r, "@65g%-50s", (const char*)codiva_des);
|
||||
const int S132 = 86;
|
||||
const int S198 = 116;
|
||||
rig.format("@%dg", _stampa_width == 132 ? S132 : S198);
|
||||
switch (riga._tipodet)
|
||||
{
|
||||
case 0 : set_row(r, "@94gDetraibile");
|
||||
break;
|
||||
case 1 : set_row(r, "@94gIndetraibile su op.es.");
|
||||
break;
|
||||
case 3 : set_row(r, "@94gPassaggi interni");
|
||||
break;
|
||||
case 9 : set_row(r, "@94gIndetraibile art.19");
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
set_row(r, " Tipo attivita' %d", tipoatt);
|
||||
case 0 :
|
||||
rig << "Detraibile ";
|
||||
break;
|
||||
case 1 :
|
||||
rig << "Indetraibile su op.es. ";
|
||||
break;
|
||||
case 3 :
|
||||
rig << "Passaggi interni ";
|
||||
break;
|
||||
case 9 :
|
||||
rig << "Indetraibile art.19 ";
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
set_row(r, (const char*)rig);
|
||||
|
||||
TRegistro reg(_reg, _anno_iva);
|
||||
const bool att_mista_ev = reg.attivita_mista();
|
||||
if (tipoatt != 0 && att_mista_ev)
|
||||
set_row(r, " Tipo attivita' %d", tipoatt);
|
||||
}
|
||||
_iva_array.destroy();
|
||||
set_row (j+1, ""); // lascio una riga vuota dopo tutto cio'
|
||||
@ -1193,7 +1295,7 @@ int CG3400_application::setta_righe_iva()
|
||||
|
||||
int CG3400_application::setta_righe_valuta(int riga)
|
||||
{
|
||||
const char* simbolo;
|
||||
// const char* simbolo;
|
||||
TString16 codvali;
|
||||
real corrval;
|
||||
int r = riga+1;
|
||||
@ -1203,13 +1305,14 @@ int CG3400_application::setta_righe_valuta(int riga)
|
||||
if (corrval != ZERO)
|
||||
{
|
||||
codvali = current_cursor()->file(LF_MOV).get(MOV_CODVALI);
|
||||
simbolo = SimboloValuta(codvali);
|
||||
// simbolo = SimboloValuta(codvali);
|
||||
TString valut(corrval.string(REAL_PICTURE));
|
||||
|
||||
if (simbolo && *simbolo)
|
||||
set_row(r,"@58gValuta %5s", simbolo);
|
||||
else
|
||||
set_row(r,"@58gValuta %3s", (const char*)codvali);
|
||||
/* if (simbolo && *simbolo)
|
||||
set_row(r,"@58gValuta %5s", simbolo);
|
||||
else */
|
||||
|
||||
set_row(r,"@58gValuta %3s", (const char*)codvali);
|
||||
|
||||
set_row(r++,"@84gCorr.in valuta @112g%s", (const char*)valut);
|
||||
}
|
||||
@ -1219,7 +1322,7 @@ int CG3400_application::setta_righe_valuta(int riga)
|
||||
// Cerca l'indirizzo del C/F.
|
||||
// Legge CLIFO o OCCAS a seconda di _occas
|
||||
// Setta le righe 2 e 3 che vengono poi resettate al record successivo
|
||||
void CG3400_application::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
|
||||
int CG3400_application::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
|
||||
{
|
||||
TString16 prov, comcf, capcf, civcf, statocf;
|
||||
TString80 viacf, comune;
|
||||
@ -1253,7 +1356,7 @@ void CG3400_application::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
|
||||
else
|
||||
{
|
||||
// E' possibile cio' ?
|
||||
if (!clifo_ok) return;
|
||||
if (!clifo_ok) return r;
|
||||
|
||||
viacf = _clifo->get(CLI_INDCF);
|
||||
civcf = _clifo->get(CLI_CIVCF);
|
||||
@ -1318,6 +1421,7 @@ sprintf (riga, "@%dg%s %s",
|
||||
set_row(r++, riga);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
//
|
||||
@ -1335,7 +1439,7 @@ void CG3400_application::aggiorna_tabreg(int partito_da, int stampate)
|
||||
|
||||
if (_tabreg->good())
|
||||
{
|
||||
_tabreg->put ("I7", (long)partito_da); // partito_da = -1 se stampa OK
|
||||
_tabreg->put ("I8", (long)partito_da); // partito_da = -1 se stampa OK
|
||||
if (partito_da == -1)
|
||||
{
|
||||
_tabreg->put ("I1", (long)_pagine_stampate + stampate); // pagine stampate
|
||||
@ -1348,21 +1452,62 @@ void CG3400_application::aggiorna_tabreg(int partito_da, int stampate)
|
||||
}
|
||||
}
|
||||
|
||||
void CG3400_application::get_date_aep(int aep, TDate* in, TDate* fin)
|
||||
{
|
||||
TTable esc("ESC");
|
||||
|
||||
esc.zero(); esc.put("CODTAB", format("%04d",aep));
|
||||
if (esc.read() == NOERR)
|
||||
{
|
||||
*in = esc.get_date("D0");
|
||||
*fin = esc.get_date("D1");
|
||||
}
|
||||
}
|
||||
|
||||
bool CG3400_application::controlla_mov_aep()
|
||||
{
|
||||
const int aep = _ae - 1;
|
||||
bool gia_stampati;
|
||||
TDate inizio_ep, fine_ep;
|
||||
|
||||
if (aep <= 0)
|
||||
return TRUE;
|
||||
else
|
||||
get_date_aep(aep,&inizio_ep, &fine_ep);
|
||||
|
||||
_cur->setfilter(format("ANNOES=%04d && STAMPATO!=\"X\"", aep));
|
||||
#ifdef DBG
|
||||
TString instr(inizio_ep.string());
|
||||
TString finstr(fine_ep.string());
|
||||
#endif
|
||||
|
||||
TRectype da (_cur->file(LF_MOV).curr());
|
||||
TRectype a (_cur->file(LF_MOV).curr());
|
||||
|
||||
da.zero(); a.zero();
|
||||
da.put(MOV_DATAREG, inizio_ep);
|
||||
a.put (MOV_DATAREG, fine_ep);
|
||||
|
||||
_cur->setregion(da, a);
|
||||
|
||||
// _cur->setfilter(format("ANNOES=%04d && STAMPATO!=\"X\"", aep));
|
||||
(*_cur) = 0L;
|
||||
|
||||
_cur->setfilter("");
|
||||
|
||||
if (_cur->items() > 0)
|
||||
for ( ; _cur->pos() < _cur->items(); ++(*_cur))
|
||||
{
|
||||
#ifdef DBG
|
||||
TString datareg(_cur->file().get("DATAREG"));
|
||||
TString numreg(_cur->file().get("NUMREG"));
|
||||
#endif
|
||||
gia_stampati = _cur->file().get_bool("STAMPATO");
|
||||
if (!gia_stampati) break; // basta trovarne uno ancora da stampare
|
||||
}
|
||||
|
||||
if (_cur->items() > 0L && !gia_stampati)
|
||||
{
|
||||
_cur->setfilter("");
|
||||
warning_box("Impossibile proseguire nella stampa.\nEsistono movimenti nell'esercizio precedente non ancora stampati su bollato");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_cur->setfilter("");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1382,7 +1527,7 @@ bool CG3400_application::leggi_tabreg(const char * reg_cod, int reg_anno)
|
||||
|
||||
_pagine_stampate = _tabreg->get_int("I1");
|
||||
_pagine_numerate = _tabreg->get_int("I2");
|
||||
_stampa_ok = _tabreg->get_int("I7");
|
||||
_stampa_ok = _tabreg->get_int("I8");
|
||||
_nprog_da = _tabreg->get_long ("I6");
|
||||
_tot_dare = _tabreg->get_real ("R1");
|
||||
_tot_avere = _tabreg->get_real ("R2");
|
||||
@ -1645,24 +1790,58 @@ void CG3400_application::init_totals()
|
||||
_tot_avere_gg = ZERO;
|
||||
_tot_dare_generale = ZERO;
|
||||
_tot_avere_generale = ZERO;
|
||||
_tot_dare_progr = _tot_dare;
|
||||
_tot_avere_progr = _tot_avere;
|
||||
if (_stampa_definitiva)
|
||||
{
|
||||
_tot_dare_progr = _tot_dare;
|
||||
_tot_avere_progr = _tot_avere;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tot_dare_progr = ZERO;
|
||||
_tot_avere_progr = ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
bool CG3400_application::init_cursor()
|
||||
{
|
||||
{
|
||||
bool gia_stampati = FALSE;
|
||||
|
||||
TRectype da (_cur->file(LF_MOV).curr());
|
||||
TRectype a (_cur->file(LF_MOV).curr());
|
||||
|
||||
#ifdef DBG
|
||||
TString instr(_data_da.string());
|
||||
TString finstr(_data_a.string());
|
||||
#endif
|
||||
|
||||
da.zero(); a.zero();
|
||||
da.put(MOV_DATAREG, _data_da);
|
||||
a.put (MOV_DATAREG, _data_a);
|
||||
|
||||
_cur->setregion(da, a);
|
||||
|
||||
if (_cur->items() == 0)
|
||||
return warning_box ("Non ci sono movimenti.\nLa stampa e' annullata");
|
||||
// _cur->setfilter(format("ANNOES=%04d && STAMPATO!=\"X\"", _ae));
|
||||
(*_cur) = 0L;
|
||||
|
||||
if (_stampa_definitiva)
|
||||
for ( ; _cur->pos() < _cur->items(); ++(*_cur))
|
||||
{
|
||||
#ifdef DBG
|
||||
TString datareg(_cur->file().get("DATAREG"));
|
||||
TString numreg(_cur->file().get("NUMREG"));
|
||||
#endif
|
||||
gia_stampati = _cur->file().get_bool("STAMPATO");
|
||||
if (!gia_stampati) break; // basta trovarne uno ancora da stampare
|
||||
}
|
||||
|
||||
// if (_cur->items() == 0L)
|
||||
if (_cur->items() == 0L || (gia_stampati && _stampa_definitiva))
|
||||
{
|
||||
_cur->setfilter("");
|
||||
return warning_box ("Non ci sono movimenti da stampare nel periodo selezionato.\nLa stampa e' annullata");
|
||||
}
|
||||
|
||||
_cur->setfilter("");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1701,6 +1880,7 @@ bool CG3400_application::set_print(int)
|
||||
}
|
||||
|
||||
init_print();
|
||||
if (!init_cursor()) continue;
|
||||
|
||||
if (_stampa_definitiva)
|
||||
{
|
||||
@ -1730,7 +1910,6 @@ bool CG3400_application::set_print(int)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!init_cursor()) return FALSE;
|
||||
init_totals();
|
||||
|
||||
return TRUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user