campo-sirio/cg/cg1600.cpp
alex 9cf96bbcc5 Patch level : 10.0 684
Files correlati     : CG1.EXE CG3.EXE
Ricompilazione Demo : [ ]
Commento            :

Bug 0001590: Tabella IV direttiva CEE
Aggiungere un ulteriore livello al codice della tabella IV direttiva per permettere l'inserimento delle lettre alfabetiche


git-svn-id: svn://10.65.10.50/trunk@20271 c028cbd2-c16b-5b4b-a496-9718f37d4682
2010-03-24 15:33:50 +00:00

4724 lines
139 KiB
C++
Executable File
Raw Blame History

#include <mask.h>
#include <printapp.h>
#include <progind.h>
#include <recarray.h>
#include <sort.h>
#include <tabutil.h>
#include <utility.h>
#include <causali.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 <saldi.h>
#include "cg1.h"
#include "cg1600.h"
#include "cglib01.h"
#include "cglib02.h"
class TRiga_sez_opp : public TObject
{
TToken_string* _str;
public:
int gruppo() const { return _str->get_int(0); }
int conto() const { return _str->get_int(1); }
long sottoc() const { return _str->get_long(2); }
const char * sezione () { return _str->get(3); }
const char * lettera () { return _str->get(4); }
const char * num_rom () { return _str->get(5); }
const char * numero () const { return _str->get(6); }
real saldo_conto () const;
real saldo_conto_raf() const;
void incrementa_saldo(real& nuovo_saldo,real& nuovo_saldo_raf);
TRiga_sez_opp(int g, int c, long s,
const char * sezione, const char * lettera,
const char * num_rom, const char * num, real& saldo, real& saldo_raf);
virtual ~TRiga_sez_opp();
};
real TRiga_sez_opp::saldo_conto () const
{
real r(_str->get(7));
return r;
}
real TRiga_sez_opp::saldo_conto_raf () const
{
real r(_str->get(8));
return r;
}
void TRiga_sez_opp::incrementa_saldo(real& sld,real& sld_raf)
{
real sld_prec = saldo_conto();
real sld_prec_raf = saldo_conto_raf();
sld_prec += sld;
sld_prec_raf += sld_raf;
_str->add(sld_prec.string(), 7);
_str->add(sld_prec_raf.string(), 8);
}
TRiga_sez_opp::TRiga_sez_opp(int g, int c, long s,
const char * sezione, const char * lettera,
const char * num_rom, const char * num, real& saldo, real& saldo_raf)
{
_str = new TToken_string(30);
_str->add(g);
_str->add(c);
_str->add(s);
_str->add(sezione);
_str->add(lettera);
_str->add(num_rom);
_str->add(num);
_str->add(saldo.string());
_str->add(saldo_raf.string());
}
TRiga_sez_opp::~TRiga_sez_opp()
{
delete _str;
}
class Righe_sez_opp : public TAssoc_array
{
public:
TRiga_sez_opp* riga() { return (TRiga_sez_opp*) get(); }
int gruppo() { return riga()->gruppo(); }
int conto() { return riga()->conto(); }
long sottoc() { return riga()->sottoc(); }
const char * sezione () { return riga()->sezione(); }
const char * lettera () { return riga()->lettera(); }
const char * num_rom () { return riga()->num_rom(); }
const char * numero () { return riga()->numero(); }
real saldo_conto () { return riga()->saldo_conto(); }
real saldo_conto_raf () { return riga()->saldo_conto_raf(); }
void add (int g, int c, long s,
const char * sezione, const char * lettera,
const char * num_rom, const char * num, real saldo, real saldo_raf);
};
void Righe_sez_opp::add(int g, int c, long s,
const char * sezione, const char * lettera,
const char * num_rom, const char * num, real saldo, real saldo_raf)
{
TString80 key; key.format("%s%s%s%s",sezione,lettera,num_rom,num);
TRiga_sez_opp* riga = (TRiga_sez_opp*)objptr(key);
if (riga == NULL)
{
riga = new TRiga_sez_opp (g, c, s, sezione, lettera, num_rom, num, saldo, saldo_raf);
TAssoc_array::add(key,riga);
}
else
{
riga->incrementa_saldo(saldo,saldo_raf);
}
}
class TStampa_IVdirettiva : public TPrintapp
{
static bool data_limite (TMask_field & f,KEY k);
static bool tipo_stampa (TMask_field & f,KEY k);
static bool data_bil_raff (TMask_field & f,KEY k);
static bool tipo_bilancio (TMask_field & f,KEY k);
static bool data_inizio (TMask_field & f,KEY k);
static bool data_fine (TMask_field & f,KEY k);
static bool anno_esercizio (TMask_field & f,KEY k);
struct bil_ivd
{
char sez;
char let;
char numr[5];
char num[7];
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;
bool conto_dettagliato;
};
bil_ivd* _bil;
TMask* _msk;
const char* _buff;
TSort* _sort;
Righe_sez_opp _sezopps;
TSaldi_list* _listasld;
TParagraph_string* _descr,*_d;
TSaldo* _sld;
bool _noseparator;
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,_data_ini_raf;
int _annoese,_annoeserafr,_anno_esercizio,_anno_esercizio_raf;
bool _competenza,_intera_struttura,_stampamov,_stampacod,_stampa_modulo;
bool _sbilancio_patr_gia_stampato,_attivo_o_passivo;
bool _diffprod_fatto,_risimp_fatto;
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;
int _stampa_mov_prov;
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;
real _totale_parziale,_totale_parziale_raf;
real _tot_parz_sld,_tot_parz_sld_d,_tot_parz_sld_a,_tot_parz_prg_d;
real _tot_parz_prg_a,_tot_parz_mov_d,_tot_parz_mov_a;
real _nuovo_tot_saldo_d, _nuovo_tot_saldo_a;
int _i;
bool _reset_righe_stampa,_totale_attivita_gia_stampato,_totale_passivita_gia_stampato,_statopatr_no_stamp;
bool _sbilancio_ordine, _quadratura, _prima_dopo;
long _items_sort;
TString tmp; // Stringa per porcate galattiche
protected:
void aggiungi_anno(int anno, TDate& inizio, TDate& fine);
virtual void on_config_change();
public:
TDate _inizioEs, _fineEs;
int date2esc(const TDate& d);
void esc2date(const int anno, TDate& d1, TDate& d2);
bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; }
virtual bool user_create() ;
virtual bool user_destroy();
bool set_print(int);
virtual bool preprocess_page (int,int);
virtual print_action postprocess_page (int,int);
virtual void postclose_print ();
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();
void init_sort();
void crea_sort_tabella();
void crea_sort_piano_conti_scalare();
void crea_sort_piano_conti_verifica();
void setta_righe_descr(TParagraph_string &, const char*);
void setta_righe_descr_verifica(TParagraph_string &, const char*);
void scrivi_record(const TString&,const TString&,const TString&, const TString&,int,int,long,const real&,const real&,const real&,const real&,const real&,const real&,char,bool conto_dettagliato = true);
void riempi_record(const TString&,const TString&,const TString&, const TString&,int,int,long,const real&,const real&,const real&,const real&,const real&,const real&,char,bool conto_dettagliato = true);
const TString & descrizione_ivd(char, char, int, const char *);
void setta_righe(const char*);
void setta_righe_verifica();
bool devo_stampare_risultato_prima_delle_imposte() const;
void stampa_risultato_prima_delle_imposte();
void stampa_totali();
void stampa_totali_con_raffronto();
void stampa_totali_verifica();
bool calcola_saldo(real&, real&,int,int,long,int);
bool calcola(int,int,long,const TDate&,const TDate&);
bool sottoc_clifo_scalare (int,int,int,int,real&,real&);
void sottoc_clifo_verifica(int,int,int,char,TString&,TString&,TString&, TString&,int,bool);
void stampa_saldo_132(const real&);
void stampa_saldo_198(real&, real&);
void set_bil_key(bil_ivd* b, char sezione, char lettera,
const char* numero_romano, const char * 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,bool conto_dettagliato = true);
TStampa_IVdirettiva() {}
};
HIDDEN inline TStampa_IVdirettiva & a() {return (TStampa_IVdirettiva&) main_app(); }
void TStampa_IVdirettiva::postclose_print()
{
delete _sort;
}
void TStampa_IVdirettiva::aggiungi_anno(int anno, TDate& inizio, TDate& fine)
{
TEsercizi_contabili ese;
if (ese.exist(anno))
{
inizio = ese[anno].inizio();
fine = ese[anno].fine();
}
else
inizio = fine = botime;
}
int TStampa_IVdirettiva::date2esc(const TDate& d)
{
TEsercizi_contabili ese;
return ese.date2esc(d);
}
void TStampa_IVdirettiva::on_config_change()
{
_prima_dopo = ini_get_bool(CONFIG_DITTA, "cg1600", "PrimaDopoImposte");
}
void TStampa_IVdirettiva::set_bil_key(bil_ivd* b, char sezione, char lettera,
const char* numero_romano, const char * numero,
bool conti_ordine, int gruppo, int conto,
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 , "%-6s", 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 TStampa_IVdirettiva::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,bool conto_dettagliato)
{
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;
b->conto_dettagliato = conto_dettagliato;
}
bool TStampa_IVdirettiva::data_limite (TMask_field& f, KEY key)
{
if (key == K_ENTER)
{
TMask& m = f.mask();
int tipobil,tipostampa;
TDate datalim;
TDate in="", fin="";
tipobil = m.get_int(F_TIPOBIL);
tipostampa = m.get_int(F_TIPOSTAMPA);
int annoese = m.get_int(F_ANNOESE);
if ((tipobil == 1) && (tipostampa == 1))
{
datalim = m.get(F_DATALIM);
if (annoese != 0)
{
a().aggiungi_anno(annoese, in, fin);
a()._data_ini_ese = in;
a()._data_fine_ese = fin;
a()._anno_esercizio = annoese;
if (datalim == botime)
a()._datalimite = a()._data_fine_ese;
else
if ((datalim < in)||(datalim > fin))
{
f.error_box(TR("La data limite non appartiene all'esercizio indicato"));
return false;
}
else
a()._datalimite = datalim;
}
else
if (annoese == 0)
{
if (datalim == botime)
{
f.error_box(TR("La data limite deve essere indicata obbligatoriamente"));
return false;
}
int anno = a().date2esc(datalim);
if (anno == 0)
{
f.error_box(TR("La data limite indicata non appartiene ad alcun esercizio attivo della ditta"));
return false;
}
a()._data_ini_ese = a()._inizioEs;
a()._data_fine_ese = a()._fineEs;
a()._datalimite = datalim;
a()._anno_esercizio = anno;
}
}
}
TString data1 = a()._datalimite.string();
TString data2 = a()._data_ini_ese.string();
TString data3 = a()._data_fine_ese.string();
return true;
}
bool TStampa_IVdirettiva::data_bil_raff (TMask_field& f, KEY key)
{
TMask& m = f.mask();
int tipobil,tipostampa;
TDate datalim, dataraf;
TDate in = "", fin = "", in_raf = "", fin_raf = "";
if (key == K_ENTER)
{
tipobil = atoi(m.get(F_TIPOBIL));
tipostampa = atoi(m.get(F_TIPOSTAMPA));
int annoese = m.get_int(F_ANNOESE);
int annoraf = m.get_int(F_ANNORAFFR);
if (tipobil == 1)
{
dataraf = m.get(F_DATABILRAF);
datalim = m.get(F_DATALIM);
if (annoraf == 0)
{
int anno;
if (datalim != botime)
{
a().date2esc(datalim);
in = a()._inizioEs;
}
else
a().aggiungi_anno(annoese, in, fin);
TString instr = in.string();
if (dataraf != botime)
{
anno = a().date2esc(dataraf);
in_raf = a()._inizioEs;
fin_raf = a()._fineEs;
a()._anno_esercizio_raf = anno;
}
else
anno = 1;
if (dataraf > in)
{
f.error_box(TR("La data bilancio da raffrontare non puo' essere maggiore o uguale alla data inizio esercizio in corso"));
return false;
}
if (anno == 0)
{
f.error_box(TR("La data bilancio da raffrontare indicata non appartiene ad alcun esercizio attivo della ditta"));
return false;
}
a()._databilrafr = dataraf;
a()._data_ini_raf = in_raf;
a()._data_fine_raf = fin_raf;
}
else
{
a().aggiungi_anno(annoraf, in_raf, fin_raf);
a()._data_ini_raf = in_raf;
a()._data_fine_raf = fin_raf;
a().aggiungi_anno(annoese,a()._data_ini_ese,a()._data_fine_ese);
if (dataraf == botime)
a()._databilrafr = fin_raf;
else
if (dataraf < in_raf || dataraf > fin_raf)
{
f.error_box(TR("La data bilancio da raffrontare deve appartenere all' esercizio da raffrontare"));
return false;
}
else
a()._databilrafr = dataraf;
a()._anno_esercizio_raf = annoraf;
}
}
} // IF (key == K_ENTER)
TString data1 = in.string();
TString data2 = in_raf.string();
TString data3 = fin_raf.string();
TString data4 = a()._databilrafr.string();
TString data5 = a()._data_ini_raf.string();
TString data6 = a()._data_fine_raf.string();
return true;
}
bool anno_ese_raff (TMask_field& f, KEY key)
{
int annoese, annoraf, anno;
TDate datalim;
if (key == K_ENTER)
{
annoese = f.mask().get_int(F_ANNOESE);
annoraf = f.mask().get_int(F_ANNORAFFR);
if (annoraf != 0)
{
if (annoese != 0)
{
if (annoraf >= annoese)
{
f.error_box(TR("L' anno esercizio da raffrontare deve essere inferiore all' anno esercizio in corso"));
return false;
}
}
else
if (annoese == 0)
{
datalim = f.mask().get(F_DATALIM);
if (datalim != botime)
{
anno = a().date2esc(datalim);
if (annoraf >= anno)
{
f.error_box(TR("L' anno esercizio da raffrontare deve essere inferiore all' anno di esercizio di appartenenza della data limite"));
return false;
}
}
}
}
}
return true;
}
bool TStampa_IVdirettiva::tipo_bilancio (TMask_field& f, KEY key)
{
int tipo_bil, anno, tipo_stampa;
if (key == K_SPACE)
{
tipo_bil = f.mask().get_int(F_TIPOBIL);
if (tipo_bil == 1)
tipo_stampa = f.mask().get_int(F_TIPOSTAMPA);
else
tipo_stampa = f.mask().get_int(F_TIPOSTAMPA1);
anno = f.mask().get_int(F_ANNOESE);
if (tipo_bil == 1)
{
f.mask().hide (98);
f.mask().hide (99);
f.mask().hide(96);
f.mask().hide(97);
}
else
if (tipo_bil == 2)
{
if (tipo_stampa == 1)
{
if (anno != 0)
{
f.mask().show (96);
f.mask().show (97);
f.mask().hide (98);
f.mask().hide (99);
}
else
if (anno == 0)
{
f.mask().show(98);
f.mask().show(99);
f.mask().hide(96);
f.mask().hide(97);
}
}
else
{
f.mask().hide (98);
f.mask().hide (99);
f.mask().hide(96);
f.mask().hide(97);
}
}
if (tipo_bil == 2 && tipo_stampa == 1 && f.mask().get_int(F_ANNOESE) == 0)
f.mask().show(F_QUADRATURA);
else
f.mask().hide(F_QUADRATURA);
}
return true;
}
bool TStampa_IVdirettiva::anno_esercizio (TMask_field& f, KEY key)
{
int tipo_bil, anno;
if (key == K_TAB || f.focusdirty())
{
int tipo_stp;
tipo_bil = f.mask().get_int(F_TIPOBIL);
anno = f.mask().get_int(F_ANNOESE);
if (tipo_bil == 1)
tipo_stp = f.mask().get_int(F_TIPOSTAMPA);
else
tipo_stp = f.mask().get_int(F_TIPOSTAMPA1);
if (tipo_bil == 1)
{
f.mask().hide (98);
f.mask().hide (99);
f.mask().hide(96);
f.mask().hide(97);
}
else
if (tipo_bil == 2)
{
if (tipo_stp == 1)
{
if (anno != 0)
{
f.mask().show (96);
f.mask().show (97);
f.mask().hide (98);
f.mask().hide (99);
}
else
if (anno == 0)
{
f.mask().show(98);
f.mask().show(99);
f.mask().hide(96);
f.mask().hide(97);
}
}
else
{
f.mask().hide (98);
f.mask().hide (99);
f.mask().hide(96);
f.mask().hide(97);
}
}
}
if (key == K_TAB)
{
int tipo_bil, tipo_stp;
tipo_bil = f.mask().get_int(F_TIPOBIL);
if (tipo_bil == 1)
tipo_stp = f.mask().get_int(F_TIPOSTAMPA);
else
tipo_stp = f.mask().get_int(F_TIPOSTAMPA1);
if (tipo_bil == 2 && tipo_stp == 1 && f.mask().get_int(F_ANNOESE) == 0)
f.mask().show(F_QUADRATURA);
else
{
f.mask().set (F_QUADRATURA,"");
f.mask().hide(F_QUADRATURA);
}
}
return true;
}
bool TStampa_IVdirettiva::tipo_stampa(TMask_field& f,KEY k)
{
int tipo_bil, tipo_stampa;
if (k == K_ENTER)
{
tipo_stampa = f.mask().get_int(F_TIPOSTAMPA);
int anno = f.mask().get_int(F_ANNOESE);
if (tipo_stampa == 2)
if (anno == 0)
{
error_box(TR("Nella stampa all'ultima immissione l'anno esercizio e' obbligatorio"));
return false;
}
}
if (k == K_SPACE)
{
int anno = f.mask().get_int(F_ANNOESE);
tipo_bil = f.mask().get_int(F_TIPOBIL);
if (tipo_bil == 1)
tipo_stampa = f.mask().get_int(F_TIPOSTAMPA);
else
tipo_stampa = f.mask().get_int(F_TIPOSTAMPA1);
if (tipo_bil == 1)
{
f.mask().hide (98);
f.mask().hide (99);
f.mask().hide(96);
f.mask().hide(97);
}
else
if (tipo_bil == 2)
{
if (tipo_stampa == 1)
{
if (anno != 0)
{
f.mask().show (96);
f.mask().show (97);
f.mask().hide (98);
f.mask().hide (99);
}
else
if (anno == 0)
{
f.mask().show(98);
f.mask().show(99);
f.mask().hide(96);
f.mask().hide(97);
}
}
else
{
f.mask().hide (98);
f.mask().hide (99);
f.mask().hide(96);
f.mask().hide(97);
}
}
if (tipo_bil == 2 && tipo_stampa == 1 && f.mask().get_int(F_ANNOESE) == 0)
f.mask().show(F_QUADRATURA);
else
f.mask().hide(F_QUADRATURA);
}
return true;
}
bool TStampa_IVdirettiva::data_inizio(TMask_field& f, KEY k)
{
int anno;
TDate data;
TDate in="", fin="";
anno = f.mask().get_int(F_ANNOESE);
data = f.mask().get (F_DATAINI);
//a()._anno_esercizio = anno;
if (k == K_ENTER)
{
if (anno != 0)
{
a().aggiungi_anno(anno, in, fin);
a()._data_ini_ese = in;
a()._data_fine_ese = fin;
a()._anno_esercizio = anno;
if (data == botime)
a()._dataini = in;
else
if (data < in || data > fin)
{
f.error_box(TR("La data non appartiene all' esercizio indicato"));
return false;
}
else
a()._dataini = data;
}
else
{
if (data == botime)
{
f.error_box(TR("La data deve essere obbligatoriamente indicata"));
return false;
}
int anno = a().date2esc(data);
if (anno == 0)
{
f.error_box(TR("La data limite indicata non appartiene ad alcun esercizio attivo della ditta"));
return false;
}
a()._anno_esercizio = anno;
a()._dataini = data;
a()._data_ini_ese = a()._inizioEs;
a()._data_fine_ese = a()._fineEs;
}
}
return true;
}
bool TStampa_IVdirettiva::data_fine(TMask_field& f, KEY k)
{
TMask& m = f.mask();
int annoes;
TDate data, data_ini;
TDate in="", fin="";
annoes = m.get_int(F_ANNOESE);
data = m.get (F_DATAFINE);
data_ini = m.get (F_DATAINI);
if (k == K_TAB)
{
TDate data (f.get());
int bil = m.get_int(F_TIPOBIL);
int anno = a().date2esc(data);
TDate dataini, datafin;
a().aggiungi_anno(anno, dataini, datafin);
if (data == datafin && bil == 2 && annoes == 0)
m.show(F_QUADRATURA);
else
m.hide(F_QUADRATURA);
}
if (k == K_ENTER)
{
if (annoes != 0)
{
a().aggiungi_anno(annoes, in, fin);
a()._data_ini_ese = in;
a()._data_fine_ese = fin;
if (data == botime)
a()._datafine = fin;
else
if (data < in || data > fin)
{
f.error_box(TR("La data non appartiene all' esercizio indicato"));
return false;
}
else
a()._datafine = data;
}
else
{
if (data == botime)
{
f.error_box(TR("La data deve essere obbligatoriamente indicata"));
return false;
}
a().date2esc(data_ini);
if (data < a()._inizioEs || data > a()._fineEs)
{
f.error_box(TR("La data non appartiene all' esercizio indicato"));
return false;
}
else
a()._datafine = data;
}
if (data < data_ini)
{
f.error_box(TR("La data finale non puo' essere inferiore alla data di partenza"));
return false;
}
}
return true;
}
void TStampa_IVdirettiva::scrivi_record(const TString& sez,
const TString& let, const TString& numerorom,const TString & 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,bool conto_dettagliato)
{
//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,conto_dettagliato);
_sort->sort ((const char*) _bil);
}
void TStampa_IVdirettiva::riempi_record(const TString& sez,
const TString& let, const TString& numerorom,const TString & 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,bool conto_dettagliato)
{
if (!(_stampamov && saldo.is_zero() && saldorafr.is_zero()))
{
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,conto_dettagliato);
_sort->sort ((const char*) _bil);
_items_sort++;
}
}
void TStampa_IVdirettiva::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,5);
TRecfield numero (tabivd.curr(),"CODTAB",6,7);
int preclen;
bool FINITO=false;
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);
const TString16 nrom((const char*)numerorom);
const TString16 nu(numero);
set_bil_key(_bil, sez, let,(const char*)nrom, nu, false,-1);
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 TStampa_IVdirettiva::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, numero, num_opp, num_conto;
int indbil;
char sezione,lettera,tmcf;
int g,c;
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;
TProgind prog(pconti.items(),TR("Elaborazione in corso... prego attendere"),false);
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(PCN_NUMIVD);
if (numero.full())
int i = 1;
saldo = ZERO;
saldo_raf = ZERO;
//Anche se il conto non e' da dettagliare ma contiene la classe e' da
//mandare ugualmente in stampa con il totale di tutti i suoi sottoconti letti
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,conto_dettagliato);
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++)
{
TRiga_sez_opp * lriga = _sezopps.riga();
TString4 sez_opp = lriga->sezione();
TString4 let_opp = lriga->lettera();
TString4 numr_opp = lriga->num_rom();
if (numr_opp == " ") //Sembrerebbe che il metodo sezione() quando il numero romano non esiste, ritorni
numr_opp.ltrim(); //una TString contenente uno spazio e non un NULL, sconvolgendo l' ordinamento.
//Per evitare tutto cio' aggiungo il metodo ltrim(), che toglie gli spazi.
//Pero', essendo il numero romano un campo Zerofill, uso ltrim() solo se non c'e'.
const TString16 num_opp(lriga->numero());
real saldo_conto = lriga->saldo_conto();
real saldo_conto_raf = lriga->saldo_conto_raf();
riempi_record(sez_opp,let_opp,numr_opp,num_opp,gruppo_prec,conto_prec,0,saldo_conto,saldo_conto_raf,ZERO,ZERO,ZERO,ZERO,tmcf,conto_dettagliato);
}
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];
indbil = pconti.get_int (PCN_INDBIL);
//Se sono nello stesso gruppo, ma ho un conto diverso da quello precedentemente
//analizzato, e se questi contiene la classe IV dir. CEE,
//allore devo controllare se va dettagliato (STSOTTBIL)
if (sez.not_empty() && sez != "0")
{
if (!stsottbil || tmcf == 'C' || tmcf == 'F')
conto_dettagliato = false;
else
conto_dettagliato = true;
sez_conto = sez;
if (let.not_empty())
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;
if (tmcf == 'C' || tmcf == 'F')
{
if (sottoc_clifo_scalare(g, c,_anno_esercizio,indbil,saldo_conto,saldo_conto_raf))
{
if (sez == "2") //Se la sezione e 2 cambio segno comunque
{
saldo_conto = -saldo_conto;
saldo_conto_raf = -saldo_conto_raf;
}
no_sez_opposta = true;
}
}
}
else
{
classe_conto = false; // Metto conto dettagliato = true perche' potrebbero esserci dei sottoconti
conto_dettagliato = true; // di questo conto che hanno la classe e quindi vanno stampati.
}
}
// Se si tratta di un sottoconto e contiene la classe, allora lo passo al sort.
if ((g != 0) && (c != 0) && (s != 0))
{
bool rec_es_corr = false;
bool rec_es_prec = false;
if (!calcola_saldo(saldo,saldo_raf,g,c,s,indbil))
continue;
// classe_conto indica se il conto precedentemente letto conteneva
// la classe. 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.not_empty() && sez_opp != "0")
{
let_opp = pconti.get(PCN_LETTIVDOPP);
numr_opp = pconti.get(PCN_NUMRIVDOPP);
num_opp = pconti.get_int(PCN_NUMIVDOPP);
if (sez_conto == "1")
{
rec_es_corr = saldo < ZERO;
if (rec_es_corr)
saldo = -saldo;
rec_es_prec = saldo_raf < ZERO;
if (rec_es_prec)
saldo_raf = -saldo_raf;
}
else
if (sez_conto == "2")
{
rec_es_corr = saldo > ZERO;
rec_es_prec = saldo_raf > ZERO;
}
if (rec_es_corr && rec_es_prec)
{
if (conto_dettagliato)
{
_sezopps.add(g,c,s,sez_opp,let_opp,numr_opp,num_opp,saldo,saldo_raf);
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
sez_opposta = true;
}
else
sez_opposta = false;
}
else
if (rec_es_corr)
{
if (conto_dettagliato)
{
_sezopps.add(g,c,s,sez_opp,let_opp,numr_opp,num_opp,saldo,ZERO);
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,saldo,ZERO,ZERO,ZERO,ZERO,ZERO,tmcf);
if (saldo_raf != ZERO)
{
if (sez_conto == "2")
if (saldo_raf < ZERO)
saldo_raf = -saldo_raf;
riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,ZERO,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
saldo_conto_raf += saldo_raf;
no_sez_opposta = true;
}
sez_opposta = true;
}
else
sez_opposta = false;
}
else
if (rec_es_prec)
{
if (conto_dettagliato)
{
_sezopps.add(g,c,s,sez_opp,let_opp,numr_opp,num_opp,ZERO,saldo_raf);
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,ZERO,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
if (saldo != ZERO)
{
if (sez_conto == "2")
if (saldo < ZERO)
saldo = -saldo;
riempi_record(sez_conto,let_conto,numr_conto,num_conto,g,c,s,saldo,ZERO,ZERO,ZERO,ZERO,ZERO,tmcf);
saldo_conto += saldo;
no_sez_opposta = true;
}
sez_opposta = true;
}
else
sez_opposta = false;
}
else
{
if (sez_conto == "2")
{
if (saldo < ZERO)
saldo = -saldo;
if (saldo_raf < ZERO)
saldo_raf = -saldo_raf;
}
if (conto_dettagliato)
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
{
if (sez_conto == "2")
{
saldo = -saldo;
saldo_raf = -saldo_raf;
}
if (conto_dettagliato)
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.not_empty() && sez_opp != "0")
{
let_opp = pconti.get(PCN_LETTIVDOPP);
numr_opp = pconti.get(PCN_NUMRIVDOPP);
num_opp = pconti.get(PCN_NUMIVDOPP);
if (sez == "1")
{
rec_es_corr = saldo < ZERO;
if (rec_es_corr)
saldo = -saldo;
rec_es_prec = saldo_raf < ZERO;
if (rec_es_prec)
saldo_raf = -saldo_raf;
}
else
if (sez == "2")
{
rec_es_corr = saldo > ZERO;
rec_es_prec = saldo_raf > ZERO;
}
if (rec_es_corr && rec_es_prec)
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
else
if (rec_es_corr)
{
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,saldo,ZERO,ZERO,ZERO,ZERO,ZERO,tmcf);
if (saldo_raf != ZERO)
{
if (sez == "2")
if (saldo_raf < ZERO)
saldo_raf = -saldo_raf;
riempi_record(sez,let,numerorom,numero,g,c,s,ZERO,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
}
}
else
if (rec_es_prec)
{
riempi_record(sez_opp,let_opp,numr_opp,num_opp,g,c,s,ZERO,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
if (saldo != ZERO)
{
if (sez == "2")
if (saldo < ZERO)
saldo = -saldo;
riempi_record(sez,let,numerorom,numero,g,c,s,saldo,ZERO,ZERO,ZERO,ZERO,ZERO,tmcf);
}
}
else
if (sez.not_empty() && sez != "0")
{
if (sez == "2")
{
if (saldo < ZERO)
saldo = -saldo;
if (saldo_raf < ZERO)
saldo_raf = -saldo_raf;
}
riempi_record(sez,let,numerorom,numero,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
}
}
else
if (sez.not_empty() && sez != "0")
{
if (sez == "2")
{
saldo = -saldo;
saldo_raf = -saldo_raf;
}
riempi_record(sez,let,numerorom,numero,g,c,s,saldo,saldo_raf,ZERO,ZERO,ZERO,ZERO,tmcf);
}
}
}
}
conto_prec = 0;
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,conto_dettagliato);
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++)
{
TRiga_sez_opp * lriga = _sezopps.riga();
TString sez_opp = lriga->sezione();
TString let_opp = lriga->lettera();
TString numr_opp = lriga->num_rom();
if (numr_opp == " ")
numr_opp.ltrim();
const TString16 num_opp(lriga->numero());
real saldo_conto = lriga->saldo_conto();
real saldo_conto_raf = lriga->saldo_conto_raf();
riempi_record(sez_opp,let_opp,numr_opp,num_opp,gruppo_prec,conto_prec,0,saldo_conto,saldo_conto_raf,ZERO,ZERO,ZERO,ZERO,tmcf,conto_dettagliato);
}
sez_opposta = false;
_sezopps.destroy();
}
}
}
}
void TStampa_IVdirettiva::crea_sort_piano_conti_verifica()
{
TLocalisamfile pconti(LF_PCON);
TString sez,let,numerorom;
TString sez_conto,let_conto,numr_conto, numero, num_conto;
char sezione,lettera,tmcf;
int g,c;
long s;
bool classe_conto = false;
bool conto_dettagliato = 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;
_sld->set_annoes(_anno_esercizio);
saldo_conto = ZERO;
sld_prg_dare_conto = ZERO;
sld_prg_avere_conto = ZERO;
mov_dare_conto = ZERO;
mov_avere_conto = ZERO;
_nuovo_tot_saldo_d = ZERO;
_nuovo_tot_saldo_a = ZERO;
indbil = 0;
gruppo_prec = -1;
conto_prec = -1;
c = 0;
num_conto = 0;
tmcf = ' ';
TProgind prog(pconti.items(),TR("Elaborazione in corso... prego attendere"),false);
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(PCN_NUMIVD);
real app;
saldo = ZERO;
sld_prg_dare = ZERO;
sld_prg_avere = ZERO;
mov_dare = ZERO;
mov_avere = ZERO;
app = ZERO;
//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;
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,conto_dettagliato);
saldo_conto = ZERO;
sld_prg_dare_conto = ZERO;
sld_prg_avere_conto = ZERO;
mov_dare_conto = ZERO;
mov_avere_conto = ZERO;
classe_conto = false;
}
}
// 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);
//Se sono nello stesso gruppo, ma ho un conto diverso da quello precedentemente
//analizzato , se contiene la classe IV dir. CEE
//allora devo controllare se va dettagliato (STSOTTBIL)
if (sez.not_empty() && sez != "0")
{
if ((tmcf == 'C') || (tmcf == 'F'))
{
sottoc_clifo_verifica(g, c,_anno_esercizio, tmcf,sez,let,numerorom, numero,indbil,stsottbil);
continue;
}
else
if (!stsottbil)
conto_dettagliato = false;
else
conto_dettagliato = true;
sez_conto = sez;
if (let.not_empty())
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; // Metto conto dettagliato = true perche' potrebbero esserci dei sottoconti
conto_dettagliato = true; // di questo conto che hanno la classe e quindi vanno stampati.
}
}
// Se si tratta di un sottoconto e contiene la classe, allora lo passo al sort.
if ((g != 0) && (c != 0) && (s != 0))
{
// 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 (_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;
//modifica del 27/11/1995
_nuovo_tot_saldo_d += mov_dare;
_nuovo_tot_saldo_a += mov_avere;
_nuovo_tot_saldo_d += sld_prg_dare;
_nuovo_tot_saldo_a += sld_prg_avere;
//fine modifica
}
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->ultima_immissione_verifica(_anno_esercizio,g,c,s,indbil,_stampa_mov_prov))
continue;
app = _sld->saldoini();
//fine modifica 11/11/1997
if (app < ZERO)
{
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;
//modifica del 05/04/1995
if (!(saldo.is_zero() && _stampamov))
{
_nuovo_tot_saldo_d += mov_dare;
_nuovo_tot_saldo_a += mov_avere;
const real nuovo = _sld->saldoinisusaldi();
if (nuovo >= ZERO)
_nuovo_tot_saldo_d += nuovo;
else
_nuovo_tot_saldo_a -= nuovo;
}
//fine modifica
}
if (classe_conto)
{
if (conto_dettagliato)
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);
if (!(saldo.is_zero() && _stampamov))//Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto
{
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;
}
}
else
{
if (sez.not_empty() && sez != "0")
scrivi_record(sez,let,numerorom,numero,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tmcf);
}
}
}
conto_prec = 0;
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,conto_dettagliato);
saldo_conto = ZERO;
sld_prg_dare_conto = ZERO;
sld_prg_avere_conto = ZERO;
mov_dare_conto = ZERO;
mov_avere_conto = ZERO;
classe_conto = false;
}
}
}
void TStampa_IVdirettiva::sottoc_clifo_verifica(int g,int c,int anno,char tipocf,TString& sez,TString& let,TString& numerorom, TString& numero,int indbil,bool stsottbil)
{
long s;
_listasld = new TSaldi_list (g,c,anno);
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, 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 = _listasld->items();
sez_conto = sez;
if (let.not_empty())
let_conto = let;
else
if ((sez == "1")||(sez == "2"))
let_conto = "Z";
else
let_conto = let;
numr_conto = numerorom;
num_conto = numero;
_listasld->restart();
for (int i=0 ; i < items; i++)
{
const TRectype* r=_listasld->saldi();
if (r == NULL) break;
s = r->get_long(SLD_SOTTOCONTO);
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;
//modifica 27/11/1995
_nuovo_tot_saldo_d += mov_dare;
_nuovo_tot_saldo_a += mov_avere;
_nuovo_tot_saldo_d += sld_prg_dare;
_nuovo_tot_saldo_a += sld_prg_avere;
//fine modifica
}
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)
{
//modifica 05/04/1994
if (!_sld->ultima_immissione_verifica(_anno_esercizio,g,c,s,indbil,_stampa_mov_prov))
{
if (indbil == 1 || indbil == 2 || indbil == 5)
app = _sld->saldofin_esprec(_anno_esercizio,g,c,s);
}
else app = _sld->saldoini();
//fine modifica
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;
//modifica 05/04/1994
if (!(saldo == ZERO && _stampamov))
{
_nuovo_tot_saldo_d += mov_dare;
_nuovo_tot_saldo_a += mov_avere;
real nuovo = _sld->saldoinisusaldi();
if (nuovo > ZERO)
_nuovo_tot_saldo_d += nuovo;
else
{
nuovo = -nuovo;
_nuovo_tot_saldo_a += nuovo;
}
}
//fine modifica
}
if (stsottbil)
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);
if (!(saldo == ZERO && _stampamov)) //Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto
{
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;
}
}
if (items > 0)
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,stsottbil);
saldo_conto = ZERO;
sld_prg_dare_conto = ZERO;
sld_prg_avere_conto = ZERO;
mov_dare_conto = ZERO;
mov_avere_conto = ZERO;
delete _listasld;
}
bool TStampa_IVdirettiva::sottoc_clifo_scalare(int g,int c,int anno,int indbil,real& saldo_conto,real& saldo_conto_raf)
{
long s;
int aep = 0;
if (anno > 0)
{
TEsercizi_contabili ec;
aep = ec.pred(anno);
}
_listasld = new TSaldi_list (g,c,anno,aep);
real saldo,saldo_raf;
bool trovato = false;
int items = _listasld->items();
for (int i=0 ; i < items; i++)
{
const TRectype* r=_listasld->saldi();
if (r == NULL) break;
s = r->get_long(SLD_SOTTOCONTO);
saldo = ZERO;
saldo_raf = ZERO;
if (!calcola_saldo(saldo,saldo_raf,g,c,s,indbil))
continue;
saldo_conto += saldo;
saldo_conto_raf += saldo_raf;
trovato = true;
}
delete _listasld;
return trovato;
}
//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 TStampa_IVdirettiva::calcola_saldo(real& saldo, real& saldo_raf,int g,int c,long s,int indbil)
{
bool no_movimentato = true;
bool no_movimentato_raf = true;
bool esiste = false;
TString saldostr,saldo_rafstr;
_sld->set_annoes(_anno_esercizio);
if (_tipo_bilancio == 1)
{
if (_tipo_stampa == 1) //bilancio per data limite
{
esiste = _sld->data_limite_bilancio(_tipo_stampa,g,c,s,_datai,_datalimite,indbil,_stampa_mov_prov);
saldo = _sld->saldo();
if (!esiste && (!_sld->esiste_saldo() || !_sld->significativo()))
no_movimentato = true;
else
if (!_stampamov)
{
if (saldo == ZERO)
{
if (!_sld->esiste_saldo() || !_sld->significativo())
no_movimentato = true;
else
no_movimentato = false;
}
else
no_movimentato = false;
}
else
{
if (saldo == ZERO)
no_movimentato = true;
else
no_movimentato = false;
}
}
else if (_tipo_stampa == 2)
{
if (!_sld->ultima_immissione_bilancio(_anno_esercizio,g,c,s,indbil,_stampa_mov_prov))
{
if (!_sld->esiste_saldo() || !_sld->significativo())
no_movimentato = true;
else
no_movimentato = false;
}
else
no_movimentato = false;
saldo = _sld->saldo();
}
saldostr = saldo.string();
if (_annoeserafr != 0 || _databilrafr != botime)
{
_sld->set_annoes(_anno_esercizio_raf);
if (_databilrafr != _data_fine_raf) //(_tipo_stampa == 1) bilancio per data limite
{
esiste = _sld->data_limite_bilancio(DataLimite,g,c,s,_datairaf,_databilrafr,indbil,_stampa_mov_prov);
saldo_raf = _sld->saldo();
if (!esiste && (!_sld->esiste_saldo() || !_sld->significativo()))
no_movimentato_raf = true;
else
if (!_stampamov)
{
if (saldo_raf == ZERO)
{
if (!_sld->esiste_saldo() || !_sld->significativo())
no_movimentato_raf = true;
else
no_movimentato_raf = false;
}
else
no_movimentato_raf = false;
}
else
{
if (saldo_raf == ZERO)
no_movimentato_raf = true;
else
no_movimentato_raf = false;
}
}
else if (_databilrafr == _data_fine_raf)
{
if (!_sld->ultima_immissione_bilancio(_anno_esercizio_raf,g,c,s,indbil,_stampa_mov_prov,false)) // W96SALDI : ho aggiunto il parametro false
{ // per dire che nel calcola del saldo non deve
if (!_sld->esiste_saldo() || !_sld->significativo()) // includere il saldo di chiusura
no_movimentato_raf = true;
else
no_movimentato_raf = false;
}
else
no_movimentato_raf = false;
saldo_raf = _sld->saldo();
}
saldo_rafstr = saldo_raf.string();
}
}
if ((no_movimentato) && (no_movimentato_raf))
return false;
else
return true;
}
bool TStampa_IVdirettiva::calcola(int g, int c, long s,
const TDate& fine_es, const TDate& fine_es_prec)
{
TLocalisamfile rmov(LF_RMOV);
TLocalisamfile mov (LF_MOV);
TDecoder causali(LF_CAUSALI, CAU_MOVAP);
TString sezione;
real importo;
int annoe;
long num_reg;
char provvis;
TDate datareg, datacomp, data;
bool conto_mov = false;
_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);
datareg = rmov.get_date(RMV_DATAREG);
num_reg = rmov.get_long(RMV_NUMREG);
sezione = rmov.get(RMV_SEZIONE);
importo = rmov.get_real(RMV_IMPORTO);
mov.setkey(1);
mov.zero();
mov.put(MOV_NUMREG, num_reg);
mov.read();
if (mov.bad()) mov.zero();
provvis = mov.get_char(MOV_PROVVIS);
datacomp = mov.get_date(MOV_DATACOMP);
if (_stampa_mov_prov == 1 && provvis != '\0') //bilancio normale (non comprende i provvisori)
continue;
if (_stampa_mov_prov == 3 && provvis == '\0') //bilancio dei soli provvisori
continue;
const TString& codcaus = mov.get(MOV_CODCAUS);
char movap = causali.decode(codcaus)[0];
movap = toupper(movap);
if (movap == 'C' && // la causale e' di chiusura
!_quadratura) // Non e' richiesta la quadratura con il Libro Giornale (Modifica
continue; // del 18-06-96 richiesta da Patrizia in seguito alla modifica dei SALDI
if (_annoese == 0)
data = datareg;
if (_annoese != 0)
data = datacomp;
if (importo == ZERO)
continue;
//calcolo i movimenti del periodo
if ( (data >= _dataini) && (data <= _datafine) )
if ((movap == 'A' && _data_ini_ese != _dataini) || (movap != 'A'))
{
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 (movap == 'A')
{
if (data >= _data_ini_ese && data <= _datafine)
{
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 >= _data_ini_ese) && (data < _dataini) )
{
if (sezione == "D")
_prg_prec_dare += importo;
else _prg_prec_avere += importo;
conto_mov = true;
}
}
return conto_mov;
}
bool TStampa_IVdirettiva::set_print(int)
{
KEY tasto = _msk->run();
if (tasto == K_ENTER)
{
_datastampa = _msk->get(F_DATASTAMPA);
_annoese = _msk->get_int(F_ANNOESE);
_annoeserafr = _msk->get_int(F_ANNORAFFR);
_intera_struttura = _msk->get_bool(F_STAMPAINT);
_stampamov = _msk->get_bool(F_STAMPAMOV);
_stampacod = _msk->get_bool(F_STAMPACOD);
_stampa_modulo = _msk->get_bool(F_STAMPAMODULO);
_tipo_bilancio = _msk->get_int(F_TIPOBIL);
_stampa_mov_prov = _msk->get_int(F_STAMPAMOVPROV);
_quadratura = _msk->get_bool(F_QUADRATURA);
_noseparator = _msk->get_bool(F_SEPARATOR);
if (_tipo_bilancio == 1)
_tipo_stampa = _msk->get_int(F_TIPOSTAMPA);
else
_tipo_stampa = _msk->get_int(F_TIPOSTAMPA1);
if (_tipo_stampa == 2)
{
_anno_esercizio = _annoese;
_anno_esercizio_raf = _annoeserafr;
}
_cont_let = 0;
_cont_numr = 0;
_cont_num = 0;
_cont_gcs = 0;
_reset_righe_stampa = true;
if (_tipo_bilancio == 1)
set_real_picture("###.###.###.###.###");
else
{
if (_noseparator)
set_real_picture("################");
else
set_real_picture("####.###.###.###");
}
set_magic_currency(true);
set_print_zero(true);
_totale_attivita_gia_stampato = false;
_totale_passivita_gia_stampato = false;
_statopatr_no_stamp = true;
_diffprod_fatto = true;
_risimp_fatto = true;
_sbilancio_ordine = false;
_sbilancio_patr_gia_stampato = false;
_attivo_o_passivo = false;
_sez_stamp = ' ';
_let_stamp = ' ';
_numr_stamp = "";
_num_stamp = "";
_sez_tot = ' ';
_let_tot = ' ';
_numr_tot = "";
_num_tot = "";
_sale = _salerafr = _totale_ordine = _totale_economico = ZERO;
_totale_ordine_raf = _totale_economico_raf = _totale_numero = ZERO;
_totale_numr = _totale_lettera = _totale_sezione = ZERO;
_totale_patrimoniale = _totale_attivita = _totale_passivita = ZERO;
_totale_num_raf = _totale_numr_raf = _totale_let_raf = ZERO;
_totale_sez_raf = _totale_patrim_raf = _totale_attiv_raf = ZERO;
_totale_passiv_raf = _totale_ordine_attivo = _totale_ordine_passivo = ZERO;
_totale_ordine_attivo_raf = _totale_ordine_passivo_raf = ZERO;
_mov_periodo_dare = _mov_periodo_avere = _prg_prec_dare = ZERO;
_prg_prec_avere = _saldo_ini_dare = _saldo_ini_avere = ZERO;
_sld_prg_dare = _sld_prg_avere = _mov_dare = _mov_avere = ZERO;
_tot_num_saldo = _tot_numr_saldo = _tot_let_saldo = _tot_gen_saldo = ZERO;
_tot_num_prg_d = _tot_numr_prg_d = _tot_let_prg_d = _tot_gen_prg_d = ZERO;
_tot_num_prg_a = _tot_numr_prg_a = _tot_let_prg_a = _tot_gen_prg_a = ZERO;
_tot_num_mov_d = _tot_numr_mov_d = _tot_let_mov_d = _tot_gen_mov_d = ZERO;
_tot_num_mov_a = _tot_numr_mov_a = _tot_let_mov_a = _tot_gen_mov_a = ZERO;
_tot_num_saldo_d = _tot_numr_saldo_d = _tot_let_saldo_d = ZERO;
_tot_gen_saldo_d = _tot_num_saldo_a = _tot_numr_saldo_a = ZERO;
_tot_let_saldo_a = _tot_gen_saldo_a = _totale_parziale = ZERO;
_totale_parziale_raf = _tot_parz_sld = _tot_parz_sld_d = ZERO;
_tot_parz_sld_a = _tot_parz_prg_d = _tot_parz_prg_a = ZERO;
_tot_parz_mov_d = _tot_parz_mov_a = ZERO;
_datai = _data_ini_ese;
_datairaf = _data_ini_raf;
TString data1 = _data_ini_ese.string();
TString data2 = _data_ini_raf.string();
// Se si tratta di stampa intera struttura allora passo al sort anche tutte
// le classi presenti sulla tabella IV dir. CEE, altrimenti passo solamente
// le classi associate ai conti/sottoconti del Piano dei conti.
_items_sort = 0;
init_sort();
if (_intera_struttura)
crea_sort_tabella();
if (_tipo_bilancio == 1)
crea_sort_piano_conti_scalare();
else
crea_sort_piano_conti_verifica();
_sort->endsort();
crea_intestazione();
delete _bil;
return true;
}
return false;
}
// Lo so, fa schifo: ma mi sono adeguato (Guy)
bool TStampa_IVdirettiva::devo_stampare_risultato_prima_delle_imposte() const
{
if (!_risimp_fatto)
return false;
if (_sez_da_stamp != '9')
return false;
if (_let_da_stamp != 'E')
return false;
if (atoi(_num_da_stamp) < 22)
return false;
return true;
}
void TStampa_IVdirettiva::stampa_risultato_prima_delle_imposte()
{
if (_risimp_fatto) // Ottimo flag che significa esattamente l'opposto! Grazie PRASSI!
{
const bool raff = _annoeserafr > 0 || _databilrafr.ok();
if (_let_da_stamp == 'E' && atoi(_num_da_stamp) > 21 && // questa prima parte e' sempre true!
!_totale_parziale.is_zero() && !_totale_parziale_raf.is_zero())
{
set_row (_i,"@4g%s@81g%r", TR("Totale delle partite straordinarie"), &_totale_parziale);
if (raff)
set_row (_i,"@111g%r", &_totale_parziale_raf);
_i++;
}
// Guy was here 05/03/2004: La prima imposta a volte e' gia' stata sommata
const real te = _totale_economico - (_prima_dopo ? _sale : ZERO);
set_row (_i,"@4g%s@81g%r", TR("Risultato prima delle imposte"), &te);
if (raff)
{
// Guy was here 10/03/2004: La prima imposta a volte e' gia' stata sommata anche qui
const real te = _totale_economico_raf - (_prima_dopo ? _salerafr : ZERO);
set_row (_i,"@111g%r", &te);
}
_i++;
_risimp_fatto = false;
}
}
void TStampa_IVdirettiva::stampa_totali()
{
bool gia_stampato_conto_ord = false;
const char* diff_prod = "9B";
TString16 classe;
classe.format("%c%c%8s%s", _sez_da_stamp,_let_da_stamp,(const char*)_numr_da_stamp,(const char*)_num_da_stamp);
_num = _num_tot;
_numr = _numr_tot;
_let = _let_tot;
if (_buff == NULL)
{
_num_tot = "";
_numr_tot = "";
_let_tot = ' ';
_sez_tot = ' ';
}
if ((_sez_stamp == '1' || _sez_stamp == '2') && _let_stamp != 'Z')
_attivo_o_passivo = true;
if (_num_da_stamp!=_num_tot)
{
if (_let_stamp != 'Z')
{
if (_sez_stamp != '5')
if (_cont_gcs != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale@25g%s)"), num2str(_num));
set_row (_i++,"@81g%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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale@25g%s)"), num2str(_num));
set_row (_i++,"@81g%r", &_totale_numero);
}
}
if (_cont_num != 0)//(_cont_num >= 2)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale@21g%s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
}
}
}
}
_cont_gcs = 0;
_cont_num = 0;
_totale_numero = 0;
_totale_numr = 0;
}
if (_let_da_stamp!=_let_tot)
{
if (_sez_stamp == '9')
{
TString16 classe;
classe.format("%c%c%8s%s",_sez_stamp,_let_stamp,(const char*)_numr_stamp,(const char*)_num_stamp);
if (_cont_gcs != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale@25g%s)"), num2str(_num));
set_row (_i++,"@81g%r", &_totale_numero);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
const int numeror = atoi(_numr);
if (numeror > 0)
{
TString numrom = itor(numeror);
set_row (_i,FR("@14gTotale@21g%s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let_stamp == 'D')
set_row (_i,FR("@4gTotale delle rettifiche"));
else
if (_let != ' ')
if (_sez_stamp == '9' && _let_stamp != 'E')
set_row (_i,FR("@3gTotale@10g%c)"), _let);
else
if (_sez_stamp != '9')
set_row (_i,FR("@3gTotale@10g%c)"), _let);
if (_let != ' ')
{
if (_sez_stamp == '9' && _let_stamp != 'E')
set_row (_i++,"@81g%r", &_totale_lettera);
else
if (_sez_stamp != '9')
set_row (_i++,"@81g%r", &_totale_lettera);
}
}
if (classe > diff_prod && _diffprod_fatto)
{
if (_let_tot == 'A' || _let_tot == 'B') //Solo se esiste una delle due lettere
{
set_row (_i++,FR("@4gDifferenza tra valore e costi della produzione@81g%r"), &_totale_economico);
_diffprod_fatto = false;
}
}
}
else
{
if (_let_stamp != 'Z')
{
if (_sez_stamp != '5')
{
if (_cont_gcs != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale@25g%s)"), num2str(_num));
set_row (_i++,"@81g%r", &_totale_numero);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale@21g%s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let != ' ')
{
set_row (_i,FR("@3gTotale@10g%c)"), _let);
set_row (_i++,"@81g%r", &_totale_lettera);
}
}
}
}
if ((_sez_stamp == '1')&&(_let_da_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE ATTIVO"));
set_row (_i++,"@81g%r", &_totale_sezione);
_totale_attivita = _totale_sezione;
_totale_sezione = ZERO;
_totale_attivita_gia_stampato = true;
}
if ((_sez_stamp == '2')&&(_let_da_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE PASSIVO"));
set_row (_i++,"@81g%r", &_totale_sezione);
_totale_passivita = _totale_sezione;
_totale_sezione = ZERO;
_totale_passivita_gia_stampato = true;
}
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE ATTIVI"));
set_row (_i++,"@81g%r", &_totale_ordine_attivo);
gia_stampato_conto_ord = true;
}
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE PASSIVI"));
set_row (_i++,"@81g%r", &_totale_ordine_passivo);
_i++;
if (!_attivo_o_passivo)
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo;
if (totale != ZERO)
{
set_row (_i++,TR("SALDO CONTI D'ORDINE"));
set_row (_i,TR("SBILANCIO"));
set_row (_i++,"@81g%r", &totale);
}
_totale_ordine_attivo = ZERO;
_totale_ordine_passivo = ZERO;
_sbilancio_ordine = true;
}
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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale@25g%s)"), num2str(_num));
set_row (_i++,"@81g%r", &_totale_numero);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale@21g%s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let != ' ')
{
if ((_sez_stamp == '9' && _let_stamp != 'E') || (_sez_stamp != '9'))
{
set_row (_i,FR("@3gTotale@10g%c)"), _let);
set_row (_i++,"@81g%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,TR("TOTALE ATTIVO"));
set_row (_i++,"@81g%r", &_totale_sezione);
_totale_attivita = _totale_sezione;
_totale_sezione = ZERO;
}
if (!_totale_passivita_gia_stampato)
if ((_sez_stamp == '2') && (_let_stamp != 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE PASSIVO"));
set_row (_i++,"@81g%r", &_totale_sezione);
_totale_passivita = _totale_sezione;
_totale_sezione = ZERO;
}
if (!gia_stampato_conto_ord)
{
if (_sez_stamp == '2')
{
if (!_sbilancio_patr_gia_stampato)
{
_totale_patrimoniale = _totale_attivita - _totale_passivita;
if (_totale_patrimoniale != ZERO)
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO STATO PATRIMONIALE"));
set_row (_i,TR("SBILANCIO (ATTIVO - PASSIVO)"));
set_row (_i++,"@81g%r", &_totale_patrimoniale);
_totale_patrimoniale = ZERO;
}
_sbilancio_patr_gia_stampato = true;
}
}
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE ATTIVI"));
set_row (_i++,"@81g%r", &_totale_ordine_attivo);
}
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE PASSIVI"));
set_row (_i++,"@81g%r", &_totale_ordine_passivo);
_i++;
if (!_sbilancio_ordine)
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo;
if (totale != ZERO)
{
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO CONTI D'ORDINE"));
set_row (_i,TR("SBILANCIO"));
set_row (_i++,"@81g%r", &totale);
_sbilancio_ordine = true;
}
_totale_ordine_passivo = ZERO;
_totale_ordine_attivo = ZERO;
}
}
}
if (_sez_stamp == '2')
{
char app = ' ';
if (!_sbilancio_patr_gia_stampato)
{
_totale_patrimoniale = _totale_attivita - _totale_passivita;
if (_totale_patrimoniale != ZERO)
{
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO STATO PATRIMONIALE"));
set_row (_i,TR("SBILANCIO (ATTIVO - PASSIVO)"));
set_row (_i++,"@81g%r", &_totale_patrimoniale);
_totale_patrimoniale = ZERO;
}
}
if (!_sbilancio_ordine)
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo;
if (totale != ZERO && !_sbilancio_ordine)
{
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO CONTI D'ORDINE"));
set_row (_i,TR("SBILANCIO"));
set_row (_i++,"@81g%r", &totale);
}
}
}
if (_sez_stamp == '5')
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE"));
set_row (_i++,"@81g%r", &_totale_ordine);
_totale_ordine = ZERO;
}
if (_sez_stamp == '9')
{
if (_buff == NULL)
{
if ((_let_stamp == 'A' || _let_stamp == 'B') && _diffprod_fatto)//Solo se esiste una delle due lettere
{
set_row (_i++,FR("@4gDifferenza tra valore e costi della produzione@81g%r"), &_totale_economico);
_diffprod_fatto = false;
}
}
char app = ' ';
set_row (_i++,"@0g%c", app);
if (_totale_economico != ZERO)
{
set_row (_i,TR("RISULTATO CONTO ECONOMICO"));
set_row (_i++,"@81g%r", &_totale_economico);
_totale_economico = ZERO;
}
}
_cont_gcs = 0;
_cont_num = 0;
_cont_numr = 0;
_cont_let = 0;
_totale_numero = 0;
_totale_numr = 0;
_totale_lettera = 0;
}
}
void TStampa_IVdirettiva::stampa_totali_con_raffronto()
{
bool gia_stampato_conto_ord = false;
const char* const diff_prod = "9B";
TString16 classe;
classe.format("%c%c%8s%s", _sez_da_stamp,_let_da_stamp,(const char*)_numr_da_stamp,(const char*)_num_da_stamp);
_num = _num_tot;
_numr = _numr_tot;
_let = _let_tot;
if (_buff == NULL)
{
_num_tot = "";
_numr_tot = "";
_let_tot = ' ';
_sez_tot = ' ';
}
if ((_sez_stamp == '1' || _sez_stamp == '2') && _let_stamp != 'Z')
_attivo_o_passivo = true;
if (_num_da_stamp!=_num_tot)
{
if (_let_stamp != 'Z')
{
if (_sez_stamp != '5' && _cont_gcs != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale %s)"), num2str(_num));
set_row (_i,"@81g%r", &_totale_numero);
set_row (_i++,"@111g%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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale %s)"), num2str(_num));
set_row (_i,"@81g%r", &_totale_numero);
set_row (_i++,"@111g%r", &_totale_num_raf);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString16 numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale %s"), (const char*) numrom);
set_row (_i,"@81g%r", &_totale_numr);
set_row (_i++,"@111g%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 (_sez_stamp == '9')
{
TString16 classe;
classe.format("%c%c%8s%s",_sez_stamp,_let_stamp,(const char*)_numr_stamp,(const char*)_num_stamp);
if (_cont_gcs != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale %s)"), num2str(_num));
set_row (_i++,"@81g%r", &_totale_numero);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale %s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let_stamp == 'D')
set_row (_i,FR("@4gTotale delle rettifiche"));
else
{
if (_let != ' ')
if (_sez_stamp == '9' && _let_stamp != 'E')
set_row (_i,FR("@3gTotale %c)"), _let);
else
if (_sez_stamp != '9')
set_row (_i,FR("@3gTotale %c)"), _let);
set_row (_i,FR("@3gTotale %c)"), _let);
}
if (_let != ' ')
{
if (_sez_stamp == '9' && _let_stamp != 'E')
{
set_row (_i,"@81g%r", &_totale_lettera);
set_row (_i++,"@111g%r", &_totale_let_raf);
}
else
if (_sez_stamp != '9')
{
set_row (_i,"@81g%r", &_totale_lettera);
set_row (_i++,"@111g%r", &_totale_let_raf);
}
}
}
if (classe > diff_prod && _diffprod_fatto)
{
if (_let_tot == 'A' || _let_tot == 'B')
{
set_row (_i++,FR("@4gDifferenza tra valore e costi della produzione@81g%r@111g%r"), &_totale_economico,&_totale_economico_raf);
_diffprod_fatto = false;
}
}
}
else
{
if (_let_stamp != 'Z')
{
if (_sez_stamp != '5')
{
if (_cont_gcs != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale@25g%s)"), num2str(_num));
set_row (_i,"@81g%r", &_totale_numero);
set_row (_i++,"@111g%r", &_totale_num_raf);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale@21g%s"), (const char*) numrom);
set_row (_i,"@81g%r", &_totale_numr);
set_row (_i++,"@111g%r", &_totale_numr_raf);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let != ' ')
{
set_row (_i,FR("@3gTotale %c)"), _let);
set_row (_i,"@81g%r", &_totale_lettera);
set_row (_i++,"@111g%r", &_totale_let_raf);
}
}
}
}
if ((_sez_stamp == '1')&&(_let_da_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE ATTIVO"));
set_row (_i,"@81g%r", &_totale_sezione);
set_row (_i++,"@111g%r", &_totale_sez_raf);
_totale_attivita = _totale_sezione;
_totale_attiv_raf = _totale_sez_raf;
_totale_sezione = ZERO;
_totale_sez_raf = ZERO;
_totale_attivita_gia_stampato = true;
}
if ((_sez_stamp == '2')&&(_let_da_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE PASSIVO"));
set_row (_i,"@81g%r", &_totale_sezione);
set_row (_i++,"@111g%r", &_totale_sez_raf);
_totale_passivita = _totale_sezione;
_totale_passiv_raf = _totale_sez_raf;
_totale_sezione = ZERO;
_totale_sez_raf = ZERO;
_totale_passivita_gia_stampato = true;
}
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE ATTIVI"));
set_row (_i,"@81g%r", &_totale_ordine_attivo);
set_row (_i++,"@111g%r", &_totale_ordine_attivo_raf);
gia_stampato_conto_ord = true;
}
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE PASSIVI"));
set_row (_i,"@81g%r", &_totale_ordine_passivo);
set_row (_i++,"@111g%r", &_totale_ordine_passivo_raf);
_i++;
gia_stampato_conto_ord = true;
if (!_attivo_o_passivo)
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo;
real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf;
if (totale != ZERO || tot_raf != ZERO)
{
set_row (_i++,TR("SALDO CONTI D'ORDINE"));
set_row (_i,TR("SBILANCIO"));
set_row (_i,"@81g%r", &totale);
set_row (_i++,"@111g%r", &tot_raf);
}
_totale_ordine_attivo = ZERO;
_totale_ordine_attivo_raf = ZERO;
_totale_ordine_passivo = ZERO;
_totale_ordine_passivo_raf = ZERO;
_sbilancio_ordine = true;
_sbilancio_patr_gia_stampato = true; //Se passa di qui non ci sono ne attivi ne passivo
}
}
}
_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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (_num.not_empty())
{
set_row (_i,FR("@18gTotale %s)"), num2str(_num));
set_row (_i,"@81g%r", &_totale_numero);
set_row (_i++,"@111g%r", &_totale_num_raf);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
set_row (_i,FR("@14gTotale %s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
set_row (_i++,"@111g%r", &_totale_numr_raf);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let != ' ')
{
if (_sez_stamp == '9' && _let_stamp != 'E')
{
set_row (_i,FR("@3gTotale %c)"), _let);
set_row (_i++,"@81g%r", &_totale_lettera);
set_row (_i++,"@111g%r", &_totale_let_raf);
}
else
if (_sez_stamp != '9')
{
set_row (_i,FR("@3gTotale %c)"), _let);
set_row (_i++,"@81g%r", &_totale_lettera);
set_row (_i++,"@111g%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,TR("TOTALE ATTIVO"));
set_row (_i,"@81g%r", &_totale_sezione);
set_row (_i++,"@111g%r", &_totale_sez_raf);
_totale_attivita = _totale_sezione;
_totale_attiv_raf = _totale_sez_raf;
_totale_sezione = ZERO;
_totale_sez_raf = ZERO;
_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,TR("TOTALE PASSIVO"));
set_row (_i,"@81g%r", &_totale_sezione);
set_row (_i++,"@111g%r", &_totale_sez_raf);
_totale_passivita = _totale_sezione;
_totale_passiv_raf = _totale_sez_raf;
_totale_sezione = ZERO;
_totale_sez_raf = ZERO;
_totale_passivita_gia_stampato = true;
}
if (!gia_stampato_conto_ord)
{
if (_sez_stamp == '2')
{
if (!_sbilancio_patr_gia_stampato)
{
_totale_patrimoniale = _totale_attivita - _totale_passivita;
_totale_patrim_raf = _totale_attiv_raf - _totale_passiv_raf;
if (_totale_patrimoniale != ZERO || _totale_patrim_raf != ZERO)
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO STATO PATRIMONIALE"));
set_row (_i,TR("SBILANCIO (ATTIVO - PASSIVO)"));
set_row (_i,"@81g%r", &_totale_patrimoniale);
set_row (_i++,"@111g%r", &_totale_patrim_raf);
_totale_patrimoniale = 0;
_totale_patrim_raf = 0;
}
_sbilancio_patr_gia_stampato = true;
}
}
if ((_sez_stamp == '1')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE ATTIVI"));
set_row (_i,"@81g%r", &_totale_ordine_attivo);
set_row (_i++,"@111g%r", &_totale_ordine_attivo_raf);
}
if ((_sez_stamp == '2')&&(_let_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE PASSIVI"));
set_row (_i,"@81g%r", &_totale_ordine_passivo);
set_row (_i++,"@111g%r", &_totale_ordine_passivo_raf);
_i++;
if (!_sbilancio_ordine)
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo;
real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf;
if (totale != ZERO || tot_raf != ZERO)
{
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO CONTI D'ORDINE"));
set_row (_i,TR("SBILANCIO"));
set_row (_i,"@81g%r", &totale);
set_row (_i++,"@111g%r", &tot_raf);
_sbilancio_ordine = true;
}
_totale_ordine_attivo = ZERO;
_totale_ordine_attivo_raf = ZERO;
_totale_ordine_passivo = ZERO;
_totale_ordine_passivo_raf = ZERO;
_sbilancio_ordine = true;
}
}
}
if (_sez_stamp == '2')
{
char app = ' ';
if (!_sbilancio_patr_gia_stampato)
{
_totale_patrimoniale = _totale_attivita - _totale_passivita;
_totale_patrim_raf = _totale_attiv_raf - _totale_passiv_raf;
if (_totale_patrimoniale != ZERO || _totale_patrim_raf != ZERO)
{
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO STATO PATRIMONIALE"));
set_row (_i,TR("SBILANCIO (ATTIVO - PASSIVO)"));
set_row (_i,"@81g%r", &_totale_patrimoniale);
set_row (_i++,"@111g%r", &_totale_patrim_raf);
_totale_patrimoniale = 0;
_totale_patrim_raf = 0;
}
}
if (!_sbilancio_ordine)
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo;
real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf;
if ((totale != ZERO || tot_raf != ZERO) && !_sbilancio_ordine)
{
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("SALDO CONTI D'ORDINE"));
set_row (_i,TR("SBILANCIO"));
set_row (_i,"@81g%r", &totale);
set_row (_i++,"@111g%r", &tot_raf);
}
}
}
if (_sez_stamp == '5')
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i,TR("TOTALE CONTI D'ORDINE"));
set_row (_i,"@81g%r", &_totale_ordine);
set_row (_i++,"@111g%r", &_totale_ordine_raf);
_totale_ordine = 0;
_totale_ordine_raf = 0;
}
if (_sez_stamp == '9')
{
if (_buff == NULL)
{
if ((_let_stamp == 'A' || _let_stamp == 'B') && _diffprod_fatto)
{
set_row (_i++,FR("@4gDifferenza tra valore e costi della produzione@81g%r@111g%r"), &_totale_economico,&_totale_economico_raf);
_diffprod_fatto = false;
}
}
char app = ' ';
set_row (_i++,"@0g%c", app);
if (_totale_economico != ZERO || _totale_economico_raf != ZERO)
{
set_row (_i,TR("RISULTATO CONTO ECONOMICO"));
set_row (_i,"@81g%r", &_totale_economico);
set_row (_i++,"@111g%r", &_totale_economico_raf);
_totale_economico = ZERO;
_totale_economico_raf = ZERO;
}
}
_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 TStampa_IVdirettiva::stampa_totali_verifica()
{
const char* const ris_imp = "9E 21";
bool total_printed = false;
_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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (((_sez == '1')||(_sez == '2')||(_sez == '9'))&&(_let != 'Z'))
{
if (_num.not_empty())
{
set_row (_i,FR("@8gTotale@15g%s)"), num2str(_num));
total_printed = true;
}
}
else
if (_num.not_empty())
{
set_row (_i,FR("@8gTotale"));
total_printed = true;
}
if (_num.not_empty())
{
if (_tot_num_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_num_prg_d);
if (_tot_num_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_num_prg_a);
set_row (_i,"@81g%r", &_tot_num_mov_d);
set_row (_i,"@98g%r", &_tot_num_mov_a);
if (!_stampa_modulo)
stampa_saldo_132(_tot_num_saldo);
else
stampa_saldo_198(_tot_num_saldo_d,_tot_num_saldo_a);
}
if (_sez_stamp == '9')
{
TString16 classe;
classe.format("%c%c%8s%s", _sez_da_stamp,_let_da_stamp,(const char*)_numr_da_stamp,(const char*)_num_da_stamp);
if (classe > ris_imp && _risimp_fatto)
{
if (_num_tot == "20" || _num_tot == "21")
{
set_row (_i,FR("@4gTotale delle partite straordinarie"));
if (_tot_parz_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_parz_prg_d);
if (_tot_parz_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_parz_prg_a);
set_row (_i,"@81g%r", &_tot_parz_mov_d);
set_row (_i,"@98g%r", &_tot_parz_mov_a);
_risimp_fatto = false;
if (_num.not_empty())
{
if (!_stampa_modulo)
stampa_saldo_132(_tot_parz_sld);
else
stampa_saldo_198(_tot_parz_sld_d,_tot_parz_sld_a);
}
}
}
}
}
_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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (((_sez == '1')||(_sez == '2')||(_sez == '9'))&&(_let != 'Z'))
{
if (_num.not_empty())
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale@15g%s)"), num2str(_num));
total_printed = true;
}
}
else
if (_num.not_empty())
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale"));
total_printed = true;
}
if (_num.not_empty())
{
if (_tot_num_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_num_prg_d);
if (_tot_num_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_num_prg_a);
set_row (_i,"@81g%r", &_tot_num_mov_d);
set_row (_i,"@98g%r", &_tot_num_mov_a);
if (!_stampa_modulo)
stampa_saldo_132(_tot_num_saldo);
else
stampa_saldo_198(_tot_num_saldo_d,_tot_num_saldo_a);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale@15g%s"), (const char*) numrom);
total_printed = true;
if (_tot_numr_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_numr_prg_d);
if (_tot_numr_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_numr_prg_a);
set_row (_i,"@81g%r", &_tot_numr_mov_d);
set_row (_i,"@98g%r", &_tot_numr_mov_a);
if (!_stampa_modulo)
stampa_saldo_132(_tot_numr_saldo);
else
stampa_saldo_198(_tot_numr_saldo_d,_tot_numr_saldo_a);
}
}
_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 != 0)
{
//Fai il totale del numero arabo e stampalo
if (((_sez == '1')||(_sez == '2')||(_sez == '9'))&&(_let != 'Z'))
{
if (_num.not_empty())
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale@15g%s)"), num2str(_num));
total_printed = true;
}
}
else
if (_num.not_empty())
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale"));
total_printed = true;
}
if (_num.not_empty())
{
if (_tot_num_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_num_prg_d);
if (_tot_num_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_num_prg_a);
set_row (_i,"@81g%r", &_tot_num_mov_d);
set_row (_i,"@98g%r", &_tot_num_mov_a);
if (!_stampa_modulo)
stampa_saldo_132(_tot_num_saldo);
else
stampa_saldo_198(_tot_num_saldo_d,_tot_num_saldo_a);
}
}
if (_cont_num != 0)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi(_numr);
TString numrom = itor(numeror);
if (numrom.not_empty())
{
if (total_printed) _i++;
set_row (_i, FR("@8gTotale@15g%s"), (const char*)numrom);
total_printed = true;
if (_tot_numr_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_numr_prg_d);
if (_tot_numr_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_numr_prg_a);
set_row (_i,"@81g%r", &_tot_numr_mov_d);
set_row (_i,"@98g%r", &_tot_numr_mov_a);
if (!_stampa_modulo)
stampa_saldo_132(_tot_numr_saldo);
else
stampa_saldo_198(_tot_numr_saldo_d,_tot_numr_saldo_a);
}
}
if (_cont_numr != 0)
{
//Fai il totale della lettera e stampalo
if (_let != ' ')
{
if (_sez_stamp == '9' && _let_stamp != 'E')
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale@15g%c)"), _let);
total_printed = true;
if (_tot_let_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_let_prg_d);
if (_tot_let_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_let_prg_a);
set_row (_i,"@81g%r", &_tot_let_mov_d);
set_row (_i,"@98g%r", &_tot_let_mov_a);
}
else
if (_sez_stamp != '9')
{
if (total_printed) _i++;
set_row (_i,FR("@8gTotale@15g%c)"), _let);
total_printed = true;
if (_tot_let_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_let_prg_d);
if (_tot_let_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_let_prg_a);
set_row (_i,"@81g%r", &_tot_let_mov_d);
set_row (_i,"@98g%r", &_tot_let_mov_a);
}
}
if (!_stampa_modulo)
{
if (_let != ' ')
if (_sez_stamp == '9' && _let_stamp != 'E')
stampa_saldo_132(_tot_let_saldo);
else
if (_sez_stamp != '9')
stampa_saldo_132(_tot_let_saldo);
}
else
{
if (_let != ' ')
if (_sez_stamp == '9' && _let_stamp != 'E')
stampa_saldo_198(_tot_let_saldo_d,_tot_let_saldo_a);
else
stampa_saldo_198(_tot_let_saldo_d,_tot_let_saldo_a);
}
}
_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 TStampa_IVdirettiva::stampa_saldo_198(real& saldo_d,real& saldo_a)
{
set_row (_i,"@46g!@80g!@114g!%r@132g%r", &saldo_d, &saldo_a);
saldo_d = saldo_a = ZERO;
}
void TStampa_IVdirettiva::stampa_saldo_132(const real& saldo)
{
real sld;
if (saldo < ZERO)
{
sld = -saldo;
_tot_sez_saldo = 'A';
}
else
{
sld = saldo;
_tot_sez_saldo = 'D';
}
set_row (_i,"@46g!@80g!@114g!%r", &sld);
if (!sld.is_zero())
set_row (_i,"@131g%c", _tot_sez_saldo);
}
print_action TStampa_IVdirettiva::postprocess_page(int file, int counter)
{
struct bil_ivd* bil = (struct bil_ivd*) _buff;
bil = (struct bil_ivd*) _buff;
if (_tipo_bilancio == 1)
{
if (_sez_da_stamp != _sez_stamp)
{
if (_sez_da_stamp == '5')
{
if (!_intera_struttura)
{
if (bil->gruppo[0] != 'Z')
{
reset_print();
_i = 1;
setta_righe(TR("CONTI D'ORDINE"));
_reset_righe_stampa = false;
}
}
else
{
reset_print();
_i = 1;
setta_righe(TR("CONTI D'ORDINE"));
_reset_righe_stampa = false;
}
}
if (_sez_da_stamp == '9')
{
if (!_intera_struttura)
{
if (bil->gruppo[0] != 'Z')
{
reset_print();
_i = 1;
setta_righe(TR("CONTO ECONOMICO"));
_reset_righe_stampa = false;
}
}
else
{
reset_print();
_i = 1;
setta_righe(TR("CONTO ECONOMICO"));
_reset_righe_stampa = false;
}
}
}
set_auto_ff(false);
}
if (_buff == NULL)
return NEXT_PAGE;
_sale = 0;
_salerafr = 0;
return REPEAT_PAGE;
}
bool TStampa_IVdirettiva::preprocess_page(int file, int counter)
{
bool ok = false;
if (_tipo_bilancio == 1)
ok = preprocess_stampa_scalare(counter);
else
ok = preprocess_stampa_verifica(counter);
return ok;
}
bool TStampa_IVdirettiva::preprocess_stampa_scalare(int counter)
{
struct bil_ivd* bil = (struct bil_ivd*) _buff;
int g,c;
long s;
bool fai = true;
TString saldostr,saldo_rafstr;
bool conto_dettagliato = 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.trim();
_sez_tot = bil->sez;
_let_tot = bil->let;
_numr_tot = bil->numr;
_numr_tot.ltrim();
_num_tot = bil->num;
_num_tot.trim();
}
}
else
{
_classe_stampata.format("%c%c%8s%s",bil->sez,bil->let,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.trim();
_sez_tot = bil->sez;
_let_tot = bil->let;
_numr_tot = bil->numr;
_numr_tot.ltrim();
_num_tot = bil->num;
_num_tot.trim();
}
}
_buff = _sort->retrieve();
if (_buff == NULL)
{
if (_annoeserafr == 0 && _databilrafr == botime)
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("%c%c%8s%s",bil->sez,bil->let,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.trim();
g = atoi(bil->gruppo);
c = atoi(bil->conto);
s = atol(bil->sottoc);
conto_dettagliato = bil->conto_dettagliato;
if (_intera_struttura)
fai = true;
else
{
if (bil->gruppo[0] != 'Z')
fai = true;
else
fai = false;
}
if (counter)
{
if (fai)
{
if (_annoeserafr == 0 && _databilrafr == botime)
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 || _databilrafr != botime)
_salerafr = bil->saldorafr;
}
else
{
if (bil->gruppo[0]=='Z')
if (_classe_da_stampare == _classe_stampata)
return false;
_sale = bil->saldo;
if (_annoeserafr != 0 || _databilrafr != botime)
_salerafr = bil->saldorafr;
}
saldostr = _sale.string();
saldo_rafstr = _salerafr.string();
// Faccio passare solo i sottoconti o i conti non dettagliati (che non hanno sottoconti)
// perch<63> l' importo dei conti dettagliati non <20> altri che il totale degli importi di
// tutti i suoi sottoconti; dunque se li sommassi anche loro, sommerei l'importo due volte.
// Pero' devo ricordarmi di cambiare ugualmente segno ai conti che vanno dettagliati.
if (g != 0 && c != 0 && s == 0 && conto_dettagliato)
if (_sez_da_stamp == '9')
{
_sale = -_sale;
if (_annoeserafr != 0 || _databilrafr != botime)
_salerafr = -_salerafr;
}
if ((g != 0 && c != 0 && s != 0)||(g != 0 && c != 0 && s == 0 && !conto_dettagliato))
{
if (_sez_da_stamp == '9')
_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 (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21"))
_totale_parziale += _sale;
}
if (_annoeserafr != 0 || _databilrafr != botime)
{
if (_sez_da_stamp == '9')
_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;
if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21"))
_totale_parziale_raf += _salerafr;
}
}
}
return true;
}
else
return false;
}
bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter)
{
struct bil_ivd* bil = (struct bil_ivd*) _buff;
int g,c;
long s;
bool fai = true;
bool conto_dettagliato = 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.trim();
_sez_tot = bil->sez;
_let_tot = bil->let;
_numr_tot = bil->numr;
_numr_tot.ltrim();
_num_tot = bil->num;
_num_tot.trim();
}
}
else
{
_classe_stampata = format ("%c%c%8s%s",bil->sez,bil->let,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.trim();
_sez_tot = bil->sez;
_let_tot = bil->let;
_numr_tot = bil->numr;
_numr_tot.ltrim();
_num_tot = bil->num;
_num_tot.trim();
}
}
_buff = _sort->retrieve();
if (_buff == NULL)
{
stampa_totali_verifica();
set_row (_i,FR("@0g****** ******** TOTALE GENERALE"));
if (_tot_gen_prg_d != ZERO)
set_row (_i,"@47g%r", &_tot_gen_prg_d);
if (_tot_gen_prg_a != ZERO)
set_row (_i,"@64g%r", &_tot_gen_prg_a);
set_row (_i,"@81g%r", &_tot_gen_mov_d);
set_row (_i,"@98g%r", &_tot_gen_mov_a);
if (!_stampa_modulo)
stampa_saldo_132(_tot_gen_saldo);
else
stampa_saldo_198(_tot_gen_saldo_d,_tot_gen_saldo_a);
//modifica 05/04/1995
if ((_tipo_stampa == 1 && _dataini == _data_ini_ese) || _tipo_stampa == 2)
{
_i++;
if (_tipo_stampa == 1 && _dataini == _data_ini_ese)
set_row(_i,FR("****** ******** TOTALE CON MOVIM. DI APERTURA@46g!@80g!@81g%r@98g%r@114g!"),&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
else
set_row(_i,FR("****** ******** TOTALE CON SALDI INIZIALI@46g!@80g!@81g%r@98g%r@114g!"),&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
}
//fine modifica
_sez_da_stamp = ' ';
_sez_stamp = ' ';
return true;
}
if (_buff != NULL)
{
bil = (struct bil_ivd*) _buff;
_classe_da_stampare = format ("%c%c%8s%s",bil->sez,bil->let,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.trim();
g = atoi(bil->gruppo);
c = atoi(bil->conto);
s = atol(bil->sottoc);
conto_dettagliato = bil->conto_dettagliato;
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;
}
else
{
if (bil->gruppo[0]=='Z')
if (_classe_da_stampare == _classe_stampata)
return false;
}
if (_stampamov && _sale.is_zero())
return false;
if ((g != 0) && (c != 0) && (s == 0) && (conto_dettagliato))
{
if (_sale < ZERO)
{
_sale = -_sale;
_sez_saldo = 'A';
}
else
_sez_saldo = 'D';
}
if ((g != 0 && c != 0 && s != 0)||(g != 0 && c != 0 && s == 0 && !conto_dettagliato))
{
_tot_num_saldo += _sale;
_tot_numr_saldo += _sale;
_tot_let_saldo += _sale;
_tot_gen_saldo += _sale;
if (_sez_da_stamp == '9')
if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21"))
_tot_parz_sld += _sale;
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;
if (_sez_da_stamp == '9')
if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21"))
_tot_parz_sld_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;
if (_sez_da_stamp == '9')
if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21"))
_tot_parz_sld_d += _sale;
}
}
if (_dataini == _data_ini_ese)
{
//modifica del 27/11/1995
if (_tipo_stampa == 2)
{
real saldo_num = _sld_prg_dare - _sld_prg_avere;
if (saldo_num > ZERO)
_tot_num_prg_d += saldo_num;
else
{
saldo_num = -saldo_num;
_tot_num_prg_a += saldo_num;
}
real saldo_numr = _sld_prg_dare - _sld_prg_avere;
if (saldo_numr > ZERO)
_tot_numr_prg_d += saldo_numr;
else
{
saldo_numr = -saldo_numr;
_tot_numr_prg_a += saldo_numr;
}
real saldo_let = _sld_prg_dare - _sld_prg_avere;
if (saldo_let > ZERO)
_tot_let_prg_d += saldo_let;
else
{
saldo_let = -saldo_let;
_tot_let_prg_a += saldo_let;
}
real saldo_gen = _sld_prg_dare - _sld_prg_avere;
if (saldo_gen > ZERO)
_tot_gen_prg_d += saldo_gen;
else
{
saldo_gen = -saldo_gen;
_tot_gen_prg_a += saldo_gen;
}
}
else if (_tipo_stampa == 1)
{
_tot_num_prg_d += _sld_prg_dare;
_tot_num_prg_a += _sld_prg_avere;
_tot_numr_prg_d += _sld_prg_dare;
_tot_numr_prg_a += _sld_prg_avere;
_tot_let_prg_d += _sld_prg_dare;
_tot_let_prg_a += _sld_prg_avere;
_tot_gen_prg_d += _sld_prg_dare;
_tot_gen_prg_a += _sld_prg_avere;
}
//fine
}
else
{
_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;
if (_sez_da_stamp == '9')
if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21"))
{
_tot_parz_prg_d += _sld_prg_dare;
_tot_parz_prg_a += _sld_prg_avere;
_tot_parz_mov_d += _mov_dare;
_tot_parz_mov_a += _mov_avere;
}
}
return true;
}
else
return false;
}
void TStampa_IVdirettiva::set_page(int file, int counter)
{
if (_tipo_bilancio == 1) // Bilancio scalare
{
if (_sez_da_stamp != _sez_stamp)
{
// Controllo se devo stampare STATO PATRIMONIALE
if (_statopatr_no_stamp && (_sez_da_stamp=='1')||((_sez_da_stamp=='2')))
{
setta_righe (TR("STATO PATRIMONIALE"));
_statopatr_no_stamp = false;
}
else // Guy was here: aggiunto else 18/02/2004 altrimenti fa due volte la setta righe
{
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 (_buff != NULL)
setta_righe_verifica();
}
}
void TStampa_IVdirettiva::setta_righe(const char * titolo)
{
struct bil_ivd* bil = (struct bil_ivd*) _buff;
int numeror, gruppo, conto;
char sezione,lettera;
long sottoc;
TString numrom,numr, numero;
bool stampa_classe = true;
sezione = bil->sez;
lettera = bil->let;
numr = bil->numr;
numeror = atoi(bil->numr);
numrom = itor(numeror);
numero = bil->num;
numero.trim();
gruppo = atoi(bil->gruppo);
conto = atoi(bil->conto);
sottoc = atol(bil->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) // Cambio sezione
{
set_row (_i++, "@0g%s", titolo);
set_row(_i++,"@0g ");
if (_sez_da_stamp == '1')
{
set_row (_i++,"@0g ");
if (_let_da_stamp == 'Z')
{
set_row (_i++,FR("@0gCONTI D'ORDINE ATTIVI"));
stampa_classe = false;
}
else
set_row (_i++,FR("@0gATTIVO"));
set_row (_i++,"@0g ");
}
if (_sez_da_stamp == '2')
{
set_row(_i++,"@0g ");
if ((_let_da_stamp == 'Z'))
{
set_row (_i++,FR("@0gCONTI D'ORDINE PASSIVI"));
stampa_classe = false;
}
else
set_row (_i++,FR("@0gPASSIVO"));
set_row(_i++,"@0g ");
}
if (stampa_classe)
{
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp== '9'))
{
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_let = 1;
_cont_numr = 1;
_cont_num = 1;
_cont_gcs = 0;
}
if (lettera > ' ')
{
set_row(_i,"@0g%c@1g)", lettera);
TParagraph_string s(descrizione_ivd(sezione,lettera, 0, ""), 40);
setta_righe_descr(s ,"@3g%s");
}
if (numrom.not_empty())
{
set_row(_i,"@3g%8s@12g-", (const char*) numrom);
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, ""), 40);
setta_righe_descr(s, "@14g%s");
}
if (numero.not_empty())
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, numero), 32);
setta_righe_descr(s, "@27g%s");
}
}
}
}
else
if ((_let_da_stamp!=_let_stamp)&&(_sez_da_stamp==_sez_stamp))
{
if ((_sez_da_stamp == '1')&&(_let_da_stamp == 'Z'))
{
set_row (_i++,"@0g ");
set_row (_i++,FR("@0gCONTI D'ORDINE ATTIVI"));
set_row (_i++,"@0g ");
stampa_classe = false;
}
if ((_sez_da_stamp == '2')&&(_let_da_stamp == 'Z'))
{
set_row(_i++,"@0g ");
set_row (_i++,FR("@0gCONTI D'ORDINE PASSIVI"));
set_row(_i++,"@0g ");
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);
TParagraph_string s(descrizione_ivd(sezione,lettera, 0 ,""), 40);
setta_righe_descr(s, "@3g%s");
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_numr = 1;
_cont_num = 1;
_cont_gcs = 0;
}
if (numrom.not_empty())
{
set_row(_i,"@3g%8s@12g-", (const char*) numrom);
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, ""), 40);
setta_righe_descr(s, "@14g%s");
}
if (numero.not_empty())
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, numero), 32);
setta_righe_descr(s, "@27g%s");
}
}
}
}
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,"@3g%8s@12g-", (const char*) numrom);
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, ""), 40);
setta_righe_descr(s,"@14g%s");
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_num = 1;
_cont_gcs = 0;
}
if (numero.not_empty())
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, numero), 32);
setta_righe_descr(s,"@27g%s");
}
}
}
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'))
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, numero), 32);
setta_righe_descr(s, "@27g%s");
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_gcs = 0;
_cont_numr= 1;
}
}
}
if (bil->gruppo[0] != 'A')
{
if (!_stampacod)
{
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
const TConto tc(gruppo, conto, sottoc, bil->tipocf);
_cont_gcs += 1;
set_row (_i,"@18g%3d@22g%3d", gruppo, conto);
if (sottoc != 0)
set_row (_i,"@26g%6ld", sottoc);
set_row (_i,"@33g%s", (const char*) tc.descrizione());
set_row (_i,"@81g%r", &_sale);
if (_annoeserafr != 0 || _databilrafr != botime)
set_row (_i,"@111g%r", &_salerafr);
_i++;
}
}
else
{
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
const TConto tc (gruppo, conto, sottoc, bil->tipocf);
_cont_gcs += 1;
set_row (_i,"@20g%s", (const char*) tc.descrizione());
set_row (_i,"@81g%r", &_sale);
if (_annoeserafr != 0 || _databilrafr != botime)
set_row (_i,"@111g%r", &_salerafr);
_i++;
}
}
}
}
void TStampa_IVdirettiva::setta_righe_verifica()
{
struct bil_ivd* bil = (struct bil_ivd*) _buff;
int numeror, gruppo, conto;
char sezione,lettera,tmcf;
long sottoc;
TString numrom,numr, numero;
_descr->set_width(35);
sezione = bil->sez;
lettera = bil->let;
numr = bil->numr;
numeror = atoi(bil->numr);
numrom = itor(numeror);
numero = bil->num;
numero.trim();
gruppo = atoi(bil->gruppo);
conto = atoi(bil->conto);
sottoc = atol(bil->sottoc);
tmcf = bil->tipocf;
//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++,"@46g!@80g!@114g!");
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp== '9'))
{
if (_let_da_stamp != 'Z')
{
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_let = 1;
_cont_numr = 1;
_cont_num = 1;
_cont_gcs = 0;
}
if (lettera > ' ')
{
set_row(_i,"@0g%c)", lettera);
TParagraph_string s(descrizione_ivd(sezione,lettera, 0, ""), 40);
setta_righe_descr_verifica(s, "@3g%s");
}
if (numrom.not_empty())
{
set_row(_i,"@0g%8s)", (const char*) numrom);
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, ""), 40);
setta_righe_descr_verifica(s, "@10g%s");
}
if (numero.not_empty())
{
set_row(_i,"@0g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror,numero), 32);
setta_righe_descr_verifica(s, "@13g%s");
}
}
}
}
else
if ((_let_da_stamp!=_let_stamp)&&(_sez_da_stamp==_sez_stamp))
{
char app = ' ';
set_row (_i,"@0g%c", app);
set_row (_i++,"@46g!@80g!@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);
TParagraph_string s(descrizione_ivd(sezione,lettera, 0, ""), 40);
setta_righe_descr_verifica(s, "@3g%s");
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_numr = 1;
_cont_num = 1;
_cont_gcs = 0;
}
if (numrom.not_empty())
{
set_row(_i,"@0g%8s)", (const char*) numrom);
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, ""), 40);
setta_righe_descr_verifica(s, "@10g%s");
}
if (numero.not_empty())
{
set_row(_i,"@0g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror,numero), 32);
setta_righe_descr_verifica(s, "@13g%s");
}
}
}
}
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++,"@46g!@80g!@114g!");
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
{
if (_let_da_stamp != 'Z')
{
set_row(_i,"@0g%8s)", (const char*) numrom);
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror, ""), 40);
setta_righe_descr_verifica(s, "@10g%s");
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_num = 1;
_cont_gcs = 0;
}
if (numero.not_empty())
{
set_row(_i,"@0g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror,numero), 32);
setta_righe_descr_verifica(s, "@13g%s");
}
}
}
}
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++,"@46g!@80g!@114g!");
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
{
if (_let_da_stamp != 'Z')
{
set_row(_i,"@0g%s)", num2str(numero));
TParagraph_string s(descrizione_ivd(sezione,lettera,numeror,numero), 32);
setta_righe_descr_verifica(s, "@13g%s");
_cont_num += 1;
_cont_gcs = 0;
}
}
}
if (bil->gruppo[0] != 'A')
{
if (!_stampacod)
{
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_gcs += 1;
set_row (_i,"@0g%3d", gruppo);
set_row (_i,"@4g%3d", conto);
if (sottoc != 0)
set_row (_i,"@8g%6ld", sottoc);
TConto tc (gruppo,conto,sottoc,tmcf);
*_d = tc.descrizione();
setta_righe_descr_verifica(*_d, "@15g%s");
_i--;
if (_dataini == _data_ini_ese)
{
//modifica del 27/11/1995
if (_tipo_stampa == 2) //all'ultima immissione
{
real saldoini = _sld_prg_dare - _sld_prg_avere;
if (saldoini > ZERO)
set_row(_i,"@47g%r", &saldoini);
else if (saldoini < ZERO) // Non stampare il saldo iniziale se == 0.0
{
saldoini = -saldoini;
set_row(_i,"@64g%r", &saldoini);
}
}
else if (_tipo_stampa == 1) //per date limiti
{
if (_sld_prg_dare != ZERO)
set_row(_i,"@47g%r", &_sld_prg_dare);
if (_sld_prg_avere != ZERO)
set_row(_i,"@64g%r", &_sld_prg_avere);
}
//fine
}
else
{
if (_sld_prg_dare != ZERO)
set_row (_i,"@47g%r", &_sld_prg_dare);
if (_sld_prg_avere != ZERO)
set_row (_i,"@64g%r", &_sld_prg_avere);
}
set_row (_i,"@81g%r", &_mov_dare);
set_row (_i,"@98g%r", &_mov_avere);
if (_stampa_modulo)
{
if (_sez_saldo == 'D')
set_row (_i,"@46g!@80g!@114g!%r", &_sale);
else
set_row (_i,"@46g!@80g!@114g!@132g%r", &_sale);
}
else
{
set_row (_i,"@46g!@80g!@114g!%r", &_sale);
if (_sale != ZERO)
set_row (_i,"@131g%c", _sez_saldo);
}
}
}
else
{
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_gcs += 1;
TConto tc (gruppo,conto,sottoc,tmcf);
*_d = tc.descrizione();
set_row (_i,"@2g#a", _d);
if (_dataini == _data_ini_ese)
{
//modifica del 27/11/1995
if (_tipo_stampa == 2)
{
real saldoini = _sld_prg_dare - _sld_prg_avere;
if (saldoini > ZERO)
set_row(_i,"@47g%r", &saldoini);
else if (saldoini < ZERO) // non stampare il saldo iniziale se == 0.0
{
saldoini = -saldoini;
set_row(_i,"@64g%r", &saldoini);
}
}
else if (_tipo_stampa == 1)
{
if (_sld_prg_dare != ZERO)
set_row(_i,"@47g%r", &_sld_prg_dare);
if (_sld_prg_avere != ZERO)
set_row(_i,"@64g%r", &_sld_prg_avere);
}
//fine
}
else
{
if (_sld_prg_dare != ZERO)
set_row (_i,"@47g%r", &_sld_prg_dare);
if (_sld_prg_avere != ZERO)
set_row (_i,"@64g%r", &_sld_prg_avere);
}
set_row (_i,"@81g%r", &_mov_dare);
set_row (_i,"@99g%r", &_mov_avere);
if (_stampa_modulo)
{
if (_sez_saldo == 'D')
set_row (_i,"@46g!@80g!@114g!%r", &_sale);
else
set_row (_i,"@46g!@80g!@114g!@132g%r", &_sale);
}
else
{
set_row (_i,"@115g%r", &_sale);
if (_sale != ZERO)
set_row (_i,"@131g%c", _sez_saldo);
set_row (_i,"@46g!@80g!@114g!");
}
}
}
}
}
void TStampa_IVdirettiva::setta_righe_descr(TParagraph_string & str, const char* formato)
{
const char* r;
while((r = str.get()) != NULL)
set_row (_i++, formato, r);
}
void TStampa_IVdirettiva::setta_righe_descr_verifica(TParagraph_string & str, const char* formato)
{
const char* r;
while ((r = str.get()) != NULL)
{
set_row (_i, formato, r);
set_row (_i++, "@46g!@80g!@114g!");
}
}
const TString & TStampa_IVdirettiva::descrizione_ivd(char sezione, char lettera, int numr, const char * numero)
{
TString16 key;
if (numr != 0)
key.format("%c%c%04d%-4s", sezione, lettera, numr, numero);
else
key.format("%c%c %-4s", sezione, lettera, numero);
key.trim();
return cache().get(TAB_IVD, key, "S0");
}
// Crea l'intestazione per la stampa a 132 e a 198 caratteri
void TStampa_IVdirettiva::crea_intestazione()
{
TString codice_ditta; codice_ditta.format("%ld", get_firm());
TString16 key;
const TRectype & nditte = cache().get(LF_NDITTE, codice_ditta);
key = codice_ditta;
key << "|1";
const TRectype & unloc = cache().get(LF_UNLOC, key);
key = "|";
key << unloc.get(ULC_COMULC);
const TRectype & comuni = cache().get(LF_COMUNI, key);
reset_header();
set_header (1, TR("DITTA@6g%-5s"), (const char*) codice_ditta);
set_header (1, "@12g%-45s", (const char*) nditte.get(NDT_RAGSOC));
set_header (1, "@59g%-25s", (const char*) unloc.get(ULC_INDULC));
set_header (1, "@86g%-9s", (const char*) unloc.get(ULC_CIVULC));
set_header (1, "@97g%-5s", (const char*) unloc.get(ULC_CAPULC));
set_header (1, "@102g%-25s", (const char*) comuni.get(COM_DENCOM));
set_header (1, "@129g%-3s", (const char*) comuni.get(COM_PROVCOM));
if (_stampa_modulo)
set_header(2,FR("@129gPag. @#"));
else
set_header(2,FR("@122gPag. @#"));
key = nditte.get(NDT_TIPOA);
key << "|" << nditte.get(NDT_CODANAGR);
const TRectype & anag = cache().get(LF_ANAG, key);
set_header (2,FR("@0gPartita iva@12g%-11s"), (const char*) anag.get(ANA_PAIV));
set_header (2,FR("@30gCodice fiscale@45g%-16s"), (const char*) anag.get(ANA_COFI));
if (_stampa_modulo)
set_header (2,FR("@131gData@116g%s"),(const char*) _datastampa.string());
else
set_header (2,FR("@105gData@111g%s"),(const char*) _datastampa.string());
if (_tipo_bilancio == 1)
intesta_scalare();
else
if (_tipo_bilancio == 2)
intesta_verifica();
}
void TStampa_IVdirettiva::intesta_verifica_fissa()
{
TString sep(132),app(32),sep1(147);
if (_tipo_stampa == 1)
{
if (_dataini == _data_ini_ese)
set_header(5,FR("@54gMOVIMENTI DI APERTURA@87gMOVIMENTI DEL PERIODO"));
else if (_dataini > _data_ini_ese)
set_header(5,FR("@54gPROGRESSIVI PRECEDENTI@87gMOVIMENTI DEL PERIODO"));
}
else if (_tipo_stampa == 2)
set_header(5,FR("@57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO"));
if (_stampa_modulo)
set_header(5,FR("@129gSALDO"));
set_header(5,"@46g!@80g!@114g!");
if (_stampa_modulo)
{
set_header(5,"@147g!");
set_header(6,"@147g!");
}
set_header(6,"@46g!@80g!@114g!");
app = "---------------------------------";
if (_stampa_modulo)
{
set_header(6,"@47g%s@81g%s@115g%s", (const char*) app, (const char*) app,(const char*) app);
set_header(7,FR("@1gdescrizione voce@46g!@53gDare@63g!@69gAvere@80g!@87gDare@97g!@103gAvere@114g!@122gDare@131g!@138gAvere@147g!"));
sep1.fill('-'); //Stampa 132 - (sep(132))
set_header (8, (const char *) sep1);
}
else
{
set_header(6,"@47g%s@81g%s@122gSALDO", (const char*) app, (const char*) app);
set_header(7,FR("@1gdescrizione voce@46g!@53gDare@63g!@69gAvere@80g!@87gDare@97g!@103gAvere@114g!"));
sep.fill('-'); //Stampa 132 - (sep(132))
set_header (8, (const char *) sep);
}
}
void TStampa_IVdirettiva::intesta_scalare()
{
TString datalimitestr,databilrafrstr;
TString sep(132);
TString16 d1e(_data_ini_ese.string());
TString16 d2e(_data_fine_ese.string());
TString16 d1r(_data_ini_raf.string());
TString16 d2r(_data_fine_raf.string());
set_header (3,TR("STAMPA BILANCIO CONFORME ALLA IV DIRETTIVA"));
set_header (3,FR("@80gEs. %s/%s"), (const char*)d1e, (const char*)d2e); /**/
if (_annoeserafr != 0 || _databilrafr != botime)
{
set_header (3,FR("@107gEs. %s/%s"), (const char*)d1r, (const char*)d2r); /**/
databilrafrstr = _databilrafr.string();
set_header (4,FR("@112galla data@122g%s"), (const char*) databilrafrstr);
}
if (_tipo_stampa == 1)
{
datalimitestr = _datalimite.string();
set_header (4,FR("@86galla data@96g%s"), (const char*) datalimitestr);
}
else if (_tipo_stampa == 2)
set_header (4,FR("@90gall'ultima immissione"));
sep.fill('-'); //Stampa 132 - (sep(132))
set_header (5, (const char *) sep);
}
void TStampa_IVdirettiva::intesta_verifica()
{
set_header (3,TR("@0gBILANCIO DI VERIFICA IV DIRETTIVA"));
if (_tipo_stampa == 1)
{
TString datainistr = _dataini.string();
TString datafinestr = _datafine.string();
set_header (3,FR("@43gdalla data@54g%s alla data %s"),
(const char*)datainistr, (const char*) datafinestr);
}
else if (_tipo_stampa == 2)
set_header (3,FR("@42gall'ultima immissione"));
TString sep;
sep.fill('-', _stampa_modulo ? 147 : 132);
set_header (4, sep);
intesta_verifica_fissa();
}
void TStampa_IVdirettiva::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),4);
_sort -> addsortkey ((char*)&(_bil->num) - (char*)&(_bil->sez),6);
_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();
}
bool TStampa_IVdirettiva::user_create()
{
open_files(LF_TAB, LF_NDITTE, LF_SALDI, LF_COMUNI, LF_UNLOC, LF_ANAG,LF_PCON,LF_CLIFO, LF_CAUSALI,0);
_descr = new TParagraph_string("",40);
_d = new TParagraph_string("",33);
_sld = new TSaldo();
_msk = new TMask("cg1600a");
_msk->set_handler(F_DATALIM, data_limite);
_msk->set_handler(F_TIPOSTAMPA, tipo_stampa);
_msk->set_handler(F_TIPOSTAMPA1, tipo_stampa);
_msk->set_handler(F_TIPOBIL, tipo_bilancio);
_msk->set_handler(F_ANNOESE, anno_esercizio);
_msk->set_handler(F_DATAINI, data_inizio);
_msk->set_handler(F_DATAFINE, data_fine);
_msk->set_handler(F_DATABILRAF, data_bil_raff);
_msk->set_handler(F_ANNORAFFR, anno_ese_raff);
return true;
}
bool TStampa_IVdirettiva::user_destroy()
{
delete _msk;
delete _descr;
delete _d;
delete _sld;
return true;
}
int cg1600 (int argc, char* argv[])
{
TStampa_IVdirettiva a;
a.run(argc, argv, TR("Stampa Bilancio IV direttiva CEE"));
return 0;
}