Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21612 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			1373 lines
		
	
	
		
			43 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			1373 lines
		
	
	
		
			43 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <form.h>
 | ||
| #include <mask.h>
 | ||
| #include <printapp.h>
 | ||
| #include <utility.h>
 | ||
| 
 | ||
| #include "soggetti.h"
 | ||
| #include "benem.h"
 | ||
| #include "donaz.h"
 | ||
| #include "famiglie.h"
 | ||
| #include "sezioni.h"
 | ||
| #include <comuni.h>
 | ||
| 
 | ||
| #include "at2.h"
 | ||
| #include "at2700a.h"
 | ||
| #include "atlib.h"
 | ||
| 
 | ||
| #include "at4100b.h"
 | ||
| #include "at4100c.h"
 | ||
| 
 | ||
| #define ALIAS_CTD			700		// categoria donatori
 | ||
| #define ALIAS_CTN1		701		// categoria non donatori 1
 | ||
| #define ALIAS_CTN2		702		// categoria non donatori 2
 | ||
| 
 | ||
| #define ALIAS_TCS 		200		// tipi/esiti controlli sanitari
 | ||
| #define ALIAS_LDN 		400		// punti di prelievo
 | ||
| #define ALIAS_LDNDON	401		// punti di prelievo
 | ||
| 
 | ||
| #define ALIAS_LCPDOM	100		// localita' postale di domicilio
 | ||
| #define ALIAS_COMDOM 	501		// comune di domicilio
 | ||
| #define ALIAS_COMNAS 	500		// comune di nascita
 | ||
| 
 | ||
| #define ALIAS_BNZ			600		// benemerenze
 | ||
| #define ALIAS_GAZ			300   // gruppi aziendale
 | ||
| 
 | ||
| #define ETI_COGNOME 3			// numero campo cognome e nome in etichetta (deve essere sempre cosi') per famiglie
 | ||
| 
 | ||
| enum ts { undefined=0, sintetico=1, completo=2, schede=3, etichette=4, cartoline=5, personale=6, notiziario=7, stampasufile=8, filepers=9};
 | ||
| 
 | ||
| // definizione form per etichette
 | ||
| class TEti_percat_form : public TForm
 | ||
| {
 | ||
| public:
 | ||
| 	
 | ||
| 	virtual TCursor* cursor() const;
 | ||
| 	virtual TRelation* relation() const;
 | ||
| 	TPrint_section& get_body() { return section('B'); } ;
 | ||
| 	TPrint_section& get_head() { return section('H'); } ;
 | ||
| 	TPrint_section& get_foot() { return section('F'); } ;
 | ||
|   TEti_percat_form(): TForm() {};
 | ||
|   TEti_percat_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
 | ||
|     						: TForm(form,code,editlevel,desc) {};
 | ||
|   virtual ~TEti_percat_form() {};
 | ||
| };
 | ||
| 
 | ||
| class TStampaPerCategorie : public TPrintapp
 | ||
| {
 | ||
|   static bool filter_func_percat(const TRelation* rel);
 | ||
| 
 | ||
|   TRelation*        _rel;
 | ||
|   TMask*            _msk;
 | ||
| 	TLocalisamfile* 	_benem;
 | ||
| 	TLocalisamfile* 	_donaz;
 | ||
| 	TLocalisamfile* 	_famiglie;
 | ||
| 	TExternisamfile*  _file;
 | ||
| 	TExternisamfile*  _filepers;
 | ||
| 	TRecord_array*  	_sbenemerenze;
 | ||
| 	TRecord_array*  	_sfamiglia;
 | ||
|   TEti_percat_form*	_form_eti;
 | ||
|   TEti_percat_form*	_form_neti;
 | ||
|   TEti_percat_form*	_form_car;
 | ||
|   TEti_percat_form*	_form_sch;    
 | ||
|   TEti_percat_form*	_form_per;    
 | ||
|   TAssoc_array			_catdon;
 | ||
|   TAssoc_array			_catnondon;
 | ||
|   TAssoc_array			_codfamiglie;
 | ||
|   TParagraph_string _cognome_nome, _dencom, _benemerenza;
 | ||
|   TString80					_rigastampa;
 | ||
|   TDate 						_data_stampa;
 | ||
|   ts								_tipostampa;
 | ||
|   TString16					_lettini, _lettfin, _capini, _capfin; 
 | ||
|   TString16					_gruppoazie, _gruppoold;
 | ||
|   bool							_pergruppo, _perfamiglie, _nosottogruppo;
 | ||
|   long 							_contatore;
 | ||
| 	TString16					_codsez, _codsot, _orario, _datacart;
 | ||
| 	TString80					_invitoper, _data, _presso1, _presso2, _presso3, _presso4;
 | ||
| 	TString80					_note, _intest1, _intest2, _intest3, _intest4;
 | ||
| 	bool							_usomodo, _usasez;
 | ||
| 	int							  _schxpag, _lenpage, _etnlarghezza, _etncolonne;
 | ||
|   int								_etlarghezza, _etcolonne, _etrighe, _etbordoini, _etbordofin, _netichette;
 | ||
|   int 							_caxpag, _cabordoini, _cabordofin, _ncartoline;
 | ||
|   bool							_stampa80, _etictot;
 | ||
|   
 | ||
| protected:
 | ||
|   virtual bool user_create();
 | ||
|   virtual bool user_destroy();
 | ||
|   virtual bool set_print(int m);
 | ||
|   virtual void set_page(int file, int cnt);
 | ||
| 	bool filepers_put(const char* nomecampo, const char* valore);
 | ||
|   virtual bool preprocess_page (int file, int counter);
 | ||
|   virtual print_action postprocess_print(int file, int counter);
 | ||
|   ts dati_cartolina();
 | ||
| 
 | ||
| public:
 | ||
|   void dati_sezione(const TString16 codsez, const TString16 codsot);
 | ||
|   void crea_intestazione();
 | ||
|   void filtra_sezioni();
 | ||
|   void header_gruppo(const TString16 gruppo);
 | ||
|   void footer_gruppo();
 | ||
|   void header_sezione(const TString16 codsez, const TString16 codsot);
 | ||
|   void footer_sezione();
 | ||
|   TMask& app_mask() { return *_msk; }
 | ||
| 
 | ||
|   TStampaPerCategorie() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",30), _benemerenza("",11) {}
 | ||
| };
 | ||
| 
 | ||
| 
 | ||
| HIDDEN inline TStampaPerCategorie& app() { return (TStampaPerCategorie&) main_app(); }
 | ||
| 
 | ||
| TCursor* TEti_percat_form::cursor() const { return app().current_cursor(); }
 | ||
| 
 | ||
| TRelation* TEti_percat_form::relation() const { return cursor()->relation(); }
 | ||
| 
 | ||
| static int compare_benem(const TObject** o1, const TObject** o2)
 | ||
| {
 | ||
|   TRectype* r1 = (TRectype*)*o1;
 | ||
|   TRectype* r2 = (TRectype*)*o2;
 | ||
|   
 | ||
|   const TString b1(r1->get(BEN_TIPOBEN));
 | ||
|   const TString b2(r2->get(BEN_TIPOBEN));
 | ||
|   
 | ||
|   int b=0;
 | ||
|   if (b1>b2) b=+1;
 | ||
|   else
 | ||
|   	if (b1<b2) b=-1;
 | ||
| 	return b;
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::dati_sezione(const TString16 codsez, const TString16 codsot)
 | ||
| {
 | ||
| 	_intest1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ1);
 | ||
| 	_intest2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ2);
 | ||
| 	_intest3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ3);
 | ||
| 	_intest4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ4);
 | ||
| 	if (_usasez)
 | ||
| 	{
 | ||
| 		if (_presso1.blank())
 | ||
| 		{
 | ||
| 			_presso1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE1);
 | ||
| 			_presso2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE2);
 | ||
| 			_presso3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE3);
 | ||
| 			_presso4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE4);
 | ||
| 		}			
 | ||
| 		if (_orario.blank())
 | ||
| 			_orario = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVORA);
 | ||
| 		if (_note.blank())
 | ||
| 			_note = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVNOTE);
 | ||
| 	}
 | ||
| 	return;
 | ||
| }
 | ||
| 
 | ||
| ts TStampaPerCategorie::dati_cartolina()
 | ||
