#include #include #include #include #include #include #include "soggetti.h" #include "benem.h" #include "donaz.h" #include "sezioni.h" #include #include "at2.h" #include "at2700a.h" #include "at4100b.h" #include "at4100c.h" #define ALIAS_CTD 700 // categoria donatori #define ALIAS_CTN1 701 // categoria non donatori 1 #define ALIAS_CTN2 702 // categoria non donatori 2 #define ALIAS_TCS 200 // tipi/esiti controlli sanitari #define ALIAS_LDN 400 // punti di prelievo #define ALIAS_LDNDON 401 // punti di prelievo #define ALIAS_LCPDOM 100 // localita' postale di domicilio #define ALIAS_COMDOM 501 // comune di domicilio #define ALIAS_COMNAS 500 // comune di nascita #define ALIAS_BNZ 600 // benemerenze #define ALIAS_GAZ 300 // gruppi aziendale #define ETI_INDIRIZZO 4 // numero campo indirizzo in etichetta (deve essere sempre cosi') enum ts { undefined=0, sintetico=1, completo=2, schede=3, etichette=4, cartoline=5, personale=6 }; // definizione form per etichette class TEti_percat_form : public TForm { public: virtual TCursor* cursor() const; virtual TRelation* relation() const; TPrint_section& get_body() { return section('B'); } ; TPrint_section& get_head() { return section('H'); } ; TPrint_section& get_foot() { return section('F'); } ; TEti_percat_form(): TForm() {}; TEti_percat_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") : TForm(form,code,editlevel,desc) {}; virtual ~TEti_percat_form() {}; }; class TStampaPerCategorie : public TPrintapp { static bool filter_func_percat(const TRelation* rel); TRelation* _rel; TMask* _msk; TLocalisamfile* _benem; TLocalisamfile* _donaz; TRecord_array* _sbenemerenze; TEti_percat_form* _form_eti; TEti_percat_form* _form_car; TEti_percat_form* _form_sch; TEti_percat_form* _form_per; TAssoc_array _catdon; TAssoc_array _catnondon; TParagraph_string _cognome_nome, _dencom, _benemerenza; TString80 _rigastampa; TDate _data_stampa; ts _tipostampa; TString16 _lettini, _lettfin, _capini, _capfin; TString16 _gruppoazie, _gruppoold; bool _pergruppo; int _contatore; TString16 _codsez, _codsot, _orario, _datacart; TString80 _invitoper, _data, _presso1, _presso2, _presso3, _presso4; TString80 _note, _intest1, _intest2, _intest3, _intest4; bool _usomodo, _usasez; int _etlarghezza, _etcolonne, _schxpag, _lenpage; bool _stampa80, _etictot; protected: virtual bool user_create(); virtual bool user_destroy(); virtual bool set_print(int m); virtual void set_page(int file, int cnt); virtual bool preprocess_page (int file, int counter); virtual print_action postprocess_print(int file, int counter); ts dati_cartolina(); public: void dati_sezione(const TString16 codsez, const TString16 codsot); void crea_intestazione(); void filtra_sezioni(); void header_gruppo(const TString16 gruppo); void footer_gruppo(); void header_sezione(const TString16 codsez, const TString16 codsot); void footer_sezione(); TMask& app_mask() { return *_msk; } TStampaPerCategorie() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",30), _benemerenza("",11) {} }; HIDDEN inline TStampaPerCategorie& app() { return (TStampaPerCategorie&) main_app(); } TCursor* TEti_percat_form::cursor() const { return app().current_cursor(); } TRelation* TEti_percat_form::relation() const { return cursor()->relation(); } void TStampaPerCategorie::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); _intest3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ3); _intest4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_INTESTAZ4); if (_usasez) { if (_presso1.blank()) { _presso1 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE1); _presso2 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE2); _presso3 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE3); _presso4 = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVSEDE4); } if (_orario.blank()) _orario = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVORA); if (_note.blank()) _note = current_cursor()->curr(LF_SEZIONI).get(SEZ_CONVNOTE); } return; } ts TStampaPerCategorie::dati_cartolina() { TMask msk("at4100b"); if (msk.run() == K_ENTER) { _invitoper = msk.get(F_INVITOPER); _data = msk.get(F_DATA); _presso1 = msk.get(F_PRESSO1); _presso2 = msk.get(F_PRESSO2); _presso3 = msk.get(F_PRESSO3); _presso4 = msk.get(F_PRESSO4); _datacart = msk.get(F_DATACART); _orario = msk.get(F_ORARIO); _note = msk.get(F_NOTE); _usasez = msk.get_bool(F_USASEZ); return cartoline; } else return undefined; } void TStampaPerCategorie::filtra_sezioni() { 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); TRectype da(LF_SOGGETTI); TRectype a(LF_SOGGETTI); if (sezini.not_empty()) da.put(SOG_CODSEZ, sezini); if (sotini.not_empty()) da.put(SOG_CODSOT, sotini); if (sezfin.not_empty()) a.put(SOG_CODSEZ, sezfin); if (sotfin.not_empty()) a.put(SOG_CODSOT, sotfin); current_cursor()->setregion(da, a); } void TStampaPerCategorie::footer_gruppo() { // stampa totale soggetti appartenenti al gruppo if (_tipostampa == etichette && _etictot) { TString80 totale = format("TOTALE %d", _contatore); TPrintrow riga; riga.put(totale); printer().print(riga); } else { 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(); } } print_action TStampaPerCategorie::postprocess_print(int file, int counter) { if (_contatore > 0) { if (_pergruppo) footer_gruppo(); else footer_sezione(); } if ((_tipostampa == schede) && (_schxpag > 1)) printer().formlen(_lenpage); return NEXT_PAGE; } void TStampaPerCategorie::footer_sezione() { // stampa totale soggetti appartenenti alla sezione if (_tipostampa == etichette && _etictot) { TString80 totale = format("TOTALE %d", _contatore); TPrintrow riga; riga.put(totale); printer().print(riga); } else { 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 TStampaPerCategorie::header_gruppo(const TString16 gruppo) { TString intestazione(132); intestazione = "GRUPPO AZIENDALE "; intestazione << gruppo; intestazione << " - "; intestazione << current_cursor()->curr(-ALIAS_GAZ).get("S0"); if (_stampa80) intestazione.center_just(80); else intestazione.center_just(132); set_header(1,"@0g%s", (const char*) intestazione); return; } void TStampaPerCategorie::set_page(int file, int cnt) { switch (_tipostampa) { case etichette: { TPrint_section& corpo = _form_eti->get_body(); for (int r=1;r<=_etcolonne;r++) { if (current_cursor()->pos()items()) { force_setpage(TRUE); corpo.update(); for (word i = 0; i < corpo.height(); i++) { TPrintrow& riga = corpo.row(i); TString256 riga1 = riga.row(); riga1.cut(_etlarghezza); int colonna = ((r-1)*_etlarghezza); TString16 formato; formato << '@' << colonna << 'g'; riga1.insert(formato,0); set_row(i+1,riga1); } if (r < _etcolonne) { ++(*current_cursor()); if (current_cursor()->pos()items()) preprocess_page(file, cnt); } } } } break; case personale: { TPrint_section& corpo = _form_per->get_body(); force_setpage(TRUE); corpo.update(); TString riga1; for (word i = 0; i < corpo.height(); i++) { TPrintrow& riga = corpo.row(i); riga1 = riga.row(); set_row(i+1,riga1); } //force_setpage(TRUE); //corpo.update_and_print(TRUE); } break; case schede: { TPrint_section& corpo = _form_sch->get_body(); corpo.update_and_print(printmode_normal, TRUE); force_setpage(TRUE); } break; case cartoline: { TPrint_section& corpo = _form_car->get_body(); const TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ); const TString16 codsot = current_cursor()->curr().get(SOG_CODSOT); if ((_codsez!=codsez)||(_codsot!=codsot)) { _codsez = codsez; _codsot = codsot; dati_sezione(codsez, codsot); corpo.reset(); TForm_item& intest1 = corpo.find_field(CAR_INTEST1); intest1.set(_intest1); TForm_item& intest2 = corpo.find_field(CAR_INTEST2); intest2.set(_intest2); TForm_item& intest3 = corpo.find_field(CAR_INTEST3); intest3.set(_intest3); TForm_item& intest4 = corpo.find_field(CAR_INTEST4); intest4.set(_intest4); TForm_item& invito = corpo.find_field(CAR_INVITOPER); invito.set(_invitoper); TForm_item& data = corpo.find_field(CAR_DATA); data.set(_data); TForm_item& presso1 = corpo.find_field(CAR_PRESSO1); presso1.set(_presso1); TForm_item& presso2 = corpo.find_field(CAR_PRESSO2); presso2.set(_presso2); TForm_item& presso3 = corpo.find_field(CAR_PRESSO3); presso3.set(_presso3); TForm_item& presso4 = corpo.find_field(CAR_PRESSO4); presso4.set(_presso4); TForm_item& orario = corpo.find_field(CAR_ORARIO); orario.set(_orario); TForm_item& datacart = corpo.find_field(CAR_DATACART); datacart.set(_datacart); TForm_item& note = corpo.find_field(CAR_NOTE); note.set(_note); } corpo.update(); for (word i = 0; i < corpo.height(); i++) { TPrintrow& riga = corpo.row(i); set_row(i+1,riga); } } break; case sintetico: { if (_stampa80) { set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS)); set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@9g#a", &_cognome_nome); set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(1,"@35g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR)); set_row(2,"@35g#a", &_dencom); set_row(1,"@67g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(2,"@67g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(3,"@67g@S", FLD(LF_SOGGETTI,SOG_TELALT)); set_row(4,""); } else { set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@12g#a", &_cognome_nome); set_row(1,"@38g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(1,"@49g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR)); set_row(1,"@100g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(1,"@116g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS)); set_row(2,"@49g#a", &_dencom); set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT)); set_row(3,""); } } break; case completo: { if (_stampa80) { set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS)); set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@9g@S",FLD(LF_SOGGETTI,SOG_COGNOME)); set_row(2,"@9g@S",FLD(LF_SOGGETTI,SOG_NOME)); set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(4,"@9g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR)); set_row(5,"@9g#a", &_dencom); set_row(1,"@40g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(2,"@40g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(3,"@40g@S", FLD(LF_SOGGETTI,SOG_TELALT)); set_row(4,"@40g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAZIE)); set_row(5,"@40g@S", FLD(LF_SOGGETTI,SOG_PROFESS)); set_row(1,"@56gGr @S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0)); set_row(2,"@56gRh @S", FLD(LF_SOGGETTI,SOG_RHANTID)); set_row(3,"@56gFe @S", FLD(LF_SOGGETTI,SOG_FENOTIPORH)); set_row(4,"@56gKe @S", FLD(LF_SOGGETTI,SOG_KELL)); set_row(5,"@56gDu @S", FLD(LF_SOGGETTI,SOG_DU)); set_row(1,"@66g@S", FLD(LF_SOGGETTI,SOG_DATAULTDON)); set_row(2,"@70g@n", FLD(LF_SOGGETTI,SOG_TOTDON)); set_row(3,"@66g@S", FLD(LF_SOGGETTI,SOG_DATAISC)); set_row(4,"@66g#a", &_benemerenza); set_row(1,"@77g@S", FLD(LF_SOGGETTI,SOG_STATO)); set_row(2,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON1)); set_row(3,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON2)); set_row(4,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON3)); set_row(5,"@77g@S", FLD(LF_SOGGETTI,SOG_IDON4)); set_row(6,""); } else { set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########")); set_row(2,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_TESSAVIS)); set_row(3,"@0g@8,rs", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@9g@S",FLD(LF_SOGGETTI,SOG_COGNOME)); set_row(2,"@9g@S",FLD(LF_SOGGETTI,SOG_NOME)); set_row(3,"@9g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(4,"@9g@S", FLD(-ALIAS_COMNAS,COM_DENCOM)); set_row(1,"@35g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR)); set_row(2,"@35g#a", &_dencom); set_row(1,"@66g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(2,"@66g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(3,"@66g@S", FLD(LF_SOGGETTI,SOG_TELALT)); set_row(4,"@66g@S", FLD(LF_SOGGETTI,SOG_GRUPPOAZIE)); set_row(5,"@66g@S", FLD(LF_SOGGETTI,SOG_PROFESS)); set_row(1,"@82gGr @S", FLD(LF_SOGGETTI,SOG_GRUPPOAB0)); set_row(2,"@82gRh @S", FLD(LF_SOGGETTI,SOG_RHANTID)); set_row(3,"@82gFe @S", FLD(LF_SOGGETTI,SOG_FENOTIPORH)); set_row(4,"@82gKe @S", FLD(LF_SOGGETTI,SOG_KELL)); set_row(5,"@82gDu @S", FLD(LF_SOGGETTI,SOG_DU)); set_row(1,"@94g@S", FLD(LF_SOGGETTI,SOG_STATO)); set_row(2,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON1)); set_row(3,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON2)); set_row(4,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON3)); set_row(5,"@94g@S", FLD(LF_SOGGETTI,SOG_IDON4)); set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_DATAULTDON)); set_row(2,"@100g@n", FLD(LF_SOGGETTI,SOG_TOTDON)); set_row(3,"@98g@S", FLD(LF_SOGGETTI,SOG_DATAISC)); set_row(4,"@98g#a", &_benemerenza); set_row(6,""); } } break; } } bool TStampaPerCategorie::filter_func_percat(const TRelation* rel) { bool filtrato = FALSE; TLocalisamfile& sog = rel->lfile(); // filtro per categorie donatori TAssoc_array& categorie = app()._catdon; if (categorie.items() != 0) { const TString16 cat = sog.get(SOG_CATDON); filtrato = categorie.is_key((const char*) cat); } if (!filtrato) { // filtro per categorie non donatori TAssoc_array& categorie = app()._catnondon; if (categorie.items() != 0) { const TString16 cat1 = sog.get(SOG_CATNOND1); const TString16 cat2 = sog.get(SOG_CATNOND2); filtrato = (categorie.is_key((const char*) cat1) || categorie.is_key((const char*) cat2)) ; } } // se non ho selezionato categorie il soggetto va filtrato comunque if (app()._catdon.items() == 0 && app()._catnondon.items() == 0) filtrato = TRUE; // filtro per iniziale cognome if (filtrato && (!app()._lettini.blank()) && (!app()._lettfin.blank())) { TString80 cognome = sog.get(SOG_COGNOME); int leni = app()._lettini.len(); TString16 cognomei = cognome.left(leni); int lenf = app()._lettfin.len(); TString16 cognomef = cognome.left(lenf); if (!(cognomei >= app()._lettini && cognomef <= app()._lettfin)) filtrato = FALSE; } return filtrato; } void TStampaPerCategorie::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(132); intestazione = "Sezione: "; intestazione << codsez; intestazione << '/'; intestazione << codsot; intestazione << ' '; intestazione << densez; if ((densot.ok())&& (densot.not_empty())) { intestazione << '/'; intestazione << densot; } if (_stampa80) intestazione.center_just(80); else intestazione.center_just(132); set_header(1,"@0g%s", (const char*) intestazione); return; } bool TStampaPerCategorie::preprocess_page(int file, int counter) { TRectype& recsog = current_cursor()->curr(); if (_tipostampa==sintetico||_tipostampa==completo) { TString80 nome = recsog.get(SOG_COGNOME); nome << ' '; nome << recsog.get(SOG_NOME); _cognome_nome = nome; TString256 localita = ""; localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S6"); if (localita.not_empty() && localita.ok()) { localita << ' '; localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0"); localita << " - "; } else { localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM); localita << ' '; } localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM); localita << ' ' << current_cursor()->curr(LF_COMUNI).get(COM_PROVCOM); localita.trim(); _dencom = localita; // cerco ultima benemerenza TString80 benemerenza = ""; const long codice = recsog.get_long(SOG_CODICE); //TRectype* key = new TRectype(LF_BENEM); TRectype key = TRectype(LF_BENEM); //key->put(BEN_CODICE,codice); key.put(BEN_CODICE,codice); const int err = _sbenemerenze->read(key); if (err == NOERR) { const int ultima = _sbenemerenze->rows(); if (ultima != 0) { TString16 codben = _sbenemerenze->row(ultima).get(BEN_TIPOBEN); TTable bnz("BNZ"); bnz.put("CODTAB",codben); if (bnz.read() == NOERR) benemerenza << bnz.get("S0"); } } benemerenza.cut(21); _benemerenza = benemerenza; } // salto pagina se cambio sezione o gruppo aziendale if (_tipostampa==sintetico || _tipostampa==completo || _tipostampa==personale) { if (_pergruppo) { TString16 grupponew = current_cursor()->curr(LF_SOGGETTI).get(SOG_GRUPPOAZIE); if (grupponew != _gruppoold ) { if (_gruppoold != "**") footer_gruppo(); _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==sintetico) && ((_stampa80 && printer().rows_left()<4) || (printer().rows_left()<3))) || (printer().rows_left()<6 && _tipostampa==completo)) printer().formfeed(); } } if (_tipostampa==etichette) if (printer().rows_left() < _form_eti->get_body().height()) printer().formfeed(); _contatore++; return TRUE; } bool TStampaPerCategorie::set_print(int m) { _tipostampa = undefined; KEY tasto; tasto = _msk->run(); switch (tasto) { case F_SINTETICO: _tipostampa=sintetico; break; case F_COMPLETO: _tipostampa=completo; break; case F_PERSONALE: _tipostampa=personale; break; case F_SCHEDE: _tipostampa=schede; if (_schxpag > 1) printer().formlen(_lenpage/_schxpag); break; case F_ETICHETTE: _tipostampa=etichette; break; case F_CARTOLINE: _tipostampa=cartoline; break; } if (_tipostampa != undefined) { if (_tipostampa == cartoline) dati_cartolina(); _codsez = "**"; _codsot = "**"; _gruppoold = "**"; _contatore = 0; TString80 chiave = ""; _pergruppo = _msk->get_bool(F_PERGRUPPO); bool percap = _msk->get_bool(F_PERCAP); _capini = _msk->get(F_CAPINI); _capfin = _msk->get(F_CAPFIN); _lettini = _msk->get(F_LETTINI); _lettini.left(15); _lettfin = _msk->get(F_LETTFIN); _lettfin.left(15); if (_pergruppo) { _gruppoazie = _msk->get(F_GRUPPOAZIE); if (_gruppoazie.empty()) chiave << "90->GRUPPOAZIE|"; } if (percap) chiave << "90->DOM_CAP|90->DOM_CODCOM|90->DOM_CODLOC|UPPER(90->COGNOME)|UPPER(90->NOME)"; else { if (_pergruppo) chiave << "UPPER(90->COGNOME)|UPPER(90->NOME)"; else chiave << "90->CODSEZ|90->CODSOT|UPPER(90->COGNOME)|UPPER(90->NOME)"; } TString256 filtro = ""; if (_gruppoazie.not_empty()) filtro.format("(90->GRUPPOAZIE == \"%s\")",(const char*)_gruppoazie); if (_capini.not_empty()) { if (filtro.not_empty()) filtro << " && "; filtro << format("(90->DOM_CAP >= \"%s\")",(const char*)_capini); } if (_capfin.not_empty()) { if (filtro.not_empty()) filtro << " && "; filtro << format("(90->DOM_CAP <= \"%s\")",(const char*)_capfin); } bool notiziario = _msk->get_bool(F_NOTIZIARIO); if (notiziario) { if (filtro.not_empty()) filtro << " && "; filtro << "(90->NOTIZIARIO == \"X\")"; } 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); TRectype da(LF_SOGGETTI); TRectype a(LF_SOGGETTI); if (sezini.not_empty()) da.put(SOG_CODSEZ, sezini); if (sotini.not_empty()) da.put(SOG_CODSOT, sotini); if (sezfin.not_empty()) a.put(SOG_CODSEZ, sezfin); if (sotfin.not_empty()) a.put(SOG_CODSOT, sotfin); current_cursor()->setregion(da, a); current_cursor()->setfilter(filtro, TRUE); ((TSorted_cursor*)current_cursor())->change_order(chiave); reset_files(); add_file(LF_SOGGETTI); _catdon.destroy(); const TString16 catpri = _msk->get(F_CAT1); const TString16 catsec = _msk->get(F_CAT2); const TString16 catter = _msk->get(F_CAT3); 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()) _catdon.add((const char*) catpri); if (catsec.not_empty() && catsec.ok()) _catdon.add((const char*) catsec); if (catter.not_empty() && catter.ok()) _catdon.add((const char*) catter); if (catqua.not_empty() && catqua.ok()) _catdon.add((const char*) catqua); if (catqui.not_empty() && catqui.ok()) _catdon.add((const char*) catqui); if (catses.not_empty() && catses.ok()) _catdon.add((const char*) catses); _catnondon.destroy(); const TString16 catnpri = _msk->get(F_CATN1); const TString16 catnsec = _msk->get(F_CATN2); const TString16 catnter = _msk->get(F_CATN3); const TString16 catnqua = _msk->get(F_CATN4); const TString16 catnqui = _msk->get(F_CATN5); const TString16 catnses = _msk->get(F_CATN6); if (catnpri.not_empty() && catnpri.ok()) _catnondon.add((const char*) catnpri); if (catnsec.not_empty() && catnsec.ok()) _catnondon.add((const char*) catnsec); if (catnter.not_empty() && catnter.ok()) _catnondon.add((const char*) catnter); if (catnqua.not_empty() && catnqua.ok()) _catnondon.add((const char*) catnqua); if (catnqui.not_empty() && catnqui.ok()) _catnondon.add((const char*) catnqui); if (catnses.not_empty() && catnses.ok()) _catnondon.add((const char*) catnses); current_cursor()->set_filterfunction (filter_func_percat); reset_print(); crea_intestazione(); return TRUE; } else return FALSE; } void TStampaPerCategorie::crea_intestazione() { reset_header(); TString sep(132); if (_tipostampa==sintetico) sep = "ELENCO SINTETICO PER CATEGORIE"; if (_tipostampa==completo) sep = "ELENCO COMPLETO PER CATEGORIE"; if (_tipostampa==sintetico || _tipostampa==completo) { printer().footerlen(3); if (_stampa80) sep.center_just(80); else sep.center_just(132); set_header(2, "@0g%s", (const char*) sep); TString16 data_stampa = _data_stampa.string(); set_header(2,"@0g%10s", (const char*) data_stampa); sep = ""; sep << "Pag. @#"; if (_stampa80) set_header(2, "@73g%s", (const char*) sep); else set_header(2, "@110g%s", (const char*) sep); sep = ""; sep.fill('-'); if (_stampa80) sep.cut(80); set_header(3, (const char *) sep); } if (_tipostampa==personale) { TPrint_section& testata = _form_per->get_head(); testata.update(); for (word i=0; iget_foot(); piede.update(); for (i=0; iadd(LF_DONAZ, "CODICE==CODICE", 1); _rel->add(LF_BENEM, "CODICE==CODICE", 1); _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); _rel->add("BNZ", "CODTAB==TIPOBEN", 1, LF_BENEM, ALIAS_BNZ); _rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD); _rel->add("CTN", "CODTAB==CATNOND1",1,0,ALIAS_CTN1); _rel->add("CTN", "CODTAB==CATNOND2",1,0,ALIAS_CTN2); _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); _rel->add("LDN", "CODTAB==PUNTORACC",1,0,ALIAS_LDN); _rel->add("LDN", "CODTAB==LUOGODON",1,LF_DONAZ, ALIAS_LDNDON); _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",1,0,ALIAS_COMDOM); _rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS); _rel->add(LF_MEDICI, "CODMED==CODMED"); _donaz = new TLocalisamfile(LF_DONAZ); _benem = new TLocalisamfile(LF_BENEM); _sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN); add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ|SOG_CODSOT","",3)); _msk = new TMask("at2700a"); TConfig config(CONFIG_STUDIO); TString16 etformato = config.get("EtFormato"); _etlarghezza = config.get_int("EtLarghezza"); _etcolonne = config.get_int("EtColonne"); _form_eti = new TEti_percat_form(etformato); _stampa80 = config.get_bool("Stampa80"); _etictot = config.get_bool("EticTot"); _form_car = new TEti_percat_form("ATCARTO1"); TString16 schformato = config.get("SchFormato"); _schxpag = config.get_int("SchXPag"); _form_sch = new TEti_percat_form(schformato); TString16 performato = config.get("ElencoFormato"); _form_per = new TEti_percat_form(performato); _lenpage = printer().formlen(); return TRUE; } bool TStampaPerCategorie::user_destroy() { delete _form_per; delete _form_sch; delete _form_car; delete _form_eti; delete _msk; delete _sbenemerenze; delete _benem; delete _donaz; delete _rel; return TRUE; } int at2700(int argc, char* argv[]) { TStampaPerCategorie a; a.run(argc, argv, "Soggetti per categorie"); return 0; }