modifiche cristina al 4/9/1996

git-svn-id: svn://10.65.10.50/trunk@3512 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1996-09-04 14:26:11 +00:00
parent 1942d8fcb4
commit ca0ec635c3
8 changed files with 1179 additions and 938 deletions

160
at/at0100a.h Executable file
View File

@ -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

View File

@ -1,7 +1,14 @@
#include "at0100.h" #include "at0100a.h"
#include "lf.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 <toolbar.h> #include <toolbar.h>
ENDPAGE ENDPAGE
@ -926,7 +933,7 @@ BEGIN
DISPLAY "Nome@25" NOME DISPLAY "Nome@25" NOME
DISPLAY "Codice" CODMED DISPLAY "Codice" CODMED
COPY OUTPUT F_CODMED COPY OUTPUT F_CODMED
CHECKTYPE NORMAL CHECKTYPE SEARCH
HELP "Medico di base" HELP "Medico di base"
WARNING "Medico assente" WARNING "Medico assente"
ADD MASK at0800a ADD MASK at0800a
@ -937,7 +944,7 @@ BEGIN
PROMPT 48 9 "" PROMPT 48 9 ""
USE LF_MEDICI KEY 2 USE LF_MEDICI KEY 2
INPUT COGNOME F_COGNMED INPUT COGNOME F_COGNMED
INPUT NOME F_NOMNMED INPUT NOME F_NOMMED
DISPLAY "Cognome@25" COGNOME DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME DISPLAY "Nome@25" NOME
DISPLAY "Codice" CODMED DISPLAY "Codice" CODMED
@ -1466,7 +1473,7 @@ BEGIN
DISPLAY "Descrizione@30" S0 DISPLAY "Descrizione@30" S0
OUTPUT F_C_PROSSTIPO CODTAB OUTPUT F_C_PROSSTIPO CODTAB
OUTPUT F_C_DESC_PROSSTIPO S0 OUTPUT F_C_DESC_PROSSTIPO S0
CHECKTYPE REQUIRED CHECKTYPE NORMAL
WARNING "Codice non presente" WARNING "Codice non presente"
HELP "Tipo/Esito controllo sanitario" HELP "Tipo/Esito controllo sanitario"
END END

View File

