Patch level : 1.7 at

Files correlati     : at8.exe
Ricompilazione Demo : [ ]
Commento            : correzioni su trasf. da Cetraplus


git-svn-id: svn://10.65.10.50/trunk@12550 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2004-12-15 09:52:19 +00:00
parent 12eea0bede
commit 50441f610f

View File

@ -1048,31 +1048,35 @@ bool TCtpr2at::accesso(const TString& istruzione)
TString8 luogodon_at;
TString16& str = (TString16&) record["DT_ACCESSO"];
const TDate datadon = TDate(atoi(str.sub(8,10)) ,atoi(str.sub(5,7)), atoi(str.sub(0,4)));
TString16& codabar = (TString16&) record["CODABAR"];
_donaz->setkey(2);
TRectype& recdon = _donaz->curr();
recdon.zero();
recdon.put(DON_CODICE, recsog.get(SOG_CODICE));
recdon.put(DON_DATADON, datadon);
if (_donaz->read() == NOERR)
{
if ((codabar.left(2) == "52") || (codabar.left(2) == "53") || (codabar.left(2) == "54") || (codabar.left(2) == "55") || (codabar.left(2) == "56") || (codabar.left(2) == "57"))
luogodon_at = "0001";
else
{
if (recsog.get(SOG_CODSEZ) == "13")
luogodon_at = "1301";
else
luogodon_at = "0000";
}
recdon.put(DON_LUOGODON, luogodon_at);
_donaz->rewrite();
TString16& prog = (TString16&) record["PROG_GIORNAL"];
TString80 chiave = str;
chiave << prog;
if (!_array_donaz->is_key(chiave))
_array_donaz->add(chiave, record["ID_ANAGRAFICA"]) ;
}
TDate datanulla(NULLDATE);
if (datadon != datanulla)
{
TString16& codabar = (TString16&) record["CODABAR"];
_donaz->setkey(2);
TRectype& recdon = _donaz->curr();
recdon.zero();
recdon.put(DON_CODICE, recsog.get(SOG_CODICE));
recdon.put(DON_DATADON, datadon);
if (_donaz->read() == NOERR)
{
if ((codabar.left(2) == "52") || (codabar.left(2) == "53") || (codabar.left(2) == "54") || (codabar.left(2) == "55") || (codabar.left(2) == "56") || (codabar.left(2) == "57"))
luogodon_at = "0001";
else
{
if (recsog.get(SOG_CODSEZ) == "13")
luogodon_at = "1301";
else
luogodon_at = "0000";
}
recdon.put(DON_LUOGODON, luogodon_at);
_donaz->rewrite();
TString16& prog = (TString16&) record["PROG_GIORNAL"];
TString80 chiave = str;
chiave << prog;
if (!_array_donaz->is_key(chiave))
_array_donaz->add(chiave, record["ID_ANAGRAFICA"]) ;
}
}
}
else
{
@ -1080,122 +1084,126 @@ bool TCtpr2at::accesso(const TString& istruzione)
TString4 tipocon = _configfile->get(tp_accesso, "ACCESSI");
TString16& str = (TString16&) record["DT_ACCESSO"];
TDate datacon = TDate(atoi(str.sub(8,10)) ,atoi(str.sub(5,7)), atoi(str.sub(0,4)));
TString16& prog = (TString16&) record["PROG_GIORNAL"];
TString80 chiave = str;
chiave << prog;
if (!_array_donaz->is_key(chiave))
_array_donaz->add(chiave, record["ID_ANAGRAFICA"]) ;
if (tipocon.empty() && _message)
TDate datanulla(NULLDATE);
if (datacon != datanulla)
{
print_line(stampa);
stampa = "Tipo accesso ";
stampa << tp_accesso[0] << " del ";
stampa << datacon.string() << " senza corrispondenza. Non inserito.";
print_line(stampa);
tipocon = "VS";
}
else
{
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, recsog.get(SOG_CODICE));
recc->put(CON_DATACON, datacon);
recc->put(CON_TIPOCON, tipocon);
recc->put(CON_RESPONSAB, "CETRAPLUS");
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, recsog.get(SOG_CODICE));
int err = _scontrolli->read(keyc);
if (err == NOERR)
TString16& prog = (TString16&) record["PROG_GIORNAL"];
TString80 chiave = str;
chiave << prog;
if (!_array_donaz->is_key(chiave))
_array_donaz->add(chiave, record["ID_ANAGRAFICA"]) ;
if (tipocon.empty() && _message)
{
int r=_scontrolli->rows();
while (r>=1 && !insert && !exist)
print_line(stampa);
stampa = "Tipo accesso ";
stampa << tp_accesso[0] << " del ";
stampa << datacon.string() << " senza corrispondenza. Non inserito.";
print_line(stampa);
tipocon = "VS";
}
else
{
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, recsog.get(SOG_CODICE));
recc->put(CON_DATACON, datacon);
recc->put(CON_TIPOCON, tipocon);
recc->put(CON_RESPONSAB, "CETRAPLUS");
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, recsog.get(SOG_CODICE));
int err = _scontrolli->read(keyc);
if (err == NOERR)
{
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (datacon==d) // esiste gia' un controllo in questa data
int r=_scontrolli->rows();
while (r>=1 && !insert && !exist)
{
// verifico la priorita
TString4 tipoes = riga.get(CON_TIPOCON);
if (tipoes != tipocon)
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (datacon==d) // esiste gia' un controllo in questa data
{
int p_tipocon = _configfile->get_int(tipocon, "PRIORITA");
int p_tipoes = _configfile->get_int(tipoes, "PRIORITA");
if (p_tipocon == 999)
// verifico la priorita
TString4 tipoes = riga.get(CON_TIPOCON);
if (tipoes != tipocon)
{
++datacon;
recc->put(CON_DATACON, datacon);
recc->put(CON_RESPONSAB, "CETRAPLUS ieri");
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
else
{
if (p_tipocon > p_tipoes)
int p_tipocon = _configfile->get_int(tipocon, "PRIORITA");
int p_tipoes = _configfile->get_int(tipoes, "PRIORITA");
if (p_tipocon == 999)
{
recc->put(CON_PROGCON,riga.get(CON_PROGCON));
_scontrolli->add_row(recc);
++datacon;
recc->put(CON_DATACON, datacon);
recc->put(CON_RESPONSAB, "CETRAPLUS ieri");
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
else
{
exist=TRUE;
r=0;
if (_message)
if (p_tipocon > p_tipoes)
{
print_line(stampa);
stampa = "";
stampa << "Controllo già esistente in data " << datacon.string();
print_line(stampa);
print_line();
}
recc->put(CON_PROGCON,riga.get(CON_PROGCON));
_scontrolli->add_row(recc);
insert = TRUE;
}
else
{
exist=TRUE;
r=0;
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Controllo già esistente in data " << datacon.string();
print_line(stampa);
print_line();
}
}
}
}
}
else
exist=TRUE;
}
else
exist=TRUE;
}
else
if (datacon > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
if (datacon > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
}
else
if (err == _iseof || err == _isemptyfile)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
if (!exist)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
}
else
if (err == _iseof || err == _isemptyfile)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
if (!exist)
{
_scontrolli->write(TRUE);
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Inserito controllo " << tipocon << " del " << datacon.string();
print_line(stampa);
print_line();
}
// aggiorno data e utente ultimo aggiornamento
TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG, oggi);
recsog.put(SOG_UTENULTAGG, "CETRAPLUS");
err = recsog.rewrite(_rel->lfile());
_scontrolli->write(TRUE);
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Inserito controllo " << tipocon << " del " << datacon.string();
print_line(stampa);
print_line();
}
// aggiorno data e utente ultimo aggiornamento
TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG, oggi);
recsog.put(SOG_UTENULTAGG, "CETRAPLUS");
err = recsog.rewrite(_rel->lfile());
}
}
}
}
@ -1250,107 +1258,111 @@ bool TCtpr2at::sacca(const TString& istruzione)
// ho trovato il soggetto, ora verifico la donazione
TString16& str = (TString16&) record["DT_PRELIEVO"];
const TDate datadon = TDate(atoi(str.sub(8,10)) ,atoi(str.sub(5,7)), atoi(str.sub(0,4)));
_progins++;
TRectype* rec = new TRectype(LF_DONAZ);
rec->put(DON_CODICE, recsog.get(SOG_CODICE));
rec->put(DON_DATADON, datadon);
str = (TString16&) record["TP_DONAZIONE"];
TRectype recpr2 = cache().get("PR2", str);
TString16 tipodon = recpr2.get("S6");
if (tipodon.empty())
{
print_line(stampa);
stampa = "";
stampa << "Tipo donazione SIT " << str << " senza corrispondenza: non inserita";
print_line(stampa);
stampa = "";
}
else
TDate datanulla(NULLDATE);
if (datadon != datanulla)
{
rec->put(DON_TIPODON, tipodon);
TString16& etichetta = (TString16&) record["ID_SACCA"];
rec->put(DON_ETICHETTA, etichetta);
rec->put(DON_CODSEZ, recsog.get(SOG_CODSEZ));
rec->put(DON_CODSOT, recsog.get(SOG_CODSOT));
rec->put(DON_PROGINS, _progins);
bool insert = FALSE;
bool exist = FALSE;
TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, recsog.get(SOG_CODICE));
err = _sdonazioni->read(key);
if (err == NOERR)
_progins++;
TRectype* rec = new TRectype(LF_DONAZ);
rec->put(DON_CODICE, recsog.get(SOG_CODICE));
rec->put(DON_DATADON, datadon);
str = (TString16&) record["TP_DONAZIONE"];
TRectype recpr2 = cache().get("PR2", str);
TString16 tipodon = recpr2.get("S6");
if (tipodon.empty())
{
print_line(stampa);
stampa = "";
stampa << "Tipo donazione SIT " << str << " senza corrispondenza: non inserita";
print_line(stampa);
stampa = "";
}
else
{
int r=_sdonazioni->rows();
while (r>=1 && !insert && !exist)
rec->put(DON_TIPODON, tipodon);
TString16& etichetta = (TString16&) record["ID_SACCA"];
rec->put(DON_ETICHETTA, etichetta);
rec->put(DON_CODSEZ, recsog.get(SOG_CODSEZ));
rec->put(DON_CODSOT, recsog.get(SOG_CODSOT));
rec->put(DON_PROGINS, _progins);
bool insert = FALSE;
bool exist = FALSE;
TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, recsog.get(SOG_CODICE));
err = _sdonazioni->read(key);
if (err == NOERR)
{
const TRectype& riga = _sdonazioni->row(r);
const TDate d = riga.get(DON_DATADON);
if (datadon==d) // esiste gia' una donazione in questa data
int r=_sdonazioni->rows();
while (r>=1 && !insert && !exist)
{
exist=TRUE;
r=0;
const TRectype& riga = _sdonazioni->row(r);
const TDate d = riga.get(DON_DATADON);
if (datadon==d) // esiste gia' una donazione in questa data
{
exist=TRUE;
r=0;
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Donazione già esistente in data " << datadon.string();
print_line(stampa);
print_line();
}
}
else
if (datadon > d)
{
rec->put(DON_PROGDON,r+1);
_sdonazioni->insert_row(rec);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
{
rec->put(DON_PROGDON,1);
rec->put(DON_PRIMADON,'X');
_sdonazioni->insert_row(rec);
}
}
else
if (err == _iseof || err == _isemptyfile)
{
rec->put(DON_PROGDON,1);
rec->put(DON_PRIMADON,'X');
_sdonazioni->insert_row(rec);
}
if (!exist)
{
err = _sdonazioni->write(TRUE);
if (err == NOERR)
{
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Donazione già esistente in data " << datadon.string();
stampa << "Inserita donazione del " << datadon;
print_line(stampa);
print_line();
}
}
else
if (datadon > d)
{
rec->put(DON_PROGDON,r+1);
_sdonazioni->insert_row(rec);
insert=TRUE;
if (modstato_tcs(recsog.get(SOG_STATO)) == 'S')
{
stampa = "** ATTENZIONE ** il soggetto e' sospeso";
print_line(stampa);
}
}
r--;
}
if (!exist && !insert)
{
rec->put(DON_PROGDON,1);
rec->put(DON_PRIMADON,'X');
_sdonazioni->insert_row(rec);
calcola_donazioni_lib(recsog, _sdonazioni); // questo metodo sistema tutto!!!
calcola_categoria(recsog); // modificato per dare i messaggi al posto dei veri cambiamenti
//print_line(); // tolto perchè altrimenti stampa alcuni fogli vuoti
// aggiorno data e utente ultimo aggiornamento
TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG, oggi);
recsog.put(SOG_UTENULTAGG, "CETRAPLUS");
err = recsog.rewrite(_rel->lfile());
}
//else
//error_box("Errore %d in scrittura archivio donazioni, riga %d", err, rigasog);
}
}
else
if (err == _iseof || err == _isemptyfile)
{
rec->put(DON_PROGDON,1);
rec->put(DON_PRIMADON,'X');
_sdonazioni->insert_row(rec);
}
if (!exist)
{
err = _sdonazioni->write(TRUE);
if (err == NOERR)
{
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Inserita donazione del " << datadon;
print_line(stampa);
if (modstato_tcs(recsog.get(SOG_STATO)) == 'S')
{
stampa = "** ATTENZIONE ** il soggetto e' sospeso";
print_line(stampa);
}
}
calcola_donazioni_lib(recsog, _sdonazioni); // questo metodo sistema tutto!!!
calcola_categoria(recsog); // modificato per dare i messaggi al posto dei veri cambiamenti
//print_line(); // tolto perchè altrimenti stampa alcuni fogli vuoti
// aggiorno data e utente ultimo aggiornamento
TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG, oggi);
recsog.put(SOG_UTENULTAGG, "CETRAPLUS");
err = recsog.rewrite(_rel->lfile());
}
//else
//error_box("Errore %d in scrittura archivio donazioni, riga %d", err, rigasog);
}
}
}
else
@ -1410,110 +1422,112 @@ bool TCtpr2at::analisi(const TString& istruzione)
stampa = recsog.get(SOG_COGNOME);
stampa << " " << recsog.get(SOG_NOME);
stampa << " " << recsog.get(SOG_DATANASC);
//TString16& str = (TString16&) record["DT_ACCESSO"];
TDate datacon = TDate(atoi(str.sub(8,10)) ,atoi(str.sub(5,7)), atoi(str.sub(0,4)));
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, recsog.get(SOG_CODICE));
recc->put(CON_DATACON, datacon);
recc->put(CON_TIPOCON, tipocon);
recc->put(CON_RESPONSAB, "CETRAPLUS");
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, recsog.get(SOG_CODICE));
int err = _scontrolli->read(keyc);
if (err == NOERR)
{
int r=_scontrolli->rows();
while (r>=1 && !insert && !exist)
TDate datanulla(NULLDATE);
if (datacon != datanulla)
{
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, recsog.get(SOG_CODICE));
recc->put(CON_DATACON, datacon);
recc->put(CON_TIPOCON, tipocon);
recc->put(CON_RESPONSAB, "CETRAPLUS");
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, recsog.get(SOG_CODICE));
int err = _scontrolli->read(keyc);
if (err == NOERR)
{
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (datacon==d) // esiste gia' un controllo in questa data
int r=_scontrolli->rows();
while (r>=1 && !insert && !exist)
{
// verifico la priorita
TString4 tipoes = riga.get(CON_TIPOCON);
if (tipoes != tipocon)
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (datacon==d) // esiste gia' un controllo in questa data
{
int p_tipocon = _configfile->get_int(tipocon, "PRIORITA");
int p_tipoes = _configfile->get_int(tipoes, "PRIORITA");
if (p_tipocon == 999)
// verifico la priorita
TString4 tipoes = riga.get(CON_TIPOCON);
if (tipoes != tipocon)
{
++datacon;
recc->put(CON_DATACON, datacon);
recc->put(CON_RESPONSAB, "CETRAPLUS ieri");
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
else
{
if (p_tipocon > p_tipoes)
int p_tipocon = _configfile->get_int(tipocon, "PRIORITA");
int p_tipoes = _configfile->get_int(tipoes, "PRIORITA");
if (p_tipocon == 999)
{
recc->put(CON_PROGCON,riga.get(CON_PROGCON));
_scontrolli->add_row(recc);
++datacon;
recc->put(CON_DATACON, datacon);
recc->put(CON_RESPONSAB, "CETRAPLUS ieri");
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
else
{
exist=TRUE;
r=0;
if (_message)
if (p_tipocon > p_tipoes)
{
print_line(stampa);
stampa = "";
stampa << "Controllo già esistente in data " << datacon.string();
print_line(stampa);
print_line();
}
recc->put(CON_PROGCON,riga.get(CON_PROGCON));
_scontrolli->add_row(recc);
insert = TRUE;
}
else
{
exist=TRUE;
r=0;
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Controllo già esistente in data " << datacon.string();
print_line(stampa);
print_line();
}
}
}
}
}
else
exist=TRUE;
}
else
exist=TRUE;
}
else
if (datacon > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
}
else
if (err == _iseof || err == _isemptyfile)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
if (!exist)
{
_scontrolli->write(TRUE);
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Inserito controllo " << tipocon << " del " << datacon.string();
print_line(stampa);
print_line();
if (datacon > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
}
else
if (err == _iseof || err == _isemptyfile)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
insert = TRUE;
}
if (!exist)
{
_scontrolli->write(TRUE);
if (_message)
{
print_line(stampa);
stampa = "";
stampa << "Inserito controllo " << tipocon << " del " << datacon.string();
print_line(stampa);
print_line();
}
// aggiorno data e utente ultimo aggiornamento
TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG, oggi);
recsog.put(SOG_UTENULTAGG, "CETRAPLUS");
err = recsog.rewrite(_rel->lfile());
}
// aggiorno data e utente ultimo aggiornamento
TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG, oggi);
recsog.put(SOG_UTENULTAGG, "CETRAPLUS");
err = recsog.rewrite(_rel->lfile());
}
}
else
@ -1578,7 +1592,7 @@ bool TCtpr2at::esclusione(const TString& istruzione)
const long codsog = recsog.get_long(SOG_CODICE);
//TString16& str = (TString16&) record["DA_DATA"];
//const TDate datacon = TDate(atoi(str.sub(8,10)) ,atoi(str.sub(5,7)), atoi(str.sub(0,4)));
TDate datacon(TODAY);
TDate datacon(TODAY);
TString16& str = (TString16&) record["A_DATA"];
const TDate datapross = TDate(atoi(str.sub(8,10)) ,atoi(str.sub(5,7)), atoi(str.sub(0,4)));
TDate datanulla(NULLDATE);