diff --git a/at/at1300.cpp b/at/at1300.cpp index b1fc32ac8..7cd663346 100755 --- a/at/at1300.cpp +++ b/at/at1300.cpp @@ -42,7 +42,7 @@ protected: public: void crea_intestazione(); - void header_ben(const TString16 tipoben); + void header_ben(const TString16 tipoben, const TString16 codsez, const TString16 codsot); void footer_ben(); TMask& app_mask() { return *_msk; } TStampaBenemerenze() : _cognome_nome("",35), _dencom("",50) {} @@ -109,14 +109,18 @@ bool TStampaBenemerenze::preprocess_page(int file, int counter) _dencom = localita; // salto pagina se cambio punto di rottura - TString16 tiponew = current_cursor()->curr().get(BEN_TIPOBEN); - if (tiponew != _tipoold ) + const TString16 tiponew = current_cursor()->curr().get(BEN_TIPOBEN); + const TString16 codsez = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ); + const TString16 codsot = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT); + if ((tiponew != _tipoold) || (_codsez!=codsez) || (_codsot!=codsot)) { if (_tipoold != "**") footer_ben(); _contatore = 0; _tipoold = tiponew; - header_ben(tiponew); + _codsez = codsez; + _codsot = codsot; + header_ben(tiponew, _codsez, _codsot); } else if (printer().rows_left() < 4) @@ -125,7 +129,7 @@ bool TStampaBenemerenze::preprocess_page(int file, int counter) return TRUE; } -void TStampaBenemerenze::header_ben(const TString16 tipoben) +void TStampaBenemerenze::header_ben(const TString16 tipoben, const TString16 codsez, const TString16 codsot) { TString intestazione(132); intestazione = "BENEMERENZA "; @@ -133,7 +137,22 @@ void TStampaBenemerenze::header_ben(const TString16 tipoben) intestazione << " "; intestazione << current_cursor()->curr(-ALIAS_BNZ).get("S0"); intestazione.center_just(132); - set_header(2,"@0g%s", (const char*) intestazione); + set_header(3,"@0g%s", (const char*) intestazione); + const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); + const TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); + intestazione = "Sezione: "; + intestazione << codsez; + intestazione << "/"; + intestazione << codsot; + intestazione << " "; + intestazione << densez; + if ((densot.ok())&& (densot.not_empty())) + { + intestazione << "/"; + intestazione << densot; + } + intestazione.center_just(); + set_header(1,"@0g%s", (const char*) intestazione); return; } @@ -143,6 +162,8 @@ bool TStampaBenemerenze::set_print(int m) tasto = _msk->run(); if (tasto == K_ENTER) { + _codsez = "**"; + _codsot = "**"; _dataini = _msk->get_date(F_DATAINI); _datafin = _msk->get_date(F_DATAFIN); TRectype da(LF_BENEM); @@ -151,7 +172,8 @@ bool TStampaBenemerenze::set_print(int m) da.put(BEN_DATABEN, _dataini); if (_datafin.ok()) a.put(BEN_DATABEN, _datafin); - TString80 chiave = "94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)"; + //TString80 chiave = "94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)"; + TString80 chiave = "90->CODSEZ|90->CODSOT|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)"; _cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a)); TString80 filtro = ""; // filtro per sezioni @@ -186,16 +208,16 @@ void TStampaBenemerenze::crea_intestazione() sep << " al "; sep << _datafin; sep.center_just(132); - set_header(1,"@0g%s", (const char*) sep); + set_header(2,"@0g%s", (const char*) sep); sep = "Pag. @#"; - set_header(1, "@110g%s", (const char*) sep); + set_header(2, "@110g%s", (const char*) sep); sep = ""; sep.fill('-'); - set_header(3, (const char *) sep); - set_header(4,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro"); - set_header(5,"@0gTessera@49gCAP/Località/Comune/Prov.@116gTelefono altro"); - set_header(6,"@110gTot.don."); - set_header(7,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------"); + set_header(4, (const char *) sep); + set_header(5,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro"); + set_header(6,"@0gTessera@49gCAP/Località/Comune/Prov.@116gTelefono altro"); + set_header(7,"@100gTot.don."); + set_header(8,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------"); printer().footerlen(3); } @@ -209,7 +231,7 @@ bool TStampaBenemerenze::user_create() _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); - + _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); _msk = new TMask("at1300a"); TConfig config(CONFIG_STUDIO); _stampa80 = config.get_bool("Stampa80");