| {
 | ||
| 	TMask msk("at4100b");
 | ||
|  	if (msk.run() == K_ENTER) 
 | ||
|  	{ 
 | ||
|  		_invitoper = msk.get(F_INVITOPER);
 | ||
|  		_data			 = msk.get(F_DATA);
 | ||
|  		_presso1   = msk.get(F_PRESSO1);
 | ||
|  		_presso2   = msk.get(F_PRESSO2);
 | ||
|  		_presso3   = msk.get(F_PRESSO3);
 | ||
|  		_presso4   = msk.get(F_PRESSO4);
 | ||
|  		_datacart  = msk.get(F_DATACART);
 | ||
|  		_orario  	 = msk.get(F_ORARIO);
 | ||
|  		_note   	 = msk.get(F_NOTE);
 | ||
|  		_usasez		 = msk.get_bool(F_USASEZ);
 | ||
|  		return cartoline;
 | ||
|  	}
 | ||
|  	else
 | ||
|  		return undefined;
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::filtra_sezioni()
 | ||
| {
 | ||
|  	const TString16 sezini = _msk->get(F_SEZINI);
 | ||
|  	const TString16 sotini = _msk->get(F_SOTINI);
 | ||
|  	const TString16 sezfin = _msk->get(F_SEZFIN);
 | ||
|  	const TString16 sotfin = _msk->get(F_SOTFIN);
 | ||
|   TRectype da(LF_SOGGETTI);
 | ||
|   TRectype a(LF_SOGGETTI);   
 | ||
| 	if (sezini.not_empty())  
 | ||
| 		da.put(SOG_CODSEZ, sezini);
 | ||
|   if (sotini.not_empty())
 | ||
| 		da.put(SOG_CODSOT, sotini);
 | ||
|   if (sezfin.not_empty())
 | ||
| 		a.put(SOG_CODSEZ, sezfin);
 | ||
|   if (sotfin.not_empty())
 | ||
| 		a.put(SOG_CODSOT, sotfin);
 | ||
| 	current_cursor()->setregion(da, a);
 | ||
| }	
 | ||
| 
 | ||
| void TStampaPerCategorie::footer_gruppo()
 | ||
| {
 | ||
| 	// stampa totale soggetti appartenenti al gruppo
 | ||
| 	if ((_tipostampa==etichette || _tipostampa==notiziario) && _etictot)
 | ||
| 	{                          
 | ||
| 		TPrint_section& corpo = _form_eti->get_body();
 | ||
| 		if (_tipostampa==notiziario)
 | ||
| 			corpo = _form_neti->get_body();
 | ||
|   	TPrintrow riga;
 | ||
| 		for (word i = 0; i < corpo.height(); i++)
 | ||
| 		{
 | ||
| 		  riga.reset();
 | ||
| 			if (i==0)
 | ||
| 			{
 | ||
| 			  TString80 totale = format("TOTALE %d", _contatore);
 | ||
| 		  	riga.put(totale);
 | ||
| 			}							
 | ||
| 	  	printer().print(riga);
 | ||
| 		}
 | ||
| 	}
 | ||
| 	else
 | ||
| 	{	
 | ||
| 		reset_footer();
 | ||
| 		TString sep(80);
 | ||
| 		sep.fill('-');
 | ||
| 		set_footer(2, (const char *) sep);
 | ||
| 		set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
 | ||
| 		printer().formfeed(); 
 | ||
| 		reset_footer();
 | ||
| 	}		
 | ||
| }
 | ||
| 
 | ||
| print_action TStampaPerCategorie::postprocess_print(int file, int counter)
 | ||
| { 
 | ||
| 	if (_contatore > 0)
 | ||
| 	{
 | ||
| 		if (_pergruppo)
 | ||
| 			footer_gruppo();
 | ||
| 		else		
 | ||
| 			footer_sezione();
 | ||
| 	}			
 | ||
| 	if ((_tipostampa == schede) && (_schxpag > 1))
 | ||
| 		printer().formlen(_lenpage);
 | ||
| 	return NEXT_PAGE;
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::footer_sezione()
 | ||
| {
 | ||
| 	// stampa totale soggetti appartenenti alla sezione
 | ||
| 	if ((_tipostampa==etichette || _tipostampa==notiziario) && _etictot)
 | ||
| 	{                          
 | ||
| 		TPrint_section& corpo = _form_eti->get_body();
 | ||
| 		if (_tipostampa==notiziario)
 | ||
| 			corpo = _form_neti->get_body();
 | ||
|   	TPrintrow riga;
 | ||
| 		for (word i = 0; i < corpo.height(); i++)
 | ||
| 		{
 | ||
| 		  riga.reset();
 | ||
| 			if (i==0)
 | ||
| 			{
 | ||
| 			  TString80 totale = format("TOTALE %d", _contatore);
 | ||
| 		  	riga.put(totale);
 | ||
| 			}							
 | ||
| 	  	printer().print(riga);
 | ||
| 		}
 | ||
| 	}
 | ||
| 	else
 | ||
| 	{
 | ||
| 		reset_footer();
 | ||
| 		TString sep(80);
 | ||
| 		sep.fill('-');
 | ||
| 		set_footer(2, (const char *) sep);
 | ||
| 		set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
 | ||
| 		printer().formfeed(); 
 | ||
| 		reset_footer();
 | ||
| 	}		
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::header_gruppo(const TString16 gruppo)
 | ||
| {
 | ||
| 	TString intestazione(132);
 | ||
| 	intestazione = "GRUPPO AZIENDALE ";
 | ||
| 	intestazione << gruppo;
 | ||
| 	intestazione << " - ";
 | ||
| 	intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0");
 | ||
| 	if (_stampa80)
 | ||
| 		intestazione.center_just(80);
 | ||
| 	else		
 | ||
| 		intestazione.center_just(132);		
 | ||
| 	set_header(1,"@0g%s", (const char*) intestazione);
 | ||
| 	return;
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::set_page(int file, int cnt)
 | ||
| {
 | ||
| 	switch (_tipostampa)
 | ||
| 	{
 | ||
| 		case etichette:
 | ||
| 		{ 
 | ||
| 			TPrint_section& corpo = _form_eti->get_body();
 | ||
| 			for (int r=1;r<=_etcolonne;r++)
 | ||
| 			{                     
 | ||
| 				if (current_cursor()->pos()<current_cursor()->items())
 | ||
| 				{ 
 | ||
| 					bool avanza = TRUE;
 | ||
| 					while (avanza)
 | ||
| 					{
 | ||
| 						if (current_cursor()->pos()<current_cursor()->items())
 | ||
| 							avanza = !(preprocess_page(file, cnt));
 | ||
| 						else
 | ||
| 							avanza = FALSE;
 | ||
| 						if (avanza)             
 | ||
| 							++(*current_cursor());
 | ||
| 					}								
 | ||
| 					force_setpage(TRUE);
 | ||
| 				  TForm_item& cognome = corpo.find_field(ETI_COGNOME);
 | ||
| 				  cognome.set(_cognome_nome);					
 | ||
| 					corpo.update();                                                     
 | ||
| 					_contatore++;    
 | ||
| 					_netichette++;
 | ||
| 					int nriga = 1;                     
 | ||
| 					if (_etrighe > 0)
 | ||
| 					{
 | ||
| 						int resto = _netichette % (_etrighe*_etcolonne);
 | ||
| 						if (resto > 0 && resto <= _etcolonne)
 | ||
| 							nriga =	nriga+_etbordoini;
 | ||
| 					}		
 | ||
|   				for (word i = 0; i < corpo.height(); i++)
 | ||
|   				{
 | ||
|   					TPrintrow& riga = corpo.row(i);
 | ||
|   					TString256 riga1 = riga.row();
 | ||
| 						riga1.cut(_etlarghezza);
 | ||
|   					int colonna = ((r-1)*_etlarghezza);
 | ||
|   					TString16 formato;
 | ||
|   					formato << '@' << colonna << 'g';
 | ||
|   					riga1.insert(formato,0);
 | ||
|   					set_row(nriga++,riga1);
 | ||
| 					}
 | ||
| 					if (r < _etcolonne)  			
 | ||
| 					{   
 | ||
| 						bool avanza = TRUE;
 | ||
| 						while (avanza)
 | ||
| 						{
 | ||
| 							++(*current_cursor());
 | ||
| 							if (current_cursor()->pos()<current_cursor()->items())
 | ||
| 								avanza = !(preprocess_page(file, cnt));
 | ||
| 							else
 | ||
| 								avanza = FALSE;								
 | ||
| 						}								
 | ||
| 					}						
 | ||
| 				}					
 | ||
| 			}				
 | ||
| 		}
 | ||
| 		break;
 | ||
| 		case notiziario:
 | ||
| 		{ 
 | ||
| 			TPrint_section& corpo = _form_neti->get_body();
 | ||
| 			for (int r=1;r<=_etncolonne;r++)
 | ||
| 			{                     
 | ||
| 				if (current_cursor()->pos()<current_cursor()->items())
 | ||
| 				{ 
 | ||
| 					bool avanza = TRUE;
 | ||
| 					while (avanza)
 | ||
| 					{
 | ||
| 						if (current_cursor()->pos()<current_cursor()->items())
 | ||
| 							avanza = !(preprocess_page(file, cnt));
 | ||
| 						else
 | ||
| 							avanza = FALSE;
 | ||
| 						if (avanza)             
 | ||
| 							++(*current_cursor());
 | ||
| 					}								
 | ||
| 					force_setpage(TRUE);
 | ||
| 				  TForm_item& cognome = corpo.find_field(ETI_COGNOME);
 | ||
| 				  cognome.set(_cognome_nome);					
 | ||
| 					corpo.update();                                                     
 | ||
| 					_contatore++;
 | ||
|   				for (word i = 0; i < corpo.height(); i++)
 | ||
|   				{
 | ||
|   					TPrintrow& riga = corpo.row(i);
 | ||
|   					TString256 riga1 = riga.row();
 | ||
| 						riga1.cut(_etnlarghezza);
 | ||
|   					int colonna = ((r-1)*_etnlarghezza);
 | ||
|   					TString16 formato;
 | ||
|   					formato << '@' << colonna << 'g';
 | ||
|   					riga1.insert(formato,0);
 | ||
|   					set_row(i+1,riga1);
 | ||
| 					}
 | ||
| 					if (r < _etncolonne)  			
 | ||
| 					{   
 | ||
| 						bool avanza = TRUE;
 | ||
| 						while (avanza)
 | ||
| 						{
 | ||
| 							++(*current_cursor());
 | ||
| 							if (current_cursor()->pos()<current_cursor()->items())
 | ||
| 								avanza = !(preprocess_page(file, cnt));
 | ||
| 							else
 | ||
| 								avanza = FALSE;								
 | ||
| 						}								
 | ||
| 					}						
 | ||
| 				}					
 | ||
| 			}				
 | ||
| 		}
 | ||
| 		break;
 | ||
| 		case personale:
 | ||
| 		{
 | ||
| 			TPrint_section& corpo = _form_per->get_body();
 | ||
| 			force_setpage(TRUE);
 | ||
| 			corpo.update();
 | ||
| 			TString riga1;
 | ||
| 			for (word i = 0; i < corpo.height(); i++)
 | ||
| 			{
 | ||
| 				TPrintrow& riga = corpo.row(i);
 | ||
| 				riga1 = riga.row();
 | ||
| 				set_row(i+1,riga1);
 | ||
| 			}
 | ||
| 			
 | ||
| 			//force_setpage(TRUE);
 | ||
| 			//corpo.update_and_print(TRUE);
 | ||
| 		}
 | ||
| 		break;
 | ||
| 		case schede:
 | ||
| 		{
 | ||
| 			TPrint_section& corpo = _form_sch->get_body();
 | ||
| 			corpo.update_and_print(printmode_normal, TRUE);
 | ||
| 			force_setpage(TRUE);
 | ||
| 		}
 | ||
| 		break;
 | ||
| 		case cartoline:
 | ||
| 		{		
 | ||
| 			TPrint_section& corpo = _form_car->get_body();
 | ||
| 			const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);		
 | ||
| 			const TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);		
 | ||
| 			if ((_codsez!=codsez)||(_codsot!=codsot))
 | ||
| 			{
 | ||
| 				_codsez = codsez;
 | ||
| 				_codsot = codsot;
 | ||
| 				dati_sezione(codsez, codsot);
 | ||
| 				corpo.reset();
 | ||
| 			  TForm_item& intest1 = corpo.find_field(CAR_INTEST1);
 | ||
| 			  intest1.set(_intest1);
 | ||
| 			  TForm_item& intest2 = corpo.find_field(CAR_INTEST2);
 | ||
| 			  intest2.set(_intest2);
 | ||
| 			  TForm_item& intest3 = corpo.find_field(CAR_INTEST3);
 | ||
| 			  intest3.set(_intest3);
 | ||
| 			  TForm_item& intest4 = corpo.find_field(CAR_INTEST4);
 | ||
| 			  intest4.set(_intest4);
 | ||
| 			  TForm_item& invito = corpo.find_field(CAR_INVITOPER);
 | ||
| 	  		invito.set(_invitoper);
 | ||
| 			  TForm_item& data = corpo.find_field(CAR_DATA);
 | ||
| 	  		data.set(_data);
 | ||
| 			  TForm_item& presso1 = corpo.find_field(CAR_PRESSO1);
 | ||
| 	  		presso1.set(_presso1);
 | ||
| 			  TForm_item& presso2 = corpo.find_field(CAR_PRESSO2);
 | ||
| 	  		presso2.set(_presso2);
 | ||
| 			  TForm_item& presso3 = corpo.find_field(CAR_PRESSO3);
 | ||
| 	  		presso3.set(_presso3);
 | ||
| 			  TForm_item& presso4 = corpo.find_field(CAR_PRESSO4);
 | ||
| 	  		presso4.set(_presso4);
 | ||
| 			  TForm_item& orario = corpo.find_field(CAR_ORARIO);
 | ||
| 	  		orario.set(_orario);
 | ||
| 			  TForm_item& datacart = corpo.find_field(CAR_DATACART);
 | ||
| 	  		datacart.set(_datacart);
 | ||
| 			  TForm_item& note = corpo.find_field(CAR_NOTE);
 | ||
| 	  		note.set(_note);
 | ||
| 			}	  		
 | ||
| 			corpo.update();
 | ||
| 			word primariga = 0;
 | ||
| 			word ultimariga = corpo.height(); 	
 | ||
| 			if (_caxpag > 0)
 | ||
| 			{
 | ||
| 				if (_ncartoline % _caxpag == 0) // numero cartoline per pagina
 | ||
| 					primariga = _cabordoini;						// bordo iniziale
 | ||
| 				if (_ncartoline % _caxpag == _caxpag-1) // numero cartoline per pagina - 1
 | ||
| 					ultimariga -= _cabordofin;						// bordo finale
 | ||
| 			}		
 | ||
| 			int nriga = 1;
 | ||
| 			for (word i = primariga; i < ultimariga; i++)
 | ||
| 			{
 | ||
| 				TPrintrow& riga = corpo.row(i);
 | ||
| 				set_row(nriga++,riga);
 | ||
| 			}  			
 | ||
| 			force_setpage(TRUE);
 | ||
| 			_ncartoline++;
 | ||
| 		}
 | ||
| 		break;
 | ||
| 		case sintetico:
 | ||
| 		{
 | ||
| 			if (_stampa80)
 | ||
| 			{
 | ||
| 				set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
 | ||
| 				set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
 | ||
| 				set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON));
 | ||
| 				set_row(1,"@9g#a", &_cognome_nome);
 | ||
| 				set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
 | ||
| 				set_row(1,"@35g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
 | ||
| 				set_row(2,"@35g#a", &_dencom);
 | ||
| 				set_row(1,"@67g@S", FLD(LF_SOGGETTI,SOG_TELABI));
 | ||
| 				set_row(2,"@67g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
 | ||
| 				set_row(3,"@67g@S", FLD(LF_SOGGETTI,SOG_TELALT));
 | ||
| 				set_row(4,"");
 | ||
| 			}				
 | ||
| 			else
 | ||
| 			{
 | ||
| 				set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
 | ||
| 				set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
 | ||
| 				set_row(1,"@12g#a", &_cognome_nome);
 | ||
| 				set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
 | ||
| 				set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
 | ||
| 				set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI));
 | ||
| 				set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
 | ||
| 				set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
 | ||
| 				set_row(2,"@49g#a", &_dencom);
 | ||
| 				set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
 | ||
| 				set_row(3,"");
 | ||
| 			}				
 | ||
| 		}
 | ||
| 		break;					
 | ||
| 		case completo:
 | ||
| 		{
 | ||
| 			if (_stampa80)
 | ||
| 			{
 | ||
| 				set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
 | ||
| 				set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
 | ||
| 				set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON));
 | ||
| 
 | ||
| 				set_row(1,"@9g@S",FLD(LF_SOGGETTI,SOG_COGNOME));
 | ||
| 				set_row(2,"@9g@S",FLD(LF_SOGGETTI,SOG_NOME));
 | ||
| 				set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
 | ||
| 				set_row(4,"@9g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
 | ||
| 				set_row(5,"@9g#a", &_dencom);
 | ||
| 	
 | ||
| 				set_row(1,"@40g@S", FLD(LF_SOGGETTI,SOG_TELABI));
 | ||
| 				set_row(2,"@40g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
 | ||
| 				set_row(3,"@40g@S", FLD(LF_SOGGETTI,SOG_TELALT));
 | ||
| 				set_row(4,"@40g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAZIE));
 | ||
| 				set_row(5,"@40g@S", FLD(LF_SOGGETTI,SOG_PROFESS));
 | ||
| 	
 | ||
| 				set_row(1,"@56gGr @S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
 | ||
| 				set_row(2,"@56gRh @S", FLD(LF_SOGGETTI,SOG_RHANTID));
 | ||
| 				set_row(3,"@56gFe @S", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
 | ||
| 				set_row(4,"@56gKe @S", FLD(LF_SOGGETTI,SOG_KELL));
 | ||
| 				set_row(5,"@56gDu @S", FLD(LF_SOGGETTI,SOG_DU));
 | ||
| 
 | ||
| 				set_row(1,"@66g@S", FLD(LF_SOGGETTI,SOG_DATAULTDON));
 | ||
| 				set_row(2,"@70g@n", FLD(LF_SOGGETTI,SOG_TOTDON));
 | ||
| 				set_row(3,"@66g@S", FLD(LF_SOGGETTI,SOG_DATAISC));
 | ||
| 				set_row(4,"@66g#a", &_benemerenza);
 | ||
| 	
 | ||
| 				set_row(1,"@77g@S", FLD(LF_SOGGETTI,SOG_STATO));
 | ||
| 				set_row(2,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON1));
 | ||
| 				set_row(3,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON2));
 | ||
| 				set_row(4,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON3));
 | ||
| 				set_row(5,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON4));
 | ||
| 				
 | ||
| 				set_row(1,"@80g@pn", FLD(LF_SOGGETTI,SOG_INTSI,"###"));
 | ||
| 				set_row(2,"@80g@pn", FLD(LF_SOGGETTI,SOG_INTAF,"###"));
 | ||
| 				
 | ||
| 				set_row(6,"");
 | ||
| 			}
 | ||
| 			else				
 | ||
| 			{
 | ||
| 				set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
 | ||
| 				set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
 | ||
| 				set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON));
 | ||
| 
 | ||
| 				set_row(1,"@9g@S",FLD(LF_SOGGETTI,SOG_COGNOME));
 | ||
| 				set_row(2,"@9g@S",FLD(LF_SOGGETTI,SOG_NOME));
 | ||
| 				set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
 | ||
| 				set_row(4,"@9g@S", FLD(-ALIAS_COMNAS,COM_DENCOM));
 | ||
| 				
 | ||
| 				set_row(1,"@35g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
 | ||
| 				set_row(2,"@35g#a", &_dencom);
 | ||
| 	
 | ||
| 				set_row(1,"@66g@S", FLD(LF_SOGGETTI,SOG_TELABI));
 | ||
| 				set_row(2,"@66g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
 | ||
| 				set_row(3,"@66g@S", FLD(LF_SOGGETTI,SOG_TELALT));
 | ||
| 				set_row(4,"@66g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAZIE));
 | ||
| 				set_row(5,"@66g@S", FLD(LF_SOGGETTI,SOG_PROFESS));
 | ||
| 	
 | ||
| 				set_row(1,"@82gGr @S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
 | ||
| 				set_row(2,"@82gRh @S", FLD(LF_SOGGETTI,SOG_RHANTID));
 | ||
| 				set_row(3,"@82gFe @S", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
 | ||
| 				set_row(4,"@82gKe @S", FLD(LF_SOGGETTI,SOG_KELL));
 | ||
| 				set_row(5,"@82gDu @S", FLD(LF_SOGGETTI,SOG_DU));
 | ||
| 	
 | ||
| 				set_row(1,"@94g@S", FLD(LF_SOGGETTI,SOG_STATO));
 | ||
| 				set_row(2,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON1));
 | ||
| 				set_row(3,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON2));
 | ||
| 				set_row(4,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON3));
 | ||
| 				set_row(5,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON4));
 | ||
| 
 | ||
| 				set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_DATAULTDON));
 | ||
