Files correlati : ve6.exe Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 979 git-svn-id: svn://10.65.10.50/trunk@15623 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			245 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			245 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <automask.h>
 | |
| #include <filetext.h>
 | |
| #include <progind.h>
 | |
| 
 | |
| #include "at9.h"
 | |
| #include "at9200a.h"
 | |
| 
 | |
| #include "soggetti.h"
 | |
| #include "donaz.h"
 | |
| #include "contsan.h"
 | |
| #include "idoneita.h"
 | |
| #include "benem.h"
 | |
| #include "storico.h"
 | |
| #include "famiglie.h"
 | |
| 
 | |
| class TCom2prov_mask : public TAutomask
 | |
| {
 | |
| protected:
 | |
|   bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | |
| public:
 | |
| 
 | |
|   TCom2prov_mask();
 | |
|   
 | |
|   virtual ~TCom2prov_mask(){};
 | |
| };
 | |
|   
 | |
| TCom2prov_mask::TCom2prov_mask() :TAutomask ("at9200a")
 | |
| {
 | |
| }  
 | |
|   
 | |
| class TCom2prov: public TSkeleton_application
 | |
| {
 | |
|   TCom2prov_mask* _msk;
 | |
| 	TRelation*   		_rel;
 | |
| 	TConfig* 				_configfile;
 | |
|   
 | |
| protected:
 | |
|   virtual bool create(void);
 | |
|   virtual void main_loop();
 | |
|   virtual bool destroy(void) ;
 | |
|   void transfer();
 | |
| 
 | |
| public:
 | |
|   TCom2prov() {}
 | |
|   virtual ~TCom2prov() {}
 | |
|   TConfig& get_config() { return *_configfile;}
 | |
| };
 | |
| 
 | |
| // restituisce un riferimento all' applicazione
 | |
| inline TCom2prov& app() { return (TCom2prov&) main_app();}
 | |
| 
 | |
| // creazione dell'applicazione
 | |
| bool TCom2prov::create()
 | |
| {                    
 | |
|   _msk = new TCom2prov_mask();
 | |
| 	_configfile = new TConfig("at9200a.ini");
 | |
|   return TSkeleton_application::create();
 | |
| }
 | |
| 
 | |
| // distruzione dell'applicazione
 | |
| bool TCom2prov::destroy()
 | |
| {                      
 | |
| 	delete _configfile;
 | |
|   delete _msk;
 | |
|   return TSkeleton_application::destroy();
 | |
| }
 | |
| 
 | |
| bool TCom2prov_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
 | |
