Patch level : 1.7 at 694
Files correlati : at9.exe Ricompilazione Demo : [ ] Commento : Aggiornamento dati da estrazione: aggiunto trasferimento dei controlli sanitari git-svn-id: svn://10.65.10.50/trunk@11923 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b00641b36c
commit
3234b3f1d9
@ -40,7 +40,9 @@ class TProv2com: public TSkeleton_application
|
|||||||
TIsamtempfile* _filesto;
|
TIsamtempfile* _filesto;
|
||||||
TLocalisamfile* _soggetti;
|
TLocalisamfile* _soggetti;
|
||||||
TRecord_array* _sdonazioni; // sheet donazioni
|
TRecord_array* _sdonazioni; // sheet donazioni
|
||||||
|
TRecord_array* _scontrolli; // sheet controlli
|
||||||
long _lastcod;
|
long _lastcod;
|
||||||
|
bool _print_header;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool create(void);
|
virtual bool create(void);
|
||||||
@ -48,6 +50,7 @@ protected:
|
|||||||
virtual bool destroy(void) ;
|
virtual bool destroy(void) ;
|
||||||
void agg_anagrafica(const TRectype& recsog, const bool aggiorna);
|
void agg_anagrafica(const TRectype& recsog, const bool aggiorna);
|
||||||
void agg_donazione(const TRectype& recsog, const TRectype& recdon);
|
void agg_donazione(const TRectype& recsog, const TRectype& recdon);
|
||||||
|
void agg_controllo(const TRectype& recsog, const TRectype& reccon);
|
||||||
void transfer();
|
void transfer();
|
||||||
void print_line(const TString& message="");
|
void print_line(const TString& message="");
|
||||||
|
|
||||||
@ -57,6 +60,21 @@ public:
|
|||||||
virtual ~TProv2com() {}
|
virtual ~TProv2com() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int compare_date(const TObject** o1, const TObject** o2)
|
||||||
|
{
|
||||||
|
const TRectype& s1 = *((TRectype*)*o1);
|
||||||
|
const TRectype& s2 = *((TRectype*)*o2);
|
||||||
|
|
||||||
|
const TDate d1(s1.get(CON_DATACON));
|
||||||
|
const TDate d2(s2.get(CON_DATACON));
|
||||||
|
|
||||||
|
int d=0;
|
||||||
|
if (d1>d2) d=+1;
|
||||||
|
else
|
||||||
|
if (d1<d2) d=-1;
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
// restituisce un riferimento all' applicazione
|
// restituisce un riferimento all' applicazione
|
||||||
inline TProv2com& app() { return (TProv2com&) main_app();}
|
inline TProv2com& app() { return (TProv2com&) main_app();}
|
||||||
|
|
||||||
@ -67,12 +85,14 @@ bool TProv2com::create()
|
|||||||
_configfile = new TConfig("at9300a.ini");
|
_configfile = new TConfig("at9300a.ini");
|
||||||
_soggetti = new TLocalisamfile(LF_SOGGETTI);
|
_soggetti = new TLocalisamfile(LF_SOGGETTI);
|
||||||
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
|
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
|
||||||
|
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
// distruzione dell'applicazione
|
// distruzione dell'applicazione
|
||||||
bool TProv2com::destroy()
|
bool TProv2com::destroy()
|
||||||
{
|
{
|
||||||
|
delete _scontrolli;
|
||||||
delete _sdonazioni;
|
delete _sdonazioni;
|
||||||
delete _soggetti;
|
delete _soggetti;
|
||||||
delete _configfile;
|
delete _configfile;
|
||||||
@ -183,7 +203,7 @@ void TProv2com::transfer()
|
|||||||
{
|
{
|
||||||
const long codice = cursore.curr(LF_CONTSAN).get_long(CON_CODICE);
|
const long codice = cursore.curr(LF_CONTSAN).get_long(CON_CODICE);
|
||||||
if (codice == codsog)
|
if (codice == codsog)
|
||||||
//filecon.write(cursore.curr(LF_CONTSAN));
|
agg_controllo(cursore.curr(), cursore.curr(LF_CONTSAN));
|
||||||
continua = cursore.next_match(LF_CONTSAN, "CODICE");
|
continua = cursore.next_match(LF_CONTSAN, "CODICE");
|
||||||
}
|
}
|
||||||
continua = TRUE;
|
continua = TRUE;
|
||||||
@ -191,7 +211,9 @@ void TProv2com::transfer()
|
|||||||
{
|
{
|
||||||
const long codice = cursore.curr(LF_IDONEITA).get_long(IDO_CODICE);
|
const long codice = cursore.curr(LF_IDONEITA).get_long(IDO_CODICE);
|
||||||
if (codice == codsog)
|
if (codice == codsog)
|
||||||
|
{
|
||||||
//fileido.write(cursore.curr(LF_IDONEITA));
|
//fileido.write(cursore.curr(LF_IDONEITA));
|
||||||
|
}
|
||||||
continua = cursore.next_match(LF_IDONEITA, "CODICE");
|
continua = cursore.next_match(LF_IDONEITA, "CODICE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +253,7 @@ void TProv2com::print_line(const TString& message)
|
|||||||
|
|
||||||
void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
||||||
{
|
{
|
||||||
bool print_intest = FALSE;
|
_print_header = FALSE;
|
||||||
TString intestazione = "";
|
TString intestazione = "";
|
||||||
TString message = "";
|
TString message = "";
|
||||||
const TString80 cognome = recsog.get(SOG_COGNOME);
|
const TString80 cognome = recsog.get(SOG_COGNOME);
|
||||||
@ -277,11 +299,11 @@ void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
|||||||
TString interno = rec.get(campo);
|
TString interno = rec.get(campo);
|
||||||
if (esterno != interno)
|
if (esterno != interno)
|
||||||
{
|
{
|
||||||
if (!print_intest)
|
if (!_print_header)
|
||||||
{
|
{
|
||||||
print_line();
|
print_line();
|
||||||
print_line(intestazione);
|
print_line(intestazione);
|
||||||
print_intest = TRUE;
|
_print_header = TRUE;
|
||||||
}
|
}
|
||||||
switch (operazione)
|
switch (operazione)
|
||||||
{
|
{
|
||||||
@ -346,7 +368,6 @@ void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
|||||||
|
|
||||||
void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
||||||
{
|
{
|
||||||
bool print_intest = FALSE;
|
|
||||||
TString intestazione = "";
|
TString intestazione = "";
|
||||||
TString message = "";
|
TString message = "";
|
||||||
const TString80 cognome = recsog.get(SOG_COGNOME);
|
const TString80 cognome = recsog.get(SOG_COGNOME);
|
||||||
@ -384,7 +405,11 @@ void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
|||||||
rec.put(SOG_DATAULTAGG, oggi);
|
rec.put(SOG_DATAULTAGG, oggi);
|
||||||
rec.put(SOG_UTENULTAGG, "PROV");
|
rec.put(SOG_UTENULTAGG, "PROV");
|
||||||
_soggetti->rewrite(rec);
|
_soggetti->rewrite(rec);
|
||||||
print_line(intestazione);
|
if (!_print_header)
|
||||||
|
{
|
||||||
|
print_line(intestazione);
|
||||||
|
_print_header = TRUE;
|
||||||
|
}
|
||||||
message = " INSERITA DONAZIONE in data ";
|
message = " INSERITA DONAZIONE in data ";
|
||||||
message << datadon.string();
|
message << datadon.string();
|
||||||
print_line(message);
|
print_line(message);
|
||||||
@ -393,6 +418,67 @@ void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TProv2com::agg_controllo(const TRectype& recsog, const TRectype& reccon)
|
||||||
|
{
|
||||||
|
TString intestazione = "";
|
||||||
|
TString message = "";
|
||||||
|
const TString80 cognome = recsog.get(SOG_COGNOME);
|
||||||
|
const TString80 nome = recsog.get(SOG_NOME);
|
||||||
|
const TDate datanasc = recsog.get_date(SOG_DATANASC);
|
||||||
|
_soggetti->setkey(2);
|
||||||
|
TRectype& rec = _rel->curr();
|
||||||
|
rec.zero();
|
||||||
|
rec.put(SOG_COGNOME, cognome);
|
||||||
|
rec.put(SOG_NOME, nome);
|
||||||
|
rec.put(SOG_DATANASC, datanasc);
|
||||||
|
intestazione = cognome;
|
||||||
|
intestazione << " ";
|
||||||
|
intestazione << nome;
|
||||||
|
intestazione << " ";
|
||||||
|
intestazione << datanasc.string();
|
||||||
|
if (_soggetti->read(rec)==NOERR)
|
||||||
|
{
|
||||||
|
const TDate& datacon = reccon.get_date(CON_DATACON);
|
||||||
|
TLocalisamfile contsan(LF_CONTSAN);
|
||||||
|
contsan.setkey(2);
|
||||||
|
contsan.zero();
|
||||||
|
contsan.put(CON_CODICE, rec.get(SOG_CODICE));
|
||||||
|
contsan.put(CON_DATACON, datacon);
|
||||||
|
if (contsan.read()==NOERR)
|
||||||
|
{
|
||||||
|
// esiste gia il controllo
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRectype* key = new TRectype(LF_CONTSAN);
|
||||||
|
key->put(CON_CODICE, rec.get(SOG_CODICE));
|
||||||
|
int err = _scontrolli->read(key);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
TRectype recnew(reccon);
|
||||||
|
recnew.put(CON_CODICE, rec.get_long(SOG_CODICE));
|
||||||
|
recnew.put(CON_PROGCON, _scontrolli->rows()+1);
|
||||||
|
_scontrolli->add_row(recnew);
|
||||||
|
_scontrolli->sort(compare_date);
|
||||||
|
_scontrolli->rewrite();
|
||||||
|
calcola_donazioni_lib(rec, _sdonazioni);
|
||||||
|
TDate oggi(TODAY);
|
||||||
|
rec.put(SOG_DATAULTAGG, oggi);
|
||||||
|
rec.put(SOG_UTENULTAGG, "PROV");
|
||||||
|
_soggetti->rewrite(rec);
|
||||||
|
if (!_print_header)
|
||||||
|
{
|
||||||
|
print_line(intestazione);
|
||||||
|
_print_header = TRUE;
|
||||||
|
}
|
||||||
|
const char* tipocon = reccon.get(CON_TIPOCON);
|
||||||
|
message.format(" INSERITO CONTROLLO %s in data %s", tipocon, datacon.string());
|
||||||
|
print_line(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int at9300(int argc, char* argv[])
|
int at9300(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user