Aggiornamento dei programmi di utilita' AVIS al 10/2/98
git-svn-id: svn://10.65.10.50/trunk@6149 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									94b3af455c
								
							
						
					
					
						commit
						1b0f205ce0
					
				
							
								
								
									
										126
									
								
								at/at7600.cpp
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										126
									
								
								at/at7600.cpp
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,126 @@ | |||||||
|  | #include <mask.h> | ||||||
|  | #include <printapp.h> | ||||||
|  | #include <tabutil.h> | ||||||
|  | #include <recarray.h> | ||||||
|  | #include <utility.h> | ||||||
|  | #include <lffiles.h> | ||||||
|  | 
 | ||||||
|  | #include "at7.h" | ||||||
|  | #include "atlib.h" | ||||||
|  | #include "at7600a.h"       | ||||||
|  |        | ||||||
|  | // nomi dei campi
 | ||||||
|  | #include "soggetti.h" | ||||||
|  | #include "contsan.h" | ||||||
|  | #include "idoneita.h" | ||||||
|  | 
 | ||||||
|  | class TRiordinaControlli : public TPrintapp | ||||||
|  | { | ||||||
|  | 	TMask*						_msk; | ||||||
|  | 	TRelation*   			_rel; | ||||||
|  | 	int 							_cur;	 | ||||||
|  | 	TLocalisamfile*		_contsan; | ||||||
|  | 	TRecord_array*		_scontrolli; | ||||||
|  | 	TLocalisamfile*		_idoneita; | ||||||
|  | 	TRecord_array*		_sidoneita; | ||||||
|  | 
 | ||||||
|  | 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); | ||||||
|  | 	 | ||||||
|  | public: | ||||||
|  | 	TRiordinaControlli() {} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | HIDDEN inline TRiordinaControlli& app() { return (TRiordinaControlli&) main_app(); } | ||||||
|  | 
 | ||||||