| 				set_row(2,"@100g@n", FLD(LF_SOGGETTI,SOG_TOTDON));
 | ||
| 				set_row(3,"@98g@S", FLD(LF_SOGGETTI,SOG_DATAISC));
 | ||
| 				set_row(4,"@98g#a", &_benemerenza);
 | ||
| 
 | ||
| 				set_row(1,"@109g@pn", FLD(LF_SOGGETTI,SOG_INTSI,"###"));
 | ||
| 				set_row(2,"@109g@pn", FLD(LF_SOGGETTI,SOG_INTAF,"###"));
 | ||
| 				
 | ||
| 				set_row(6,"");
 | ||
| 			}			
 | ||
| 		}
 | ||
| 		break;					
 | ||
| 	}	
 | ||
| }
 | ||
| 
 | ||
| bool TStampaPerCategorie::filter_func_percat(const TRelation* rel)
 | ||
| {   
 | ||
| 	bool filtrato = FALSE;
 | ||
| 	TLocalisamfile& sog = rel->lfile();
 | ||
| 	// filtro per categorie donatori
 | ||
| 	TAssoc_array& categorie = app()._catdon;
 | ||
| 	if (categorie.items() != 0)
 | ||
| 	{
 | ||
| 		const TString& cat = sog.get(SOG_CATDON);
 | ||
| 		filtrato = categorie.is_key(cat);
 | ||
| 	}	
 | ||
| 	if (!filtrato)
 | ||
| 	{	
 | ||
| 		// filtro per categorie non donatori
 | ||
| 		TAssoc_array& categorie = app()._catnondon;
 | ||
| 		if (categorie.items() != 0)
 | ||
| 		{
 | ||
| 			const TString16 cat1 = sog.get(SOG_CATNOND1);
 | ||
| 			const TString16 cat2 = sog.get(SOG_CATNOND2);			
 | ||
| 			filtrato = (categorie.is_key((const char*) cat1) || categorie.is_key((const char*) cat2)) ;
 | ||
| 		}	
 | ||
| 	}		
 | ||
| 	// se non ho selezionato categorie il soggetto va filtrato comunque
 | ||
| 	if (app()._catdon.items() == 0 && app()._catnondon.items() == 0)
 | ||
| 		filtrato = TRUE;
 | ||
| 	// filtro per iniziale cognome		
 | ||
| 	if (filtrato && ((!app()._lettini.blank()) || (!app()._lettfin.blank())))
 | ||
| 	{
 | ||
| 		TString80 cognome = sog.get(SOG_COGNOME);
 | ||
| 		int leni = app()._lettini.len();
 | ||
| 		TString16 cognomei = cognome.left(leni);
 | ||
| 		int lenf = app()._lettfin.len();
 | ||
| 		TString16 cognomef = cognome.left(lenf);
 | ||
| 		if (!(cognomei >= app()._lettini && cognomef <= app()._lettfin))
 | ||
| 			filtrato = FALSE;
 | ||
| 	}		
 | ||
|   return filtrato;
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::header_sezione(const TString16 codsez, const TString16 codsot)
 | ||
| {
 | ||
| 	const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
 | ||
| 	const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
 | ||
| 	TString intestazione(132);
 | ||
| 	intestazione = "Sezione: ";
 | ||
| 	intestazione << codsez;
 | ||
| 	if (!codsot.blank())
 | ||
| 	{
 | ||
| 		intestazione << '/';
 | ||
| 		intestazione << codsot;
 | ||
| 	}		
 | ||
| 	intestazione << ' ';
 | ||
| 	intestazione << densez;
 | ||
| 	if (!densot.blank() && !codsot.blank())
 | ||
| 	{
 | ||
| 		intestazione << '/';
 | ||
| 		intestazione << densot;
 | ||
| 	}		
 | ||
| 	if (_stampa80)
 | ||
| 		intestazione.center_just(80);
 | ||
| 	else		
 | ||
| 		intestazione.center_just(132);		
 | ||
| 	set_header(1,"@0g%s", (const char*) intestazione);
 | ||
| 	return;
 | ||
| }
 | ||
| 
 | ||
| bool TStampaPerCategorie::filepers_put(const char* nomecampo, const char* valore)
 | ||
| {
 | ||
| 	TRectype& curr_rec = _filepers->curr();
 | ||
| 	if (!curr_rec.exist(nomecampo))
 | ||
| 		return false;
 | ||
| 
 | ||
| 	curr_rec.put(nomecampo, valore);
 | ||
| 	return true;
 | ||
| }
 | ||
| 
 | ||
| bool TStampaPerCategorie::preprocess_page(int file, int counter)
 | ||
| {
 | ||
| 	TRectype& recsog = current_cursor()->curr();
 | ||
| 	if (_tipostampa==sintetico||_tipostampa==completo)
 | ||
| 	{
 | ||
| 		TString80 nome = recsog.get(SOG_COGNOME);
 | ||
| 		nome << ' ';
 | ||
| 		nome << recsog.get(SOG_NOME);
 | ||
| 		_cognome_nome = nome;
 | ||
| 		TString256 localita = "";
 | ||
| 		localita << recsog.get(SOG_DOM_CAP);
 | ||
| 		localita << " ";
 | ||
| 		if (!recsog.get(SOG_DOM_CODLOC).blank())
 | ||
| 			localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
 | ||
| 		else
 | ||
| 			localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
 | ||
| 		localita << ' ' << current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
 | ||
| 		localita.trim();
 | ||
| 		_dencom = localita;
 | ||
| 		// cerco ultima benemerenza
 | ||
| 		TString80 benemerenza = "";   
 | ||
| 		const long codice = recsog.get_long(SOG_CODICE);
 | ||
| 
 | ||
| 		TRectype key = TRectype(LF_BENEM);
 | ||
| 
 | ||
| 		key.put(BEN_CODICE,codice);
 | ||
| 		const int err = _sbenemerenze->read(key);
 | ||
| 		if (err == NOERR)
 | ||
| 		{                                   
 | ||
| 			const int ultima = _sbenemerenze->rows();
 | ||
| 			if (ultima != 0)
 | ||
| 			{
 | ||
| 				//sorting delle benemerenze (necessario in quanto alcuni stupidissimi volontari sono riusciti a mettere le benemerenze..
 | ||
| 				//..in ordine sparso!!!
 | ||
| 				_sbenemerenze->sort(compare_benem);
 | ||
| 
 | ||
| 				const TString16 codben = _sbenemerenze->row(ultima).get(BEN_TIPOBEN);
 | ||
| 				benemerenza << cache().get("BNZ", codben).get("S0");
 | ||
| 			}			
 | ||
| 	  }
 | ||
| 	  benemerenza.cut(21);
 | ||
| 	  _benemerenza = benemerenza;
 | ||
| 	}
 | ||
| 	// salto pagina se cambio sezione o gruppo aziendale
 | ||
| 	if (_tipostampa==sintetico || _tipostampa==completo || _tipostampa==personale)
 | ||
| 	{
 | ||
| 		if (_pergruppo)
 | ||
| 		{
 | ||
| 			TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE);		
 | ||
| 			if (grupponew != _gruppoold )
 | ||
| 			{
 | ||
| 				if (_gruppoold != "**")
 | ||
| 					footer_gruppo();
 | ||
| 				_contatore = 0;				
 | ||
| 				_gruppoold = grupponew;
 | ||
| 				header_gruppo(grupponew);
 | ||
| 			}
 | ||
| 		}
 | ||
| 		else
 | ||
| 		{
 | ||
| 			const TString16 codsez = recsog.get(SOG_CODSEZ);		
 | ||
| 			const TString16 codsot = recsog.get(SOG_CODSOT);		
 | ||
| 			if ((_codsez!=codsez)||((_codsot!=codsot) && (!_nosottogruppo)))
 | ||
| 			{
 | ||
| 				if (_codsez != "**")
 | ||
| 					footer_sezione();
 | ||
| 				_contatore = 0;					
 | ||
| 				_codsez = codsez;
 | ||
| 				_codsot = codsot;
 | ||
| 				if (_nosottogruppo)
 | ||
| 					header_sezione(codsez, "  ");
 | ||
| 				else	
 | ||
| 					header_sezione(codsez, codsot);
 | ||
| 			}
 | ||
| 		}
 | ||
| 		if (((_tipostampa==sintetico) && ((_stampa80 && printer().rows_left()<4) || (printer().rows_left()<3))) || (printer().rows_left()<6 && _tipostampa==completo))
 | ||
| 			printer().formfeed();
 | ||
| 	}	  
 | ||
| 	if (_tipostampa==etichette && _etrighe == 0)		
 | ||
| 		if (printer().rows_left() < _form_eti->get_body().height())
 | ||
| 			printer().formfeed();
 | ||
| 	if (_tipostampa==notiziario && _etrighe == 0)		
 | ||
| 		if (printer().rows_left() < _form_neti->get_body().height())
 | ||
| 			printer().formfeed();
 | ||
| 	if (_perfamiglie)
 | ||
| 	{
 | ||
| 		TRectype& recfam = current_cursor()->curr(LF_FAMIGLIE);
 | ||
| 		const long codice = recsog.get_long(SOG_CODICE);
 | ||
| 		const long codsufam = recfam.get_long(FAM_CODFAM);
 | ||
| 		const int rigafamsog = recfam.get_int(FAM_PROGFAM);
 | ||
| 		if ( codsufam == codice)
 | ||
| 		{
 | ||
| 			TRectype key = TRectype(LF_FAMIGLIE);
 | ||
| 			key.put(FAM_FAMIGLIA, recfam.get_long(FAM_FAMIGLIA));
 | ||
| 			const int err = _sfamiglia->read(key);
 | ||
| 			if (err == NOERR)
 | ||
| 			{
 | ||
| 				TRecnotype pos = current_cursor()->pos();
 | ||
| 				// controllo se qualcuno che lo precede nella famiglia rientra
 | ||
| 				// nella selezione, in questo caso ho gia' stampato la famiglia
 | ||
| 				// che viene stampata quando incontro il primo componente che
 | ||
| 				// rientra nella famiglia
 | ||
| 				// se non l'ho ancora stampato, accodo tutti i nominativi
 | ||
| 				// della famiglia e stampo    
 | ||
| 				bool dastampare=TRUE;
 | ||
| 				for (int r=1; r<=_sfamiglia->rows(); r++)
 | ||
| 				{
 | ||
| 					const TRectype& riga = _sfamiglia->row(r);
 | ||
| 					long codfam = riga.get_long(FAM_CODFAM);
 | ||
| 					if (!(codice == codfam))
 | ||
| 					{                                                  
 | ||
| 						TLocalisamfile sog(LF_SOGGETTI);
 | ||
| 						sog.setkey(1);
 | ||
| 						sog.put(SOG_CODICE, codfam);
 | ||
| 						if (sog.read() == NOERR)
 | ||
| 						{
 | ||
| 							current_cursor()->curr().put(SOG_CODSEZ, sog.get(SOG_CODSEZ));
 | ||
| 							current_cursor()->curr().put(SOG_CODSOT, sog.get(SOG_CODSOT));
 | ||
| 							current_cursor()->curr().put(SOG_COGNOME, sog.get(SOG_COGNOME));
 | ||
| 							current_cursor()->curr().put(SOG_NOME, sog.get(SOG_NOME));
 | ||
| 							current_cursor()->curr().put(SOG_DATANASC, sog.get(SOG_DATANASC));
 | ||
| 							if (current_cursor()->test() == NOERR)
 | ||
| 								if (r < rigafamsog)
 | ||
| 									dastampare = FALSE;
 | ||
| 						}									
 | ||
| 					}						
 | ||
| 				}
 | ||
| 				//current_cursor()->restore_status();				
 | ||
| 				if (dastampare)
 | ||
| 				{                         
 | ||
| 					TString256 cognome = "";
 | ||
| 					for (int r=1; r<=_sfamiglia->rows(); r++)
 | ||
| 					{
 | ||
| 						const TRectype& riga = _sfamiglia->row(r);
 | ||
| 						long codfam = riga.get_long(FAM_CODFAM);
 | ||
| 						if (codice == codfam)
 | ||
| 						{
 | ||
| 							TLocalisamfile sog(LF_SOGGETTI);
 | ||
| 							sog.setkey(1);
 | ||
| 							sog.put(SOG_CODICE, codfam);
 | ||
| 							if (sog.read() == NOERR)
 | ||
| 							{
 | ||
| 								cognome << sog.get(SOG_COGNOME);
 | ||
| 								cognome << " ";
 | ||
| 								cognome << sog.get(SOG_NOME);
 | ||
| 							}								
 | ||
| 						}							
 | ||
| 						else						
 | ||
| 						{                             
 | ||
| 							TLocalisamfile sog(LF_SOGGETTI);
 | ||
| 							sog.setkey(1);
 | ||
| 							sog.put(SOG_CODICE, codfam);
 | ||
| 							if (sog.read() == NOERR)
 | ||
| 							{
 | ||
| 								current_cursor()->curr().put(SOG_CODSEZ, sog.get(SOG_CODSEZ));
 | ||
| 								current_cursor()->curr().put(SOG_CODSOT, sog.get(SOG_CODSOT));
 | ||
| 								current_cursor()->curr().put(SOG_COGNOME, sog.get(SOG_COGNOME));
 | ||
| 								current_cursor()->curr().put(SOG_NOME, sog.get(SOG_NOME));
 | ||
| 								current_cursor()->curr().put(SOG_DATANASC, sog.get(SOG_DATANASC));
 | ||
| 								if (current_cursor()->test() == NOERR)
 | ||
| 								{                   
 | ||
| 									//TLocalisamfile soggetti(LF_SOGGETTI);
 | ||
| 									//soggetti.setkey(1);
 | ||
| 									//soggetti.put(SOG_CODICE, codfam);
 | ||
| 									sog.put(SOG_CODICE, codfam);
 | ||
| 									if (sog.read() == NOERR)
 | ||
| 									{
 | ||
| 										cognome << ", ";
 | ||
| 										cognome << sog.get(SOG_COGNOME);
 | ||
| 										cognome << " ";
 | ||
| 										cognome << sog.get(SOG_NOME);							
 | ||
| 									}									
 | ||
| 								}
 | ||
| 							}						
 | ||
| 						}					
 | ||
| 						_cognome_nome = cognome;
 | ||
| 					}
 | ||
| 				}	
 | ||
| 				(*current_cursor()) = pos;				
 | ||
| 				if (!dastampare)
 | ||
| 					return FALSE;
 | ||
| 			}
 | ||
| 		} 
 | ||
| 		else
 | ||
| 		{
 | ||
| 			TString80 cognome= "";
 | ||
| 			cognome << recsog.get(SOG_COGNOME);
 | ||
| 			cognome << " ";
 | ||
| 			cognome << recsog.get(SOG_NOME);
 | ||
| 			_cognome_nome = cognome;
 | ||
| 		}
 | ||
| 	}	
 | ||
| 	else
 | ||
| 	{
 | ||
| 		TString80 cognome= "";
 | ||
| 		cognome << recsog.get(SOG_COGNOME);
 | ||
| 		cognome << " ";
 | ||
| 		cognome << recsog.get(SOG_NOME);
 | ||
| 		_cognome_nome = cognome;
 | ||
| 	}
 | ||
| 	if (_tipostampa==stampasufile)
 | ||
| 	{
 | ||
| 		_file->zero();
 | ||
| 		if (_perfamiglie)
 | ||
| 			_file->put("NOMINATIVO", _cognome_nome); 
 | ||
| 		else
 | ||
| 		{
 | ||
| 			_file->put("CODICE",recsog.get(SOG_CODICE)); 
 | ||
| 			_file->put("COGNOME",recsog.get(SOG_COGNOME)); 
 | ||
| 			_file->put("NOME",recsog.get(SOG_NOME)); 
 | ||
| 		}
 | ||
| 		_file->put("DATANASC", recsog.get_date(SOG_DATANASC));
 | ||
| 		_file->put("SPOSATA",recsog.get(SOG_COGNOME_SP)); 
 | ||
| 		_file->put("INDIRIZZO",recsog.get(SOG_DOM_INDIR)); 
 | ||
| 		_file->put("PRESSO",recsog.get(SOG_DOM_DISTRI)); 
 | ||
| 		_file->put("STRADARIO",recsog.get(SOG_DOM_STRADA)); 
 | ||
| 		TString80 localita = "";
 | ||
| 		localita << recsog.get(SOG_DOM_CAP);
 | ||
| 		localita << ' ';
 | ||
| 		if (recsog.get(SOG_DOM_CODLOC).not_empty())
 | ||
| 			localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
 | ||
| 		else
 | ||
| 			localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
 | ||
| 		localita << ' ' << current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
 | ||
| 		localita.trim();
 | ||
| 		_file->put("LOCALITA",localita); 
 | ||
| 		_file->write();	
 | ||
| 		do_events();	
 | ||
| 	}	
 | ||
| 	if (_tipostampa==filepers)
 | ||
| 	{
 | ||
| 		_filepers->zero();
 | ||
| 		filepers_put("ASSOCIAZ", current_cursor()->curr(LF_SEZIONI).get("DENSEZ"));
 | ||
| 		filepers_put("DATANASC",recsog.get(SOG_DATANASC)); 
 | ||
| 		filepers_put("CATDON",recsog.get(SOG_CATDON)); 
 | ||
| 		filepers_put("TESSAVIS",recsog.get(SOG_TESSAVIS)); 
 | ||
| 		filepers_put("GRUPPOAB0",recsog.get(SOG_GRUPPOAB0)); 
 | ||
| 		filepers_put("KELL",recsog.get(SOG_KELL)); 
 | ||
| 		filepers_put("RHANTID",recsog.get(SOG_RHANTID));
 | ||
| 		const char* sesso = recsog.get(SOG_SESSO)[0] =='1' ? "M" : "F";
 | ||
| 		filepers_put("SESSO", sesso); 
 | ||
| 		filepers_put("COGNOME",recsog.get(SOG_COGNOME)); 
 | ||
| 		filepers_put("NOME",recsog.get(SOG_NOME)); 
 | ||
| 		filepers_put("INDIRIZZO",recsog.get(SOG_DOM_INDIR)); 
 | ||
| 		filepers_put("CAP",recsog.get(SOG_DOM_CAP)); 
 | ||
| 		TString80 localita = "";
 | ||
| 		if (recsog.get(SOG_DOM_CODLOC).not_empty())
 | ||
| 			localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
 | ||
| 		else
 | ||
| 			localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
 | ||
| 		localita << ' ' << current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM);
 | ||
| 		localita.trim();
 | ||
| 		filepers_put("LOCALITA",localita);
 | ||
| 
 | ||
|     filepers_put("TELABI", recsog.get(SOG_TELABI));
 | ||
|     filepers_put("TELLAV", recsog.get(SOG_TELLAV));
 | ||
|     filepers_put("TELALT", recsog.get(SOG_TELALT));
 | ||
| 
 | ||
| 		_filepers->write();	
 | ||
| 		do_events();	
 | ||
| 	}	
 | ||
