Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 873 git-svn-id: svn://10.65.10.50/trunk@15151 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			214 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			214 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <mask.h>
 | |
| #include <progind.h>
 | |
| #include <relation.h>
 | |
| #include <tabutil.h>
 | |
| #include <urldefid.h>
 | |
| 
 | |
| #include "at8.h"
 | |
| 
 | |
| #include "atlib.h"
 | |
|           
 | |
| // nomi dei campi
 | |
| #include "soggetti.h"
 | |
| #include "donaz.h"
 | |
| #include "contsan.h"
 | |
| #include "idoneita.h"
 | |
| #include "rconvoc.h"
 | |
| 
 | |
| class TCTDon2AT : public TApplication
 | |
| {
 | |
| 	TMask*					_msk;
 | |
| 	TRelation*   		_rel;
 | |
| 
 | |
|   TLocalisamfile* _soggetti;
 | |
| 	TLocalisamfile* _donaz;
 | |
| 	TLocalisamfile* _contsan;
 | |
| 	TLocalisamfile* _idoneita;
 | |
| 	TRecord_array*	_sdonazioni; 
 | |
| 	TRecord_array*	_scontrolli;
 | |
| 	TRecord_array*	_sidoneita;
 | |
| 	// parametri di sezione
 | |
|   int							_intsi_f1, _intsi_f2, _intsi_m, _intaf_m, _etadonne;
 | |
| 	int							_numdon1, _numdon2;
 | |
| 	TString16				_catini1, _catfin1, _catini2, _catfin2, _motivoid;
 | |
| 	bool						_sttess2, _dataisc, _nomessage, _autoid;
 | |
| 	
 | |
| 	
 | |
| protected:
 | |
| 	virtual bool create();
 | |
| 	virtual bool destroy();
 | |
|   virtual bool menu(MENU_TAG m);
 | |
| 	virtual TMask& get_mask() { return *_msk; }
 | |
| 	virtual TRelation* get_relation() const { return _rel; }
 | |
| 	
 | |
| 	int write(TSheet_field& s);
 | |
| 
 | |
| public:
 | |
| 	TCTDon2AT() {}
 | |
| 	
 | |
| };
 | |
| 
 | |
| HIDDEN inline TCTDon2AT& app() { return (TCTDon2AT&) main_app(); }
 | |
| 
 | |
| bool TCTDon2AT::create()
 | |
| {
 | |
| 	TApplication::create();
 | |
| 	_msk = new TMask("at8300a");
 | |
| 	_rel = new TRelation(LF_SOGGETTI);
 | |
|   //_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
 | |
| 	_donaz = new TLocalisamfile(LF_DONAZ);
 | |
| 	_contsan = new TLocalisamfile(LF_CONTSAN);
 | |
| 	_idoneita = new TLocalisamfile(LF_IDONEITA);
 | |
| 	_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
 | |
| 	_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
 | |
| 	_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
 | |
|   TConfig config(CONFIG_STUDIO);
 | |
|   _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");
 | |
|   _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");
 | |
|   dispatch_e_menu(BAR_ITEM(1));
 | |
| 	return TRUE;
 | |
| }	
 | |
| 
 | |
| bool TCTDon2AT::destroy()	
 | |
| {                          
 | |
| 	delete _sidoneita;
 | |
| 	delete _scontrolli;
 | |
| 	delete _sdonazioni;
 | |
| 	delete _idoneita;
 | |
| 	delete _contsan;
 | |
| 	delete _donaz;	
 | |
| 	delete _rel;
 | |
| 	delete _msk;
 | |
| 	return TApplication::destroy();
 | |
| }
 | |
| 
 | |
| bool TCTDon2AT::menu(MENU_TAG m)
 | |
