Files correlati : Ricompilazione Demo : [ ] Commento : Modifiche al pacchetto gestione 770 (ora denominato Gestione Percipienti), in modo da avere diciture corrette per quanto riguarda i programmi di stampa e gestione quadri, ora chiamati RIEPILOGHI. Commentato l'uso dei quadri che non servivano piu', modificati opportunamente i menus e programmi per gestione parametri ed azzeramenti git-svn-id: svn://10.65.10.50/trunk@7030 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			1039 lines
		
	
	
		
			29 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			1039 lines
		
	
	
		
			29 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
// 772200.cpp - Stampa certificazioni
 | 
						|
#include <config.h>
 | 
						|
#include <mask.h>
 | 
						|
#include <printapp.h>
 | 
						|
#include <progind.h>
 | 
						|
#include <relation.h>
 | 
						|
#include <sort.h>
 | 
						|
#include <tabutil.h>
 | 
						|
 | 
						|
#include <comuni.h>
 | 
						|
#include <nditte.h>
 | 
						|
#include <anagr.h>
 | 
						|
#include <anafis.h>
 | 
						|
 | 
						|
#include "perc.h"
 | 
						|
#include "rpag.h"
 | 
						|
#include "scperc.h"
 | 
						|
 | 
						|
#include "772.h"
 | 
						|
#include "772200.h"
 | 
						|
#include "77lib.h"
 | 
						|
 | 
						|
class TSt_certif : public TPrintapp
 | 
						|
{  
 | 
						|
  char  _liv;       // Se stampa a livello di studio
 | 
						|
  int   _anno_dic;  // Anno dichiarazione nei paramentri utente o studio
 | 
						|
  
 | 
						|
  // Configurazione
 | 
						|
  TString16  _section;
 | 
						|
  TConfig*   _cnf,* _cns;
 | 
						|
  
 | 
						|
  struct righe_pag
 | 
						|
  {
 | 
						|
    char ditta[6];
 | 
						|
    char tipoa;
 | 
						|
    char codan[6];
 | 
						|
    char perc[7];
 | 
						|
    char codc[3];
 | 
						|
    real corr;
 | 
						|
    real somme;
 | 
						|
    real quote;
 | 
						|
    real impo;
 | 
						|
    real rite;
 | 
						|
    real netto;
 | 
						|
    real inps;
 | 
						|
  };
 | 
						|
  righe_pag*        _rig;
 | 
						|
  TRelation*        _rel;
 | 
						|
  TCursor*          _cur;
 | 
						|
  TProgind*         _prog;
 | 
						|
  TSort*            _sort;
 | 
						|
  const char*       _buf;
 | 
						|
  TLocalisamfile*   _nditte;
 | 
						|
  TLocalisamfile*   _anag;
 | 
						|
  TLocalisamfile*   _rpag;
 | 
						|
  TLocalisamfile*   _scperc;
 | 
						|
  TLocalisamfile*   _comuni;  
 | 
						|
  TTable*           _ca7;
 | 
						|
  TString80         _ragsocER, _indER, _civER, _capER, _dencomER, _provER, _cofiER;
 | 
						|
  TString80         _ragsocPE, _indPE, _civPE, _capPE, _dencomPE, _provPE, _cofiPE;
 | 
						|
  TString80         _dencomnscER, _provnscER, _dencomnscPE, _provnscPE;
 | 
						|
  TString80         _datanascER, _datanascPE, _luogo;
 | 
						|
  TString16         _key1p, _key2p, _perc_p;
 | 
						|
  TDate             _data;
 | 
						|
  char              _tipoa_p, _tipoa;         
 | 
						|
  int               _mese_da, _mese_a, _codc_p;
 | 
						|
  int               _riga, _off_lung, _conta; 
 | 
						|
  long              _num_att, _codanagER, _codanagPE_p, _codanagPE;
 | 
						|
  real              _tot_corr, _tot_somme, _tot_quote, _tot_impo, _tot_rite, _tot_netto, _tot_inps;
 | 
						|
  real              _t_corr, _t_somme, _t_quote, _t_impo, _t_rite, _t_netto, _t_inps;
 | 
						|
  real              _corr, _quote, _impo, _rite, _netto, _somme, _inps;
 | 
						|
  bool              _intesta, _stampa, _settato_totale, _fai_footer;
 | 
						|
  bool              _st_modulo, _st_data;
 | 
						|
                                       
 | 
						|
protected:
 | 
						|
  virtual void on_config_change();
 | 
						|
  virtual bool user_create() ;
 | 
						|
  virtual bool user_destroy();
 | 
						|
  virtual bool set_print(int m);
 | 
						|
  virtual bool preprocess_page (int,int);
 | 
						|
  virtual bool preprocess_print(int,int);
 | 
						|
  virtual print_action postprocess_page (int,int);
 | 
						|
  virtual void postclose_print();
 | 
						|
  virtual void preprocess_header();
 | 
						|
  virtual void preprocess_footer();
 | 
						|
  
 | 
						|
  static bool mese_handler(TMask_field& f, KEY k);        
 | 
						|
  static bool codditta_hnd(TMask_field& f, KEY k);
 | 
						|
  
 | 
						|
  bool   init_print();
 | 
						|
  
 | 
						|
public:
 | 
						|
  TRectype& look_causali();
 | 
						|
  TRectype& look_schperc(long,char,long,int);
 | 
						|
  void crea_sort();
 | 
						|
  void init_sort();
 | 
						|
  void leggi_sort();
 | 
						|
  void stampa_su_modulo();
 | 
						|
  void stampa_totale(int);
 | 
						|
  void salva_totale(); 
 | 
						|
  int  stampa_riga(int,int,const char*);
 | 
						|
  void dati_erogante();
 | 
						|
  void dati_percipiente(); 
 | 
						|
  void riempi_record(long,char,long,const real&,int,const real&,const real&,const real&,const real&,const real&,const real&,const real&);
 | 
						|
    
 | 
						|
  // D = stampa ditta, S = stampa a livello di studio 
 | 
						|
  TSt_certif(char livello='D') : _intesta(TRUE), _liv(toupper(livello)) {}
 | 
						|
  virtual ~TSt_certif() {}
 | 
						|
};
 | 
						|
 | 
						|