| 	if (_tipostampa!=etichette && _tipostampa!=notiziario)
 | ||
| 		_contatore++;
 | ||
|   return TRUE;
 | ||
| }
 | ||
| 
 | ||
| bool TStampaPerCategorie::set_print(int m)
 | ||
| {
 | ||
|   TPrinter& p = printer();
 | ||
| 	p.read_configuration();
 | ||
| 	_tipostampa = undefined;
 | ||
|   KEY tasto;
 | ||
|   tasto = _msk->run();
 | ||
|   switch (tasto)
 | ||
|   {
 | ||
| 	  case F_SINTETICO:
 | ||
| 	  	_tipostampa=sintetico;
 | ||
| 	 	break;
 | ||
| 	  case F_COMPLETO:
 | ||
| 	  	_tipostampa=completo;
 | ||
| 	 	break;
 | ||
| 	  case F_PERSONALE:
 | ||
| 	  	_tipostampa=personale;
 | ||
| 	 	break;
 | ||
| 	  case F_SCHEDE:
 | ||
| 	  	_tipostampa=schede;
 | ||
| 			if (_schxpag > 1)	  	
 | ||
| 	  		printer().formlen(_lenpage/_schxpag);
 | ||
| 	 	break;
 | ||
| 	  case F_ETICHETTE:
 | ||
| 	  {
 | ||
| 			if (_msk->get_bool(F_NOTIZIARIO))
 | ||
| 	  		_tipostampa = (configura_stampante(p, "AT_NOTIZIARIO", "et. notiziario")) ? notiziario : undefined;
 | ||
| 	  	else
 | ||
| 	  		_tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined;
 | ||
| 		}	  		
 | ||
| 	  break;
 | ||
| 	  case F_CARTOLINE:
 | ||
|   		_tipostampa = (configura_stampante(p, "AT_CARTOLINE", "cartoline")) ? dati_cartolina() : undefined;
 | ||
| 	  break;
 | ||
| 	  case F_FILE:        
 | ||
| 	  {
 | ||
| 	  	_tipostampa=stampasufile;
 | ||
| 	  	//operazione aggiunta da Marco il 04/11/99 per svuotare il contenuto del file prima di riempirlo nuovamente
 | ||
| 	  	if (yesno_box("Azzerare il contenuto del file prima dell'elaborazione?"))
 | ||
| 				_file->zap();
 | ||
| 	  }	
 | ||
| 	  break;
 | ||
| 	  case F_FILEPERS:        
 | ||
| 	  {              
 | ||
| 	  	if (_filepers == NULL)
 | ||
| 				message_box("Manca il file di destinazione: opzione non selezionabile");
 | ||
| 	  	else         
 | ||
| 	  	{
 | ||
| 	  		_tipostampa=filepers;
 | ||
| 	  		if (yesno_box("Azzerare il contenuto del file prima dell'elaborazione?"))
 | ||
| 					_filepers->zap();
 | ||
| 			}	
 | ||
| 	  }	
 | ||
| 	  break;
 | ||
|   }	
 | ||
| 	if (_tipostampa != undefined)
 | ||
|   {                                        
 | ||
|   	if (_tipostampa == cartoline)
 | ||
|   		dati_cartolina();
 | ||
| 		if (_tipostampa==etichette || _tipostampa==notiziario || _tipostampa==stampasufile)
 | ||
| 			_cognome_nome.set_width(200);  		
 | ||
|   	_codsez = "**";
 | ||
|   	_codsot = "**";
 | ||
| 		_gruppoold = "**"; 
 | ||
| 		_contatore = 0; 
 | ||
| 		_netichette = 0;
 | ||
| 		_ncartoline  = 0;
 | ||
|   	TString256 chiave = "";
 | ||
|   	_pergruppo = _msk->get_bool(F_PERGRUPPO);
 | ||
|   	_perfamiglie = _msk->get_bool(F_PERFAMIGLIE);
 | ||
|   	_nosottogruppo = _msk->get_bool(F_NOSOTTOGRUPPO);
 | ||
| 		bool percap = _msk->get_bool(F_PERCAP);
 | ||
| 		_capini = _msk->get(F_CAPINI);
 | ||
| 		_capfin = _msk->get(F_CAPFIN);
 | ||
| 		_lettini = _msk->get(F_LETTINI);
 | ||
| 		_lettini.left(15);
 | ||
| 		_lettfin = _msk->get(F_LETTFIN);
 | ||
| 		_lettfin.left(15);
 | ||
| 		if (_lettfin.blank())
 | ||
| 			_lettfin = "ZZZZZZZZZZZZZZZ";
 | ||
|   	if (_pergruppo)
 | ||
|   	{
 | ||
|   		_gruppoazie = _msk->get(F_GRUPPOAZIE);
 | ||
| 			if (_gruppoazie.empty())  		
 | ||
|   			chiave << "90->GRUPPOAZIE|";
 | ||
| 		}  		
 | ||
| 		if (percap)
 | ||
| 			chiave << "90->DOM_CAP|90->DOM_CODCOM|90->DOM_CODLOC|UPPER(90->COGNOME)|UPPER(90->NOME)";
 | ||
| 		else
 | ||
| 		{	
 | ||
| 			if (_pergruppo)
 | ||
| 				chiave << "UPPER(90->COGNOME)|UPPER(90->NOME)";						
 | ||
| 			else
 | ||
| 			{
 | ||
| 				if (_nosottogruppo)
 | ||
| 					chiave << "90->CODSEZ|UPPER(90->COGNOME)|UPPER(90->NOME)";
 | ||
| 				else
 | ||
| 					chiave << "90->CODSEZ|90->CODSOT|UPPER(90->COGNOME)|UPPER(90->NOME)";
 | ||
| 			}	
 | ||
| 		}			
 | ||
|   	TString256 filtro = "";
 | ||
|   	if (_pergruppo)
 | ||
|   	{ 	
 | ||
|   		if (_gruppoazie.not_empty())
 | ||
| 	  		filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
 | ||
| 			else	  		
 | ||
| 	  		filtro.format("(90->GRUPPOAZIE != \"\")");
 | ||
| 		}	  		
 | ||
| 		if (_capini.not_empty())
 | ||
| 		{
 | ||
| 			if (filtro.not_empty())
 | ||
| 				filtro << " && ";
 | ||
| 			filtro << format("(90->DOM_CAP >= \"%s\")",(const char*)_capini);
 | ||
| 		}		  	
 | ||
| 		if (_capfin.not_empty())
 | ||
| 		{
 | ||
| 			if (filtro.not_empty())
 | ||
| 				filtro << " && ";
 | ||
| 			filtro << format("(90->DOM_CAP <= \"%s\")",(const char*)_capfin);
 | ||
| 		}		  	
 | ||
| 		if ((_tipostampa==notiziario) || _msk->get_bool(F_NOTIZIARIO))
 | ||
| 		{
 | ||
| 			if (filtro.not_empty())
 | ||
| 				filtro << " && ";
 | ||
| 			filtro << "(90->NOTIZIARIO == \"X\")";
 | ||
| 		}	
 | ||
| 	 	const TString16 sezini = _msk->get(F_SEZINI);
 | ||
| 	 	const TString16 sotini = _msk->get(F_SOTINI);
 | ||
| 	 	const TString16 sezfin = _msk->get(F_SEZFIN);
 | ||
| 	 	const TString16 sotfin = _msk->get(F_SOTFIN);
 | ||
| 	  TRectype da(LF_SOGGETTI);
 | ||
| 	  TRectype a(LF_SOGGETTI);   
 | ||
| 		if (sezini.not_empty())  
 | ||
| 			da.put(SOG_CODSEZ, sezini);
 | ||
| 	  if (sotini.not_empty())
 | ||
| 			da.put(SOG_CODSOT, sotini);
 | ||
| 	  if (sezfin.not_empty())
 | ||
| 			a.put(SOG_CODSEZ, sezfin);
 | ||
| 	  if (sotfin.not_empty())
 | ||
| 			a.put(SOG_CODSOT, sotfin);
 | ||
| 		current_cursor()->setregion(da, a);
 | ||
| 		current_cursor()->setfilter(filtro, FALSE);
 | ||
| 		((TSorted_cursor*)current_cursor())->change_order(chiave);
 | ||
|     reset_files(); 
 | ||
|     add_file(LF_SOGGETTI);
 | ||
|     _catdon.destroy();
 | ||
| 	  const TString16 catpri = _msk->get(F_CAT1);
 | ||
| 	  const TString16 catsec = _msk->get(F_CAT2);
 | ||
| 	  const TString16 catter = _msk->get(F_CAT3);
 | ||
| 	  const TString16 catqua = _msk->get(F_CAT4);
 | ||
| 	  const TString16 catqui = _msk->get(F_CAT5);
 | ||
| 	  const TString16 catses = _msk->get(F_CAT6);
 | ||
| 	  const TString16 catset = _msk->get(F_CAT7);
 | ||
| 	  const TString16 catott = _msk->get(F_CAT8);
 | ||
| 	  if (catpri.not_empty())
 | ||
| 	  	_catdon.add((const char*) catpri);
 | ||
| 	  if (catsec.not_empty())
 | ||
| 	  	_catdon.add((const char*) catsec);
 | ||
| 	  if (catter.not_empty())
 | ||
| 	  	_catdon.add((const char*) catter);
 | ||
| 	  if (catqua.not_empty())
 | ||
| 	  	_catdon.add((const char*) catqua);
 | ||
| 	  if (catqui.not_empty())
 | ||
| 	  	_catdon.add((const char*) catqui);
 | ||
| 	  if (catses.not_empty())
 | ||
| 	  	_catdon.add((const char*) catses);
 | ||
| 	  if (catset.not_empty())
 | ||
| 	  	_catdon.add((const char*) catset);
 | ||
| 	  if (catott.not_empty())
 | ||
| 	  	_catdon.add((const char*) catott);
 | ||
|   	_catnondon.destroy();
 | ||
| 	  const TString16 catnpri = _msk->get(F_CATN1);
 | ||
| 	  const TString16 catnsec = _msk->get(F_CATN2);
 | ||
| 	  const TString16 catnter = _msk->get(F_CATN3);
 | ||
| 	  const TString16 catnqua = _msk->get(F_CATN4);
 | ||
| 	  const TString16 catnqui = _msk->get(F_CATN5);
 | ||
| 	  const TString16 catnses = _msk->get(F_CATN6);
 | ||
| 	  if (catnpri.not_empty())
 | ||
| 	  	_catnondon.add((const char*) catnpri);
 | ||
| 	  if (catnsec.not_empty())
 | ||
| 	  	_catnondon.add((const char*) catnsec);
 | ||
| 	  if (catnter.not_empty())
 | ||
| 	  	_catnondon.add((const char*) catnter);
 | ||
| 	  if (catnqua.not_empty())
 | ||
| 	  	_catnondon.add((const char*) catnqua);
 | ||
| 	  if (catnqui.not_empty())
 | ||
| 	  	_catnondon.add((const char*) catnqui);
 | ||
| 	  if (catnses.not_empty())
 | ||
| 	  	_catnondon.add((const char*) catnses);
 | ||
| 		current_cursor()->set_filterfunction (filter_func_percat, FALSE);
 | ||
| 		if (_perfamiglie)
 | ||
| 		{
 | ||
| 		  TConfig config(CONFIG_STUDIO);
 | ||
| 		  TString16 etformato = config.get("EtFFormato");
 | ||
| 		  _etlarghezza = config.get_int("EtFLarghezza");
 | ||
| 		  _etcolonne = config.get_int("EtFColonne");
 | ||
| 		  _etrighe = config.get_int("EtFRighe");
 | ||
| 		  _etbordoini = config.get_int("EtFBordoIni"); 
 | ||
| 		  _etbordofin = config.get_int("EtFBordoFin"); 
 | ||
| 		  delete _form_eti;
 | ||
| 			_form_eti = new TEti_percat_form(etformato);
 | ||
|     }
 | ||
| 		reset_print();
 | ||
| 		printer().footerlen(0);		
 | ||
|     crea_intestazione();
 | ||
|     return TRUE;
 | ||
|   }
 | ||
|   else
 | ||
|     return FALSE;
 | ||
| }
 | ||
