Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@19874 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			589 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			589 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <applicat.h>
 | 
						|
#include <mask.h>
 | 
						|
#include <printer.h>
 | 
						|
#include <progind.h>
 | 
						|
#include <relation.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include <urldefid.h>
 | 
						|
#include <utility.h>
 | 
						|
 | 
						|
#include "at3.h"
 | 
						|
 | 
						|
// nomi campi maschera
 | 
						|
#include "at3800a.h"
 | 
						|
          
 | 
						|
// nomi dei campi
 | 
						|
#include "soggetti.h"
 | 
						|
#include "donaz.h"
 | 
						|
#include "atstatd.h"
 | 
						|
#include "sezioni.h"
 | 
						|
 | 
						|
// classe per la definizione di una riga di statistica
 | 
						|
class TRigaP : public TObject
 | 
						|
{                             
 | 
						|
	TString16			_punto;
 | 
						|
	TArray				_valori;
 | 
						|
 | 
						|
protected:
 | 
						|
	const TRigaP& copy(const TRigaP& riga);
 | 
						|
public:
 | 
						|
	TObject* dup() const { return new TRigaP(*this); }
 | 
						|
	const TRigaP& operator = (const TRigaP& riga);
 | 
						|
	const real& operator [] (int colonna) const;
 | 
						|
	void aggiorna_valore(int colonna, const real& numero) ;
 | 
						|
	void azzera_valori();
 | 
						|
	// costruttore
 | 
						|
	TRigaP(TString16 punto) {_punto = punto;}
 | 
						|
	// costruttore di copia
 | 
						|
	TRigaP(const TRigaP& riga)  { copy(riga); }
 | 
						|
	virtual ~TRigaP() {};
 | 
						|
};
 | 
						|
 | 
						|
const TRigaP& TRigaP::copy(const TRigaP& riga)
 | 
						|
{
 | 
						|
	_punto = riga._punto;
 | 
						|
	_valori = riga._valori;
 | 
						|
	return (*this);
 | 
						|
}
 | 
						|
 | 
						|
const TRigaP& TRigaP::operator = (const TRigaP& riga)
 | 
						|
{
 | 
						|
	copy(riga);
 | 
						|
	return (*this);
 | 
						|
}
 | 
						|
 | 
						|
const real& TRigaP::operator [] (int colonna) const
 | 
						|
{
 | 
						|
	real* valore = (real*)_valori.objptr(colonna);
 | 
						|
	if (valore == NULL)
 | 
						|
		return ZERO;
 | 
						|
	else
 | 
						|
		return *valore;		
 | 
						|
}
 | 
						|
 | 
						|
void TRigaP::aggiorna_valore(int colonna, const real& numero)
 | 
						|
{
 | 
						|
	real* valore = (real*)_valori.objptr(colonna);
 | 
						|
	if (valore == NULL)
 | 
						|
		_valori.add(new real(numero), colonna);
 | 
						|
	else
 | 
						|
		*valore += numero;
 | 
						|
}
 | 
						|
  
 | 
						|
void TRigaP::azzera_valori()
 | 
						|
{
 | 
						|
	_valori.destroy();
 | 
						|
}
 | 
						|
 | 
						|
class TRiepilogoPunto : public TApplication
 | 
						|
{
 | 
						|
	TMask*					_msk;
 | 
						|
	TRelation*   		_rel;
 | 
						|
	TCursor*				_cur;
 | 
						|
	TLocalisamfile* _sezioni;
 | 
						|
	TLocalisamfile* _soggetti;
 | 
						|
	TLocalisamfile* _donaz;
 | 
						|
	TLocalisamfile* _atstatd;
 | 
						|
	TDate						_dataini, _datafin;
 | 
						|
	TAssoc_array*		_colonne;
 | 
						|
	TAssoc_array*		_punti;
 | 
						|
	TArray					_righe;	// array per riepilogo donazioni
 | 
						|
	TString16				_sezini, _sotini, _sezfin, _sotfin;     
 | 
						|
	bool						_solotot;
 | 
						|
	int							_sezionistampate;
 | 
						|
 | 
						|
protected:
 | 
						|
	virtual bool create();
 | 
						|
	virtual bool destroy();
 | 
						|
  virtual bool menu(MENU_TAG m);
 | 
						|
	virtual TMask& get_mask() { return *_msk; }
 | 
						|
	virtual TRelation* get_relation() const { return _rel; }
 | 
						|
	int data2row(const TString16 punto);
 | 
						|
	bool riepilogo();
 | 
						|
	bool stampa();
 | 
						|
	bool crea_colonne();
 | 
						|
	bool crea_righe();
 | 
						|
	void azzera_righe();
 | 
						|
	void stampa_sezione(TString16 codsez, TString16 codsot);
 | 
						|
	void crea_intestazione();
 | 
						|
public:
 | 
						|
	TRiepilogoPunto() {}
 | 
						|
	
 | 
						|
};
 | 
						|
 | 
						|
