Patch level :1.7 nopatch
Files correlati :at8.exe Ricompilazione Demo : [ ] Commento :aggiunta la procedura che checka (!) le nuove donazioni da winsit git-svn-id: svn://10.65.10.50/trunk@9988 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
088605a03c
commit
a545a03f1a
238
at/at8800.cpp
238
at/at8800.cpp
@ -67,7 +67,7 @@ int TCtbo2at_file::autosave(TRelation& rel, const TRecord_text& rec)
|
|||||||
TFieldtypes tipo_campo = rel_rec.type(field.name());
|
TFieldtypes tipo_campo = rel_rec.type(field.name());
|
||||||
bool vuoto = valore.blank();
|
bool vuoto = valore.blank();
|
||||||
if (valore[0] == '@') //se trovo il carattere @ -> azzero il campo
|
if (valore[0] == '@') //se trovo il carattere @ -> azzero il campo
|
||||||
valore.cut(0);
|
valore.cut(0);
|
||||||
switch(tipo_campo)
|
switch(tipo_campo)
|
||||||
{
|
{
|
||||||
case _datefld:
|
case _datefld:
|
||||||
@ -122,11 +122,11 @@ int TCtbo2at_file::autosave(TRelation& rel, const TRecord_text& rec)
|
|||||||
|
|
||||||
class TCtbo2at: public TSkeleton_application
|
class TCtbo2at: public TSkeleton_application
|
||||||
{
|
{
|
||||||
TMask* _msk;
|
TMask* _msk;
|
||||||
TCtbo2at_file* _trasfile;
|
TCtbo2at_file* _trasfile;
|
||||||
int _numdon1, _numdon2;
|
int _numdon1, _numdon2;
|
||||||
TString16 _catini1, _catfin1, _catini2, _catfin2;
|
TString16 _catini1, _catfin1, _catini2, _catfin2;
|
||||||
bool _sttess2, _dataisc;
|
bool _sttess2, _dataisc;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool create(void);
|
virtual bool create(void);
|
||||||
@ -135,8 +135,8 @@ protected:
|
|||||||
void transfer(void);
|
void transfer(void);
|
||||||
void inizializza_file(void);
|
void inizializza_file(void);
|
||||||
static bool annulla_handler(TMask_field& f, KEY k);
|
static bool annulla_handler(TMask_field& f, KEY k);
|
||||||
bool test_donation(TRectype& recsog, const char* tipo, const TDate& datadon, const TString& luogodon);
|
bool test_donation(TRectype& recsog, const char* tipo, const TDate& datadon, const TString& luogodon);
|
||||||
bool test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter);
|
bool test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter);
|
||||||
void calcola_categoria(TRectype& recsog);
|
void calcola_categoria(TRectype& recsog);
|
||||||
public:
|
public:
|
||||||
const TMask& msk() const { return *_msk; }
|
const TMask& msk() const { return *_msk; }
|
||||||
@ -177,7 +177,7 @@ bool TCtbo2at::destroy()
|
|||||||
void TCtbo2at::main_loop()
|
void TCtbo2at::main_loop()
|
||||||
{
|
{
|
||||||
// Preimposta gli eventuali valori specificati sulla riga di comando
|
// Preimposta gli eventuali valori specificati sulla riga di comando
|
||||||
//error_box("Attenzione: manca la configurazione del trasferimento!");
|
//error_box("Attenzione: manca la configurazione del trasferimento!");
|
||||||
KEY key = K_ENTER;
|
KEY key = K_ENTER;
|
||||||
while (key != K_QUIT)
|
while (key != K_QUIT)
|
||||||
{
|
{
|
||||||
@ -190,85 +190,87 @@ void TCtbo2at::main_loop()
|
|||||||
bool TCtbo2at::test_donation(TRectype& recsog, const char* tipo, const TDate& datadon, const TString& luogodon)
|
bool TCtbo2at::test_donation(TRectype& recsog, const char* tipo, const TDate& datadon, const TString& luogodon)
|
||||||
{
|
{
|
||||||
//ricostruisce le donazioni del soggetto in esame
|
//ricostruisce le donazioni del soggetto in esame
|
||||||
TRectype* key = new TRectype(LF_DONAZ);
|
TRectype* key = new TRectype(LF_DONAZ);
|
||||||
key->put(DON_CODICE, recsog.get(SOG_CODICE));
|
key->put(DON_CODICE, recsog.get(SOG_CODICE));
|
||||||
TRecord_array donazioni(LF_DONAZ,DON_PROGDON);
|
TRecord_array donazioni(LF_DONAZ,DON_PROGDON);
|
||||||
donazioni.read(key);
|
donazioni.read(key);
|
||||||
// verificare se ha fatto una donazione di tipo <tipo> con data successiva all'ultima donazione
|
// verificare se ha fatto una donazione di tipo <tipo> con data successiva all'ultima donazione
|
||||||
const int r=donazioni.last_row();
|
const int r=donazioni.last_row();
|
||||||
if (r > 0)
|
if (r > 0)
|
||||||
{
|
{
|
||||||
const TRectype& lastdon = donazioni[r];
|
const TRectype& lastdon = donazioni[r];
|
||||||
if (lastdon.get_date(DON_DATADON) >= datadon)
|
if (lastdon.get_date(DON_DATADON) >= datadon)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//aggiunge la nuova donazione
|
//aggiunge la nuova donazione
|
||||||
// compila i dati della donazione in esame
|
// compila i dati della donazione in esame
|
||||||
TRectype* rec = new TRectype(LF_DONAZ);
|
TRectype* rec = new TRectype(LF_DONAZ);
|
||||||
rec->put(DON_CODICE, recsog.get(SOG_CODICE));
|
rec->put(DON_CODICE, recsog.get(SOG_CODICE));
|
||||||
rec->put(DON_PROGDON,r+1);
|
rec->put(DON_PROGDON,r+1);
|
||||||
rec->put(DON_DATADON, datadon);
|
rec->put(DON_DATADON, datadon);
|
||||||
rec->put(DON_TIPODON, tipo);
|
rec->put(DON_TIPODON, tipo);
|
||||||
rec->put(DON_CODSEZ,recsog.get(SOG_CODSEZ));
|
rec->put(DON_CODSEZ,recsog.get(SOG_CODSEZ));
|
||||||
rec->put(DON_CODSOT,recsog.get(SOG_CODSOT));
|
rec->put(DON_CODSOT,recsog.get(SOG_CODSOT));
|
||||||
rec->put(DON_LUOGODON, luogodon);
|
rec->put(DON_LUOGODON, luogodon);
|
||||||
|
if (r == 0)
|
||||||
|
rec->put(DON_PRIMADON,"X");
|
||||||
|
|
||||||
donazioni.insert_row(rec);
|
donazioni.insert_row(rec);
|
||||||
donazioni.write(TRUE);
|
donazioni.write(TRUE);
|
||||||
calcola_donazioni_lib(recsog, &donazioni); // questo metodo sistema tutto!!!
|
calcola_donazioni_lib(recsog, &donazioni); // questo metodo sistema tutto!!!
|
||||||
calcola_categoria(recsog);
|
calcola_categoria(recsog);
|
||||||
// aggiorno data e utente ultimo aggiornamento
|
// aggiorno data e utente ultimo aggiornamento
|
||||||
const TDate oggi(TODAY);
|
const TDate oggi(TODAY);
|
||||||
recsog.put(SOG_DATAULTAGG,oggi);
|
recsog.put(SOG_DATAULTAGG,oggi);
|
||||||
recsog.put(SOG_UTENULTAGG,"WINSIT");
|
recsog.put(SOG_UTENULTAGG,"WINSIT");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCtbo2at::calcola_categoria(TRectype& recsog)
|
void TCtbo2at::calcola_categoria(TRectype& recsog)
|
||||||
{
|
{
|
||||||
TTable ctd("CTD");
|
TTable ctd("CTD");
|
||||||
TString16 catdon = recsog.get(SOG_CATDON);
|
TString16 catdon = recsog.get(SOG_CATDON);
|
||||||
const int totdon = recsog.get_int(SOG_TOTDON);
|
const int totdon = recsog.get_int(SOG_TOTDON);
|
||||||
ctd.put("CODTAB",catdon);
|
ctd.put("CODTAB",catdon);
|
||||||
if (ctd.read() == NOERR)
|
if (ctd.read() == NOERR)
|
||||||
{
|
{
|
||||||
bool dimissione = ctd.get_bool("B0");
|
bool dimissione = ctd.get_bool("B0");
|
||||||
if (dimissione)
|
if (dimissione)
|
||||||
{
|
{
|
||||||
const TString& cat_coll = ctd.get("S6");
|
const TString& cat_coll = ctd.get("S6");
|
||||||
if (cat_coll.not_empty())
|
if (cat_coll.not_empty())
|
||||||
{
|
{
|
||||||
catdon = cat_coll;
|
catdon = cat_coll;
|
||||||
recsog.put(SOG_CATDON, catdon);
|
recsog.put(SOG_CATDON, catdon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((catdon == _catini1 || _catini1.empty()) && (totdon>=_numdon1) && _catfin1.not_empty())
|
if ((catdon == _catini1 || _catini1.empty()) && (totdon>=_numdon1) && _catfin1.not_empty())
|
||||||
{
|
{
|
||||||
recsog.put(SOG_CATDON, _catfin1);
|
recsog.put(SOG_CATDON, _catfin1);
|
||||||
catdon = _catfin1;
|
catdon = _catfin1;
|
||||||
}
|
}
|
||||||
bool tstampata = recsog.get_bool(SOG_T_STAMPATA);
|
bool tstampata = recsog.get_bool(SOG_T_STAMPATA);
|
||||||
if ((catdon == _catini2 || _catini2.empty()) && (totdon>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || tstampata))
|
if ((catdon == _catini2 || _catini2.empty()) && (totdon>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || tstampata))
|
||||||
{
|
{
|
||||||
recsog.put(SOG_CATDON, _catfin2);
|
recsog.put(SOG_CATDON, _catfin2);
|
||||||
catdon = _catfin2;
|
catdon = _catfin2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter)
|
bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter)
|
||||||
{
|
{
|
||||||
TRectype* key_cont = new TRectype(LF_CONTSAN);
|
TRectype* key_cont = new TRectype(LF_CONTSAN);
|
||||||
key_cont->put(CON_CODICE, recsog.get(SOG_CODICE));
|
key_cont->put(CON_CODICE, recsog.get(SOG_CODICE));
|
||||||
TRecord_array controlli(LF_CONTSAN,CON_PROGCON);
|
TRecord_array controlli(LF_CONTSAN,CON_PROGCON);
|
||||||
controlli.read(key_cont);
|
controlli.read(key_cont);
|
||||||
|
|
||||||
TRectype* key = new TRectype(LF_IDONEITA);
|
TRectype* key = new TRectype(LF_IDONEITA);
|
||||||
key->put(IDO_CODICE, recsog.get(SOG_CODICE));
|
key->put(IDO_CODICE, recsog.get(SOG_CODICE));
|
||||||
TRecord_array idoneita(LF_IDONEITA,IDO_PROGIDO);
|
TRecord_array idoneita(LF_IDONEITA,IDO_PROGIDO);
|
||||||
idoneita.read(key);
|
idoneita.read(key);
|
||||||
|
|
||||||
const int r = idoneita.last_row(); //se trova una data idoneita >= di quella in esame, quest'ultima
|
const int r = idoneita.last_row(); //se trova una data idoneita >= di quella in esame, quest'ultima
|
||||||
if (r > 0) //viene ignorata
|
if (r > 0) //viene ignorata
|
||||||
{
|
{
|
||||||
@ -276,20 +278,20 @@ bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datad
|
|||||||
if (lastido.get_date(IDO_DATAIDO) >= datadon)
|
if (lastido.get_date(IDO_DATAIDO) >= datadon)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRectype* rec = new TRectype(LF_IDONEITA);
|
TRectype* rec = new TRectype(LF_IDONEITA);
|
||||||
rec->put(IDO_CODICE, recsog.get(SOG_CODICE));
|
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_DATAIDO, datadon);
|
||||||
rec->put(IDO_TIPOIDO, stricmp(tipo, "SI") != 0 ? "AF" : "SI"); // Il mondo è bello perchè c'é l'AVIS
|
rec->put(IDO_TIPOIDO, stricmp(tipo, "SI") != 0 ? "AF" : "SI"); // Il mondo è bello perchè c'é l'AVIS
|
||||||
rec->put(IDO_IDO_SOS, "ID");
|
rec->put(IDO_IDO_SOS, "ID");
|
||||||
rec->put(IDO_INTERVALLO, inter);
|
rec->put(IDO_INTERVALLO, inter);
|
||||||
idoneita.add_row(rec);
|
idoneita.add_row(rec);
|
||||||
idoneita.write();
|
idoneita.write();
|
||||||
|
|
||||||
con_reord(recsog, &controlli, &idoneita);
|
con_reord(recsog, &controlli, &idoneita);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// trasferimento dati da file CT su programma avis
|
// trasferimento dati da file CT su programma avis
|
||||||
@ -306,38 +308,38 @@ void TCtbo2at::transfer()
|
|||||||
TRectype& sogg = rel.curr();
|
TRectype& sogg = rel.curr();
|
||||||
|
|
||||||
TString8 str; // Stringa jolly di lavoro
|
TString8 str; // Stringa jolly di lavoro
|
||||||
TRecord_text curr;
|
TRecord_text curr;
|
||||||
while (_trasfile->read(curr) == NOERR)
|
while (_trasfile->read(curr) == NOERR)
|
||||||
{
|
{
|
||||||
pi.setstatus(_trasfile->read_file()->tellg());
|
pi.setstatus(_trasfile->read_file()->tellg());
|
||||||
//controlla se il donatore é AVIS oppure un cane sciolto o, peggio ancora, un adepto della
|
//controlla se il donatore é AVIS oppure un cane sciolto o, peggio ancora, un adepto della
|
||||||
//concorrenza!!!(ovviamente si va a stringhe fisse e non a tabelle! roba da avis.....)
|
//concorrenza!!!(ovviamente si va a stringhe fisse e non a tabelle! roba da avis.....)
|
||||||
str = curr.get(31); //donatore della concorrenza -> lo salta
|
str = curr.get(31); //donatore della concorrenza -> lo salta
|
||||||
str.trim();
|
str.trim();
|
||||||
if (str == "ADVS")
|
if (str == "ADVS")
|
||||||
continue;
|
continue;
|
||||||
if (str == "NOASS") //se il donatore é un cane sciolto -> va in sezione NI ed in categoria NI
|
if (str == "NOASS") //se il donatore é un cane sciolto -> va in sezione NI ed in categoria NI
|
||||||
{
|
{
|
||||||
curr.add("NI",0);
|
curr.add("NI",0);
|
||||||
curr.add("@",1);
|
curr.add("@",1);
|
||||||
sogg.put(SOG_CATDON,"NI");
|
sogg.put(SOG_CATDON,"NI");
|
||||||
}
|
}
|
||||||
|
|
||||||
str = curr.get(2);
|
str = curr.get(2);
|
||||||
sogg.put(SOG_CODICE, str);
|
sogg.put(SOG_CODICE, str);
|
||||||
if (rel.read(_isequal) != NOERR)
|
if (rel.read(_isequal) != NOERR)
|
||||||
sogg.zero();
|
sogg.zero();
|
||||||
|
|
||||||
//controlla se il donatore ha cambiato sezione spostandosi da Bologna in provincia;
|
//controlla se il donatore ha cambiato sezione spostandosi da Bologna in provincia;
|
||||||
//in questo caso gli deve cancellare il sottogruppo (veramente un procedimento da
|
//in questo caso gli deve cancellare il sottogruppo (veramente un procedimento da
|
||||||
//galera, ma se l'avis e winsit vogliono cosí.....)
|
//galera, ma se l'avis e winsit vogliono cosí.....)
|
||||||
str = curr.get(0);
|
str = curr.get(0);
|
||||||
str.trim();
|
str.trim();
|
||||||
TString8 str1;
|
TString8 str1;
|
||||||
str1 = curr.get(1);
|
str1 = curr.get(1);
|
||||||
str1.trim();
|
str1.trim();
|
||||||
if (str != sogg.get(SOG_CODSEZ) && str != "01" && str1 == "")
|
if (str != sogg.get(SOG_CODSEZ) && str != "01" && str1 == "")
|
||||||
curr.add("@",1);
|
curr.add("@",1);
|
||||||
|
|
||||||
_trasfile->autosave(rel, curr);
|
_trasfile->autosave(rel, curr);
|
||||||
//const long codsog = atol(curr.get(2));
|
//const long codsog = atol(curr.get(2));
|
||||||
@ -349,17 +351,17 @@ void TCtbo2at::transfer()
|
|||||||
str = curr.get(23+i);
|
str = curr.get(23+i);
|
||||||
if (!str.blank())
|
if (!str.blank())
|
||||||
{
|
{
|
||||||
datadon = TDate(str);
|
datadon = TDate(str);
|
||||||
str = curr.get(32);
|
str = curr.get(32);
|
||||||
str.trim();
|
str.trim();
|
||||||
//cambio codice del punto di prelievo per casi speciali (sarebbe necessaria una tabella,
|
//cambio codice del punto di prelievo per casi speciali (sarebbe necessaria una tabella,
|
||||||
//ma con l'AVIS é tempo sprecato....)
|
//ma con l'AVIS é tempo sprecato....)
|
||||||
if (str == "UROM")
|
if (str == "UROM")
|
||||||
str = "013"; else
|
str = "013"; else
|
||||||
if (str == "UROB")
|
if (str == "UROB")
|
||||||
str = "O.BE"; else
|
str = "O.BE"; else
|
||||||
if (str == "IMOLA")
|
if (str == "IMOLA")
|
||||||
str = "70";
|
str = "70";
|
||||||
update |= test_donation(sogg, tipo[i], datadon, str);
|
update |= test_donation(sogg, tipo[i], datadon, str);
|
||||||
}
|
}
|
||||||
str = curr.get(27+i);
|
str = curr.get(27+i);
|
||||||
@ -372,13 +374,13 @@ void TCtbo2at::transfer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_trasfile->close();
|
_trasfile->close();
|
||||||
message_box("Operazione terminata");
|
message_box("Operazione terminata");
|
||||||
}
|
}
|
||||||
|
|
||||||
//inizializza il file di testo su cui emettere i dati
|
//inizializza il file di testo su cui emettere i dati
|
||||||
void TCtbo2at::inizializza_file()
|
void TCtbo2at::inizializza_file()
|
||||||
{
|
{
|
||||||
TFilename filect = _msk->get(F_FILENAME); //aggiungere lettura automatica nomi file
|
TFilename filect = _msk->get(F_FILENAME); //aggiungere lettura automatica nomi file
|
||||||
_trasfile->open(filect,'r');
|
_trasfile->open(filect,'r');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +405,7 @@ void TCtbo2at_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, T
|
|||||||
TString valore;
|
TString valore;
|
||||||
if (code == "_UPPERCASE")
|
if (code == "_UPPERCASE")
|
||||||
{
|
{
|
||||||
valore.upper();
|
valore.upper();
|
||||||
}
|
}
|
||||||
else NFCHECK("Macro non definita: %s", (const char *)code);
|
else NFCHECK("Macro non definita: %s", (const char *)code);
|
||||||
str = valore;
|
str = valore;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user