| 
 | ||
| void TStampaPerCategorie::crea_intestazione()
 | ||
| {
 | ||
|   reset_header();
 | ||
|  	TString sep(132);
 | ||
|   if (_tipostampa==sintetico)
 | ||
| 	 	sep = "ELENCO SINTETICO PER CATEGORIE";
 | ||
|   if (_tipostampa==completo)
 | ||
| 	 	sep = "ELENCO COMPLETO PER CATEGORIE";
 | ||
| 	if (_tipostampa==sintetico || _tipostampa==completo)	  	
 | ||
| 	{ 
 | ||
|   	printer().footerlen(3);
 | ||
| 
 | ||
| 		if (_stampa80)
 | ||
| 			sep.center_just(80);
 | ||
| 		else			
 | ||
| 			sep.center_just(132);
 | ||
|   	set_header(2, "@0g%s", (const char*) sep);
 | ||
|   	TString16 data_stampa = _data_stampa.string();
 | ||
|   	set_header(2,"@0g%10s", (const char*) data_stampa);
 | ||
|   	sep = "";
 | ||
|   	sep << "Pag. @#";
 | ||
|   	if (_stampa80)
 | ||
|   		set_header(2, "@73g%s", (const char*) sep);  
 | ||
| 		else  		
 | ||
| 			set_header(2, "@110g%s", (const char*) sep);  		
 | ||
|   	sep = "";
 | ||
|   	sep.fill('-');
 | ||
| 		if (_stampa80)
 | ||
| 			sep.cut(80);
 | ||
|   	set_header(3, (const char *) sep);
 | ||
| 	}
 | ||
| 	if (_tipostampa==personale)
 | ||
| 	{
 | ||
| 		TPrint_section& testata = _form_per->get_head();
 | ||
| 		testata.update();
 | ||
| 		for (word i=0; i<testata.height(); i++)
 | ||
| 		{
 | ||
| 			TPrintrow& riga = testata.row(i);
 | ||
| 			TString256 riga1 = riga.row();
 | ||
| 			set_header(i+1,riga1);
 | ||
| 		}
 | ||
| 		TPrint_section& piede = _form_per->get_foot();
 | ||
| 		piede.update();
 | ||
| 		for (int i = 0; i < piede.height(); i++)
 | ||
| 		{
 | ||
| 			TPrintrow& riga = piede.row(i);
 | ||
| 			TString256 riga1 = riga.row();
 | ||
| 			set_footer(i+1,riga1);
 | ||
| 		}
 | ||
| 	}
 | ||
| 	if (_tipostampa==sintetico)
 | ||
| 	{
 | ||
| 		if (_stampa80)
 | ||
| 		{
 | ||
| 			_dencom.set_width(30);
 | ||
| 	  	set_header(4,"@0gCodice@9gCognome e nome@35gIndirizzo@67gTelefono abit.");
 | ||
| 	  	set_header(5,"@0gTessera@35gCAP/Localit<69>/Comune/Prov.@67gTelefono lavoro");
 | ||
| 	  	set_header(6,"@0gCat.don.@9gData nascita@67gTelefono altro");
 | ||
| 	  	set_header(7,"@0g--------@9g-------------------------@35g------------------------------@67g--------------");
 | ||
|   	}
 | ||
| 		else
 | ||
| 		{
 | ||
| 			_dencom.set_width(50);
 | ||
| 	  	set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
 | ||
| 	  	set_header(5,"@0gTessera@49gCAP/Localit<69>/Comune/Prov.@116gTelefono altro");
 | ||
| 	  	set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
 | ||
|   	}
 | ||
| 	}
 | ||
| 	if (_tipostampa==completo)
 | ||
| 	{
 | ||
| 		_dencom.set_width(30);
 | ||
| 		if (_stampa80)
 | ||
| 		{
 | ||
| 	  	set_header(4,"@0g  Codice@9gCognome@40gTelefono abit.@56gTipizza@66gUlt.donaz.@77gSt.");
 | ||
|   		set_header(5,"@0g Tessera@9gNome@40gTelefono lavoro@56gzione@66gTot.donaz.@77gId.");
 | ||
|   		set_header(6,"@0g  Categ.@9gData di nascita@40gTelefono altro@66gData iscr.");
 | ||
|   		set_header(7,"@9gIndirizzo@40gGruppo aziend.@66gUlt.benem.");
 | ||
|   		set_header(8,"@40gProfessione");
 | ||
|   		set_header(9,"@0g--------@9g------------------------------@40g---------------@56g---------@66g----------@77g---");
 | ||
| 		}
 | ||
| 		else
 | ||
| 		{
 | ||
| 	  	set_header(4,"@0g  Codice@9gCognome@35gIndirizzo@66gTelefono abit.@82gTipizza@92gStato@98gUlt.donaz.@109gInt.SI");
 | ||
|   		set_header(5,"@0g Tessera@9gNome@66gTelefono lavoro@82gzione@92gIdon.@98gTot.donaz.@109gInt.AF");
 | ||
|   		set_header(6,"@0g  Categ.@9gData di nascita@66gTelefono altro@98gData iscr.");
 | ||
|   		set_header(7,"@9gLuogo di nascita@66gGruppo aziend.@98gUlt.benem.");
 | ||
|   		set_header(8,"@66gProfessione");
 | ||
|   		set_header(9,"@0g--------@9g-------------------------@35g------------------------------@66g---------------@82g---------@92g-----@98g----------@109g------");
 | ||
| 		}  		
 | ||
| 	}
 | ||
| }
 | ||
