diff --git a/at/at0900.cpp b/at/at0900.cpp deleted file mode 100755 index beda72900..000000000 --- a/at/at0900.cpp +++ /dev/null @@ -1,253 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "at0.h" -#include "atlib.h" - -#define ALIAS_TCS 200 // alias tabella tipi/esiti controlli sanitari -#define MODIFICA_ID "MI" // controllo per modificare idoneita' precedente - -// nomi campi maschera -#include "at0900a.h" - -// nomi dei campi -#include "soggetti.h" -#include "contsan.h" -#include "sezioni.h" - -class TModificaIntervalli : public TPrintapp -{ - TMask* _msk; - TRelation* _rel; - - TLocalisamfile* _contsan; - TRecord_array* _scontrolli; - - int _cur; - bool _modsi, _modaf; - int _oldsi, _oldaf, _newsi, _newaf; - TDate _data_stampa; - TString16 _codsez, _codsot; - - static bool filter_func_intervalli(const TRelation* rel); - -protected: - virtual bool user_create(); - virtual bool user_destroy(); - virtual bool set_print(int m); - virtual void set_page(int file, int cnt); - virtual bool preprocess_page(int file, int counter); - -public: - void filtra_sezioni(); - void crea_intestazione(); - void header_sezione(const TString16 codsez, const TString16 codsot); - TModificaIntervalli() : _data_stampa(TODAY) {} -}; - -HIDDEN inline TModificaIntervalli& app() { return (TModificaIntervalli&) main_app(); } - -void TModificaIntervalli::filtra_sezioni() -{ - const TString16 sezini = _msk->get(F_SEZINI); - const TString16 sotini = _msk->get(F_SOTINI); - const TString16 sezfin = _msk->get(F_SEZFIN); - const TString16 sotfin = _msk->get(F_SOTFIN); - TRectype da(LF_SOGGETTI); - TRectype a(LF_SOGGETTI); - if (sezini.not_empty()) - da.put(SOG_CODSEZ, sezini); - if (sotini.not_empty()) - da.put(SOG_CODSOT, sotini); - if (sezfin.not_empty()) - a.put(SOG_CODSEZ, sezfin); - if (sotfin.not_empty()) - a.put(SOG_CODSOT, sotfin); - current_cursor()->setregion(da, a); -} - -bool TModificaIntervalli::preprocess_page(int file, int counter) -{ - TRectype& recsog = current_cursor()->curr(); - TRectype* key = new TRectype(LF_CONTSAN); - long codice = recsog.get_long(SOG_CODICE); - key->put(CON_CODICE, codice); - int err = _scontrolli->read(key); - int progcon = _scontrolli->rows()+1; - TRectype& reccon = _contsan->curr(); - reccon.zero(); - reccon.put(CON_CODICE, codice); - reccon.put(CON_PROGCON, progcon); - reccon.put(CON_DATACON, _data_stampa); - reccon.put(CON_TIPOCON, MODIFICA_ID); - reccon.put(CON_IDON1, recsog.get(SOG_IDON1)); - reccon.put(CON_IDON2, recsog.get(SOG_IDON2)); - reccon.put(CON_IDON3, recsog.get(SOG_IDON3)); - reccon.put(CON_IDON4, recsog.get(SOG_IDON4)); - if (_modsi) - reccon.put(CON_INTSI, _newsi); - else - reccon.put(CON_INTSI, recsog.get_int(SOG_INTSI)); - if (_modaf) - reccon.put(CON_INTAF, _newaf); - else - reccon.put(CON_INTAF, recsog.get_int(SOG_INTAF)); - _scontrolli->add_row(reccon); - _scontrolli->rewrite(); - //con_reord(recsog, _scontrolli); - current_cursor()->file().rewrite(); - - // salto pagina se cambio sezione - const TString16 codsez = recsog.get(SOG_CODSEZ); - const TString16 codsot = recsog.get(SOG_CODSOT); - if ((_codsez!=codsez)||(_codsot!=codsot)) - { - if (_codsez != "**") - printer().formfeed(); - _codsez = codsez; - _codsot = codsot; - header_sezione(codsez, codsot); - } - return TRUE; -} - -void TModificaIntervalli::set_page(int file, int cnt) -{ - set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######")); - set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON)); - set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME)); - set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME)); - set_row(1,"@63g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); -} - -bool TModificaIntervalli::filter_func_intervalli(const TRelation* rel) -{ - bool filtrato = FALSE; - TRectype& recsog = rel->lfile().curr(); - if (app()._modsi) - filtrato = (app()._oldsi == recsog.get_int(SOG_INTSI)); - if (app()._modaf && !filtrato) - filtrato = (app()._oldaf == recsog.get_int(SOG_INTAF)); - return filtrato; -} - -void TModificaIntervalli::header_sezione(const TString16 codsez, const TString16 codsot) -{ - const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); - const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); - TString intestazione(132); - intestazione = "Sezione: "; - intestazione << codsez; - intestazione << "/"; - intestazione << codsot; - intestazione << " "; - intestazione << densez; - if (densot.not_empty()) - { - intestazione << "/"; - intestazione << densot; - } - intestazione.center_just(); - set_header(1,"@0g%s", (const char*) intestazione); - return; -} - -bool TModificaIntervalli::set_print(int) -{ - KEY tasto; - tasto = _msk->run(); - if (tasto == K_ENTER) - { - _codsez = "**"; - _codsot = "**"; - _modsi = _msk->get_bool(F_MOD_SI); - _modaf = _msk->get_bool(F_MOD_AF); - _oldsi = _msk->get_int(F_OLD_SI); - _oldaf = _msk->get_int(F_OLD_AF); - _newsi = _msk->get_int(F_NEW_SI); - _newaf = _msk->get_int(F_NEW_AF); - reset_files(); - add_file(LF_SOGGETTI); - filtra_sezioni(); - // non si puo' fare il filtro per intervalli perche' la setfilter - // non funziona bene con i campi numerici - current_cursor()->set_filterfunction(filter_func_intervalli, TRUE); - reset_print(); - crea_intestazione(); - return TRUE; - } - else - return FALSE; -} - -void TModificaIntervalli::crea_intestazione() -{ - reset_header(); - - TString sep(132); - sep = "MODIFICA INTERVALLI DI DONAZIONE "; - if (_modsi) - { - sep << "SI da "; - sep << _oldsi ; - sep << " a "; - sep << _newsi; - } - if (_modaf) - { - if (_modsi) - sep << " - "; - sep << "AF da "; - sep << _oldaf ; - sep << " a "; - sep << _newaf; - } - sep.center_just(); - set_header(2, "@0g%s", (const char*) sep); - TString16 data_stampa = _data_stampa.string(); - set_header(2,"@0g%10s", (const char*) data_stampa); - sep = ""; - sep << "Pag. @#"; - set_header(2, "@120g%s", (const char*) sep); - - sep = ""; - sep.fill('-'); - set_header(3, (const char *) sep); - set_header(4,"@0gCod.@9gC.@12gCognome e nome@38gNato il"); - set_header(5,"@0g------@9g--@12g-------------------------@38g----------"); -} - -bool TModificaIntervalli::user_create() -{ - _msk = new TMask("at0900a"); - _rel = new TRelation(LF_SOGGETTI); - _rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT"); - _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); - //cursore ordinamento per sezione+sottogruppo+cognome+nome - _cur = add_cursor(new TCursor(_rel, "", 3)); - - _contsan = new TLocalisamfile(LF_CONTSAN); - _scontrolli = new TRecord_array(LF_CONTSAN, CON_PROGCON); - return TRUE; -} - -bool TModificaIntervalli::user_destroy() -{ - delete _scontrolli; - delete _contsan; - delete _rel; - delete _msk; - return TRUE; -} - -int at0900(int argc, char* argv[]) -{ - TModificaIntervalli a; - a.run(argc, argv, "Modifica intervalli di donazione"); - return 0; -} \ No newline at end of file diff --git a/at/at0900a.h b/at/at0900a.h deleted file mode 100755 index 5ed8288c1..000000000 --- a/at/at0900a.h +++ /dev/null @@ -1,17 +0,0 @@ -// modifica intervalli di donazione -// definizione campi per maschera di selezione - -#define F_SEZINI 101 -#define F_D_SEZINI 102 -#define F_SOTINI 103 -#define F_D_SOTINI 104 -#define F_SEZFIN 105 -#define F_D_SEZFIN 106 -#define F_SOTFIN 107 -#define F_D_SOTFIN 108 -#define F_MOD_SI 109 -#define F_OLD_SI 110 -#define F_NEW_SI 111 -#define F_MOD_AF 112 -#define F_OLD_AF 113 -#define F_NEW_AF 114 diff --git a/at/at0900a.uml b/at/at0900a.uml deleted file mode 100755 index 0ccd940af..000000000 --- a/at/at0900a.uml +++ /dev/null @@ -1,180 +0,0 @@ -#include "at0900a.h" - -PAGE "Modifica intervalli di donazione" -1 -1 78 11 - -GROUPBOX DLG_NULL 77 4 -BEGIN - PROMPT 1 1 "Scelta sezioni/sottogruppi" -END - -STRING F_SEZINI 2 -BEGIN - PROMPT 2 2 "Da " - FLAGS "U" - USE LF_SEZIONI - INPUT CODSEZ F_SEZINI - INPUT CODSOT F_SOTINI - DISPLAY "Cod.sez" CODSEZ - DISPLAY "Cod.sot." CODSOT - DISPLAY "Sezione@25" DENSEZ - DISPLAY "Sottogruppo@25" DENSOT - OUTPUT F_SEZINI CODSEZ - OUTPUT F_D_SEZINI DENSEZ - OUTPUT F_SOTINI CODSOT - OUTPUT F_D_SOTINI DENSOT - CHECKTYPE SEARCH - HELP "Codice sezione da cui partire" -END - -STRING F_D_SEZINI 25 -BEGIN - PROMPT 11 2 "" - FLAGS "U" - USE LF_SEZIONI KEY 2 - INPUT DENSEZ F_D_SEZINI - DISPLAY "Sezione@25" DENSEZ - DISPLAY "Sottogruppo@25" DENSOT - DISPLAY "Cod.sez" CODSEZ - DISPLAY "Cod.sot." CODSOT - COPY OUTPUT F_SEZINI - CHECKTYPE NORMAL - HELP "Sezione da cui partire" -END - -STRING F_SOTINI 2 -BEGIN - PROMPT 2 3 " " - COPY ALL F_SEZINI - CHECKTYPE SEARCH - HELP "Codice sottogruppo da cui partire" -END - -STRING F_D_SOTINI 25 -BEGIN - PROMPT 11 3 "" - FLAGS "U" - COPY USE F_D_SEZINI - INPUT DENSEZ F_D_SEZINI - INPUT DENSOT F_D_SOTINI - COPY DISPLAY F_D_SEZINI - COPY OUTPUT F_D_SEZINI - CHECKTYPE NORMAL - HELP "Sottogruppo da cui partire" -END - -STRING F_SEZFIN 2 -BEGIN - PROMPT 41 2 "A " - FLAGS "U" - USE LF_SEZIONI - INPUT CODSEZ F_SEZFIN - INPUT CODSOT F_SOTFIN - DISPLAY "Cod.sez" CODSEZ - DISPLAY "Cod.sot." CODSOT - DISPLAY "Sezione@25" DENSEZ - DISPLAY "Sottogruppo@25" DENSOT - OUTPUT F_SEZFIN CODSEZ - OUTPUT F_D_SEZFIN DENSEZ - OUTPUT F_SOTFIN CODSOT - OUTPUT F_D_SOTFIN DENSOT - CHECKTYPE SEARCH - HELP "Codice sezione finale" -END - -STRING F_D_SEZFIN 25 -BEGIN - PROMPT 49 2 "" - FLAGS "U" - USE LF_SEZIONI KEY 2 - INPUT DENSEZ F_D_SEZFIN - DISPLAY "Sezione@25" DENSEZ - DISPLAY "Sottogruppo@25" DENSOT - DISPLAY "Cod.sez" CODSEZ - DISPLAY "Cod.sot." CODSOT - COPY OUTPUT F_SEZFIN - CHECKTYPE NORMAL - HELP "Sezione finale" -END - -STRING F_SOTFIN 2 -BEGIN - PROMPT 41 3 " " - COPY ALL F_SEZFIN - CHECKTYPE SEARCH - HELP "Codice sottogruppo finale" -END - -STRING F_D_SOTFIN 25 -BEGIN - PROMPT 49 3 "" - FLAGS "U" - COPY USE F_D_SEZFIN - INPUT DENSEZ F_D_SEZFIN - INPUT DENSOT F_D_SOTFIN - COPY DISPLAY F_D_SEZFIN - COPY OUTPUT F_D_SEZFIN - CHECKTYPE NORMAL - HELP "Sottogruppo finale" -END - -GROUPBOX DLG_NULL 77 4 -BEGIN - PROMPT 1 5 "Opzioni per la modifica" -END - -BOOLEAN F_MOD_SI -BEGIN - PROMPT 2 6 "Modifica intervallo SI" - HELP "Si vuole modificare l'intervallo per la donazione SI" - MESSAGE TRUE ENABLE, 1@ - MESSAGE FALSE DISABLE, 1@ -END - -NUMBER F_OLD_SI 3 -BEGIN - PROMPT 30 6 "Vecchio " - HELP "Indicare l'intervallo di donazione SI che si vuole modificare" - GROUP 1 -END - -NUMBER F_NEW_SI 3 -BEGIN - PROMPT 45 6 "Nuovo " - HELP "Indicare il nuovo intervallo di donazione SI" - GROUP 1 -END - -BOOLEAN F_MOD_AF -BEGIN - PROMPT 2 7 "Modifica intervallo AF" - HELP "Si vuole modificare l'intervallo per la donazione AF" - MESSAGE TRUE ENABLE, 2@ - MESSAGE FALSE DISABLE, 2@ -END - -NUMBER F_OLD_AF 3 -BEGIN - PROMPT 30 7 "Vecchio " - HELP "Indicare l'intervallo di donazione AF che si vuole modificare" - GROUP 2 -END - -NUMBER F_NEW_AF 3 -BEGIN - PROMPT 45 7 "Nuovo " - HELP "Indicare il nuovo intervallo di donazione AF" - GROUP 2 -END - -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -12 -1 "" -END - -BUTTON DLG_QUIT 9 2 -BEGIN - PROMPT -22 -1 "" -END - -ENDPAGE -ENDMASK