Stampa piano dei conti per analisi di bilancio.
git-svn-id: svn://10.65.10.50/trunk@1778 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
995621f8ec
commit
ada1bc0910
508
cg/cg1100.cpp
508
cg/cg1100.cpp
@ -9,6 +9,7 @@
|
||||
#include <sort.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <progind.h>
|
||||
|
||||
#include <nditte.h>
|
||||
#include <pconti.h>
|
||||
@ -50,9 +51,11 @@ class CG1100_application : public TPrintapp
|
||||
|
||||
bil_ivd* _bil;
|
||||
TTable* _tab; // tabella codici IV direttiva
|
||||
TIsamtempfile* _tpcon;
|
||||
TLocalisamfile* _pcon;
|
||||
TRectype* _rec;
|
||||
TSort* _sort;
|
||||
TRelation* _rel;
|
||||
TRelation* _rel, *_relt;
|
||||
TMask* _msk;
|
||||
TParagraph_string _d1, _d2; // qui
|
||||
const char* _buf;
|
||||
@ -60,15 +63,15 @@ class CG1100_application : public TPrintapp
|
||||
bool _salto_pag,_resetta_righe_stampa;
|
||||
int _old_gruppo;
|
||||
int _pcont_reclen,_i;
|
||||
int _cur_c1, _cur_c2;
|
||||
int _cur_c1, _cur_c2, _cur_c3;
|
||||
TString _clivd, _clivdo;
|
||||
char _sez_da_stamp,_sez_stamp,_let_da_stamp,_let_stamp;
|
||||
TString _numr_da_stamp,_numr_stamp;
|
||||
int _gruppo,_conto,_num_da_stamp,_num_stamp,_g_prec,_c_prec;
|
||||
long _sottoc,_s_prec;
|
||||
TString _classe_da_stampare,_classe_stampata;
|
||||
TString _classe_da_stampare,_classe_stampata,_codcbl_da_stamp,_codcbl_stamp;
|
||||
bool _conto_classificato,_sottoc_classificato,_stampa_riga_vuota;
|
||||
bool _prima_volta;
|
||||
bool _prima_volta, _stampa_g, _stampa_c;
|
||||
TDate _data_stampa;
|
||||
|
||||
public:
|
||||
@ -86,16 +89,18 @@ public:
|
||||
|
||||
void intesta (stampe);
|
||||
|
||||
|
||||
bool elabora_riga(); // decide se fare salto pagina o no
|
||||
void do_sort();
|
||||
void set_completa ();
|
||||
void set_con_IV ();
|
||||
void set_senza_IV ();
|
||||
void set_senza_IV_ana ();
|
||||
void set_con_ana ();
|
||||
void set_senza_ana ();
|
||||
// void set_senza_ana ();
|
||||
void prepara_pcon_temp();
|
||||
void cancella(int,int,long);
|
||||
void init_sort();
|
||||
const char* descrizione_numero(char, char, int, int);
|
||||
const char* descrizione_codcbl(TString&);
|
||||
// void setta_righe_descr(TParagraph_string*);
|
||||
int leggo_sottoc(int,int,long);
|
||||
void riempi_record(char,char,const TString&,int,int,int,long,const TString&,char,char,const TString&,int);
|
||||
@ -138,9 +143,16 @@ void CG1100_application::init_sort()
|
||||
case con_ana_bil:
|
||||
{
|
||||
TRecfield codcbl (*_rec, PCN_CODCBL);
|
||||
TRecfield gruppo (*_rec, PCN_GRUPPO);
|
||||
TRecfield conto (*_rec, PCN_CONTO);
|
||||
TRecfield sottoc (*_rec, PCN_SOTTOCONTO);
|
||||
|
||||
_sort->reset(_rec->len());
|
||||
_sort->addsortkey (codcbl);
|
||||
_sort->addsortkey (gruppo);
|
||||
_sort->addsortkey (conto);
|
||||
_sort->addsortkey (sottoc);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -185,8 +197,11 @@ void CG1100_application::riempi_record(char sez,char let,const TString& numr,
|
||||
|
||||
void CG1100_application::postclose_print()
|
||||
{
|
||||
// if (_tipo_stampa == con_IV_direttiva)
|
||||
// delete _sort;
|
||||
if (_tipo_stampa == senza_ana_bil)
|
||||
{
|
||||
delete _tpcon;
|
||||
delete _relt;
|
||||
}
|
||||
}
|
||||
|
||||
print_action CG1100_application::postprocess_page(int file,int counter)
|
||||
@ -195,37 +210,19 @@ print_action CG1100_application::postprocess_page(int file,int counter)
|
||||
{
|
||||
case completa:
|
||||
case senza_IV_direttiva:
|
||||
case completa_bil:
|
||||
case senza_ana_bil:
|
||||
break;
|
||||
case con_IV_direttiva:
|
||||
case con_ana_bil:
|
||||
{
|
||||
//const char * buf;
|
||||
struct bil_ivd* bil = (struct bil_ivd*) _buf;
|
||||
/*
|
||||
if (_sez_da_stamp != _sez_stamp)
|
||||
{
|
||||
if (_sez_da_stamp == '5' || _sez_da_stamp == '9')
|
||||
{
|
||||
reset_print();
|
||||
_i = 1;
|
||||
set_con_IV();
|
||||
_resetta_righe_stampa = FALSE;
|
||||
}
|
||||
else
|
||||
_resetta_righe_stampa = TRUE;
|
||||
}
|
||||
else
|
||||
_resetta_righe_stampa = TRUE;
|
||||
*/
|
||||
|
||||
_sez_stamp = _sez_da_stamp;
|
||||
_let_stamp = _let_da_stamp;
|
||||
_numr_stamp = _numr_da_stamp;
|
||||
_num_stamp = _num_da_stamp;
|
||||
_classe_stampata.format("%c%c%s%2d",_sez_stamp,_let_stamp,(const char*)_numr_stamp,_num_stamp);
|
||||
|
||||
|
||||
|
||||
if ( (_buf = _sort->retrieve()) != NULL)
|
||||
{
|
||||
bil = (struct bil_ivd*) _buf;
|
||||
@ -241,59 +238,72 @@ print_action CG1100_application::postprocess_page(int file,int counter)
|
||||
|
||||
//set_auto_ff(FALSE);
|
||||
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case con_ana_bil:
|
||||
{
|
||||
TRectype rec (LF_PCON);
|
||||
|
||||
_codcbl_stamp = _codcbl_da_stamp;
|
||||
|
||||
if ( (_buf = _sort->retrieve()) != NULL)
|
||||
{
|
||||
rec = _buf;
|
||||
_codcbl_da_stamp = rec.get(PCN_CODCBL);
|
||||
_gruppo = rec.get_int(PCN_GRUPPO);
|
||||
_conto = rec.get_int(PCN_CONTO);
|
||||
_sottoc = rec.get_long(PCN_SOTTOCONTO);
|
||||
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
void CG1100_application::set_page(int file,int counter)
|
||||
{
|
||||
//const char* buf;
|
||||
|
||||
intesta (_tipo_stampa);
|
||||
//intesta (_tipo_stampa);
|
||||
switch (_tipo_stampa)
|
||||
{
|
||||
case con_IV_direttiva:
|
||||
{
|
||||
// if (_resetta_righe_stampa)
|
||||
// {
|
||||
reset_print();
|
||||
_i = 1;
|
||||
// }
|
||||
|
||||
if (_sez_da_stamp != _sez_stamp)
|
||||
// {
|
||||
// if (_sez_da_stamp=='1' || _sez_da_stamp=='2')
|
||||
set_con_IV ();
|
||||
// if (_sez_da_stamp == '5' || _sez_da_stamp == '9')
|
||||
// {
|
||||
// set_row (_i,"%s","");
|
||||
// set_auto_ff(TRUE);
|
||||
// }
|
||||
// }
|
||||
else
|
||||
if (_buf != NULL)
|
||||
set_con_IV();
|
||||
}
|
||||
break;
|
||||
case con_ana_bil:
|
||||
{
|
||||
reset_print();
|
||||
_i = 1;
|
||||
|
||||
if (_codcbl_da_stamp != _codcbl_stamp)
|
||||
set_con_ana ();
|
||||
else
|
||||
if (_buf != NULL)
|
||||
set_con_ana();
|
||||
}
|
||||
break;
|
||||
case senza_IV_direttiva:
|
||||
set_senza_IV();
|
||||
set_senza_IV_ana();
|
||||
break;
|
||||
case senza_ana_bil:
|
||||
set_senza_ana();
|
||||
set_senza_IV_ana();
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
@ -301,13 +311,7 @@ default:
|
||||
//////////////////////////////////////////////////////////////
|
||||
void CG1100_application::do_sort()
|
||||
{
|
||||
switch (_tipo_stampa)
|
||||
{
|
||||
case completa:
|
||||
case senza_IV_direttiva:
|
||||
case senza_ana_bil:
|
||||
break;
|
||||
case con_IV_direttiva:
|
||||
if (_tipo_stampa == con_IV_direttiva)
|
||||
{
|
||||
char sez_conto,let_conto;
|
||||
TString numr_conto;
|
||||
@ -322,8 +326,12 @@ void CG1100_application::do_sort()
|
||||
|
||||
long last = cursor->items();
|
||||
|
||||
TProgind prg (last, "Elaborazione Piano dei Conti... Prego attendere", FALSE, TRUE, 30);
|
||||
|
||||
for ( *cursor = 0; cursor->pos() < last; ++(*cursor) )
|
||||
{
|
||||
prg.addstatus(1);
|
||||
|
||||
int g = rec.get_int(PCN_GRUPPO);
|
||||
int c = rec.get_int(PCN_CONTO);
|
||||
long s = rec.get_int(PCN_SOTTOCONTO);
|
||||
@ -382,14 +390,13 @@ void CG1100_application::do_sort()
|
||||
}
|
||||
|
||||
_sort->endsort();
|
||||
// delete _bil;
|
||||
select_cursor (_cur_c2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case con_ana_bil:
|
||||
if (_tipo_stampa == con_ana_bil)
|
||||
{
|
||||
bool livello_conto = FALSE;
|
||||
|
||||
_sort->init();
|
||||
|
||||
select_cursor (_cur_c1);
|
||||
@ -398,35 +405,166 @@ void CG1100_application::do_sort()
|
||||
TRectype & rec = cursor->curr();
|
||||
|
||||
long last = cursor->items();
|
||||
|
||||
TProgind prg (last, "Elaborazione Piano dei Conti... Prego attendere", FALSE, TRUE, 30);
|
||||
|
||||
TString c1(12);
|
||||
|
||||
int conto_p = -1;
|
||||
|
||||
for ( *cursor = 0; cursor->pos() < last; ++(*cursor) )
|
||||
{
|
||||
if (rec.get(PCN_CONTO).not_empty() && rec.get(PCN_SOTTOCONTO).empty())
|
||||
prg.addstatus(1);
|
||||
|
||||
int gruppo = rec.get_int (PCN_GRUPPO);
|
||||
int conto = rec.get_int (PCN_CONTO);
|
||||
long sottoc = rec.get_long(PCN_SOTTOCONTO);
|
||||
|
||||
if (livello_conto && (conto != conto_p) )
|
||||
{
|
||||
c1 = "";
|
||||
livello_conto = FALSE;
|
||||
}
|
||||
|
||||
conto_p = conto;
|
||||
|
||||
if (conto == 0) // Si tratta di un gruppo
|
||||
c1 = rec.get(PCN_CODCBL);
|
||||
else
|
||||
if (rec.get(PCN_SOTTOCONTO).not_empty() && rec.get(PCN_CODCBL).empty())
|
||||
if (sottoc == 0) // Si tratta di un conto
|
||||
{
|
||||
if (rec.get(PCN_CODCBL).empty())
|
||||
rec.put(PCN_CODCBL, c1);
|
||||
else
|
||||
{
|
||||
c1 = rec.get(PCN_CODCBL);
|
||||
livello_conto = TRUE;
|
||||
}
|
||||
}
|
||||
else // Si tratta di un sottoconto
|
||||
if (rec.get(PCN_CODCBL).empty())
|
||||
rec.put(PCN_CODCBL, c1);
|
||||
|
||||
if (rec.get(PCN_CODCBL).not_empty() )
|
||||
_sort->sort (rec.string());
|
||||
}
|
||||
|
||||
_sort->endsort();
|
||||
select_cursor (_cur_c2);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
void CG1100_application::cancella(int g, int c, long s)
|
||||
{
|
||||
_tpcon->setkey(1);
|
||||
_tpcon->zero();
|
||||
_tpcon->put(PCN_GRUPPO, g);
|
||||
_tpcon->put(PCN_CONTO, c);
|
||||
_tpcon->put(PCN_SOTTOCONTO, s);
|
||||
if (_tpcon->read() == NOERR)
|
||||
_tpcon->remove();
|
||||
}
|
||||
|
||||
void CG1100_application::prepara_pcon_temp()
|
||||
{
|
||||
TLocalisamfile pcon (LF_PCON);
|
||||
TRectype rec (LF_PCON);
|
||||
bool gruppo_riclassificato = FALSE;
|
||||
bool conto_riclassificato = FALSE;
|
||||
|
||||
int g_prec = -1;
|
||||
int c_prec = -1;
|
||||
|
||||
long items = pcon.items();
|
||||
|
||||
TProgind prog (items,"Elaborazione Piano dei Conti... Prego attendere", FALSE, TRUE, 30);
|
||||
|
||||
for (pcon.first(); !pcon.eof(); pcon.next())
|
||||
{
|
||||
prog.addstatus(1);
|
||||
|
||||
int g = pcon.get_int (PCN_GRUPPO);
|
||||
int c = pcon.get_int (PCN_CONTO);
|
||||
long s = pcon.get_long(PCN_SOTTOCONTO);
|
||||
|
||||
if (gruppo_riclassificato && g == g_prec)
|
||||
continue;
|
||||
else
|
||||
gruppo_riclassificato = FALSE;
|
||||
|
||||
if (conto_riclassificato && (g == g_prec && c == c_prec) )
|
||||
continue;
|
||||
else
|
||||
conto_riclassificato = FALSE;
|
||||
|
||||
TString16 codcbl = pcon.get(PCN_CODCBL);
|
||||
|
||||
if (c == 0) // Se si tratta di un gruppo
|
||||
{
|
||||
if (codcbl.empty())
|
||||
{
|
||||
rec = pcon.curr();
|
||||
|
||||
_tpcon->zero();
|
||||
_tpcon->curr() = rec;
|
||||
_tpcon->write();
|
||||
}
|
||||
else
|
||||
gruppo_riclassificato = TRUE;
|
||||
}
|
||||
else
|
||||
if (s == 0) // Se si tratta di un conto
|
||||
{
|
||||
if (codcbl.empty())
|
||||
{
|
||||
rec = pcon.curr();
|
||||
|
||||
_tpcon->zero();
|
||||
_tpcon->curr() = rec;
|
||||
_tpcon->write();
|
||||
}
|
||||
else
|
||||
{
|
||||
int gruppo = pcon.get_int(PCN_GRUPPO);
|
||||
|
||||
cancella(gruppo,0,0); // Cancella l'eventuale gruppo
|
||||
|
||||
conto_riclassificato = TRUE;
|
||||
}
|
||||
}
|
||||
else // Se si tratta di un sottoconto
|
||||
{
|
||||
if (codcbl.empty())
|
||||
{
|
||||
rec = pcon.curr();
|
||||
|
||||
_tpcon->zero();
|
||||
_tpcon->curr() = rec;
|
||||
_tpcon->write();
|
||||
}
|
||||
else
|
||||
{
|
||||
int gruppo = pcon.get_int(PCN_GRUPPO);
|
||||
int conto = pcon.get_int(PCN_CONTO);
|
||||
|
||||
cancella(gruppo,0,0); // Cancella l'eventuale gruppo
|
||||
cancella(gruppo,conto,0); // Cancella l'eventuale conto
|
||||
}
|
||||
}
|
||||
}
|
||||
select_cursor(_cur_c3); // Seleziono il cursore definito sul piano dei conti temporaneo
|
||||
_tpcon->first();
|
||||
}
|
||||
|
||||
bool CG1100_application::preprocess_print (int file,int counter)
|
||||
{
|
||||
do_sort();
|
||||
switch (_tipo_stampa)
|
||||
{
|
||||
case completa:
|
||||
case completa_bil:
|
||||
case senza_IV_direttiva:
|
||||
break;
|
||||
case con_IV_direttiva:
|
||||
case con_ana_bil:
|
||||
{
|
||||
struct bil_ivd* bil = (struct bil_ivd*) _buf;
|
||||
|
||||
@ -449,9 +587,29 @@ bool CG1100_application::preprocess_print (int file,int counter)
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case con_ana_bil:
|
||||
{
|
||||
TRectype rec (LF_PCON);
|
||||
|
||||
if ((_buf = _sort->retrieve()) != NULL)
|
||||
{
|
||||
rec = _buf;
|
||||
_codcbl_da_stamp = rec.get(PCN_CODCBL);
|
||||
_gruppo = rec.get_int(PCN_GRUPPO);
|
||||
_conto = rec.get_int(PCN_CONTO);
|
||||
_sottoc = rec.get_long(PCN_SOTTOCONTO);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case senza_ana_bil:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -611,7 +769,7 @@ void CG1100_application::set_con_IV()
|
||||
_i--;
|
||||
} */
|
||||
|
||||
void CG1100_application::set_senza_IV()
|
||||
void CG1100_application::set_senza_IV_ana()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -658,7 +816,6 @@ void CG1100_application::set_senza_IV()
|
||||
|
||||
if (conto != 0 && sottoc == 0l)
|
||||
{
|
||||
//set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "#") );
|
||||
set_row (i, "@82g@1s", FLD(LF_PCON, PCN_TMCF) );
|
||||
set_row (i, "@89g@f", FLD(LF_PCON, PCN_STSOTTBIL) );
|
||||
@ -670,7 +827,6 @@ void CG1100_application::set_senza_IV()
|
||||
char tipospric = rec.get_char(PCN_TIPOSPRIC);
|
||||
if (tipospric == '\0') tipospric = '0';
|
||||
set_row (i, "@104g@1n", FLD(LF_PCON, PCN_RICSER) );
|
||||
//set_row (i, "@109g@1n", FLD(LF_PCON, PCN_TIPOSPRIC) );
|
||||
set_row (i, "@109g%c", tipospric);
|
||||
set_row (i, "@115g@1s", FLD(LF_PCON, PCN_SEZSALDI) );
|
||||
set_row (i, "@129g@f", FLD(LF_PCON, PCN_STSOTTAB) );
|
||||
@ -679,40 +835,54 @@ void CG1100_application::set_senza_IV()
|
||||
|
||||
void CG1100_application::set_con_ana()
|
||||
{
|
||||
// gruppo, conto e sottoconto
|
||||
int g,c;
|
||||
long s;
|
||||
char tmcf;
|
||||
int TipoSpric, IndBil;
|
||||
TRectype rec (LF_PCON);
|
||||
TString16 val;
|
||||
|
||||
reset_row (1);
|
||||
rec = _buf;
|
||||
|
||||
g = _rec->get_int (PCN_GRUPPO);
|
||||
c = _rec->get_int (PCN_CONTO);
|
||||
s = _rec->get_long (PCN_SOTTOCONTO);
|
||||
tmcf = _rec->get(PCN_TMCF)[0];
|
||||
TipoSpric = _rec->get_int(PCN_TIPOSPRIC);
|
||||
IndBil = _rec->get_int(PCN_INDBIL);
|
||||
TString descrizione,descr;
|
||||
bool stampa_codcbl = TRUE;
|
||||
|
||||
TString cod(_rec->get(PCN_CODCBL));
|
||||
TString codcbl = rec.get(PCN_CODCBL);
|
||||
int gruppo = rec.get_int (PCN_GRUPPO);
|
||||
int conto = rec.get_int (PCN_CONTO);
|
||||
long sottoc = rec.get_long(PCN_SOTTOCONTO);
|
||||
bool stsobi = rec.get_bool(PCN_STSOTTBIL);
|
||||
if (stsobi)
|
||||
val = "Si";
|
||||
else
|
||||
val = "No";
|
||||
|
||||
set_row (1, "%-10s", (const char *) cod);
|
||||
descrizione = descrizione_codcbl(codcbl);
|
||||
descr = rec.get(PCN_DESCR);
|
||||
|
||||
set_row (1, "@15g%-40s", "") ; /* TBI */
|
||||
set_row (1, "@60g$[r]%3d$[n] $[r]%3d$[n] $[r]%6ld$[n]", g, c, s);
|
||||
_d1 = _rec->get (PCN_DESCR);
|
||||
char app = ' ';
|
||||
set_row (_i++,"@0g%c", app);
|
||||
|
||||
set_row (1, "@78g#a", &_d1);
|
||||
|
||||
/* const char * s2 = s1.get();
|
||||
|
||||
if (s2)
|
||||
if (_codcbl_da_stamp != _codcbl_stamp)
|
||||
{
|
||||
reset_row(2);
|
||||
set_row (2, "@78g%-30s", s2);
|
||||
}*/
|
||||
set_row (_i,"@0g%10s", (const char*) _codcbl_da_stamp);
|
||||
set_row (_i,"@12g%s", (const char*) descrizione);
|
||||
}
|
||||
|
||||
set_row (_i,"@62g$[r]%3d$[n]", _gruppo);
|
||||
set_row (_i,"@65g$[r]%3d$[n]", _conto);
|
||||
|
||||
if (_sottoc != 0)
|
||||
set_row (_i,"@68g$[r]%6ld$[n]", _sottoc);
|
||||
|
||||
set_row (_i,"@76g%.40s", (const char*) descr);
|
||||
|
||||
if (conto != 0 && sottoc == 0l)
|
||||
set_row (_i, "@121g%s", (const char*) val);
|
||||
else
|
||||
if (sottoc != 0l)
|
||||
set_row (_i, "@129g%s", (const char*) val);
|
||||
|
||||
_i++;
|
||||
}
|
||||
|
||||
/*********
|
||||
void CG1100_application::set_senza_ana()
|
||||
{
|
||||
reset_row (1);
|
||||
@ -728,15 +898,13 @@ void CG1100_application::set_senza_ana()
|
||||
set_row (1, "@73g#-8t", &_clivd);
|
||||
set_row (1, "@82g@pn", FLD(LF_PCON, PCN_NUMIVD, "@@") );
|
||||
|
||||
//set_row (1, "@87g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
set_row (1, "@87g@pn", FLD(LF_PCON, PCN_INDBIL, "#") );
|
||||
set_row (1, "@92g@1s", FLD(LF_PCON, PCN_TMCF) );
|
||||
set_row (1, "@99g@f", FLD(LF_PCON, PCN_STSOTTBIL) );
|
||||
set_row (1, "@107g@f", FLD(LF_PCON, PCN_COMPENS) );
|
||||
//set_row (1, "@114g@1n", FLD(LF_PCON, PCN_TIPOSPRIC) );
|
||||
set_row (1, "@120g@1s", FLD(LF_PCON, PCN_SEZSALDI) );
|
||||
}
|
||||
|
||||
*********/
|
||||
|
||||
void CG1100_application::set_completa()
|
||||
{
|
||||
@ -772,18 +940,22 @@ void CG1100_application::set_completa()
|
||||
FLD(LF_PCON, PCN_SOTTOCONTO, "######"));
|
||||
|
||||
|
||||
// set_row (1, "@16g@50s", FLD(LF_PCON,PCN_DESCR) );
|
||||
set_row (i, "@16g%.40s", (const char*) desc); // ???
|
||||
|
||||
if (_tipo_stampa == completa)
|
||||
{
|
||||
if (sezione != '0' && sezione != '9')
|
||||
set_row (i, "@58g@1s", FLD(LF_PCON, PCN_SEZIVD) );
|
||||
set_row (i, "@60g@1s", FLD(LF_PCON, PCN_LETTIVD) );
|
||||
set_row (i, "@62g#-8t", &_clivd );
|
||||
set_row (i, "@71g@pn", FLD(LF_PCON, PCN_NUMIVD, "@@") );
|
||||
}
|
||||
else
|
||||
if (_tipo_stampa == completa_bil)
|
||||
set_row (i, "@60g@10s", FLD(LF_PCON, PCN_CODCBL) );
|
||||
|
||||
if (conto != 0 && sottoc == 0l)
|
||||
{
|
||||
//set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "##") );
|
||||
set_row (i, "@76g@pn", FLD(LF_PCON, PCN_INDBIL, "#") );
|
||||
set_row (i, "@82g@1s", FLD(LF_PCON, PCN_TMCF) );
|
||||
set_row (i, "@89g@f", FLD(LF_PCON, PCN_STSOTTBIL) );
|
||||
@ -795,9 +967,8 @@ void CG1100_application::set_completa()
|
||||
char tipospric = rec.get_char(PCN_TIPOSPRIC);
|
||||
if (tipospric == '\0') tipospric = '0';
|
||||
set_row (i, "@104g@1n", FLD(LF_PCON, PCN_RICSER) );
|
||||
//set_row (i, "@109g@1n", FLD(LF_PCON, PCN_TIPOSPRIC) );
|
||||
set_row (i, "@109g%c", tipospric);
|
||||
set_row (i, "@115g@1s", FLD(LF_PCON, PCN_SEZSALDI) );
|
||||
set_row (i, "@114g@1s", FLD(LF_PCON, PCN_SEZSALDI) );
|
||||
set_row (i, "@129g@f", FLD(LF_PCON, PCN_STSOTTAB) );
|
||||
}
|
||||
_s_prec = sottoc;
|
||||
@ -908,8 +1079,9 @@ bool CG1100_application::preprocess_page(int file,int counter)
|
||||
static int c1 = 0;
|
||||
static TString16 a1;
|
||||
char sez;
|
||||
TString16 codcbl;
|
||||
|
||||
if (_tipo_stampa == completa)
|
||||
if (_tipo_stampa == completa || _tipo_stampa == completa_bil)
|
||||
set_completa();
|
||||
|
||||
if (_tipo_stampa == senza_IV_direttiva)
|
||||
@ -969,18 +1141,58 @@ bool CG1100_application::preprocess_page(int file,int counter)
|
||||
_c_prec = conto;
|
||||
}
|
||||
}
|
||||
|
||||
if (_tipo_stampa == senza_ana_bil)
|
||||
{
|
||||
if (file == LF_PCON)
|
||||
{
|
||||
TRectype& rec = current_cursor()->curr();
|
||||
int gruppo = rec.get_int (PCN_GRUPPO);
|
||||
int conto = rec.get_int (PCN_CONTO);
|
||||
long sottoc = rec.get_long(PCN_SOTTOCONTO);
|
||||
|
||||
force_setpage();
|
||||
if (rec.get_int(PCN_CONTO) == 0) return FALSE;
|
||||
if (rec.get_long(PCN_SOTTOCONTO) == 0L)
|
||||
a1 = rec.get(PCN_CODCBL);
|
||||
else
|
||||
if (rec.get(PCN_CODCBL).empty())
|
||||
rec.put(PCN_CODCBL, a1);
|
||||
if (rec.get(PCN_CODCBL).not_empty()) return FALSE;
|
||||
|
||||
if (gruppo != _g_prec)
|
||||
{
|
||||
_stampa_g = TRUE;
|
||||
_stampa_c = TRUE;
|
||||
}
|
||||
|
||||
if ( (gruppo != _g_prec || conto != _c_prec) && _stampa_g)
|
||||
_stampa_c = TRUE;
|
||||
|
||||
_g_prec = gruppo;
|
||||
_c_prec = conto;
|
||||
|
||||
if (conto == 0) // Si tratta di un gruppo
|
||||
{
|
||||
_stampa_g = FALSE;
|
||||
_stampa_c = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (sottoc == 0) // Si tratta di un conto
|
||||
{
|
||||
if (_stampa_g)
|
||||
{
|
||||
_stampa_c = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (sottoc != 0) // Si tratta di un sottoconto
|
||||
{
|
||||
if (_stampa_c)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (elabora_riga())
|
||||
printer().formfeed();
|
||||
|
||||
@ -1016,6 +1228,8 @@ bool CG1100_application::set_print(int)
|
||||
_num_stamp = 0;
|
||||
_classe_stampata = "";
|
||||
|
||||
_resetta_righe_stampa = TRUE;
|
||||
|
||||
if (_tipo_stampa == senza_IV_direttiva)
|
||||
{
|
||||
_conto_classificato = TRUE;
|
||||
@ -1027,17 +1241,33 @@ bool CG1100_application::set_print(int)
|
||||
switch (_tipo_stampa)
|
||||
{
|
||||
case completa:
|
||||
case completa_bil:
|
||||
case senza_IV_direttiva:
|
||||
select_cursor(_cur_c1);
|
||||
break;
|
||||
case senza_ana_bil:
|
||||
select_cursor (_cur_c1); break;
|
||||
{
|
||||
_tpcon = new TIsamtempfile (LF_PCON, "ab", TRUE);
|
||||
_relt = new TRelation (_tpcon);
|
||||
TCursor *tcursor = new TCursor (_relt);
|
||||
|
||||
_cur_c3 = add_cursor (tcursor);
|
||||
|
||||
select_cursor(_cur_c1);
|
||||
prepara_pcon_temp();
|
||||
break;
|
||||
}
|
||||
case con_IV_direttiva:
|
||||
case con_ana_bil:
|
||||
init_sort();
|
||||
do_sort();
|
||||
select_cursor (_cur_c2); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
init_sort();
|
||||
_resetta_righe_stampa = TRUE;
|
||||
//init_sort();
|
||||
|
||||
intesta (_tipo_stampa);
|
||||
|
||||
printer().footerlen(5);
|
||||
|
||||
@ -1079,7 +1309,7 @@ void CG1100_application::intesta (stampe tipo)
|
||||
|
||||
case con_IV_direttiva:
|
||||
set_header (soh++, "@20gStampa conti riclassificati per IV direttiva");
|
||||
s.fill('_');
|
||||
s.fill('-');
|
||||
set_header (soh++, (const char *) s);
|
||||
set_header (soh++, "@58gCodici Piano@116gSez. e Classe");
|
||||
set_header (soh++, "Classe@14gDescrizione@58gdei Conti @73gDescrizione@116gdi segno opposto");
|
||||
@ -1088,26 +1318,33 @@ void CG1100_application::intesta (stampe tipo)
|
||||
|
||||
case senza_IV_direttiva:
|
||||
set_header (soh++, "@20gStampa conti non collegati per IV direttiva");
|
||||
s.fill('_');
|
||||
s.fill('-');
|
||||
set_header (soh++, (const char *) s);
|
||||
set_header (soh++, "Conto @75gTipo@86gNo Dettaglio@104gT@107gSpesa@118gDet.alleg.bil.");
|
||||
set_header (soh++, "Sottoconto @16gDescrizione@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov.");
|
||||
break;
|
||||
|
||||
case completa_bil:
|
||||
soh++;
|
||||
s.fill('-');
|
||||
set_header (soh++, "Conto@60gCod.tabella@75gTipo@86gNo Dettaglio@104gT@107gSpesa@118gDet.alleg.bil.");
|
||||
set_header (soh++, "Sottoconto @16gDescrizione@60gAnalis.bil.@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov.");
|
||||
break;
|
||||
|
||||
case con_ana_bil:
|
||||
|
||||
s.fill('_');
|
||||
soh++;
|
||||
s.fill('-');
|
||||
set_header (soh++, (const char *) s);
|
||||
set_header (soh++, "Codice @61gCodici Piano@113gDett.alleg.Bilancio");
|
||||
set_header (soh++, "Tabella@16gDescrizione@60gdei Conti @78gDescrizione @113gSot.con. * Moviment.");
|
||||
|
||||
set_header (soh++, "Codice @63gCodici Piano@118gDet.alleg.bil.");
|
||||
set_header (soh++, "Tabella@12gDescrizione@63gdei Conti @76gDescrizione@118gSot.con * Mov.");
|
||||
break;
|
||||
|
||||
case senza_ana_bil:
|
||||
s.fill('_');
|
||||
soh++;
|
||||
s.fill('-');
|
||||
set_header (soh++, (const char *) s);
|
||||
set_header (soh++, "Conto @67gSez. Classe@85gTipo@96gNo Dettaglio@112gSpesa @123gDet.bil.");
|
||||
set_header (soh++, "Sottoconto @16gDescrizione@68gIV dir. @85gConto @91gC/F @96gBilancio @106gComp. @112gRicavo @119gSez");
|
||||
set_header (soh++, "Conto@74gTipo@86gNo Dettaglio@107gSpesa@114gT@116gDett.alleg.bil.");
|
||||
set_header (soh++, "Sottoconto@16gDescrizione@74gConto@81gC/F@86gBilancio@96gCompensaz.@107gRicavo@114gA@116gSot.con * Movim.");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1153,6 +1390,19 @@ const char* CG1100_application::descrizione_numero(char sezione, char lettera, i
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const char* CG1100_application::descrizione_codcbl(TString& codcbl)
|
||||
{
|
||||
TLocalisamfile abpcon (LF_ABPCON);
|
||||
|
||||
abpcon.setkey(1);
|
||||
abpcon.zero();
|
||||
abpcon.put("CODCBL", codcbl);
|
||||
if (abpcon.read() == NOERR)
|
||||
tmp = abpcon.get("DESCR");
|
||||
else
|
||||
tmp = "";
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool CG1100_application::user_create()
|
||||
{
|
||||
@ -1160,10 +1410,18 @@ bool CG1100_application::user_create()
|
||||
_tab = new TTable(TAB_IVD);
|
||||
_msk = new TMask ("cg1100a") ;
|
||||
|
||||
_pcon = new TLocalisamfile (LF_PCON);
|
||||
|
||||
TCursor *cursor = new TCursor (_rel);
|
||||
|
||||
_cur_c1 = add_cursor (cursor);
|
||||
|
||||
// _tpcon = new TIsamtempfile (LF_PCON, "ab", TRUE);
|
||||
// _relt = new TRelation (_tpcon);
|
||||
// TCursor *tcursor = new TCursor (_relt);
|
||||
|
||||
// _cur_c3 = add_cursor (tcursor);
|
||||
|
||||
_rec = new TRectype (cursor->curr());
|
||||
|
||||
_pcont_reclen = _rec->len();
|
||||
@ -1186,6 +1444,8 @@ bool CG1100_application::user_destroy()
|
||||
{
|
||||
delete _rel;
|
||||
delete _tab;
|
||||
delete _pcon;
|
||||
//delete _tpcon;
|
||||
delete _msk;
|
||||
delete _rec;
|
||||
// delete _descr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user