| 
 | ||
| bool TStampaPerCategorie::user_create()
 | ||
| { 
 | ||
|   //controllo e caricamento dati dalla configurazione
 | ||
|   TConfig config(CONFIG_STUDIO);
 | ||
|   //etichette
 | ||
|   TString16 etformato = config.get("EtFormato");
 | ||
|   if (!controlla_esistenza_form(etformato, "ate10x36"))
 | ||
|     return false;
 | ||
| 	_form_eti = new TEti_percat_form(etformato);
 | ||
|   _etlarghezza = config.get_int("EtLarghezza");
 | ||
|   _etcolonne = config.get_int("EtColonne");
 | ||
|   _etrighe = config.get_int("EtRighe");
 | ||
|   _etbordoini = config.get_int("EtBordoIni"); 
 | ||
|   _etbordofin = config.get_int("EtBordoFin");
 | ||
| 
 | ||
|   //etichette notiziario
 | ||
|   TString16 etnformato = config.get("EtNFormato");
 | ||
|   if (!controlla_esistenza_form(etnformato, "ate10x36"))
 | ||
|     return false;
 | ||
| 	_form_neti = new TEti_percat_form(etnformato);
 | ||
|   _stampa80 = config.get_bool("Stampa80");
 | ||
|   _etictot = config.get_bool("EticTot");
 | ||
| 
 | ||
|   //cartoline
 | ||
|   TString16 caformato = config.get("CaFormato");
 | ||
|   if (!controlla_esistenza_form(caformato, "atcarto1"))
 | ||
|     return false;
 | ||
| 	_form_car = new TEti_percat_form(caformato);
 | ||
| 
 | ||
|   //schede
 | ||
|   TString16 schformato = config.get("SchFormato");
 | ||
|   if (!controlla_esistenza_form(schformato, "at_pagin"))
 | ||
|     return false;
 | ||
|   _form_sch = new TEti_percat_form(schformato);
 | ||
|   _schxpag = config.get_int("SchXPag");
 | ||
| 	
 | ||
|   //elenco
 | ||
|   TString16 performato = config.get("ElencoFormato");
 | ||
|   if (!controlla_esistenza_form(performato, "atrubrsa"))
 | ||
|     return false;
 | ||
| 	_form_per = new TEti_percat_form(performato);
 | ||
| 
 | ||
| 	_lenpage = printer().formlen();
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 	//attenzione: i files at2700a e at2700b, se si desiderano personalizzati, richiedono il tracciato record modificato..
 | ||
| 	//..in Custom; questo perch<63> le varie sezioni possono volere campi diversi; il max dei campi <20> quello che si trova..
 | ||
| 	//..nei trr ufficiali; la gestione dei campi mancanti <20> fatta dalla filepers_put() al momento della scrittura vera..
 | ||
| 	//..e propria dei files
 | ||
| 	//stampa indirizzi su file
 | ||
|   TFilename filename, filetrr; 
 | ||
|   if (!controlla_esistenza_trr("at2700a", filename, filetrr))
 | ||
|     return false;
 | ||
| 
 | ||
|   _file = new TExternisamfile(filename, filetrr, false);
 | ||
| 
 | ||
| 	//stampa file personalizzato
 | ||
| 	TFilename persname, perstrr; 
 | ||
|   if (!controlla_esistenza_trr("at2700b", persname, perstrr))
 | ||
|     return false;
 | ||
| 
 | ||
| 	_filepers = new TExternisamfile(persname, perstrr, false);	 		  
 | ||
| 
 | ||
| 
 | ||
|   //relazione e cursore
 | ||
|   _rel = new TRelation(LF_SOGGETTI);
 | ||
|   _rel->add(LF_DONAZ, "CODICE==CODICE", 1);
 | ||
|   _rel->add(LF_BENEM, "CODICE==CODICE", 1);
 | ||
|   _rel->add(LF_FAMIGLIE, "CODFAM==CODICE", 2);
 | ||
|   _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
 | ||
|   _rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ);
 | ||
