From 070a402b891aec2dad2f092a513e0c2281f8fa75 Mon Sep 17 00:00:00 2001 From: cris Date: Tue, 10 Oct 2000 07:58:55 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Stampa Idonei: aggiunta possibilita' di selezionare: chi ha tutte le id., chi ha esclusivamente le id. indicate o chi ha almeno una delle id. indicate, messo totale parziale e finale git-svn-id: svn://10.65.10.50/trunk@9225 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at2500.cpp | 140 +++++++++++++++++++++++++++++++++++++++---------- at/at2500a.uml | 11 +++- 2 files changed, 121 insertions(+), 30 deletions(-) diff --git a/at/at2500.cpp b/at/at2500.cpp index 0045403b5..ad4a4f635 100755 --- a/at/at2500.cpp +++ b/at/at2500.cpp @@ -41,7 +41,7 @@ class TStampaIdonei : public TPrintapp TDate _data_stampa; ts _tipostampa; TString16 _codsez, _codsot; - int _etlarghezza, _etcolonne; + int _etlarghezza, _etcolonne, _stampa, _numidon, _contatore, _totale; static bool filter_func_idonei(const TRelation* rel); @@ -57,6 +57,8 @@ public: void crea_intestazione(); void filtra_sezioni(); void header_sezione(const TString16 codsez, const TString16 codsot); + void footer_sezione(); + void fine_stampa(); TMask& app_mask() { return *_msk; } TStampaIdonei() : _data_stampa(TODAY), _cognome_nome("",25) {} }; @@ -67,6 +69,39 @@ TCursor* TEti_idonei_form::cursor() const { return app().current_cursor(); } TRelation* TEti_idonei_form::relation() const { return cursor()->relation(); } +void TStampaIdonei::fine_stampa() +{ + // stampa totale soggetti a fine stampa + if (_tipostampa==elenco) + { + reset_footer(); + TString sep(80); + sep.fill('-'); + set_footer(2, (const char *) sep); + if (_totale > 0 && _totale != _contatore) + { + set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _totale); + printer().formfeed(); + } + reset_footer(); + } +} + +void TStampaIdonei::footer_sezione() +{ + // stampa totale soggetti appartenenti alla sezione + if (_tipostampa==elenco) + { + reset_footer(); + TString sep(80); + sep.fill('-'); + set_footer(2, (const char *) sep); + set_footer(3,"TOTALE SOGGETTI STAMPATI %d", _contatore); + printer().formfeed(); + reset_footer(); + } +} + void TStampaIdonei::filtra_sezioni() { const TString16 sezini = _msk->get(F_SEZINI); @@ -158,27 +193,43 @@ bool TStampaIdonei::filter_func_idonei(const TRelation * rel) { TAssoc_array idoneita; TString16 idonsog = sog.get(SOG_IDON1); - if (idonsog.not_empty() && idonsog.ok()) + if (idonsog.not_empty()) idoneita.add((const char*) idonsog); idonsog = sog.get(SOG_IDON2); - if (idonsog.not_empty() && idonsog.ok()) + if (idonsog.not_empty()) idoneita.add((const char*) idonsog); idonsog = sog.get(SOG_IDON3); - if (idonsog.not_empty() && idonsog.ok()) + if (idonsog.not_empty()) idoneita.add((const char*) idonsog); idonsog = sog.get(SOG_IDON4); - if (idonsog.not_empty() && idonsog.ok()) + if (idonsog.not_empty()) idoneita.add((const char*) idonsog); if (idoneita.items() != 0) - { - if (app()._idon1.not_empty() && app()._idon1.ok()) - filtrato = idoneita.is_key((const char*) app()._idon1); - if (app()._idon2.not_empty() && app()._idon2.ok()) - filtrato = filtrato && idoneita.is_key((const char*) app()._idon2); - if (app()._idon3.not_empty() && app()._idon3.ok()) - filtrato = filtrato && idoneita.is_key((const char*) app()._idon3); - if (app()._idon4.not_empty() && app()._idon4.ok()) - filtrato = filtrato && idoneita.is_key((const char*) app()._idon4); + { + if (app()._stampa < 2) + { + if (app()._idon1.not_empty()) + filtrato = idoneita.is_key((const char*) app()._idon1); + if (app()._idon2.not_empty()) + filtrato = filtrato && idoneita.is_key((const char*) app()._idon2); + if (app()._idon3.not_empty()) + filtrato = filtrato && idoneita.is_key((const char*) app()._idon3); + if (app()._idon4.not_empty()) + filtrato = filtrato && idoneita.is_key((const char*) app()._idon4); + if (app()._stampa == 1) + filtrato = (filtrato && (app()._numidon == idoneita.items())); + } + else + { + if (app()._idon1.not_empty()) + filtrato = idoneita.is_key((const char*) app()._idon1); + if (app()._idon2.not_empty()) + filtrato = filtrato || idoneita.is_key((const char*) app()._idon2); + if (app()._idon3.not_empty()) + filtrato = filtrato || idoneita.is_key((const char*) app()._idon3); + if (app()._idon4.not_empty()) + filtrato = filtrato || idoneita.is_key((const char*) app()._idon4); + } } else if (!(app()._idon1.empty() && app()._idon2.empty() && app()._idon3.empty() && app()._idon4.empty())) @@ -202,7 +253,8 @@ bool TStampaIdonei::preprocess_page(int file, int counter) if ((_codsez!=codsez)||(_codsot!=codsot)) { if (_codsez != "**") - printer().formfeed(); + footer_sezione(); + _contatore = 0; _codsez = codsez; _codsot = codsot; header_sezione(codsez, codsot); @@ -211,15 +263,20 @@ bool TStampaIdonei::preprocess_page(int file, int counter) if (_tipostampa==etichette) if (printer().rows_left() < _form_eti->get_body().height()) printer().formfeed(); + _contatore++; + _totale++; return TRUE; } print_action TStampaIdonei::postprocess_print(int file, int counter) { - printer().formfeed(); + if (_contatore > 0) + footer_sezione(); + fine_stampa(); return NEXT_PAGE; } + void TStampaIdonei::header_sezione(const TString16 codsez, const TString16 codsot) { const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); @@ -231,7 +288,7 @@ void TStampaIdonei::header_sezione(const TString16 codsez, const TString16 codso intestazione << codsot; intestazione << " "; intestazione << densez; - if ((densot.ok())&& (densot.not_empty())) + if (densot.not_empty()) { intestazione << "/"; intestazione << densot; @@ -255,6 +312,8 @@ bool TStampaIdonei::set_print(int m) _tipostampa = elenco; _codsez = "**"; _codsot = "**"; + _contatore = 0; + _totale = 0; } break; case F_ETICHETTE: @@ -269,7 +328,7 @@ bool TStampaIdonei::set_print(int m) filtra_sezioni(); // filtro per tipo idoneità _tipoidon = _msk->get(F_TIPO); - if (_tipoidon.not_empty() && _tipoidon.ok()) + if (_tipoidon.not_empty()) current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)_tipoidon)); else current_cursor()->setfilter("(TCS->S6 == \"I\") || (TCS->S6 == \"F\")", TRUE); @@ -281,23 +340,33 @@ bool TStampaIdonei::set_print(int m) const TString16 catqua = _msk->get(F_CAT4); const TString16 catqui = _msk->get(F_CAT5); const TString16 catses = _msk->get(F_CAT6); - if (catpri.not_empty() && catpri.ok()) + if (catpri.not_empty()) _categorie.add((const char*) catpri); - if (catsec.not_empty() && catsec.ok()) + if (catsec.not_empty()) _categorie.add((const char*) catsec); - if (catter.not_empty() && catter.ok()) + if (catter.not_empty()) _categorie.add((const char*) catter); - if (catqua.not_empty() && catqua.ok()) + if (catqua.not_empty()) _categorie.add((const char*) catqua); - if (catqui.not_empty() && catqui.ok()) + if (catqui.not_empty()) _categorie.add((const char*) catqui); - if (catses.not_empty() && catses.ok()) + if (catses.not_empty()) _categorie.add((const char*) catses); // filtro per idoneita _idon1 = _msk->get(F_IDON1); _idon2 = _msk->get(F_IDON2); _idon3 = _msk->get(F_IDON3); _idon4 = _msk->get(F_IDON4); + _stampa = _msk->get_int(F_STAMPA); + _numidon = 0; + if (_idon1.not_empty()) + _numidon++; + if (_idon2.not_empty()) + _numidon++; + if (_idon3.not_empty()) + _numidon++; + if (_idon4.not_empty()) + _numidon++; current_cursor()->set_filterfunction(filter_func_idonei); reset_print(); crea_intestazione(); @@ -314,7 +383,7 @@ void TStampaIdonei::crea_intestazione() { TString sep(80); sep = "ELENCO IDONEI"; - if ((_tipoidon.ok()) && (_tipoidon.not_empty())) + if (_tipoidon.not_empty()) { sep << ": tipo "; sep << _tipoidon; @@ -322,25 +391,37 @@ void TStampaIdonei::crea_intestazione() sep << " "; sep << dtipo; } - if ((_idon1.ok()) && (_idon1.not_empty())) + if (_idon1.not_empty()) { sep << " per "; sep << _idon1; } - if ((_idon2.ok()) && (_idon2.not_empty())) + if (_idon2.not_empty()) { sep << " "; sep << _idon2; } - if ((_idon3.ok()) && (_idon3.not_empty())) + if (_idon3.not_empty()) { sep << " "; sep << _idon3; } - if ((_idon4.ok()) && (_idon4.not_empty())) + if (_idon4.not_empty()) { sep << " "; sep << _idon4; + } + switch (_stampa) + { + case 0: + sep << " - Tutte queste idon."; + break; + case 1: + sep << " - Esclusivamente queste idon."; + break; + case 2: + sep << " - Almeno una idon."; + break; } sep.center_just(); set_header(2, "@0g%s", (const char*) sep); @@ -355,6 +436,7 @@ void TStampaIdonei::crea_intestazione() set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gData stato@60gIdon.@66g SI@70gUltima don."); set_header(5,"@0gTessera@38gGruppo Rh@49g Stato@66g AF"); set_header(6,"@0g--------@9g--@12g-------------------------@38g----------@49g----------@60g-- --@66g---@70g----------"); + printer().footerlen(3); } } diff --git a/at/at2500a.uml b/at/at2500a.uml index ebdafe88e..fda32ca6e 100755 --- a/at/at2500a.uml +++ b/at/at2500a.uml @@ -265,7 +265,7 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 77 5 +GROUPBOX DLG_NULL 77 6 BEGIN PROMPT 1 10 "Tipo/Esito e tipi idoneita'" END @@ -375,5 +375,14 @@ BEGIN PROMPT 52 13 "" FLAGS "D" END + +LISTBOX F_STAMPA 33 +BEGIN + PROMPT 2 14 "Stampa soggetti che hanno " + ITEM "0|Tutte le idon. indicate" + ITEM "1|Esclusivamente le idon. indicate" + ITEM "2|Almeno una delle idon. indicate" +END + ENDPAGE ENDMASK