From a545a03f1a4d0f9fdd8bf027dc2203c6f88f24da Mon Sep 17 00:00:00 2001 From: cris Date: Wed, 2 Jan 2002 16:15:22 +0000 Subject: [PATCH] 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 --- at/at8800.cpp | 238 +++++++++++++++++++++++++------------------------- 1 file changed, 120 insertions(+), 118 deletions(-) diff --git a/at/at8800.cpp b/at/at8800.cpp index fe16334ab..17c39e14a 100755 --- a/at/at8800.cpp +++ b/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()); bool vuoto = valore.blank(); if (valore[0] == '@') //se trovo il carattere @ -> azzero il campo - valore.cut(0); + valore.cut(0); switch(tipo_campo) { case _datefld: @@ -122,11 +122,11 @@ int TCtbo2at_file::autosave(TRelation& rel, const TRecord_text& rec) class TCtbo2at: public TSkeleton_application { - TMask* _msk; + TMask* _msk; TCtbo2at_file* _trasfile; - int _numdon1, _numdon2; - TString16 _catini1, _catfin1, _catini2, _catfin2; - bool _sttess2, _dataisc; + int _numdon1, _numdon2; + TString16 _catini1, _catfin1, _catini2, _catfin2; + bool _sttess2, _dataisc; protected: virtual bool create(void); @@ -135,8 +135,8 @@ protected: void transfer(void); void inizializza_file(void); 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_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter); + 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); void calcola_categoria(TRectype& recsog); public: const TMask& msk() const { return *_msk; } @@ -177,7 +177,7 @@ bool TCtbo2at::destroy() void TCtbo2at::main_loop() { // 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; 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) { //ricostruisce le donazioni del soggetto in esame - TRectype* key = new TRectype(LF_DONAZ); - key->put(DON_CODICE, recsog.get(SOG_CODICE)); - TRecord_array donazioni(LF_DONAZ,DON_PROGDON); - donazioni.read(key); - // verificare se ha fatto una donazione di tipo con data successiva all'ultima donazione - const int r=donazioni.last_row(); - if (r > 0) - { + TRectype* key = new TRectype(LF_DONAZ); + key->put(DON_CODICE, recsog.get(SOG_CODICE)); + TRecord_array donazioni(LF_DONAZ,DON_PROGDON); + donazioni.read(key); + // verificare se ha fatto una donazione di tipo con data successiva all'ultima donazione + const int r=donazioni.last_row(); + if (r > 0) + { const TRectype& lastdon = donazioni[r]; if (lastdon.get_date(DON_DATADON) >= datadon) return FALSE; } - - //aggiunge la nuova donazione - // compila i dati della donazione in esame - TRectype* rec = new TRectype(LF_DONAZ); - rec->put(DON_CODICE, recsog.get(SOG_CODICE)); + + //aggiunge la nuova donazione + // compila i dati della donazione in esame + TRectype* rec = new TRectype(LF_DONAZ); + rec->put(DON_CODICE, recsog.get(SOG_CODICE)); rec->put(DON_PROGDON,r+1); - rec->put(DON_DATADON, datadon); - rec->put(DON_TIPODON, tipo); - rec->put(DON_CODSEZ,recsog.get(SOG_CODSEZ)); - rec->put(DON_CODSOT,recsog.get(SOG_CODSOT)); - rec->put(DON_LUOGODON, luogodon); + rec->put(DON_DATADON, datadon); + rec->put(DON_TIPODON, tipo); + rec->put(DON_CODSEZ,recsog.get(SOG_CODSEZ)); + rec->put(DON_CODSOT,recsog.get(SOG_CODSOT)); + rec->put(DON_LUOGODON, luogodon); + if (r == 0) + rec->put(DON_PRIMADON,"X"); - donazioni.insert_row(rec); - donazioni.write(TRUE); - calcola_donazioni_lib(recsog, &donazioni); // questo metodo sistema tutto!!! + donazioni.insert_row(rec); + donazioni.write(TRUE); + calcola_donazioni_lib(recsog, &donazioni); // questo metodo sistema tutto!!! calcola_categoria(recsog); // aggiorno data e utente ultimo aggiornamento const TDate oggi(TODAY); recsog.put(SOG_DATAULTAGG,oggi); recsog.put(SOG_UTENULTAGG,"WINSIT"); - return TRUE; + return TRUE; } void TCtbo2at::calcola_categoria(TRectype& recsog) { - TTable ctd("CTD"); - TString16 catdon = recsog.get(SOG_CATDON); - const int totdon = recsog.get_int(SOG_TOTDON); - ctd.put("CODTAB",catdon); - if (ctd.read() == NOERR) - { - bool dimissione = ctd.get_bool("B0"); - if (dimissione) - { - 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; - } + TTable ctd("CTD"); + TString16 catdon = recsog.get(SOG_CATDON); + const int totdon = recsog.get_int(SOG_TOTDON); + ctd.put("CODTAB",catdon); + if (ctd.read() == NOERR) + { + bool dimissione = ctd.get_bool("B0"); + if (dimissione) + { + 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; + } } } bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter) { - TRectype* key_cont = new TRectype(LF_CONTSAN); - key_cont->put(CON_CODICE, recsog.get(SOG_CODICE)); - TRecord_array controlli(LF_CONTSAN,CON_PROGCON); - controlli.read(key_cont); - - TRectype* key = new TRectype(LF_IDONEITA); - key->put(IDO_CODICE, recsog.get(SOG_CODICE)); - TRecord_array idoneita(LF_IDONEITA,IDO_PROGIDO); - idoneita.read(key); - + TRectype* key_cont = new TRectype(LF_CONTSAN); + key_cont->put(CON_CODICE, recsog.get(SOG_CODICE)); + TRecord_array controlli(LF_CONTSAN,CON_PROGCON); + controlli.read(key_cont); + + TRectype* key = new TRectype(LF_IDONEITA); + key->put(IDO_CODICE, recsog.get(SOG_CODICE)); + TRecord_array idoneita(LF_IDONEITA,IDO_PROGIDO); + idoneita.read(key); + const int r = idoneita.last_row(); //se trova una data idoneita >= di quella in esame, quest'ultima 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) 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_DATAIDO, datadon); - 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_INTERVALLO, inter); - idoneita.add_row(rec); - idoneita.write(); - - con_reord(recsog, &controlli, &idoneita); - - return TRUE; + + TRectype* rec = new TRectype(LF_IDONEITA); + rec->put(IDO_CODICE, recsog.get(SOG_CODICE)); + 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 + rec->put(IDO_IDO_SOS, "ID"); + rec->put(IDO_INTERVALLO, inter); + idoneita.add_row(rec); + idoneita.write(); + + con_reord(recsog, &controlli, &idoneita); + + return TRUE; } // trasferimento dati da file CT su programma avis @@ -306,38 +308,38 @@ void TCtbo2at::transfer() TRectype& sogg = rel.curr(); TString8 str; // Stringa jolly di lavoro - TRecord_text curr; + TRecord_text curr; 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 //concorrenza!!!(ovviamente si va a stringhe fisse e non a tabelle! roba da avis.....) - str = curr.get(31); //donatore della concorrenza -> lo salta - str.trim(); - if (str == "ADVS") - continue; - if (str == "NOASS") //se il donatore é un cane sciolto -> va in sezione NI ed in categoria NI - { - curr.add("NI",0); - curr.add("@",1); - sogg.put(SOG_CATDON,"NI"); - } - + str = curr.get(31); //donatore della concorrenza -> lo salta + str.trim(); + if (str == "ADVS") + continue; + if (str == "NOASS") //se il donatore é un cane sciolto -> va in sezione NI ed in categoria NI + { + curr.add("NI",0); + curr.add("@",1); + sogg.put(SOG_CATDON,"NI"); + } + str = curr.get(2); sogg.put(SOG_CODICE, str); if (rel.read(_isequal) != NOERR) sogg.zero(); - //controlla se il donatore ha cambiato sezione spostandosi da Bologna in provincia; - //in questo caso gli deve cancellare il sottogruppo (veramente un procedimento da - //galera, ma se l'avis e winsit vogliono cosí.....) - str = curr.get(0); - str.trim(); - TString8 str1; - str1 = curr.get(1); - str1.trim(); - if (str != sogg.get(SOG_CODSEZ) && str != "01" && str1 == "") - curr.add("@",1); + //controlla se il donatore ha cambiato sezione spostandosi da Bologna in provincia; + //in questo caso gli deve cancellare il sottogruppo (veramente un procedimento da + //galera, ma se l'avis e winsit vogliono cosí.....) + str = curr.get(0); + str.trim(); + TString8 str1; + str1 = curr.get(1); + str1.trim(); + if (str != sogg.get(SOG_CODSEZ) && str != "01" && str1 == "") + curr.add("@",1); _trasfile->autosave(rel, curr); //const long codsog = atol(curr.get(2)); @@ -349,17 +351,17 @@ void TCtbo2at::transfer() str = curr.get(23+i); if (!str.blank()) { - datadon = TDate(str); - str = curr.get(32); - str.trim(); - //cambio codice del punto di prelievo per casi speciali (sarebbe necessaria una tabella, - //ma con l'AVIS é tempo sprecato....) - if (str == "UROM") - str = "013"; else - if (str == "UROB") - str = "O.BE"; else - if (str == "IMOLA") - str = "70"; + datadon = TDate(str); + str = curr.get(32); + str.trim(); + //cambio codice del punto di prelievo per casi speciali (sarebbe necessaria una tabella, + //ma con l'AVIS é tempo sprecato....) + if (str == "UROM") + str = "013"; else + if (str == "UROB") + str = "O.BE"; else + if (str == "IMOLA") + str = "70"; update |= test_donation(sogg, tipo[i], datadon, str); } str = curr.get(27+i); @@ -372,13 +374,13 @@ void TCtbo2at::transfer() } } _trasfile->close(); - message_box("Operazione terminata"); + message_box("Operazione terminata"); } //inizializza il file di testo su cui emettere i dati 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'); } @@ -403,7 +405,7 @@ void TCtbo2at_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, T TString valore; if (code == "_UPPERCASE") { - valore.upper(); + valore.upper(); } else NFCHECK("Macro non definita: %s", (const char *)code); str = valore;