Files correlati : Ricompilazione Demo : [ ] Commento : ultima versione di AVIS git-svn-id: svn://10.65.10.50/trunk@11386 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			531 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			531 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <form.h>
 | 
						|
#include <msksheet.h>
 | 
						|
#include <printapp.h>
 | 
						|
#include <recarray.h>
 | 
						|
#include <utility.h>
 | 
						|
 | 
						|
#include "soggetti.h" 
 | 
						|
#include "donaz.h"
 | 
						|
#include "benem.h"
 | 
						|
#include "sezioni.h"
 | 
						|
#include <comuni.h>
 | 
						|
 | 
						|
#include "at7.h"    
 | 
						|
#include "at4100b.h"
 | 
						|
#include "at4100c.h"
 | 
						|
#include "at7300a.h"
 | 
						|
//#include "at4500.h"
 | 
						|
#include "atlib.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
 | 
						|
 | 
						|
enum ts { undefined=0, schede=1, etichette=2, cartoline=3, donazioni=4 };
 | 
						|
 
 | 
						|
// definizione form per tessere associative
 | 
						|
class TSingole_form : public TForm
 | 
						|
{
 | 
						|
public:
 | 
						|
	
 | 
						|
	virtual TCursor* cursor() const;
 | 
						|
	virtual TRelation* relation() const;
 | 
						|
	TPrint_section& get_body() { return section('B'); } ;
 | 
						|
  TSingole_form(): TForm() {};
 | 
						|
  TSingole_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
 | 
						|
    						: TForm(form,code,editlevel,desc) {};
 | 
						|
  virtual ~TSingole_form() {};
 | 
						|
};
 | 
						|
 | 
						|
class TStampeSingole : public TPrintapp
 | 
						|
{
 | 
						|
  TRelation*			_rel;
 | 
						|
  TIsamtempfile*	_sogtmp;
 | 
						|
	TLocalisamfile* _donaz;
 | 
						|
	TLocalisamfile* _benem;
 | 
						|
	TRecord_array*	_sdonazioni;
 | 
						|
	TRecord_array*  _sbenemerenze;
 | 
						|
  TMask*      		_msk;
 | 
						|
  TSingole_form*	_form_sch;
 | 
						|
  TSingole_form*	_form_car;
 | 
						|
  TSingole_form*	_form_eti;
 | 
						|
  TSingole_form*	_form_don;
 | 
						|
  TAssoc_array		_asoggetti;
 | 
						|
  ts							_tipostampa;
 | 
						|
  int 						_cur;
 | 
						|
  TDate 					_data_stampa;
 | 
						|
	TString16				_codsez, _codsot, _orario, _datacart;
 | 
						|
	TString80				_invitoper, _data, _presso1, _presso2, _presso3, _presso4;
 | 
						|
	TString80				_note, _intest1, _intest2, _intest3, _intest4;
 | 
						|
	bool						_usomodo, _usasez;
 | 
						|
  int							_etlarghezza, _etcolonne, _schxpag, _lenpage;
 | 
						|
  int							_contaschede;
 | 
						|
 | 
						|
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);
 | 
						|
  virtual print_action postprocess_print(int file, int counter);
 | 
						|
  ts dati_cartolina();
 | 
						|
	
 | 
						|
	static void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 1);
 | 
						|
	static bool soggetti_notify(TSheet_field& s, int r, KEY k);
 | 
						|
	static bool nome_handler(TMask_field& f, KEY k);
 | 
						|
	static bool codice_handler(TMask_field& f, KEY k);
 | 
						|
	
 | 
						|
public:
 | 
						|
	void filtra_codici();	
 | 
						|
  void dati_sezione(const TString16 codsez, const TString16 codsot);
 | 
						|
	
 | 
						|
  TMask& app_mask() { return *_msk; }
 | 
						|
  TStampeSingole() : _data_stampa(TODAY) {}
 | 
						|
};
 | 
						|
 | 
						|
HIDDEN inline TStampeSingole& app() { return (TStampeSingole&) main_app(); }
 | 
						|
 | 
						|
TCursor* TSingole_form::cursor() const { return app().current_cursor(); }
 | 
						|
 | 
						|
TRelation* TSingole_form::relation() const { return cursor()->relation(); }
 | 
						|
 | 
						|
