Patch level : at

Files correlati     : at8.exe at8900a.msk
Ricompilazione Demo : [ ]
Commento            : varie su procedure di acquisizione dati da CT


git-svn-id: svn://10.65.10.50/trunk@11271 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2003-06-24 08:47:34 +00:00
parent 1b4cfe220b
commit 8b7a226994
6 changed files with 1450 additions and 308 deletions

View File

@ -4,7 +4,7 @@
#include "at8.h"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8}"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
int main(int argc,char** argv)
@ -32,6 +32,8 @@ int main(int argc,char** argv)
rt = at8800(argc,argv) ; break;
case 8:
rt = at8900(argc,argv) ; break;
case 9:
rt = at8a00(argc,argv) ; break;
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -10,6 +10,6 @@ int at8500(int argc, char* argv[]);
int at8700(int argc, char* argv[]);
int at8800(int argc, char* argv[]);
int at8900(int argc, char* argv[]);
int at8a00(int argc, char* argv[]);
#endif // __AT8_H

View File

@ -260,7 +260,10 @@ void TCtbo2at::calcola_categoria(TRectype& recsog)
}
bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter)
{
{
const char* tipoido = stricmp(tipo, "SI") != 0 ? "AF" : "SI";
int intervallo = 0;
TRectype* key_cont = new TRectype(LF_CONTSAN);
key_cont->put(CON_CODICE, recsog.get(SOG_CODICE));
TRecord_array controlli(LF_CONTSAN,CON_PROGCON);
@ -270,29 +273,35 @@ bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datad
key->put(IDO_CODICE, recsog.get(SOG_CODICE));
TRecord_array idoneita(LF_IDONEITA,IDO_PROGIDO);
idoneita.read(key);
TString16 stato = recsog.get(SOG_STATO);
if (modstato_tcs(stato) != 'S' && stato.not_empty())
return FALSE;
if (tipo == "SI")
TString16 stato;
if (tipo == "SI")
{
stato = recsog.get(SOG_STATOSI);
intervallo = recsog.get_int(SOG_INTSI);
}
else
{
stato = recsog.get(SOG_STATOAF);
if (modstato_tcs(stato) != 'S' && stato.not_empty())
intervallo = recsog.get_int(SOG_INTAF);
}
if (stato.empty())
stato = recsog.get(SOG_STATO);
if (modstato_tcs(stato) != 'S' && stato.not_empty() && intervallo == inter)
return FALSE;
const int r = idoneita.last_row(); //se trova una data idoneita >= di quella in esame, quest'ultima viene ignorata
if (r > 0)
{
const TRectype& lastido = idoneita[r];
if (lastido.get_date(IDO_DATAIDO) >= datadon)
if ((lastido.get_date(IDO_DATAIDO) >= datadon) && (tipoido == lastido.get(IDO_TIPOIDO)))
return FALSE;
}
TRectype* rec = new TRectype(LF_IDONEITA);
rec->put(IDO_CODICE, recsog.get(SOG_CODICE));
rec->put(IDO_PROGIDO, r+1);
//rec->put(IDO_PROGIDO, r+1);
rec->put(IDO_DATAIDO, datadon);
rec->put(IDO_TIPOIDO, stricmp(tipo, "SI") != 0 ? "AF" : "SI"); // Il mondo è bello perchè c'é l'AVIS (tutte le donaz. non SI sono AF! mah?!)
rec->put(IDO_TIPOIDO, tipoido); // Il mondo è bello perchè c'é l'AVIS (tutte le donaz. non SI sono AF! mah?!)
rec->put(IDO_IDO_SOS, "ID");
rec->put(IDO_INTERVALLO, inter);
// aggiunto da cristina il 18/09/2002 altrimenti non so che quella riga é stata aggiunta da CT
@ -301,6 +310,13 @@ bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datad
idoneita.write();
con_reord(recsog, &controlli, &idoneita);
// verifico se occorre azzerare numero convocazioni e data ultima convocazione
TDate dataultdon = recsog.get(SOG_DATAULTDON);
if ((datadon - dataultdon) > 730)
{
recsog.put(SOG_DATACONV, NULLDATE);
recsog.put(SOG_NUMCONV, 0);
}
// aggiorno data e utente ultimo aggiornamento (Cristina 18/09/2002)
const TDate oggi(TODAY);
recsog.put(SOG_DATAULTAGG,oggi);
@ -376,30 +392,17 @@ void TCtbo2at::transfer()
if (str == "UROB")
str = "O.BE"; else
if (str == "IMOLA")
str = "70";
str = "70";
update |= test_donation(sogg, tipo[i], datadon, str);
//rimette a posto idoneitá ed intervalli vari...(lo fa solo per chi ha donato perché per gli altri non viene passata
//alcuna data... winsit del c...o!)
str = curr.get(27+i);
if (!real::is_null(str))
update |= test_inter(sogg, tipo[i], datadon, atoi(str));
}
else
{
int intervallo;
if (tipo[i] == "SI")
intervallo = sogg.get_int(SOG_INTSI);
else
intervallo = sogg.get_int(SOG_INTAF);
str = curr.get(27+i);
if ((!real::is_null(str)) && (intervallo != atoi(str)))
{
TDate oggi(TODAY);
update |= test_inter(sogg, tipo[i], oggi, atoi(str));
}
}
if (update)
str = curr.get(27+i);
if (!real::is_null(str))
update |= test_inter(sogg, tipo[i], datadon, atoi(str));
if (update)
{
calcola_categoria(sogg);
rel.rewrite();
}
}
}
_trasfile->close();

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ END
ENDPAGE
PAGE "Acquisizione dati da SIT Parma" -1 -1 78 20
PAGE "Aggiornamento archivi da SIT Parma" -1 -1 78 20
GROUPBOX DLG_NULL 77 9
BEGIN

