Patch level : 1.7 at 684
Files correlati : at9.exe Ricompilazione Demo : [ ] Commento : Ultime modifiche ad aggiornamento archivi da estrazione: ne seguiranno altre! git-svn-id: svn://10.65.10.50/trunk@11793 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ffb3b74b40
commit
0b87d28685
125
at/at9300.cpp
125
at/at9300.cpp
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "at9.h"
|
#include "at9.h"
|
||||||
#include "at9300a.h"
|
#include "at9300a.h"
|
||||||
|
#include "atlib.h"
|
||||||
|
|
||||||
#include "soggetti.h"
|
#include "soggetti.h"
|
||||||
#include "donaz.h"
|
#include "donaz.h"
|
||||||
@ -38,13 +39,15 @@ class TProv2com: public TSkeleton_application
|
|||||||
TIsamtempfile* _fileben;
|
TIsamtempfile* _fileben;
|
||||||
TIsamtempfile* _filesto;
|
TIsamtempfile* _filesto;
|
||||||
TLocalisamfile* _soggetti;
|
TLocalisamfile* _soggetti;
|
||||||
|
TRecord_array* _sdonazioni; // sheet donazioni
|
||||||
long _lastcod;
|
long _lastcod;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool create(void);
|
virtual bool create(void);
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
virtual bool destroy(void) ;
|
virtual bool destroy(void) ;
|
||||||
void agg_anagrafica(const TRectype& recsog);
|
void agg_anagrafica(const TRectype& recsog, const bool aggiorna);
|
||||||
|
void agg_donazione(const TRectype& recsog, const TRectype& recdon);
|
||||||
void transfer();
|
void transfer();
|
||||||
void print_line(const TString& message="");
|
void print_line(const TString& message="");
|
||||||
|
|
||||||
@ -63,12 +66,14 @@ bool TProv2com::create()
|
|||||||
_msk = new TMask("at9300a");
|
_msk = new TMask("at9300a");
|
||||||
_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);
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
// distruzione dell'applicazione
|
// distruzione dell'applicazione
|
||||||
bool TProv2com::destroy()
|
bool TProv2com::destroy()
|
||||||
{
|
{
|
||||||
|
delete _sdonazioni;
|
||||||
delete _soggetti;
|
delete _soggetti;
|
||||||
delete _configfile;
|
delete _configfile;
|
||||||
delete _msk;
|
delete _msk;
|
||||||
@ -123,33 +128,33 @@ void TProv2com::transfer()
|
|||||||
_fileben = new TIsamtempfile(LF_BENEM, (const char*) nomeben, FALSE);
|
_fileben = new TIsamtempfile(LF_BENEM, (const char*) nomeben, FALSE);
|
||||||
_filesto = new TIsamtempfile(LF_STORICO, (const char*) nomesto, FALSE);
|
_filesto = new TIsamtempfile(LF_STORICO, (const char*) nomesto, FALSE);
|
||||||
_rel = new TRelation(LF_SOGGETTI);
|
_rel = new TRelation(LF_SOGGETTI);
|
||||||
if (donazioni)
|
|
||||||
{
|
|
||||||
_rel->add(LF_DONAZ, "CODICE==CODICE");
|
|
||||||
}
|
|
||||||
if (controlli)
|
|
||||||
{
|
|
||||||
_rel->add(LF_CONTSAN, "CODICE==CODICE");
|
|
||||||
_rel->add(LF_IDONEITA, "CODICE==CODICE");
|
|
||||||
}
|
|
||||||
if (benemerenze)
|
|
||||||
_rel->add(LF_BENEM, "CODICE==CODICE");
|
|
||||||
if (storico)
|
|
||||||
_rel->add(LF_STORICO, "CODICE==CODICE");
|
|
||||||
|
|
||||||
_reltmp = new TRelation(LF_SOGGETTI);
|
_reltmp = new TRelation(LF_SOGGETTI);
|
||||||
_reltmp->lfile().last();
|
_reltmp->lfile().last();
|
||||||
_lastcod = _reltmp->lfile().get_long(SOG_CODICE);
|
_lastcod = _reltmp->lfile().get_long(SOG_CODICE);
|
||||||
|
|
||||||
//_reltmp->add(LF_DONAZ, "CODICE==CODICE");
|
|
||||||
//_reltmp->add(LF_CONTSAN, "CODICE==CODICE");
|
|
||||||
//_reltmp->add(LF_IDONEITA, "CODICE==CODICE");
|
|
||||||
//_reltmp->add(LF_BENEM, "CODICE==CODICE");
|
|
||||||
//_reltmp->add(LF_STORICO, "CODICE==CODICE");
|
|
||||||
|
|
||||||
_reltmp->replace(_filesog);
|
_reltmp->replace(_filesog);
|
||||||
|
|
||||||
anagrafica = (anagrafica || donazioni || controlli || benemerenze || storico);
|
_rel->add(LF_DONAZ, "CODICE==CODICE");
|
||||||
|
_reltmp->add(LF_DONAZ, "CODICE==CODICE");
|
||||||
|
_reltmp->replace(_filedon, 1);
|
||||||
|
|
||||||
|
_rel->add(LF_CONTSAN, "CODICE==CODICE");
|
||||||
|
_rel->add(LF_IDONEITA, "CODICE==CODICE");
|
||||||
|
_reltmp->add(LF_CONTSAN, "CODICE==CODICE");
|
||||||
|
_reltmp->add(LF_IDONEITA, "CODICE==CODICE");
|
||||||
|
_reltmp->replace(_filecon, 2);
|
||||||
|
_reltmp->replace(_fileido, 3);
|
||||||
|
|
||||||
|
_rel->add(LF_BENEM, "CODICE==CODICE");
|
||||||
|
_reltmp->add(LF_BENEM, "CODICE==CODICE");
|
||||||
|
_reltmp->replace(_fileben, 4);
|
||||||
|
|
||||||
|
_rel->add(LF_STORICO, "CODICE==CODICE");
|
||||||
|
_reltmp->add(LF_STORICO, "CODICE==CODICE");
|
||||||
|
_reltmp->replace(_filesto, 5);
|
||||||
|
|
||||||
|
//anagrafica = (anagrafica || donazioni || controlli || benemerenze || storico);
|
||||||
TCursor cursore(_reltmp);
|
TCursor cursore(_reltmp);
|
||||||
long records = cursore.items();
|
long records = cursore.items();
|
||||||
TProgind pi(records,"Aggiornamento archivi", TRUE, TRUE);
|
TProgind pi(records,"Aggiornamento archivi", TRUE, TRUE);
|
||||||
@ -159,8 +164,7 @@ void TProv2com::transfer()
|
|||||||
const long codsog = cursore.curr().get_long(SOG_CODICE);
|
const long codsog = cursore.curr().get_long(SOG_CODICE);
|
||||||
pi.addstatus(1);
|
pi.addstatus(1);
|
||||||
if (pi.iscancelled()) break;
|
if (pi.iscancelled()) break;
|
||||||
if (anagrafica)
|
agg_anagrafica(cursore.curr(), anagrafica);
|
||||||
agg_anagrafica(cursore.curr());
|
|
||||||
if (donazioni)
|
if (donazioni)
|
||||||
{
|
{
|
||||||
bool continua = TRUE;
|
bool continua = TRUE;
|
||||||
@ -168,7 +172,7 @@ void TProv2com::transfer()
|
|||||||
{
|
{
|
||||||
const long codice = cursore.curr(LF_DONAZ).get_long(DON_CODICE);
|
const long codice = cursore.curr(LF_DONAZ).get_long(DON_CODICE);
|
||||||
if (codice == codsog)
|
if (codice == codsog)
|
||||||
//filedon.write(cursore.curr(LF_DONAZ));
|
agg_donazione(cursore.curr(), cursore.curr(LF_DONAZ));
|
||||||
continua = cursore.next_match(LF_DONAZ, "CODICE");
|
continua = cursore.next_match(LF_DONAZ, "CODICE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +229,7 @@ void TProv2com::print_line(const TString& message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TProv2com::agg_anagrafica(const TRectype& recsog)
|
void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
||||||
{
|
{
|
||||||
bool print_intest = FALSE;
|
bool print_intest = FALSE;
|
||||||
TString intestazione = "";
|
TString intestazione = "";
|
||||||
@ -244,7 +248,23 @@ void TProv2com::agg_anagrafica(const TRectype& recsog)
|
|||||||
intestazione << nome;
|
intestazione << nome;
|
||||||
intestazione << " ";
|
intestazione << " ";
|
||||||
intestazione << datanasc.string();
|
intestazione << datanasc.string();
|
||||||
|
bool confronta = TRUE;
|
||||||
|
if (!aggiorna)
|
||||||
|
{
|
||||||
|
_soggetti->read(rec);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_soggetti->read(rec)==NOERR)
|
if (_soggetti->read(rec)==NOERR)
|
||||||
|
{
|
||||||
|
TString16 catdon = recsog.get(SOG_CATDON);
|
||||||
|
TString16 catorig = rec.get(SOG_CATDON);
|
||||||
|
if (catdon == catorig)
|
||||||
|
{
|
||||||
|
const char xcatdon = _configfile->get(catdon, "CATDON")[0];
|
||||||
|
if (xcatdon != X_SOS_CONAVVISO)
|
||||||
|
confronta = FALSE;
|
||||||
|
}
|
||||||
|
if (confronta)
|
||||||
{
|
{
|
||||||
for (int i=1;i<recsog.items();i++)
|
for (int i=1;i<recsog.items();i++)
|
||||||
{
|
{
|
||||||
@ -304,6 +324,8 @@ void TProv2com::agg_anagrafica(const TRectype& recsog)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_soggetti->rewrite(rec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -315,12 +337,63 @@ void TProv2com::agg_anagrafica(const TRectype& recsog)
|
|||||||
rec = recsog;
|
rec = recsog;
|
||||||
rec.put(SOG_CODICE, _lastcod);
|
rec.put(SOG_CODICE, _lastcod);
|
||||||
_soggetti->write(rec);
|
_soggetti->write(rec);
|
||||||
message << " INSERITO ";
|
message << " INSERITO con codice ";
|
||||||
|
message << _lastcod;
|
||||||
print_line(message);
|
print_line(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
||||||
|
{
|
||||||
|
bool print_intest = FALSE;
|
||||||
|
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& datadon = recdon.get_date(DON_DATADON);
|
||||||
|
const TDate& dataultdon = rec.get_date(SOG_DATAULTDON);
|
||||||
|
if (datadon > dataultdon)
|
||||||
|
{
|
||||||
|
TRectype* key = new TRectype(LF_DONAZ);
|
||||||
|
key->put(DON_CODICE, rec.get(SOG_CODICE));
|
||||||
|
int err = _sdonazioni->read(key);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
TRectype recnew(recdon);
|
||||||
|
recnew.put(DON_CODICE, rec.get_long(SOG_CODICE));
|
||||||
|
recnew.put(DON_PROGDON, _sdonazioni->rows()+1);
|
||||||
|
_sdonazioni->add_row(recnew);
|
||||||
|
_sdonazioni->rewrite();
|
||||||
|
calcola_donazioni_lib(rec, _sdonazioni);
|
||||||
|
TDate oggi(TODAY);
|
||||||
|
rec.put(SOG_DATAULTAGG, oggi);
|
||||||
|
rec.put(SOG_UTENULTAGG, "PROV");
|
||||||
|
_soggetti->rewrite(rec);
|
||||||
|
print_line(intestazione);
|
||||||
|
message = " INSERITA DONAZIONE in data ";
|
||||||
|
message << datadon.string();
|
||||||
|
print_line(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int at9300(int argc, char* argv[])
|
int at9300(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TProv2com a;
|
TProv2com a;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user