|   _rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
 | ||
|   _rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
 | ||
|   _rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
 | ||
|   _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
 | ||
|   _rel->add("LDN", "CODTAB==PUNTORACC",1,0,ALIAS_LDN);
 | ||
|   _rel->add("LDN", "CODTAB==LUOGODON",1,LF_DONAZ, ALIAS_LDNDON);
 | ||
|   _rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM);
 | ||
|   _rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,0,ALIAS_GAZ);
 | ||
|   _rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
 | ||
|   _rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
 | ||
|   _rel->add(LF_MEDICI, "CODMED==CODMED");
 | ||
| 	_donaz 		= new TLocalisamfile(LF_DONAZ);
 | ||
| 	_benem 		=	new TLocalisamfile(LF_BENEM);
 | ||
| 	_famiglie =	new TLocalisamfile(LF_FAMIGLIE);
 | ||
| 	_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);	
 | ||
| 	_sfamiglia = new TRecord_array(LF_FAMIGLIE,FAM_PROGFAM);	
 | ||
| 	add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ|SOG_CODSOT","",3));
 | ||
| 
 | ||
|   //maschera
 | ||
|   _msk = new TMask("at2700a");
 | ||
| 
 | ||
|   return true;
 | ||
| }
 | ||
| 
 | ||
| bool TStampaPerCategorie::user_destroy()
 | ||
| {
 | ||
| 	delete _form_per;  
 | ||
|   delete _form_sch;		  
 | ||
|   delete _form_car;
 | ||
|   delete _form_eti;
 | ||
|   delete _msk;
 | ||
|   if (_filepers != NULL)
 | ||
|   	delete _filepers;
 | ||
|  	delete _file;
 | ||
|   delete _sfamiglia;
 | ||
|   delete _sbenemerenze;
 | ||
|   delete _famiglie;
 | ||
|   delete _benem;
 | ||
|   delete _donaz;
 | ||
|   delete _rel;
 | ||
|   return TRUE;
 | ||
| }
 | ||
| 
 | ||
| int at2700(int argc, char* argv[])
 | ||
| {
 | ||
|   TStampaPerCategorie a;
 | ||
|   a.run(argc, argv, "Soggetti per categorie");
 | ||
|   return 0;
 | ||
| }
 |