From b3ad7ac008c0f2788091f7652a867d3432ca9c39 Mon Sep 17 00:00:00 2001 From: cris Date: Mon, 22 Oct 2001 09:07:33 +0000 Subject: [PATCH] Patch level :1.7 qualunque Files correlati :un sacco Ricompilazione Demo : [ ] Commento :modifiche da maggio ad ottobre git-svn-id: svn://10.65.10.50/trunk@9924 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at0100a.uml | 4 +- at/at0600.cpp | 87 +++++++++++-- at/at0600a.h | 12 +- at/at0600a.uml | 72 +++++++++- at/at1200.cpp | 39 +++--- at/at2100.cpp | 3 +- at/at2600.cpp | 7 + at/at2600a.h | 1 + at/at2600a.uml | 5 + at/at2900.cpp | 47 ++++--- at/at2900a.h | 12 +- at/at2900a.uml | 88 ++++++++++++- at/at3600.cpp | 51 +++++--- at/at4300.cpp | 11 +- at/at5100a.h | 13 +- at/at5100a.uml | 2 +- at/at5300.cpp | 4 +- at/at7200.cpp | 10 +- at/at8200.cpp | 172 +++++++++++++----------- at/at8200a.h | 4 +- at/at8200a.uml | 45 ++++--- at/at8300.cpp | 14 +- at/at8700.cpp | 18 +++ at/at8800.cpp | 340 +++++++++++++++++++++++++++++++----------------- at/atlib1.cpp | 16 +-- at/atrubrsa.frm | 35 +++-- 26 files changed, 781 insertions(+), 331 deletions(-) diff --git a/at/at0100a.uml b/at/at0100a.uml index 79f430638..02c5ed828 100755 --- a/at/at0100a.uml +++ b/at/at0100a.uml @@ -2519,7 +2519,7 @@ BEGIN HELP "Motivo del controllo sanitario" END -STRING F_C_RESPONSAB 50 15 +STRING F_C_RESPONSAB 50 BEGIN PROMPT 2 17 "Responsabile " FIELD LF_CONTSAN->RESPONSAB @@ -2667,7 +2667,7 @@ BEGIN HELP "Motivo del controllo sanitario" END -STRING F_I_RESPONSAB 50 15 +STRING F_I_RESPONSAB 50 BEGIN PROMPT 2 13 "Responsabile " FIELD LF_IDONEITA->RESPONSAB diff --git a/at/at0600.cpp b/at/at0600.cpp index 7266097f2..c09c50bd0 100755 --- a/at/at0600.cpp +++ b/at/at0600.cpp @@ -14,6 +14,7 @@ #include "soggetti.h" #include "donaz.h" #include "contsan.h" +#include "idoneita.h" #include "benem.h" #include "storico.h" #include "sezioni.h" @@ -28,13 +29,17 @@ class TChiusuraPeriodica : public TPrintapp TMask* _msk; TRelation* _rel; + TLocalisamfile* _contsan; + TLocalisamfile* _idoneita; + TRecord_array* _scontrolli; + TRecord_array* _sidoneita; int _cur; TDate _data_chiusura, _dataud; TParagraph_string _operazione; bool _definitiva, _sospesi, _usosez; TString16 _codsez, _codsot; int _numdon; - TString16 _catfin1, _catfin2; + TString16 _catfin1, _catfin2, _contsan1, _contsan2, _motivo; TAssoc_array _categorie; int _contatore, _totale; @@ -171,6 +176,9 @@ bool TChiusuraPeriodica::preprocess_page(int file, int counter) } else { + TRectype* key = new TRectype(LF_CONTSAN); + long codice = recsog.get_long(SOG_CODICE); + key->put(CON_CODICE, codice); const int totdon = recsog.get_int(SOG_TOTDON); if (_catfin1.not_empty() && totdon<=_numdon) { @@ -186,6 +194,23 @@ bool TChiusuraPeriodica::preprocess_page(int file, int counter) recsog.put(SOG_DATAULTAGG, oggi); recsog.put(SOG_UTENULTAGG, user()); filesog.rewrite(); + if (_contsan1.not_empty()) + { + 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, oggi); + reccon.put(CON_TIPOCON, _contsan1); + TString80 resp = user(); + resp << " - CHIUSURA PERIODICA"; + reccon.put(CON_RESPONSAB, resp); + reccon.put(CON_MOTIVO, _motivo); + _scontrolli->add_row(reccon); + _scontrolli->rewrite(); + } } } else @@ -204,6 +229,23 @@ bool TChiusuraPeriodica::preprocess_page(int file, int counter) recsog.put(SOG_DATAULTAGG, oggi); recsog.put(SOG_UTENULTAGG, user()); filesog.rewrite(); + if (_contsan2.not_empty()) + { + 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, oggi); + reccon.put(CON_TIPOCON, _contsan2); + TString80 resp = user(); + resp << " - CHIUSURA PERIODICA"; + reccon.put(CON_RESPONSAB, resp); + reccon.put(CON_MOTIVO, _motivo); + _scontrolli->add_row(reccon); + _scontrolli->rewrite(); + } } } } @@ -279,11 +321,15 @@ void TChiusuraPeriodica::set_page(int file, int cnt) 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,"@64g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON)); - set_row(1,"@75g@ld", FLD(LF_SOGGETTI,SOG_DATAISC)); - set_row(1,"@86g@pn", FLD(LF_SOGGETTI,SOG_TOTDON, "###")); - set_row(1,"@90g@6,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS)); - set_row(1,"@97g#a", &_operazione); + set_row(1,"@64g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); + set_row(1,"@75g@S", FLD(LF_SOGGETTI,SOG_TELABI)); + set_row(1,"@90g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); + set_row(1,"@105g@S", FLD(LF_SOGGETTI,SOG_TELALT)); + set_row(1,"@120g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON)); + set_row(1,"@131g@ld", FLD(LF_SOGGETTI,SOG_DATAISC)); + set_row(1,"@142g@pn", FLD(LF_SOGGETTI,SOG_TOTDON, "###")); + set_row(1,"@152g@6,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS)); + set_row(1,"@159g#a", &_operazione); } bool TChiusuraPeriodica::filter_func_chiusura(const TRelation* rel) @@ -355,6 +401,20 @@ bool TChiusuraPeriodica::filter_func_chiusura(const TRelation* rel) if (data.ok()) filtrato = (data < app()._dataud); } + if (filtrato) + { + 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) + { + const TRectype& riga = app()._scontrolli->row(app()._scontrolli->rows()); + data = riga.get_date(CON_DATACON); + if (data >= app()._dataud) + filtrato = FALSE; + } + } } } } @@ -396,6 +456,9 @@ bool TChiusuraPeriodica::set_print(int) _numdon = _msk->get_int(F_NUMDON); _catfin1 = _msk->get(F_CATFIN1); _catfin2 = _msk->get(F_CATFIN2); + _contsan1 = _msk->get(F_CONTSAN1); + _contsan2 = _msk->get(F_CONTSAN2); + _motivo = _msk->get(F_MOTIVO); _definitiva = _msk->get_bool(F_DEFINITIVA); _sospesi = _msk->get_bool(F_SOSPESI); reset_files(); @@ -434,8 +497,8 @@ void TChiusuraPeriodica::crea_intestazione() sep = ""; sep.fill('-'); set_header(3, (const char *) sep); - set_header(4,"@0gCodice@9gC.@12gCognome@38gNome@64gData u.d.@75gData isc.@86gDon.@90gTess.@97gOperazione"); - set_header(5,"@0g--------@9g--@12g-------------------------@38g-------------------------@64g----------@75g----------@86g---@90g------@97g-----------------------------------"); + set_header(4,"@0gCodice@9gC.@12gCognome@38gNome@64gData nasc.@75gTel.Abit.@90gTel. Lav.@105gTel.Altro@120gDt.ult.don.@131gData Iscr.@142gTot. don.@152gT.AVIS@159gOp."); + set_header(5,"@0g--------@9g--@12g-------------------------@38g-------------------------@64g----------@75g--------------@90g--------------@105g--------------@120g----------@131g----------@142g---------@152g------@159g----------"); printer().footerlen(3); } @@ -448,11 +511,19 @@ bool TChiusuraPeriodica::user_create() _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); + _idoneita = new TLocalisamfile(LF_IDONEITA); + _scontrolli = new TRecord_array(LF_CONTSAN, CON_PROGCON); + _sidoneita = new TRecord_array(LF_IDONEITA, IDO_PROGIDO); return TRUE; } bool TChiusuraPeriodica::user_destroy() { + delete _sidoneita; + delete _scontrolli; + delete _idoneita; + delete _contsan; delete _rel; delete _msk; return TRUE; diff --git a/at/at0600a.h b/at/at0600a.h index 5ddd3134d..290ca8d8e 100755 --- a/at/at0600a.h +++ b/at/at0600a.h @@ -31,6 +31,14 @@ #define F_CATFIN2 216 // categoria di arrivo con donazioni >= numdon #define F_D_CATFIN1 217 #define F_D_CATFIN2 218 +// opzioni per controlli sanitari +#define F_CONTSAN1 301 // stato con donazioni < numdon +#define F_CONTSAN2 302 // stato con donazioni >= numdon +#define F_D_CONTSAN1 303 // +#define F_D_CONTSAN2 304 // +#define F_MOTIVO 305 // motivo da segnalare nel controllo +#define F_D_MOTIVO 306 // + // opzioni comuni -#define F_SOSPESI 301 -#define F_DEFINITIVA 302 +#define F_SOSPESI 401 +#define F_DEFINITIVA 402 diff --git a/at/at0600a.uml b/at/at0600a.uml index e900dca43..baa379e19 100755 --- a/at/at0600a.uml +++ b/at/at0600a.uml @@ -135,7 +135,7 @@ BEGIN HELP "Sottogruppo finale" END -GROUPBOX DLG_NULL 77 14 +GROUPBOX DLG_NULL 77 17 BEGIN PROMPT 1 5 "Opzioni per la chiusura" END @@ -325,9 +325,30 @@ BEGIN FLAGS "D" END +STRING F_CONTSAN1 2 +BEGIN + PROMPT 2 15 "Stato del don. per la cat.(crea un controllo) " + FLAGS "U" + USE TCS SELECT S6=="S" + INPUT CODTAB F_CONTSAN1 + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_CONTSAN1 CODTAB + OUTPUT F_D_CONTSAN1 S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" + GROUP 1 +END + +STRING F_D_CONTSAN1 30 20 +BEGIN + PROMPT 56 15 "" + FLAGS "D" +END + STRING F_CATFIN2 2 BEGIN - PROMPT 2 15 "Cat. per num. don. maggiore del num. indicato " + PROMPT 2 16 "Cat. per num. don. maggiore del num. indicato " FLAGS "U" USE CTD INPUT CODTAB F_CATFIN2 @@ -342,20 +363,61 @@ END STRING F_D_CATFIN2 30 20 BEGIN - PROMPT 56 15 "" + PROMPT 56 16 "" FLAGS "D" END +STRING F_CONTSAN2 2 +BEGIN + PROMPT 2 17 "Stato del don. per la cat.(crea un controllo) " + FLAGS "U" + USE TCS SELECT S6=="S" + INPUT CODTAB F_CONTSAN2 + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_CONTSAN2 CODTAB + OUTPUT F_D_CONTSAN2 S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" + GROUP 1 +END + +STRING F_D_CONTSAN2 30 20 +BEGIN + PROMPT 56 17 "" + FLAGS "D" +END + +STRING F_MOTIVO 4 +BEGIN + PROMPT 2 18 "Motivo da specificare nel contr. (se creato) " + FLAGS "U" + USE MTC + INPUT CODTAB F_MOTIVO + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_MOTIVO CODTAB + OUTPUT F_D_MOTIVO S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" + GROUP 1 +END + +STRING F_D_MOTIVO 30 20 +BEGIN + PROMPT 56 18 "" + FLAGS "D" +END BOOLEAN F_SOSPESI BEGIN - PROMPT 2 17 "Anche sospesi" + PROMPT 2 19 "Anche sospesi" HELP "Indicare se si vogliono processare per la chiusura anche i soggetti sospesi" END BOOLEAN F_DEFINITIVA BEGIN - PROMPT 30 17 "Chiusura definitiva" + PROMPT 30 19 "Chiusura definitiva" HELP "Se chiusura definitiva, le operazioni stampate verranno registrate" END diff --git a/at/at1200.cpp b/at/at1200.cpp index a68236963..4b38b8c79 100755 --- a/at/at1200.cpp +++ b/at/at1200.cpp @@ -107,29 +107,26 @@ bool TAttribuzioneBenemerenze::preprocess_page(int file, int counter) TRectype* key = new TRectype(LF_BENEM); key->put(BEN_CODICE, codice); int err = _sbenemerenze->read(key); - if (err == NOERR) - { - int r = _sbenemerenze->rows(); - TRectype& rec = _sbenemerenze->row(r+1,TRUE); + int r = _sbenemerenze->rows(); + TRectype& rec = _sbenemerenze->row(r+1,TRUE); - TString16 codsez = recsog.get(SOG_CODSEZ); - TString16 codsot = recsog.get(SOG_CODSOT); - TString16 gruppoazie = recsog.get(SOG_GRUPPOAZIE); + TString16 codsez = recsog.get(SOG_CODSEZ); + TString16 codsot = recsog.get(SOG_CODSOT); + TString16 gruppoazie = recsog.get(SOG_GRUPPOAZIE); - rec.put(BEN_TIPOBEN, tipoben); - rec.put(BEN_DATAMAT, recsog.get(SOG_DATAULTDON)); - rec.put(BEN_BONUS, recsog.get(SOG_TOTDON)); - rec.put(BEN_DATABEN, _dataela); - rec.put(BEN_DATACON, _datapre); - if (_attgruppi) - rec.put(BEN_GRUPPOAZIE, gruppoazie); - else - { - rec.put(BEN_CODSEZ, codsez); - rec.put(BEN_CODSOT, codsot); - } - int err = _sbenemerenze->rewrite(); - } + rec.put(BEN_TIPOBEN, tipoben); + rec.put(BEN_DATAMAT, recsog.get(SOG_DATAULTDON)); + rec.put(BEN_BONUS, recsog.get(SOG_TOTDON)); + rec.put(BEN_DATABEN, _dataela); + rec.put(BEN_DATACON, _datapre); + if (_attgruppi) + rec.put(BEN_GRUPPOAZIE, gruppoazie); + else + { + rec.put(BEN_CODSEZ, codsez); + rec.put(BEN_CODSOT, codsot); + } + err = _sbenemerenze->rewrite(); } } return TRUE; diff --git a/at/at2100.cpp b/at/at2100.cpp index 19df5ab41..0d33c24b8 100755 --- a/at/at2100.cpp +++ b/at/at2100.cpp @@ -230,7 +230,8 @@ bool TStampaSospesi::filter_func_sospesi(const TRelation* rel) if (contsan.read() == NOERR) { const TString16 motivo = contsan.get(CON_MOTIVO); - if ((app()._motivo1==motivo) || (app()._motivo2==motivo) || (app()._motivo3==motivo) || (app()._motivo4==motivo) || (app()._motivo5==motivo)) + if ((app()._motivo1==motivo) + || (app()._motivo2==motivo && app()._motivo2.not_empty()) || (app()._motivo3==motivo && app()._motivo3.not_empty()) || (app()._motivo4==motivo && app()._motivo4.not_empty()) || (app()._motivo5==motivo) && app()._motivo5.not_empty()) filtrato = TRUE; else filtrato = FALSE; diff --git a/at/at2600.cpp b/at/at2600.cpp index c1a480d9a..3a3f49be3 100755 --- a/at/at2600.cpp +++ b/at/at2600.cpp @@ -45,6 +45,7 @@ class TStampaIscritti : public TPrintapp TDate _dataini, _datafin; int _etlarghezza, _etcolonne; bool _attuale; + int _numdon; static bool filter_func_iscritti(const TRelation* rel); @@ -166,6 +167,11 @@ bool TStampaIscritti::filter_func_iscritti(const TRelation * rel) filtrato = (datadim >= app()._dataini && datadim <= app()._datafin); } } + if (app()._numdon > 0 && filtrato) + { + const int totdon = sog.get_int(SOG_TOTDON); + filtrato = (totdon >= app()._numdon); + } return filtrato; } @@ -314,6 +320,7 @@ bool TStampaIscritti::set_print(int m) _dataini = _msk->get(F_DATAINI); _datafin = _msk->get(F_DATAFIN); _attuale = _msk->get_bool(F_ATTUALE); + _numdon = _msk->get_int(F_NUMDON); current_cursor()->set_filterfunction(filter_func_iscritti, TRUE); reset_print(); printer().footerlen(0); diff --git a/at/at2600a.h b/at/at2600a.h index ce10ad129..b110ecff1 100755 --- a/at/at2600a.h +++ b/at/at2600a.h @@ -27,6 +27,7 @@ #define F_DATAINI 302 #define F_DATAFIN 303 #define F_ATTUALE 304 // flag per stampare solo soggetti che sono ancora attualmente nella situazione richiesta (i/d) +#define F_NUMDON 305 // soggetti che hanno almeno tot donazioni #define F_ELENCO 401 #define F_ETICHETTE 402 diff --git a/at/at2600a.uml b/at/at2600a.uml index 3c1c2cab5..a9b1124dc 100755 --- a/at/at2600a.uml +++ b/at/at2600a.uml @@ -296,5 +296,10 @@ BEGIN HELP "Stampa solo i soggetti che sono ancora nella situazione scelta" END +NUMBER F_NUMDON 3 +BEGIN + PROMPT 2 15 "Numero minimo donazioni " +END + ENDPAGE ENDMASK diff --git a/at/at2900.cpp b/at/at2900.cpp index 6fdec3da3..9bfdd2823 100755 --- a/at/at2900.cpp +++ b/at/at2900.cpp @@ -47,7 +47,7 @@ class TFrequenza : public TPrintapp TDate _data_stampa; TDate _dataini,_datafin; int _numdon; - TString16 _tipodon; + TString16 _tipodon1, _tipodon2, _tipodon3, _tipodon4, _tipodon5, _tipodon; ts _tipostampa; TString16 _codsez, _codsot; int _etlarghezza, _etcolonne; @@ -197,7 +197,7 @@ bool TFrequenza::filter_func_freq(const TRelation* rel) if ((datadon>=app()._dataini || !app()._dataini.ok()) && (datadon<=app()._datafin || !app()._datafin.ok())) { TString16 tipodon = riga.get(DON_TIPODON); - if ((app()._tipodon.empty()) || (app()._tipodon == tipodon)) + if ((app()._tipodon.empty()) || (app()._tipodon1 == tipodon) || (app()._tipodon2 == tipodon) || (app()._tipodon3 == tipodon) || (app()._tipodon4 == tipodon) || (app()._tipodon5 == tipodon)) numdon++; } } @@ -270,7 +270,7 @@ bool TFrequenza::preprocess_page(int file, int counter) if ((datadon>=_dataini) && (datadon<=_datafin)) { TString16 tipodon = riga.get(DON_TIPODON); - if ((app()._tipodon.empty()) || (app()._tipodon == tipodon)) + if ((app()._tipodon.empty()) || (app()._tipodon1 == tipodon) || (app()._tipodon2 == tipodon) || (app()._tipodon3 == tipodon) || (app()._tipodon4 == tipodon) || (app()._tipodon5 == tipodon)) { numdon++; dataultdon = datadon; @@ -391,7 +391,14 @@ bool TFrequenza::set_print(int m) _numdon = _msk->get_int(F_NUMDON); _dataini = _msk->get(F_DATAINI); _datafin = _msk->get(F_DATAFIN); - _tipodon = _msk->get(F_TIPODON); + _tipodon1 = _msk->get(F_TIPODON1); + _tipodon2 = _msk->get(F_TIPODON2); + _tipodon3 = _msk->get(F_TIPODON3); + _tipodon4 = _msk->get(F_TIPODON4); + _tipodon5 = _msk->get(F_TIPODON5); + _tipodon = _tipodon1; + _tipodon << _tipodon2 << _tipodon3 << _tipodon4 << _tipodon5; + //if (_tipodon1.empty()) && (_tipodon2.empty()) && (_tipodon3.empty()) && (_tipodon4.empty()) && (_tipodon5.empty()) && (!_dataini.ok()) && (!_datafin.ok())) if ((_tipodon.empty()) && (!_dataini.ok()) && (!_datafin.ok())) _ctrltotale = TRUE; else @@ -446,8 +453,16 @@ void TFrequenza::crea_intestazione() } sep << _numdon; sep << " DONAZIONI"; - if (_tipodon.not_empty()) - sep << ' ' << _tipodon; + if (_tipodon1.not_empty()) + sep << ' ' << _tipodon1; + if (_tipodon2.not_empty()) + sep << ' ' << _tipodon2; + if (_tipodon3.not_empty()) + sep << ' ' << _tipodon3; + if (_tipodon4.not_empty()) + sep << ' ' << _tipodon4; + if (_tipodon5.not_empty()) + sep << ' ' << _tipodon5; if (_dataini.ok()) sep << " DAL " << _dataini.string(); if (_datafin.ok()) @@ -456,7 +471,7 @@ void TFrequenza::crea_intestazione() sep.center_just(80); else sep.center_just(132); - set_header(2, "@0g%s", (const char*) sep); + set_header(3, "@0g%s", (const char*) sep); TString16 data_stampa = _data_stampa.string(); set_header(2,"@0g%10s", (const char*) data_stampa); sep = ""; @@ -465,21 +480,21 @@ void TFrequenza::crea_intestazione() set_header(2, "@73g%s", (const char*) sep); else set_header(2, "@110g%s", (const char*) sep); - set_header(3, ""); + set_header(4, ""); if (_stampa80) { - set_header(4,"@0gCodice@9gCognome e nome@44gTelefono abit.@60gNum.don."); - set_header(5,"@0gTessera@44gTelefono lavoro@60gUlt.don."); - set_header(6,"@0gCateg.@9gNato il@44gTelefono altro"); - set_header(7,"@0g--------@9g----------------------------------@44g--------------@60g----------"); + set_header(5,"@0gCodice@9gCognome e nome@44gTelefono abit.@60gNum.don."); + set_header(6,"@0gTessera@44gTelefono lavoro@60gUlt.don."); + set_header(7,"@0gCateg.@9gNato il@44gTelefono altro"); + set_header(8,"@0g--------@9g----------------------------------@44g--------------@60g----------"); _cognome_nome.set_width(35); } else { - set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gNum.don."); - set_header(5,"@0gTessera@49gCAP/Località/Comune/Prov.@100gTelefono lavoro@116gUlt.don."); - set_header(6,"@100gTelefono altro"); - set_header(7,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g----------"); + set_header(5,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gNum.don."); + set_header(6,"@0gTessera@49gCAP/Località/Comune/Prov.@100gTelefono lavoro@116gUlt.don."); + set_header(7,"@100gTelefono altro"); + set_header(8,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g----------"); _cognome_nome.set_width(25); } printer().footerlen(3); diff --git a/at/at2900a.h b/at/at2900a.h index 36824f18e..0c7b06c1b 100755 --- a/at/at2900a.h +++ b/at/at2900a.h @@ -27,8 +27,16 @@ #define F_NUMDON 302 #define F_DATAINI 303 #define F_DATAFIN 304 -#define F_TIPODON 305 -#define F_D_TIPODON 306 +#define F_TIPODON1 305 +#define F_D_TIPODON1 306 +#define F_TIPODON2 307 +#define F_D_TIPODON2 308 +#define F_TIPODON3 309 +#define F_D_TIPODON3 310 +#define F_TIPODON4 311 +#define F_D_TIPODON4 312 +#define F_TIPODON5 313 +#define F_D_TIPODON5 314 #define F_ELENCO 401 #define F_ETICHETTE 402 diff --git a/at/at2900a.uml b/at/at2900a.uml index 416bf1367..14c437d7b 100755 --- a/at/at2900a.uml +++ b/at/at2900a.uml @@ -264,7 +264,7 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 77 4 +GROUPBOX DLG_NULL 77 8 BEGIN PROMPT 1 10 "Opzioni di elaborazione" END @@ -292,25 +292,101 @@ BEGIN PROMPT 50 11 "al " END -STRING F_TIPODON 2 +STRING F_TIPODON1 2 BEGIN PROMPT 2 12 "Tipo donazioni " FLAGS "U" USE TDN - INPUT CODTAB F_TIPODON + INPUT CODTAB F_TIPODON1 DISPLAY "Codice" CODTAB DISPLAY "Descrizione@30" S0 - OUTPUT F_TIPODON CODTAB - OUTPUT F_D_TIPODON S0 + OUTPUT F_TIPODON1 CODTAB + OUTPUT F_D_TIPODON1 S0 CHECKTYPE NORMAL WARNING "Codice non presente" END -STRING F_D_TIPODON 30 +STRING F_D_TIPODON1 30 BEGIN PROMPT 24 12 "" FLAGS "D" END +STRING F_TIPODON2 2 +BEGIN + PROMPT 2 13 " " + FLAGS "U" + USE TDN + INPUT CODTAB F_TIPODON2 + COPY DISPLAY F_TIPODON1 + OUTPUT F_TIPODON2 CODTAB + OUTPUT F_D_TIPODON2 S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" +END + +STRING F_D_TIPODON2 30 +BEGIN + PROMPT 24 13 "" + FLAGS "D" +END + +STRING F_TIPODON3 2 +BEGIN + PROMPT 2 14 " " + FLAGS "U" + USE TDN + INPUT CODTAB F_TIPODON3 + COPY DISPLAY F_TIPODON1 + OUTPUT F_TIPODON3 CODTAB + OUTPUT F_D_TIPODON3 S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" +END + +STRING F_D_TIPODON3 30 +BEGIN + PROMPT 24 14 "" + FLAGS "D" +END + +STRING F_TIPODON4 2 +BEGIN + PROMPT 2 15 " " + FLAGS "U" + USE TDN + INPUT CODTAB F_TIPODON4 + COPY DISPLAY F_TIPODON1 + OUTPUT F_TIPODON4 CODTAB + OUTPUT F_D_TIPODON4 S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" +END + +STRING F_D_TIPODON4 30 +BEGIN + PROMPT 24 15 "" + FLAGS "D" +END + +STRING F_TIPODON5 2 +BEGIN + PROMPT 2 16 " " + FLAGS "U" + USE TDN + INPUT CODTAB F_TIPODON5 + COPY DISPLAY F_TIPODON1 + OUTPUT F_TIPODON5 CODTAB + OUTPUT F_D_TIPODON5 S0 + CHECKTYPE NORMAL + WARNING "Codice non presente" +END + +STRING F_D_TIPODON5 30 +BEGIN + PROMPT 24 16 "" + FLAGS "D" +END + ENDPAGE ENDMASK diff --git a/at/at3600.cpp b/at/at3600.cpp index 71873f3a8..a27813466 100755 --- a/at/at3600.cpp +++ b/at/at3600.cpp @@ -505,7 +505,8 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) rigatotali.aggiorna_valore((int) colonnadm.integer(),riga[(int) colonnadm.integer()]); totdonazioni+=riga[(int) colonnadm.integer()]; valore = ""; - valore.format("%8d",riga[(int) colonnadm.integer()].integer()); + //valore.format("%8d",riga[(int) colonnadm.integer()].integer()); + valore.format("%8s",riga[(int) colonnadm.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; const char* indicedf = "DF"; @@ -513,12 +514,14 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) rigatotali.aggiorna_valore((int) colonnadf.integer(),riga[(int) colonnadf.integer()]); totdonazioni+=riga[(int) colonnadf.integer()]; valore = ""; - valore.format("%8d",riga[(int) colonnadf.integer()].integer()); + //valore.format("%8d",riga[(int) colonnadf.integer()].integer()); + valore.format("%8s",riga[(int) colonnadf.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; // stampo totale donazioni valore = ""; - valore.format("%8d",totdonazioni.integer()); + //valore.format("%8d",totdonazioni.integer()); + valore.format("%8s",totdonazioni.string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+10; @@ -527,7 +530,8 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) totsoggetti+=riga[(int) colonnasm.integer()]; rigatotali.aggiorna_valore((int) colonnasm.integer(),riga[(int) colonnasm.integer()]); valore = ""; - valore.format("%8d",riga[(int) colonnasm.integer()].integer()); + //valore.format("%8d",riga[(int) colonnasm.integer()].integer()); + valore.format("%8s",riga[(int) colonnasm.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; const char* indicesf = "SF"; @@ -535,12 +539,14 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) totsoggetti+=riga[(int) colonnasf.integer()]; rigatotali.aggiorna_valore((int) colonnasf.integer(),riga[(int) colonnasf.integer()]); valore = ""; - valore.format("%8d",riga[(int) colonnasf.integer()].integer()); + //valore.format("%8d",riga[(int) colonnasf.integer()].integer()); + valore.format("%8s",riga[(int) colonnasf.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; // stampo totale donatori valore = ""; - valore.format("%8d",totsoggetti.integer()); + //valore.format("%8d",totsoggetti.integer()); + valore.format("%8s",totsoggetti.string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+14; @@ -548,7 +554,8 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) if (totsoggetti.integer()!=0) { // maschi - if (riga[(int) colonnasm.integer()].integer() != 0) + //if (riga[(int) colonnasm.integer()].integer() != 0) + if (riga[(int) colonnasm.integer()] != ZERO) { valore = ""; real perc = riga[(int) colonnadm.integer()] / riga[(int) colonnasm.integer()]; @@ -557,7 +564,8 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) } pos = pos+8; // femmine - if (riga[(int) colonnasf.integer()].integer() != 0) + //if (riga[(int) colonnasf.integer()].integer() != 0) + if (riga[(int) colonnasf.integer()] != ZERO) { valore = ""; real perc = riga[(int) colonnadf.integer()] / riga[(int) colonnasf.integer()]; @@ -597,47 +605,55 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) real& colonnadm = (real&)_colonne->find(indicedm); totdonazioni+=rigatotali[(int) colonnadm.integer()]; valore = ""; - valore.format("%8d",rigatotali[(int) colonnadm.integer()].integer()); + //valore.format("%8d",rigatotali[(int) colonnadm.integer()].integer()); + valore.format("%8s",rigatotali[(int) colonnadm.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; const char* indicedf = "DF"; real& colonnadf = (real&)_colonne->find(indicedf); totdonazioni+=rigatotali[(int) colonnadf.integer()]; valore = ""; - valore.format("%8d",rigatotali[(int) colonnadf.integer()].integer()); + //valore.format("%8d",rigatotali[(int) colonnadf.integer()].integer()); + valore.format("%8s",rigatotali[(int) colonnadf.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; // stampo totale donazioni valore = ""; - valore.format("%8d",totdonazioni.integer()); + //valore.format("%8d",totdonazioni.integer()); + valore.format("%8s",totdonazioni.string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+10; const char* indicesm = "SM"; real& colonnasm = (real&)_colonne->find(indicesm); totsoggetti+=rigatotali[(int) colonnasm.integer()]; valore = ""; - valore.format("%8d",rigatotali[(int) colonnasm.integer()].integer()); + //valore.format("%8d",rigatotali[(int) colonnasm.integer()].integer()); + valore.format("%8s",rigatotali[(int) colonnasm.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; const char* indicesf = "SF"; real& colonnasf = (real&)_colonne->find(indicesf); totsoggetti+=rigatotali[(int) colonnasf.integer()]; valore = ""; - valore.format("%8d",rigatotali[(int) colonnasf.integer()].integer()); + //valore.format("%8d",rigatotali[(int) colonnasf.integer()].integer()); + valore.format("%8s",rigatotali[(int) colonnasf.integer()].string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+8; // stampo totale donatori valore = ""; - valore.format("%8d",totsoggetti.integer()); + //valore.format("%8d",totsoggetti.integer()); + valore.format("%8s",totsoggetti.string()); rigastampa.overwrite((const char*)valore, pos); pos = pos+14; // percentuale - if (totsoggetti.integer()!=0) + //if (totsoggetti.integer()!=0) + if (totsoggetti!=ZERO) { // maschi - if (rigatotali[(int) colonnasm.integer()].integer() != 0) + //if (rigatotali[(int) colonnasm.integer()].integer() != 0) + if (rigatotali[(int) colonnasm.integer()] != ZERO) { valore = ""; real perc = rigatotali[(int) colonnadm.integer()] / rigatotali[(int) colonnasm.integer()]; @@ -646,7 +662,8 @@ void TStatDonGrRh::stampa_sezione(TString16 codsez, TString16 codsot) } pos = pos+8; // femmine - if (rigatotali[(int) colonnasf.integer()].integer() != 0) + //if (rigatotali[(int) colonnasf.integer()].integer() != 0) + if (rigatotali[(int) colonnasf.integer()] != ZERO) { valore = ""; real perc = rigatotali[(int) colonnadf.integer()] / rigatotali[(int) colonnasf.integer()]; diff --git a/at/at4300.cpp b/at/at4300.cpp index 4af148f01..1eec37e51 100755 --- a/at/at4300.cpp +++ b/at/at4300.cpp @@ -306,7 +306,16 @@ void TStampaConvocazioni::fine_stampa() TString sep(80); sep.fill('-'); set_footer(1, (const char *) sep); - set_footer(2,"TOTALE GENERALE %d", _totfinestampa); + 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); + set_footer(3,"Da sezione/sottogruppo %s/%s", (const char*) sezini, (const char*) sotini); + set_footer(4," a sezione/sottogruppo %s/%s", (const char*) sezfin, (const char*) sotfin); + set_footer(6,"TOTALE GENERALE %d", _totfinestampa); + + TString16 data_stampa = _data_stampa.string(); + set_footer(8,"Stampato il %10s", (const char*) data_stampa); printer().formfeed(); reset_footer(); } diff --git a/at/at5100a.h b/at/at5100a.h index f48c04df3..9b6f351d1 100755 --- a/at/at5100a.h +++ b/at/at5100a.h @@ -74,13 +74,16 @@ #define AT_D_NETFORM 167 -// definizione cartoline +// definizione cartoline per donazioni #define AT_CAFORM 168 #define AT_CAPARAM 169 - #define AT_D_CAFORM 170 -// definizione tessere -#define AT_TEFORM 171 +// definizione cartoline altre stampe (dove previste) +#define AT_ACAFORM 171 +#define AT_ACAPARAM 172 +#define AT_D_ACAFORM 173 -#define AT_D_TEFORM 172 +// definizione tessere +#define AT_TEFORM 174 +#define AT_D_TEFORM 175 diff --git a/at/at5100a.uml b/at/at5100a.uml index c4a264586..488bb6734 100755 --- a/at/at5100a.uml +++ b/at/at5100a.uml @@ -395,7 +395,7 @@ END GROUPBOX DLG_NULL 77 4 BEGIN - PROMPT 1 7 "Cartoline" + PROMPT 1 7 "Cartoline per donazione" END STRING AT_CAFORM 8 diff --git a/at/at5300.cpp b/at/at5300.cpp index 560b441d1..88cd25959 100755 --- a/at/at5300.cpp +++ b/at/at5300.cpp @@ -564,9 +564,9 @@ bool TTurniControlli::user_create() _rel = new TRelation(LF_SOGGETTI); _rel->add(LF_SEZIONI,"CODSEZ==CODSEZ|CODSOT==CODSOT"); _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); - _rel->add("LCP", "CODTAB==RES_CODLOC",1,LF_SOGGETTI,ALIAS_LCPRES); +// _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==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); diff --git a/at/at7200.cpp b/at/at7200.cpp index 14b7fd0e3..06c1dabeb 100755 --- a/at/at7200.cpp +++ b/at/at7200.cpp @@ -21,7 +21,7 @@ class TPrimaDon : public TPrintapp TRecord_array* _sdonazioni; TLocalisamfile* _storico; TRecord_array* _sstorico; - + protected: virtual bool user_create(); virtual bool user_destroy(); @@ -51,6 +51,7 @@ bool TPrimaDon::preprocess_page(int file, int counter) int errd = _sdonazioni->read(keyd); if ((errd == NOERR) && (_sdonazioni->rows()>0)) { + /* for (int d=1; d<=_sdonazioni->rows(); d++) { TRectype& riga = _sdonazioni->row(d, TRUE); @@ -85,7 +86,7 @@ bool TPrimaDon::preprocess_page(int file, int counter) } } } - /* + */ TDate dataprisi = recsog.get(SOG_DATAPRISI); TDate datapriaf = recsog.get(SOG_DATAPRIAF); TRectype& riga = _sdonazioni->row(1, TRUE); @@ -101,11 +102,10 @@ bool TPrimaDon::preprocess_page(int file, int counter) rewrite = TRUE; riga.put(DON_PRIMADON, TRUE); } - */ if (rewrite) _sdonazioni->rewrite(); } - return rewrite; + return rewrite; } void TPrimaDon::set_page(int file, int cnt) @@ -141,7 +141,7 @@ bool TPrimaDon::user_create() } bool TPrimaDon::user_destroy() -{ +{ delete _sstorico; delete _sdonazioni; delete _storico; diff --git a/at/at8200.cpp b/at/at8200.cpp index 046f39f95..01948fdac 100755 --- a/at/at8200.cpp +++ b/at/at8200.cpp @@ -113,9 +113,10 @@ bool TAggConSan::menu(MENU_TAG m) if (!pr.open()) return error_box("Errore in apertura stampante."); - bool controlli = _msk->get_bool(F_CONTROLLI); bool anagrafica = _msk->get_bool(F_ANAGRAFICA); + bool controlli = _msk->get_bool(F_CONTROLLI); bool benemerenze = _msk->get_bool(F_BENEMERENZE); + TLocalisamfile& soggetti = _rel->lfile(); _rel->lfile().setkey(2); bool modificato = FALSE; TDate oggi(TODAY); @@ -134,6 +135,99 @@ bool TAggConSan::menu(MENU_TAG m) row.put(rigastampa); printer().setheaderline(3, row); TRectype recsog = _rel->curr(); + + if (anagrafica) + { + TExternisamfile* fs = new TExternisamfile("$portasog"); + TProgind *pi; + pi = new TProgind(fs->eod(),"Aggiornamento dati anagrafici", FALSE, TRUE, 10); + pi->setstatus(1); + for(fs->first(); !fs->eof(); fs->next()) + { + pi->addstatus(1); + modificato = FALSE; + const TString80 cognome = fs->get("COGNOME"); + const TString80 nome = fs->get("NOME"); + const TDate datanasc = fs->get_date("DATANASC"); + recsog.zero(); + recsog.put(SOG_COGNOME, cognome); + recsog.put(SOG_NOME, nome); + recsog.put(SOG_DATANASC, datanasc); + if (recsog.read(_rel->lfile())==NOERR) + { + if (fs->get("DATAISC").not_empty()) + recsog.put(SOG_DATAISC, fs->get("DATAISC")); + recsog.put(SOG_TESSAVIS, fs->get("TESSAVIS")); + recsog.put(SOG_COGNOME_SP, fs->get("COGNOME_SP")); + recsog.put(SOG_DOM_INDIR, fs->get("DOM_INDIR")); + recsog.put(SOG_DOM_CODCOM, fs->get("DOM_CODCOM")); + recsog.put(SOG_DOM_CODLOC, fs->get("DOM_CODLOC")); + recsog.put(SOG_DOM_STRADA, fs->get("DOM_STRADA")); + recsog.put(SOG_DOM_DISTRI, fs->get("DOM_DISTRI")); + recsog.put(SOG_DOM_CAP, fs->get("DOM_CAP")); + recsog.put(SOG_RES_INDIR, fs->get("RES_INDIR")); + recsog.put(SOG_RES_CODCOM, fs->get("RES_CODCOM")); + recsog.put(SOG_RES_CODLOC, fs->get("RES_CODLOC")); + recsog.put(SOG_RES_CAP, fs->get("RES_CAP")); + recsog.put(SOG_COMNASC, fs->get("COMNASC")); + recsog.put(SOG_SESSO, fs->get("SESSO")); + recsog.put(SOG_CF, fs->get("CF")); + recsog.put(SOG_DOCID, fs->get("DOCID")); + recsog.put(SOG_TELABI, fs->get("TELABI")); + recsog.put(SOG_TELLAV, fs->get("TELLAV")); + recsog.put(SOG_TELALT, fs->get("TELALT")); + recsog.put(SOG_TITINDIR, fs->get("TITINDIR")); + recsog.put(SOG_CATNOND1, fs->get("CATNOND1")); + recsog.put(SOG_CATNOND2, fs->get("CATNOND2")); + recsog.put(SOG_CODMED, fs->get("CODMED")); + recsog.put(SOG_NOTIZIARIO, fs->get("NOTIZIARIO")); + recsog.put(SOG_BENEM, fs->get("BENEM")); + recsog.put(SOG_CONSENSO, fs->get("CONSENSO")); + recsog.put(SOG_MODCONV, fs->get("MODCONV")); + recsog.put(SOG_GIOPREDON, fs->get("GIOPREDON")); + recsog.put(SOG_GIOPRECON, fs->get("GIOPRECON")); + recsog.put(SOG_CONDOCC, fs->get("CONDOCC")); + recsog.put(SOG_POSPROF, fs->get("POSPROF")); + recsog.put(SOG_RAMOATT, fs->get("RAMOATT")); + recsog.put(SOG_TITSTUD, fs->get("TITSTUD")); + recsog.put(SOG_PROFESS, fs->get("PROFESS")); + recsog.put(SOG_ESCLUSO, fs->get("ESCLUSO")); + recsog.put(SOG_TERMESCL, fs->get("TERMESCL")); + recsog.put(SOG_MOTESCL, fs->get("MOTESCL")); + recsog.put(SOG_DATAULTAGG, oggi); + recsog.put(SOG_UTENULTAGG, "PORT."); + recsog.rewrite(_rel->lfile()); + } + else + { + rigastampa = ""; + rigastampa << cognome; + rigastampa << " " << nome; + rigastampa << " " << datanasc.string(); + const char* catdon = recsog.get(SOG_CATDON); + if (yesno_box("%s %s %s %s\nIl soggetto non esiste nell'archivio provinciale. Inserire?", (const char*) cognome,(const char*) nome, (const char*) datanasc.string(), catdon)) + { + soggetti.setkey(1); + soggetti.last(); + long lastcod = soggetti.get_long(SOG_CODICE); + soggetti.zero(); + for (int i=0;iget(recsog.fieldname(i))); + soggetti.put(SOG_CODICE, lastcod+1); + soggetti.put(SOG_DATAULTAGG, oggi); + soggetti.put(SOG_UTENULTAGG, "PORT.-inserimento autom."); + soggetti.write(); + rigastampa << " " << "*** INSERITO codice " << soggetti.get(SOG_CODICE); + soggetti.setkey(2); + } + row.reset(); + row.put((const char*) rigastampa); + printer().print(row); + } + } + delete pi; + delete fs; + } if (controlli) { TExternisamfile* fc = new TExternisamfile("$portacon"); @@ -378,82 +472,6 @@ bool TAggConSan::menu(MENU_TAG m) delete pi; delete fc; } - if (anagrafica) - { - TExternisamfile* fs = new TExternisamfile("$portasog"); - TProgind *pi; - pi = new TProgind(fs->eod(),"Aggiornamento dati anagrafici", FALSE, TRUE, 10); - pi->setstatus(1); - for(fs->first(); !fs->eof(); fs->next()) - { - pi->addstatus(1); - modificato = FALSE; - const TString80 cognome = fs->get("COGNOME"); - const TString80 nome = fs->get("NOME"); - const TDate datanasc = fs->get_date("DATANASC"); - recsog.zero(); - recsog.put(SOG_COGNOME, cognome); - recsog.put(SOG_NOME, nome); - recsog.put(SOG_DATANASC, datanasc); - if (recsog.read(_rel->lfile())==NOERR) - { - if (fs->get("DATAISC").not_empty()) - recsog.put(SOG_DATAISC, fs->get("DATAISC")); - recsog.put(SOG_TESSAVIS, fs->get("TESSAVIS")); - recsog.put(SOG_COGNOME_SP, fs->get("COGNOME_SP")); - recsog.put(SOG_DOM_INDIR, fs->get("DOM_INDIR")); - recsog.put(SOG_DOM_CODCOM, fs->get("DOM_CODCOM")); - recsog.put(SOG_DOM_CODLOC, fs->get("DOM_CODLOC")); - recsog.put(SOG_DOM_STRADA, fs->get("DOM_STRADA")); - recsog.put(SOG_DOM_DISTRI, fs->get("DOM_DISTRI")); - recsog.put(SOG_DOM_CAP, fs->get("DOM_CAP")); - recsog.put(SOG_RES_INDIR, fs->get("RES_INDIR")); - recsog.put(SOG_RES_CODCOM, fs->get("RES_CODCOM")); - recsog.put(SOG_RES_CODLOC, fs->get("RES_CODLOC")); - recsog.put(SOG_RES_CAP, fs->get("RES_CAP")); - recsog.put(SOG_COMNASC, fs->get("COMNASC")); - recsog.put(SOG_SESSO, fs->get("SESSO")); - recsog.put(SOG_CF, fs->get("CF")); - recsog.put(SOG_DOCID, fs->get("DOCID")); - recsog.put(SOG_TELABI, fs->get("TELABI")); - recsog.put(SOG_TELLAV, fs->get("TELLAV")); - recsog.put(SOG_TELALT, fs->get("TELALT")); - recsog.put(SOG_TITINDIR, fs->get("TITINDIR")); - recsog.put(SOG_CATNOND1, fs->get("CATNOND1")); - recsog.put(SOG_CATNOND2, fs->get("CATNOND2")); - recsog.put(SOG_CODMED, fs->get("CODMED")); - recsog.put(SOG_NOTIZIARIO, fs->get("NOTIZIARIO")); - recsog.put(SOG_BENEM, fs->get("BENEM")); - recsog.put(SOG_CONSENSO, fs->get("CONSENSO")); - recsog.put(SOG_MODCONV, fs->get("MODCONV")); - recsog.put(SOG_GIOPREDON, fs->get("GIOPREDON")); - recsog.put(SOG_GIOPRECON, fs->get("GIOPRECON")); - recsog.put(SOG_CONDOCC, fs->get("CONDOCC")); - recsog.put(SOG_POSPROF, fs->get("POSPROF")); - recsog.put(SOG_RAMOATT, fs->get("RAMOATT")); - recsog.put(SOG_TITSTUD, fs->get("TITSTUD")); - recsog.put(SOG_PROFESS, fs->get("PROFESS")); - recsog.put(SOG_ESCLUSO, fs->get("ESCLUSO")); - recsog.put(SOG_TERMESCL, fs->get("TERMESCL")); - recsog.put(SOG_MOTESCL, fs->get("MOTESCL")); - recsog.put(SOG_DATAULTAGG, oggi); - recsog.put(SOG_UTENULTAGG, "PORT."); - recsog.rewrite(_rel->lfile()); - } - else - { - rigastampa = ""; - rigastampa << cognome; - rigastampa << " " << nome; - rigastampa << " " << datanasc.string(); - row.reset(); - row.put((const char*) rigastampa); - printer().print(row); - } - } - delete pi; - delete fs; - } pr.formfeed(); pr.close(); } diff --git a/at/at8200a.h b/at/at8200a.h index 6e788a272..ed0741819 100755 --- a/at/at8200a.h +++ b/at/at8200a.h @@ -1,6 +1,6 @@ // aggiornamento archivio da portatili // definizione campi per maschera di selezione -#define F_CONTROLLI 101 -#define F_ANAGRAFICA 102 +#define F_ANAGRAFICA 101 +#define F_CONTROLLI 102 #define F_BENEMERENZE 103 diff --git a/at/at8200a.uml b/at/at8200a.uml index 59b603430..7f193f331 100755 --- a/at/at8200a.uml +++ b/at/at8200a.uml @@ -1,29 +1,38 @@ #include "at8200a.h" -PAGE "Aggiorna archivi da altra sezione" -1 -1 78 20 - -BOOLEAN F_CONTROLLI -BEGIN - PROMPT 2 5 "Aggiorna controlli sanitari e idoneita'" -END - -BOOLEAN F_ANAGRAFICA -BEGIN - PROMPT 2 6 "Aggiorna dati anagrafici" -END - -BOOLEAN F_BENEMERENZE -BEGIN - PROMPT 2 7 "Aggiorna benemerenze" -END +TOOLBAR "" 0 20 0 2 BUTTON DLG_OK 9 2 BEGIN - PROMPT -12 14 "" + PROMPT -12 -11 "" END BUTTON DLG_QUIT 9 2 BEGIN - PROMPT -22 14 "" + PROMPT -22 -11 "" +END +ENDPAGE + +PAGE "Aggiorna archivi da altra sezione" -1 -1 78 20 + +GROUPBOX DLG_NULL 77 7 +BEGIN + PROMPT 1 1 "Opzioni di aggiornamento" +END + +BOOLEAN F_ANAGRAFICA +BEGIN + PROMPT 2 3 "Aggiorna dati anagrafici" +END + +BOOLEAN F_CONTROLLI +BEGIN + PROMPT 2 4 "Aggiorna controlli sanitari e idoneita'" +END + + +BOOLEAN F_BENEMERENZE +BEGIN + PROMPT 2 5 "Aggiorna benemerenze" END ENDPAGE diff --git a/at/at8300.cpp b/at/at8300.cpp index 5db67dcad..36346bed1 100755 --- a/at/at8300.cpp +++ b/at/at8300.cpp @@ -128,7 +128,19 @@ bool TCTDon2AT::menu(MENU_TAG m) int err = _sdonazioni->read(key); if (err == NOERR) { - calcola_donazioni_lib(recsog, _sdonazioni); + calcola_donazioni_lib(recsog, _sdonazioni); + recsog.rewrite(_rel->lfile()); + + TRectype* keyc = new TRectype(LF_CONTSAN); + keyc->put(CON_CODICE, codsog); + int err = _scontrolli->read(keyc); + + TRectype* keyi = new TRectype(LF_IDONEITA); + keyi->put(IDO_CODICE, codsog); + err = _sidoneita->read(keyi); + + con_reord(recsog,_scontrolli,_sidoneita); + recsog.rewrite(_rel->lfile()); } TTable ctd("CTD"); diff --git a/at/at8700.cpp b/at/at8700.cpp index 76bf17965..5fcc85c47 100755 --- a/at/at8700.cpp +++ b/at/at8700.cpp @@ -13,6 +13,7 @@ #include "at8700a.h" #include "soggetti.h" #include "donaz.h" +#include "contsan.h" #define CTBOFILENAME "at2ctbo.dat" @@ -235,7 +236,24 @@ void TCtbo_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr valore = riga.get(DON_DATADON); } } + else if (code == "_MOTIVO") + { + + const TDate datacon = cur.curr().get(SOG_DATASTATO); + const long codsog = cur.curr().get_long(SOG_CODICE); + TLocalisamfile controlli(LF_CONTSAN); + controlli.setkey(2); + controlli.put(CON_DATACON,datacon); + controlli.put(CON_CODICE,codsog); + if (controlli.read() == NOERR) + valore = controlli.get(CON_MOTIVO); + else + valore.cut(0); + } + + else NFCHECK("Macro non definita: %s", (const char *)code); + str = valore; } diff --git a/at/at8800.cpp b/at/at8800.cpp index 1dc151f9f..a27b824a5 100755 --- a/at/at8800.cpp +++ b/at/at8800.cpp @@ -11,54 +11,27 @@ #include "at8.h" #include "at8800a.h" -#include "soggetti.h" +#include "atlib.h" + +#include "contsan.h" #include "donaz.h" +#include "idoneita.h" +#include "soggetti.h" -#define ATFILENAME "ctbo2at.dat" - -class TCtbo2at_file; - -class TCtbo2at: public TSkeleton_application -{ - TMask* _msk; - TRelation* _rel; - TCursor* _cur; - TCtbo2at_file* _trasfile; - TRecord_array* _donazioni; - TLocalisamfile* _donaz; - TDate _data; - -protected: - virtual bool create(void); - virtual void main_loop(); - virtual bool destroy(void) ; - void transfer(void); - void inizializza_cur(void); - void inizializza_file(void); - void record(THash_object& lavoro); - static bool annulla_handler(TMask_field& f, KEY k); -public: - - const TMask& msk() const { return *_msk; } - const TRecord_array& donazioni() { return *_donazioni;} - const TDate data() { return _data;} - - TCtbo2at() {} - virtual ~TCtbo2at() {} -}; - -// restituisce un riferimento all' applicazione -inline TCtbo2at& app() { return (TCtbo2at&) main_app();} +#define ATFILENAME "pippo.txt" ///////////////////////////////////////////////////// // Classe TCtbo2at_file customizzata dalla TFile_text // ///////////////////////////////////////////////////// + class TCtbo2at_file: public TFile_text { protected: virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str); public: + virtual int autosave(TRelation& rel, const TRecord_text& rec); + TCtbo2at_file(const TString& file_name, const TString& config_name); virtual ~TCtbo2at_file() { } }; @@ -68,17 +41,111 @@ TCtbo2at_file::TCtbo2at_file(const TString& file_name, const TString& config_nam { } +int TCtbo2at_file::autosave(TRelation& rel, const TRecord_text& rec) +{ + const TString& type = rec.type();//prendo il tracciato record del tipo del record_text + TTracciato_record& tr = *t_rec(type); + + TArray& a_tc = tr.tracciati_campo(); + const int items = a_tc.items(); + TString valore; + for (int i = 0; i < items; i++) + { + const TTracciato_campo& tc = tr.get(i); + TFieldref field(tc.field()); + if (field.name().not_empty()) + { + if (field.file()==0) + field.set_file(rel.lfile().num()); + valore = rec.row(i); + // formatta il campo del file di testo secondo le specifiche del campo su file isam + preformat_field(field,valore,rel,tr.type()); + const TRectype& rel_rec = rel.curr(field.file()); + TFieldtypes tipo_campo = rel_rec.type(field.name()); + bool vuoto = valore.blank(); + switch(tipo_campo) + { + case _datefld: + { + if (real::is_null(valore)) + { + valore.cut(0); + vuoto = TRUE; + } + TDate data(valore); + format_date(data, fpicture(tc), valore);//formatta la data secondo le specifiche del tracciato + } + break; + case _realfld: + case _intfld: + case _longfld: + { + const real numero(valore); + vuoto = numero.is_zero(); + + valore = numero.string(fpicture(tc));//formatta il numero secondo le specifiche del tracciato + + int length = flength(tc,rel_rec); + if (falign(tc) == 'L') + valore.left_just(length, ffiller(tc)); + else + valore.right_just(length, ffiller(tc)); } + break; + default: + valore = format_field(tc, rel.lfile().num(), valore);//formatta il campo secondo le specifiche del record + break; + } + + if (!vuoto && rel.exist(field.file())) + field.write(valore, rel);//faccio una write sulla relazione del fieldref + } + } + + int err = NOERR; + if (pre_writerel(rel,rec)) + { + err= rel.write(); + if (err == _isdupkey || err ==_isreinsert) + err = rel.rewrite(); + } + return err; +} + +///////////////////////////////////////////////////// +// Classe TCtbo2at: applicazione principale // +///////////////////////////////////////////////////// + +class TCtbo2at: public TSkeleton_application +{ + TMask* _msk; + TCtbo2at_file* _trasfile; + +protected: + virtual bool create(void); + virtual void main_loop(); + virtual bool destroy(void) ; + void transfer(void); + void inizializza_file(void); + static bool annulla_handler(TMask_field& f, KEY k); + bool test_donation(TRectype& recsog, const char* tipo, const TDate& datadon, const TString& luogodon); + bool test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter); + +public: + const TMask& msk() const { return *_msk; } + + TCtbo2at() {} + virtual ~TCtbo2at() {} +}; + +// restituisce un riferimento all' applicazione +inline TCtbo2at& app() { return (TCtbo2at&) main_app();} + // creazione dell'applicazione bool TCtbo2at::create() -{ +{ + open_files(LF_SOGGETTI, LF_DONAZ, LF_CONTSAN, LF_IDONEITA, 0); _msk = new TMask("at8800a"); - _rel = new TRelation(LF_SOGGETTI); - _cur = NULL; _msk->set(F_FILENAME,ATFILENAME); - _donaz = new TLocalisamfile(LF_DONAZ); - _donazioni = new TRecord_array(LF_DONAZ,DON_PROGDON); - - //_msk->set_handler(DLG_CANCEL, annulla_handler); _trasfile = NULL; return TSkeleton_application::create(); } @@ -86,14 +153,7 @@ bool TCtbo2at::create() // distruzione dell'applicazione bool TCtbo2at::destroy() { - delete _donazioni; - delete _donaz; - delete _cur; - delete _rel; delete _msk; - - if (_trasfile) - delete _trasfile; return TSkeleton_application::destroy(); } @@ -101,82 +161,144 @@ bool TCtbo2at::destroy() void TCtbo2at::main_loop() { // Preimposta gli eventuali valori specificati sulla riga di comando + //error_box("Attenzione: manca la configurazione del trasferimento!"); KEY key = K_ENTER; while (key != K_QUIT) { key = _msk->run(); if (key == K_ENTER) transfer(); + } +} + +bool TCtbo2at::test_donation(TRectype& recsog, const char* tipo, const TDate& datadon, const TString& luogodon) +{ + //ricostruisce le donazioni del soggetto in esame + TRectype* key = new TRectype(LF_DONAZ); + key->put(DON_CODICE, recsog.get(SOG_CODICE)); + TRecord_array donazioni(LF_DONAZ,DON_PROGDON); + donazioni.read(key); + // verificare se ha fatto una donazione di tipo con data successiva all'ultima donazione + const int r=donazioni.last_row(); + if (r > 0) + { + const TRectype& lastdon = donazioni[r]; + if (lastdon.get_date(DON_DATADON) >= datadon) + return FALSE; } + + //aggiunge la nuova donazione + // compila i dati della donazione in esame + TRectype* rec = new TRectype(LF_DONAZ); + rec->put(DON_CODICE, recsog.get(SOG_CODICE)); + rec->put(DON_PROGDON,r+1); + rec->put(DON_DATADON, datadon); + rec->put(DON_TIPODON, tipo); + rec->put(DON_CODSEZ,recsog.get(SOG_CODSEZ)); + rec->put(DON_CODSOT,recsog.get(SOG_CODSOT)); + rec->put(DON_LUOGODON, luogodon); + + donazioni.insert_row(rec); + donazioni.write(TRUE); + calcola_donazioni_lib(recsog, &donazioni); // questo metodo sistema tutto!!! + return TRUE; +} + +bool TCtbo2at::test_inter(TRectype& recsog, const char* tipo, const TDate& datadon, int inter) +{ + TRectype* key_cont = new TRectype(LF_CONTSAN); + key_cont->put(CON_CODICE, recsog.get(SOG_CODICE)); + TRecord_array controlli(LF_CONTSAN,CON_PROGCON); + controlli.read(key_cont); + + TRectype* key = new TRectype(LF_IDONEITA); + key->put(IDO_CODICE, recsog.get(SOG_CODICE)); + TRecord_array idoneita(LF_IDONEITA,IDO_PROGIDO); + idoneita.read(key); + + const int r = idoneita.last_row(); //se trova una data idoneita >= di quella in esame, quest'ultima + if (r > 0) //viene ignorata + { + const TRectype& lastido = idoneita[r]; + if (lastido.get_date(IDO_DATAIDO) >= datadon) + return FALSE; + } + + TRectype* rec = new TRectype(LF_IDONEITA); + rec->put(IDO_CODICE, recsog.get(SOG_CODICE)); + rec->put(IDO_PROGIDO, r+1); + rec->put(IDO_DATAIDO, datadon); + rec->put(IDO_TIPOIDO, stricmp(tipo, "SI") != 0 ? "AF" : "SI"); // Il mondo è bello perchè c'é l'AVIS + rec->put(IDO_IDO_SOS, "ID"); + rec->put(IDO_INTERVALLO, inter); + idoneita.add_row(rec); + idoneita.write(); + + con_reord(recsog, &controlli, &idoneita); + + return TRUE; } // trasferimento dati da file CT su programma avis void TCtbo2at::transfer() { - inizializza_cur(); - TFilename ctboini = "ctbo2at.ini"; _trasfile = new TCtbo2at_file(_msk->get(F_FILENAME), ctboini); inizializza_file(); - long n_sog = _cur->items(); - if (n_sog > 0) - { - TProgind pi(n_sog,"Lettura dati da archivio CT...",FALSE,TRUE); - - TAssoc_array& tracciati = _trasfile->tracciati(); - //scandisco tutti i soggetti - for (*_cur = 0; _cur->pos() < n_sog; ++(*_cur)) - { - pi.addstatus(1L); - - TRectype* key = new TRectype(LF_DONAZ); - key->put(DON_CODICE,_cur->file().get(SOG_CODICE)); - _donazioni->read(key); - - THash_object* lavoro = tracciati.get_hashobj(); - //scandisco tutti i record di un effetto - for (int i = 0; lavoro != NULL; i++) + TRelation rel(LF_SOGGETTI); + TRectype& sogg = rel.curr(); + + TString8 str; // Stringa jolly di lavoro + TRecord_text curr; + while (_trasfile->read(curr) == NOERR) + { + str = curr.get(2); + sogg.put(SOG_CODICE, str); + if (rel.read() != NOERR) + sogg.zero(); + + _trasfile->autosave(rel, curr); + //const long codsog = atol(curr.get(2)); + const char* tipo[] = { "SI", "PL", "PI", "PP" }; + for (int i = 0; i < 4; i++) + { + bool update = FALSE; + TDate datadon(TODAY); + str = curr.get(23+i); + if (!str.blank()) { - record(*lavoro);//emetto il record - lavoro = tracciati.get_hashobj(); + datadon = TDate(str); + str = curr.get(32); + if (str == "UROM ") + str = "013"; else + if (str == "UROB ") + str = "O.BE"; else + if (str == "IMOLA ") + str = "70"; + update |= test_donation(sogg, tipo[i], datadon, str); } - } + str = curr.get(27+i); + if (!real::is_null(str)) + { + update |= test_inter(sogg, tipo[i], datadon, atoi(str)); + } + if (update) + rel.rewrite(); + } } _trasfile->close(); - delete _trasfile; - _trasfile = NULL; message_box("Operazione terminata"); } -//inizializza il cursore -void TCtbo2at::inizializza_cur() -{ - TProgind prg (1,"Preparazione archivio soggetti da trasferire\nPrego attendere...",FALSE, FALSE); - _cur = new TCursor(_rel); - _cur->freeze(); -} - //inizializza il file di testo su cui emettere i dati void TCtbo2at::inizializza_file() { - TFilename filect = _msk->get(F_FILENAME); + TFilename filect = _msk->get(F_FILENAME); //aggiungere lettura automatica nomi file _trasfile->open(filect,'r'); - //_trasfile->force_record_separator(TRUE); - } -//emetto un record -void TCtbo2at::record(THash_object& lavoro) -{ - TTracciato_record& oggetto = (TTracciato_record&)lavoro.obj(); - const TString& tipo = oggetto.type(); - TRecord_text rec(tipo); - //carico il record da emettere - _trasfile->autoload(rec, *_cur, &tipo); - _trasfile->write(rec);//emetto i dati su file -} // handler per gestire la conferma dell'annullamento dei dati inseriti // nella maschera @@ -198,37 +320,13 @@ void TCtbo2at_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, T TString valore; if (code == "_TOTALE") { - int totale = 0; - TString16 tipodon(s.get()); - CHECK(tipodon[0]=='!',"Macro _TOTALE senza carattere '!'"); - tipodon.ltrim(1); - for (int r=1; r<=app().donazioni().rows(); r++) - { - const TRectype& riga = app().donazioni().row(r); - const TDate datadon = riga.get(DON_DATADON); - if ((riga.get(DON_TIPODON)==tipodon) && (app().data().year() == datadon.year())) - totale++; - } - valore.cut(0); - valore << totale; } else if (code == "_ULTIMA") { - valore.cut(0); - TString16 tipodon(s.get()); - CHECK(tipodon[0]=='!',"Macro _ULTIMA senza carattere '!'"); - tipodon.ltrim(1); - for (int r=1; r<=app().donazioni().rows(); r++) - { - const TRectype& riga = app().donazioni().row(r); - const TDate datadon = riga.get(DON_DATADON); - if ((riga.get(DON_TIPODON)==tipodon) && (app().data().year() == datadon.year())) - valore = riga.get(DON_DATADON); - } } else NFCHECK("Macro non definita: %s", (const char *)code); str = valore; -} +} int at8800(int argc, char* argv[]) { diff --git a/at/atlib1.cpp b/at/atlib1.cpp index 397b83c0d..b327be25a 100755 --- a/at/atlib1.cpp +++ b/at/atlib1.cpp @@ -86,14 +86,14 @@ void con_reord(TRectype& soggetto, TRecord_array* controlli, TRecord_array* idon if ((modstato == 'I') && (r_ultid == -1)) r_ultid = r; } - TString16 id1 = ' '; - TString16 id2 = ' '; - TString16 id3 = ' '; - TString16 id4 = ' '; + TString16 id1 = " "; + TString16 id2 = " "; + TString16 id3 = " "; + TString16 id4 = " "; int intsi = 0; int intaf = 0; - tipo = ' '; - prosstipo = ' '; + tipo = " "; + prosstipo = " "; data = TDate(NULLDATE); prossdata = TDate(NULLDATE); @@ -119,7 +119,7 @@ void con_reord(TRectype& soggetto, TRecord_array* controlli, TRecord_array* idon soggetto.put(SOG_INTSI,intsi); if (intaf > 0) soggetto.put(SOG_INTAF,intaf); - tipo = ' '; + tipo = " "; if (r_ultstato != -1) { const TRectype& row = controlli->row(r_ultstato); @@ -407,7 +407,7 @@ void don_datepross(TRectype& soggetto) void calcola_donazioni_lib(TRectype& soggetto, TRecord_array* donazioni) { TDate ultdata(NULLDATE); - TString16 ulttipo = ' '; + TString16 ulttipo = " "; const int i = donazioni->rows(); const int donprecsi = soggetto.get_int(SOG_DONPRECSI); const int donprecaf = soggetto.get_int(SOG_DONPRECAF); diff --git a/at/atrubrsa.frm b/at/atrubrsa.frm index 6494b95b5..a187e7bb3 100755 --- a/at/atrubrsa.frm +++ b/at/atrubrsa.frm @@ -19,57 +19,72 @@ SECTION HEADER ODD 3 STRINGA 1 6 BEGIN KEY "Cartella clinica" - PROMPT 1 2 "N.Car." + PROMPT 1 3 "N.Car." END STRINGA 2 2 BEGIN KEY "Categoria" - PROMPT 8 2 "C." + PROMPT 8 3 "C." END STRINGA 3 15 BEGIN KEY "Cognome e nome" - PROMPT 11 2 "Cognome e nome" + PROMPT 11 3 "Cognome e nome" END STRINGA 4 7 BEGIN KEY "Nato il" - PROMPT 63 2 "Nato il" + PROMPT 63 3 "Nato il" END STRINGA 5 9 BEGIN KEY "Gruppo AB0" - PROMPT 74 2 " AB0 " + PROMPT 74 3 " AB0 " END STRINGA 6 9 BEGIN KEY "Rh/AntiD" - PROMPT 84 2 " Rh " + PROMPT 84 3 " Rh " END STRINGA 7 9 BEGIN KEY "Kell" - PROMPT 94 2 " Kell " + PROMPT 94 3 " Kell " END STRINGA 8 9 BEGIN KEY "Du" - PROMPT 104 2 " Du " + PROMPT 104 3 " Du " END -STRINGA 9 11 +STRINGA 9 13 BEGIN KEY "Fenotipo" - PROMPT 114 2 " Fenotipo Rh " + PROMPT 114 3 " Fenotipo Rh " END +STRINGA 10 10 +BEGIN + KEY "Data" + PROMPT 1 2 "Data " + MESSAGE _TODAY +END + +NUMERO 11 7 +BEGIN + KEY "Nr. pagina" + //PROMPT 115 2 "Pag. " + //MESSAGE _PAGENO +END + + END // END SECTION HEADER SECTION BODY ODD 3