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
		
			
				
	
	
		
			124 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| 
 | |
| #include "atlib.h"
 | |
| 
 | |
| #include "at5.h"
 | |
| 
 | |
| #include "soggetti.h"
 | |
| #include "donaz.h"
 | |
| #include "contsan.h"
 | |
| #include "idoneita.h"
 | |
| 
 | |
| class TRiordinaSog : public TApplication
 | |
| { 
 | |
|   TLocalisamfile* _soggetti;
 | |
|   TLocalisamfile* _donaz;
 | |
|   TLocalisamfile* _contsan;
 | |
|   TLocalisamfile* _idoneita;
 | |
| 	TRecord_array*	_sdonazioni; 
 | |
| 	TRecord_array*	_scontrolli;
 | |
| 	TRecord_array*	_sidoneita;
 | |
|   
 | |
| protected:
 | |
|   virtual bool create();
 | |
|   virtual bool destroy();
 | |
| public:
 | |
|   TRiordinaSog() {}
 | |
|   virtual ~TRiordinaSog() {}
 | |
| };
 | |
| 
 | |
| bool TRiordinaSog::create()
 | |
| {
 | |
|   TApplication::create();
 | |
|   
 | |
|   if (argc() < 3)
 | |
|     return error_box("Specificare il codice del soggetto");
 | |
|   long codsog = atol(argv(2));
 | |
|   _soggetti = new TLocalisamfile(LF_SOGGETTI);
 | |
|   _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);
 | |
|   const int numdon1 = config.get_int("NumDon1");
 | |
|   const int numdon2 = config.get_int("NumDon2");
 | |
|   TString16 catini1 = config.get("CatIni1");
 | |
|   TString16 catfin1 = config.get("CatFin1");
 | |
|   TString16 catini2 = config.get("CatIni2");
 | |
|   TString16 catfin2 = config.get("CatFin2");
 | |
|   const bool sttess2 = config.get_bool("StTess2");
 | |
|   const bool dataisc = config.get_bool("DataIsc");
 | |
|   const int etadonne = config.get_int("EtaDonne");
 | |
|   const int intsi_f1 = config.get_int("IntSI_F1");
 | |
|   const int intsi_f2 = config.get_int("IntSI_F2");
 | |
|   const int intsi_m = config.get_int("IntSI_M");
 | |
|   const int intaf_m = config.get_int("IntAF_M");
 | |
|   TRectype soggetto(LF_SOGGETTI);
 | |
| 	_soggetti->put(SOG_CODICE, codsog);
 | |
| 	if (_soggetti->read() == NOERR)
 | |
| 	{                         
 | |
| 		TRectype& sog = _soggetti->curr();
 | |
| 		TRectype* key = new TRectype(LF_DONAZ);
 | |
| 		key->put(DON_CODICE, codsog);
 | |
| 		int err = _sdonazioni->read(key);
 | |
| 		if (err == NOERR)
 | |
| 		{
 | |
| 			calcola_donazioni_lib(sog, _sdonazioni);
 | |
| 			_sdonazioni->rewrite();
 | |
| 			_soggetti->rewrite();
 | |
| 		}     
 | |
| 		TString16 catdon = sog.get(SOG_CATDON);
 | |
| 		const int totdon = sog.get_int(SOG_TOTDON);
 | |
| 		const TRectype& ctd = cache().get("CTD", catdon);
 | |
| 		const bool dimissione = ctd.get_bool("B0");
 | |
| 		if (dimissione)
 | |
| 		{   
 | |
| 			const TString16 catcoll = ctd.get("S6");
 | |
| 			if (catcoll.not_empty())
 | |
| 			{
 | |
| 				sog.put(SOG_CATDON, catcoll);		    				
 | |
| 				catdon = catcoll;
 | |
| 			}	
 | |
| 		}							
 | |
| 		if ((catdon == catini1 || catini1.empty()) && (totdon==numdon1) && catfin1.not_empty())
 | |
| 			sog.put(SOG_CATDON, catfin1);
 | |
| 		if ((catdon == catini2 || catini2.empty()) && (totdon>=numdon2) && catfin2.not_empty() && (!sttess2 || dimissione))
 | |
| 			sog.put(SOG_CATDON, catfin2);
 | |
| 	  TDate dataiscsog = sog.get_date(SOG_DATAISC);
 | |
| 	  if (!dataiscsog.ok() && dataisc)
 | |
| 	  {                 
 | |
| 			if (!sog.get_date(SOG_DATAPRISI) == NULLDATE)
 | |
| 				sog.put(SOG_DATAISC,sog.get(SOG_DATAPRISI));
 | |
| 			else
 | |
|   		{
 | |
| 				const TRectype& riga = _sdonazioni->row(1);
 | |
| 				sog.put(SOG_DATAISC,riga.get(DON_DATADON));
 | |
| 			}				  	
 | |
| 		}					
 | |
| 		_soggetti->rewrite();			
 | |
| 	}
 | |
|   stop_run();
 | |
|   return TRUE;
 | |
| }
 | |
| 
 | |
| bool TRiordinaSog::destroy()
 | |
| {                         
 | |
| 	delete _sidoneita;
 | |
| 	delete _scontrolli;
 | |
| 	delete _sdonazioni;
 | |
|   delete _idoneita;
 | |
|   delete _contsan;
 | |
|   delete _donaz;
 | |
|   delete _soggetti;
 | |
|   return TApplication::destroy();
 | |
| }
 | |
| 
 | |
| int at5400(int argc, char* argv[])
 | |
| {                                             
 | |
|   TRiordinaSog a;
 | |
|   a.run(argc, argv, "Riordina donazioni soggetto");
 | |
|   return 0;
 | |
| }
 |