HIDDEN inline TRiepilogoPunto& app() { return (TRiepilogoPunto&) main_app(); }
 | 
						|
 | 
						|
int TRiepilogoPunto::data2row(const TString16 punto)
 | 
						|
{       
 | 
						|
	real& indicer = (real&)_punti->find((const char*) punto);
 | 
						|
	return ((int) indicer.integer());
 | 
						|
}
 | 
						|
 | 
						|
bool TRiepilogoPunto::crea_colonne()
 | 
						|
{                   
 | 
						|
	_colonne->destroy();
 | 
						|
	TTable tdn("TDN");
 | 
						|
	real contatore(ZERO);
 | 
						|
	for (tdn.first(); !tdn.eof(); tdn.next())
 | 
						|
	{ 
 | 
						|
		real* oggetto = new real(contatore);                                
 | 
						|
		_colonne->add((const char*)tdn.get("CODTAB"),(TObject*)oggetto);
 | 
						|
		contatore+=1;
 | 
						|
	}		
 | 
						|
	return !tdn.empty();
 | 
						|
}
 | 
						|
 | 
						|
bool TRiepilogoPunto::crea_righe()
 | 
						|
{                     
 | 
						|
	TTable ldn("LDN");
 | 
						|
	TString16 punto = "**";
 | 
						|
	int indice = 0;
 | 
						|
	_punti->destroy();
 | 
						|
	real* oggetto1 = new real(indice);
 | 
						|
	_punti->add((const char*) punto, (TObject*) oggetto1);
 | 
						|
	_righe.add(new TRigaP(punto), indice);
 | 
						|
	for (ldn.first(); !ldn.eof(); ldn.next())
 | 
						|
	{ 
 | 
						|
		indice++;
 | 
						|
		punto = ldn.get("CODTAB");
 | 
						|
		_righe.add(new TRigaP(punto), indice);
 | 
						|
		real* oggetto = new real(indice);
 | 
						|
		_punti->add((const char*) punto,(TObject*) oggetto);
 | 
						|
	}		
 | 
						|
	return _righe.items()>0;	
 | 
						|
}
 | 
						|
 | 
						|
bool TRiepilogoPunto::create()
 | 
						|
{
 | 
						|
	TApplication::create();
 | 
						|
	_msk = new TMask("at3800a");
 | 
						|
	_rel = new TRelation(LF_DONAZ);
 | 
						|
  _rel->add(LF_SOGGETTI, "CODICE==CODICE");
 | 
						|
  _soggetti = new TLocalisamfile(LF_SOGGETTI);
 | 
						|
	_donaz = new TLocalisamfile(LF_DONAZ);
 | 
						|
	_atstatd = new TLocalisamfile(LF_ATSTATD);	
 | 
						|
	_sezioni = new TLocalisamfile(LF_SEZIONI);
 | 
						|
	_colonne = new TAssoc_array();
 | 
						|
	_punti = new TAssoc_array();
 | 
						|
  dispatch_e_menu(BAR_ITEM_ID(1));
 | 
						|
	return TRUE;
 | 
						|
}	
 | 
						|
 | 
						|
bool TRiepilogoPunto::destroy()	
 | 
						|
{
 | 
						|
	delete _punti;
 | 
						|
	delete _colonne;
 | 
						|
	delete _sezioni;
 | 
						|
	delete _atstatd;
 | 
						|
	delete _donaz;
 | 
						|
	delete _soggetti;
 | 
						|
	delete _rel;
 | 
						|
	delete _msk;
 | 
						|
	return TApplication::destroy();
 | 
						|
}
 | 
						|
 | 
						|
