b108a12dba
git-svn-id: svn://10.65.10.50/trunk@64 c028cbd2-c16b-5b4b-a496-9718f37d4682
3618 lines
101 KiB
C++
Executable File
3618 lines
101 KiB
C++
Executable File
#include <mask.h>
|
|
#include <printapp.h>
|
|
#include <scanner.h>
|
|
#include <relation.h>
|
|
#include <tabutil.h>
|
|
#include <utility.h>
|
|
#include <prefix.h>
|
|
#include <lffiles.h>
|
|
#include <sort.h>
|
|
#include <assoc.h>
|
|
#include <progind.h>
|
|
#include <config.h>
|
|
|
|
#include <comuni.h>
|
|
#include <nditte.h>
|
|
#include <unloc.h>
|
|
#include <clifo.h>
|
|
#include <pconti.h>
|
|
#include <anagr.h>
|
|
#include <rmov.h>
|
|
#include <mov.h>
|
|
|
|
#include "cglib.h"
|
|
#include "cg1.h"
|
|
#include "cg1600.h"
|
|
|
|
extern char __tmp [MAXSTR];
|
|
static TFixed_string tmp(__tmp, MAXSTR);
|
|
|
|
bool our_handler (TMask_field & f,KEY k);
|
|
|
|
class Anno_es : public TObject
|
|
{
|
|
TDate _inizio, _fine;
|
|
TToken_string *_str;
|
|
public:
|
|
long anno();
|
|
TDate inizio();
|
|
TDate fine() ;
|
|
Anno_es(long anno, TDate& inizio, TDate& fine);
|
|
~Anno_es() { delete _str; }
|
|
};
|
|
|
|
TDate Anno_es::inizio()
|
|
{
|
|
_inizio = _str->get(1);
|
|
return _inizio;
|
|
}
|
|
|
|
TDate Anno_es::fine()
|
|
{
|
|
_fine = _str->get(2);
|
|
return _fine;
|
|
}
|
|
|
|
long Anno_es::anno()
|
|
{
|
|
return _str->get_int(0);
|
|
}
|
|
|
|
Anno_es::Anno_es(long anno, TDate& inizio, TDate& fine)
|
|
{
|
|
_str = new TToken_string(35);
|
|
_inizio = inizio;
|
|
_fine = fine;
|
|
_str->add(anno); _str->add(_inizio.string()); _str->add(_fine.string());
|
|
}
|
|
|
|
class Anni_es : public TAssoc_array
|
|
{
|
|
TTable * _tabesc;
|
|
public:
|
|
void add(long anno, TDate& inizio, TDate& fine);
|
|
void aggiungi_anno(long anno, TDate& inizio, TDate& fine);
|
|
Anno_es * trova(long anno, TDate& inizio, TDate& fine);
|
|
Anni_es();
|
|
~Anni_es() { delete _tabesc; }
|
|
};
|
|
|
|
Anni_es::Anni_es()
|
|
{
|
|
_tabesc = new TTable (TAB_ESC);
|
|
}
|
|
|
|
void Anni_es::add(long annoe, TDate& in, TDate& fin)
|
|
{
|
|
TString key = format("%4ld", annoe);
|
|
Anno_es anno(annoe, in, fin);
|
|
TAssoc_array::add(key, anno);
|
|
}
|
|
|
|
Anno_es * Anni_es::trova(long annoe, TDate& in, TDate& fin)
|
|
{
|
|
TString key = format("%4ld", annoe);
|
|
Anno_es *anno = (Anno_es*) objptr ((const char*) key);
|
|
if (anno == NULL) {
|
|
in = ""; fin = "";
|
|
}
|
|
else {
|
|
in = anno->inizio();
|
|
fin = anno->fine();
|
|
}
|
|
return anno;
|
|
}
|
|
|
|
void Anni_es::aggiungi_anno(long annoese, TDate& inizio, TDate& fine)
|
|
{
|
|
TString dep;
|
|
TString key = format("%4ld", annoese);
|
|
Anno_es * anno;
|
|
|
|
if (!is_key((const char *) key))
|
|
{
|
|
_tabesc->curr().zero();
|
|
dep = format ("%04d",annoese);
|
|
_tabesc->curr().put("CODTAB", (const char*) dep);
|
|
_tabesc->read();
|
|
if (_tabesc->bad())
|
|
_tabesc->curr().zero();
|
|
inizio = _tabesc->curr().get_date("D0");
|
|
fine = _tabesc->curr().get_date("D1");
|
|
anno = new Anno_es(annoese, inizio, fine);
|
|
TAssoc_array::add(key, anno);
|
|
}
|
|
else
|
|
anno = trova (annoese, inizio, fine);
|
|
}
|
|
|
|
class _riga_sez_opp : public TObject
|
|
{
|
|
TToken_string * _str;
|
|
public:
|
|
int gruppo() { return atoi(_str->get(0)); }
|
|
int conto() { return atoi(_str->get(1)); }
|
|
int sottoc() { return atoi(_str->get(2)); }
|
|
const char * sezione () { return _str->get(3); }
|
|
const char * lettera () { return _str->get(4); }
|
|
const char * num_rom () { return _str->get(5); }
|
|
int numero () { return atoi(_str->get(6)); }
|
|
real saldo_conto ();
|
|
void incrementa_saldo(real& nuovo_saldo);
|
|
_riga_sez_opp(int g, int c, long s,
|
|
const char * sezione, const char * lettera,
|
|
const char * num_rom, int num, real& saldo);
|
|
~_riga_sez_opp();
|
|
};
|
|
|
|
real _riga_sez_opp::saldo_conto ()
|
|
{
|
|
real r(_str->get(7));
|
|
return r;
|
|
}
|
|
|
|
void _riga_sez_opp::incrementa_saldo(real& sld)
|
|
{
|
|
real sld_prec = saldo_conto();
|
|
sld_prec += sld;
|
|
_str->add(sld_prec.string(), 7);
|
|
}
|
|
|
|
_riga_sez_opp::_riga_sez_opp(int g, int c, long s,
|
|
const char * sezione, const char * lettera,
|
|
const char * num_rom, int num, real& saldo)
|
|
{
|
|
_str = new TToken_string(30);
|
|
_str->add(format("%d",g));
|
|
_str->add(format("%d",c));
|
|
_str->add(format("%ld",s));
|
|
_str->add(sezione);
|
|
_str->add(lettera);
|
|
_str->add(num_rom);
|
|
_str->add(format("%d",num));
|
|
_str->add(saldo.string());
|
|
}
|
|
|
|
_riga_sez_opp::~_riga_sez_opp()
|
|
{
|
|
delete _str;
|
|
}
|
|
|
|
class Righe_sez_opp : public TAssoc_array
|
|
{
|
|
public:
|
|
_riga_sez_opp* riga() { return (_riga_sez_opp*) get(); }
|
|
int gruppo() { return riga()->gruppo(); }
|
|
int conto() { return riga()->conto(); }
|
|
int sottoc() { return riga()->sottoc(); }
|
|
const char * sezione () { return riga()->sezione(); }
|
|
const char * lettera () { return riga()->lettera(); }
|
|
const char * num_rom () { return riga()->num_rom(); }
|
|
int numero () { return riga()->numero(); }
|
|
real saldo_conto () { return riga()->saldo_conto(); }
|
|
|
|
void add (int g, int c, long s,
|
|
const char * sezione, const char * lettera,
|
|
const char * num_rom, int num, real saldo);
|
|
};
|
|
|
|
void Righe_sez_opp::add(int g, int c, long s,
|
|
const char * sezione, const char * lettera,
|
|
const char * num_rom, int num, real saldo)
|
|
{
|
|
_riga_sez_opp * riga;
|
|
TString key = format("%s%s%s%d",sezione,lettera,num_rom,num);
|
|
|
|
if (!is_key((const char *) key))
|
|
{
|
|
riga = new _riga_sez_opp (g, c, s, sezione, lettera, num_rom, num, saldo);
|
|
TAssoc_array::add(key,riga);
|
|
}
|
|
else
|
|
{
|
|
riga = (_riga_sez_opp*) objptr ((const char*) key);
|
|
riga->incrementa_saldo(saldo);
|
|
// add(key,riga,TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
class CG1600_application : public TPrintapp
|
|
{
|
|
friend bool our_handler (TMask_field & f,KEY k);
|
|
|
|
struct bil_ivd
|
|
{
|
|
char sez;
|
|
char let;
|
|
char numr[10];
|
|
char num[4];
|
|
char gruppo[4];
|
|
char conto[4];
|
|
char sottoc[8];
|
|
real saldo;
|
|
real saldorafr;
|
|
real sld_prg_dare;
|
|
real sld_prg_avere;
|
|
real mov_dare;
|
|
real mov_avere;
|
|
char tipocf;
|
|
};
|
|
|
|
bil_ivd* _bil;
|
|
TMask* _msk;
|
|
TTable* _tabesc;
|
|
TTable* _tabivd;
|
|
TLocalisamfile* _nditte;
|
|
TLocalisamfile* _comuni;
|
|
TLocalisamfile* _unloc;
|
|
TLocalisamfile* _anag;
|
|
TLocalisamfile* _pconti;
|
|
TLocalisamfile* _clifo;
|
|
const char* _buff;
|
|
TSort* _sort;
|
|
Anni_es _anni_es;
|
|
Righe_sez_opp _sezopps;
|
|
TClifo_list* _listacf;
|
|
TProgind* _prog;
|
|
|
|
TDate _data_fine_ese,_data_fine_ese_prec,_data_fine_raf,_data_fine_raf_prec;
|
|
TDate _datastampa,_datalimite,_databilrafr,_datai,_datairaf;
|
|
TDate _dataini,_datafine,_data_ini_ese;
|
|
int _annoese,_annoeserafr;
|
|
bool _competenza,_intera_struttura,_stampamov,_stampacod,_stampa_modulo;
|
|
bool _stampa_mov_prov;
|
|
TString _classe_stampata, _classe_da_stampare,_numr_tot,_num_tot,_numr,_num;
|
|
char _sez_da_stamp,_let_da_stamp,_sez_stamp,_let_stamp,_sez_tot,_let_tot,_let,_sez_saldo,_sez,_tot_sez_saldo;
|
|
TString _numr_da_stamp,_num_da_stamp,_numr_stamp,_num_stamp,_descr_sez;
|
|
int _tipo_bilancio, _tipo_stampa;
|
|
int _cont_let,_cont_numr,_cont_num,_cont_gcs;
|
|
Saldo _sld;
|
|
real _sale,_salerafr,_totale_ordine,_totale_economico;
|
|
real _totale_ordine_raf,_totale_economico_raf;
|
|
real _totale_numero,_totale_numr,_totale_lettera,_totale_sezione;
|
|
real _totale_patrimoniale,_totale_attivita,_totale_passivita;
|
|
real _totale_num_raf,_totale_numr_raf,_totale_let_raf,_totale_sez_raf;
|
|
real _totale_patrim_raf,_totale_attiv_raf,_totale_passiv_raf;
|
|
real _totale_ordine_attivo,_totale_ordine_passivo,_totale_ordine_attivo_raf;
|
|
real _totale_ordine_passivo_raf;
|
|
real _mov_periodo_dare,_mov_periodo_avere,_prg_prec_dare,_prg_prec_avere,_saldo_ini_dare,_saldo_ini_avere;
|
|
real _sld_prg_dare,_sld_prg_avere,_mov_dare,_mov_avere;
|
|
real _tot_num_saldo,_tot_numr_saldo,_tot_let_saldo,_tot_gen_saldo;
|
|
real _tot_num_prg_d,_tot_numr_prg_d,_tot_let_prg_d,_tot_gen_prg_d;
|
|
real _tot_num_prg_a,_tot_numr_prg_a,_tot_let_prg_a,_tot_gen_prg_a;
|
|
real _tot_num_mov_d,_tot_numr_mov_d,_tot_let_mov_d,_tot_gen_mov_d;
|
|
real _tot_num_mov_a,_tot_numr_mov_a,_tot_let_mov_a,_tot_gen_mov_a;
|
|
real _tot_num_saldo_d,_tot_numr_saldo_d,_tot_let_saldo_d,_tot_gen_saldo_d;
|
|
real _tot_num_saldo_a,_tot_numr_saldo_a,_tot_let_saldo_a,_tot_gen_saldo_a;
|
|
int _i;
|
|
bool _reset_righe_stampa,_totale_attivita_gia_stampato,_totale_passivita_gia_stampato,_statopatr_no_stamp;
|
|
TString _causale_ap, _causale_chi;
|
|
|
|
public:
|
|
|
|
bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; }
|
|
void user_create() ;
|
|
void user_destroy();
|
|
bool set_print(int);
|
|
|
|
virtual bool preprocess_page (int,int);
|
|
virtual print_action postprocess_page (int,int);
|
|
virtual print_action postprocess_print (int,int);
|
|
|
|
virtual void preprocess_header();
|
|
virtual void set_page(int,int);
|
|
|
|
bool preprocess_stampa_scalare(int);
|
|
bool preprocess_stampa_verifica(int);
|
|
void crea_intestazione();
|
|
void intesta_scalare();
|
|
void intesta_verifica();
|
|
void intesta_verifica_fissa();
|
|
TDate data_inferiore();
|
|
TDate data_inferiore_raf();
|
|
void init_sort();
|
|
void crea_sort_tabella();
|
|
void crea_sort_piano_conti_scalare();
|
|
void crea_sort_piano_conti_verifica();
|
|
void scrivi_record(const TString&,const TString&,const TString&,int,int,int,long,const real&,const real&,const real&,const real&,const real&,const real&,char);
|
|
void scrivi_record_fittizio(const TString&,const TString&,const TString&,int);
|
|
void riempi_record(const TString&,const TString&,const TString&,int,int,int,long,const real&,const real&,const real&,const real&,const real&,const real&,char);
|
|
const char* descrizione_sezione(char);
|
|
const char* descrizione_lettera(char, char);
|
|
const char* descrizione_numeroromano(char, char, TString);
|
|
const char* descrizione_numero(char, char, TString, int);
|
|
const char* descrizione_sottoconto(int, int, long);
|
|
const char* descr_sottoc_clifo(char,int,int,long);
|
|
void setta_righe(const char*);
|
|
void setta_righe_verifica();
|
|
void stampa_totali();
|
|
void stampa_totali_con_raffronto();
|
|
void stampa_totali_verifica();
|
|
bool calcola(int,int,long,const TDate&,const TDate&);
|
|
bool calcola_saldo(real&, real&,int,int,long,int);
|
|
bool ricerca_sottoc_clifo(int,int,char,TString&,TString&,TString&,int,int);
|
|
const char* causale_apertura() { return _causale_ap;}
|
|
const char* causale_chiusura() { return _causale_chi;}
|
|
void stampa_saldo_132(const real&);
|
|
void stampa_saldo_198(real&, real&);
|
|
void set_bil_key(bil_ivd* b, char lettera, char sezione,
|
|
const char* numero_romano, int numero,
|
|
bool conti_ordine = TRUE, int conto = 0,
|
|
int gruppo = 0, long sottoconto = 0L, char tipocf = ' ');
|
|
void set_bil_val(bil_ivd* b, const real& saldo = ZERO,
|
|
const real& saldorafr = ZERO,
|
|
const real& sld_prg_dare = ZERO,
|
|
const real& sld_prg_avere = ZERO,
|
|
const real& mov_dare = ZERO,
|
|
const real& mov_avere = ZERO);
|
|
CG1600_application() {}
|
|
};
|
|
|
|
print_action CG1600_application::postprocess_print(int file, int counter)
|
|
{
|
|
delete _sort;
|
|
|
|
|
|
return NEXT_PAGE;
|
|
}
|
|
|
|
void CG1600_application::set_bil_key(bil_ivd* b, char lettera, char sezione,
|
|
const char* numero_romano, int numero,
|
|
bool conti_ordine, int conto, int gruppo,
|
|
long sottoconto, char tipocf)
|
|
|
|
{
|
|
b->sez = sezione;
|
|
|
|
//Se esiste solamente la sezione,significa che e' un conto d'ordine
|
|
//Forzo la lettera della classe a Z, per ottenere, grazie
|
|
//all'ordinamento del sort, i record dei conti d'ordine per ultimi
|
|
|
|
b->let = (conti_ordine && lettera == '\0' && sezione < '3') ? 'Z' : lettera;
|
|
strcpy(b->numr, numero_romano);
|
|
sprintf(b->num , "%2d", numero);
|
|
if (gruppo < 0)
|
|
{
|
|
strcpy(b->gruppo, "ZZZ");
|
|
strcpy(b->conto, "ZZZ");
|
|
strcpy(b->sottoc, "ZZZZZZ");
|
|
b->tipocf = ' ';
|
|
}
|
|
else
|
|
if (gruppo == 0)
|
|
{
|
|
strcpy(b->gruppo, "AAA");
|
|
strcpy(b->conto, "AAA");
|
|
strcpy(b->sottoc, "AAAAAA");
|
|
b->tipocf = ' ';
|
|
}
|
|
else
|
|
{
|
|
sprintf(b->gruppo , "%3d", gruppo);
|
|
sprintf(b->conto , "%3d", conto);
|
|
sprintf(b->sottoc , "%6ld", sottoconto);
|
|
b->tipocf = tipocf;
|
|
}
|
|
}
|
|
|
|
void CG1600_application::set_bil_val(bil_ivd* b, const real& saldo,
|
|
const real& saldorafr,
|
|
const real& sld_prg_dare,
|
|
const real& sld_prg_avere,
|
|
const real& mov_dare,
|
|
const real& mov_avere)
|
|
{
|
|
b->saldo = saldo;
|
|
b->saldorafr = saldorafr;
|
|
b->sld_prg_dare = sld_prg_dare;
|
|
b->sld_prg_avere = sld_prg_avere;
|
|
b->mov_dare = mov_dare;
|
|
b->mov_avere = mov_avere;
|
|
}
|
|
|
|
|
|
bool our_handler(TMask_field& f, KEY key)
|
|
{
|
|
if (key == K_ENTER)
|
|
{
|
|
TMask& m = f.mask();
|
|
int tipobil,tipostampa;
|
|
TDate datalim,databilrafr;
|
|
TDate in="", fin="", in_prec="", fin_prec="";
|
|
CG1600_application * a = (CG1600_application*) MainApp();
|
|
|
|
tipobil = atoi(m.get(F_TIPOBIL));
|
|
tipostampa = atoi(m.get(F_TIPOSTAMPA));
|
|
|
|
long annoese = m.get_long(F_ANNOESE);
|
|
long annoprec = annoese - 1;
|
|
a->_anni_es.aggiungi_anno(annoese, in, fin);
|
|
a->_anni_es.aggiungi_anno(annoprec, in_prec, fin_prec);
|
|
a->_data_fine_ese = fin;
|
|
a->_data_fine_ese_prec = fin_prec;
|
|
if ((tipobil == 1) && (tipostampa == 1))
|
|
{
|
|
if (f.dlg() == F_DATALIM)
|
|
{
|
|
datalim = m.get(F_DATALIM);
|
|
|
|
if ((datalim < in_prec)||(datalim > fin))
|
|
{
|
|
f.error_box("La data limite non puo' essere inferiore alla data inizio esercizio precedente, e superiore alla data fine esercizio in corso");
|
|
return FALSE;
|
|
}
|
|
}
|
|
if (f.dlg() == F_DATABILRAF)
|
|
{
|
|
datalim = m.get(F_DATALIM);
|
|
databilrafr = m.get(F_DATABILRAF);
|
|
|
|
if (datalim <= fin_prec)
|
|
if (databilrafr >= in_prec)
|
|
{
|
|
f.error_box("La data bilancio da raffrontare non puo' essere maggiore o uguale alla data inizio esercizio precedente");
|
|
return FALSE;
|
|
}
|
|
if (datalim <= fin)
|
|
if (databilrafr >= in)
|
|
{
|
|
f.error_box("La data bilancio da raffrontare non puo' essere maggiore o uguale alla data inizio esercizio in corso");
|
|
return FALSE;
|
|
}
|
|
}
|
|
}
|
|
if ((tipobil == 1) && (tipostampa == 2))
|
|
if (f.dlg() == F_DATABILRAF)
|
|
{
|
|
databilrafr = m.get(F_DATABILRAF);
|
|
if ((databilrafr>=in))
|
|
{
|
|
f.error_box("La data bilancio da raffrontare non puo' essere superiore alla data inizio esercizio in corso");
|
|
return FALSE;
|
|
}
|
|
}
|
|
if ((tipobil == 1) && (tipostampa == 3))
|
|
if (f.dlg() == F_DATABILRAF)
|
|
{
|
|
databilrafr = m.get(F_DATABILRAF);
|
|
if ((databilrafr>=in_prec))
|
|
{
|
|
f.error_box("La data bilancio da raffrontare non puo' essere superiore alla data inizio esercizio precedente");
|
|
return FALSE;
|
|
}
|
|
}
|
|
if ((tipobil == 2) && (tipostampa == 1))
|
|
{
|
|
if (f.dlg() == F_DATAINI)
|
|
{
|
|
TDate dataini(m.get(F_DATAINI));
|
|
if (dataini < in)
|
|
{
|
|
f.error_box("La data limite inferiore non puo' essere minore della data inizio esercizio precedente");
|
|
return FALSE;
|
|
}
|
|
}
|
|
if (f.dlg() == F_DATAFINE)
|
|
{
|
|
TDate datafine(m.get(F_DATAFINE));
|
|
if (datafine > fin)
|
|
{
|
|
f.error_box("La data limite superiore non puo' essere maggiore della data inizio esercizio in corso");
|
|
return FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
void CG1600_application::scrivi_record(const TString& sez,
|
|
const TString& let, const TString& numerorom,int numero,
|
|
int g,int c,long s,const real& saldo,const real& saldorafr,
|
|
const real& sld_dare,const real& sld_avere,
|
|
const real& mov_dare,const real& mov_avere,char tipocf)
|
|
{
|
|
|
|
//Se esiste solamente la sezione,significa che e' un conto d'ordine
|
|
//Forzo la lettera della classe a Z, per ottenere, grazie
|
|
//all'ordinamento del sort, i record dei conti d'ordine per ultimi
|
|
|
|
set_bil_key(_bil, sez[0], let[0], numerorom, numero, TRUE, g, c, s, tipocf);
|
|
set_bil_val(_bil, saldo, saldorafr, sld_dare, sld_avere, mov_dare, mov_avere);
|
|
_sort->sort ((const char*) _bil);
|
|
}
|
|
|
|
void CG1600_application::scrivi_record_fittizio(const TString& sez,
|
|
const TString& let,const TString& numerorom,int numero)
|
|
|
|
{
|
|
set_bil_key(_bil, sez[0], let[0], numerorom, numero, TRUE, 0);
|
|
set_bil_val(_bil);
|
|
_sort->sort ((const char*) _bil);
|
|
}
|
|
|
|
void CG1600_application::riempi_record(const TString& sez,
|
|
const TString& let, const TString& numerorom,int numero,
|
|
int g,int c,long s,const real& saldo,const real& saldorafr,
|
|
const real& sld_dare,const real& sld_avere,
|
|
const real& mov_dare,const real& mov_avere,char tipocf)
|
|
{
|
|
set_bil_key(_bil, sez[0], let[0], numerorom, numero, FALSE, g, c, s, tipocf);
|
|
set_bil_val(_bil, saldo, saldorafr, sld_dare, sld_avere, mov_dare, mov_avere);
|
|
_sort->sort ((const char*) _bil);
|
|
}
|
|
|
|
void CG1600_application::crea_sort_tabella()
|
|
{
|
|
TRecnotype recno_prec=0l, recno_curr=0l;
|
|
TString codtab_prec;
|
|
TTable tabivd(TAB_IVD);
|
|
TRecfield codtab_curr(tabivd.curr(),"CODTAB");
|
|
TRecfield sezione (tabivd.curr(),"CODTAB",0,0);
|
|
TRecfield lettera (tabivd.curr(),"CODTAB",1,1);
|
|
TRecfield numerorom (tabivd.curr(),"CODTAB",2,9);
|
|
TRecfield numero (tabivd.curr(),"CODTAB",10,11);
|
|
int preclen;
|
|
bool FINITO=FALSE;
|
|
|
|
init_sort();
|
|
|
|
tabivd.first();
|
|
codtab_prec = tabivd.get("CODTAB");
|
|
|
|
// Compilo tanti record quante sono le classi IV direttiva trovate sulla
|
|
// tabella %IVD, usando dei gruppi, conti e sottoconti fittizi. Successivamente
|
|
// nel caso di stampa completa verranno stampati anche questi record; nel caso
|
|
// di stampa non completa non verranno stampati.
|
|
|
|
do
|
|
{
|
|
recno_prec = tabivd.recno();
|
|
tabivd.next();
|
|
if (tabivd.eof())
|
|
{
|
|
tabivd.zero();
|
|
FINITO=TRUE;
|
|
}
|
|
recno_curr = tabivd.recno();
|
|
preclen = codtab_prec.len();
|
|
if (!strncmp(codtab_curr,codtab_prec,preclen))
|
|
codtab_prec = (const char *)codtab_curr;
|
|
else
|
|
{
|
|
tabivd.readat(recno_prec);
|
|
const char sez = *((const char*) sezione);
|
|
const char let = *((const char*) lettera);
|
|
|
|
set_bil_key(_bil, sez, let, numerorom, numero, FALSE);
|
|
set_bil_val(_bil);
|
|
_sort->sort ((const char*) _bil);
|
|
tabivd.readat(recno_curr);
|
|
codtab_prec = (const char *)codtab_curr;
|
|
}
|
|
} while (!FINITO);
|
|
}
|
|
|
|
// Passo al sort tutti i record presenti su piano dei conti, aventi la classe
|
|
// IV direttiva CEE.
|
|
|
|
void CG1600_application::crea_sort_piano_conti_scalare()
|
|
{
|
|
TLocalisamfile pconti(LF_PCON);
|
|
TString sez,let,numerorom;
|
|
TString sez_conto,let_conto,numr_conto,sez_opp,let_opp,numr_opp;
|
|
int num_conto, indbil;
|
|
char sezione,lettera,tmcf;
|
|
int numero,g,c,num_opp;
|
|
long s;
|
|
bool sez_opposta = FALSE;
|
|
bool no_sez_opposta = FALSE;
|
|
bool classe_conto = FALSE;
|
|
bool conto_dettagliato = FALSE;
|
|
bool stsottbil;
|
|
int gruppo_prec,conto_prec;
|
|
real saldo,saldo_raf,saldo_conto,saldo_conto_raf;
|
|
real saldo_conto_opp,saldo_conto_raf_opp;
|
|
|
|
c = 0;
|
|
num_conto = 0;
|
|
tmcf = ' ';
|
|
indbil = 0;
|
|
|
|
saldo_conto = ZERO;
|
|
saldo_conto_raf = ZERO;
|
|
saldo_conto_opp = ZERO;
|
|
saldo_conto_raf_opp = ZERO;
|
|
|
|
gruppo_prec = -1;
|
|
conto_prec = -1;
|
|
|
|
for (pconti.first(); !pconti.eof(); pconti.next())
|
|
{
|
|
_prog->addstatus(1);
|
|
g = pconti.get_int (PCN_GRUPPO);
|
|
c = pconti.get_int (PCN_CONTO);
|
|
s = pconti.get_long(PCN_SOTTOCONTO);
|
|
sez = pconti.get(PCN_SEZIVD);
|
|
let = pconti.get(PCN_LETTIVD);
|
|
sezione = sez[0];
|
|
lettera = let[0];
|
|
numerorom = pconti.get(PCN_NUMRIVD);
|
|
numero = pconti.get_int (PCN_NUMIVD);
|
|
|
|
saldo = ZERO;
|
|
saldo_raf = ZERO;
|
|
|
|
if (conto_dettagliato)
|
|
{
|
|
if (classe_conto)
|
|
{
|
|
if (c != conto_prec && conto_prec != -1)
|
|
{
|
|
if (no_sez_opposta)
|
|
{
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,gruppo_prec,conto_prec,0,saldo_conto,saldo_conto_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
saldo_conto = ZERO;
|
|
saldo_conto_raf = ZERO;
|
|
classe_conto = FALSE;
|
|
no_sez_opposta = FALSE;
|
|
}
|
|
if (sez_opposta)
|
|
{
|
|
int items = _sezopps.items();
|
|
_sezopps.restart();
|
|
for (int i=0; i<items; i++)
|
|
{
|
|
_riga_sez_opp * lriga = _sezopps.riga();
|
|
TString sez_opp = lriga->sezione();
|
|
TString let_opp = lriga->lettera();
|
|
TString numr_opp = lriga->num_rom();
|
|
int num_opp = lriga->numero();
|
|
real saldo_conto_opp = lriga->saldo_conto();
|
|
riempi_record(sez_opp,let_opp,numr_opp,num_opp,gruppo_prec,conto_prec,0,saldo_conto_opp,ZERO,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
}
|
|
sez_opposta = FALSE;
|
|
|
|
_sezopps.destroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//Senza questo controllo conto_prec quando viene letto un gruppo verrebbe
|
|
//settato a 0 (il conto non c'e'), quindi nella eventuale lettura del conto
|
|
//nel ciclo successivo, qualsiasi conto sarebbe diverso da quello precedente.
|
|
|
|
if (g != gruppo_prec)
|
|
conto_prec = -1;
|
|
else
|
|
conto_prec = c;
|
|
|
|
gruppo_prec = g;
|
|
|
|
// Se si tratta di un conto e contiene la classe, allora lo passo al sort.
|
|
// Gli eventuali sottoconti avranno la stessa classe.
|
|
|
|
if ((g != 0) && (c != 0) && (s == 0))
|
|
{
|
|
stsottbil = pconti.get_bool(PCN_STSOTTBIL);
|
|
tmcf = pconti.get(PCN_TMCF)[0];
|
|
long record = pconti.recno();
|
|
pconti.next();
|
|
pconti.next();
|
|
int g_app = pconti.get_int(PCN_GRUPPO);
|
|
int c_app = pconti.get_int(PCN_CONTO);
|
|
long s_app = pconti.get_long(PCN_SOTTOCONTO);
|
|
pconti.readat(record);
|
|
|
|
//Se sono nello stesso gruppo, ma ho un conto diverso da quello precedentemente
|
|
//analizzato, allore devo controllare se va dettagliato
|
|
//(STSOTTBIL) e in caso affermativo se ha almeno due sottoconti.
|
|
|
|
if (((stsottbil)||(tmcf=='C')||(tmcf=='F'))&&((g_app!=0)&&(c_app!=0)&&(s_app!=0)))
|
|
{
|
|
conto_dettagliato = TRUE;
|
|
|
|
indbil = pconti.get_int(PCN_INDBIL);
|
|
|
|
if ((let != "")||(numerorom != "")||(numero != 0))
|
|
{
|
|
// if (sez == "")
|
|
// sez_conto = "9";
|
|
// else
|
|
sez_conto = sez;
|
|
|
|
if (let != "")
|
|
let_conto = let;
|
|
else
|
|
if ((sez == "1")||(sez == "2"))
|
|
let_conto = "Z";
|
|
else
|
|
let_conto = let;
|
|
|
|
numr_conto = numerorom;
|
|
num_conto = numero;
|
|
classe_conto = TRUE;
|
|
}
|
|
else
|
|
classe_conto = FALSE;
|
|
}
|
|
else
|
|
conto_dettagliato = FALSE;
|
|
}
|
|
|
|
// Se si tratta di un sottoconto e contiene la classe, allora lo passo al sort.
|
|
|
|
if (conto_dettagliato)
|
|
{
|
|
if ((g != 0) && (c != 0) && (s != 0))
|
|
{
|
|
|
|
// int indbil = pconti.get_int(PCN_INDBIL);
|
|
if (!calcola_saldo(saldo,saldo_raf,g,c,s,indbil))
|
|
continue;
|
|
|
|
// classe_conto indica se il conto precedentemente letto conteneva la classe,
|
|
// ma quest' ultima non era presente a livello di gruppo. In caso affermativo
|
|
// anche questo sottoconto appena letto avra' la stessa classe del conto.
|
|
|
|
if (classe_conto)
|
|
{
|
|
sez_opp = pconti.get(PCN_SEZIVDOPP);
|
|
if ((sez_opp != "")&&(((sez_conto=="1")&&(saldo < ZERO))||((sez_conto=="2")&&(saldo > ZERO))))
|
|
{
|
|
let_opp = pconti.get(PCN_LETTIVDOPP);
|
|
numr_opp = pconti.get(PCN_NUMRIVDOPP);
|
|
num_opp = pconti.get_int(PCN_NUMIVDOPP);
|
|
sez_opposta = TRUE;
|
|
saldo = -saldo;
|
|
|
|
_sezopps.add(g,c,s,sez_opp,let_opp,numr_opp,num_opp,saldo);
|
|
|
|
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
}
|
|
else
|
|
{
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
saldo_conto += saldo;
|
|
saldo_conto_raf += saldo_raf;
|
|
no_sez_opposta = TRUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sez_opp = pconti.get(PCN_SEZIVDOPP);
|
|
if ((sez_opp != "")&&(((sez=="1")&&(saldo < ZERO))||((sez=="2")&&(saldo > ZERO))))
|
|
{
|
|
let_opp = pconti.get(PCN_LETTIVDOPP);
|
|
numr_opp = pconti.get(PCN_NUMRIVDOPP);
|
|
num_opp = pconti.get_int(PCN_NUMIVDOPP);
|
|
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
}
|
|
else
|
|
{
|
|
if ((let != "")||(numerorom != "")||(numero != 0))
|
|
{
|
|
// if (sez == "")
|
|
// sez = "9";
|
|
|
|
scrivi_record(sez,let,numerorom,numero,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
conto_prec = 0;
|
|
|
|
if (conto_dettagliato)
|
|
{
|
|
if (classe_conto)
|
|
{
|
|
if (c != conto_prec && conto_prec != -1)
|
|
{
|
|
if (no_sez_opposta)
|
|
{
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,gruppo_prec,c,0,saldo_conto,saldo_conto_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
saldo_conto = ZERO;
|
|
saldo_conto_raf = ZERO;
|
|
classe_conto = FALSE;
|
|
no_sez_opposta = FALSE;
|
|
}
|
|
if (sez_opposta)
|
|
{
|
|
int items = _sezopps.items();
|
|
_sezopps.restart();
|
|
for (int i=0; i<items; i++)
|
|
{
|
|
_riga_sez_opp * lriga = _sezopps.riga();
|
|
TString sez_opp = lriga->sezione();
|
|
TString let_opp = lriga->lettera();
|
|
TString numr_opp = lriga->num_rom();
|
|
int num_opp = lriga->numero();
|
|
real saldo_conto_opp = lriga->saldo_conto();
|
|
riempi_record(sez_opp,let_opp,numr_opp,num_opp,gruppo_prec,conto_prec,0,saldo_conto_opp,ZERO,ZERO,ZERO,ZERO,ZERO,tmcf);
|
|
}
|
|
sez_opposta = FALSE;
|
|
|
|
_sezopps.destroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CG1600_application::crea_sort_piano_conti_verifica()
|
|
{
|
|
TLocalisamfile pconti(LF_PCON);
|
|
TString sez,let,numerorom;
|
|
TString sez_conto,let_conto,numr_conto;
|
|
int num_conto;
|
|
char sezione,lettera,tmcf;
|
|
int numero,g,c;
|
|
long s;
|
|
bool classe_conto = FALSE;
|
|
bool conto_dettagliato = FALSE;
|
|
bool stamp_almeno_un_sottoc = FALSE;
|
|
bool stsottbil;
|
|
int gruppo_prec,conto_prec, indbil;
|
|
real saldo,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere;
|
|
real saldo_conto,sld_prg_dare_conto,sld_prg_avere_conto,mov_dare_conto,mov_avere_conto;
|
|
|
|
saldo_conto = ZERO;
|
|
sld_prg_dare_conto = ZERO;
|
|
sld_prg_avere_conto = ZERO;
|
|
mov_dare_conto = ZERO;
|
|
mov_avere_conto = ZERO;
|
|
|
|
indbil = 0;
|
|
gruppo_prec = -1;
|
|
conto_prec = -1;
|
|
c = 0;
|
|
num_conto = 0;
|
|
tmcf = ' ';
|
|
|
|
for (pconti.first(); !pconti.eof(); pconti.next())
|
|
{
|
|
_prog->addstatus(1);
|
|
g = pconti.get_int (PCN_GRUPPO);
|
|
c = pconti.get_int (PCN_CONTO);
|
|
s = pconti.get_long(PCN_SOTTOCONTO);
|
|
sez = pconti.get(PCN_SEZIVD);
|
|
let = pconti.get(PCN_LETTIVD);
|
|
sezione = sez[0];
|
|
lettera = let[0];
|
|
numerorom = pconti.get(PCN_NUMRIVD);
|
|
numero = pconti.get_int (PCN_NUMIVD);
|
|
real app;
|
|
|
|
saldo = ZERO;
|
|
sld_prg_dare = ZERO;
|
|
sld_prg_avere = ZERO;
|
|
mov_dare = ZERO;
|
|
mov_avere = ZERO;
|
|
app = ZERO;
|
|
|
|
if (conto_dettagliato)
|
|
{
|
|
if (stamp_almeno_un_sottoc)
|
|
{
|
|
if (classe_conto)
|
|
{
|
|
if (c != conto_prec && conto_prec != -1)
|
|
{
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,gruppo_prec,conto_prec,0,saldo_conto,ZERO,sld_prg_dare_conto,sld_prg_avere_conto,mov_dare_conto,mov_avere_conto,tmcf);
|
|
saldo_conto = ZERO;
|
|
sld_prg_dare_conto = ZERO;
|
|
sld_prg_avere_conto = ZERO;
|
|
mov_dare_conto = ZERO;
|
|
mov_avere_conto = ZERO;
|
|
classe_conto = FALSE;
|
|
stamp_almeno_un_sottoc = FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//Senza questo controllo conto_prec quando viene letto un gruppo verrebbe
|
|
//settato a 0 (il conto non c'e'), quindi nella eventuale lettura del conto
|
|
//nel ciclo successivo, qualsiasi conto sarebbe diverso da quello precedente.
|
|
|
|
if (g != gruppo_prec)
|
|
conto_prec = -1;
|
|
else
|
|
conto_prec = c;
|
|
|
|
gruppo_prec = g;
|
|
|
|
// Se si tratta di un conto e contiene la classe, allora lo passo al sort.
|
|
// Gli eventuali sottoconti avranno la stessa classe.
|
|
|
|
if ((g != 0) && (c != 0) && (s == 0))
|
|
{
|
|
stsottbil = pconti.get_bool(PCN_STSOTTBIL);
|
|
tmcf = pconti.get(PCN_TMCF)[0];
|
|
indbil = pconti.get_int(PCN_INDBIL);
|
|
|
|
if ((tmcf == 'C') || (tmcf == 'F'))
|
|
if (stsottbil)
|
|
{
|
|
if (!ricerca_sottoc_clifo(g, c, tmcf,sez,let,numerorom,numero,indbil))
|
|
continue;
|
|
}
|
|
else
|
|
continue;
|
|
|
|
long record = pconti.recno();
|
|
pconti.next();
|
|
pconti.next();
|
|
int g_app = pconti.get_int(PCN_GRUPPO);
|
|
int c_app = pconti.get_int(PCN_CONTO);
|
|
int s_app = pconti.get_int(PCN_SOTTOCONTO);
|
|
pconti.readat(record);
|
|
|
|
//Se sono nello stesso gruppo, ma ho un conto diverso da quello precedentemente
|
|
//analizzato , allora devo controllare se va dettagliato
|
|
//(STSOTTBIL) e in caso affermativo se ha almeno due sottoconti.
|
|
|
|
if ((stsottbil)&&(g_app!=0)&&(c_app!=0)&&(s_app!=0))
|
|
{
|
|
conto_dettagliato = TRUE;
|
|
|
|
if ((let != "")||(numerorom != "")||(numero != 0))
|
|
{
|
|
// if (sez == "")
|
|
// sez_conto = "9";
|
|
// else
|
|
sez_conto = sez;
|
|
|
|
if (let != "")
|
|
let_conto = let;
|
|
else
|
|
if ((sez == "1")||(sez == "2"))
|
|
let_conto = "Z";
|
|
else
|
|
let_conto = let;
|
|
|
|
numr_conto = numerorom;
|
|
num_conto = numero;
|
|
classe_conto = TRUE;
|
|
}
|
|
else
|
|
classe_conto = FALSE;
|
|
}
|
|
else
|
|
conto_dettagliato = FALSE;
|
|
}
|
|
|
|
// Se si tratta di un sottoconto e contiene la classe, allora lo passo al sort.
|
|
|
|
if (conto_dettagliato)
|
|
{
|
|
if ((g != 0) && (c != 0) && (s != 0))
|
|
{
|
|
|
|
// int indbil = pconti.get_int(PCN_INDBIL);
|
|
if (_tipo_stampa == 1)
|
|
{
|
|
if (!calcola(g,c,s,_data_fine_ese,_data_fine_ese_prec))
|
|
continue;
|
|
|
|
// classe_conto indica se il conto precedentemente letto conteneva la classe,
|
|
// ma quest' ultima non era presente a livello di gruppo. In caso affermativo
|
|
// anche questo sottoconto appena letto avra' la stessa classe del conto.
|
|
|
|
if (_dataini == _data_ini_ese)
|
|
{
|
|
sld_prg_dare = _saldo_ini_dare;
|
|
sld_prg_avere = _saldo_ini_avere;
|
|
mov_dare = _mov_periodo_dare;
|
|
mov_avere = _mov_periodo_avere;
|
|
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
|
}
|
|
else if (_dataini > _data_ini_ese)
|
|
{
|
|
sld_prg_dare = _prg_prec_dare;
|
|
sld_prg_avere = _prg_prec_avere;
|
|
mov_dare = _mov_periodo_dare;
|
|
mov_avere = _mov_periodo_avere;
|
|
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
|
}
|
|
}
|
|
else
|
|
if (_tipo_stampa == 2)
|
|
{
|
|
if (!_sld.calcola(_annoese,0,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
continue;
|
|
app = _sld.saldoini();
|
|
if (app < ZERO)
|
|
{
|
|
app = -app;
|
|
sld_prg_dare = ZERO;
|
|
sld_prg_avere = app;
|
|
}
|
|
else
|
|
{
|
|
sld_prg_dare = app;
|
|
sld_prg_avere = ZERO;
|
|
}
|
|
mov_dare = _sld.prgdare();
|
|
mov_avere = _sld.prgavere();
|
|
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
|
}
|
|
else
|
|
if (_tipo_stampa == 3)
|
|
{
|
|
if (!_sld.calcola (_annoese,_annoese-1,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
continue;
|
|
|
|
sld_prg_dare = ZERO;
|
|
sld_prg_avere = ZERO;
|
|
mov_dare = _sld.prgdare();
|
|
mov_avere = _sld.prgavere();
|
|
saldo = mov_dare - mov_avere;
|
|
}
|
|
|
|
if (classe_conto)
|
|
{
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tmcf);
|
|
saldo_conto += saldo;
|
|
sld_prg_dare_conto += sld_prg_dare;
|
|
sld_prg_avere_conto += sld_prg_avere;
|
|
mov_dare_conto += mov_dare;
|
|
mov_avere_conto += mov_avere;
|
|
stamp_almeno_un_sottoc = TRUE;
|
|
}
|
|
else
|
|
{
|
|
if ((let != "")||(numerorom != "")||(numero != 0))
|
|
{
|
|
// if (sez == "")
|
|
// sez = "9";
|
|
|
|
scrivi_record(sez,let,numerorom,numero,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tmcf);
|
|
stamp_almeno_un_sottoc = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
conto_prec = 0;
|
|
|
|
if (conto_dettagliato)
|
|
{
|
|
if (stamp_almeno_un_sottoc)
|
|
{
|
|
if (classe_conto)
|
|
{
|
|
if (c != conto_prec && conto_prec != -1)
|
|
{
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,gruppo_prec,c,0,saldo_conto,ZERO,sld_prg_dare_conto,sld_prg_avere_conto,mov_dare_conto,mov_avere_conto,tmcf);
|
|
saldo_conto = ZERO;
|
|
sld_prg_dare_conto = ZERO;
|
|
sld_prg_avere_conto = ZERO;
|
|
mov_dare_conto = ZERO;
|
|
mov_avere_conto = ZERO;
|
|
classe_conto = FALSE;
|
|
stamp_almeno_un_sottoc = FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
bool CG1600_application::ricerca_sottoc_clifo(int g,int c,char tipocf,TString& sez,TString& let,TString& numerorom,int numero,int indbil)
|
|
{
|
|
long s;
|
|
_listacf = new TClifo_list (g,c,tipocf);
|
|
real saldo,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere;
|
|
real saldo_conto,sld_prg_dare_conto,sld_prg_avere_conto,mov_dare_conto,mov_avere_conto;
|
|
real app;
|
|
TString sez_conto,let_conto,numr_conto;
|
|
int num_conto;
|
|
|
|
saldo_conto = ZERO;
|
|
sld_prg_dare_conto = ZERO;
|
|
sld_prg_avere_conto = ZERO;
|
|
mov_dare_conto = ZERO;
|
|
mov_avere_conto = ZERO;
|
|
|
|
int items = _listacf->items();
|
|
if (items >= 2)
|
|
{
|
|
sez_conto = sez;
|
|
|
|
if (let != "")
|
|
let_conto = let;
|
|
else
|
|
if ((sez == "1")||(sez == "2"))
|
|
let_conto = "Z";
|
|
else
|
|
let_conto = let;
|
|
|
|
numr_conto = numerorom;
|
|
num_conto = numero;
|
|
|
|
for (int i=0 ; i < _listacf->items(); i++)
|
|
{
|
|
const TRectype& r=_listacf->clifo(i);
|
|
s = r.get_long(CLI_CODCF);
|
|
|
|
saldo = ZERO;
|
|
sld_prg_dare = ZERO;
|
|
sld_prg_avere = ZERO;
|
|
mov_dare = ZERO;
|
|
mov_avere = ZERO;
|
|
app = ZERO;
|
|
|
|
if (_tipo_stampa == 1)
|
|
{
|
|
if (!calcola(g,c,s,_data_fine_ese,_data_fine_ese_prec))
|
|
continue;
|
|
|
|
if (_dataini == _data_ini_ese)
|
|
{
|
|
sld_prg_dare = _saldo_ini_dare;
|
|
sld_prg_avere = _saldo_ini_avere;
|
|
mov_dare = _mov_periodo_dare;
|
|
mov_avere = _mov_periodo_avere;
|
|
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
|
}
|
|
else if (_dataini > _data_ini_ese)
|
|
{
|
|
sld_prg_dare = _prg_prec_dare;
|
|
sld_prg_avere = _prg_prec_avere;
|
|
mov_dare = _mov_periodo_dare;
|
|
mov_avere = _mov_periodo_avere;
|
|
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
|
}
|
|
}
|
|
else
|
|
if (_tipo_stampa == 2)
|
|
{
|
|
if (!_sld.calcola (_annoese,0,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
continue;
|
|
app = _sld.saldoini();
|
|
if (app < ZERO)
|
|
{
|
|
app = -app;
|
|
sld_prg_dare = ZERO;
|
|
sld_prg_avere = app;
|
|
}
|
|
else
|
|
{
|
|
sld_prg_dare = app;
|
|
sld_prg_avere = ZERO;
|
|
}
|
|
mov_dare = _sld.prgdare();
|
|
mov_avere = _sld.prgavere();
|
|
saldo = sld_prg_dare-sld_prg_avere+mov_dare-mov_avere;
|
|
}
|
|
else
|
|
if (_tipo_stampa == 3)
|
|
{
|
|
if (!_sld.calcola (_annoese,_annoese-1,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
continue;
|
|
|
|
sld_prg_dare = ZERO;
|
|
sld_prg_avere = ZERO;
|
|
mov_dare = _sld.prgdare();
|
|
mov_avere = _sld.prgavere();
|
|
saldo = mov_dare - mov_avere;
|
|
}
|
|
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tipocf);
|
|
saldo_conto += saldo;
|
|
sld_prg_dare_conto += sld_prg_dare;
|
|
sld_prg_avere_conto += sld_prg_avere;
|
|
mov_dare_conto += mov_dare;
|
|
mov_avere_conto += mov_avere;
|
|
}
|
|
riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,0,saldo_conto,ZERO,sld_prg_dare_conto,sld_prg_avere_conto,mov_dare_conto,mov_avere_conto,tipocf);
|
|
saldo_conto = ZERO;
|
|
sld_prg_dare_conto = ZERO;
|
|
sld_prg_avere_conto = ZERO;
|
|
mov_dare_conto = ZERO;
|
|
mov_avere_conto = ZERO;
|
|
|
|
delete _listacf;
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
//La funzione calcola_saldo calcola il saldo dell'esercizio in corso e di
|
|
//quello da raffrontare. Inoltre ritorna vero se il sottoconto e' movimentato
|
|
//e falso se non e' movimentato, e quindi non deve essere stampato.
|
|
|
|
bool CG1600_application::calcola_saldo(real& saldo, real& saldo_raf,int g,int c,long s,int indbil)
|
|
{
|
|
bool no_movimentato = TRUE;
|
|
bool no_movimentato_raf = TRUE;
|
|
|
|
if (_tipo_bilancio == 1)
|
|
{
|
|
if (_tipo_stampa == 1) //bilancio per data limite
|
|
{
|
|
if (!_sld.calcola (_annoese,0,g,c,s,_datai,_datalimite,indbil,_competenza,_data_ini_ese,_data_fine_ese,_data_fine_ese_prec,_stampa_mov_prov))
|
|
no_movimentato = TRUE;
|
|
else
|
|
no_movimentato = FALSE;
|
|
}
|
|
else if (_tipo_stampa == 2)
|
|
{
|
|
if (!_sld.calcola (_annoese,0,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
no_movimentato = TRUE;
|
|
else
|
|
no_movimentato = FALSE;
|
|
}
|
|
else if (_tipo_stampa == 3)
|
|
{
|
|
if (!_sld.calcola (_annoese,_annoese-1,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
no_movimentato = TRUE;
|
|
else
|
|
no_movimentato = FALSE;
|
|
}
|
|
|
|
saldo = _sld.saldo();
|
|
|
|
if (_annoeserafr != 0)
|
|
{
|
|
if (_tipo_stampa == 1) //bilancio per data limite
|
|
{
|
|
if (!_sld.calcola (_annoeserafr,0,g,c,s,_datairaf,_databilrafr,indbil,_competenza,_data_fine_raf,_data_fine_raf_prec,"",_stampa_mov_prov))
|
|
no_movimentato_raf = TRUE;
|
|
else
|
|
no_movimentato_raf = FALSE;
|
|
}
|
|
else if (_tipo_stampa == 2)
|
|
{
|
|
if (!_sld.calcola (_annoeserafr,0,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
no_movimentato_raf = TRUE;
|
|
else
|
|
no_movimentato_raf = FALSE;
|
|
}
|
|
else if (_tipo_stampa == 3)
|
|
{
|
|
if (!_sld.calcola (_annoeserafr,_annoeserafr-1,g,c,s,"","",indbil,FALSE,"","","",FALSE))
|
|
no_movimentato_raf = TRUE;
|
|
else
|
|
no_movimentato_raf = FALSE;
|
|
}
|
|
|
|
saldo_raf = _sld.saldo();
|
|
}
|
|
}
|
|
|
|
if ((no_movimentato) && (no_movimentato_raf))
|
|
return FALSE;
|
|
else
|
|
return TRUE;
|
|
}
|
|
|
|
bool CG1600_application::calcola(int g, int c, long s,
|
|
const TDate& fine_es, const TDate& fine_es_prec)
|
|
{
|
|
TString sezione;
|
|
real importo;
|
|
int annoe;
|
|
long num_reg;
|
|
TDate data_rmv;
|
|
bool conto_mov = FALSE;
|
|
TLocalisamfile rmov(LF_RMOV);
|
|
TLocalisamfile mov(LF_MOV);
|
|
|
|
_mov_periodo_dare = ZERO;
|
|
_mov_periodo_avere = ZERO;
|
|
_prg_prec_dare = ZERO;
|
|
_prg_prec_avere = ZERO;
|
|
_saldo_ini_dare = ZERO;
|
|
_saldo_ini_avere = ZERO;
|
|
|
|
rmov.setkey(2);
|
|
rmov.zero();
|
|
rmov.put(RMV_GRUPPO,g);
|
|
if (c != 0)
|
|
rmov.put(RMV_CONTO,c);
|
|
if (s != 0)
|
|
rmov.put(RMV_SOTTOCONTO,s);
|
|
TRectype rec(rmov.curr());
|
|
|
|
rmov.read(_isgteq);
|
|
for ( ; !rmov.eof(); rmov.next())
|
|
{
|
|
if (rmov.curr() != rec) break;
|
|
|
|
annoe = rmov.get_int(RMV_ANNOES);
|
|
data_rmv = rmov.get_date(RMV_DATAREG);
|
|
num_reg = rmov.get_long(RMV_NUMREG);
|
|
sezione = rmov.get(RMV_SEZIONE);
|
|
importo = rmov.get_real(RMV_IMPORTO);
|
|
|
|
if ((annoe != _annoese && annoe != _annoese - 1) || (importo == ZERO))
|
|
continue;
|
|
|
|
mov.setkey(1);
|
|
mov.zero();
|
|
mov.put(MOV_NUMREG, num_reg);
|
|
mov.read();
|
|
if (mov.bad()) mov.zero();
|
|
const bool movprovv = mov.get(MOV_PROVVIS).not_empty();
|
|
|
|
if (!_stampa_mov_prov && movprovv) //se non richiesto
|
|
continue; //stampa mov provv.
|
|
//li scarto
|
|
const TString codcaus(mov.get(MOV_CODCAUS));
|
|
|
|
if (codcaus == causale_chiusura()) //la causale e' uguale a quella di chiusura
|
|
break;
|
|
|
|
if (_competenza)
|
|
if (annoe == _annoese -1)
|
|
if (_datafine == fine_es)
|
|
if ( ((data_rmv > fine_es) || (data_rmv > fine_es_prec)) &&
|
|
(data_rmv <= fine_es) ) //viene stampato tra i mov del periodo
|
|
{
|
|
if (sezione == "D")
|
|
_mov_periodo_dare += importo;
|
|
else _mov_periodo_avere += importo;
|
|
}
|
|
|
|
//calcolo i movimenti del periodo
|
|
if ( (data_rmv >= _dataini) && (data_rmv <= _datafine) )
|
|
if ((codcaus == causale_apertura() && _data_ini_ese != _dataini) ||
|
|
(codcaus != causale_apertura()))
|
|
{
|
|
conto_mov = TRUE;
|
|
if (sezione == "D")
|
|
_mov_periodo_dare += importo;
|
|
else _mov_periodo_avere += importo;
|
|
}
|
|
|
|
//il saldo inizio es. e' dato dall'importo dare - importo avere di quei movimenti che hanno causale == apertura e data reg >= data inizio es. e <= data limite sup.
|
|
|
|
if (_dataini == _data_ini_ese) //calcolo il saldo iniziale
|
|
{
|
|
if (codcaus == causale_apertura())
|
|
{
|
|
if (sezione == "D")
|
|
_saldo_ini_dare += importo;
|
|
else _saldo_ini_avere += importo;
|
|
conto_mov = TRUE;
|
|
}
|
|
}
|
|
else if (_dataini > _data_ini_ese) //calcolo i progressivi precedenti
|
|
if ( (data_rmv >= _data_ini_ese) && (data_rmv < _dataini) )
|
|
{
|
|
if (sezione == "D")
|
|
_prg_prec_dare += importo;
|
|
else _prg_prec_avere += importo;
|
|
|
|
conto_mov = TRUE;
|
|
}
|
|
}
|
|
return conto_mov;
|
|
}
|
|
|
|
bool CG1600_application::set_print(int)
|
|
{
|
|
KEY tasto;
|
|
|
|
// if (_sort) delete _sort;
|
|
// if (_bil) delete _bil;
|
|
{
|
|
TConfig conf(CONFIG_DITTA);
|
|
|
|
_causale_ap = conf.get("CoCaCh");
|
|
_causale_chi = conf.get("CoCaCh");
|
|
}
|
|
|
|
_msk->set_handler(F_DATALIM, our_handler);
|
|
_msk->set_handler(F_DATABILRAF, our_handler);
|
|
_msk->set_handler(F_DATAINI, our_handler);
|
|
_msk->set_handler(F_DATAFINE, our_handler);
|
|
|
|
tasto = _msk->run();
|
|
|
|
if (tasto == K_ENTER)
|
|
{
|
|
_datastampa = (_msk->get(F_DATASTAMPA));
|
|
_competenza = (bool)(_msk->get(F_COMPETENZA) == "X");
|
|
_annoese = _msk->get_int(F_ANNOESE);
|
|
_annoeserafr = _msk->get_int(F_ANNORAFFR);
|
|
_intera_struttura = (bool)(_msk->get(F_STAMPAINT) == "X");
|
|
_stampamov = (bool)(_msk->get(F_STAMPAMOV) == "X");
|
|
_stampacod = (bool)(_msk->get(F_STAMPACOD) == "X");
|
|
_stampa_modulo = (bool)(_msk->get(F_STAMPAMODULO) == "X");
|
|
_tipo_bilancio = atoi(_msk->get(F_TIPOBIL));
|
|
_stampa_mov_prov = (bool)(_msk->get(F_STAMPAMOVPROV) == "X");
|
|
if (_tipo_bilancio == 1)
|
|
{
|
|
_tipo_stampa = atoi(_msk->get(F_TIPOSTAMPA));
|
|
_prog = new TProgind(_pconti->items(),"Elaborazione in corso... prego attendere",FALSE);
|
|
}
|
|
else if (_tipo_bilancio == 2)
|
|
{
|
|
_tipo_stampa = atoi(_msk->get(F_TIPOSTAMPA1));
|
|
_prog = new TProgind(_pconti->items(),"Elaborazione in corso... prego attendere",FALSE);
|
|
}
|
|
_datalimite = _msk->get(F_DATALIM);
|
|
_databilrafr = _msk->get(F_DATABILRAF);
|
|
_dataini = _msk->get(F_DATAINI);
|
|
_datafine = _msk->get(F_DATAFINE);
|
|
_cont_let = 0;
|
|
_cont_numr = 0;
|
|
_cont_num = 0;
|
|
_cont_gcs = 0;
|
|
_reset_righe_stampa = TRUE;
|
|
set_real_picture("###.###.###.###");
|
|
set_print_zero();
|
|
_totale_attivita_gia_stampato = FALSE;
|
|
_totale_passivita_gia_stampato = FALSE;
|
|
_statopatr_no_stamp = TRUE;
|
|
|
|
_sez_stamp = ' ';
|
|
_let_stamp = ' ';
|
|
_numr_stamp = "";
|
|
_num_stamp = "";
|
|
_sez_tot = ' ';
|
|
_let_tot = ' ';
|
|
_numr_tot = "";
|
|
_num_tot = "";
|
|
|
|
_datai = data_inferiore();
|
|
_datairaf = data_inferiore_raf();
|
|
|
|
crea_sort_tabella();
|
|
if (_tipo_bilancio == 1)
|
|
crea_sort_piano_conti_scalare();
|
|
else if (_tipo_bilancio == 2)
|
|
crea_sort_piano_conti_verifica();
|
|
_sort->endsort();
|
|
|
|
|
|
crea_intestazione();
|
|
delete _bil;
|
|
delete _prog;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void CG1600_application::stampa_totali()
|
|
{
|
|
bool gia_stampato_conto_ord = FALSE;
|
|
|
|
_num = _num_tot;
|
|
_numr = _numr_tot;
|
|
_let = _let_tot;
|
|
|
|
if (_buff == NULL)
|
|
{
|
|
_num_tot = "";
|
|
_numr_tot = "";
|
|
_let_tot = ' ';
|
|
_sez_tot = ' ';
|
|
}
|
|
|
|
if (_num_da_stamp!=_num_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i++,"@86g%r", &_totale_numero);
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_totale_numero = 0;
|
|
}
|
|
if (_numr_da_stamp!=_numr_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i++,"@86g%r", &_totale_numero);
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@14gTotale@21g%s", (const char*) numrom);
|
|
set_row (_i++,"@86g%r", &_totale_numr);
|
|
}
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_totale_numero = 0;
|
|
_totale_numr = 0;
|
|
}
|
|
if (_let_da_stamp!=_let_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i++,"@86g%r", &_totale_numero);
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@14gTotale@21g%s", (const char*) numrom);
|
|
set_row (_i++,"@86g%r", &_totale_numr);
|
|
}
|
|
if (_cont_numr >= 2)
|
|
{
|
|
//Fai il totale della lettera e stampalo
|
|
set_row (_i,"@3gTotale@10g%c@12g)", _let);
|
|
set_row (_i++,"@86g%r", &_totale_lettera);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ((_sez_stamp == '1')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE ATTIVITA'");
|
|
set_row (_i++,"@86g%r", &_totale_sezione);
|
|
_totale_attivita = _totale_sezione;
|
|
_totale_sezione = 0;
|
|
_totale_attivita_gia_stampato = TRUE;
|
|
}
|
|
|
|
if ((_sez_stamp == '2')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE PASSIVITA'");
|
|
set_row (_i++,"@86g%r", &_totale_sezione);
|
|
_totale_passivita = _totale_sezione;
|
|
_totale_sezione = 0;
|
|
_totale_passivita_gia_stampato = TRUE;
|
|
}
|
|
|
|
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE ATTIVI");
|
|
set_row (_i++,"@86g%r", &_totale_ordine_attivo);
|
|
_totale_ordine_attivo = 0;
|
|
gia_stampato_conto_ord = TRUE;
|
|
}
|
|
|
|
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE PASSIVI");
|
|
set_row (_i++,"@86g%r", &_totale_ordine_passivo);
|
|
_totale_ordine_passivo = 0;
|
|
gia_stampato_conto_ord = TRUE;
|
|
}
|
|
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_cont_numr = 0;
|
|
_totale_numero = 0;
|
|
_totale_numr = 0;
|
|
_totale_lettera = 0;
|
|
}
|
|
if (_sez_da_stamp != _sez_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i++,"@86g%r", &_totale_numero);
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@14gTotale@21g%s", (const char*) numrom);
|
|
set_row (_i++,"@86g%r", &_totale_numr);
|
|
}
|
|
if (_cont_numr >= 2)
|
|
{
|
|
//Fai il totale della lettera e stampalo
|
|
set_row (_i,"@3gTotale@10g%c@12g)", _let);
|
|
set_row (_i++,"@86g%r", &_totale_lettera);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!_totale_attivita_gia_stampato)
|
|
if ((_sez_stamp == '1') && (_let_stamp != 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE ATTIVITA'");
|
|
set_row (_i++,"@86g%r", &_totale_sezione);
|
|
_totale_attivita = _totale_sezione;
|
|
_totale_sezione = 0;
|
|
}
|
|
|
|
if (!_totale_passivita_gia_stampato)
|
|
if ((_sez_stamp == '2') && (_let_stamp != 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE PASSIVITA'");
|
|
set_row (_i++,"@86g%r", &_totale_sezione);
|
|
_totale_passivita = _totale_sezione;
|
|
_totale_sezione = 0;
|
|
}
|
|
|
|
if (!gia_stampato_conto_ord)
|
|
{
|
|
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE ATTIVI");
|
|
set_row (_i++,"@86g%r", &_totale_ordine_attivo);
|
|
_totale_ordine_attivo = 0;
|
|
}
|
|
|
|
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE PASSIVI");
|
|
set_row (_i++,"@86g%r", &_totale_ordine_passivo);
|
|
_totale_ordine_passivo = 0;
|
|
}
|
|
}
|
|
|
|
if (_sez_stamp == '2')
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i++,"@0gSALDO STATO PATRIMONIALE");
|
|
set_row (_i,"@0gSBILANCIO (ATTIVITA' - PASSIVITA')");
|
|
_totale_patrimoniale = _totale_attivita - _totale_passivita;
|
|
set_row (_i++,"@86g%r", &_totale_patrimoniale);
|
|
_totale_patrimoniale = 0;
|
|
}
|
|
if (_sez_stamp == '5')
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE");
|
|
set_row (_i++,"@86g%r", &_totale_ordine);
|
|
_totale_ordine = 0;
|
|
}
|
|
if (_sez_stamp == '9')
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTO ECONOMICO");
|
|
set_row (_i++,"@86g%r", &_totale_economico);
|
|
_totale_economico = 0;
|
|
}
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_cont_numr = 0;
|
|
_cont_let = 0;
|
|
_totale_numero = 0;
|
|
_totale_numr = 0;
|
|
_totale_lettera = 0;
|
|
}
|
|
}
|
|
|
|
void CG1600_application::stampa_totali_con_raffronto()
|
|
{
|
|
bool gia_stampato_conto_ord = FALSE;
|
|
|
|
_num = _num_tot;
|
|
_numr = _numr_tot;
|
|
_let = _let_tot;
|
|
|
|
if (_buff == NULL)
|
|
{
|
|
_num_tot = "";
|
|
_numr_tot = "";
|
|
_let_tot = ' ';
|
|
_sez_tot = ' ';
|
|
}
|
|
|
|
if (_num_da_stamp!=_num_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i,"@86g%r", &_totale_numero);
|
|
set_row (_i++,"@112g%r", &_totale_num_raf);
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_totale_numero = 0;
|
|
_totale_num_raf = 0;
|
|
}
|
|
if (_numr_da_stamp!=_numr_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i,"@86g%r", &_totale_numero);
|
|
set_row (_i++,"@112g%r", &_totale_num_raf);
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@14gTotale@21g%s", (const char*) numrom);
|
|
set_row (_i,"@86g%r", &_totale_numr);
|
|
set_row (_i++,"@112g%r", &_totale_numr_raf);
|
|
}
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_totale_numero = 0;
|
|
_totale_numr = 0;
|
|
_totale_num_raf = 0;
|
|
_totale_numr_raf = 0;
|
|
}
|
|
if (_let_da_stamp!=_let_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i,"@86g%r", &_totale_numero);
|
|
set_row (_i++,"@112g%r", &_totale_num_raf);
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@14gTotale@21g%s", (const char*) numrom);
|
|
set_row (_i,"@86g%r", &_totale_numr);
|
|
set_row (_i++,"@112g%r", &_totale_numr_raf);
|
|
}
|
|
if (_cont_numr >= 2)
|
|
{
|
|
//Fai il totale della lettera e stampalo
|
|
set_row (_i,"@3gTotale@10g%c@12g)", _let);
|
|
set_row (_i,"@86g%r", &_totale_lettera);
|
|
set_row (_i++,"@112g%r", &_totale_let_raf);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ((_sez_stamp == '1')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE ATTIVITA'");
|
|
set_row (_i,"@86g%r", &_totale_sezione);
|
|
set_row (_i++,"@112g%r", &_totale_sez_raf);
|
|
_totale_attivita = _totale_sezione;
|
|
_totale_attiv_raf = _totale_sez_raf;
|
|
_totale_sezione = 0;
|
|
_totale_sez_raf = 0;
|
|
_totale_attivita_gia_stampato = TRUE;
|
|
}
|
|
|
|
if ((_sez_stamp == '2')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE PASSIVITA'");
|
|
set_row (_i,"@86g%r", &_totale_sezione);
|
|
set_row (_i++,"@112g%r", &_totale_sez_raf);
|
|
_totale_passivita = _totale_sezione;
|
|
_totale_passiv_raf = _totale_sez_raf;
|
|
_totale_sezione = 0;
|
|
_totale_sez_raf = 0;
|
|
_totale_passivita_gia_stampato = TRUE;
|
|
}
|
|
|
|
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE ATTIVI");
|
|
set_row (_i,"@86g%r", &_totale_ordine_attivo);
|
|
set_row (_i++,"@112g%r", &_totale_ordine_attivo_raf);
|
|
_totale_ordine_attivo = 0;
|
|
_totale_ordine_attivo_raf = 0;
|
|
gia_stampato_conto_ord = TRUE;
|
|
}
|
|
|
|
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE PASSIVI");
|
|
set_row (_i,"@86g%r", &_totale_ordine_passivo);
|
|
set_row (_i++,"@112g%r", &_totale_ordine_passivo_raf);
|
|
_totale_ordine_passivo = 0;
|
|
_totale_ordine_passivo_raf = 0;
|
|
gia_stampato_conto_ord = TRUE;
|
|
}
|
|
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_cont_numr = 0;
|
|
_totale_numero = 0;
|
|
_totale_numr = 0;
|
|
_totale_lettera = 0;
|
|
_totale_num_raf = 0;
|
|
_totale_numr_raf = 0;
|
|
_totale_let_raf = 0;
|
|
}
|
|
if (_sez_da_stamp != _sez_tot)
|
|
{
|
|
if (_let_stamp != 'Z')
|
|
{
|
|
if (_sez_stamp != '5')
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
set_row (_i,"@18gTotale@25g%s@27g)",(const char*) _num);
|
|
set_row (_i,"@86g%r", &_totale_numero);
|
|
set_row (_i++,"@112g%r", &_totale_num_raf);
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@14gTotale@21g%s", (const char*) numrom);
|
|
set_row (_i++,"@86g%r", &_totale_numr);
|
|
set_row (_i++,"@112g%r", &_totale_numr_raf);
|
|
}
|
|
if (_cont_numr >= 2)
|
|
{
|
|
//Fai il totale della lettera e stampalo
|
|
set_row (_i,"@3gTotale@10g%c@12g)", _let);
|
|
set_row (_i++,"@86g%r", &_totale_lettera);
|
|
set_row (_i++,"@112g%r", &_totale_let_raf);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!_totale_attivita_gia_stampato)
|
|
if ((_sez_stamp == '1') && (_let_stamp != 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE ATTIVITA'");
|
|
set_row (_i,"@86g%r", &_totale_sezione);
|
|
set_row (_i++,"@112g%r", &_totale_sez_raf);
|
|
_totale_attivita = _totale_sezione;
|
|
_totale_attiv_raf = _totale_sez_raf;
|
|
_totale_sezione = 0;
|
|
_totale_sez_raf = 0;
|
|
_totale_attivita_gia_stampato = TRUE;
|
|
}
|
|
|
|
if (!_totale_passivita_gia_stampato)
|
|
if ((_sez_stamp == '2') && (_let_stamp != 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE PASSIVITA'");
|
|
set_row (_i,"@86g%r", &_totale_sezione);
|
|
set_row (_i++,"@112g%r", &_totale_sez_raf);
|
|
_totale_passivita = _totale_sezione;
|
|
_totale_passiv_raf = _totale_sez_raf;
|
|
_totale_sezione = 0;
|
|
_totale_sez_raf = 0;
|
|
_totale_passivita_gia_stampato = TRUE;
|
|
}
|
|
|
|
if (!gia_stampato_conto_ord)
|
|
{
|
|
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE ATTIVI");
|
|
set_row (_i++,"@86g%r", &_totale_ordine_attivo);
|
|
_totale_ordine_attivo = 0;
|
|
}
|
|
|
|
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE PASSIVI");
|
|
set_row (_i++,"@86g%r", &_totale_ordine_passivo);
|
|
_totale_ordine_passivo = 0;
|
|
}
|
|
}
|
|
|
|
if (_sez_stamp == '2')
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i++,"@0gSALDO STATO PATRIMONIALE");
|
|
set_row (_i,"@0gSBILANCIO (ATTIVITA' - PASSIVITA')");
|
|
_totale_patrimoniale = _totale_attivita - _totale_passivita;
|
|
_totale_patrim_raf = _totale_attiv_raf - _totale_passiv_raf;
|
|
set_row (_i,"@86g%r", &_totale_patrimoniale);
|
|
set_row (_i++,"@112g%r", &_totale_patrim_raf);
|
|
_totale_patrimoniale = 0;
|
|
_totale_patrim_raf = 0;
|
|
}
|
|
if (_sez_stamp == '5')
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTI D' ORDINE");
|
|
set_row (_i,"@86g%r", &_totale_ordine);
|
|
set_row (_i++,"@112g%r", &_totale_ordine_raf);
|
|
_totale_ordine = 0;
|
|
_totale_ordine_raf = 0;
|
|
}
|
|
if (_sez_stamp == '9')
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i,"@0gTOTALE CONTO ECONOMICO");
|
|
set_row (_i,"@86g%r", &_totale_economico);
|
|
set_row (_i++,"@112g%r", &_totale_economico_raf);
|
|
_totale_economico = 0;
|
|
_totale_economico_raf = 0;
|
|
}
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_cont_numr = 0;
|
|
_cont_let = 0;
|
|
_totale_numero = 0;
|
|
_totale_numr = 0;
|
|
_totale_lettera = 0;
|
|
_totale_num_raf = 0;
|
|
_totale_numr_raf = 0;
|
|
_totale_let_raf = 0;
|
|
}
|
|
}
|
|
|
|
void CG1600_application::stampa_totali_verifica()
|
|
{
|
|
_num = _num_tot;
|
|
_numr = _numr_tot;
|
|
_let = _let_tot;
|
|
_sez = _sez_tot;
|
|
|
|
if (_buff == NULL)
|
|
{
|
|
_num_tot = "";
|
|
_numr_tot = "";
|
|
_let_tot = ' ';
|
|
_sez_tot = ' ';
|
|
}
|
|
|
|
if (_num_da_stamp!=_num_tot)
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
if (((_sez == '1')||(_sez == '2')||(_sez == '9'))&&(_let != 'Z'))
|
|
{
|
|
set_row (_i,"@8gTotale@15g%s@17g)",(const char*) _num);
|
|
}
|
|
else
|
|
set_row (_i,"@8gTotale");
|
|
set_row (_i,"@49g%r", &_tot_num_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_num_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_num_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_num_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_num_saldo < ZERO)
|
|
{
|
|
_tot_num_saldo = -_tot_num_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_num_saldo);
|
|
}
|
|
else
|
|
{
|
|
stampa_saldo_198(_tot_num_saldo_d,_tot_num_saldo_a);
|
|
// _tot_num_saldo_d = 0;
|
|
// _tot_num_saldo_a = 0;
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_tot_num_prg_d = ZERO;
|
|
_tot_num_prg_a = ZERO;
|
|
_tot_num_mov_d = ZERO;
|
|
_tot_num_mov_a = ZERO;
|
|
_tot_num_saldo = ZERO;
|
|
}
|
|
if (_numr_da_stamp!=_numr_tot)
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
if (((_sez == '1')||(_sez == '2')||(_sez == '9'))&&(_let != 'Z'))
|
|
{
|
|
set_row (_i,"@8gTotale@15g%s@17g)",(const char*) _num);
|
|
}
|
|
else
|
|
set_row (_i,"@8gTotale");
|
|
set_row (_i,"@49g%r", &_tot_num_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_num_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_num_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_num_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_num_saldo < ZERO)
|
|
{
|
|
_tot_num_saldo = -_tot_num_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_num_saldo);
|
|
}
|
|
else
|
|
{
|
|
stampa_saldo_198(_tot_num_saldo_d,_tot_num_saldo_a);
|
|
//_tot_num_saldo_d = 0;
|
|
//_tot_num_saldo_a = 0;
|
|
}
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@8gTotale@15g%s", (const char*) numrom);
|
|
set_row (_i,"@49g%r", &_tot_numr_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_numr_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_numr_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_numr_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_numr_saldo < ZERO)
|
|
{
|
|
_tot_numr_saldo = -_tot_numr_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_numr_saldo);
|
|
}
|
|
else
|
|
{
|
|
stampa_saldo_198(_tot_numr_saldo_d,_tot_numr_saldo_a);
|
|
// _tot_numr_saldo_d = 0;
|
|
// _tot_numr_saldo_a = 0;
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_tot_num_prg_d = ZERO;
|
|
_tot_num_prg_a = ZERO;
|
|
_tot_num_mov_d = ZERO;
|
|
_tot_num_mov_a = ZERO;
|
|
_tot_num_saldo = ZERO;
|
|
_tot_numr_prg_d = ZERO;
|
|
_tot_numr_prg_a = ZERO;
|
|
_tot_numr_mov_d = ZERO;
|
|
_tot_numr_mov_a = ZERO;
|
|
_tot_numr_saldo = ZERO;
|
|
}
|
|
if ((_let_da_stamp!=_let_tot) || (_sez_da_stamp != _sez_tot))
|
|
{
|
|
if (_cont_gcs >= 2)
|
|
{
|
|
//Fai il totale del numero arabo e stampalo
|
|
if (((_sez == '1')||(_sez == '2')||(_sez == '9'))&&(_let != 'Z'))
|
|
{
|
|
set_row (_i,"@8gTotale@15g%s@17g)",(const char*) _num);
|
|
}
|
|
else
|
|
set_row (_i,"@8gTotale");
|
|
set_row (_i,"@49g%r", &_tot_num_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_num_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_num_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_num_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_num_saldo < ZERO)
|
|
{
|
|
_tot_num_saldo = -_tot_num_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_num_saldo);
|
|
}
|
|
else
|
|
{
|
|
stampa_saldo_198(_tot_num_saldo_d,_tot_num_saldo_a);
|
|
// _tot_num_saldo_d = 0;
|
|
// _tot_num_saldo_a = 0;
|
|
}
|
|
}
|
|
if (_cont_num >= 2)
|
|
{
|
|
//Fai il totale del numero romano e stampalo
|
|
int numeror = atoi(_numr);
|
|
TString numrom = itor(numeror);
|
|
set_row (_i,"@8gTotale@15g%s", (const char*) numrom);
|
|
set_row (_i,"@49g%r", &_tot_numr_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_numr_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_numr_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_numr_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_numr_saldo < ZERO)
|
|
{
|
|
_tot_numr_saldo = -_tot_numr_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_numr_saldo);
|
|
}
|
|
else
|
|
{
|
|
stampa_saldo_198(_tot_numr_saldo_d,_tot_numr_saldo_a);
|
|
// _tot_numr_saldo_d = 0;
|
|
// _tot_numr_saldo_a = 0;
|
|
}
|
|
}
|
|
if (_cont_numr >= 2)
|
|
{
|
|
//Fai il totale della lettera e stampalo
|
|
set_row (_i,"@8gTotale@15g%c@16g)", _let);
|
|
set_row (_i,"@49g%r", &_tot_let_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_let_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_let_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_let_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_let_saldo < ZERO)
|
|
{
|
|
_tot_let_saldo = -_tot_let_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_let_saldo);
|
|
}
|
|
else
|
|
{
|
|
stampa_saldo_198(_tot_let_saldo_d,_tot_let_saldo_a);
|
|
// _tot_let_saldo_d = 0;
|
|
// _tot_let_saldo_a = 0;
|
|
}
|
|
}
|
|
_cont_gcs = 0;
|
|
_cont_num = 0;
|
|
_cont_numr = 0;
|
|
_tot_num_prg_d = ZERO;
|
|
_tot_num_prg_a = ZERO;
|
|
_tot_num_mov_d = ZERO;
|
|
_tot_num_mov_a = ZERO;
|
|
_tot_num_saldo = ZERO;
|
|
_tot_numr_prg_d = ZERO;
|
|
_tot_numr_prg_a = ZERO;
|
|
_tot_numr_mov_d = ZERO;
|
|
_tot_numr_mov_a = ZERO;
|
|
_tot_numr_saldo = ZERO;
|
|
_tot_let_prg_d = ZERO;
|
|
_tot_let_prg_a = ZERO;
|
|
_tot_let_mov_d = ZERO;
|
|
_tot_let_mov_a = ZERO;
|
|
_tot_let_saldo = ZERO;
|
|
}
|
|
}
|
|
|
|
void CG1600_application::stampa_saldo_198(real& saldo_d,real& saldo_a)
|
|
{
|
|
set_row (_i,"@115g%r", &saldo_d);
|
|
set_row (_i,"@48g|@81g|@114g|@131g|");
|
|
set_row (_i,"@133g%r", &saldo_a);
|
|
set_row (_i++,"@48g|@81g|@114g|@131g|");
|
|
saldo_d = real(ZERO);
|
|
saldo_a = real(ZERO);
|
|
}
|
|
|
|
void CG1600_application::stampa_saldo_132(const real& saldo)
|
|
{
|
|
set_row (_i,"@115g%r", &saldo);
|
|
set_row (_i,"@48g|@81g|@114g|");
|
|
set_row (_i++,"@131g%c", _tot_sez_saldo);
|
|
}
|
|
|
|
print_action CG1600_application::postprocess_page(int file, int counter)
|
|
{
|
|
if (_tipo_bilancio == 1)
|
|
{
|
|
if (_sez_da_stamp != _sez_stamp)
|
|
{
|
|
if (_sez_da_stamp == '5')
|
|
{
|
|
reset_print();
|
|
_i = 1;
|
|
setta_righe("CONTI D' ORDINE");
|
|
_reset_righe_stampa = FALSE;
|
|
}
|
|
if (_sez_da_stamp == '9')
|
|
{
|
|
reset_print();
|
|
_i = 1;
|
|
setta_righe("CONTO ECONOMICO");
|
|
_reset_righe_stampa = FALSE;
|
|
}
|
|
}
|
|
|
|
set_auto_ff(FALSE);
|
|
}
|
|
|
|
if (_buff == NULL)
|
|
return NEXT_PAGE;
|
|
|
|
_sale = 0;
|
|
_salerafr = 0;
|
|
|
|
return REPEAT_PAGE;
|
|
}
|
|
|
|
bool CG1600_application::preprocess_page(int file, int counter)
|
|
{
|
|
if (_tipo_bilancio == 1)
|
|
{
|
|
if (preprocess_stampa_scalare(counter))
|
|
return TRUE;
|
|
else
|
|
return FALSE;
|
|
}
|
|
else if (_tipo_bilancio == 2)
|
|
{
|
|
if (preprocess_stampa_verifica(counter))
|
|
return TRUE;
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool CG1600_application::preprocess_stampa_scalare(int counter)
|
|
{
|
|
struct bil_ivd* bil = (struct bil_ivd*) _buff;
|
|
int g,c;
|
|
long s;
|
|
bool fai = TRUE;
|
|
|
|
if (!counter)
|
|
{
|
|
reset_print();
|
|
_i = 1;
|
|
}
|
|
|
|
if (_reset_righe_stampa)
|
|
{
|
|
reset_print();
|
|
_i = 1;
|
|
}
|
|
else
|
|
_reset_righe_stampa = TRUE;
|
|
|
|
if (counter)
|
|
{
|
|
if (!_intera_struttura)
|
|
{
|
|
if (bil->gruppo[0] != 'Z')
|
|
{
|
|
_sez_stamp = bil->sez;
|
|
_let_stamp = bil->let;
|
|
_numr_stamp = bil->numr;
|
|
_numr_stamp.ltrim();
|
|
_num_stamp = bil->num;
|
|
_num_stamp.ltrim();
|
|
_sez_tot = bil->sez;
|
|
_let_tot = bil->let;
|
|
_numr_tot = bil->numr;
|
|
_numr_tot.ltrim();
|
|
_num_tot = bil->num;
|
|
_num_tot.ltrim();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_classe_stampata = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
|
|
_sez_stamp = bil->sez;
|
|
_let_stamp = bil->let;
|
|
_numr_stamp = bil->numr;
|
|
_numr_stamp.ltrim();
|
|
_num_stamp = bil->num;
|
|
_num_stamp.ltrim();
|
|
_sez_tot = bil->sez;
|
|
_let_tot = bil->let;
|
|
_numr_tot = bil->numr;
|
|
_numr_tot.ltrim();
|
|
_num_tot = bil->num;
|
|
_num_tot.ltrim();
|
|
}
|
|
}
|
|
|
|
_buff = _sort->retrieve();
|
|
|
|
if (_buff == NULL)
|
|
{
|
|
if (_annoeserafr == 0)
|
|
stampa_totali();
|
|
else
|
|
stampa_totali_con_raffronto();
|
|
_sez_da_stamp = ' ';
|
|
_sez_stamp = ' ';
|
|
return TRUE;
|
|
}
|
|
|
|
if (_buff != NULL)
|
|
{
|
|
bil = (struct bil_ivd*) _buff;
|
|
_classe_da_stampare = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
|
|
_sez_da_stamp = bil->sez;
|
|
_let_da_stamp = bil->let;
|
|
_numr_da_stamp = bil->numr;
|
|
_numr_da_stamp.ltrim();
|
|
_num_da_stamp = bil->num;
|
|
_num_da_stamp.ltrim();
|
|
g = atoi(bil->gruppo);
|
|
c = atoi(bil->conto);
|
|
s = atol(bil->sottoc);
|
|
|
|
if (_intera_struttura)
|
|
fai = TRUE;
|
|
else
|
|
{
|
|
if (bil->gruppo[0] != 'Z')
|
|
fai = TRUE;
|
|
else
|
|
fai = FALSE;
|
|
}
|
|
|
|
if (counter)
|
|
{
|
|
if (fai)
|
|
if (_annoeserafr == 0)
|
|
stampa_totali();
|
|
else
|
|
stampa_totali_con_raffronto();
|
|
}
|
|
|
|
//Fare ricerca di dataregmov
|
|
|
|
if (!_intera_struttura)
|
|
{
|
|
if (bil->gruppo[0]=='Z')
|
|
return FALSE;
|
|
|
|
_sale = bil->saldo;
|
|
if (_annoeserafr != 0)
|
|
_salerafr = bil->saldorafr;
|
|
|
|
if (_stampamov)
|
|
{
|
|
if (_annoeserafr != 0)
|
|
{
|
|
if ((_sale.is_zero()) && (_salerafr.is_zero()))
|
|
return FALSE;
|
|
}
|
|
else
|
|
if (_sale.is_zero())
|
|
return FALSE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (bil->gruppo[0]=='Z')
|
|
{
|
|
if (_classe_da_stampare != _classe_stampata)
|
|
{
|
|
sprintf (bil->gruppo,"%s", " ");
|
|
sprintf (bil->conto ,"%s", " ");
|
|
sprintf (bil->sottoc,"%s", " ");
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
_sale = bil->saldo;
|
|
if (_annoeserafr != 0)
|
|
_salerafr = bil->saldorafr;
|
|
|
|
if (_stampamov)
|
|
{
|
|
if (_annoeserafr != 0)
|
|
{
|
|
if ((_sale.is_zero()) && (_salerafr.is_zero()))
|
|
return FALSE;
|
|
}
|
|
else
|
|
{
|
|
if (_sale.is_zero())
|
|
return FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ((g != 0) && (c != 0) && (s != 0))
|
|
{
|
|
if (_sez_da_stamp == '5')
|
|
if (_sale < ZERO)
|
|
_sale = -_sale;
|
|
|
|
if (_sez_da_stamp == '9')
|
|
if (_sale> ZERO)
|
|
_sale = -_sale;
|
|
|
|
_totale_numero += _sale;
|
|
_totale_numr += _sale;
|
|
_totale_lettera += _sale;
|
|
if ((_sez_da_stamp == '1')||(_sez_da_stamp == '2'))
|
|
{
|
|
if (_let_da_stamp != 'Z')
|
|
_totale_sezione += _sale;
|
|
else
|
|
{
|
|
if (_sez_da_stamp == '1')
|
|
_totale_ordine_attivo += _sale;
|
|
else
|
|
if (_sez_da_stamp == '2')
|
|
_totale_ordine_passivo += _sale;
|
|
}
|
|
}
|
|
|
|
if (_sez_da_stamp == '5')
|
|
_totale_ordine += _sale;
|
|
|
|
if (_sez_da_stamp == '9')
|
|
_totale_economico += _sale;
|
|
|
|
if (_annoeserafr != 0)
|
|
{
|
|
if (_sez_da_stamp == '5')
|
|
if (_salerafr < ZERO)
|
|
_salerafr = -_salerafr;
|
|
if (_sez_da_stamp == '9')
|
|
if (_salerafr> ZERO)
|
|
_salerafr = -_salerafr;
|
|
|
|
_totale_num_raf += _salerafr;
|
|
_totale_numr_raf += _salerafr;
|
|
_totale_let_raf += _salerafr;
|
|
if ((_sez_da_stamp == '1')||(_sez_da_stamp == '2'))
|
|
{
|
|
if (_let_da_stamp != 'Z')
|
|
_totale_sez_raf += _salerafr;
|
|
else
|
|
{
|
|
if (_sez_da_stamp == '1')
|
|
_totale_ordine_attivo_raf += _salerafr;
|
|
else
|
|
if (_sez_da_stamp == '2')
|
|
_totale_ordine_passivo_raf += _salerafr;
|
|
}
|
|
}
|
|
|
|
if (_sez_da_stamp == '5')
|
|
_totale_ordine_raf += _salerafr;
|
|
if (_sez_da_stamp == '9')
|
|
_totale_economico_raf += _salerafr;
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
bool CG1600_application::preprocess_stampa_verifica(int counter)
|
|
{
|
|
struct bil_ivd* bil = (struct bil_ivd*) _buff;
|
|
int g,c;
|
|
long s;
|
|
bool fai = TRUE;
|
|
|
|
if (!counter)
|
|
{
|
|
reset_print();
|
|
_i = 1;
|
|
}
|
|
|
|
if (_reset_righe_stampa)
|
|
{
|
|
reset_print();
|
|
_i = 1;
|
|
}
|
|
else
|
|
_reset_righe_stampa = TRUE;
|
|
|
|
if (counter)
|
|
{
|
|
if (!_intera_struttura)
|
|
{
|
|
if (bil->gruppo[0] != 'Z')
|
|
{
|
|
_sez_stamp = bil->sez;
|
|
_let_stamp = bil->let;
|
|
_numr_stamp = bil->numr;
|
|
_numr_stamp.ltrim();
|
|
_num_stamp = bil->num;
|
|
_num_stamp.ltrim();
|
|
_sez_tot = bil->sez;
|
|
_let_tot = bil->let;
|
|
_numr_tot = bil->numr;
|
|
_numr_tot.ltrim();
|
|
_num_tot = bil->num;
|
|
_num_tot.ltrim();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_classe_stampata = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
|
|
_sez_stamp = bil->sez;
|
|
_let_stamp = bil->let;
|
|
_numr_stamp = bil->numr;
|
|
_numr_stamp.ltrim();
|
|
_num_stamp = bil->num;
|
|
_num_stamp.ltrim();
|
|
_sez_tot = bil->sez;
|
|
_let_tot = bil->let;
|
|
_numr_tot = bil->numr;
|
|
_numr_tot.ltrim();
|
|
_num_tot = bil->num;
|
|
_num_tot.ltrim();
|
|
}
|
|
}
|
|
|
|
_buff = _sort->retrieve();
|
|
|
|
if (_buff == NULL)
|
|
{
|
|
stampa_totali_verifica();
|
|
set_row (_i,"@0g****** ******** TOTALE GENERALE");
|
|
set_row (_i,"@49g%r", &_tot_gen_prg_d);
|
|
set_row (_i,"@65g%r", &_tot_gen_prg_a);
|
|
set_row (_i,"@82g%r", &_tot_gen_mov_d);
|
|
set_row (_i,"@98g%r", &_tot_gen_mov_a);
|
|
|
|
if (!_stampa_modulo)
|
|
{
|
|
if (_tot_gen_saldo < ZERO)
|
|
{
|
|
_tot_gen_saldo = -_tot_gen_saldo;
|
|
_tot_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_tot_sez_saldo = 'D';
|
|
stampa_saldo_132(_tot_gen_saldo);
|
|
}
|
|
else
|
|
stampa_saldo_198(_tot_gen_saldo_d,_tot_gen_saldo_a);
|
|
|
|
_sez_da_stamp = ' ';
|
|
_sez_stamp = ' ';
|
|
return TRUE;
|
|
}
|
|
|
|
if (_buff != NULL)
|
|
{
|
|
bil = (struct bil_ivd*) _buff;
|
|
_classe_da_stampare = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
|
|
_sez_da_stamp = bil->sez;
|
|
_let_da_stamp = bil->let;
|
|
_numr_da_stamp = bil->numr;
|
|
_numr_da_stamp.ltrim();
|
|
_num_da_stamp = bil->num;
|
|
_num_da_stamp.ltrim();
|
|
g = atoi(bil->gruppo);
|
|
c = atoi(bil->conto);
|
|
s = atol(bil->sottoc);
|
|
|
|
if (_intera_struttura)
|
|
fai = TRUE;
|
|
else
|
|
{
|
|
if (bil->gruppo[0] != 'Z')
|
|
fai = TRUE;
|
|
else
|
|
fai = FALSE;
|
|
}
|
|
|
|
if (counter)
|
|
{
|
|
if (fai)
|
|
stampa_totali_verifica();
|
|
}
|
|
|
|
_sale = bil->saldo;
|
|
_sld_prg_dare = bil->sld_prg_dare;
|
|
_sld_prg_avere = bil->sld_prg_avere;
|
|
_mov_dare = bil->mov_dare;
|
|
_mov_avere = bil->mov_avere;
|
|
|
|
if (!_intera_struttura)
|
|
{
|
|
if (bil->gruppo[0]=='Z')
|
|
return FALSE;
|
|
|
|
if (_stampamov)
|
|
{
|
|
if (_sale.is_zero())
|
|
return FALSE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (bil->gruppo[0]=='Z')
|
|
{
|
|
if (_classe_da_stampare != _classe_stampata)
|
|
{
|
|
sprintf (bil->gruppo,"%s", " ");
|
|
sprintf (bil->conto ,"%s", " ");
|
|
sprintf (bil->sottoc,"%s", " ");
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
if (_stampamov)
|
|
{
|
|
if (_sale.is_zero())
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
if ((g != 0) && (c != 0) && (s == 0))
|
|
{
|
|
if (_sld_prg_avere < ZERO)
|
|
_sld_prg_avere = -_sld_prg_avere;
|
|
|
|
if (_mov_avere < ZERO)
|
|
_mov_avere = -_mov_avere;
|
|
|
|
if (_sale < ZERO)
|
|
{
|
|
_sale = -_sale;
|
|
_sez_saldo = 'A';
|
|
}
|
|
else
|
|
_sez_saldo = 'D';
|
|
}
|
|
|
|
if ((g != 0) && (c != 0) && (s != 0))
|
|
{
|
|
_tot_num_saldo += _sale;
|
|
_tot_numr_saldo += _sale;
|
|
_tot_let_saldo += _sale;
|
|
_tot_gen_saldo += _sale;
|
|
|
|
if (_sld_prg_avere < ZERO)
|
|
_sld_prg_avere = -_sld_prg_avere;
|
|
|
|
if (_mov_avere < ZERO)
|
|
_mov_avere = -_mov_avere;
|
|
|
|
if (_sale < ZERO)
|
|
{
|
|
_sale = -_sale;
|
|
_sez_saldo = 'A';
|
|
if (_stampa_modulo)
|
|
{
|
|
_tot_num_saldo_a += _sale;
|
|
_tot_numr_saldo_a += _sale;
|
|
_tot_let_saldo_a += _sale;
|
|
_tot_gen_saldo_a += _sale;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_sez_saldo = 'D';
|
|
if (_stampa_modulo)
|
|
{
|
|
_tot_num_saldo_d += _sale;
|
|
_tot_numr_saldo_d += _sale;
|
|
_tot_let_saldo_d += _sale;
|
|
_tot_gen_saldo_d += _sale;
|
|
}
|
|
}
|
|
|
|
_tot_num_prg_d += _sld_prg_dare;
|
|
_tot_numr_prg_d += _sld_prg_dare;
|
|
_tot_let_prg_d += _sld_prg_dare;
|
|
_tot_gen_prg_d += _sld_prg_dare;
|
|
_tot_num_prg_a += _sld_prg_avere;
|
|
_tot_numr_prg_a += _sld_prg_avere;
|
|
_tot_let_prg_a += _sld_prg_avere;
|
|
_tot_gen_prg_a += _sld_prg_avere;
|
|
_tot_num_mov_d += _mov_dare;
|
|
_tot_numr_mov_d += _mov_dare;
|
|
_tot_let_mov_d += _mov_dare;
|
|
_tot_gen_mov_d += _mov_dare;
|
|
_tot_num_mov_a += _mov_avere;
|
|
_tot_numr_mov_a += _mov_avere;
|
|
_tot_let_mov_a += _mov_avere;
|
|
_tot_gen_mov_a += _mov_avere;
|
|
}
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
void CG1600_application::set_page(int file, int counter)
|
|
{
|
|
if (_tipo_bilancio == 1)
|
|
{
|
|
if (_sez_da_stamp != _sez_stamp)
|
|
{
|
|
if ((_sez_da_stamp=='1')||((_sez_da_stamp=='2')&&(_statopatr_no_stamp)))
|
|
{
|
|
setta_righe ("STATO PATRIMONIALE");
|
|
_statopatr_no_stamp = FALSE;
|
|
}
|
|
if (_sez_da_stamp == '2')
|
|
setta_righe("");
|
|
if ((_sez_da_stamp == '5') || (_sez_da_stamp == '9'))
|
|
set_auto_ff(TRUE);
|
|
}
|
|
else
|
|
{
|
|
if (_buff != NULL)
|
|
setta_righe("");
|
|
}
|
|
}
|
|
else if (_tipo_bilancio == 2)
|
|
{
|
|
if (_buff != NULL)
|
|
setta_righe_verifica();
|
|
}
|
|
}
|
|
|
|
void CG1600_application::setta_righe(const char * titolo)
|
|
{
|
|
struct bil_ivd* bil = (struct bil_ivd*) _buff;
|
|
int numeror, numero, gruppo, conto;
|
|
char sezione,lettera;
|
|
long sottoc;
|
|
TString numrom,numr,num;
|
|
TString descr_let,descr_numr,descr_num,descr_sottoc,descr_classe;
|
|
bool stampa_classe = TRUE;
|
|
|
|
sezione = bil->sez;
|
|
lettera = bil->let;
|
|
numr = bil->numr;
|
|
// numr.ltrim();
|
|
numeror = atoi(bil->numr);
|
|
numrom = itor(numeror);
|
|
numero = atoi(bil->num);
|
|
num = bil->num;
|
|
gruppo = atoi(bil->gruppo);
|
|
conto = atoi(bil->conto);
|
|
sottoc = atoi(bil->sottoc);
|
|
_descr_sez = descrizione_sezione(sezione);
|
|
descr_let = descrizione_lettera(sezione,lettera);
|
|
descr_numr = descrizione_numeroromano(sezione,lettera,numr);
|
|
descr_num = descrizione_numero(sezione,lettera,numr,numero);
|
|
descr_sottoc = descrizione_sottoconto(gruppo,conto,sottoc);
|
|
|
|
//Se la classe prelevata dal record corrente del sort e' diversa dalla classe
|
|
//prelevata dal record precedente, allora stampo la nuova classe con i relativi
|
|
//sottoconti. In caso contrario continuo a stampare solo i sottoconti.
|
|
|
|
if (_sez_da_stamp != _sez_stamp)
|
|
{
|
|
set_row (_i++,"@0g%s", titolo);
|
|
char app = ' ';
|
|
set_row(_i++,"@0g%c", app);
|
|
|
|
if ((_sez_da_stamp == '1')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i++,"@0gCONTI D' ORDINE ATTIVI");
|
|
set_row (_i++,"@0g%c", app);
|
|
stampa_classe = FALSE;
|
|
}
|
|
if ((_sez_da_stamp == '2')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row(_i++,"@0g%c", app);
|
|
set_row (_i++,"@0gCONTI D' ORDINE PASSIVI");
|
|
set_row(_i++,"@0g%c", app);
|
|
stampa_classe = FALSE;
|
|
}
|
|
|
|
if (stampa_classe)
|
|
{
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp== '9'))
|
|
{
|
|
set_row(_i++,"@0g%s", (const char*) _descr_sez);
|
|
_cont_let = 1;
|
|
_cont_numr = 1;
|
|
_cont_num = 1;
|
|
_cont_gcs = 0;
|
|
if (lettera != ' ')
|
|
{
|
|
set_row(_i,"@0g%c", bil->let);
|
|
set_row(_i++,"@1g)@3g%s", (const char*) descr_let);
|
|
}
|
|
if (numrom != "")
|
|
{
|
|
set_row(_i,"@9g%s", (const char*) numrom);
|
|
set_row(_i++,"@12g-@14g%s", (const char*) descr_numr);
|
|
}
|
|
if (num != "")
|
|
{
|
|
set_row(_i,"@13g%s", bil->num);
|
|
set_row(_i++,"@15g)@18g%s", (const char*) descr_num);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
if ((_let_da_stamp!=_let_stamp)&&(_sez_da_stamp==_sez_stamp))
|
|
{
|
|
if ((_sez_da_stamp == '1')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i++,"@0g%c", app);
|
|
set_row (_i++,"@0gCONTI D' ORDINE ATTIVI");
|
|
set_row (_i++,"@0g%c", app);
|
|
stampa_classe = FALSE;
|
|
}
|
|
if ((_sez_da_stamp == '2')&&(_let_da_stamp == 'Z'))
|
|
{
|
|
char app = ' ';
|
|
set_row(_i++,"@0g%c", app);
|
|
set_row (_i++,"@0gCONTI D' ORDINE PASSIVI");
|
|
set_row(_i++,"@0g%c", app);
|
|
stampa_classe = FALSE;
|
|
}
|
|
if (stampa_classe)
|
|
{
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
|
|
{
|
|
set_row(_i,"@0g%c", bil->let);
|
|
set_row(_i++,"@1g)@3g%s", (const char*) descr_let);
|
|
_cont_let += 1;
|
|
if (numrom != "")
|
|
{
|
|
set_row(_i,"@9g%s", (const char*) numrom);
|
|
set_row(_i++,"@12g-@14g%s", (const char*) descr_numr);
|
|
}
|
|
if (num != "")
|
|
{
|
|
set_row(_i,"@13g%s", bil->num);
|
|
set_row(_i++,"@15g)@18g%s", (const char*) descr_num);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
if ((_numr_da_stamp!=_numr_stamp)&&(_sez_da_stamp==_sez_stamp)&&(_let_da_stamp==_let_stamp))
|
|
{
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
|
|
{
|
|
set_row(_i,"@9g%s", (const char*) numrom);
|
|
set_row(_i++,"@12g-@14g%s", (const char*) descr_numr);
|
|
_cont_numr += 1;
|
|
if (num != "")
|
|
{
|
|
set_row(_i,"@13g%s", bil->num);
|
|
set_row(_i++,"@15g)@18g%s", (const char*) descr_num);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
if ((_num_da_stamp!=_num_stamp)&&(_sez_da_stamp==_sez_stamp)&&(_let_da_stamp==_let_stamp)&&(_numr_da_stamp==_numr_stamp))
|
|
{
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
|
|
{
|
|
set_row(_i,"@13g%s", bil->num);
|
|
set_row(_i++,"@15g)@18g%s", (const char*) descr_num);
|
|
_cont_num += 1;
|
|
}
|
|
}
|
|
if (bil->gruppo[0] != 'A')
|
|
{
|
|
_cont_gcs += 1;
|
|
if (!_stampacod)
|
|
{
|
|
set_row (_i,"@18g%s", bil->gruppo);
|
|
set_row (_i,"@22g%s", bil->conto);
|
|
set_row (_i,"@26g%s", bil->sottoc);
|
|
set_row (_i,"@33g%s", (const char*) descr_sottoc);
|
|
set_row (_i,"@86g%r", &_sale);
|
|
if (_annoeserafr != 0)
|
|
set_row (_i,"@112g%r", &_salerafr);
|
|
_i++;
|
|
}
|
|
else
|
|
{
|
|
if ((sezione != ' ')&&(lettera == ' ')&&(numrom == "")&&(num == ""))
|
|
descr_classe = _descr_sez;
|
|
if ((sezione != ' ')&&(lettera != ' ')&&(numrom == "")&&(num == ""))
|
|
descr_classe = descr_let;
|
|
if ((sezione != ' ')&&(lettera != ' ')&&(numrom != "")&&(num == ""))
|
|
descr_classe = descr_numr;
|
|
if ((sezione != ' ')&&(lettera != ' ')&&(numrom != "")&&(num != ""))
|
|
descr_classe = descr_num;
|
|
if (descr_classe != descr_sottoc)
|
|
{
|
|
set_row (_i,"@33g%s", (const char*) descr_sottoc);
|
|
set_row (_i,"@86g%r", &_sale);
|
|
if (_annoeserafr != 0)
|
|
set_row (_i,"@112g%r", &_salerafr);
|
|
_i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CG1600_application::setta_righe_verifica()
|
|
{
|
|
struct bil_ivd* bil = (struct bil_ivd*) _buff;
|
|
int numeror, numero, gruppo, conto;
|
|
char sezione,lettera,tmcf;
|
|
long sottoc;
|
|
TString numrom,numr,num;
|
|
TString descr_let,descr_numr,descr_num,descr_sottoc,descr_classe;
|
|
|
|
sezione = bil->sez;
|
|
lettera = bil->let;
|
|
numr = bil->numr;
|
|
numeror = atoi(bil->numr);
|
|
numrom = itor(numeror);
|
|
numero = atoi(bil->num);
|
|
num = bil->num;
|
|
gruppo = atoi(bil->gruppo);
|
|
conto = atoi(bil->conto);
|
|
sottoc = atoi(bil->sottoc);
|
|
tmcf = bil->tipocf;
|
|
_descr_sez = descrizione_sezione(sezione);
|
|
descr_let = descrizione_lettera(sezione,lettera);
|
|
descr_numr = descrizione_numeroromano(sezione,lettera,numr);
|
|
descr_num = descrizione_numero(sezione,lettera,numr,numero);
|
|
if ((tmcf == 'C') || (tmcf == 'F'))
|
|
descr_sottoc = descr_sottoc_clifo(tmcf,gruppo,conto,sottoc);
|
|
else
|
|
descr_sottoc = descrizione_sottoconto(gruppo,conto,sottoc);
|
|
|
|
//Se la classe prelevata dal record corrente del sort e' diversa dalla classe
|
|
//prelevata dal record precedente, allora stampo la nuova classe con i relativi
|
|
//sottoconti. In caso contrario continuo a stampare solo i sottoconti.
|
|
|
|
if (_sez_da_stamp != _sez_stamp)
|
|
{
|
|
char app = ' ';
|
|
set_row (_i,"@0g%c", app);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp== '9'))
|
|
{
|
|
if (_let_da_stamp != 'Z')
|
|
{
|
|
_cont_let = 1;
|
|
_cont_numr = 1;
|
|
_cont_num = 1;
|
|
_cont_gcs = 0;
|
|
if (lettera != '\0')
|
|
{
|
|
set_row(_i,"@0g%c", bil->let);
|
|
set_row(_i,"@1g)@3g%s", (const char*) descr_let);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
}
|
|
if (numrom != "")
|
|
{
|
|
set_row(_i,"@0g%s", (const char*) numrom);
|
|
set_row(_i,"@8g)@10g%s", (const char*) descr_numr);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
}
|
|
if (num != " 0")
|
|
{
|
|
set_row(_i,"@0g%s", bil->num);
|
|
set_row(_i,"@2g)@4g%s", (const char*) descr_num);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
if ((_let_da_stamp!=_let_stamp)&&(_sez_da_stamp==_sez_stamp))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i,"@0g%c", app);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
|
|
{
|
|
if (_let_da_stamp != 'Z')
|
|
{
|
|
set_row(_i,"@0g%c", bil->let);
|
|
set_row(_i,"@1g)@3g%s", (const char*) descr_let);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
_cont_let += 1;
|
|
if (numrom != "")
|
|
{
|
|
set_row(_i,"@0g%s", (const char*) numrom);
|
|
set_row(_i,"@8g)@10g%s", (const char*) descr_numr);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
}
|
|
if (num != " 0")
|
|
{
|
|
set_row(_i,"@0g%s", bil->num);
|
|
set_row(_i,"@2g)@4g%s", (const char*) descr_num);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
if ((_numr_da_stamp!=_numr_stamp)&&(_sez_da_stamp==_sez_stamp)&&(_let_da_stamp==_let_stamp))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i,"@0g%c", app);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
|
|
{
|
|
if (_let_da_stamp != 'Z')
|
|
{
|
|
set_row(_i,"@0g%s", (const char*) numrom);
|
|
set_row(_i,"@8g)@10g%s", (const char*) descr_numr);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
_cont_numr += 1;
|
|
if (num != " 0")
|
|
{
|
|
set_row(_i,"@0g%s", bil->num);
|
|
set_row(_i,"@2g)@4g%s", (const char*) descr_num);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
if ((_num_da_stamp!=_num_stamp)&&(_sez_da_stamp==_sez_stamp)&&(_let_da_stamp==_let_stamp)&&(_numr_da_stamp==_numr_stamp))
|
|
{
|
|
char app = ' ';
|
|
set_row (_i,"@0g%c", app);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
|
|
{
|
|
if (_let_da_stamp != 'Z')
|
|
{
|
|
set_row(_i,"@0g%s", bil->num);
|
|
set_row(_i,"@2g)@4g%s", (const char*) descr_num);
|
|
set_row (_i++,"@48g|@81g|@114g|");
|
|
_cont_num += 1;
|
|
}
|
|
}
|
|
}
|
|
if (bil->gruppo[0] != 'A')
|
|
{
|
|
_cont_gcs += 1;
|
|
if (!_stampacod)
|
|
{
|
|
set_row (_i,"@0g%s", bil->gruppo);
|
|
set_row (_i,"@4g%s", bil->conto);
|
|
set_row (_i,"@8g%s", bil->sottoc);
|
|
set_row (_i,"@15g%s", (const char*) descr_sottoc);
|
|
set_row (_i,"@49g%r", &_sld_prg_dare);
|
|
set_row (_i,"@65g%r", &_sld_prg_avere);
|
|
set_row (_i,"@82g%r", &_mov_dare);
|
|
set_row (_i,"@98g%r", &_mov_avere);
|
|
if (_stampa_modulo)
|
|
{
|
|
if (_sez_saldo == 'D')
|
|
{
|
|
set_row (_i,"@115g%r", &_sale);
|
|
set_row (_i,"@48g|@81g|@114g|@131g|");
|
|
}
|
|
else
|
|
if (_sez_saldo == 'A')
|
|
{
|
|
set_row (_i,"@133g%r", &_sale);
|
|
set_row (_i,"@48g|@81g|@114g|@131g|");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
set_row (_i,"@115g%r", &_sale);
|
|
set_row (_i,"@131g%c", _sez_saldo);
|
|
set_row (_i,"@48g|@81g|@114g|");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((sezione != ' ')&&(lettera == ' ')&&(numrom == "")&&(num == ""))
|
|
descr_classe = _descr_sez;
|
|
if ((sezione != ' ')&&(lettera != ' ')&&(numrom == "")&&(num == ""))
|
|
descr_classe = descr_let;
|
|
if ((sezione != ' ')&&(lettera != ' ')&&(numrom != "")&&(num == ""))
|
|
descr_classe = descr_numr;
|
|
if ((sezione != ' ')&&(lettera != ' ')&&(numrom != "")&&(num != ""))
|
|
descr_classe = descr_num;
|
|
if (descr_classe != descr_sottoc)
|
|
{
|
|
set_row (_i,"@33g%s", (const char*) descr_sottoc);
|
|
set_row (_i,"@49g%r", &_sld_prg_dare);
|
|
set_row (_i,"@66g%r", &_sld_prg_avere);
|
|
set_row (_i,"@82g%r", &_mov_dare);
|
|
set_row (_i,"@99g%r", &_mov_avere);
|
|
if (_stampa_modulo)
|
|
{
|
|
if (_sez_saldo == 'D')
|
|
{
|
|
set_row (_i,"@115g%r", &_sale);
|
|
set_row (_i,"@48g|@81g|@114g|@131g|");
|
|
}
|
|
else
|
|
if (_sez_saldo == 'A')
|
|
{
|
|
set_row (_i,"@133g%r", &_sale);
|
|
set_row (_i,"@48g|@81g|@114g|@131g|");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
set_row (_i,"@115g%r", &_sale);
|
|
set_row (_i,"@131g%c", _sez_saldo);
|
|
set_row (_i,"@48g|@81g|@114g|");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
TDate CG1600_application::data_inferiore()
|
|
{
|
|
TDate data;
|
|
TDate data_ini_ese_prec,data_fine_ese_prec,data_ini_ese,data_fine_ese;
|
|
long annoese,annoeseprec;
|
|
|
|
annoese = _msk->get_long(F_ANNOESE);
|
|
annoeseprec = annoese - 1;
|
|
|
|
_anni_es.aggiungi_anno(annoese, data_ini_ese, data_fine_ese);
|
|
_anni_es.aggiungi_anno(annoeseprec, data_ini_ese_prec, data_fine_ese_prec);
|
|
|
|
if ((_datalimite>=data_ini_ese_prec)&&(_datalimite<=data_fine_ese_prec))
|
|
data = data_ini_ese_prec;
|
|
if ((_datalimite>=data_ini_ese)&&(_datalimite<=data_fine_ese))
|
|
data = data_ini_ese;
|
|
_data_ini_ese = data_ini_ese;
|
|
return (data);
|
|
}
|
|
|
|
TDate CG1600_application::data_inferiore_raf()
|
|
{
|
|
TDate data;
|
|
TDate data_ini_raf_prec,data_fine_raf_prec,data_ini_raf,data_fine_raf;
|
|
long annoese,annoeseprec;
|
|
|
|
annoese = _msk->get_long(F_ANNORAFFR);
|
|
annoeseprec = annoese - 1;
|
|
|
|
_anni_es.aggiungi_anno(annoese, data_ini_raf, data_fine_raf);
|
|
_anni_es.aggiungi_anno(annoeseprec, data_ini_raf_prec, data_fine_raf_prec);
|
|
|
|
_data_fine_raf = data_fine_raf;
|
|
_data_fine_raf_prec = data_fine_raf_prec;
|
|
|
|
if ((_databilrafr>=data_ini_raf_prec)&&(_databilrafr<=data_fine_raf_prec))
|
|
data = data_ini_raf_prec;
|
|
if ((_databilrafr>=data_ini_raf)&&(_databilrafr<=data_fine_raf))
|
|
data = data_ini_raf;
|
|
|
|
return (data);
|
|
}
|
|
|
|
const char* CG1600_application::descrizione_sezione(char sezione)
|
|
{
|
|
TTable tabivd(TAB_IVD);
|
|
TString dep, dep2;
|
|
|
|
tabivd.zero();
|
|
dep = format("%1c", sezione);
|
|
tabivd.put("CODTAB", dep);
|
|
tabivd.read();
|
|
dep2 = tabivd.get("CODTAB");
|
|
if (dep == dep2)
|
|
tmp = tabivd.get("S0");
|
|
else
|
|
tmp = "";
|
|
return (__tmp);
|
|
}
|
|
|
|
const char* CG1600_application::descrizione_lettera(char sezione, char lettera)
|
|
{
|
|
TTable tabivd(TAB_IVD);
|
|
TString dep, dep2;
|
|
|
|
tabivd.zero();
|
|
dep = format("%1c%1c", sezione, lettera);
|
|
tabivd.put("CODTAB", dep);
|
|
tabivd.read();
|
|
dep2 = tabivd.get("CODTAB");
|
|
if (dep == dep2)
|
|
tmp = tabivd.get("S0");
|
|
else
|
|
tmp = "";
|
|
return (__tmp);
|
|
}
|
|
|
|
const char* CG1600_application::descrizione_numeroromano(char sezione, char lettera, TString numr)
|
|
{
|
|
TTable tabivd(TAB_IVD);
|
|
TString dep, dep2;
|
|
|
|
tabivd.zero();
|
|
dep = format("%1c%1c%8s", sezione, lettera, (const char*) numr);
|
|
tabivd.put("CODTAB", dep);
|
|
tabivd.read();
|
|
dep2 = tabivd.get("CODTAB");
|
|
if (dep == dep2)
|
|
tmp = tabivd.get("S0");
|
|
else
|
|
tmp = "";
|
|
return (__tmp);
|
|
}
|
|
|
|
const char* CG1600_application::descrizione_numero(char sezione, char lettera, TString numr, int numero)
|
|
{
|
|
TTable tabivd(TAB_IVD);
|
|
TString dep;
|
|
|
|
tabivd.zero();
|
|
dep = format("%1c%1c%8s%02d",sezione, lettera, (const char*) numr, numero);
|
|
tabivd.put("CODTAB", dep);
|
|
tabivd.read();
|
|
if (tabivd.bad())
|
|
tabivd.zero();
|
|
tmp = tabivd.get("S0");
|
|
return (__tmp);
|
|
}
|
|
|
|
const char* CG1600_application::descrizione_sottoconto(int gruppo, int conto, long sottoc)
|
|
{
|
|
TLocalisamfile pconti (LF_PCON);
|
|
|
|
pconti.zero();
|
|
pconti.put(PCN_GRUPPO , gruppo);
|
|
if (conto != 0)
|
|
pconti.put(PCN_CONTO , conto );
|
|
if (sottoc != 0)
|
|
pconti.put(PCN_SOTTOCONTO, sottoc);
|
|
pconti.read();
|
|
if (pconti.bad())
|
|
pconti.zero();
|
|
tmp = pconti.get(PCN_DESCR);
|
|
return (__tmp);
|
|
}
|
|
|
|
const char* CG1600_application::descr_sottoc_clifo(char tipocf,int g,int c,long s)
|
|
{
|
|
TLocalisamfile clifo (LF_CLIFO);
|
|
|
|
clifo.zero();
|
|
clifo.put(CLI_TIPOCF,tipocf);
|
|
clifo.put(CLI_GRUPPO , g);
|
|
if (c != 0)
|
|
clifo.put(CLI_CONTO , c );
|
|
if (s != 0)
|
|
clifo.put(CLI_CODCF, s);
|
|
clifo.read();
|
|
if (clifo.bad())
|
|
clifo.zero();
|
|
tmp = clifo.get(CLI_RAGSOC);
|
|
return (__tmp);
|
|
}
|
|
|
|
void CG1600_application::preprocess_header()
|
|
{
|
|
}
|
|
|
|
// Crea l'intestazione per la stampa a 132 e a 198 caratteri
|
|
|
|
void CG1600_application::crea_intestazione()
|
|
{
|
|
TString datastampastr;
|
|
TString sep(132),sep1(147);
|
|
|
|
TString app(8);
|
|
TLocalisamfile nditte (LF_NDITTE);
|
|
TLocalisamfile comuni (LF_COMUNI);
|
|
TLocalisamfile unloc (LF_UNLOC);
|
|
TLocalisamfile anag (LF_ANAG);
|
|
TString codice_ditta,ragsoc,indulc,civulc,capulc,com,prov,comulc;
|
|
TString cofi,paiv,tipoa,codanagr;
|
|
|
|
reset_header();
|
|
|
|
nditte.setkey(1);
|
|
codice_ditta << get_firm();
|
|
nditte.curr().zero();
|
|
nditte.curr().put(NDT_CODDITTA,codice_ditta);
|
|
nditte.read();
|
|
app=nditte.curr().get(NDT_CODDITTA);
|
|
ragsoc=nditte.curr().get(NDT_RAGSOC);
|
|
tipoa =nditte.curr().get(NDT_TIPOA);
|
|
codanagr = nditte.get(NDT_CODANAGR);
|
|
|
|
unloc.setkey(1);
|
|
unloc.curr().zero();
|
|
unloc.curr().put(ULC_CODDITTA,app);
|
|
unloc.curr().put(ULC_CODULC,"1");
|
|
unloc.read();
|
|
indulc=unloc.curr().get(ULC_INDULC);
|
|
civulc=unloc.curr().get(ULC_CIVULC);
|
|
capulc=unloc.curr().get(ULC_CAPULC);
|
|
comulc=unloc.curr().get(ULC_COMULC);
|
|
|
|
comuni.setkey(1);
|
|
comuni.curr().zero();
|
|
comuni.curr().put(COM_COM,comulc);
|
|
comuni.read();
|
|
com=comuni.curr().get(COM_DENCOM);
|
|
prov=comuni.curr().get(COM_PROVCOM);
|
|
|
|
anag.setkey(2);
|
|
anag.curr().zero();
|
|
anag.curr().put(ANA_TIPOA,tipoa);
|
|
anag.curr().put(ANA_CODANAGR,codanagr);
|
|
anag.read();
|
|
cofi=anag.curr().get(ANA_COFI);
|
|
paiv=anag.curr().get(ANA_PAIV);
|
|
|
|
set_header (1, "@0gDITTA@6g%-5s", (const char*) codice_ditta);
|
|
set_header (1, "@12g%-45s", (const char*) ragsoc);
|
|
set_header (1, "@59g%-25s", (const char*) indulc);
|
|
set_header (1, "@86g%-9s", (const char*) civulc);
|
|
set_header (1, "@97g%-5s", (const char*) capulc);
|
|
set_header (1, "@103g%-25s", (const char*) com);
|
|
set_header (1, "@129g%-3s", (const char*) prov);
|
|
|
|
if (_stampa_modulo)
|
|
{
|
|
sep1 << "Pag. @#";
|
|
sep1.right_just(139);
|
|
set_header(2,(const char*) sep1);
|
|
}
|
|
else
|
|
{
|
|
sep << "Pag. @#";
|
|
sep.right_just(132);
|
|
set_header(2,(const char*) sep);
|
|
}
|
|
|
|
datastampastr = _datastampa.string();
|
|
|
|
set_header (2,"@0gPartita iva@12g%-11s", (const char*) paiv);
|
|
set_header (2,"@30gCodice fiscale@45g%-16s", (const char*) cofi);
|
|
if (_stampa_modulo)
|
|
set_header (2,"@131gData@136g%s",(const char*) datastampastr);
|
|
else
|
|
set_header (2,"@105gData@110g%s",(const char*) datastampastr);
|
|
|
|
if (_tipo_bilancio == 1)
|
|
{
|
|
intesta_scalare();
|
|
}
|
|
else if (_tipo_bilancio == 2)
|
|
{
|
|
intesta_verifica();
|
|
}
|
|
|
|
}
|
|
|
|
void CG1600_application::intesta_verifica_fissa()
|
|
{
|
|
TString sep(132),app(32),sep1(147);
|
|
|
|
if (_tipo_stampa == 1)
|
|
{
|
|
if (_dataini == _data_ini_ese)
|
|
set_header(5,"@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO");
|
|
else if (_dataini > _data_ini_ese)
|
|
set_header(5,"@54gPROGRESSIVI PRECEDENTI@87gMOVIMENTI DEL PERIODO");
|
|
}
|
|
else if ((_tipo_stampa == 2) || (_tipo_stampa == 3))
|
|
set_header(5,"@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO");
|
|
|
|
if (_stampa_modulo)
|
|
set_header(5,"@129gSALDO");
|
|
|
|
set_header(5,"@48g|@81g|@114g|");
|
|
|
|
if (_stampa_modulo)
|
|
{
|
|
set_header(5,"@147g|");
|
|
set_header(6,"@131g|@147g|");
|
|
}
|
|
|
|
set_header(6,"@48g|@81g|@114g|");
|
|
app = "--------------------------------";
|
|
if (_stampa_modulo)
|
|
{
|
|
set_header(6,"@49g%s@82g%s@115g%s", (const char*) app, (const char*) app,(const char*) app);
|
|
set_header(7,"@1gdescrizione voce@48g|@57gDare@65g|@72gAvere@81g|@90gDare@98g|@105gAvere@114g|@122gDare@131g|@138gAvere@147g|");
|
|
sep1.fill('-'); //Stampa 132 - (sep(132))
|
|
set_header (8, (const char *) sep1);
|
|
}
|
|
else
|
|
{
|
|
set_header(6,"@49g%s@82g%s@122gSALDO", (const char*) app, (const char*) app);
|
|
set_header(7,"@1gdescrizione voce@48g|@57gDare@65g|@72gAvere@81g|@90gDare@98g|@105gAvere@114g|");
|
|
sep.fill('-'); //Stampa 132 - (sep(132))
|
|
set_header (8, (const char *) sep);
|
|
}
|
|
}
|
|
|
|
void CG1600_application::intesta_scalare()
|
|
{
|
|
TString datalimitestr,databilrafrstr;
|
|
TString sep(132);
|
|
|
|
set_header (3,"@0gSTAMPA BILANCIO CONFORME ALLA IV DIRETTIVA");
|
|
if (_competenza)
|
|
set_header (3,"@48g(con controllo competenza)");
|
|
set_header (3,"@89gEsercizio@99g%d", _annoese);
|
|
if (_annoeserafr != 0)
|
|
{
|
|
set_header (3,"@115gEsercizio@125g%d", _annoeserafr);
|
|
databilrafrstr = _databilrafr.string();
|
|
set_header (4,"@112galla data@122g%s", (const char*) databilrafrstr);
|
|
}
|
|
if (_tipo_stampa == 1)
|
|
{
|
|
datalimitestr = _datalimite.string();
|
|
set_header (4,"@86galla data@96g%s", (const char*) datalimitestr);
|
|
}
|
|
else if ((_tipo_stampa == 2) || (_tipo_stampa == 3))
|
|
set_header (4,"@90gall' ultima immissione");
|
|
|
|
sep.fill('-'); //Stampa 132 - (sep(132))
|
|
set_header (5, (const char *) sep);
|
|
}
|
|
|
|
void CG1600_application::intesta_verifica()
|
|
{
|
|
TString sep(132),sep1(147);
|
|
|
|
set_header (3,"@0gBILANCIO DI VERIFICA IV DIRETTIVA");
|
|
if (_competenza)
|
|
set_header (3,"@87g(con controllo competenza)");
|
|
if (_tipo_stampa == 1)
|
|
{
|
|
TString datainistr = _dataini.string();
|
|
TString datafinestr = _datafine.string();
|
|
set_header (3,"@43gdalla data@54g%s", (const char*) datainistr);
|
|
set_header (3,"@65galla data@75g%s", (const char*) datafinestr);
|
|
}
|
|
else if (_tipo_stampa == 2)
|
|
set_header (3,"@42gall' ultima immissione esercizio in corso");
|
|
else if (_tipo_stampa == 3)
|
|
set_header (3,"@42gall' ultima immissione esercizio precedente");
|
|
|
|
if (_stampa_modulo)
|
|
{
|
|
sep1.fill('-'); //Stampa 132 - (sep(132))
|
|
set_header (4, (const char *) sep1);
|
|
}
|
|
else
|
|
{
|
|
sep.fill('-'); //Stampa 132 - (sep(132))
|
|
set_header (4, (const char *) sep);
|
|
}
|
|
intesta_verifica_fissa();
|
|
}
|
|
|
|
void CG1600_application::init_sort()
|
|
{
|
|
_bil = new bil_ivd;
|
|
_sort = new TSort (sizeof(bil_ivd));
|
|
|
|
_sort -> addsortkey ((char*)&(_bil->sez) - (char*)&(_bil->sez),1);
|
|
_sort -> addsortkey ((char*)&(_bil->let) - (char*)&(_bil->sez),1);
|
|
_sort -> addsortkey ((char*)&(_bil->numr) - (char*)&(_bil->sez),8);
|
|
_sort -> addsortkey ((char*)&(_bil->num) - (char*)&(_bil->sez),2);
|
|
_sort -> addsortkey ((char*)&(_bil->gruppo) - (char*)&(_bil->sez),3);
|
|
_sort -> addsortkey ((char*)&(_bil->conto) - (char*)&(_bil->sez),3);
|
|
_sort -> addsortkey ((char*)&(_bil->sottoc) - (char*)&(_bil->sez),6);
|
|
_sort->init();
|
|
}
|
|
|
|
void CG1600_application::user_create()
|
|
{
|
|
_nditte = new TLocalisamfile (LF_NDITTE);
|
|
_comuni = new TLocalisamfile (LF_COMUNI);
|
|
_unloc = new TLocalisamfile (LF_UNLOC);
|
|
_anag = new TLocalisamfile (LF_ANAG);
|
|
_pconti = new TLocalisamfile (LF_PCON);
|
|
_clifo = new TLocalisamfile (LF_CLIFO);
|
|
|
|
_tabivd = new TTable (TAB_IVD);
|
|
_tabesc = new TTable (TAB_ESC);
|
|
|
|
_msk = new TMask("cg1600a");
|
|
}
|
|
|
|
void CG1600_application::user_destroy()
|
|
{
|
|
delete _msk;
|
|
|
|
delete _tabivd;
|
|
delete _tabesc;
|
|
delete _nditte;
|
|
delete _comuni;
|
|
delete _unloc;
|
|
delete _anag;
|
|
delete _pconti;
|
|
delete _clifo;
|
|
}
|
|
|
|
int cg1600 (int argc, char* argv[])
|
|
{
|
|
|
|
CG1600_application a;
|
|
|
|
a.run(argc, argv, "Stampa Bilancio IV direttiva CEE");
|
|
return 0;
|
|
}
|
|
|
|
|
|
|