HIDDEN bool printer_handler(TMask_field& f, KEY k)
 | 
						|
{        
 | 
						|
  if (k == K_SPACE)
 | 
						|
  {                  
 | 
						|
    TMask& m = f.mask();
 | 
						|
    if (!m.query_mode())
 | 
						|
    {
 | 
						|
      TString16 config;
 | 
						|
      config << "CARTOLINE";
 | 
						|
  
 | 
						|
      TPrinter& p = printer();
 | 
						|
      p.set_printtype(normprinter);           // Force configuration update
 | 
						|
      p.read_configuration(config);
 | 
						|
      if (p.set())
 | 
						|
      	f.message_box("Stampante configurata per stampa cartoline");
 | 
						|
    }    
 | 
						|
  }
 | 
						|
  return TRUE;  
 | 
						|
}
 | 
						|
 | 
						|
void TStampeSingole::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 TStampeSingole::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 TStampeSingole::add_rows_soggetti(TSheet_field& s, int count, int start)
 | 
						|
{
 | 
						|
	if (start == 1)
 | 
						|
		s.destroy();
 | 
						|
	for (int r=start; r<start+count; r++)
 | 
						|
		TToken_string& row = s.row(r-1);
 | 
						|
}
 | 
						|
 | 
						|
void TStampeSingole::filtra_codici()
 | 
						|
{
 | 
						|
	for (_sogtmp->first(); !_sogtmp->eof(); _sogtmp->next())
 | 
						|
		_sogtmp->remove();
 | 
						|
	TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
 | 
						|
	for (int r=0; r < s.items(); r++)
 | 
						|
 	{
 | 
						|
 		TToken_string& row = s.row(r);
 | 
						|
 		const long codice = row.get_long(0);
 | 
						|
 		if (codice != 0)
 | 
						|
 		{
 | 
						|
 			TLocalisamfile soggetti(LF_SOGGETTI);
 | 
						|
 			soggetti.setkey(1);
 | 
						|
 			soggetti.zero();
 | 
						|
 			soggetti.put(SOG_CODICE,codice);
 | 
						|
 			if (soggetti.read() == NOERR)
 | 
						|
 				_sogtmp->write(soggetti.curr());
 | 
						|
 		}
 | 
						|
	} 		
 | 
						|
}	
 | 
						|
 | 
						|