@ -44,14 +44,14 @@ protected:
virtual TMask& get_mask() { return *_msk; } virtual TMask& get_mask() { return *_msk; }
virtual TRelation* get_relation() const { return _rel; } virtual TRelation* get_relation() const { return _rel; }
virtual TAssoc_array& get_array_sogg() { return *_asoggetti; } TAssoc_array& get_array_sogg() { return *_asoggetti; }
virtual int write(TSheet_field& s); int write(TSheet_field& s);
static bool check_sog_sheet(const char* codsog); bool check_sog_sheet(const char* codsog);
//static bool codice_handler(TMask_field& f, KEY k);
static bool nome_handler(TMask_field& f, KEY k); 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 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); static bool ins_controlli_handler(TMask_field& f, KEY k);
public: 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) void TDonaz_app::add_rows_soggetti(TSheet_field& s, int count, int start)
{ {
if (start == 1) if (start == 0)
s.destroy(); s.destroy();
for (int r=start; r<=start+count; r++) for (int r=start; r<=start+count-1; r++)
TToken_string& row = s.row(r-1); TToken_string& row = s.row(r);
} }
bool TDonaz_app::create() bool TDonaz_app::create()
@ -97,8 +97,8 @@ bool TDonaz_app::create()
TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI); TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
ss.set_notify(soggetti_notify); 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_NOME,nome_handler);
ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
dispatch_e_menu(BAR_ITEM(1)); dispatch_e_menu(BAR_ITEM(1));
@ -125,14 +125,19 @@ bool TDonaz_app::menu(MENU_TAG m)
do do
{ {
TSheet_field& s = (TSheet_field&)msk.field(F_SOGGETTI); TSheet_field& s = (TSheet_field&)msk.field(F_SOGGETTI);
add_rows_soggetti(s,12); s.destroy();
add_rows_soggetti(s);
_asoggetti->destroy(); _asoggetti->destroy();
msk.set(F_DATADON,oggi); msk.set(F_DATADON,oggi);
tasto = msk.run(); tasto = msk.run();
switch (tasto) switch (tasto)
{ {
case K_ESC: // annulla case K_ESC: // annulla
{
if (yesno_box("Registrare le modifiche?"))
TDonaz_app::write(s);
msk.reset(); msk.reset();
}
break; break;
case K_SAVE: // registra case K_SAVE: // registra
{ {
@ -146,6 +151,12 @@ bool TDonaz_app::menu(MENU_TAG m)
msk.reset(); msk.reset();
} }
break; break;
case K_QUIT: // fine
{
if (yesno_box("Registrare le modifiche?"))
TDonaz_app::write(s);
}
break;
} }
} }
while (tasto != K_QUIT); 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(); TAssoc_array& array_sogg = app().get_array_sogg();
if (array_sogg.is_key(codsog)) if (array_sogg.is_key(codsog))
array_sogg.remove(codsog); array_sogg.remove(codsog);
} }
if ((r == s.items()-1) && (r == s.first_empty())) 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); s.select(r);
} }
} }
break; break;
case K_CTRL+K_TAB: case K_CTRL+K_TAB:
// uscita riga // 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())) 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); s.select(r);
} }
} }
@ -489,33 +477,36 @@ bool TDonaz_app::soggetti_notify(TSheet_field& s, int r, KEY k)
return ok; return ok;
} }
/*
bool TDonaz_app::codice_handler(TMask_field& f, KEY k) bool TDonaz_app::codice_handler(TMask_field& f, KEY k)
{ {
bool ok = TRUE; bool ok = TRUE;
if (k == K_TAB && f.focusdirty() && f.get().not_empty()) if (k == K_TAB && f.focusdirty())
{ {
const TMask& m = f.mask(); const char* codice = f.get();
const char* codsog = m.get(F_S_CODICE); if (codice != NULL)
ok = check_sog_sheet(codsog); // controllo che il sog. non sia già inserito {
if (!ok) ok = app().check_sog_sheet(codice);
f.error_box("Soggetto già inserito"); if (!ok)
} return f.error_box("Soggetto già inserito");
return ok; //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 TDonaz_app::nome_handler(TMask_field& f, KEY k)
{ {
bool ok = TRUE; bool ok = TRUE;
if (k == K_TAB && f.focusdirty()) if (k == K_TAB && f.focusdirty())
{ {
TMask& m = f.mask(); TMask& m = f.mask();
long codsog = m.get_long(F_S_CODICE); long codsog = m.get_long(F_S_CODICE);
if (codsog == 0) 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; return ok;
} }

View File

@ -1,258 +1,289 @@
#include "at0200a.h" #include "at0200a.h"
#include "lf.h" #include "lf.h"
TOOLBAR "" 0 20 0 2 TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE BUTTON DLG_SAVEREC 10 2
BEGIN
PAGE "Giornaliero donazioni/controlli" -1 -1 78 20 PROMPT -14 -11 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
GROUPBOX DLG_NULL 77 6 PICTURE BMP_SAVERECDN
BEGIN END
PROMPT 1 0 "Dati fissi"
FLAGS "R" BUTTON DLG_NEWREC 10 2
END BEGIN
PROMPT -24 -11 "~Nuovo"
DATE F_DATADON MESSAGE EXIT,K_INS
BEGIN PICTURE BMP_NEWREC
PROMPT 2 1 "Data donazione " PICTURE BMP_NEWRECDN
//VALIDATE NOT_EMPTY_FUNC END
CHECKTYPE REQUIRED
HELP "Data donazione" BUTTON DLG_CANCEL 10 2
END BEGIN
PROMPT -34 -11 "~Annulla"
STRING F_TIPODON 2 MESSAGE EXIT,K_ESC
BEGIN PICTURE 102
PROMPT 2 2 "Tipo donazione " END
FLAGS "U"
USE TDN BUTTON DLG_QUIT 10 2
INPUT CODTAB F_TIPODON BEGIN
DISPLAY "Codice" CODTAB PROMPT -44 -11 "~Fine"
DISPLAY "Descrizione@30" S0 MESSAGE EXIT,K_QUIT
OUTPUT F_TIPODON CODTAB PICTURE BMP_QUIT
OUTPUT F_DESC_TIPODON S0 PICTURE BMP_QUITDN
//VALIDATE NOT_EMPTY_FUNC END
CHECKTYPE REQUIRED
WARNING "Codice non presente" ENDPAGE
HELP "Tipo donazione"
END PAGE "Giornaliero donazioni/controlli" -1 -1 78 20
STRING F_LUOGODON 4
BEGIN GROUPBOX DLG_NULL 77 6
PROMPT 2 3 "Luogo donazione " BEGIN
FLAGS "U" PROMPT 1 0 "Dati fissi"
USE LDN FLAGS "R"
INPUT CODTAB F_LUOGODON END
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0 DATE F_DATADON
OUTPUT F_LUOGODON CODTAB BEGIN
OUTPUT F_DESC_LUOGODON S0 PROMPT 2 1 "Data donazione "
CHECKTYPE NORMAL //VALIDATE NOT_EMPTY_FUNC
WARNING "Codice non presente" CHECKTYPE REQUIRED
HELP "Luogo donazione" HELP "Data donazione"
END END
STRING F_DESC_TIPODON 25 STRING F_TIPODON 2
BEGIN BEGIN
PROMPT 30 2 "" PROMPT 2 2 "Tipo donazione "
FLAGS "D" FLAGS "U"
END USE TDN
INPUT CODTAB F_TIPODON
STRING F_DESC_LUOGODON 25 DISPLAY "Codice" CODTAB
BEGIN DISPLAY "Descrizione@30" S0
PROMPT 30 3 "" OUTPUT F_TIPODON CODTAB
FLAGS "D" OUTPUT F_DESC_TIPODON S0
END //VALIDATE NOT_EMPTY_FUNC
CHECKTYPE REQUIRED
BOOLEAN F_INS_CONTROLLI WARNING "Codice non presente"
BEGIN HELP "Tipo donazione"
PROMPT 2 4 "Inserimento controlli" END
END
STRING F_LUOGODON 4
GROUPBOX DLG_NULL 77 13 BEGIN
BEGIN PROMPT 2 3 "Luogo donazione "
PROMPT 1 6 "Soggetti" FLAGS "U"
END USE LDN
INPUT CODTAB F_LUOGODON
SPREADSHEET F_SOGGETTI 75 11 DISPLAY "Codice" CODTAB
BEGIN DISPLAY "Descrizione@30" S0
PROMPT 2 7 "" OUTPUT F_LUOGODON CODTAB
ITEM "Codice@6" OUTPUT F_DESC_LUOGODON S0
ITEM "Cognome@25" CHECKTYPE NORMAL
ITEM "Nome@25" WARNING "Codice non presente"
ITEM "Con." HELP "Luogo donazione"
ITEM "Nato il@10" END
ITEM "Sez."
ITEM "Sot." STRING F_DESC_TIPODON 25
ITEM "Cat." BEGIN
ITEM "Tessera" PROMPT 30 2 ""
END FLAGS "D"
END
ENDPAGE
STRING F_DESC_LUOGODON 25
ENDMASK BEGIN
PROMPT 30 3 ""
PAGE "Soggetto " -1 -1 78 20 FLAGS "D"
END
NUMBER F_S_CODICE 6
BEGIN BOOLEAN F_INS_CONTROLLI
PROMPT 2 1 "Codice " BEGIN
FIELD LF_SOGGETTI->CODICE PROMPT 2 4 "Inserimento controlli"
FLAGS "RG" END
USE LF_SOGGETTI KEY 1
INPUT CODICE F_S_CODICE GROUPBOX DLG_NULL 77 13
DISPLAY "Codice@6" CODICE BEGIN
DISPLAY "Cognome@25" COGNOME PROMPT 1 6 "Soggetti"
DISPLAY "Nome@25" NOME END
DISPLAY "Nato il@10" DATANASC
DISPLAY "Sez." CODSEZ SPREADSHEET F_SOGGETTI 75 11
DISPLAY "Sot." CODSOT BEGIN
DISPLAY "C." CATDON PROMPT 2 7 ""
DISPLAY "Tessera" TESSAVIS ITEM "Codice@6"
OUTPUT F_S_CODICE CODICE ITEM "Cognome@25"
OUTPUT F_S_COGNOME COGNOME ITEM "Nome@25"
OUTPUT F_S_NOME NOME ITEM "Con."
OUTPUT F_S_DATANASC DATANASC ITEM "Nato il@10"
OUTPUT F_S_CODSEZ CODSEZ ITEM "Sez."
OUTPUT F_S_CODSOT CODSOT ITEM "Sot."
OUTPUT F_S_CATDON CATDON ITEM "Cat."
CHECKTYPE NORMAL ITEM "Tessera"
ADD RUN at0 -0 END
END
ENDPAGE
STRING F_S_COGNOME 25
BEGIN ENDMASK
PROMPT 2 2 "Cognome e nome "
FIELD LF_SOGGETTI->COGNOME PAGE "Soggetto " -1 -1 78 20
USE LF_SOGGETTI KEY 2
INPUT COGNOME F_S_COGNOME NUMBER F_S_CODICE 6
INPUT NOME F_S_NOME BEGIN
DISPLAY "Cognome@25" COGNOME PROMPT 2 1 "Codice "
DISPLAY "Nome@25" NOME FIELD LF_SOGGETTI->CODICE
DISPLAY "Nato il@10" DATANASC FLAGS "RG"
DISPLAY "Codice@6" CODICE USE LF_SOGGETTI KEY 1
DISPLAY "Sez." CODSEZ INPUT CODICE F_S_CODICE
DISPLAY "Sot." CODSOT DISPLAY "Codice@6" CODICE
DISPLAY "C." CATDON DISPLAY "Cognome@25" COGNOME
DISPLAY "Tessera" TESSAVIS DISPLAY "Nome@25" NOME
COPY OUTPUT F_S_CODICE DISPLAY "Nato il@10" DATANASC
CHECKTYPE SEARCH DISPLAY "Sez." CODSEZ
HELP "Cognome del soggetto" DISPLAY "Sot." CODSOT
ADD RUN at0 -0 DISPLAY "C." CATDON
END DISPLAY "Tessera" TESSAVIS
OUTPUT F_S_CODICE CODICE
STRING F_S_NOME 25 OUTPUT F_S_COGNOME COGNOME
BEGIN OUTPUT F_S_NOME NOME
PROMPT 46 2 "" OUTPUT F_S_DATANASC DATANASC
FIELD LF_SOGGETTI->NOME OUTPUT F_S_CODSEZ CODSEZ
COPY ALL F_S_COGNOME OUTPUT F_S_CODSOT CODSOT
COPY OUTPUT F_S_CODICE OUTPUT F_S_CATDON CATDON
//CHECKTYPE NORMAL CHECKTYPE NORMAL
CHECKTYPE SEARCH ADD RUN at0 -0
HELP "Nome del soggetto" END
ADD RUN at0 -0
END STRING F_S_COGNOME 25
BEGIN
STRING F_S_TIPOCON 2 PROMPT 2 2 "Cognome e nome "
BEGIN FIELD LF_SOGGETTI->COGNOME
PROMPT 2 5 "Tipo controllo " USE LF_SOGGETTI KEY 2
FLAGS "U" INPUT COGNOME F_S_COGNOME
USE TCS SELECT S6=="N" INPUT NOME F_S_NOME
INPUT CODTAB F_S_TIPOCON DISPLAY "Cognome@25" COGNOME
DISPLAY "Codice" CODTAB DISPLAY "Nome@25" NOME
DISPLAY "Descrizione@30" S0 DISPLAY "Nato il@10" DATANASC
OUTPUT F_S_TIPOCON CODTAB DISPLAY "Codice@6" CODICE
OUTPUT F_S_DESC_TIPOCON S0 DISPLAY "Sez." CODSEZ
WARNING "Codice non presente" DISPLAY "Sot." CODSOT
HELP "Tipo/Esito controllo sanitario" DISPLAY "C." CATDON
END DISPLAY "Tessera" TESSAVIS
COPY OUTPUT F_S_CODICE
DATE F_S_DATANASC CHECKTYPE SEARCH
BEGIN HELP "Cognome del soggetto"
PROMPT 2 3 "Nato il " ADD RUN at0 -0
FIELD LF_SOGGETTI->DATANASC END
FLAGS "D"
END STRING F_S_NOME 25
BEGIN
STRING F_S_CODSEZ 2 PROMPT 46 2 ""
BEGIN FIELD LF_SOGGETTI->NOME
PROMPT 2 7 "Sez. " COPY ALL F_S_COGNOME
FIELD LF_SOGGETTI->CODSEZ COPY OUTPUT F_S_CODICE
FLAGS "D" //CHECKTYPE NORMAL
END CHECKTYPE SEARCH
HELP "Nome del soggetto"
STRING F_S_DENSEZ 25 ADD RUN at0 -0
BEGIN END
PROMPT 13 7 ""
FLAGS "D" STRING F_S_TIPOCON 2
END BEGIN
PROMPT 2 5 "Tipo controllo "
STRING F_S_CODSOT 2 FLAGS "U"
BEGIN USE TCS SELECT S6=="N"
PROMPT 43 7 "Sot. " INPUT CODTAB F_S_TIPOCON
FIELD LF_SOGGETTI->CODSOT DISPLAY "Codice" CODTAB
FLAGS "D" DISPLAY "Descrizione@30" S0
USE LF_SEZIONI OUTPUT F_S_TIPOCON CODTAB
INPUT CODSEZ F_S_CODSEZ OUTPUT F_S_DESC_TIPOCON S0
INPUT CODSOT F_S_CODSOT WARNING "Codice non presente"
OUTPUT F_S_DENSEZ DENSEZ HELP "Tipo/Esito controllo sanitario"
OUTPUT F_S_DENSOT DENSOT END
CHECKTYPE NORMAL
END DATE F_S_DATANASC
BEGIN
STRING F_S_DENSOT 25 PROMPT 2 3 "Nato il "
BEGIN FIELD LF_SOGGETTI->DATANASC
PROMPT 54 7 "" FLAGS "D"
FLAGS "D" END
END
STRING F_S_CODSEZ 2
STRING F_S_CATDON 2 BEGIN
BEGIN PROMPT 2 7 "Sez. "
PROMPT 2 8 "Cat. " FIELD LF_SOGGETTI->CODSEZ
FIELD LF_SOGGETTI->CATDON FLAGS "D"
FLAGS "D" END
USE CTD
INPUT CODTAB F_S_CATDON STRING F_S_DENSEZ 25
OUTPUT F_S_DESC_CATDON S0 BEGIN
CHECKTYPE NORMAL PROMPT 13 7 ""
END FLAGS "D"
END
STRING F_S_TESSERA 10
BEGIN STRING F_S_CODSOT 2
PROMPT 43 8 "Tessera AVIS " BEGIN
FIELD LF_SOGGETTI->TESSAVIS PROMPT 43 7 "Sot. "
FLAGS "D" FIELD LF_SOGGETTI->CODSOT
END FLAGS "D"
USE LF_SEZIONI
STRING F_S_DESC_TIPOCON 25 INPUT CODSEZ F_S_CODSEZ
BEGIN INPUT CODSOT F_S_CODSOT
PROMPT 35 5 "" OUTPUT F_S_DENSEZ DENSEZ
FLAGS "D" OUTPUT F_S_DENSOT DENSOT
END CHECKTYPE NORMAL
END
STRING F_S_DESC_CATDON 22
BEGIN STRING F_S_DENSOT 25
PROMPT 13 8 "" BEGIN
FLAGS "D" PROMPT 54 7 ""
END FLAGS "D"
END
BUTTON DLG_OK 9 2
BEGIN STRING F_S_CATDON 2
PROMPT -13 -1 "" BEGIN
END PROMPT 2 8 "Cat. "
FIELD LF_SOGGETTI->CATDON
BUTTON DLG_CANCEL 9 2 FLAGS "D"
BEGIN USE CTD
PROMPT -23 -1 "" INPUT CODTAB F_S_CATDON
END OUTPUT F_S_DESC_CATDON S0
CHECKTYPE NORMAL
BUTTON DLG_DELREC 9 2 END
BEGIN
PROMPT -33 -1 "" STRING F_S_TESSERA 10
MESSAGE EXIT, K_DEL BEGIN
END PROMPT 43 8 "Tessera AVIS "
FIELD LF_SOGGETTI->TESSAVIS
ENDPAGE FLAGS "D"
END
ENDMASK
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

View File

@ -1,356 +1,358 @@
#include <mask.h> #include <mask.h>
#include <form.h> #include <form.h>
#include <printapp.h> #include <printapp.h>
#include "lf.h" #include "lf.h"
#include "soggetti.h" #include "soggetti.h"
#include "sezioni.h" #include "sezioni.h"
#include <comuni.h> #include <comuni.h>
#include "at2.h" #include "at2.h"
#include "at2200a.h" #include "at2200a.h"
#define ALIAS_LCP 100 #define ALIAS_LCP 100
#define ALIAS_TCS 200 #define ALIAS_TCS 200
enum ts { undefined = 0, elenco = 1, etichette = 2 }; enum ts { undefined = 0, elenco = 1, etichette = 2 };
// definizione form per etichette // definizione form per etichette
class TEti_pereta_form : public TForm class TEti_pereta_form : public TForm
{ {
public: public:
virtual TCursor* cursor() const; virtual TCursor* cursor() const;
virtual TRelation* relation() const; virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ; TPrint_section& get_body() { return section('B'); } ;
TEti_pereta_form(): TForm() {}; TEti_pereta_form(): TForm() {};
TEti_pereta_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") TEti_pereta_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {}; : TForm(form,code,editlevel,desc) {};
virtual ~TEti_pereta_form() {}; virtual ~TEti_pereta_form() {};
}; };
class TPereta_application : public TPrintapp class TPereta_application : public TPrintapp
{ {
static bool filter_func_pereta(const TRelation *); static bool filter_func_pereta(const TRelation *);
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TEti_pereta_form* _form_eti; TEti_pereta_form* _form_eti;
int _cur1, _cur2, _cur3, _cur4; TAssoc_array* _categorie;
TParagraph_string _cognome_nome, _dencom;
int _cur1, _cur2, _cur3, _cur4;
TDate _data_stampa; TParagraph_string _cognome_nome, _dencom;
TDate _dataini, _datafin;
ts _tipo_stampa; TDate _data_stampa;
TString _codsez, _codsot; TDate _dataini, _datafin;
ts _tipo_stampa;
TString _codsez, _codsot;
protected:
virtual bool user_create();
virtual bool user_destroy(); protected:
virtual bool set_print(int m); virtual bool user_create();
virtual void set_page(int file, int cnt); virtual bool user_destroy();
virtual bool preprocess_page (int file, int counter); virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
public: virtual bool preprocess_page (int file, int counter);
void crea_intestazione();
void filtra_sezioni(); public:
void header_sezione(TString codsez, TString codsot); void set_one_cat(short field_id);
TMask& app_mask() { return *_msk; } void set_categorie();
TAssoc_array& get_categorie() { return *_categorie; }
TPereta_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} void crea_intestazione();
}; void filtra_sezioni();
void header_sezione(const char* codsez, const char* codsot);
HIDDEN inline TPereta_application& app() { return (TPereta_application&) main_app(); } TMask& app_mask() { return *_msk; }
TCursor* TEti_pereta_form::cursor() const { return app().current_cursor(); } TPereta_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
};
TRelation* TEti_pereta_form::relation() const { return cursor()->relation(); }
HIDDEN inline TPereta_application& app() { return (TPereta_application&) main_app(); }
void TPereta_application::filtra_sezioni()
{ TCursor* TEti_pereta_form::cursor() const { return app().current_cursor(); }
TString sezini = _msk->get(F_SEZINI);
TString sotini = _msk->get(F_SOTINI); TRelation* TEti_pereta_form::relation() const { return cursor()->relation(); }
TString sezfin = _msk->get(F_SEZFIN);
TString sotfin = _msk->get(F_SOTFIN); void TPereta_application::filtra_sezioni()
select_cursor(_cur4); {
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); const char* sezini = _msk->get(F_SEZINI);
TRectype da(fl.curr()); const char* sotini = _msk->get(F_SOTINI);
TRectype a(fl.curr()); const char* sezfin = _msk->get(F_SEZFIN);
da.zero(); const char* sotfin = _msk->get(F_SOTFIN);
a.zero(); select_cursor(_cur4);
if ((sezini.not_empty()) && (sezini.ok())) TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
da.put(SOG_CODSEZ, sezini); TRectype da(fl.curr());
if ((sotini.not_empty()) && (sotini.ok())) TRectype a(fl.curr());
da.put(SOG_CODSOT, sotini); da.zero();
if ((sezfin.not_empty()) && (sezfin.ok())) a.zero();
a.put(SOG_CODSEZ, sezfin); //if ((sezini.not_empty()) && (sezini.ok()))
if ((sotfin.not_empty()) && (sotfin.ok())) if (sezini != NULL)
a.put(SOG_CODSOT, sotfin); da.put(SOG_CODSEZ, sezini);
current_cursor()->setregion(da, a); //if ((sotini.not_empty()) && (sotini.ok()))
} if (sotini != NULL)
da.put(SOG_CODSOT, sotini);
void TPereta_application::set_page(int file, int cnt) //if ((sezfin.not_empty()) && (sezfin.ok()))
{ if (sezfin != NULL)
switch (_tipo_stampa) a.put(SOG_CODSEZ, sezfin);
{ //if ((sotfin.not_empty()) && (sotfin.ok()))
case etichette: if (sotfin != NULL)
{ a.put(SOG_CODSOT, sotfin);
TPrint_section& corpo = _form_eti->get_body(); current_cursor()->setregion(da, a);
corpo.reset(); }
corpo.update();
for (int i = 0; i < corpo.height(); i++) void TPereta_application::set_page(int file, int cnt)
{ {
TPrintrow& riga = corpo.row(i); switch (_tipo_stampa)
set_row(i+1,riga); {
} case etichette:
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage {
// altrimenti stampa sempre la stessa etichetta TPrint_section& corpo = _form_eti->get_body();
} corpo.reset();
break; corpo.update();
case elenco: for (int i = 0; i < corpo.height(); i++)
{ {
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######")); TPrintrow& riga = corpo.row(i);
set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(i+1,riga);
set_row(1,"@10g#a", &_cognome_nome); }
set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); // altrimenti stampa sempre la stessa etichetta
set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); }
set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); break;
set_row(2,"@47g#a", &_dencom); case elenco:
set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT)); {
} set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######"));
break; 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));
bool TPereta_application::filter_func_pereta(const TRelation * rel) set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI));
{ set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
bool filtrato = TRUE; set_row(2,"@47g#a", &_dencom);
set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT));
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); }
break;
//filtro per categorie }
}
TMask& msk = app().app_mask();
TString catpri = msk.get(F_CAT1); bool TPereta_application::filter_func_pereta(const TRelation * rel)
TString catsec = msk.get(F_CAT2); {
TString catter = msk.get(F_CAT3); bool filtrato = TRUE;
TString catqua = msk.get(F_CAT4);
TString catqui = msk.get(F_CAT5); TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI));
TString catses = msk.get(F_CAT6);
//filtro per categorie
TAssoc_array categorie; TAssoc_array& categorie = TPereta_application::get_categorie();
if (catpri.not_empty() && catpri.ok()) if (categorie.items() != 0)
categorie.add((const char*) catpri); {
if (catsec.not_empty() && catsec.ok()) const char* cat = sog->curr().get(SOG_CATDON);
categorie.add((const char*) catsec); if (categorie.is_key(cat))
if (catter.not_empty() && catter.ok()) filtrato = TRUE;
categorie.add((const char*) catter); else
if (catqua.not_empty() && catqua.ok()) filtrato = FALSE;
categorie.add((const char*) catqua); }
if (catqui.not_empty() && catqui.ok()) if (filtrato)
categorie.add((const char*) catqui); {
if (catses.not_empty() && catses.ok()) // filtro per età
categorie.add((const char*) catses); TRectype from (sog->curr());
TRectype to (sog->curr());
if (categorie.items() != 0) from.zero();
{ to.zero();
TString cat = sog->curr().get(SOG_CATDON); if (app()._dataini.ok())
if (categorie.is_key((const char*) cat)) from.put(SOG_DATANASC, app()._dataini);
filtrato = TRUE; if (app()._datafin.ok())
else to.put(SOG_DATANASC, app()._datafin);
filtrato = FALSE; if ((sog->curr() >= from) && (sog->curr() <= to))
} filtrato = TRUE;
if (filtrato) else
{ filtrato = FALSE;
// filtro per età }
TRectype from (sog->curr()); return filtrato;
TRectype to (sog->curr()); }
from.zero();
to.zero(); bool TPereta_application::preprocess_page(int file, int counter)
if (app()._dataini.ok()) {
from.put(SOG_DATANASC, app()._dataini); // contatore soggetti stampati
if (app()._datafin.ok()) // per ora non c'è
to.put(SOG_DATANASC, app()._datafin); if (_tipo_stampa == elenco)
if ((sog->curr() >= from) && (sog->curr() <= to)) {
filtrato = TRUE; TString nome = current_cursor()->curr().get(SOG_COGNOME);
else nome << " ";
filtrato = FALSE; nome << current_cursor()->curr().get(SOG_NOME);
} _cognome_nome = nome;
return filtrato; TString localita = "";
} localita << current_cursor()->curr(-ALIAS_LCP).get("S6");
if (localita.not_empty() && localita.ok())
bool TPereta_application::preprocess_page(int file, int counter) {
{ localita << " ";
// contatore soggetti stampati localita << current_cursor()->curr(-ALIAS_LCP).get("S0");
// per ora non c'è localita << " - ";
if (_tipo_stampa == elenco) }
{ else
TString nome = current_cursor()->curr().get(SOG_COGNOME); {
nome << " "; localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM);
nome << current_cursor()->curr().get(SOG_NOME); localita << " ";
_cognome_nome = nome; }
TString localita = ""; localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
localita << current_cursor()->curr(-ALIAS_LCP).get("S6"); localita.trim();
if (localita.not_empty() && localita.ok()) _dencom = localita;
{
localita << " "; // salto pagina se cambio sezione
localita << current_cursor()->curr(-ALIAS_LCP).get("S0"); TString codsez = current_cursor()->curr().get(SOG_CODSEZ);
localita << " - "; TString codsot = current_cursor()->curr().get(SOG_CODSOT);
} if ((_codsez!=codsez)||(_codsot!=codsot))
else {
{ if (_codsez != "**")
localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM); printer().formfeed();
localita << " "; _codsez = codsez;
} _codsot = codsot;
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM); header_sezione(codsez, codsot);
localita.trim(); }
_dencom = localita; }
return TRUE;
// salto pagina se cambio sezione }
TString codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); void TPereta_application::header_sezione(TString codsez, TString codsot)
if ((_codsez!=codsez)||(_codsot!=codsot)) {
{ const char* densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
//if (!_codsez.blank()) const char* densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
if (_codsez != "**") TString intestazione(132);
printer().formfeed(); intestazione = "Sezione: ";
_codsez = codsez; intestazione << codsez;
_codsot = codsot; intestazione << "/";
header_sezione(codsez, codsot); intestazione << codsot;
} intestazione << " ";
} intestazione << densez;
return TRUE; if ((densot.ok())&& (densot.not_empty()))
} {
intestazione << "/";
void TPereta_application::header_sezione(TString codsez, TString codsot) intestazione << densot;
{ }
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); intestazione.center_just();
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); set_header(1,"@0g%s", (const char*) intestazione);
TString intestazione(132); return;
intestazione = "Sezione: "; }
intestazione << codsez;
intestazione << "/"; bool TPereta_application::set_print(int)
intestazione << codsot; {
intestazione << " "; _tipo_stampa = undefined;
intestazione << densez; KEY tasto;
if ((densot.ok())&& (densot.not_empty())) tasto = _msk->run();
{ switch (tasto)
intestazione << "/"; {
intestazione << densot; case F_ELENCO:
} _tipo_stampa = elenco;
intestazione.center_just(); _codsez = "**";
set_header(1,"@0g%s", (const char*) intestazione); _codsot = "**";
return; break;
} case F_ETICHETTE:
_tipo_stampa = etichette;
bool TPereta_application::set_print(int) break;
{ }
_tipo_stampa = undefined; if (_tipo_stampa != undefined)
KEY tasto; {
tasto = _msk->run(); reset_files();
switch (tasto) add_file(LF_SOGGETTI);
{ _dataini = _msk->get(F_DATAINI);
case F_ELENCO: _datafin = _msk->get(F_DATAFIN);
_tipo_stampa = elenco; filtra_sezioni();
//_codsez.spaces(2); set_categorie();
//_codsot.spaces(2); current_cursor()->set_filterfunction (filter_func_pereta);
_codsez = "**"; reset_print();
_codsot = "**"; crea_intestazione();
break; return TRUE;
case F_ETICHETTE: }
_tipo_stampa = etichette; else
break; return FALSE;
} }
if (_tipo_stampa != undefined)
{ void TPereta_application::set_one_cat(short field_id)
reset_files(); {
add_file(LF_SOGGETTI); const char* cat = _msk->get(field_id);
_dataini = _msk->get(F_DATAINI); if (cat != NULL)
_datafin = _msk->get(F_DATAFIN); _categorie->add(cat);
filtra_sezioni(); }
current_cursor()->set_filterfunction (filter_func_pereta);
reset_print(); void TPereta_application::set_categorie()
crea_intestazione(); {
return TRUE; set_one_cat(F_CAT1);
} set_one_cat(F_CAT2);
else set_one_cat(F_CAT3);
return FALSE; set_one_cat(F_CAT4);
} set_one_cat(F_CAT5);
set_one_cat(F_CAT6);
void TPereta_application::crea_intestazione() }
{
reset_header(); void TPereta_application::crea_intestazione()
{
if (_tipo_stampa == elenco) reset_header();
{
TString sep(132); if (_tipo_stampa == elenco)
sep = "ELENCO PER DATA DI NASCITA"; {
TDate data = _msk->get(F_DATAINI); TString sep(132);
if (data.ok()) sep = "ELENCO PER DATA DI NASCITA";
{ TDate data = _msk->get(F_DATAINI);
sep << " dal "; if (data.ok())
sep << data.string(); {
} sep << " dal ";
data = _msk->get(F_DATAFIN); sep << data.string();
if (data.ok()) }
{ data = _msk->get(F_DATAFIN);
sep << " al "; if (data.ok())
sep << data.string(); {
} sep << " al ";
sep.center_just(); sep << data.string();
set_header(2, "@0g%s", (const char*) sep); }
TString data_stampa = _data_stampa.string(); sep.center_just();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2, "@0g%s", (const char*) sep);
sep = ""; TString data_stampa = _data_stampa.string();
sep << "Pag. @#"; set_header(2,"@0g%10s", (const char*) data_stampa);
set_header(2, "@120g%s", (const char*) sep); sep = "";
sep << "Pag. @#";
sep = ""; set_header(2, "@120g%s", (const char*) sep);
sep.fill('-');
set_header(3, (const char *) sep); sep = "";
sep.fill('-');
set_header(4,"@0gCod.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro"); set_header(3, (const char *) sep);
set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro");
set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------"); 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); bool TPereta_application::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); {
_rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP); _rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_COMUNI, "COM==COM"); _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
// per stampare nell'intestazione la denominazione della sezione _rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); _rel->add(LF_COMUNI, "COM==COM");
// per stampare nell'intestazione la denominazione della sezione
_cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_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 _cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice
_cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome _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
_form_eti = new TEti_pereta_form("AT_ETSOG"); _cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome
_msk = new TMask("at2200a");
return TRUE; _form_eti = new TEti_pereta_form("AT_ETSOG");
} _msk = new TMask("at2200a");
return TRUE;
bool TPereta_application::user_destroy() }
{
delete _msk; bool TPereta_application::user_destroy()
delete _rel; {
delete _form_eti; delete _msk;
return TRUE; delete _rel;
} delete _form_eti;
return TRUE;
int at2200(int argc, char* argv[]) }
{
int at2200(int argc, char* argv[])
TPereta_application a; {
a.run(argc, argv, "Elenco per data nascita"); TPereta_application a;
return 0; a.run(argc, argv, "Elenco per data nascita");
}
return 0;
}

View File

@ -1,118 +1,155 @@
// trasferimenti !!!! // trasferimenti
class TTransfer : public TObject #include <applicat.h>
{ #include <config.h>
TArray _cursors; #include <mask.h>
TCursor* _current_cursor; #include <relation.h>
#include <urldefid.h>
TArray _configs;
TConfig* _current_config; #include "atfield.cpp"
#include "lf.h"
const char* _wmess;
bool _wbar; // nomi delle variabili in .ini per i campi
bool _wcancel; #define FIELD "FIELD"
int _wthr; #define LEN "LEN"
#define DEC "DEC"
MENU_TAG _last_choice; #define FLAGS "FLAGS"
virtual bool create(); // nomi delle variabili in .ini per HEADER
virtual bool destroy(); #define HEADER "HEADER"
#define NOMEFILE "NOMEFILE"
protected: #define LUNGHEZZA "LUNGHEZZA"
virtual bool user_create() pure; #define RECORDSEP "RECORDSEP"
virtual bool user_destroy() pure; #define FIELDSEP "FIELDSEP"
void do_trasf(int n); class TTransfer_app : public TApplication
{
public: TMask* _msk;
void select_cursor(int i); TRelation* _rel;
TCursor* get_cursor(int i);
int add_cursor(TCursor* c); protected:
TCursor* current_cursor() { return _current_cursor; } virtual bool create();
virtual bool destroy();
void select_config(int i); virtual bool menu(MENU_TAG m) ;
TConfig* get_config(int i); virtual TMask& get_mask() { return *_msk; }
int add_config(TConfig* c); virtual TRelation* get_relation() const { return _rel; }
TConfig* current_config() { return _current_config; } virtual void scarica();
virtual bool menu(MENU_TAG m); public:
TTransfer_app() {}
void reset_files();
void add_file(int file, int from = 0); };
void add_file(const char* tab, int from = 0);
HIDDEN inline TTransfer_app& app() { return (TTransfer_app&) main_app(); }
TTransfer(); bool TTransfer_app::create()
virtual ~TTransfer{}; {
_msk = new TMask("at5100a");
}; _rel = new TRelation(LF_SOGGETTI);
TTransfer::TTransfer():TObject(),_cursors(10),_configs(10) /*
{ _rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_current_cursor = NULL; _donaz = new TLocalisamfile(LF_DONAZ);
_current_config = NULL; _contsan = new TLocalisamfile(LF_CONTSAN);
_last_choice = BAR_ITEM (1); _sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
} _scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
_asoggetti = new TAssoc_array();
bool TTransfer::create()
{ _msk->set_handler(F_INS_CONTROLLI,ins_controlli_handler);
if (user_create()) TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
{ ss.set_notify(soggetti_notify);
dispatch_e_menu (_last_choice);
return TRUE; //ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
} ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
else return FALSE; */
}
dispatch_e_menu(BAR_ITEM(1));
bool TTransfer::destroy()
{ return TRUE;
user_destroy(); }
//reset_files();
_cursors.destroy(); bool TTransfer_app::destroy()
_configs.destroy() {
return //TApplication::destroy(); delete _rel;
} delete _msk;
/*
delete _donaz;
void TTransfer::select_cursor(int c) delete _contsan;
{ delete _sdonazioni;
if (c == -1) _current_cursor = NULL; delete _scontrolli;
else _current_cursor = (TCursor*) &_cursors[c]; delete _asoggetti;
} */
return TRUE;
TCursor* TTransfer::get_cursor(int c) }
{
if (c == -1) return NULL; bool TTransfer_app::menu(MENU_TAG m)
else return (TCursor*) &_cursors[c]; {
} TMask& msk = get_mask();
const TDate oggi(TODAY);
int TTransfer::add_cursor(TCursor* c) KEY tasto;
{ do
if (c == NULL) {
return -1; tasto = msk.run();
_cursors.add(c); switch (tasto)
_current_cursor = c; {
return _cursors.items() - 1; case K_ESC: // annulla
} msk.reset();
break;
void TTransfer::select_config(int c) case K_ENTER: // registra
{ {
if (c == -1) _current_config = NULL; TTransfer_app::scarica();
else _current_config = (TConfig*) &_configs[c]; msk.reset();
} }
break;
TConfig* TTransfer::get_config(int c) }
{ }
if (c == -1) return NULL; while (tasto != K_QUIT);
else return (TConfig*) &_configs[c]; return FALSE;
} }
int TTransfer::add_config(TConfig* c) void TTransfer_app::scarica()
{ {
if (c == NULL)
return -1; TArray arr_exprs; // array delle TExpr corrispondenti ai campi da scaricare
_configs.add(c); TArray arr_fields; // array dei TField_text (campi indicati in .ini)
_current_config = c;
return _configs.items() - 1; 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;
}

View File

@ -1,12 +1,13 @@
// scarico dati per sezione comunale // scarico dati per sezione comunale
// definizione campi per maschera di selezione // definizione campi per maschera di selezione
#define F_SEZINI 101 #define F_SEZINI 101
#define F_D_SEZINI 102 #define F_D_SEZINI 102
#define F_SOTINI 103 #define F_SOTINI 103
#define F_D_SOTINI 104 #define F_D_SOTINI 104
#define F_SEZFIN 105 #define F_SEZFIN 105
#define F_D_SEZFIN 106 #define F_D_SEZFIN 106
#define F_SOTFIN 107 #define F_SOTFIN 107
#define F_D_SOTFIN 108 #define F_D_SOTFIN 108
#define F_DATA 109 #define F_DATAINI 109
#define F_DATAFIN 110

View File

@ -1,138 +1,150 @@
#include "at4100a.h" #include "at5100a.h"
#include "lf.h" #include "lf.h"
PAGE "Scarico dati" -1 -1 78 20 PAGE "Scarico dati" -1 -1 78 11
GROUPBOX DLG_NULL 77 4 GROUPBOX DLG_NULL 77 4
BEGIN BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi" PROMPT 1 1 "Scelta sezioni/sottogruppi"
END END
STRING F_SEZINI 2 STRING F_SEZINI 2
BEGIN BEGIN
PROMPT 2 2 "Da " PROMPT 2 2 "Da "
FLAGS "U" FLAGS "U"
USE LF_SEZIONI USE LF_SEZIONI
INPUT CODSEZ F_SEZINI INPUT CODSEZ F_SEZINI
INPUT CODSOT F_SOTINI INPUT CODSOT F_SOTINI
DISPLAY "Cod.sez" CODSEZ DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZINI CODSEZ OUTPUT F_SEZINI CODSEZ
OUTPUT F_D_SEZINI DENSEZ OUTPUT F_D_SEZINI DENSEZ
OUTPUT F_SOTINI CODSOT OUTPUT F_SOTINI CODSOT
OUTPUT F_D_SOTINI DENSOT OUTPUT F_D_SOTINI DENSOT
CHECKTYPE SEARCH CHECKTYPE SEARCH
HELP "Codice sezione da cui partire" HELP "Codice sezione da cui partire"
END END
STRING F_D_SEZINI 25 STRING F_D_SEZINI 25
BEGIN BEGIN
PROMPT 11 2 "" PROMPT 11 2 ""
FLAGS "U" FLAGS "U"
USE LF_SEZIONI 2 USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI INPUT DENSEZ F_D_SEZINI
DISPLAY "Sezione@25" DENSEZ DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZINI COPY OUTPUT F_SEZINI
CHECKTYPE NORMAL CHECKTYPE NORMAL
HELP "Sezione da cui partire" HELP "Sezione da cui partire"
END END
STRING F_SOTINI 2 STRING F_SOTINI 2
BEGIN BEGIN
PROMPT 2 3 " " PROMPT 2 3 " "
COPY ALL F_SEZINI COPY ALL F_SEZINI
CHECKTYPE SEARCH CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire" HELP "Codice sottogruppo da cui partire"
END END
STRING F_D_SOTINI 25 STRING F_D_SOTINI 25
BEGIN BEGIN
PROMPT 11 3 "" PROMPT 11 3 ""
FLAGS "U" FLAGS "U"
COPY USE F_D_SEZINI COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI INPUT DENSEZ F_D_SEZINI
INPUT DENSOT F_D_SOTINI INPUT DENSOT F_D_SOTINI
COPY DISPLAY F_D_SEZINI COPY DISPLAY F_D_SEZINI
COPY OUTPUT F_D_SEZINI COPY OUTPUT F_D_SEZINI
CHECKTYPE NORMAL CHECKTYPE NORMAL
HELP "Sottogruppo da cui partire" HELP "Sottogruppo da cui partire"
END END
STRING F_SEZFIN 2 STRING F_SEZFIN 2
BEGIN BEGIN
PROMPT 41 2 "A " PROMPT 41 2 "A "
FLAGS "U" FLAGS "U"
USE LF_SEZIONI USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN INPUT CODSEZ F_SEZFIN
INPUT CODSOT F_SOTFIN INPUT CODSOT F_SOTFIN
DISPLAY "Cod.sez" CODSEZ DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZFIN CODSEZ OUTPUT F_SEZFIN CODSEZ
OUTPUT F_D_SEZFIN DENSEZ OUTPUT F_D_SEZFIN DENSEZ
OUTPUT F_SOTFIN CODSOT OUTPUT F_SOTFIN CODSOT
OUTPUT F_D_SOTFIN DENSOT OUTPUT F_D_SOTFIN DENSOT
CHECKTYPE SEARCH CHECKTYPE SEARCH
HELP "Codice sezione finale" HELP "Codice sezione finale"
END END
STRING F_D_SEZFIN 25 STRING F_D_SEZFIN 25
BEGIN BEGIN
PROMPT 49 2 "" PROMPT 49 2 ""
FLAGS "U" FLAGS "U"
USE LF_SEZIONI 2 USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN INPUT DENSEZ F_D_SEZFIN
DISPLAY "Sezione@25" DENSEZ DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZFIN COPY OUTPUT F_SEZFIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
HELP "Sezione finale" HELP "Sezione finale"
END END
STRING F_SOTFIN 2 STRING F_SOTFIN 2
BEGIN BEGIN
PROMPT 41 3 " " PROMPT 41 3 " "
COPY ALL F_SEZFIN COPY ALL F_SEZFIN
CHECKTYPE SEARCH CHECKTYPE SEARCH
HELP "Codice sottogruppo finale" HELP "Codice sottogruppo finale"
END END
STRING F_D_SOTFIN 25 STRING F_D_SOTFIN 25
BEGIN BEGIN
PROMPT 49 3 "" PROMPT 49 3 ""
FLAGS "U" FLAGS "U"
COPY USE F_D_SEZFIN COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN INPUT DENSEZ F_D_SEZFIN
INPUT DENSOT F_D_SOTFIN INPUT DENSOT F_D_SOTFIN
COPY DISPLAY F_D_SEZFIN COPY DISPLAY F_D_SEZFIN
COPY OUTPUT F_D_SEZFIN COPY OUTPUT F_D_SEZFIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
HELP "Sottogruppo finale" HELP "Sottogruppo finale"
END END
DATE F_DATA
BEGIN GROUPBOX DLG_NULL 77 3
PROMPT 2 5 "Data scarico " BEGIN
CHECKTYPE REQUIRED PROMPT 1 5 "Intervallo date ultimo aggiornamento"
HELP "Data scarico" END
END
DATE F_DATAINI
BUTTON DLG_OK 9 2 BEGIN
BEGIN PROMPT 2 6 "Data ultimo aggiornamento dal "
PROMPT -12 14 "" HELP "Data di ultimo aggiornamento iniziale"
END END
BUTTON DLG_QUIT 9 2 DATE F_DATAFIN
BEGIN BEGIN
PROMPT -22 14 "" PROMPT 46 6 "al "
END HELP "Data di ultimo aggiornamento finale"
END
ENDPAGE
ENDMASK
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 9 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 9 ""
END
ENDPAGE
ENDMASK