1997-12-05 16:26:15 +00:00
# include <form.h>
# include <mask.h>
1999-02-02 14:35:53 +00:00
# include <prefix.h>
1997-12-05 16:26:15 +00:00
# include <printapp.h>
# include <recarray.h>
# include <tabutil.h>
# include <utility.h>
# include <lffiles.h>
# include "at0.h"
# include "atlib.h"
# define ALIAS_TCS 200
1998-02-12 13:26:36 +00:00
# define ALIAS_CTD 700
1997-12-05 16:26:15 +00:00
# define FINE_SOSPENSIONE "FS"
1998-08-07 09:41:03 +00:00
# define SOSPENSIONE "SO"
1997-12-05 16:26:15 +00:00
// nomi campi maschera
# include "at0700a.h"
// nomi dei campi
# include "soggetti.h"
# include "contsan.h"
1997-12-09 13:53:23 +00:00
# include "idoneita.h"
1997-12-05 16:26:15 +00:00
# include "sezioni.h"
class TSbloccoSospesi : public TPrintapp
{
TMask * _msk ;
TRelation * _rel ;
TLocalisamfile * _contsan ;
1997-12-09 13:53:23 +00:00
TLocalisamfile * _idoneita ;
1997-12-05 16:26:15 +00:00
TRecord_array * _scontrolli ;
1997-12-09 13:53:23 +00:00
TRecord_array * _sidoneita ;
1997-12-05 16:26:15 +00:00
int _cur ;
int _contatore , _totale ;
TDate _data_sblocco ; // data scadenza sospensione fino a _data_sblocco
TDate _data_stampa ;
TString16 _tiposo ; // tipo sospesione da sbloccare
TString16 _codsez , _codsot ;
1998-07-03 13:14:22 +00:00
bool _definitiva , _anchedimessi , _persezione ;
1997-12-05 16:26:15 +00:00
TParagraph_string _cognome_nome , _operazione ;
TString16 _finesospensione ;
1998-02-13 13:28:00 +00:00
int _intsi_f1 , _intsi_f2 , _intsi_m , _intaf_m , _etadonne ;
2000-11-22 10:11:18 +00:00
int _numdon1 , _numdon2 ;
2005-03-08 13:37:24 +00:00
TString16 _catini1 , _catfin1 , _catini2 , _catfin2 ;
2000-11-22 10:11:18 +00:00
bool _sttess2 , _dataisc , _nomessage , _autoid ;
1997-12-05 16:26:15 +00:00
static bool filter_func_sbloccosospesi ( const TRelation * rel ) ;
protected :
virtual bool user_create ( ) ;
virtual bool user_destroy ( ) ;
virtual bool set_print ( int m ) ;
virtual void set_page ( int file , int cnt ) ;
virtual bool preprocess_page ( int file , int counter ) ;
virtual print_action postprocess_print ( int file , int counter ) ;
2002-03-11 15:51:47 +00:00
static bool data_handler ( TMask_field & f , KEY k ) ;
1997-12-05 16:26:15 +00:00
public :
void filtra_sezioni ( ) ;
void crea_intestazione ( ) ;
void header_sezione ( const TString16 codsez , const TString16 codsot ) ;
void footer_sezione ( ) ;
void fine_stampa ( ) ;
2005-03-08 13:37:24 +00:00
TSbloccoSospesi ( ) : _data_sblocco ( TODAY ) , _data_stampa ( TODAY ) , _tiposo ( " " ) , _cognome_nome ( " " , 25 ) , _operazione ( " " , 45 ) { }
1997-12-05 16:26:15 +00:00
} ;
HIDDEN inline TSbloccoSospesi & app ( ) { return ( TSbloccoSospesi & ) main_app ( ) ; }
2002-03-11 15:51:47 +00:00
bool TSbloccoSospesi : : data_handler ( TMask_field & f , KEY k )
{
if ( f . to_check ( k ) )
{
const TDate oggi ( TODAY ) ;
const TDate data = f . get ( ) ;
if ( data > oggi )
return f . yesno_box ( " ATTENZIONE! La data di sblocco <20> superiore alla data di sistema. Confermi lo sblocco? " ) ;
}
return TRUE ;
}
1997-12-05 16:26:15 +00:00
print_action TSbloccoSospesi : : postprocess_print ( int file , int counter )
{
if ( _contatore > 0 )
footer_sezione ( ) ;
fine_stampa ( ) ;
return NEXT_PAGE ;
}
void TSbloccoSospesi : : fine_stampa ( )
{
// stampa totale soggetti a fine stampa
reset_footer ( ) ;
TString sep ( 80 ) ;
sep . fill ( ' - ' ) ;
set_footer ( 2 , ( const char * ) sep ) ;
if ( _totale > 0 )
1998-02-11 15:34:14 +00:00
{
if ( _totale ! = _contatore )
1998-05-25 13:19:32 +00:00
{
1998-02-11 15:34:14 +00:00
set_footer ( 3 , " TOTALE SOGGETTI SBLOCCATI %d " , _totale ) ;
1998-05-25 13:19:32 +00:00
printer ( ) . formfeed ( ) ;
}
1998-02-11 15:34:14 +00:00
}
1997-12-05 16:26:15 +00:00
else
1998-05-25 13:19:32 +00:00
{
1997-12-05 16:26:15 +00:00
set_footer ( 3 , " NON CI SONO SOGGETTI SOSPESI DA SBLOCCARE " ) ;
1998-05-25 13:19:32 +00:00
printer ( ) . formfeed ( ) ;
}
1997-12-05 16:26:15 +00:00
reset_footer ( ) ;
}
void TSbloccoSospesi : : footer_sezione ( )
{
1998-07-03 13:14:22 +00:00
if ( _persezione )
if ( _contatore > 0 )
{
reset_footer ( ) ;
TString sep ( 80 ) ;
sep . fill ( ' - ' ) ;
set_footer ( 2 , ( const char * ) sep ) ;
set_footer ( 3 , " TOTALE SOGGETTI STAMPATI %d " , _contatore ) ;
printer ( ) . formfeed ( ) ;
reset_footer ( ) ;
}
1997-12-05 16:26:15 +00:00
}
void TSbloccoSospesi : : filtra_sezioni ( )
{
const TString16 sezini = _msk - > get ( F_SEZINI ) ;
const TString16 sotini = _msk - > get ( F_SOTINI ) ;
const TString16 sezfin = _msk - > get ( F_SEZFIN ) ;
const TString16 sotfin = _msk - > get ( F_SOTFIN ) ;
TRectype da ( LF_SOGGETTI ) ;
TRectype a ( LF_SOGGETTI ) ;
if ( sezini . not_empty ( ) )
da . put ( SOG_CODSEZ , sezini ) ;
if ( sotini . not_empty ( ) )
da . put ( SOG_CODSOT , sotini ) ;
if ( sezfin . not_empty ( ) )
a . put ( SOG_CODSEZ , sezfin ) ;
if ( sotfin . not_empty ( ) )
a . put ( SOG_CODSOT , sotfin ) ;
current_cursor ( ) - > setregion ( da , a ) ;
}
bool TSbloccoSospesi : : preprocess_page ( int file , int counter )
{
TRectype & recsog = current_cursor ( ) - > curr ( ) ;
2005-03-08 13:37:24 +00:00
TRectype & reccon = current_cursor ( ) - > curr ( LF_CONTSAN ) ;
1997-12-05 16:26:15 +00:00
TString80 nome = recsog . get ( SOG_COGNOME ) ;
nome < < " " ;
nome < < recsog . get ( SOG_NOME ) ;
_cognome_nome = nome ;
const TString16 stato = recsog . get ( SOG_STATO ) ;
1998-02-04 13:46:27 +00:00
const TString16 pros_stato = recsog . get ( SOG_PROS_STATO ) ;
1997-12-05 16:26:15 +00:00
const TString16 statosi = recsog . get ( SOG_STATOSI ) ;
const TString16 statoaf = recsog . get ( SOG_STATOAF ) ;
const TDate datafine = recsog . get_date ( SOG_DATA_PROS ) ;
TDate datafinesi ( NULLDATE ) ;
TDate datafineaf ( NULLDATE ) ;
if ( statosi = = " SO " )
2004-02-26 10:36:28 +00:00
{
datafinesi = recsog . get_date ( SOG_FINESOSSI ) ;
if ( ( datafine = = datafinesi ) & & ( stato = = statosi ) & & ( pros_stato ! = FINE_SOSPENSIONE ) )
datafinesi = NULLDATE ;
}
1997-12-05 16:26:15 +00:00
if ( statoaf = = " SO " )
2004-02-26 10:36:28 +00:00
{
1997-12-05 16:26:15 +00:00
datafineaf = recsog . get_date ( SOG_FINESOSAF ) ;
2004-02-26 10:36:28 +00:00
if ( ( datafine = = datafineaf ) & & ( stato = = statoaf ) & & ( pros_stato ! = FINE_SOSPENSIONE ) )
datafineaf = NULLDATE ;
}
1997-12-05 16:26:15 +00:00
TString80 operazione = " " ;
1998-02-04 13:46:27 +00:00
if ( stato = = " SO " & & pros_stato = = FINE_SOSPENSIONE & & datafine . ok ( ) & & datafine < = app ( ) . _data_sblocco )
{
const TDate datastato = recsog . get_date ( SOG_DATASTATO ) ;
2005-03-08 13:37:24 +00:00
operazione . format ( " %s %s %4s -- -- -- SO FS " , datastato . string ( ) , datafine . string ( ) , ( const char * ) reccon . get ( CON_MOTIVO ) ) ;
1998-02-04 13:46:27 +00:00
}
1997-12-05 16:26:15 +00:00
else
if ( statosi = = " SO " & & datafinesi . ok ( ) & & datafinesi < = app ( ) . _data_sblocco )
1998-02-04 13:46:27 +00:00
{
const TDate datastato = recsog . get_date ( SOG_DATASI ) ;
2005-03-08 13:37:24 +00:00
operazione . format ( " %s %s %4s SI SO ID " , datastato . string ( ) , datafinesi . string ( ) , ( const char * ) reccon . get ( CON_MOTIVO ) ) ;
1998-02-04 13:46:27 +00:00
}
1997-12-05 16:26:15 +00:00
else
if ( statoaf = = " SO " & & datafineaf . ok ( ) & & datafineaf < = app ( ) . _data_sblocco )
1998-02-04 13:46:27 +00:00
{
const TDate datastato = recsog . get_date ( SOG_DATAAF ) ;
2005-03-08 13:37:24 +00:00
operazione . format ( " %s %s %4s AF SO ID " , datastato . string ( ) , datafineaf . string ( ) , ( const char * ) reccon . get ( CON_MOTIVO ) ) ;
2000-03-03 11:47:59 +00:00
}
TDate datarif = app ( ) . _data_sblocco ;
datarif . set_year ( datarif . year ( ) - 2 ) ;
TDate dataultdon = recsog . get_date ( SOG_DATAULTDON ) ;
if ( dataultdon . ok ( ) )
{
if ( dataultdon < datarif )
operazione < < " ** " ;
}
else
{
TDate dataultido = recsog . get_date ( SOG_DATAULTID ) ;
TString16 idon1 = recsog . get ( SOG_IDON1 ) ;
TString16 idon2 = recsog . get ( SOG_IDON2 ) ;
TString16 idon3 = recsog . get ( SOG_IDON3 ) ;
TString16 idon4 = recsog . get ( SOG_IDON4 ) ;
if ( dataultido . ok ( ) & & is_idon ( idon1 , idon2 , idon3 , idon4 , IDON_SI ) )
if ( dataultido < datarif )
operazione < < " ** " ;
}
1997-12-05 16:26:15 +00:00
_operazione = operazione ;
if ( _definitiva )
1998-02-04 13:46:27 +00:00
{
1997-12-09 13:53:23 +00:00
if ( stato = = " SO " & & datafine . ok ( ) & & datafine < = app ( ) . _data_sblocco )
{
TRectype * key = new TRectype ( LF_CONTSAN ) ;
long codice = recsog . get_long ( SOG_CODICE ) ;
key - > put ( CON_CODICE , codice ) ;
int err = _scontrolli - > read ( key ) ;
2003-08-08 13:24:47 +00:00
TRectype * key1 = new TRectype ( LF_IDONEITA ) ;
key1 - > put ( IDO_CODICE , codice ) ;
err = _sidoneita - > read ( key1 ) ;
1997-12-09 13:53:23 +00:00
int progcon = _scontrolli - > rows ( ) + 1 ;
TRectype & reccon = _contsan - > curr ( ) ;
reccon . zero ( ) ;
reccon . put ( CON_CODICE , codice ) ;
reccon . put ( CON_PROGCON , progcon ) ;
reccon . put ( CON_DATACON , _data_stampa ) ;
reccon . put ( CON_TIPOCON , FINE_SOSPENSIONE ) ;
1999-02-02 14:35:53 +00:00
TString80 resp = user ( ) ;
resp < < " - SBLOCCO AUTOMATICO " ;
reccon . put ( CON_RESPONSAB , resp ) ;
1997-12-09 13:53:23 +00:00
_scontrolli - > add_row ( reccon ) ;
_scontrolli - > rewrite ( ) ;
1998-10-16 14:13:25 +00:00
recsog . put ( SOG_DATACONV , NULLDATE ) ;
recsog . put ( SOG_DATAULTSOL , NULLDATE ) ;
recsog . put ( SOG_NUMCONV , 0 ) ;
1998-02-13 13:28:00 +00:00
//current_cursor()->file().rewrite();
1997-12-09 13:53:23 +00:00
}
if ( ( statosi = = " SO " & & datafinesi . ok ( ) & & datafinesi < = app ( ) . _data_sblocco ) | | ( statoaf = = " SO " & & datafineaf . ok ( ) & & datafineaf < = app ( ) . _data_sblocco ) )
{
TRectype * key = new TRectype ( LF_IDONEITA ) ;
long codice = recsog . get_long ( SOG_CODICE ) ;
2000-03-03 11:47:59 +00:00
key - > put ( IDO_CODICE , codice ) ;
1998-02-04 13:46:27 +00:00
int err = _sidoneita - > read ( key ) ;
2000-03-03 11:47:59 +00:00
// Aggiunte le righe relative a key1 da Marco in data 20/12/99
// per gestire le sospensioni parziali in quanto per tali soggetti non veniva mai passato,
// alla funzione CON_REORD, lo spreadsheet dei controlli sanitari ma solo quello delle idoneita'.
TRectype * key1 = new TRectype ( LF_CONTSAN ) ;
key1 - > put ( CON_CODICE , codice ) ;
err = _scontrolli - > read ( key1 ) ;
1997-12-09 13:53:23 +00:00
if ( statosi = = " SO " & & datafinesi . ok ( ) & & datafinesi < = app ( ) . _data_sblocco )
{
int progido = _sidoneita - > rows ( ) + 1 ;
TRectype & recido = _idoneita - > curr ( ) ;
recido . zero ( ) ;
recido . put ( IDO_CODICE , codice ) ;
recido . put ( IDO_PROGIDO , progido ) ;
recido . put ( IDO_DATAIDO , _data_stampa ) ;
recido . put ( IDO_IDO_SOS , " ID " ) ;
recido . put ( IDO_TIPOIDO , " SI " ) ;
recido . put ( IDO_INTERVALLO , recsog . get ( SOG_INTSI ) ) ;
1998-02-13 13:28:00 +00:00
if ( recsog . get_int ( SOG_INTSI ) = = 0 )
{
2003-06-19 13:02:53 +00:00
const char sesso = recsog . get_char ( SOG_SESSO ) ;
if ( sesso = = ' 2 ' )
1998-02-13 13:28:00 +00:00
{
TDate datanasc = recsog . get_date ( SOG_DATANASC ) ;
int eta = _data_stampa . year ( ) - datanasc . year ( ) ;
1998-02-26 10:21:19 +00:00
if ( eta < = _etadonne )
1998-02-13 13:28:00 +00:00
recido . put ( IDO_INTERVALLO , _intsi_f1 ) ;
else
recido . put ( IDO_INTERVALLO , _intsi_f2 ) ;
}
else
recido . put ( IDO_INTERVALLO , _intsi_m ) ;
}
2002-03-11 15:51:47 +00:00
TString80 resp = user ( ) ;
resp < < " - SBLOCCO AUTOMATICO " ;
recido . put ( IDO_RESPONSAB , resp ) ;
1997-12-09 13:53:23 +00:00
_sidoneita - > add_row ( recido ) ;
_sidoneita - > rewrite ( ) ;
1998-10-16 14:13:25 +00:00
recsog . put ( SOG_DATACONV , NULLDATE ) ;
recsog . put ( SOG_DATAULTSOL , NULLDATE ) ;
recsog . put ( SOG_NUMCONV , 0 ) ;
1997-12-09 13:53:23 +00:00
}
if ( statoaf = = " SO " & & datafineaf . ok ( ) & & datafineaf < = app ( ) . _data_sblocco )
{
int progido = _sidoneita - > rows ( ) + 1 ;
TRectype & recido = _idoneita - > curr ( ) ;
recido . zero ( ) ;
recido . put ( IDO_CODICE , codice ) ;
recido . put ( IDO_PROGIDO , progido ) ;
recido . put ( IDO_DATAIDO , _data_stampa ) ;
recido . put ( IDO_IDO_SOS , " ID " ) ;
recido . put ( IDO_TIPOIDO , " AF " ) ;
recido . put ( IDO_INTERVALLO , recsog . get ( SOG_INTAF ) ) ;
1998-02-13 13:28:00 +00:00
if ( recsog . get_int ( SOG_INTAF ) = = 0 )
recido . put ( IDO_INTERVALLO , _intaf_m ) ;
1999-02-02 14:35:53 +00:00
TString80 resp = user ( ) ;
resp < < " - SBLOCCO AUTOMATICO " ;
recido . put ( IDO_RESPONSAB , resp ) ;
1997-12-09 13:53:23 +00:00
_sidoneita - > add_row ( recido ) ;
_sidoneita - > rewrite ( ) ;
}
2003-08-08 13:24:47 +00:00
}
con_reord ( recsog , _scontrolli , _sidoneita ) ;
const TDate oggi ( TODAY ) ;
recsog . put ( SOG_DATAULTAGG , oggi ) ;
recsog . put ( SOG_UTENULTAGG , user ( ) ) ;
2000-11-22 10:11:18 +00:00
2003-08-08 13:24:47 +00:00
TString16 catdon = recsog . get ( SOG_CATDON ) ;
const TRectype & ctd = cache ( ) . get ( " CTD " , catdon ) ;
const int totdon = recsog . get_int ( SOG_TOTDON ) ;
if ( ctd . get_bool ( " B0 " ) )
{
const TString16 catcoll = ctd . get ( " S6 " ) ;
if ( catcoll . not_empty ( ) )
2002-07-24 09:09:05 +00:00
{
2003-08-08 13:24:47 +00:00
recsog . put ( SOG_CATDON , catcoll ) ;
recsog . put ( SOG_DATADIM , NULLDATE ) ;
catdon = catcoll ;
2002-07-24 09:09:05 +00:00
}
2003-08-08 13:24:47 +00:00
}
if ( ( catdon = = _catini1 | | _catini1 . empty ( ) ) & & ( totdon > = _numdon1 ) & & _catfin1 . not_empty ( ) )
{
recsog . put ( SOG_CATDON , _catfin1 ) ;
catdon = _catfin1 ;
}
bool tstampata = recsog . get_bool ( SOG_T_STAMPATA ) ;
if ( ( catdon = = _catini2 | | _catini2 . empty ( ) ) & & ( totdon > = _numdon2 ) & & _catfin2 . not_empty ( ) & & ( ! _sttess2 | | tstampata ) )
{
recsog . put ( SOG_CATDON , _catfin2 ) ;
catdon = _catfin2 ;
}
current_cursor ( ) - > file ( ) . rewrite ( ) ;
1997-12-09 13:53:23 +00:00
}
1997-12-05 16:26:15 +00:00
// salto pagina se cambio sezione
const TString16 codsez = recsog . get ( SOG_CODSEZ ) ;
const TString16 codsot = recsog . get ( SOG_CODSOT ) ;
if ( ( _codsez ! = codsez ) | | ( _codsot ! = codsot ) )
{
if ( ( _codsez ! = " ** " ) & & ( _contatore > 0 ) )
footer_sezione ( ) ;
_contatore = 0 ;
_codsez = codsez ;
_codsot = codsot ;
header_sezione ( codsez , codsot ) ;
}
_contatore + + ;
_totale + + ;
return TRUE ;
}
void TSbloccoSospesi : : set_page ( int file , int cnt )
{
set_row ( 1 , " @0g@pn " , FLD ( LF_SOGGETTI , SOG_CODICE , " ######## " ) ) ;
set_row ( 1 , " @9g@S " , FLD ( LF_SOGGETTI , SOG_CATDON ) ) ;
set_row ( 1 , " @12g#a " , & _cognome_nome ) ;
set_row ( 1 , " @38g@ld " , FLD ( LF_SOGGETTI , SOG_DATANASC ) ) ;
set_row ( 1 , " @49g@S " , FLD ( LF_SOGGETTI , SOG_TESSAVIS ) ) ;
1998-07-03 13:14:22 +00:00
set_row ( 1 , " @56g@S " , FLD ( LF_SOGGETTI , SOG_CODSEZ ) ) ;
set_row ( 1 , " @59g@S " , FLD ( LF_SOGGETTI , SOG_CODSOT ) ) ;
set_row ( 1 , " @62g#a " , & _operazione ) ;
2005-03-08 13:37:24 +00:00
set_row ( 1 , " @110g@ld " , FLD ( LF_SOGGETTI , SOG_DATAPROSSI ) ) ;
set_row ( 1 , " @121g@S " , FLD ( LF_SOGGETTI , SOG_TELABI ) ) ;
set_row ( 2 , " @121g@S " , FLD ( LF_SOGGETTI , SOG_TELLAV ) ) ;
set_row ( 3 , " @121g@S " , FLD ( LF_SOGGETTI , SOG_TELALT ) ) ;
set_row ( 4 , " " ) ;
1997-12-05 16:26:15 +00:00
}
bool TSbloccoSospesi : : filter_func_sbloccosospesi ( const TRelation * rel )
{
1998-02-12 13:26:36 +00:00
bool filtrato = TRUE ;
1997-12-05 16:26:15 +00:00
TRectype & recsog = rel - > lfile ( ) . curr ( ) ;
1998-02-12 13:26:36 +00:00
if ( ! app ( ) . _anchedimessi )
filtrato = ! ( rel - > lfile ( - ALIAS_CTD ) . get_bool ( " B0 " ) ) ;
if ( filtrato )
{
filtrato = FALSE ;
const TString16 stato = recsog . get ( SOG_STATO ) ;
const TString16 statopros = recsog . get ( SOG_PROS_STATO ) ;
const TString16 statosi = recsog . get ( SOG_STATOSI ) ;
const TString16 statoaf = recsog . get ( SOG_STATOAF ) ;
1998-08-07 09:41:03 +00:00
if ( app ( ) . _tiposo . not_empty ( ) )
filtrato = filtrato | | ( ( stato = = app ( ) . _tiposo ) & & ( statopros = = FINE_SOSPENSIONE ) ) ;
else
2005-05-20 10:15:20 +00:00
{
filtrato = ( ( statosi = = SOSPENSIONE ) | | ( statoaf = = SOSPENSIONE ) ) ;
1998-08-07 09:41:03 +00:00
filtrato = filtrato | | ( ( rel - > lfile ( - ALIAS_TCS ) . get ( " S6 " ) = = " S " ) & & ( statopros = = FINE_SOSPENSIONE ) ) ;
2005-05-20 10:15:20 +00:00
}
1998-08-07 09:41:03 +00:00
if ( filtrato )
{
TDate datafine ( NULLDATE ) ;
if ( statopros = = FINE_SOSPENSIONE )
datafine = recsog . get_date ( SOG_DATA_PROS ) ;
TDate datafinesi ( NULLDATE ) ;
TDate datafineaf ( NULLDATE ) ;
2004-02-26 10:36:28 +00:00
if ( statosi = = " SO " )
{
datafinesi = recsog . get_date ( SOG_FINESOSSI ) ;
if ( ( stato = = statosi ) & & ( statopros ! = FINE_SOSPENSIONE ) )
datafinesi = NULLDATE ;
}
1998-08-07 09:41:03 +00:00
if ( statoaf = = " SO " )
2004-02-26 10:36:28 +00:00
{
1998-08-07 09:41:03 +00:00
datafineaf = recsog . get_date ( SOG_FINESOSAF ) ;
2004-02-26 10:36:28 +00:00
if ( ( stato = = statoaf ) & & ( statopros ! = FINE_SOSPENSIONE ) )
datafineaf = NULLDATE ;
}
1998-08-07 09:41:03 +00:00
filtrato = ( datafine . ok ( ) ) & & ( datafine < = app ( ) . _data_sblocco ) & & ( statopros = = FINE_SOSPENSIONE ) ;
if ( ( ! filtrato ) & & ( datafinesi . ok ( ) | | datafineaf . ok ( ) ) )
filtrato = ( ( datafinesi . ok ( ) & & ( datafinesi < = app ( ) . _data_sblocco ) ) | | ( datafineaf . ok ( ) & & ( datafineaf < = app ( ) . _data_sblocco ) ) ) ;
}
1998-02-12 13:26:36 +00:00
}
1997-12-05 16:26:15 +00:00
return filtrato ;
}
void TSbloccoSospesi : : header_sezione ( const TString16 codsez , const TString16 codsot )
{
1998-07-03 13:14:22 +00:00
if ( _persezione )
1997-12-05 16:26:15 +00:00
{
1998-07-03 13:14:22 +00:00
const TString80 densez = current_cursor ( ) - > curr ( LF_SEZIONI ) . get ( SEZ_DENSEZ ) ;
const TString80 densot = current_cursor ( ) - > curr ( LF_SEZIONI ) . get ( SEZ_DENSOT ) ;
2004-01-07 10:10:41 +00:00
TString intestazione ( 115 ) ;
1998-07-03 13:14:22 +00:00
intestazione = " Sezione: " ;
intestazione < < codsez ;
1997-12-05 16:26:15 +00:00
intestazione < < " / " ;
1998-07-03 13:14:22 +00:00
intestazione < < codsot ;
intestazione < < " " ;
intestazione < < densez ;
2000-10-10 08:09:56 +00:00
if ( densot . not_empty ( ) )
1998-07-03 13:14:22 +00:00
{
intestazione < < " / " ;
intestazione < < densot ;
}
intestazione . center_just ( ) ;
set_header ( 1 , " @0g%s " , ( const char * ) intestazione ) ;
}
1997-12-05 16:26:15 +00:00
return ;
}
bool TSbloccoSospesi : : set_print ( int )
{
KEY tasto ;
tasto = _msk - > run ( ) ;
if ( tasto = = K_ENTER )
{
_codsez = " ** " ;
_codsot = " ** " ;
_data_sblocco = _msk - > get ( F_DATA ) ;
_tiposo = _msk - > get ( F_TIPO ) ;
_definitiva = _msk - > get_bool ( F_DEFINITIVA ) ;
1998-02-12 13:26:36 +00:00
_anchedimessi = _msk - > get_bool ( F_ANCHEDIMESSI ) ;
1998-07-03 13:14:22 +00:00
_persezione = _msk - > get_bool ( F_PERSEZIONE ) ;
1997-12-05 16:26:15 +00:00
_contatore = 0 ;
1998-08-07 09:41:03 +00:00
_totale = 0 ;
filtra_sezioni ( ) ;
if ( _persezione )
( ( TSorted_cursor * ) current_cursor ( ) ) - > change_order ( " 90->CODSEZ|90->CODSOT|90->COGNOME|90->NOME|90->DATANASC " ) ;
else
( ( TSorted_cursor * ) current_cursor ( ) ) - > change_order ( " 90->COGNOME|90->NOME|90->DATANASC " ) ;
1997-12-05 16:26:15 +00:00
reset_files ( ) ;
add_file ( LF_SOGGETTI ) ;
// filtro per tipo sospensione
1998-08-07 09:41:03 +00:00
/*
1997-12-05 16:26:15 +00:00
TString256 filtro = " " ;
if ( _tiposo . not_empty ( ) )
1998-02-12 13:26:36 +00:00
filtro . format ( " (((STATO == \" %s \" ) && (PROS_STATO == \" FS \" )) " , ( const char * ) _tiposo ) ;
1997-12-05 16:26:15 +00:00
else
1998-02-12 13:26:36 +00:00
filtro < < " (((TCS->S6 == \" S \" ) && (PROS_STATO == \" FS \" )) " ;
filtro < < " || (STATOSI == \" SO \" ) || (STATOAF == \" SO \" )) " ;
1997-12-05 16:26:15 +00:00
current_cursor ( ) - > setfilter ( filtro , TRUE ) ;
1998-08-07 09:41:03 +00:00
*/
1997-12-05 16:26:15 +00:00
current_cursor ( ) - > set_filterfunction ( filter_func_sbloccosospesi , TRUE ) ;
reset_print ( ) ;
1998-09-02 14:06:20 +00:00
printer ( ) . footerlen ( 0 ) ;
crea_intestazione ( ) ;
1997-12-05 16:26:15 +00:00
return TRUE ;
}
else
return FALSE ;
}
void TSbloccoSospesi : : crea_intestazione ( )
{
reset_header ( ) ;
2005-03-08 13:37:24 +00:00
TString sep ( 136 ) ;
1997-12-05 16:26:15 +00:00
if ( _definitiva )
sep = " SBLOCCO DEFINITIVO SOSPESI " ;
else
sep = " STAMPA PROVVISORIA PER SBLOCCO SOSPESI " ;
sep < < _tiposo ;
sep < < " FINO ALLA DATA " ;
TString16 data_stampa = _data_sblocco . string ( ) ;
sep < < data_stampa ;
sep . center_just ( ) ;
set_header ( 2 , " @0g%s " , ( const char * ) sep ) ;
data_stampa = _data_stampa . string ( ) ;
set_header ( 2 , " @0g%10s " , ( const char * ) data_stampa ) ;
sep = " " ;
sep < < " Pag. @# " ;
2005-03-08 13:37:24 +00:00
set_header ( 2 , " @120g%s " , ( const char * ) sep ) ;
1997-12-05 16:26:15 +00:00
sep = " " ;
sep . fill ( ' - ' ) ;
set_header ( 3 , ( const char * ) sep ) ;
2005-03-08 13:37:24 +00:00
set_header ( 4 , " @0gCod.@9gC.@12gCognome e nome@38gNato il@49gTess.@56gSe/So@62gData sosp.@73gScadenza@84gMot. @89gDo Da A Sogg.@110gData pr.SI@121gTel. abi. " ) ;
set_header ( 5 , " @121gTel. lav. " ) ;
set_header ( 6 , " @121gTel. altro " ) ;
set_header ( 7 , " @0g------@9g--@12g-------------------------@38g----------@49g------@56g-- --@62g----------@73g----------@84g----@89g---------------------@110g----------@121g-------------- " ) ;
1997-12-05 16:26:15 +00:00
printer ( ) . footerlen ( 3 ) ;
}
bool TSbloccoSospesi : : user_create ( )
{
_msk = new TMask ( " at0700a " ) ;
2002-03-11 15:51:47 +00:00
_msk - > set_handler ( F_DATA , data_handler ) ;
1997-12-05 16:26:15 +00:00
_rel = new TRelation ( LF_SOGGETTI ) ;
2005-03-08 13:37:24 +00:00
_rel - > add ( LF_CONTSAN , " CODICE==CODICE|DATACON==DATASTATO " ) ;
1997-12-05 16:26:15 +00:00
_rel - > add ( LF_SEZIONI , " CODSEZ==CODSEZ|CODSOT==CODSOT " ) ;
_rel - > add ( " TCS " , " CODTAB==STATO " , 1 , 0 , ALIAS_TCS ) ;
1998-02-12 13:26:36 +00:00
_rel - > add ( " CTD " , " CODTAB==CATDON " , 1 , 0 , ALIAS_CTD ) ;
1997-12-05 16:26:15 +00:00
//cursore ordinamento per sezione+sottogruppo+cognome+nome
1998-08-07 09:41:03 +00:00
add_cursor ( new TSorted_cursor ( _rel , " " , " " , 3 ) ) ;
1997-12-05 16:26:15 +00:00
_contsan = new TLocalisamfile ( LF_CONTSAN ) ;
1997-12-09 13:53:23 +00:00
_idoneita = new TLocalisamfile ( LF_IDONEITA ) ;
1997-12-05 16:26:15 +00:00
_scontrolli = new TRecord_array ( LF_CONTSAN , CON_PROGCON ) ;
1997-12-09 13:53:23 +00:00
_sidoneita = new TRecord_array ( LF_IDONEITA , IDO_PROGIDO ) ;
1998-02-13 13:28:00 +00:00
TConfig config ( CONFIG_STUDIO ) ;
2000-11-22 10:11:18 +00:00
_numdon1 = config . get_int ( " NumDon1 " ) ;
_numdon2 = config . get_int ( " NumDon2 " ) ;
_catini1 = config . get ( " CatIni1 " ) ;
_catfin1 = config . get ( " CatFin1 " ) ;
_catini2 = config . get ( " CatIni2 " ) ;
_catfin2 = config . get ( " CatFin2 " ) ;
_sttess2 = config . get_bool ( " StTess2 " ) ;
_dataisc = config . get_bool ( " DataIsc " ) ;
_nomessage = config . get_bool ( " NoMessage " ) ;
1998-02-13 13:28:00 +00:00
_etadonne = config . get_int ( " EtaDonne " ) ;
_intsi_f1 = config . get_int ( " IntSI_F1 " ) ;
_intsi_f2 = config . get_int ( " IntSI_F2 " ) ;
_intsi_m = config . get_int ( " IntSI_M " ) ;
_intaf_m = config . get_int ( " IntAF_M " ) ;
2000-11-22 10:11:18 +00:00
1997-12-05 16:26:15 +00:00
return TRUE ;
}
bool TSbloccoSospesi : : user_destroy ( )
{
1998-08-07 09:41:03 +00:00
delete _sidoneita ;
delete _scontrolli ;
delete _idoneita ;
delete _contsan ;
1997-12-05 16:26:15 +00:00
delete _rel ;
delete _msk ;
return TRUE ;
}
int at0700 ( int argc , char * argv [ ] )
{
TSbloccoSospesi a ;
a . run ( argc , argv , " Sblocco sospesi " ) ;
return 0 ;
}