From 1e7361b7c23d39fc880ab8896ab80b4c953956e8 Mon Sep 17 00:00:00 2001 From: cris Date: Thu, 14 Aug 1997 13:08:40 +0000 Subject: [PATCH] aggiunto statistiche donazioni e varie di adeguamento alla versione git-svn-id: svn://10.65.10.50/trunk@5060 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at0100a.uml | 1 - at/at0100b.uml | 1 - at/at0100c.uml | 1 - at/at0200.cpp | 2 +- at/at0200a.uml | 1 - at/at0300.cpp | 2 +- at/at0300a.uml | 1 - at/at0400.cpp | 2 +- at/at0400a.uml | 1 - at/at0500.cpp | 10 +- at/at0500a.uml | 2 +- at/at0700a.uml | 1 - at/at0800a.uml | 1 - at/at1100.cpp | 2 +- at/at1100a.uml | 2 +- at/at1200.cpp | 2 +- at/at1200a.uml | 2 +- at/at1300.cpp | 2 +- at/at1300a.uml | 2 +- at/at1400.cpp | 2 +- at/at1400a.uml | 1 - at/at1500.cpp | 2 +- at/at1500a.uml | 2 +- at/at1600.cpp | 2 +- at/at1600a.uml | 2 +- at/at2100.cpp | 2 +- at/at2100a.uml | 2 +- at/at2200.cpp | 2 +- at/at2200a.uml | 2 +- at/at2300.cpp | 2 +- at/at2300a.uml | 2 +- at/at2400.cpp | 2 +- at/at2400a.uml | 2 +- at/at2500.cpp | 2 +- at/at2500a.uml | 2 +- at/at2600.cpp | 2 +- at/at2600a.uml | 2 +- at/at2700.cpp | 2 +- at/at2700a.uml | 2 +- at/at3100.cpp | 6 +- at/at4100.cpp | 2 +- at/at4100a.uml | 2 +- at/at4100b.uml | 1 - at/at4200.cpp | 2 +- at/at4200a.uml | 2 +- at/at4300.cpp | 244 ++++++++++--------- at/at4300a.h | 5 +- at/at4300a.uml | 22 +- at/at4400.cpp | 2 +- at/at4400a.uml | 2 +- at/at6.cpp | 8 +- at/at6.h | 5 +- at/at6.url | 18 ++ at/at6100.cpp | 2 +- at/at6100a.uml | 3 +- at/at6200.cpp | 3 +- at/at6200a.uml | 3 +- at/at6300.cpp | 27 +- at/at6300a.uml | 6 +- at/at6400.cpp | 2 +- at/at6400a.uml | 2 +- at/at6500.cpp | 275 +++++++++++++-------- at/at6500a.h | 27 +- at/at6500a.uml | 156 +++++++----- at/at6600.cpp | 650 +++++++++++++++++++++++++++++++++++++++++++++++++ at/at6600a.h | 15 ++ at/at6600a.uml | 153 ++++++++++++ at/at6700.cpp | 536 ++++++++++++++++++++++++++++++++++++++++ at/at6700a.h | 15 ++ at/at6700a.uml | 153 ++++++++++++ at/at7.cpp | 4 +- at/at7.h | 1 + at/at7100.cpp | 2 +- at/at7100a.uml | 1 - at/at7200.cpp | 2 +- at/at7200a.uml | 1 - at/at7300.cpp | 2 +- at/at7300a.uml | 1 - at/at7400.cpp | 2 +- at/at7400a.uml | 1 - at/at7500.cpp | 17 +- at/at7500a.uml | 1 - at/atstatd.h | 11 + 83 files changed, 2075 insertions(+), 397 deletions(-) create mode 100755 at/at6600.cpp create mode 100755 at/at6600a.h create mode 100755 at/at6600a.uml create mode 100755 at/at6700.cpp create mode 100755 at/at6700a.h create mode 100755 at/at6700a.uml create mode 100755 at/atstatd.h diff --git a/at/at0100a.uml b/at/at0100a.uml index d2a8a55a7..025001700 100755 --- a/at/at0100a.uml +++ b/at/at0100a.uml @@ -1,5 +1,4 @@ #include "at0100a.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at0100b.uml b/at/at0100b.uml index c5a308593..d23f41827 100755 --- a/at/at0100b.uml +++ b/at/at0100b.uml @@ -1,5 +1,4 @@ #include "at0100b.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at0100c.uml b/at/at0100c.uml index 3461f068e..7810dc582 100755 --- a/at/at0100c.uml +++ b/at/at0100c.uml @@ -1,5 +1,4 @@ #include "at0100c.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at0200.cpp b/at/at0200.cpp index b8187bc19..c51864e97 100755 --- a/at/at0200.cpp +++ b/at/at0200.cpp @@ -10,9 +10,9 @@ #include #include #include +#include #include "at0.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF // nomi campi maschera #include "at0200a.h" diff --git a/at/at0200a.uml b/at/at0200a.uml index 9a83ca67a..0971a78aa 100755 --- a/at/at0200a.uml +++ b/at/at0200a.uml @@ -1,5 +1,4 @@ #include "at0200a.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at0300.cpp b/at/at0300.cpp index 8dbe81de6..0f1f46688 100755 --- a/at/at0300.cpp +++ b/at/at0300.cpp @@ -10,9 +10,9 @@ #include #include #include +#include #include "at0.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF // nomi campi maschera #include "at0300a.h" diff --git a/at/at0300a.uml b/at/at0300a.uml index 6eb6c6eaa..f533583c0 100755 --- a/at/at0300a.uml +++ b/at/at0300a.uml @@ -1,5 +1,4 @@ #include "at0300a.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at0400.cpp b/at/at0400.cpp index 93b8e4b14..ec553472f 100755 --- a/at/at0400.cpp +++ b/at/at0400.cpp @@ -5,9 +5,9 @@ #include #include #include +#include #include "at0.h" -#include "lf.h" #include "atlib.h" // nomi campi maschera diff --git a/at/at0400a.uml b/at/at0400a.uml index 685ebda46..70bf50cfc 100755 --- a/at/at0400a.uml +++ b/at/at0400a.uml @@ -1,5 +1,4 @@ #include "at0400a.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at0500.cpp b/at/at0500.cpp index 6d7d8106c..1e1e9c9c9 100755 --- a/at/at0500.cpp +++ b/at/at0500.cpp @@ -1,17 +1,17 @@ #include #include #include +#include -#include "lf.h" +#include "at0.h" +#include "at0500a.h" + +// nomi dei campi #include "soggetti.h" #include "sezioni.h" #include "convoc.h" #include "rconvoc.h" -#include "lf.h" -#include "at0.h" -#include "at0500a.h" - class TSpostamentoConv : public TPrintapp { TRelation* _rel; diff --git a/at/at0500a.uml b/at/at0500a.uml index f34a5e7ab..7e2173215 100755 --- a/at/at0500a.uml +++ b/at/at0500a.uml @@ -1,5 +1,5 @@ #include "at0500a.h" -#include "lf.h" + PAGE "Spostamento convocazioni" -1 -1 78 20 GROUPBOX DLG_NULL 77 8 diff --git a/at/at0700a.uml b/at/at0700a.uml index bf1db55e5..b2de09e91 100755 --- a/at/at0700a.uml +++ b/at/at0700a.uml @@ -1,5 +1,4 @@ #include "at0700.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 #include diff --git a/at/at0800a.uml b/at/at0800a.uml index af0beb824..456d27906 100755 --- a/at/at0800a.uml +++ b/at/at0800a.uml @@ -1,5 +1,4 @@ #include "at0800.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 #include diff --git a/at/at1100.cpp b/at/at1100.cpp index 8b6c33efa..6aa1b9c42 100755 --- a/at/at1100.cpp +++ b/at/at1100.cpp @@ -1,9 +1,9 @@ #include #include #include +#include #include "at1.h" -#include "lf.h" // nomi campi maschera #include "at1100a.h" diff --git a/at/at1100a.uml b/at/at1100a.uml index 7182c91f2..12ac604e8 100755 --- a/at/at1100a.uml +++ b/at/at1100a.uml @@ -1,5 +1,5 @@ #include "at1100a.h" -#include "lf.h" + PAGE "Chiusura Periodica" -1 -1 78 12 GROUPBOX DLG_NULL 77 4 diff --git a/at/at1200.cpp b/at/at1200.cpp index 8cb036205..ef225dbaf 100755 --- a/at/at1200.cpp +++ b/at/at1200.cpp @@ -4,9 +4,9 @@ #include #include #include +#include #include "at1.h" -#include "lf.h" // nomi campi maschera #include "at1200a.h" diff --git a/at/at1200a.uml b/at/at1200a.uml index af5cd1982..59b913492 100755 --- a/at/at1200a.uml +++ b/at/at1200a.uml @@ -1,5 +1,5 @@ #include "at1200a.h" -#include "lf.h" + PAGE "Attribuzione benemerenze" -1 -1 78 10 GROUPBOX DLG_NULL 77 4 diff --git a/at/at1300.cpp b/at/at1300.cpp index d4c69d1ab..850edf619 100755 --- a/at/at1300.cpp +++ b/at/at1300.cpp @@ -4,9 +4,9 @@ #include #include #include +#include #include "at1.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF #include "atlib.h" #define ALIAS_TCS 200 diff --git a/at/at1300a.uml b/at/at1300a.uml index d525b0525..1d815d309 100755 --- a/at/at1300a.uml +++ b/at/at1300a.uml @@ -1,5 +1,5 @@ #include "at1300a.h" -#include "lf.h" + PAGE "Sblocco sospesi" -1 -1 78 11 GROUPBOX DLG_NULL 77 4 diff --git a/at/at1400.cpp b/at/at1400.cpp index 04d1a9c22..2df1065a3 100755 --- a/at/at1400.cpp +++ b/at/at1400.cpp @@ -3,8 +3,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include diff --git a/at/at1400a.uml b/at/at1400a.uml index 7cca2f1d4..3559027f7 100755 --- a/at/at1400a.uml +++ b/at/at1400a.uml @@ -1,5 +1,4 @@ #include "at1400a.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at1500.cpp b/at/at1500.cpp index c2674bb04..3272d87da 100755 --- a/at/at1500.cpp +++ b/at/at1500.cpp @@ -4,9 +4,9 @@ #include #include #include +#include #include "at1.h" -#include "lf.h" #include "atlib.h" #define ALIAS_TCS 200 // alias tabella tipi/esiti controlli sanitari diff --git a/at/at1500a.uml b/at/at1500a.uml index 52fc15deb..c4c6fdb04 100755 --- a/at/at1500a.uml +++ b/at/at1500a.uml @@ -1,5 +1,5 @@ #include "at1500a.h" -#include "lf.h" + PAGE "Modifica intervalli di donazione" -1 -1 78 11 GROUPBOX DLG_NULL 77 4 diff --git a/at/at1600.cpp b/at/at1600.cpp index c2c60fc03..448bdbbbf 100755 --- a/at/at1600.cpp +++ b/at/at1600.cpp @@ -4,9 +4,9 @@ #include #include #include +#include #include "at1.h" -#include "lf.h" // nomi campi maschera #include "at1600a.h" diff --git a/at/at1600a.uml b/at/at1600a.uml index a0541d115..e76cf3ac7 100755 --- a/at/at1600a.uml +++ b/at/at1600a.uml @@ -1,5 +1,5 @@ #include "at1600a.h" -#include "lf.h" + PAGE "Sblocco esclusi" -1 -1 78 11 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2100.cpp b/at/at2100.cpp index 5da68e879..ad6ca0d28 100755 --- a/at/at2100.cpp +++ b/at/at2100.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" diff --git a/at/at2100a.uml b/at/at2100a.uml index 234ad1c62..fc56b8828 100755 --- a/at/at2100a.uml +++ b/at/at2100a.uml @@ -1,5 +1,5 @@ #include "at2100a.h" -#include "lf.h" + PAGE "Stampa soggetti sospesi" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2200.cpp b/at/at2200.cpp index cecb86c2a..129409a3b 100755 --- a/at/at2200.cpp +++ b/at/at2200.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include diff --git a/at/at2200a.uml b/at/at2200a.uml index d1f0ca601..621fbbfa8 100755 --- a/at/at2200a.uml +++ b/at/at2200a.uml @@ -1,5 +1,5 @@ #include "at2200a.h" -#include "lf.h" + PAGE "Stampa soggetti per data nascita" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2300.cpp b/at/at2300.cpp index 63b16fce9..8667decf8 100755 --- a/at/at2300.cpp +++ b/at/at2300.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" diff --git a/at/at2300a.uml b/at/at2300a.uml index c65310348..d4640ab69 100755 --- a/at/at2300a.uml +++ b/at/at2300a.uml @@ -1,5 +1,5 @@ #include "at2300a.h" -#include "lf.h" + PAGE "Stampa soggetti esclusi" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2400.cpp b/at/at2400.cpp index e3ad4b774..a5d246063 100755 --- a/at/at2400.cpp +++ b/at/at2400.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include diff --git a/at/at2400a.uml b/at/at2400a.uml index d92679425..a77c38f24 100755 --- a/at/at2400a.uml +++ b/at/at2400a.uml @@ -1,5 +1,5 @@ #include "at2400a.h" -#include "lf.h" + PAGE "Stampa soggetti modificati" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2500.cpp b/at/at2500.cpp index 38cae2093..f988e541b 100755 --- a/at/at2500.cpp +++ b/at/at2500.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" diff --git a/at/at2500a.uml b/at/at2500a.uml index b6ababc30..0041a7361 100755 --- a/at/at2500a.uml +++ b/at/at2500a.uml @@ -1,5 +1,5 @@ #include "at2500a.h" -#include "lf.h" + PAGE "Stampa soggetti idonei alla donazione" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2600.cpp b/at/at2600.cpp index 9a10f8540..5e3d881c6 100755 --- a/at/at2600.cpp +++ b/at/at2600.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" diff --git a/at/at2600a.uml b/at/at2600a.uml index c91a8ed50..78b14c37d 100755 --- a/at/at2600a.uml +++ b/at/at2600a.uml @@ -1,5 +1,5 @@ #include "at2600a.h" -#include "lf.h" + PAGE "Stampa iscritti/dimessi" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at2700.cpp b/at/at2700.cpp index 5c56192fb..534da6013 100755 --- a/at/at2700.cpp +++ b/at/at2700.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include diff --git a/at/at2700a.uml b/at/at2700a.uml index 3cb8e3a06..e7569fd39 100755 --- a/at/at2700a.uml +++ b/at/at2700a.uml @@ -1,5 +1,5 @@ #include "at2700a.h" -#include "lf.h" + PAGE "Stampa soggetti per categorie" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at3100.cpp b/at/at3100.cpp index 1c8d0b770..7a15deeb9 100755 --- a/at/at3100.cpp +++ b/at/at3100.cpp @@ -4,11 +4,11 @@ #include #include #include -#include <..\ef\filetext.h> -#include <..\ef\filetext.cpp> +#include <..\include\filetext.h> +#include <..\include\filetext.cpp> +#include #include "at3.h" -#include "lf.h" // nomi campi maschera //#include "at3100a.h" diff --git a/at/at4100.cpp b/at/at4100.cpp index 2a27b29cf..3824d3bcd 100755 --- a/at/at4100.cpp +++ b/at/at4100.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" diff --git a/at/at4100a.uml b/at/at4100a.uml index 6a575b8c3..a46dcacc2 100755 --- a/at/at4100a.uml +++ b/at/at4100a.uml @@ -1,5 +1,5 @@ #include "at4100a.h" -#include "lf.h" + PAGE "Stampa scadenze di donazione" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at4100b.uml b/at/at4100b.uml index afe9a1133..e9b136780 100755 --- a/at/at4100b.uml +++ b/at/at4100b.uml @@ -1,5 +1,4 @@ #include "at4100b.h" -#include "lf.h" TOOLBAR "" 0 20 0 2 diff --git a/at/at4200.cpp b/at/at4200.cpp index 64a5beb02..76c7a6b41 100755 --- a/at/at4200.cpp +++ b/at/at4200.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include diff --git a/at/at4200a.uml b/at/at4200a.uml index 627b2edf8..d643699b7 100755 --- a/at/at4200a.uml +++ b/at/at4200a.uml @@ -1,5 +1,5 @@ #include "at4200a.h" -#include "lf.h" + PAGE "Stampa Urgenze" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at4300.cpp b/at/at4300.cpp index 19b6b9337..5a59a0ee2 100755 --- a/at/at4300.cpp +++ b/at/at4300.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" @@ -19,7 +19,7 @@ #define STATO_IDONEO 'I' // IDONEITA' #define STATO_FINESO 'F' // FINE SOSPENSIONE // tpi di stampa -enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 }; +enum ts { undefined = 0, elencocon = 1, elencorit = 2, etichette = 3, cartoline = 4 }; // definizione form per etichette e cartoline class TConv_form : public TForm @@ -101,100 +101,91 @@ ts TStampaConvocazioni::dati_cartoline() void TStampaConvocazioni::set_page(int file, int cnt) { - switch (_tipo_stampa) + if (_tipo_stampa == elencocon || _tipo_stampa == elencorit) { - case elenco: + reset_row(1); + reset_row(2); + reset_row(3); + set_row(1,"@0g@S", FLD(LF_SOGGETTI,SOG_CODCL)); + // stampare il numero convocazione + set_row(1,"@7g#3d", &_numconv); + set_row(1,"@11g#a", &_cognome_nome); + set_row(1,"@37g@ld",FLD(LF_SOGGETTI,SOG_DATANASC)); + set_row(1,"@48g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0)); + set_row(1,"@52g@S", FLD(LF_SOGGETTI,SOG_RHANTID)); + set_row(1,"@56g@S", FLD(LF_SOGGETTI,SOG_KELL)); + set_row(1,"@60g@S", FLD(LF_SOGGETTI,SOG_FENOTIPORH)); + set_row(1,"@67g@S", FLD(LF_SOGGETTI,SOG_DU)); + set_row(1,"@71g@ld",FLD(LF_SOGGETTI,SOG_DATAULTDON)); + set_row(1,"@82g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON)); + set_row(1,"@85g@ld",FLD(LF_SOGGETTI,SOG_DATAPROSSI)); + set_row(2,"@0g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS)); + set_row(2,"@37g@S", FLD(LF_SOGGETTI,SOG_CATDON)); + 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(3,""); + } + if (_tipo_stampa == etichette) + { + TPrint_section& corpo = _form_eti->get_body(); + corpo.reset(); + corpo.update(); + for (int i = 0; i < corpo.items(); i++) { - if (printer().rows_left() < 3) - printer().formfeed(); - reset_row(1); - reset_row(2); - reset_row(3); - set_row(1,"@0g@S", FLD(LF_SOGGETTI,SOG_CODCL)); - // stampare il numero convocazione - //set_row(1,"@7g@pn", FLD(LF_SOGGETTI,SOG_NUMCONV,"###")); - //set_row(1,"@7g#3a", &_numconv); - set_row(1,"@11g#a", &_cognome_nome); - set_row(1,"@37g@ld",FLD(LF_SOGGETTI,SOG_DATANASC)); - set_row(1,"@48g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0)); - set_row(1,"@52g@S", FLD(LF_SOGGETTI,SOG_RHANTID)); - set_row(1,"@56g@S", FLD(LF_SOGGETTI,SOG_KELL)); - set_row(1,"@60g@S", FLD(LF_SOGGETTI,SOG_FENOTIPORH)); - set_row(1,"@67g@S", FLD(LF_SOGGETTI,SOG_DU)); - set_row(1,"@71g@ld",FLD(LF_SOGGETTI,SOG_DATAULTDON)); - set_row(1,"@82g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON)); - set_row(1,"@85g@ld",FLD(LF_SOGGETTI,SOG_DATAPROSSI)); - set_row(2,"@0g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS)); - set_row(2,"@37g@S", FLD(LF_SOGGETTI,SOG_CATDON)); - 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(3,""); - } - break; - case etichette: + 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) + { + 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)) { - TPrint_section& corpo = _form_eti->get_body(); + _codsez = codsez; + _codsot = codsot; + dati_sezione(codsez, codsot); 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 + 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); } - 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 (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 + corpo.update(); + for (int i = 0; i < corpo.height(); i++) + { + TPrintrow& riga = corpo.row(i); + set_row(i+1,riga); + } + force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage // altrimenti stampa sempre la stessa etichetta - } - break; - } + } } void TStampaConvocazioni::header_sezione(const TString16 codsez, const TString16 codsot) @@ -243,28 +234,27 @@ bool TStampaConvocazioni::filter_func_conv (const TRelation* rel) bool TStampaConvocazioni::preprocess_page(int file, int counter) { - switch (_tipo_stampa) + if (_tipo_stampa == elencocon || _tipo_stampa == elencorit) { - case elenco: + TRectype& recsog = current_cursor()->curr(); + const TString16 codsez = recsog.get(SOG_CODSEZ); + const TString16 codsot = recsog.get(SOG_CODSOT); + TString80 nome = recsog.get(SOG_COGNOME); + nome << " "; + nome << recsog.get(SOG_NOME); + _cognome_nome = nome; + // salto pagina se cambio sezione + if ((_codsez!=codsez)||(_codsot!=codsot)) { - TRectype& recsog = current_cursor()->curr(); - const TString16 codsez = recsog.get(SOG_CODSEZ); - const TString16 codsot = recsog.get(SOG_CODSOT); - TString80 nome = recsog.get(SOG_COGNOME); - nome << " "; - nome << recsog.get(SOG_NOME); - _cognome_nome = nome; - // salto pagina se cambio sezione - if ((_codsez!=codsez)||(_codsot!=codsot)) - { - if (_codsez != "**") - printer().formfeed(); - _codsez = codsez; - _codsot = codsot; - header_sezione(codsez, codsot); - } + if (_codsez != "**") + printer().formfeed(); + _codsez = codsez; + _codsot = codsot; + header_sezione(codsez, codsot); } - break; + else + if (printer().rows_left() < 3) + printer().formfeed(); } TRectype& recsog = current_cursor()->curr(); TString80 nome = recsog.get(SOG_COGNOME); @@ -276,15 +266,21 @@ bool TStampaConvocazioni::preprocess_page(int file, int counter) if (_definitiva) { recsog.put(SOG_NUMCONV, _numconv); - if (_numconv > 4) - return FALSE; - else - { - recsog.put(SOG_DATACONV,app()._dataconv); - current_cursor()->file().rewrite(); - } + recsog.put(SOG_DATACONV,app()._dataconv); + current_cursor()->file().rewrite(); } - return TRUE; + if (_numconv > 4) + { + if (_tipo_stampa == cartoline || _tipo_stampa == etichette || _tipo_stampa == elencocon) + return FALSE; + else + return TRUE; + } + else + if (_tipo_stampa == elencorit) + return FALSE; + else + return TRUE; } void TStampaConvocazioni::filtra_sezioni() @@ -335,8 +331,11 @@ bool TStampaConvocazioni::set_print(int) tasto = _msk->run(); switch (tasto) { - case F_ELENCO: - _tipo_stampa = elenco; + case F_ELENCOCON: + _tipo_stampa = elencocon; + break; + case F_ELENCORIT: + _tipo_stampa = elencorit; break; case F_ETICHETTE: _tipo_stampa = etichette; @@ -376,10 +375,13 @@ bool TStampaConvocazioni::set_print(int) void TStampaConvocazioni::crea_intestazione() { reset_header(); - if (_tipo_stampa == elenco) + if (_tipo_stampa == elencocon || _tipo_stampa == elencorit) { TString sep(132); - sep = "CONVOCAZIONI PER SEZIONE fatte il "; + if (_tipo_stampa == elencocon) + sep = "ELENCO CONVOCATI elaborato il "; + else + sep = "ELENCO RITARDATARI elaborato il "; sep << _dataconv.string(); sep.center_just(); set_header(2, "@0g%s", (const char*) sep); diff --git a/at/at4300a.h b/at/at4300a.h index f1447dcbc..897f952df 100755 --- a/at/at4300a.h +++ b/at/at4300a.h @@ -12,6 +12,7 @@ #define F_INTMIN 110 #define F_INTMAX 111 #define F_DEFINITIVA 112 -#define F_ELENCO 401 -#define F_ETICHETTE 402 +#define F_ELENCOCON 401 +#define F_ELENCORIT 402 +#define F_ETICHETTE 403 #define F_CARTOLINE 404 diff --git a/at/at4300a.uml b/at/at4300a.uml index a0e72b43f..695806024 100755 --- a/at/at4300a.uml +++ b/at/at4300a.uml @@ -1,6 +1,6 @@ #include "at4300a.h" -#include "lf.h" -PAGE "Stampa convocazioni per sezione (Parma)" -1 -1 78 15 + +PAGE "Stampa convocazioni per sezione (Parma)" -1 -1 78 18 GROUPBOX DLG_NULL 77 4 BEGIN @@ -150,27 +150,33 @@ BEGIN PROMPT 1 11 "Stampa" END -BUTTON F_ELENCO 9 2 +BUTTON F_ELENCOCON 18 2 BEGIN - PROMPT -14 12 "Elenco" - MESSAGE EXIT,F_ELENCO + PROMPT 2 12 "Elenco convocati" + MESSAGE EXIT,F_ELENCOCON +END + +BUTTON F_ELENCORIT 18 2 +BEGIN + PROMPT 22 12 "Elenco ritardatari" + MESSAGE EXIT,F_ELENCORIT END BUTTON F_ETICHETTE 9 2 BEGIN - PROMPT -24 12 "Etichette" + PROMPT 43 12 "Etichette" MESSAGE EXIT,F_ETICHETTE END BUTTON F_CARTOLINE 9 2 BEGIN - PROMPT -34 12 "Cartoline" + PROMPT 54 12 "Cartoline" MESSAGE EXIT,F_CARTOLINE END BUTTON DLG_QUIT 9 2 BEGIN - PROMPT -44 12 "" + PROMPT 66 12 "" END ENDPAGE diff --git a/at/at4400.cpp b/at/at4400.cpp index 3d35c2aad..6e633c6ac 100755 --- a/at/at4400.cpp +++ b/at/at4400.cpp @@ -3,8 +3,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include "convoc.h" diff --git a/at/at4400a.uml b/at/at4400a.uml index fd79b6344..d50e0a75b 100755 --- a/at/at4400a.uml +++ b/at/at4400a.uml @@ -1,5 +1,5 @@ #include "at4400a.h" -#include "lf.h" + PAGE "Stampa convocazioni per punto di prelievo" -1 -1 78 20 GROUPBOX DLG_NULL 77 12 diff --git a/at/at6.cpp b/at/at6.cpp index e858167a4..76c6bf062 100755 --- a/at/at6.cpp +++ b/at/at6.cpp @@ -3,7 +3,7 @@ #include "at6.h" -#define usage "Error - usage : %s -[0|1|2|3]" +#define usage "Error - usage : %s -[0|1|2|3|4|5|6]" int main(int argc, char** argv) { @@ -20,6 +20,12 @@ int main(int argc, char** argv) rt = at6300(argc, argv); break; case 3: rt = at6400(argc, argv); break; + case 4: + rt = at6500(argc, argv); break; + case 5: + rt = at6600(argc, argv); break; + case 6: + rt = at6700(argc, argv); break; default: error_box(usage, argv[0]) ; rt = 1; break; } diff --git a/at/at6.h b/at/at6.h index 1399dd735..65d0d2918 100755 --- a/at/at6.h +++ b/at/at6.h @@ -4,6 +4,9 @@ int at6100(int argc, char* argv[]); // stampa tabella medici int at6200(int argc, char* argv[]); // stampa tabella sezioni/sottogruppi int at6300(int argc, char* argv[]); // stampa di controllo donazioni -int at6400(int argc, char* argv[]); // stampa di controllo soggetti +int at6400(int argc, char* argv[]); // stampa di controllo soggetti incompleti +int at6500(int argc, char* argv[]); // stampa di controllo controlli sanitari +int at6600(int argc, char* argv[]); // riepilogo mensile donazioni +int at6700(int argc, char* argv[]); // riepilogo giornaliero donazioni #endif // __AT6_H diff --git a/at/at6.url b/at/at6.url index ee52c1628..7dec3886f 100755 --- a/at/at6.url +++ b/at/at6.url @@ -26,3 +26,21 @@ MENUBAR MENU_BAR(3) MENU MENU_BAR(3) SUBMENU MENU_FILE "~File" + +/* at6 -4 stampa di controllo controlli sanitari */ +MENUBAR MENU_BAR(4) + +MENU MENU_BAR(4) + SUBMENU MENU_FILE "~File" + +/* at6 -5 riepilogo mensile donazioni */ +MENUBAR MENU_BAR(5) + +MENU MENU_BAR(5) + SUBMENU MENU_FILE "~File" + +/* at6 -6 riepilogo giornaliero donazioni */ +MENUBAR MENU_BAR(6) + +MENU MENU_BAR(6) + SUBMENU MENU_FILE "~File" diff --git a/at/at6100.cpp b/at/at6100.cpp index 197d87a88..4ee68384d 100755 --- a/at/at6100.cpp +++ b/at/at6100.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include "lf.h" #include "medici.h" #include diff --git a/at/at6100a.uml b/at/at6100a.uml index 96589a511..63b3062ca 100755 --- a/at/at6100a.uml +++ b/at/at6100a.uml @@ -1,6 +1,5 @@ #include "at6100a.h" -#include -#include "lf.h" + PAGE "Stampa di controllo tabella medici" -1 -1 70 17 RADIOBUTTON F_SORT 25 diff --git a/at/at6200.cpp b/at/at6200.cpp index 362474094..de44c833e 100755 --- a/at/at6200.cpp +++ b/at/at6200.cpp @@ -1,9 +1,8 @@ #include #include #include - #include -#include "lf.h" + #include "sezioni.h" #include diff --git a/at/at6200a.uml b/at/at6200a.uml index 9ef2b5444..171dba4de 100755 --- a/at/at6200a.uml +++ b/at/at6200a.uml @@ -1,6 +1,5 @@ #include "at6200a.h" -#include -#include "lf.h" + PAGE "Stampa di controllo tabella sezioni" -1 -1 70 17 RADIOBUTTON F_SORT 25 diff --git a/at/at6300.cpp b/at/at6300.cpp index f42f6ee22..cafc499ad 100755 --- a/at/at6300.cpp +++ b/at/at6300.cpp @@ -2,8 +2,8 @@ #include #include #include +#include -#include "lf.h" #include "donaz.h" #include "soggetti.h" #include "sezioni.h" @@ -44,15 +44,18 @@ 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_SOGGETTI,SOG_CODICE,"######")); - set_row(1,"@14g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS)); - set_row(1,"@22g#a", &_cognome_nome); - set_row(1,"@58g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); - set_row(1,"@69g@S", FLD(LF_SOGGETTI,SOG_CODSEZ)); - set_row(1,"@72g@S", FLD(LF_SOGGETTI,SOG_CODSOT)); - set_row(1,"@75g@ld", FLD(LF_DONAZ,DON_DATADON)); - set_row(1,"@86g@S", FLD(LF_DONAZ,DON_TIPODON)); - set_row(1,"@92g@S", FLD(LF_DONAZ, DON_LUOGODON)); + 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)); } bool TControlloDonazioni::preprocess_page(int file, int counter) @@ -286,8 +289,8 @@ void TControlloDonazioni::crea_intestazione() } sep.center_just(); set_header(2,"@0g%s", (const char*) sep); - set_header(3,"@0gProg.@7gCodice@14gTessera@22gCognome e nome@58gNato il@69gSe/So@75gData don.@86gTipo@92gLuogo"); - set_header(4,"@0g------@7g------@14g-------@22g-----------------------------------@58g----------@69g-----@75g----------@86g----@91g-------------------------"); + 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---"); } bool TControlloDonazioni::user_create() diff --git a/at/at6300a.uml b/at/at6300a.uml index ceebf0057..9d3b09ecd 100755 --- a/at/at6300a.uml +++ b/at/at6300a.uml @@ -1,5 +1,5 @@ #include "at6300a.h" -#include "lf.h" + PAGE "Stampa di controllo donazioni" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 @@ -180,9 +180,9 @@ BEGIN ITEM "S|Sezione/Sottogruppo" END -RADIOBUTTON F_ORDINAMENTO 25 +RADIOBUTTON F_ORDINAMENTO 35 BEGIN - PROMPT 40 10 "Ordinamento per " + PROMPT 30 10 "Ordinamento per data donazione e ..." ITEM "C|Cognome e nome" ITEM "I|Inserimento" ITEM "E|Etichetta sacca" diff --git a/at/at6400.cpp b/at/at6400.cpp index 607838d56..c04b55b42 100755 --- a/at/at6400.cpp +++ b/at/at6400.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include "lf.h" #include "soggetti.h" #include "sezioni.h" #include diff --git a/at/at6400a.uml b/at/at6400a.uml index c743e3618..a7f4b4fe1 100755 --- a/at/at6400a.uml +++ b/at/at6400a.uml @@ -1,5 +1,5 @@ #include "at6400a.h" -#include "lf.h" + PAGE "Stampa soggetti incompleti" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 diff --git a/at/at6500.cpp b/at/at6500.cpp index 08e6f8278..69d4b504d 100755 --- a/at/at6500.cpp +++ b/at/at6500.cpp @@ -2,29 +2,28 @@ #include #include #include +#include -#include "lf.h" -#include "donaz.h" +#include "contsan.h" #include "soggetti.h" #include "sezioni.h" #include "at6.h" #include "at6500a.h" -//#define ALIAS_LDN 100 +#define ALIAS_TCS 100 -class TRiepilogoDonazioni : public TPrintapp +class TControlloControlli : public TPrintapp { TRelation* _rel; TMask* _msk; + int _counter; int _cur; - TDate _dataini, _datafin; - TString16 _codsez, _codsot; - int _mese,_anno; - //bool _primedon; - TAssoc_array* _totali_mese; - TAssoc_array* _totali_anno; - TAssoc_array* _totali_sezione; + TDate _dataold, _dataini, _datafin; + TString16 _tipocon, _sezold; + TString16 _sezini, _sotini, _tipostampa, _ordinamento; + + TParagraph_string _cognome_nome; protected: virtual bool user_create(); @@ -35,91 +34,166 @@ protected: public: void crea_intestazione(); - void header_sezione(const TString16 codsez, const TString16 codsot); + void header_data(const TDate data, const TString16 luogo, const TString16 sezione); TMask& app_mask() { return *_msk; } - TRiepilogoDonazioni() {} + TControlloControlli() : _cognome_nome("",35) {} }; -HIDDEN inline TRiepilogoDonazioni& app() { return (TRiepilogoDonazioni&) main_app(); } +HIDDEN inline TControlloControlli& app() { return (TControlloControlli&) main_app(); } -void TRiepilogoDonazioni::set_page(int file, int cnt) +void TControlloControlli::set_page(int file, int cnt) { + set_row(1,"@0g#D" , &_counter); + set_row(1,"@7g@pn" , FLD(LF_SOGGETTI,SOG_CODICE,"######")); + set_row(1,"@14g@S" , FLD(LF_SOGGETTI,SOG_TESSAVIS)); + set_row(1,"@22g#a" , &_cognome_nome); + set_row(1,"@58g@ld" , FLD(LF_SOGGETTI,SOG_DATANASC)); + set_row(1,"@69g@S" , FLD(LF_SOGGETTI,SOG_CODSEZ)); + set_row(1,"@72g@S" , FLD(LF_SOGGETTI,SOG_CODSOT)); + set_row(1,"@75g@ld" , FLD(LF_CONTSAN,CON_DATACON)); + set_row(1,"@86g@S" , FLD(LF_CONTSAN,CON_TIPOCON)); } -bool TRiepilogoDonazioni::preprocess_page(int file, int counter) +bool TControlloControlli::preprocess_page(int file, int counter) { - TRectype& recsog = current_cursor()->curr(LF_SOGGETTI); - // salto pagina se cambio sezione - const TString16 codsez = recsog.get(SOG_CODSEZ); - const TString16 codsot = recsog.get(SOG_CODSOT); - if ((_codsez != codsez) || (_codsot != codsot)) + // 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; + + // salto pagina se cambio punto di rottura + switch (_tipostampa[0]) { - if (_codsez != "**") - //printer().formfeed(); - riepilogo_sezione(); - _codsez = codsez; - _codsot = codsot; - _mese = -1; - _anno = -1; - header_sezione(codsez, codsot); - } - const TDate datadon = current_cursor()->curr().get(DON_DATADON); - const int mese = datadon.month(); - const int anno = datadon.year(); - if (_mese != mese) - { - if (_mese != -1) - riepilogo_mese(); - _mese = mese; - } - if (_anno != anno) - { - if (_anno != -1) - riepilogo_anno(); - _anno = anno; - } - const char* tipodon = current_cursor()->curr().get(DON_TIPODON); - if (_totali_mese.is_key(tipodon)) - _totali_mese[tipodon]++; - else - _totali_mese.add(tipodon,1); - if (_totali_anno.is_key(tipodon)) - _totali_anno[tipodon]++; - else - _totali_anno.add(tipodon,1); + case 'D': + { + const TDate datanew = current_cursor()->curr().get(CON_DATACON); + if (datanew != _dataold ) + { + if (_dataold.ok()) + printer().formfeed(); + _dataold = datanew; + header_data(datanew,"",""); + _counter = 0; + } + } + break; + case 'S': + { + TString16 seznew = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ); + seznew << "/"; + seznew << current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT); + if (seznew != _sezold ) + { + if (_sezold != "****") + printer().formfeed(); + _sezold = seznew; + header_data(NULLDATE,"",seznew); + _counter = 0; + } + } + break; + } + _counter++; return TRUE; } -bool TRiepilogoDonazioni::set_print(int m) +void TControlloControlli::header_data(const TDate data, const TString16 luogo, const TString16 sezione) +{ + TString intestazione(132); + intestazione = "STAMPA DI CONTROLLO CONTROLLI SANITARI "; + switch (_tipostampa[0]) + { + case 'D': + { + intestazione << "PER DATA "; + intestazione << data; + } + break; + case 'S': + { + intestazione << "PER SEZIONE "; + intestazione << sezione; + } + break; + } + intestazione.center_just(); + set_header(1,"@0g%s", (const char*) intestazione); + intestazione = "Pag. @#"; + set_header(1, "@110g%s", (const char*) intestazione); + return; +} + +bool TControlloControlli::set_print(int m) { KEY tasto; tasto = _msk->run(); if (tasto == K_ENTER) { + _sezini = _msk->get(F_SEZINI); + _sotini = _msk->get(F_SOTINI); _dataini = _msk->get_date(F_DATAINI); _datafin = _msk->get_date(F_DATAFIN); - //_primedon = _msk->get_bool(F_PRIMEDON); + _tipocon = _msk->get(F_TIPOCON); + + _tipostampa = _msk->get(F_TIPOSTAMPA); + _ordinamento = _msk->get(F_ORDINAMENTO); TString80 chiave = ""; - chiave = "90->CODSEZ|90->CODSOT|92->DATADON|"; - // filtro per sezione/sottogruppo + switch (_tipostampa[0]) + { + case 'D': + chiave = "93->DATACON|"; + break; + case 'S': + chiave = "90->CODSEZ|90->CODSOT|93->DATACON|"; + break; + } + switch (_ordinamento[0]) + { + case 'C': + chiave << "UPPER(90->COGNOME)|UPPER(90->NOME)"; + break; + } TString80 filtro = ""; - if + // filtro per tipo controlli + if (_tipocon.not_empty()) + filtro = format("(TIPOCON == \"%s\")",(const char*)_tipocon); + // 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); + } + } + } // filtro per data - TRectype da(LF_DONAZ); - TRectype a (LF_DONAZ); + TRectype da(LF_CONTSAN); + TRectype a (LF_CONTSAN); if (_dataini.ok()) - da.put(DON_DATADON, _dataini); + da.put(CON_DATACON, _dataini); if (_datafin.ok()) - a.put(DON_DATADON, _datafin); + a.put(CON_DATACON, _datafin); _cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a)); - // manca il filtro da sez./sot. a sez./sot. - //current_cursor()->setfilter((const char*) filtro, TRUE); - _codsez = "**"; - _codsot = "**"; - _mese = -1; - _anno = -1; + current_cursor()->setfilter((const char*) filtro, TRUE); + _counter = 0; + _dataold = NULLDATE; + _sezold = "****"; reset_files(); - add_file(LF_DONAZ); + add_file(LF_CONTSAN); reset_print(); crea_intestazione(); return TRUE; @@ -127,59 +201,66 @@ bool TRiepilogoDonazioni::set_print(int m) else return FALSE; } - -void TRiepilogoDonazioni::crea_intestazione() + +void TControlloControlli::crea_intestazione() { reset_header(); - TString sep(132); - sep = "RIEPILOGO DONAZIONI "; + TString sep(132); + sep = "Selezioni della stampa: "; + if (_sezini.not_empty()) + { + sep << "Sez. "; + sep << _sezini; + if (_sotini.not_empty()) + { + sep << "/"; + sep << _sotini; + } + sep << "; "; + } if (_dataini.ok()) { - sep << " DAL "; + sep << "Dal "; sep << _dataini.string(); } if (_datafin.ok()) { - sep << " AL "; + sep << " Al "; sep << _datafin.string(); } + if (_dataini.ok() || _datafin.ok()) + sep << "; "; + if (_tipocon.not_empty()) + { + sep << "Tipo "; + sep << _tipocon; + sep << "; "; + } 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(2,"@0g%s", (const char*) sep); + set_header(3,"@0gProg.@7gCodice@14gTessera@22gCognome e nome@58gNato il@69gSe/So@75gData con.@86gTipo"); + set_header(4,"@0g------@7g------@14g-------@22g-----------------------------------@58g----------@69g-----@75g----------@86g----"); } -bool TRiepilogoDonazioni::user_create() +bool TControlloControlli::user_create() { - _rel = new TRelation(LF_DONAZ); + _rel = new TRelation(LF_CONTSAN); _rel->add(LF_SOGGETTI, "CODICE==CODICE"); - //_rel->add("LDN", "CODTAB==LUOGODON",1,0,ALIAS_LDN); + _rel->add("TCS", "CODTAB==TIPOCON",1,0,ALIAS_TCS); _msk = new TMask("at6500a"); - _totali_mese = new TAssoc_array(); - _totali_anno = new TAssoc_array(); - _totali_sezione = new TAssoc_array(); return TRUE; } -bool TRiepilogoDonazioni::user_destroy() +bool TControlloControlli::user_destroy() { delete _msk; delete _rel; - delete _totali_mese; - delete _totali_anno; - delete _totali_sezione; return TRUE; } int at6500(int argc, char* argv[]) { - TRiepilogoDonazioni a; - a.run(argc, argv, "Riepilogo donazioni"); + TControlloControlli a; + a.run(argc, argv, "Stampa di controllo controlli sanitari"); return 0; } diff --git a/at/at6500a.h b/at/at6500a.h index f01a857e5..7a12d60e8 100755 --- a/at/at6500a.h +++ b/at/at6500a.h @@ -1,14 +1,17 @@ -// riepilogo mensile donazioni +// stampa di controllo controlli sanitari // definizione campi per maschera di selezione -#define F_SEZINI 101 -#define F_D_SEZINI 102 -#define F_SOTINI 103 -#define F_D_SOTINI 104 -#define F_SEZFIN 105 -#define F_D_SEZFIN 106 -#define F_SOTFIN 107 -#define F_D_SOTFIN 108 - -#define F_DATAINI 301 -#define F_DATAFIN 302 +#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_TIPOCON 111 +#define F_TIPOSTAMPA 112 +#define F_ORDINAMENTO 113 +#define F_D_TIPOCON 201 diff --git a/at/at6500a.uml b/at/at6500a.uml index 069666111..aa3432060 100755 --- a/at/at6500a.uml +++ b/at/at6500a.uml @@ -1,15 +1,15 @@ #include "at6500a.h" -#include "lf.h" -PAGE "Riepilogo mensile donazioni" -1 -1 78 12 + +PAGE "Stampa di controllo controlli sanitari" -1 -1 78 20 GROUPBOX DLG_NULL 77 4 BEGIN - PROMPT 1 1 "Scelta sezioni/sottogruppi" + PROMPT 1 1 "Scelta sezione/sottogruppo" END STRING F_SEZINI 2 BEGIN - PROMPT 2 2 "Da " + PROMPT 2 2 "Sezione " FLAGS "U" USE LF_SEZIONI INPUT CODSEZ F_SEZINI @@ -23,12 +23,12 @@ BEGIN OUTPUT F_SOTINI CODSOT OUTPUT F_D_SOTINI DENSOT CHECKTYPE SEARCH - HELP "Codice sezione da cui partire" + HELP "Codice sezione da stampare" END STRING F_D_SEZINI 25 BEGIN - PROMPT 11 2 "" + PROMPT 20 2 "" FLAGS "U" USE LF_SEZIONI KEY 2 INPUT DENSEZ F_D_SEZINI @@ -38,20 +38,20 @@ BEGIN DISPLAY "Cod.sot." CODSOT COPY OUTPUT F_SEZINI CHECKTYPE NORMAL - HELP "Sezione da cui partire" + HELP "Sezione da stampare" END STRING F_SOTINI 2 BEGIN - PROMPT 2 3 " " + PROMPT 2 3 "Sottogruppo " COPY ALL F_SEZINI CHECKTYPE SEARCH - HELP "Codice sottogruppo da cui partire" + HELP "Codice sottogruppo da stampare" END STRING F_D_SOTINI 25 BEGIN - PROMPT 11 3 "" + PROMPT 20 3 "" FLAGS "U" COPY USE F_D_SEZINI INPUT DENSEZ F_D_SEZINI @@ -62,76 +62,108 @@ BEGIN HELP "Sottogruppo da cui partire" END -STRING F_SEZFIN 2 +//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 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" + PROMPT 1 5 "Selezione dati per la stampa" END -STRING F_D_SEZFIN 25 +DATA F_DATAINI 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" + PROMPT 2 6 "Controlli dal " END -STRING F_SOTFIN 2 +DATA F_DATAFIN BEGIN - PROMPT 41 3 " " - COPY ALL F_SEZFIN - CHECKTYPE SEARCH - HELP "Codice sottogruppo finale" + PROMPT 30 6 "al " 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" +STRING F_TIPOCON 2 +BEGIN + PROMPT 2 7 "Tipo controllo " + FLAGS "U" + USE TCS + INPUT CODTAB F_TIPOCON + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_TIPOCON CODTAB + OUTPUT F_D_TIPOCON S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" END -GROUPBOX DLG_NULL 77 3 +STRING F_D_TIPOCON 30 BEGIN - PROMPT 1 5 "Opzioni per il riepilogo" + PROMPT 26 7 "" + FLAGS "D" END -DATE F_DATAINI +RADIOBUTTON F_TIPOSTAMPA 25 BEGIN - PROMPT 2 6 "Donazioni effettuate dal " - HELP "Data iniziale" + PROMPT 1 10 "Stampa per " + ITEM "D|Data controllo" + ITEM "S|Sezione/Sottogruppo" END -DATE F_DATAFIN +RADIOBUTTON F_ORDINAMENTO 25 BEGIN - PROMPT 40 6 "al " - HELP "Data finale" + PROMPT 40 10 "Ordinamento per " + ITEM "C|Cognome e nome" + ITEM "D|Data controllo" END BUTTON DLG_OK 9 2 diff --git a/at/at6600.cpp b/at/at6600.cpp new file mode 100755 index 000000000..3c0ce0f45 --- /dev/null +++ b/at/at6600.cpp @@ -0,0 +1,650 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "at6.h" + +// nomi campi maschera +#include "at6600a.h" + +// nomi dei campi +#include "soggetti.h" +#include "donaz.h" +#include "atstatd.h" +#include "sezioni.h" + +// classe per la definizione di una riga di statistica +class TRiga : public TObject +{ + int _anno, _mese; + TArray _valori; + +protected: + const TRiga& copy(const TRiga& riga); +public: + const int anno() const { return _anno; } + const int mese() const { return _mese; } + TObject* dup() const { return new TRiga(*this); } + const TRiga& operator = (const TRiga& riga); + const real& operator [] (int colonna) const; + void aggiorna_valore(int colonna, const real& numero) ; + void azzera_valori(); + // costruttore + TRiga(int anno, int mese) {_anno = anno; _mese = mese;} + // costruttore di copia + TRiga(const TRiga& riga) { copy(riga); } + virtual ~TRiga() {}; +}; + +const TRiga& TRiga::copy(const TRiga& riga) +{ + _anno = riga._anno; + _mese = riga._mese; + _valori = riga._valori; + return (*this); +} + +const TRiga& TRiga::operator = (const TRiga& riga) +{ + copy(riga); + return (*this); +} + +const real& TRiga::operator [] (int colonna) const +{ + real* valore = (real*)_valori.objptr(colonna); + if (valore == NULL) + return ZERO; + else + return *valore; +} + +void TRiga::aggiorna_valore(int colonna, const real& numero) +{ + real* valore = (real*)_valori.objptr(colonna); + if (valore == NULL) + _valori.add(new real(numero), colonna); + else + *valore += numero; +} + +void TRiga::azzera_valori() +{ + _valori.destroy(); +} + +class TRiepilogoDonazioni : public TApplication +{ + TMask* _msk; + TRelation* _rel; + TCursor* _cur; + TLocalisamfile* _sezioni; + TLocalisamfile* _soggetti; + TLocalisamfile* _donaz; + TLocalisamfile* _atstatd; + TDate _dataini, _datafin; + bool _primedon; + TAssoc_array* _colonne; + TArray _righe; // array per riepilogo donazioni + TArray _righe_prime; // array per riepilogo prime don + +protected: + virtual bool create(); + virtual bool destroy(); + virtual bool menu(MENU_TAG m); + virtual TMask& get_mask() { return *_msk; } + virtual TRelation* get_relation() const { return _rel; } + int data2row(const int anno, const int mese); + bool riepilogo(); + bool stampa(); + bool crea_colonne(); + bool crea_righe(); + void azzera_righe(); + void stampa_sezione(TString16 codsez, TString16 codsot); + void crea_intestazione(); + TString16 int2month(const int month); +public: + TRiepilogoDonazioni() {} + +}; + +HIDDEN inline TRiepilogoDonazioni& app() { return (TRiepilogoDonazioni&) main_app(); } + +TString16 TRiepilogoDonazioni::int2month(const int month) +{ + TString16 mese = ""; + switch (month) + { + case 1: + mese << "GENNAIO "; + break; + case 2: + mese << "FEBBRAIO "; + break; + case 3: + mese << "MARZO "; + break; + case 4: + mese << "APRILE "; + break; + case 5: + mese << "MAGGIO "; + break; + case 6: + mese << "GIUGNO "; + break; + case 7: + mese << "LUGLIO "; + break; + case 8: + mese << "AGOSTO "; + break; + case 9: + mese << "SETTEMBRE"; + break; + case 10: + mese << "OTTOBRE "; + break; + case 11: + mese << "NOVEMBRE "; + break; + case 12: + mese << "DICEMBRE "; + break; + } + return mese; +} + +int TRiepilogoDonazioni::data2row(const int anno, const int mese) +{ + const int annoini = _dataini.year(); + return (anno-annoini)*12 + mese; +} + +bool TRiepilogoDonazioni::crea_colonne() +{ + _colonne->destroy(); + TTable tdn("TDN"); + real contatore(ZERO); + for (tdn.first(); !tdn.eof(); tdn.next()) + { + real* oggetto = new real(contatore); + _colonne->add((const char*)tdn.get("CODTAB"),(TObject*)oggetto); + contatore+=1; + } + return !tdn.empty(); +} + +bool TRiepilogoDonazioni::crea_righe() +{ + int anno = _dataini.year(); + int meseini, mesefin; + while (anno<=_datafin.year()) + { + if (anno == _dataini.year()) + meseini = _dataini.month(); + else + meseini = 1; + if (anno == _datafin.year()) + mesefin = _datafin.month(); + else + mesefin = 12; + for (int mese=meseini;mese<=mesefin;mese++) + { + _righe.add(new TRiga(anno, mese), data2row(anno, mese)); + if (_primedon) + _righe_prime.add(new TRiga(anno, mese), data2row(anno, mese)); + } + anno++; + } + return _righe.items()>0; +} + +bool TRiepilogoDonazioni::create() +{ + TApplication::create(); + _msk = new TMask("at6600a"); + _rel = new TRelation(LF_DONAZ); + _rel->add(LF_SOGGETTI, "CODICE==CODICE"); + _soggetti = new TLocalisamfile(LF_SOGGETTI); + _donaz = new TLocalisamfile(LF_DONAZ); + _atstatd = new TLocalisamfile(LF_ATSTATD); + _sezioni = new TLocalisamfile(LF_SEZIONI); + _colonne = new TAssoc_array(); + dispatch_e_menu(BAR_ITEM(1)); + return TRUE; +} + +bool TRiepilogoDonazioni::destroy() +{ + delete _rel; + delete _msk; + delete _soggetti; + delete _donaz; + delete _atstatd; + delete _sezioni; + delete _colonne; + return TApplication::destroy(); +} + +bool TRiepilogoDonazioni::menu(MENU_TAG m) +{ + TMask& msk = get_mask(); + KEY tasto; + tasto = msk.run(); + if (tasto == K_ENTER) + { + _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); + if (riepilogo()) + stampa(); + } + return FALSE; +} + +void TRiepilogoDonazioni::crea_intestazione() +{ + TPrintrow row; + TString256 sep; + sep = "RIEPILOGO DONAZIONI"; + if (_dataini.ok()) + { + sep << " dal "; + sep << _dataini.string(); + } + if (_datafin.ok()) + { + sep << " al "; + sep << _datafin.string(); + } + sep.center_just(80); + row.put(sep); + row.put("@>", 1); + row.put("Pag. @#", 70); + printer().setheaderline(2, row); + row.reset(); + printer().setheaderline(3, row); + sep = "Mese "; + TTable tdn("TDN"); + int pos = 27; + for (tdn.first(); !tdn.eof(); tdn.next()) + { + sep.overwrite((const char*)tdn.get("CODTAB"),pos); + pos = pos+10; + } + sep.overwrite("Totale",pos); + row.put(sep); + printer().setheaderline(5, row); + sep = ""; + sep.fill('-'); + row.reset(); + row.put(sep); + printer().setheaderline(6, row); +} + +bool TRiepilogoDonazioni::stampa() +{ + if (printer().open()) + { + crea_intestazione(); + TRelation* relstat = new TRelation(LF_ATSTATD); + TCursor* curstat = new TCursor(relstat, "", 2); + TString16 oldsez = "**"; + TString16 oldsot = "**"; + double numero, numprime; + TString16 actsez, actsot; + TString16 tipodon; + int anno, mese; + long last = curstat->items(); + for ( *curstat=0; curstat->pos() < last; ++(*curstat) ) + { + actsez = curstat->curr().get(ATS_CODSEZ); + actsot = curstat->curr().get(ATS_CODSOT); + anno = curstat->curr().get_int(ATS_ANNO); + mese = curstat->curr().get_int(ATS_MESE); + tipodon = curstat->curr().get(ATS_TIPODON); + numero = (double)curstat->curr().get_int(ATS_NUMERO); + numprime = (double)curstat->curr().get_int(ATS_NUMPRIME); + if (actsez != oldsez || actsot != oldsot) + { + if (oldsez != "**" && oldsot != "**") + { + stampa_sezione(oldsez,oldsot); + azzera_righe(); + } + oldsez = actsez; + oldsot = actsot; + } + TRiga& riga = (TRiga&)_righe[data2row(anno,mese)]; + real& colonna = (real&)_colonne->find((const char*)tipodon); + real n = numero; + riga.aggiorna_valore(colonna.integer(),n); + if (_primedon) + { + TRiga& riga_prime = (TRiga&)_righe_prime[data2row(anno,mese)]; + n = numprime; + riga_prime.aggiorna_valore(colonna.integer(), n); + } + } + if (oldsez != "**" && oldsot != "**") + stampa_sezione(oldsez,oldsot); + delete curstat; + delete relstat; + printer().close(); + return TRUE; + } + else + return FALSE; +} + +void TRiepilogoDonazioni::azzera_righe() +{ + int anno = _dataini.year(); + int meseini, mesefin; + while (anno<=_datafin.year()) + { + if (anno == _dataini.year()) + meseini = _dataini.month(); + else + meseini = 1; + if (anno == _datafin.year()) + mesefin = _datafin.month(); + else + mesefin = 12; + for (int mese=meseini;mese<=mesefin;mese++) + { + TRiga& riga = (TRiga&)_righe[data2row(anno,mese)]; + riga.azzera_valori(); + if (_primedon) + { + TRiga& riga_prime = (TRiga&)_righe_prime[data2row(anno,mese)]; + riga_prime.azzera_valori(); + } + } + anno++; + } +} + +void TRiepilogoDonazioni::stampa_sezione(TString16 codsez, TString16 codsot) +{ + TPrintrow row; + TString256 rigastampa; + rigastampa = "Sezione: "; + rigastampa << codsez; + if (codsot.not_empty()) + { + rigastampa << "/"; + rigastampa << codsot; + } + rigastampa << " "; + TLocalisamfile sezioni(LF_SEZIONI); + sezioni.setkey(1); + sezioni.zero(); + sezioni.put(SEZ_CODSEZ,codsez); + sezioni.put(SEZ_CODSOT,codsot); + if (sezioni.read() == NOERR) + { + TString80 den = sezioni.get(SEZ_DENSEZ); + rigastampa << den; + den = sezioni.get(SEZ_DENSOT); + if (den.not_empty()) + { + rigastampa << "/"; + rigastampa << den; + } + } + rigastampa.center_just(80); + row.put(rigastampa); + printer().setheaderline(1, row); + + TRiga rigatotali(0,0); + int anno = _dataini.year(); + int meseini, mesefin; + real totalemese = ZERO; + TString16 valore; + while (anno<=_datafin.year()) + { + if (anno == _dataini.year()) + meseini = _dataini.month(); + else + meseini = 1; + if (anno == _datafin.year()) + mesefin = _datafin.month(); + else + mesefin = 12; + for (int mese=meseini;mese<=mesefin;mese++) + { + TRiga& riga = (TRiga&)_righe[data2row(anno,mese)]; + row.reset(); + rigastampa = ""; + rigastampa.format("%s %4d", (const char*)int2month(mese), anno); + totalemese = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + rigatotali.aggiorna_valore(i,riga[i]); + totalemese+=riga[i]; + valore = ""; + valore.format("%8d",riga[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totalemese.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + } + anno++; + } + // stampa totali per sezione + rigastampa = ""; + rigastampa.fill('-'); + row.reset(); + row.put(rigastampa); + printer().print(row); + row.reset(); + rigastampa = ""; + rigastampa = "Totale periodo"; + totalemese = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + totalemese+=rigatotali[i]; + valore = ""; + valore.format("%8d",rigatotali[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totalemese.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + + if (_primedon) + { + rigatotali.azzera_valori(); + row.reset(); + printer().print(row); + printer().print(row); + printer().print(row); + printer().print(row); + //printer().skip(4); + rigastampa = "RIEPILOGO PRIME DONAZIONI"; + rigastampa.center_just(); + row.put(rigastampa); + row.reset(); + row.put(rigastampa); + printer().print(row); + rigastampa = ""; + rigastampa.fill('-'); + row.reset(); + row.put(rigastampa); + printer().print(row); + row.reset(); + printer().print(row); + anno = _dataini.year(); + while (anno<=_datafin.year()) + { + if (anno == _dataini.year()) + meseini = _dataini.month(); + else + meseini = 1; + if (anno == _datafin.year()) + mesefin = _datafin.month(); + else + mesefin = 12; + for (int mese=meseini;mese<=mesefin;mese++) + { + TRiga& riga = (TRiga&)_righe_prime[data2row(anno,mese)]; + row.reset(); + rigastampa = ""; + rigastampa.format("%s %4d", (const char*)int2month(mese), anno); + totalemese = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + rigatotali.aggiorna_valore(i,riga[i]); + totalemese+=riga[i]; + valore = ""; + valore.format("%8d",riga[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totalemese.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + } + anno++; + } + // stampa totali per sezione + rigastampa = ""; + rigastampa.fill('-'); + row.reset(); + row.put(rigastampa); + printer().print(row); + row.reset(); + rigastampa = ""; + rigastampa = "Totale periodo"; + totalemese = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + totalemese+=rigatotali[i]; + valore = ""; + valore.format("%8d",rigatotali[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totalemese.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + } + printer().formfeed(); +} + +bool TRiepilogoDonazioni::riepilogo() +{ + if (crea_colonne() && crea_righe()) + { + // cancello i risultati della elaborazione precedente + TLocalisamfile stat(LF_ATSTATD); + for (stat.first(); !stat.eof(); stat.next()) + stat.remove(); + stat.setkey(2); + // filtro per data + TRectype da(LF_DONAZ); + TRectype a (LF_DONAZ); + if (_dataini.ok()) + 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); + TString16 codsez, codsot, tipodon; + TDate datadon; + int anno, mese; + long numero; + bool primadon; + TRectype& recdon = _cur->curr(); + TRectype& recsog = _cur->curr(LF_SOGGETTI); + long last = _cur->items(); + TProgind prg (last, "Elaborazione in corso... Prego attendere", FALSE, TRUE, 30); + for ( *_cur=0; _cur->pos() < last; ++(*_cur) ) + { + prg.addstatus(1); + codsez = recdon.get(DON_CODSEZ); + codsot = recdon.get(DON_CODSOT); + if (codsez.empty()) + { + codsez = recsog.get(SOG_CODSEZ); + codsot = recsog.get(SOG_CODSOT); + } + datadon = recdon.get_date(DON_DATADON); + tipodon = recdon.get(DON_TIPODON); + primadon = recdon.get_bool(DON_PRIMADON); + anno = datadon.year(); + mese = datadon.month(); + stat.zero(); + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + stat.put(ATS_ANNO, anno); + stat.put(ATS_MESE, mese); + stat.put(ATS_TIPODON, tipodon); + if (stat.read() == NOERR) + { + numero = stat.get_long(ATS_NUMERO); + numero++; + stat.put(ATS_NUMERO, numero); + if (_primedon && primadon) + { + numero = stat.get_long(ATS_NUMPRIME); + numero++; + stat.put(ATS_NUMPRIME, numero); + } + stat.rewrite(); + } + else + { + stat.zero(); + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + stat.put(ATS_ANNO, anno); + stat.put(ATS_MESE, mese); + stat.put(ATS_TIPODON, tipodon); + numero = 1; + stat.put(ATS_NUMERO, numero); + if (_primedon && primadon) + stat.put(ATS_NUMPRIME, numero); + stat.write(); + } + } + return (stat.eod() > 0); + } + else + return FALSE; +} + +int at6600(int argc, char* argv[]) +{ + TRiepilogoDonazioni a; + a.run(argc, argv, "Riepilogo donazioni"); + return 0; +} \ No newline at end of file diff --git a/at/at6600a.h b/at/at6600a.h new file mode 100755 index 000000000..ecd1ccaf9 --- /dev/null +++ b/at/at6600a.h @@ -0,0 +1,15 @@ +// riepilogo mensile donazioni +// definizione campi per maschera di selezione + +#define F_SEZINI 101 +#define F_D_SEZINI 102 +#define F_SOTINI 103 +#define F_D_SOTINI 104 +#define F_SEZFIN 105 +#define F_D_SEZFIN 106 +#define F_SOTFIN 107 +#define F_D_SOTFIN 108 + +#define F_DATAINI 301 +#define F_DATAFIN 302 +#define F_PRIMEDON 303 diff --git a/at/at6600a.uml b/at/at6600a.uml new file mode 100755 index 000000000..bb88165bb --- /dev/null +++ b/at/at6600a.uml @@ -0,0 +1,153 @@ +#include "at6600a.h" + +PAGE "Riepilogo mensile donazioni" -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 4 +BEGIN + PROMPT 1 5 "Opzioni per il riepilogo" +END + +DATE F_DATAINI +BEGIN + PROMPT 2 6 "Donazioni effettuate dal " + HELP "Data iniziale" +END + +DATE F_DATAFIN +BEGIN + PROMPT 40 6 "al " + HELP "Data finale" +END + +BOOLEAN F_PRIMEDON +BEGIN + PROMPT 2 7 "Riepilogo per prime donazioni" +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_QUIT 9 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE +ENDMASK diff --git a/at/at6700.cpp b/at/at6700.cpp new file mode 100755 index 000000000..ded24422b --- /dev/null +++ b/at/at6700.cpp @@ -0,0 +1,536 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "at6.h" + +// nomi campi maschera +#include "at6700a.h" + +// nomi dei campi +#include "soggetti.h" +#include "donaz.h" +#include "atstatd.h" +#include "sezioni.h" + +// classe per la definizione di una riga di statistica +class TRigaG : public TObject +{ + TDate _data; + TArray _valori; + +protected: + const TRigaG& copy(const TRigaG& riga); +public: + const TDate data() const { return _data; } + TObject* dup() const { return new TRigaG(*this); } + const TRigaG& operator = (const TRigaG& riga); + const real& operator [] (int colonna) const; + void aggiorna_valore(int colonna, const real& numero) ; + void azzera_valori(); + // costruttore + TRigaG(TDate data) {_data = data;} + // costruttore di copia + TRigaG(const TRigaG& riga) { copy(riga); } + virtual ~TRigaG() {}; +}; + +const TRigaG& TRigaG::copy(const TRigaG& riga) +{ + _data = riga._data; + _valori = riga._valori; + return (*this); +} + +const TRigaG& TRigaG::operator = (const TRigaG& riga) +{ + copy(riga); + return (*this); +} + +const real& TRigaG::operator [] (int colonna) const +{ + real* valore = (real*)_valori.objptr(colonna); + if (valore == NULL) + return ZERO; + else + return *valore; +} + +void TRigaG::aggiorna_valore(int colonna, const real& numero) +{ + real* valore = (real*)_valori.objptr(colonna); + if (valore == NULL) + _valori.add(new real(numero), colonna); + else + *valore += numero; +} + +void TRigaG::azzera_valori() +{ + _valori.destroy(); +} + +class TRiepilogoGiornaliero : public TApplication +{ + TMask* _msk; + TRelation* _rel; + TCursor* _cur; + TLocalisamfile* _sezioni; + TLocalisamfile* _soggetti; + TLocalisamfile* _donaz; + TLocalisamfile* _atstatd; + bool _primedon; + TDate _dataini, _datafin; + TAssoc_array* _colonne; + TArray _righe; // array per riepilogo donazioni + TArray _righe_prime; // array per riepilogo prime don + +protected: + virtual bool create(); + virtual bool destroy(); + virtual bool menu(MENU_TAG m); + virtual TMask& get_mask() { return *_msk; } + virtual TRelation* get_relation() const { return _rel; } + int data2row(const TDate data) { return data-_dataini; } + bool riepilogo(); + bool stampa(); + bool crea_colonne(); + bool crea_righe(); + void azzera_righe(); + void stampa_sezione(TString16 codsez, TString16 codsot); + void crea_intestazione(); +public: + TRiepilogoGiornaliero() {} + +}; + +HIDDEN inline TRiepilogoGiornaliero& app() { return (TRiepilogoGiornaliero&) main_app(); } + +bool TRiepilogoGiornaliero::crea_colonne() +{ + _colonne->destroy(); + TTable tdn("TDN"); + real contatore(ZERO); + for (tdn.first(); !tdn.eof(); tdn.next()) + { + real* oggetto = new real(contatore); + _colonne->add((const char*)tdn.get("CODTAB"),(TObject*)oggetto); + contatore+=1; + } + return !tdn.empty(); +} + +bool TRiepilogoGiornaliero::crea_righe() +{ + TDate data = _dataini; + while (data<=_datafin) + { + _righe.add(new TRigaG(data), data2row(data)); + if (_primedon) + _righe_prime.add(new TRigaG(data), data2row(data)); + ++data; + } + return _righe.items()>0; +} + +bool TRiepilogoGiornaliero::create() +{ + TApplication::create(); + _msk = new TMask("at6700a"); + _rel = new TRelation(LF_DONAZ); + _rel->add(LF_SOGGETTI, "CODICE==CODICE"); + _soggetti = new TLocalisamfile(LF_SOGGETTI); + _donaz = new TLocalisamfile(LF_DONAZ); + _atstatd = new TLocalisamfile(LF_ATSTATD); + _sezioni = new TLocalisamfile(LF_SEZIONI); + _colonne = new TAssoc_array(); + dispatch_e_menu(BAR_ITEM(1)); + return TRUE; +} + +bool TRiepilogoGiornaliero::destroy() +{ + delete _rel; + delete _msk; + delete _soggetti; + delete _donaz; + delete _atstatd; + delete _sezioni; + delete _colonne; + return TApplication::destroy(); +} + +bool TRiepilogoGiornaliero::menu(MENU_TAG m) +{ + TMask& msk = get_mask(); + KEY tasto; + tasto = msk.run(); + if (tasto == K_ENTER) + { + _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); + if (riepilogo()) + stampa(); + } + return FALSE; +} + +void TRiepilogoGiornaliero::crea_intestazione() +{ + TPrintrow row; + TString256 sep; + sep = "GIORNALIERO DONAZIONI"; + if (_dataini.ok()) + { + sep << " dal "; + sep << _dataini.string(); + } + if (_datafin.ok()) + { + sep << " al "; + sep << _datafin.string(); + } + sep.center_just(80); + row.put(sep); + row.put("@>", 1); + row.put("Pag. @#", 70); + printer().setheaderline(2, row); + row.reset(); + printer().setheaderline(3, row); + sep = "Data "; + TTable tdn("TDN"); + int pos = 27; + for (tdn.first(); !tdn.eof(); tdn.next()) + { + sep.overwrite((const char*)tdn.get("CODTAB"),pos); + pos = pos+10; + } + sep.overwrite("Totale",pos); + row.put(sep); + printer().setheaderline(5, row); + sep = ""; + sep.fill('-'); + row.reset(); + row.put(sep); + printer().setheaderline(6, row); +} + +bool TRiepilogoGiornaliero::stampa() +{ + if (printer().open()) + { + crea_intestazione(); + TRelation* relstat = new TRelation(LF_ATSTATD); + TCursor* curstat = new TCursor(relstat, "", 1); + TString16 oldsez = "**"; + TString16 oldsot = "**"; + double numero, numprime; + TString16 actsez, actsot; + TString16 tipodon; + TDate data; + long last = curstat->items(); + for ( *curstat=0; curstat->pos() < last; ++(*curstat) ) + { + actsez = curstat->curr().get(ATS_CODSEZ); + actsot = curstat->curr().get(ATS_CODSOT); + data = curstat->curr().get_date(ATS_DATA); + tipodon = curstat->curr().get(ATS_TIPODON); + numero = (double)curstat->curr().get_int(ATS_NUMERO); + numprime = (double)curstat->curr().get_int(ATS_NUMPRIME); + if (actsez != oldsez || actsot != oldsot) + { + if (oldsez != "**" && oldsot != "**") + { + stampa_sezione(oldsez,oldsot); + azzera_righe(); + } + oldsez = actsez; + oldsot = actsot; + } + TRigaG& riga = (TRigaG&)_righe[data2row(data)]; + real& colonna = (real&)_colonne->find((const char*)tipodon); + real n = numero; + riga.aggiorna_valore(colonna.integer(),n); + if (_primedon) + { + TRigaG& riga_prime = (TRigaG&)_righe_prime[data2row(data)]; + n = numprime; + riga_prime.aggiorna_valore(colonna.integer(), n); + } + } + if (oldsez != "**" && oldsot != "**") + stampa_sezione(oldsez,oldsot); + delete curstat; + delete relstat; + printer().close(); + return TRUE; + } + else + return FALSE; +} + +void TRiepilogoGiornaliero::azzera_righe() +{ + TDate data = _dataini; + while (data<=_datafin) + { + TRigaG& riga = (TRigaG&)_righe[data2row(data)]; + riga.azzera_valori(); + if (_primedon) + { + TRigaG& riga_prime = (TRigaG&)_righe_prime[data2row(data)]; + riga_prime.azzera_valori(); + } + ++data; + } +} + +void TRiepilogoGiornaliero::stampa_sezione(TString16 codsez, TString16 codsot) +{ + TPrintrow row; + TString256 rigastampa; + rigastampa = "Sezione: "; + rigastampa << codsez; + if (codsot.not_empty()) + { + rigastampa << "/"; + rigastampa << codsot; + } + rigastampa << " "; + TLocalisamfile sezioni(LF_SEZIONI); + sezioni.setkey(1); + sezioni.zero(); + sezioni.put(SEZ_CODSEZ,codsez); + sezioni.put(SEZ_CODSOT,codsot); + if (sezioni.read() == NOERR) + { + TString80 den = sezioni.get(SEZ_DENSEZ); + rigastampa << den; + den = sezioni.get(SEZ_DENSOT); + if (den.not_empty()) + { + rigastampa << "/"; + rigastampa << den; + } + } + rigastampa.center_just(80); + row.put(rigastampa); + printer().setheaderline(1, row); + + TRigaG rigatotali(NULLDATE); + TDate data = _dataini; + real totaledata = ZERO; + TString16 valore; + while (data<=_datafin) + { + TRigaG& riga = (TRigaG&)_righe[data2row(data)]; + row.reset(); + rigastampa = ""; + rigastampa.format("%s", (const char*)data.string()); + totaledata = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + rigatotali.aggiorna_valore(i,riga[i]); + totaledata+=riga[i]; + valore = ""; + valore.format("%8d",riga[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totaledata.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + ++data; + } + // stampa totali per sezione + rigastampa = ""; + rigastampa.fill('-'); + row.reset(); + row.put(rigastampa); + printer().print(row); + row.reset(); + rigastampa = ""; + rigastampa = "Totale periodo"; + totaledata = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + totaledata+=rigatotali[i]; + valore = ""; + valore.format("%8d",rigatotali[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totaledata.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + + if (_primedon) + { + printer().formfeed(); + rigatotali.azzera_valori(); + data = _dataini; + while (data<=_datafin) + { + TRigaG& riga = (TRigaG&)_righe_prime[data2row(data)]; + row.reset(); + rigastampa = ""; + rigastampa.format("%s", (const char*)data.string()); + totaledata = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + rigatotali.aggiorna_valore(i,riga[i]); + totaledata+=riga[i]; + valore = ""; + valore.format("%8d",riga[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totaledata.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + ++data; + } + // stampa totali per sezione + rigastampa = ""; + rigastampa.fill('-'); + row.reset(); + row.put(rigastampa); + printer().print(row); + row.reset(); + rigastampa = ""; + rigastampa = "Totale periodo"; + totaledata = ZERO; + int pos = 21; + for (int i=0;i<_colonne->items();i++) + { + totaledata+=rigatotali[i]; + valore = ""; + valore.format("%8d",rigatotali[i].integer()); + rigastampa.overwrite((const char*)valore, pos); + pos = pos+10; + } + valore = ""; + valore.format("%8d",totaledata.integer()); + rigastampa.overwrite((const char*)valore, pos+4); + row.put((const char*) rigastampa); + printer().print(row); + } + row.reset(); + printer().setheaderline(3, row); + printer().formfeed(); +} + +bool TRiepilogoGiornaliero::riepilogo() +{ + if (crea_colonne() && crea_righe()) + { + // cancello i risultati della elaborazione precedente + TLocalisamfile stat(LF_ATSTATD); + for (stat.first(); !stat.eof(); stat.next()) + stat.remove(); + // filtro per data + TRectype da(LF_DONAZ); + TRectype a (LF_DONAZ); + if (_dataini.ok()) + 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); + TString16 codsez, codsot, tipodon; + int anno, mese, giorno; + TDate data; + long numero; + bool primadon; + TRectype& recdon = _cur->curr(); + TRectype& recsog = _cur->curr(LF_SOGGETTI); + long last = _cur->items(); + TProgind prg (last, "Elaborazione in corso... Prego attendere", FALSE, TRUE, 30); + for ( *_cur=0; _cur->pos() < last; ++(*_cur) ) + { + prg.addstatus(1); + codsez = recdon.get(DON_CODSEZ); + codsot = recdon.get(DON_CODSOT); + if (codsez.empty()) + { + codsez = recsog.get(SOG_CODSEZ); + codsot = recsog.get(SOG_CODSOT); + } + data = recdon.get_date(DON_DATADON); + anno = data.year(); + mese = data.month(); + giorno = data.day(); + tipodon = recdon.get(DON_TIPODON); + primadon = recdon.get_bool(DON_PRIMADON); + stat.zero(); + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + //stat.put(ATS_DATA, data); + stat.put(ATS_ANNO, anno); + stat.put(ATS_MESE, mese); + stat.put(ATS_GIORNO, giorno); + stat.put(ATS_TIPODON, tipodon); + if (stat.read() == NOERR) + { + numero = stat.get_long(ATS_NUMERO); + numero++; + stat.put(ATS_NUMERO, numero); + if (_primedon && primadon) + { + numero = stat.get_long(ATS_NUMPRIME); + numero++; + stat.put(ATS_NUMPRIME, numero); + } + int err = stat.rewrite(); + } + else + { + stat.zero(); + stat.put(ATS_CODSEZ, codsez); + stat.put(ATS_CODSOT, codsot); + stat.put(ATS_ANNO, anno); + stat.put(ATS_MESE, mese); + stat.put(ATS_GIORNO, giorno); + stat.put(ATS_DATA, data); + stat.put(ATS_TIPODON, tipodon); + numero = 1; + stat.put(ATS_NUMERO, numero); + if (_primedon && primadon) + stat.put(ATS_NUMPRIME, numero); + int err = stat.write(); + } + } + return (stat.eod() > 0); + } + else + return FALSE; +} + +int at6700(int argc, char* argv[]) +{ + TRiepilogoGiornaliero a; + a.run(argc, argv, "Riepilogo giornaliero donazioni"); + return 0; +} \ No newline at end of file diff --git a/at/at6700a.h b/at/at6700a.h new file mode 100755 index 000000000..f1f54fcd7 --- /dev/null +++ b/at/at6700a.h @@ -0,0 +1,15 @@ +// riepilogo gironaliero donazioni +// definizione campi per maschera di selezione + +#define F_SEZINI 101 +#define F_D_SEZINI 102 +#define F_SOTINI 103 +#define F_D_SOTINI 104 +#define F_SEZFIN 105 +#define F_D_SEZFIN 106 +#define F_SOTFIN 107 +#define F_D_SOTFIN 108 + +#define F_DATAINI 301 +#define F_DATAFIN 302 +#define F_PRIMEDON 303 diff --git a/at/at6700a.uml b/at/at6700a.uml new file mode 100755 index 000000000..ef7bd8a60 --- /dev/null +++ b/at/at6700a.uml @@ -0,0 +1,153 @@ +#include "at6700a.h" + +PAGE "Riepilogo giornaliero donazioni" -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 4 +BEGIN + PROMPT 1 5 "Opzioni per il riepilogo" +END + +DATE F_DATAINI +BEGIN + PROMPT 2 6 "Donazioni effettuate dal " + HELP "Data iniziale" +END + +DATE F_DATAFIN +BEGIN + PROMPT 40 6 "al " + HELP "Data finale" +END + +BOOLEAN F_PRIMEDON +BEGIN + PROMPT 2 7 "Riepilogo per prime donazioni" +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_QUIT 9 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE +ENDMASK diff --git a/at/at7.cpp b/at/at7.cpp index f75c0e16a..1f69a6133 100755 --- a/at/at7.cpp +++ b/at/at7.cpp @@ -4,7 +4,7 @@ #include "at7.h" -#define usage "Error - usage : %s -{0|1|2|3}" +#define usage "Error - usage : %s -{0|1|2|3|4}" int main(int argc,char** argv) @@ -22,6 +22,8 @@ int main(int argc,char** argv) rt = at7300(argc,argv) ; break; case 3: rt = at7400(argc,argv) ; break; + case 4: + rt = at7500(argc,argv) ; break; default: error_box(usage, argv[0]) ; break; } diff --git a/at/at7.h b/at/at7.h index 3d60dc1fa..70bbdbafb 100755 --- a/at/at7.h +++ b/at/at7.h @@ -5,6 +5,7 @@ int at7100(int argc, char* argv[]); int at7200(int argc, char* argv[]); int at7300(int argc, char* argv[]); int at7400(int argc, char* argv[]); +int at7500(int argc, char* argv[]); #endif // __AT7_H diff --git a/at/at7100.cpp b/at/at7100.cpp index c1c784465..24705f7a4 100755 --- a/at/at7100.cpp +++ b/at/at7100.cpp @@ -2,9 +2,9 @@ #include #include #include +#include #include "at7.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF // nomi dei campi #include "soggetti.h" diff --git a/at/at7100a.uml b/at/at7100a.uml index 2ec3e255c..234c05ccc 100755 --- a/at/at7100a.uml +++ b/at/at7100a.uml @@ -1,4 +1,3 @@ -#include "lf.h" PAGE "Aggiornamento CAP" -1 -1 78 20 BUTTON DLG_OK 9 2 diff --git a/at/at7200.cpp b/at/at7200.cpp index 40db70967..395f5f72b 100755 --- a/at/at7200.cpp +++ b/at/at7200.cpp @@ -2,9 +2,9 @@ #include #include #include +#include #include "at7.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF // nomi dei campi #include "soggetti.h" diff --git a/at/at7200a.uml b/at/at7200a.uml index e206a0621..89eea4a52 100755 --- a/at/at7200a.uml +++ b/at/at7200a.uml @@ -1,4 +1,3 @@ -#include "lf.h" PAGE "Correzioni per AVIS Bolzano" -1 -1 78 20 BUTTON DLG_OK 9 2 diff --git a/at/at7300.cpp b/at/at7300.cpp index aec25839c..6043c7f4a 100755 --- a/at/at7300.cpp +++ b/at/at7300.cpp @@ -3,9 +3,9 @@ #include #include #include +#include #include "at7.h" -#include "lf.h" #include "atlib.h" diff --git a/at/at7300a.uml b/at/at7300a.uml index 80057ec8a..b31d196e6 100755 --- a/at/at7300a.uml +++ b/at/at7300a.uml @@ -1,4 +1,3 @@ -#include "lf.h" PAGE "Stampa SO senza data FS" -1 -1 78 20 BUTTON DLG_OK 9 2 diff --git a/at/at7400.cpp b/at/at7400.cpp index 504ff9b74..97f9dcaca 100755 --- a/at/at7400.cpp +++ b/at/at7400.cpp @@ -2,9 +2,9 @@ #include #include #include +#include #include "at7.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF // nomi dei campi #include "soggetti.h" diff --git a/at/at7400a.uml b/at/at7400a.uml index e718ba586..24a2476be 100755 --- a/at/at7400a.uml +++ b/at/at7400a.uml @@ -1,4 +1,3 @@ -#include "lf.h" PAGE "Correzione nati a CERMES" -1 -1 78 20 BUTTON DLG_OK 9 2 diff --git a/at/at7500.cpp b/at/at7500.cpp index 52d4b432d..f69e023f9 100755 --- a/at/at7500.cpp +++ b/at/at7500.cpp @@ -1,10 +1,11 @@ #include #include #include +#include #include +#include #include "at7.h" -#include "lf.h" // se non lo metto non riesco a usare gli LF // nomi dei campi #include "soggetti.h" @@ -16,6 +17,10 @@ class TAggiornaDon : public TPrintapp TMask* _msk; TRelation* _rel; int _cur; + TLocalisamfile* _donaz; + TLocalisamfile* _storico; + TRecord_array* _sdonazioni; + TRecord_array* _sstorico; protected: virtual bool user_create(); @@ -50,7 +55,7 @@ bool TAggiornaDon::preprocess_page(int file, int counter) TDate datadon; for (int r=1; r<=_sdonazioni->rows(); r++) { - const TRectype& riga = _sdonazioni->row(r); + TRectype& riga = _sdonazioni->row(r, TRUE); datadon = riga.get(DON_DATADON); if (dataisc.ok()) // ha la data iscrizione @@ -84,7 +89,7 @@ bool TAggiornaDon::preprocess_page(int file, int counter) else // la data donazione è inferiore alla data iscrizione { - bool trovato = FALSE + bool trovato = FALSE; for (int l=1; l<=_sstorico->rows(); l++) { const TRectype& rigas = _sstorico->row(l); @@ -116,7 +121,7 @@ bool TAggiornaDon::preprocess_page(int file, int counter) } } if (rewrite) - _sdonazioni.rewrite(); + _sdonazioni->rewrite(); } return rewrite; } @@ -124,8 +129,8 @@ bool TAggiornaDon::preprocess_page(int file, int counter) void TAggiornaDon::set_page(int file, int cnt) { set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); - set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME)); - set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME)); + //set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_COGNOME)); + //set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME)); } bool TAggiornaDon::set_print(int) diff --git a/at/at7500a.uml b/at/at7500a.uml index 3bd4d3baf..979f068f7 100755 --- a/at/at7500a.uml +++ b/at/at7500a.uml @@ -1,4 +1,3 @@ -#include "lf.h" PAGE "Correzione sez./sot. su donazioni" -1 -1 78 20 BUTTON DLG_OK 9 2 diff --git a/at/atstatd.h b/at/atstatd.h new file mode 100755 index 000000000..31cd62335 --- /dev/null +++ b/at/atstatd.h @@ -0,0 +1,11 @@ +// definizione campi dell'archivio ATSTATD + +#define ATS_CODSEZ "CODSEZ" +#define ATS_CODSOT "CODSOT" +#define ATS_DATA "DATA" +#define ATS_ANNO "ANNO" +#define ATS_MESE "MESE" +#define ATS_GIORNO "GIORNO" +#define ATS_TIPODON "TIPODON" +#define ATS_NUMERO "NUMERO" +#define ATS_NUMPRIME "NUMPRIME" \ No newline at end of file