From d4aa612144473294e3bddab73f0801b08c8e451e Mon Sep 17 00:00:00 2001 From: cris Date: Fri, 7 Aug 1998 10:02:53 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Corretto ordine nella destroy(); possibilita' di selezionare se stampare un foglio per ogni sezione git-svn-id: svn://10.65.10.50/trunk@6927 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- at/at4400.cpp | 158 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 62 deletions(-) diff --git a/at/at4400.cpp b/at/at4400.cpp index 359ee8f9f..0ca117601 100755 --- a/at/at4400.cpp +++ b/at/at4400.cpp @@ -33,7 +33,7 @@ public: virtual ~TStConvoc_form() {}; }; -class TConvocazioniPerSezione : public TPrintapp +class TConvocazioniPerPunto : public TPrintapp { TRelation* _rel; TMask* _msk; @@ -43,7 +43,7 @@ class TConvocazioniPerSezione : public TPrintapp TParagraph_string _cognome_nome; TDate _data_stampa; TDate _dataini, _datafin; - bool _aggiorna; + bool _aggiorna, _persezione; TString16 _punto,_tipo, _sezione, _sottog, _ordina; TString16 _codsez, _codsot; TString16 _orario, _datacart; @@ -51,7 +51,7 @@ class TConvocazioniPerSezione : public TPrintapp TString80 _note, _intest1, _intest2, _intest3, _intest4; bool _usasez; ts _tipostampa; - int _contxsez; + int _contxsez, _contatore; int _etlarghezza, _etcolonne; //static bool filter_func_stconvoc(const TRelation* rel); @@ -69,18 +69,19 @@ public: void crea_intestazione(); void header_sezione(const TString16 codsez, const TString16 codsot); void footer_sezione(); + void fine_stampa(); void dati_sezione(const TString16 codsez, const TString16 codsot); TMask& app_mask() { return *_msk; } - TConvocazioniPerSezione() : _data_stampa(TODAY), _cognome_nome("",35) {} + TConvocazioniPerPunto() : _data_stampa(TODAY), _cognome_nome("",35) {} }; -HIDDEN inline TConvocazioniPerSezione& app() { return (TConvocazioniPerSezione&) main_app(); } +HIDDEN inline TConvocazioniPerPunto& app() { return (TConvocazioniPerPunto&) main_app(); } TCursor* TStConvoc_form::cursor() const { return app().current_cursor(); } TRelation* TStConvoc_form::relation() const { return cursor()->relation(); } -ts TConvocazioniPerSezione::dati_cartoline() +ts TConvocazioniPerPunto::dati_cartoline() { TMask msk("at4100b"); if (msk.run() == K_ENTER) @@ -101,7 +102,21 @@ ts TConvocazioniPerSezione::dati_cartoline() return undefined; } -void TConvocazioniPerSezione::set_page(int file, int cnt) +void TConvocazioniPerPunto::fine_stampa() +{ + // stampa totale soggetti a fine stampa + + reset_footer(); + printer().footerlen(20); + TString sep(80); + sep.fill('-'); + set_footer(1, (const char *) sep); + set_footer(2,"TOTALE SOGGETTI CONVOCATI %d", _contatore); + printer().formfeed(); + reset_footer(); +} + +void TConvocazioniPerPunto::set_page(int file, int cnt) { // costruzione etichette switch (_tipostampa) @@ -185,25 +200,34 @@ void TConvocazioniPerSezione::set_page(int file, int cnt) set_row(1,"@0g#a", &_cognome_nome); set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@40g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS)); - set_row(1,"@48g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON)); - set_row(1,"@59g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON)); - set_row(1,"@62g@ld", FLD(LF_RCONVOC,RCV_DATACONV)); - set_row(1,"@73g@S", FLD(LF_RCONVOC,RCV_CHIAMATA)); - set_row(1,"@75g@S", FLD(LF_CONVOC,COV_DATA)); + set_row(1,"@48g@S", FLD(LF_SOGGETTI,SOG_CODSEZ)); + set_row(1,"@51g@S", FLD(LF_SOGGETTI,SOG_CODSOT)); + set_row(1,"@54g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON)); + set_row(1,"@65g@S", FLD(LF_SOGGETTI,SOG_TIPOULTDON)); + set_row(1,"@68g@ld", FLD(LF_RCONVOC,RCV_DATACONV)); + set_row(1,"@79g@S", FLD(LF_RCONVOC,RCV_CHIAMATA)); + set_row(1,"@84g@S", FLD(LF_CONVOC,COV_DATA)); } break; } } -print_action TConvocazioniPerSezione::postprocess_print(int file, int counter) +print_action TConvocazioniPerPunto::postprocess_print(int file, int counter) { if (_contxsez > 0) footer_sezione(); + if ((_contatore > 0) && ((_contatore != _contxsez) || (!_persezione))) + fine_stampa(); return NEXT_PAGE; } -bool TConvocazioniPerSezione::preprocess_page(int file, int counter) +bool TConvocazioniPerPunto::preprocess_page(int file, int counter) { + if (_aggiorna) + { + current_cursor()->curr().put(RCV_STAMPATO,"X"); + current_cursor()->file().rewrite(); + } if (_tipostampa==elenco) { TString80 nome = current_cursor()->curr(LF_SOGGETTI).get(SOG_COGNOME); @@ -224,6 +248,7 @@ bool TConvocazioniPerSezione::preprocess_page(int file, int counter) header_sezione(codsez, codsot); } _contxsez++; + _contatore++; } if (_tipostampa==etichette) if (printer().rows_left() < _form_eti->get_body().height()) @@ -231,48 +256,49 @@ bool TConvocazioniPerSezione::preprocess_page(int file, int counter) return TRUE; } -void TConvocazioniPerSezione::footer_sezione() -{ - // stampa totale sezione - reset_footer(); - TString sep(80); - sep.fill('-'); - set_footer(2, (const char *) sep); - set_footer(3,"TOTALE CONVOCATI SEZIONE %d", _contxsez); - printer().formfeed(); - reset_footer(); +void TConvocazioniPerPunto::footer_sezione() +{ + if (_persezione) + { + // stampa totale sezione + reset_footer(); + TString sep(80); + sep.fill('-'); + set_footer(2, (const char *) sep); + set_footer(3,"TOTALE CONVOCATI SEZIONE %d", _contxsez); + printer().formfeed(); + reset_footer(); + } } -void TConvocazioniPerSezione::header_sezione(const TString16 codsez, const TString16 codsot) +void TConvocazioniPerPunto::header_sezione(const TString16 codsez, const TString16 codsot) { - const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); - const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); - TString intestazione(80); - intestazione = "Sezione: "; - intestazione << codsez; - if (codsot.not_empty()) + if (_persezione) { - intestazione << "/"; - intestazione << codsot; - } - intestazione << " "; - intestazione << densez; - if (densot.not_empty()) - { - intestazione << "/"; - intestazione << densot; - } - intestazione.center_just(); - set_header(1,"@0g%s", (const char*) intestazione); - TString16 data_stampa = _data_stampa.string(); - set_header(1,"@0g%10s", (const char*) data_stampa); - TString16 sep = ""; - sep << "Pag. @#"; - set_header(1, "@70g%s", (const char*) sep); + const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); + const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); + TString intestazione(80); + intestazione = "Sezione: "; + intestazione << codsez; + if (codsot.not_empty()) + { + intestazione << "/"; + intestazione << codsot; + } + intestazione << " "; + intestazione << densez; + if (densot.not_empty()) + { + intestazione << "/"; + intestazione << densot; + } + intestazione.center_just(); + set_header(1,"@0g%s", (const char*) intestazione); + } return; } -void TConvocazioniPerSezione::dati_sezione(const TString16 codsez, const TString16 codsot) +void TConvocazioniPerPunto::dati_sezione(const TString16 codsez, const TString16 codsot) { _intest1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ1); _intest2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ2); @@ -295,7 +321,7 @@ void TConvocazioniPerSezione::dati_sezione(const TString16 codsez, const TString return; } -bool TConvocazioniPerSezione::set_print(int m) +bool TConvocazioniPerPunto::set_print(int m) { _tipostampa = undefined; KEY tasto; @@ -321,6 +347,7 @@ bool TConvocazioniPerSezione::set_print(int m) _sezione = _msk->get(F_CODSEZ); _sottog = _msk->get(F_CODSOT); _aggiorna = _msk->get_bool(F_AGGIORNA); + _persezione = _msk->get_bool(F_PERSEZIONE); _ordina = _msk->get(F_ORDINA); TString256 chiave = ""; switch (_ordina[0]) @@ -373,6 +400,8 @@ bool TConvocazioniPerSezione::set_print(int m) //current_cursor()->set_filterfunction(filter_func_stconvoc); _codsez = "**"; _codsot = "**"; + _contxsez = 0; + _contatore = 0; reset_files(); add_file(LF_RCONVOC); reset_print(); @@ -383,7 +412,7 @@ bool TConvocazioniPerSezione::set_print(int m) return FALSE; } -void TConvocazioniPerSezione::crea_intestazione() +void TConvocazioniPerPunto::crea_intestazione() { reset_header(); if (_tipostampa == elenco) @@ -407,9 +436,11 @@ void TConvocazioniPerSezione::crea_intestazione() } sep.center_just(); set_header(2, "@0g%s", (const char*) sep); - char ora[16]; - _strtime(ora); - set_header(2,"@0g%8s", ora); + TString16 data_stampa = _data_stampa.string(); + set_header(2,"@0g%10s", (const char*) data_stampa); + sep = ""; + sep << "Pag. @#"; + set_header(2, "@80g%s", (const char*) sep); sep = ""; if (_punto.not_empty()) { @@ -423,13 +454,16 @@ void TConvocazioniPerSezione::crea_intestazione() } sep.center_just(); set_header(3, "@0g%s", (const char*) sep); - set_header(5,"@0gCognome e nome@36gCat.@40gTessera@48gUltima donaz.@62gData conv.@73gTipo"); - set_header(6,"@0g-----------------------------------@36g---@40g-------@48g---------- --@62g----------@73g----"); + char ora[16]; + _strtime(ora); + set_header(3,"@0g%8s", ora); + set_header(5,"@0gCognome e nome@36gCat.@40gTessera@48gSe/So@54gUltima donaz.@68gData cart.@79gTipo@84gData conv."); + set_header(6,"@0g-----------------------------------@36g---@40g-------@48g-- --@54g---------- --@68g----------@79g----@84g----------"); printer().footerlen(3); } } -bool TConvocazioniPerSezione::user_create() +bool TConvocazioniPerPunto::user_create() { _rel = new TRelation(LF_RCONVOC); _rel->add(LF_SOGGETTI, "CODICE==CODICE"); @@ -447,18 +481,18 @@ bool TConvocazioniPerSezione::user_create() return TRUE; } -bool TConvocazioniPerSezione::user_destroy() +bool TConvocazioniPerPunto::user_destroy() { + delete _form_car; + delete _form_eti; delete _msk; delete _rel; - delete _form_eti; - delete _form_car; return TRUE; } int at4400(int argc, char* argv[]) { - TConvocazioniPerSezione a; - a.run(argc, argv, "Elenco convocati"); + TConvocazioniPerPunto a; + a.run(argc, argv, "Stampa convocati su punto di prelievo"); return 0; }