bool TRiepilogoPunto::menu(MENU_TAG m)
 | 
						|
{ 
 | 
						|
	TMask& msk = get_mask();
 | 
						|
	KEY tasto;
 | 
						|
 	tasto = msk.run();
 | 
						|
 	if (tasto == K_ENTER)
 | 
						|
 	{
 | 
						|
		_dataini = msk.get(F_DATAINI); 		
 | 
						|
		_datafin = msk.get(F_DATAFIN); 		
 | 
						|
		_solotot = msk.get_bool(F_SOLOTOT); 		
 | 
						|
 		_sezini = _msk->get(F_SEZINI);
 | 
						|
 		_sotini = _msk->get(F_SOTINI);
 | 
						|
 		_sezfin = _msk->get(F_SEZFIN);
 | 
						|
 		_sotfin = _msk->get(F_SOTFIN);
 | 
						|
		if (riepilogo())
 | 
						|
			stampa();
 | 
						|
 	}
 | 
						|
 	return FALSE;
 | 
						|
}  
 | 
						|
 | 
						|
void TRiepilogoPunto::crea_intestazione()
 | 
						|
{ 
 | 
						|
	TPrintrow row;
 | 
						|
	TString256 sep;
 | 
						|
	sep = "RIEPILOGO DONAZIONI PER TIPO E PUNTO ";
 | 
						|
	sep.center_just(80);
 | 
						|
	row.put(sep);
 | 
						|
  row.put("@>", 1);
 | 
						|
  row.put("Pag. @#", 70);
 | 
						|
  printer().setheaderline(2, row);
 | 
						|
  row.reset();
 | 
						|
  sep = "";
 | 
						|
	if (_dataini.ok())
 | 
						|
	{
 | 
						|
		sep << " dal ";
 | 
						|
		sep << _dataini.string();
 | 
						|
	}
 | 
						|
	if (_datafin.ok())
 | 
						|
	{
 | 
						|
		sep << " al ";
 | 
						|
		sep << _datafin.string();
 | 
						|
	}
 | 
						|
	sep.center_just(80);
 | 
						|
	row.put(sep);  
 | 
						|
  printer().setheaderline(3, row);	  
 | 
						|
  row.reset();
 | 
						|
  sep = "Punto di prelievo ";
 | 
						|
	TTable tdn("TDN");
 | 
						|
	//int pos = 37;
 | 
						|
	int pos = 57;
 | 
						|
	for (tdn.first(); !tdn.eof(); tdn.next())
 | 
						|
	{ 
 | 
						|
		sep.overwrite((const char*)tdn.get("CODTAB"),pos);
 | 
						|
		pos = pos+10;
 | 
						|
	}		
 | 
						|
	sep.overwrite("Totale",pos);	
 | 
						|
	row.put(sep);
 | 
						|
	printer().setheaderline(5, row);  
 | 
						|
	sep = "";
 | 
						|
	sep.fill('-',80);
 | 
						|
	sep.cut(pos+6);
 | 
						|
	row.reset();
 | 
						|
	row.put(sep);
 | 
						|
	printer().setheaderline(6, row);
 | 
						|
}
 | 
						|
 | 
						|