| { 
 | |
|  	KEY tasto = _msk->run();
 | |
|  	if (tasto == K_ENTER)
 | |
|  	{
 | |
| 		_rel->lfile().setkey(1);
 | |
| 		bool modificato = FALSE;
 | |
| 		TDate oggi(TODAY);
 | |
| 		TRectype recsog = _rel->curr();
 | |
| 		TExternisamfile* f = new TExternisamfile("$appoggio");	 		
 | |
|   	TProgind *pi;
 | |
|   	pi = new TProgind(f->eod(),"Acquisizione dati da CT", FALSE, TRUE, 10);
 | |
|   	pi->setstatus(1);
 | |
| 	  for(f->first(); !f->eof(); f->next())
 | |
| 	  {     
 | |
|    	  pi->addstatus(1);
 | |
| 			const long codsog = f->get_long("CODICE");	  	             
 | |
| 			recsog.zero();
 | |
| 			recsog.put(SOG_CODICE, codsog);
 | |
| 			if (recsog.read(_rel->lfile())==NOERR)
 | |
| 			{
 | |
| 				TRectype* key = new TRectype(LF_DONAZ);
 | |
| 				key->put(DON_CODICE, codsog);
 | |
| 				int err = _sdonazioni->read(key);
 | |
| 				if (err == NOERR)
 | |
| 				{
 | |
| 					calcola_donazioni_lib(recsog, _sdonazioni);					
 | |
| 					_sdonazioni->rewrite();
 | |
| 					recsog.rewrite(_rel->lfile());
 | |
| 					
 | |
| 					TRectype* keyc = new TRectype(LF_CONTSAN);
 | |
| 					keyc->put(CON_CODICE, codsog);
 | |
| 					int err = _scontrolli->read(keyc);
 | |
| 					
 | |
| 					TRectype* keyi = new TRectype(LF_IDONEITA);
 | |
| 					keyi->put(IDO_CODICE, codsog);
 | |
| 					err = _sidoneita->read(keyi);
 | |
| 					
 | |
| 					con_reord(recsog,_scontrolli,_sidoneita);
 | |
| 					
 | |
| 					recsog.rewrite(_rel->lfile());
 | |
| 				}
 | |
| 				TTable ctd("CTD"); 
 | |
| 				TString16 catdon = recsog.get(SOG_CATDON);
 | |
| 				const int totdon = recsog.get_int(SOG_TOTDON);
 | |
| 				ctd.put("CODTAB",catdon);
 | |
| 				if (ctd.read() == NOERR)
 | |
| 				{
 | |
| 					bool dimissione = ctd.get_bool("B0");
 | |
| 					if (dimissione)          
 | |
| 					{
 | |
| 						recsog.put(SOG_CATDON,ctd.get("S6"));		    				
 | |
| 						if (ctd.get("S6").not_empty())
 | |
| 							catdon = ctd.get("S6");							
 | |
| 					}							
 | |
| 					if ((catdon == _catini1 || _catini1.empty()) && (totdon>=_numdon1) && _catfin1.not_empty())
 | |
| 						recsog.put(SOG_CATDON, _catfin1);  
 | |
| 					const 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);
 | |
| 			  }
 | |
| 			  TDate dataiscsog = recsog.get_date(SOG_DATAISC);
 | |
| 			  if (!dataiscsog.ok() && _dataisc)
 | |
| 			  {                 
 | |
| 					if (!recsog.get_date(SOG_DATAPRISI) == NULLDATE)
 | |
| 						recsog.put(SOG_DATAISC,recsog.get(SOG_DATAPRISI));
 | |
| 					else
 | |
| 		  		{
 | |
| 						const TRectype& riga = _sdonazioni->row(1);
 | |
| 						recsog.put(SOG_DATAISC,riga.get(DON_DATADON));
 | |
| 					}				  	
 | |
| 				}					
 | |
| 				const TDate dataprossi = recsog.get_date(SOG_DATAPROSSI);
 | |
| 				const TDate dataconv = recsog.get_date(SOG_DATACONV);
 | |
| 				const char stato = modstato_tcs(recsog.get(SOG_STATO));
 | |
| 				const TString16 statosi = recsog.get(SOG_STATOSI);
 | |
| 				if ((stato == 'S') || (statosi == SOSPENSIONE) || (dataprossi > dataconv) || !dataprossi.ok())
 | |
| 				{
 | |
| 					TLocalisamfile rconvoc(LF_RCONVOC);
 | |
| 					rconvoc.setkey(3);
 | |
| 					rconvoc.zero();
 | |
| 					rconvoc.put(RCV_CODICE, recsog.get(SOG_CODICE));
 | |
| 					rconvoc.put(RCV_DATACONV, recsog.get(SOG_DATACONV));
 | |
| 					if (rconvoc.read() == NOERR)
 | |
| 					{
 | |
| 						rconvoc.put(RCV_ANNULLATO, TRUE);
 | |
| 						int err = rconvoc.rewrite();
 | |
| 					}
 | |
| 					const TDate datanulla(NULLDATE);
 | |
| 					recsog.put(SOG_DATACONV, datanulla);
 | |
| 					recsog.put(SOG_DATAULTSOL, datanulla);
 | |
| 					const int numzero = 0;
 | |
| 					recsog.put(SOG_NUMCONV,numzero);
 | |
| 				}	
 | |
| 				recsog.put(SOG_DATAULTAGG, oggi);
 | |
| 				recsog.put(SOG_UTENULTAGG, "CT");
 | |
| 				recsog.rewrite(_rel->lfile());
 | |
| 			}
 | |
| 		}
 | |
|   	delete pi;
 | |
|   	delete f;
 | |
|  	}
 | |
|   return FALSE;
 | |
| }  
 | |
| 
 | |
| int TCTDon2AT::write(TSheet_field& s)
 | |
| { 
 | |
| 	return NOERR;	
 | |
| }
 | |
| 
 | |
| 		
 | |
| int at8300(int argc, char* argv[])
 | |
| {
 | |
| 	TCTDon2AT a;
 | |
| 	a.run(argc, argv, "Acquisizione dati da CT");
 | |
| 	return 0;
 | |
| } |