Adeguamento alla versione definitiva dei progetti

git-svn-id: svn://10.65.10.50/trunk@5702 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1997-12-05 16:26:15 +00:00
parent cb8d41dcd1
commit 17948962eb
114 changed files with 9976 additions and 3736 deletions

View File

@ -4,14 +4,12 @@
#include "at0.h"
#define usage "Error - usage : %s -{0|1|2|3|4}"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8}"
int main(int argc,char** argv)
{
int rt = -1 ;
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
switch (r)
{
case 0:
@ -24,6 +22,14 @@ int main(int argc,char** argv)
rt = at0400(argc,argv) ; break;
case 4:
rt = at0500(argc,argv) ; break;
case 5:
rt = at0600(argc,argv) ; break;
case 6:
rt = at0700(argc,argv) ; break;
case 7:
rt = at0800(argc,argv) ; break;
case 8:
rt = at0900(argc,argv) ; break;
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -6,6 +6,10 @@ int at0200(int argc, char* argv[]);
int at0300(int argc, char* argv[]);
int at0400(int argc, char* argv[]);
int at0500(int argc, char* argv[]);
int at0600(int argc, char* argv[]);
int at0700(int argc, char* argv[]);
int at0800(int argc, char* argv[]);
int at0900(int argc, char* argv[]);
#endif // __AT0_H

View File

@ -9,29 +9,43 @@
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
/* at0 -1 giornaliero donazioni/controlli */
/* at0 -1 giornaliero donazioni */
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"
/* at0 -2 giornaliero controlli */
MENUBAR MENU_BAR(2)
MENU MENU_BAR(2)
SUBMENU MENU_FILE "~File"
/* at0 -3 gestione convocazione su punto di raccolta*/
/* at0 -3 convocazione su punto di raccolta */
MENUBAR MENU_BAR(3)
MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File"
/* at0 -4 spostamento convocazioni su punto di raccolta */
MENUBAR MENU_BAR(4)
MENU MENU_BAR(4)
SUBMENU MENU_FILE "~File"
/* at0 -5 chiusura periodica */
MENUBAR MENU_BAR(5)
MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File"
/* at0 -6 sblocco sospesi */
MENUBAR MENU_BAR(6)
MENU MENU_BAR(6)
SUBMENU MENU_FILE "~File"
/* at0 -7 sblocco esclusi */
MENUBAR MENU_BAR(7)
MENU MENU_BAR(7)
SUBMENU MENU_FILE "~File"
/* at0 -8 modifica intervalli di donazione */
MENUBAR MENU_BAR(8)
MENU MENU_BAR(8)
SUBMENU MENU_FILE "~File"

View File

@ -1,4 +1,4 @@
// definizione campi della maschera at0100a.msk
// definizione campi della maschera at0100z.msk
// SOGGETTI e dati collegati
// pagina 1
@ -57,30 +57,32 @@
#define F_NOMMED 213
#define F_NOTIZIARIO 214
#define F_BENEM 215
#define F_GRUPPOAB0 216
#define F_RHANTID 217
#define F_KELL 218
#define F_FENOTIPORH 219
#define F_DU 220
#define F_ANTICORPI 221
#define F_CMV 222
#define F_MODCONV 223
#define F_PUNTORACC 224
#define F_DESC_PUNTORACC 225
#define F_GPD_LUN 226
#define F_GPD_MAR 227
#define F_GPD_MER 228
#define F_GPD_GIO 229
#define F_GPD_VEN 230
#define F_GPD_SAB 231
#define F_GPD_DOM 232
#define F_GPC_LUN 233
#define F_GPC_MAR 234
#define F_GPC_MER 235
#define F_GPC_GIO 236
#define F_GPC_VEN 237
#define F_GPC_SAB 238
#define F_GPC_DOM 239
#define F_CONSENSO 216
#define F_T_STAMPATA 217
#define F_GRUPPOAB0 218
#define F_RHANTID 219
#define F_KELL 220
#define F_FENOTIPORH 221
#define F_DU 222
#define F_ANTICORPI 223
#define F_CMV 224
#define F_MODCONV 225
#define F_PUNTORACC 226
#define F_DESC_PUNTORACC 227
#define F_GPD_LUN 228
#define F_GPD_MAR 229
#define F_GPD_MER 230
#define F_GPD_GIO 231
#define F_GPD_VEN 232
#define F_GPD_SAB 233
#define F_GPD_DOM 234
#define F_GPC_LUN 235
#define F_GPC_MAR 236
#define F_GPC_MER 237
#define F_GPC_GIO 238
#define F_GPC_VEN 239
#define F_GPC_SAB 240
#define F_GPC_DOM 241
// pagina 3
@ -115,6 +117,13 @@
#define F_DATACONV 329
#define F_NUMCONV 330
#define F_STATOSI 331
#define F_DATASI 332
#define F_FINESOSSI 333
#define F_STATOAF 334
#define F_DATAAF 335
#define F_FINESOSAF 336
// pagina 4
#define F_CONDOCC 401
#define F_POSPROF 402
@ -129,9 +138,8 @@
#define F_MOTESCL 411
#define F_UTENULTAGG 412
#define F_DATAULTAGG 413
#define F_T_STAMPATA 414
#define F_FAMIGLIA 415
#define F_NOTE 416
#define F_FAMIGLIA 414
#define F_NOTE 415
// pagina 5
#define F_DONAZIONI 501
@ -143,6 +151,7 @@
// pagina 6
#define F_CONTROLLI 601
#define F_IDONEITA 602
// pagina 7
#define F_BENEMERENZE 701
@ -187,6 +196,16 @@
#define F_C_DESC_PROSSTIPO 156
#define F_C_DESC_MOTIVO 157
// pagina idoneita'
#define F_I_DATAIDO 101
#define F_I_TIPOIDO 102
#define F_I_IDO_SOS 103
#define F_I_INTERVALLO 104
#define F_I_FINESOS 105
#define F_I_MOTIVO 106
#define F_I_RESPONSAB 107
#define F_I_DESC_MOTIVO 151
// pagina benemerenze
#define F_B_TIPOBEN 101
#define F_B_DESC_TIPOBEN 102

View File

@ -128,7 +128,7 @@ BEGIN
OUTPUT F_DENSOT DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Codice sezione assente"
END
@ -145,7 +145,7 @@ BEGIN
COPY OUTPUT F_CODSEZ
CHECKTYPE NORMAL
HELP "Denominazione sezione di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Denominazione assente"
END
@ -158,7 +158,7 @@ BEGIN
COPY ALL F_CODSEZ
CHECKTYPE NORMAL
HELP "Codice sottogruppo di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Codice sottogruppo assente"
END
@ -173,7 +173,7 @@ BEGIN
COPY OUTPUT F_DENSEZ
CHECKTYPE NORMAL
HELP "Sottogruppo di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Denominazione sottogruppo assente"
END
@ -460,7 +460,7 @@ BEGIN
PROMPT 38 18 "Doc. di identita' "
FIELDS DOCID
FLAGS "U"
HELP "Documento di identit: tipo e numero"
HELP "Documento di identita': tipo e numero"
END
STRING F_TELABI 14
@ -481,7 +481,7 @@ STRING F_TELALT 14
BEGIN
PROMPT 56 19 "Altro "
FIELD TELALT
HELP "Altro numero telefonico per reperibilit"
HELP "Altro numero telefonico per reperibilita'"
END
ENDPAGE
@ -560,6 +560,19 @@ BEGIN
GROUP 12
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 57 3 "Tessera"
@ -679,7 +692,7 @@ END
STRING F_TITINDIR 10
BEGIN
PROMPT 59 8 "Titolo "
FIELDS TESSSSN
FIELDS TITINDIR
HELP "Eventuale titolo da stampare prima del nome sull'indirizzo"
END
@ -699,7 +712,7 @@ BEGIN
CHECKTYPE NORMAL
HELP "Codice medico di base"
WARNING "Codice medico assente"
ADD MASK at0800a
ADD MASK batbmed
END
STRING F_COGNMED 25 23
@ -714,7 +727,7 @@ BEGIN
CHECKTYPE SEARCH
HELP "Medico di base"
WARNING "Medico assente"
ADD MASK at0800a
ADD MASK batbmed
END
STRING F_NOMMED 25 22
@ -730,7 +743,7 @@ BEGIN
CHECKTYPE NORMAL
HELP "Medico di base"
WARNING "Medico assente"
ADD MASK at0800a
ADD MASK batbmed
END
BOOLEAN F_NOTIZIARIO
@ -745,6 +758,19 @@ BEGIN
FIELD BENEM
END
BOOLEAN F_CONSENSO
BEGIN
PROMPT 32 10 "Consenso"
FIELD CONSENSO
END
BOOLEAN F_T_STAMPATA
BEGIN
PROMPT 47 10 "Tessera stampata "
FIELD T_STAMPATA
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 12 "Dati gruppo-ematici"
@ -1021,6 +1047,19 @@ BEGIN
GROUP 12
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 57 3 "Tessera"
@ -1062,14 +1101,14 @@ END
STRING DLG_NULL 4
BEGIN
PROMPT 54 6 "Kell "
PROMPT 55 6 "Kell "
FLAGS "D"
GROUP 9
END
STRING DLG_NULL 4
BEGIN
PROMPT 67 6 "Du "
PROMPT 69 6 "Du "
FLAGS "D"
GROUP 10
END
@ -1078,7 +1117,8 @@ STRING F_STATO 2
BEGIN
PROMPT 2 7 "Stato attuale "
FIELD STATO
FLAGS "D"
FLAGS "DG"
MESSAGE COPY,17@
USE TCS
INPUT CODTAB F_STATO
OUTPUT F_DESCSTATO S3
@ -1127,83 +1167,125 @@ BEGIN
PROMPT 2 9 "Tipi di idon. "
FIELD IDON1
FLAGS "D"
USE IDO
INPUT CODTAB F_IDON1
OUTPUT F_DESC_ID1 S0
CHECKTYPE NORMAL
// USE IDO
// INPUT CODTAB F_IDON1
// OUTPUT F_DESC_ID1 S0
// CHECKTYPE NORMAL
END
STRING F_DESC_ID1 25
BEGIN
PROMPT 20 9 ""
FLAGS "D"
END
//STRING F_DESC_ID1 25
//BEGIN
// PROMPT 20 9 ""
// FLAGS "D"
//END
STRING F_IDON2 2
BEGIN
PROMPT 47 9 ""
PROMPT 20 9 ""
FIELD IDON2
FLAGS "D"
USE IDO
INPUT CODTAB F_IDON2
OUTPUT F_DESC_ID2 S0
CHECKTYPE NORMAL
// USE IDO
// INPUT CODTAB F_IDON2
// OUTPUT F_DESC_ID2 S0
// CHECKTYPE NORMAL
END
STRING F_DESC_ID2 25
BEGIN
PROMPT 51 9 ""
FLAGS "D"
END
//STRING F_DESC_ID2 25
//BEGIN
// PROMPT 51 9 ""
// FLAGS "D"
//END
STRING F_IDON3 2
BEGIN
PROMPT 2 10 " "
PROMPT 24 9 ""
FIELD IDON3
FLAGS "D"
USE IDO
INPUT CODTAB F_IDON3
OUTPUT F_DESC_ID3 S0
CHECKTYPE NORMAL
// USE IDO
// INPUT CODTAB F_IDON3
// OUTPUT F_DESC_ID3 S0
// CHECKTYPE NORMAL
END
STRING F_DESC_ID3 25
BEGIN
PROMPT 20 10 ""
FLAGS "D"
END
//STRING F_DESC_ID3 25
//BEGIN
// PROMPT 20 10 ""
// FLAGS "D"
//END
STRING F_IDON4 2
BEGIN
PROMPT 47 10 ""
PROMPT 28 9 ""
FIELD IDON4
FLAGS "D"
USE IDO
INPUT CODTAB F_IDON4
OUTPUT F_DESC_ID4 S0
CHECKTYPE NORMAL
// USE IDO
// INPUT CODTAB F_IDON4
// OUTPUT F_DESC_ID4 S0
// CHECKTYPE NORMAL
END
STRING F_DESC_ID4 25
//STRING F_DESC_ID4 25
//BEGIN
// PROMPT 51 10 ""
// FLAGS "D"
//END
STRING F_TIPOULTID 2
BEGIN
PROMPT 51 10 ""
PROMPT 38 9 "Ult. idon.: Tipo "
FIELD TIPOULTID
FLAGS "D"
END
DATE F_DATAULTID
BEGIN
PROMPT 2 11 "Data ult. id. "
PROMPT 61 9 "Data "
FIELD DATAULTID
FLAGS "D"
END
STRING F_TIPOULTID 2
STRING F_STATOSI 2
BEGIN
PROMPT 30 11 "Tipo "
FIELD TIPOULTID
PROMPT 2 10 "Stato attuale : Sangue intero "
FIELD STATOSI
FLAGS "D"
END
DATE F_DATASI
BEGIN
PROMPT 36 10 ""
FIELD DATASI
FLAGS "D"
END
DATE F_FINESOSSI
BEGIN
PROMPT 2 11 "Fine sosp. : Sangue intero "
FIELD FINESOSSI
FLAGS "D"
END
STRING F_STATOAF 2
BEGIN
PROMPT 48 10 "Aferesi "
FIELD STATOAF
FLAGS "D"
END
DATE F_DATAAF
BEGIN
PROMPT 60 10 ""
FIELD DATAAF
FLAGS "D"
END
DATE F_FINESOSAF
BEGIN
PROMPT 48 11 "Aferesi "
FIELD FINESOSAF
FLAGS "D"
END
GROUPBOX DLG_NULL 77 8
BEGIN
PROMPT 1 13 "Situazione donazioni"
@ -1234,7 +1316,7 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_DESC_ULTDON 25
STRING F_DESC_ULTDON 30 25
BEGIN
PROMPT 48 14 ""
FLAGS "D"
@ -1386,6 +1468,32 @@ BEGIN
GROUP 12
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 57 3 "Tessera"
@ -1552,15 +1660,9 @@ BEGIN
FLAGS "D"
END
BOOLEAN F_T_STAMPATA
BEGIN
PROMPT 44 14 "Tessera stampata "
FIELD T_STAMPATA
END
BUTTON F_FAMIGLIA 10 1
BEGIN
PROMPT 65 14 "Famiglia"
PROMPT 44 14 "Famiglia"
END
MEMO F_NOTE 77 4
@ -1645,6 +1747,19 @@ BEGIN
GROUP 12
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 57 3 "Tessera"
@ -1781,6 +1896,19 @@ BEGIN
GROUP 12
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 57 3 "Tessera"
@ -1794,9 +1922,14 @@ BEGIN
GROUP 5
END
SPREADSHEET F_CONTROLLI
TEXT DLG_NULL
BEGIN
PROMPT 1 5 "Controlli sanitari"
PROMPT 1 5 "Idoneita'/Sospensioni/Controlli sanitari sul soggetto"
END
SPREADSHEET F_CONTROLLI -1 6
BEGIN
PROMPT 1 6 "Controlli sanitari sul soggetto"
ITEM "Data@10F"
ITEM "Tipo@F"
ITEM "Id.1"
@ -1808,7 +1941,24 @@ BEGIN
ITEM "Pr.tipo"
ITEM "Pr.data"
ITEM "Mot."
ITEM "Responsabile@50"
ITEM "Responsabile@15"
END
TEXT DLG_NULL
BEGIN
PROMPT 1 13 "Idoneita'/Sospensioni per tipologie di donazione"
END
SPREADSHEET F_IDONEITA -1 6
BEGIN
PROMPT 1 14 "Idoneita'/Sospensioni per SI/AF"
ITEM "Data@10F"
ITEM "SI/AF@5F"
ITEM "Tipo@4F"
ITEM "Int."
ITEM "Fine sosp."
ITEM "Mot."
ITEM "Responsabile@37"
END
ENDPAGE
@ -1887,6 +2037,19 @@ BEGIN
GROUP 12
END
TEXT DLG_NULL
BEGIN
PROMPT 39 3 "Stato att."
END
STRING DLG_NULL 2
BEGIN
// stato attuale
PROMPT 51 3 ""
FLAGS "D"
GROUP 17
END
TEXT DLG_NULL
BEGIN
PROMPT 57 3 "Tessera"
@ -2020,7 +2183,7 @@ BEGIN
OUTPUT F_D_DENSOT DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Codice sezione assente"
END
@ -2032,7 +2195,7 @@ BEGIN
COPY ALL F_D_CODSEZ
CHECKTYPE NORMAL
HELP "Codice sottogruppo di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Codice sottogruppo assente"
END
@ -2048,7 +2211,7 @@ BEGIN
COPY OUTPUT F_D_CODSEZ
CHECKTYPE NORMAL
HELP "Denominazione sezione di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Denominazione assente"
END
@ -2062,7 +2225,7 @@ BEGIN
COPY OUTPUT F_D_DENSEZ
CHECKTYPE NORMAL
HELP "Sottogruppo di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Denominazione sottogruppo assente"
END
@ -2104,7 +2267,7 @@ BEGIN
FLAGS "U"
END
STRING F_D_DESC_TIPODON 25
STRING F_D_DESC_TIPODON 30
BEGIN
PROMPT 24 3 ""
FLAGS "D"
@ -2187,7 +2350,7 @@ BEGIN
OUTPUT F_C_DESC_IDON1 S0
CHECKTYPE NORMAL
VALIDATE NOT_EMPTY_FUNC
WARNING "Codice idoneit non presente"
WARNING "Codice idoneita' non presente"
HELP "Idoneita' alla donazione"
END
@ -2203,7 +2366,7 @@ BEGIN
OUTPUT F_C_IDON2 CODTAB
OUTPUT F_C_DESC_IDON2 S0
CHECKTYPE NORMAL
WARNING "Codice idoneit non presente"
WARNING "Codice idoneita' non presente"
HELP "Idoneita' alla donazione"
END
@ -2219,7 +2382,7 @@ BEGIN
OUTPUT F_C_IDON3 CODTAB
OUTPUT F_C_DESC_IDON3 S0
CHECKTYPE NORMAL
WARNING "Codice idoneit non presente"
WARNING "Codice idoneita' non presente"
HELP "Idoneita' alla donazione"
END
@ -2235,7 +2398,7 @@ BEGIN
OUTPUT F_C_IDON4 CODTAB
OUTPUT F_C_DESC_IDON4 S0
CHECKTYPE NORMAL
WARNING "Codice idoneit non presente"
WARNING "Codice idoneita' non presente"
HELP "Idoneita' alla donazione"
END
@ -2309,7 +2472,7 @@ BEGIN
HELP "Motivo del controllo sanitario"
END
STRING F_C_RESPONSAB 50
STRING F_C_RESPONSAB 50 15
BEGIN
PROMPT 2 17 "Responsabile "
FIELD LF_CONTSAN->RESPONSAB
@ -2377,6 +2540,135 @@ ENDPAGE
ENDMASK
PAGE "Idoneita'" -1 -1 75 20
GRUPBOX DLG_NULL 73 4
BEGIN
PROMPT 1 1 "Dati identificativi del controllo"
END
DATE F_I_DATAIDO
BEGIN
PROMPT 2 2 "Data intervento "
FIELD LF_IDONEITA->DATAIDO
CHECKTYPE REQUIRED
VALIDATE NOT_EMPTY_FUNC
HELP "Data intervento"
END
LISTBOX F_I_TIPOIDO 16
BEGIN
PROMPT 2 3 "Tipologia donazione interessata (SI/AF)"
FIELD LF_IDONEITA->TIPOIDO
FLAGS "U"
ITEM " | "
ITEM "SI|Sangue intero "
ITEM "AF|Aferesi"
//USE TCS
//INPUT CODTAB F_C_TIPOCON
//DISPLAY "Codice" CODTAB
//DISPLAY "Descrizione@40" S0
//OUTPUT F_C_TIPOCON CODTAB
//OUTPUT F_C_DESC_TIPOCON S0
//CHECKTYPE REQUIRED
VALIDATE NOT_EMPTY_FUNC
END
LISTBOX F_I_IDO_SOS 14
BEGIN
PROMPT 2 4 "Idoneit… o sospensione"
FIELD LF_IDONEITA->IDO_SOS
FLAGS "U"
VALIDATE NOT_EMPTY_FUNC
ITEM " | "
ITEM "ID|Idoneita'"
ITEM "SO|Sospensione "
//USE TCS
//INPUT CODTAB F_C_TIPOCON
//DISPLAY "Codice" CODTAB
//DISPLAY "Descrizione@40" S0
//OUTPUT F_C_TIPOCON CODTAB
//OUTPUT F_C_DESC_TIPOCON S0
END
GRUPBOX DLG_NULL 73 3
BEGIN
PROMPT 1 5 "Dati da compilare se si tratta di idoneita'"
END
NUMBER F_I_INTERVALLO 3 0
BEGIN
PROMPT 2 6 "Intervallo di donazione"
FIELD LF_IDONEITA->INTERVALLO
FLAGS "U"
VALIDATE NOT_EMPTY_FUNC
END
GRUPBOX DLG_NULL 73 3
BEGIN
PROMPT 1 8 "Dati da compilare se si tratta di sospensione"
END
DATE F_I_FINESOS
BEGIN
PROMPT 2 9 "Data fine sospensione"
FIELD LF_IDONEITA->FINESOS
HELP "Data controllo"
END
GROUPBOX DLG_NULL 73 4
BEGIN
PROMPT 1 11 "Dati complementari"
END
STRING F_I_MOTIVO 4
BEGIN
PROMPT 2 12 "Motivo "
FIELD LF_IDONEITA->MOTIVO
FLAGS "U"
USE MTC
INPUT CODTAB F_I_MOTIVO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_I_MOTIVO CODTAB
OUTPUT F_I_DESC_MOTIVO S0
CHECKTYPE NORMAL
WARNING "Codice motivo non presente"
HELP "Motivo del controllo sanitario"
END
STRING F_I_RESPONSAB 50 15
BEGIN
PROMPT 2 13 "Responsabile "
FIELD LF_IDONEITA->RESPONSAB
END
STRING F_I_DESC_MOTIVO 25
BEGIN
PROMPT 23 16 ""
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
PAGE "Benemerenze" -1 -1 75 14
@ -2467,7 +2759,7 @@ BEGIN
OUTPUT F_B_DENSOT DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Codice sezione assente"
END
@ -2479,7 +2771,7 @@ BEGIN
COPY ALL F_B_CODSEZ
CHECKTYPE NORMAL
HELP "Codice sottogruppo di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Codice sottogruppo assente"
END
@ -2511,7 +2803,7 @@ BEGIN
COPY OUTPUT F_B_CODSEZ
CHECKTYPE NORMAL
HELP "Denominazione sezione di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Denominazione assente"
END
@ -2525,7 +2817,7 @@ BEGIN
COPY OUTPUT F_B_DENSEZ
CHECKTYPE NORMAL
HELP "Sottogruppo di appartenenza"
ADD MASK at0700a
ADD MASK batbsez
WARNING "Denominazione sottogruppo assente"
END

View File

@ -80,7 +80,7 @@ BEGIN
HELP "Punto di prelievo"
END
STRING F_D_LUOGOGEN 25
STRING F_D_LUOGOGEN 50 25
BEGIN
PROMPT 20 9 ""
FLAGS "D"
@ -147,7 +147,7 @@ BEGIN
FLAGS "D"
END
STRING F_G_D_LUOGO 25
STRING F_G_D_LUOGO 50 25
BEGIN
PROMPT 30 5 ""
FLAGS "D"

View File

@ -25,7 +25,7 @@
#include "atlib.h"
#define ALIAS_CTD 100
#define ALIAS_CTD 700
class TGiornalieroDC : public TApplication
{
@ -38,9 +38,12 @@ class TGiornalieroDC : public TApplication
TLocalisamfile* _rconvoc;
TRecord_array* _sdonazioni;
TRecord_array* _scontrolli;
TAssoc_array* _asoggetti; // array dei soggetti inseriti per controllare doppio ins.
bool _modified;
// array dei soggetti inseriti per controllare doppio inserimento
TAssoc_array* _asoggetti;
bool _modified, _ricerca;
long _progins;
TDate _datadon;
TString16 _tipodon, _luogodon;
// parametri di sezione
int _numdon1, _numdon2;
TString16 _catini1, _catfin1, _catini2, _catfin2;
@ -56,7 +59,7 @@ protected:
TAssoc_array& get_array_sogg() { return *_asoggetti; }
int write(TSheet_field& s);
int read(TSheet_field& s);
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);
@ -78,7 +81,7 @@ bool TGiornalieroDC::ins_controlli_handler(TMask_field& f, KEY k)
TMask& m = f.mask();
TSheet_field& s = (TSheet_field&)m.field(F_SOGGETTI);
const bool ins_controlli = m.get_bool(F_INS_CONTROLLI);
s.enable_column(3,ins_controlli);
s.enable_column(4,ins_controlli);
}
return TRUE;
}
@ -95,6 +98,7 @@ bool TGiornalieroDC::create()
{
TApplication::create();
_modified = FALSE;
_ricerca = FALSE;
_msk = new TMask("at0200a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
@ -147,14 +151,28 @@ bool TGiornalieroDC::menu(MENU_TAG m)
do
{
TSheet_field& s = (TSheet_field&)msk.field(F_SOGGETTI);
//s.reset();
if (s.items() == 0)
add_rows_soggetti(s);
_asoggetti->destroy();
msk.set(F_DATADON,oggi);
//msk.set(F_DATADON,oggi);
_ricerca = FALSE;
tasto = msk.run();
_datadon = msk.get(F_DATADON);
_tipodon = msk.get(F_TIPODON);
_luogodon = msk.get(F_LUOGODON);
switch (tasto)
{
case K_F9: // ricerca
{
if (_modified)
if (yesno_box("Registrare le modifiche?"))
TGiornalieroDC::write(s);
_modified = FALSE;
_ricerca = TRUE;
TGiornalieroDC::read(s);
}
break;
case K_ESC: // annulla
{
if (_modified)
@ -162,13 +180,16 @@ bool TGiornalieroDC::menu(MENU_TAG m)
TGiornalieroDC::write(s);
_modified = FALSE;
msk.reset();
msk.field(DLG_SAVEREC).enable();
msk.field(DLG_FINDREC).enable();
msk.field(DLG_NEWREC).enable();
}
break;
case K_SAVE: // registra
{
TGiornalieroDC::write(s);
_modified = FALSE;
msk.reset(); //verificare se va tolta
//msk.reset(); //verificare se va tolta
}
break;
case K_INS: // nuovo
@ -195,12 +216,81 @@ bool TGiornalieroDC::menu(MENU_TAG m)
return FALSE;
}
int TGiornalieroDC::read(TSheet_field& s)
{
s.destroy();
TLocalisamfile donaz(LF_DONAZ);
TLocalisamfile soggetti(LF_SOGGETTI);
soggetti.setkey(1);
donaz.setkey(4);
donaz.zero();
donaz.put(DON_DATADON, _datadon);
if (_tipodon.not_empty())
{
donaz.put(DON_TIPODON, _tipodon);
if (_luogodon.not_empty())
donaz.put(DON_LUOGODON, _luogodon);
}
TString16 luogodon;
bool leggi = TRUE;
TRectype r(donaz.curr());
int items = 0;
for(donaz.read(); !donaz.eof(); donaz.next())
{
if (donaz.curr() != r) break;
if (_tipodon.empty() && _luogodon.not_empty())
{
luogodon = donaz.get(DON_LUOGODON);
if (luogodon == _luogodon)
leggi = TRUE;
else
leggi = FALSE;
}
else
leggi = TRUE;
if (leggi)
{
TToken_string& row = s.row(items);
row.add(donaz.get(DON_CODICE));
soggetti.zero();
soggetti.put(SOG_CODICE,donaz.get(DON_CODICE));
int err = soggetti.read();
if (err == NOERR)
{
row.add(soggetti.get(SOG_COGNOME));
row.add(soggetti.get(SOG_NOME));
}
else
{
row.add("");
row.add("");
}
row.add(donaz.get(DON_TIPODON));
row.add("");
row.add(donaz.get(DON_ETICHETTA));
row.add(donaz.get(DON_PRIMADON));
if (err == NOERR)
{
row.add(soggetti.get(SOG_DATANASC));
row.add(soggetti.get(SOG_CODSEZ));
row.add(soggetti.get(SOG_CODSOT));
row.add(soggetti.get(SOG_CATDON));
row.add(soggetti.get(SOG_TESSAVIS));
row.add(soggetti.get(SOG_INTSI));
}
items++;
}
}
_msk->field(DLG_SAVEREC).disable();
_msk->field(DLG_FINDREC).disable();
_msk->field(DLG_NEWREC).disable();
return items;
}
int TGiornalieroDC::write(TSheet_field& s)
{
const TMask& m = s.mask();
const TDate data = m.get(F_DATADON);
int items = s.items();
TProgind *pi;
pi = new TProgind(items,"Registrazione donazioni e controlli", FALSE, TRUE, 10);
@ -220,13 +310,24 @@ int TGiornalieroDC::write(TSheet_field& s)
int err = sog.read();
if (err == NOERR)
{
const TString16 tipocon = row.get(3);
if (!tipocon.blank())
TString16 tipocon = row.get(4);
if (tipocon.blank())
tipocon = m.get(F_TIPOCON);
if (tipocon.not_empty())
{
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, row.get(0));
recc->put(CON_DATACON, m.get(F_DATADON));
recc->put(CON_TIPOCON, row.get(3));
recc->put(CON_DATACON, _datadon);
recc->put(CON_TIPOCON, tipocon);
if (modstato_tcs(tipocon) == 'I')
{
recc->put(CON_IDON1,sog.get(SOG_IDON1));
recc->put(CON_IDON2,sog.get(SOG_IDON2));
recc->put(CON_IDON3,sog.get(SOG_IDON3));
recc->put(CON_IDON4,sog.get(SOG_IDON4));
recc->put(CON_INTSI,sog.get(SOG_INTSI));
recc->put(CON_INTAF,sog.get(SOG_INTAF));
}
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
@ -239,13 +340,13 @@ int TGiornalieroDC::write(TSheet_field& s)
{
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (data==d) // esiste già un controllo in questa data
if (_datadon==d) // esiste già un controllo in questa data
{
exist=TRUE;
r=0;
}
else
if (data > d)
if (_datadon > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
@ -266,15 +367,22 @@ int TGiornalieroDC::write(TSheet_field& s)
_scontrolli->insert_row(recc);
}
if (!exist)
{
_scontrolli->write(TRUE);
con_reord(sog.curr(),_scontrolli);
}
}
_progins++;
TRectype* rec = new TRectype(LF_DONAZ);
rec->put(DON_CODICE, row.get(0));
rec->put(DON_DATADON, m.get(F_DATADON));
rec->put(DON_TIPODON, m.get(F_TIPODON));
rec->put(DON_LUOGODON, m.get(F_LUOGODON));
rec->put(DON_ETICHETTA, row.get(4));
rec->put(DON_DATADON, _datadon);
TString16 tipodon = row.get(3);
if (tipodon.blank())
tipodon = _tipodon;
rec->put(DON_TIPODON, tipodon);
rec->put(DON_LUOGODON, _luogodon);
rec->put(DON_ETICHETTA, row.get(5));
rec->put(DON_PRIMADON, row.get(6));
rec->put(DON_CODSEZ,sog.get(SOG_CODSEZ));
rec->put(DON_CODSOT,sog.get(SOG_CODSOT));
@ -293,13 +401,13 @@ int TGiornalieroDC::write(TSheet_field& s)
{
const TRectype& riga = _sdonazioni->row(r);
const TDate d = riga.get(DON_DATADON);
if (data==d) // esiste gia' una donazione in questa data
if (_datadon==d) // esiste gia' una donazione in questa data
{
exist=TRUE;
r=0;
}
else
if (data > d)
if (_datadon > d)
{
rec->put(DON_PROGDON,r+1);
_sdonazioni->insert_row(rec);
@ -346,29 +454,28 @@ int TGiornalieroDC::write(TSheet_field& s)
}
// controllo se è idoneo
const TString16 tipo = m.get(F_TIPODON);
int totdon = sog.get_int(SOG_TOTDON);
sog.put(SOG_TOTDON,totdon+1);
if (data > dataultdon)
if (_datadon > dataultdon)
{
sog.put(SOG_DATAULTDON,data);
sog.put(SOG_TIPOULTDON,tipo);
sog.put(SOG_DATAULTDON,_datadon);
sog.put(SOG_TIPOULTDON,tipodon);
}
if (is_donaz(tipo,IDON_SI))
if (is_donaz(tipodon,IDON_SI))
{
totdon = sog.get_int(SOG_TOTDONSI);
sog.put(SOG_TOTDONSI,totdon+1);
dataultdon = sog.get_date(SOG_DATAULTSI);
if (data>dataultdon)
sog.put(SOG_DATAULTSI,data);
if (_datadon>dataultdon)
sog.put(SOG_DATAULTSI,_datadon);
}
if (is_donaz(tipo,IDON_AF))
if (is_donaz(tipodon,IDON_AF))
{
totdon = sog.get_int(SOG_TOTDONAF);
sog.put(SOG_TOTDONAF,totdon+1);
dataultdon = sog.get_date(SOG_DATAULTAF);
if (data>dataultdon)
sog.put(SOG_DATAULTAF,data);
if (_datadon>dataultdon)
sog.put(SOG_DATAULTAF,_datadon);
}
char modstato = ' ';
const TString16 stato = sog.get(SOG_STATO); // stato attuale
@ -465,9 +572,6 @@ int TGiornalieroDC::write(TSheet_field& s)
if ((catdon == _catini2 || _catini2.empty()) && (totdon+1>=_numdon2) && _catfin2.not_empty() && !_sttess2)
sog.put(SOG_CATDON, _catfin2);
}
// per bologna
// if (catdon == "06")
// sog.put(SOG_CATDON,"04");
}
TDate dataisc = sog.get_date(SOG_DATAISC);
if (dataisc.empty() && _dataisc)
@ -477,7 +581,8 @@ int TGiornalieroDC::write(TSheet_field& s)
}
// aggiorno data e utente ultimo aggiornamento
sog.put(SOG_DATAULTAGG,TODAY);
const TDate oggi(TODAY);
sog.put(SOG_DATAULTAGG,oggi);
sog.put(SOG_UTENULTAGG,user());
sog.rewrite();
@ -505,6 +610,15 @@ bool TGiornalieroDC::soggetti_notify(TSheet_field& s, int r, KEY k)
bool ok = TRUE;
switch (k)
{
case K_INS:
// richiesta inserimento riga
if (app()._ricerca)
{
s.message_box("Fase di ricerca: impossibile inserire donazioni");
ok = FALSE;
}
break;
case K_DEL:
case K_CTRL+K_DEL:
// avvenuta cancellazione riga
break;
@ -595,6 +709,9 @@ bool TGiornalieroDC::codice_handler(TMask_field& f, KEY k)
m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
m.set(F_S_CATDON, sog.get(SOG_CATDON));
const int totdon = sog.get_int(SOG_TOTDON);
if (totdon == 0)
m.set(F_S_PRIMADON, 'X');
}
else
ok = FALSE; // codice non esistente

View File

@ -8,31 +8,36 @@
#define F_DESC_TIPODON 204
#define F_DESC_LUOGODON 205
#define F_INS_CONTROLLI 206
#define F_TIPOCON 207
#define F_DESC_TIPOCON 208
// spreadsheet
#define F_SOGGETTI 207
#define F_SOGGETTI 209
// pagina soggetti
#define F_S_CODICE 101
#define F_S_COGNOME 102
#define F_S_NOME 103
#define F_S_TIPOCON 104
#define F_S_ETICHETTA 105
#define F_S_DATANASC 106
#define F_S_CODSEZ 107
#define F_S_CODSOT 108
#define F_S_CATDON 109
#define F_S_TESSAVIS 110
#define F_S_TIPODON 104
#define F_S_TIPOCON 105
#define F_S_ETICHETTA 106
#define F_S_PRIMADON 107
#define F_S_DATANASC 108
#define F_S_CODSEZ 109
#define F_S_CODSOT 110
#define F_S_CATDON 111
#define F_S_TESSAVIS 112
#define F_S_INTSI 113
#define F_S_DENSEZ 151
#define F_S_DENSOT 152
#define F_S_DESC_TIPOCON 153
#define F_S_DESC_CATDON 154
//#define F_S_DESC_CATDON 154
#define F_S_IDON1 155
#define F_S_IDON2 156
#define F_S_IDON3 157
#define F_S_IDON4 158
#define F_S_INTSI 159
//#define F_S_INTSI 159
#define F_S_INTAF 160
#define F_S_PROSSTIPO 161
#define F_S_PROSSDATA 162

View File

@ -2,9 +2,16 @@
TOOLBAR "" 0 20 0 2
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -16 -11 "Ri~cerca"
MESSAGE EXIT,K_F9
PICTURE 126
END
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -15 -11 "~Registra"
PROMPT -26 -11 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
@ -12,7 +19,7 @@ END
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -25 -11 "~Nuovo"
PROMPT -36 -11 "~Nuovo"
MESSAGE EXIT,K_INS
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
@ -20,20 +27,20 @@ END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -35 -11 "~Annulla"
PROMPT -46 -11 "~Annulla"
MESSAGE EXIT,K_ESC
PICTURE 102
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -45 -11 "~Stampa"
PROMPT -56 -11 "~Stampa"
MESSAGE RUN,at6,-2
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -55 -11 "~Fine"
PROMPT -66 -11 "~Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
@ -52,7 +59,7 @@ END
DATE F_DATADON
BEGIN
PROMPT 2 1 "Data donazione "
VALIDATE NOT_EMPTY_FUNC
CHECKTYPE REQUIRED
HELP "Data donazione"
END
@ -67,7 +74,7 @@ BEGIN
OUTPUT F_TIPODON CODTAB
OUTPUT F_DESC_TIPODON S0
VALIDATE NOT_EMPTY_FUNC
CHECKTYPE REQUIRED
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo donazione"
END
@ -89,19 +96,42 @@ END
STRING F_DESC_TIPODON 30
BEGIN
PROMPT 30 2 ""
PROMPT 26 2 ""
FLAGS "D"
END
STRING F_DESC_LUOGODON 50
BEGIN
PROMPT 30 3 ""
PROMPT 26 3 ""
FLAGS "D"
END
BOOLEAN F_INS_CONTROLLI
BEGIN
PROMPT 2 4 "Inserimento controlli"
MESSAGE TRUE ENABLE,F_TIPOCON
MESSAGE FALSE RESET,F_TIPOCON|DISABLE,F_TIPOCON
END
STRING F_TIPOCON 2
BEGIN
PROMPT 30 4 "Tipo/Esito "
FLAGS "U"
USE TCS
INPUT CODTAB F_TIPOCON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_TIPOCON CODTAB
OUTPUT F_DESC_TIPOCON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo controllo"
END
STRING F_DESC_TIPOCON 30
BEGIN
PROMPT 46 4 ""
FLAGS "D"
END
SPREADSHEET F_SOGGETTI
@ -110,13 +140,16 @@ BEGIN
ITEM "Codice@8"
ITEM "Cognome@25"
ITEM "Nome@25"
ITEM "Don."
ITEM "Con."
ITEM "Et. sacca"
ITEM "1ø"
ITEM "Nato il@10"
ITEM "Sez."
ITEM "Sot."
ITEM "Cat."
ITEM "Tessera"
ITEM "Int.SI"
END
ENDPAGE
@ -125,9 +158,9 @@ ENDMASK
PAGE "Soggetto " -1 -1 78 20
GROUPBOX DLG_NULL 77 5
GROUPBOX DLG_NULL 77 6
BEGIN
PROMPT 1 0 ""
PROMPT 1 0 "Soggetto donatore"
FLAGS "R"
END
@ -147,6 +180,7 @@ BEGIN
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
OUTPUT F_S_CODICE CODICE
OUTPUT F_S_COGNOME COGNOME
OUTPUT F_S_NOME NOME
@ -155,8 +189,9 @@ BEGIN
OUTPUT F_S_CODSOT CODSOT
OUTPUT F_S_CATDON CATDON
OUTPUT F_S_TESSAVIS TESSAVIS
OUTPUT F_S_INTSI INTSI
// CHECKTYPE NORMAL
// ADD RUN at0 -0
ADD RUN at0 -0
END
STRING F_S_COGNOME 25
@ -174,6 +209,7 @@ BEGIN
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
OUTPUT F_S_CODICE CODICE
OUTPUT F_S_COGNOME COGNOME
OUTPUT F_S_NOME NOME
@ -182,9 +218,10 @@ BEGIN
OUTPUT F_S_CODSOT CODSOT
OUTPUT F_S_CATDON CATDON
OUTPUT F_S_TESSAVIS TESSAVIS
OUTPUT F_S_INTSI INTSI
HELP "Cognome del soggetto"
// CHECKTYPE NORMAL
// ADD RUN at0 -0
ADD RUN at0 -0
END
STRING F_S_NOME 25
@ -203,6 +240,7 @@ BEGIN
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
OUTPUT F_S_CODICE CODICE
OUTPUT F_S_COGNOME COGNOME
OUTPUT F_S_NOME NOME
@ -211,19 +249,35 @@ BEGIN
OUTPUT F_S_CODSOT CODSOT
OUTPUT F_S_CATDON CATDON
OUTPUT F_S_TESSAVIS TESSAVIS
OUTPUT F_S_INTSI INTSI
HELP "Nome del soggetto"
// CHECKTYPE NORMAL
// ADD RUN at0 -0
ADD RUN at0 -0
END
STRING F_S_TIPODON 2
BEGIN
PROMPT 2 16 "Tipo donazione "
FLAGS "U"
USE TDN
INPUT CODTAB F_S_TIPODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_S_TIPODON CODTAB
//OUTPUT F_S_DESC_TIPODON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo donazione (se diverso da dati fissi)"
END
GROUPBOX DLG_NULL 77 9
BEGIN
PROMPT 1 9 "Dati del controllo sanitario effettuato"
PROMPT 1 6 "Dati del controllo sanitario effettuato"
END
STRING F_S_TIPOCON 2
BEGIN
PROMPT 2 10 "Tipo controllo "
PROMPT 2 7 "Tipo controllo "
FLAGS "U"
USE TCS SELECT S6=="N"
INPUT CODTAB F_S_TIPOCON
@ -235,11 +289,20 @@ BEGIN
HELP "Tipo/Esito controllo sanitario"
END
NUMBER F_S_ETICHETTA 9
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 2 17 "Etichetta sacca "
PROMPT 1 15 "Dati complementari della donazione"
END
NUMBER F_S_ETICHETTA 9
BEGIN
PROMPT 30 16 "Etichetta sacca "
END
BOOLEAN F_S_PRIMADON
BEGIN
PROMPT 60 16 "Prima donazione"
END
DATE F_S_DATANASC
BEGIN
@ -247,26 +310,21 @@ BEGIN
FLAGS "D"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 5 "Dati associativi"
END
STRING F_S_CODSEZ 2
BEGIN
PROMPT 2 6 "Sez. "
PROMPT 2 4 "Sez./Sottog. "
FLAGS "D"
END
STRING F_S_DENSEZ 25
STRING F_S_DENSEZ 25 23
BEGIN
PROMPT 12 6 ""
PROMPT 20 4 ""
FLAGS "D"
END
STRING F_S_CODSOT 2
BEGIN
PROMPT 40 6 "Sot. "
PROMPT 46 4 ""
FLAGS "D"
USE LF_SEZIONI
INPUT CODSEZ F_S_CODSEZ
@ -276,48 +334,54 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_S_DENSOT 25
STRING F_S_DENSOT 25 23
BEGIN
PROMPT 50 6 ""
PROMPT 49 4 ""
FLAGS "D"
END
STRING F_S_CATDON 2
BEGIN
PROMPT 2 7 "Cat. "
PROMPT 60 3 "Categoria "
FLAGS "D"
USE CTD
INPUT CODTAB F_S_CATDON
OUTPUT F_S_DESC_CATDON S0
CHECKTYPE NORMAL
// USE CTD
// INPUT CODTAB F_S_CATDON
// OUTPUT F_S_DESC_CATDON S0
// CHECKTYPE NORMAL
END
STRING F_S_TESSAVIS 10
BEGIN
PROMPT 52 7 "Tessera AVIS "
PROMPT 33 3 "Tessera AVIS "
FLAGS "D"
END
NUMBER F_S_INTSI 3 0
BEGIN
PROMPT 40 12 "Sangue intero "
FLAGS "D"
END
STRING F_S_DESC_TIPOCON 25
BEGIN
PROMPT 23 10 ""
PROMPT 23 7 ""
FLAGS "D"
END
STRING F_S_DESC_CATDON 25
BEGIN
PROMPT 12 7 ""
FLAGS "D"
END
//STRING F_S_DESC_CATDON 25 15
//BEGIN
// PROMPT 61 3 ""
// FLAGS "D"
//END
TEXT DLG_NULL
BEGIN
PROMPT 2 11 "Se idoneita': Tipi donazione ammessi"
PROMPT 2 8 "Se idoneita': tipi donazione ammessi"
END
STRING F_S_IDON1 2
BEGIN
PROMPT 40 11 ""
PROMPT 40 8 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON1
@ -332,7 +396,7 @@ END
STRING F_S_IDON2 2
BEGIN
PROMPT 40 12 ""
PROMPT 40 9 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON2
@ -347,8 +411,8 @@ END
STRING F_S_IDON3 2
BEGIN
PROMPT 40 13 ""
FLAGS "U"
PROMPT 40 10 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON3
DISPLAY "Codice" CODTAB
@ -362,8 +426,8 @@ END
STRING F_S_IDON4 2
BEGIN
PROMPT 40 14 ""
FLAGS "U"
PROMPT 40 11 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON4
DISPLAY "Codice" CODTAB
@ -377,24 +441,24 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 2 15 " Intervalli"
PROMPT 2 12 " intervalli"
END
NUMBER F_S_INTSI 3 0
BEGIN
PROMPT 40 15 "Sangue intero "
FLAGS "U"
END
//NUMBER F_S_INTSI 3 0
//BEGIN
// PROMPT 29 12 "Sangue intero "
// FLAGS "U"
//END
NUMBER F_S_INTAF 3 0
BEGIN
PROMPT 60 15 "Aferesi "
PROMPT 59 12 "Aferesi "
FLAGS "U"
END
STRING F_S_PROSSTIPO 2
BEGIN
PROMPT 2 16 "Prossimo contr.: Tipo "
PROMPT 2 13 "Prossimo tipo "
FLAGS "U"
USE TCS
INPUT CODTAB F_S_PROSSTIPO
@ -410,37 +474,37 @@ END
DATE F_S_PROSSDATA
BEGIN
PROMPT 56 16 "Data "
PROMPT 55 13 "Data "
HELP "Data controllo"
END
STRING F_S_DESC_IDON1 25
BEGIN
PROMPT 46 11 ""
PROMPT 45 8 ""
FLAGS "D"
END
STRING F_S_DESC_IDON2 25
BEGIN
PROMPT 46 12 ""
PROMPT 45 9 ""
FLAGS "D"
END
STRING F_S_DESC_IDON3 25
BEGIN
PROMPT 46 13 ""
PROMPT 45 10 ""
FLAGS "D"
END
STRING F_S_DESC_IDON4 25
BEGIN
PROMPT 46 14 ""
PROMPT 45 11 ""
FLAGS "D"
END
STRING F_S_DESC_PROSSTIPO 25
BEGIN
PROMPT 29 16 ""
PROMPT 23 13 ""
FLAGS "D"
END

View File

@ -24,7 +24,7 @@
#include "atlib.h"
#define ALIAS_CTD 100
#define ALIAS_CTD 700
class TGiornalieroC : public TApplication
{
@ -52,7 +52,7 @@ protected:
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 tipocon_handler(TMask_field& f, KEY k);
//static bool tipocon_handler(TMask_field& f, KEY k);
static bool soggetti_notify(TSheet_field& s, int r, KEY k);
void add_rows_soggetti(TSheet_field& s, int count = 20, int start = 0);
@ -169,7 +169,10 @@ int TGiornalieroC::write(TSheet_field& s)
{
const TMask& m = s.mask();
const TDate data = m.get(F_DATACON);
const TDate datagen = m.get(F_DATACON);
const TString16 tipogen = m.get(F_TIPOCON);
const TDate prdatagen = m.get(F_PROSSDATA);
const TString16 prtipogen = m.get(F_PROSSTIPO);
int items = s.items();
TProgind *pi;
@ -192,15 +195,32 @@ int TGiornalieroC::write(TSheet_field& s)
int err = sog.read();
if (err == NOERR)
{
const TString16 tipocon = row.get(3);
if (!tipocon.blank())
TString16 tipocon = row.get(3);
TString16 prosstipo = row.get(4);
TDate prossdata = row.get(5);
if (tipocon.blank())
tipocon = tipogen;
if (prosstipo.blank())
prosstipo = prtipogen;
if (!prossdata.ok())
prossdata = prdatagen;
if (!tipocon.blank())
{
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, row.get(0));
recc->put(CON_DATACON, m.get(F_DATACON));
recc->put(CON_DATACON, datagen);
recc->put(CON_TIPOCON, tipocon);
recc->put(CON_PROSSTIPO, row.get(4));
recc->put(CON_PROSSDATA, row.get(5));
recc->put(CON_PROSSTIPO, prosstipo);
recc->put(CON_PROSSDATA, prossdata);
if (modstato_tcs(tipocon) == 'I')
{
recc->put(CON_IDON1, sog.get(SOG_IDON1));
recc->put(CON_IDON2, sog.get(SOG_IDON2));
recc->put(CON_IDON3, sog.get(SOG_IDON3));
recc->put(CON_IDON4, sog.get(SOG_IDON4));
recc->put(CON_INTSI, sog.get(SOG_INTSI));
recc->put(CON_INTAF, sog.get(SOG_INTAF));
}
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
@ -213,13 +233,13 @@ int TGiornalieroC::write(TSheet_field& s)
{
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (data==d) // esiste gia' un controllo in questa data
if (datagen==d) // esiste gia' un controllo in questa data
{
exist=TRUE;
r=0;
}
else
if (data > d)
if (datagen > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
@ -242,7 +262,8 @@ int TGiornalieroC::write(TSheet_field& s)
if (!exist)
_scontrolli->write(TRUE);
con_reord(sog.curr(), _scontrolli);
sog.put(SOG_DATAULTAGG,TODAY);
const TDate oggi(TODAY);
sog.put(SOG_DATAULTAGG,oggi);
sog.put(SOG_UTENULTAGG,user());
sog.rewrite();
}
@ -366,27 +387,66 @@ bool TGiornalieroC::codice_handler(TMask_field& f, KEY k)
}
return ok;
}
/*
bool TGiornalieroC::tipocon_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (k == K_TAB && !f.focusdirty())
{
TMask& m = f.mask();
TString16 tipoconsog = m.get(F_S_TIPOCON);
TString80 nome = m.get(F_S_NOME);
if (tipoconsog.empty() && nome.not_empty())
const TString16 tipo = m.get(F_S_TIPOCON);
const char modstato = modstato_tcs(tipo);
if ( modstato == 'I' || modstato == 'M')
{
m.field(F_S_IDON1).enable();
m.field(F_S_IDON2).enable();
m.field(F_S_IDON3).enable();
m.field(F_S_IDON4).enable();
m.field(F_S_INTSI).disable();
m.field(F_S_INTAF).disable();
const TString16 idon1 = m.get(F_S_IDON1);
const TString16 idon2 = m.get(F_S_IDON2);
const TString16 idon3 = m.get(F_S_IDON3);
const TString16 idon4 = m.get(F_S_IDON4);
if (is_idon(idon1,idon2,idon3,idon4,IDON_SI))
m.field(F_S_INTSI).enable();
else
m.field(F_S_INTSI).reset();
if (is_idon(idon1,idon2,idon3,idon4,IDON_AF))
m.field(F_S_INTAF).enable();
else
m.field(F_S_INTAF).reset();
// propongo i dati precedenti per idoneita'
if (idon1.empty() && idon2.empty() && idon3.empty() && idon4.empty())
{
const TMask& mask = *(app().get_mask());
m.set(F_S_IDON1,mask.get(F_IDON1));
m.set(F_S_IDON2,mask.get(F_IDON2));
m.set(F_S_IDON3,mask.get(F_IDON3));
m.set(F_S_IDON4,mask.get(F_IDON4));
m.set(F_S_INTSI,mask.get(F_INTSI));
m.set(F_S_INTAF,mask.get(F_INTAF));
}
}
else
{
TString16 tipocon = app().get_mask().get(F_TIPOCON);
TString16 prosstipo = app().get_mask().get(F_PROSSTIPO);
TDate prossdata = app().get_mask().get(F_PROSSDATA);
m.field(F_S_TIPOCON).set(tipocon);
m.field(F_S_PROSSTIPO).set(prosstipo);
m.field(F_S_PROSSDATA).set(prossdata);
}
}
m.field(F_S_IDON1).reset();
m.field(F_S_IDON1).disable();
m.field(F_S_IDON2).reset();
m.field(F_S_IDON2).disable();
m.field(F_S_IDON3).reset();
m.field(F_S_IDON3).disable();
m.field(F_S_IDON4).reset();
m.field(F_S_IDON4).disable();
m.field(F_S_INTSI).reset();
m.field(F_S_INTSI).disable();
m.field(F_S_INTAF).reset();
m.field(F_S_INTAF).disable();
}
}
return TRUE;
}
}
*/
int at0300(int argc, char* argv[])
{

View File

@ -52,54 +52,54 @@ BEGIN
HELP "Data donazione"
END
//STRING F_TIPOCON 2
//BEGIN
// PROMPT 2 2 "Tipo/Esito "
// FLAGS "U"
// USE TCS
// INPUT CODTAB F_TIPOCON
// DISPLAY "Codice" CODTAB
// DISPLAY "Descrizione@30" S0
// OUTPUT F_TIPOCON CODTAB
// OUTPUT F_DESC_TIPOCON S0
// CHECKTYPE NORMAL
// WARNING "Codice non presente"
// HELP "Tipo/Esito controllo sanitario"
//END
//
//STRING F_PROSSTIPO 2
//BEGIN
// PROMPT 2 3 "Prossimo tipo "
// FLAGS "U"
// USE TCS
// INPUT CODTAB F_PROSSTIPO
// DISPLAY "Codice" CODTAB
// DISPLAY "Descrizione@30" S0
// OUTPUT F_PROSSTIPO CODTAB
// OUTPUT F_DESC_PROSSTIPO S0
// CHECKTYPE NORMAL
// WARNING "Codice non presente"
// HELP "Tipo/Esito del prossimo controllo previsto"
//END
//
//DATE F_PROSSDATA
//BEGIN
// PROMPT 2 4 "Data prevista "
// HELP "Data prevista per il prossimo controllo"
//END
//
//STRING F_DESC_TIPOCON 25
//BEGIN
// PROMPT 30 2 ""
// FLAGS "D"
//END
//
//STRING F_DESC_PROSSTIPO 25
//BEGIN
// PROMPT 30 3 ""
// FLAGS "D"
//END
//
STRING F_TIPOCON 2
BEGIN
PROMPT 2 2 "Tipo/Esito "
FLAGS "U"
USE TCS
INPUT CODTAB F_TIPOCON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_TIPOCON CODTAB
OUTPUT F_DESC_TIPOCON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo/Esito controllo sanitario"
END
STRING F_PROSSTIPO 2
BEGIN
PROMPT 2 3 "Prossimo tipo "
FLAGS "U"
USE TCS
INPUT CODTAB F_PROSSTIPO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_PROSSTIPO CODTAB
OUTPUT F_DESC_PROSSTIPO S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo/Esito del prossimo controllo previsto"
END
DATE F_PROSSDATA
BEGIN
PROMPT 2 4 "Data prevista "
HELP "Data prevista per il prossimo controllo"
END
STRING F_DESC_TIPOCON 25
BEGIN
PROMPT 30 2 ""
FLAGS "D"
END
STRING F_DESC_PROSSTIPO 25
BEGIN
PROMPT 30 3 ""
FLAGS "D"
END
SPREADSHEET F_SOGGETTI
BEGIN
PROMPT 2 6 "Soggetti"

View File

@ -1,11 +1,11 @@
#include <mask.h>
#include <form.h>
#include <msksheet.h>
#include <printer.h>
#include <progind.h>
#include <recarray.h>
#include <relapp.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "at0.h"
#include "atlib.h"
@ -19,7 +19,7 @@
#include "convoc.h"
#include "rconvoc.h"
#define ALIAS_CTD -100
#define ALIAS_CTD -700
#define ALIAS_TCS -200
#define IDON_SI "SI"
#define IDON_AF "AF"
@ -34,6 +34,7 @@ class TGestioneConvocazioni: public TRelation_application
TCursor* _cur; // cursore per selezione soggetti
TLocalisamfile* _rconvoc;
TLocalisamfile* _soggetti;
TLocalisamfile* _sezioni;
TRecord_array* _sconvocati; // sheet convocati
long _lastcod; // progressivo convocazione da assegnare
long _numero; // numero convocazione
@ -58,12 +59,15 @@ protected:
virtual bool changing_mask(int mode) { return FALSE; }
virtual TMask* get_mask( int mode = 0) { return _msk; }
virtual TRelation* get_relation() const { return _rel; }
static bool convocati_notify(TSheet_field& s, int r, KEY k);
static bool esegui_handler(TMask_field& f, KEY k);
static bool data_handler(TMask_field&f, KEY k);
static bool dataini_handler(TMask_field&f, KEY k);
static bool sezione_handler(TMask_field&f, KEY k);
public:
virtual void print();
TGestioneConvocazioni() {}
};
@ -74,6 +78,7 @@ bool TGestioneConvocazioni::filter_func_convoc(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& sog = rel->curr();
const long codice = sog.get_long(SOG_CODICE);
const TString16 cat = sog.get(SOG_CATDON);
const char stato = modstato_tcs(sog.get(SOG_STATO));
const TString16 escluso = sog.get(SOG_ESCLUSO);
@ -101,7 +106,8 @@ bool TGestioneConvocazioni::filter_func_convoc(const TRelation* rel)
if (filtrato)
{
filtrato = FALSE;
const TDate data = app()._data;
//const TDate data = app()._data;
TDate data = app()._dataini;
const int numconv = sog.get_int(SOG_NUMCONV);
const TDate dataultconv = sog.get(SOG_DATACONV);
const TDate dataultsol = sog.get(SOG_DATAULTSOL);
@ -130,6 +136,30 @@ bool TGestioneConvocazioni::filter_func_convoc(const TRelation* rel)
return filtrato;
}
bool TGestioneConvocazioni::sezione_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
{
TMask& m = f.mask();
//const TString16 codsez = m.get(F_CODSEZ);
//const TString16 codsot = m.get(F_CODSOT);
TLocalisamfile sez(LF_SEZIONI);
sez.setkey(1);
TRectype& recsez = sez.curr();
recsez.zero();
recsez.put(SEZ_CODSEZ, m.get(F_CODSEZ));
recsez.put(SEZ_CODSOT, m.get(F_CODSOT));
if (sez.read() == NOERR)
{
TDate data = sez.get_date(SEZ_DATAULTCON);
++data;
m.set(F_DATAINI, data);
m.check_field(F_DATAINI);
}
}
return TRUE;
}
bool TGestioneConvocazioni::data_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
@ -166,6 +196,42 @@ bool TGestioneConvocazioni::data_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TGestioneConvocazioni::dataini_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
{
const TDate data = f.get();
const int giorno = data.wday();
TString16 datagio = "";
switch (giorno)
{
case 0:
datagio = "Domenica";
break;
case 1:
datagio = "Lunedi";
break;
case 2:
datagio = "Martedi";
break;
case 3:
datagio = "Mercoledi";
break;
case 4:
datagio = "Giovedi";
break;
case 5:
datagio = "Venerdi";
break;
case 6:
datagio = "Sabato";
break;
}
f.mask().set(F_DATAINIGIO,datagio);
}
return TRUE;
}
bool TGestioneConvocazioni::esegui_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
@ -179,6 +245,8 @@ bool TGestioneConvocazioni::esegui_handler(TMask_field& f, KEY k)
app()._codsez = m.get(F_CODSEZ);
app()._codsot = m.get(F_CODSOT);
app()._dataini = m.get(F_DATAINI);
if (app()._dataini.empty())
app()._dataini = app()._data;
app()._ritarda = m.get_bool(F_RITARDA);
app()._maxrit = m.get_int(F_MAXRIT);
if (app()._numero == 0 || !app()._data.ok() || app()._punto.empty() || app()._tipo.empty())
@ -338,10 +406,14 @@ bool TGestioneConvocazioni::user_create()
_sconvocati = new TRecord_array(LF_RCONVOC,RCV_PROGCONV);
_msk->set_handler(F_ESEGUI,esegui_handler);
_msk->set_handler(F_DATA,data_handler);
_msk->set_handler(F_DATAINI,dataini_handler);
_msk->set_handler(F_CODSEZ,sezione_handler);
_msk->set_handler(F_CODSOT,sezione_handler);
TSheet_field& sc = (TSheet_field&)_msk->field(F_CONVOCATI);
sc.set_notify(convocati_notify);
_rel->lfile().last();
_lastcod = _rel->lfile().get_long(COV_NUMERO);
enable_menu_item(M_FILE_PRINT);
return TRUE;
}
@ -439,6 +511,16 @@ int TGestioneConvocazioni::scrivi(const TMask& m, bool ri)
int err = ri ? TRelation_application::rewrite(m) : TRelation_application::write(m);
if (err == NOERR)
{
TLocalisamfile sez(LF_SEZIONI);
sez.setkey(1);
sez.zero();
sez.put(SEZ_CODSEZ, app()._codsez);
sez.put(SEZ_CODSOT, app()._codsot);
if (sez.read() == NOERR)
{
sez.put(SEZ_DATAULTCON, app()._data);
sez.rewrite();
}
TLocalisamfile soggetti(LF_SOGGETTI);
_sconvocati->destroy_rows();
TSheet_field& s = (TSheet_field&)m.field(F_CONVOCATI);
@ -501,6 +583,17 @@ bool TGestioneConvocazioni::convocati_notify(TSheet_field& s, int r, KEY k)
return result;
}
void TGestioneConvocazioni::print()
{
TForm elenco("ATCONVOC");
TCursor& cur = *elenco.cursor();
TLocalisamfile& convoc = cur.file();
const long numero = app()._msk->get_long(F_NUMERO);
convoc.put(COV_NUMERO, numero);
cur.read();
elenco.print(-1);
}
int at0400(int argc, char* argv[])
{
TGestioneConvocazioni a;

View File

@ -13,13 +13,14 @@
#define F_CODSOT 110
#define F_DENSOT 111
#define F_DATAINI 112
#define F_RITARDA 113
#define F_MAXRIT 114
#define F_NOTE 115
#define F_NUMCONV 116
#define F_NUMSOLL 117
#define F_NUMRIT 118
#define F_CONVOCATI 119
#define F_DATAINIGIO 113
#define F_RITARDA 114
#define F_MAXRIT 115
#define F_NOTE 116
#define F_NUMCONV 117
#define F_NUMSOLL 118
#define F_NUMRIT 119
#define F_CONVOCATI 120
#define F_ESEGUI 140

View File

@ -1,8 +1,51 @@
#include "at0400a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
#include <toolbar.h>
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -46 -1 "Ri~cerca"
MESSAGE EXIT,K_F9
PICTURE 126
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -56 -1 "~Annulla"
MESSAGE EXIT,K_ESC
PICTURE 102
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -66 -1 "~Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
@ -124,7 +167,7 @@ BEGIN
OUTPUT F_DENSOT DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_DENSEZ 25
@ -140,7 +183,7 @@ BEGIN
COPY OUTPUT F_CODSEZ
CHECKTYPE NORMAL
HELP "Denominazione sezione da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_CODSOT 2
@ -150,7 +193,7 @@ BEGIN
COPY ALL F_CODSEZ
CHECKTYPE NORMAL
HELP "Codice sottogruppo da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_DENSOT 25
@ -164,7 +207,7 @@ BEGIN
COPY OUTPUT F_DENSEZ
CHECKTYPE NORMAL
HELP "Sottogruppo da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
DATE F_DATAINI
@ -173,6 +216,12 @@ BEGIN
FIELD DATAINI
END
STRING F_DATAINIGIO 10
BEGIN
PROMPT 35 7 ""
FLAGS "D"
END
BOOLEAN F_RITARDA
BEGIN
PROMPT 2 8 "Ritardatari"
@ -181,7 +230,7 @@ END
NUMBER F_MAXRIT 3
BEGIN
PROMPT 20 8 "Massimo ritardo in giorni"
PROMPT 20 8 "Massimo ritardo in giorni "
FIELD MAXRIT
END

View File

@ -72,7 +72,7 @@ BEGIN
OUTPUT F_DENSOT DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_DENSEZ 25
@ -88,7 +88,7 @@ BEGIN
COPY OUTPUT F_CODSEZ
CHECKTYPE NORMAL
HELP "Denominazione sezione da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_CODSOT 2
@ -97,7 +97,7 @@ BEGIN
COPY ALL F_CODSEZ
CHECKTYPE NORMAL
HELP "Codice sottogruppo da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_DENSOT 25
@ -111,7 +111,7 @@ BEGIN
COPY OUTPUT F_DENSEZ
CHECKTYPE NORMAL
HELP "Sottogruppo da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
GROUPBOX DLG_NULL 77 4

233
at/at0600.cpp Executable file
View File

@ -0,0 +1,233 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "at0.h"
// nomi campi maschera
#include "at0600a.h"
// nomi dei campi
#include "soggetti.h"
#include "donaz.h"
#include "contsan.h"
#include "benem.h"
#include "storico.h"
#include "sezioni.h"
class TChiusuraPeriodica : public TPrintapp
{
static bool filter_func_chiusura(const TRelation* rel);
TMask* _msk;
TRelation* _rel;
int _cur;
TDate _data_chiusura;
TParagraph_string _operazione;
bool _definitiva;
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);
virtual TMask& get_mask() { return *_msk; }
public:
void filtra_sezioni();
void crea_intestazione();
TChiusuraPeriodica() : _data_chiusura(TODAY), _operazione("",30) {}
};
HIDDEN inline TChiusuraPeriodica& app() { return (TChiusuraPeriodica&) main_app(); }
void TChiusuraPeriodica::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TChiusuraPeriodica::preprocess_page(int file, int counter)
{
_operazione = "Nulla";
TRectype& recsez = current_cursor()->curr(LF_SEZIONI);
TRectype& recsog = current_cursor()->curr();
TLocalisamfile& filesog = current_cursor()->file();
const TString16 cat_estinti = recsez.get(SEZ_CATESTI);
const TString16 cat_cancellati = recsez.get(SEZ_CATCANC);
const TString16 cat_emeriti = recsez.get(SEZ_CATEMER);
const int intesti = recsez.get_int(SEZ_INTESTI);
const int donemer = recsez.get_int(SEZ_DONEMER);
const TString16 catsog = recsog.get(SOG_CATDON);
if ((catsog==cat_estinti && cat_estinti.not_empty())
|| (catsog==cat_cancellati && cat_cancellati.not_empty()))
{
const int totdon = recsog.get_int(SOG_TOTDON);
if (totdon >= donemer && donemer != 0)
{
_operazione = "Passaggio a emeriti";
if (_definitiva)
{
recsog.put(SOG_CATDON,cat_emeriti);
filesog.rewrite();
}
}
else
{
_operazione = "Cancellato";
if (_definitiva)
filesog.remove();
}
}
else
{
TDate dataultdon = recsog.get(SOG_DATAULTDON);
if (dataultdon.ok())
{
dataultdon.addyear(intesti);
if (dataultdon < _data_chiusura)
{
_operazione = "Passaggio a estinti";
if (_definitiva)
{
recsog.put(SOG_CATDON,cat_estinti);
filesog.rewrite();
}
}
else
_operazione = "Non doveva essere filtrato: data ancora valida";
}
else
_operazione = "Non doveva essere filtrato: data vuota";
}
return TRUE;
}
void TChiusuraPeriodica::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@65g#a", &_operazione);
}
bool TChiusuraPeriodica::filter_func_chiusura(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& recsez = rel->lfile(LF_SEZIONI).curr();
TRectype& recsog = rel->lfile().curr();
const TString16 cat_estinti = recsez.get(SEZ_CATESTI);
const TString16 cat_cancellati = recsez.get(SEZ_CATCANC);
const TString16 cat_emeriti = recsez.get(SEZ_CATEMER);
const int intesti = recsez.get_int(SEZ_INTESTI);
const TString16 catsog = recsog.get(SOG_CATDON);
filtrato = ((catsog == cat_estinti && cat_estinti.not_empty()) ||
(catsog == cat_cancellati && cat_cancellati.not_empty()));
if (!filtrato && catsog != cat_emeriti)
{
TDate dataultdon = recsog.get(SOG_DATAULTDON);
if (dataultdon.ok())
{
dataultdon.addyear(intesti);
filtrato = (dataultdon < app()._data_chiusura);
}
}
return filtrato;
}
bool TChiusuraPeriodica::set_print(int)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_definitiva = _msk->get_bool(F_DEFINITIVA);
_data_chiusura = _msk->get(F_DATA);
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
current_cursor()->set_filterfunction(filter_func_chiusura,TRUE);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TChiusuraPeriodica::crea_intestazione()
{
reset_header();
TString sep(132);
TString16 data_stampa;
sep.fill('-');
set_header(1, (const char *) sep);
sep = "";
sep << "Pag. @#";
sep.right_just(132);
set_header(2,(const char*) sep);
if (_definitiva)
set_header(2,"@0gCHIUSURA PERIODICA - DEFINITIVA - ALLA DATA");
else
set_header(2,"@0gCHIUSURA PERIODICA - PROVVISORIA - ALLA DATA");
data_stampa = _data_chiusura.string();
set_header(2,"@47g%10s", (const char*) data_stampa);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
}
bool TChiusuraPeriodica::user_create()
{
_msk = new TMask("at0600a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
return TRUE;
}
bool TChiusuraPeriodica::user_destroy()
{
delete _rel;
delete _msk;
return TRUE;
}
int at0600(int argc, char* argv[])
{
TChiusuraPeriodica a;
a.run(argc, argv, "Chiusura periodica");
return 0;
}

13
at/at0600a.h Executable file
View File

@ -0,0 +1,13 @@
// chiusura periodica
// 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
#define F_DEFINITIVA 110

148
at/at0600a.uml Executable file
View File

@ -0,0 +1,148 @@
#include "at0600a.h"
PAGE "Chiusura Periodica" -1 -1 78 12
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 6 "Opzioni per la chiusura"
END
DATE F_DATA
BEGIN
PROMPT 2 7 "Data di riferimento "
CHECKTYPE REQUIRED
HELP "Data di riferimento per i conteggi di chiusura"
END
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT 43 7 "Chiusura definitiva"
HELP "Se chiusura definitiva, le operazioni stampate verranno registrate"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 10 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 10 ""
END
ENDPAGE
ENDMASK

347
at/at0700.cpp Executable file
View File

@ -0,0 +1,347 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "at0.h"
#include "atlib.h"
#define ALIAS_TCS 200
#define FINE_SOSPENSIONE "FS"
// nomi campi maschera
#include "at0700a.h"
// nomi dei campi
#include "soggetti.h"
#include "contsan.h"
#include "sezioni.h"
class TSbloccoSospesi : public TPrintapp
{
TMask* _msk;
TRelation* _rel;
TLocalisamfile* _contsan;
TRecord_array* _scontrolli;
int _cur;
int _contatore, _totale;
TDate _data_sblocco; // data scadenza sospensione fino a _data_sblocco
TDate _data_stampa;
TString16 _tiposo; // tipo sospesione da sbloccare
TString16 _codsez, _codsot;
bool _definitiva;
TParagraph_string _cognome_nome, _operazione;
TString16 _finesospensione;
static bool filter_func_sbloccosospesi(const TRelation* rel);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
virtual print_action postprocess_print(int file, int counter);
public:
void filtra_sezioni();
void crea_intestazione();
void header_sezione(const TString16 codsez, const TString16 codsot);
void footer_sezione();
void fine_stampa();
TSbloccoSospesi() : _data_sblocco(TODAY), _data_stampa(TODAY), _tiposo(""), _cognome_nome("",25), _operazione("",25) {}
};
HIDDEN inline TSbloccoSospesi& app() { return (TSbloccoSospesi&) main_app(); }
print_action TSbloccoSospesi::postprocess_print(int file, int counter)
{
if (_contatore > 0)
footer_sezione();
fine_stampa();
return NEXT_PAGE;
}
void TSbloccoSospesi::fine_stampa()
{
// stampa totale soggetti a fine stampa
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
if (_totale > 0)
set_footer(3,"TOTALE SOGGETTI SBLOCCATI %d", _totale);
else
set_footer(3,"NON CI SONO SOGGETTI SOSPESI DA SBLOCCARE");
printer().formfeed();
reset_footer();
}
void TSbloccoSospesi::footer_sezione()
{
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TSbloccoSospesi::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TSbloccoSospesi::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
const TString16 stato = recsog.get(SOG_STATO);
const TString16 statosi = recsog.get(SOG_STATOSI);
const TString16 statoaf = recsog.get(SOG_STATOAF);
const TDate datafine = recsog.get_date(SOG_DATA_PROS);
TDate datafinesi(NULLDATE);
TDate datafineaf(NULLDATE);
if (statosi == "SO")
datafinesi = recsog.get_date(SOG_FINESOSSI);
if (statoaf == "SO")
datafineaf = recsog.get_date(SOG_FINESOSAF);
TString80 operazione = "";
if (stato == "SO" && datafine.ok() && datafine <= app()._data_sblocco)
operazione << "-- -- -- SO FS";
else
if (statosi == "SO" && datafinesi.ok() && datafinesi <= app()._data_sblocco)
operazione << "SI SO ID";
else
if (statoaf == "SO" && datafineaf.ok() && datafineaf <= app()._data_sblocco)
operazione << "AF SO ID";
_operazione = operazione;
if (_definitiva)
{
TRectype* key = new TRectype(LF_CONTSAN);
long codice = recsog.get_long(SOG_CODICE);
key->put(CON_CODICE, codice);
int err = _scontrolli->read(key);
int progcon = _scontrolli->rows()+1;
TRectype& reccon = _contsan->curr();
reccon.zero();
reccon.put(CON_CODICE, codice);
reccon.put(CON_PROGCON, progcon);
reccon.put(CON_DATACON, _data_stampa);
reccon.put(CON_TIPOCON, FINE_SOSPENSIONE);
_scontrolli->add_row(reccon);
_scontrolli->rewrite();
con_reord(recsog, _scontrolli);
current_cursor()->file().rewrite();
}
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if ((_codsez != "**") && (_contatore > 0))
footer_sezione();
_contatore = 0;
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
_contatore++;
_totale++;
return TRUE;
}
void TSbloccoSospesi::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g#a", &_cognome_nome);
set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@57g@ld", FLD(LF_SOGGETTI,SOG_DATASTATO));
set_row(1,"@68g@ld", FLD(LF_SOGGETTI,SOG_DATA_PROS));
set_row(1,"@79g#a", &_operazione);
}
bool TSbloccoSospesi::filter_func_sbloccosospesi(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& recsog = rel->lfile().curr();
const TString16 stato = recsog.get(SOG_STATO);
const TString16 statosi = recsog.get(SOG_STATOSI);
const TString16 statoaf = recsog.get(SOG_STATOAF);
const TDate datafine = recsog.get_date(SOG_DATA_PROS);
TDate datafinesi(NULLDATE);
TDate datafineaf(NULLDATE);
if (statosi == "SO")
datafinesi = recsog.get_date(SOG_FINESOSSI);
if (statoaf == "SO")
datafineaf = recsog.get_date(SOG_FINESOSAF);
filtrato = (datafine.ok()) && (datafine <= app()._data_sblocco);
if ((!filtrato) && (datafinesi.ok() || datafineaf.ok()))
filtrato = ((datafinesi.ok() && (datafinesi <= app()._data_sblocco)) || (datafineaf.ok() && (datafineaf <= app()._data_sblocco)));
/*
TRectype* key = new TRectype(LF_CONTSAN);
long codice = recsog.get_long(SOG_CODICE);
key->put(CON_CODICE, codice);
int err = app()._scontrolli->read(key);
if (err == NOERR)
{
TString16 stato = recsog.get(SOG_STATO);
TDate datastato = recsog.get(SOG_DATASTATO);
for (int r=1; r<=app()._scontrolli->rows(); r++)
{
const TRectype& riga = app()._scontrolli->row(r);
TString16 tipo = riga.get(CON_TIPOCON);
TDate datatipo = riga.get(CON_DATACON);
if (tipo == stato && datatipo == datastato)
{
TString16 prosstipo = riga.get(CON_PROSSTIPO);
if (modstato_tcs(prosstipo) == 'F')
{
TDate datafine = riga.get(CON_PROSSDATA);
filtrato = (datafine.ok()) && (datafine <= app()._data_sblocco);
}
}
}
}
*/
return filtrato;
}
void TSbloccoSospesi::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(100);
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 TSbloccoSospesi::set_print(int)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_codsez = "**";
_codsot = "**";
_data_sblocco = _msk->get(F_DATA);
_tiposo = _msk->get(F_TIPO);
_definitiva = _msk->get_bool(F_DEFINITIVA);
_contatore = 0;
_totale = 0;
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
// filtro per tipo sospensione
TString256 filtro = "";
if (_tiposo.not_empty())
filtro.format("((STATO == \"%s\") && (PROS_STATO == \"FS\"))",(const char*)_tiposo);
else
filtro << "((TCS->S6 == \"S\") && (PROS_STATO == \"FS\"))";
filtro << " || (STATOSI == \"SO\") || (STATOAF == \"SO\")";
current_cursor()->setfilter(filtro, TRUE);
current_cursor()->set_filterfunction(filter_func_sbloccosospesi,TRUE);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TSbloccoSospesi::crea_intestazione()
{
reset_header();
TString sep(100);
if (_definitiva)
sep = "SBLOCCO DEFINITIVO SOSPESI ";
else
sep = "STAMPA PROVVISORIA PER SBLOCCO SOSPESI ";
sep << _tiposo;
sep << " FINO ALLA DATA ";
TString16 data_stampa = _data_sblocco.string();
sep << data_stampa;
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@88g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCod.@9gC.@12gCognome e nome@38gNato il@49gTessera@57gData sosp.@68gScadenza@79gDo Da A Sogg.");
set_header(5,"@0g------@9g--@12g-------------------------@38g----------@49g-------@57g----------@68g----------@79g---------------");
printer().footerlen(3);
}
bool TSbloccoSospesi::user_create()
{
_msk = new TMask("at0700a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_contsan = new TLocalisamfile(LF_CONTSAN);
_scontrolli = new TRecord_array(LF_CONTSAN, CON_PROGCON);
return TRUE;
}
bool TSbloccoSospesi::user_destroy()
{
delete _rel;
delete _msk;
delete _contsan;
delete _scontrolli;
return TRUE;
}
int at0700(int argc, char* argv[])
{
TSbloccoSospesi a;
a.run(argc, argv, "Sblocco sospesi");
return 0;
}

15
at/at0700a.h Executable file
View File

@ -0,0 +1,15 @@
// sblocco sospesi
// 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
#define F_TIPO 110
#define F_D_TIPO 111
#define F_DEFINITIVA 112

View File

@ -1,460 +1,175 @@
#include "at0700.h"
#include "at0700a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 9 2
BEGIN
PROMPT -12 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -11 ""
END
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE
PAGE "Sezioni 1" -1 -1 78 20
PAGE "Sblocco sospesi" -1 -1 78 11
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 0 ""
FLAGS "R"
PROMPT 1 1 "Scelta sezioni/sottogruppi"
END
STRING F_CODSEZ 2
STRING F_SEZINI 2
BEGIN
PROMPT 2 1 "Cod. sezione "
FIELD CODSEZ
PROMPT 2 2 "Da "
FLAGS "U"
KEY 1
USE LF_SEZIONI
INPUT CODSEZ F_CODSEZ
INPUT CODSOT F_CODSOT
DISPLAY "Cod.sez. " CODSEZ
DISPLAY "Cod.sot. " CODSOT
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_CODSEZ CODSEZ
OUTPUT F_DENSEZ DENSEZ
OUTPUT F_CODSOT CODSOT
OUTPUT F_DENSOT DENSOT
MESSAGE COPY,1@
CHECKTYPE REQUIRED
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_CODSOT 2
STRING F_D_SEZINI 25
BEGIN
PROMPT 2 2 "Cod. sottogruppo "
FIELD CODSOT
PROMPT 11 2 ""
FLAGS "U"
KEY 1
COPY ALL F_CODSEZ
MESSAGE COPY,2@
CHECKTYPE NORMAL
WARNING "Inserire il codice della sezione"
END
STRING F_DENSEZ 25
BEGIN
PROMPT 29 1 "Denominazione sez. "
FIELD DENSEZ
KEY 2
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_DENSEZ
INPUT DENSOT F_DENSOT
INPUT DENSEZ F_D_SEZINI
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez. " CODSEZ
DISPLAY "Cod.sot. " CODSOT
COPY OUTPUT F_CODSEZ
MESSAGE COPY,3@
CHECKTYPE REQUIRED
WARNING "Inserire la denominazione della sezione"
END
STRING F_DENSOT 25
BEGIN
PROMPT 29 2 "Denominazione sot. "
FIELD DENSOT
KEY 2
COPY ALL F_DENSEZ
MESSAGE COPY,4@
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZINI
CHECKTYPE NORMAL
WARNING "Inserire la denominazione del sottogruppo"
HELP "Sezione da cui partire"
END
GROUPBOX DLG_NULL 77 7
STRING F_SOTINI 2
BEGIN
PROMPT 1 4 "Dati anagrafici"
PROMPT 2 3 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_INDIRIZZO 50
BEGIN
PROMPT 2 5 "Indirizzo "
FIELD INDIRIZZO
END
STRING F_COM 4
BEGIN
PROMPT 2 6 "Comune "
FIELD COM
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
FLAGS "U"
USE LF_COMUNI
INPUT STATO ""
INPUT COM F_COM
#include <comdcod.h>
OUTPUT F_COM COM
OUTPUT F_DENCOM DENCOM
OUTPUT F_PROVCOM PROVCOM
OUTPUT F_CAPCOM CAPCOM
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
WARNING "Comune assente"
HELP "Sottogruppo da cui partire"
END
STRING F_DENCOM 48
STRING F_SEZFIN 2
BEGIN
PROMPT 19 6 ""
USE LF_COMUNI KEY 2
INPUT DENCOM F_DENCOM
#include <comdden.h>
COPY OUTPUT F_COM
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_LOCALITA 4
STRING F_SOTFIN 2
BEGIN
PROMPT 2 7 "Localita' "
FIELD LOCALITA
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"
USE LCP SELECT S7=#F_COM
INPUT CODTAB F_LOCALITA
DISPLAY "Codice" CODTAB
DISPLAY "Localita'@30" S0
DISPLAY "CAP@5" S6
OUTPUT F_LOCALITA CODTAB
OUTPUT F_DENLOC S0
OUTPUT F_CAPCOM S6
OUTPUT F_COM S7
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 "Codice localit… postale se diversa dal comune"
HELP "Sottogruppo finale"
END
STRING F_DENLOC 30
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 19 7 ""
USE LCP KEY 2 SELECT S7=#F_COM
INPUT S0 F_DENLOC
DISPLAY "Località@30" S0
DISPLAY "CAP@5" S6
DISPLAY "Codice" CODTAB
COPY OUTPUT F_LOCALITA
CHECKTYPE NORMAL
HELP "Localit… postale se diversa dal comune"
PROMPT 1 5 "Opzioni per lo sblocco"
END
STRING F_PROVCOM 5
DATE F_DATA
BEGIN
PROMPT 71 6 ""
FLAGS "D"
PROMPT 2 6 "Scadenza fino al "
CHECKTYPE REQUIRED
HELP "Data di riferimento per la scadenza (fino al)"
END
STRING F_CAPCOM 5
STRING F_TIPO 2
BEGIN
PROMPT 67 7 "CAP "
FLAGS "D"
END
STRING F_TELEFONO 15
BEGIN
PROMPT 2 8 "Telefono "
FIELD TELEFONO
END
STRING F_FAX 15
BEGIN
PROMPT 32 8 "Fax "
FIELD FAX
END
STRING F_REFERCED 50
BEGIN
PROMPT 2 9 "Referente CED "
FIELD REFERCED
END
RADIOBUTTON F_STATO 13
BEGIN
PROMPT 1 11 "Stato"
FIELD STATO
ITEM "A|Attiva"
ITEM "E|Estinta"
END
GROUPBOX DLG_NULL 25 6
BEGIN
PROMPT 16 11 "Intestazione tessere"
END
STRING F_INTESTAZ1 20
BEGIN
PROMPT 17 12 ""
FIELD INTESTAZ1
END
STRING F_INTESTAZ2 20
BEGIN
PROMPT 17 13 ""
FIELD INTESTAZ2
END
STRING F_INTESTAZ3 20
BEGIN
PROMPT 17 14 ""
FIELD INTESTAZ3
END
STRING F_INTESTAZ4 20
BEGIN
PROMPT 17 15 ""
FIELD INTESTAZ4
END
GROUPBOX DLG_NULL 35 8
BEGIN
PROMPT 43 11 "Dati per stampa cartolina"
END
STRING F_CONVORA 20
BEGIN
PROMPT 44 12 "Orario "
FIELD CONVORA
END
STRING F_CONVSEDE1 25
BEGIN
PROMPT 44 13 "Sede "
FIELD CONVSEDE1
END
STRING F_CONVSEDE2 25
BEGIN
PROMPT 44 14 " "
FIELD CONVSEDE2
END
STRING F_CONVSEDE3 25
BEGIN
PROMPT 44 15 " "
FIELD CONVSEDE3
END
STRING F_CONVSEDE4 25
BEGIN
PROMPT 44 16 " "
FIELD CONVSEDE4
END
STRING F_CONVNOTE 25
BEGIN
PROMPT 44 17 "Note "
FIELD CONVNOTE
END
ENDPAGE
PAGE "Sezioni 2" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
STRING DLG_NULL 2
BEGIN
PROMPT 2 1 "Cod. sezione "
FLAGS "D"
GROUP 1
END
STRING DLG_NULL 2
BEGIN
PROMPT 2 2 "Cod. sottogruppo "
FLAGS "D"
GROUP 2
END
STRING DLG_NULL 25
BEGIN
PROMPT 29 1 "Denominazione sez. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 25
BEGIN
PROMPT 29 2 "Denominazione sot. "
FLAGS "D"
GROUP 4
END
GROUPBOX DLG_NULL 35 7
BEGIN
PROMPT 1 4 "Parametri convocazione"
END
NUMBER F_INTMINCONV 4
BEGIN
PROMPT 2 5 "Int. min. convoc. "
FIELD INTMINCONV
HELP "Intervallo minimo di convocazione in giorni (dall'ultima don.)"
END
NUMBER F_INTMIN 4
BEGIN
PROMPT 2 6 "Int. avvisi: min. "
FIELD INTMIN
END
NUMBER F_INTMAX 4
BEGIN
PROMPT 2 7 " max. "
FIELD INTMAX
END
LISTBOX F_TIPOCONV 11
BEGIN
PROMPT 2 8 "Tipo convocazione "
FIELD TIPOCONV
ITEM "D|Data fissa"
ITEM "G|dal Giorno"
END
DATE F_DATAULTCON
BEGIN
PROMPT 2 9 "Data ultima conv. "
FIELD DATAULTCON
FLAGS "D"
END
GROUPBOX DLG_NULL 35 7
BEGIN
PROMPT 1 11 "Parametri convocazione BO"
END
NUMBER F_GIOCARSOL 3
BEGIN
PROMPT 2 12 "Gio. tra cart. e soll. "
FIELD GIOCARSOL
HELP "Intervallo in giorni tra cartolina e primo sollecito"
END
NUMBER F_GIOSOLSOL 3
BEGIN
PROMPT 2 13 "Gio. tra soll. e soll. "
FIELD GIOSOLSOL
HELP "Intervallo in giorni tra solleciti"
END
NUMBER F_GIOULTSOL 3
BEGIN
PROMPT 2 14 "Gio. tra penult. e ult. soll. "
FIELD GIOULTSOL
HELP "Intervallo tra penultimo e ultimo sollecito"
END
NUMBER F_GIOPERRIT 3
BEGIN
PROMPT 2 15 "Gio. tra chiamate per ritard. "
FIELD GIOPERRIT
HELP "Giorni tra le chiamate per ritardatari"
END
NUMBER F_NUMMAXSOL 2
BEGIN
PROMPT 2 16 "Num. max di solleciti "
FIELD NUMMAXSOL
HELP "Numero massimo di solleciti inviabili per soggetto"
END
GROUPBOX DLG_NULL 41 8
BEGIN
PROMPT 37 4 "Parametri per chiusura fine anno"
END
NUMBER F_DONEMER 3
BEGIN
PROMPT 38 5 "Donazioni per passaggio a emeriti "
FIELD DONEMER
PROMPT 2 7 "Tipo sospensione "
FLAGS "U"
END
NUMBER F_INTESTI 2
BEGIN
PROMPT 38 6 "Intervallo di estinzione in anni "
FIELD INTESTI
FLAGS "U"
END
TEXT DLG_NULL
BEGIN
PROMPT 38 7 "Categorie:"
END
STRING F_CATEMER 2
BEGIN
PROMPT 39 8 "emeriti "
FIELD CATEMER
FLAGS "U"
USE CTD
INPUT CODTAB F_CATEMER
USE TCS SELECT S6="S"
INPUT CODTAB F_TIPO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CATEMER CODTAB
OUTPUT F_DESC_CATEMER S0
OUTPUT F_TIPO CODTAB
OUTPUT F_D_TIPO S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo sospensione: vuoto = tutti"
END
STRING F_DESC_CATEMER 20
STRING F_D_TIPO 30
BEGIN
PROMPT 56 8 ""
PROMPT 25 7 ""
FLAGS "D"
END
STRING F_CATESTI 2
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT 39 9 "estinti "
FIELD CATESTI
FLAGS "U"
USE CTD
INPUT CODTAB F_CATESTI
COPY DISPLAY F_CATEMER
OUTPUT F_CATESTI CODTAB
OUTPUT F_DESC_CATESTI S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
PROMPT 2 8 "Sblocco definitivo"
HELP "Se sblocco definitivo, i soggetti stampati vengono sbloccati"
END
STRING F_DESC_CATESTI 20
BEGIN
PROMPT 56 9 ""
FLAGS "D"
END
STRING F_CATCANC 2
BEGIN
PROMPT 39 10 "cancellati "
FIELD CATCANC
FLAGS "U"
USE CTD
INPUT CODTAB F_CATCANC
COPY DISPLAY F_CATEMER
OUTPUT F_CATCANC CODTAB
OUTPUT F_DESC_CATCANC S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
END
STRING F_DESC_CATCANC 20
BEGIN
PROMPT 56 10 ""
FLAGS "D"
END
ENDPAGE
ENDMASK

198
at/at0800.cpp Executable file
View File

@ -0,0 +1,198 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "at0.h"
// nomi campi maschera
#include "at0800a.h"
// nomi dei campi
#include "soggetti.h"
#include "sezioni.h"
class TSbloccoEsclusi : public TPrintapp
{
TMask* _msk;
TRelation* _rel;
int _cur;
TDate _data_sblocco; // data scadenza esclusione fino a _data_sblocco
TDate _data_stampa;
TString16 _codsez, _codsot;
bool _definitiva;
static bool filter_func_sbloccoesclusi(const TRelation* rel);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
public:
void filtra_sezioni();
void crea_intestazione();
void header_sezione(const TString16 codsez, const TString16 codsot);
TSbloccoEsclusi() : _data_sblocco(TODAY), _data_stampa(TODAY) {}
};
HIDDEN inline TSbloccoEsclusi& app() { return (TSbloccoEsclusi&) main_app(); }
void TSbloccoEsclusi::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TSbloccoEsclusi::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
if (_definitiva)
{
recsog.put(SOG_ESCLUSO, " ");
recsog.put(SOG_TERMESCL, NULLDATE);
current_cursor()->file().rewrite();
}
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
return TRUE;
}
void TSbloccoEsclusi::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@63g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
}
bool TSbloccoEsclusi::filter_func_sbloccoesclusi(const TRelation* rel)
{
TRectype& recsog = rel->lfile().curr();
TDate scadenza = recsog.get(SOG_TERMESCL);
return (scadenza.ok() && scadenza <= app()._data_sblocco);
}
void TSbloccoEsclusi::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132);
intestazione = "Sezione: ";
intestazione << codsez;
intestazione << "/";
intestazione << codsot;
intestazione << " ";
intestazione << densez;
if ((densot.ok())&& (densot.not_empty()))
{
intestazione << "/";
intestazione << densot;
}
intestazione.center_just();
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
bool TSbloccoEsclusi::set_print(int)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_codsez = "**";
_codsot = "**";
_data_sblocco = _msk->get(F_DATA);
_definitiva = _msk->get_bool(F_DEFINITIVA);
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
current_cursor()->setfilter("ESCLUSO == \"TD\"", TRUE);
current_cursor()->set_filterfunction(filter_func_sbloccoesclusi, TRUE);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TSbloccoEsclusi::crea_intestazione()
{
reset_header();
TString sep(132);
if (_definitiva)
sep = "SBLOCCO DEFINITIVO ESCLUSI ";
else
sep = "STAMPA PROVVISORIA PER SBLOCCO ESCLUSI ";
sep << " FINO ALLA DATA ";
TString16 data_stampa = _data_sblocco.string();
sep << data_stampa;
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@120g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCod.@9gC.@12gCognome e nome@38gNato il");
set_header(5,"@0g--------@9g--@12g-------------------------@38g----------");
}
bool TSbloccoEsclusi::user_create()
{
_msk = new TMask("at0800a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
return TRUE;
}
bool TSbloccoEsclusi::user_destroy()
{
delete _rel;
delete _msk;
return TRUE;
}
int at0800(int argc, char* argv[])
{
TSbloccoEsclusi a;
a.run(argc, argv, "Sblocco esclusi");
return 0;
}

13
at/at0800a.h Executable file
View File

@ -0,0 +1,13 @@
// sblocco esclusi
// 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
#define F_DEFINITIVA 110

View File

@ -1,155 +1,148 @@
#include "at0800.h"
#include "at0800a.h"
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE
PAGE "Sblocco esclusi" -1 -1 78 11
PAGE "Medici" -1 -1 78 20
GROUPBOX DLG_NULL 77 5
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 ""
FLAGS "R"
PROMPT 1 1 "Scelta sezioni/sottogruppi"
END
NUMBER F_CODMED 6
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Cod. medico "
FIELD CODMED
PROMPT 2 2 "Da "
FLAGS "U"
KEY 1
USE LF_MEDICI
INPUT CODMED F_CODMED
DISPLAY "Codice " CODMED
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
OUTPUT F_CODMED CODMED
OUTPUT F_COGNOME COGNOME
OUTPUT F_NOME NOME
CHECKTYPE REQUIRED
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_COGNOME 25
STRING F_D_SEZINI 25
BEGIN
PROMPT 2 3 "Cognome "
FIELD COGNOME
KEY 2
USE LF_MEDICI KEY 2
INPUT COGNOME F_COGNOME
INPUT NOME F_NOME
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
DISPLAY "Codice " CODMED
COPY OUTPUT F_CODMED
CHECKTYPE REQUIRED
WARNING "Inserire il cognome del medico"
END
STRING F_NOME 25
BEGIN
PROMPT 2 4 "Nome "
FIELD NOME
KEY 2
COPY ALL F_COGNOME
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 6 "Indirizzo"
END
STRING F_INDIRIZZO 50
BEGIN
PROMPT 2 7 "Indirizzo "
FIELD INDIRIZZO
END
STRING F_COM 4
BEGIN
PROMPT 2 8 "Comune "
FIELD COM
PROMPT 11 2 ""
FLAGS "U"
USE LF_COMUNI
INPUT STATO ""
INPUT COM F_COM
#include <comdcod.h>
OUTPUT F_COM COM
OUTPUT F_DENCOM DENCOM
OUTPUT F_PROVCOM PROVCOM
OUTPUT F_CAPCOM CAPCOM
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
WARNING "Comune assente"
HELP "Sezione da cui partire"
END
STRING F_DENCOM 48
STRING F_SOTINI 2
BEGIN
PROMPT 19 8 ""
USE LF_COMUNI KEY 2
INPUT DENCOM F_DENCOM
#include <comdden.h>
COPY OUTPUT F_COM
CHECKTYPE NORMAL
PROMPT 2 3 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_LOCALITA 4
BEGIN
PROMPT 2 9 "Località "
FIELD LOCALITA
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
FLAGS "U"
USE LCP SELECT S7=#F_COM
INPUT CODTAB F_LOCALITA
DISPLAY "Codice" CODTAB
DISPLAY "Località@30" S0
DISPLAY "CAP@5" S6
OUTPUT F_LOCALITA CODTAB
OUTPUT F_DENLOC S0
OUTPUT F_CAPCOM S6
OUTPUT F_COM S7
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 "Codice localit… postale se diversa dal comune"
HELP "Sottogruppo da cui partire"
END
STRING F_DENLOC 30
STRING F_SEZFIN 2
BEGIN
PROMPT 19 9 ""
USE LCP KEY 2 SELECT S7=#F_COM
INPUT S0 F_DENLOC
DISPLAY "Località@30" S0
DISPLAY "CAP@5" S6
DISPLAY "Codice" CODTAB
COPY OUTPUT F_LOCALITA
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 "Localit… postale se diversa dal comune"
HELP "Sezione finale"
END
STRING F_PROVCOM 5
STRING F_SOTFIN 2
BEGIN
PROMPT 71 8 ""
FLAGS "D"
PROMPT 41 3 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
END
STRING F_CAPCOM 5
BEGIN
PROMPT 67 9 "CAP "
FLAGS "D"
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 11 "Telefoni"
PROMPT 1 5 "Opzioni per lo sblocco"
END
STRING F_TELAMB 15
DATE F_DATA
BEGIN
PROMPT 2 12 "Ambulatorio "
FIELD TELAMB
PROMPT 2 6 "Scadenza fino al "
CHECKTYPE REQUIRED
HELP "Data di riferimento per la scadenza (fino al)"
END
STRING F_TELABI 15
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT 40 12 "Abitazione "
FIELD TELABI
PROMPT 35 6 "Sblocco definitivo"
HELP "Se sblocco definitivo, i soggetti stampati vengono sbloccati"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE

253
at/at0900.cpp Executable file
View File

@ -0,0 +1,253 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "at0.h"
#include "atlib.h"
#define ALIAS_TCS 200 // alias tabella tipi/esiti controlli sanitari
#define MODIFICA_ID "MI" // controllo per modificare idoneita' precedente
// nomi campi maschera
#include "at0900a.h"
// nomi dei campi
#include "soggetti.h"
#include "contsan.h"
#include "sezioni.h"
class TModificaIntervalli : public TPrintapp
{
TMask* _msk;
TRelation* _rel;
TLocalisamfile* _contsan;
TRecord_array* _scontrolli;
int _cur;
bool _modsi, _modaf;
int _oldsi, _oldaf, _newsi, _newaf;
TDate _data_stampa;
TString16 _codsez, _codsot;
static bool filter_func_intervalli(const TRelation* rel);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
public:
void filtra_sezioni();
void crea_intestazione();
void header_sezione(const TString16 codsez, const TString16 codsot);
TModificaIntervalli() : _data_stampa(TODAY) {}
};
HIDDEN inline TModificaIntervalli& app() { return (TModificaIntervalli&) main_app(); }
void TModificaIntervalli::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TModificaIntervalli::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
TRectype* key = new TRectype(LF_CONTSAN);
long codice = recsog.get_long(SOG_CODICE);
key->put(CON_CODICE, codice);
int err = _scontrolli->read(key);
int progcon = _scontrolli->rows()+1;
TRectype& reccon = _contsan->curr();
reccon.zero();
reccon.put(CON_CODICE, codice);
reccon.put(CON_PROGCON, progcon);
reccon.put(CON_DATACON, _data_stampa);
reccon.put(CON_TIPOCON, MODIFICA_ID);
reccon.put(CON_IDON1, recsog.get(SOG_IDON1));
reccon.put(CON_IDON2, recsog.get(SOG_IDON2));
reccon.put(CON_IDON3, recsog.get(SOG_IDON3));
reccon.put(CON_IDON4, recsog.get(SOG_IDON4));
if (_modsi)
reccon.put(CON_INTSI, _newsi);
else
reccon.put(CON_INTSI, recsog.get_int(SOG_INTSI));
if (_modaf)
reccon.put(CON_INTAF, _newaf);
else
reccon.put(CON_INTAF, recsog.get_int(SOG_INTAF));
_scontrolli->add_row(reccon);
_scontrolli->rewrite();
con_reord(recsog, _scontrolli);
current_cursor()->file().rewrite();
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
return TRUE;
}
void TModificaIntervalli::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@63g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
}
bool TModificaIntervalli::filter_func_intervalli(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& recsog = rel->lfile().curr();
if (app()._modsi)
filtrato = (app()._oldsi == recsog.get_int(SOG_INTSI));
if (app()._modaf && !filtrato)
filtrato = (app()._oldaf == recsog.get_int(SOG_INTAF));
return filtrato;
}
void TModificaIntervalli::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132);
intestazione = "Sezione: ";
intestazione << codsez;
intestazione << "/";
intestazione << codsot;
intestazione << " ";
intestazione << densez;
if ((densot.ok())&& (densot.not_empty()))
{
intestazione << "/";
intestazione << densot;
}
intestazione.center_just();
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
bool TModificaIntervalli::set_print(int)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_codsez = "**";
_codsot = "**";
_modsi = _msk->get_bool(F_MOD_SI);
_modaf = _msk->get_bool(F_MOD_AF);
_oldsi = _msk->get_int(F_OLD_SI);
_oldaf = _msk->get_int(F_OLD_AF);
_newsi = _msk->get_int(F_NEW_SI);
_newaf = _msk->get_int(F_NEW_AF);
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
// non si puo' fare il filtro per intervalli perche' la setfilter
// non funziona bene con i campi numerici
current_cursor()->set_filterfunction(filter_func_intervalli, TRUE);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TModificaIntervalli::crea_intestazione()
{
reset_header();
TString sep(132);
sep = "MODIFICA INTERVALLI DI DONAZIONE ";
if (_modsi)
{
sep << "SI da ";
sep << _oldsi ;
sep << " a ";
sep << _newsi;
}
if (_modaf)
{
if (_modsi)
sep << " - ";
sep << "AF da ";
sep << _oldaf ;
sep << " a ";
sep << _newaf;
}
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@120g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCod.@9gC.@12gCognome e nome@38gNato il");
set_header(5,"@0g------@9g--@12g-------------------------@38g----------");
}
bool TModificaIntervalli::user_create()
{
_msk = new TMask("at0900a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_contsan = new TLocalisamfile(LF_CONTSAN);
_scontrolli = new TRecord_array(LF_CONTSAN, CON_PROGCON);
return TRUE;
}
bool TModificaIntervalli::user_destroy()
{
delete _rel;
delete _msk;
delete _contsan;
delete _scontrolli;
return TRUE;
}
int at0900(int argc, char* argv[])
{
TModificaIntervalli a;
a.run(argc, argv, "Modifica intervalli di donazione");
return 0;
}

17
at/at0900a.h Executable file
View File

@ -0,0 +1,17 @@
// modifica intervalli di donazione
// definizione campi per maschera di selezione
#define F_SEZINI 101
#define F_D_SEZINI 102
#define F_SOTINI 103
#define F_D_SOTINI 104
#define F_SEZFIN 105
#define F_D_SEZFIN 106
#define F_SOTFIN 107
#define F_D_SOTFIN 108
#define F_MOD_SI 109
#define F_OLD_SI 110
#define F_NEW_SI 111
#define F_MOD_AF 112
#define F_OLD_AF 113
#define F_NEW_AF 114

180
at/at0900a.uml Executable file
View File

@ -0,0 +1,180 @@
#include "at0900a.h"
PAGE "Modifica intervalli di donazione" -1 -1 78 11
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
INPUT CODSOT F_SOTINI
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZINI CODSEZ
OUTPUT F_D_SEZINI DENSEZ
OUTPUT F_SOTINI CODSOT
OUTPUT F_D_SOTINI DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da cui partire"
END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZINI
CHECKTYPE NORMAL
HELP "Sezione da cui partire"
END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
INPUT DENSOT F_D_SOTINI
COPY DISPLAY F_D_SEZINI
COPY OUTPUT F_D_SEZINI
CHECKTYPE NORMAL
HELP "Sottogruppo da cui partire"
END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
INPUT CODSOT F_SOTFIN
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZFIN CODSEZ
OUTPUT F_D_SEZFIN DENSEZ
OUTPUT F_SOTFIN CODSOT
OUTPUT F_D_SOTFIN DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione finale"
END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZFIN
CHECKTYPE NORMAL
HELP "Sezione finale"
END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
INPUT DENSOT F_D_SOTFIN
COPY DISPLAY F_D_SEZFIN
COPY OUTPUT F_D_SEZFIN
CHECKTYPE NORMAL
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 5 "Opzioni per la modifica"
END
BOOLEAN F_MOD_SI
BEGIN
PROMPT 2 6 "Modifica intervallo SI"
HELP "Si vuole modificare l'intervallo per la donazione SI"
MESSAGE TRUE ENABLE, 1@
MESSAGE FALSE DISABLE, 1@
END
NUMBER F_OLD_SI 3
BEGIN
PROMPT 30 6 "Vecchio "
HELP "Indicare l'intervallo di donazione SI che si vuole modificare"
GROUP 1
END
NUMBER F_NEW_SI 3
BEGIN
PROMPT 45 6 "Nuovo "
HELP "Indicare il nuovo intervallo di donazione SI"
GROUP 1
END
BOOLEAN F_MOD_AF
BEGIN
PROMPT 2 7 "Modifica intervallo AF"
HELP "Si vuole modificare l'intervallo per la donazione AF"
MESSAGE TRUE ENABLE, 2@
MESSAGE FALSE DISABLE, 2@
END
NUMBER F_OLD_AF 3
BEGIN
PROMPT 30 7 "Vecchio "
HELP "Indicare l'intervallo di donazione AF che si vuole modificare"
GROUP 2
END
NUMBER F_NEW_AF 3
BEGIN
PROMPT 45 7 "Nuovo "
HELP "Indicare il nuovo intervallo di donazione AF"
GROUP 2
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -4,7 +4,7 @@
#include "at1.h"
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
#define usage "Error - usage : %s -{0|1|2|3|4}"
int main(int argc,char** argv)
@ -24,8 +24,6 @@ int main(int argc,char** argv)
rt = at1400(argc,argv) ; break;
case 4:
rt = at1500(argc,argv) ; break;
case 5:
rt = at1600(argc,argv) ; break;
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -5,39 +5,26 @@
#include <default.url>
/* at1 -0 chiusura periodica */
/* at1 -0 proposta benemerenza */
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
/* at1 -1 attribuzione benemerenze */
/* at1 -1 attribuzione automatica benemerenze */
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"
/* at1 -2 sblocco sospesi */
/* at1 -2 elenco benemerenze attribuite */
MENUBAR MENU_BAR(2)
MENU MENU_BAR(2)
SUBMENU MENU_FILE "~File"
/* at1 -3 stampa tessere */
/* at1 -3 elenco benemerenze attribuite per gruppo aziendale */
MENUBAR MENU_BAR(3)
MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File"
/* at1 -4 modifica intervalli di donazione */
/* at1 -4 stampa di controllo benemerenze */
MENUBAR MENU_BAR(4)
MENU MENU_BAR(4)
SUBMENU MENU_FILE "~File"
/* at1 -5 sblocco esclusi */
MENUBAR MENU_BAR(5)
MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File"

View File

@ -1,56 +1,94 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <utility.h>
#include <lffiles.h>
#include "at1.h"
// nomi campi maschera
#include "at1100a.h"
// nomi dei campi
#include "soggetti.h"
#include "donaz.h"
#include "contsan.h"
#include "benem.h"
#include "storico.h"
#include "sezioni.h"
class TChiusuraPeriodica : public TPrintapp
{
static bool filter_func_chiusura(const TRelation* rel);
#include "at1.h"
#include "at1100a.h"
TMask* _msk;
TRelation* _rel;
int _cur;
TDate _data_chiusura;
TParagraph_string _operazione;
bool _definitiva;
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);
virtual TMask& get_mask() { return *_msk; }
#define ALIAS_LCP 100
#define ALIAS_TCS 200
enum ts { undefined = 0, elenco = 1, etichette = 2 };
// definizione form per etichette
class TEti_donben_form : public TForm
{
public:
void filtra_sezioni();
void crea_intestazione();
TChiusuraPeriodica() : _data_chiusura(TODAY), _operazione("",30) {}
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TEti_donben_form(): TForm() {};
TEti_donben_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TEti_donben_form() {};
};
HIDDEN inline TChiusuraPeriodica& app() { return (TChiusuraPeriodica&) main_app(); }
class TStampaDonBen : public TPrintapp
{
TRelation* _rel;
TMask* _msk;
TLocalisamfile* _benem;
TRecord_array* _sbenemerenze;
TEti_donben_form* _form_eti;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
int _numini, _numfin;
TString16 _tipoben;
bool _definitiva;
int _contatore;
int _etlarghezza, _etcolonne;
void TChiusuraPeriodica::filtra_sezioni()
static bool filter_func_donben(const TRelation* rel);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
virtual print_action postprocess_print(int file, int counter);
public:
void crea_intestazione();
void filtra_sezioni();
void header_sezione(const TString16 codsez, const TString16 codsot);
void footer_sezione();
TMask& app_mask() { return *_msk; }
TStampaDonBen() : _data_stampa(TODAY), _cognome_nome("",25) {}
};
HIDDEN inline TStampaDonBen& app() { return (TStampaDonBen&) main_app(); }
TCursor* TEti_donben_form::cursor() const { return app().current_cursor(); }
TRelation* TEti_donben_form::relation() const { return cursor()->relation(); }
print_action TStampaDonBen::postprocess_print(int file, int counter)
{
if (_tipostampa == elenco && _contatore > 0)
footer_sezione();
return NEXT_PAGE;
}
void TStampaDonBen::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
TRectype a (LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
@ -62,172 +100,329 @@ void TChiusuraPeriodica::filtra_sezioni()
current_cursor()->setregion(da, a);
}
bool TChiusuraPeriodica::preprocess_page(int file, int counter)
void TStampaDonBen::set_page(int file, int cnt)
{
_operazione = "Nulla";
TRectype& recsez = current_cursor()->curr(LF_SEZIONI);
TRectype& recsog = current_cursor()->curr();
TLocalisamfile& filesog = current_cursor()->file();
const TString16 cat_estinti = recsez.get(SEZ_CATESTI);
const TString16 cat_cancellati = recsez.get(SEZ_CATCANC);
const TString16 cat_emeriti = recsez.get(SEZ_CATEMER);
const int intesti = recsez.get_int(SEZ_INTESTI);
const int donemer = recsez.get_int(SEZ_DONEMER);
const TString16 catsog = recsog.get(SOG_CATDON);
if ((catsog==cat_estinti && cat_estinti.not_empty())
|| (catsog==cat_cancellati && cat_cancellati.not_empty()))
{
const int totdon = recsog.get_int(SOG_TOTDON);
if (totdon >= donemer && donemer != 0)
{
_operazione = "Passaggio a emeriti";
if (_definitiva)
{
recsog.put(SOG_CATDON,cat_emeriti);
filesog.rewrite();
}
}
else
{
_operazione = "Cancellato";
if (_definitiva)
filesog.remove();
}
}
else
{
TDate dataultdon = recsog.get(SOG_DATAULTDON);
if (dataultdon.ok())
{
dataultdon.addyear(intesti);
if (dataultdon < _data_chiusura)
{
_operazione = "Passaggio a estinti";
if (_definitiva)
{
recsog.put(SOG_CATDON,cat_estinti);
filesog.rewrite();
// costruzione etichette
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
}
break;
case elenco:
{
if (_definitiva)
set_row(1,"@5g#a", &_cognome_nome);
else
_operazione = "Non doveva essere filtrato: data ancora valida";
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(2,"@9g@S", FLD(LF_SOGGETTI,SOG_CODSEZ));
set_row(2,"@12g@S", FLD(LF_SOGGETTI,SOG_CODSOT));
set_row(1,"@15g#a", &_cognome_nome);
set_row(2,"@15g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@41g@pn", FLD(LF_SOGGETTI,SOG_TOTDON,"###"));
set_row(1,"@45g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(2,"@48g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON));
set_row(1,"@56g@S", FLD(LF_SOGGETTI,SOG_STATO));
set_row(1,"@59g@ld", FLD(LF_SOGGETTI,SOG_DATAPROSSI));
set_row(2,"@59g@ld", FLD(LF_SOGGETTI,SOG_DATAPROSAF));
set_row(3,"");
}
}
break;
}
}
bool TStampaDonBen::filter_func_donben(const TRelation* rel)
{
bool filtrato = TRUE;
TLocalisamfile& sog = rel->lfile();
// filtro per categorie
TAssoc_array& categorie = app()._categorie;
long codice = sog.get_long(SOG_CODICE);
if (categorie.items() != 0)
{
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
// filtro per numero donazioni
if (filtrato)
{
const int totdon = sog.get_int(SOG_TOTDON);
filtrato = ((totdon >= app()._numini) && (totdon <= app()._numfin));
}
// filtro per tipo benemerenza
if ((filtrato) && (app()._tipoben.not_empty()))
{
TLocalisamfile benem(LF_BENEM);
benem.setkey(3);
benem.zero();
benem.put(BEN_CODICE, codice);
benem.put(BEN_TIPOBEN, app()._tipoben);
int err = benem.read();
filtrato = (err != NOERR);
}
if (filtrato && app()._definitiva)
{
TRectype* key = new TRectype(LF_BENEM);
key->put(BEN_CODICE, codice);
int err = app()._sbenemerenze->read(key);
if (err == NOERR)
{
int r = app()._sbenemerenze->rows();
TRectype& rec = app()._sbenemerenze->row(r+1,TRUE);
TString16 codsez = sog.get(SOG_CODSEZ);
TString16 codsot = sog.get(SOG_CODSOT);
TString16 gruppoazie = sog.get(SOG_GRUPPOAZIE);
rec.put(BEN_TIPOBEN, app()._tipoben);
//rec.put(BEN_DATAMAT, row.get(2));
//rec.put(BEN_BONUS, row.get());
TDate oggi(TODAY);
rec.put(BEN_DATABEN, oggi);
//rec.put(BEN_DATACON, row.get());
//rec.put(BEN_RITIRATA, row.get());
rec.put(BEN_CODSEZ, codsez);
rec.put(BEN_CODSOT, codsot);
rec.put(BEN_GRUPPOAZIE, gruppoazie);
int err = app()._sbenemerenze->rewrite();
}
}
return filtrato;
}
bool TStampaDonBen::preprocess_page(int file, int counter)
{
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if ((_codsez != "**") && (_contatore > 0))
footer_sezione();
_contatore = 0;
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
else
_operazione = "Non doveva essere filtrato: data vuota";
}
if (printer().rows_left() < 4)
printer().formfeed();
_contatore++;
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
void TChiusuraPeriodica::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@65g#a", &_operazione);
}
bool TChiusuraPeriodica::filter_func_chiusura(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& recsez = rel->lfile(LF_SEZIONI).curr();
TRectype& recsog = rel->lfile().curr();
const TString16 cat_estinti = recsez.get(SEZ_CATESTI);
const TString16 cat_cancellati = recsez.get(SEZ_CATCANC);
const TString16 cat_emeriti = recsez.get(SEZ_CATEMER);
const int intesti = recsez.get_int(SEZ_INTESTI);
const TString16 catsog = recsog.get(SOG_CATDON);
filtrato = ((catsog == cat_estinti && cat_estinti.not_empty()) ||
(catsog == cat_cancellati && cat_cancellati.not_empty()));
if (!filtrato && catsog != cat_emeriti)
{
TDate dataultdon = recsog.get(SOG_DATAULTDON);
if (dataultdon.ok())
{
dataultdon.addyear(intesti);
filtrato = (dataultdon < app()._data_chiusura);
}
}
return filtrato;
}
bool TChiusuraPeriodica::set_print(int)
void TStampaDonBen::footer_sezione()
{
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TStampaDonBen::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(80);
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 TStampaDonBen::set_print(int m)
{
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_definitiva = _msk->get_bool(F_DEFINITIVA);
_data_chiusura = _msk->get(F_DATA);
switch (tasto)
{
case F_ELENCO:
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipostampa = etichette;
break;
}
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
current_cursor()->set_filterfunction(filter_func_chiusura,TRUE);
reset_print();
crea_intestazione();
// filtro per sezioni selezionati
filtra_sezioni();
// filtro per categorie
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
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);
_numini = _msk->get_int(F_NUMINI);
_numfin = _msk->get_int(F_NUMFIN);
_tipoben = _msk->get(F_TIPOBEN);
_definitiva = _msk->get_bool(F_DEFINITIVA);
if (_definitiva)
_cognome_nome.set_width(60);
current_cursor()->set_filterfunction(filter_func_donben);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TChiusuraPeriodica::crea_intestazione()
void TStampaDonBen::crea_intestazione()
{
reset_header();
TString sep(132);
TString16 data_stampa;
reset_header();
sep.fill('-');
set_header(1, (const char *) sep);
sep = "";
sep << "Pag. @#";
sep.right_just(132);
set_header(2,(const char*) sep);
if (_definitiva)
set_header(2,"@0gCHIUSURA PERIODICA - DEFINITIVA - ALLA DATA");
else
set_header(2,"@0gCHIUSURA PERIODICA - PROVVISORIA - ALLA DATA");
data_stampa = _data_chiusura.string();
set_header(2,"@47g%10s", (const char*) data_stampa);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
if (_tipostampa == elenco)
{
if (_definitiva)
{
TString sep(80);
sep = "BENEMERENZA ";
TString80 benem = _msk->get(F_D_TIPOBEN);
sep << benem;
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
const TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@72g%s", (const char*) sep);
sep = "";
set_header(3, (const char *) sep);
}
else
{
TString sep(80);
sep = "ELENCO SOGGETTI CHE HANNO DA ";
sep << format("%i A %i DONAZIONI",_numini,_numfin);
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
const TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@72g%s", (const char*) sep);
if (_tipoben.not_empty())
{
sep = "CHE NON HANNO LA BENEMERENZA ";
sep << _tipoben;
sep << " ";
TString80 benem = _msk->get(F_D_TIPOBEN);
sep << benem;
sep.center_just();
set_header(3, "@0g%s", (const char*) sep);
}
sep = "";
sep.fill('-');
set_header(4, (const char *) sep);
set_header(5,"@0gCodice@9gCat.@15gCognome e nome@41gDon@45gData ult.@56gSt@59gData pr.SI");
set_header(6,"@0gTessera@9gSe/So@15gData di nascita@45gTipo ult.@59gData pr.AF");
set_header(7,"@0g--------@9g-----@15g-------------------------@41g---@45g----------@56g--@59g----------");
}
printer().footerlen(3);
}
}
bool TChiusuraPeriodica::user_create()
bool TStampaDonBen::user_create()
{
_msk = new TMask("at1100a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_rel = new TRelation(LF_SOGGETTI);
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_cur = add_cursor(new TCursor(_rel, "", 3));
return TRUE;
}
_msk = new TMask("at1100a");
_benem = new TLocalisamfile(LF_BENEM);
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_donben_form(etformato);
return TRUE;
}
bool TChiusuraPeriodica::user_destroy()
bool TStampaDonBen::user_destroy()
{
delete _rel;
delete _msk;
return TRUE;
delete _msk;
delete _rel;
delete _form_eti;
delete _benem;
delete _sbenemerenze;
return TRUE;
}
int at1100(int argc, char* argv[])
{
TChiusuraPeriodica a;
a.run(argc, argv, "Chiusura periodica");
return 0;
}
TStampaDonBen a;
a.run(argc, argv, "Proposta benemerenza");
return 0;
}

View File

@ -1,4 +1,4 @@
// chiusura periodica
// stampa elenco soggetti per numero donazioni e benemerenze
// definizione campi per maschera di selezione
#define F_SEZINI 101
@ -9,5 +9,25 @@
#define F_D_SEZFIN 106
#define F_SOTFIN 107
#define F_D_SOTFIN 108
#define F_DATA 109
#define F_DEFINITIVA 110
#define F_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_NUMINI 301
#define F_NUMFIN 302
#define F_TIPOBEN 303
#define F_D_TIPOBEN 304
#define F_DEFINITIVA 305
#define F_ELENCO 401
#define F_ETICHETTE 402

View File

@ -1,6 +1,6 @@
#include "at1100a.h"
PAGE "Chiusura Periodica" -1 -1 78 12
PAGE "Stampa soggetti proposti per benemerenze" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
@ -117,32 +117,195 @@ BEGIN
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 3
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 6 "Opzioni per la chiusura"
PROMPT 1 5 "Categorie"
END
DATE F_DATA
STRING F_CAT1 2
BEGIN
PROMPT 2 7 "Data di riferimento "
CHECKTYPE REQUIRED
HELP "Data di riferimento per i conteggi di chiusura"
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 8 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 8 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 10 "Selezioni per la stampa"
END
NUMBER F_NUMINI 3
BEGIN
PROMPT 2 11 "Numero donazioni effettuate: da "
END
NUMBER F_NUMFIN 3
BEGIN
PROMPT 40 11 "a "
END
STRING F_TIPOBEN 2
BEGIN
PROMPT 2 12 "Benemerenza non ricevuta "
FLAGS "U"
USE BNZ
INPUT CODTAB F_TIPOBEN
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_TIPOBEN CODTAB
OUTPUT F_D_TIPOBEN S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo benemerenza"
END
STRING F_D_TIPOBEN 30
BEGIN
PROMPT 40 12 ""
FLAGS "D"
END
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT 43 7 "Chiusura definitiva"
HELP "Se chiusura definitiva, le operazioni stampate verranno registrate"
PROMPT 2 13 "Attribuzione definitiva"
END
BUTTON DLG_OK 9 2
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT -12 10 ""
PROMPT 1 15 "Stampa"
END
BUTTON F_ELENCO 9 2
BEGIN
PROMPT -13 16 "Elenco"
MESSAGE EXIT,F_ELENCO
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -23 16 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 10 ""
PROMPT -33 16 ""
END
ENDPAGE
ENDMASK

View File

@ -4,7 +4,6 @@
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "at1.h"
@ -15,7 +14,9 @@
#include "soggetti.h"
#include "donaz.h"
#include "benem.h"
#include "sezioni.h"
#include "sezioni.h"
#define ALIAS_GAZ 300
class TAttribuzioneBenemerenze : public TPrintapp
{
@ -25,13 +26,17 @@ class TAttribuzioneBenemerenze : public TPrintapp
TLocalisamfile* _benem;
TRecord_array* _sdonazioni;
TRecord_array* _sbenemerenze;
int _cur;
TDate _data_attribuzione; // data attribuzione benemerenza
TDate _data_stampa;
TAssoc_array _catdon;
TString16 _gruppoazie, _gruppoold;
TDate _dataela, _datapre;
bool _anchegruppi;
TString16 _tipoben; // tipo benemerenza da assegnare
bool _definitiva;
int _numdon; // numero donazioni necessarie
TDate _data_stampa;
TString16 _codsez, _codsot;
TParagraph_string _cognome_nome;
int _contatore;
static bool filter_func_attriben(const TRelation* rel);
@ -43,33 +48,13 @@ protected:
virtual bool preprocess_page(int file, int counter);
public:
void filtra_sezioni();
void crea_intestazione();
void header_sezione(const TString16 codsez, const TString16 codsot);
TAttribuzioneBenemerenze() : _data_attribuzione(TODAY), _data_stampa(TODAY), _tipoben(""), _cognome_nome("",25) {}
TAttribuzioneBenemerenze() : _data_stampa(TODAY), _cognome_nome("",25) {}
};
HIDDEN inline TAttribuzioneBenemerenze& app() { return (TAttribuzioneBenemerenze&) main_app(); }
void TAttribuzioneBenemerenze::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TAttribuzioneBenemerenze::preprocess_page(int file, int counter)
{
TRectype& recsez = current_cursor()->curr(LF_SEZIONI);
@ -151,18 +136,64 @@ bool TAttribuzioneBenemerenze::set_print(int)
if (tasto == K_ENTER)
{
_codsez = "**";
_codsot = "**";
_data_attribuzione = _msk->get(F_DATA);
_codsot = "**";
_gruppoold = "**";
_contatore = 0;
TString80 chiave = "";
_dataela = _msk->get(F_DATAELA);
_datapre = _msk->get(F_DATAPRE);
_gruppoazie = _msk->get(F_GRUPPOAZIE);
_anchegruppi = _msk->get_bool(F_ANCHEGRUPPI);
_tipoben = _msk->get(F_TIPOBEN);
TTable bnz("BNZ");
bnz.put("CODTAB",(const char*) _tipoben);
if (bnz.read() == NOERR)
_numdon = bnz.get_int("I0");
_definitiva = _msk->get_bool(F_DEFINITIVA);
if (_gruppoazie.not_empty())
chiave << "90->GRUPPOAZIE|UPPER(90->COGNOME)|UPPER(90->NOME)";
else
return FALSE;
chiave = "90->CODSEZ|90->CODSOT|UPPER(90->COGNOME)|UPPER(90->NOME)";
TString80 filtro = "";
if (_gruppoazie.not_empty())
filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
else
if (!_anchegruppi)
filtro.format("(90->GRUPPOAZIE == \"\")");
// filtro per sezioni
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
current_cursor()->setfilter(filtro, TRUE);
((TSorted_cursor*)current_cursor())->change_order(chiave);
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_catdon.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_catdon.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_catdon.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_catdon.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_catdon.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_catdon.add((const char*) catses);
current_cursor()->setfilter("TOTDON!=0");
current_cursor()->set_filterfunction(filter_func_attriben,TRUE);
reset_print();
@ -173,7 +204,6 @@ bool TAttribuzioneBenemerenze::set_print(int)
return FALSE;
}
void TAttribuzioneBenemerenze::crea_intestazione()
{
reset_header();
@ -185,7 +215,7 @@ void TAttribuzioneBenemerenze::crea_intestazione()
sep << " ";
sep << descr;
sep << " ALLA DATA ";
TString16 data_stampa = _data_attribuzione.string();
TString16 data_stampa = _dataela.string();
sep << data_stampa;
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
@ -207,8 +237,8 @@ bool TAttribuzioneBenemerenze::user_create()
_msk = new TMask("at1200a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,0,ALIAS_GAZ);
add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ","",3));
_donaz = new TLocalisamfile(LF_DONAZ);
_benem = new TLocalisamfile(LF_BENEM);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);

View File

@ -1,14 +1,33 @@
// attribuzione benemerenze
// 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
#define F_TIPOBEN 110
#define F_D_TIPOBEN 111
#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_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_DATAELA 109
#define F_DATAPRE 110
#define F_GRUPPOAZIE 111
#define F_D_GRUPPOAZIE 112
#define F_ANCHEGRUPPI 113
#define F_TIPOBEN 114
#define F_D_TIPOBEN 115
#define F_DEFINITIVA 116

View File

@ -1,15 +1,28 @@
#include "at1200a.h"
PAGE "Attribuzione benemerenze" -1 -1 78 10
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE // FINE TOOLBAR
PAGE "Attribuzione benemerenze" -1 -1 78 18
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
PROMPT 1 0 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
PROMPT 2 1 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
@ -28,7 +41,7 @@ END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
PROMPT 11 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
@ -43,7 +56,7 @@ END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
PROMPT 2 2 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
@ -51,7 +64,7 @@ END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
PROMPT 11 2 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
@ -64,7 +77,7 @@ END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
PROMPT 41 1 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
@ -83,7 +96,7 @@ END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
PROMPT 49 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
@ -98,7 +111,7 @@ END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
PROMPT 41 2 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
@ -106,7 +119,7 @@ END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
PROMPT 49 2 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
@ -117,16 +130,187 @@ BEGIN
HELP "Sottogruppo finale"
END
DATE F_DATA
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 2 5 "Data attribuzione "
PROMPT 1 4 "Categorie donatori"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 5 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 5 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 8
BEGIN
PROMPT 1 9 "Opzioni per l'attribuzione"
END
DATE F_DATAELA
BEGIN
PROMPT 2 10 "Data elaborazione "
CHECKTYPE REQUIRED
HELP "Data di riferimento per l'attribuzione delle benemerenze"
END
DATE F_DATAPRE
BEGIN
PROMPT 2 11 "Data prevista consegna "
HELP "Data di prevista consegna"
END
STRING F_GRUPPOAZIE 4
BEGIN
PROMPT 2 12 "Gruppo az. che attribuisce "
FLAGS "U"
USE GAZ
INPUT CODTAB F_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_GRUPPOAZIE CODTAB
OUTPUT F_D_GRUPPOAZIE S0
CHECKTYPE NORMAL
WARNING "Codice gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
STRING F_D_GRUPPOAZIE 30
BEGIN
PROMPT 37 12 ""
FLAGS "U"
USE GAZ KEY 2
INPUT S0 F_D_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
COPY OUTPUT F_GRUPPOAZIE
CHECKTYPE NORMAL
WARNING "Gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
BOOLEAN F_ANCHEGRUPPI
BEGIN
PROMPT 2 13 "Includi soggetti appartenenti a gruppi aziendali"
END
STRING F_TIPOBEN 2
BEGIN
PROMPT 2 6 "Benemerenza "
PROMPT 2 14 "Benemerenza da attribuire "
FLAGS "U"
USE BNZ
INPUT CODTAB F_TIPOBEN
@ -142,18 +326,14 @@ END
STRING F_D_TIPOBEN 25
BEGIN
PROMPT 26 6 ""
PROMPT 35 14 ""
FLAGS "D"
END
BUTTON DLG_OK 9 2
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
PROMPT 2 15 "Attribuzione definitiva"
HELP "Se attribuzione definitiva, le benemerenze stampate verranno registrate"
END
ENDPAGE

View File

@ -1,286 +1,217 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "benem.h"
#include "soggetti.h"
#include "sezioni.h"
#include <comuni.h>
#include "at1.h"
#include "atlib.h"
#define ALIAS_TCS 200
#define FINE_SOSPENSIONE "FS"
// nomi campi maschera
#include "at1300a.h"
// nomi dei campi
#include "soggetti.h"
#include "contsan.h"
#include "sezioni.h"
class TSbloccoSospesi : public TPrintapp
#define ALIAS_BNZ 600
#define ALIAS_LCPRES 101 // localita' postale di residenza
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
#define ALIAS_COMRES 502 // comune di residenza
#define ALIAS_COMDOM 501 // comune di domicilio
#define ALIAS_COMNAS 500 // comune di nascita
class TStampaBenemerenze : public TPrintapp
{
TMask* _msk;
TRelation* _rel;
TLocalisamfile* _contsan;
TRecord_array* _scontrolli;
int _cur;
TDate _data_sblocco; // data scadenza sospensione fino a _data_sblocco
TDate _data_stampa;
TString16 _tiposo; // tipo sospesione da sbloccare
TString16 _codsez, _codsot;
bool _definitiva;
TParagraph_string _cognome_nome;
TString16 _finesospensione;
static bool filter_func_sbloccosospesi(const TRelation* rel);
TRelation* _rel;
TMask* _msk;
int _counter;
int _cur;
TDate _dataini, _datafin;
TString16 _codsez, _codsot;
bool _stampa80;
TParagraph_string _cognome_nome, _dencom;
TString16 _tipoold;
int _contatore;
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);
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);
virtual print_action postprocess_print(int file, int counter);
public:
void filtra_sezioni();
void crea_intestazione();
void header_sezione(const TString16 codsez, const TString16 codsot);
TSbloccoSospesi() : _data_sblocco(TODAY), _data_stampa(TODAY), _tiposo(""), _cognome_nome("",25) {}
void header_ben(const TString16 tipoben);
void footer_ben();
TMask& app_mask() { return *_msk; }
TStampaBenemerenze() : _cognome_nome("",35), _dencom("",50) {}
};
HIDDEN inline TSbloccoSospesi& app() { return (TSbloccoSospesi&) main_app(); }
HIDDEN inline TStampaBenemerenze& app() { return (TStampaBenemerenze&) main_app(); }
HIDDEN bool printer_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
if (!m.query_mode())
{
TString16 config;
config << "SBLOCCOSO";
TPrinter& p = printer();
p.set_printtype(normprinter); // Force configuration update
p.read_configuration(config);
if (p.set())
f.message_box("Stampante configurata per sblocco sospesi");
}
}
return TRUE;
print_action TStampaBenemerenze::postprocess_print(int file, int counter)
{
if (_contatore > 0)
footer_ben();
return NEXT_PAGE;
}
void TSbloccoSospesi::filtra_sezioni()
void TStampaBenemerenze::footer_ben()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
bool TSbloccoSospesi::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
if (_definitiva)
{
TRectype* key = new TRectype(LF_CONTSAN);
long codice = recsog.get_long(SOG_CODICE);
key->put(CON_CODICE, codice);
int err = _scontrolli->read(key);
int progcon = _scontrolli->rows()+1;
TRectype& reccon = _contsan->curr();
reccon.zero();
reccon.put(CON_CODICE, codice);
reccon.put(CON_PROGCON, progcon);
reccon.put(CON_DATACON, _data_stampa);
reccon.put(CON_TIPOCON, FINE_SOSPENSIONE);
_scontrolli->add_row(reccon);
_scontrolli->rewrite();
con_reord(recsog, _scontrolli);
current_cursor()->file().rewrite();
}
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
return TRUE;
// stampa totale benemerenze
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TSbloccoSospesi::set_page(int file, int cnt)
{
void TStampaBenemerenze::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g#a", &_cognome_nome);
set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@57g@S", FLD(LF_SOGGETTI,SOG_PROS_STATO));
set_row(1,"@68g@S", FLD(LF_SOGGETTI,SOG_STATO));
set_row(1,"@80g@ld", FLD(LF_SOGGETTI,SOG_DATA_PROS));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
}
bool TSbloccoSospesi::filter_func_sbloccosospesi(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& recsog = rel->lfile().curr();
TRectype* key = new TRectype(LF_CONTSAN);
long codice = recsog.get_long(SOG_CODICE);
key->put(CON_CODICE, codice);
int err = app()._scontrolli->read(key);
if (err == NOERR)
{
TString16 stato = recsog.get(SOG_STATO);
TDate datastato = recsog.get(SOG_DATASTATO);
for (int r=1; r<=app()._scontrolli->rows(); r++)
{
const TRectype& riga = app()._scontrolli->row(r);
TString16 tipo = riga.get(CON_TIPOCON);
TDate datatipo = riga.get(CON_DATACON);
if (tipo == stato && datatipo == datastato)
{
TString16 prosstipo = riga.get(CON_PROSSTIPO);
if (modstato_tcs(prosstipo) == 'F')
{
TDate datafine = riga.get(CON_PROSSDATA);
filtrato = (datafine.ok()) && (datafine <= app()._data_sblocco);
}
}
}
}
return filtrato;
}
void TSbloccoSospesi::header_sezione(const TString16 codsez, const TString16 codsot)
bool TStampaBenemerenze::preprocess_page(int file, int counter)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(100);
intestazione = "Sezione: ";
intestazione << codsez;
intestazione << "/";
intestazione << codsot;
intestazione << " ";
intestazione << densez;
if ((densot.ok())&& (densot.not_empty()))
TString80 nome = current_cursor()->curr(LF_SOGGETTI).get(SOG_COGNOME);
nome << " ";
nome << current_cursor()->curr(LF_SOGGETTI).get(SOG_NOME);
_cognome_nome = nome;
TString256 localita = "";
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S6");
if (localita.not_empty() && localita.ok())
{
intestazione << "/";
intestazione << densot;
}
intestazione.center_just();
set_header(1,"@0g%s", (const char*) intestazione);
localita << " ";
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
localita << " - ";
}
else
{
localita = current_cursor()->curr(-ALIAS_COMDOM).get(COM_CAPCOM);
localita << " ";
}
localita << current_cursor()->curr(-ALIAS_COMDOM).get(COM_DENCOM);
localita.trim();
_dencom = localita;
// salto pagina se cambio punto di rottura
TString16 tiponew = current_cursor()->curr().get(BEN_TIPOBEN);
if (tiponew != _tipoold )
{
if (_tipoold != "**")
footer_ben();
_contatore = 0;
_tipoold = tiponew;
header_ben(tiponew);
}
else
if (printer().rows_left() < 4)
printer().formfeed();
_contatore++;
return TRUE;
}
void TStampaBenemerenze::header_ben(const TString16 tipoben)
{
TString intestazione(132);
intestazione = "BENEMERENZA ";
intestazione << tipoben;
intestazione << " ";
intestazione << current_cursor()->curr(-ALIAS_BNZ).get("S0");
intestazione.center_just(132);
set_header(2,"@0g%s", (const char*) intestazione);
return;
}
bool TSbloccoSospesi::set_print(int)
{
bool TStampaBenemerenze::set_print(int m)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_codsez = "**";
_codsot = "**";
_data_sblocco = _msk->get(F_DATA);
_tiposo = _msk->get(F_TIPO);
_definitiva = _msk->get_bool(F_DEFINITIVA);
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
// filtro per tipo sospensione
if (_tiposo.not_empty())
current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)_tiposo));
else
current_cursor()->setfilter("TCS->S6 == \"S\"", TRUE);
current_cursor()->set_filterfunction(filter_func_sbloccosospesi,TRUE);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
TRectype da(LF_BENEM);
TRectype a (LF_BENEM);
if (_dataini.ok())
da.put(BEN_DATABEN, _dataini);
if (_datafin.ok())
a.put(BEN_DATABEN, _datafin);
TString80 chiave = "94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
_cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a));
TString80 filtro = "";
current_cursor()->setfilter((const char*) filtro, TRUE);
_counter = 0;
_tipoold = "**";
reset_files();
add_file(LF_BENEM);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TSbloccoSospesi::crea_intestazione()
void TStampaBenemerenze::crea_intestazione()
{
reset_header();
TString sep(100);
if (_definitiva)
sep = "SBLOCCO DEFINITIVO SOSPESI ";
else
sep = "STAMPA PROVVISORIA PER SBLOCCO SOSPESI ";
sep << _tiposo;
sep << " FINO ALLA DATA ";
TString16 data_stampa = _data_sblocco.string();
sep << data_stampa;
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@88g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCod.@9gC.@12gCognome e nome@38gNato il@49gTessera@57gStato att.@68gStato prec.@80gScadenza");
set_header(5,"@0g------@9g--@12g-------------------------@38g----------@49g-------@57g----------@68g-----------@80g----------");
reset_header();
TString sep(132);
sep = "STAMPA BENEMERENZE ATTRIBUITE dal ";
sep << _dataini;
sep << " al ";
sep << _datafin;
sep.center_just(132);
set_header(1,"@0g%s", (const char*) sep);
sep = "Pag. @#";
set_header(1, "@110g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
set_header(5,"@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
printer().footerlen(3);
}
bool TSbloccoSospesi::user_create()
bool TStampaBenemerenze::user_create()
{
_msk = new TMask("at1300a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_msk->set_handler(F_PRINTER, printer_handler);
_contsan = new TLocalisamfile(LF_CONTSAN);
_scontrolli = new TRecord_array(LF_CONTSAN, CON_PROGCON);
TString16 config;
config << "SBLOCCOSO";
printer().read_configuration(config);
return TRUE;
}
_rel = new TRelation(LF_BENEM);
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add("BNZ", "CODTAB==TIPOBEN",1,0,ALIAS_BNZ);
_rel->add("LCP", "CODTAB==RES_CODLOC",1,LF_SOGGETTI,ALIAS_LCPRES);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,LF_SOGGETTI,ALIAS_LCPDOM);
_rel->add(LF_COMUNI, "COM==RES_CODCOM",1,LF_SOGGETTI,ALIAS_COMRES);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,LF_SOGGETTI,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,LF_SOGGETTI,ALIAS_COMNAS);
_msk = new TMask("at1300a");
TConfig config(CONFIG_STUDIO);
_stampa80 = config.get_bool("Stampa80");
return TRUE;
}
bool TSbloccoSospesi::user_destroy()
bool TStampaBenemerenze::user_destroy()
{
delete _rel;
delete _msk;
delete _contsan;
delete _scontrolli;
printer().read_configuration();
return TRUE;
delete _msk;
delete _rel;
return TRUE;
}
int at1300(int argc, char* argv[])
{
TSbloccoSospesi a;
a.run(argc, argv, "Sblocco sospesi");
return 0;
}
TStampaBenemerenze a;
a.run(argc, argv, "Stampa benemerenze attribuite");
return 0;
}

View File

@ -1,16 +1,13 @@
// sblocco sospesi
// stampa di controllo benemerenze
// 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
#define F_TIPO 110
#define F_D_TIPO 111
#define F_DEFINITIVA 112
#define F_PRINTER 113
#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

View File

@ -1,15 +1,15 @@
#include "at1300a.h"
PAGE "Sblocco sospesi" -1 -1 78 11
PAGE "Stampa di controllo benemerenze" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
PROMPT 1 0 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
PROMPT 2 1 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
@ -28,7 +28,7 @@ END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
PROMPT 11 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
@ -43,7 +43,7 @@ END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
PROMPT 2 2 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
@ -51,7 +51,7 @@ END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
PROMPT 11 2 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
@ -64,7 +64,7 @@ END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
PROMPT 41 1 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
@ -83,7 +83,7 @@ END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
PROMPT 49 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
@ -98,7 +98,7 @@ END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
PROMPT 41 2 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
@ -106,7 +106,7 @@ END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
PROMPT 49 2 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
@ -117,59 +117,29 @@ BEGIN
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 5
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 1 5 "Opzioni per lo sblocco"
PROMPT 1 5 "Selezioni dati per la stampa"
END
DATE F_DATA
DATA F_DATAINI
BEGIN
PROMPT 2 6 "Scadenza fino al "
CHECKTYPE REQUIRED
HELP "Data di riferimento per la scadenza (fino al)"
PROMPT 2 6 "Benemerenze dal "
END
STRING F_TIPO 2
DATA F_DATAFIN
BEGIN
PROMPT 2 7 "Tipo sospensione "
FLAGS "U"
USE TCS SELECT S6="S"
INPUT CODTAB F_TIPO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_TIPO CODTAB
OUTPUT F_D_TIPO S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo sospensione: vuoto = tutti"
END
STRING F_D_TIPO 30
BEGIN
PROMPT 25 7 ""
FLAGS "D"
END
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT 2 8 "Sblocco definitivo"
HELP "Se sblocco definitivo, i soggetti stampati vengono sbloccati"
PROMPT 30 6 "al "
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -13 -1 ""
PROMPT -12 -1 ""
END
BUTTON F_PRINTER 19 2
BEGIN
PROMPT -23 -1 "Imposta stampante"
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 -1 ""
PROMPT -22 -1 ""
END
ENDPAGE

View File

@ -1,55 +1,36 @@
//#include <form.h>
#include <form.h>
#include <mask.h>
#include <msksheet.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "benem.h"
#include "soggetti.h"
#include "sezioni.h"
#include <comuni.h>
#include "at1.h"
#include "at1400a.h"
#define ALIAS_COMRES 300
#define ALIAS_COMNAS 400
//#define ALIAS_CTN1 500
//#define ALIAS_CTN2 600
#define ALIAS_LCP 700
#define ALIAS_CTD 800
/*
// definizione form per tessere associative
class TTessere_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TTessere_form(): TForm() {};
TTessere_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TTessere_form() {};
};
*/
class TStampaTessere : public TPrintapp
{
TRelation* _rel;
TMask* _msk;
TAssoc_array _categorie;
//TTessere_form* _form_pag;
TAssoc_array _asoggetti;
int _numdon;
bool _aggiorna;
int _cur;
TDate _data_stampa;
TString _riepilogodon;
#define ALIAS_BNZ 600
#define ALIAS_GAZ 300
static bool filter_func_auto(const TRelation* rel);
static bool filter_func_manuale(const TRelation* rel);
#define ALIAS_LCPRES 101 // localita' postale di residenza
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
#define ALIAS_COMRES 502 // comune di residenza
#define ALIAS_COMDOM 501 // comune di domicilio
#define ALIAS_COMNAS 500 // comune di nascita
class TStampaBenxGAz : public TPrintapp
{
TRelation* _rel;
TMask* _msk;
int _cur;
TDate _dataini, _datafin;
TString16 _codsez, _codsot;
bool _stampa80;
TParagraph_string _cognome_nome, _dencom;
TString16 _gruppoazie, _gruppoold, _tipoold;
int _contatore;
protected:
virtual bool user_create();
@ -57,276 +38,197 @@ protected:
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
virtual print_action postprocess_page(int file, int counter);
static void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 1);
virtual print_action postprocess_print(int file, int counter);
public:
void filtra_sezioni();
void filtra_codici();
void crea_intestazione();
void header_gruppo(const TString16 gruppo);
void footer_gruppo();
TMask& app_mask() { return *_msk; }
TStampaTessere() : _data_stampa(TODAY), _riepilogodon(50) {}
TStampaBenxGAz() : _cognome_nome("",35), _dencom("",50) {}
};
HIDDEN inline TStampaTessere& app() { return (TStampaTessere&) main_app(); }
HIDDEN inline TStampaBenxGAz& app() { return (TStampaBenxGAz&) main_app(); }
//TCursor* TTessere_form::cursor() const { return app().current_cursor(); }
//TRelation* TTessere_form::relation() const { return cursor()->relation(); }
HIDDEN bool printer_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
if (!m.query_mode())
{
TString16 config;
config << "TESSERE";
TPrinter& p = printer();
p.set_printtype(normprinter); // Force configuration update
p.read_configuration(config);
if (p.set())
f.message_box("Stampante configurata per stampa tessere");
}
}
return TRUE;
}
void TStampaTessere::add_rows_soggetti(TSheet_field& s, int count, int start)
{
if (start == 1)
s.destroy();
for (int r=start; r<start+count; r++)
TToken_string& row = s.row(r-1);
}
void TStampaTessere::filtra_codici()
{
TRectype da(LF_SOGGETTI);
TRectype a (LF_SOGGETTI);
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
long maxcod = 0;
long mincod = 99999;
for (int r=0; r < s.items(); r++)
{
TToken_string& row = s.row(r);
const long codice = row.get_long(0);
if (codice != 0)
{
if (codice > maxcod)
maxcod = codice;
if (codice < mincod)
mincod = codice;
}
}
if (mincod != 0)
da.put(SOG_CODICE, mincod);
if (maxcod != 0)
a.put(SOG_CODICE, maxcod);
current_cursor()->setregion(da, a);
}
void TStampaTessere::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
void TStampaTessere::set_page(int file, int cnt)
{
TString16 data_stampa = _data_stampa.string();
set_row(3, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSEZ));
set_row(4, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSOT));
set_row(9,"@33g%s@1j@pn", "Cod. prov.",FLD(LF_SOGGETTI,SOG_CODICE,"#########"));
set_row(12,"@37g@10ls", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(14,"@45g%10s", (const char*) data_stampa);
set_row(16,"@8g@ls@1j@ls", FLD(LF_SOGGETTI,SOG_COGNOME), FLD(LF_SOGGETTI,SOG_NOME));
set_row(18,"@8g@ls@1j@2s", FLD(-ALIAS_COMNAS,COM_DENCOM),FLD(-ALIAS_COMNAS,COM_PROVCOM));
set_row(18,"@45g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(20,"@10g@ls@1j@2s",FLD(-ALIAS_COMRES,COM_DENCOM),FLD(-ALIAS_COMRES,COM_PROVCOM));
set_row(20,"@45g@15ls", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(22,"@2g@50ls", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(24,"@10g@16ls", FLD(LF_SOGGETTI,SOG_CF));
set_row(28,"@4g@4ls", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
set_row(28,"@17g@3ls", FLD(LF_SOGGETTI,SOG_RHANTID));
set_row(28,"@30g@6ls", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
set_row(28,"@48g@3ls", FLD(LF_SOGGETTI,SOG_KELL));
set_row(28,"@58g@3ls", FLD(LF_SOGGETTI,SOG_DU));
set_row(32,"@4g@20ls", FLD(LF_SOGGETTI,SOG_DOCID));
set_row(41,"@4g#t", &_riepilogodon);
set_row(72,"");
}
bool TStampaTessere::filter_func_auto(const TRelation* rel)
{
bool filtrato = TRUE;
TLocalisamfile& sog = rel->lfile();
filtrato = !(sog.get_bool(SOG_T_STAMPATA));
if (filtrato)
filtrato = (sog.get_int(SOG_TOTDON) >= app()._numdon);
if (filtrato)
{
// filtro per categorie
TAssoc_array& categorie = app()._categorie;
if (categorie.items() != 0)
{
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
}
return filtrato;
}
bool TStampaTessere::filter_func_manuale(const TRelation* rel)
{
TLocalisamfile& sog = rel->lfile();
TAssoc_array& array_sogg = app()._asoggetti;
const char* codice = sog.get(SOG_CODICE);
return (array_sogg.is_key(codice));
}
print_action TStampaTessere::postprocess_page(int file, int counter)
{
printer().formfeed();
print_action TStampaBenxGAz::postprocess_print(int file, int counter)
{
if (_contatore > 0)
footer_gruppo();
return NEXT_PAGE;
}
bool TStampaTessere::preprocess_page(int file, int counter)
void TStampaBenxGAz::footer_gruppo()
{
TLocalisamfile& sogg = current_cursor()->file(LF_SOGGETTI);
const int totdon = sogg.get_int(SOG_TOTDON);
const TDate dataultima = sogg.get(SOG_DATAULTDON);
_riepilogodon = "";
if (totdon != 0)
{
_riepilogodon = "Donazioni effettuate fino al ";
_riepilogodon << dataultima.string();
_riepilogodon << " n.ro ";
_riepilogodon << totdon;
}
if (_aggiorna)
// stampa totale benemerenze attribuite al gruppo
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TStampaBenxGAz::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g#a", &_cognome_nome);
set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
}
bool TStampaBenxGAz::preprocess_page(int file, int counter)
{
TString80 nome = current_cursor()->curr(LF_SOGGETTI).get(SOG_COGNOME);
nome << " ";
nome << current_cursor()->curr(LF_SOGGETTI).get(SOG_NOME);
_cognome_nome = nome;
TString256 localita = "";
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S6");
if (localita.not_empty() && localita.ok())
{
sogg.put(SOG_T_STAMPATA,TRUE);
sogg.rewrite();
}
localita << " ";
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
localita << " - ";
}
else
{
localita = current_cursor()->curr(-ALIAS_COMDOM).get(COM_CAPCOM);
localita << " ";
}
localita << current_cursor()->curr(-ALIAS_COMDOM).get(COM_DENCOM);
localita.trim();
_dencom = localita;
// salto pagina se cambio punto di rottura
TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE);
if (grupponew != _gruppoold )
{
if (_gruppoold != "**")
footer_gruppo();
_contatore = 0;
_gruppoold = grupponew;
header_gruppo(grupponew);
_tipoold = "**";
}
TString16 tiponew = current_cursor()->curr().get(BEN_TIPOBEN);
if (tiponew != _tipoold)
{
TPrintrow riga;
printer().print(riga);
riga.reset();
riga.put(current_cursor()->curr(-ALIAS_BNZ).get("S0"));
_tipoold = tiponew;
if (printer().rows_left() < 3)
printer().formfeed();
printer().print(riga);
}
if (printer().rows_left() < 4)
printer().formfeed();
_contatore++;
return TRUE;
}
bool TStampaTessere::set_print(int m)
{
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
s.destroy();
s.force_update();
if (s.items()==0)
add_rows_soggetti(s,50);
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
reset_files();
add_file(LF_SOGGETTI);
_asoggetti.destroy();
for (int r=0; r < s.items(); r++)
{
TToken_string& row = s.row(r);
const long codice = row.get_long(0);
const char* scodice = row.get(0);
if (codice != 0)
_asoggetti.add(scodice);
}
if (_asoggetti.items() != 0)
{
_aggiorna = _msk->get_bool(F_AGGIORNA2);
filtra_codici();
current_cursor()->setfilter("");
current_cursor()->set_filterfunction (filter_func_manuale, TRUE);
}
else
{
filtra_sezioni();
_numdon = _msk->get_int(F_NUMDON);
_aggiorna = _msk->get_bool(F_AGGIORNA);
//const char* filtro = format("(NUM(TOTDON>=%i)) && (T_STAMPATA!=\"X\")",_numdon);
//const char* filtro = format("T_STAMPATA!=\"X\"");
//const char* filtro = format("TOTDON>=%i",_numdon);
//current_cursor()->setfilter(filtro);
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
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);
current_cursor()->set_filterfunction (filter_func_auto, TRUE);
}
reset_print();
return TRUE;
}
else
return FALSE;
}
bool TStampaTessere::user_create()
void TStampaBenxGAz::header_gruppo(const TString16 gruppo)
{
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMRES);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
//_rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
//_rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
TString intestazione(132);
intestazione = "GRUPPO AZIENDALE ";
intestazione << gruppo;
intestazione << " - ";
intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0");
intestazione.center_just(132);
set_header(2,"@0g%s", (const char*) intestazione);
return;
}
bool TStampaBenxGAz::set_print(int m)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
_gruppoazie = _msk->get(F_GRUPPOAZIE);
TRectype da(LF_BENEM);
TRectype a (LF_BENEM);
if (_dataini.ok())
da.put(BEN_DATABEN, _dataini);
if (_datafin.ok())
a.put(BEN_DATABEN, _datafin);
TString80 chiave = "90->GRUPPOAZIE|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
_cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a));
TString80 filtro = "";
if (_gruppoazie.not_empty())
filtro = format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
current_cursor()->setfilter((const char*) filtro, TRUE);
_contatore = 0;
_gruppoold = "**";
_tipoold = "**";
reset_files();
add_file(LF_BENEM);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TStampaBenxGAz::crea_intestazione()
{
reset_header();
TString sep(132);
sep = "STAMPA BENEMERENZE ATTRIBUITE dal ";
sep << _dataini;
sep << " al ";
sep << _datafin;
sep.center_just(132);
set_header(1,"@0g%s", (const char*) sep);
sep = "Pag. @#";
set_header(1, "@110g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
set_header(5,"@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
printer().footerlen(3);
}
bool TStampaBenxGAz::user_create()
{
_rel = new TRelation(LF_BENEM);
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add("BNZ", "CODTAB==TIPOBEN",1,0,ALIAS_BNZ);
_rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,LF_SOGGETTI,ALIAS_GAZ);
_rel->add("LCP", "CODTAB==RES_CODLOC",1,LF_SOGGETTI,ALIAS_LCPRES);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,LF_SOGGETTI,ALIAS_LCPDOM);
_rel->add(LF_COMUNI, "COM==RES_CODCOM",1,LF_SOGGETTI,ALIAS_COMRES);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,LF_SOGGETTI,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,LF_SOGGETTI,ALIAS_COMNAS);
_msk = new TMask("at1400a");
_msk->set_handler(F_PRINTER, printer_handler);
//_form_pag = new TTessere_form("AT_PAGIN"); // dovrà esserci PAGINE
TString16 config;
config << "TESSERE";
printer().read_configuration(config);
TConfig config(CONFIG_STUDIO);
_stampa80 = config.get_bool("Stampa80");
return TRUE;
}
bool TStampaTessere::user_destroy()
bool TStampaBenxGAz::user_destroy()
{
delete _msk;
delete _rel;
//delete _form_pag;
printer().read_configuration();
return TRUE;
}
int at1400(int argc, char* argv[])
{
TStampaTessere a;
a.run(argc, argv, "Stampa tessere associative");
TStampaBenxGAz a;
a.run(argc, argv, "Stampa ben. per gruppo aziendale");
return 0;
}

View File

@ -1,46 +1,15 @@
// stampa tessere associative
// stampa di controllo benemerenze PER GRUPPO AZIENDALE
// 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_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_NUMDON 301
#define F_AGGIORNA 302
#define F_AGGIORNA2 303
#define F_SOGGETTI 304
#define F_PRINTER 401
// pagina soggetti
#define F_S_CODICE 101
#define F_S_COGNOME 102
#define F_S_NOME 103
#define F_S_DATANASC 104
#define F_S_CODSEZ 105
#define F_S_CODSOT 106
#define F_S_CATDON 107
#define F_S_TESSAVIS 108
#define F_S_DENSEZ 211
#define F_S_DENSOT 212
#define F_S_DESC_CATDON 213
#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
#define F_GRUPPOAZIE 111
#define F_D_GRUPPOAZIE 112

View File

@ -1,35 +1,15 @@
#include "at1400a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 9 2
BEGIN
PROMPT -13 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON F_PRINTER 19 2
BEGIN
PROMPT -23 -11 "Imposta stampante"
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 -11 ""
END
ENDPAGE
PAGE "Selezione automatica" -1 -1 78 20
PAGE "Stampa benemerenze per gruppo aziendale" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
PROMPT 1 0 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
PROMPT 2 1 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
@ -48,7 +28,7 @@ END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
PROMPT 11 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
@ -63,15 +43,15 @@ END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
PROMPT 2 2 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
BEGIN
PROMPT 11 2 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
@ -84,7 +64,7 @@ END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
PROMPT 41 1 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
@ -103,7 +83,7 @@ END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
PROMPT 49 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
@ -118,15 +98,15 @@ END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
PROMPT 41 2 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
BEGIN
PROMPT 49 2 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
@ -137,318 +117,59 @@ BEGIN
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 5 "Categorie"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 8 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 8 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 1 10 "Opzioni per la stampa tessere"
END
NUMBER F_NUMDON 3
BEGIN
PROMPT 2 11 "Numero minimo di donazioni "
END
BOOLEAN F_AGGIORNA
BEGIN
PROMPT 40 11 "Aggiornare archivio soggetti"
END
ENDPAGE
PAGE "Selezione manuale" -1 -1 78 20
BOOLEAN F_AGGIORNA2
BEGIN
PROMPT 2 2 "Aggiornare archivio soggetti"
GROUP 1
END
SPREADSHEET F_SOGGETTI
BEGIN
PROMPT 2 4 "Soggetti"
ITEM "Codice@8"
ITEM "Cognome@25"
ITEM "Nome@25"
ITEM "Nato il@10"
ITEM "Sez."
ITEM "Sot."
ITEM "Cat."
ITEM "Tessera"
GROUP 1
END
ENDPAGE
ENDMASK
PAGE "Soggetto " -1 -1 78 20
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
NUMBER F_S_CODICE 8
BEGIN
PROMPT 2 1 "Codice "
FLAGS "RG"
USE LF_SOGGETTI KEY 1
INPUT CODICE F_S_CODICE
DISPLAY "Codice@8" 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
OUTPUT F_S_TESSAVIS TESSAVIS
CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_COGNOME 25
BEGIN
PROMPT 2 2 "Cognome e nome "
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@8" 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 ""
COPY ALL F_S_COGNOME
COPY OUTPUT F_S_CODICE
CHECKTYPE SEARCH
HELP "Nome del soggetto"
ADD RUN at0 -0
END
DATE F_S_DATANASC
BEGIN
PROMPT 2 3 "Nato il "
FLAGS "D"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 5 "Dati associativi"
PROMPT 1 5 "Selezioni dati per la stampa"
END
STRING F_S_CODSEZ 2
DATA F_DATAINI
BEGIN
PROMPT 2 6 "Sez. "
FLAGS "D"
PROMPT 2 6 "Benemerenze dal "
END
STRING F_S_DENSEZ 25
DATA F_DATAFIN
BEGIN
PROMPT 12 6 ""
FLAGS "D"
PROMPT 32 6 "al "
END
STRING F_S_CODSOT 2
STRING F_GRUPPOAZIE 4
BEGIN
PROMPT 40 6 "Sot. "
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
PROMPT 2 7 "Gruppo aziendale "
FLAGS "U"
USE GAZ
INPUT CODTAB F_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_GRUPPOAZIE CODTAB
OUTPUT F_D_GRUPPOAZIE S0
CHECKTYPE NORMAL
WARNING "Codice gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
STRING F_S_DENSOT 25
STRING F_D_GRUPPOAZIE 30
BEGIN
PROMPT 50 6 ""
FLAGS "D"
END
STRING F_S_CATDON 2
BEGIN
PROMPT 2 7 "Cat. "
FLAGS "D"
USE CTD
INPUT CODTAB F_S_CATDON
OUTPUT F_S_DESC_CATDON S0
PROMPT 30 7 ""
FLAGS "U"
USE GAZ KEY 2
INPUT S0 F_D_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
COPY OUTPUT F_GRUPPOAZIE
CHECKTYPE NORMAL
END
STRING F_S_TESSAVIS 10
BEGIN
PROMPT 52 7 "Tessera AVIS "
FLAGS "D"
END
STRING F_S_DESC_CATDON 25
BEGIN
PROMPT 12 7 ""
FLAGS "D"
WARNING "Gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -13 -1 ""
PROMPT -12 -1 ""
END
BUTTON DLG_CANCEL 9 2
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_DELREC 9 2
BEGIN
PROMPT -33 -1 ""
MESSAGE EXIT, K_DEL
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -1,58 +1,88 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "benem.h"
#include "donaz.h"
#include "sezioni.h"
#include <comuni.h>
#include "at1.h"
#include "atlib.h"
#define ALIAS_TCS 200 // alias tabella tipi/esiti controlli sanitari
#define MODIFICA_ID "MI" // controllo per modificare idoneita' precedente
// nomi campi maschera
#include "at1500a.h"
// nomi dei campi
#include "soggetti.h"
#include "contsan.h"
#include "sezioni.h"
class TModificaIntervalli : public TPrintapp
#define ALIAS_BNZ 600 // benemerenze
#define ALIAS_GAZ 300 // gruppi aziendale
class TControlloBenemerenze : public TPrintapp
{
TMask* _msk;
TRelation* _rel;
TLocalisamfile* _contsan;
TRecord_array* _scontrolli;
static bool filter_func_ctrlben(const TRelation* rel);
int _cur;
bool _modsi, _modaf;
int _oldsi, _oldaf, _newsi, _newaf;
TDate _data_stampa;
TRelation* _rel;
TMask* _msk;
TLocalisamfile* _benem;
TRecord_array* _sbenemerenze;
TAssoc_array _catdon;
TAssoc_array* _colonne;
TParagraph_string _cognome_nome, _benemerenza;
TDate _data_stampa;
TString16 _lettini, _lettfin;
TString16 _gruppoazie, _gruppoold;
bool _pergruppo;
int _contatore;
TString16 _codsez, _codsot;
static bool filter_func_intervalli(const TRelation* rel);
TString80 _intestazione1, _intestazione2;
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);
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);
virtual print_action postprocess_print(int file, int counter);
bool crea_colonne();
public:
void filtra_sezioni();
void dati_sezione(const TString16 codsez, const TString16 codsot);
void crea_intestazione();
void filtra_sezioni();
void header_gruppo(const TString16 gruppo);
void footer_gruppo();
void header_sezione(const TString16 codsez, const TString16 codsot);
TModificaIntervalli() : _data_stampa(TODAY) {}
void footer_sezione();
TMask& app_mask() { return *_msk; }
TControlloBenemerenze() : _data_stampa(TODAY), _cognome_nome("",25), _benemerenza("",80) {}
};
HIDDEN inline TModificaIntervalli& app() { return (TModificaIntervalli&) main_app(); }
HIDDEN inline TControlloBenemerenze& app() { return (TControlloBenemerenze&) main_app(); }
void TModificaIntervalli::filtra_sezioni()
bool TControlloBenemerenze::crea_colonne()
{
_intestazione1 = "";
_intestazione2 = "";
_colonne->destroy();
TTable bnz("BNZ");
real contatore(ZERO);
for (bnz.first(); !bnz.eof(); bnz.next())
{
real* oggetto = new real(contatore);
_colonne->add((const char*)bnz.get("CODTAB"),(TObject*)oggetto);
TString80 ben = bnz.get("S0");
const int pos = (int)contatore.integer();
TString16 ben1 = ben.mid(0,11);
TString16 ben2= ben.mid(11,11);
_intestazione1.insert(ben1,pos);
_intestazione2.insert(ben2,pos);
contatore+=12;
}
return !bnz.empty();
}
void TControlloBenemerenze::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
@ -60,7 +90,7 @@ void TModificaIntervalli::filtra_sezioni()
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
@ -71,72 +101,94 @@ void TModificaIntervalli::filtra_sezioni()
current_cursor()->setregion(da, a);
}
bool TModificaIntervalli::preprocess_page(int file, int counter)
void TControlloBenemerenze::footer_gruppo()
{
// stampa totale soggetti appartenenti al gruppo
reset_footer();
TString sep(132);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
print_action TControlloBenemerenze::postprocess_print(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
TRectype* key = new TRectype(LF_CONTSAN);
long codice = recsog.get_long(SOG_CODICE);
key->put(CON_CODICE, codice);
int err = _scontrolli->read(key);
int progcon = _scontrolli->rows()+1;
TRectype& reccon = _contsan->curr();
reccon.zero();
reccon.put(CON_CODICE, codice);
reccon.put(CON_PROGCON, progcon);
reccon.put(CON_DATACON, _data_stampa);
reccon.put(CON_TIPOCON, MODIFICA_ID);
reccon.put(CON_IDON1, recsog.get(SOG_IDON1));
reccon.put(CON_IDON2, recsog.get(SOG_IDON2));
reccon.put(CON_IDON3, recsog.get(SOG_IDON3));
reccon.put(CON_IDON4, recsog.get(SOG_IDON4));
if (_modsi)
reccon.put(CON_INTSI, _newsi);
else
reccon.put(CON_INTSI, recsog.get_int(SOG_INTSI));
if (_modaf)
reccon.put(CON_INTAF, _newaf);
else
reccon.put(CON_INTAF, recsog.get_int(SOG_INTAF));
_scontrolli->add_row(reccon);
_scontrolli->rewrite();
con_reord(recsog, _scontrolli);
current_cursor()->file().rewrite();
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
if (_contatore > 0)
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
return TRUE;
if (_pergruppo)
footer_gruppo();
else
footer_sezione();
}
return NEXT_PAGE;
}
void TModificaIntervalli::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######"));
void TControlloBenemerenze::footer_sezione()
{
// stampa totale soggetti appartenenti alla sezione
reset_footer();
TString sep(132);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TControlloBenemerenze::header_gruppo(const TString16 gruppo)
{
TString intestazione(132);
intestazione = "GRUPPO AZIENDALE ";
intestazione << gruppo;
intestazione << " - ";
intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0");
intestazione.center_just(132);
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
void TControlloBenemerenze::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(2,"@2g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@63g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@12g#a", &_cognome_nome);
set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(2,"@41g@pn", FLD(LF_SOGGETTI,SOG_TOTDON,"###"));
set_row(1,"@49g#a",&_benemerenza);
set_row(3,"");
}
bool TModificaIntervalli::filter_func_intervalli(const TRelation* rel)
bool TControlloBenemerenze::filter_func_ctrlben(const TRelation* rel)
{
bool filtrato = FALSE;
TRectype& recsog = rel->lfile().curr();
if (app()._modsi)
filtrato = (app()._oldsi == recsog.get_int(SOG_INTSI));
if (app()._modaf && !filtrato)
filtrato = (app()._oldaf == recsog.get_int(SOG_INTAF));
return filtrato;
TLocalisamfile& sog = rel->lfile();
// filtro per categorie donatori
TAssoc_array& categorie = app()._catdon;
if (categorie.items() != 0)
{
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
// se non ho selezionato categorie il soggetto va filtrato comunque
if (app()._catdon.items() == 0)
filtrato = TRUE;
// filtro per iniziale cognome
if (filtrato && (!app()._lettini.blank()) && (!app()._lettfin.blank()))
{
TString80 cognome = sog.get(SOG_COGNOME);
TString16 primalett = cognome.left(15);
if (!(primalett >= app()._lettini && primalett <= app()._lettfin))
filtrato = FALSE;
}
return filtrato;
}
void TModificaIntervalli::header_sezione(const TString16 codsez, const TString16 codsot)
void TControlloBenemerenze::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
@ -152,32 +204,133 @@ void TModificaIntervalli::header_sezione(const TString16 codsez, const TString16
intestazione << "/";
intestazione << densot;
}
intestazione.center_just();
intestazione.center_just(132);
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
bool TModificaIntervalli::set_print(int)
bool TControlloBenemerenze::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
TString80 benemerenza = "";
const long codice = recsog.get_long(SOG_CODICE);
TRectype* key = new TRectype(LF_BENEM);
key->put(BEN_CODICE,codice);
const int err = _sbenemerenze->read(key);
for (int r=1; r<=_sbenemerenze->rows(); r++)
{
const TRectype& riga = _sbenemerenze->row(r);
const TString16 tipoben = riga.get(BEN_TIPOBEN);
const TDate databen = riga.get(BEN_DATABEN);
real& colonna = (real&)_colonne->find((const char*)tipoben);
benemerenza.insert(databen.string(),colonna.integer());
}
_benemerenza = benemerenza;
// salto pagina se cambio sezione o gruppo aziendale
if (_pergruppo)
{
TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE);
if (grupponew != _gruppoold )
{
if (_gruppoold != "**")
footer_gruppo();
_contatore = 0;
_gruppoold = grupponew;
header_gruppo(grupponew);
}
}
else
{
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
footer_sezione();
_contatore = 0;
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
}
if (printer().rows_left()<2)
printer().formfeed();
_contatore++;
return TRUE;
}
bool TControlloBenemerenze::set_print(int m)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_codsez = "**";
_codsot = "**";
_modsi = _msk->get_bool(F_MOD_SI);
_modaf = _msk->get_bool(F_MOD_AF);
_oldsi = _msk->get_int(F_OLD_SI);
_oldaf = _msk->get_int(F_OLD_AF);
_newsi = _msk->get_int(F_NEW_SI);
_newaf = _msk->get_int(F_NEW_AF);
{
crea_colonne();
_codsez = "**";
_codsot = "**";
_gruppoold = "**";
_contatore = 0;
TString80 chiave = "";
_pergruppo = _msk->get_bool(F_PERGRUPPO);
if (_pergruppo)
{
_gruppoazie = _msk->get(F_GRUPPOAZIE);
if (_gruppoazie.empty())
chiave << "90->GRUPPOAZIE|";
}
else
chiave << "90->CODSEZ|90->CODSOT|";
chiave << "90->TOTDON|90->COGNOME|90->NOME";
_lettini = _msk->get(F_LETTINI);
_lettini.left(15);
_lettfin = _msk->get(F_LETTFIN);
_lettfin.left(15);
TString80 filtro = "";
if (_gruppoazie.not_empty())
filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
current_cursor()->setfilter(filtro, TRUE);
((TSorted_cursor*)current_cursor())->change_order(chiave);
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
// non si puo' fare il filtro per intervalli perche' la setfilter
// non funziona bene con i campi numerici
current_cursor()->set_filterfunction(filter_func_intervalli, TRUE);
reset_print();
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_catdon.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_catdon.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_catdon.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_catdon.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_catdon.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_catdon.add((const char*) catses);
current_cursor()->set_filterfunction (filter_func_ctrlben);
reset_print();
crea_intestazione();
return TRUE;
}
@ -185,69 +338,55 @@ bool TModificaIntervalli::set_print(int)
return FALSE;
}
void TModificaIntervalli::crea_intestazione()
void TControlloBenemerenze::crea_intestazione()
{
reset_header();
reset_header();
TString sep(132);
sep = "STAMPA DI CONTROLLO BENEMERENZE";
printer().footerlen(3);
sep.center_just(132);
set_header(2, "@0g%s", (const char*) sep);
TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@110g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
TString sep(132);
sep = "MODIFICA INTERVALLI DI DONAZIONE ";
if (_modsi)
{
sep << "SI da ";
sep << _oldsi ;
sep << " a ";
sep << _newsi;
}
if (_modaf)
{
if (_modsi)
sep << " - ";
sep << "AF da ";
sep << _oldaf ;
sep << " a ";
sep << _newaf;
}
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@120g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCod.@9gC.@12gCognome e nome@38gNato il");
set_header(5,"@0g------@9g--@12g-------------------------@38g----------");
set_header(4,"@0g Codice@9gC.@12gCognome e nome@38gData nasc.@49g%s", (const char*)_intestazione1);
set_header(5,"@0g Tessera@38gTot.don. @49g%s", (const char*)_intestazione2);
}
bool TModificaIntervalli::user_create()
bool TControlloBenemerenze::user_create()
{
_msk = new TMask("at1500a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_contsan = new TLocalisamfile(LF_CONTSAN);
_scontrolli = new TRecord_array(LF_CONTSAN, CON_PROGCON);
return TRUE;
}
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_BENEM, "CODICE==CODICE", 1);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ);
_rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,0,ALIAS_GAZ);
_benem = new TLocalisamfile(LF_BENEM);
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
_colonne = new TAssoc_array();
add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ","",3));
_msk = new TMask("at1500a");
return TRUE;
}
bool TModificaIntervalli::user_destroy()
bool TControlloBenemerenze::user_destroy()
{
delete _rel;
delete _msk;
delete _contsan;
delete _scontrolli;
return TRUE;
delete _msk;
delete _rel;
delete _colonne;
delete _benem;
delete _sbenemerenze;
return TRUE;
}
int at1500(int argc, char* argv[])
{
TModificaIntervalli a;
a.run(argc, argv, "Modifica intervalli di donazione");
return 0;
}
TControlloBenemerenze a;
a.run(argc, argv, "Stampa di controllo benemerenze");
return 0;
}

View File

@ -1,17 +1,30 @@
// modifica intervalli di donazione
// stampa di controllo benemerenze
// definizione campi per maschera di selezione
#define F_SEZINI 101
#define F_D_SEZINI 102
#define F_SOTINI 103
#define F_D_SOTINI 104
#define F_SEZFIN 105
#define F_D_SEZFIN 106
#define F_SOTFIN 107
#define F_D_SOTFIN 108
#define F_MOD_SI 109
#define F_OLD_SI 110
#define F_NEW_SI 111
#define F_MOD_AF 112
#define F_OLD_AF 113
#define F_NEW_AF 114
#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_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_PERGRUPPO 401
#define F_GRUPPOAZIE 402
#define F_D_GRUPPOAZIE 403
#define F_LETTINI 405
#define F_LETTFIN 406

View File

@ -1,15 +1,28 @@
#include "at1500a.h"
PAGE "Modifica intervalli di donazione" -1 -1 78 11
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE // FINE TOOLBAR
PAGE "Stampa di controllo benemerenze" -1 -1 78 18
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
PROMPT 1 0 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
PROMPT 2 1 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
@ -28,7 +41,7 @@ END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
PROMPT 11 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
@ -43,7 +56,7 @@ END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
PROMPT 2 2 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
@ -51,7 +64,7 @@ END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
PROMPT 11 2 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
@ -64,7 +77,7 @@ END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
PROMPT 41 1 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
@ -83,7 +96,7 @@ END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
PROMPT 49 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
@ -98,7 +111,7 @@ END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
PROMPT 41 2 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
@ -106,7 +119,7 @@ END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
PROMPT 49 2 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
@ -117,63 +130,186 @@ BEGIN
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 4 "Categorie donatori"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 5 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 5 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 5 "Opzioni per la modifica"
PROMPT 1 9 "Opzioni di stampa"
END
BOOLEAN F_MOD_SI
BOOLEAN F_PERGRUPPO
BEGIN
PROMPT 2 6 "Modifica intervallo SI"
HELP "Si vuole modificare l'intervallo per la donazione SI"
MESSAGE TRUE ENABLE, 1@
MESSAGE FALSE DISABLE, 1@
PROMPT 2 10 "Stampa per gruppo aziendale"
MESSAGE TRUE ENABLE,F_GRUPPOAZIE|ENABLE,F_D_GRUPPOAZIE
MESSAGE FALSE RESET,F_GRUPPOAZIE|RESET,F_D_GRUPPOAZIE|DISABLE,F_GRUPPOAZIE|DISABLE,F_D_GRUPPOAZIE
END
NUMBER F_OLD_SI 3
STRING F_GRUPPOAZIE 4
BEGIN
PROMPT 30 6 "Vecchio "
HELP "Indicare l'intervallo di donazione SI che si vuole modificare"
PROMPT 35 10 ""
FLAGS "U"
USE GAZ
INPUT CODTAB F_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_GRUPPOAZIE CODTAB
OUTPUT F_D_GRUPPOAZIE S0
CHECKTYPE NORMAL
WARNING "Codice gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
STRING F_D_GRUPPOAZIE 30
BEGIN
PROMPT 43 10 ""
FLAGS "U"
USE GAZ KEY 2
INPUT S0 F_D_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
COPY OUTPUT F_GRUPPOAZIE
CHECKTYPE NORMAL
WARNING "Gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
STRING F_LETTINI 15
BEGIN
PROMPT 2 11 "Selezione iniziali cognome: da "
GROUP 1
PICTURE "!!"
END
NUMBER F_NEW_SI 3
STRING F_LETTFIN 15
BEGIN
PROMPT 45 6 "Nuovo "
HELP "Indicare il nuovo intervallo di donazione SI"
PROMPT 52 11 "a "
GROUP 1
END
BOOLEAN F_MOD_AF
BEGIN
PROMPT 2 7 "Modifica intervallo AF"
HELP "Si vuole modificare l'intervallo per la donazione AF"
MESSAGE TRUE ENABLE, 2@
MESSAGE FALSE DISABLE, 2@
END
NUMBER F_OLD_AF 3
BEGIN
PROMPT 30 7 "Vecchio "
HELP "Indicare l'intervallo di donazione AF che si vuole modificare"
GROUP 2
END
NUMBER F_NEW_AF 3
BEGIN
PROMPT 45 7 "Nuovo "
HELP "Indicare il nuovo intervallo di donazione AF"
GROUP 2
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
//VALIDATE (#F_LETTINI<=#F_LETTFIN)
PICTURE "!!"
END
ENDPAGE

View File

@ -3,7 +3,7 @@
#include "at2.h"
#define usage "Error - usage : %s -[0,1,2,3,4,5,6]"
#define usage "Error - usage : %s -[0|1|2|3|4|5|6|7]"
int main(int argc, char** argv)
{
@ -26,6 +26,8 @@ int main(int argc, char** argv)
rt = at2600(argc, argv); break;
case 6:
rt = at2700(argc, argv); break;
case 7:
rt = at2800(argc, argv); break;
default:
error_box(usage, argv[0]) ; rt = 1; break;
}

View File

@ -8,6 +8,7 @@ int at2400(int argc, char* argv[]); // elenco soggetti modificati
int at2500(int argc, char* argv[]); // elenco soggetti idonei
int at2600(int argc, char* argv[]); // elenco soggetti iscritti/dimessi
int at2700(int argc, char* argv[]); // elenco soggetti per categorie
int at2800(int argc, char* argv[]); // elenco soggetti che non donano dal
#endif // __AT2_H

View File

@ -9,39 +9,38 @@
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
/* at2 -1 elenco soggetti modificati */
/* at2 -1 elenco per data di nascita */
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"
/* at2 -2 elenco esclusi */
MENUBAR MENU_BAR(2)
MENU MENU_BAR(2)
SUBMENU MENU_FILE "~File"
/* at2 -3 elenco soggetti modificati */
MENUBAR MENU_BAR(3)
MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File"
/* at2 -4 elenco idonei */
MENUBAR MENU_BAR(4)
MENU MENU_BAR(4)
SUBMENU MENU_FILE "~File"
/* at2 -5 elenco iscritti/dimessi */
MENUBAR MENU_BAR(5)
MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File"
/* at2 -6 elenco per categorie */
MENUBAR MENU_BAR(6)
MENU MENU_BAR(6)
SUBMENU MENU_FILE "~File"
/* at2 -7 elenco soggetti che non donano dal */
MENUBAR MENU_BAR(7)
MENU MENU_BAR(7)
SUBMENU MENU_FILE "~File"

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -35,11 +34,11 @@ class TStampaSospesi : public TPrintapp
TMask* _msk;
TEti_sospesi_form* _form_eti;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
int _etlarghezza, _etcolonne;
static bool filter_func_sospesi(const TRelation* rel);
@ -86,14 +85,13 @@ void TStampaSospesi::filtra_sezioni()
void TStampaSospesi::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
corpo.reset();
corpo.update();
for (int i = 0; i < corpo.height(); i++)
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
@ -137,7 +135,7 @@ bool TStampaSospesi::filter_func_sospesi(const TRelation* rel)
bool TStampaSospesi::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -156,6 +154,9 @@ bool TStampaSospesi::preprocess_page(int file, int counter)
header_sezione(codsez, codsot);
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -182,21 +183,21 @@ void TStampaSospesi::header_sezione(const TString16 codsez, const TString16 cods
bool TStampaSospesi::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -240,7 +241,7 @@ void TStampaSospesi::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "ELENCO SOSPESI";
@ -275,12 +276,14 @@ bool TStampaSospesi::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare nell'intestazione la denominazione della sezione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome e nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel,"", 3));
_msk = new TMask("at2100a");
_form_eti = new TEti_sospesi_form("AT_ETSOG");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_sospesi_form(etformato);
return TRUE;
}
@ -295,6 +298,6 @@ bool TStampaSospesi::user_destroy()
int at2100(int argc, char* argv[])
{
TStampaSospesi a;
a.run(argc, argv, "Elenco sospesi");
a.run(argc, argv, "Stampa soggetti sospesi");
return 0;
}

View File

@ -1,7 +1,6 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -37,13 +36,12 @@ class TStampaPerEta : public TPrintapp
TMask* _msk;
TEti_pereta_form* _form_eti;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome, _dencom;
TDate _data_stampa;
TDate _dataini, _datafin;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
int _etlarghezza, _etcolonne;
protected:
virtual bool user_create();
@ -88,14 +86,13 @@ void TStampaPerEta::filtra_sezioni()
void TStampaPerEta::set_page(int file, int cnt)
{
switch (_tipo_stampa)
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
corpo.reset();
corpo.update();
for (int i = 0; i < corpo.height(); i++)
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
@ -167,7 +164,7 @@ void TStampaPerEta::header_sezione(const TString16 codsez, const TString16 codso
bool TStampaPerEta::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TRectype recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -203,26 +200,29 @@ bool TStampaPerEta::preprocess_page(int file, int counter)
header_sezione(codsez, codsot);
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
bool TStampaPerEta::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -259,7 +259,7 @@ bool TStampaPerEta::set_print(int m)
void TStampaPerEta::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "ELENCO PER DATA DI NASCITA";
@ -297,11 +297,13 @@ bool TStampaPerEta::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare nell'intestazione la denominazione della sezione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome e nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_form_eti = new TEti_pereta_form("AT_ETSOG");
add_cursor(new TCursor(_rel, "", 3));
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_pereta_form(etformato);
_msk = new TMask("at2200a");
return TRUE;
}
@ -317,6 +319,6 @@ bool TStampaPerEta::user_destroy()
int at2200(int argc, char* argv[])
{
TStampaPerEta a;
a.run(argc, argv, "Elenco per data nascita");
a.run(argc, argv, "Stampa soggetti per data nascita");
return 0;
}

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -39,11 +38,11 @@ class TStampaEsclusi : public TPrintapp
TAssoc_array _categorie;
TString16 _tipoesc;
TDate _termineesc;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
int _etlarghezza, _etcolonne;
protected:
virtual bool user_create();
@ -88,14 +87,13 @@ void TStampaEsclusi::filtra_sezioni()
void TStampaEsclusi::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
corpo.reset();
corpo.update();
for (int i = 0; i < corpo.height(); i++)
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
@ -141,7 +139,7 @@ bool TStampaEsclusi::filter_func_esclusi(const TRelation * rel)
bool TStampaEsclusi::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -160,6 +158,9 @@ bool TStampaEsclusi::preprocess_page(int file, int counter)
header_sezione(codsez, codsot);
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -186,21 +187,21 @@ void TStampaEsclusi::header_sezione(const TString16 codsez, const TString16 cods
bool TStampaEsclusi::set_print(int)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -244,7 +245,7 @@ bool TStampaEsclusi::set_print(int)
void TStampaEsclusi::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(90);
sep = "ELENCO ESCLUSI";
@ -280,12 +281,14 @@ bool TStampaEsclusi::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare le denominazione della sezione nell'intestazione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at2300a");
_form_eti = new TEti_esclusi_form("AT_ETSOG");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_esclusi_form(etformato);
return TRUE;
}
@ -300,6 +303,6 @@ bool TStampaEsclusi::user_destroy()
int at2300(int argc, char* argv[])
{
TStampaEsclusi a;
a.run(argc, argv, "Elenco esclusi");
a.run(argc, argv, "Stampa soggetti esclusi");
return 0;
}

View File

@ -1,35 +1,36 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include <recarray.h>
#include "soggetti.h"
#include "donaz.h"
#include "benem.h"
#include "sezioni.h"
#include <comuni.h>
#include "at2.h"
#include "at2400a.h"
#define ALIAS_CTD 100 // categoria donatori
#define ALIAS_CTN1 110 // categoria non donatori 1
#define ALIAS_CTN2 120 // categoria non donatori 2
#define ALIAS_CTD 700 // categoria donatori
#define ALIAS_CTN1 701 // categoria non donatori 1
#define ALIAS_CTN2 702 // categoria non donatori 2
#define ALIAS_TCS 200 // tipi/esiti controlli sanitari
#define ALIAS_LDN 300 // punti di prelievo
#define ALIAS_LDN 400 // punti di prelievo
#define ALIAS_LCPRES 400 // localita' postale di residenza
#define ALIAS_LCPDOM 410 // localita' postale di domicilio
#define ALIAS_COMRES 500 // comune di residenza
#define ALIAS_COMDOM 510 // comune di domicilio
#define ALIAS_COMNAS 520 // comune di nascita
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
#define ALIAS_COMDOM 501 // comune di domicilio
#define ALIAS_COMNAS 500 // comune di nascita
enum ts { undefined = 0, elenco = 1, pagine = 2 };
#define ALIAS_BNZ 600 // benemerenze
// definizione form per pagine anagrafiche
enum ts { undefined = 0, elenco = 1, schede = 2 };
// definizione form
class TModificati_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
@ -45,13 +46,18 @@ class TStampaModificati : public TPrintapp
TRelation* _rel;
TMask* _msk;
TModificati_form* _form_pag;
TLocalisamfile* _donaz;
TLocalisamfile* _benem;
TRecord_array* _sdonazioni;
TRecord_array* _sbenemerenze;
TModificati_form* _form_sch;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome, _dencom;
TDate _data_stampa, _dataini;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
TString80 _eledon;
TString80 _eleben1,_eleben2;
protected:
virtual bool user_create();
@ -96,23 +102,16 @@ void TStampaModificati::filtra_sezioni()
void TStampaModificati::set_page(int file, int cnt)
{
switch (_tipo_stampa)
switch (_tipostampa)
{
case pagine:
case schede:
{
TPrint_section& corpo = _form_pag->get_body();
corpo.reset();
corpo.update();
for (int i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
TPrint_section& corpo = _form_sch->get_body();
corpo.update_and_print(TRUE);
force_setpage(TRUE);
}
break;
case elenco:
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
@ -124,6 +123,7 @@ void TStampaModificati::set_page(int file, int cnt)
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(3,"");
}
break;
}
@ -151,9 +151,9 @@ bool TStampaModificati::filter_func_modificati(const TRelation* rel)
bool TStampaModificati::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
TRectype& recsog = current_cursor()->curr();
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
@ -186,6 +186,27 @@ bool TStampaModificati::preprocess_page(int file, int counter)
header_sezione(codsez, codsot);
}
}
else
{
const long codice = recsog.get_long(SOG_CODICE);
TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, codice);
int err = _sdonazioni->read(key);
_eledon = "";
if (err == NOERR)
{
for (int r=_sdonazioni->rows(); r>_sdonazioni->rows()-3 && r>0; r--)
{
const TRectype& riga = _sdonazioni->row(r);
const TDate datadon = riga.get(DON_DATADON);
_eledon << datadon.string();
_eledon << " ";
_eledon << riga.get(DON_TIPODON);
_eledon << " ";
_eledon << riga.get(DON_LUOGODON);
}
}
}
return TRUE;
}
@ -212,21 +233,21 @@ void TStampaModificati::header_sezione(const TString16 codsez, const TString16 c
bool TStampaModificati::set_print(int)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsez = "**";
break;
case F_PAGINE:
_tipo_stampa = pagine;
case F_SCHEDE:
_tipostampa = schede;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -263,7 +284,7 @@ bool TStampaModificati::set_print(int)
void TStampaModificati::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "ELENCO MODIFICATI";
@ -292,21 +313,25 @@ void TStampaModificati::crea_intestazione()
bool TStampaModificati::user_create()
{
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_DONAZ, "CODICE==CODICE", 1);
_rel->add(LF_BENEM, "CODICE==CODICE", 1);
_rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
_rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LDN", "CODTAB==PUNTORACC",1,0,ALIAS_LDN);
_rel->add("LCP", "CODTAB==RES_CODLOC",1,0,ALIAS_LCPRES);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM);
_rel->add(LF_COMUNI, "COM==RES_CODCOM",1,0,ALIAS_COMRES);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add(LF_MEDICI, "CODMED==CODMED");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_form_pag = new TModificati_form("AT_PAGIN");
_donaz = new TLocalisamfile(LF_DONAZ);
_benem = new TLocalisamfile(LF_BENEM);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
add_cursor(new TCursor(_rel, "", 3));
_form_sch = new TModificati_form("AT_PAGIN");
_msk = new TMask("at2400a");
return TRUE;
}
@ -314,14 +339,18 @@ bool TStampaModificati::user_create()
bool TStampaModificati::user_destroy()
{
delete _msk;
delete _rel;
delete _form_pag;
delete _rel;
delete _donaz;
delete _benem;
delete _sdonazioni;
delete _sbenemerenze;
delete _form_sch;
return TRUE;
}
int at2400(int argc, char* argv[])
{
TStampaModificati a;
a.run(argc, argv, "Elenco soggetti modificati");
a.run(argc, argv, "Stampa soggetti modificati");
return 0;
}

View File

@ -27,4 +27,4 @@
//#define F_DATAFIN 302
#define F_ELENCO 401
#define F_PAGINE 402
#define F_SCHEDE 402

View File

@ -273,10 +273,10 @@ BEGIN
MESSAGE EXIT,F_ELENCO
END
BUTTON F_PAGINE 9 2
BUTTON F_SCHEDE 9 2
BEGIN
PROMPT -23 14 "Pagine"
MESSAGE EXIT,F_PAGINE
PROMPT -23 14 "Schede"
MESSAGE EXIT,F_SCHEDE
END
BUTTON DLG_QUIT 9 2

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -37,12 +36,11 @@ class TStampaIdonei : public TPrintapp
TAssoc_array _categorie;
TString16 _tipoidon;
TString16 _idon1, _idon2, _idon3, _idon4;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
int _etlarghezza, _etcolonne;
static bool filter_func_idonei(const TRelation* rel);
@ -89,21 +87,32 @@ void TStampaIdonei::filtra_sezioni()
void TStampaIdonei::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
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);
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
force_setpage(TRUE);
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case elenco:
@ -167,7 +176,7 @@ bool TStampaIdonei::filter_func_idonei(const TRelation * rel)
bool TStampaIdonei::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -186,6 +195,9 @@ bool TStampaIdonei::preprocess_page(int file, int counter)
header_sezione(codsez, codsot);
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -212,21 +224,21 @@ void TStampaIdonei::header_sezione(const TString16 codsez, const TString16 codso
bool TStampaIdonei::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -274,7 +286,7 @@ bool TStampaIdonei::set_print(int m)
void TStampaIdonei::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "ELENCO IDONEI";
@ -328,12 +340,15 @@ bool TStampaIdonei::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare la denominazione della sezione nell'intestazione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at2500a");
_form_eti = new TEti_idonei_form("AT_ETSOG");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_idonei_form(etformato);
return TRUE;
}
@ -348,6 +363,6 @@ bool TStampaIdonei::user_destroy()
int at2500(int argc, char* argv[])
{
TStampaIdonei a;
a.run(argc, argv, "Elenco idonei");
a.run(argc, argv, "Stampa soggetti idonei");
return 0;
}

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -35,13 +34,13 @@ class TStampaIscritti : public TPrintapp
TMask* _msk;
TEti_iscritti_form* _form_eti;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
char _tipo_iscdim; // iscritti o dimessi
TDate _dataini, _datafin;
int _etlarghezza, _etcolonne;
static bool filter_func_iscritti(const TRelation* rel);
@ -88,21 +87,32 @@ void TStampaIscritti::filtra_sezioni()
void TStampaIscritti::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
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);
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
force_setpage(TRUE);
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case elenco:
@ -148,7 +158,7 @@ bool TStampaIscritti::filter_func_iscritti(const TRelation * rel)
bool TStampaIscritti::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -167,6 +177,9 @@ bool TStampaIscritti::preprocess_page(int file, int counter)
header_sezione(codsez, codsot);
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -193,21 +206,21 @@ void TStampaIscritti::header_sezione(const TString16 codsez, const TString16 cod
bool TStampaIscritti::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -248,7 +261,7 @@ bool TStampaIscritti::set_print(int m)
void TStampaIscritti::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "ELENCO ";
@ -286,12 +299,14 @@ bool TStampaIscritti::user_create()
_rel = new TRelation(LF_SOGGETTI);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare nell'intestazione la denominazione della sezione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at2600a");
_form_eti = new TEti_iscritti_form("AT_ETSOG");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_iscritti_form(etformato);
return TRUE;
}
@ -306,6 +321,6 @@ bool TStampaIscritti::user_destroy()
int at2600(int argc, char* argv[])
{
TStampaIscritti a;
a.run(argc, argv, "Elenco iscritti/dimessi");
a.run(argc, argv, "Stampa iscritti/dimessi");
return 0;
}

View File

@ -1,19 +1,37 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include "soggetti.h"
#include "benem.h"
#include "donaz.h"
#include "sezioni.h"
#include <comuni.h>
#include "at2.h"
#include "at2700a.h"
#define ALIAS_LCP 100
#define ALIAS_TCS 200
#include "at4100b.h"
#include "at4100c.h"
enum ts { undefined = 0, elenco = 1, etichette = 2 };
#define ALIAS_CTD 700 // categoria donatori
#define ALIAS_CTN1 701 // categoria non donatori 1
#define ALIAS_CTN2 702 // categoria non donatori 2
#define ALIAS_TCS 200 // tipi/esiti controlli sanitari
#define ALIAS_LDN 400 // punti di prelievo
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
#define ALIAS_COMDOM 501 // comune di domicilio
#define ALIAS_COMNAS 500 // comune di nascita
#define ALIAS_BNZ 600 // benemerenze
#define ALIAS_GAZ 300 // gruppi aziendale
enum ts { undefined=0, sintetico=1, completo=2, schede=3, etichette=4, cartoline=5 };
// definizione form per etichette
class TEti_percat_form : public TForm
@ -35,18 +53,28 @@ class TStampaPerCategorie : public TPrintapp
TRelation* _rel;
TMask* _msk;
TLocalisamfile* _benem;
TLocalisamfile* _donaz;
TRecord_array* _sbenemerenze;
TEti_percat_form* _form_eti;
TEti_percat_form* _form_car;
TEti_percat_form* _form_sch;
TAssoc_array _catdon;
TAssoc_array _catnondon;
int _cur1;
TParagraph_string _cognome_nome, _dencom;
TParagraph_string _cognome_nome, _dencom, _benemerenza;
TString80 _rigastampa;
TDate _data_stampa;
ts _tipo_stampa;
TString16 _codsez, _codsot;
char _lettini, _lettfin;
ts _tipostampa;
TString16 _lettini, _lettfin, _capini, _capfin;
TString16 _gruppoazie, _gruppoold;
bool _pergruppo;
int _contatore;
TString16 _codsez, _codsot, _orario, _datacart;
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
bool _usomodo, _usasez;
int _etlarghezza, _etcolonne;
bool _stampa80;
protected:
virtual bool user_create();
@ -54,14 +82,20 @@ protected:
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page (int file, int counter);
virtual print_action postprocess_print(int file, int counter);
ts dati_cartolina();
public:
void dati_sezione(const TString16 codsez, const TString16 codsot);
void crea_intestazione();
void filtra_sezioni();
void header_gruppo(const TString16 gruppo);
void footer_gruppo();
void header_sezione(const TString16 codsez, const TString16 codsot);
void footer_sezione();
TMask& app_mask() { return *_msk; }
TStampaPerCategorie() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
TStampaPerCategorie() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",30), _benemerenza("",11) {}
};
HIDDEN inline TStampaPerCategorie& app() { return (TStampaPerCategorie&) main_app(); }
@ -70,6 +104,54 @@ TCursor* TEti_percat_form::cursor() const { return app().current_cursor(); }
TRelation* TEti_percat_form::relation() const { return cursor()->relation(); }
void TStampaPerCategorie::dati_sezione(const TString16 codsez, const TString16 codsot)
{
_intest1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ1);
_intest2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ2);
_intest3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ3);
_intest4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ4);
if (_usasez)
{
if (_presso1.blank())
{
_presso1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE1);
_presso2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE2);
_presso3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE3);
_presso4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE4);
}
if (_orario.blank())
_orario = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVORA);
if (_note.blank())
_note = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVNOTE);
}
return;
}
ts TStampaPerCategorie::dati_cartolina()
{
TMask msk("at4100b");
if (msk.run() == K_ENTER)
{
_invitoper = msk.get(F_INVITOPER);
_data = msk.get(F_DATA);
_presso1 = msk.get(F_PRESSO1);
_presso2 = msk.get(F_PRESSO2);
_presso3 = msk.get(F_PRESSO3);
_presso4 = msk.get(F_PRESSO4);
_datacart = msk.get(F_DATACART);
_orario = msk.get(F_ORARIO);
_note = msk.get(F_NOTE);
_usasez = msk.get_bool(F_USASEZ);
return cartoline;
}
else
return undefined;
}
void TStampaPerCategorie::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
@ -89,26 +171,141 @@ void TStampaPerCategorie::filtra_sezioni()
current_cursor()->setregion(da, a);
}
void TStampaPerCategorie::footer_gruppo()
{
// stampa totale soggetti appartenenti al gruppo
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
print_action TStampaPerCategorie::postprocess_print(int file, int counter)
{
if (_contatore > 0)
{
if (_pergruppo)
footer_gruppo();
else
footer_sezione();
}
return NEXT_PAGE;
}
void TStampaPerCategorie::footer_sezione()
{
// stampa totale soggetti appartenenti alla sezione
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(2, (const char *) sep);
set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TStampaPerCategorie::header_gruppo(const TString16 gruppo)
{
TString intestazione(132);
intestazione = "GRUPPO AZIENDALE ";
intestazione << gruppo;
intestazione << " - ";
intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0");
if (_stampa80)
intestazione.center_just(80);
else
intestazione.center_just(132);
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
void TStampaPerCategorie::set_page(int file, int cnt)
{
switch (_tipo_stampa)
switch (_tipostampa)
{
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);
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case schede:
{
TPrint_section& corpo = _form_sch->get_body();
corpo.update_and_print(TRUE);
force_setpage(TRUE);
}
break;
case elenco:
case cartoline:
{
TPrint_section& corpo = _form_car->get_body();
const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
const TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
_codsez = codsez;
_codsot = codsot;
dati_sezione(codsez, codsot);
corpo.reset();
TForm_item& intest1 = corpo.find_field(CAR_INTEST1);
intest1.set(_intest1);
TForm_item& intest2 = corpo.find_field(CAR_INTEST2);
intest2.set(_intest2);
TForm_item& intest3 = corpo.find_field(CAR_INTEST3);
intest3.set(_intest3);
TForm_item& intest4 = corpo.find_field(CAR_INTEST4);
intest4.set(_intest4);
TForm_item& invito = corpo.find_field(CAR_INVITOPER);
invito.set(_invitoper);
TForm_item& data = corpo.find_field(CAR_DATA);
data.set(_data);
TForm_item& presso1 = corpo.find_field(CAR_PRESSO1);
presso1.set(_presso1);
TForm_item& presso2 = corpo.find_field(CAR_PRESSO2);
presso2.set(_presso2);
TForm_item& presso3 = corpo.find_field(CAR_PRESSO3);
presso3.set(_presso3);
TForm_item& presso4 = corpo.find_field(CAR_PRESSO4);
presso4.set(_presso4);
TForm_item& orario = corpo.find_field(CAR_ORARIO);
orario.set(_orario);
TForm_item& datacart = corpo.find_field(CAR_DATACART);
datacart.set(_datacart);
TForm_item& note = corpo.find_field(CAR_NOTE);
note.set(_note);
}
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
}
}
break;
case sintetico:
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
@ -117,8 +314,89 @@ void TStampaPerCategorie::set_page(int file, int cnt)
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(3,"");
}
break;
case completo:
{
if (_stampa80)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@9g@S",FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(2,"@9g@S",FLD(LF_SOGGETTI,SOG_NOME));
set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(4,"@9g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(5,"@9g#a", &_dencom);
set_row(1,"@40g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(2,"@40g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(3,"@40g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(4,"@40g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAZIE));
set_row(5,"@40g@S", FLD(LF_SOGGETTI,SOG_PROFESS));
set_row(1,"@56gGr @S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
set_row(2,"@56gRh @S", FLD(LF_SOGGETTI,SOG_RHANTID));
set_row(3,"@56gFe @S", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
set_row(4,"@56gKe @S", FLD(LF_SOGGETTI,SOG_KELL));
set_row(5,"@56gDu @S", FLD(LF_SOGGETTI,SOG_DU));
set_row(1,"@66g@S", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(2,"@70g@n", FLD(LF_SOGGETTI,SOG_TOTDON));
set_row(3,"@66g@S", FLD(LF_SOGGETTI,SOG_DATAISC));
set_row(4,"@66g#a", &_benemerenza);
set_row(1,"@77g@S", FLD(LF_SOGGETTI,SOG_STATO));
set_row(2,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON1));
set_row(3,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON2));
set_row(4,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON3));
set_row(5,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON4));
set_row(6,"");
}
else
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@9g@S",FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(2,"@9g@S",FLD(LF_SOGGETTI,SOG_NOME));
set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@35g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(2,"@35g#a", &_dencom);
set_row(1,"@66g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(2,"@66g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(3,"@66g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(4,"@66g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAZIE));
set_row(5,"@66g@S", FLD(LF_SOGGETTI,SOG_PROFESS));
set_row(1,"@82gGr @S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
set_row(2,"@82gRh @S", FLD(LF_SOGGETTI,SOG_RHANTID));
set_row(3,"@82gFe @S", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
set_row(4,"@82gKe @S", FLD(LF_SOGGETTI,SOG_KELL));
set_row(5,"@82gDu @S", FLD(LF_SOGGETTI,SOG_DU));
set_row(1,"@94g@S", FLD(LF_SOGGETTI,SOG_STATO));
set_row(2,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON1));
set_row(3,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON2));
set_row(4,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON3));
set_row(5,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON4));
set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(2,"@100g@n", FLD(LF_SOGGETTI,SOG_TOTDON));
set_row(3,"@98g@S", FLD(LF_SOGGETTI,SOG_DATAISC));
set_row(4,"@98g#a", &_benemerenza);
set_row(6,"");
}
}
break;
}
@ -150,10 +428,10 @@ bool TStampaPerCategorie::filter_func_percat(const TRelation* rel)
if (app()._catdon.items() == 0 && app()._catnondon.items() == 0)
filtrato = TRUE;
// filtro per iniziale cognome
if (filtrato && (app()._lettini != ' ') && (app()._lettfin != ' '))
if (filtrato && (!app()._lettini.blank()) && (!app()._lettfin.blank()))
{
TString80 cognome = sog.get(SOG_COGNOME);
const char primalett = cognome[0];
TString16 primalett = cognome.left(15);
if (!(primalett >= app()._lettini && primalett <= app()._lettfin))
filtrato = FALSE;
}
@ -176,14 +454,17 @@ void TStampaPerCategorie::header_sezione(const TString16 codsez, const TString16
intestazione << "/";
intestazione << densot;
}
intestazione.center_just();
if (_stampa80)
intestazione.center_just(80);
else
intestazione.center_just(132);
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
bool TStampaPerCategorie::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa==sintetico||_tipostampa==completo)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -191,11 +472,11 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
TString256 localita = "";
localita << current_cursor()->curr(-ALIAS_LCP).get("S6");
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S6");
if (localita.not_empty() && localita.ok())
{
localita << " ";
localita << current_cursor()->curr(-ALIAS_LCP).get("S0");
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
localita << " - ";
}
else
@ -206,53 +487,152 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
localita.trim();
_dencom = localita;
// salto pagina se cambio sezione
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
// cerco ultima benemerenza
TString80 benemerenza = "";
const long codice = recsog.get_long(SOG_CODICE);
TRectype* key = new TRectype(LF_BENEM);
key->put(BEN_CODICE,codice);
const int err = _sbenemerenze->read(key);
if (err == NOERR)
{
const int ultima = _sbenemerenze->rows();
if (ultima != 0)
{
TString16 codben = _sbenemerenze->row(ultima).get(BEN_TIPOBEN);
TTable bnz("BNZ");
bnz.put("CODTAB",codben);
if (bnz.read() == NOERR)
benemerenza << bnz.get("S0");
}
}
benemerenza.cut(21);
_benemerenza = benemerenza;
// salto pagina se cambio sezione o gruppo aziendale
if (_pergruppo)
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE);
if (grupponew != _gruppoold )
{
if (_gruppoold != "**")
footer_gruppo();
_contatore = 0;
_gruppoold = grupponew;
header_gruppo(grupponew);
}
}
}
else
{
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
footer_sezione();
_contatore = 0;
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
}
if ((printer().rows_left()<2 && _tipostampa==sintetico) || (printer().rows_left()<6 && _tipostampa==completo))
printer().formfeed();
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
_contatore++;
return TRUE;
}
bool TStampaPerCategorie::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
case F_SINTETICO:
_tipostampa=sintetico;
break;
case F_COMPLETO:
_tipostampa=completo;
break;
case F_SCHEDE:
_tipostampa=schede;
break;
case F_ETICHETTE:
_tipostampa=etichette;
break;
case F_CARTOLINE:
_tipostampa=cartoline;
break;
}
if (_tipostampa != undefined)
{
if (_tipostampa == cartoline)
dati_cartolina();
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
break;
}
if (_tipo_stampa != undefined)
{
_gruppoold = "**";
_contatore = 0;
TString80 chiave = "";
_pergruppo = _msk->get_bool(F_PERGRUPPO);
if (_pergruppo)
{
_gruppoazie = _msk->get(F_GRUPPOAZIE);
if (_gruppoazie.empty())
chiave << "90->GRUPPOAZIE|";
}
bool percap = _msk->get_bool(F_PERCAP);
TString16 lettera;
lettera = _msk->get(F_LETTINI);
_lettini = lettera[0];
lettera = _msk->get(F_LETTFIN);
_lettfin = lettera[0];
_capini = _msk->get(F_CAPINI);
_capfin = _msk->get(F_CAPFIN);
_lettini = _msk->get(F_LETTINI);
_lettini.left(15);
_lettfin = _msk->get(F_LETTFIN);
_lettfin.left(15);
if (percap)
chiave = "13->CAPCOM|UPPER(90->COGNOME)|UPPER(90->NOME)";
chiave << "90->DOM_CAP|90->DOM_CODCOM|90->DOM_CODLOC|UPPER(90->COGNOME)|UPPER(90->NOME)";
else
chiave = "UPPER(90->COGNOME)|UPPER(90->NOME)";
_cur1 = add_cursor(new TSorted_cursor(_rel, (const char*) chiave));
TString80 filtro = "";
current_cursor()->setfilter((const char*) filtro, TRUE);
chiave << "UPPER(90->COGNOME)|UPPER(90->NOME)";
TString256 filtro = "";
if (_gruppoazie.not_empty())
filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie);
if (_capini.not_empty())
{
if (filtro.not_empty())
filtro << " && ";
filtro << format("(90->DOM_CAP >= \"%s\")",(const char*)_capini);
}
if (_capfin.not_empty())
{
if (filtro.not_empty())
filtro << " && ";
filtro << format("(90->DOM_CAP <= \"%s\")",(const char*)_capfin);
}
bool notiziario = _msk->get_bool(F_NOTIZIARIO);
if (notiziario)
{
if (filtro.not_empty())
filtro << " && ";
filtro << "(90->NOTIZIARIO == \"X\")";
}
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
current_cursor()->setfilter(filtro, TRUE);
((TSorted_cursor*)current_cursor())->change_order(chiave);
reset_files();
add_file(LF_SOGGETTI);
const TString16 catpri = _msk->get(F_CAT1);
@ -303,34 +683,94 @@ bool TStampaPerCategorie::set_print(int m)
void TStampaPerCategorie::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
{
TString sep(132);
sep = "ELENCO PER CATEGORIE";
sep.center_just();
TString sep(132);
if (_tipostampa==sintetico)
sep = "ELENCO SINTETICO PER CATEGORIE";
if (_tipostampa==completo)
sep = "ELENCO COMPLETO PER CATEGORIE";
if (_tipostampa==sintetico || _tipostampa==completo)
{
printer().footerlen(3);
if (_stampa80)
sep.center_just(80);
else
sep.center_just(132);
set_header(2, "@0g%s", (const char*) sep);
TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
set_header(2, "@120g%s", (const char*) sep);
if (_stampa80)
set_header(2, "@73g%s", (const char*) sep);
else
set_header(2, "@110g%s", (const char*) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
}
if (_tipostampa==sintetico)
{
_dencom.set_width(50);
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
set_header(5,"@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(5,"@0gTessera@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
}
}
if (_tipostampa==completo)
{
_dencom.set_width(30);
if (_stampa80)
{
set_header(4,"@0g Codice@9gCognome@40gTelefono abit.@56gTipizza@66gUlt.donaz.@77gSt.");
set_header(5,"@0g Tessera@9gNome@40gTelefono lavoro@56gzione@66gTot.donaz.@77gId.");
set_header(6,"@0g Categ.@9gData di nascita@40gTelefono altro@66gData iscr.");
set_header(7,"@9gIndirizzo@40gGruppo aziend.@66gUlt.benem.");
set_header(8,"@40gProfessione");
set_header(9,"@0g--------@9g------------------------------@40g---------------@56g---------@66g----------@77g---");
}
else
{
set_header(4,"@0g Codice@9gCognome@35gIndirizzo@66gTelefono abit.@82gTipizza@92gStato@98gUlt.donaz.");
set_header(5,"@0g Tessera@9gNome@66gTelefono lavoro@82gzione@92gIdon.@98gTot.donaz.");
set_header(6,"@0g Categ.@9gData di nascita@66gTelefono altro@98gData iscr.");
set_header(7,"@66gGruppo aziend.@98gUlt.benem.");
set_header(8,"@66gProfessione");
set_header(9,"@0g--------@9g-------------------------@35g------------------------------@66g---------------@82g---------@92g-----@98g----------");
}
}
}
bool TStampaPerCategorie::user_create()
{
_rel = new TRelation(LF_SOGGETTI);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
_rel->add(LF_DONAZ, "CODICE==CODICE", 1);
_rel->add(LF_BENEM, "CODICE==CODICE", 1);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_form_eti = new TEti_percat_form("AT_ETSOG");
_rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
_rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LDN", "CODTAB==PUNTORACC",1,0,ALIAS_LDN);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM);
_rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,0,ALIAS_GAZ);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add(LF_MEDICI, "CODMED==CODMED");
_donaz = new TLocalisamfile(LF_DONAZ);
_benem = new TLocalisamfile(LF_BENEM);
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ","",3));
_msk = new TMask("at2700a");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_percat_form(etformato);
_stampa80 = config.get_bool("Stampa80");
_form_car = new TEti_percat_form("ATCARTO1");
_form_sch = new TEti_percat_form("AT_PAGIN");
return TRUE;
}
@ -338,13 +778,19 @@ bool TStampaPerCategorie::user_destroy()
{
delete _msk;
delete _rel;
delete _benem;
delete _donaz;
delete _sbenemerenze;
delete _form_eti;
delete _form_car;
delete _form_sch;
return TRUE;
}
int at2700(int argc, char* argv[])
{
TStampaPerCategorie a;
a.run(argc, argv, "Elenco per categorie");
a.run(argc, argv, "Stampa soggetti per categorie");
return 0;
}

View File

@ -1,4 +1,4 @@
// stampa elenco soggetti per categoria
// stampa soggetti per categoria
// definizione campi per maschera di selezione
#define F_SEZINI 101
@ -36,9 +36,18 @@
#define F_CATN6 311
#define F_D_CATN6 312
#define F_PERCAP 401
#define F_LETTINI 402
#define F_LETTFIN 403
#define F_PERGRUPPO 401
#define F_GRUPPOAZIE 402
#define F_D_GRUPPOAZIE 403
#define F_PERCAP 404
#define F_CAPINI 405
#define F_CAPFIN 406
#define F_LETTINI 407
#define F_LETTFIN 408
#define F_NOTIZIARIO 409
#define F_ELENCO 501
#define F_ETICHETTE 502
#define F_SINTETICO 501
#define F_COMPLETO 502
#define F_SCHEDE 503
#define F_ETICHETTE 504
#define F_CARTOLINE 505

View File

@ -1,15 +1,54 @@
#include "at2700a.h"
TOOLBAR "" 0 20 0 2
BUTTON F_SINTETICO 9 2
BEGIN
PROMPT -16 -11 "Sintetico"
MESSAGE EXIT,F_SINTETICO
END
BUTTON F_COMPLETO 9 2
BEGIN
PROMPT -26 -11 "Completo"
MESSAGE EXIT,F_COMPLETO
END
BUTTON F_SCHEDE 9 2
BEGIN
PROMPT -36 -11 "Schede"
MESSAGE EXIT,F_SCHEDE
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -46 -11 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON F_CARTOLINE 9 2
BEGIN
PROMPT -56 -11 "Cartoline"
MESSAGE EXIT,F_CARTOLINE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -66 -11 ""
END
ENDPAGE
PAGE "Stampa soggetti per categorie" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
PROMPT 1 0 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
PROMPT 2 1 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
@ -28,7 +67,7 @@ END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
PROMPT 11 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
@ -43,7 +82,7 @@ END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
PROMPT 2 2 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
@ -51,7 +90,7 @@ END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
PROMPT 11 2 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
@ -64,7 +103,7 @@ END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
PROMPT 41 1 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
@ -83,7 +122,7 @@ END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
PROMPT 49 1 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
@ -98,7 +137,7 @@ END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
PROMPT 41 2 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
@ -106,7 +145,7 @@ END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
PROMPT 49 2 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
@ -119,12 +158,12 @@ END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 5 "Categorie donatori"
PROMPT 1 4 "Categorie donatori"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 6 ""
PROMPT 2 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
@ -139,13 +178,13 @@ END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 6 ""
PROMPT 8 5 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 7 ""
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
@ -159,13 +198,13 @@ END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 7 ""
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 8 ""
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
@ -179,13 +218,13 @@ END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 8 ""
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 6 ""
PROMPT 40 5 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
@ -199,13 +238,13 @@ END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 6 ""
PROMPT 46 5 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 7 ""
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
@ -219,13 +258,13 @@ END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 7 ""
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 8 ""
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
@ -239,18 +278,18 @@ END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 8 ""
PROMPT 46 7 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 10 "Categorie non donatori"
PROMPT 1 9 "Categorie non donatori"
END
STRING F_CATN1 2
BEGIN
PROMPT 2 11 ""
PROMPT 2 10 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN1
@ -265,13 +304,13 @@ END
STRING F_D_CATN1 30
BEGIN
PROMPT 8 11 ""
PROMPT 8 10 ""
FLAGS "D"
END
STRING F_CATN2 2
BEGIN
PROMPT 2 12 ""
PROMPT 2 11 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN2
@ -285,13 +324,13 @@ END
STRING F_D_CATN2 30
BEGIN
PROMPT 8 12 ""
PROMPT 8 11 ""
FLAGS "D"
END
STRING F_CATN3 2
BEGIN
PROMPT 2 13 ""
PROMPT 2 12 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN3
@ -305,13 +344,13 @@ END
STRING F_D_CATN3 30
BEGIN
PROMPT 8 13 ""
PROMPT 8 12 ""
FLAGS "D"
END
STRING F_CATN4 2
BEGIN
PROMPT 40 11 ""
PROMPT 40 10 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN4
@ -325,13 +364,13 @@ END
STRING F_D_CATN4 30
BEGIN
PROMPT 46 11 ""
PROMPT 46 10 ""
FLAGS "D"
END
STRING F_CATN5 2
BEGIN
PROMPT 40 12 ""
PROMPT 40 11 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN5
@ -345,13 +384,13 @@ END
STRING F_D_CATN5 30
BEGIN
PROMPT 46 12 ""
PROMPT 46 11 ""
FLAGS "D"
END
STRING F_CATN6 2
BEGIN
PROMPT 40 13 ""
PROMPT 40 12 ""
FLAGS "U"
USE CTN
INPUT CODTAB F_CATN6
@ -365,52 +404,88 @@ END
STRING F_D_CATN6 30
BEGIN
PROMPT 46 13 ""
PROMPT 46 12 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 6
BEGIN
PROMPT 1 14 "Opzioni di stampa"
END
BOOLEAN F_PERGRUPPO
BEGIN
PROMPT 2 15 "Stampa per gruppo aziendale"
MESSAGE TRUE ENABLE,F_GRUPPOAZIE|ENABLE,F_D_GRUPPOAZIE
MESSAGE FALSE RESET,F_GRUPPOAZIE|RESET,F_D_GRUPPOAZIE|DISABLE,F_GRUPPOAZIE|DISABLE,F_D_GRUPPOAZIE
END
STRING F_GRUPPOAZIE 4
BEGIN
PROMPT 35 15 ""
FLAGS "U"
USE GAZ
INPUT CODTAB F_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_GRUPPOAZIE CODTAB
OUTPUT F_D_GRUPPOAZIE S0
CHECKTYPE NORMAL
WARNING "Codice gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
STRING F_D_GRUPPOAZIE 30
BEGIN
PROMPT 43 15 ""
FLAGS "U"
USE GAZ KEY 2
INPUT S0 F_D_GRUPPOAZIE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
COPY OUTPUT F_GRUPPOAZIE
CHECKTYPE NORMAL
WARNING "Gruppo aziendale non presente"
HELP "Gruppo aziendale di appartenenza"
END
BOOLEAN F_NOTIZIARIO
BEGIN
PROMPT 2 16 "Stampa per notiziario"
END
BOOLEAN F_PERCAP
BEGIN
PROMPT 2 15 "Ordinamento per CAP"
MESSAGE TRUE DISABLE,1@
MESSAGE FALSE ENABLE,1@
PROMPT 2 17 "Ordinamento per CAP"
MESSAGE TRUE DISABLE,1@|ENABLE,2@
MESSAGE FALSE ENABLE,1@|DISABLE,2@
END
STRING F_LETTINI 1
STRINGA F_CAPINI 5
BEGIN
PROMPT 30 15 "Selezione iniziali cognome: da "
PROMPT 35 17 "Stampa solo dal cap "
GROUP 2
END
STRINGA F_CAPFIN 5
BEGIN
PROMPT 61 17 "al cap "
GROUP 2
END
STRING F_LETTINI 15
BEGIN
PROMPT 2 18 "Selezione iniziali cognome: da "
GROUP 1
PICTURE "!"
PICTURE "!!"
END
STRING F_LETTFIN 1
STRING F_LETTFIN 15
BEGIN
PROMPT 63 15 "a "
PROMPT 50 18 "a "
GROUP 1
//VALIDATE (#F_LETTINI<=#F_LETTFIN)
PICTURE "!"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 16 "Stampa"
END
BUTTON F_ELENCO 9 2
BEGIN
PROMPT -13 17 "Elenco"
MESSAGE EXIT,F_ELENCO
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -23 17 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 17 ""
PICTURE "!!"
END
ENDPAGE

369
at/at2800.cpp Executable file
View File

@ -0,0 +1,369 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include "soggetti.h"
#include "sezioni.h"
#include <comuni.h>
#include "at2.h"
#include "at2800a.h"
#define ALIAS_LCP 100
#define ALIAS_TCS 200
enum ts { undefined = 0, elenco = 1, etichette = 2 };
// definizione form per etichette
class TEti_nondon_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TEti_nondon_form(): TForm() {};
TEti_nondon_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TEti_nondon_form() {};
};
class TStampaNonDon : public TPrintapp
{
static bool filter_func_nondon(const TRelation* rel);
TRelation* _rel;
TMask* _msk;
TEti_nondon_form* _form_eti;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome, _dencom;
TDate _data_stampa;
TDate _data;
ts _tipostampa;
TString16 _codsez, _codsot;
int _etlarghezza, _etcolonne;
bool _stampa80;
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(const TString16 codsez, const TString16 codsot);
TMask& app_mask() { return *_msk; }
TStampaNonDon() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
};
HIDDEN inline TStampaNonDon& app() { return (TStampaNonDon&) main_app(); }
TCursor* TEti_nondon_form::cursor() const { return app().current_cursor(); }
TRelation* TEti_nondon_form::relation() const { return cursor()->relation(); }
void TStampaNonDon::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
void TStampaNonDon::set_page(int file, int cnt)
{
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case elenco:
{
if (_stampa80)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(3,"@6g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@9g#a", &_cognome_nome);
set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@44g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(2,"@44g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(3,"@44g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(1,"@60g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(2,"@64g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON));
set_row(1,"@74g@n", FLD(LF_SOGGETTI,SOG_TOTDON));
set_row(4,"");
}
else
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g#a", &_cognome_nome);
set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(1,"@132g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(2,"@132g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON));
}
}
break;
}
}
bool TStampaNonDon::filter_func_nondon(const TRelation* rel)
{
bool filtrato = TRUE;
TLocalisamfile& sog = rel->lfile();
// filtro per categorie
TAssoc_array& categorie = app()._categorie;
if (categorie.items() != 0)
{
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
// filtro per data ultima donazione
if (filtrato)
{
const TDate dataultdon = sog.get(SOG_DATAULTDON);
if (dataultdon.ok())
filtrato = (dataultdon <= app()._data);
else
filtrato = FALSE;
}
return filtrato;
}
void TStampaNonDon::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132);
intestazione = "Sezione: ";
intestazione << codsez;
intestazione << "/";
intestazione << codsot;
intestazione << " ";
intestazione << densez;
if ((densot.ok())&& (densot.not_empty()))
{
intestazione << "/";
intestazione << densot;
}
if (_stampa80)
intestazione.center_just(80);
else
intestazione.center_just(132);
set_header(1,"@0g%s", (const char*) intestazione);
return;
}
bool TStampaNonDon::preprocess_page(int file, int counter)
{
if (_tipostampa == elenco)
{
TRectype recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
_cognome_nome = nome;
TString256 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
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
bool TStampaNonDon::set_print(int m)
{
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipostampa = etichette;
break;
}
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
_data = _msk->get(F_DATA);
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
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);
current_cursor()->set_filterfunction (filter_func_nondon);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TStampaNonDon::crea_intestazione()
{
reset_header();
if (_tipostampa == elenco)
{
TString sep(132);
sep = "ELENCO SOGGETTI CHE NON DONANO DAL ";
if (app()._data.ok())
sep << _data.string();
if (_stampa80)
sep.center_just(80);
else
sep.center_just(132);
set_header(2, "@0g%s", (const char*) sep);
TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "";
sep << "Pag. @#";
if (_stampa80)
set_header(2, "@73g%s", (const char*) sep);
else
set_header(2, "@110g%s", (const char*) sep);
set_header(3, "");
if (_stampa80)
{
set_header(4,"@0gCodice@9gCognome e nome@44gTelefono abit.@60gUltima don.@71gTot.don.");
set_header(5,"@0gTessera@44gTelefono lavoro");
set_header(6,"@0gCateg.@9gNato il@44gTelefono altro");
set_header(7,"@0g--------@9g----------------------------------@44g--------------@60g----------@71g--------");
_cognome_nome.set_width(35);
}
else
{
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro@132gData u.d.");
set_header(5,"@49gCAP/Località/Comune/Prov.@116gTelefono altro@132gTipo u.d.");
set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------@132g----------");
_cognome_nome.set_width(25);
}
}
}
bool TStampaNonDon::user_create()
{
_rel = new TRelation(LF_SOGGETTI);
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_cur = add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at2800a");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_nondon_form(etformato);
_stampa80 = config.get_bool("Stampa80");
return TRUE;
}
bool TStampaNonDon::user_destroy()
{
delete _msk;
delete _rel;
delete _form_eti;
return TRUE;
}
int at2800(int argc, char* argv[])
{
TStampaNonDon a;
a.run(argc, argv, "Stampa soggetti che non donano dal ...");
return 0;
}

29
at/at2800a.h Executable file
View File

@ -0,0 +1,29 @@
// stampa elenco soggetti che non donano dal ...
// 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_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_DATA 301
#define F_ELENCO 401
#define F_ETICHETTE 402

280
at/at2800a.uml Executable file
View File

@ -0,0 +1,280 @@
#include "at2800a.h"
PAGE "Stampa soggetti che non donano dal" -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 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 5
BEGIN
PROMPT 1 5 "Categorie"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 8 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 8 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 1 10 "Opzioni di elaborazione"
END
DATE F_DATA
BEGIN
PROMPT 2 11 "Soggetti che non donano da "
HELP "Data massima in cui il soggetto pu• aver fatto l'ultima donazione"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 13 "Stampa"
END
BUTTON F_ELENCO 9 2
BEGIN
PROMPT -13 14 "Elenco"
MESSAGE EXIT,F_ELENCO
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -23 14 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 14 ""
END
ENDPAGE
ENDMASK

View File

@ -4,7 +4,7 @@
#include "at4.h"
#define usage "Error - usage : %s -{0|1|2|3}"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7}"
int main(int argc,char** argv)
@ -22,6 +22,14 @@ int main(int argc,char** argv)
rt = at4300(argc,argv) ; break;
case 3:
rt = at4400(argc,argv) ; break;
case 4:
rt = at4500(argc,argv) ; break;
case 5:
rt = at4600(argc,argv) ; break;
case 6:
rt = at4700(argc,argv) ; break;
case 7:
rt = at4800(argc,argv) ; break;
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -29,3 +29,26 @@ MENUBAR MENU_BAR(3)
MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File"
/* at4 -4 stampa tessere associative globale */
MENUBAR MENU_BAR(4)
MENU MENU_BAR(4)
SUBMENU MENU_FILE "~File"
/* at4 -5 stampa tessere associative singole */
MENUBAR MENU_BAR(5)
MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File"
/* at4 -6 stampa cartoline/etichette/schede/dettaglio donazioni singole */
MENUBAR MENU_BAR(6)
MENU MENU_BAR(6)
SUBMENU MENU_FILE "~File"
/* at4 -6 stampa cartoline/... da codice a codice */
MENUBAR MENU_BAR(7)
MENU MENU_BAR(7)
SUBMENU MENU_FILE "~File"

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -40,17 +39,17 @@ class TStampaScadenze : public TPrintapp
TScadenze_form* _form_eti;
TScadenze_form* _form_car;
TAssoc_array _categorie;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
TDate _dataini, _datafin, _dataultid;
bool _usomodo, _usasez;
TString16 _giorni;
TString16 _procdon, _modo, _ab01, _ab02, _ab03, _rh;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot, _orario, _datacart;
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
int _etlarghezza, _etcolonne;
static bool filter_func_scadenze(const TRelation* rel);
@ -120,20 +119,32 @@ void TStampaScadenze::filtra_sezioni()
void TStampaScadenze::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
corpo.update();
for (int i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
force_setpage(TRUE);
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case cartoline:
@ -175,7 +186,7 @@ void TStampaScadenze::set_page(int file, int cnt)
note.set(_note);
}
corpo.update();
for (int i = 0; i < corpo.height(); i++)
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
@ -197,6 +208,7 @@ void TStampaScadenze::set_page(int file, int cnt)
set_row(1,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON1));
set_row(1,"@97g@S", FLD(LF_SOGGETTI,SOG_IDON2));
set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
set_row(1,"@105g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(2,"@13g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(2,"@53g@pn", FLD(LF_SOGGETTI,SOG_INTSI,"###"));
@ -205,7 +217,10 @@ void TStampaScadenze::set_page(int file, int cnt)
set_row(2,"@87g@S", FLD(LF_SOGGETTI,SOG_TIPOULTID));
set_row(2,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON3));
set_row(2,"@97g@S", FLD(LF_SOGGETTI,SOG_IDON4));
set_row(2,"@100g@S", FLD(LF_SOGGETTI,SOG_RHANTID));
set_row(2,"@100g@S", FLD(LF_SOGGETTI,SOG_RHANTID));
set_row(2,"@105g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(3,"@105g@S", FLD(LF_SOGGETTI,SOG_TELALT));
//set_row(3,"");
}
break;
}
@ -238,7 +253,7 @@ bool TStampaScadenze::filter_func_scadenze(const TRelation* rel)
if (filtrato && (app()._ab01.not_empty() || app()._ab02.not_empty() || app()._ab03.not_empty()))
{
const TString16 ab0 = sog.get(SOG_GRUPPOAB0);
filtrato = (ab0 == app()._ab01 || ab0 == app()._ab02 || ab0 == app()._ab03);
filtrato = ((app()._ab01.not_empty() && ab0 == app()._ab01) || (app()._ab02.not_empty() && ab0 == app()._ab02) || (app()._ab03.not_empty() && ab0 == app()._ab03));
}
if (filtrato && app()._rh.not_empty())
{
@ -282,9 +297,7 @@ bool TStampaScadenze::filter_func_scadenze(const TRelation* rel)
bool TStampaScadenze::preprocess_page(int file, int counter)
{
switch (_tipo_stampa)
{
case elenco:
if (_tipostampa==elenco)
{
TRectype& recsog = current_cursor()->curr();
const TString16 codsez = recsog.get(SOG_CODSEZ);
@ -301,10 +314,14 @@ bool TStampaScadenze::preprocess_page(int file, int counter)
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
}
break;
}
else
if (printer().rows_left() < 4)
printer().formfeed();
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -354,22 +371,22 @@ void TStampaScadenze::dati_sezione(const TString16 codsez, const TString16 codso
bool TStampaScadenze::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
case F_CARTOLINE:
_tipo_stampa = dati_cartoline();
_tipostampa = dati_cartoline();
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
_codsez = "**";
_codsot = "**";
@ -439,7 +456,7 @@ bool TStampaScadenze::set_print(int m)
void TStampaScadenze::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "SCADENZE DI DONAZIONE ";
@ -479,13 +496,15 @@ bool TStampaScadenze::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare la denominazione della sezione nell'intestazione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at4100a");
_form_eti = new TScadenze_form("AT_ETSOG");
_form_car = new TScadenze_form("AT_ETCAR");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TScadenze_form(etformato);
_form_car = new TScadenze_form("ATCARTO1");
return TRUE;
}

View File

@ -1,7 +1,6 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -12,6 +11,7 @@
#define ALIAS_LCP 100
#define ALIAS_TCS 200
#define IDON_SI "SI"
enum ts { undefined = 0, elenco = 1, etichette = 2 };
@ -38,13 +38,14 @@ class TStampaUrgenze : public TPrintapp
TUrgenze_form* _form_eti;
TRectype* _sangue;
TAssoc_array _categorie;
TString16 _tipodon;
long _giorni;
int _cur;
TParagraph_string _cognome_nome, _dencom;
TDate _data_stampa;
TDate _dataini, _datafin;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot;
int _etlarghezza, _etcolonne;
protected:
virtual bool user_create();
@ -90,35 +91,51 @@ void TStampaUrgenze::filtra_sezioni()
void TStampaUrgenze::set_page(int file, int cnt)
{
switch (_tipo_stampa)
{
switch (_tipostampa)
{
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);
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
force_setpage(TRUE);
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case elenco:
{
set_row(2,"");
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g#a", &_cognome_nome);
set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(2,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
set_row(1,"@53g@S", FLD(LF_SOGGETTI,SOG_RHANTID));
set_row(1,"@57g@S", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
set_row(1,"@64g@S", FLD(LF_SOGGETTI,SOG_KELL));
set_row(1,"@68g@S", FLD(LF_SOGGETTI,SOG_DU));
set_row(1,"@72g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(1,"@83g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON));
set_row(1,"@86g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@101g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
}
break;
}
@ -135,6 +152,32 @@ bool TStampaUrgenze::filter_func_urgenze(const TRelation* rel)
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
// filtro per idoneita al tipo donazione
if (filtrato)
{
filtrato = FALSE;
TString16 idon = sog.get(SOG_IDON1);
if (idon == app()._tipodon)
filtrato = TRUE;
else
{
TString16 idon = sog.get(SOG_IDON2);
if (idon == app()._tipodon)
filtrato = TRUE;
else
{
TString16 idon = sog.get(SOG_IDON3);
if (idon == app()._tipodon)
filtrato = TRUE;
else
{
TString16 idon = sog.get(SOG_IDON4);
if (idon == app()._tipodon)
filtrato = TRUE;
}
}
}
}
// filtro per tipizzazione
if (filtrato)
{
@ -145,18 +188,35 @@ bool TStampaUrgenze::filter_func_urgenze(const TRelation* rel)
if (filtrato)
{
const long giorni_sez = rel->lfile(LF_SEZIONI).get_long(SEZ_INTMINCONV);
const long giorni = (giorni_sez > app()._giorni) ? giorni_sez : app()._giorni;
long giorni;
if (giorni_sez == 0)
giorni = app()._giorni;
else
giorni = (giorni_sez > app()._giorni) ? giorni_sez : app()._giorni;
TDate data(TODAY);
data = data - (const long) giorni;
const TDate dataultdon = sog.get(SOG_DATAULTDON);
filtrato = (dataultdon <= data);
if (giorni==0)
{
TDate datapros;
if (app()._tipodon == IDON_SI)
datapros = sog.get(SOG_DATAPROSSI);
else
datapros = sog.get(SOG_DATAPROSAF);
filtrato = (datapros <= data);
}
else
{
data = data - (const long) giorni;
const TDate dataultdon = sog.get(SOG_DATAULTDON);
filtrato = (dataultdon <= data);
}
}
return filtrato;
}
bool TStampaUrgenze::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
@ -190,7 +250,13 @@ bool TStampaUrgenze::preprocess_page(int file, int counter)
_codsot = codsot;
header_sezione(codsez, codsot);
}
else
if (printer().rows_left() < 2)
printer().formfeed();
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -217,21 +283,21 @@ void TStampaUrgenze::header_sezione(const TString16 codsez, const TString16 cods
bool TStampaUrgenze::set_print(int)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
_codsez = "**";
_codsot = "**";
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
reset_files();
add_file(LF_SOGGETTI);
@ -273,6 +339,7 @@ bool TStampaUrgenze::set_print(int)
if ((du.ok()) && (du.not_empty()))
_sangue->put(SOG_DU, du);
_giorni = _msk->get_long(F_GIORNI);
_tipodon = _msk->get(F_TIPODON);
// filtra solo idonei
current_cursor()->setfilter("TCS->S6 == \"I\"", TRUE);
// filtra per categorie, tipizzazione e data donazione
@ -288,10 +355,11 @@ bool TStampaUrgenze::set_print(int)
void TStampaUrgenze::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
sep = "CONVOCAZIONI URGENTI";
sep = "CONVOCAZIONI URGENTI per ";
sep << _tipodon;
sep.center_just();
set_header(2, "@0g%s", (const char*) sep);
TString16 data_stampa = _data_stampa.string();
@ -302,9 +370,8 @@ void TStampaUrgenze::crea_intestazione()
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
set_header(5,"@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gGr.@53gRh@57gFen.Rh@64gKellDu@72gUlt. donaz.@86gTelefono abit.@101gTelefono lavoro@116gTelefono altro");
set_header(5,"@0g--------@9g--@12g-------------------------@38g----------@49g--- --- ------ --- ---@72g---------- --@86g--------------@101g--------------@116g--------------");
}
}
@ -314,13 +381,16 @@ bool TStampaUrgenze::user_create()
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare nell'intestazione la denominazione della sezione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_form_eti = new TUrgenze_form("AT_ETSOG");
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at4200a");
_sangue = new TRectype(LF_SOGGETTI);
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TUrgenze_form(etformato);
return TRUE;
}

View File

@ -24,14 +24,14 @@
#define F_D_CAT6 212
#define F_GRUPPOAB0 301
#define F_RHANTID 302
#define F_KELL 303
#define F_FENOTIPORH 304
#define F_DU 305
#define F_NUMERO 306
#define F_TIPODON 301
#define F_GRUPPOAB0 302
#define F_RHANTID 303
#define F_KELL 304
#define F_FENOTIPORH 305
#define F_DU 306
#define F_GIORNI 307
#define F_D_TIPODON 308
#define F_ELENCO 401
#define F_ETICHETTE 402

View File

@ -1,6 +1,6 @@
#include "at4200a.h"
PAGE "Stampa Urgenze" -1 -1 78 20
PAGE "Urgenze" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
@ -245,14 +245,30 @@ BEGIN
END
GROUPBOX DLG_NULL 77 3
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 10 "Dati gruppo-ematici richiesti"
END
STRING F_TIPODON 2
BEGIN
PROMPT 2 11 "Tipo donazione "
FLAGS "U"
USE TDN
INPUT CODTAB F_TIPODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@40" S0
OUTPUT F_TIPODON CODTAB
OUTPUT F_D_TIPODON S0
CHECKTYPE REQUIRED
VALIDATE NOT_EMPTY_FUNC
WARNING "Codice tipo donazione non presente"
HELP "Tipo donazione"
END
LISTBOX F_GRUPPOAB0 4
BEGIN
PROMPT 2 11 "Gruppo AB0 "
PROMPT 2 12 "Gruppo AB0 "
FIELD GRUPPOAB0
FLAGS "U"
#include "gruppo.h"
@ -260,7 +276,7 @@ END
LISTBOX F_RHANTID 3
BEGIN
PROMPT 22 11 "Rh/AntiD "
PROMPT 22 12 "Rh/AntiD "
FIELD RHANTID
FLAGS "U"
#include "rh.h"
@ -268,13 +284,13 @@ END
STRING F_FENOTIPORH 6
BEGIN
PROMPT 39 11 "Fen.Rh "
PROMPT 39 12 "Fen.Rh "
FIELD FENOTIPORH
END
LISTBOX F_KELL 3
BEGIN
PROMPT 55 11 "Kell "
PROMPT 55 12 "Kell "
FIELD KELL
FLAGS "U"
#include "rh.h"
@ -282,53 +298,58 @@ END
LISTBOX F_DU 3
BEGIN
PROMPT 68 11 "Du "
PROMPT 68 12 "Du "
FIELD DU
FLAGS "U"
#include "rh.h"
END
STRING F_D_TIPODON 25
BEGIN
PROMPT 24 11 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 1 13 "Richieste"
PROMPT 1 14 "Richieste"
END
NUMBER F_NUMERO 3
BEGIN
PROMPT 2 14 "Soggetti richiesti "
CHECKTYPE REQUIRED
WARNING "Inserire il numero dei soggetti richiesti"
HELP "Numero dei soggetti richiesti per l'urgenza"
END
//NUMBER F_NUMERO 3
//BEGIN
// PROMPT 2 14 "Numero soggetti richiesti "
//CHECKTYPE REQUIRED
// WARNING "Inserire il numero dei soggetti richiesti"
// HELP "Numero dei soggetti richiesti per l'urgenza"
//END
NUMBER F_GIORNI 3
BEGIN
PROMPT 40 14 "Giorni dall'ultima donazione"
CHECKTYPE REQUIRED
PROMPT 2 15 "Giorni dall'ultima donazione "
//CHECKTYPE REQUIRED
WARNING "Inserire il numero giorni"
HELP "N.ro minimo di giorni che devono essere trascorsi dall'ultima donazione"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 16 "Stampa"
PROMPT 1 17 "Stampa"
END
BUTTON F_ELENCO 9 2
BEGIN
PROMPT -13 17 "Elenco"
PROMPT -13 18 "Elenco"
MESSAGE EXIT,F_ELENCO
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -23 17 "Etichette"
PROMPT -23 18 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 17 ""
PROMPT -33 18 ""
END
ENDPAGE

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -12,9 +11,9 @@
#include "at4100b.h"
#include "at4100c.h"
#define ALIAS_TABCTD 100 // alias tabella categorie donatori
#define ALIAS_TABLCP 100 // alias tabella località postali
#define ALIAS_TABTCS 200 // alias tabella tipi/esiti controlli sanitari
#define ALIAS_TABLCP 300 // alias tabella località postali
#define ALIAS_TABCTD 700 // alias tabella categorie donatori
#define STATO_IDONEO 'I' // IDONEITA'
#define STATO_FINESO 'F' // FINE SOSPENSIONE
@ -43,18 +42,18 @@ class TStampaConvocazioni : public TPrintapp
TMask* _msk;
TConv_form* _form_eti; // per etichette
TConv_form* _form_car; // per cartoline
int _cur;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
TString16 _codsez, _codsot, _orario, _datacart;
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
TDate _dataconv;
bool _usasez;
long _intmin, _intmax;
long _intmin, _intmax, _intmincon;
TParagraph_string _cognome_nome;
int _numconv;
bool _definitiva;
int _etlarghezza, _etcolonne;
protected:
virtual bool user_create();
@ -101,7 +100,7 @@ ts TStampaConvocazioni::dati_cartoline()
void TStampaConvocazioni::set_page(int file, int cnt)
{
if (_tipo_stampa == elencocon || _tipo_stampa == elencorit)
if (_tipostampa==elencocon || _tipostampa==elencorit)
{
reset_row(1);
reset_row(2);
@ -124,22 +123,37 @@ void TStampaConvocazioni::set_page(int file, int cnt)
set_row(2,"@71g@ld",FLD(LF_SOGGETTI,SOG_DATAULTID));
set_row(2,"@82g@S", FLD(LF_SOGGETTI,SOG_TIPOULTID));
set_row(2,"@85g@pn",FLD(LF_SOGGETTI,SOG_INTSI,"###"));
set_row(1,"@96g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@111g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(2,"@96g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(3,"");
}
if (_tipo_stampa == etichette)
if (_tipostampa==etichette)
{
TPrint_section& corpo = _form_eti->get_body();
corpo.reset();
corpo.update();
for (int i = 0; i < corpo.items(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,"%s",riga.row());
}
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
}
if (_tipo_stampa == cartoline)
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
if (_tipostampa==cartoline)
{
TPrint_section& corpo = _form_car->get_body();
const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
@ -178,7 +192,7 @@ void TStampaConvocazioni::set_page(int file, int cnt)
note.set(_note);
}
corpo.update();
for (int i = 0; i < corpo.height(); i++)
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
@ -216,16 +230,30 @@ bool TStampaConvocazioni::filter_func_conv (const TRelation* rel)
const char stato = rel->curr(-ALIAS_TABTCS).get_char("S6");
const bool dimesso = rel->curr(-ALIAS_TABCTD).get_char("B0");
TDate dataconv = sog.curr().get_date(SOG_DATACONV);
const int totdon = sog.get_int(SOG_TOTDON);
const int numconv = sog.get_int(SOG_NUMCONV);
if (dataprossi.ok())
{
// intervallo tra data convocazione e data pross. si
long intconvsi = app()._dataconv - dataprossi;
// intervallo tra data convocazione e data ultima convocazione
long intultconvsi = app()._dataconv - dataconv;
if ((intconvsi >= 0) && (intconvsi < app()._intmax) && (intultconvsi > app()._intmin) && ((stato == STATO_IDONEO) || (stato == STATO_FINESO)) && (dimesso != 'X'))
return TRUE;
else
return FALSE;
// verifico se si tratta di soggetto nuovo, con 0 donazioni
if ((totdon == 0) && (numconv == 0))
{
const TDate dataultid = sog.get_date(SOG_DATAULTID);
long intervallo = app()._dataconv - dataultid;
// convoco solo se è passato l'intervallo minimo di convocazione
if (intervallo >= app()._intmincon)
return TRUE;
else
return FALSE;
}
else
if ((intconvsi >= 0) && (intconvsi < app()._intmax) && (intultconvsi > app()._intmin) && ((stato == STATO_IDONEO) || (stato == STATO_FINESO)) && (dimesso != 'X'))
return TRUE;
else
return FALSE;
}
else
// non ha la data di prossima donazione SI
@ -234,7 +262,7 @@ bool TStampaConvocazioni::filter_func_conv (const TRelation* rel)
bool TStampaConvocazioni::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elencocon || _tipo_stampa == elencorit)
if (_tipostampa==elencocon || _tipostampa==elencorit)
{
TRectype& recsog = current_cursor()->curr();
const TString16 codsez = recsog.get(SOG_CODSEZ);
@ -256,6 +284,9 @@ bool TStampaConvocazioni::preprocess_page(int file, int counter)
if (printer().rows_left() < 3)
printer().formfeed();
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
@ -271,13 +302,13 @@ bool TStampaConvocazioni::preprocess_page(int file, int counter)
}
if (_numconv > 4)
{
if (_tipo_stampa == cartoline || _tipo_stampa == etichette || _tipo_stampa == elencocon)
if (_tipostampa==cartoline || _tipostampa==etichette || _tipostampa==elencocon)
return FALSE;
else
return TRUE;
}
else
if (_tipo_stampa == elencorit)
if (_tipostampa==elencorit)
return FALSE;
else
return TRUE;
@ -326,25 +357,25 @@ void TStampaConvocazioni::dati_sezione(const TString16 codsez, const TString16 c
bool TStampaConvocazioni::set_print(int)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCOCON:
_tipo_stampa = elencocon;
_tipostampa = elencocon;
break;
case F_ELENCORIT:
_tipo_stampa = elencorit;
_tipostampa = elencorit;
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
case F_CARTOLINE:
_tipo_stampa = dati_cartoline();
_tipostampa = dati_cartoline();
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
_codsez = "**";
_codsot = "**";
@ -353,6 +384,7 @@ bool TStampaConvocazioni::set_print(int)
_dataconv = _msk->get(F_DATACONV);
_intmin = _msk->get_int(F_INTMIN);
_intmax = _msk->get_int(F_INTMAX);
_intmincon = _msk->get_int(F_INTMINCON);
_definitiva = _msk->get_bool(F_DEFINITIVA);
// filtro per sezioni selezionati
filtra_sezioni();
@ -375,10 +407,10 @@ bool TStampaConvocazioni::set_print(int)
void TStampaConvocazioni::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elencocon || _tipo_stampa == elencorit)
if (_tipostampa==elencocon || _tipostampa==elencorit)
{
TString sep(132);
if (_tipo_stampa == elencocon)
if (_tipostampa==elencocon)
sep = "ELENCO CONVOCATI elaborato il ";
else
sep = "ELENCO RITARDATARI elaborato il ";
@ -393,9 +425,9 @@ void TStampaConvocazioni::crea_intestazione()
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(5,"@0gCod.CL@7gNC@11gCognome e nome@37gNato il@48gGr.@52gRh@55gKell@60gFen.Rh@67gDu@71gUltima donaz.@85gData pros.");
set_header(6,"@0gTess.@37gCat.don@71gUltima idon.@85gInt.SI");
set_header(7,"@0g------@7g---@11g-------------------------@37g----------@48g--- --- --- ------ --@71g---------- --@85g---------- --@83g----------");
set_header(5,"@0gCod.CL@7gNC@11gCognome e nome@37gNato il@48gGr.@52gRh@55gKell@60gFen.Rh@67gDu@71gUltima donaz.@85gData pros.@96gTel. abitaz.@111gTelefono altro");
set_header(6,"@0gTess.@37gCat.don@71gUltima idon.@85gInt.SI@96gTelefono lav.");
set_header(7,"@0g------@7g---@11g-------------------------@37g----------@48g--- --- --- ------ --@71g---------- --@85g---------- --@96g--------------@111g---------------");
}
}
@ -407,11 +439,14 @@ bool TStampaConvocazioni::user_create()
_rel->add("LCP", "CODTAB==DOM_CODLOC", 1, 0, ALIAS_TABLCP); // per verificare che sia DONATORE NON DIMESSO
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at4300a");
_form_eti = new TConv_form("AT_ETSOG");
_form_car = new TConv_form("AT_CARTO");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TConv_form(etformato);
_form_car = new TConv_form("ATCARTO1");
return TRUE;
}

View File

@ -11,7 +11,8 @@
#define F_DATACONV 109
#define F_INTMIN 110
#define F_INTMAX 111
#define F_DEFINITIVA 112
#define F_INTMINCON 112
#define F_DEFINITIVA 113
#define F_ELENCOCON 401
#define F_ELENCORIT 402
#define F_ETICHETTE 403

View File

@ -117,7 +117,7 @@ BEGIN
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 6
GROUPBOX DLG_NULL 77 7
BEGIN
PROMPT 1 4 "Opzioni di convocazione"
END
@ -125,58 +125,63 @@ END
DATE F_DATACONV
BEGIN
PROMPT 2 5 "Data elaborazione "
PROMPT 2 5 "Data elaborazione "
HELP "Data elaborazione"
VALIDATE NOT_EMPTY_FUNC
END
NUMBER F_INTMIN 4
BEGIN
PROMPT 2 6 "Intervallo minimo "
PROMPT 2 6 "Intervallo minimo avvisi "
END
NUMBER F_INTMAX 4
BEGIN
PROMPT 2 7 "Intervallo massimo "
PROMPT 2 7 "Intervallo massimo avvisi "
END
NUMBER F_INTMINCON 4
BEGIN
PROMPT 2 8 "Intervallo minimo convoc. "
END
BOOLEAN F_DEFINITIVA
BEGIN
PROMPT 2 8 "Registra stampa convocazione su archivio soggetti"
PROMPT 2 9 "Registra stampa convocazione su archivio soggetti"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 11 "Stampa"
PROMPT 1 12 "Stampa"
END
BUTTON F_ELENCOCON 18 2
BEGIN
PROMPT 2 12 "Elenco convocati"
PROMPT 2 13 "Elenco convocati"
MESSAGE EXIT,F_ELENCOCON
END
BUTTON F_ELENCORIT 18 2
BEGIN
PROMPT 22 12 "Elenco ritardatari"
PROMPT 22 13 "Elenco ritardatari"
MESSAGE EXIT,F_ELENCORIT
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT 43 12 "Etichette"
PROMPT 43 13 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON F_CARTOLINE 9 2
BEGIN
PROMPT 54 12 "Cartoline"
PROMPT 54 13 "Cartoline"
MESSAGE EXIT,F_CARTOLINE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT 66 12 ""
PROMPT 66 13 ""
END
ENDPAGE

View File

@ -3,7 +3,6 @@
#include <printapp.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -16,7 +15,7 @@
#include "at4100c.h"
#define ALIAS_LCP 100
#define ALIAS_LDN 200
#define ALIAS_LDN 400
enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 };
@ -40,7 +39,6 @@ class TConvocazioniPerSezione : public TPrintapp
TMask* _msk;
TStConvoc_form* _form_eti;
TStConvoc_form* _form_car;
int _cur;
TParagraph_string _cognome_nome;
TDate _data_stampa;
@ -52,8 +50,9 @@ class TConvocazioniPerSezione : public TPrintapp
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
bool _usasez;
ts _tipo_stampa;
ts _tipostampa;
int _contxsez;
int _etlarghezza, _etcolonne;
//static bool filter_func_stconvoc(const TRelation* rel);
@ -105,19 +104,32 @@ ts TConvocazioniPerSezione::dati_cartoline()
void TConvocazioniPerSezione::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
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
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case cartoline:
@ -159,7 +171,7 @@ void TConvocazioniPerSezione::set_page(int file, int cnt)
note.set(_note);
}
corpo.update();
for (int i = 0; i < corpo.height(); i++)
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
@ -191,9 +203,7 @@ print_action TConvocazioniPerSezione::postprocess_print(int file, int counter)
bool TConvocazioniPerSezione::preprocess_page(int file, int counter)
{
switch (_tipo_stampa)
{
case elenco:
if (_tipostampa==elenco)
{
TString80 nome = current_cursor()->curr(LF_SOGGETTI).get(SOG_COGNOME);
nome << " ";
@ -214,8 +224,9 @@ bool TConvocazioniPerSezione::preprocess_page(int file, int counter)
}
_contxsez++;
}
break;
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
@ -285,22 +296,22 @@ void TConvocazioniPerSezione::dati_sezione(const TString16 codsez, const TString
bool TConvocazioniPerSezione::set_print(int m)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
case F_CARTOLINE:
_tipo_stampa = dati_cartoline();
_tipostampa = dati_cartoline();
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
_dataini = _msk->get(F_DATAINI);
_datafin = _msk->get(F_DATAFIN);
@ -373,7 +384,7 @@ bool TConvocazioniPerSezione::set_print(int m)
void TConvocazioniPerSezione::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(80);
sep = "ELENCO CONVOCATI";
@ -422,13 +433,15 @@ bool TConvocazioniPerSezione::user_create()
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add(LF_CONVOC, "NUMERO==NUMERO");
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,LF_SOGGETTI,ALIAS_LCP);
//_rel->add("LDN", "CODTAB==COV_PUNTO",1,LF_CONVOC,ALIAS_LDN);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,LF_SOGGETTI);
// per stampare la denominazione della sezione nell'intestazione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT",1,LF_SOGGETTI);
_msk = new TMask("at4400a");
_form_eti = new TStConvoc_form("AT_ETSOG");
_form_car = new TStConvoc_form("AT_ETCAR");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TStConvoc_form(etformato);
_form_car = new TStConvoc_form("ATCARTO1");
return TRUE;
}

View File

@ -73,7 +73,7 @@ BEGIN
OUTPUT F_DENSOT DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_DENSEZ 25
@ -89,7 +89,7 @@ BEGIN
COPY OUTPUT F_CODSEZ
CHECKTYPE NORMAL
HELP "Denominazione sezione da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_CODSOT 2
@ -98,7 +98,7 @@ BEGIN
COPY ALL F_CODSEZ
CHECKTYPE NORMAL
HELP "Codice sottogruppo da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
STRING F_DENSOT 25
@ -112,7 +112,7 @@ BEGIN
COPY OUTPUT F_DENSEZ
CHECKTYPE NORMAL
HELP "Sottogruppo da convocare"
ADD MASK at0700a
ADD MASK batbsez
END
BOOLEAN F_AGGIORNA

243
at/at4500.cpp Executable file
View File

@ -0,0 +1,243 @@
#include <form.h>
#include <mask.h>
#include <msksheet.h>
#include <printapp.h>
#include <utility.h>
#include "soggetti.h"
#include "sezioni.h"
#include <comuni.h>
#include "at4.h"
#include "at4500a.h"
#include "at4500.h"
//#define ALIAS_COMRES 300
//#define ALIAS_COMNAS 400
//#define ALIAS_CTN1 500
//#define ALIAS_CTN2 600
#define ALIAS_LCP 100
//#define ALIAS_CTD 800
// definizione form per tessere associative
class TTessere_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TTessere_form(): TForm() {};
TTessere_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TTessere_form() {};
};
class TStampaTessere : public TPrintapp
{
TRelation* _rel;
TMask* _msk;
TAssoc_array _categorie;
TTessere_form* _form_pag;
int _numdon;
bool _aggiorna;
int _cur;
TDate _data_stampa;
TString _riepilogodon;
static bool filter_func_auto(const TRelation* rel);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
public:
void filtra_sezioni();
TMask& app_mask() { return *_msk; }
TStampaTessere() : _data_stampa(TODAY), _riepilogodon(35) {}
};
HIDDEN inline TStampaTessere& app() { return (TStampaTessere&) main_app(); }
TCursor* TTessere_form::cursor() const { return app().current_cursor(); }
TRelation* TTessere_form::relation() const { return cursor()->relation(); }
HIDDEN bool printer_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
if (!m.query_mode())
{
TString16 config;
config << "TESSERE";
TPrinter& p = printer();
p.set_printtype(normprinter); // Force configuration update
p.read_configuration(config);
if (p.set())
f.message_box("Stampante configurata per stampa tessere");
}
}
return TRUE;
}
void TStampaTessere::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
void TStampaTessere::set_page(int file, int cnt)
{
TPrint_section& corpo = _form_pag->get_body();
corpo.reset();
TForm_item& rigadon = corpo.find_field(TES_RIGADON1);
rigadon.set(_riepilogodon);
corpo.update();
for (word 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
}
bool TStampaTessere::filter_func_auto(const TRelation* rel)
{
bool filtrato = TRUE;
TLocalisamfile& sog = rel->lfile();
filtrato = !(sog.get_bool(SOG_T_STAMPATA));
if (filtrato)
filtrato = (sog.get_int(SOG_TOTDON) >= app()._numdon);
if (filtrato)
{
// filtro per categorie
TAssoc_array& categorie = app()._categorie;
if (categorie.items() != 0)
{
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
}
return filtrato;
}
bool TStampaTessere::preprocess_page(int file, int counter)
{
TLocalisamfile& sogg = current_cursor()->file(LF_SOGGETTI);
const int totdon = sogg.get_int(SOG_TOTDON);
const TDate dataultima = sogg.get(SOG_DATAULTDON);
_riepilogodon = "";
if (totdon != 0)
{
_riepilogodon = "Donazioni fino al ";
_riepilogodon << dataultima.string();
_riepilogodon << " n.";
_riepilogodon << totdon;
}
if (_aggiorna)
{
sogg.put(SOG_T_STAMPATA,TRUE);
sogg.rewrite();
}
return TRUE;
}
bool TStampaTessere::set_print(int m)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
_numdon = _msk->get_int(F_NUMDON);
_aggiorna = _msk->get_bool(F_AGGIORNA);
//const char* filtro = format("(NUM(TOTDON>=%i)) && (T_STAMPATA!=\"X\")",_numdon);
//const char* filtro = format("T_STAMPATA!=\"X\"");
//const char* filtro = format("TOTDON>=%i",_numdon);
//current_cursor()->setfilter(filtro);
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
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);
current_cursor()->set_filterfunction (filter_func_auto, TRUE);
reset_print();
return TRUE;
}
else
return FALSE;
}
bool TStampaTessere::user_create()
{
_rel = new TRelation(LF_SOGGETTI);
//_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
//_rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
//_rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
//_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at4500a");
_msk->set_handler(F_PRINTER, printer_handler);
_form_pag = new TTessere_form("ATTESSER");
TString16 config;
config << "TESSERE";
printer().read_configuration(config);
return TRUE;
}
bool TStampaTessere::user_destroy()
{
delete _msk;
delete _rel;
delete _form_pag;
printer().read_configuration();
return TRUE;
}
int at4500(int argc, char* argv[])
{
TStampaTessere a;
a.run(argc, argv, "Stampa tessere associative");
return 0;
}

7
at/at4500.h Executable file
View File

@ -0,0 +1,7 @@
// stampa tessere associative
// definizione campi del form
#define TES_RIGADON1 25
#define TES_RIGADON2 26
#define TES_RIGADON3 27
#define TES_RIGADON4 28

30
at/at4500a.h Executable file
View File

@ -0,0 +1,30 @@
// stampa tessere associative
// 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_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212
#define F_NUMDON 301
#define F_AGGIORNA 302
#define F_PRINTER 401

283
at/at4500a.uml Executable file
View File

@ -0,0 +1,283 @@
#include "at4500a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 9 2
BEGIN
PROMPT -13 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON F_PRINTER 19 2
BEGIN
PROMPT -23 -11 "Imposta stampante"
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 -11 ""
END
ENDPAGE
PAGE "Stampa tessere associative" -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 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 5
BEGIN
PROMPT 1 5 "Categorie"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 8 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 8 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 1 10 "Opzioni per la stampa tessere"
END
NUMBER F_NUMDON 3
BEGIN
PROMPT 2 11 "Numero minimo di donazioni "
END
BOOLEAN F_AGGIORNA
BEGIN
PROMPT 40 11 "Aggiornare archivio soggetti"
END
ENDPAGE
ENDMASK

333
at/at4600.cpp Executable file
View File

@ -0,0 +1,333 @@
#include <form.h>
#include <mask.h>
#include <msksheet.h>
#include <printapp.h>
#include <utility.h>
#include "soggetti.h"
#include "sezioni.h"
#include <comuni.h>
#include "at4.h"
#include "at4600a.h"
#include "at4500.h"
#define ALIAS_COMDOM 501
#define ALIAS_COMNAS 500
#define ALIAS_LCP 100
// definizione form per tessere associative
class TTessereS_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TTessereS_form(): TForm() {};
TTessereS_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TTessereS_form() {};
};
class TStampaTessereS : public TPrintapp
{
TRelation* _rel;
TIsamtempfile* _sogtmp;
TMask* _msk;
TTessereS_form* _form_pag;
TAssoc_array _asoggetti;
int _numdon;
bool _aggiorna;
int _cur;
TDate _data_stampa;
TString _riepilogodon;
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);
static void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 1);
static bool soggetti_notify(TSheet_field& s, int r, KEY k);
static bool nome_handler(TMask_field& f, KEY k);
static bool codice_handler(TMask_field& f, KEY k);
public:
void filtra_codici();
TMask& app_mask() { return *_msk; }
TStampaTessereS() : _data_stampa(TODAY), _riepilogodon(35) {}
};
HIDDEN inline TStampaTessereS& app() { return (TStampaTessereS&) main_app(); }
TCursor* TTessereS_form::cursor() const { return app().current_cursor(); }
TRelation* TTessereS_form::relation() const { return cursor()->relation(); }
HIDDEN bool printer_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
if (!m.query_mode())
{
TString16 config;
config << "TESSERE";
TPrinter& p = printer();
p.set_printtype(normprinter); // Force configuration update
p.read_configuration(config);
if (p.set())
f.message_box("Stampante configurata per stampa tessere");
}
}
return TRUE;
}
void TStampaTessereS::add_rows_soggetti(TSheet_field& s, int count, int start)
{
if (start == 1)
s.destroy();
for (int r=start; r<start+count; r++)
TToken_string& row = s.row(r-1);
}
void TStampaTessereS::filtra_codici()
{
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
for (int r=0; r < s.items(); r++)
{
TToken_string& row = s.row(r);
const long codice = row.get_long(0);
if (codice != 0)
{
TLocalisamfile soggetti(LF_SOGGETTI);
soggetti.setkey(1);
soggetti.zero();
soggetti.put(SOG_CODICE,codice);
if (soggetti.read() == NOERR)
_sogtmp->write(soggetti.curr());
}
}
}
void TStampaTessereS::set_page(int file, int cnt)
{
TPrint_section& corpo = _form_pag->get_body();
corpo.update();
//TForm_item& rigadon = corpo.find_field(TES_RIGADON1);
//rigadon.set(_riepilogodon);
for (word 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
}
bool TStampaTessereS::preprocess_page(int file, int counter)
{
TLocalisamfile& sogg = current_cursor()->file(LF_SOGGETTI);
const int totdon = sogg.get_int(SOG_TOTDON);
const TDate dataultima = sogg.get(SOG_DATAULTDON);
_riepilogodon = "";
if (totdon != 0)
{
_riepilogodon = "Donazioni fino al ";
_riepilogodon << dataultima.string();
_riepilogodon << " n.";
_riepilogodon << totdon;
}
if (_aggiorna)
{
sogg.put(SOG_T_STAMPATA,TRUE);
sogg.rewrite();
}
current_cursor()->file().remove();
return TRUE;
}
bool TStampaTessereS::set_print(int m)
{
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
s.destroy();
s.force_update();
if (s.items()==0)
add_rows_soggetti(s,50);
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
reset_files();
add_file(LF_SOGGETTI);
_asoggetti.destroy();
for (int r=0; r < s.items(); r++)
{
TToken_string& row = s.row(r);
const long codice = row.get_long(0);
const char* scodice = row.get(0);
if (codice != 0)
_asoggetti.add(scodice);
}
if (_asoggetti.items() != 0)
{
_aggiorna = _msk->get_bool(F_AGGIORNA);
filtra_codici();
}
reset_print();
return TRUE;
}
else
return FALSE;
}
bool TStampaTessereS::user_create()
{
_sogtmp = new TIsamtempfile(LF_SOGGETTI,NULL,TRUE,TRUE);
_rel = new TRelation(_sogtmp);
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
//cursore ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 1));
_msk = new TMask("at4600a");
_msk->set_handler(F_PRINTER, printer_handler);
_form_pag = new TTessereS_form("ATTESSER");
TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
ss.set_notify(soggetti_notify);
ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
TString16 config;
config << "TESSERE";
printer().read_configuration(config);
return TRUE;
}
bool TStampaTessereS::soggetti_notify(TSheet_field& s, int r, KEY k)
{
bool ok = TRUE;
switch (k)
{
case K_INS:
// richiesta inserimento riga
break;
case K_DEL:
case K_CTRL+K_DEL:
// avvenuta cancellazione riga
break;
case K_SPACE:
// inizio modifica riga
break;
case K_TAB:
// entrata riga
{
static bool entering = TRUE;
if (entering)
{
entering = FALSE;
if ((r == s.items()-1) && (r == s.first_empty()))
app().add_rows_soggetti(s,10,r+1);
TToken_string& row = s.row(r);
if (row.empty_items())
s.select(r);
entering = TRUE;
}
}
break;
case K_ENTER:
// uscita da riga modificata
case K_CTRL+K_TAB:
// uscita riga
{
TToken_string& row = s.row(r);
const long codsog = row.get_long(0);
if (codsog != 0)
for (int i=s.items()-1; i>=0; i--)
{
if (i != r)
{
TToken_string& row = s.row(i);
if (codsog == row.get_long(0))
return s.sheet_mask().field(F_S_CODICE).error_box("Soggetto gia' inserito");
}
}
else
{
const char* cognome = row.get(1);
if ((cognome != NULL) && (cognome != "\0"))
s.sheet_mask().field(F_S_NOME).set_focusdirty();
}
}
break;
}
return ok;
}
bool TStampaTessereS::nome_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (f.to_check(k))
{
TMask& m = f.mask();
long codsog = m.get_long(F_S_CODICE);
if (codsog == 0)
f.on_key(K_F9);
}
return ok;
}
bool TStampaTessereS::codice_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (f.to_check(k))
{
TMask& m = f.mask();
long codsog = m.get_long(F_S_CODICE);
if (codsog != 0)
{
TLocalisamfile sog(LF_SOGGETTI);
sog.setkey(1);
sog.zero();
sog.put(SOG_CODICE, codsog);
int err = sog.read();
if (err == NOERR)
{
m.set(F_S_COGNOME, sog.get(SOG_COGNOME));
m.set(F_S_NOME, sog.get(SOG_NOME));
m.set(F_S_DATANASC, sog.get(SOG_DATANASC));
m.set(F_S_TESSAVIS, sog.get(SOG_TESSAVIS));
m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
m.set(F_S_CATDON, sog.get(SOG_CATDON));
}
else
ok = FALSE; // codice non esistente
}
}
return ok;
}
bool TStampaTessereS::user_destroy()
{
delete _sogtmp;
delete _msk;
delete _rel;
delete _form_pag;
printer().read_configuration();
return TRUE;
}
int at4600(int argc, char* argv[])
{
TStampaTessereS a;
a.run(argc, argv, "Stampa tessere singole");
return 0;
}

21
at/at4600a.h Executable file
View File

@ -0,0 +1,21 @@
// stampa tessere associative singole
// definizione campi per maschera di selezione
#define F_AGGIORNA 101
#define F_SOGGETTI 102
#define F_PRINTER 401
// pagina soggetti
#define F_S_CODICE 101
#define F_S_COGNOME 102
#define F_S_NOME 103
#define F_S_DATANASC 104
#define F_S_CODSEZ 105
#define F_S_CODSOT 106
#define F_S_CATDON 107
#define F_S_TESSAVIS 108
#define F_S_DENSEZ 211
#define F_S_DENSOT 212
#define F_S_DESC_CATDON 213

225
at/at4600a.uml Executable file
View File

@ -0,0 +1,225 @@
#include "at4600a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 9 2
BEGIN
PROMPT -13 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON F_PRINTER 19 2
BEGIN
PROMPT -23 -11 "Imposta stampante"
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -33 -11 ""
END
ENDPAGE
PAGE "Selezione manuale" -1 -1 78 20
BOOLEAN F_AGGIORNA
BEGIN
PROMPT 2 2 "Aggiornare archivio soggetti"
GROUP 1
END
SPREADSHEET F_SOGGETTI
BEGIN
PROMPT 2 4 "Soggetti"
ITEM "Codice@8"
ITEM "Cognome@25"
ITEM "Nome@25"
ITEM "Nato il@10"
ITEM "Sez."
ITEM "Sot."
ITEM "Cat."
ITEM "Tessera"
GROUP 1
END
ENDPAGE
ENDMASK
PAGE "Soggetto " -1 -1 78 20
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
NUMBER F_S_CODICE 8
BEGIN
PROMPT 2 1 "Codice "
FLAGS "RG"
USE LF_SOGGETTI KEY 1
INPUT CODICE F_S_CODICE
DISPLAY "Codice@8" 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
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
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
OUTPUT F_S_TESSAVIS TESSAVIS
//CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_COGNOME 25
BEGIN
PROMPT 2 2 "Cognome e nome "
USE LF_SOGGETTI KEY 2
INPUT COGNOME F_S_COGNOME
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
DISPLAY "Nato il@10" DATANASC
DISPLAY "Codice@8" CODICE
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
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
OUTPUT F_S_TESSAVIS TESSAVIS
HELP "Cognome del soggetto"
ADD RUN at0 -0
END
STRING F_S_NOME 25
BEGIN
PROMPT 46 2 ""
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@8" CODICE
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
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
OUTPUT F_S_TESSAVIS TESSAVIS
HELP "Nome del soggetto"
// CHECKTYPE NORMAL
ADD RUN at0 -0
END
DATE F_S_DATANASC
BEGIN
PROMPT 2 3 "Nato il "
FLAGS "D"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 5 "Dati associativi"
END
STRING F_S_CODSEZ 2
BEGIN
PROMPT 2 6 "Sez. "
FLAGS "D"
END
STRING F_S_DENSEZ 25
BEGIN
PROMPT 12 6 ""
FLAGS "D"
END
STRING F_S_CODSOT 2
BEGIN
PROMPT 40 6 "Sot. "
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 50 6 ""
FLAGS "D"
END
STRING F_S_CATDON 2
BEGIN
PROMPT 2 7 "Cat. "
FLAGS "D"
USE CTD
INPUT CODTAB F_S_CATDON
OUTPUT F_S_DESC_CATDON S0
CHECKTYPE NORMAL
END
STRING F_S_TESSAVIS 10
BEGIN
PROMPT 52 7 "Tessera AVIS "
FLAGS "D"
END
STRING F_S_DESC_CATDON 25
BEGIN
PROMPT 12 7 ""
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

516
at/at4700.cpp Executable file
View File

@ -0,0 +1,516 @@
#include <form.h>
#include <msksheet.h>
#include <printapp.h>
#include <recarray.h>
#include <utility.h>
#include "soggetti.h"
#include "donaz.h"
#include "benem.h"
#include "sezioni.h"
#include <comuni.h>
#include "at4.h"
#include "at4100b.h"
#include "at4100c.h"
#include "at4700a.h"
#include "at4500.h"
#define ALIAS_CTD 700 // categoria donatori
#define ALIAS_CTN1 701 // categoria non donatori 1
#define ALIAS_CTN2 702 // categoria non donatori 2
#define ALIAS_TCS 200 // tipi/esiti controlli sanitari
#define ALIAS_LDN 400 // punti di prelievo
#define ALIAS_LDNDON 401 // punti di prelievo
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
#define ALIAS_COMDOM 501 // comune di domicilio
#define ALIAS_COMNAS 500 // comune di nascita
#define ALIAS_BNZ 600 // benemerenze
enum ts { undefined=0, schede=1, etichette=2, cartoline=3, donazioni=4 };
// definizione form per tessere associative
class TSingole_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TSingole_form(): TForm() {};
TSingole_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TSingole_form() {};
};
class TStampeSingole : public TPrintapp
{
TRelation* _rel;
TIsamtempfile* _sogtmp;
TLocalisamfile* _donaz;
TLocalisamfile* _benem;
TRecord_array* _sdonazioni;
TRecord_array* _sbenemerenze;
TMask* _msk;
TSingole_form* _form_sch;
TSingole_form* _form_car;
TSingole_form* _form_eti;
TSingole_form* _form_don;
TAssoc_array _asoggetti;
ts _tipostampa;
int _cur;
TDate _data_stampa;
TString16 _codsez, _codsot, _orario, _datacart;
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
bool _usomodo, _usasez;
int _etlarghezza, _etcolonne;
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);
ts dati_cartolina();
static void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 1);
static bool soggetti_notify(TSheet_field& s, int r, KEY k);
static bool nome_handler(TMask_field& f, KEY k);
static bool codice_handler(TMask_field& f, KEY k);
public:
void filtra_codici();
void dati_sezione(const TString16 codsez, const TString16 codsot);
TMask& app_mask() { return *_msk; }
TStampeSingole() : _data_stampa(TODAY) {}
};
HIDDEN inline TStampeSingole& app() { return (TStampeSingole&) main_app(); }
TCursor* TSingole_form::cursor() const { return app().current_cursor(); }
TRelation* TSingole_form::relation() const { return cursor()->relation(); }
HIDDEN bool printer_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
if (!m.query_mode())
{
TString16 config;
config << "CARTOLINE";
TPrinter& p = printer();
p.set_printtype(normprinter); // Force configuration update
p.read_configuration(config);
if (p.set())
f.message_box("Stampante configurata per stampa cartoline");
}
}
return TRUE;
}
void TStampeSingole::dati_sezione(const TString16 codsez, const TString16 codsot)
{
_intest1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ1);
_intest2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ2);
_intest3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ3);
_intest4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ4);
if (_usasez)
{
if (_presso1.blank())
{
_presso1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE1);
_presso2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE2);
_presso3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE3);
_presso4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE4);
}
if (_orario.blank())
_orario = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVORA);
if (_note.blank())
_note = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVNOTE);
}
return;
}
ts TStampeSingole::dati_cartolina()
{
TMask msk("at4100b");
if (msk.run() == K_ENTER)
{
_invitoper = msk.get(F_INVITOPER);
_data = msk.get(F_DATA);
_presso1 = msk.get(F_PRESSO1);
_presso2 = msk.get(F_PRESSO2);
_presso3 = msk.get(F_PRESSO3);
_presso4 = msk.get(F_PRESSO4);
_datacart = msk.get(F_DATACART);
_orario = msk.get(F_ORARIO);
_note = msk.get(F_NOTE);
_usasez = msk.get_bool(F_USASEZ);
return cartoline;
}
else
return undefined;
}
void TStampeSingole::add_rows_soggetti(TSheet_field& s, int count, int start)
{
if (start == 1)
s.destroy();
for (int r=start; r<start+count; r++)
TToken_string& row = s.row(r-1);
}
void TStampeSingole::filtra_codici()
{
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
for (int r=0; r < s.items(); r++)
{
TToken_string& row = s.row(r);
const long codice = row.get_long(0);
if (codice != 0)
{
TLocalisamfile soggetti(LF_SOGGETTI);
soggetti.setkey(1);
soggetti.zero();
soggetti.put(SOG_CODICE,codice);
if (soggetti.read() == NOERR)
_sogtmp->write(soggetti.curr());
}
}
}
void TStampeSingole::set_page(int file, int cnt)
{
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case schede:
{
TPrint_section& corpo = _form_sch->get_body();
corpo.update_and_print(TRUE);
force_setpage(TRUE);
}
break;
case donazioni:
{
TPrint_section& corpo = _form_don->get_body();
corpo.update_and_print(TRUE);
force_setpage(TRUE);
}
break;
case cartoline:
{
TPrint_section& corpo = _form_car->get_body();
const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
const TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
_codsez = codsez;
_codsot = codsot;
dati_sezione(codsez, codsot);
corpo.reset();
TForm_item& intest1 = corpo.find_field(CAR_INTEST1);
intest1.set(_intest1);
TForm_item& intest2 = corpo.find_field(CAR_INTEST2);
intest2.set(_intest2);
TForm_item& intest3 = corpo.find_field(CAR_INTEST3);
intest3.set(_intest3);
TForm_item& intest4 = corpo.find_field(CAR_INTEST4);
intest4.set(_intest4);
TForm_item& invito = corpo.find_field(CAR_INVITOPER);
invito.set(_invitoper);
TForm_item& data = corpo.find_field(CAR_DATA);
data.set(_data);
TForm_item& presso1 = corpo.find_field(CAR_PRESSO1);
presso1.set(_presso1);
TForm_item& presso2 = corpo.find_field(CAR_PRESSO2);
presso2.set(_presso2);
TForm_item& presso3 = corpo.find_field(CAR_PRESSO3);
presso3.set(_presso3);
TForm_item& presso4 = corpo.find_field(CAR_PRESSO4);
presso4.set(_presso4);
TForm_item& orario = corpo.find_field(CAR_ORARIO);
orario.set(_orario);
TForm_item& datacart = corpo.find_field(CAR_DATACART);
datacart.set(_datacart);
TForm_item& note = corpo.find_field(CAR_NOTE);
note.set(_note);
}
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
}
}
break;
}
}
bool TStampeSingole::preprocess_page(int file, int counter)
{
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
bool TStampeSingole::set_print(int m)
{
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
s.destroy();
s.force_update();
if (s.items()==0)
add_rows_soggetti(s,50);
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_CARTOLINE:
_tipostampa=cartoline;
break;
case F_SCHEDE:
_tipostampa=schede;
break;
case F_ETICHETTE:
_tipostampa=etichette;
break;
case F_DONAZIONI:
_tipostampa=donazioni;
break;
}
if (_tipostampa != undefined)
{
if (_tipostampa == cartoline)
dati_cartolina();
reset_files();
add_file(LF_SOGGETTI);
_asoggetti.destroy();
for (int r=0; r < s.items(); r++)
{
TToken_string& row = s.row(r);
const long codice = row.get_long(0);
const char* scodice = row.get(0);
if (codice != 0)
_asoggetti.add(scodice);
}
if (_asoggetti.items() != 0)
filtra_codici();
reset_print();
return TRUE;
}
else
return FALSE;
}
bool TStampeSingole::user_create()
{
_sogtmp = new TIsamtempfile(LF_SOGGETTI,NULL,TRUE,TRUE);
_rel = new TRelation(_sogtmp);
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add(LF_DONAZ, "CODICE==CODICE", 1);
_rel->add("LDN", "CODTAB==LUOGODON",1,LF_DONAZ, ALIAS_LDNDON);
_rel->add(LF_BENEM, "CODICE==CODICE", 1);
_rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
_rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LDN", "CODTAB==PUNTORACC",1,0,ALIAS_LDN);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add(LF_MEDICI, "CODMED==CODMED");
_donaz = new TLocalisamfile(LF_DONAZ);
_benem = new TLocalisamfile(LF_BENEM);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
_cur = add_cursor(new TCursor(_rel, "", 1));
_msk = new TMask("at4700a");
//_msk->set_handler(F_PRINTER, printer_handler);
_form_car = new TSingole_form("ATCARTO1");
_form_sch = new TSingole_form("AT_PAGIN");
_form_don = new TSingole_form("ATDDONAZ");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TSingole_form(etformato);
TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
ss.set_notify(soggetti_notify);
ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
/*
TString16 config;
config << "CARTOLINE";
printer().read_configuration(config);
*/
return TRUE;
}
bool TStampeSingole::soggetti_notify(TSheet_field& s, int r, KEY k)
{
bool ok = TRUE;
switch (k)
{
case K_INS:
// richiesta inserimento riga
break;
case K_DEL:
case K_CTRL+K_DEL:
// avvenuta cancellazione riga
break;
case K_SPACE:
// inizio modifica riga
break;
case K_TAB:
// entrata riga
{
static bool entering = TRUE;
if (entering)
{
entering = FALSE;
if ((r == s.items()-1) && (r == s.first_empty()))
app().add_rows_soggetti(s,10,r+1);
TToken_string& row = s.row(r);
if (row.empty_items())
s.select(r);
entering = TRUE;
}
}
break;
case K_ENTER:
// uscita da riga modificata
case K_CTRL+K_TAB:
// uscita riga
{
TToken_string& row = s.row(r);
const long codsog = row.get_long(0);
if (codsog != 0)
for (int i=s.items()-1; i>=0; i--)
{
if (i != r)
{
TToken_string& row = s.row(i);
if (codsog == row.get_long(0))
return s.sheet_mask().field(F_S_CODICE).error_box("Soggetto gia' inserito");
}
}
else
{
const char* cognome = row.get(1);
if ((cognome != NULL) && (cognome != "\0"))
s.sheet_mask().field(F_S_NOME).set_focusdirty();
}
}
break;
}
return ok;
}
bool TStampeSingole::nome_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (f.to_check(k))
{
TMask& m = f.mask();
long codsog = m.get_long(F_S_CODICE);
if (codsog == 0)
f.on_key(K_F9);
}
return ok;
}
bool TStampeSingole::codice_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (f.to_check(k))
{
TMask& m = f.mask();
long codsog = m.get_long(F_S_CODICE);
if (codsog != 0)
{
TLocalisamfile sog(LF_SOGGETTI);
sog.setkey(1);
sog.zero();
sog.put(SOG_CODICE, codsog);
int err = sog.read();
if (err == NOERR)
{
m.set(F_S_COGNOME, sog.get(SOG_COGNOME));
m.set(F_S_NOME, sog.get(SOG_NOME));
m.set(F_S_DATANASC, sog.get(SOG_DATANASC));
m.set(F_S_TESSAVIS, sog.get(SOG_TESSAVIS));
m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
m.set(F_S_CATDON, sog.get(SOG_CATDON));
}
else
ok = FALSE; // codice non esistente
}
}
return ok;
}
bool TStampeSingole::user_destroy()
{
delete _sogtmp;
delete _msk;
delete _sdonazioni;
delete _sbenemerenze;
delete _donaz;
delete _benem;
delete _rel;
delete _form_sch;
delete _form_car;
delete _form_eti;
delete _form_don;
//printer().read_configuration();
return TRUE;
}
int at4700(int argc, char* argv[])
{
TStampeSingole a;
a.run(argc, argv, "Stampe singole");
return 0;
}

22
at/at4700a.h Executable file
View File

@ -0,0 +1,22 @@
// stampa etichette/cartoline/schede anagrafiche/dettaglio donazioni singole
// definizione campi per maschera di selezione
#define F_SOGGETTI 101
#define F_CARTOLINE 401
#define F_ETICHETTE 402
#define F_SCHEDE 403
#define F_DONAZIONI 404
// pagina soggetti
#define F_S_CODICE 101
#define F_S_COGNOME 102
#define F_S_NOME 103
#define F_S_DATANASC 104
#define F_S_CODSEZ 105
#define F_S_CODSOT 106
#define F_S_CATDON 107
#define F_S_TESSAVIS 108
#define F_S_DENSEZ 211
#define F_S_DENSOT 212
#define F_S_DESC_CATDON 213

232
at/at4700a.uml Executable file
View File

@ -0,0 +1,232 @@
#include "at4700a.h"
TOOLBAR "" 0 20 0 2
BUTTON F_CARTOLINE 9 2
BEGIN
PROMPT -15 -11 "Cartoline"
MESSAGE EXIT,F_CARTOLINE
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -25 -11 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON F_SCHEDE 9 2
BEGIN
PROMPT -35 -11 "Schede"
MESSAGE EXIT,F_SCHEDE
END
BUTTON F_DONAZIONI 9 2
BEGIN
PROMPT -45 -11 "Donazioni"
MESSAGE EXIT,F_DONAZIONI
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -55 -11 ""
END
ENDPAGE
PAGE "Selezione manuale" -1 -1 78 20
SPREADSHEET F_SOGGETTI
BEGIN
PROMPT 2 4 "Soggetti"
ITEM "Codice@8"
ITEM "Cognome@25"
ITEM "Nome@25"
ITEM "Nato il@10"
ITEM "Sez."
ITEM "Sot."
ITEM "Cat."
ITEM "Tessera"
GROUP 1
END
ENDPAGE
ENDMASK
PAGE "Soggetto " -1 -1 78 20
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
NUMBER F_S_CODICE 8
BEGIN
PROMPT 2 1 "Codice "
FLAGS "RG"
USE LF_SOGGETTI KEY 1
INPUT CODICE F_S_CODICE
DISPLAY "Codice@8" 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
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
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
OUTPUT F_S_TESSAVIS TESSAVIS
//CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_COGNOME 25
BEGIN
PROMPT 2 2 "Cognome e nome "
USE LF_SOGGETTI KEY 2
INPUT COGNOME F_S_COGNOME
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
DISPLAY "Nato il@10" DATANASC
DISPLAY "Codice@8" CODICE
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
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
OUTPUT F_S_TESSAVIS TESSAVIS
HELP "Cognome del soggetto"
ADD RUN at0 -0
END
STRING F_S_NOME 25
BEGIN
PROMPT 46 2 ""
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@8" CODICE
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
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
OUTPUT F_S_TESSAVIS TESSAVIS
HELP "Nome del soggetto"
// CHECKTYPE NORMAL
ADD RUN at0 -0
END
DATE F_S_DATANASC
BEGIN
PROMPT 2 3 "Nato il "
FLAGS "D"
END
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 5 "Dati associativi"
END
STRING F_S_CODSEZ 2
BEGIN
PROMPT 2 6 "Sez. "
FLAGS "D"
END
STRING F_S_DENSEZ 25
BEGIN
PROMPT 12 6 ""
FLAGS "D"
END
STRING F_S_CODSOT 2
BEGIN
PROMPT 40 6 "Sot. "
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 50 6 ""
FLAGS "D"
END
STRING F_S_CATDON 2
BEGIN
PROMPT 2 7 "Cat. "
FLAGS "D"
USE CTD
INPUT CODTAB F_S_CATDON
OUTPUT F_S_DESC_CATDON S0
CHECKTYPE NORMAL
END
STRING F_S_TESSAVIS 10
BEGIN
PROMPT 52 7 "Tessera AVIS "
FLAGS "D"
END
STRING F_S_DESC_CATDON 25
BEGIN
PROMPT 12 7 ""
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

363
at/at4800.cpp Executable file
View File

@ -0,0 +1,363 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <utility.h>
#include "soggetti.h"
#include "donaz.h"
#include "benem.h"
#include "sezioni.h"
#include <comuni.h>
#include "at4.h"
#include "at4100b.h"
#include "at4100c.h"
#include "at4800a.h"
#include "at4500.h"
#define ALIAS_CTD 700 // categoria donatori
#define ALIAS_CTN1 701 // categoria non donatori 1
#define ALIAS_CTN2 702 // categoria non donatori 2
#define ALIAS_TCS 200 // tipi/esiti controlli sanitari
#define ALIAS_LDN 400 // punti di prelievo
#define ALIAS_LDNDON 401 // punti di prelievo
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
#define ALIAS_COMDOM 501 // comune di domicilio
#define ALIAS_COMNAS 500 // comune di nascita
#define ALIAS_BNZ 600 // benemerenze
enum ts { undefined=0, schede=1, etichette=2, cartoline=3, donazioni=4 };
// definizione form per tessere associative
class TPerCodice_form : public TForm
{
public:
virtual TCursor* cursor() const;
virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ;
TPerCodice_form(): TForm() {};
TPerCodice_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {};
virtual ~TPerCodice_form() {};
};
class TStampePerCodice : public TPrintapp
{
TRelation* _rel;
TLocalisamfile* _donaz;
TLocalisamfile* _benem;
TRecord_array* _sdonazioni;
TRecord_array* _sbenemerenze;
TMask* _msk;
TPerCodice_form* _form_sch;
TPerCodice_form* _form_car;
TPerCodice_form* _form_eti;
TPerCodice_form* _form_don;
ts _tipostampa;
int _cur;
TDate _data_stampa;
TString16 _codsez, _codsot, _orario, _datacart;
TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4;
TString80 _note, _intest1, _intest2, _intest3, _intest4;
bool _usomodo, _usasez;
int _etlarghezza, _etcolonne;
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);
ts dati_cartolina();
public:
void dati_sezione(const TString16 codsez, const TString16 codsot);
TMask& app_mask() { return *_msk; }
TStampePerCodice() : _data_stampa(TODAY) {}
};
HIDDEN inline TStampePerCodice& app() { return (TStampePerCodice&) main_app(); }
TCursor* TPerCodice_form::cursor() const { return app().current_cursor(); }
TRelation* TPerCodice_form::relation() const { return cursor()->relation(); }
HIDDEN bool printer_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
if (!m.query_mode())
{
TString16 config;
config << "CARTOLINE";
TPrinter& p = printer();
p.set_printtype(normprinter); // Force configuration update
p.read_configuration(config);
if (p.set())
f.message_box("Stampante configurata per stampa cartoline");
}
}
return TRUE;
}
void TStampePerCodice::dati_sezione(const TString16 codsez, const TString16 codsot)
{
_intest1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ1);
_intest2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ2);
_intest3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ3);
_intest4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ4);
if (_usasez)
{
if (_presso1.blank())
{
_presso1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE1);
_presso2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE2);
_presso3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE3);
_presso4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE4);
}
if (_orario.blank())
_orario = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVORA);
if (_note.blank())
_note = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVNOTE);
}
return;
}
ts TStampePerCodice::dati_cartolina()
{
TMask msk("at4100b");
if (msk.run() == K_ENTER)
{
_invitoper = msk.get(F_INVITOPER);
_data = msk.get(F_DATA);
_presso1 = msk.get(F_PRESSO1);
_presso2 = msk.get(F_PRESSO2);
_presso3 = msk.get(F_PRESSO3);
_presso4 = msk.get(F_PRESSO4);
_datacart = msk.get(F_DATACART);
_orario = msk.get(F_ORARIO);
_note = msk.get(F_NOTE);
_usasez = msk.get_bool(F_USASEZ);
return cartoline;
}
else
return undefined;
}
void TStampePerCodice::set_page(int file, int cnt)
{
switch (_tipostampa)
{
case etichette:
{
TPrint_section& corpo = _form_eti->get_body();
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case schede:
{
TPrint_section& corpo = _form_sch->get_body();
corpo.update_and_print(TRUE);
force_setpage(TRUE);
}
break;
case donazioni:
{
TPrint_section& corpo = _form_don->get_body();
corpo.update_and_print(TRUE);
force_setpage(TRUE);
}
break;
case cartoline:
{
TPrint_section& corpo = _form_car->get_body();
const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
const TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
_codsez = codsez;
_codsot = codsot;
dati_sezione(codsez, codsot);
corpo.reset();
TForm_item& intest1 = corpo.find_field(CAR_INTEST1);
intest1.set(_intest1);
TForm_item& intest2 = corpo.find_field(CAR_INTEST2);
intest2.set(_intest2);
TForm_item& intest3 = corpo.find_field(CAR_INTEST3);
intest3.set(_intest3);
TForm_item& intest4 = corpo.find_field(CAR_INTEST4);
intest4.set(_intest4);
TForm_item& invito = corpo.find_field(CAR_INVITOPER);
invito.set(_invitoper);
TForm_item& data = corpo.find_field(CAR_DATA);
data.set(_data);
TForm_item& presso1 = corpo.find_field(CAR_PRESSO1);
presso1.set(_presso1);
TForm_item& presso2 = corpo.find_field(CAR_PRESSO2);
presso2.set(_presso2);
TForm_item& presso3 = corpo.find_field(CAR_PRESSO3);
presso3.set(_presso3);
TForm_item& presso4 = corpo.find_field(CAR_PRESSO4);
presso4.set(_presso4);
TForm_item& orario = corpo.find_field(CAR_ORARIO);
orario.set(_orario);
TForm_item& datacart = corpo.find_field(CAR_DATACART);
datacart.set(_datacart);
TForm_item& note = corpo.find_field(CAR_NOTE);
note.set(_note);
}
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
}
}
break;
}
}
bool TStampePerCodice::preprocess_page(int file, int counter)
{
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
bool TStampePerCodice::set_print(int m)
{
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_CARTOLINE:
_tipostampa=cartoline;
break;
case F_SCHEDE:
_tipostampa=schede;
break;
case F_ETICHETTE:
_tipostampa=etichette;
break;
case F_DONAZIONI:
_tipostampa=donazioni;
break;
}
if (_tipostampa != undefined)
{
if (_tipostampa == cartoline)
dati_cartolina();
const long codini = _msk->get_long(F_CODINI);
const long codfin = _msk->get_long(F_CODFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (codini!=0)
da.put(SOG_CODICE, codini);
if (codfin!=0)
a.put(SOG_CODICE, codfin);
current_cursor()->setregion(da, a);
reset_files();
add_file(LF_SOGGETTI);
reset_print();
return TRUE;
}
else
return FALSE;
}
bool TStampePerCodice::user_create()
{
_rel = new TRelation(LF_SOGGETTI);
_rel->add(LF_DONAZ, "CODICE==CODICE", 1);
_rel->add("LDN", "CODTAB==LUOGODON",1,LF_DONAZ, ALIAS_LDNDON);
_rel->add(LF_BENEM, "CODICE==CODICE", 1);
_rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1);
_rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2);
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LDN", "CODTAB==PUNTORACC",1,0,ALIAS_LDN);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM);
_rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS);
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add(LF_MEDICI, "CODMED==CODMED");
_donaz = new TLocalisamfile(LF_DONAZ);
_benem = new TLocalisamfile(LF_BENEM);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
_cur = add_cursor(new TCursor(_rel, "", 1));
_msk = new TMask("at4800a");
//_msk->set_handler(F_PRINTER, printer_handler);
_form_car = new TPerCodice_form("ATCARTO1");
_form_sch = new TPerCodice_form("AT_PAGIN");
_form_don = new TPerCodice_form("ATDDONAZ");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TPerCodice_form(etformato);
/*
TString16 config;
config << "CARTOLINE";
printer().read_configuration(config);
*/
return TRUE;
}
bool TStampePerCodice::user_destroy()
{
delete _msk;
delete _sdonazioni;
delete _sbenemerenze;
delete _donaz;
delete _benem;
delete _rel;
delete _form_sch;
delete _form_car;
delete _form_eti;
delete _form_don;
//printer().read_configuration();
return TRUE;
}
int at4800(int argc, char* argv[])
{
TStampePerCodice a;
a.run(argc, argv, "Stampe per codice");
return 0;
}

10
at/at4800a.h Executable file
View File

@ -0,0 +1,10 @@
// stampa etichette/cartoline/scehde/dettaglio donazioni per codice
// definizione campi per maschera di selezione
#define F_CODINI 101 // da codice
#define F_CODFIN 102 // a codice
#define F_CARTOLINE 401
#define F_ETICHETTE 402
#define F_SCHEDE 403
#define F_DONAZIONI 404

56
at/at4800a.uml Executable file
View File

@ -0,0 +1,56 @@
#include "at4800a.h"
TOOLBAR "" 0 20 0 2
BUTTON F_CARTOLINE 9 2
BEGIN
PROMPT -15 -11 "Cartoline"
MESSAGE EXIT,F_CARTOLINE
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -25 -11 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON F_SCHEDE 9 2
BEGIN
PROMPT -35 -11 "Schede"
MESSAGE EXIT,F_SCHEDE
END
BUTTON F_DONAZIONI 9 2
BEGIN
PROMPT -45 -11 "Donazioni"
MESSAGE EXIT,F_DONAZIONI
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -55 -11 ""
END
ENDPAGE
PAGE "Stampe per codice" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Selezione intervallo codici"
END
NUMBER F_CODINI 9
BEGIN
PROMPT 2 2 "Codice iniziale "
HELP "Codice soggetto da cui iniziare la stampa: vuoto = inizio"
END
NUMBER F_CODFIN 9
BEGIN
PROMPT 2 3 "Codice finale "
HELP "Codice soggetto finale per la stampa: vuoto = fine"
END
ENDPAGE
ENDMASK

View File

@ -15,8 +15,24 @@
// data iscrizione
#define AT_DATAISC 108 // data iscrizione se vuota = data prima donazione
// stampa
#define AT_STAMPA80 109 // stampa 80 colonne (dove prevista)
//intervalli di donazione per idoneita' automatiche
#define AT_ETADONNE 110 // limite di et… per intervalli primo caso (eta' fertile)
#define AT_INTSI_F1 111 // intervallo SI per femmine prima fascia
#define AT_INTSI_F2 112 // intervallo SI per femmine seconda fascia
#define AT_INTSI_M 113 // intervallo SI per maschi
#define AT_INTAF_M 114 // intervallo AF per tutti
// definizione etichette
#define AT_ETFORM 115
#define AT_ETLARG 116
#define AT_ETCOL 117
// descrizioni
#define AT_D_CATINI1 151
#define AT_D_CATFIN1 152
#define AT_D_CATINI2 153
#define AT_D_CATFIN2 154
#define AT_D_ETFORM 155

View File

@ -15,9 +15,9 @@ END
ENDPAGE
PAGE "Parametri sezione" -1 -1 76 17
PAGE "Parametri 1" -1 -1 78 20
GROUPBOX DLG_NULL 74 5
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 0 "Primo passaggio di categoria"
END
@ -57,7 +57,7 @@ BEGIN
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 74 6
GROUPBOX DLG_NULL 77 6
BEGIN
PROMPT 1 5 "Secondo passaggio di categoria"
END
@ -111,6 +111,49 @@ BEGIN
FIELD DataIsc
END
BOOLEAN AT_STAMPA80
BEGIN
PROMPT 2 12 "Stampa 80 colonne dove prevista"
HELP "Stampa gli elenchi con il formato 80 colonne dove previsto"
FIELD Stampa80
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 14 "Intervalli di donazione nelle idoneita' automatiche"
END
NUMBER AT_ETADONNE 3
BEGIN
PROMPT 2 15 "Eta' per la suddivisione delle donne in due fasce "
FIELD EtaDonne
END
NUMBER AT_INTSI_F1 3
BEGIN
PROMPT 2 16 "Intervallo SI per femmine 1ø fascia "
FIELD IntSI_F1
END
NUMBER AT_INTSI_F2 3
BEGIN
PROMPT 2 17 "Intervallo SI per femmine 2ø fascia "
FIELD IntSI_F2
END
NUMBER AT_INTSI_M 3
BEGIN
PROMPT 45 16 "Intervallo SI per maschi "
FIELD IntSI_M
END
NUMBER AT_INTAF_M 3
BEGIN
PROMPT 45 17 "Intervallo AF per tutti "
FIELD IntAF_M
END
STRING AT_D_CATINI1 40
BEGIN
PROMPT 30 2 ""
@ -137,4 +180,41 @@ END
ENDPAGE
PAGE "Parametri 2" -1 -1 78 20
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 0 "Etichette soggetti"
END
STRING AT_ETFORM 8
BEGIN
PROMPT 2 1 "Formato "
FIELD EtFormato
USE LF_FORM
INPUT TIPOPROF AT_ETFORM
DISPLAY "Formato@8" TIPOPROF
DISPLAY "Descrizione@50" DESC
OUTPUT AT_ETFORM TIPOPROF
OUTPUT AT_D_ETFORM DESC
END
STRING AT_D_ETFORM 50
BEGIN
PROMPT 2 23 ""
FLAGS "D"
END
NUMBER AT_ETLARG 3
BEGIN
PROMPT 2 2 "Larghezza "
FIELD EtLarghezza
END
NUMBER AT_ETCOL 1
BEGIN
PROMPT 2 3 "Colonne "
FIELD EtColonne
END
ENDMASK

View File

@ -1,7 +1,6 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include "medici.h"
#include <comuni.h>
@ -33,7 +32,8 @@ class TStampaMedici : public TPrintapp
int _cur1, _cur2;
TParagraph_string _cognome_nome, _dencom, _indirizzo;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
int _etlarghezza, _etcolonne;
protected:
virtual bool user_create();
@ -56,19 +56,32 @@ TRelation* TMed_form::relation() const { return cursor()->relation(); }
void TStampaMedici::set_page(int file, int cnt)
{
// costruzione etichette
switch (_tipo_stampa)
switch (_tipostampa)
{
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);
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case elenco:
@ -86,7 +99,7 @@ void TStampaMedici::set_page(int file, int cnt)
bool TStampaMedici::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa==elenco)
{
TString80 nome = current_cursor()->curr().get(MED_COGNOME);
nome << " ";
@ -100,24 +113,27 @@ bool TStampaMedici::preprocess_page(int file, int counter)
_dencom = localita;
_indirizzo = current_cursor()->curr(LF_MEDICI).get(MED_INDIRIZZO);
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
bool TStampaMedici::set_print(int)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
long codfr, codto;
TString80 cogfr, cogto;
@ -164,7 +180,7 @@ bool TStampaMedici::set_print(int)
void TStampaMedici::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
TString16 data_stampa;
@ -195,6 +211,10 @@ bool TStampaMedici::user_create()
_cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome
_msk = new TMask("at6100a");
_form_eti = new TMed_form("AT_ETMED");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
return TRUE;
}

View File

@ -1,7 +1,6 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include "sezioni.h"
#include <comuni.h>
@ -32,7 +31,8 @@ class TStampaSezioni : public TPrintapp
int _cur1, _cur2;
TParagraph_string _dencom, _indirizzo;
TDate _data_stampa;
ts _tipo_stampa;
ts _tipostampa;
int _etlarghezza, _etcolonne;
protected:
virtual bool user_create();
@ -55,19 +55,32 @@ TRelation* TSez_form::relation() const { return cursor()->relation(); }
void TStampaSezioni::set_page(int file, int cnt)
{
switch (_tipo_stampa)
switch (_tipostampa)
{
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);
for (int r=1;r<=_etcolonne;r++)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 riga1 = riga.row();
riga1.cut(_etlarghezza);
int colonna = ((r-1)*_etlarghezza);
TString16 formato;
formato << '@' << colonna << "g";
riga1.insert(formato,0);
set_row(i+1,riga1);
}
if (r < _etcolonne)
++(*current_cursor());
}
}
}
break;
case elenco:
@ -87,7 +100,7 @@ void TStampaSezioni::set_page(int file, int cnt)
bool TStampaSezioni::preprocess_page(int file, int counter)
{
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString256 localita = "";
localita << current_cursor()->curr("LCP").get("S0");
@ -97,24 +110,27 @@ bool TStampaSezioni::preprocess_page(int file, int counter)
_dencom = localita;
_indirizzo = current_cursor()->curr(LF_SEZIONI).get(SEZ_INDIRIZZO);
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
return TRUE;
}
bool TStampaSezioni::set_print(int)
{
_tipo_stampa = undefined;
_tipostampa = undefined;
KEY tasto;
tasto = _msk->run();
switch (tasto)
{
case F_ELENCO:
_tipo_stampa = elenco;
_tipostampa = elenco;
break;
case F_ETICHETTE:
_tipo_stampa = etichette;
_tipostampa = etichette;
break;
}
if (_tipo_stampa != undefined)
if (_tipostampa != undefined)
{
TString16 codfr, codto;
TString80 denfr, dento;
@ -161,7 +177,7 @@ bool TStampaSezioni::set_print(int)
void TStampaSezioni::crea_intestazione()
{
reset_header();
if (_tipo_stampa == elenco)
if (_tipostampa == elenco)
{
TString sep(132);
TString16 data_stampa;
@ -192,6 +208,10 @@ bool TStampaSezioni::user_create()
_cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per denominazione
_msk = new TMask("at6200a");
_form_eti = new TSez_form("AT_ETSEZ");
TConfig config(CONFIG_STUDIO);
TString16 etformato = config.get("EtFormato");
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
return TRUE;
}

View File

@ -1,28 +1,31 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <tabutil.h>
#include <utility.h>
#include <lffiles.h>
#include "donaz.h"
#include "contsan.h"
#include "soggetti.h"
#include "sezioni.h"
#include "at6.h"
#include "at6300a.h"
#define ALIAS_LDN 100
#define ALIAS_LDN 400
class TControlloDonazioni : public TPrintapp
{
TRelation* _rel;
TMask* _msk;
int _counter;
TLocalisamfile* _contsan;
int _contatore, _totfinestampa;
int _cur;
TDate _dataold, _dataini, _datafin;
TString16 _tipodon, _luogodon, _luogoold, _sezold;
TString16 _sezini, _sotini, _tipostampa,_ordinamento;
TString16 _controllo;
bool _stampa80, _primedon;
TParagraph_string _cognome_nome;
protected:
@ -31,10 +34,13 @@ protected:
virtual bool set_print(int m);
virtual void set_page(int file, int cnt);
virtual bool preprocess_page(int file, int counter);
virtual print_action postprocess_print(int file, int counter);
public:
void crea_intestazione();
void header_data(const TDate data, const TString16 luogo, const TString16 sezione);
void header_stampa(const TDate data, const TString16 luogo, const TString16 sezione, const TString16 sottog);
void footer_stampa();
void fine_stampa();
TMask& app_mask() { return *_msk; }
TControlloDonazioni() : _cognome_nome("",35) {}
};
@ -43,30 +49,60 @@ HIDDEN inline TControlloDonazioni& app() { return (TControlloDonazioni&) main_ap
void TControlloDonazioni::set_page(int file, int cnt)
{
set_row(1,"@0g#D", &_counter);
set_row(1,"@7g@pn", FLD(LF_DONAZ,DON_ETICHETTA,"#########"));
set_row(1,"@17g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@26g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@34g#a", &_cognome_nome);
set_row(1,"@70g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@81g@S", FLD(LF_SOGGETTI,SOG_CODSEZ));
set_row(1,"@84g@S", FLD(LF_SOGGETTI,SOG_CODSOT));
set_row(1,"@87g@ld", FLD(LF_DONAZ,DON_DATADON));
set_row(1,"@98g@S", FLD(LF_DONAZ,DON_TIPODON));
set_row(1,"@104g@S", FLD(LF_DONAZ, DON_LUOGODON));
set_row(1,"@110g@S", FLD(LF_SOGGETTI, SOG_GRUPPOAB0));
set_row(1,"@114g@S", FLD(LF_SOGGETTI, SOG_RHANTID));
if (_stampa80)
{
set_row(1,"@0g#D", &_contatore);
set_row(1,"@6g@pn", FLD(LF_DONAZ,DON_ETICHETTA,"#########"));
set_row(1,"@16g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(2,"@16g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@25g#a", &_cognome_nome);
set_row(2,"@25g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@61g@S", FLD(LF_SOGGETTI,SOG_CODSEZ));
set_row(2,"@64g@S", FLD(LF_SOGGETTI,SOG_CODSOT));
set_row(1,"@64g@ld", FLD(LF_DONAZ,DON_DATADON));
set_row(2,"@64g@S", FLD(LF_DONAZ,DON_TIPODON));
//set_row(1,"@104g@S", FLD(LF_DONAZ, DON_LUOGODON));
set_row(1,"@75g@S", FLD(LF_SOGGETTI, SOG_GRUPPOAB0));
set_row(2,"@75g@S", FLD(LF_SOGGETTI, SOG_RHANTID));
set_row(1,"@79g#t", &_controllo);
}
else
{
set_row(1,"@0g#D", &_contatore);
set_row(1,"@7g@pn", FLD(LF_DONAZ,DON_ETICHETTA,"#########"));
set_row(1,"@17g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@26g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
set_row(1,"@34g#a", &_cognome_nome);
set_row(1,"@70g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@81g@S", FLD(LF_SOGGETTI,SOG_CODSEZ));
set_row(1,"@84g@S", FLD(LF_SOGGETTI,SOG_CODSOT));
set_row(1,"@87g@ld", FLD(LF_DONAZ,DON_DATADON));
set_row(1,"@98g@S", FLD(LF_DONAZ,DON_TIPODON));
set_row(1,"@104g@S", FLD(LF_DONAZ, DON_LUOGODON));
set_row(1,"@110g@S", FLD(LF_SOGGETTI, SOG_GRUPPOAB0));
set_row(1,"@114g@S", FLD(LF_SOGGETTI, SOG_RHANTID));
set_row(1,"@118g@S", FLD(LF_SOGGETTI, SOG_FENOTIPORH));
set_row(1,"@125g@S", FLD(LF_SOGGETTI, SOG_KELL));
set_row(1,"@129g@S", FLD(LF_SOGGETTI, SOG_DU));
}
}
bool TControlloDonazioni::preprocess_page(int file, int counter)
{
// contatore soggetti stampati
// per ora non c'è
TString80 nome = current_cursor()->curr(LF_SOGGETTI).get(SOG_COGNOME);
nome << " ";
nome << current_cursor()->curr(LF_SOGGETTI).get(SOG_NOME);
_cognome_nome = nome;
// verifico se ha un controllo sanitario nella data della donazione
TLocalisamfile contsan(LF_CONTSAN);
contsan.setkey(2);
contsan.zero();
contsan.put(CON_DATACON,current_cursor()->curr().get(DON_DATADON));
contsan.put(CON_CODICE,current_cursor()->curr().get(DON_CODICE));
if (contsan.read() == NOERR)
_controllo = contsan.get(CON_TIPOCON);
else
_controllo = " ";
// salto pagina se cambio punto di rottura
switch (_tipostampa[0])
{
@ -76,10 +112,10 @@ bool TControlloDonazioni::preprocess_page(int file, int counter)
if (datanew != _dataold )
{
if (_dataold.ok())
printer().formfeed();
footer_stampa();
_dataold = datanew;
header_data(datanew,"","");
_counter = 0;
header_stampa(datanew,"","","");
_contatore = 0;
}
}
break;
@ -89,34 +125,76 @@ bool TControlloDonazioni::preprocess_page(int file, int counter)
if (luogonew != _luogoold )
{
if (_luogoold != "****")
printer().formfeed();
footer_stampa();
_luogoold = luogonew;
header_data(NULLDATE,luogonew,"");
_counter = 0;
header_stampa(NULLDATE,luogonew,"","");
_contatore = 0;
}
}
break;
case 'S':
{
TString16 seznew = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ);
{
TString16 sezione = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ);
TString16 sottog = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT);
TString16 seznew = "";
seznew << sezione;
seznew << "/";
seznew << current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT);
seznew << sottog;
if (seznew != _sezold )
{
if (_sezold != "****")
printer().formfeed();
footer_stampa();
_sezold = seznew;
header_data(NULLDATE,"",seznew);
_counter = 0;
header_stampa(NULLDATE,"",sezione,sottog);
_contatore = 0;
}
}
break;
}
_counter++;
// salto pagina se non ci sono abbastanza righe per il record
if ((_stampa80) && (printer().rows_left() < 2))
printer().formfeed();
_contatore++;
_totfinestampa++;
return TRUE;
}
void TControlloDonazioni::header_data(const TDate data, const TString16 luogo, const TString16 sezione)
print_action TControlloDonazioni::postprocess_print(int file, int counter)
{
if (_contatore > 0)
footer_stampa();
if (_totfinestampa > 0)
fine_stampa();
return NEXT_PAGE;
}
void TControlloDonazioni::footer_stampa()
{
// stampa totale soggetti a fine pagina
reset_footer();
TString sep(80);
sep.fill('-');
set_footer(1, (const char *) sep);
set_footer(2,"TOTALE DONAZIONI %d", _contatore);
printer().formfeed();
reset_footer();
}
void TControlloDonazioni::fine_stampa()
{
// stampa totale soggetti a fine stampa
reset_footer();
printer().footerlen(20);
TString sep(80);
sep.fill('-');
set_footer(1, (const char *) sep);
set_footer(2,"DONAZIONI TOTALI STAMPATE %d", _totfinestampa);
printer().formfeed();
reset_footer();
}
void TControlloDonazioni::header_stampa(const TDate data, const TString16 luogo, const TString16 sezione, const TString16 sottog)
{
TString intestazione(132);
intestazione = "STAMPA DI CONTROLLO DONAZIONI ";
@ -130,21 +208,54 @@ void TControlloDonazioni::header_data(const TDate data, const TString16 luogo, c
break;
case 'L':
{
intestazione << "PER LUOGO ";
intestazione << "PER PUNTO DI PRELIEVO ";
intestazione << luogo;
intestazione << " ";
TTable ldn("LDN");
ldn.put("CODTAB",luogo);
if (ldn.read() == NOERR)
intestazione << ldn.get("S0");
}
break;
case 'S':
{
intestazione << "PER SEZIONE ";
intestazione << sezione;
if (sottog.not_empty())
{
intestazione << "/";
intestazione << sottog;
}
TLocalisamfile sez(LF_SEZIONI);
sez.setkey(1);
TRectype& recsez = sez.curr();
recsez.zero();
recsez.put(SEZ_CODSEZ, sezione);
recsez.put(SEZ_CODSOT, sottog);
if (sez.read() == NOERR)
{
intestazione << " ";
intestazione << recsez.get(SEZ_DENSEZ);
TString80 densot = recsez.get(SEZ_DENSOT);
if (densot.not_empty())
{
intestazione << "/";
intestazione << densot;
}
}
}
break;
}
intestazione.center_just();
if (_stampa80)
intestazione.center_just(80);
else
intestazione.center_just(132);
set_header(1,"@0g%s", (const char*) intestazione);
intestazione = "Pag. @#";
set_header(1, "@110g%s", (const char*) intestazione);
if (_stampa80)
set_header(1, "@73g%s", (const char*) intestazione);
else
set_header(1, "@110g%s", (const char*) intestazione);
return;
}
@ -160,6 +271,7 @@ bool TControlloDonazioni::set_print(int m)
_datafin = _msk->get_date(F_DATAFIN);
_tipodon = _msk->get(F_TIPODON);
_luogodon = _msk->get(F_LUOGODON);
_primedon = _msk->get_bool(F_PRIMEDON);
_tipostampa = _msk->get(F_TIPOSTAMPA);
_ordinamento = _msk->get(F_ORDINAMENTO);
@ -188,7 +300,7 @@ bool TControlloDonazioni::set_print(int m)
chiave << "92->ETICHETTA";
break;
}
TString80 filtro = "";
TString256 filtro = "";
// filtro per tipo donazione
if (_tipodon.not_empty())
filtro = format("(TIPODON == \"%s\")",(const char*)_tipodon);
@ -203,6 +315,17 @@ bool TControlloDonazioni::set_print(int m)
filtro << format("(LUOGODON == \"%s\")",(const char*)_luogodon);
}
}
if (_primedon)
{
if (filtro.empty())
filtro = format("(PRIMADON == \"X\")");
else
{
filtro << " && ";
filtro << format("(PRIMADON == \"X\")");
}
}
// filtro per sezione/sottogruppo
if (_sezini.not_empty())
{
@ -231,9 +354,11 @@ bool TControlloDonazioni::set_print(int m)
da.put(DON_DATADON, _dataini);
if (_datafin.ok())
a.put(DON_DATADON, _datafin);
_cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a));
current_cursor()->setfilter((const char*) filtro, TRUE);
_counter = 0;
current_cursor()->setregion(da, a);
current_cursor()->setfilter(filtro, TRUE);
((TSorted_cursor*)current_cursor())->change_order(chiave);
_contatore = 0;
_totfinestampa = 0;
_dataold = NULLDATE;
_luogoold = "****";
_sezold = "****";
@ -250,19 +375,24 @@ bool TControlloDonazioni::set_print(int m)
void TControlloDonazioni::crea_intestazione()
{
reset_header();
TString sep(132);
sep = "Selezioni della stampa: ";
if (_sezini.not_empty())
{
sep << "Sez. ";
sep << _sezini;
if (_sotini.not_empty())
TString sep(132);
if (_primedon)
sep = "PRIME DONAZIONI EFFETTUATE ";
else
{
sep = "Selezioni della stampa: ";
if (_sezini.not_empty())
{
sep << "/";
sep << _sotini;
}
sep << "; ";
}
sep << "Sez. ";
sep << _sezini;
if (_sotini.not_empty())
{
sep << "/";
sep << _sotini;
}
sep << "; ";
}
}
if (_dataini.ok())
{
sep << "Dal ";
@ -287,10 +417,23 @@ void TControlloDonazioni::crea_intestazione()
sep << _luogodon;
sep << "; ";
}
sep.center_just();
if (_stampa80)
sep.center_just(80);
else
sep.center_just(132);
set_header(2,"@0g%s", (const char*) sep);
set_header(3,"@0gProg.@7gEt.sacca@17gCodice@26gTessera@34gCognome e nome@70gNato il@81gSe/So@87gData don.@98gTipo@104gLuogo@110gGr.@114gRh");
set_header(4,"@0g------@7g---------@17g--------@26g-------@34g-----------------------------------@70g----------@81g-----@87g----------@98g----@104g-----@110g---@114g---");
if (_stampa80)
{
set_header(3,"@0gProg.@6gEt.sacca@16gCodice@25gCognome e nome@61gSe@64gData don.@75gGr.");
set_header(4,"@16gTessera@25gData nascita@61gSo@64gTipo don.@75gRh");
set_header(5,"@0g-----@6g---------@16g--------@25g-----------------------------------@61g--@64g----------@75g---");
}
else
{
set_header(3,"@0gProg.@7gEt.sacca@17gCodice@26gTessera@34gCognome e nome@70gNato il@81gSe/So@87gData don.@98gTipo@104gLuogo@110gGr.@114gRh@118gFen.Rh@125gKellDu");
set_header(4,"@0g------@7g---------@17g--------@26g-------@34g-----------------------------------@70g----------@81g-----@87g----------@98g----@104g-----@110g---@114g---@118g------@125g--- ---");
}
printer().footerlen(3);
}
bool TControlloDonazioni::user_create()
@ -299,6 +442,10 @@ bool TControlloDonazioni::user_create()
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
_rel->add("LDN", "CODTAB==LUOGODON",1,0,ALIAS_LDN);
_msk = new TMask("at6300a");
_contsan = new TLocalisamfile(LF_CONTSAN);
add_cursor(new TSorted_cursor(_rel,"","",2));
TConfig config(CONFIG_STUDIO);
_stampa80 = config.get_bool("Stampa80");
return TRUE;
}
@ -306,6 +453,7 @@ bool TControlloDonazioni::user_destroy()
{
delete _msk;
delete _rel;
delete _contsan;
return TRUE;
}

View File

@ -13,7 +13,8 @@
#define F_DATAFIN 110
#define F_TIPODON 111
#define F_LUOGODON 112
#define F_TIPOSTAMPA 113
#define F_ORDINAMENTO 114
#define F_PRIMEDON 113
#define F_TIPOSTAMPA 114
#define F_ORDINAMENTO 115
#define F_D_TIPODON 201
#define F_D_LUOGODON 202

View File

@ -117,9 +117,9 @@ END
// HELP "Sottogruppo finale"
//END
GROUPBOX DLG_NULL 77 5
GROUPBOX DLG_NULL 77 6
BEGIN
PROMPT 1 5 "Selezione dati per la stampa"
PROMPT 1 5 "Opzioni per la stampa"
END
DATA F_DATAINI
@ -166,15 +166,20 @@ BEGIN
WARNING "Codice non presente"
END
STRING F_D_LUOGODON 30
STRING F_D_LUOGODON 50 30
BEGIN
PROMPT 26 8 ""
FLAGS "D"
END
BOOLEAN F_PRIMEDON
BEGIN
PROMPT 2 9 "Stampa solo prime donazioni"
END
RADIOBUTTON F_TIPOSTAMPA 25
BEGIN
PROMPT 1 10 "Stampa per "
PROMPT 1 11 "Stampa per "
ITEM "D|Data donazione"
ITEM "L|Punto prelievo"
ITEM "S|Sezione/Sottogruppo"
@ -182,7 +187,7 @@ END
RADIOBUTTON F_ORDINAMENTO 35
BEGIN
PROMPT 30 10 "Ordinamento per data donazione e ..."
PROMPT 30 11 "Ordinamento per data donazione e ..."
ITEM "C|Cognome e nome"
ITEM "I|Inserimento"
ITEM "E|Etichetta sacca"

View File

@ -1,7 +1,6 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <lffiles.h>
#include "soggetti.h"
#include "sezioni.h"
@ -21,11 +20,11 @@ class TStampaIncompleti : public TPrintapp
TMask* _msk;
TAssoc_array _catdon;
TAssoc_array _catnondon;
int _cur;
TParagraph_string _cognome_nome, _dencom;
TDate _data_stampa;
TString16 _codsez, _codsot;
bool _indirizzo, _datanasc, _categoria, _sezione, _gruppoab0, _rhantid;
bool _indirizzo, _datanasc, _categoria, _sezione, _gruppoab0;
bool _rhantid, _tessera, _telabi, _cf;
protected:
virtual bool user_create();
@ -75,6 +74,7 @@ void TStampaIncompleti::set_page(int file, int cnt)
set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@49g#a", &_dencom);
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
set_row(3,"");
}
bool TStampaIncompleti::filter_func_incompleti(const TRelation* rel)
@ -102,9 +102,9 @@ bool TStampaIncompleti::filter_func_incompleti(const TRelation* rel)
}
if (app()._catdon.items() == 0 && app()._catnondon.items() == 0)
filtrato = TRUE;
incompleto = !(app()._indirizzo || app()._datanasc
|| app()._categoria || app()._sezione
|| app()._gruppoab0 || app()._rhantid);
incompleto = !(app()._indirizzo || app()._datanasc || app()._categoria
|| app()._sezione || app()._gruppoab0 || app()._rhantid
|| app()._tessera || app()._telabi || app()._cf);
if (filtrato && app()._indirizzo && !incompleto)
{
@ -139,6 +139,21 @@ bool TStampaIncompleti::filter_func_incompleti(const TRelation* rel)
TString16 rhantid = sog.get(SOG_RHANTID);
incompleto = rhantid.empty();
}
if (filtrato && app()._tessera && !incompleto)
{
TString16 tessera = sog.get(SOG_TESSAVIS);
incompleto = tessera.empty();
}
if (filtrato && app()._telabi && !incompleto)
{
TString16 telabi = sog.get(SOG_TELABI);
incompleto = telabi.empty();
}
if (filtrato && app()._cf && !incompleto)
{
TString16 cf = sog.get(SOG_CF);
incompleto = cf.empty();
}
filtrato = (filtrato && incompleto);
return filtrato;
}
@ -198,6 +213,8 @@ bool TStampaIncompleti::preprocess_page(int file, int counter)
_codsot = codsot;
header_sezione(codsez, codsot);
}
if (printer().rows_left()<3)
printer().formfeed();
return TRUE;
}
@ -254,6 +271,9 @@ bool TStampaIncompleti::set_print(int m)
_sezione = _msk->get_bool(F_SEZIONE);
_gruppoab0 = _msk->get_bool(F_GRUPPOAB0);
_rhantid = _msk->get_bool(F_RHANTID);
_tessera = _msk->get_bool(F_TESSERA);
_telabi = _msk->get_bool(F_TELABI);
_cf = _msk->get_bool(F_CF);
//current_cursor()->setfilter("DOM_CODCOM == \"\"");
current_cursor()->set_filterfunction (filter_func_incompleti);
reset_print();
@ -276,12 +296,33 @@ void TStampaIncompleti::crea_intestazione()
sep = "";
sep << "Pag. @#";
set_header(2, "@120g%s", (const char*) sep);
sep = "DATI MANCANTI: ";
if (_indirizzo)
sep << "INDIRIZZO - ";
if (_datanasc)
sep << "DATA NASCITA - ";
if (_gruppoab0)
sep << "GRUPPO AB0 - ";
if (_rhantid)
sep << "RH/ANTID - ";
if (_sezione)
sep << "SEZIONE - ";
if (_categoria)
sep << "CATEGORIA - ";
if (_tessera)
sep << "TESSERA - ";
if (_telabi)
sep << "TEL. ABIT. - ";
if (_cf)
sep << "COD. FISCALE - ";
sep.center_just();
set_header(3, (const char *) sep);
sep = "";
sep.fill('-');
set_header(3, (const char *) sep);
set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
set_header(5,"@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
set_header(4, (const char *) sep);
set_header(5,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
set_header(6,"@49gCAP/Località/Comune/Prov.@116gTelefono altro");
set_header(7,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
}
bool TStampaIncompleti::user_create()
@ -289,10 +330,8 @@ bool TStampaIncompleti::user_create()
_rel = new TRelation(LF_SOGGETTI);
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==DOM_CODCOM");
// per stampare nell'intestazione la denominazione della sezione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
// ordinamento per sezione+sottogruppo+cognome+nome
_cur = add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TCursor(_rel, "", 3));
_msk = new TMask("at6400a");
return TRUE;
}

View File

@ -42,3 +42,6 @@
#define F_RHANTID 404
#define F_CATEGORIA 405
#define F_SEZIONE 406
#define F_TESSERA 407
#define F_TELABI 408
#define F_CF 409

View File

@ -1,5 +1,19 @@
#include "at6400a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
END
PAGE "Stampa soggetti incompleti" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
@ -369,9 +383,9 @@ BEGIN
FLAGS "D"
END
GROUPBOX DLG_NULL 77 4
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 14 "Soggetti con i seguenti dati incompleti"
PROMPT 1 14 "Soggetti con i seguenti dati mancanti"
END
BOOLEAN F_INDIRIZZO
@ -386,32 +400,37 @@ END
BOOLEAN F_CATEGORIA
BEGIN
PROMPT 27 15 "Categoria"
PROMPT 2 17 "Categoria"
END
BOOLEAN F_SEZIONE
BEGIN
PROMPT 27 16 "Sezione di appartenenza"
PROMPT 27 15 "Sezione di appartenenza"
END
BOOLEAN F_GRUPPOAB0
BEGIN
PROMPT 57 15 "Gruppo AB0"
PROMPT 27 16 "Gruppo AB0"
END
BOOLEAN F_RHANTID
BEGIN
PROMPT 57 16 "Rh/AntiD"
PROMPT 27 17 "Rh/AntiD"
END
BUTTON DLG_OK 9 2
BOOLEAN F_TESSERA
BEGIN
PROMPT -12 -1 ""
PROMPT 57 15 "Tessera AVIS"
END
BUTTON DLG_QUIT 9 2
BOOLEAN F_TELABI
BEGIN
PROMPT -22 -1 ""
PROMPT 57 16 "Tel. abit."
END
BOOLEAN F_CF
BEGIN
PROMPT 57 17 "Codice fiscale"
END
ENDPAGE

View File

@ -2,7 +2,6 @@
#include <mask.h>
#include <printapp.h>
#include <utility.h>
#include <lffiles.h>
#include "contsan.h"
#include "soggetti.h"
@ -11,7 +10,7 @@
#include "at6.h"
#include "at6500a.h"
#define ALIAS_TCS 100
#define ALIAS_TCS 200
class TControlloControlli : public TPrintapp
{

View File

@ -1,5 +1,5 @@
#include <applicat.h>
#include <execp.h>
//#include <execp.h>
#include <mask.h>
#include <printer.h>
#include <progind.h>
@ -7,7 +7,7 @@
#include <relation.h>
#include <tabutil.h>
#include <urldefid.h>
#include <lffiles.h>
#include <utility.h>
#include "at6.h"
@ -94,6 +94,7 @@ class TRiepilogoDonazioni : public TApplication
TAssoc_array* _colonne;
TArray _righe; // array per riepilogo donazioni
TArray _righe_prime; // array per riepilogo prime don
TString16 _sezini, _sotini, _sezfin, _sotfin;
protected:
virtual bool create();
@ -244,10 +245,10 @@ bool TRiepilogoDonazioni::menu(MENU_TAG m)
_dataini = msk.get(F_DATAINI);
_datafin = msk.get(F_DATAFIN);
_primedon = msk.get_bool(F_PRIMEDON);
//const TString16 sezini = _msk->get(F_SEZINI);
//const TString16 sotini = _msk->get(F_SOTINI);
//const TString16 sezfin = _msk->get(F_SEZFIN);
//const TString16 sotfin = _msk->get(F_SOTFIN);
_sezini = _msk->get(F_SEZINI);
_sotini = _msk->get(F_SOTINI);
_sezfin = _msk->get(F_SEZFIN);
_sotfin = _msk->get(F_SOTFIN);
if (riepilogo())
stampa();
}
@ -576,8 +577,51 @@ bool TRiepilogoDonazioni::riepilogo()
da.put(DON_DATADON, _dataini);
if (_datafin.ok())
a.put(DON_DATADON, _datafin);
_cur = new TCursor(_rel, "", 2, &da, &a);
//current_cursor()->setfilter((const char*) filtro, TRUE);
_cur = new TCursor(_rel, "", 2, &da, &a);
TString256 filtro = "";
// filtro per sezione/sottogruppo
if (_sezini.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
else
{
filtro << " && ";
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
}
if (_sotini.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
else
{
filtro << " && ";
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
}
}
}
if (_sezfin.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
else
{
filtro << " && ";
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
}
if (_sotfin.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
else
{
filtro << " && ";
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
}
}
}
_cur->setfilter((const char*) filtro, TRUE);
TString16 codsez, codsot, tipodon;
TDate datadon;
int anno, mese;
@ -645,6 +689,6 @@ bool TRiepilogoDonazioni::riepilogo()
int at6600(int argc, char* argv[])
{
TRiepilogoDonazioni a;
a.run(argc, argv, "Riepilogo donazioni");
a.run(argc, argv, "Riepilogo mensile donazioni");
return 0;
}

View File

@ -1,5 +1,5 @@
#include <applicat.h>
#include <execp.h>
//#include <execp.h>
#include <mask.h>
#include <printer.h>
#include <progind.h>
@ -7,7 +7,7 @@
#include <relation.h>
#include <tabutil.h>
#include <urldefid.h>
#include <lffiles.h>
#include <utility.h>
#include "at6.h"
@ -92,6 +92,7 @@ class TRiepilogoGiornaliero : public TApplication
TAssoc_array* _colonne;
TArray _righe; // array per riepilogo donazioni
TArray _righe_prime; // array per riepilogo prime don
TString16 _sezini, _sotini, _sezfin, _sotfin;
protected:
virtual bool create();
@ -178,10 +179,10 @@ bool TRiepilogoGiornaliero::menu(MENU_TAG m)
_dataini = msk.get(F_DATAINI);
_datafin = msk.get(F_DATAFIN);
_primedon = msk.get_bool(F_PRIMEDON);
//const TString16 sezini = _msk->get(F_SEZINI);
//const TString16 sotini = _msk->get(F_SOTINI);
//const TString16 sezfin = _msk->get(F_SEZFIN);
//const TString16 sotfin = _msk->get(F_SOTFIN);
_sezini = _msk->get(F_SEZINI);
_sotini = _msk->get(F_SOTINI);
_sezfin = _msk->get(F_SEZFIN);
_sotfin = _msk->get(F_SOTFIN);
if (riepilogo())
stampa();
}
@ -458,7 +459,50 @@ bool TRiepilogoGiornaliero::riepilogo()
if (_datafin.ok())
a.put(DON_DATADON, _datafin);
_cur = new TCursor(_rel, "", 2, &da, &a);
//current_cursor()->setfilter((const char*) filtro, TRUE);
TString256 filtro = "";
// filtro per sezione/sottogruppo
if (_sezini.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
else
{
filtro << " && ";
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
}
if (_sotini.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
else
{
filtro << " && ";
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
}
}
}
if (_sezfin.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
else
{
filtro << " && ";
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
}
if (_sotfin.not_empty())
{
if (filtro.empty())
filtro = format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
else
{
filtro << " && ";
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
}
}
}
_cur->setfilter((const char*) filtro, TRUE);
TString16 codsez, codsot, tipodon;
int anno, mese, giorno;
TDate data;

View File

@ -4,7 +4,7 @@
#include "at7.h"
#define usage "Error - usage : %s -{0|1|2|3|4}"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8}"
int main(int argc,char** argv)
@ -24,6 +24,14 @@ int main(int argc,char** argv)
rt = at7400(argc,argv) ; break;
case 4:
rt = at7500(argc,argv) ; break;
case 5:
rt = at7600(argc,argv) ; break;
case 6:
rt = at7700(argc,argv) ; break;
case 7:
rt = at7800(argc,argv) ; break;
case 8:
rt = at7900(argc,argv) ; break;
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -6,6 +6,10 @@ int at7200(int argc, char* argv[]);
int at7300(int argc, char* argv[]);
int at7400(int argc, char* argv[]);
int at7500(int argc, char* argv[]);
int at7600(int argc, char* argv[]);
int at7700(int argc, char* argv[]);
int at7800(int argc, char* argv[]);
int at7900(int argc, char* argv[]);
#endif // __AT7_H

Some files were not shown because too many files have changed in this diff Show More