diff --git a/at/at0100a.h b/at/at0100a.h new file mode 100755 index 000000000..12e382a78 --- /dev/null +++ b/at/at0100a.h @@ -0,0 +1,160 @@ +// definizione campi della maschera at0100a.msk +// SOGGETTI e dati collegati + +// pagina 1 +#define F_CODICE 101 +#define F_COGNOME 102 +#define F_NOME 103 +#define F_DATANASC 104 +#define F_CODSEZ 105 +#define F_DENSEZ 106 +#define F_CODSOT 107 +#define F_DENSOT 108 +#define F_CATDON 109 +#define F_DESC_CATDON 110 +#define F_DATAISC 111 +#define F_DATADIM 112 +#define F_COMNASC 113 +#define F_DENCOMNASC 114 +#define F_PROVCOMNASC 115 +#define F_INDIRIZZO 116 +#define F_COM 117 +#define F_DENCOM 118 +#define F_CAPCOM 119 +#define F_PROVCOM 120 +#define F_LOCALITA 121 +#define F_DENLOC 122 +#define F_TELABI 123 +#define F_TELLAV 124 +#define F_TELALT 125 +#define F_SESSO 126 +#define F_DATAULTAGG 127 +#define F_UTENULTAGG 128 + +// pagina 2 +#define F_CATNOND1 201 +#define F_DESC_CATNOND1 202 +#define F_CATNOND2 203 +#define F_DESC_CATNOND2 204 +#define F_TITINDIR 205 +#define F_TESSAVIS 206 +#define F_CODCT 207 +#define F_CODCL 208 +#define F_TESSSSN 209 +#define F_DOCID 210 +#define F_CF 211 +#define F_CONDOCC 212 +#define F_POSPROF 213 +#define F_RAMOATT 214 +#define F_TITSTUD 215 +#define F_PROFESS 216 +#define F_DESC_PROF 217 +#define F_LUOGOLAV 218 +#define F_DESC_LUOGO 219 + +// pagina 3 +#define F_STATO 301 +#define F_DESCSTATO 302 +#define F_DATASTATO 303 +#define F_IDON1 304 +#define F_DESC_ID1 305 +#define F_IDON2 306 +#define F_DESC_ID2 307 +#define F_IDON3 308 +#define F_DESC_ID3 309 +#define F_IDON4 310 +#define F_DESC_ID4 311 +#define F_DATAULTID 312 +#define F_TIPOULTID 313 +#define F_INTSI 314 +#define F_INTAF 315 +#define F_TOTDON 316 +#define F_DATAULTDON 317 +#define F_TIPOULTDON 318 +#define F_DESC_ULTDON 319 +#define F_DATAPROSSI 320 +#define F_DATAPROSAF 321 +#define F_DATAULTSI 322 +#define F_DATAULTAF 323 +#define F_TOTDONSI 324 +#define F_TOTDONAF 325 + + +// pagina 4 +#define F_GRUPPOAB0 401 +#define F_RHANTID 402 +#define F_KELL 403 +#define F_FENOTIPORH 404 +#define F_DU 405 +#define F_MODCONV 406 +#define F_GIOPREDON 407 +#define F_GIOPRECON 408 +#define F_ESCLUSO 409 +#define F_TERMESCL 410 +#define F_MOTESCL 411 +#define F_CODMED 412 +#define F_COGNMED 413 +#define F_NOMMED 414 + +// pagina 5 +#define F_DONAZIONI 501 + +// pagina 6 +#define F_CONTROLLI 601 + +// pagina 7 +#define F_BENEMERENZE 701 +#define F_STORICO 702 + +// bottoni personalizzati per l'applicazione +#define DLG_GENDON 801 + +// pagina donazioni +#define F_D_DATADON 101 +#define F_D_TIPODON 102 +#define F_D_LUOGODON 103 +#define F_D_ETICHETTA 104 +#define F_D_CC 105 +#define F_D_PA 106 +#define F_D_HB 107 +#define F_D_SGPT 108 +#define F_D_PROTIDEMIA 109 +//#define F_D_PRIMADON 110 +#define F_D_DESC_TIPODON 211 +#define F_D_DESC_LUOGODON 212 + +// pagina controlli sanitari +#define F_C_DATACON 101 +#define F_C_TIPOCON 102 +#define F_C_IDON1 103 +#define F_C_IDON2 104 +#define F_C_IDON3 105 +#define F_C_IDON4 106 +#define F_C_INTSI 107 +#define F_C_INTAF 108 +#define F_C_PROSSTIPO 109 +#define F_C_PROSSDATA 110 +#define F_C_DESC_TIPOCON 211 +#define F_C_DESC_IDON1 212 +#define F_C_DESC_IDON2 213 +#define F_C_DESC_IDON3 214 +#define F_C_DESC_IDON4 215 +#define F_C_DESC_PROSSTIPO 216 + +// pagina benemerenze +#define F_B_TIPOBEN 101 +#define F_B_DATABEN 102 +#define F_B_RITIRATA 103 +#define F_B_DESC_TIPOBEN 211 + +// pagina storico iscrizioni e dimissioni +#define F_S_DATAISC 101 +#define F_S_DATADIM 102 +#define F_S_CODSEZ 103 +#define F_S_CODSOT 104 +#define F_S_CATISC 105 +#define F_S_MOTDIM 106 +#define F_S_DENSEZ 211 +#define F_S_DENSOT 212 +#define F_S_DESC_CATISC 213 + diff --git a/at/at0100a.uml b/at/at0100a.uml index 33b9c8076..b627e5422 100755 --- a/at/at0100a.uml +++ b/at/at0100a.uml @@ -1,7 +1,14 @@ -#include "at0100.h" +#include "at0100a.h" #include "lf.h" -TOOLBAR "" 0 20 0 2 +TOOLBAR "" 0 20 0 2 + +BUTTON DLG_GENDON 25 1 +BEGIN +PROMPT -13 -3 "Genera donazioni" +MESSAGE K_F10 +END + #include ENDPAGE @@ -926,7 +933,7 @@ BEGIN DISPLAY "Nome@25" NOME DISPLAY "Codice" CODMED COPY OUTPUT F_CODMED - CHECKTYPE NORMAL + CHECKTYPE SEARCH HELP "Medico di base" WARNING "Medico assente" ADD MASK at0800a @@ -937,7 +944,7 @@ BEGIN PROMPT 48 9 "" USE LF_MEDICI KEY 2 INPUT COGNOME F_COGNMED - INPUT NOME F_NOMNMED + INPUT NOME F_NOMMED DISPLAY "Cognome@25" COGNOME DISPLAY "Nome@25" NOME DISPLAY "Codice" CODMED @@ -1466,7 +1473,7 @@ BEGIN DISPLAY "Descrizione@30" S0 OUTPUT F_C_PROSSTIPO CODTAB OUTPUT F_C_DESC_PROSSTIPO S0 - CHECKTYPE REQUIRED + CHECKTYPE NORMAL WARNING "Codice non presente" HELP "Tipo/Esito controllo sanitario" END diff --git a/at/at0200.cpp b/at/at0200.cpp index b7c976466..a73e28100 100755 --- a/at/at0200.cpp +++ b/at/at0200.cpp @@ -44,14 +44,14 @@ protected: virtual TMask& get_mask() { return *_msk; } virtual TRelation* get_relation() const { return _rel; } - virtual TAssoc_array& get_array_sogg() { return *_asoggetti; } - virtual int write(TSheet_field& s); + TAssoc_array& get_array_sogg() { return *_asoggetti; } + int write(TSheet_field& s); - static bool check_sog_sheet(const char* codsog); - //static bool codice_handler(TMask_field& f, KEY k); + bool check_sog_sheet(const char* codsog); static bool nome_handler(TMask_field& f, KEY k); + static bool codice_handler(TMask_field& f, KEY k); static bool soggetti_notify(TSheet_field& s, int r, KEY k); - static void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 1); + void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 0); static bool ins_controlli_handler(TMask_field& f, KEY k); public: @@ -76,10 +76,10 @@ bool TDonaz_app::ins_controlli_handler(TMask_field& f, KEY k) void TDonaz_app::add_rows_soggetti(TSheet_field& s, int count, int start) { - if (start == 1) + if (start == 0) s.destroy(); - for (int r=start; r<=start+count; r++) - TToken_string& row = s.row(r-1); + for (int r=start; r<=start+count-1; r++) + TToken_string& row = s.row(r); } bool TDonaz_app::create() @@ -97,8 +97,8 @@ bool TDonaz_app::create() TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI); ss.set_notify(soggetti_notify); - //ss.sheet_mask().set_handler(F_S_CODICE,codice_handler); ss.sheet_mask().set_handler(F_S_NOME,nome_handler); + ss.sheet_mask().set_handler(F_S_CODICE,codice_handler); dispatch_e_menu(BAR_ITEM(1)); @@ -125,14 +125,19 @@ bool TDonaz_app::menu(MENU_TAG m) do { TSheet_field& s = (TSheet_field&)msk.field(F_SOGGETTI); - add_rows_soggetti(s,12); + s.destroy(); + add_rows_soggetti(s); _asoggetti->destroy(); msk.set(F_DATADON,oggi); tasto = msk.run(); switch (tasto) { case K_ESC: // annulla + { + if (yesno_box("Registrare le modifiche?")) + TDonaz_app::write(s); msk.reset(); + } break; case K_SAVE: // registra { @@ -146,6 +151,12 @@ bool TDonaz_app::menu(MENU_TAG m) msk.reset(); } break; + case K_QUIT: // fine + { + if (yesno_box("Registrare le modifiche?")) + TDonaz_app::write(s); + } + break; } } while (tasto != K_QUIT); @@ -444,43 +455,20 @@ bool TDonaz_app::soggetti_notify(TSheet_field& s, int r, KEY k) TAssoc_array& array_sogg = app().get_array_sogg(); if (array_sogg.is_key(codsog)) array_sogg.remove(codsog); - } + } if ((r == s.items()-1) && (r == s.first_empty())) { - add_rows_soggetti(s,10,r+1); + app().add_rows_soggetti(s,10,r+1); s.select(r); - } + } } break; case K_CTRL+K_TAB: // uscita riga { - TToken_string& row = s.row(r); - const char* codice = row.get(0); - if (codice != NULL) - { - ok = check_sog_sheet(codice); - if (!ok) - return s.error_box("Soggetto già inserito"); - else - // controllare che sia idoneo a quel tipo di donazione - // il controllo sull'esistenza della donazione viene fatto - // al momento della registrazione (write) - { - const long codsog = row.get_long(0); - - //TLocalisamfile& sog = get_relation()->lfile(); - //sog.zero(); - //sog.put(SOG_CODICE, codsog); - //int err = sog.read(); - //if (err == NOERR) - //{ - //} - } - } if ((r == s.items()-1) && (r == s.first_empty())) { - add_rows_soggetti(s,10,r+1); + app().add_rows_soggetti(s,10,r+1); s.select(r); } } @@ -489,33 +477,36 @@ bool TDonaz_app::soggetti_notify(TSheet_field& s, int r, KEY k) return ok; } -/* bool TDonaz_app::codice_handler(TMask_field& f, KEY k) { bool ok = TRUE; - if (k == K_TAB && f.focusdirty() && f.get().not_empty()) - { - const TMask& m = f.mask(); - const char* codsog = m.get(F_S_CODICE); - ok = check_sog_sheet(codsog); // controllo che il sog. non sia già inserito - if (!ok) - f.error_box("Soggetto già inserito"); - } - return ok; + if (k == K_TAB && f.focusdirty()) + { + const char* codice = f.get(); + if (codice != NULL) + { + ok = app().check_sog_sheet(codice); + if (!ok) + return f.error_box("Soggetto già inserito"); + //else + // controllare che sia idoneo a quel tipo di donazione + // il controllo sull'esistenza della donazione viene fatto + // al momento della registrazione (write) + } + } + return ok; } -*/ bool TDonaz_app::nome_handler(TMask_field& f, KEY k) { - bool ok = TRUE; + bool ok = TRUE; if (k == K_TAB && f.focusdirty()) { TMask& m = f.mask(); long codsog = m.get_long(F_S_CODICE); if (codsog == 0) - m.send_key(K_F9,F_S_NOME); + f.on_key(K_F9); } - //f.message_box("sono in nome_handler"); return ok; } diff --git a/at/at0200a.uml b/at/at0200a.uml index 37b0f0c57..8ff8cb1b6 100755 --- a/at/at0200a.uml +++ b/at/at0200a.uml @@ -1,258 +1,289 @@ -#include "at0200a.h" -#include "lf.h" - -TOOLBAR "" 0 20 0 2 -#include -ENDPAGE - -PAGE "Giornaliero donazioni/controlli" -1 -1 78 20 - - -GROUPBOX DLG_NULL 77 6 -BEGIN - PROMPT 1 0 "Dati fissi" - FLAGS "R" -END - -DATE F_DATADON -BEGIN - PROMPT 2 1 "Data donazione " - //VALIDATE NOT_EMPTY_FUNC - CHECKTYPE REQUIRED - HELP "Data donazione" -END - -STRING F_TIPODON 2 -BEGIN - PROMPT 2 2 "Tipo donazione " - FLAGS "U" - USE TDN - INPUT CODTAB F_TIPODON - DISPLAY "Codice" CODTAB - DISPLAY "Descrizione@30" S0 - OUTPUT F_TIPODON CODTAB - OUTPUT F_DESC_TIPODON S0 - //VALIDATE NOT_EMPTY_FUNC - CHECKTYPE REQUIRED - WARNING "Codice non presente" - HELP "Tipo donazione" -END - -STRING F_LUOGODON 4 -BEGIN - PROMPT 2 3 "Luogo donazione " - FLAGS "U" - USE LDN - INPUT CODTAB F_LUOGODON - DISPLAY "Codice" CODTAB - DISPLAY "Descrizione@30" S0 - OUTPUT F_LUOGODON CODTAB - OUTPUT F_DESC_LUOGODON S0 - CHECKTYPE NORMAL - WARNING "Codice non presente" - HELP "Luogo donazione" -END - -STRING F_DESC_TIPODON 25 -BEGIN - PROMPT 30 2 "" - FLAGS "D" -END - -STRING F_DESC_LUOGODON 25 -BEGIN - PROMPT 30 3 "" - FLAGS "D" -END - -BOOLEAN F_INS_CONTROLLI -BEGIN - PROMPT 2 4 "Inserimento controlli" -END - -GROUPBOX DLG_NULL 77 13 -BEGIN - PROMPT 1 6 "Soggetti" -END - -SPREADSHEET F_SOGGETTI 75 11 -BEGIN - PROMPT 2 7 "" - ITEM "Codice@6" - ITEM "Cognome@25" - ITEM "Nome@25" - ITEM "Con." - ITEM "Nato il@10" - ITEM "Sez." - ITEM "Sot." - ITEM "Cat." - ITEM "Tessera" -END - -ENDPAGE - -ENDMASK - -PAGE "Soggetto " -1 -1 78 20 - -NUMBER F_S_CODICE 6 -BEGIN - PROMPT 2 1 "Codice " - FIELD LF_SOGGETTI->CODICE - FLAGS "RG" - USE LF_SOGGETTI KEY 1 - INPUT CODICE F_S_CODICE - DISPLAY "Codice@6" CODICE - DISPLAY "Cognome@25" COGNOME - DISPLAY "Nome@25" NOME - DISPLAY "Nato il@10" DATANASC - DISPLAY "Sez." CODSEZ - DISPLAY "Sot." CODSOT - DISPLAY "C." CATDON - DISPLAY "Tessera" TESSAVIS - OUTPUT F_S_CODICE CODICE - OUTPUT F_S_COGNOME COGNOME - OUTPUT F_S_NOME NOME - OUTPUT F_S_DATANASC DATANASC - OUTPUT F_S_CODSEZ CODSEZ - OUTPUT F_S_CODSOT CODSOT - OUTPUT F_S_CATDON CATDON - CHECKTYPE NORMAL - ADD RUN at0 -0 -END - -STRING F_S_COGNOME 25 -BEGIN - PROMPT 2 2 "Cognome e nome " - FIELD LF_SOGGETTI->COGNOME - USE LF_SOGGETTI KEY 2 - INPUT COGNOME F_S_COGNOME - INPUT NOME F_S_NOME - DISPLAY "Cognome@25" COGNOME - DISPLAY "Nome@25" NOME - DISPLAY "Nato il@10" DATANASC - DISPLAY "Codice@6" CODICE - DISPLAY "Sez." CODSEZ - DISPLAY "Sot." CODSOT - DISPLAY "C." CATDON - DISPLAY "Tessera" TESSAVIS - COPY OUTPUT F_S_CODICE - CHECKTYPE SEARCH - HELP "Cognome del soggetto" - ADD RUN at0 -0 -END - -STRING F_S_NOME 25 -BEGIN - PROMPT 46 2 "" - FIELD LF_SOGGETTI->NOME - COPY ALL F_S_COGNOME - COPY OUTPUT F_S_CODICE - //CHECKTYPE NORMAL - CHECKTYPE SEARCH - HELP "Nome del soggetto" - ADD RUN at0 -0 -END - -STRING F_S_TIPOCON 2 -BEGIN - PROMPT 2 5 "Tipo controllo " - FLAGS "U" - USE TCS SELECT S6=="N" - INPUT CODTAB F_S_TIPOCON - DISPLAY "Codice" CODTAB - DISPLAY "Descrizione@30" S0 - OUTPUT F_S_TIPOCON CODTAB - OUTPUT F_S_DESC_TIPOCON S0 - WARNING "Codice non presente" - HELP "Tipo/Esito controllo sanitario" -END - -DATE F_S_DATANASC -BEGIN - PROMPT 2 3 "Nato il " - FIELD LF_SOGGETTI->DATANASC - FLAGS "D" -END - -STRING F_S_CODSEZ 2 -BEGIN - PROMPT 2 7 "Sez. " - FIELD LF_SOGGETTI->CODSEZ - FLAGS "D" -END - -STRING F_S_DENSEZ 25 -BEGIN - PROMPT 13 7 "" - FLAGS "D" -END - -STRING F_S_CODSOT 2 -BEGIN - PROMPT 43 7 "Sot. " - FIELD LF_SOGGETTI->CODSOT - FLAGS "D" - USE LF_SEZIONI - INPUT CODSEZ F_S_CODSEZ - INPUT CODSOT F_S_CODSOT - OUTPUT F_S_DENSEZ DENSEZ - OUTPUT F_S_DENSOT DENSOT - CHECKTYPE NORMAL -END - -STRING F_S_DENSOT 25 -BEGIN - PROMPT 54 7 "" - FLAGS "D" -END - -STRING F_S_CATDON 2 -BEGIN - PROMPT 2 8 "Cat. " - FIELD LF_SOGGETTI->CATDON - FLAGS "D" - USE CTD - INPUT CODTAB F_S_CATDON - OUTPUT F_S_DESC_CATDON S0 - CHECKTYPE NORMAL -END - -STRING F_S_TESSERA 10 -BEGIN - PROMPT 43 8 "Tessera AVIS " - FIELD LF_SOGGETTI->TESSAVIS - FLAGS "D" -END - -STRING F_S_DESC_TIPOCON 25 -BEGIN - PROMPT 35 5 "" - FLAGS "D" -END - -STRING F_S_DESC_CATDON 22 -BEGIN - PROMPT 13 8 "" - FLAGS "D" -END - -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -13 -1 "" -END - -BUTTON DLG_CANCEL 9 2 -BEGIN - PROMPT -23 -1 "" -END - -BUTTON DLG_DELREC 9 2 -BEGIN - PROMPT -33 -1 "" - MESSAGE EXIT, K_DEL -END - -ENDPAGE - -ENDMASK +#include "at0200a.h" +#include "lf.h" + +TOOLBAR "" 0 20 0 2 + +BUTTON DLG_SAVEREC 10 2 +BEGIN + PROMPT -14 -11 "~Registra" + MESSAGE EXIT,K_SAVE + PICTURE BMP_SAVEREC + PICTURE BMP_SAVERECDN +END + +BUTTON DLG_NEWREC 10 2 +BEGIN + PROMPT -24 -11 "~Nuovo" + MESSAGE EXIT,K_INS + PICTURE BMP_NEWREC + PICTURE BMP_NEWRECDN +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -34 -11 "~Annulla" + MESSAGE EXIT,K_ESC + PICTURE 102 +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -44 -11 "~Fine" + MESSAGE EXIT,K_QUIT + PICTURE BMP_QUIT + PICTURE BMP_QUITDN +END + +ENDPAGE + +PAGE "Giornaliero donazioni/controlli" -1 -1 78 20 + + +GROUPBOX DLG_NULL 77 6 +BEGIN + PROMPT 1 0 "Dati fissi" + FLAGS "R" +END + +DATE F_DATADON +BEGIN + PROMPT 2 1 "Data donazione " + //VALIDATE NOT_EMPTY_FUNC + CHECKTYPE REQUIRED + HELP "Data donazione" +END + +STRING F_TIPODON 2 +BEGIN + PROMPT 2 2 "Tipo donazione " + FLAGS "U" + USE TDN + INPUT CODTAB F_TIPODON + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_TIPODON CODTAB + OUTPUT F_DESC_TIPODON S0 + //VALIDATE NOT_EMPTY_FUNC + CHECKTYPE REQUIRED + WARNING "Codice non presente" + HELP "Tipo donazione" +END + +STRING F_LUOGODON 4 +BEGIN + PROMPT 2 3 "Luogo donazione " + FLAGS "U" + USE LDN + INPUT CODTAB F_LUOGODON + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_LUOGODON CODTAB + OUTPUT F_DESC_LUOGODON S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" + HELP "Luogo donazione" +END + +STRING F_DESC_TIPODON 25 +BEGIN + PROMPT 30 2 "" + FLAGS "D" +END + +STRING F_DESC_LUOGODON 25 +BEGIN + PROMPT 30 3 "" + FLAGS "D" +END + +BOOLEAN F_INS_CONTROLLI +BEGIN + PROMPT 2 4 "Inserimento controlli" +END + +GROUPBOX DLG_NULL 77 13 +BEGIN + PROMPT 1 6 "Soggetti" +END + +SPREADSHEET F_SOGGETTI 75 11 +BEGIN + PROMPT 2 7 "" + ITEM "Codice@6" + ITEM "Cognome@25" + ITEM "Nome@25" + ITEM "Con." + ITEM "Nato il@10" + ITEM "Sez." + ITEM "Sot." + ITEM "Cat." + ITEM "Tessera" +END + +ENDPAGE + +ENDMASK + +PAGE "Soggetto " -1 -1 78 20 + +NUMBER F_S_CODICE 6 +BEGIN + PROMPT 2 1 "Codice " + FIELD LF_SOGGETTI->CODICE + FLAGS "RG" + USE LF_SOGGETTI KEY 1 + INPUT CODICE F_S_CODICE + DISPLAY "Codice@6" CODICE + DISPLAY "Cognome@25" COGNOME + DISPLAY "Nome@25" NOME + DISPLAY "Nato il@10" DATANASC + DISPLAY "Sez." CODSEZ + DISPLAY "Sot." CODSOT + DISPLAY "C." CATDON + DISPLAY "Tessera" TESSAVIS + OUTPUT F_S_CODICE CODICE + OUTPUT F_S_COGNOME COGNOME + OUTPUT F_S_NOME NOME + OUTPUT F_S_DATANASC DATANASC + OUTPUT F_S_CODSEZ CODSEZ + OUTPUT F_S_CODSOT CODSOT + OUTPUT F_S_CATDON CATDON + CHECKTYPE NORMAL + ADD RUN at0 -0 +END + +STRING F_S_COGNOME 25 +BEGIN + PROMPT 2 2 "Cognome e nome " + FIELD LF_SOGGETTI->COGNOME + USE LF_SOGGETTI KEY 2 + INPUT COGNOME F_S_COGNOME + INPUT NOME F_S_NOME + DISPLAY "Cognome@25" COGNOME + DISPLAY "Nome@25" NOME + DISPLAY "Nato il@10" DATANASC + DISPLAY "Codice@6" CODICE + DISPLAY "Sez." CODSEZ + DISPLAY "Sot." CODSOT + DISPLAY "C." CATDON + DISPLAY "Tessera" TESSAVIS + COPY OUTPUT F_S_CODICE + CHECKTYPE SEARCH + HELP "Cognome del soggetto" + ADD RUN at0 -0 +END + +STRING F_S_NOME 25 +BEGIN + PROMPT 46 2 "" + FIELD LF_SOGGETTI->NOME + COPY ALL F_S_COGNOME + COPY OUTPUT F_S_CODICE + //CHECKTYPE NORMAL + CHECKTYPE SEARCH + HELP "Nome del soggetto" + ADD RUN at0 -0 +END + +STRING F_S_TIPOCON 2 +BEGIN + PROMPT 2 5 "Tipo controllo " + FLAGS "U" + USE TCS SELECT S6=="N" + INPUT CODTAB F_S_TIPOCON + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_S_TIPOCON CODTAB + OUTPUT F_S_DESC_TIPOCON S0 + WARNING "Codice non presente" + HELP "Tipo/Esito controllo sanitario" +END + +DATE F_S_DATANASC +BEGIN + PROMPT 2 3 "Nato il " + FIELD LF_SOGGETTI->DATANASC + FLAGS "D" +END + +STRING F_S_CODSEZ 2 +BEGIN + PROMPT 2 7 "Sez. " + FIELD LF_SOGGETTI->CODSEZ + FLAGS "D" +END + +STRING F_S_DENSEZ 25 +BEGIN + PROMPT 13 7 "" + FLAGS "D" +END + +STRING F_S_CODSOT 2 +BEGIN + PROMPT 43 7 "Sot. " + FIELD LF_SOGGETTI->CODSOT + FLAGS "D" + USE LF_SEZIONI + INPUT CODSEZ F_S_CODSEZ + INPUT CODSOT F_S_CODSOT + OUTPUT F_S_DENSEZ DENSEZ + OUTPUT F_S_DENSOT DENSOT + CHECKTYPE NORMAL +END + +STRING F_S_DENSOT 25 +BEGIN + PROMPT 54 7 "" + FLAGS "D" +END + +STRING F_S_CATDON 2 +BEGIN + PROMPT 2 8 "Cat. " + FIELD LF_SOGGETTI->CATDON + FLAGS "D" + USE CTD + INPUT CODTAB F_S_CATDON + OUTPUT F_S_DESC_CATDON S0 + CHECKTYPE NORMAL +END + +STRING F_S_TESSERA 10 +BEGIN + PROMPT 43 8 "Tessera AVIS " + FIELD LF_SOGGETTI->TESSAVIS + FLAGS "D" +END + +STRING F_S_DESC_TIPOCON 25 +BEGIN + PROMPT 35 5 "" + FLAGS "D" +END + +STRING F_S_DESC_CATDON 22 +BEGIN + PROMPT 13 8 "" + FLAGS "D" +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -13 -1 "" +END + +BUTTON DLG_CANCEL 9 2 +BEGIN + PROMPT -23 -1 "" +END + +BUTTON DLG_DELREC 9 2 +BEGIN + PROMPT -33 -1 "" + MESSAGE EXIT, K_DEL +END + +ENDPAGE + +ENDMASK diff --git a/at/at2200.cpp b/at/at2200.cpp index 93b1342fb..7e2ca4416 100755 --- a/at/at2200.cpp +++ b/at/at2200.cpp @@ -1,356 +1,358 @@ -#include -#include -#include - -#include "lf.h" -#include "soggetti.h" -#include "sezioni.h" -#include - -#include "at2.h" -#include "at2200a.h" - -#define ALIAS_LCP 100 -#define ALIAS_TCS 200 - -enum ts { undefined = 0, elenco = 1, etichette = 2 }; - -// definizione form per etichette -class TEti_pereta_form : public TForm -{ -public: - - virtual TCursor* cursor() const; - virtual TRelation* relation() const; - TPrint_section& get_body() { return section('B'); } ; - TEti_pereta_form(): TForm() {}; - TEti_pereta_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") - : TForm(form,code,editlevel,desc) {}; - virtual ~TEti_pereta_form() {}; -}; - -class TPereta_application : public TPrintapp -{ - static bool filter_func_pereta(const TRelation *); - - TRelation* _rel; - TMask* _msk; - TEti_pereta_form* _form_eti; - - int _cur1, _cur2, _cur3, _cur4; - TParagraph_string _cognome_nome, _dencom; - - TDate _data_stampa; - TDate _dataini, _datafin; - ts _tipo_stampa; - TString _codsez, _codsot; - - -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 crea_intestazione(); - void filtra_sezioni(); - void header_sezione(TString codsez, TString codsot); - TMask& app_mask() { return *_msk; } - - TPereta_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} -}; - -HIDDEN inline TPereta_application& app() { return (TPereta_application&) main_app(); } - -TCursor* TEti_pereta_form::cursor() const { return app().current_cursor(); } - -TRelation* TEti_pereta_form::relation() const { return cursor()->relation(); } - -void TPereta_application::filtra_sezioni() -{ - TString sezini = _msk->get(F_SEZINI); - TString sotini = _msk->get(F_SOTINI); - TString sezfin = _msk->get(F_SEZFIN); - TString sotfin = _msk->get(F_SOTFIN); - select_cursor(_cur4); - TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); - TRectype da(fl.curr()); - TRectype a(fl.curr()); - da.zero(); - a.zero(); - if ((sezini.not_empty()) && (sezini.ok())) - da.put(SOG_CODSEZ, sezini); - if ((sotini.not_empty()) && (sotini.ok())) - da.put(SOG_CODSOT, sotini); - if ((sezfin.not_empty()) && (sezfin.ok())) - a.put(SOG_CODSEZ, sezfin); - if ((sotfin.not_empty()) && (sotfin.ok())) - a.put(SOG_CODSOT, sotfin); - current_cursor()->setregion(da, a); -} - -void TPereta_application::set_page(int file, int cnt) -{ - switch (_tipo_stampa) - { - case etichette: - { - TPrint_section& corpo = _form_eti->get_body(); - corpo.reset(); - corpo.update(); - for (int i = 0; i < corpo.height(); i++) - { - TPrintrow& riga = corpo.row(i); - set_row(i+1,riga); - } - force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage - // altrimenti stampa sempre la stessa etichetta - } - break; - case elenco: - { - set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######")); - set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); - set_row(1,"@10g#a", &_cognome_nome); - set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); - set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); - set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); - set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); - set_row(2,"@47g#a", &_dencom); - set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT)); - } - break; - } -} - -bool TPereta_application::filter_func_pereta(const TRelation * rel) -{ - bool filtrato = TRUE; - - TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); - - //filtro per categorie - - TMask& msk = app().app_mask(); - TString catpri = msk.get(F_CAT1); - TString catsec = msk.get(F_CAT2); - TString catter = msk.get(F_CAT3); - TString catqua = msk.get(F_CAT4); - TString catqui = msk.get(F_CAT5); - TString catses = msk.get(F_CAT6); - - TAssoc_array categorie; - if (catpri.not_empty() && catpri.ok()) - categorie.add((const char*) catpri); - if (catsec.not_empty() && catsec.ok()) - categorie.add((const char*) catsec); - if (catter.not_empty() && catter.ok()) - categorie.add((const char*) catter); - if (catqua.not_empty() && catqua.ok()) - categorie.add((const char*) catqua); - if (catqui.not_empty() && catqui.ok()) - categorie.add((const char*) catqui); - if (catses.not_empty() && catses.ok()) - categorie.add((const char*) catses); - - if (categorie.items() != 0) - { - TString cat = sog->curr().get(SOG_CATDON); - if (categorie.is_key((const char*) cat)) - filtrato = TRUE; - else - filtrato = FALSE; - } - if (filtrato) - { - // filtro per età - TRectype from (sog->curr()); - TRectype to (sog->curr()); - from.zero(); - to.zero(); - if (app()._dataini.ok()) - from.put(SOG_DATANASC, app()._dataini); - if (app()._datafin.ok()) - to.put(SOG_DATANASC, app()._datafin); - if ((sog->curr() >= from) && (sog->curr() <= to)) - filtrato = TRUE; - else - filtrato = FALSE; - } - return filtrato; -} - -bool TPereta_application::preprocess_page(int file, int counter) -{ - // contatore soggetti stampati - // per ora non c'è - if (_tipo_stampa == elenco) - { - TString nome = current_cursor()->curr().get(SOG_COGNOME); - nome << " "; - nome << current_cursor()->curr().get(SOG_NOME); - _cognome_nome = nome; - TString localita = ""; - localita << current_cursor()->curr(-ALIAS_LCP).get("S6"); - if (localita.not_empty() && localita.ok()) - { - localita << " "; - localita << current_cursor()->curr(-ALIAS_LCP).get("S0"); - localita << " - "; - } - else - { - localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM); - localita << " "; - } - localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM); - localita.trim(); - _dencom = localita; - - // salto pagina se cambio sezione - TString codsez = current_cursor()->curr().get(SOG_CODSEZ); - TString codsot = current_cursor()->curr().get(SOG_CODSOT); - if ((_codsez!=codsez)||(_codsot!=codsot)) - { - //if (!_codsez.blank()) - if (_codsez != "**") - printer().formfeed(); - _codsez = codsez; - _codsot = codsot; - header_sezione(codsez, codsot); - } - } - return TRUE; -} - -void TPereta_application::header_sezione(TString codsez, TString codsot) -{ - TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); - TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); - TString intestazione(132); - intestazione = "Sezione: "; - intestazione << codsez; - intestazione << "/"; - intestazione << codsot; - intestazione << " "; - intestazione << densez; - if ((densot.ok())&& (densot.not_empty())) - { - intestazione << "/"; - intestazione << densot; - } - intestazione.center_just(); - set_header(1,"@0g%s", (const char*) intestazione); - return; -} - -bool TPereta_application::set_print(int) -{ - _tipo_stampa = undefined; - KEY tasto; - tasto = _msk->run(); - switch (tasto) - { - case F_ELENCO: - _tipo_stampa = elenco; - //_codsez.spaces(2); - //_codsot.spaces(2); - _codsez = "**"; - _codsot = "**"; - break; - case F_ETICHETTE: - _tipo_stampa = etichette; - break; - } - if (_tipo_stampa != undefined) - { - reset_files(); - add_file(LF_SOGGETTI); - _dataini = _msk->get(F_DATAINI); - _datafin = _msk->get(F_DATAFIN); - filtra_sezioni(); - current_cursor()->set_filterfunction (filter_func_pereta); - reset_print(); - crea_intestazione(); - return TRUE; - } - else - return FALSE; -} - -void TPereta_application::crea_intestazione() -{ - reset_header(); - - if (_tipo_stampa == elenco) - { - TString sep(132); - sep = "ELENCO PER DATA DI NASCITA"; - TDate data = _msk->get(F_DATAINI); - if (data.ok()) - { - sep << " dal "; - sep << data.string(); - } - data = _msk->get(F_DATAFIN); - if (data.ok()) - { - sep << " al "; - sep << data.string(); - } - sep.center_just(); - set_header(2, "@0g%s", (const char*) sep); - TString 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.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro"); - set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro"); - set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------"); - } -} - -bool TPereta_application::user_create() -{ - _rel = new TRelation(LF_SOGGETTI); - _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); - _rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP); - _rel->add(LF_COMUNI, "COM==COM"); - // per stampare nell'intestazione la denominazione della sezione - _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); - - _cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice - _cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome - _cur3 = add_cursor(new TCursor(_rel, "", 3)); //cursore ordinamento per sezione+sottogruppo+codice - _cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome - - _form_eti = new TEti_pereta_form("AT_ETSOG"); - _msk = new TMask("at2200a"); - return TRUE; -} - -bool TPereta_application::user_destroy() -{ - delete _msk; - delete _rel; - delete _form_eti; - return TRUE; -} - -int at2200(int argc, char* argv[]) -{ - - TPereta_application a; - - a.run(argc, argv, "Elenco per data nascita"); - - return 0; -} +#include +#include +#include + +#include "lf.h" +#include "soggetti.h" +#include "sezioni.h" +#include + +#include "at2.h" +#include "at2200a.h" + +#define ALIAS_LCP 100 +#define ALIAS_TCS 200 + +enum ts { undefined = 0, elenco = 1, etichette = 2 }; + +// definizione form per etichette +class TEti_pereta_form : public TForm +{ +public: + + virtual TCursor* cursor() const; + virtual TRelation* relation() const; + TPrint_section& get_body() { return section('B'); } ; + TEti_pereta_form(): TForm() {}; + TEti_pereta_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") + : TForm(form,code,editlevel,desc) {}; + virtual ~TEti_pereta_form() {}; +}; + +class TPereta_application : public TPrintapp +{ + static bool filter_func_pereta(const TRelation *); + + TRelation* _rel; + TMask* _msk; + TEti_pereta_form* _form_eti; + + TAssoc_array* _categorie; + + int _cur1, _cur2, _cur3, _cur4; + TParagraph_string _cognome_nome, _dencom; + + TDate _data_stampa; + TDate _dataini, _datafin; + ts _tipo_stampa; + TString _codsez, _codsot; + + +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 set_one_cat(short field_id); + void set_categorie(); + TAssoc_array& get_categorie() { return *_categorie; } + void crea_intestazione(); + void filtra_sezioni(); + void header_sezione(const char* codsez, const char* codsot); + TMask& app_mask() { return *_msk; } + + TPereta_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} +}; + +HIDDEN inline TPereta_application& app() { return (TPereta_application&) main_app(); } + +TCursor* TEti_pereta_form::cursor() const { return app().current_cursor(); } + +TRelation* TEti_pereta_form::relation() const { return cursor()->relation(); } + +void TPereta_application::filtra_sezioni() +{ + const char* sezini = _msk->get(F_SEZINI); + const char* sotini = _msk->get(F_SOTINI); + const char* sezfin = _msk->get(F_SEZFIN); + const char* sotfin = _msk->get(F_SOTFIN); + select_cursor(_cur4); + TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); + TRectype da(fl.curr()); + TRectype a(fl.curr()); + da.zero(); + a.zero(); + //if ((sezini.not_empty()) && (sezini.ok())) + if (sezini != NULL) + da.put(SOG_CODSEZ, sezini); + //if ((sotini.not_empty()) && (sotini.ok())) + if (sotini != NULL) + da.put(SOG_CODSOT, sotini); + //if ((sezfin.not_empty()) && (sezfin.ok())) + if (sezfin != NULL) + a.put(SOG_CODSEZ, sezfin); + //if ((sotfin.not_empty()) && (sotfin.ok())) + if (sotfin != NULL) + a.put(SOG_CODSOT, sotfin); + current_cursor()->setregion(da, a); +} + +void TPereta_application::set_page(int file, int cnt) +{ + switch (_tipo_stampa) + { + case etichette: + { + TPrint_section& corpo = _form_eti->get_body(); + corpo.reset(); + corpo.update(); + for (int i = 0; i < corpo.height(); i++) + { + TPrintrow& riga = corpo.row(i); + set_row(i+1,riga); + } + force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage + // altrimenti stampa sempre la stessa etichetta + } + break; + case elenco: + { + set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######")); + set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); + set_row(1,"@10g#a", &_cognome_nome); + set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); + set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); + set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); + set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); + set_row(2,"@47g#a", &_dencom); + set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT)); + } + break; + } +} + +bool TPereta_application::filter_func_pereta(const TRelation * rel) +{ + bool filtrato = TRUE; + + TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); + + //filtro per categorie + TAssoc_array& categorie = TPereta_application::get_categorie(); + if (categorie.items() != 0) + { + const char* cat = sog->curr().get(SOG_CATDON); + if (categorie.is_key(cat)) + filtrato = TRUE; + else + filtrato = FALSE; + } + if (filtrato) + { + // filtro per età + TRectype from (sog->curr()); + TRectype to (sog->curr()); + from.zero(); + to.zero(); + if (app()._dataini.ok()) + from.put(SOG_DATANASC, app()._dataini); + if (app()._datafin.ok()) + to.put(SOG_DATANASC, app()._datafin); + if ((sog->curr() >= from) && (sog->curr() <= to)) + filtrato = TRUE; + else + filtrato = FALSE; + } + return filtrato; +} + +bool TPereta_application::preprocess_page(int file, int counter) +{ + // contatore soggetti stampati + // per ora non c'è + if (_tipo_stampa == elenco) + { + TString nome = current_cursor()->curr().get(SOG_COGNOME); + nome << " "; + nome << current_cursor()->curr().get(SOG_NOME); + _cognome_nome = nome; + TString localita = ""; + localita << current_cursor()->curr(-ALIAS_LCP).get("S6"); + if (localita.not_empty() && localita.ok()) + { + localita << " "; + localita << current_cursor()->curr(-ALIAS_LCP).get("S0"); + localita << " - "; + } + else + { + localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM); + localita << " "; + } + localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM); + localita.trim(); + _dencom = localita; + + // salto pagina se cambio sezione + TString codsez = current_cursor()->curr().get(SOG_CODSEZ); + TString codsot = current_cursor()->curr().get(SOG_CODSOT); + if ((_codsez!=codsez)||(_codsot!=codsot)) + { + if (_codsez != "**") + printer().formfeed(); + _codsez = codsez; + _codsot = codsot; + header_sezione(codsez, codsot); + } + } + return TRUE; +} + +void TPereta_application::header_sezione(TString codsez, TString codsot) +{ + const char* densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); + const char* densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); + TString intestazione(132); + intestazione = "Sezione: "; + intestazione << codsez; + intestazione << "/"; + intestazione << codsot; + intestazione << " "; + intestazione << densez; + if ((densot.ok())&& (densot.not_empty())) + { + intestazione << "/"; + intestazione << densot; + } + intestazione.center_just(); + set_header(1,"@0g%s", (const char*) intestazione); + return; +} + +bool TPereta_application::set_print(int) +{ + _tipo_stampa = undefined; + KEY tasto; + tasto = _msk->run(); + switch (tasto) + { + case F_ELENCO: + _tipo_stampa = elenco; + _codsez = "**"; + _codsot = "**"; + break; + case F_ETICHETTE: + _tipo_stampa = etichette; + break; + } + if (_tipo_stampa != undefined) + { + reset_files(); + add_file(LF_SOGGETTI); + _dataini = _msk->get(F_DATAINI); + _datafin = _msk->get(F_DATAFIN); + filtra_sezioni(); + set_categorie(); + current_cursor()->set_filterfunction (filter_func_pereta); + reset_print(); + crea_intestazione(); + return TRUE; + } + else + return FALSE; +} + +void TPereta_application::set_one_cat(short field_id) +{ + const char* cat = _msk->get(field_id); + if (cat != NULL) + _categorie->add(cat); +} + +void TPereta_application::set_categorie() +{ + set_one_cat(F_CAT1); + set_one_cat(F_CAT2); + set_one_cat(F_CAT3); + set_one_cat(F_CAT4); + set_one_cat(F_CAT5); + set_one_cat(F_CAT6); +} + +void TPereta_application::crea_intestazione() +{ + reset_header(); + + if (_tipo_stampa == elenco) + { + TString sep(132); + sep = "ELENCO PER DATA DI NASCITA"; + TDate data = _msk->get(F_DATAINI); + if (data.ok()) + { + sep << " dal "; + sep << data.string(); + } + data = _msk->get(F_DATAFIN); + if (data.ok()) + { + sep << " al "; + sep << data.string(); + } + sep.center_just(); + set_header(2, "@0g%s", (const char*) sep); + TString 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.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro"); + set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro"); + set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------"); + } +} + +bool TPereta_application::user_create() +{ + _rel = new TRelation(LF_SOGGETTI); + _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); + _rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP); + _rel->add(LF_COMUNI, "COM==COM"); + // per stampare nell'intestazione la denominazione della sezione + _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); + + _cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice + _cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome + _cur3 = add_cursor(new TCursor(_rel, "", 3)); //cursore ordinamento per sezione+sottogruppo+codice + _cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome + + _form_eti = new TEti_pereta_form("AT_ETSOG"); + _msk = new TMask("at2200a"); + return TRUE; +} + +bool TPereta_application::user_destroy() +{ + delete _msk; + delete _rel; + delete _form_eti; + return TRUE; +} + +int at2200(int argc, char* argv[]) +{ + + TPereta_application a; + + a.run(argc, argv, "Elenco per data nascita"); + + return 0; +} diff --git a/at/at5100.cpp b/at/at5100.cpp index 81fda2855..8a6376008 100755 --- a/at/at5100.cpp +++ b/at/at5100.cpp @@ -1,118 +1,155 @@ -// trasferimenti !!!! - -class TTransfer : public TObject -{ - TArray _cursors; - TCursor* _current_cursor; - - TArray _configs; - TConfig* _current_config; - - const char* _wmess; - bool _wbar; - bool _wcancel; - int _wthr; - - MENU_TAG _last_choice; - - virtual bool create(); - virtual bool destroy(); - -protected: - virtual bool user_create() pure; - virtual bool user_destroy() pure; - - void do_trasf(int n); - -public: - void select_cursor(int i); - TCursor* get_cursor(int i); - int add_cursor(TCursor* c); - TCursor* current_cursor() { return _current_cursor; } - - void select_config(int i); - TConfig* get_config(int i); - int add_config(TConfig* c); - TConfig* current_config() { return _current_config; } - - virtual bool menu(MENU_TAG m); - - void reset_files(); - void add_file(int file, int from = 0); - void add_file(const char* tab, int from = 0); - - - TTransfer(); - virtual ~TTransfer{}; - -}; - -TTransfer::TTransfer():TObject(),_cursors(10),_configs(10) -{ - _current_cursor = NULL; - _current_config = NULL; - _last_choice = BAR_ITEM (1); -} - -bool TTransfer::create() -{ - if (user_create()) - { - dispatch_e_menu (_last_choice); - return TRUE; - } - else return FALSE; -} - -bool TTransfer::destroy() -{ - user_destroy(); - //reset_files(); - _cursors.destroy(); - _configs.destroy() - return //TApplication::destroy(); -} - - -void TTransfer::select_cursor(int c) -{ - if (c == -1) _current_cursor = NULL; - else _current_cursor = (TCursor*) &_cursors[c]; -} - -TCursor* TTransfer::get_cursor(int c) -{ - if (c == -1) return NULL; - else return (TCursor*) &_cursors[c]; -} - -int TTransfer::add_cursor(TCursor* c) -{ - if (c == NULL) - return -1; - _cursors.add(c); - _current_cursor = c; - return _cursors.items() - 1; -} - -void TTransfer::select_config(int c) -{ - if (c == -1) _current_config = NULL; - else _current_config = (TConfig*) &_configs[c]; -} - -TConfig* TTransfer::get_config(int c) -{ - if (c == -1) return NULL; - else return (TConfig*) &_configs[c]; -} - -int TTransfer::add_config(TConfig* c) -{ - if (c == NULL) - return -1; - _configs.add(c); - _current_config = c; - return _configs.items() - 1; -} - +// trasferimenti + +#include +#include +#include +#include +#include + +#include "atfield.cpp" +#include "lf.h" + +// nomi delle variabili in .ini per i campi +#define FIELD "FIELD" +#define LEN "LEN" +#define DEC "DEC" +#define FLAGS "FLAGS" + +// nomi delle variabili in .ini per HEADER +#define HEADER "HEADER" +#define NOMEFILE "NOMEFILE" +#define LUNGHEZZA "LUNGHEZZA" +#define RECORDSEP "RECORDSEP" +#define FIELDSEP "FIELDSEP" + +class TTransfer_app : public TApplication +{ + TMask* _msk; + TRelation* _rel; + +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; } + virtual void scarica(); + +public: + TTransfer_app() {} + +}; + +HIDDEN inline TTransfer_app& app() { return (TTransfer_app&) main_app(); } + +bool TTransfer_app::create() +{ + _msk = new TMask("at5100a"); + _rel = new TRelation(LF_SOGGETTI); + + /* + _rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD); + _donaz = new TLocalisamfile(LF_DONAZ); + _contsan = new TLocalisamfile(LF_CONTSAN); + _sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON); + _scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON); + _asoggetti = new TAssoc_array(); + + _msk->set_handler(F_INS_CONTROLLI,ins_controlli_handler); + TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI); + ss.set_notify(soggetti_notify); + + //ss.sheet_mask().set_handler(F_S_CODICE,codice_handler); + ss.sheet_mask().set_handler(F_S_NOME,nome_handler); + */ + + dispatch_e_menu(BAR_ITEM(1)); + + return TRUE; +} + +bool TTransfer_app::destroy() +{ + delete _rel; + delete _msk; + /* + delete _donaz; + delete _contsan; + delete _sdonazioni; + delete _scontrolli; + delete _asoggetti; + */ + return TRUE; +} + +bool TTransfer_app::menu(MENU_TAG m) +{ + TMask& msk = get_mask(); + const TDate oggi(TODAY); + KEY tasto; + do + { + tasto = msk.run(); + switch (tasto) + { + case K_ESC: // annulla + msk.reset(); + break; + case K_ENTER: // registra + { + TTransfer_app::scarica(); + msk.reset(); + } + break; + } + } + while (tasto != K_QUIT); + return FALSE; +} + +void TTransfer_app::scarica() +{ + + TArray arr_exprs; // array delle TExpr corrispondenti ai campi da scaricare + TArray arr_fields; // array dei TField_text (campi indicati in .ini) + + TConfig ini("esporta.ini"); + TString_array campi; + int i = ini.list_paragraphs(campi); + int poshead = campi.find("HEADER"); + campi.remove(poshead,TRUE); + for ( int k = 0; k < campi.items(); k++ ) + { + const char* campo = campi.row(k); + TString_array vl; + int i = ini.list_variables(vl, TRUE, campo); + //for ( int j = 0; j < vl.items(); j++ ) + int pos = vl.find(FIELD); + TExpr* espressione = vl.row(pos).get(1); + arr_exprs.add(espressione) + TToken_string variabile = vl.row(pos); + int pos = vl.find(LEN); + TToken_string variabile = vl.row(pos); + int pos = vl.find(DEC); + TToken_string variabile = vl.row(pos); + + + + } + + /* + TText_field campo() + + arr_fields.add(); + */ + } + +} + + +int at5100(int argc, char* argv[]) +{ + TTransfer_app a; + a.run(argc, argv, "Scarico dati"); + return 0; +} diff --git a/at/at5100a.h b/at/at5100a.h index e752868d1..7ff53b9b7 100755 --- a/at/at5100a.h +++ b/at/at5100a.h @@ -1,12 +1,13 @@ -// scarico dati per sezione comunale -// 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_DATA 109 +// scarico dati per sezione comunale +// 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_DATAINI 109 +#define F_DATAFIN 110 diff --git a/at/at5100a.uml b/at/at5100a.uml index eb66e3257..acd4ecd0e 100755 --- a/at/at5100a.uml +++ b/at/at5100a.uml @@ -1,138 +1,150 @@ -#include "at4100a.h" -#include "lf.h" -PAGE "Scarico dati" -1 -1 78 20 - -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 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 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 - -DATE F_DATA -BEGIN - PROMPT 2 5 "Data scarico " - CHECKTYPE REQUIRED - HELP "Data scarico" -END - -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -12 14 "" -END - -BUTTON DLG_QUIT 9 2 -BEGIN - PROMPT -22 14 "" -END - -ENDPAGE -ENDMASK +#include "at5100a.h" +#include "lf.h" +PAGE "Scarico dati" -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 3 +BEGIN + PROMPT 1 5 "Intervallo date ultimo aggiornamento" +END + +DATE F_DATAINI +BEGIN + PROMPT 2 6 "Data ultimo aggiornamento dal " + HELP "Data di ultimo aggiornamento iniziale" +END + +DATE F_DATAFIN +BEGIN + PROMPT 46 6 "al " + HELP "Data di ultimo aggiornamento finale" +END + + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 9 "" +END + +BUTTON DLG_QUIT 9 2 +BEGIN + PROMPT -22 9 "" +END + +ENDPAGE +ENDMASK