View File

@ -5,7 +5,7 @@
#include <relation.h>
#include <tabutil.h>
#include <printer.h>
#include <progind.h>
//#include <progind.h>
#include <recarray.h>
#include <utility.h>
@ -31,6 +31,7 @@ class TCtDonpr2at_file: public TFile_text
{
protected:
virtual void preformat_field(const TFieldref&field,TString &str,TRelation& rel,const TString &tipo_tr);
virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str);
public:
virtual int autosave(TRelation& rel, const TRecord_text& rec);
@ -44,6 +45,18 @@ TCtDonpr2at_file::TCtDonpr2at_file(const TString& file_name, const TString& conf
{
}
void TCtDonpr2at_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TString& str)
{
const TString code(s.get(0));
TString valore;
if (code == "_UPPERCASE")
{
valore.upper();
}
else NFCHECK("Macro non definita: %s", (const char *)code);
str = valore;
}
int TCtDonpr2at_file::autosave(TRelation& rel, const TRecord_text& rec)
{
const TString& type = rec.type();//prendo il tracciato record del tipo del record_text
@ -230,6 +243,7 @@ bool TCtDonpr2at::test_donation(TRectype& recsog, const char* tipo, const TDate&
void TCtDonpr2at::calcola_categoria(TRectype& recsog)
{
TString256 rigastampa;
TTable ctd("CTD");
TString4 catdon = recsog.get(SOG_CATDON);
const int totdon = recsog.get_int(SOG_TOTDON);
@ -239,24 +253,32 @@ void TCtDonpr2at::calcola_categoria(TRectype& recsog)
bool dimissione = ctd.get_bool("B0");
if (dimissione)
{
rigastampa.format("Categoria: attuale %s", (const char*) catdon);
const TString& cat_coll = ctd.get("S6");
if (cat_coll.not_empty())
{
catdon = cat_coll;
recsog.put(SOG_CATDON, catdon);
}
}
if ((catdon == _catini1 || _catini1.empty()) && (totdon>=_numdon1) && _catfin1.not_empty())
{
recsog.put(SOG_CATDON, _catfin1);
catdon = _catfin1;
}
bool tstampata = recsog.get_bool(SOG_T_STAMPATA);
if ((catdon == _catini2 || _catini2.empty()) && (totdon>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || tstampata))
{
recsog.put(SOG_CATDON, _catfin2);
catdon = _catfin2;
}
//recsog.put(SOG_CATDON, catdon);
}
}
if ((catdon == _catini1 || _catini1.empty()) && (totdon>=_numdon1) && _catfin1.not_empty())
{
if (!dimissione)
recsog.put(SOG_CATDON, _catfin1);
catdon = _catfin1;
}
bool tstampata = recsog.get_bool(SOG_T_STAMPATA);
if ((catdon == _catini2 || _catini2.empty()) && (totdon>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || tstampata))
{
if (!dimissione)
recsog.put(SOG_CATDON, _catfin2);
catdon = _catfin2;
}
if (dimissione)
{
rigastampa << " - calcolata " << catdon;
print_line(rigastampa);
}
}
}
@ -354,6 +376,16 @@ void TCtDonpr2at::new_sogg(TRectype& sogg, const TRecord_text& curr)
long codice = soggetti.get_long(SOG_CODICE);
sogg.put(SOG_CODICE, codice+1);
sogg.put(SOG_CATDON, "NU");
TString str;
str = curr.get(32);
if (str[0] == '0')
str = str.sub(1);
sogg.put(SOG_CODSEZ, str.sub(0,2));
sogg.put(SOG_CODSOT, str.sub(2,4));
const TDate oggi(TODAY);
sogg.put(SOG_DATAULTAGG,oggi);
sogg.put(SOG_UTENULTAGG,"SIT");
}
// trasferimento dati da file CT su programma avis
@ -365,7 +397,7 @@ void TCtDonpr2at::transfer()
_trasfile = new TCtDonpr2at_file(_msk->get(F_FILENAME), ctprini);
inizializza_file();
const long dimension = fsize(_msk->get(F_FILENAME));
TProgind pi(dimension,"Acquisizione in corso...");
//TProgind pi(dimension,"Acquisizione in corso...");
TRelation rel(LF_SOGGETTI);
rel.lfile().setkey(2);
TRectype& sogg = rel.curr();
@ -379,7 +411,7 @@ void TCtDonpr2at::transfer()
bool cancelled = FALSE;
while ((_trasfile->read(curr) == NOERR) && (!cancelled))
{
pi.setstatus(_trasfile->read_file()->tellg());
//pi.setstatus(_trasfile->read_file()->tellg());
// cerco il donatore con cognome, nome e data nascita
cognome = curr.get(1);
str = cognome.left(7);
@ -444,14 +476,14 @@ void TCtDonpr2at::transfer()
}
// aggiungere le visite e i controlli
}
cancelled = pi.iscancelled();
//cancelled = pi.iscancelled();
}
_trasfile->close();
print_footer();
if (cancelled)
message_box("Operazione annullata: il trasferimento non è stato completato");
else
message_box("Operazione terminata");
//if (cancelled)
// message_box("Operazione annullata: il trasferimento non è stato completato");
//else
// message_box("Operazione terminata");
}
else
error_box("Errore in apertura stampante.");
@ -480,7 +512,8 @@ bool TCtDonpr2at::annulla_handler(TMask_field& f, KEY k)
void TCtDonpr2at_file::preformat_field(const TFieldref&field,TString &str,TRelation& rel,const TString &tipo_tr)
{
TString tmp;
TString80 fieldname = field.name();
TString80 fieldname = field.name();
if (fieldname == "SESSO")
{
const char sesso = str[0];
@ -490,6 +523,18 @@ void TCtDonpr2at_file::preformat_field(const TFieldref&field,TString &str,TRelat
str = "2";
else str = " ";
}
else if (fieldname == "PREFERENZE") // giorno preferito donazione
{
str << "XXXXXXX";
str = str.sub(0,7);
for (int i = 0; i< 7; i++)
{
if (str[i] != 'X')
str[i] = 'X';
else
str[i] = ' ';
}
}
else if ((fieldname == "CODCF") || (fieldname == "TESSSSN"))
{
tmp = rel.curr(field.file()).get(fieldname);