bool TRiepilogoPunto::stampa()
 | 
						|
{ 
 | 
						|
	if (printer().open())
 | 
						|
	{
 | 
						|
		_sezionistampate = 0;
 | 
						|
		crea_intestazione();
 | 
						|
		TRelation* relstat = new TRelation(LF_ATSTATD);
 | 
						|
		TCursor* curstat = new TCursor(relstat, "", 1);
 | 
						|
		TString16 oldsez = "**";
 | 
						|
		TString16 oldsot = "**";
 | 
						|
		long numero;
 | 
						|
		TString16 actsez, actsot;
 | 
						|
		TString16 tipodon, punto;
 | 
						|
		long last = curstat->items();
 | 
						|
	  for ( *curstat=0; curstat->pos() < last; ++(*curstat) )
 | 
						|
	  {
 | 
						|
			actsez = curstat->curr().get(ATS_CODSEZ);																						  	
 | 
						|
			actsot = curstat->curr().get(ATS_CODSOT);		
 | 
						|
			tipodon = curstat->curr().get(ATS_TIPODON);		
 | 
						|
			punto = curstat->curr().get(ATS_PUNTO);
 | 
						|
			numero = curstat->curr().get_long(ATS_NUMERO);		
 | 
						|
			if (actsez != oldsez || actsot != oldsot)
 | 
						|
			{                 
 | 
						|
				if (oldsez != "**" && oldsot != "**")
 | 
						|
				{
 | 
						|
					stampa_sezione(oldsez,oldsot);
 | 
						|
					azzera_righe();
 | 
						|
				}
 | 
						|
				oldsez = actsez;
 | 
						|
				oldsot = actsot;
 | 
						|
			}				                               
 | 
						|
			if (punto.empty())
 | 
						|
				punto = "**";
 | 
						|
			TRigaP& riga = (TRigaP&)_righe[data2row(punto)];
 | 
						|
			real& colonna = (real&)_colonne->find((const char*)tipodon);
 | 
						|
			real n = numero;
 | 
						|
			riga.aggiorna_valore((int) colonna.integer(),n);
 | 
						|
		}                             
 | 
						|
		if (oldsez != "**" && oldsot != "**")
 | 
						|
			stampa_sezione(oldsez,oldsot);
 | 
						|
		delete curstat;
 | 
						|
		delete relstat;
 | 
						|
		printer().close();
 | 
						|
		return TRUE;
 | 
						|
	}
 | 
						|
	else
 | 
						|
		return FALSE;		
 | 
						|
}
 | 
						|
 | 
						|
void TRiepilogoPunto::azzera_righe()
 | 
						|
{
 | 
						|
	TString16 punto = "**";
 | 
						|
	int indice = data2row(punto);
 | 
						|
	TRigaP& riga = (TRigaP&)_righe[indice];
 | 
						|
	riga.azzera_valori();
 | 
						|
	TTable ldn("LDN");
 | 
						|
	for (ldn.first(); !ldn.eof(); ldn.next())
 | 
						|
	{ 
 | 
						|
		punto = ldn.get("CODTAB");
 | 
						|
		indice = data2row(punto);
 | 
						|
		TRigaP& riga = (TRigaP&)_righe[indice];
 | 
						|
		riga.azzera_valori();
 | 
						|
	}		
 | 
						|
}
 | 
						|
 | 
						|