|  | bool TRiordinaControlli::preprocess_page(int file, int counter) | ||||||
|  | {  | ||||||
|  | 	bool rewrite = FALSE; | ||||||
|  | 	TRectype& recsog = current_cursor()->curr(); | ||||||
|  | 	const long codice = recsog.get_long(SOG_CODICE); | ||||||
|  | 	TRectype* keyc = new TRectype(LF_CONTSAN); | ||||||
|  | 	keyc->put(CON_CODICE, codice); | ||||||
|  | 	int err = _scontrolli->read(keyc); | ||||||
|  | 	TRectype* keyi = new TRectype(LF_IDONEITA); | ||||||
|  | 	keyi->put(IDO_CODICE, codice); | ||||||
|  | 	int erri = _sidoneita->read(keyi); | ||||||
|  | 	 | ||||||
|  | 	if ((err == NOERR || erri == NOERR) && (_scontrolli->rows() > 0 || _sidoneita->rows() > 0)) | ||||||
|  | 	{ | ||||||
|  | 		con_reord(recsog,_scontrolli, _sidoneita); | ||||||
|  | 		rewrite = TRUE; | ||||||
|  | 	}		              | ||||||
|  | 	if (rewrite) | ||||||
|  | 		current_cursor()->file().rewrite(); | ||||||
|  | 	return rewrite;	 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TRiordinaControlli::set_page(int file, int cnt) | ||||||
|  | {  | ||||||
|  | 	set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); | ||||||
|  | 	//set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
 | ||||||
|  | 	//set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME));
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TRiordinaControlli::set_print(int) | ||||||
|  | { | ||||||
|  |   KEY tasto; | ||||||
|  |   tasto = _msk->run(); | ||||||
|  | 	if (tasto == K_ENTER) | ||||||
|  | 	{  	  | ||||||
|  | 	  TRectype da(LF_SOGGETTI); | ||||||
|  | 	  TRectype a(LF_SOGGETTI); | ||||||
|  | 	  const long codini = _msk->get_long(F_CODINI); | ||||||
|  | 	  const long codfin = _msk->get_long(F_CODFIN); | ||||||
|  | 	  da.zero(); | ||||||
|  | 	  a.zero(); | ||||||
|  | 		if (codini != 0)	  	 | ||||||
|  | 	  	da.put(SOG_CODICE, codini); | ||||||
|  | 		if (codfin != 0)	  	 | ||||||
|  | 	  	a.put(SOG_CODICE, codfin); | ||||||
|  | 	  current_cursor()->setregion(da,a); | ||||||
|  |    	//current_cursor()->setfilter(format("STATO == \"RF\""));
 | ||||||
|  | 	   | ||||||
|  | 		reset_files();  | ||||||
|  |     add_file(LF_SOGGETTI); | ||||||
|  | 		reset_print();		 | ||||||
|  |     return TRUE; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |     return FALSE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TRiordinaControlli::user_create() | ||||||
|  | { | ||||||
|  | 	_msk = new TMask("at7600a"); | ||||||
|  | 	_rel = new TRelation(LF_SOGGETTI); | ||||||
|  | 	_contsan		= new TLocalisamfile(LF_CONTSAN); | ||||||
|  | 	_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON); | ||||||
|  | 	_idoneita		= new TLocalisamfile(LF_IDONEITA); | ||||||
|  | 	_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO); | ||||||
|  |   _cur = add_cursor(new TCursor(_rel, "", 1)); | ||||||
|  |   long items = _rel->lfile().items(); | ||||||
|  | 	return TRUE; | ||||||
|  | }	 | ||||||
|  | 
 | ||||||
|  | bool TRiordinaControlli::user_destroy()	 | ||||||
|  | { | ||||||
|  | 	delete _msk; | ||||||
|  | 	delete _rel; | ||||||
|  | 	delete _scontrolli; | ||||||
|  | 	delete _contsan; | ||||||
|  | 	delete _sidoneita; | ||||||
|  | 	delete _idoneita; | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int at7600(int argc, char* argv[]) | ||||||
|  | { | ||||||
|  | 	TRiordinaControlli a; | ||||||
|  | 	a.run(argc, argv, "Riordina controlli"); | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								at/at7600a.h
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								at/at7600a.h
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | // riordino controlli
 | ||||||
|  | #define F_CODINI 101 | ||||||
|  | #define F_CODFIN 102 | ||||||
							
								
								
									
										28
									
								
								at/at7600a.uml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								at/at7600a.uml
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | #include "at4800a.h" | ||||||
|  | 
 | ||||||
|  | PAGE "Riordina controlli" -1 -1 78 20 | ||||||
|  | 
 | ||||||
|  | NUMBER F_CODINI 9 | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 2 2 "Codice iniziale " | ||||||
|  |   HELP "Codice soggetto iniziale (vuoto = inizio)" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | NUMBER F_CODFIN 9 | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 2 3 "Codice finale   " | ||||||
|  |   HELP "Codice soggetto finale (vuoto = fine)" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_OK 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -12 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_QUIT 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -22 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | ENDPAGE | ||||||
|  | ENDMASK | ||||||
							
								
								
									
										135
									
								
								at/at7700.cpp
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										135
									
								
								at/at7700.cpp
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,135 @@ | |||||||
|  | #include <mask.h> | ||||||
|  | #include <printapp.h> | ||||||
|  | #include <recarray.h> | ||||||
|  | #include <tabutil.h> | ||||||
|  | #include <utility.h> | ||||||
|  | #include <lffiles.h> | ||||||
|  | 
 | ||||||
|  | #include "at7.h" | ||||||
|  | 
 | ||||||
|  | #include "atlib.h" | ||||||
|  | 
 | ||||||
|  | // nomi dei campi
 | ||||||
|  | #include "soggetti.h" | ||||||
|  | #include "contsan.h" | ||||||
|  | #include "donaz.h" | ||||||
|  | 
 | ||||||
|  | #define ALIAS_TCS	200 | ||||||
|  | 
 | ||||||
|  | class TProblemiStato : public TPrintapp | ||||||
|  | { | ||||||
|  | 	TMask*						_msk; | ||||||
|  | 	TRelation*   			_rel; | ||||||
|  | 	int 							_cur; | ||||||
|  | 	TLocalisamfile* 	_soggetti; | ||||||
|  | 	TLocalisamfile* 	_contsan; | ||||||
|  | 	TLocalisamfile* 	_donaz; | ||||||
|  | 	TRecord_array*  	_scontrolli; | ||||||
|  | 	TRecord_array*  	_sdonazioni; | ||||||
|  | 	 | ||||||
|  | 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); | ||||||
|  | 	 | ||||||
|  | public: | ||||||
|  | 	TProblemiStato() {} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | HIDDEN inline TProblemiStato& app() { return (TProblemiStato&) main_app(); } | ||||||
|  | 
 | ||||||
|  | bool TProblemiStato::preprocess_page(int file, int counter) | ||||||
|  | {    | ||||||
|  | 	bool rew = FALSE; | ||||||
|  | 	TRectype& recsog = current_cursor()->curr(); | ||||||
|  | 	const long codice = recsog.get_long(SOG_CODICE); | ||||||
|  | 	TString16 idon1 = recsog.get(SOG_IDON1); | ||||||
|  | 	if (idon1.empty()) | ||||||
|  | 	{	 | ||||||
|  | 		rew = TRUE; | ||||||
|  | 		TRectype* key = new TRectype(LF_CONTSAN); | ||||||
|  | 		key->put(CON_CODICE, codice); | ||||||
|  | 		int err = _scontrolli->read(key); | ||||||
|  | 		if (err == NOERR) | ||||||
|  | 		{  | ||||||
|  | 			for (int r=1; r<=_scontrolli->rows(); r++) | ||||||
|  | 			{ | ||||||
|  | 				TRectype& riga = _scontrolli->row(r, TRUE); | ||||||
|  | 				TString16 tipocon = riga.get(CON_TIPOCON); | ||||||
|  | 				const char stato = modstato_tcs(tipocon); | ||||||
|  | 				if (stato == 'I' || stato == 'F') | ||||||
|  | 				{       | ||||||
|  | 					int numdonsi = recsog.get_int(SOG_TOTDONSI); | ||||||
|  | 					int numdonaf = recsog.get_int(SOG_TOTDONAF); | ||||||
|  | 					if (numdonsi != 0) | ||||||
|  | 						riga.put(CON_IDON1, "SI"); | ||||||
|  | 						if (numdonaf != 0) | ||||||
|  | 							riga.put(CON_IDON2, "PL"); | ||||||
|  | 					else | ||||||
|  | 						if (numdonaf != 0) | ||||||
|  | 							riga.put(CON_IDON1, "PL");					 | ||||||
|  | 				}	 | ||||||
|  | 			} | ||||||
|  | 			_scontrolli->rewrite(); | ||||||
|  | 			//con_reord(recsog,_scontrolli, _sidoneita);
 | ||||||
|  |    		current_cursor()->file().rewrite(); | ||||||
|  | 		}	  | ||||||
|  | 	}		 | ||||||
|  | 	return rew;	 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TProblemiStato::set_page(int file, int cnt) | ||||||
|  | {  | ||||||
|  | 	set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); | ||||||
|  | 	set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME)); | ||||||
|  | 	set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TProblemiStato::set_print(int) | ||||||
|  | { | ||||||
|  |   KEY tasto; | ||||||
|  |   tasto = _msk->run(); | ||||||
|  | 	if (tasto == K_ENTER) | ||||||
|  | 	{  	  | ||||||
|  |     reset_files();  | ||||||
|  |     add_file(LF_SOGGETTI); | ||||||
|  | 		reset_print();		 | ||||||
|  |     current_cursor()->setfilter("((TCS->S6 == \"I\") || (TCS->S6 == \"F\"))", TRUE); | ||||||
|  |     return TRUE; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |     return FALSE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TProblemiStato::user_create() | ||||||
|  | { | ||||||
|  | 	_msk = new TMask("at7700a"); | ||||||
|  | 	_rel = new TRelation(LF_SOGGETTI); | ||||||
|  |   _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);	 | ||||||
|  | 	_contsan 	= new TLocalisamfile(LF_CONTSAN); | ||||||
|  | 	_donaz 	= new TLocalisamfile(LF_DONAZ); | ||||||
|  | 	_scontrolli 	= new TRecord_array(LF_CONTSAN,CON_PROGCON); | ||||||
|  | 	_sdonazioni 	= new TRecord_array(LF_DONAZ,DON_PROGDON); | ||||||
|  |   _cur = add_cursor(new TCursor(_rel, "", 1)); | ||||||
|  | 	return TRUE; | ||||||
|  | }	 | ||||||
|  | 
 | ||||||
|  | bool TProblemiStato::user_destroy()	 | ||||||
|  | { | ||||||
|  | 	delete _rel; | ||||||
|  | 	delete _msk; | ||||||
|  | 	delete _contsan; | ||||||
|  | 	delete _donaz; | ||||||
|  | 	delete _scontrolli; | ||||||
|  | 	delete _sdonazioni; | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int at7700(int argc, char* argv[]) | ||||||
|  | { | ||||||
|  | 	TProblemiStato a; | ||||||
|  | 	a.run(argc, argv, "Soggetti con problemi sullo stato"); | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								at/at7700a.uml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								at/at7700a.uml
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | PAGE "Idonei senza tipo donazione" -1 -1 78 20 | ||||||
|  | BUTTON DLG_OK 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -12 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_QUIT 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -22 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | ENDPAGE | ||||||
|  | ENDMASK | ||||||
							
								
								
									
										85
									
								
								at/at7800.cpp
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										85
									
								
								at/at7800.cpp
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,85 @@ | |||||||
|  | #include <mask.h> | ||||||
|  | #include <printapp.h> | ||||||
|  | #include <tabutil.h> | ||||||
|  | #include <utility.h> | ||||||
|  | #include <lffiles.h> | ||||||
|  | 
 | ||||||
|  | #include "at7.h" | ||||||
|  | 
 | ||||||
|  | // nomi dei campi
 | ||||||
|  | #include "soggetti.h" | ||||||
|  | 
 | ||||||
|  | class TCatvuota_app : public TPrintapp | ||||||
|  | { | ||||||
|  | 	TMask*						_msk; | ||||||
|  | 	TRelation*   			_rel; | ||||||
|  | 	int 							_cur;	 | ||||||
|  | 	TString16					_catavi; | ||||||
|  | 
 | ||||||
|  | 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); | ||||||
|  | 	 | ||||||
|  | public: | ||||||
|  | 	TCatvuota_app() {} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | HIDDEN inline TCatvuota_app& app() { return (TCatvuota_app&) main_app(); } | ||||||
|  | 
 | ||||||
|  | bool TCatvuota_app::preprocess_page(int file, int counter) | ||||||
|  | {  | ||||||
|  | 	TRectype& recsog = current_cursor()->curr(); | ||||||
|  | 	recsog.put(SOG_CATDON, _catavi); | ||||||
|  | 	current_cursor()->file().rewrite(); | ||||||
|  |   return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TCatvuota_app::set_page(int file, int cnt) | ||||||
|  | {  | ||||||
|  | 	set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); | ||||||
|  | 	set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME)); | ||||||
|  | 	set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME)); | ||||||
|  | 	set_row(1,"@62g@S", FLD(LF_SOGGETTI,SOG_CATDON)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TCatvuota_app::set_print(int) | ||||||
|  | { | ||||||
|  |   KEY tasto; | ||||||
|  |   tasto = _msk->run(); | ||||||
|  | 	if (tasto == K_ENTER) | ||||||
|  | 	{  	  | ||||||
|  |     reset_files();  | ||||||
|  |     add_file(LF_SOGGETTI); | ||||||
|  | 		reset_print();		 | ||||||
|  | 		_catavi = "AV"; | ||||||
|  |    	current_cursor()->setfilter("(CATDON == \"\")", TRUE); | ||||||
|  |     return TRUE; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |     return FALSE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TCatvuota_app::user_create() | ||||||
|  | { | ||||||
|  | 	_msk = new TMask("at7800a"); | ||||||
|  | 	_rel = new TRelation(LF_SOGGETTI); | ||||||
|  |   _cur = add_cursor(new TCursor(_rel, "", 1)); | ||||||
|  | 	return TRUE; | ||||||
|  | }	 | ||||||
|  | 
 | ||||||
|  | bool TCatvuota_app::user_destroy()	 | ||||||
|  | { | ||||||
|  | 	delete _rel; | ||||||
|  | 	delete _msk; | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int at7800(int argc, char* argv[]) | ||||||
|  | { | ||||||
|  | 	TCatvuota_app a; | ||||||
|  | 	a.run(argc, argv, "Correzioni categorie vuote"); | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
							
								
								
									
										14
									
								
								at/at7800a.uml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								at/at7800a.uml
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | PAGE "Correzione soggetti senza categoria don." -1 -1 78 20 | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_OK 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -12 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_QUIT 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -22 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | ENDPAGE | ||||||
|  | ENDMASK | ||||||
							
								
								
									
										109
									
								
								at/at7900.cpp
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										109
									
								
								at/at7900.cpp
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,109 @@ | |||||||
|  | #include <mask.h> | ||||||
|  | #include <printapp.h> | ||||||
|  | #include <tabutil.h> | ||||||
|  | #include <recarray.h> | ||||||
|  | #include <utility.h> | ||||||
|  | #include <lffiles.h> | ||||||
|  | 
 | ||||||
|  | #include "at7.h" | ||||||
|  | #include "atlib.h" | ||||||
|  | 
 | ||||||
|  | // nomi dei campi
 | ||||||
|  | #include "soggetti.h" | ||||||
|  | #include "donaz.h" | ||||||
|  | 
 | ||||||
|  | class TUltimaDon : public TPrintapp | ||||||
|  | { | ||||||
|  | 	TMask*						_msk; | ||||||
|  | 	TRelation*   			_rel; | ||||||
|  | 	int 							_cur;	 | ||||||
|  | 	TLocalisamfile*		_donaz; | ||||||
|  | 	TRecord_array*		_sdonazioni; | ||||||
|  | 
 | ||||||
|  | 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); | ||||||
|  | 	 | ||||||
|  | public: | ||||||
|  | 	TUltimaDon() {} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | HIDDEN inline TUltimaDon& app() { return (TUltimaDon&) main_app(); } | ||||||
|  | 
 | ||||||
|  | bool TUltimaDon::preprocess_page(int file, int counter) | ||||||
|  | {  | ||||||
|  | 	bool rewrite = FALSE; | ||||||
|  | 	TRectype& recsog = current_cursor()->curr(); | ||||||
|  | 	const long codice = recsog.get_long(SOG_CODICE); | ||||||
|  | 	TRectype* keyd = new TRectype(LF_DONAZ); | ||||||
|  | 	keyd->put(DON_CODICE, codice); | ||||||
|  | 	int errd = _sdonazioni->read(keyd); | ||||||
|  | 	if ((errd == NOERR) && (_sdonazioni->rows()>0)) | ||||||
|  | 	{    | ||||||
|  | 		TDate dataultdon = recsog.get(SOG_DATAULTDON); | ||||||
|  | 		int totdonsi = recsog.get_int(SOG_TOTDONSI); | ||||||
|  | 		int totdonaf = recsog.get_int(SOG_TOTDONAF); | ||||||
|  | 		int totdon = recsog.get_int(SOG_TOTDON); | ||||||
|  | 		int totale = totdonsi+totdonaf; | ||||||
|  | 		int ultima = _sdonazioni->rows(); | ||||||
|  | 		TRectype& riga = _sdonazioni->row(ultima, TRUE); | ||||||
|  | 		TDate datadon =	riga.get(DON_DATADON);			 | ||||||
|  | 		if (datadon > dataultdon || totdon != totale) | ||||||
|  | 		{ | ||||||
|  | 			rewrite = TRUE; | ||||||
|  | 			calcola_donazioni_lib(recsog,_sdonazioni); | ||||||
|  | 		}			 | ||||||
|  | 		if (rewrite)  | ||||||
|  | 			current_cursor()->file().rewrite(); | ||||||
|  | 	}			 | ||||||
|  | 	return rewrite;	 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TUltimaDon::set_page(int file, int cnt) | ||||||
|  | {  | ||||||
|  | 	set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TUltimaDon::set_print(int) | ||||||
|  | { | ||||||
|  |   KEY tasto; | ||||||
|  |   tasto = _msk->run(); | ||||||
|  | 	if (tasto == K_ENTER) | ||||||
|  | 	{  	  | ||||||
|  |     reset_files();  | ||||||
|  |     add_file(LF_SOGGETTI); | ||||||
|  | 		reset_print();		 | ||||||
|  |     return TRUE; | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |     return FALSE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TUltimaDon::user_create() | ||||||
|  | { | ||||||
|  | 	_msk = new TMask("at7900a"); | ||||||
|  | 	_rel = new TRelation(LF_SOGGETTI); | ||||||
|  | 	_donaz 		= new TLocalisamfile(LF_DONAZ); | ||||||
|  | 	_sdonazioni 	= new TRecord_array(LF_DONAZ,DON_PROGDON); | ||||||
|  |   _cur = add_cursor(new TCursor(_rel, "", 1)); | ||||||
|  | 	return TRUE; | ||||||
|  | }	 | ||||||
|  | 
 | ||||||
|  | bool TUltimaDon::user_destroy()	 | ||||||
|  | { | ||||||
|  | 	delete _msk; | ||||||
|  | 	delete _rel; | ||||||
|  | 	delete _donaz; | ||||||
|  | 	delete _sdonazioni; | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int at7900(int argc, char* argv[]) | ||||||
|  | { | ||||||
|  | 	TUltimaDon a; | ||||||
|  | 	a.run(argc, argv, "Controllo data ultima donazione e totale"); | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
							
								
								
									
										14
									
								
								at/at7900a.uml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								at/at7900a.uml
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | PAGE "Controllo data ultima donazione" -1 -1 78 20 | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_OK 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -12 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | BUTTON DLG_QUIT 9 2 | ||||||
|  | BEGIN | ||||||
|  |         PROMPT -22 14 "" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | ENDPAGE | ||||||
|  | ENDMASK | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user