Files correlati : Ricompilazione Demo : [ ] Commento : Riportate le patch fino alla 2.1 490 Controllare velib.h. il merge era impossibile Controllare modaut.h e campo.aut. pack DT Contabilità industriale conflittano git-svn-id: svn://10.65.10.50/trunk@13668 c028cbd2-c16b-5b4b-a496-9718f37d4682
639 lines
18 KiB
C++
Executable File
639 lines
18 KiB
C++
Executable File
#include <applicat.h>
|
|
#include <filetext.h>
|
|
#include <form.h>
|
|
#include <mask.h>
|
|
#include <progind.h>
|
|
#include <relation.h>
|
|
#include <tabutil.h>
|
|
#include <printer.h>
|
|
#include <recarray.h>
|
|
#include <utility.h>
|
|
|
|
#include "at9.h"
|
|
#include "at9300a.h"
|
|
#include "atlib.h"
|
|
|
|
#include "soggetti.h"
|
|
#include "donaz.h"
|
|
#include "contsan.h"
|
|
#include "idoneita.h"
|
|
#include "benem.h"
|
|
#include "storico.h"
|
|
|
|
#define X_SOS_CONAVVISO 'A'
|
|
#define X_SOS_NONAVVISO 'S'
|
|
#define X_INS_SEVUOTO 'R'
|
|
#define X_VIS_SEDIVERSO 'V'
|
|
#define X_IGNORA 'I'
|
|
|
|
class TProv2com: public TSkeleton_application
|
|
{
|
|
TMask* _msk;
|
|
TRelation* _rel;
|
|
TRelation* _reltmp;
|
|
TConfig* _configfile;
|
|
TIsamtempfile* _filesog;
|
|
TIsamtempfile* _filedon;
|
|
TIsamtempfile* _filecon;
|
|
TIsamtempfile* _fileido;
|
|
TIsamtempfile* _fileben;
|
|
TIsamtempfile* _filesto;
|
|
TLocalisamfile* _soggetti;
|
|
TRecord_array* _sdonazioni; // sheet donazioni
|
|
TRecord_array* _scontrolli; // sheet controlli
|
|
TRecord_array* _sidoneita; // sheet idoneita
|
|
TRecord_array* _sbenem; // sheet benemerenze
|
|
TRecord_array* _sstorico; // sheet storico
|
|
long _lastcod;
|
|
bool _print_header;
|
|
|
|
protected:
|
|
virtual bool create(void);
|
|
virtual void main_loop();
|
|
virtual bool destroy(void) ;
|
|
void agg_anagrafica(const TRectype& recsog, const bool aggiorna);
|
|
void agg_donazione(const TRectype& recsog, const TRectype& recdon);
|
|
void agg_controllo(const TRectype& recsog, const TRectype& reccon);
|
|
void agg_benemerenza(const TRectype& recsog, const TRectype& recben);
|
|
void agg_storico(const TRectype& recsog, const TRectype& recsto);
|
|
void transfer();
|
|
void print_line(const TString& message="");
|
|
|
|
public:
|
|
const TMask& msk() const { return *_msk; }
|
|
TProv2com() {}
|
|
virtual ~TProv2com() {}
|
|
};
|
|
|
|
static int compare_date_con(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;
|
|
}
|
|
|
|
static int compare_date_ben(const TObject** o1, const TObject** o2)
|
|
{
|
|
const TRectype& s1 = *((TRectype*)*o1);
|
|
const TRectype& s2 = *((TRectype*)*o2);
|
|
|
|
const TDate d1(s1.get(BEN_DATABEN));
|
|
const TDate d2(s2.get(BEN_DATABEN));
|
|
|
|
int d=0;
|
|
if (d1>d2) d=+1;
|
|
else
|
|
if (d1<d2) d=-1;
|
|
return d;
|
|
}
|
|
|
|
static int compare_date_sto(const TObject** o1, const TObject** o2)
|
|
{
|
|
const TRectype& s1 = *((TRectype*)*o1);
|
|
const TRectype& s2 = *((TRectype*)*o2);
|
|
|
|
const TDate d1(s1.get(STO_DATAISC));
|
|
const TDate d2(s2.get(STO_DATAISC));
|
|
|
|
int d=0;
|
|
if (d1>d2) d=+1;
|
|
else
|
|
if (d1<d2) d=-1;
|
|
return d;
|
|
}
|
|
|
|
// restituisce un riferimento all' applicazione
|
|
inline TProv2com& app() { return (TProv2com&) main_app();}
|
|
|
|
// creazione dell'applicazione
|
|
bool TProv2com::create()
|
|
{
|
|
_msk = new TMask("at9300a");
|
|
_configfile = new TConfig("at9300a.ini");
|
|
_soggetti = new TLocalisamfile(LF_SOGGETTI);
|
|
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
|
|
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
|
|
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
|
|
_sbenem = new TRecord_array(LF_BENEM,BEN_PROGBEN);
|
|
_sstorico = new TRecord_array(LF_STORICO,STO_PROGSTO);
|
|
return TSkeleton_application::create();
|
|
}
|
|
|
|
// distruzione dell'applicazione
|
|
bool TProv2com::destroy()
|
|
{
|
|
delete _sstorico;
|
|
delete _sbenem;
|
|
delete _sidoneita;
|
|
delete _scontrolli;
|
|
delete _sdonazioni;
|
|
delete _soggetti;
|
|
delete _configfile;
|
|
delete _msk;
|
|
return TSkeleton_application::destroy();
|
|
}
|
|
|
|
// carica la maschera
|
|
void TProv2com::main_loop()
|
|
{
|
|
_msk->set(F_PERCORSO,_configfile->get("PERCORSO", "ARCHIVIO"));
|
|
KEY key = _msk->run();
|
|
if (key == K_ENTER)
|
|
{
|
|
if (printer().open())
|
|
{
|
|
transfer();
|
|
_configfile->set("PERCORSO", _msk->get(F_PERCORSO), "ARCHIVIO");
|
|
TDate oggi(TODAY);
|
|
_configfile->set("DATA", oggi, "ARCHIVIO");
|
|
printer().close();
|
|
}
|
|
}
|
|
}
|
|
|
|
// trasferimento dati da file CT su programma avis
|
|
void TProv2com::transfer()
|
|
{
|
|
bool anagrafica = _msk->get_bool(F_ANAGRAFICA);
|
|
const bool donazioni = _msk->get_bool(F_DONAZIONI);
|
|
const bool controlli = _msk->get_bool(F_CONTROLLI);
|
|
const bool benemerenze = _msk->get_bool(F_BENEMERENZE);
|
|
const bool storico = _msk->get_bool(F_STORICO);
|
|
TString80 percorso = _msk->get(F_PERCORSO);
|
|
percorso.insert("%");
|
|
TString80 nomesog = percorso;
|
|
nomesog << "SOGGETTI";
|
|
TString80 nomedon = percorso;
|
|
nomedon << "DONAZ";
|
|
TString80 nomecon = percorso;
|
|
nomecon << "CONTSAN";
|
|
TString80 nomeido = percorso;
|
|
nomeido << "IDONEITA";
|
|
TString80 nomeben = percorso;
|
|
nomeben << "BENEM";
|
|
TString80 nomesto = percorso;
|
|
nomesto << "STORICO";
|
|
|
|
_filesog = new TIsamtempfile(LF_SOGGETTI, (const char *) nomesog, FALSE);
|
|
_filecon = new TIsamtempfile(LF_CONTSAN, (const char*) nomecon, FALSE);
|
|
_filedon = new TIsamtempfile(LF_DONAZ, (const char* ) nomedon, FALSE);
|
|
_fileido = new TIsamtempfile(LF_IDONEITA, (const char*) nomeido, FALSE);
|
|
_fileben = new TIsamtempfile(LF_BENEM, (const char*) nomeben, FALSE);
|
|
_filesto = new TIsamtempfile(LF_STORICO, (const char*) nomesto, FALSE);
|
|
_rel = new TRelation(LF_SOGGETTI);
|
|
|
|
_reltmp = new TRelation(LF_SOGGETTI);
|
|
_reltmp->lfile().last();
|
|
_lastcod = _reltmp->lfile().get_long(SOG_CODICE);
|
|
|
|
_reltmp->replace(_filesog);
|
|
|
|
_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);
|
|
long records = cursore.items();
|
|
TProgind pi(records,"Aggiornamento archivi", TRUE, TRUE);
|
|
pi.setstatus(1);
|
|
for (cursore = 0; cursore.pos() < records; ++(cursore))
|
|
{
|
|
const long codsog = cursore.curr().get_long(SOG_CODICE);
|
|
pi.addstatus(1);
|
|
if (pi.iscancelled()) break;
|
|
agg_anagrafica(cursore.curr(), anagrafica);
|
|
if (donazioni)
|
|
{
|
|
bool continua = TRUE;
|
|
while (continua)
|
|
{
|
|
const long codice = cursore.curr(LF_DONAZ).get_long(DON_CODICE);
|
|
if (codice == codsog)
|
|
agg_donazione(cursore.curr(), cursore.curr(LF_DONAZ));
|
|
continua = cursore.next_match(LF_DONAZ, "CODICE");
|
|
}
|
|
}
|
|
if (controlli)
|
|
{
|
|
bool continua = TRUE;
|
|
while (continua)
|
|
{
|
|
const long codice = cursore.curr(LF_CONTSAN).get_long(CON_CODICE);
|
|
if (codice == codsog)
|
|
agg_controllo(cursore.curr(), cursore.curr(LF_CONTSAN));
|
|
continua = cursore.next_match(LF_CONTSAN, "CODICE");
|
|
}
|
|
continua = TRUE;
|
|
while (continua)
|
|
{
|
|
const long codice = cursore.curr(LF_IDONEITA).get_long(IDO_CODICE);
|
|
if (codice == codsog)
|
|
{
|
|
//fileido.write(cursore.curr(LF_IDONEITA));
|
|
}
|
|
continua = cursore.next_match(LF_IDONEITA, "CODICE");
|
|
}
|
|
}
|
|
if (benemerenze)
|
|
{
|
|
bool continua = TRUE;
|
|
while (continua)
|
|
{
|
|
const long codice = cursore.curr(LF_BENEM).get_long(BEN_CODICE);
|
|
if (codice == codsog)
|
|
agg_benemerenza(cursore.curr(), cursore.curr(LF_BENEM));
|
|
continua = cursore.next_match(LF_BENEM, "CODICE");
|
|
}
|
|
}
|
|
if (storico)
|
|
{
|
|
bool continua = TRUE;
|
|
while (continua)
|
|
{
|
|
const long codice = cursore.curr(LF_STORICO).get_long(STO_CODICE);
|
|
if (codice == codsog)
|
|
agg_storico(cursore.curr(), cursore.curr(LF_STORICO));
|
|
continua = cursore.next_match(LF_STORICO, "CODICE");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void TProv2com::print_line(const TString& message)
|
|
{
|
|
TPrintrow row;
|
|
row.reset();
|
|
row.put((const char*) message);
|
|
printer().print(row);
|
|
}
|
|
|
|
|
|
void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
|
|
{
|
|
_print_header = 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();
|
|
bool confronta = TRUE;
|
|
if (!aggiorna)
|
|
{
|
|
_soggetti->read(rec);
|
|
return;
|
|
}
|
|
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++)
|
|
{
|
|
message = " ";
|
|
TString80 campo(recsog.fieldname(i));
|
|
if (campo.not_empty())
|
|
{
|
|
char operazione = _configfile->get(campo, "SOGGETTI")[0];
|
|
if (operazione == ' ')
|
|
operazione = X_IGNORA;
|
|
TString esterno = recsog.get(campo);
|
|
TString interno = rec.get(campo);
|
|
if (esterno != interno)
|
|
{
|
|
if (!_print_header)
|
|
{
|
|
print_line();
|
|
print_line(intestazione);
|
|
_print_header = TRUE;
|
|
}
|
|
switch (operazione)
|
|
{
|
|
case X_SOS_CONAVVISO:
|
|
{
|
|
rec.put(campo, esterno);
|
|
message << campo;
|
|
message << " da ";
|
|
message << interno;
|
|
message << " a ";
|
|
message << esterno;
|
|
print_line(message);
|
|
}
|
|
break;
|
|
case X_SOS_NONAVVISO:
|
|
{
|
|
rec.put(campo, esterno);
|
|
}
|
|
break;
|
|
case X_INS_SEVUOTO:
|
|
{
|
|
if (interno.empty())
|
|
rec.put(campo, esterno);
|
|
}
|
|
break;
|
|
case X_VIS_SEDIVERSO:
|
|
{
|
|
message << campo;
|
|
message << " originale ";
|
|
message << interno;
|
|
message << " aggiornamento ";
|
|
message << esterno;
|
|
print_line(message);
|
|
}
|
|
break;
|
|
case X_IGNORA:
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_soggetti->rewrite(rec);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TString16 catdon = recsog.get(SOG_CATDON);
|
|
const char xcatdon = _configfile->get(catdon, "CATDON")[0];
|
|
if (xcatdon == X_SOS_CONAVVISO)
|
|
{
|
|
_lastcod = _lastcod + 1;
|
|
rec = recsog;
|
|
rec.put(SOG_CODICE, _lastcod);
|
|
_soggetti->write(rec);
|
|
message << " INSERITO con codice ";
|
|
message << _lastcod;
|
|
print_line(message);
|
|
}
|
|
}
|
|
}
|
|
|
|
void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
|
|
{
|
|
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);
|
|
TRectype* key = new TRectype(LF_DONAZ);
|
|
key->put(DON_CODICE, rec.get(SOG_CODICE));
|
|
int err = _sdonazioni->read(key);
|
|
if (datadon > dataultdon || _sdonazioni->rows() == 0)
|
|
{
|
|
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);
|
|
if (!_print_header)
|
|
{
|
|
print_line();
|
|
print_line(intestazione);
|
|
_print_header = TRUE;
|
|
}
|
|
message = " INSERITA DONAZIONE in data ";
|
|
message << datadon.string();
|
|
print_line(message);
|
|
}
|
|
}
|
|
}
|
|
|
|
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);
|
|
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_con);
|
|
_scontrolli->rewrite();
|
|
TRectype* keyi = new TRectype(LF_IDONEITA);
|
|
keyi->put(IDO_CODICE, rec.get(SOG_CODICE));
|
|
err = _sidoneita->read(keyi);
|
|
con_reord(rec, _scontrolli, _sidoneita);
|
|
don_datepross(rec);
|
|
TDate oggi(TODAY);
|
|
rec.put(SOG_DATAULTAGG, oggi);
|
|
rec.put(SOG_UTENULTAGG, "PROV");
|
|
_soggetti->rewrite(rec);
|
|
if (!_print_header)
|
|
{
|
|
print_line();
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
void TProv2com::agg_benemerenza(const TRectype& recsog, const TRectype& recben)
|
|
{
|
|
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 TString16& tipoben = recben.get(BEN_TIPOBEN);
|
|
TLocalisamfile benem(LF_BENEM);
|
|
benem.setkey(3);
|
|
benem.zero();
|
|
benem.put(BEN_CODICE, rec.get(SOG_CODICE));
|
|
benem.put(BEN_TIPOBEN, tipoben);
|
|
if (benem.read()==NOERR)
|
|
{
|
|
// esiste gia la benemerenza
|
|
}
|
|
else
|
|
{
|
|
TRectype* key = new TRectype(LF_BENEM);
|
|
key->put(BEN_CODICE, rec.get(SOG_CODICE));
|
|
int err = _sbenem->read(key);
|
|
TRectype recnew(recben);
|
|
recnew.put(BEN_CODICE, rec.get_long(SOG_CODICE));
|
|
recnew.put(BEN_PROGBEN, _sbenem->rows()+1);
|
|
_sbenem->add_row(recnew);
|
|
_sbenem->sort(compare_date_ben);
|
|
_sbenem->rewrite();
|
|
TDate oggi(TODAY);
|
|
rec.put(SOG_DATAULTAGG, oggi);
|
|
rec.put(SOG_UTENULTAGG, "PROV");
|
|
_soggetti->rewrite(rec);
|
|
if (!_print_header)
|
|
{
|
|
print_line();
|
|
print_line(intestazione);
|
|
_print_header = TRUE;
|
|
}
|
|
message.format(" INSERITA BENEMERENZA %s", (const char*) tipoben);
|
|
print_line(message);
|
|
}
|
|
}
|
|
}
|
|
|
|
void TProv2com::agg_storico(const TRectype& recsog, const TRectype& recsto)
|
|
{
|
|
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)
|
|
{
|
|
TRectype recnew(recsto);
|
|
recnew.put(STO_CODICE, rec.get_long(SOG_CODICE));
|
|
TRectype* key = new TRectype(LF_STORICO);
|
|
key->put(STO_CODICE, rec.get(SOG_CODICE));
|
|
int err = _sstorico->read(key);
|
|
const int progsto = recsto.get_int(STO_PROGSTO);
|
|
TLocalisamfile storico(LF_STORICO);
|
|
storico.setkey(1);
|
|
storico.zero();
|
|
storico.put(STO_CODICE, rec.get(SOG_CODICE));
|
|
storico.put(STO_PROGSTO, progsto);
|
|
if (storico.read()!=NOERR)
|
|
recnew.put(STO_PROGSTO, _sstorico->rows()+1);
|
|
_sstorico->add_row(recnew);
|
|
_sstorico->sort(compare_date_sto);
|
|
_sstorico->rewrite();
|
|
TDate oggi(TODAY);
|
|
rec.put(SOG_DATAULTAGG, oggi);
|
|
rec.put(SOG_UTENULTAGG, "PROV");
|
|
_soggetti->rewrite(rec);
|
|
if (!_print_header)
|
|
{
|
|
print_line();
|
|
print_line(intestazione);
|
|
_print_header = TRUE;
|
|
}
|
|
message.format(" INSERITA RIGA DI STORICO");
|
|
print_line(message);
|
|
}
|
|
}
|
|
|
|
int at9300(int argc, char* argv[])
|
|
{
|
|
TProv2com a;
|
|
a.run(argc, argv, "Aggiornamento archivi da estrazione");
|
|
return 0;
|
|
}
|