From 9c5df3d01913e40aa4fcc0e9e2d4ee8fdcb73aba Mon Sep 17 00:00:00 2001 From: cris Date: Mon, 8 Mar 1999 15:07:56 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunto aggiornamento situazione soggetti da file esterno (appoggio, con codice soggetti da riordinare) git-svn-id: svn://10.65.10.50/trunk@7905 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at8.cpp | 4 +- at/at8.h | 1 + at/at8.url | 5 ++ at/at8400.cpp | 218 +++++++++++++++++++++++++++++++++++++++++++++++++ at/at8400a.uml | 13 +++ 5 files changed, 240 insertions(+), 1 deletion(-) create mode 100755 at/at8400.cpp create mode 100755 at/at8400a.uml diff --git a/at/at8.cpp b/at/at8.cpp index 5e379a477..6756c4682 100755 --- a/at/at8.cpp +++ b/at/at8.cpp @@ -4,7 +4,7 @@ #include "at8.h" -#define usage "Error - usage : %s -{0|1|2}" +#define usage "Error - usage : %s -{0|1|2|3}" int main(int argc,char** argv) @@ -20,6 +20,8 @@ int main(int argc,char** argv) rt = at8200(argc,argv) ; break; case 2: rt = at8300(argc,argv) ; break; + case 3: + rt = at8400(argc,argv) ; break; default: error_box(usage, argv[0]) ; break; } diff --git a/at/at8.h b/at/at8.h index ffbffad18..69b12eb35 100755 --- a/at/at8.h +++ b/at/at8.h @@ -4,6 +4,7 @@ int at8100(int argc, char* argv[]); int at8200(int argc, char* argv[]); int at8300(int argc, char* argv[]); +int at8400(int argc, char* argv[]); #endif // __AT8_H diff --git a/at/at8.url b/at/at8.url index f4d7503e4..960b7348a 100755 --- a/at/at8.url +++ b/at/at8.url @@ -17,3 +17,8 @@ MENUBAR MENU_BAR(2) MENU MENU_BAR(2) SUBMENU MENU_FILE "~File" +/* at8 -3 aggiornamento situazione soggetti da appoggio */ +MENUBAR MENU_BAR(3) +MENU MENU_BAR(3) + SUBMENU MENU_FILE "~File" + diff --git a/at/at8400.cpp b/at/at8400.cpp new file mode 100755 index 000000000..39880df76 --- /dev/null +++ b/at/at8400.cpp @@ -0,0 +1,218 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "at8.h" + +#include "atlib.h" + +// nomi dei campi +#include "soggetti.h" +#include "donaz.h" +#include "contsan.h" +#include "idoneita.h" +#include "rconvoc.h" + +class TReconstruction : public TApplication +{ + TMask* _msk; + TRelation* _rel; + + TLocalisamfile* _soggetti; + TLocalisamfile* _donaz; + TLocalisamfile* _contsan; + TLocalisamfile* _idoneita; + TRecord_array* _sdonazioni; + TRecord_array* _scontrolli; + TRecord_array* _sidoneita; + // parametri di sezione + int _intsi_f1, _intsi_f2, _intsi_m, _intaf_m, _etadonne; + int _numdon1, _numdon2; + TString16 _catini1, _catfin1, _catini2, _catfin2, _motivoid; + bool _sttess2, _dataisc, _nomessage, _autoid; + + +protected: + virtual bool create(); + virtual bool destroy(); + virtual bool menu(MENU_TAG m); + virtual TMask& get_mask() { return *_msk; } + virtual TRelation* get_relation() const { return _rel; } + + int write(TSheet_field& s); + +public: + TReconstruction() {} + +}; + +HIDDEN inline TReconstruction& app() { return (TReconstruction&) main_app(); } + +bool TReconstruction::create() +{ + TApplication::create(); + _msk = new TMask("at8400a"); + _rel = new TRelation(LF_SOGGETTI); + //_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD); + _donaz = new TLocalisamfile(LF_DONAZ); + _contsan = new TLocalisamfile(LF_CONTSAN); + _idoneita = new TLocalisamfile(LF_IDONEITA); + _sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON); + _scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON); + _sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO); + TConfig config(CONFIG_STUDIO); + _numdon1 = config.get_int("NumDon1"); + _numdon2 = config.get_int("NumDon2"); + _catini1 = config.get("CatIni1"); + _catfin1 = config.get("CatFin1"); + _catini2 = config.get("CatIni2"); + _catfin2 = config.get("CatFin2"); + _sttess2 = config.get_bool("StTess2"); + _dataisc = config.get_bool("DataIsc"); + _nomessage = config.get_bool("NoMessage"); + _etadonne = config.get_int("EtaDonne"); + _intsi_f1 = config.get_int("IntSI_F1"); + _intsi_f2 = config.get_int("IntSI_F2"); + _intsi_m = config.get_int("IntSI_M"); + _intaf_m = config.get_int("IntAF_M"); + dispatch_e_menu(BAR_ITEM(1)); + return TRUE; +} + +bool TReconstruction::destroy() +{ + delete _sidoneita; + delete _scontrolli; + delete _sdonazioni; + delete _idoneita; + delete _contsan; + delete _donaz; + delete _rel; + delete _msk; + return TApplication::destroy(); +} + +bool TReconstruction::menu(MENU_TAG m) +{ + KEY tasto = _msk->run(); + if (tasto == K_ENTER) + { + _rel->lfile().setkey(1); + bool modificato = FALSE; + TDate oggi(TODAY); + TRectype recsog = _rel->curr(); + TExternisamfile* f = new TExternisamfile("$appoggio"); + TProgind *pi; + pi = new TProgind(f->eod(),"Aggiornamento situazione soggetti da appoggio", FALSE, TRUE, 10); + pi->setstatus(1); + for(f->first(); !f->eof(); f->next()) + { + pi->addstatus(1); + const long codsog = f->get_long("CODICE"); + recsog.zero(); + recsog.put(SOG_CODICE, codsog); + if (recsog.read(_rel->lfile())==NOERR) + { + TRectype* keyd = new TRectype(LF_DONAZ); + keyd->put(DON_CODICE, codsog); + int err = _sdonazioni->read(keyd); + if (_sdonazioni->rows()>0) + { + calcola_donazioni_lib(recsog, _sdonazioni); + recsog.rewrite(_rel->lfile()); + } + TRectype* key = new TRectype(LF_IDONEITA); + key->put(IDO_CODICE, recsog.get(SOG_CODICE)); + _sidoneita->read(key); + TRectype* keyc = new TRectype(LF_CONTSAN); + keyc->put(CON_CODICE, recsog.get(SOG_CODICE)); + _scontrolli->read(keyc); + if (_scontrolli->rows()>0 || _sidoneita->rows()>0) + { + con_reord(recsog,_scontrolli,_sidoneita); + recsog.rewrite(_rel->lfile()); + } + 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) + { + recsog.put(SOG_CATDON,ctd.get("S6")); + if (ctd.get("S6").not_empty()) + catdon = ctd.get("S6"); + } + if ((catdon == _catini1 || _catini1.empty()) && (totdon==_numdon1) && _catfin1.not_empty()) + recsog.put(SOG_CATDON, _catfin1); + if ((catdon == _catini2 || _catini2.empty()) && (totdon>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || dimissione)) + recsog.put(SOG_CATDON, _catfin2); + } + TDate dataiscsog = recsog.get_date(SOG_DATAISC); + if (!dataiscsog.ok() && _dataisc) + { + if (!recsog.get_date(SOG_DATAPRISI) == NULLDATE) + recsog.put(SOG_DATAISC,recsog.get(SOG_DATAPRISI)); + else + { + const TRectype& riga = _sdonazioni->row(1); + recsog.put(SOG_DATAISC,riga.get(DON_DATADON)); + } + } + const TDate dataprossi = recsog.get_date(SOG_DATAPROSSI); + const TDate dataconv = recsog.get_date(SOG_DATACONV); + const char stato = modstato_tcs(recsog.get(SOG_STATO)); + const TString16 statosi = recsog.get(SOG_STATOSI); + if ((stato == 'S') || (statosi == SOSPENSIONE) || (dataprossi > dataconv) || !dataprossi.ok()) + { + TLocalisamfile rconvoc(LF_RCONVOC); + rconvoc.setkey(3); + rconvoc.zero(); + rconvoc.put(RCV_CODICE, recsog.get(SOG_CODICE)); + rconvoc.put(RCV_DATACONV, recsog.get(SOG_DATACONV)); + if (rconvoc.read() == NOERR) + { + rconvoc.put(RCV_ANNULLATO, TRUE); + int err = rconvoc.write(); + } + const TDate datanulla(NULLDATE); + recsog.put(SOG_DATACONV, datanulla); + recsog.put(SOG_DATAULTSOL, datanulla); + const int numzero = 0; + recsog.put(SOG_NUMCONV,numzero); + } + recsog.put(SOG_DATAULTAGG, oggi); + recsog.put(SOG_UTENULTAGG, "CRISTINA"); + recsog.rewrite(_rel->lfile()); + } + } + delete pi; + delete f; + } + return FALSE; +} + +int TReconstruction::write(TSheet_field& s) +{ + return NOERR; +} + + +int at8400(int argc, char* argv[]) +{ + TReconstruction a; + a.run(argc, argv, "Aggiornamento situazione soggetti da appoggio"); + return 0; +} \ No newline at end of file diff --git a/at/at8400a.uml b/at/at8400a.uml new file mode 100755 index 000000000..fd2c8fe43 --- /dev/null +++ b/at/at8400a.uml @@ -0,0 +1,13 @@ +PAGE "Aggiornamento situazione soggetti da appoggio" -1 -1 78 20 +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 14 "" +END + +BUTTON DLG_QUIT 9 2 +BEGIN + PROMPT -22 14 "" +END + +ENDPAGE +ENDMASK