void TRiepilogoPunto::stampa_sezione(TString16 codsez, TString16 codsot)
 | 
						|
{ 
 | 
						|
	TPrintrow row;
 | 
						|
	TString256 rigastampa;
 | 
						|
	if (codsez == "ZZ" && codsot == "ZZ")
 | 
						|
	{
 | 
						|
		if (_sezionistampate != 1)
 | 
						|
		{
 | 
						|
			//rigastampa = "RIEPILOGO TOTALE PER TUTTE LE SEZIONI STAMPATE";
 | 
						|
			rigastampa = "";
 | 
						|
			rigastampa << "RIEPILOGO TOTALE SEZIONI DA " << _sezini << '/' << _sotini << " A " << _sezfin << '/' << _sotfin;
 | 
						|
		}	
 | 
						|
	}	
 | 
						|
	else
 | 
						|
	{
 | 
						|
		_sezionistampate++;
 | 
						|
		rigastampa = "Sezione: ";
 | 
						|
		rigastampa << codsez;
 | 
						|
		if (codsot.not_empty())
 | 
						|
		{
 | 
						|
			rigastampa << "/";
 | 
						|
			rigastampa << codsot;
 | 
						|
		}		
 | 
						|
		rigastampa << " ";
 | 
						|
		TLocalisamfile sezioni(LF_SEZIONI);
 | 
						|
		sezioni.setkey(1);
 | 
						|
		sezioni.zero();
 | 
						|
		sezioni.put(SEZ_CODSEZ,codsez);
 | 
						|
		sezioni.put(SEZ_CODSOT,codsot);	
 | 
						|
		if (sezioni.read() == NOERR)
 | 
						|
		{
 | 
						|
			TString80 den = sezioni.get(SEZ_DENSEZ);
 | 
						|
			rigastampa << den;
 | 
						|
			den = sezioni.get(SEZ_DENSOT);
 | 
						|
			if (den.not_empty())
 | 
						|
			{
 | 
						|
				rigastampa << "/";
 | 
						|
				rigastampa << den;
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}		
 | 
						|
	if ((codsez == "ZZ" && codsot == "ZZ" && _sezionistampate != 1) || (codsez != "ZZ"))
 | 
						|
	{
 | 
						|
		rigastampa.center_just(80);
 | 
						|
		row.put(rigastampa);
 | 
						|
	  printer().setheaderline(1, row);
 | 
						|
	  
 | 
						|
	  TRigaP rigatotali("");
 | 
						|
		real totalepunto = ZERO;
 | 
						|
		TString16 valore;
 | 
						|
		TString16 punto = "**";
 | 
						|
		TRigaP& riga = (TRigaP&)_righe[data2row(punto)];
 | 
						|
		row.reset();
 | 
						|
		rigastampa = "Senza punto";
 | 
						|
		totalepunto = ZERO;
 | 
						|
		//int pos = 31;
 | 
						|
		int pos = 51;
 | 
						|
		for (int i=0;i<_colonne->items();i++)
 | 
						|
		{                      
 | 
						|
			rigatotali.aggiorna_valore(i,riga[i]);
 | 
						|
			totalepunto+=riga[i];
 | 
						|
			valore = "";
 | 
						|
			valore.format("%8s",riga[i].string(8,0));
 | 
						|
			rigastampa.overwrite((const char*)valore, pos);
 | 
						|
			pos = pos+10;
 | 
						|
		}           
 | 
						|
		if (totalepunto != ZERO)
 | 
						|
		{
 | 
						|
			valore = "";
 | 
						|
			valore.format("%8s",totalepunto.string(8,0));
 | 
						|
			rigastampa.overwrite((const char*)valore, pos+4);
 | 
						|
			row.put((const char*) rigastampa);
 | 
						|
			printer().print(row);			
 | 
						|
		}
 | 
						|
	
 | 
						|
		TTable ldn("LDN");
 | 
						|
		for (ldn.first(); !ldn.eof(); ldn.next())
 | 
						|
		{ 
 | 
						|
			punto = ldn.get("CODTAB");
 | 
						|
			TRigaP& riga = (TRigaP&)_righe[data2row(punto)];
 | 
						|
			row.reset();
 | 
						|
			rigastampa = "";
 | 
						|
			rigastampa << punto;
 | 
						|
			rigastampa << " ";                 
 | 
						|
			rigastampa << ldn.get("S0");
 | 
						|
			//rigastampa.cut(30);
 | 
						|
			rigastampa.cut(55);
 | 
						|
			totalepunto = ZERO;
 | 
						|
			//int pos = 31;
 | 
						|
			int pos = 51;
 | 
						|
			for (int i=0;i<_colonne->items();i++)
 | 
						|
			{                      
 | 
						|
				rigatotali.aggiorna_valore(i,riga[i]);
 | 
						|
				totalepunto+=riga[i];
 | 
						|
				valore = "";
 | 
						|
				valore.format("%8s",riga[i].string(8,0));
 | 
						|
				rigastampa.overwrite((const char*)valore, pos);
 | 
						|
				pos = pos+10;
 | 
						|
			}           
 | 
						|
			if (totalepunto != ZERO)
 | 
						|
			{
 | 
						|
				valore = "";
 | 
						|
				valore.format("%8s",totalepunto.string(8,0));
 | 
						|
				rigastampa.overwrite((const char*)valore, pos+4);
 | 
						|
				row.put((const char*) rigastampa);
 | 
						|
				printer().print(row);			
 | 
						|
			}			
 | 
						|
		}		
 | 
						|
		// stampa totali per sezione
 | 
						|
		rigastampa = "";
 | 
						|
		rigastampa.fill('-',80);
 | 
						|
		rigastampa.cut(pos+4+8);
 | 
						|
		row.reset();
 | 
						|
		row.put(rigastampa);
 | 
						|
		printer().print(row);
 | 
						|
		row.reset();
 | 
						|
		rigastampa = "";
 | 
						|
		rigastampa = "Totale ";
 | 
						|
		totalepunto = ZERO;
 | 
						|
		//pos = 31;
 | 
						|
		pos = 51;
 | 
						|
		for (int i = 0; i < _colonne->items(); i++)
 | 
						|
		{                      
 | 
						|
			totalepunto+=rigatotali[i];
 | 
						|
			valore = "";
 | 
						|
			valore.format("%8s",rigatotali[i].string(8,0));
 | 
						|
			rigastampa.overwrite((const char*)valore, pos);
 | 
						|
			pos = pos+10;
 | 
						|
		}           
 | 
						|
		valore = "";
 | 
						|
		valore.format("%8s",totalepunto.string(8,0));
 | 
						|
		rigastampa.overwrite((const char*)valore, pos+4);
 | 
						|
		row.put((const char*) rigastampa);
 | 
						|
		printer().print(row);			
 | 
						|
		row.reset();
 | 
						|
	  printer().setheaderline(3, row);	  
 | 
						|
		printer().formfeed();
 | 
						|
	}		
 | 
						|
}
 | 
						|
 | 
						|
bool TRiepilogoPunto::riepilogo()
 | 
						|
{            
 | 
						|
	if (crea_colonne() && crea_righe())
 | 
						|
	{   
 | 
						|
		// cancello i risultati della elaborazione precedente
 | 
						|
		TLocalisamfile stat(LF_ATSTATD);
 | 
						|
		for (stat.first(); !stat.eof(); stat.next())
 | 
						|
			stat.remove();
 | 
						|
		// filtro per data
 | 
						|
		TRectype da(LF_DONAZ);
 | 
						|
  	TRectype a (LF_DONAZ);
 | 
						|
  	if (_dataini.ok())
 | 
						|
			da.put(DON_DATADON, _dataini);
 | 
						|
  	if (_datafin.ok())
 | 
						|
			a.put(DON_DATADON, _datafin);
 | 
						|
		_cur = new TCursor(_rel, "", 2, &da, &a);
 | 
						|
		TString256 filtro = "";
 | 
						|
		// filtro per sezione/sottogruppo
 | 
						|
	 	if (_sezini.not_empty())
 | 
						|
	 	{
 | 
						|
	 		if (_sotini.not_empty())
 | 
						|
	 		{                    
 | 
						|
	 			filtro << "(";
 | 
						|
	 			filtro << format("(92->CODSEZ > \"%s\")",(const char*)_sezini);
 | 
						|
	 			filtro << " || ";
 | 
						|
	 			filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezini);
 | 
						|
	 			filtro << " && ";
 | 
						|
	 			filtro << format("(92->CODSOT >= \"%s\")",(const char*)_sotini);
 | 
						|
	 			filtro << ")";
 | 
						|
	 			filtro << ")";
 | 
						|
	 		}
 | 
						|
	 		else
 | 
						|
		 			filtro << format("(92->CODSEZ >= \"%s\")",(const char*)_sezini);
 | 
						|
	 	}
 | 
						|
	 	if (_sezfin.not_empty())
 | 
						|
	 	{
 | 
						|
 			if (filtro.not_empty())
 | 
						|
 				filtro << " && "; 
 | 
						|
	 	
 | 
						|
	 		if (_sotfin.not_empty())
 | 
						|
	 		{          
 | 
						|
	 			filtro << "(";
 | 
						|
	 			filtro << format("(92->CODSEZ < \"%s\")",(const char*)_sezfin);
 | 
						|
	 			filtro << " || ";
 | 
						|
	 			filtro << "(" << format("(92->CODSEZ == \"%s\")",(const char*)_sezfin);
 | 
						|
	 			filtro << " && ";
 | 
						|
	 			filtro << format("(92->CODSOT <= \"%s\")",(const char*)_sotfin);
 | 
						|
	 			filtro << ")";
 | 
						|
	 			filtro << ")";
 | 
						|
	 		}
 | 
						|
	 		else
 | 
						|
	 			filtro << format("(92->CODSEZ <= \"%s\")",(const char*)_sezfin);
 | 
						|
		}
 | 
						|
		_cur->setfilter((const char*) filtro, TRUE);
 | 
						|
		TString16 codsez, codsot, tipodon, punto;
 | 
						|
		long numero;  
 | 
						|
		TRectype& recdon = _cur->curr();
 | 
						|
		TRectype& recsog = _cur->curr(LF_SOGGETTI);
 | 
						|
  	long last = _cur->items();   
 | 
						|
  	TProgind prg (last, "Elaborazione in corso... Prego attendere", FALSE, TRUE, 30);
 | 
						|
  	for ( *_cur=0; _cur->pos() < last; ++(*_cur) )
 | 
						|
  	{
 | 
						|
    	prg.addstatus(1);
 | 
						|
			codsez = recdon.get(DON_CODSEZ);
 | 
						|
			codsot = recdon.get(DON_CODSOT);
 | 
						|
			if (codsez.empty())
 | 
						|
			{
 | 
						|
				codsez = recsog.get(SOG_CODSEZ);
 | 
						|
				codsot = recsog.get(SOG_CODSOT);
 | 
						|
			}
 | 
						|
			tipodon = recdon.get(DON_TIPODON);
 | 
						|
			punto = recdon.get(DON_LUOGODON);
 | 
						|
			if (!_solotot)
 | 
						|
			{
 | 
						|
				stat.zero();
 | 
						|
				stat.put(ATS_CODSEZ, codsez);  	 
 | 
						|
				stat.put(ATS_CODSOT, codsot);  	 
 | 
						|
				stat.put(ATS_TIPODON, tipodon);  	 
 | 
						|
				stat.put(ATS_PUNTO, punto);  	 
 | 
						|
				if (stat.read() == NOERR)
 | 
						|
				{
 | 
						|
					numero = stat.get_long(ATS_NUMERO);
 | 
						|
					numero++;
 | 
						|
					stat.put(ATS_NUMERO, numero);
 | 
						|
					int err = stat.rewrite();			
 | 
						|
				}			
 | 
						|
				else
 | 
						|
				{
 | 
						|
					stat.zero();
 | 
						|
					stat.put(ATS_CODSEZ, codsez);  	 
 | 
						|
					stat.put(ATS_CODSOT, codsot);  	 
 | 
						|
					stat.put(ATS_TIPODON, tipodon);  	 
 | 
						|
					stat.put(ATS_PUNTO, punto);  	 
 | 
						|
					numero = 1;
 | 
						|
					stat.put(ATS_NUMERO, numero);
 | 
						|
					int err = stat.write();
 | 
						|
				}
 | 
						|
			}				
 | 
						|
			stat.zero();
 | 
						|
			stat.put(ATS_CODSEZ, "ZZ");  	 
 | 
						|
			stat.put(ATS_CODSOT, "ZZ");  	 
 | 
						|
			stat.put(ATS_TIPODON, tipodon);  	 
 | 
						|
			stat.put(ATS_PUNTO, punto);  	 
 | 
						|
			if (stat.read() == NOERR)
 | 
						|
			{
 | 
						|
				numero = stat.get_long(ATS_NUMERO);
 | 
						|
				numero++;
 | 
						|
				stat.put(ATS_NUMERO, numero);
 | 
						|
				int err = stat.rewrite();			
 | 
						|
			}			
 | 
						|
			else
 | 
						|
			{
 | 
						|
				stat.zero();
 | 
						|
				stat.put(ATS_CODSEZ, "ZZ");  	 
 | 
						|
				stat.put(ATS_CODSOT, "ZZ");  	 
 | 
						|
				stat.put(ATS_TIPODON, tipodon);  	 
 | 
						|
				stat.put(ATS_PUNTO, punto);  	 
 | 
						|
				numero = 1;
 | 
						|
				stat.put(ATS_NUMERO, numero);
 | 
						|
				int err = stat.write();
 | 
						|
			}
 | 
						|
		}	
 | 
						|
		return (stat.eod() > 0);
 | 
						|
	}		
 | 
						|
	else
 | 
						|
		return FALSE;	
 | 
						|
}         
 | 
						|
 | 
						|
int at3800(int argc, char* argv[])
 | 
						|
{
 | 
						|
	TRiepilogoPunto a;
 | 
						|
	a.run(argc, argv, "Riepilogo donazioni per tipo e punto");
 | 
						|
	return 0;
 | 
						|
} |