bool TSt_certif::codditta_hnd(TMask_field& f, KEY k)
 | 
						|
{         
 | 
						|
  if (k == K_TAB && !(f.mask().is_running()) )
 | 
						|
  {
 | 
						|
    TString16 codditta; codditta << get_firm_770();
 | 
						|
    if (codditta != "0")        
 | 
						|
    {
 | 
						|
      f.set(codditta);
 | 
						|
      f.check();
 | 
						|
    }
 | 
						|
  }   
 | 
						|
 | 
						|
  return TRUE;                                           
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::on_config_change()
 | 
						|
{ 
 | 
						|
  
 | 
						|
  TConfig conf(_liv == 'S' ? CONFIG_USER : CONFIG_STUDIO);
 | 
						|
  _anno_dic = (int)conf.get_long(ANNO_SEL, _section);
 | 
						|
  if (_liv == 'D')
 | 
						|
  {
 | 
						|
    TConfig confs(CONFIG_USER);
 | 
						|
    _st_data = confs.get_bool(ST_DATA, "77ps");
 | 
						|
  }
 | 
						|
  else _st_data = conf.get_bool(ST_DATA, "77ps");
 | 
						|
}
 | 
						|
 | 
						|
bool TSt_certif::mese_handler (TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  if (k == K_ENTER)
 | 
						|
  {
 | 
						|
    const int meseda = f.mask().get_int(F_DA);
 | 
						|
    const int mesea  = atoi(f.get());
 | 
						|
    if (meseda > mesea)
 | 
						|
    {                   
 | 
						|
      f.error_box("Il mese di inizio periodo non deve essere superiore al mese di fine periodo");
 | 
						|
      return FALSE;
 | 
						|
    }
 | 
						|
  }  
 | 
						|
  return TRUE;
 | 
						|
} 
 | 
						|
 | 
						|
TRectype& TSt_certif::look_schperc (long cod, char t, long codan, int np)
 | 
						|
{
 | 
						|
//  TLocalisamfile schede(LF_SCPERC);    // Gosen
 | 
						|
  TLocalisamfile& schede = *_scperc;
 | 
						|
  schede.zero();
 | 
						|
  schede.put(SPR_CODDITTA, cod);
 | 
						|
  schede.put(SPR_TIPOA, t);
 | 
						|
  schede.put(SPR_CODANAGR, codan);
 | 
						|
  schede.put(SPR_NPROG, np);
 | 
						|
  schede.read();
 | 
						|
  if (schede.bad())
 | 
						|
    schede.zero();
 | 
						|
 | 
						|
  return schede.curr();
 | 
						|
}
 | 
						|
 | 
						|
TRectype& TSt_certif::look_causali()
 | 
						|
{                            
 | 
						|
  TString16 dep;
 | 
						|
  
 | 
						|
  _ca7->zero();
 | 
						|
  dep.format("%02d", _codc_p);
 | 
						|
  _ca7->put("CODTAB", dep);
 | 
						|
  _ca7->read();      
 | 
						|
  if (_ca7->bad())
 | 
						|
     _ca7->zero();
 | 
						|
 | 
						|
  return _ca7->curr();
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::init_sort()
 | 
						|
{
 | 
						|
  _rig  = new righe_pag;
 | 
						|
  _sort = new TSort(sizeof(righe_pag));
 | 
						|
 | 
						|
/*
 | 
						|
  _sort->addsortkey ((char*)&(_rig->ditta) - (char*)&(_rig->ditta),5);
 | 
						|
  _sort->addsortkey ((char*)&(_rig->tipoa) - (char*)&(_rig->ditta),1);
 | 
						|
  _sort->addsortkey ((char*)&(_rig->codan) - (char*)&(_rig->ditta),5);
 | 
						|
  _sort->addsortkey ((char*)&(_rig->perc) - (char*)&(_rig->ditta),6);
 | 
						|
  _sort->addsortkey ((char*)&(_rig->codc) - (char*)&(_rig->ditta),2);
 | 
						|
*/
 | 
						|
  _sort->addsortkey (0, 23);
 | 
						|
  _sort->init();
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::crea_sort()
 | 
						|
{
 | 
						|
  long ditta, dittac, codan, codanc;
 | 
						|
  char tipoa, tipoac;
 | 
						|
  int nprog, nprogc, codc, mese, anno;
 | 
						|
  real corrisp, somme, impo, rite, netto, quote, perc, inps;
 | 
						|
  TDate datapag;
 | 
						|
 | 
						|
  dittac = codanc = 0l;
 | 
						|
  tipoac = '\0';
 | 
						|
  nprogc = -1;
 | 
						|
  
 | 
						|
  init_sort();
 | 
						|
  *_cur = 0l;
 | 
						|
  for (int i = 0; i < _cur->items(); i++, ++(*_cur))
 | 
						|
  {
 | 
						|
    _prog->addstatus(1);
 | 
						|
    ditta   = _cur->curr().get_long(PAG_CODDITTA);
 | 
						|
    tipoa   = _cur->curr().get(PAG_TIPOA)[0];
 | 
						|
    codan   = _cur->curr().get_long(PAG_CODANAGR);
 | 
						|
    nprog   = _cur->curr().get_int(PAG_NPROG);
 | 
						|
    datapag = _cur->curr().get(PAG_DATAPAG);
 | 
						|
    if (ditta == dittac && tipoa == tipoac && codan == codanc && nprog == nprogc)
 | 
						|
      continue;
 | 
						|
    const TRectype& dep = look_schperc(ditta, tipoa, codan, nprog);
 | 
						|
    mese = dep.get_int(SPR_MESEC);
 | 
						|
    anno = dep.get_int(SPR_ANNOC);
 | 
						|
    codc = dep.get_int(SPR_CODCAUS);
 | 
						|
    if ( anno != 0 )  //se c'e' l'anno c'e' di certo anche il mese (Omero)
 | 
						|
    {
 | 
						|
      if ( anno != _anno_dic || (mese < _mese_da || mese > _mese_a ) )
 | 
						|
      {
 | 
						|
        dittac = ditta;
 | 
						|
        tipoac = tipoa;
 | 
						|
        codanc = codan;
 | 
						|
        nprogc = nprog;
 | 
						|
        continue;
 | 
						|
      }
 | 
						|
    }  
 | 
						|
    else //anno non specificato
 | 
						|
       if ( datapag.year() != _anno_dic || (datapag.month() < _mese_da || mese > _mese_a) )
 | 
						|
       {  
 | 
						|
         //dittac = ditta;
 | 
						|
         //tipoac = tipoa;
 | 
						|
         //codanc = codan;
 | 
						|
         //nprogc = nprog;
 | 
						|
         continue;
 | 
						|
       }  
 | 
						|
    perc    = _cur->curr().get_real(PAG_PERC);
 | 
						|
    somme   = _cur->curr().get_real(PAG_SPESA);
 | 
						|
    corrisp = _cur->curr().get_real(PAG_COMPENSO);
 | 
						|
    rite    = _cur->curr().get_real(PAG_RITENUTA);
 | 
						|
    impo    = _cur->curr().get_real(PAG_IMPONIBILE);
 | 
						|
    netto   = _cur->curr().get_real(PAG_NETTO);
 | 
						|
    inps    = _cur->curr().get_real(PAG_INPSPERC);
 | 
						|
    quote   = corrisp-impo;
 | 
						|
    
 | 
						|
    riempi_record(ditta,tipoa,codan,perc,codc,corrisp,somme,quote,impo,rite,netto,inps); 
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::riempi_record(long d,char t,long ca,const real& p,int c, 
 | 
						|
                               const real& co,const real& so,
 | 
						|
                               const real& qu,const real& im,const real& ri,
 | 
						|
                               const real& ne, const real& inps)
 | 
						|
{
 | 
						|
  sprintf(_rig->ditta, "%5ld", d);
 | 
						|
  _rig->tipoa = t;
 | 
						|
  sprintf(_rig->codan, "%5ld", ca);
 | 
						|
  //sprintf(_rig->perc,  "%2d", p);
 | 
						|
  TString16 pp(p.string("###,@@"));
 | 
						|
  sprintf(_rig->perc, "%s", (const char*)pp);
 | 
						|
  sprintf(_rig->codc, "%02d", c);
 | 
						|
  _rig->corr  = co;
 | 
						|
  _rig->somme = so;
 | 
						|
  _rig->quote = qu;
 | 
						|
  _rig->impo  = im;
 | 
						|
  _rig->rite  = ri;
 | 
						|
  _rig->netto = ne;
 | 
						|
  _rig->inps  = inps;
 | 
						|
  
 | 
						|
  _sort->sort((const char*)_rig);
 | 
						|
}    
 | 
						|
 | 
						|
int TSt_certif::stampa_riga(int i, int ct, const char* d)
 | 
						|
{
 | 
						|
 if (!_st_modulo)
 | 
						|
 {
 | 
						|
  TString16 app (_perc_p.left(3)); //stampo solo la parte intera
 | 
						|
  app.ltrim();                                               
 | 
						|
  
 | 
						|
  real lordo_netto_iva = _tot_corr + _tot_somme;
 | 
						|
  real somme_quote = _tot_somme + _tot_quote;
 | 
						|
  
 | 
						|
  set_row(i,"%02d %4d %-.25s @34g%r@50g%r@66g%r",_codc_p,ct,d,&lordo_netto_iva,&somme_quote,&_tot_impo);
 | 
						|
  set_row(i++,"@83g%s@86g%r@101g%r@117g%r",(const char*)app,&_tot_rite,&_tot_inps,&_tot_netto);
 | 
						|
 }
 | 
						|
 else
 | 
						|
 {
 | 
						|
  real non_sogg  = _tot_corr - _tot_impo + _tot_somme;
 | 
						|
  real imp_netto = _tot_impo - _tot_rite /* - _tot_inps */;  
 | 
						|
  TString16 app (_perc_p.left(3));
 | 
						|
  app.ltrim();
 | 
						|
  set_row(i++, "@3g%4d@11g%-.28s@43g%12.0r@57g%12.0r@71g%12.0r@85g%s@89g%12.0r@104g%12.0r", 
 | 
						|
               ct,d,&_tot_corr,&non_sogg,&_tot_impo,(const char*)app,&_tot_rite,&imp_netto);
 | 
						|
  set_row(i, "");                
 | 
						|
 }   
 | 
						|
 return i;
 | 
						|
} 
 | 
						|
 | 
						|
// Totale su carta bianca
 | 
						|
void TSt_certif::stampa_totale(int i)
 | 
						|
{
 | 
						|
  TString dep(94);
 | 
						|
  dep.fill('-');
 | 
						|
  set_row(i++, "");
 | 
						|
  set_row(i++, "@38g%s", (const char*) dep);
 | 
						|
 | 
						|
  real lordo_netto_iva = _t_corr + _t_somme;
 | 
						|
  real somme_quote = _t_somme + _t_quote;
 | 
						|
 | 
						|
  set_row(i, "@15gTOTALE@34g%r@50g%r@66g%r@86g%r@101g%r@117g%r",
 | 
						|
             &lordo_netto_iva,&somme_quote,&_t_impo,&_t_rite,&_t_inps,&_t_netto);
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::salva_totale()
 | 
						|
{
 | 
						|
 //salvo gli importi del record che sto leggendo
 | 
						|
 _tot_corr += _corr;
 | 
						|
 _tot_somme+= _somme;
 | 
						|
 _tot_quote+= _quote;
 | 
						|
 _tot_impo += _impo;
 | 
						|
 _tot_rite += _rite;
 | 
						|
 _tot_netto+= _netto;
 | 
						|
 _tot_inps += _inps;
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::leggi_sort()
 | 
						|
{
 | 
						|
  int i = 1;
 | 
						|
  reset_print();
 | 
						|
  
 | 
						|
  //il concetto e' che quando sto stampando un record sto gia' leggendo i dati del record successivo!!!
 | 
						|
  if ((_buf = _sort->retrieve()) != NULL)
 | 
						|
  {
 | 
						|
    TString16 key1, key2;
 | 
						|
    struct righe_pag* rp = (struct righe_pag*)_buf;
 | 
						|
    long ditta = atol(rp->ditta);
 | 
						|
    _tipoa = rp->tipoa;           
 | 
						|
    _codanagPE = atol(rp->codan); 
 | 
						|
    
 | 
						|
    if (_key1p == "")
 | 
						|
    {
 | 
						|
     _tipoa_p = _tipoa;        
 | 
						|
     _codanagPE_p = _codanagPE;
 | 
						|
    }
 | 
						|
    
 | 
						|
    TString16 perc = rp->perc;
 | 
						|
    int  codc  = atoi(rp->codc);
 | 
						|
    _corr  = rp->corr;
 | 
						|
    _somme = rp->somme;
 | 
						|
    _quote = rp->quote;
 | 
						|
    _impo  = rp->impo;
 | 
						|
    _rite  = rp->rite;
 | 
						|
    _netto = rp->netto;
 | 
						|
    _inps  = rp->inps;
 | 
						|
    
 | 
						|
    key1.format("%c%5ld", _tipoa, _codanagPE);
 | 
						|
    key2.format("%s%02d", (const char*)perc, codc);
 | 
						|
    
 | 
						|
    if (key1 != _key1p && _key1p != "") //e' cambiato il percipiente
 | 
						|
    {
 | 
						|
      TRectype cau  = look_causali();
 | 
						|
      TString descr = cau.get("S0");
 | 
						|
      int codtrib   = cau.get_int("I0");
 | 
						|
      
 | 
						|
      i = stampa_riga(i, codtrib, descr);
 | 
						|
      
 | 
						|
      //aggiornamento totale finale
 | 
						|
      _t_corr  += _tot_corr;
 | 
						|
      _t_somme += _tot_somme;
 | 
						|
      _t_quote += _tot_quote;
 | 
						|
      _t_impo  += _tot_impo;
 | 
						|
      _t_rite  += _tot_rite;
 | 
						|
      _t_netto += _tot_netto;
 | 
						|
      _t_inps  += _tot_inps;
 | 
						|
 | 
						|
      if (!_st_modulo)
 | 
						|
      {
 | 
						|
        stampa_totale(i);
 | 
						|
        _tot_corr=_tot_somme=_tot_quote=_tot_impo=_tot_rite=_tot_netto=_tot_inps=ZERO; //sono i totali relativi ad ogni singola riga di stampa
 | 
						|
        _t_corr = _t_somme = _t_quote = _t_impo = _t_rite =_t_netto = _t_inps=ZERO;  //sono i totali finali (relativi cioe' al percipiente)
 | 
						|
      }
 | 
						|
      
 | 
						|
      //salvo gli importi del record che sto leggendo
 | 
						|
      //salva_totale();
 | 
						|
      
 | 
						|
      _settato_totale = TRUE;
 | 
						|
    }
 | 
						|
    else if (key2 != _key2p && _key2p != "")
 | 
						|
    {
 | 
						|
      TRectype cau = look_causali();
 | 
						|
      TString descr = cau.get("S0");
 | 
						|
      int codtrib   = cau.get_int("I0");
 | 
						|
 | 
						|
      stampa_riga(i, codtrib, descr);
 | 
						|
      
 | 
						|
      _t_corr  += _tot_corr;
 | 
						|
      _t_somme += _tot_somme;
 | 
						|
      _t_quote += _tot_quote;
 | 
						|
      _t_impo  += _tot_impo;
 | 
						|
      _t_rite  += _tot_rite;
 | 
						|
      _t_netto += _tot_netto;
 | 
						|
      _t_inps  += _tot_inps;
 | 
						|
      
 | 
						|
      _tot_corr=_tot_somme=_tot_quote=_tot_impo=_tot_rite=_tot_netto=_tot_inps=ZERO;
 | 
						|
      
 | 
						|
      if (_st_modulo)
 | 
						|
         _conta += 1;
 | 
						|
      
 | 
						|
      //salvo gli importi del record che sto leggendo
 | 
						|
      //spostato in postprocess_page
 | 
						|
      //salva_totale();
 | 
						|
    }
 | 
						|
    //else  //non e' cambiato il percipiente e non sono cambiate ne' la causale ne' la percentuale
 | 
						|
      //salva_totale();
 | 
						|
    
 | 
						|
    //spostato nella postprocess_page
 | 
						|
    /*  
 | 
						|
     _tipoa_p = _tipoa;         //serve alla preprocess_header
 | 
						|
     _codanagPE_p = _codanagPE; //idem
 | 
						|
    */    
 | 
						|
    _codc_p = codc;
 | 
						|
    _perc_p = perc;
 | 
						|
    _key1p  = key1,
 | 
						|
    _key2p  = key2;  
 | 
						|
    _stampa = TRUE;
 | 
						|
  }
 | 
						|
  else if (_stampa)  //sono finiti i record ma c'e' ancora un record da stampare
 | 
						|
  {
 | 
						|
    TRectype cau  = look_causali();
 | 
						|
    TString descr = cau.get("S0");
 | 
						|
    int codtrib   = cau.get_int("I0");
 | 
						|
    
 | 
						|
    /*
 | 
						|
    _tipoa_p = _tipoa;
 | 
						|
    _codanagPE_p = _codanagPE;
 | 
						|
    */
 | 
						|
    
 | 
						|
    stampa_riga(i, codtrib, descr);
 | 
						|
 | 
						|
    _t_corr  += _tot_corr;
 | 
						|
    _t_somme += _tot_somme;
 | 
						|
    _t_quote += _tot_quote;
 | 
						|
    _t_impo  += _tot_impo;
 | 
						|
    _t_rite  += _tot_rite;
 | 
						|
    _t_netto += _tot_netto;
 | 
						|
    _t_inps  += _tot_inps;
 | 
						|
    
 | 
						|
    if (!_st_modulo)
 | 
						|
      stampa_totale(i);
 | 
						|
    
 | 
						|
    _settato_totale = TRUE;        
 | 
						|
  } 
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::preprocess_footer()
 | 
						|
{
 | 
						|
  if (_st_modulo)
 | 
						|
  {
 | 
						|
   //riga totale
 | 
						|
   real t_non_sogg  = _t_corr - _t_impo + _t_somme; 
 | 
						|
   real t_imp_netto = _t_impo - _t_rite /* - _t_inps */;
 | 
						|
  
 | 
						|
   reset_footer();
 | 
						|
    
 | 
						|
   int r = 1; 
 | 
						|
 | 
						|
   TString tc, tns, ti, tr, tim;
 | 
						|
   tc  = _t_corr.string();
 | 
						|
   tns = t_non_sogg.string();
 | 
						|
   ti  = _t_impo.string();
 | 
						|
   tr  = _t_rite.string();
 | 
						|
   tim = t_imp_netto.string();
 | 
						|
   
 | 
						|
   _tot_corr=_tot_somme=_tot_quote=_tot_impo=_tot_rite=_tot_netto=_tot_inps=ZERO;
 | 
						|
   
 | 
						|
   if (_settato_totale)
 | 
						|
     _t_corr = _t_somme = _t_quote = _t_impo = _t_rite =_t_netto = _t_inps = ZERO;
 | 
						|
   
 | 
						|
   if (_settato_totale)
 | 
						|
     set_footer(r++, "@43g%12s@57g%12s@71g%12s@89g%12s@104g%12s", (const char*)tc,
 | 
						|
                     (const char*)tns,(const char*)ti,(const char*)tr,(const char*)tim);
 | 
						|
   else 
 | 
						|
     set_footer(r++, "@5gsegue...");
 | 
						|
   
 | 
						|
   set_footer(r++, "");
 | 
						|
   set_footer(r++, "");
 | 
						|
   set_footer(r++, "");
 | 
						|
   set_footer(r++, "");     
 | 
						|
   set_footer(r++, "");     
 | 
						|
   set_footer(r++, "");     
 | 
						|
   set_footer(r++, "");     
 | 
						|
   set_footer(r++, ""); 
 | 
						|
   set_footer(r++, "@3g%s",(const char*) _ragsocER);
 | 
						|
   set_footer(r++, ""); 
 | 
						|
   set_footer(r++, "@3g%s %s",(const char*) _indER, (const char*) _civER);
 | 
						|
   set_footer(r++, "");
 | 
						|
   set_footer(r++, "@3g%s     %s %s", (const char*) _capER, (const char*) _dencomER,
 | 
						|
                    (const char*) _provER);
 | 
						|
   set_footer(r++, "");
 | 
						|
   set_footer(r, "@3g%s", (const char*)_cofiER); 
 | 
						|
   r+=2;
 | 
						|
   if (_st_data)
 | 
						|
     set_footer(++r, "@16g%s", (const char*)_data); 
 | 
						|
  }
 | 
						|
  else if (_fai_footer)
 | 
						|
  {
 | 
						|
   reset_footer();
 | 
						|
   
 | 
						|
   TString dep(71);
 | 
						|
   dep.fill('-');
 | 
						|
   int r = 1;
 | 
						|
   
 | 
						|
   set_footer(r++, "LE CIFRE GLOBALI SU ESPOSTE CORRISPONDONO ALLE SINGOLE REGISTRAZIONI RISULTANTI NEL CONTO INDIVIDUALE DEL");
 | 
						|
   set_footer(r++, "PERCIPIENTE LE CUI RITENUTE D'ACCONTO SONO STATE VERSATE NEI TERMINI DI LEGGE.");   
 | 
						|
   set_footer(r++, "");
 | 
						|
   set_footer(r++, "@1g%s", (const char*) dep);
 | 
						|
   set_footer(r++, "!@5gDATI IDENTIFICATIVI DEL SOGGETTO EROGANTE O SOSTITUTO D'IMPOSTA@72g!");
 | 
						|
   set_footer(r  , "!@1g%s@72g!", (const char*) dep);
 | 
						|
   set_footer(r++, "@85gIn fede.");
 | 
						|
   set_footer(r++, "!@15g%s@72g!",(const char*) _ragsocER);
 | 
						|
   set_footer(r++, "! Indirizzo:@15g%s %s@72g!",(const char*) _indER, (const char*) _civER);
 | 
						|
   set_footer(r++, "!@6g%s@15g%s %s@72g!",(const char*) _capER, (const char*) _dencomER,
 | 
						|
                   (const char*) _provER);
 | 
						|
   set_footer(r,   "! Cod.Fiscale: %s@72g!", (const char*) _cofiER);                 
 | 
						|
   set_footer(r++, "@74g----------------------------------------");
 | 
						|
   set_footer(r,   "@1g%s", (const char*) dep);
 | 
						|
   set_footer(r,   "@90g(Firma)");                 
 | 
						|
   
 | 
						|
   _fai_footer = FALSE;
 | 
						|
  } 
 | 
						|
}
 | 
						|
 | 
						|
bool TSt_certif::preprocess_print(int file, int counter)
 | 
						|
{
 | 
						|
  _key1p = _key2p = ""; 
 | 
						|
  _tot_corr = _tot_somme = _tot_quote = _tot_impo = _tot_rite = _tot_netto = _tot_inps = ZERO;
 | 
						|
  _t_corr = _t_somme = _t_quote = _t_impo = _t_rite = _t_netto = _t_inps = ZERO;
 | 
						|
  _stampa = _settato_totale = _fai_footer = FALSE;
 | 
						|
  _conta = 0;
 | 
						|
   
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TSt_certif::preprocess_page(int file, int counter)
 | 
						|
{
 | 
						|
  leggi_sort(); 
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
print_action TSt_certif::postprocess_page(int file, int counter)
 | 
						|
{
 | 
						|
  //devo usare due flag diversi: _settato_totale mi dice se fare oppure no 
 | 
						|
  //un formfeed cosi' da richiamare la preprocess_footer() anche se il totale viene stampato 
 | 
						|
  //prima dell'area del footer. Se pero' sto stampando proprio il totale nell'area del footer
 | 
						|
  //viene richiamata la preprocess_footer() che a questo punto deve essere eseguita solo se e' vero il 
 | 
						|
  //flag _fai_footer. Infatti se controllassi il flag _settato_totale esso sarebbe vero in questo caso
 | 
						|
  //e il risultato sarebbe quello di vedere stampato il footer e a pagina vuota il totale del percipiente
 | 
						|
  //e cio' non sarebbe corretto!
 | 
						|
  if (_settato_totale) 
 | 
						|
    if (!_st_modulo)
 | 
						|
    {
 | 
						|
     _intesta = TRUE;
 | 
						|
     _fai_footer = TRUE;
 | 
						|
     _tipoa_p = _tipoa;         //serve alla preprocess_header
 | 
						|
     _codanagPE_p = _codanagPE; //idem
 | 
						|
     printer().formfeed();
 | 
						|
     _settato_totale = FALSE;
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
     _tipoa_p = _tipoa;         //serve alla preprocess_header
 | 
						|
     _codanagPE_p = _codanagPE; //idem
 | 
						|
     _conta = 0;
 | 
						|
     printer().formfeed();
 | 
						|
     _settato_totale = FALSE;
 | 
						|
    }
 | 
						|
  
 | 
						|
  if (_st_modulo && _conta == 8) 
 | 
						|
  {
 | 
						|
    _conta = 0;
 | 
						|
    printer().formfeed();
 | 
						|
  }
 | 
						|
     
 | 
						|
  if (_buf == NULL)
 | 
						|
    return NEXT_PAGE;
 | 
						|
  
 | 
						|
  salva_totale();
 | 
						|
  
 | 
						|
  return REPEAT_PAGE;   
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::postclose_print()
 | 
						|
{
 | 
						|
  delete _sort;
 | 
						|
}
 | 
						|
                                         
 | 
						|
bool TSt_certif::init_print()
 | 
						|
{
 | 
						|
  TMask msk ("772200a");
 | 
						|
  KEY tasto;
 | 
						|
  TLocalisamfile& fl = _cur->file(LF_RPAG);
 | 
						|
  
 | 
						|
  msk.set_handler (F_A, mese_handler);
 | 
						|
  msk.set_handler (F_CODDITTA, codditta_hnd);
 | 
						|
  
 | 
						|
  // precarica campi maschera con valori di default
 | 
						|
  _nditte->setkey(1);
 | 
						|
  _nditte->zero();
 | 
						|
  _nditte->put(NDT_CODDITTA, get_firm_770());
 | 
						|
  if (_nditte->read() == NOERR)
 | 
						|
  {
 | 
						|
    // precarico luogo 
 | 
						|
    TToken_string address = get_anag_address(_nditte->get_char(NDT_TIPOA),    
 | 
						|
                                             _nditte->get_long(NDT_CODANAGR));
 | 
						|
    msk.set(F_LUOGO, address.get(0));                                        
 | 
						|
  }           
 | 
						|
  
 | 
						|
  // precarico numero attestazione
 | 
						|
  msk.set(F_ATTESTA,1);
 | 
						|
  
 | 
						|
  // esecuzione maschera
 | 
						|
  tasto = msk.run();
 | 
						|
 | 
						|
  if (tasto == K_ENTER)
 | 
						|
  {
 | 
						|
    char tipoa_da = msk.get(F_TIPODA)[0];
 | 
						|
    long cod_da   = msk.get_long(F_CODDA);
 | 
						|
    char tipoa_a  = msk.get(F_TIPOA)[0];
 | 
						|
    long cod_a    = msk.get_long(F_CODA);   
 | 
						|
    long codditta = get_firm_770();
 | 
						|
 | 
						|
    _num_att   = msk.get_long(F_ATTESTA);
 | 
						|
    _mese_da   = msk.get_int(F_DA);
 | 
						|
    _mese_a    = msk.get_int(F_A);
 | 
						|
    _luogo     = msk.get(F_LUOGO);
 | 
						|
    _data      = msk.get(F_DATA);
 | 
						|
    _st_modulo = msk.get_bool(F_MODULO);
 | 
						|
    
 | 
						|
    _off_lung = msk.get_int(F_LUNG);  
 | 
						|
        
 | 
						|
    TRectype da (fl.curr());
 | 
						|
    TRectype a  (fl.curr());  
 | 
						|
 | 
						|
    da.zero();
 | 
						|
    a.zero();
 | 
						|
     
 | 
						|
    da.put(PAG_CODDITTA, codditta);        
 | 
						|
    da.put(PAG_TIPOA,    tipoa_da);
 | 
						|
    da.put(PAG_CODANAGR, cod_da);
 | 
						|
 | 
						|
    a.put(PAG_CODDITTA,  codditta);        
 | 
						|
    a.put(PAG_TIPOA,     tipoa_a);
 | 
						|
    a.put(PAG_CODANAGR,  cod_a);
 | 
						|
 | 
						|
    _cur->setregion(da, a);
 | 
						|
    
 | 
						|
    _intesta = TRUE; 
 | 
						|
    dati_erogante();
 | 
						|
    if (!_st_modulo) 
 | 
						|
    {
 | 
						|
      set_real_picture ("###.###.###.###");
 | 
						|
      printer().footerlen(11); 
 | 
						|
      for (int i=1; i<=11; i++) set_footer(i, "%s", " ");
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      /*
 | 
						|
      printer().footerlen(22); 
 | 
						|
      for (int i=1; i<=22; i++) set_footer(i, "%s", " "); 
 | 
						|
      */
 | 
						|
      int area_footer = 31 - _off_lung;
 | 
						|
      printer().footerlen(area_footer); 
 | 
						|
      for (int i=1; i<=area_footer; i++) set_footer(i, "%s", " ");
 | 
						|
    } 
 | 
						|
    
 | 
						|
    set_print_zero(FALSE); 
 | 
						|
    
 | 
						|
    _prog = new TProgind(_cur->items(),"Elaborazione in corso... prego attendere",FALSE);
 | 
						|
    
 | 
						|
    crea_sort();
 | 
						|
    _sort->endsort();
 | 
						|
    
 | 
						|
    delete _rig;
 | 
						|
    delete _prog;  
 | 
						|
    
 | 
						|
    return TRUE;
 | 
						|
  }
 | 
						|
  else
 | 
						|
    return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
bool TSt_certif::set_print(int)
 | 
						|
{
 | 
						|
  long  codditta, codditta_prec;
 | 
						|
  int   i = 0;
 | 
						|
 | 
						|
  if (_liv == 'S')
 | 
						|
  {
 | 
						|
    codditta_prec = get_firm_770();
 | 
						|
    while ((codditta = _cnf->get_long(DITTE_SEL, _section, i++)) != 0L) 
 | 
						|
    {
 | 
						|
      set_firm_770(codditta);
 | 
						|
 | 
						|
// init_print ritorna TRUE solo se K_ENTER      
 | 
						|
      if (init_print())
 | 
						|
        print();
 | 
						|
      else break;
 | 
						|
    }  
 | 
						|
    set_firm_770(codditta_prec);
 | 
						|
// Non richiamare di nuovo print()!    
 | 
						|
    return FALSE;
 | 
						|
  }
 | 
						|
  else
 | 
						|
    return init_print();
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::stampa_su_modulo()
 | 
						|
{
 | 
						|
  dati_percipiente(); 
 | 
						|
  //in origine _off_lung era fisso (=3)
 | 
						|
  //in origine _off_larg era fisso (=3)
 | 
						|
  /*
 | 
						|
  set_header(3, "@26g%s", (const char*)_ragsocPE);
 | 
						|
  set_header(4, "@8g%4d", _anno_dic);
 | 
						|
  */
 | 
						|
  set_header(_off_lung, "@26g%s", (const char*)_ragsocPE);
 | 
						|
  set_header(_off_lung + 1, "@8g%4d", _anno_dic);
 | 
						|
  if (_tipoa_p == 'F') 
 | 
						|
  {
 | 
						|
    set_header(_off_lung + 2, "@26g%-.50s %s %s",(const char*)_dencomnscPE,
 | 
						|
                              (const char*)_provnscPE,(const char*)_datanascPE);
 | 
						|
    set_header(_off_lung + 6, "@26g%-.35s", (const char*)_dencomPE); 
 | 
						|
  }  
 | 
						|
  set_header(_off_lung + 6, "@8g%ld", _num_att++); 
 | 
						|
  set_header(_off_lung + 4, "@26g%16s", (const char*)_cofiPE);
 | 
						|
  set_header(_off_lung + 8, "@26g%-.35s %s %5s %-.35s %s", (const char*)_indPE, 
 | 
						|
            (const char*)_civPE,(const char*)_capPE,(const char*)_dencomPE,(const char*)_provPE);
 | 
						|
  /*
 | 
						|
  for (int i = 12; i <= 25; i++)
 | 
						|
     set_header(i, "");              
 | 
						|
  */ 
 | 
						|
  int app = _off_lung + 6;
 | 
						|
  for (int i = app; i <= app + 12; i++)
 | 
						|
     set_header(i, "");              
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::preprocess_header()
 | 
						|
{ 
 | 
						|
  int i = 1;
 | 
						|
  
 | 
						|
  reset_header();
 | 
						|
  
 | 
						|
  if (_st_modulo)
 | 
						|
  {
 | 
						|
    stampa_su_modulo();
 | 
						|
    return;
 | 
						|
  }   
 | 
						|
  
 | 
						|
  if (_intesta)
 | 
						|
  { 
 | 
						|
   TString dep(73); 
 | 
						|
   dep.fill('-');
 | 
						|
   dati_percipiente();
 | 
						|
   set_header(i++, "@1g---------------------------------------------------");
 | 
						|
   set_header(i++, "!@12gCERTIFICAZIONE DEI COMPENSI@52g!");
 | 
						|
   set_header(i++, "!@9gASSOGGETTATI A RITENUTA D'ACCONTO@52g!");
 | 
						|
   set_header(i++, "!@3g(Art. 7 bis D.P.R. 29 Settembre 1973, n.600)@52g!");
 | 
						|
   set_header(i++, "@1g---------------------------------------------------");
 | 
						|
   set_header(i++, "");
 | 
						|
   set_header(i++, "@59g%s", (const char*) dep);
 | 
						|
   set_header(i++, "@58g!@84gSOGGETTO PERCIPIENTE@132g!");
 | 
						|
   set_header(i++, "@58g!%s@132g!", (const char*) dep);
 | 
						|
   set_header(i,   "@29gATTESTAZIONE RILASCIATA A:@58g!");
 | 
						|
   if (_tipoa_p == 'F')
 | 
						|
     set_header(i, "@60gCognome e Nome:");
 | 
						|
   else
 | 
						|
     set_header(i, "@60gDenominazione:");
 | 
						|
   set_header(i++, " %s@132g!", (const char*)_ragsocPE );
 | 
						|
   set_header(i++, "@58g!@60gDomicilio in    %s %s@132g!", (const char*)_indPE,(const char*)_civPE);
 | 
						|
   set_header(i++, "@58g!@70g%5s %-.46s %s@132g!", (const char*)_capPE,(const char*)_dencomPE,(const char*)_provPE);
 | 
						|
   if (_tipoa_p == 'F')
 | 
						|
   {
 | 
						|
     set_header(i++, "@58g!@60gLuogo e data di nascita: %-.30s %s %s@132g!", (const char*)_dencomnscPE, 
 | 
						|
                     (const char*)_provnscPE,(const char*)_datanascPE);
 | 
						|
     set_header(i,   "ANNO EROGAZIONE     ATTESTAZIONE@58g!@132g!");
 | 
						|
     set_header(i++, "@60gComune di iscrizione anagrafica: %-.35s", (const char*)_dencomPE); 
 | 
						|
   }
 | 
						|
   else
 | 
						|
   {
 | 
						|
    set_header(i++, "@58g!@132g!");
 | 
						|
    set_header(i++, "ANNO EROGAZIONE     ATTESTAZIONE@58g!@132g!");
 | 
						|
   }
 | 
						|
   set_header(i++, "@5g%d@25g%ld@58g!@60gCodice fiscale: %16s@132g!", _anno_dic,_num_att++,(const char*)_cofiPE); 
 | 
						|
   set_header(i++, "@59g%s", (const char*) dep);
 | 
						|
   set_header(i++, "");
 | 
						|
   set_header(i++, "@50g%s,li %d %s %d", (const char*)_luogo, _data.day(), itom(_data.month()), _data.year());
 | 
						|
   set_header(i++, "");
 | 
						|
   set_header(i++, "@7gPer gli adempimenti previsti dall'art.7 bis del D.P.R. 29 Settembre 1973,n. 600 e successive modificazioni");
 | 
						|
   set_header(i++, "si attesta che nel corso del periodo dal 01/01/%d al 31/12/%d al percipiente evidenziato in riquadro", _anno_dic, _anno_dic);
 | 
						|
   set_header(i++, "sono stati corrisposti i seguenti compensi debitamente assoggettati a ritenuta d'acconto e ad eventuale ritenuta previdenziale:");
 | 
						|
   set_header(i++, "");
 | 
						|
   _intesta = FALSE;  
 | 
						|
  }
 | 
						|
  TString sep(132); 
 | 
						|
  sep.fill('-');
 | 
						|
  set_header(i++, (const char*)sep);
 | 
						|
  set_header(i++, "Codice@36gTotale lordo@53gSomme e Quote@90gRitenute@108gRitenute");
 | 
						|
  set_header(i++, "Cs Trib Descrizione@36gal netto IVA@53gNon soggette@69gImponibile@83gAl@90gFiscali@108gPrevidenz.@123gNet.corr.");
 | 
						|
  set_header(i, (const char*)sep);
 | 
						|
}   
 | 
						|
 | 
						|
void TSt_certif::dati_erogante()
 | 
						|
{ 
 | 
						|
  long    codditta;
 | 
						|
  char    tipoa;
 | 
						|
  TString com,comnasc;           
 | 
						|
  TDate   data;
 | 
						|
       
 | 
						|
  codditta = get_firm_770();
 | 
						|
                 
 | 
						|
  _nditte->setkey(1);
 | 
						|
  _nditte->curr().zero();
 | 
						|
  _nditte->curr().put(NDT_CODDITTA, codditta);
 | 
						|
  if (_nditte->read() == NOERR)
 | 
						|
  {
 | 
						|
    tipoa      = _nditte->get_char(NDT_TIPOA);
 | 
						|
    _codanagER = _nditte->get_long(NDT_CODANAGR);
 | 
						|
  }
 | 
						|
  _anag->setkey(1);
 | 
						|
  _anag->zero();
 | 
						|
  _anag->put(ANA_TIPOA,    tipoa);
 | 
						|
  _anag->put(ANA_CODANAGR, _codanagER);
 | 
						|
  if (_anag->read() == NOERR)
 | 
						|
  {  
 | 
						|
    _ragsocER = _anag->get(ANA_RAGSOC);
 | 
						|
    _cofiER   = _anag->get(ANA_COFI);
 | 
						|
    
 | 
						|
    if (tipoa == 'F')
 | 
						|
    {
 | 
						|
      TString80 nome = _ragsocER.mid(30);
 | 
						|
      _ragsocER.cut(30);
 | 
						|
      _ragsocER.trim(); nome.trim();
 | 
						|
      _ragsocER << ' ' << nome;
 | 
						|
    }
 | 
						|
    
 | 
						|
    com = _anag->get(ANA_COMRF);
 | 
						|
    
 | 
						|
    if (com != "")
 | 
						|
    {
 | 
						|
      _indER = _anag->get(ANA_INDRF);
 | 
						|
      _civER = _anag->get(ANA_CIVRF);
 | 
						|
      _capER = _anag->get(ANA_CAPRF);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      _indER = _anag->get(ANA_INDRES);
 | 
						|
      _civER = _anag->get(ANA_CIVRES);
 | 
						|
      _capER = _anag->get(ANA_CAPRES);
 | 
						|
      com    = _anag->get(ANA_COMRES);
 | 
						|
    }
 | 
						|
  }
 | 
						|
  _comuni->setkey(1);
 | 
						|
  _comuni->zero();
 | 
						|
  _comuni->put(COM_COM,com);
 | 
						|
  if (_comuni->read() == NOERR)
 | 
						|
  {
 | 
						|
    _dencomER = _comuni->get(COM_DENCOM);
 | 
						|
    _provER   = _comuni->get(COM_PROVCOM);
 | 
						|
  }
 | 
						|
  
 | 
						|
  /* dati riguardanti il luogo e la data di nascita
 | 
						|
  if (tipoa == 'F')
 | 
						|
  {
 | 
						|
    TLocalisamfile anagfis(LF_ANAGFIS);
 | 
						|
    
 | 
						|
    anagfis.setkey(1);
 | 
						|
    anagfis.zero();
 | 
						|
    anagfis.put(ANF_CODANAGR, _codanagER);
 | 
						|
    if (anagfis.read() == NOERR)
 | 
						|
    {
 | 
						|
      data = anagfis.get_date(ANF_DATANASC);
 | 
						|
      _datanascER = data.string();
 | 
						|
      comnasc   = anagfis.get     (ANF_COMNASC);
 | 
						|
    }
 | 
						|
    
 | 
						|
    _comuni->setkey(1);
 | 
						|
    _comuni->zero();
 | 
						|
    _comuni->put(COM_COM,comnasc);
 | 
						|
    if (_comuni->read() == NOERR)
 | 
						|
    {
 | 
						|
      _dencomnscER = _comuni->get(COM_DENCOM);
 | 
						|
      _provnscER   = _comuni->get(COM_PROVCOM);
 | 
						|
    }               
 | 
						|
    _dencomnscER.rtrim();
 | 
						|
    _provnscER.rtrim();
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    _dencomnscER = "";
 | 
						|
    _provnscER   = "";
 | 
						|
  }
 | 
						|
  _indER.rtrim();
 | 
						|
  _dencomER.rtrim();   
 | 
						|
  */
 | 
						|
}
 | 
						|
 | 
						|
void TSt_certif::dati_percipiente()
 | 
						|
{ 
 | 
						|
  TString com; 
 | 
						|
  TDate   data;  
 | 
						|
  TString comnasc;
 | 
						|
                 
 | 
						|
  _anag->setkey(1);
 | 
						|
  _anag->zero();
 | 
						|
  _anag->put(ANA_TIPOA, _tipoa_p);
 | 
						|
  _anag->put(ANA_CODANAGR, _codanagPE_p);
 | 
						|
  if (_anag->read() == NOERR)
 | 
						|
  {  
 | 
						|
    _ragsocPE = _anag->get(ANA_RAGSOC);
 | 
						|
    _cofiPE   = _anag->get(ANA_COFI);
 | 
						|
    if (_tipoa_p == 'F')
 | 
						|
    {
 | 
						|
      TString80 nome = _ragsocPE.mid(30);
 | 
						|
      _ragsocPE.cut(30);
 | 
						|
      _ragsocPE.trim(); nome.trim();
 | 
						|
      _ragsocPE << ' ' << nome;
 | 
						|
    }
 | 
						|
    com = _anag->get(ANA_COMRF);
 | 
						|
    if (com != "")
 | 
						|
    {
 | 
						|
      _indPE = _anag->get(ANA_INDRF);
 | 
						|
      _civPE = _anag->get(ANA_CIVRF);
 | 
						|
      _capPE = _anag->get(ANA_CAPRF);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      _indPE = _anag->get(ANA_INDRES);
 | 
						|
      _civPE = _anag->get(ANA_CIVRES);
 | 
						|
      _capPE = _anag->get(ANA_CAPRES);
 | 
						|
      com    = _anag->get(ANA_COMRES);
 | 
						|
    }
 | 
						|
  }
 | 
						|
  _comuni->setkey(1);
 | 
						|
  _comuni->zero();
 | 
						|
  _comuni->put(COM_COM,com);
 | 
						|
  if (_comuni->read() == NOERR)
 | 
						|
  {
 | 
						|
    _dencomPE = _comuni->get(COM_DENCOM);
 | 
						|
    _provPE   = _comuni->get(COM_PROVCOM);
 | 
						|
  }
 | 
						|
  if (_tipoa_p == 'F')
 | 
						|
  {
 | 
						|
    TLocalisamfile anagfis(LF_ANAGFIS);
 | 
						|
    anagfis.setkey(1);
 | 
						|
    anagfis.zero();
 | 
						|
    anagfis.put(ANF_CODANAGR, _codanagPE_p);
 | 
						|
    if (anagfis.read() == NOERR)
 | 
						|
    {
 | 
						|
      data = anagfis.get_date(ANF_DATANASC);
 | 
						|
      _datanascPE = data.string();
 | 
						|
      comnasc   = anagfis.get(ANF_COMNASC);
 | 
						|
    }
 | 
						|
    _comuni->setkey(1);
 | 
						|
    _comuni->zero();
 | 
						|
    _comuni->put(COM_COM,comnasc);
 | 
						|
    if (_comuni->read() == NOERR)
 | 
						|
    {
 | 
						|
      _dencomnscPE = _comuni->get(COM_DENCOM);
 | 
						|
      _provnscPE   = _comuni->get(COM_PROVCOM);
 | 
						|
    }                  
 | 
						|
    _dencomnscPE.rtrim();
 | 
						|
    _provnscPE.rtrim();
 | 
						|
  }
 | 
						|
  else
 | 
						|
  {
 | 
						|
    _dencomnscPE = "";
 | 
						|
    _provnscPE   = "";
 | 
						|
  }              
 | 
						|
  _indPE.rtrim();
 | 
						|
  _dencomPE.rtrim();
 | 
						|
}
 | 
						|
 | 
						|
bool TSt_certif::user_create()
 | 
						|
{
 | 
						|
  // Parametri configurazione
 | 
						|
  _section = name(); 
 | 
						|
  _section.cut(2); 
 | 
						|
  _cnf = new TConfig(CONFIG_USER, _section);
 | 
						|
  _cns = new TConfig(CONFIG_USER, "77ps");
 | 
						|
  
 | 
						|
  _rel = new TRelation (LF_RPAG);
 | 
						|
  _cur = new TCursor(_rel,"",1);
 | 
						|
 | 
						|
  _nditte = new TLocalisamfile (LF_NDITTE);
 | 
						|
  _comuni = new TLocalisamfile (LF_COMUNI);
 | 
						|
  _anag   = new TLocalisamfile (LF_ANAG);
 | 
						|
  _rpag   = new TLocalisamfile (LF_RPAG);
 | 
						|
  _scperc = new TLocalisamfile (LF_SCPERC);
 | 
						|
  _ca7    = new TTable ("%CA7");
 | 
						|
  _rig    = new righe_pag;
 | 
						|
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TSt_certif::user_destroy()
 | 
						|
{
 | 
						|
  delete _rel;   
 | 
						|
  delete _cur;
 | 
						|
  delete _nditte;
 | 
						|
  delete _anag;
 | 
						|
  delete _comuni;
 | 
						|
  delete _rpag;
 | 
						|
  delete _scperc;
 | 
						|
  delete _ca7;
 | 
						|
  delete _rig;
 | 
						|
  delete _cnf;
 | 
						|
  delete _cns;
 | 
						|
                                        
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
int m72200(int argc, char* argv[])
 | 
						|
{
 | 
						|
  TSt_certif a(*argv[2]);
 | 
						|
  a.run(argc, argv, "Stampa certificazioni");
 | 
						|
  return 0;
 | 
						|
}
 |