void TStampeSingole::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())
 | 
						|
				{ 
 | 
						|
					force_setpage(TRUE);
 | 
						|
					corpo.update();
 | 
						|
  				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(i+1,riga1);
 | 
						|
					}
 | 
						|
					if (r < _etcolonne)  			
 | 
						|
						++(*current_cursor());
 | 
						|
				}					
 | 
						|
			}				
 | 
						|
		}
 | 
						|
		break;
 | 
						|
		case schede:
 | 
						|
		{
 | 
						|
			TPrint_section& corpo = _form_sch->get_body();
 | 
						|
			corpo.update_and_print(printmode_normal, TRUE);
 | 
						|
			force_setpage(TRUE);
 | 
						|
			_contaschede++;
 | 
						|
		}
 | 
						|
		break;
 | 
						|
		case donazioni:
 | 
						|
		{
 | 
						|
			TPrint_section& corpo = _form_don->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();
 | 
						|
			for (word i = 0; i < corpo.height(); i++)
 | 
						|
			{
 | 
						|
				TPrintrow& riga = corpo.row(i);
 | 
						|
				set_row(i+1,riga);
 | 
						|
			}  			
 | 
						|
			force_setpage(TRUE);
 | 
						|
		}
 | 
						|
		break;
 | 
						|
	}							
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::preprocess_page(int file, int counter)
 | 
						|
{                              
 | 
						|
	if (_tipostampa==etichette)		
 | 
						|
		if (printer().rows_left() < _form_eti->get_body().height())
 | 
						|
			printer().formfeed();
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
print_action TStampeSingole::postprocess_print(int file, int counter)
 | 
						|
{ 
 | 
						|
	if ((_tipostampa == schede) && (_schxpag > 1))
 | 
						|
		printer().formlen(_lenpage);
 | 
						|
	return NEXT_PAGE;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::set_print(int m)
 | 
						|
{ 
 | 
						|
  TPrinter& p = printer();
 | 
						|
	p.read_configuration();
 | 
						|
	TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
 | 
						|
	s.destroy();
 | 
						|
	s.force_update();
 | 
						|
	if (s.items()==0)
 | 
						|
		add_rows_soggetti(s,50);
 | 
						|
	_tipostampa = undefined;
 | 
						|
  KEY tasto;
 | 
						|
  tasto = _msk->run();
 | 
						|
  switch (tasto)
 | 
						|
  {                  
 | 
						|
	  case F_CARTOLINE:
 | 
						|
	  	_tipostampa=cartoline;
 | 
						|
	 	break;
 | 
						|
	  case F_SCHEDE:
 | 
						|
	  	_tipostampa=schede;
 | 
						|
	  	if (_schxpag > 1)            
 | 
						|
	  		printer().formlen(_lenpage/_schxpag);
 | 
						|
	 	break;
 | 
						|
	  case F_ETICHETTE:
 | 
						|
  		_tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined;
 | 
						|
		break;  	
 | 
						|
	  case F_DONAZIONI:
 | 
						|
	  	_tipostampa=donazioni;	
 | 
						|
	  break;
 | 
						|
  }	
 | 
						|
	if (_tipostampa != undefined)
 | 
						|
  {                                        
 | 
						|
  	if (_tipostampa == cartoline)
 | 
						|
  		dati_cartolina();
 | 
						|
		_contaschede = 0;
 | 
						|
    reset_files(); 
 | 
						|
    add_file(LF_SOGGETTI);
 | 
						|
	  _asoggetti.destroy();
 | 
						|
	 	for (int r=0; r < s.items(); r++)
 | 
						|
	 	{
 | 
						|
	 		TToken_string& row = s.row(r);
 | 
						|
	 		const long codice = row.get_long(0);
 | 
						|
	 		const char* scodice = row.get(0);
 | 
						|
	 		if (codice != 0)
 | 
						|
	 			_asoggetti.add(scodice);
 | 
						|
	 	}
 | 
						|
	 	if (_asoggetti.items() != 0)
 | 
						|
			filtra_codici();
 | 
						|
		reset_print();
 | 
						|
    return TRUE;
 | 
						|
  }
 | 
						|
  else
 | 
						|
   	return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::user_create()
 | 
						|
{
 | 
						|
  _sogtmp = new TIsamtempfile(LF_SOGGETTI,NULL,TRUE,TRUE);
 | 
						|
  _rel = new TRelation(_sogtmp);
 | 
						|
	_rel->add(LF_SOGGETTI, "CODICE==CODICE");
 | 
						|
  _rel->add(LF_DONAZ, "CODICE==CODICE", 1);
 | 
						|
  _rel->add("LDN", "CODTAB==LUOGODON",1,LF_DONAZ, ALIAS_LDNDON);
 | 
						|
  _rel->add(LF_BENEM, "CODICE==CODICE", 1);
 | 
						|
  _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("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM);
 | 
						|
  _rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
 | 
						|
  _rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
 | 
						|
  _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
 | 
						|
  _rel->add(LF_MEDICI, "CODMED==CODMED");
 | 
						|
	_donaz 		= new TLocalisamfile(LF_DONAZ);
 | 
						|
	_benem 		=	new TLocalisamfile(LF_BENEM);
 | 
						|
	_sdonazioni 	= new TRecord_array(LF_DONAZ,DON_PROGDON);
 | 
						|
	_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);	
 | 
						|
 | 
						|
  _cur = add_cursor(new TCursor(_rel, "", 2));
 | 
						|
  _msk = new TMask("at7300a");           
 | 
						|
  //Modificato il form per le cartoline in ATCARTO2 da ATCARTO1 da Marco il 14/09/99
 | 
						|
  _form_car = new TSingole_form("ATCARTO2");
 | 
						|
  _form_don = new TSingole_form("ATDDONAZ");
 | 
						|
  TConfig config(CONFIG_STUDIO);
 | 
						|
  TString16 etformato = config.get("EtFormato");
 | 
						|
  _etlarghezza = config.get_int("EtLarghezza");
 | 
						|
  _etcolonne = config.get_int("EtColonne");
 | 
						|
	_form_eti = new TSingole_form(etformato);
 | 
						|
  TString16 schformato = config.get("SchFormato");
 | 
						|
  _schxpag = config.get_int("SchXPag");
 | 
						|
  _form_sch = new TSingole_form(schformato);
 | 
						|
	_lenpage = printer().formlen();
 | 
						|
	TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
 | 
						|
	ss.set_notify(soggetti_notify);
 | 
						|
	ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
 | 
						|
	ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::soggetti_notify(TSheet_field& s, int r, KEY k)
 | 
						|
{              
 | 
						|
	bool ok = TRUE;
 | 
						|
	switch (k)
 | 
						|
	{ 
 | 
						|
		case K_INS:
 | 
						|
			// richiesta inserimento riga
 | 
						|
		break;	
 | 
						|
		case K_DEL:
 | 
						|
		case K_CTRL+K_DEL:
 | 
						|
		// avvenuta cancellazione riga
 | 
						|
		break;
 | 
						|
		case K_SPACE:
 | 
						|
		// inizio modifica riga
 | 
						|
		break;
 | 
						|
		case K_TAB:
 | 
						|
		// entrata riga			
 | 
						|
		{         
 | 
						|
		  static bool entering = TRUE;
 | 
						|
		  if (entering)
 | 
						|
		  {
 | 
						|
		    entering = FALSE;
 | 
						|
			  if ((r == s.items()-1) && (r == s.first_empty()))
 | 
						|
				  app().add_rows_soggetti(s,10,r+1);
 | 
						|
			  TToken_string& row = s.row(r);
 | 
						|
			  if (row.empty_items())
 | 
						|
			  	s.select(r,1,FALSE);			
 | 
						|
			  entering = TRUE;	
 | 
						|
			}  	
 | 
						|
		}
 | 
						|
	  break;
 | 
						|
		case K_ENTER:
 | 
						|
		// uscita da riga modificata
 | 
						|
		case K_CTRL+K_TAB:
 | 
						|
		// uscita riga
 | 
						|
		{ 
 | 
						|
			TToken_string& row = s.row(r);
 | 
						|
			const long codsog = row.get_long(0);
 | 
						|
			if (codsog != 0)
 | 
						|
				for (int i=s.items()-1; i>=0; i--)
 | 
						|
				{
 | 
						|
					if (i != r)
 | 
						|
					{
 | 
						|
						TToken_string& row = s.row(i); 
 | 
						|
						if (codsog == row.get_long(0))
 | 
						|
							return s.sheet_mask().field(F_S_CODICE).error_box("Soggetto gia' inserito");
 | 
						|
					}					
 | 
						|
				}				
 | 
						|
			else
 | 
						|
			{
 | 
						|
				const char* cognome = row.get(1);
 | 
						|
				if ((cognome != NULL) && (cognome != "\0"))
 | 
						|
					s.sheet_mask().field(F_S_NOME).set_focusdirty();
 | 
						|
			}
 | 
						|
		}
 | 
						|
	  break;  	
 | 
						|
	}  
 | 
						|
  return ok;  
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::nome_handler(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
	bool ok = TRUE;
 | 
						|
  if (f.to_check(k))
 | 
						|
  {
 | 
						|
  	TMask& m = f.mask();
 | 
						|
  	long codsog = m.get_long(F_S_CODICE);
 | 
						|
  	if (codsog == 0)
 | 
						|
      f.on_key(K_F9);
 | 
						|
  }	
 | 
						|
  return ok;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::codice_handler(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
	bool ok = TRUE;
 | 
						|
  if (f.to_check(k))
 | 
						|
  {
 | 
						|
  	TMask& m = f.mask();
 | 
						|
  	long codsog = m.get_long(F_S_CODICE);
 | 
						|
  	if (codsog != 0)
 | 
						|
  	{
 | 
						|
			TLocalisamfile sog(LF_SOGGETTI);
 | 
						|
  		sog.setkey(1);	
 | 
						|
			sog.zero();
 | 
						|
			sog.put(SOG_CODICE, codsog);
 | 
						|
			int err = sog.read();
 | 
						|
			if (err == NOERR)
 | 
						|
			{
 | 
						|
  			m.set(F_S_COGNOME, sog.get(SOG_COGNOME));
 | 
						|
  			m.set(F_S_NOME, sog.get(SOG_NOME));
 | 
						|
  			m.set(F_S_DATANASC, sog.get(SOG_DATANASC));
 | 
						|
  			m.set(F_S_TESSAVIS, sog.get(SOG_TESSAVIS));
 | 
						|
  			m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
 | 
						|
  			m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
 | 
						|
  			m.set(F_S_CATDON, sog.get(SOG_CATDON));
 | 
						|
			}  			
 | 
						|
			else
 | 
						|
				ok = FALSE; // codice non esistente  			
 | 
						|
  	}
 | 
						|
  }	
 | 
						|
  return ok;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampeSingole::user_destroy()
 | 
						|
{
 | 
						|
  delete _form_sch;
 | 
						|
  delete _form_eti;
 | 
						|
  delete _form_don;
 | 
						|
  delete _form_car;
 | 
						|
  delete _msk;
 | 
						|
  delete _sbenemerenze;  
 | 
						|
  delete _sdonazioni;
 | 
						|
  delete _benem;
 | 
						|
  delete _donaz;
 | 
						|
  delete _rel;
 | 
						|
  delete _sogtmp;
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
int at7300(int argc, char* argv[])
 | 
						|
{
 | 
						|
  TStampeSingole a;
 | 
						|
  a.run(argc, argv, "Stampe singole");
 | 
						|
  return 0;
 | 
						|
}
 |