diff --git a/at/at2100.cpp b/at/at2100.cpp index fc3a88f69..19df5ab41 100755 --- a/at/at2100.cpp +++ b/at/at2100.cpp @@ -14,6 +14,7 @@ #define ALIAS_LCPDOM 100 #define ALIAS_TCS 200 +#define ALIAS_GAZ 300 // gruppi aziendale enum ts { undefined=0, sintetico=1, completo=2, etichette=3, lettere=4 }; @@ -44,8 +45,9 @@ class TStampaSospesi : public TPrintapp TDate _dataini, _datafin, _sodataini, _sodatafin; ts _tipostampa; TString16 _codsez, _codsot, _motivo1, _motivo2, _motivo3, _motivo4, _motivo5, _tiposo, _prosstipo; + TString16 _gruppoazie, _gruppoold; int _etlarghezza, _etcolonne, _contatore, _totale; - bool _motivi; + bool _motivi, _pergruppo; static bool filter_func_sospesi(const TRelation* rel); @@ -61,6 +63,7 @@ public: void crea_intestazione(); void filtra_sezioni(); void header_sezione(const TString16 codsez, const TString16 codsot); + void header_gruppo(const TString16 gruppo); void footer_sezione(); void fine_stampa(); TMask& app_mask() { return *_msk; } @@ -266,17 +269,32 @@ bool TStampaSospesi::preprocess_page(int file, int counter) motivo = contsan.get(CON_MOTIVO); _motivo = motivo; // salto pagina se cambio sezione - const TString16 codsez = recsog.get(SOG_CODSEZ); - const TString16 codsot = recsog.get(SOG_CODSOT); - if ((_codsez!=codsez)||(_codsot!=codsot)) + if (_pergruppo) { - if (_codsez != "**") - footer_sezione(); - _contatore = 0; - _codsez = codsez; - _codsot = codsot; - header_sezione(codsez, codsot); + TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE); + if (grupponew != _gruppoold ) + { + if (_gruppoold != "**") + footer_sezione(); + _contatore = 0; + _gruppoold = grupponew; + header_gruppo(grupponew); + } } + else + { + const TString16 codsez = recsog.get(SOG_CODSEZ); + const TString16 codsot = recsog.get(SOG_CODSOT); + if ((_codsez!=codsez)||(_codsot!=codsot)) + { + if (_codsez != "**") + footer_sezione(); + _contatore = 0; + _codsez = codsez; + _codsot = codsot; + header_sezione(codsez, codsot); + } + } } if (_tipostampa==etichette) if (printer().rows_left() < _form_eti->get_body().height()) @@ -335,7 +353,22 @@ void TStampaSospesi::footer_sezione() reset_footer(); } } - + +void TStampaSospesi::header_gruppo(const TString16 gruppo) +{ + TString intestazione(132); + intestazione = "GRUPPO AZIENDALE "; + intestazione << gruppo; + intestazione << " - "; + intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0"); + if (_tipostampa==sintetico) + intestazione.center_just(100); + else + intestazione.center_just(); + set_header(1,"@0g%s", (const char*) intestazione); + return; +} + void TStampaSospesi::fine_stampa() { // stampa totale soggetti a fine stampa @@ -366,7 +399,7 @@ bool TStampaSospesi::set_print(int m) case F_SINTETICO: { _tipostampa = sintetico; - _codsez = _codsot = "**"; + _codsez = _codsot = _gruppoold = "**"; _contatore = 0; _totale = 0; } @@ -374,7 +407,7 @@ bool TStampaSospesi::set_print(int m) case F_COMPLETO: { _tipostampa = completo; - _codsez = _codsot = "**"; + _codsez = _codsot = _gruppoold = "**"; _contatore = 0; _totale = 0; } @@ -398,7 +431,18 @@ bool TStampaSospesi::set_print(int m) _motivo4 = _msk->get(F_MOTIVO4); _motivo5 = _msk->get(F_MOTIVO5); _motivi = (_motivo1.not_empty() || _motivo2.not_empty() || _motivo3.not_empty() || _motivo4.not_empty() || _motivo5.not_empty()); - TString filtro; + _pergruppo = _msk->get_bool(F_PERGRUPPO); + TString256 filtro = ""; + // filtro per gruppo aziendale + if (_pergruppo) + { + _gruppoazie = _msk->get(F_GRUPPOAZIE); + if (_gruppoazie.not_empty()) + filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie); + else + filtro.format("(90->GRUPPOAZIE != \"\")"); + filtro << " && "; + } // filtro per tipo sospensione _tiposo = _msk->get(F_TIPO); if (_tiposo.not_empty()) @@ -433,6 +477,12 @@ bool TStampaSospesi::set_print(int m) _datafin = _msk->get_date(F_DATAFIN); _sodataini = _msk->get_date(F_SODATAINI); _sodatafin = _msk->get_date(F_SODATAFIN); + TString80 chiave = ""; + if (_pergruppo && _gruppoazie.empty()) + { + chiave << "90->GRUPPOAZIE|UPPER(90->COGNOME)|UPPER(90->NOME)"; + ((TSorted_cursor*)current_cursor())->change_order(chiave); + } current_cursor()->set_filterfunction(filter_func_sospesi); reset_print(); printer().footerlen(0); @@ -516,10 +566,11 @@ bool TStampaSospesi::user_create() _rel = new TRelation(LF_SOGGETTI); _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); _rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM); + _rel->add("GAZ", "CODTAB==GRUPPOAZIE",1,0,ALIAS_GAZ); _rel->add(LF_COMUNI, "COM==DOM_CODCOM"); _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); _contsan = new TLocalisamfile(LF_CONTSAN); - add_cursor(new TCursor(_rel,"", 3)); + add_cursor(new TSorted_cursor(_rel,"90->CODSEZ|90->CODSOT|90->COGNOME|90->NOME","",3)); _msk = new TMask("at2100a"); TConfig config(CONFIG_STUDIO); TString16 etformato = config.get("EtFormato"); diff --git a/at/at2100a.h b/at/at2100a.h index 753dbd9eb..64eba3f54 100755 --- a/at/at2100a.h +++ b/at/at2100a.h @@ -42,7 +42,11 @@ #define F_MOTIVO5 317 #define F_D_MOTIVO5 318 -#define F_SINTETICO 401 -#define F_COMPLETO 402 -#define F_ETICHETTE 403 -#define F_LETTERE 404 +#define F_PERGRUPPO 401 +#define F_GRUPPOAZIE 402 +#define F_D_GRUPPOAZIE 403 + +#define F_SINTETICO 501 +#define F_COMPLETO 502 +#define F_ETICHETTE 503 +#define F_LETTERE 504 diff --git a/at/at2100a.uml b/at/at2100a.uml index c61209ce3..9fadba746 100755 --- a/at/at2100a.uml +++ b/at/at2100a.uml @@ -1,5 +1,5 @@ #include "at2100a.h" -TOOLBAR "" 0 20 0 2 +TOOLBAR "" 0 -2 0 2 BUTTON F_SINTETICO 9 2 BEGIN PROMPT -15 -11 "~Sintetico" @@ -30,7 +30,7 @@ BEGIN END ENDPAGE -PAGE "Stampa soggetti sospesi" -1 -1 78 20 +PAGE "Stampa soggetti sospesi" -1 -1 78 21 GROUPBOX DLG_NULL 77 4 BEGIN @@ -274,7 +274,7 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 77 11 +GROUPBOX DLG_NULL 77 12 BEGIN PROMPT 1 10 "Opzioni per la stampa" END @@ -446,5 +446,42 @@ BEGIN FLAGS "D" END +BOOLEAN F_PERGRUPPO +BEGIN + PROMPT 2 20 "Stampa per gruppo aziendale" + MESSAGE TRUE ENABLE,F_GRUPPOAZIE|ENABLE,F_D_GRUPPOAZIE + MESSAGE FALSE RESET,F_GRUPPOAZIE|RESET,F_D_GRUPPOAZIE|DISABLE,F_GRUPPOAZIE|DISABLE,F_D_GRUPPOAZIE +END + +STRING F_GRUPPOAZIE 4 +BEGIN + PROMPT 35 20 "" + FLAGS "U" + USE GAZ + INPUT CODTAB F_GRUPPOAZIE + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_GRUPPOAZIE CODTAB + OUTPUT F_D_GRUPPOAZIE S0 + CHECKTYPE NORMAL + WARNING "Codice gruppo aziendale non presente" + HELP "Gruppo aziendale di appartenenza" +END + +STRING F_D_GRUPPOAZIE 30 +BEGIN + PROMPT 43 20 "" + FLAGS "U" + USE GAZ KEY 2 + INPUT S0 F_D_GRUPPOAZIE + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@30" S0 + COPY OUTPUT F_GRUPPOAZIE + CHECKTYPE NORMAL + WARNING "Gruppo aziendale non presente" + HELP "Gruppo aziendale di appartenenza" +END + + ENDPAGE ENDMASK