1995-01-03 16:45:39 +00:00
# include <mask.h>
# include <printapp.h>
1995-01-04 15:38:10 +00:00
# include <progind.h>
1997-06-19 14:33:52 +00:00
# include <recarray.h>
1995-01-04 15:38:10 +00:00
# include <sort.h>
1995-01-03 16:45:39 +00:00
# include <tabutil.h>
# include <utility.h>
1997-06-19 14:33:52 +00:00
# include <causali.h>
1995-01-03 16:45:39 +00:00
# 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"
1997-06-19 14:33:52 +00:00
# include "cglib01.h"
# include "cglib02.h"
1995-01-03 16:45:39 +00:00
1997-10-16 08:47:25 +00:00
class TRiga_sez_opp : public TObject
1995-01-03 16:45:39 +00:00
{
1999-07-16 14:59:11 +00:00
TToken_string * _str ;
1997-06-19 14:33:52 +00:00
1995-01-03 16:45:39 +00:00
public :
int gruppo ( ) { return atoi ( _str - > get ( 0 ) ) ; }
int conto ( ) { return atoi ( _str - > get ( 1 ) ) ; }
1999-05-24 13:34:11 +00:00
long sottoc ( ) { return atol ( _str - > get ( 2 ) ) ; }
1995-01-03 16:45:39 +00:00
const char * sezione ( ) { return _str - > get ( 3 ) ; }
const char * lettera ( ) { return _str - > get ( 4 ) ; }
const char * num_rom ( ) { return _str - > get ( 5 ) ; }
int numero ( ) { return atoi ( _str - > get ( 6 ) ) ; }
real saldo_conto ( ) ;
real saldo_conto_raf ( ) ;
void incrementa_saldo ( real & nuovo_saldo , real & nuovo_saldo_raf ) ;
1997-10-16 08:47:25 +00:00
TRiga_sez_opp ( int g , int c , long s ,
1995-01-03 16:45:39 +00:00
const char * sezione , const char * lettera ,
const char * num_rom , int num , real & saldo , real & saldo_raf ) ;
1997-10-16 08:47:25 +00:00
virtual ~ TRiga_sez_opp ( ) ;
1995-01-03 16:45:39 +00:00
} ;
1997-10-16 08:47:25 +00:00
real TRiga_sez_opp : : saldo_conto ( )
1995-01-03 16:45:39 +00:00
{
real r ( _str - > get ( 7 ) ) ;
return r ;
}
1997-10-16 08:47:25 +00:00
real TRiga_sez_opp : : saldo_conto_raf ( )
1995-01-03 16:45:39 +00:00
{
real r ( _str - > get ( 8 ) ) ;
return r ;
}
1997-10-16 08:47:25 +00:00
void TRiga_sez_opp : : incrementa_saldo ( real & sld , real & sld_raf )
1995-01-03 16:45:39 +00:00
{
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 ) ;
}
1997-10-16 08:47:25 +00:00
TRiga_sez_opp : : TRiga_sez_opp ( int g , int c , long s ,
1995-01-03 16:45:39 +00:00
const char * sezione , const char * lettera ,
const char * num_rom , int num , real & saldo , real & saldo_raf )
{
_str = new TToken_string ( 30 ) ;
_str - > add ( format ( " %d " , g ) ) ;
_str - > add ( format ( " %d " , c ) ) ;
_str - > add ( format ( " %ld " , s ) ) ;
_str - > add ( sezione ) ;
_str - > add ( lettera ) ;
_str - > add ( num_rom ) ;
_str - > add ( format ( " %d " , num ) ) ;
_str - > add ( saldo . string ( ) ) ;
_str - > add ( saldo_raf . string ( ) ) ;
}
1997-10-16 08:47:25 +00:00
TRiga_sez_opp : : ~ TRiga_sez_opp ( )
1995-01-03 16:45:39 +00:00
{
delete _str ;
}
class Righe_sez_opp : public TAssoc_array
{
public :
1997-10-16 08:47:25 +00:00
TRiga_sez_opp * riga ( ) { return ( TRiga_sez_opp * ) get ( ) ; }
1995-01-03 16:45:39 +00:00
int gruppo ( ) { return riga ( ) - > gruppo ( ) ; }
int conto ( ) { return riga ( ) - > conto ( ) ; }
1999-05-24 13:34:11 +00:00
long sottoc ( ) { return riga ( ) - > sottoc ( ) ; }
1995-01-03 16:45:39 +00:00
const char * sezione ( ) { return riga ( ) - > sezione ( ) ; }
const char * lettera ( ) { return riga ( ) - > lettera ( ) ; }
const char * num_rom ( ) { return riga ( ) - > num_rom ( ) ; }
int numero ( ) { return riga ( ) - > numero ( ) ; }
real saldo_conto ( ) { return riga ( ) - > saldo_conto ( ) ; }
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 , int 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 , int num , real saldo , real saldo_raf )
{
1999-07-16 14:59:11 +00:00
TString80 key ; key . format ( " %s%s%s%d " , sezione , lettera , num_rom , num ) ;
1995-01-03 16:45:39 +00:00
1999-07-16 14:59:11 +00:00
TRiga_sez_opp * riga = ( TRiga_sez_opp * ) objptr ( key ) ;
if ( riga = = NULL )
1995-01-03 16:45:39 +00:00
{
1997-10-16 08:47:25 +00:00
riga = new TRiga_sez_opp ( g , c , s , sezione , lettera , num_rom , num , saldo , saldo_raf ) ;
1995-01-03 16:45:39 +00:00
TAssoc_array : : add ( key , riga ) ;
}
else
{
riga - > incrementa_saldo ( saldo , saldo_raf ) ;
}
}
1997-10-16 08:47:25 +00:00
class TStampa_IVdirettiva : public TPrintapp
1995-01-03 16:45:39 +00:00
{
1997-06-19 14:33:52 +00:00
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 ) ;
1995-01-03 16:45:39 +00:00
struct bil_ivd
{
char sez ;
char let ;
char numr [ 5 ] ;
char num [ 4 ] ;
char gruppo [ 4 ] ;
char conto [ 4 ] ;
char sottoc [ 8 ] ;
real saldo ;
real saldorafr ;
real sld_prg_dare ;
real sld_prg_avere ;
real mov_dare ;
real mov_avere ;
char tipocf ;
bool conto_dettagliato ;
} ;
bil_ivd * _bil ;
TMask * _msk ;
TLocalisamfile * _nditte ;
TLocalisamfile * _comuni ;
TLocalisamfile * _unloc ;
TLocalisamfile * _anag ;
TLocalisamfile * _pconti ;
TLocalisamfile * _clifo ;
TLocalisamfile * _saldi ;
1995-04-19 13:13:21 +00:00
TLocalisamfile * _caus ;
1995-01-03 16:45:39 +00:00
const char * _buff ;
TSort * _sort ;
Righe_sez_opp _sezopps ;
TSaldi_list * _listasld ;
1996-09-26 15:06:12 +00:00
TProgind * _prog , * _prog_stampa ;
1995-04-19 13:13:21 +00:00
TParagraph_string * _descr , * _d ;
1996-09-26 15:06:12 +00:00
TSaldo * _sld ;
1997-10-16 08:47:25 +00:00
bool _noseparator ;
1995-01-03 16:45:39 +00:00
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 ;
1995-04-19 13:13:21 +00:00
bool _diffprod_fatto , _risimp_fatto ;
1995-01-03 16:45:39 +00:00
TString _classe_stampata , _classe_da_stampare , _numr_tot , _num_tot , _numr ;
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 , _num ;
1995-04-19 13:13:21 +00:00
int _stampa_mov_prov ;
1995-01-03 16:45:39 +00:00
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 ;
1995-04-06 16:10:12 +00:00
real _nuovo_tot_saldo_d , _nuovo_tot_saldo_a ;
1995-01-03 16:45:39 +00:00
int _i ;
bool _reset_righe_stampa , _totale_attivita_gia_stampato , _totale_passivita_gia_stampato , _statopatr_no_stamp ;
1996-06-19 14:04:56 +00:00
bool _sbilancio_ordine , _quadratura ;
1996-09-26 15:06:12 +00:00
long _items_sort ;
1997-06-19 14:33:52 +00:00
1998-05-04 09:34:04 +00:00
TString tmp ; // Stringa per porcate galattiche
protected :
1997-06-19 14:33:52 +00:00
void aggiungi_anno ( int anno , TDate & inizio , TDate & fine ) ;
1995-01-03 16:45:39 +00:00
public :
1996-06-19 14:04:56 +00:00
TDate _inizioEs , _fineEs ;
1997-06-19 14:33:52 +00:00
int date2esc ( const TDate & d ) ;
1996-10-11 11:36:15 +00:00
void esc2date ( const int anno , TDate & d1 , TDate & d2 ) ;
1996-06-19 14:04:56 +00:00
1995-01-03 16:45:39 +00:00
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 ) ;
1996-09-26 15:06:12 +00:00
virtual bool preprocess_print ( int , int ) ;
1995-01-03 16:45:39 +00:00
virtual print_action postprocess_page ( int , int ) ;
1996-09-26 15:06:12 +00:00
virtual print_action postprocess_print ( int , int ) ;
1995-01-03 16:45:39 +00:00
virtual void postclose_print ( ) ;
virtual void preprocess_header ( ) ;
virtual void set_page ( int , int ) ;
bool preprocess_stampa_scalare ( int ) ;
bool preprocess_stampa_verifica ( int ) ;
void crea_intestazione ( ) ;
void intesta_scalare ( ) ;
void intesta_verifica ( ) ;
void intesta_verifica_fissa ( ) ;
void init_sort ( ) ;
void crea_sort_tabella ( ) ;
void crea_sort_piano_conti_scalare ( ) ;
void crea_sort_piano_conti_verifica ( ) ;
2003-05-05 14:32:23 +00:00
void setta_righe_descr ( TParagraph_string * , const char * , const char * ) ;
void setta_righe_descr_verifica ( TParagraph_string * , const char * , const char * ) ;
1995-01-03 16:45:39 +00:00
void scrivi_record ( const TString & , const TString & , const TString & , int , int , int , long , const real & , const real & , const real & , const real & , const real & , const real & , char , bool conto_dettagliato = TRUE ) ;
void riempi_record ( const TString & , const TString & , const TString & , int , int , int , long , const real & , const real & , const real & , const real & , const real & , const real & , char , bool conto_dettagliato = TRUE ) ;
const char * descrizione_sezione ( char ) ;
const char * descrizione_lettera ( char , char ) ;
const char * descrizione_numeroromano ( char , char , int ) ;
const char * descrizione_numero ( char , char , int , int ) ;
const char * descrizione_sottoconto ( int , int , long ) ;
const char * descr_sottoc_clifo ( char , long ) ;
void setta_righe ( const char * ) ;
2003-05-05 14:32:23 +00:00
void setta_righe_verifica ( ) ;
bool devo_stampare_risultato_prima_delle_imposte ( ) const ;
void stampa_risultato_prima_delle_imposte ( ) ;
1995-01-03 16:45:39 +00:00
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 & , int , 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 , int numero ,
bool conti_ordine = TRUE , int conto = 0 ,
int gruppo = 0 , long sottoconto = 0L , char tipocf = ' ' ) ;
void set_bil_val ( bil_ivd * b , const real & saldo = ZERO ,
const real & saldorafr = ZERO ,
const real & sld_prg_dare = ZERO ,
const real & sld_prg_avere = ZERO ,
const real & mov_dare = ZERO ,
const real & mov_avere = ZERO , bool conto_dettagliato = TRUE ) ;
1997-10-16 08:47:25 +00:00
TStampa_IVdirettiva ( ) { }
1995-01-03 16:45:39 +00:00
} ;
1997-10-16 08:47:25 +00:00
HIDDEN inline TStampa_IVdirettiva & a ( ) { return ( TStampa_IVdirettiva & ) main_app ( ) ; }
1995-01-03 16:45:39 +00:00
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : postclose_print ( )
1995-01-03 16:45:39 +00:00
{
delete _sort ;
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : aggiungi_anno ( int anno , TDate & inizio , TDate & fine )
1996-10-11 11:36:15 +00:00
{
1997-06-19 14:33:52 +00:00
TEsercizi_contabili ese ;
if ( ese . exist ( anno ) )
1996-10-11 11:36:15 +00:00
{
1997-06-19 14:33:52 +00:00
inizio = ese [ anno ] . inizio ( ) ;
fine = ese [ anno ] . fine ( ) ;
1996-10-11 11:36:15 +00:00
}
1997-06-19 14:33:52 +00:00
else
inizio = fine = botime ;
}
1997-10-16 08:47:25 +00:00
int TStampa_IVdirettiva : : date2esc ( const TDate & d )
1997-06-19 14:33:52 +00:00
{
TEsercizi_contabili ese ;
return ese . date2esc ( d ) ;
1996-10-11 11:36:15 +00:00
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : set_bil_key ( bil_ivd * b , char sezione , char lettera ,
1995-01-03 16:45:39 +00:00
const char * numero_romano , int 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 , " %2d " , numero ) ;
if ( gruppo < 0 )
{
strcpy ( b - > gruppo , " ZZZ " ) ;
strcpy ( b - > conto , " ZZZ " ) ;
strcpy ( b - > sottoc , " ZZZZZZ " ) ;
b - > tipocf = ' ' ;
}
else
if ( gruppo = = 0 )
{
strcpy ( b - > gruppo , " AAA " ) ;
strcpy ( b - > conto , " AAA " ) ;
strcpy ( b - > sottoc , " AAAAAA " ) ;
b - > tipocf = ' ' ;
}
else
{
sprintf ( b - > gruppo , " %3d " , gruppo ) ;
sprintf ( b - > conto , " %3d " , conto ) ;
sprintf ( b - > sottoc , " %6ld " , sottoconto ) ;
b - > tipocf = tipocf ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : set_bil_val ( bil_ivd * b , const real & saldo ,
1995-01-03 16:45:39 +00:00
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 ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : data_limite ( TMask_field & f , KEY key )
1995-01-03 16:45:39 +00:00
{
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 )
{
1997-06-19 14:33:52 +00:00
a ( ) . aggiungi_anno ( annoese , in , fin ) ;
1995-01-03 16:45:39 +00:00
a ( ) . _data_ini_ese = in ;
1997-06-19 14:33:52 +00:00
a ( ) . _data_fine_ese = fin ;
1995-01-03 16:45:39 +00:00
a ( ) . _anno_esercizio = annoese ;
if ( datalim = = botime )
a ( ) . _datalimite = a ( ) . _data_fine_ese ;
else
if ( ( datalim < in ) | | ( datalim > fin ) )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data limite non appartiene all' esercizio indicato " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
}
else
a ( ) . _datalimite = datalim ;
}
else
if ( annoese = = 0 )
{
if ( datalim = = botime )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data limite deve essere indicata obbligatoriamente " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
}
1996-06-19 14:04:56 +00:00
int anno = a ( ) . date2esc ( datalim ) ;
1995-01-03 16:45:39 +00:00
if ( anno = = 0 )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data limite indicata non appartiene ad alcun esercizio attivo della ditta " ) ) ;
1995-01-03 16:45:39 +00:00
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 ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : data_bil_raff ( TMask_field & f , KEY key )
1995-01-03 16:45:39 +00:00
{
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 ) ;
2003-02-25 15:22:52 +00:00
if ( tipobil = = 1 )
1995-01-03 16:45:39 +00:00
{
dataraf = m . get ( F_DATABILRAF ) ;
datalim = m . get ( F_DATALIM ) ;
if ( annoraf = = 0 )
{
int anno ;
if ( datalim ! = botime )
{
1996-06-19 14:04:56 +00:00
a ( ) . date2esc ( datalim ) ;
1995-01-03 16:45:39 +00:00
in = a ( ) . _inizioEs ;
}
else
1997-06-19 14:33:52 +00:00
a ( ) . aggiungi_anno ( annoese , in , fin ) ;
1995-01-03 16:45:39 +00:00
TString instr = in . string ( ) ;
if ( dataraf ! = botime )
{
1996-06-19 14:04:56 +00:00
anno = a ( ) . date2esc ( dataraf ) ;
1995-01-03 16:45:39 +00:00
in_raf = a ( ) . _inizioEs ;
fin_raf = a ( ) . _fineEs ;
a ( ) . _anno_esercizio_raf = anno ;
}
else
1999-04-16 12:02:04 +00:00
anno = 1 ;
2003-02-25 15:22:52 +00:00
if ( dataraf > in )
1995-01-03 16:45:39 +00:00
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data bilancio da raffrontare non puo' essere maggiore o uguale alla data inizio esercizio in corso " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
2003-02-25 15:22:52 +00:00
}
1995-01-03 16:45:39 +00:00
2003-02-25 15:22:52 +00:00
if ( anno = = 0 )
{
f . error_box ( TR ( " La data bilancio da raffrontare indicata non appartiene ad alcun esercizio attivo della ditta " ) ) ;
return FALSE ;
}
1995-01-03 16:45:39 +00:00
2003-02-25 15:22:52 +00:00
a ( ) . _databilrafr = dataraf ;
a ( ) . _data_ini_raf = in_raf ;
a ( ) . _data_fine_raf = fin_raf ;
1995-01-03 16:45:39 +00:00
}
else
1997-06-19 14:33:52 +00:00
{
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 ) ;
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
if ( dataraf = = botime )
a ( ) . _databilrafr = fin_raf ;
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
else
if ( dataraf < in_raf | | dataraf > fin_raf )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data bilancio da raffrontare deve appartenere all' esercizio da raffrontare " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
}
1995-01-03 16:45:39 +00:00
else
1997-06-19 14:33:52 +00:00
a ( ) . _databilrafr = dataraf ;
a ( ) . _anno_esercizio_raf = annoraf ;
}
1995-01-03 16:45:39 +00:00
}
} // 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 )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " L' anno esercizio da raffrontare deve essere inferiore all' anno esercizio in corso " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
}
}
else
if ( annoese = = 0 )
{
datalim = f . mask ( ) . get ( F_DATALIM ) ;
if ( datalim ! = botime )
{
1996-06-19 14:04:56 +00:00
anno = a ( ) . date2esc ( datalim ) ;
1995-01-03 16:45:39 +00:00
if ( annoraf > = anno )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " L' anno esercizio da raffrontare deve essere inferiore all' anno di esercizio di appartenenza della data limite " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
}
}
}
}
}
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : tipo_bilancio ( TMask_field & f , KEY key )
1995-01-03 16:45:39 +00:00
{
1996-07-09 13:00:08 +00:00
int tipo_bil , anno , tipo_stampa ;
1995-01-03 16:45:39 +00:00
if ( key = = K_SPACE )
{
1996-07-09 13:00:08 +00:00
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 ) ;
1995-01-03 16:45:39 +00:00
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 )
1996-11-05 08:11:31 +00:00
{
if ( tipo_stampa = = 1 )
1995-01-03 16:45:39 +00:00
{
1996-11-05 08:11:31 +00:00
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 ) ;
}
1995-01-03 16:45:39 +00:00
}
else
1996-11-05 08:11:31 +00:00
{
f . mask ( ) . hide ( 98 ) ;
f . mask ( ) . hide ( 99 ) ;
f . mask ( ) . hide ( 96 ) ;
f . mask ( ) . hide ( 97 ) ;
}
1996-07-09 13:00:08 +00:00
}
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 ) ;
1995-01-03 16:45:39 +00:00
}
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : anno_esercizio ( TMask_field & f , KEY key )
1995-01-03 16:45:39 +00:00
{
int tipo_bil , anno ;
if ( key = = K_TAB | | f . focusdirty ( ) )
{
1996-11-05 08:11:31 +00:00
int tipo_stp ;
1995-01-03 16:45:39 +00:00
tipo_bil = f . mask ( ) . get_int ( F_TIPOBIL ) ;
anno = f . mask ( ) . get_int ( F_ANNOESE ) ;
1996-11-05 08:11:31 +00:00
if ( tipo_bil = = 1 )
tipo_stp = f . mask ( ) . get_int ( F_TIPOSTAMPA ) ;
else
tipo_stp = f . mask ( ) . get_int ( F_TIPOSTAMPA1 ) ;
1995-01-03 16:45:39 +00:00
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 )
{
1996-11-05 08:11:31 +00:00
if ( tipo_stp = = 1 )
1995-01-03 16:45:39 +00:00
{
1996-11-05 08:11:31 +00:00
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 ) ;
}
1995-01-03 16:45:39 +00:00
}
else
1996-11-05 08:11:31 +00:00
{
f . mask ( ) . hide ( 98 ) ;
f . mask ( ) . hide ( 99 ) ;
f . mask ( ) . hide ( 96 ) ;
f . mask ( ) . hide ( 97 ) ;
}
1995-01-03 16:45:39 +00:00
}
1996-07-09 13:00:08 +00:00
}
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 ) ;
}
1995-01-03 16:45:39 +00:00
}
1996-07-09 13:00:08 +00:00
1995-01-03 16:45:39 +00:00
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : tipo_stampa ( TMask_field & f , KEY k )
1995-01-03 16:45:39 +00:00
{
1996-07-09 13:00:08 +00:00
int tipo_bil , tipo_stampa ;
1995-01-03 16:45:39 +00:00
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 )
{
2003-02-25 15:22:52 +00:00
error_box ( TR ( " Nella stampa all'ultima immissione l'anno esercizio e' obbligatorio " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
}
}
1996-07-09 13:00:08 +00:00
if ( k = = K_SPACE )
1996-11-05 08:11:31 +00:00
{
int anno = f . mask ( ) . get_int ( F_ANNOESE ) ;
1996-07-09 13:00:08 +00:00
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 ) ;
1996-11-05 08:11:31 +00:00
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 ) ;
}
}
1996-07-09 13:00:08 +00:00
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 ) ;
}
1995-01-03 16:45:39 +00:00
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : data_inizio ( TMask_field & f , KEY k )
1995-01-03 16:45:39 +00:00
{
int anno ;
TDate data ;
TDate in = " " , fin = " " ;
anno = f . mask ( ) . get_int ( F_ANNOESE ) ;
data = f . mask ( ) . get ( F_DATAINI ) ;
1995-04-06 16:10:12 +00:00
//a()._anno_esercizio = anno;
1995-01-03 16:45:39 +00:00
if ( k = = K_ENTER )
{
if ( anno ! = 0 )
{
1997-06-19 14:33:52 +00:00
a ( ) . aggiungi_anno ( anno , in , fin ) ;
1995-01-03 16:45:39 +00:00
a ( ) . _data_ini_ese = in ;
a ( ) . _data_fine_ese = fin ;
a ( ) . _anno_esercizio = anno ;
if ( data = = botime )
1995-04-06 16:10:12 +00:00
a ( ) . _dataini = in ;
1995-01-03 16:45:39 +00:00
else
1997-06-19 14:33:52 +00:00
if ( data < in | | data > fin )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data non appartiene all' esercizio indicato " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
}
else
a ( ) . _dataini = data ;
1995-01-03 16:45:39 +00:00
}
else
{
1997-06-19 14:33:52 +00:00
if ( data = = botime )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data deve essere obbligatoriamente indicata " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
}
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
int anno = a ( ) . date2esc ( data ) ;
if ( anno = = 0 )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data limite indicata non appartiene ad alcun esercizio attivo della ditta " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
}
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
a ( ) . _anno_esercizio = anno ;
a ( ) . _dataini = data ;
a ( ) . _data_ini_ese = a ( ) . _inizioEs ;
a ( ) . _data_fine_ese = a ( ) . _fineEs ;
1995-04-06 16:10:12 +00:00
}
1995-01-03 16:45:39 +00:00
}
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : data_fine ( TMask_field & f , KEY k )
1997-06-19 14:33:52 +00:00
{
TMask & m = f . mask ( ) ;
1995-01-03 16:45:39 +00:00
int annoes ;
TDate data , data_ini ;
TDate in = " " , fin = " " ;
1997-06-19 14:33:52 +00:00
annoes = m . get_int ( F_ANNOESE ) ;
data = m . get ( F_DATAFINE ) ;
data_ini = m . get ( F_DATAINI ) ;
1995-04-06 16:10:12 +00:00
//a()._anno_esercizio = annoes;
1996-06-19 14:04:56 +00:00
if ( k = = K_TAB )
{
TDate data ( f . get ( ) ) ;
1997-06-19 14:33:52 +00:00
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 ) ;
1996-06-19 14:04:56 +00:00
}
1995-01-03 16:45:39 +00:00
if ( k = = K_ENTER )
{
if ( annoes ! = 0 )
{
1997-06-19 14:33:52 +00:00
a ( ) . aggiungi_anno ( annoes , in , fin ) ;
1995-01-03 16:45:39 +00:00
a ( ) . _data_ini_ese = in ;
a ( ) . _data_fine_ese = fin ;
if ( data = = botime )
1997-06-19 14:33:52 +00:00
a ( ) . _datafine = fin ;
1995-01-03 16:45:39 +00:00
else
1997-06-19 14:33:52 +00:00
if ( data < in | | data > fin )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data non appartiene all' esercizio indicato " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
}
else
a ( ) . _datafine = data ;
1995-01-03 16:45:39 +00:00
}
else
{
1997-06-19 14:33:52 +00:00
if ( data = = botime )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data deve essere obbligatoriamente indicata " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
}
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
a ( ) . date2esc ( data_ini ) ;
if ( data < a ( ) . _inizioEs | | data > a ( ) . _fineEs )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data non appartiene all' esercizio indicato " ) ) ;
1997-06-19 14:33:52 +00:00
return FALSE ;
1995-01-03 16:45:39 +00:00
}
1997-06-19 14:33:52 +00:00
else
a ( ) . _datafine = data ;
}
1995-01-03 16:45:39 +00:00
if ( data < data_ini )
{
2003-02-25 15:22:52 +00:00
f . error_box ( TR ( " La data finale non puo' essere inferiore alla data di partenza " ) ) ;
1995-01-03 16:45:39 +00:00
return FALSE ;
}
}
1997-06-19 14:33:52 +00:00
1995-01-03 16:45:39 +00:00
return TRUE ;
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : scrivi_record ( const TString & sez ,
1995-01-03 16:45:39 +00:00
const TString & let , const TString & numerorom , int numero ,
int g , int c , long s , const real & saldo , const real & saldorafr ,
const real & sld_dare , const real & sld_avere ,
const real & mov_dare , const real & mov_avere , char tipocf , 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 ) ;
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : riempi_record ( const TString & sez ,
1995-01-03 16:45:39 +00:00
const TString & let , const TString & numerorom , int numero ,
int g , int c , long s , const real & saldo , const real & saldorafr ,
const real & sld_dare , const real & sld_avere ,
const real & mov_dare , const real & mov_avere , char tipocf , bool conto_dettagliato )
{
2001-05-01 08:17:07 +00:00
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 + + ;
}
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : crea_sort_tabella ( )
1995-01-03 16:45:39 +00:00
{
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 ) ;
TString16 nrom ( ( const char * ) numerorom ) ;
const int nu = ( int ) 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.
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : crea_sort_piano_conti_scalare ( )
1995-01-03 16:45:39 +00:00
{
TLocalisamfile pconti ( LF_PCON ) ;
TString sez , let , numerorom ;
TString sez_conto , let_conto , numr_conto , sez_opp , let_opp , numr_opp ;
int num_conto , indbil ;
char sezione , lettera , tmcf ;
int numero , g , c , num_opp ;
long s ;
bool sez_opposta = FALSE ;
bool no_sez_opposta = FALSE ;
bool classe_conto = FALSE ;
bool conto_dettagliato = FALSE ;
bool stsottbil ;
int gruppo_prec , conto_prec ;
real saldo , saldo_raf , saldo_conto , saldo_conto_raf ;
real saldo_conto_opp , saldo_conto_raf_opp ;
c = 0 ;
num_conto = 0 ;
tmcf = ' ' ;
indbil = 0 ;
saldo_conto = ZERO ;
saldo_conto_raf = ZERO ;
saldo_conto_opp = ZERO ;
saldo_conto_raf_opp = ZERO ;
gruppo_prec = - 1 ;
conto_prec = - 1 ;
for ( pconti . first ( ) ; ! pconti . eof ( ) ; pconti . next ( ) )
{
_prog - > addstatus ( 1 ) ;
g = pconti . get_int ( PCN_GRUPPO ) ;
c = pconti . get_int ( PCN_CONTO ) ;
s = pconti . get_long ( PCN_SOTTOCONTO ) ;
sez = pconti . get ( PCN_SEZIVD ) ;
let = pconti . get ( PCN_LETTIVD ) ;
sezione = sez [ 0 ] ;
lettera = let [ 0 ] ;
numerorom = pconti . get ( PCN_NUMRIVD ) ;
numero = pconti . get_int ( PCN_NUMIVD ) ;
saldo = ZERO ;
saldo_raf = ZERO ;
//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 + + )
{
1997-10-16 08:47:25 +00:00
TRiga_sez_opp * lriga = _sezopps . riga ( ) ;
1995-01-03 16:45:39 +00:00
TString sez_opp = lriga - > sezione ( ) ;
TString let_opp = lriga - > lettera ( ) ;
TString 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'.
int 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 ) )
{
1995-01-26 13:55:45 +00:00
stsottbil = ! pconti . get_bool ( PCN_STSOTTBIL ) ;
1995-01-03 16:45:39 +00:00
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)
1995-04-06 16:10:12 +00:00
if ( sez ! = " 0 " & & sez ! = " " )
1995-01-03 16:45:39 +00:00
{
if ( ! stsottbil | | tmcf = = ' C ' | | tmcf = = ' F ' )
conto_dettagliato = FALSE ;
else
conto_dettagliato = TRUE ;
sez_conto = sez ;
if ( let ! = " " )
let_conto = let ;
else
if ( ( sez = = " 1 " ) | | ( sez = = " 2 " ) )
let_conto = " Z " ;
else
let_conto = let ;
numr_conto = numerorom ;
num_conto = numero ;
classe_conto = TRUE ;
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.
bool stessa_sezione = ( saldo * saldo_raf ) > ZERO ;
if ( classe_conto )
{
sez_opp = pconti . get ( PCN_SEZIVDOPP ) ;
1998-11-04 18:04:26 +00:00
if ( sez_opp . not_empty ( ) & & sez_opp ! = " 0 " )
1995-01-03 16:45:39 +00:00
{
let_opp = pconti . get ( PCN_LETTIVDOPP ) ;
numr_opp = pconti . get ( PCN_NUMRIVDOPP ) ;
num_opp = pconti . get_int ( PCN_NUMIVDOPP ) ;
if ( sez_conto = = " 1 " & & saldo < ZERO ) // || (sez_conto == "2" && saldo > ZERO) )
{
saldo = - saldo ;
rec_es_corr = TRUE ;
}
if ( sez_conto = = " 1 " & & saldo_raf < ZERO ) //|| (sez_conto == "2" && saldo_raf > ZERO) )
{
saldo_raf = - saldo_raf ;
rec_es_prec = TRUE ;
}
if ( sez_conto = = " 2 " & & saldo > ZERO )
{
rec_es_corr = TRUE ;
}
if ( sez_conto = = " 2 " & & saldo_raf > ZERO )
{
rec_es_prec = TRUE ;
}
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 += saldo;
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 ;
//saldo_conto_raf += saldo_raf;
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 ) ;
1998-11-04 18:04:26 +00:00
if ( sez_opp . not_empty ( ) & & sez_opp ! = " 0 " )
1995-01-03 16:45:39 +00:00
{
let_opp = pconti . get ( PCN_LETTIVDOPP ) ;
numr_opp = pconti . get ( PCN_NUMRIVDOPP ) ;
num_opp = pconti . get_int ( PCN_NUMIVDOPP ) ;
if ( sez = = " 1 " & & saldo < ZERO ) //|| (sez == "2" && saldo > ZERO) )
{
saldo = - saldo ;
rec_es_corr = TRUE ;
}
if ( sez = = " 1 " & & saldo_raf < ZERO ) //|| (sez == "2" && saldo_raf > ZERO) )
{
saldo_raf = - saldo_raf ;
rec_es_prec = TRUE ;
}
if ( sez = = " 2 " & & saldo > ZERO )
{
rec_es_corr = TRUE ;
}
if ( sez = = " 2 " & & saldo_raf > ZERO )
{
rec_es_prec = TRUE ;
}
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
1995-04-06 16:10:12 +00:00
if ( sez ! = " 0 " & & sez ! = " " )
1995-01-03 16:45:39 +00:00
{
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
1995-04-06 16:10:12 +00:00
if ( sez ! = " 0 " & & sez ! = " " )
1995-01-03 16:45:39 +00:00
{
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 + + )
{
1997-10-16 08:47:25 +00:00
TRiga_sez_opp * lriga = _sezopps . riga ( ) ;
1995-01-03 16:45:39 +00:00
TString sez_opp = lriga - > sezione ( ) ;
TString let_opp = lriga - > lettera ( ) ;
TString numr_opp = lriga - > num_rom ( ) ;
if ( numr_opp = = " " )
numr_opp . ltrim ( ) ;
int 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 ( ) ;
}
}
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : crea_sort_piano_conti_verifica ( )
1995-01-03 16:45:39 +00:00
{
TLocalisamfile pconti ( LF_PCON ) ;
TString sez , let , numerorom ;
TString sez_conto , let_conto , numr_conto ;
int num_conto ;
char sezione , lettera , tmcf ;
int numero , g , c ;
long s ;
bool classe_conto = FALSE ;
bool conto_dettagliato = FALSE ;
bool 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 ;
1995-04-06 16:10:12 +00:00
_nuovo_tot_saldo_d = ZERO ;
_nuovo_tot_saldo_a = ZERO ;
1995-01-03 16:45:39 +00:00
indbil = 0 ;
gruppo_prec = - 1 ;
conto_prec = - 1 ;
c = 0 ;
num_conto = 0 ;
tmcf = ' ' ;
for ( pconti . first ( ) ; ! pconti . eof ( ) ; pconti . next ( ) )
{
_prog - > addstatus ( 1 ) ;
g = pconti . get_int ( PCN_GRUPPO ) ;
c = pconti . get_int ( PCN_CONTO ) ;
s = pconti . get_long ( PCN_SOTTOCONTO ) ;
sez = pconti . get ( PCN_SEZIVD ) ;
let = pconti . get ( PCN_LETTIVD ) ;
sezione = sez [ 0 ] ;
lettera = let [ 0 ] ;
numerorom = pconti . get ( PCN_NUMRIVD ) ;
numero = pconti . get_int ( PCN_NUMIVD ) ;
real app ;
saldo = ZERO ;
sld_prg_dare = ZERO ;
sld_prg_avere = ZERO ;
mov_dare = ZERO ;
mov_avere = ZERO ;
app = ZERO ;
1997-05-22 08:51:20 +00:00
//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 ;
1995-01-03 16:45:39 +00:00
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 ) )
{
1995-01-26 13:55:45 +00:00
stsottbil = ! pconti . get_bool ( PCN_STSOTTBIL ) ;
1995-01-03 16:45:39 +00:00
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)
1995-04-06 16:10:12 +00:00
if ( sez ! = " 0 " & & sez ! = " " )
1995-01-03 16:45:39 +00:00
{
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 ! = " " )
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 ;
1995-04-06 16:10:12 +00:00
saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere ;
1995-11-30 09:39:32 +00:00
//modifica del 27/11/1995
1995-04-06 16:10:12 +00:00
_nuovo_tot_saldo_d + = mov_dare ;
_nuovo_tot_saldo_a + = mov_avere ;
1995-11-30 09:39:32 +00:00
_nuovo_tot_saldo_d + = sld_prg_dare ;
_nuovo_tot_saldo_a + = sld_prg_avere ;
1995-04-06 16:10:12 +00:00
//fine modifica
1995-01-03 16:45:39 +00:00
}
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 )
{
1995-04-19 13:13:21 +00:00
if ( ! _sld - > ultima_immissione_verifica ( _anno_esercizio , g , c , s , indbil , _stampa_mov_prov ) )
1997-11-12 10:46:27 +00:00
continue ;
app = _sld - > saldoini ( ) ;
//fine modifica 11/11/1997
1995-01-03 16:45:39 +00:00
if ( app < ZERO )
{
sld_prg_dare = ZERO ;
1997-11-12 10:46:27 +00:00
sld_prg_avere = - app ;
1995-01-03 16:45:39 +00:00
}
else
{
sld_prg_dare = app ;
sld_prg_avere = ZERO ;
}
mov_dare = _sld - > prgdare ( ) ;
mov_avere = _sld - > prgavere ( ) ;
1995-04-06 16:10:12 +00:00
saldo = sld_prg_dare - sld_prg_avere + mov_dare - mov_avere ;
//modifica del 05/04/1995
1997-11-12 10:46:27 +00:00
if ( ! ( saldo . is_zero ( ) & & _stampamov ) )
1995-04-06 16:10:12 +00:00
{
_nuovo_tot_saldo_d + = mov_dare ;
_nuovo_tot_saldo_a + = mov_avere ;
1997-11-12 10:46:27 +00:00
const real nuovo = _sld - > saldoinisusaldi ( ) ;
if ( nuovo > = ZERO )
1995-04-06 16:10:12 +00:00
_nuovo_tot_saldo_d + = nuovo ;
else
1997-11-12 10:46:27 +00:00
_nuovo_tot_saldo_a - = nuovo ;
1995-04-06 16:10:12 +00:00
}
//fine modifica
1995-01-03 16:45:39 +00:00
}
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 ) ;
1997-11-12 10:46:27 +00:00
if ( ! ( saldo . is_zero ( ) & & _stampamov ) ) //Se non deve stampare i conti con saldo a zero, non aggiornare il totale del conto
1997-05-22 08:51:20 +00:00
{
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 ;
}
1995-01-03 16:45:39 +00:00
}
else
{
1995-04-06 16:10:12 +00:00
if ( sez ! = " 0 " & & sez ! = " " )
2001-05-01 08:17:07 +00:00
scrivi_record ( sez , let , numerorom , numero , g , c , s , saldo , ZERO , sld_prg_dare , sld_prg_avere , mov_dare , mov_avere , tmcf ) ;
1995-01-03 16:45:39 +00:00
}
}
}
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 ;
}
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : sottoc_clifo_verifica ( int g , int c , int anno , char tipocf , TString & sez , TString & let , TString & numerorom , int numero , int indbil , bool stsottbil )
1995-01-03 16:45:39 +00:00
{
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 ;
int num_conto ;
saldo_conto = ZERO ;
sld_prg_dare_conto = ZERO ;
sld_prg_avere_conto = ZERO ;
mov_dare_conto = ZERO ;
mov_avere_conto = ZERO ;
1995-04-06 16:10:12 +00:00
1995-01-03 16:45:39 +00:00
int items = _listasld - > items ( ) ;
sez_conto = sez ;
if ( let ! = " " )
let_conto = let ;
else
if ( ( sez = = " 1 " ) | | ( sez = = " 2 " ) )
let_conto = " Z " ;
else
let_conto = let ;
numr_conto = numerorom ;
num_conto = numero ;
_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 ;
1995-04-06 16:10:12 +00:00
1995-11-30 09:39:32 +00:00
//modifica 27/11/1995
1995-04-06 16:10:12 +00:00
_nuovo_tot_saldo_d + = mov_dare ;
_nuovo_tot_saldo_a + = mov_avere ;
1995-11-30 09:39:32 +00:00
_nuovo_tot_saldo_d + = sld_prg_dare ;
_nuovo_tot_saldo_a + = sld_prg_avere ;
1995-04-06 16:10:12 +00:00
//fine modifica
1995-01-03 16:45:39 +00:00
}
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 )
{
1995-04-06 16:10:12 +00:00
//modifica 05/04/1994
1995-04-19 13:13:21 +00:00
if ( ! _sld - > ultima_immissione_verifica ( _anno_esercizio , g , c , s , indbil , _stampa_mov_prov ) )
1995-04-06 16:10:12 +00:00
{
if ( indbil = = 1 | | indbil = = 2 | | indbil = = 5 )
app = _sld - > saldofin_esprec ( _anno_esercizio , g , c , s ) ;
}
else app = _sld - > saldoini ( ) ;
//fine modifica
1995-01-03 16:45:39 +00:00
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 ( ) ;
1995-04-06 16:10:12 +00:00
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
1995-01-03 16:45:39 +00:00
}
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 ) ;
1997-05-22 08:51:20 +00:00
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 ;
}
1995-01-03 16:45:39 +00:00
}
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 ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : sottoc_clifo_scalare ( int g , int c , int anno , int indbil , real & saldo_conto , real & saldo_conto_raf )
1995-01-03 16:45:39 +00:00
{
long s ;
int aep = 0 ;
if ( anno ) aep = anno - 1 ;
_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.
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : calcola_saldo ( real & saldo , real & saldo_raf , int g , int c , long s , int indbil )
1995-01-03 16:45:39 +00:00
{
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 )
{
1995-04-19 13:13:21 +00:00
if ( ! _sld - > ultima_immissione_bilancio ( _anno_esercizio , g , c , s , indbil , _stampa_mov_prov ) )
1995-01-03 16:45:39 +00:00
{
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 ) ;
1996-06-14 14:38:05 +00:00
if ( _databilrafr ! = _data_fine_raf ) //(_tipo_stampa == 1) bilancio per data limite
{
1995-01-03 16:45:39 +00:00
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 ;
}
1996-06-14 14:38:05 +00:00
}
2003-02-25 15:22:52 +00:00
else if ( _databilrafr = = _data_fine_raf )
1995-11-03 15:38:55 +00:00
{
1996-07-09 13:00:08 +00:00
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
1995-01-03 16:45:39 +00:00
no_movimentato_raf = TRUE ;
else
no_movimentato_raf = FALSE ;
}
else
no_movimentato_raf = FALSE ;
saldo_raf = _sld - > saldo ( ) ;
1996-06-14 14:38:05 +00:00
}
1995-01-03 16:45:39 +00:00
saldo_rafstr = saldo_raf . string ( ) ;
}
}
if ( ( no_movimentato ) & & ( no_movimentato_raf ) )
return FALSE ;
else
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : calcola ( int g , int c , long s ,
1995-01-03 16:45:39 +00:00
const TDate & fine_es , const TDate & fine_es_prec )
{
1997-06-19 14:33:52 +00:00
TLocalisamfile rmov ( LF_RMOV ) ;
TLocalisamfile mov ( LF_MOV ) ;
TDecoder causali ( LF_CAUSALI , CAU_MOVAP ) ;
1995-01-03 16:45:39 +00:00
TString sezione ;
real importo ;
int annoe ;
long num_reg ;
1995-04-19 13:13:21 +00:00
char provvis ;
1995-01-03 16:45:39 +00:00
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 ( ) ;
1995-04-19 13:13:21 +00:00
provvis = mov . get_char ( MOV_PROVVIS ) ;
1995-01-03 16:45:39 +00:00
datacomp = mov . get_date ( MOV_DATACOMP ) ;
1995-04-19 13:13:21 +00:00
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 ;
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
const TString & codcaus = mov . get ( MOV_CODCAUS ) ;
1999-04-06 15:34:39 +00:00
char movap = causali . decode ( codcaus ) [ 0 ] ;
movap = toupper ( movap ) ;
1997-06-19 14:33:52 +00:00
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
1995-03-08 13:23:55 +00:00
1995-01-03 16:45:39 +00:00
if ( _annoese = = 0 )
data = datareg ;
if ( _annoese ! = 0 )
data = datacomp ;
1995-02-24 10:18:23 +00:00
1995-04-19 13:13:21 +00:00
if ( importo = = ZERO )
continue ;
1995-01-03 16:45:39 +00:00
//calcolo i movimenti del periodo
1995-03-08 13:23:55 +00:00
if ( ( data > = _dataini ) & & ( data < = _datafine ) )
1997-06-19 14:33:52 +00:00
if ( ( movap = = ' A ' & & _data_ini_ese ! = _dataini ) | | ( movap ! = ' A ' ) )
1995-03-08 13:23:55 +00:00
{
conto_mov = TRUE ;
if ( sezione = = " D " )
_mov_periodo_dare + = importo ;
else _mov_periodo_avere + = importo ;
}
1995-01-03 16:45:39 +00:00
//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
{
1997-06-19 14:33:52 +00:00
if ( movap = = ' A ' )
1996-09-26 15:06:12 +00:00
{
if ( data > = _data_ini_ese & & data < = _datafine )
{
if ( sezione = = " D " )
_saldo_ini_dare + = importo ;
else _saldo_ini_avere + = importo ;
conto_mov = TRUE ;
}
1995-01-03 16:45:39 +00:00
}
}
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 ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : set_print ( int )
1995-01-03 16:45:39 +00:00
{
1997-11-12 10:46:27 +00:00
KEY tasto = _msk - > run ( ) ;
1997-06-19 14:33:52 +00:00
if ( tasto = = K_ENTER )
{
1997-10-16 08:47:25 +00:00
_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 ) ;
1997-06-19 14:33:52 +00:00
if ( _tipo_bilancio = = 1 )
1997-11-12 10:46:27 +00:00
_tipo_stampa = _msk - > get_int ( F_TIPOSTAMPA ) ;
1997-10-16 08:47:25 +00:00
else
_tipo_stampa = _msk - > get_int ( F_TIPOSTAMPA1 ) ;
2003-02-25 15:22:52 +00:00
_prog = new TProgind ( _pconti - > items ( ) , TR ( " Elaborazione in corso... prego attendere " ) , FALSE ) ;
2003-05-05 14:32:23 +00:00
1997-10-16 08:47:25 +00:00
if ( _tipo_stampa = = 2 )
1996-09-26 15:06:12 +00:00
{
1997-10-16 08:47:25 +00:00
_anno_esercizio = _annoese ;
_anno_esercizio_raf = _annoeserafr ;
}
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
_cont_let = 0 ;
_cont_numr = 0 ;
_cont_num = 0 ;
_cont_gcs = 0 ;
_reset_righe_stampa = TRUE ;
if ( _tipo_bilancio = = 1 )
1997-10-16 08:47:25 +00:00
set_real_picture ( " ###.###.###.###.### " ) ;
else
{
if ( _noseparator )
set_real_picture ( " ################ " ) ;
else
set_real_picture ( " ####.###.###.### " ) ;
}
1999-07-16 14:59:11 +00:00
set_magic_currency ( TRUE ) ;
1997-06-19 14:33:52 +00:00
1997-10-16 08:47:25 +00:00
set_print_zero ( TRUE ) ;
1995-11-17 14:29:24 +00:00
1997-06-19 14:33:52 +00:00
_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 ( ) ;
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
// 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 ( ) ;
1997-10-16 08:47:25 +00:00
else
1997-06-19 14:33:52 +00:00
crea_sort_piano_conti_verifica ( ) ;
_sort - > endsort ( ) ;
1995-01-03 16:45:39 +00:00
1997-06-19 14:33:52 +00:00
crea_intestazione ( ) ;
delete _bil ;
2003-05-05 14:32:23 +00:00
delete _prog ; _prog = NULL ;
1997-06-19 14:33:52 +00:00
return TRUE ;
}
return FALSE ;
1995-01-03 16:45:39 +00:00
}
2003-05-05 14:32:23 +00:00
// 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 ) < = 21 )
return FALSE ;
return TRUE ;
}
void TStampa_IVdirettiva : : stampa_risultato_prima_delle_imposte ( )
2001-05-01 08:17:07 +00:00
{
if ( _risimp_fatto ) // Ottimo flag che significa esattamente l'opposto! Grazie PRASSI!
2003-05-05 14:32:23 +00:00
{
const bool raff = _annoeserafr > 0 | | _databilrafr . ok ( ) ;
if ( _let_da_stamp = = ' E ' & & atoi ( _num_da_stamp ) > 21 & & // questa prima parte e' sempre TRUE!
2001-05-01 08:17:07 +00:00
! _totale_parziale . is_zero ( ) & & ! _totale_parziale_raf . is_zero ( ) )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @4gTotale delle partite straordinarie " ) ) ;
2001-05-01 08:17:07 +00:00
set_row ( _i , " @81g%r " , & _totale_parziale ) ;
if ( raff )
set_row ( _i , " @111g%r " , & _totale_parziale_raf ) ;
_i + + ;
}
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @4gRisultato prima delle imposte " ) ) ;
2001-05-01 08:17:07 +00:00
set_row ( _i , " @81g%r " , & _totale_economico ) ;
if ( raff )
set_row ( _i , " @111g%r " , & _totale_economico_raf ) ;
_i + + ;
_risimp_fatto = FALSE ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : stampa_totali ( )
1995-01-03 16:45:39 +00:00
{
bool gia_stampato_conto_ord = FALSE ;
2001-05-01 08:17:07 +00:00
const char * diff_prod = " 9B " ;
1995-01-03 16:45:39 +00:00
TString16 classe ;
classe . format ( " %c%c%8s%2s " , _sez_da_stamp , _let_da_stamp , ( const char * ) _numr_da_stamp , ( const char * ) _num_da_stamp ) ;
_num = atoi ( _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 ' )
2001-05-01 08:17:07 +00:00
if ( _cont_gcs ! = 0 ) // (_cont_gcs >= 2)
1995-01-03 16:45:39 +00:00
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale@25g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numero ) ;
1995-01-03 16:45:39 +00:00
}
}
}
2003-05-05 14:32:23 +00:00
/* Killed
2001-05-01 08:17:07 +00:00
if ( _sez_stamp = = ' 9 ' ) // Conto economico
2003-05-05 14:32:23 +00:00
{
const char * ris_imp = " 9E 21 " ;
2001-05-01 08:17:07 +00:00
if ( classe > ris_imp & & _risimp_fatto ) // Classe > 9E________21
stampa_risultato_prima_delle_imposte ( ) ;
2003-05-05 14:32:23 +00:00
}
*/
1995-01-03 16:45:39 +00:00
_cont_gcs = 0 ;
_totale_numero = 0 ;
}
if ( _numr_da_stamp ! = _numr_tot )
{
if ( _let_stamp ! = ' Z ' )
{
if ( _sez_stamp ! = ' 5 ' )
{
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale@25g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numero ) ;
1995-01-03 16:45:39 +00:00
}
}
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 ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale@21g%s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numr ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
_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%2s " , _sez_stamp , _let_stamp , ( const char * ) _numr_stamp , ( const char * ) _num_stamp ) ;
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale@25g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numero ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_num ! = 0 ) //(_cont_num >= 2)
{
//Fai il totale del numero romano e stampalo
1997-11-12 10:46:27 +00:00
const int numeror = atoi ( _numr ) ;
if ( numeror > 0 )
1995-01-03 16:45:39 +00:00
{
1997-11-12 10:46:27 +00:00
TString numrom = itor ( numeror ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale@21g%s " ) , ( const char * ) numrom ) ;
2003-05-05 14:32:23 +00:00
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numr ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let_stamp = = ' D ' )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @4gTotale delle rettifiche " ) ) ;
1995-01-03 16:45:39 +00:00
else
if ( _let ! = ' ' )
if ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale@10g%c) " ) , _let ) ;
1995-01-03 16:45:39 +00:00
else
if ( _sez_stamp ! = ' 9 ' )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale@10g%c) " ) , _let ) ;
1995-01-03 16:45:39 +00:00
if ( _let ! = ' ' )
{
if ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' )
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_lettera ) ;
1995-01-03 16:45:39 +00:00
else
if ( _sez_stamp ! = ' 9 ' )
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_lettera ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( classe > diff_prod & & _diffprod_fatto )
{
if ( _let_tot = = ' A ' | | _let_tot = = ' B ' ) //Solo se esiste una delle due lettere
{
2003-02-25 15:22:52 +00:00
set_row ( _i + + , FR ( " @4gDifferenza tra valore e costi della produzione@81g%r " ) , & _totale_economico ) ;
1995-01-03 16:45:39 +00:00
_diffprod_fatto = FALSE ;
}
}
}
else
{
if ( _let_stamp ! = ' Z ' )
{
if ( _sez_stamp ! = ' 5 ' )
{
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale@25g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numero ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_num ! = 0 ) //(_cont_num >= 2)
1995-11-17 14:29:24 +00:00
{
1995-01-03 16:45:39 +00:00
//Fai il totale del numero romano e stampalo
int numeror = atoi ( _numr ) ;
TString numrom = itor ( numeror ) ;
if ( numrom ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale@21g%s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numr ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let ! = ' ' )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale@10g%c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_lettera ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
if ( ( _sez_stamp = = ' 1 ' ) & & ( _let_da_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE ATTIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_sezione ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE PASSIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_sezione ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE ATTIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_ordine_attivo ) ;
1995-11-17 14:29:24 +00:00
// _totale_ordine_attivo = ZERO;
1995-01-03 16:45:39 +00:00
gia_stampato_conto_ord = TRUE ;
}
if ( ( _sez_stamp = = ' 2 ' ) & & ( _let_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE PASSIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_ordine_passivo ) ;
1995-01-03 16:45:39 +00:00
_i + + ;
if ( ! _attivo_o_passivo )
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo ;
if ( totale ! = ZERO )
{
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO CONTI D'ORDINE " ) ) ;
set_row ( _i , TR ( " SBILANCIO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & totale ) ;
1995-01-03 16:45:39 +00:00
}
_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 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale@25g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numero ) ;
1995-01-03 16:45:39 +00:00
}
}
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 ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale@21g%s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numr ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let ! = ' ' )
{
2003-02-25 15:22:52 +00:00
if ( ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' ) | | ( _sez_stamp ! = ' 9 ' ) )
1995-01-03 16:45:39 +00:00
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale@10g%c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_lettera ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
}
if ( ! _totale_attivita_gia_stampato )
if ( ( _sez_stamp = = ' 1 ' ) & & ( _let_stamp ! = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE ATTIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_sezione ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE PASSIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_sezione ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO STATO PATRIMONIALE " ) ) ;
set_row ( _i , TR ( " SBILANCIO (ATTIVO - PASSIVO) " ) ) ;
1995-01-03 16:45:39 +00:00
//_totale_patrimoniale = _totale_attivita - _totale_passivita;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_patrimoniale ) ;
1995-01-03 16:45:39 +00:00
_totale_patrimoniale = ZERO ;
}
_sbilancio_patr_gia_stampato = TRUE ;
}
}
if ( ( _sez_stamp = = ' 1 ' ) & & ( _let_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE ATTIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_ordine_attivo ) ;
1995-01-03 16:45:39 +00:00
// _totale_ordine_attivo = ZERO;
}
if ( ( _sez_stamp = = ' 2 ' ) & & ( _let_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE PASSIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_ordine_passivo ) ;
1995-01-03 16:45:39 +00:00
_i + + ;
if ( ! _sbilancio_ordine )
{
real totale = _totale_ordine_attivo - _totale_ordine_passivo ;
if ( totale ! = ZERO )
{
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO CONTI D'ORDINE " ) ) ;
set_row ( _i , TR ( " SBILANCIO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & totale ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO STATO PATRIMONIALE " ) ) ;
set_row ( _i , TR ( " SBILANCIO (ATTIVO - PASSIVO) " ) ) ;
1995-01-03 16:45:39 +00:00
//_totale_patrimoniale = _totale_attivita - _totale_passivita;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_patrimoniale ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO CONTI D'ORDINE " ) ) ;
set_row ( _i , TR ( " SBILANCIO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & totale ) ;
1995-01-03 16:45:39 +00:00
}
}
}
if ( _sez_stamp = = ' 5 ' )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_ordine ) ;
1995-01-03 16:45:39 +00:00
_totale_ordine = ZERO ;
}
2001-05-01 08:17:07 +00:00
1995-01-03 16:45:39 +00:00
if ( _sez_stamp = = ' 9 ' )
{
if ( _buff = = NULL )
{
if ( ( _let_stamp = = ' A ' | | _let_stamp = = ' B ' ) & & _diffprod_fatto ) //Solo se esiste una delle due lettere
{
2003-02-25 15:22:52 +00:00
set_row ( _i + + , FR ( " @4gDifferenza tra valore e costi della produzione@81g%r " ) , & _totale_economico ) ;
1995-01-03 16:45:39 +00:00
_diffprod_fatto = FALSE ;
}
2003-05-05 14:32:23 +00:00
/* Killed
1995-01-03 16:45:39 +00:00
if ( _risimp_fatto )
2001-05-01 08:17:07 +00:00
stampa_risultato_prima_delle_imposte ( ) ;
2003-05-05 14:32:23 +00:00
*/
1995-01-03 16:45:39 +00:00
}
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
if ( _totale_economico ! = ZERO )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " RISULTATO CONTO ECONOMICO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_economico ) ;
1995-01-03 16:45:39 +00:00
_totale_economico = ZERO ;
}
}
_cont_gcs = 0 ;
_cont_num = 0 ;
_cont_numr = 0 ;
_cont_let = 0 ;
_totale_numero = 0 ;
_totale_numr = 0 ;
_totale_lettera = 0 ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : stampa_totali_con_raffronto ( )
1995-01-03 16:45:39 +00:00
{
bool gia_stampato_conto_ord = FALSE ;
1997-10-16 08:47:25 +00:00
const char * const diff_prod = " 9B " ;
1995-01-03 16:45:39 +00:00
TString16 classe ;
classe . format ( " %c%c%8s%2s " , _sez_da_stamp , _let_da_stamp , ( const char * ) _numr_da_stamp , ( const char * ) _num_da_stamp ) ;
_num = atoi ( _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 ' )
{
2001-05-01 08:17:07 +00:00
if ( _sez_stamp ! = ' 5 ' & & _cont_gcs ! = 0 )
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
1995-01-03 16:45:39 +00:00
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale %2d) " ) , _num ) ;
2001-05-01 08:17:07 +00:00
set_row ( _i , " @81g%r " , & _totale_numero ) ;
set_row ( _i + + , " @111g%r " , & _totale_num_raf ) ;
1995-01-03 16:45:39 +00:00
}
2001-05-01 08:17:07 +00:00
}
}
2003-05-05 14:32:23 +00:00
/* Killed
1995-01-03 16:45:39 +00:00
if ( _sez_stamp = = ' 9 ' )
{
if ( classe > ris_imp & & _risimp_fatto )
2003-05-05 14:32:23 +00:00
2001-05-01 08:17:07 +00:00
stampa_risultato_prima_delle_imposte ( TRUE ) ;
1995-01-03 16:45:39 +00:00
}
2003-05-05 14:32:23 +00:00
*/
2001-05-01 08:17:07 +00:00
1995-01-03 16:45:39 +00:00
_cont_gcs = 0 ;
_totale_numero = 0 ;
_totale_num_raf = 0 ;
}
if ( _numr_da_stamp ! = _numr_tot )
{
if ( _let_stamp ! = ' Z ' )
{
if ( _sez_stamp ! = ' 5 ' )
2001-05-01 08:17:07 +00:00
{
1995-01-03 16:45:39 +00:00
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale %2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_numero ) ;
set_row ( _i + + , " @111g%r " , & _totale_num_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
2001-05-01 08:17:07 +00:00
1995-01-03 16:45:39 +00:00
if ( _cont_num ! = 0 ) //(_cont_num >= 2)
{
//Fai il totale del numero romano e stampalo
int numeror = atoi ( _numr ) ;
1997-10-16 08:47:25 +00:00
TString16 numrom = itor ( numeror ) ;
1995-01-03 16:45:39 +00:00
if ( numrom ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale %s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_numr ) ;
set_row ( _i + + , " @111g%r " , & _totale_numr_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
_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%2s " , _sez_stamp , _let_stamp , ( const char * ) _numr_stamp , ( const char * ) _num_stamp ) ;
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale %2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numero ) ;
1995-01-03 16:45:39 +00:00
}
}
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 ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale %s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numr ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let_stamp = = ' D ' )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @4gTotale delle rettifiche " ) ) ;
1995-01-03 16:45:39 +00:00
else
2001-05-01 08:17:07 +00:00
{
1995-01-03 16:45:39 +00:00
if ( _let ! = ' ' )
if ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale %c) " ) , _let ) ;
1995-01-03 16:45:39 +00:00
else
if ( _sez_stamp ! = ' 9 ' )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale %c) " ) , _let ) ;
set_row ( _i , FR ( " @3gTotale %c) " ) , _let ) ;
2001-05-01 08:17:07 +00:00
}
1995-01-03 16:45:39 +00:00
if ( _let ! = ' ' )
2001-05-01 08:17:07 +00:00
{
1995-01-03 16:45:39 +00:00
if ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' )
{
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_lettera ) ;
set_row ( _i + + , " @111g%r " , & _totale_let_raf ) ;
1995-01-03 16:45:39 +00:00
}
else
if ( _sez_stamp ! = ' 9 ' )
{
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_lettera ) ;
set_row ( _i + + , " @111g%r " , & _totale_let_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
}
if ( classe > diff_prod & & _diffprod_fatto )
{
if ( _let_tot = = ' A ' | | _let_tot = = ' B ' )
{
2003-02-25 15:22:52 +00:00
set_row ( _i + + , FR ( " @4gDifferenza tra valore e costi della produzione@81g%r@111g%r " ) , & _totale_economico , & _totale_economico_raf ) ;
1995-01-03 16:45:39 +00:00
_diffprod_fatto = FALSE ;
}
}
}
else
{
if ( _let_stamp ! = ' Z ' )
{
if ( _sez_stamp ! = ' 5 ' )
{
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale@25g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_numero ) ;
set_row ( _i + + , " @111g%r " , & _totale_num_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
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 ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale@21g%s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_numr ) ;
set_row ( _i + + , " @111g%r " , & _totale_numr_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let ! = ' ' )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale %c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_lettera ) ;
set_row ( _i + + , " @111g%r " , & _totale_let_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
if ( ( _sez_stamp = = ' 1 ' ) & & ( _let_da_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE ATTIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_sezione ) ;
set_row ( _i + + , " @111g%r " , & _totale_sez_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE PASSIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_sezione ) ;
set_row ( _i + + , " @111g%r " , & _totale_sez_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE ATTIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_ordine_attivo ) ;
set_row ( _i + + , " @111g%r " , & _totale_ordine_attivo_raf ) ;
1995-01-03 16:45:39 +00:00
//_totale_ordine_attivo = ZERO;
//_totale_ordine_attivo_raf = ZERO;
gia_stampato_conto_ord = TRUE ;
}
if ( ( _sez_stamp = = ' 2 ' ) & & ( _let_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE PASSIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_ordine_passivo ) ;
set_row ( _i + + , " @111g%r " , & _totale_ordine_passivo_raf ) ;
1995-01-03 16:45:39 +00:00
_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 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO CONTI D'ORDINE " ) ) ;
set_row ( _i , TR ( " SBILANCIO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & totale ) ;
set_row ( _i + + , " @111g%r " , & tot_raf ) ;
1995-01-03 16:45:39 +00:00
}
_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 ' )
{
2003-02-25 15:22:52 +00:00
if ( _cont_gcs ! = 0 )
1995-01-03 16:45:39 +00:00
{
//Fai il totale del numero arabo e stampalo
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @18gTotale %2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_numero ) ;
set_row ( _i + + , " @111g%r " , & _totale_num_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
2003-02-25 15:22:52 +00:00
if ( _cont_num ! = 0 )
1995-01-03 16:45:39 +00:00
{
//Fai il totale del numero romano e stampalo
int numeror = atoi ( _numr ) ;
TString numrom = itor ( numeror ) ;
if ( numrom ! = " " )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @14gTotale %s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_numr ) ;
set_row ( _i + + , " @111g%r " , & _totale_numr_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let ! = ' ' )
{
if ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale %c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_lettera ) ;
set_row ( _i + + , " @111g%r " , & _totale_let_raf ) ;
1995-01-03 16:45:39 +00:00
}
else
if ( _sez_stamp ! = ' 9 ' )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @3gTotale %c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @81g%r " , & _totale_lettera ) ;
set_row ( _i + + , " @111g%r " , & _totale_let_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
}
if ( ! _totale_attivita_gia_stampato )
if ( ( _sez_stamp = = ' 1 ' ) & & ( _let_stamp ! = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE ATTIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_sezione ) ;
set_row ( _i + + , " @111g%r " , & _totale_sez_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE PASSIVO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_sezione ) ;
set_row ( _i + + , " @111g%r " , & _totale_sez_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO STATO PATRIMONIALE " ) ) ;
set_row ( _i , TR ( " SBILANCIO (ATTIVO - PASSIVO) " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_patrimoniale ) ;
set_row ( _i + + , " @111g%r " , & _totale_patrim_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE ATTIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_ordine_attivo ) ;
set_row ( _i + + , " @111g%r " , & _totale_ordine_attivo_raf ) ;
1995-01-03 16:45:39 +00:00
}
if ( ( _sez_stamp = = ' 2 ' ) & & ( _let_stamp = = ' Z ' ) )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE PASSIVI " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_ordine_passivo ) ;
set_row ( _i + + , " @111g%r " , & _totale_ordine_passivo_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO CONTI D'ORDINE " ) ) ;
set_row ( _i , TR ( " SBILANCIO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & totale ) ;
set_row ( _i + + , " @111g%r " , & tot_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO STATO PATRIMONIALE " ) ) ;
set_row ( _i , TR ( " SBILANCIO (ATTIVO - PASSIVO) " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_patrimoniale ) ;
set_row ( _i + + , " @111g%r " , & _totale_patrim_raf ) ;
1995-01-03 16:45:39 +00:00
_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 ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i + + , TR ( " SALDO CONTI D'ORDINE " ) ) ;
set_row ( _i , TR ( " SBILANCIO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & totale ) ;
set_row ( _i + + , " @111g%r " , & tot_raf ) ;
1995-01-03 16:45:39 +00:00
}
}
}
if ( _sez_stamp = = ' 5 ' )
{
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " TOTALE CONTI D'ORDINE " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_ordine ) ;
set_row ( _i + + , " @111g%r " , & _totale_ordine_raf ) ;
1995-01-03 16:45:39 +00:00
_totale_ordine = 0 ;
_totale_ordine_raf = 0 ;
}
if ( _sez_stamp = = ' 9 ' )
{
if ( _buff = = NULL )
{
if ( ( _let_stamp = = ' A ' | | _let_stamp = = ' B ' ) & & _diffprod_fatto )
{
2003-02-25 15:22:52 +00:00
set_row ( _i + + , FR ( " @4gDifferenza tra valore e costi della produzione@81g%r@111g%r " ) , & _totale_economico , & _totale_economico_raf ) ;
1995-01-03 16:45:39 +00:00
_diffprod_fatto = FALSE ;
}
2003-05-05 14:32:23 +00:00
// killed stampa_risultato_prima_delle_imposte(TRUE);
1995-01-03 16:45:39 +00:00
}
char app = ' ' ;
set_row ( _i + + , " @0g%c " , app ) ;
if ( _totale_economico ! = ZERO | | _totale_economico_raf ! = ZERO )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , TR ( " RISULTATO CONTO ECONOMICO " ) ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _totale_economico ) ;
set_row ( _i + + , " @111g%r " , & _totale_economico_raf ) ;
1995-01-03 16:45:39 +00:00
_totale_economico = 0 ;
_totale_economico_raf = 0 ;
}
}
_cont_gcs = 0 ;
_cont_num = 0 ;
_cont_numr = 0 ;
_cont_let = 0 ;
_totale_numero = 0 ;
_totale_numr = 0 ;
_totale_lettera = 0 ;
_totale_num_raf = 0 ;
_totale_numr_raf = 0 ;
_totale_let_raf = 0 ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : stampa_totali_verifica ( )
{
const char * const ris_imp = " 9E 21 " ;
bool total_printed = FALSE ;
1995-01-03 16:45:39 +00:00
_num = atoi ( _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 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( ( ( _sez = = ' 1 ' ) | | ( _sez = = ' 2 ' ) | | ( _sez = = ' 9 ' ) ) & & ( _let ! = ' Z ' ) )
{
if ( _num ! = 0 )
1997-10-16 08:47:25 +00:00
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
}
1995-01-03 16:45:39 +00:00
}
else
1997-10-16 08:47:25 +00:00
if ( _num ! = 0 )
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale " ) ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
}
1995-01-03 16:45:39 +00:00
if ( _num ! = 0 )
1997-05-22 08:51:20 +00:00
{
if ( _tot_num_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_num_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_num_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_num_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_num_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_num_mov_a ) ;
}
if ( ! _stampa_modulo )
{
if ( _num ! = 0 )
stampa_saldo_132 ( _tot_num_saldo ) ;
}
else
{
if ( _num ! = 0 )
stampa_saldo_198 ( _tot_num_saldo_d , _tot_num_saldo_a ) ;
// _tot_num_saldo_d = 0;
// _tot_num_saldo_a = 0;
}
if ( _sez_stamp = = ' 9 ' )
{
TString16 classe ;
classe . format ( " %c%c%8s%2s " , _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 " )
1995-02-24 10:18:23 +00:00
{
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @4gTotale delle partite straordinarie " ) ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_parz_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_parz_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_parz_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_parz_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_parz_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_parz_mov_a ) ;
_risimp_fatto = FALSE ;
if ( ! _stampa_modulo )
{
if ( _num ! = 0 )
stampa_saldo_132 ( _tot_parz_sld ) ;
}
else
{
if ( _num ! = 0 )
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 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( ( ( _sez = = ' 1 ' ) | | ( _sez = = ' 2 ' ) | | ( _sez = = ' 9 ' ) ) & & ( _let ! = ' Z ' ) )
{
if ( _num ! = 0 )
1997-10-16 08:47:25 +00:00
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
}
1995-01-03 16:45:39 +00:00
}
else
if ( _num ! = 0 )
1997-10-16 08:47:25 +00:00
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale " ) ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
}
1995-01-03 16:45:39 +00:00
if ( _num ! = 0 )
{
1997-05-22 08:51:20 +00:00
if ( _tot_num_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_num_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_num_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_num_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_num_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_num_mov_a ) ;
}
if ( ! _stampa_modulo )
{
if ( _num ! = 0 )
stampa_saldo_132 ( _tot_num_saldo ) ;
}
else
{
if ( _num ! = 0 )
stampa_saldo_198 ( _tot_num_saldo_d , _tot_num_saldo_a ) ;
//_tot_num_saldo_d = 0;
//_tot_num_saldo_a = 0;
}
}
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 ! = " " )
1997-10-16 08:47:25 +00:00
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
1997-05-22 08:51:20 +00:00
if ( _tot_numr_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_numr_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_numr_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_numr_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_numr_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_numr_mov_a ) ;
}
if ( ! _stampa_modulo )
{
if ( numrom ! = " " )
stampa_saldo_132 ( _tot_numr_saldo ) ;
}
else
{
if ( numrom ! = " " )
stampa_saldo_198 ( _tot_numr_saldo_d , _tot_numr_saldo_a ) ;
// _tot_numr_saldo_d = 0;
// _tot_numr_saldo_a = 0;
}
}
_cont_gcs = 0 ;
_cont_num = 0 ;
_tot_num_prg_d = ZERO ;
_tot_num_prg_a = ZERO ;
_tot_num_mov_d = ZERO ;
_tot_num_mov_a = ZERO ;
_tot_num_saldo = ZERO ;
_tot_numr_prg_d = ZERO ;
_tot_numr_prg_a = ZERO ;
_tot_numr_mov_d = ZERO ;
_tot_numr_mov_a = ZERO ;
_tot_numr_saldo = ZERO ;
}
if ( ( _let_da_stamp ! = _let_tot ) | | ( _sez_da_stamp ! = _sez_tot ) )
{
if ( _cont_gcs ! = 0 ) //(_cont_gcs >= 2)
{
//Fai il totale del numero arabo e stampalo
if ( ( ( _sez = = ' 1 ' ) | | ( _sez = = ' 2 ' ) | | ( _sez = = ' 9 ' ) ) & & ( _let ! = ' Z ' ) )
{
1997-10-16 08:47:25 +00:00
if ( _num ! = 0 )
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%2d) " ) , _num ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
}
1995-01-03 16:45:39 +00:00
}
else
if ( _num ! = 0 )
1997-10-16 08:47:25 +00:00
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale " ) ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
}
1995-01-03 16:45:39 +00:00
if ( _num ! = 0 )
{
1997-05-22 08:51:20 +00:00
if ( _tot_num_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_num_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_num_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_num_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_num_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_num_mov_a ) ;
}
if ( ! _stampa_modulo )
{
if ( _num ! = 0 )
stampa_saldo_132 ( _tot_num_saldo ) ;
}
else
{
if ( _num ! = 0 )
stampa_saldo_198 ( _tot_num_saldo_d , _tot_num_saldo_a ) ;
}
}
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 ! = " " )
{
1997-10-16 08:47:25 +00:00
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%s " ) , ( const char * ) numrom ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
1997-05-22 08:51:20 +00:00
if ( _tot_numr_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_numr_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_numr_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_numr_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_numr_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_numr_mov_a ) ;
}
if ( ! _stampa_modulo )
{
if ( numrom ! = " " )
stampa_saldo_132 ( _tot_numr_saldo ) ;
}
else
{
if ( numrom ! = " " )
stampa_saldo_198 ( _tot_numr_saldo_d , _tot_numr_saldo_a ) ;
}
}
if ( _cont_numr ! = 0 ) //(_cont_numr >= 2)
{
//Fai il totale della lettera e stampalo
if ( _let ! = ' ' )
{
if ( _sez_stamp = = ' 9 ' & & _let_stamp ! = ' E ' )
1997-10-16 08:47:25 +00:00
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
1997-05-22 08:51:20 +00:00
if ( _tot_let_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_let_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_let_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_let_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_let_mov_d ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _tot_let_mov_a ) ;
}
else
if ( _sez_stamp ! = ' 9 ' )
1997-10-16 08:47:25 +00:00
{
if ( total_printed ) _i + + ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @8gTotale@15g%c) " ) , _let ) ;
1997-10-16 08:47:25 +00:00
total_printed = TRUE ;
1997-05-22 08:51:20 +00:00
if ( _tot_let_prg_d ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _tot_let_prg_d ) ;
1997-05-22 08:51:20 +00:00
if ( _tot_let_prg_a ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _tot_let_prg_a ) ;
set_row ( _i , " @81g%r " , & _tot_let_mov_d ) ;
1995-01-03 16:45:39 +00:00
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 ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : stampa_saldo_198 ( real & saldo_d , real & saldo_a )
1995-01-03 16:45:39 +00:00
{
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g!%r@132g%r " , & saldo_d , & saldo_a ) ;
saldo_d = saldo_a = ZERO ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : stampa_saldo_132 ( const real & saldo )
1995-01-03 16:45:39 +00:00
{
1997-10-16 08:47:25 +00:00
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 ( ) )
1996-10-01 15:01:34 +00:00
set_row ( _i , " @131g%c " , _tot_sez_saldo ) ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
print_action TStampa_IVdirettiva : : postprocess_page ( int file , int counter )
1995-01-03 16:45:39 +00:00
{
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 ;
2003-02-25 15:22:52 +00:00
setta_righe ( TR ( " CONTI D'ORDINE " ) ) ;
1995-01-03 16:45:39 +00:00
_reset_righe_stampa = FALSE ;
}
}
else
{
reset_print ( ) ;
_i = 1 ;
2003-02-25 15:22:52 +00:00
setta_righe ( TR ( " CONTI D'ORDINE " ) ) ;
1995-01-03 16:45:39 +00:00
_reset_righe_stampa = FALSE ;
}
}
if ( _sez_da_stamp = = ' 9 ' )
{
if ( ! _intera_struttura )
{
if ( bil - > gruppo [ 0 ] ! = ' Z ' )
{
reset_print ( ) ;
_i = 1 ;
2003-02-25 15:22:52 +00:00
setta_righe ( TR ( " CONTO ECONOMICO " ) ) ;
1995-01-03 16:45:39 +00:00
_reset_righe_stampa = FALSE ;
}
}
else
{
reset_print ( ) ;
_i = 1 ;
2003-02-25 15:22:52 +00:00
setta_righe ( TR ( " CONTO ECONOMICO " ) ) ;
1995-01-03 16:45:39 +00:00
_reset_righe_stampa = FALSE ;
}
}
}
set_auto_ff ( FALSE ) ;
}
if ( _buff = = NULL )
return NEXT_PAGE ;
_sale = 0 ;
_salerafr = 0 ;
return REPEAT_PAGE ;
}
1997-10-16 08:47:25 +00:00
print_action TStampa_IVdirettiva : : postprocess_print ( int file , int counter )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
if ( _prog_stampa ! = NULL )
2001-05-01 08:17:07 +00:00
{
1996-09-26 15:06:12 +00:00
delete _prog_stampa ;
2001-05-01 08:17:07 +00:00
_prog_stampa = NULL ;
}
1996-09-26 15:06:12 +00:00
return NEXT_PAGE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : preprocess_print ( int file , int counter )
1996-09-26 15:06:12 +00:00
{
2003-05-09 09:33:18 +00:00
if ( printer ( ) . printtype ( ) ! = screenvis )
2003-02-25 15:22:52 +00:00
_prog_stampa = new TProgind ( _items_sort , TR ( " Preparazione stampa... prego attendere " ) , FALSE ) ;
2003-10-21 15:46:29 +00:00
else
_prog_stampa = NULL ;
2003-05-09 09:33:18 +00:00
1996-09-26 15:06:12 +00:00
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : preprocess_page ( int file , int counter )
1996-09-26 15:06:12 +00:00
{
2003-05-05 14:32:23 +00:00
if ( _prog_stampa ! = NULL )
1996-09-26 15:06:12 +00:00
_prog_stampa - > addstatus ( 1 ) ;
1997-10-16 08:47:25 +00:00
bool ok = FALSE ;
1995-01-03 16:45:39 +00:00
if ( _tipo_bilancio = = 1 )
1997-10-16 08:47:25 +00:00
ok = preprocess_stampa_scalare ( counter ) ;
else
ok = preprocess_stampa_verifica ( counter ) ;
1995-01-03 16:45:39 +00:00
1997-10-16 08:47:25 +00:00
return ok ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : preprocess_stampa_scalare ( int counter )
1995-01-03 16:45:39 +00:00
{
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 . ltrim ( ) ;
_sez_tot = bil - > sez ;
_let_tot = bil - > let ;
_numr_tot = bil - > numr ;
_numr_tot . ltrim ( ) ;
_num_tot = bil - > num ;
_num_tot . ltrim ( ) ;
}
}
else
{
2003-05-05 14:32:23 +00:00
_classe_stampata . format ( " %c%c%8s%2s " , bil - > sez , bil - > let , bil - > numr , bil - > num ) ;
2001-05-01 08:17:07 +00:00
_sez_stamp = bil - > sez ;
_let_stamp = bil - > let ;
1995-01-03 16:45:39 +00:00
_numr_stamp = bil - > numr ;
_numr_stamp . ltrim ( ) ;
_num_stamp = bil - > num ;
_num_stamp . ltrim ( ) ;
2001-05-01 08:17:07 +00:00
_sez_tot = bil - > sez ;
_let_tot = bil - > let ;
1995-01-03 16:45:39 +00:00
_numr_tot = bil - > numr ;
_numr_tot . ltrim ( ) ;
2001-05-01 08:17:07 +00:00
_num_tot = bil - > num ;
1995-01-03 16:45:39 +00:00
_num_tot . ltrim ( ) ;
}
}
_buff = _sort - > retrieve ( ) ;
2001-05-01 08:17:07 +00:00
if ( _buff = = NULL )
1995-01-03 16:45:39 +00:00
{
if ( _annoeserafr = = 0 & & _databilrafr = = botime )
2001-05-01 08:17:07 +00:00
stampa_totali ( ) ;
1995-01-03 16:45:39 +00:00
else
2001-05-01 08:17:07 +00:00
stampa_totali_con_raffronto ( ) ;
1995-01-03 16:45:39 +00:00
_sez_da_stamp = ' ' ;
_sez_stamp = ' ' ;
return TRUE ;
2001-05-01 08:17:07 +00:00
}
1995-01-03 16:45:39 +00:00
if ( _buff ! = NULL )
{
bil = ( struct bil_ivd * ) _buff ;
2003-05-05 14:32:23 +00:00
_classe_da_stampare . format ( " %c%c%8s%2s " , bil - > sez , bil - > let , bil - > numr , bil - > num ) ;
1995-01-03 16:45:39 +00:00
_sez_da_stamp = bil - > sez ;
_let_da_stamp = bil - > let ;
_numr_da_stamp = bil - > numr ;
_numr_da_stamp . ltrim ( ) ;
_num_da_stamp = bil - > num ;
_num_da_stamp . ltrim ( ) ;
g = atoi ( bil - > gruppo ) ;
c = atoi ( bil - > conto ) ;
s = atol ( bil - > sottoc ) ;
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 )
2001-05-01 08:17:07 +00:00
{
1995-01-03 16:45:39 +00:00
if ( _annoeserafr = = 0 & & _databilrafr = = botime )
stampa_totali ( ) ;
else
stampa_totali_con_raffronto ( ) ;
2001-05-01 08:17:07 +00:00
}
1995-01-03 16:45:39 +00:00
}
//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 ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : preprocess_stampa_verifica ( int counter )
1995-01-03 16:45:39 +00:00
{
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 . ltrim ( ) ;
_sez_tot = bil - > sez ;
_let_tot = bil - > let ;
_numr_tot = bil - > numr ;
_numr_tot . ltrim ( ) ;
_num_tot = bil - > num ;
_num_tot . ltrim ( ) ;
}
}
else
{
2003-05-05 14:32:23 +00:00
_classe_stampata = format ( " %c%c%8s%2s " , bil - > sez , bil - > let , bil - > numr , bil - > num ) ;
1995-01-03 16:45:39 +00:00
_sez_stamp = bil - > sez ;
_let_stamp = bil - > let ;
_numr_stamp = bil - > numr ;
_numr_stamp . ltrim ( ) ;
_num_stamp = bil - > num ;
_num_stamp . ltrim ( ) ;
_sez_tot = bil - > sez ;
_let_tot = bil - > let ;
_numr_tot = bil - > numr ;
_numr_tot . ltrim ( ) ;
_num_tot = bil - > num ;
_num_tot . ltrim ( ) ;
}
}
_buff = _sort - > retrieve ( ) ;
if ( _buff = = NULL )
{
stampa_totali_verifica ( ) ;
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " @0g****** ******** TOTALE GENERALE " ) ) ;
1997-10-16 08:47:25 +00:00
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 ) ;
1995-04-06 16:10:12 +00:00
1995-01-03 16:45:39 +00:00
if ( ! _stampa_modulo )
stampa_saldo_132 ( _tot_gen_saldo ) ;
else
stampa_saldo_198 ( _tot_gen_saldo_d , _tot_gen_saldo_a ) ;
1995-04-06 16:10:12 +00:00
//modifica 05/04/1995
if ( ( _tipo_stampa = = 1 & & _dataini = = _data_ini_ese ) | | _tipo_stampa = = 2 )
1996-09-30 15:05:25 +00:00
{
_i + + ;
1997-10-16 08:47:25 +00:00
if ( _tipo_stampa = = 1 & & _dataini = = _data_ini_ese )
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " ****** ******** TOTALE CON MOVIM. DI APERTURA@46g!@80g!@81g%r@98g%r@114g! " ) , & _nuovo_tot_saldo_d , & _nuovo_tot_saldo_a ) ;
1995-11-30 09:39:32 +00:00
else
2003-02-25 15:22:52 +00:00
set_row ( _i , FR ( " ****** ******** TOTALE CON SALDI INIZIALI@46g!@80g!@81g%r@98g%r@114g! " ) , & _nuovo_tot_saldo_d , & _nuovo_tot_saldo_a ) ;
1995-11-17 14:29:24 +00:00
}
1995-04-06 16:10:12 +00:00
//fine modifica
1995-01-03 16:45:39 +00:00
_sez_da_stamp = ' ' ;
_sez_stamp = ' ' ;
return TRUE ;
}
if ( _buff ! = NULL )
{
bil = ( struct bil_ivd * ) _buff ;
2003-05-05 14:32:23 +00:00
_classe_da_stampare = format ( " %c%c%8s%2s " , bil - > sez , bil - > let , bil - > numr , bil - > num ) ;
1995-01-03 16:45:39 +00:00
_sez_da_stamp = bil - > sez ;
_let_da_stamp = bil - > let ;
_numr_da_stamp = bil - > numr ;
_numr_da_stamp . ltrim ( ) ;
_num_da_stamp = bil - > num ;
_num_da_stamp . ltrim ( ) ;
g = atoi ( bil - > gruppo ) ;
c = atoi ( bil - > conto ) ;
s = atol ( bil - > sottoc ) ;
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 ;
}
2001-05-01 08:17:07 +00:00
if ( _stampamov & & _sale . is_zero ( ) )
return FALSE ;
1995-01-03 16:45:39 +00:00
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 ;
}
}
1995-04-06 16:10:12 +00:00
if ( _dataini = = _data_ini_ese )
{
1995-11-30 09:39:32 +00:00
//modifica del 27/11/1995
if ( _tipo_stampa = = 2 )
1995-04-06 16:10:12 +00:00
{
1995-11-30 09:39:32 +00:00
real saldo_num = _sld_prg_dare - _sld_prg_avere ;
if ( saldo_num > ZERO )
_tot_num_prg_d + = saldo_num ;
else
{
1995-04-06 16:10:12 +00:00
saldo_num = - saldo_num ;
_tot_num_prg_a + = saldo_num ;
1995-11-30 09:39:32 +00:00
}
real saldo_numr = _sld_prg_dare - _sld_prg_avere ;
if ( saldo_numr > ZERO )
_tot_numr_prg_d + = saldo_numr ;
else
{
1995-04-06 16:10:12 +00:00
saldo_numr = - saldo_numr ;
_tot_numr_prg_a + = saldo_numr ;
1995-11-30 09:39:32 +00:00
}
real saldo_let = _sld_prg_dare - _sld_prg_avere ;
if ( saldo_let > ZERO )
_tot_let_prg_d + = saldo_let ;
else
{
1995-04-06 16:10:12 +00:00
saldo_let = - saldo_let ;
_tot_let_prg_a + = saldo_let ;
1995-11-30 09:39:32 +00:00
}
real saldo_gen = _sld_prg_dare - _sld_prg_avere ;
if ( saldo_gen > ZERO )
_tot_gen_prg_d + = saldo_gen ;
else
{
1995-04-06 16:10:12 +00:00
saldo_gen = - saldo_gen ;
_tot_gen_prg_a + = saldo_gen ;
1995-11-30 09:39:32 +00:00
}
}
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 ;
1995-04-06 16:10:12 +00:00
}
1995-11-30 09:39:32 +00:00
//fine
1995-04-06 16:10:12 +00:00
}
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 ;
}
1995-01-03 16:45:39 +00:00
_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 ;
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : set_page ( int file , int counter )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
if ( _tipo_bilancio = = 1 ) // Bilancio scalare
1995-01-03 16:45:39 +00:00
{
if ( _sez_da_stamp ! = _sez_stamp )
{
2003-05-05 14:32:23 +00:00
// Controllo se devo stampare STATO PATRIMONIALE
if ( _statopatr_no_stamp & & ( _sez_da_stamp = = ' 1 ' ) | | ( ( _sez_da_stamp = = ' 2 ' ) ) )
1995-01-03 16:45:39 +00:00
{
2003-02-25 15:22:52 +00:00
setta_righe ( TR ( " STATO PATRIMONIALE " ) ) ;
1995-01-03 16:45:39 +00:00
_statopatr_no_stamp = FALSE ;
}
if ( _sez_da_stamp = = ' 2 ' )
setta_righe ( " " ) ;
if ( ( _sez_da_stamp = = ' 5 ' ) | | ( _sez_da_stamp = = ' 9 ' ) )
set_auto_ff ( TRUE ) ;
}
else
{
if ( _buff ! = NULL )
setta_righe ( " " ) ;
}
}
1997-10-16 08:47:25 +00:00
else
1995-01-03 16:45:39 +00:00
{
if ( _buff ! = NULL )
setta_righe_verifica ( ) ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : setta_righe ( const char * titolo )
1995-01-03 16:45:39 +00:00
{
struct bil_ivd * bil = ( struct bil_ivd * ) _buff ;
int numeror , numero , gruppo , conto ;
char sezione , lettera ;
long sottoc ;
TString numrom , numr ;
TString descr_let , descr_numr , descr_num , descr_sottoc , descr_classe ;
bool stampa_classe = TRUE ;
2003-05-05 14:32:23 +00:00
const char * lettera1 = " @1g)@3g%s " ;
const char * lettera2 = " @3g%s " ;
const char * numr1 = " @12g-@14g%s " ;
const char * numr2 = " @14g%s " ;
const char * num = " @15g)@18g%s " ;
const char * num2 = " @18g%s " ;
1995-01-03 16:45:39 +00:00
_descr - > set_width ( 40 ) ;
sezione = bil - > sez ;
lettera = bil - > let ;
numr = bil - > numr ;
numeror = atoi ( bil - > numr ) ;
numrom = itor ( numeror ) ;
numero = atoi ( bil - > num ) ;
gruppo = atoi ( bil - > gruppo ) ;
conto = atoi ( bil - > conto ) ;
1999-05-24 13:34:11 +00:00
sottoc = atol ( bil - > sottoc ) ;
1995-01-03 16:45:39 +00:00
descr_let = descrizione_lettera ( sezione , lettera ) ;
descr_numr = descrizione_numeroromano ( sezione , lettera , numeror ) ;
descr_num = descrizione_numero ( sezione , lettera , numeror , numero ) ;
descr_sottoc = descrizione_sottoconto ( gruppo , conto , sottoc ) ;
1995-04-19 13:13:21 +00:00
1995-01-03 16:45:39 +00:00
//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.
2003-05-05 14:32:23 +00:00
if ( _sez_da_stamp ! = _sez_stamp ) // Cambio sezione
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
set_row ( _i + + , " @0g%s " , titolo ) ;
set_row ( _i + + , " @0g " ) ;
if ( _sez_da_stamp = = ' 1 ' )
1995-01-03 16:45:39 +00:00
{
char app = ' ' ;
2003-05-05 14:32:23 +00:00
set_row ( _i + + , FR ( " @0gCONTI D'ORDINE ATTIVI " ) ) ;
1995-01-03 16:45:39 +00:00
stampa_classe = FALSE ;
}
else
if ( ( _sez_da_stamp = = ' 1 ' ) & & ( _let_da_stamp ! = ' Z ' ) )
{
char app = ' ' ;
2003-05-05 14:32:23 +00:00
set_row ( _i + + , FR ( " @0gATTIVO " ) ) ;
1995-01-03 16:45:39 +00:00
}
2003-05-05 14:32:23 +00:00
1995-01-03 16:45:39 +00:00
2003-05-05 14:32:23 +00:00
if ( _sez_da_stamp = = ' 2 ' )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
set_row ( _i + + , " @0g " ) ;
if ( ( _let_da_stamp = = ' Z ' ) )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
set_row ( _i + + , FR ( " @0gCONTI D'ORDINE PASSIVI " ) ) ;
stampa_classe = FALSE ;
2003-05-09 09:33:18 +00:00
}
2003-05-05 14:32:23 +00:00
else
set_row ( _i + + , FR ( " @0gPASSIVO " ) ) ;
2003-05-09 09:33:18 +00:00
}
1995-01-03 16:45:39 +00:00
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 " , bil - > let ) ;
* _descr = ( const char * ) descr_let ;
setta_righe_descr ( _descr , lettera1 , lettera2 ) ;
}
if ( numrom ! = " " )
{
set_row ( _i , " @3g%8s " , ( const char * ) numrom ) ;
* _descr = ( const char * ) descr_numr ;
setta_righe_descr ( _descr , numr1 , numr2 ) ;
}
if ( numero ! = 0 )
{
2003-05-05 14:32:23 +00:00
if ( devo_stampare_risultato_prima_delle_imposte ( ) )
stampa_risultato_prima_delle_imposte ( ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @13g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr ( _descr , num , num2 ) ;
}
}
}
}
else
if ( ( _let_da_stamp ! = _let_stamp ) & & ( _sez_da_stamp = = _sez_stamp ) )
{
if ( ( _sez_da_stamp = = ' 1 ' ) & & ( _let_da_stamp = = ' Z ' ) )
{
2003-05-05 14:32:23 +00:00
set_row ( _i + + , " @0g " ) ;
set_row ( _i + + , FR ( " @0gCONTI D'ORDINE ATTIVI " ) ) ;
set_row ( _i + + , " @0g " ) ;
1995-01-03 16:45:39 +00:00
stampa_classe = FALSE ;
}
if ( ( _sez_da_stamp = = ' 2 ' ) & & ( _let_da_stamp = = ' Z ' ) )
{
2003-05-05 14:32:23 +00:00
set_row ( _i + + , " @0g " ) ;
set_row ( _i + + , FR ( " @0gCONTI D'ORDINE PASSIVI " ) ) ;
set_row ( _i + + , " @0g " ) ;
1995-01-03 16:45:39 +00:00
stampa_classe = FALSE ;
}
if ( stampa_classe )
{
if ( ( _sez_da_stamp = = ' 1 ' ) | | ( _sez_da_stamp = = ' 2 ' ) | | ( _sez_da_stamp = = ' 9 ' ) )
2001-05-01 08:17:07 +00:00
{
2003-05-05 14:32:23 +00:00
set_row ( _i , " @0g%c " , bil - > let ) ;
* _descr = ( const char * ) descr_let ;
setta_righe_descr ( _descr , lettera1 , lettera2 ) ;
1995-01-03 16:45:39 +00:00
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_numr = 1 ;
_cont_num = 1 ;
_cont_gcs = 0 ;
}
if ( numrom ! = " " )
{
set_row ( _i , " @3g%8s " , ( const char * ) numrom ) ;
* _descr = ( const char * ) descr_numr ;
setta_righe_descr ( _descr , numr1 , numr2 ) ;
}
if ( numero ! = 0 )
{
2003-05-05 14:32:23 +00:00
if ( devo_stampare_risultato_prima_delle_imposte ( ) )
stampa_risultato_prima_delle_imposte ( ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @13g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr ( _descr , num , num2 ) ;
}
}
}
}
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 " , ( const char * ) numrom ) ;
* _descr = ( const char * ) descr_numr ;
setta_righe_descr ( _descr , numr1 , numr2 ) ;
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_num = 1 ;
_cont_gcs = 0 ;
}
if ( numero ! = 0 )
{
2003-05-05 14:32:23 +00:00
if ( devo_stampare_risultato_prima_delle_imposte ( ) )
stampa_risultato_prima_delle_imposte ( ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @13g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr ( _descr , num , num2 ) ;
}
}
}
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 ' ) )
{
2003-05-05 14:32:23 +00:00
if ( devo_stampare_risultato_prima_delle_imposte ( ) )
stampa_risultato_prima_delle_imposte ( ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @13g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr ( _descr , num , num2 ) ;
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
1997-05-22 08:51:20 +00:00
{
1995-01-03 16:45:39 +00:00
_cont_gcs = 0 ;
1997-05-22 08:51:20 +00:00
_cont_numr = 1 ;
}
1995-01-03 16:45:39 +00:00
}
}
if ( bil - > gruppo [ 0 ] ! = ' A ' )
{
if ( ! _stampacod )
{
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_gcs + = 1 ;
set_row ( _i , " @18g%s " , bil - > gruppo ) ;
set_row ( _i , " @22g%s " , bil - > conto ) ;
1997-05-22 08:51:20 +00:00
if ( sottoc ! = 0 )
set_row ( _i , " @26g%s " , bil - > sottoc ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @33g%s " , ( const char * ) descr_sottoc ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _sale ) ;
1995-01-03 16:45:39 +00:00
if ( _annoeserafr ! = 0 | | _databilrafr ! = botime )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @111g%r " , & _salerafr ) ;
1995-01-03 16:45:39 +00:00
_i + + ;
}
}
else
{
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_gcs + = 1 ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera = = ' ' ) & & ( numrom = = " " ) & & ( numero = = 0 ) )
descr_classe = _descr_sez ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera ! = ' ' ) & & ( numrom = = " " ) & & ( numero = = 0 ) )
descr_classe = descr_let ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera ! = ' ' ) & & ( numrom ! = " " ) & & ( numero = = 0 ) )
descr_classe = descr_numr ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera ! = ' ' ) & & ( numrom ! = " " ) & & ( numero ! = 0 ) )
descr_classe = descr_num ;
if ( descr_classe ! = descr_sottoc )
{
set_row ( _i , " @20g%s " , ( const char * ) descr_sottoc ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _sale ) ;
1995-01-03 16:45:39 +00:00
if ( _annoeserafr ! = 0 | | _databilrafr ! = botime )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @111g%r " , & _salerafr ) ;
1995-01-03 16:45:39 +00:00
_i + + ;
}
}
}
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : setta_righe_verifica ( )
1995-01-03 16:45:39 +00:00
{
struct bil_ivd * bil = ( struct bil_ivd * ) _buff ;
int numeror , numero , gruppo , conto ;
char sezione , lettera , tmcf ;
long sottoc ;
TString numrom , numr ;
TString descr_let , descr_numr , descr_num , descr_sottoc , descr_classe ;
2003-05-05 14:32:23 +00:00
const char * lettera1 = " @1g)@3g%s " ;
const char * lettera2 = " @3g%s " ;
const char * numr1 = " @8g)@10g%s " ;
const char * numr2 = " @10g%s " ;
const char * num = " @2g)@4g%s " ;
const char * num2 = " @4g%s " ;
1995-01-03 16:45:39 +00:00
_descr - > set_width ( 35 ) ;
sezione = bil - > sez ;
lettera = bil - > let ;
numr = bil - > numr ;
numeror = atoi ( bil - > numr ) ;
numrom = itor ( numeror ) ;
numero = atoi ( bil - > num ) ;
gruppo = atoi ( bil - > gruppo ) ;
conto = atoi ( bil - > conto ) ;
1999-05-24 13:34:11 +00:00
sottoc = atol ( bil - > sottoc ) ;
1995-01-03 16:45:39 +00:00
tmcf = bil - > tipocf ;
descr_let = descrizione_lettera ( sezione , lettera ) ;
descr_numr = descrizione_numeroromano ( sezione , lettera , numeror ) ;
descr_num = descrizione_numero ( sezione , lettera , numeror , numero ) ;
if ( ( tmcf = = ' C ' ) | | ( tmcf = = ' F ' ) )
{
if ( gruppo ! = 0 & & conto ! = 0 & & sottoc ! = 0 )
{
TConto tc ( gruppo , conto , sottoc , tmcf ) ;
descr_sottoc = tc . descrizione ( ) ;
}
else
descr_sottoc = descrizione_sottoconto ( gruppo , conto , sottoc ) ;
}
else
descr_sottoc = descrizione_sottoconto ( gruppo , conto , sottoc ) ;
1995-04-19 13:13:21 +00:00
* _d = ( const char * ) descr_sottoc ;
1995-01-03 16:45:39 +00:00
//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 ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
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 ! = ' \0 ' )
{
set_row ( _i , " @0g%c " , bil - > let ) ;
* _descr = ( const char * ) descr_let ;
setta_righe_descr_verifica ( _descr , lettera1 , lettera2 ) ;
}
if ( numrom ! = " " )
{
set_row ( _i , " @0g%8s " , ( const char * ) numrom ) ;
* _descr = ( const char * ) descr_numr ;
setta_righe_descr_verifica ( _descr , numr1 , numr2 ) ;
}
if ( numero ! = 0 )
{
set_row ( _i , " @0g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr_verifica ( _descr , num , num2 ) ;
}
}
}
}
else
if ( ( _let_da_stamp ! = _let_stamp ) & & ( _sez_da_stamp = = _sez_stamp ) )
{
char app = ' ' ;
set_row ( _i , " @0g%c " , app ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
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 ) ;
* _descr = ( const char * ) descr_let ;
setta_righe_descr_verifica ( _descr , lettera1 , lettera2 ) ;
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_numr = 1 ;
_cont_num = 1 ;
_cont_gcs = 0 ;
}
if ( numrom ! = " " )
{
set_row ( _i , " @0g%8s " , ( const char * ) numrom ) ;
* _descr = ( const char * ) descr_numr ;
setta_righe_descr_verifica ( _descr , numr1 , numr2 ) ;
}
if ( numero ! = 0 )
{
set_row ( _i , " @0g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr_verifica ( _descr , num , num2 ) ;
}
}
}
}
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 ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
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 ) ;
* _descr = ( const char * ) descr_numr ;
setta_righe_descr_verifica ( _descr , numr1 , numr2 ) ;
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_num = 1 ;
_cont_gcs = 0 ;
}
if ( numero ! = 0 )
{
set_row ( _i , " @0g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr_verifica ( _descr , num , num2 ) ;
}
}
}
}
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 ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i + + , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
if ( ( _sez_da_stamp = = ' 1 ' ) | | ( _sez_da_stamp = = ' 2 ' ) | | ( _sez_da_stamp = = ' 9 ' ) )
{
if ( _let_da_stamp ! = ' Z ' )
{
set_row ( _i , " @0g%s " , bil - > num ) ;
* _descr = ( const char * ) descr_num ;
setta_righe_descr_verifica ( _descr , num , num2 ) ;
_cont_num + = 1 ;
_cont_gcs = 0 ;
}
}
}
if ( bil - > gruppo [ 0 ] ! = ' A ' )
{
if ( ! _stampacod )
{
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
1995-04-19 13:13:21 +00:00
_cont_gcs + = 1 ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @0g%s " , bil - > gruppo ) ;
set_row ( _i , " @4g%s " , bil - > conto ) ;
1997-05-22 08:51:20 +00:00
if ( sottoc ! = 0 )
set_row ( _i , " @8g%s " , bil - > sottoc ) ;
num = " @15g%s " ;
num2 = num ;
setta_righe_descr_verifica ( _d , num , num2 ) ;
_i - - ;
1995-04-06 16:10:12 +00:00
if ( _dataini = = _data_ini_ese )
{
1995-11-30 09:39:32 +00:00
//modifica del 27/11/1995
if ( _tipo_stampa = = 2 ) //all'ultima immissione
{
real saldoini = _sld_prg_dare - _sld_prg_avere ;
1997-05-22 08:51:20 +00:00
if ( saldoini > ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & saldoini ) ;
1997-05-22 08:51:20 +00:00
else if ( saldoini < ZERO ) // Non stampare il saldo iniziale se == 0.0
1995-11-30 09:39:32 +00:00
{
1995-04-06 16:10:12 +00:00
saldoini = - saldoini ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & saldoini ) ;
1995-11-30 09:39:32 +00:00
}
1995-04-06 16:10:12 +00:00
}
1995-11-30 09:39:32 +00:00
else if ( _tipo_stampa = = 1 ) //per date limiti
{
1997-05-22 08:51:20 +00:00
if ( _sld_prg_dare ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _sld_prg_dare ) ;
1997-05-22 08:51:20 +00:00
if ( _sld_prg_avere ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _sld_prg_avere ) ;
1995-11-30 09:39:32 +00:00
}
//fine
}
1995-04-06 16:10:12 +00:00
else
{
1997-05-22 08:51:20 +00:00
if ( _sld_prg_dare ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _sld_prg_dare ) ;
1997-05-22 08:51:20 +00:00
if ( _sld_prg_avere ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _sld_prg_avere ) ;
1995-04-06 16:10:12 +00:00
}
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _mov_dare ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @98g%r " , & _mov_avere ) ;
if ( _stampa_modulo )
{
if ( _sez_saldo = = ' D ' )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g!%r " , & _sale ) ;
1995-01-03 16:45:39 +00:00
else
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g!@132g%r " , & _sale ) ;
1995-01-03 16:45:39 +00:00
}
else
{
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g!%r " , & _sale ) ;
1996-07-09 13:00:08 +00:00
if ( _sale ! = ZERO )
set_row ( _i , " @131g%c " , _sez_saldo ) ;
1995-01-03 16:45:39 +00:00
}
}
}
else
{
if ( ! _intera_struttura | | ( _intera_struttura & & bil - > gruppo [ 0 ] ! = ' Z ' ) )
{
_cont_gcs + = 1 ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera = = ' ' ) & & ( numrom = = " " ) & & ( numero = = 0 ) )
descr_classe = _descr_sez ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera ! = ' ' ) & & ( numrom = = " " ) & & ( numero = = 0 ) )
descr_classe = descr_let ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera ! = ' ' ) & & ( numrom ! = " " ) & & ( numero = = 0 ) )
descr_classe = descr_numr ;
if ( ( sezione ! = ' 0 ' ) & & ( lettera ! = ' ' ) & & ( numrom ! = " " ) & & ( numero ! = 0 ) )
descr_classe = descr_num ;
if ( descr_classe ! = descr_sottoc )
{
1995-04-19 13:13:21 +00:00
set_row ( _i , " @2g#a " , _d ) ;
1995-11-30 09:39:32 +00:00
1995-04-06 16:10:12 +00:00
if ( _dataini = = _data_ini_ese )
{
1995-11-30 09:39:32 +00:00
//modifica del 27/11/1995
if ( _tipo_stampa = = 2 )
1995-04-06 16:10:12 +00:00
{
1995-11-30 09:39:32 +00:00
real saldoini = _sld_prg_dare - _sld_prg_avere ;
1997-05-22 08:51:20 +00:00
if ( saldoini > ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & saldoini ) ;
1997-05-22 08:51:20 +00:00
else if ( saldoini < ZERO ) // non stampare il saldo iniziale se == 0.0
1995-11-30 09:39:32 +00:00
{
1995-04-06 16:10:12 +00:00
saldoini = - saldoini ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & saldoini ) ;
1995-11-30 09:39:32 +00:00
}
1995-04-06 16:10:12 +00:00
}
1995-11-30 09:39:32 +00:00
else if ( _tipo_stampa = = 1 )
{
1997-05-22 08:51:20 +00:00
if ( _sld_prg_dare ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _sld_prg_dare ) ;
1997-05-22 08:51:20 +00:00
if ( _sld_prg_avere ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _sld_prg_avere ) ;
1995-11-30 09:39:32 +00:00
}
//fine
}
1995-04-06 16:10:12 +00:00
else
{
1997-05-22 08:51:20 +00:00
if ( _sld_prg_dare ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @47g%r " , & _sld_prg_dare ) ;
1997-05-22 08:51:20 +00:00
if ( _sld_prg_avere ! = ZERO )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @64g%r " , & _sld_prg_avere ) ;
1995-04-06 16:10:12 +00:00
}
1997-10-16 08:47:25 +00:00
set_row ( _i , " @81g%r " , & _mov_dare ) ;
1995-01-03 16:45:39 +00:00
set_row ( _i , " @99g%r " , & _mov_avere ) ;
if ( _stampa_modulo )
{
if ( _sez_saldo = = ' D ' )
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g!%r " , & _sale ) ;
1995-01-03 16:45:39 +00:00
else
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g!@132g%r " , & _sale ) ;
1995-01-03 16:45:39 +00:00
}
else
{
1996-07-09 13:00:08 +00:00
set_row ( _i , " @115g%r " , & _sale ) ;
if ( _sale ! = ZERO )
set_row ( _i , " @131g%c " , _sez_saldo ) ;
1997-10-16 08:47:25 +00:00
set_row ( _i , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
}
}
}
}
}
}
2003-05-05 14:32:23 +00:00
void TStampa_IVdirettiva : : setta_righe_descr ( TParagraph_string * str , const char * formato , const char * formato2 )
1995-01-03 16:45:39 +00:00
{
const char * r ;
2003-05-05 14:32:23 +00:00
for ( int i = 1 ; ( r = str - > get ( ) ) ! = NULL ; i + + )
1995-01-03 16:45:39 +00:00
{
if ( i = = 1 )
set_row ( _i , formato , r ) ;
else
2003-05-05 14:32:23 +00:00
set_row ( _i , formato2 , r ) ;
1995-01-03 16:45:39 +00:00
_i + + ;
}
}
2003-05-05 14:32:23 +00:00
void TStampa_IVdirettiva : : setta_righe_descr_verifica ( TParagraph_string * str , const char * formato , const char * formato2 )
1995-01-03 16:45:39 +00:00
{
const char * r ;
int i = 1 ;
while ( ( r = str - > get ( ) ) ! = NULL )
{
if ( i = = 1 )
set_row ( _i , formato , r ) ;
else
if ( i > 1 )
set_row ( _i , formato2 , r ) ;
2001-05-01 08:17:07 +00:00
set_row ( _i + + , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
i + + ;
}
}
1997-10-16 08:47:25 +00:00
const char * TStampa_IVdirettiva : : descrizione_sezione ( char sezione )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
const char sez [ 2 ] = { sezione , ' \0 ' } ;
tmp = cache ( ) . get ( TAB_IVD , sez , " S0 " ) ;
1995-01-16 15:08:33 +00:00
return tmp ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
const char * TStampa_IVdirettiva : : descrizione_lettera ( char sezione , char lettera )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
const char let [ 3 ] = { sezione , lettera , ' \0 ' } ;
tmp = cache ( ) . get ( TAB_IVD , let , " S0 " ) ;
1995-01-16 15:08:33 +00:00
return tmp ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
const char * TStampa_IVdirettiva : : descrizione_numeroromano ( char sezione , char lettera , int numr )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
TString8 cod ; cod . format ( " %c%c%04d " , sezione , lettera , numr ) ;
tmp = cache ( ) . get ( TAB_IVD , cod , " S0 " ) ;
1995-01-16 15:08:33 +00:00
return tmp ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
const char * TStampa_IVdirettiva : : descrizione_numero ( char sezione , char lettera , int numr , int numero )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
TString8 cod ; cod . format ( " %c%c%04d%02d " , sezione , lettera , numr , numero ) ;
tmp = cache ( ) . get ( TAB_IVD , cod , " S0 " ) ;
1995-01-16 15:08:33 +00:00
return tmp ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
const char * TStampa_IVdirettiva : : descrizione_sottoconto ( int gruppo , int conto , long sottoc )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
// Cache non strettamente necessaria in quanto i conti vengono letti solo una volta
TString16 cod ; cod . format ( " %d|%d|%ld " , gruppo , conto , sottoc ) ;
tmp = cache ( ) . get ( LF_PCON , cod , PCN_DESCR ) ;
1995-01-16 15:08:33 +00:00
return tmp ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
const char * TStampa_IVdirettiva : : descr_sottoc_clifo ( char tipocf , long s )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
// Cache non strettamente necessaria in quanto i clifo vengono letti solo una volta
TString16 cod ; cod . format ( " %c|%ld " , tipocf , s ) ;
tmp = cache ( ) . get ( LF_CLIFO , cod , CLI_RAGSOC ) ;
1995-01-16 15:08:33 +00:00
return tmp ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : preprocess_header ( )
1995-01-03 16:45:39 +00:00
{
}
// Crea l'intestazione per la stampa a 132 e a 198 caratteri
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : crea_intestazione ( )
1995-01-03 16:45:39 +00:00
{
TString datastampastr ;
TString sep ( 132 ) , sep1 ( 147 ) ;
TString app ( 8 ) ;
TLocalisamfile nditte ( LF_NDITTE ) ;
TLocalisamfile comuni ( LF_COMUNI ) ;
TLocalisamfile unloc ( LF_UNLOC ) ;
TLocalisamfile anag ( LF_ANAG ) ;
TString codice_ditta , ragsoc , indulc , civulc , capulc , com , prov , comulc ;
TString cofi , paiv , tipoa , codanagr ;
reset_header ( ) ;
nditte . setkey ( 1 ) ;
codice_ditta < < get_firm ( ) ;
nditte . curr ( ) . zero ( ) ;
nditte . curr ( ) . put ( NDT_CODDITTA , codice_ditta ) ;
nditte . read ( ) ;
app = nditte . curr ( ) . get ( NDT_CODDITTA ) ;
ragsoc = nditte . curr ( ) . get ( NDT_RAGSOC ) ;
tipoa = nditte . curr ( ) . get ( NDT_TIPOA ) ;
codanagr = nditte . get ( NDT_CODANAGR ) ;
unloc . setkey ( 1 ) ;
unloc . curr ( ) . zero ( ) ;
unloc . curr ( ) . put ( ULC_CODDITTA , app ) ;
unloc . curr ( ) . put ( ULC_CODULC , " 1 " ) ;
unloc . read ( ) ;
indulc = unloc . curr ( ) . get ( ULC_INDULC ) ;
civulc = unloc . curr ( ) . get ( ULC_CIVULC ) ;
capulc = unloc . curr ( ) . get ( ULC_CAPULC ) ;
comulc = unloc . curr ( ) . get ( ULC_COMULC ) ;
comuni . setkey ( 1 ) ;
comuni . curr ( ) . zero ( ) ;
comuni . curr ( ) . put ( COM_COM , comulc ) ;
comuni . read ( ) ;
com = comuni . curr ( ) . get ( COM_DENCOM ) ;
prov = comuni . curr ( ) . get ( COM_PROVCOM ) ;
anag . setkey ( 1 ) ;
anag . curr ( ) . zero ( ) ;
anag . curr ( ) . put ( ANA_TIPOA , tipoa ) ;
anag . curr ( ) . put ( ANA_CODANAGR , codanagr ) ;
anag . read ( ) ;
cofi = anag . curr ( ) . get ( ANA_COFI ) ;
paiv = anag . curr ( ) . get ( ANA_PAIV ) ;
2003-02-25 15:22:52 +00:00
set_header ( 1 , TR ( " DITTA@6g%-5s " ) , ( const char * ) codice_ditta ) ;
1995-01-03 16:45:39 +00:00
set_header ( 1 , " @12g%-45s " , ( const char * ) ragsoc ) ;
set_header ( 1 , " @59g%-25s " , ( const char * ) indulc ) ;
set_header ( 1 , " @86g%-9s " , ( const char * ) civulc ) ;
set_header ( 1 , " @97g%-5s " , ( const char * ) capulc ) ;
1997-10-16 08:47:25 +00:00
set_header ( 1 , " @102g%-25s " , ( const char * ) com ) ;
1995-01-03 16:45:39 +00:00
set_header ( 1 , " @129g%-3s " , ( const char * ) prov ) ;
if ( _stampa_modulo )
{
2003-02-25 15:22:52 +00:00
sep1 < < FR ( " Pag. @# " ) ;
1995-01-03 16:45:39 +00:00
sep1 . right_just ( 139 ) ;
set_header ( 2 , ( const char * ) sep1 ) ;
}
else
{
2003-02-25 15:22:52 +00:00
sep < < FR ( " Pag. @# " ) ;
1995-01-03 16:45:39 +00:00
sep . right_just ( 132 ) ;
set_header ( 2 , ( const char * ) sep ) ;
}
datastampastr = _datastampa . string ( ) ;
2003-02-25 15:22:52 +00:00
set_header ( 2 , FR ( " Partita iva@12g%-11s " ) , ( const char * ) paiv ) ;
set_header ( 2 , FR ( " @30gCodice fiscale@45g%-16s " ) , ( const char * ) cofi ) ;
1995-01-03 16:45:39 +00:00
if ( _stampa_modulo )
2003-02-25 15:22:52 +00:00
set_header ( 2 , FR ( " @131gData@136g%s " ) , ( const char * ) datastampastr ) ;
1995-01-03 16:45:39 +00:00
else
2003-02-25 15:22:52 +00:00
set_header ( 2 , FR ( " @105gData@111g%s " ) , ( const char * ) datastampastr ) ;
1995-01-03 16:45:39 +00:00
if ( _tipo_bilancio = = 1 )
{
intesta_scalare ( ) ;
}
else if ( _tipo_bilancio = = 2 )
{
intesta_verifica ( ) ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : intesta_verifica_fissa ( )
1995-01-03 16:45:39 +00:00
{
TString sep ( 132 ) , app ( 32 ) , sep1 ( 147 ) ;
if ( _tipo_stampa = = 1 )
{
if ( _dataini = = _data_ini_ese )
2003-02-25 15:22:52 +00:00
set_header ( 5 , FR ( " @54gMOVIMENTI DI APERTURA@87gMOVIMENTI DEL PERIODO " ) ) ;
1995-01-03 16:45:39 +00:00
else if ( _dataini > _data_ini_ese )
2003-02-25 15:22:52 +00:00
set_header ( 5 , FR ( " @54gPROGRESSIVI PRECEDENTI@87gMOVIMENTI DEL PERIODO " ) ) ;
1995-01-03 16:45:39 +00:00
}
else if ( _tipo_stampa = = 2 )
2003-02-25 15:22:52 +00:00
set_header ( 5 , FR ( " @57gSALDO INIZIALE@87gMOVIMENTI DEL PERIODO " ) ) ;
1995-01-03 16:45:39 +00:00
if ( _stampa_modulo )
2003-02-25 15:22:52 +00:00
set_header ( 5 , FR ( " @129gSALDO " ) ) ;
1995-01-03 16:45:39 +00:00
1997-10-16 08:47:25 +00:00
set_header ( 5 , " @46g!@80g!@114g! " ) ;
1995-01-03 16:45:39 +00:00
if ( _stampa_modulo )
{
set_header ( 5 , " @147g! " ) ;
1997-10-16 08:47:25 +00:00
set_header ( 6 , " @147g! " ) ;
1995-01-03 16:45:39 +00:00
}
1997-10-16 08:47:25 +00:00
set_header ( 6 , " @46g!@80g!@114g! " ) ;
app = " --------------------------------- " ;
1995-01-03 16:45:39 +00:00
if ( _stampa_modulo )
{
1997-10-16 08:47:25 +00:00
set_header ( 6 , " @47g%s@81g%s@115g%s " , ( const char * ) app , ( const char * ) app , ( const char * ) app ) ;
2003-02-25 15:22:52 +00:00
set_header ( 7 , FR ( " @1gdescrizione voce@46g!@53gDare@63g!@69gAvere@80g!@87gDare@97g!@103gAvere@114g!@122gDare@131g!@138gAvere@147g! " ) ) ;
1995-01-03 16:45:39 +00:00
sep1 . fill ( ' - ' ) ; //Stampa 132 - (sep(132))
set_header ( 8 , ( const char * ) sep1 ) ;
}
else
{
1997-10-16 08:47:25 +00:00
set_header ( 6 , " @47g%s@81g%s@122gSALDO " , ( const char * ) app , ( const char * ) app ) ;
2003-02-25 15:22:52 +00:00
set_header ( 7 , FR ( " @1gdescrizione voce@46g!@53gDare@63g!@69gAvere@80g!@87gDare@97g!@103gAvere@114g! " ) ) ;
1995-01-03 16:45:39 +00:00
sep . fill ( ' - ' ) ; //Stampa 132 - (sep(132))
set_header ( 8 , ( const char * ) sep ) ;
}
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : intesta_scalare ( )
1995-01-03 16:45:39 +00:00
{
TString datalimitestr , databilrafrstr ;
1996-03-11 08:06:41 +00:00
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 ( ) ) ;
2003-02-25 15:22:52 +00:00
set_header ( 3 , TR ( " STAMPA BILANCIO CONFORME ALLA IV DIRETTIVA " ) ) ;
set_header ( 3 , FR ( " @80gEs. %s/%s " ) , ( const char * ) d1e , ( const char * ) d2e ) ; /**/
1995-01-03 16:45:39 +00:00
if ( _annoeserafr ! = 0 | | _databilrafr ! = botime )
{
2003-02-25 15:22:52 +00:00
set_header ( 3 , FR ( " @106gEs. %s/%s " ) , ( const char * ) d1r , ( const char * ) d2r ) ; /**/
1995-01-03 16:45:39 +00:00
databilrafrstr = _databilrafr . string ( ) ;
2003-02-25 15:22:52 +00:00
set_header ( 4 , FR ( " @112galla data@122g%s " ) , ( const char * ) databilrafrstr ) ;
1995-01-03 16:45:39 +00:00
}
if ( _tipo_stampa = = 1 )
{
datalimitestr = _datalimite . string ( ) ;
2003-02-25 15:22:52 +00:00
set_header ( 4 , FR ( " @86galla data@96g%s " ) , ( const char * ) datalimitestr ) ;
1995-01-03 16:45:39 +00:00
}
else if ( _tipo_stampa = = 2 )
2003-02-25 15:22:52 +00:00
set_header ( 4 , FR ( " @90gall'ultima immissione " ) ) ;
1995-01-03 16:45:39 +00:00
sep . fill ( ' - ' ) ; //Stampa 132 - (sep(132))
set_header ( 5 , ( const char * ) sep ) ;
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : intesta_verifica ( )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
set_header ( 3 , TR ( " @0gBILANCIO DI VERIFICA IV DIRETTIVA " ) ) ;
1995-01-03 16:45:39 +00:00
if ( _tipo_stampa = = 1 )
{
TString datainistr = _dataini . string ( ) ;
TString datafinestr = _datafine . string ( ) ;
2003-02-25 15:22:52 +00:00
set_header ( 3 , FR ( " @43gdalla data@54g%s alla data %s " ) ,
2003-05-05 14:32:23 +00:00
1997-10-16 08:47:25 +00:00
( const char * ) datainistr , ( const char * ) datafinestr ) ;
1995-01-03 16:45:39 +00:00
}
else if ( _tipo_stampa = = 2 )
2003-02-25 15:22:52 +00:00
set_header ( 3 , FR ( " @42gall'ultima immissione " ) ) ;
1995-01-03 16:45:39 +00:00
2003-05-05 14:32:23 +00:00
TString sep ;
sep . fill ( ' - ' , _stampa_modulo ? 147 : 132 ) ;
set_header ( 4 , sep ) ;
1995-01-03 16:45:39 +00:00
intesta_verifica_fissa ( ) ;
}
1997-10-16 08:47:25 +00:00
void TStampa_IVdirettiva : : init_sort ( )
1995-01-03 16:45:39 +00:00
{
_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 ) , 2 ) ;
_sort - > addsortkey ( ( char * ) & ( _bil - > gruppo ) - ( char * ) & ( _bil - > sez ) , 3 ) ;
_sort - > addsortkey ( ( char * ) & ( _bil - > conto ) - ( char * ) & ( _bil - > sez ) , 3 ) ;
_sort - > addsortkey ( ( char * ) & ( _bil - > sottoc ) - ( char * ) & ( _bil - > sez ) , 6 ) ;
_sort - > init ( ) ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : user_create ( )
1995-01-03 16:45:39 +00:00
{
2003-05-05 14:32:23 +00:00
open_files ( LF_TAB , 0 ) ;
1995-01-03 16:45:39 +00:00
_nditte = new TLocalisamfile ( LF_NDITTE ) ;
_comuni = new TLocalisamfile ( LF_COMUNI ) ;
_unloc = new TLocalisamfile ( LF_UNLOC ) ;
_anag = new TLocalisamfile ( LF_ANAG ) ;
_pconti = new TLocalisamfile ( LF_PCON ) ;
_clifo = new TLocalisamfile ( LF_CLIFO ) ;
1995-04-19 13:13:21 +00:00
_saldi = new TLocalisamfile ( LF_SALDI ) ;
_caus = new TLocalisamfile ( LF_CAUSALI ) ;
_descr = new TParagraph_string ( " " , 40 ) ;
_d = new TParagraph_string ( " " , 33 ) ;
1995-01-03 16:45:39 +00:00
1995-03-13 10:58:43 +00:00
_sld = new TSaldo ( ) ;
1995-01-03 16:45:39 +00:00
_msk = new TMask ( " cg1600a " ) ;
1997-11-12 10:46:27 +00:00
_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 ) ;
1995-01-03 16:45:39 +00:00
return TRUE ;
}
1997-10-16 08:47:25 +00:00
bool TStampa_IVdirettiva : : user_destroy ( )
1995-01-03 16:45:39 +00:00
{
delete _msk ;
delete _nditte ;
delete _comuni ;
delete _unloc ;
delete _anag ;
delete _pconti ;
delete _clifo ;
1995-04-19 13:13:21 +00:00
delete _saldi ;
delete _caus ;
1995-01-03 16:45:39 +00:00
delete _descr ;
1995-04-19 13:13:21 +00:00
delete _d ;
1995-01-03 16:45:39 +00:00
delete _sld ;
return TRUE ;
}
int cg1600 ( int argc , char * argv [ ] )
{
1997-10-16 08:47:25 +00:00
TStampa_IVdirettiva a ;
1995-01-03 16:45:39 +00:00
2003-02-25 15:22:52 +00:00
a . run ( argc , argv , TR ( " Stampa Bilancio IV direttiva CEE " ) ) ;
2003-05-05 14:32:23 +00:00
1995-01-03 16:45:39 +00:00
return 0 ;
}