| { 
 | |
|   switch (f.dlg())
 | |
|   {
 | |
|   case F_SEZINI:
 | |
|     if (e == fe_modify)
 | |
|     {                                      
 | |
|     	TString16 sezini = get(F_SEZINI);
 | |
| 		  TString80 percorso = app().get_config().get("PERCORSO", "ARCHIVIO");
 | |
|     	if (percorso.find(sezini) == -1)
 | |
|     	{
 | |
|     		TConfig configditta(CONFIG_DITTA);
 | |
| 		  	set(F_DATA, configditta.get(sezini, "AT"));
 | |
| 		  	percorso << sezini;
 | |
| 		  	percorso << '\\';
 | |
| 		  	set(F_PERCORSO, percorso);
 | |
| 		  }	
 | |
|     }
 | |
|     break;
 | |
|   default:
 | |
|     break;
 | |
|   }
 | |
|   return true;
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| void TCom2prov::main_loop()
 | |
| {                       
 | |
|   if (_msk->run() == K_ENTER)
 | |
|     transfer();
 | |
| }
 | |
| 
 | |
| // trasferimento dati da file CT su programma avis
 | |
| void TCom2prov::transfer()
 | |
| {                                       
 | |
| 	bool anagrafica = _msk->get_bool(F_ANAGRAFICA);
 | |
| 	const bool donazioni = _msk->get_bool(F_DONAZIONI);
 | |
| 	const bool controlli = _msk->get_bool(F_CONTROLLI);
 | |
| 	const bool benemerenze = _msk->get_bool(F_BENEMERENZE);
 | |
| 	const bool storico = _msk->get_bool(F_STORICO);
 | |
| 	const bool famiglie = _msk->get_bool(F_FAMIGLIE);
 | |
| 	TString80 percorso = _msk->get(F_PERCORSO);
 | |
| 	percorso.insert("%");
 | |
| 	TString80 nomesog = percorso;
 | |
| 	nomesog << "SOGGETTI";
 | |
| 	TString80 nomedon = percorso;
 | |
| 	nomedon << "DONAZ";
 | |
| 	TString80 nomecon = percorso;
 | |
| 	nomecon << "CONTSAN";
 | |
| 	TString80 nomeido = percorso;
 | |
| 	nomeido << "IDONEITA";
 | |
| 	TString80 nomeben = percorso;
 | |
| 	nomeben << "BENEM";
 | |
| 	TString80 nomesto = percorso;
 | |
| 	nomesto << "STORICO";
 | |
| 	TString80 nomefam = percorso;
 | |
| 	nomefam << "FAMIGLIE";
 | |
| 	
 | |
|   TIsamtempfile filecon(LF_CONTSAN, (const char*) nomecon);
 | |
|   TIsamtempfile filesog(LF_SOGGETTI, (const char *) nomesog);
 | |
|   TIsamtempfile filedon(LF_DONAZ, (const char* ) nomedon);
 | |
|   TIsamtempfile fileido(LF_IDONEITA, (const char*) nomeido);
 | |
|   TIsamtempfile fileben(LF_BENEM, (const char*) nomeben);
 | |
|   TIsamtempfile filesto(LF_STORICO, (const char*) nomesto);
 | |
|   TIsamtempfile filefam(LF_FAMIGLIE, (const char*) nomefam);
 | |
| 	_rel = new TRelation(LF_SOGGETTI);
 | |
| 	if (donazioni)
 | |
| 		_rel->add(LF_DONAZ, "CODICE==CODICE");
 | |
| 	if (controlli)                            
 | |
| 	{
 | |
| 		_rel->add(LF_CONTSAN, "CODICE==CODICE");
 | |
| 		_rel->add(LF_IDONEITA, "CODICE==CODICE");
 | |
| 	}	
 | |
| 	if (benemerenze)
 | |
| 		_rel->add(LF_BENEM, "CODICE==CODICE");
 | |
| 	if (storico)
 | |
| 		_rel->add(LF_STORICO, "CODICE==CODICE");
 | |
| 	if (famiglie)
 | |
| 		_rel->add(LF_FAMIGLIE, "CODFAM==CODICE");
 | |
| 	anagrafica = (anagrafica || donazioni || controlli ||	benemerenze || storico || famiglie);
 | |
| 	TRectype da(LF_SOGGETTI);
 | |
| 	da.zero();
 | |
| 	const TString16 codsez  = _msk->get(F_SEZINI);
 | |
| 	const TString16 codsot  = _msk->get(F_SOTINI);
 | |
| 	if (codsez.not_empty())
 | |
| 		da.put(SOG_CODSEZ, codsez);
 | |
| 	if (codsot.not_empty())
 | |
| 		da.put(SOG_CODSOT, codsot);
 | |
| 	
 | |
| 	TString80 filtro = "";
 | |
| 	const TDate data = _msk->get_date(F_DATA);
 | |
| 	if (data.ok())
 | |
| 		filtro << "(ANSI(" << SOG_DATAULTAGG << ")>=\"" << data.string(ANSI) << "\")";
 | |
| 	TCursor cursore(_rel, filtro, 3, &da, &da);
 | |
| 	long records = cursore.items();
 | |
|  	TProgind pi(records,"Estrazione dati", true, true);
 | |
|  	pi.setstatus(1);
 | |
|   for (cursore = 0; cursore.pos() < records; ++(cursore))
 | |
|  	{
 | |
|   	const long codsog = cursore.curr().get_long(SOG_CODICE);
 | |
|   	pi.addstatus(1);
 | |
|    	if (pi.iscancelled()) break;
 | |
|  		if (anagrafica)
 | |
|  			filesog.write(cursore.curr());	
 | |
|  		if (donazioni)
 | |
|  		{      
 | |
|  			bool continua = true;
 | |
|  			while (continua)
 | |
|  			{                                                   
 | |
|  				const long codice = cursore.curr(LF_DONAZ).get_long(DON_CODICE);
 | |
|  				if (codice == codsog)
 | |
|  					filedon.write(cursore.curr(LF_DONAZ));
 | |
| 		  	continua = cursore.next_match(LF_DONAZ, "CODICE");
 | |
|  			}	
 | |
|  		}
 | |
|  		if (controlli)
 | |
|  		{      
 | |
|  			bool continua = true;
 | |
|  			while (continua)
 | |
|  			{                                                   
 | |
|  				const long codice = cursore.curr(LF_CONTSAN).get_long(CON_CODICE);
 | |
|  				if (codice == codsog)
 | |
|  					filecon.write(cursore.curr(LF_CONTSAN));
 | |
| 		  	continua = cursore.next_match(LF_CONTSAN, "CODICE");
 | |
|  			}	
 | |
|  			continua = true;
 | |
|  			while (continua)
 | |
|  			{                                                   
 | |
|  				const long codice = cursore.curr(LF_IDONEITA).get_long(IDO_CODICE);
 | |
|  				if (codice == codsog)
 | |
|  					fileido.write(cursore.curr(LF_IDONEITA));
 | |
| 		  	continua = cursore.next_match(LF_IDONEITA, "CODICE");
 | |
|  			}	
 | |
|  		}
 | |
|  		if (benemerenze)
 | |
|  		{      
 | |
|  			bool continua = true;
 | |
|  			while (continua)
 | |
|  			{                                                   
 | |
|  				const long codice = cursore.curr(LF_BENEM).get_long(BEN_CODICE);
 | |
|  				if (codice == codsog)
 | |
|  					fileben.write(cursore.curr(LF_BENEM));
 | |
| 		  	continua = cursore.next_match(LF_BENEM, "CODICE");
 | |
|  			}	
 | |
|  		}
 | |
|  		if (storico)
 | |
|  		{      
 | |
|  			bool continua = true;
 | |
|  			while (continua)
 | |
|  			{                                                   
 | |
|  				const long codice = cursore.curr(LF_STORICO).get_long(STO_CODICE);
 | |
|  				if (codice == codsog)
 | |
|  					filesto.write(cursore.curr(LF_STORICO));
 | |
| 		  	continua = cursore.next_match(LF_STORICO, "CODICE");
 | |
|  			}	
 | |
|  		}
 | |
|  		if (famiglie)
 | |
|  		{      
 | |
| 			const long codice = cursore.curr(LF_FAMIGLIE).get_long(FAM_CODFAM);
 | |
|  			if (codice == codsog)
 | |
|  				filefam.write(cursore.curr(LF_FAMIGLIE));
 | |
|  		}
 | |
|  	}
 | |
| 	TDate oggi(TODAY);
 | |
| 	TConfig configditta(CONFIG_DITTA);
 | |
| 	configditta.set(_msk->get(F_SEZINI), oggi, "AT");
 | |
|  	
 | |
| }
 | |
| 
 | |
| int at9200(int argc, char* argv[])
 | |
| {
 | |
|   TCom2prov a;
 | |
|   a.run(argc, argv, "Estrazione archivi per aggiornamento");
 | |
|   return 0;
 | |
| }
 |