diff --git a/at/at4800.cpp b/at/at4800.cpp deleted file mode 100755 index 508c088d7..000000000 --- a/at/at4800.cpp +++ /dev/null @@ -1,371 +0,0 @@ -#include -#include -#include -#include -#include - -#include "soggetti.h" -#include "donaz.h" -#include "benem.h" -#include "sezioni.h" -#include - -#include "at4.h" -#include "at4100b.h" -#include "at4100c.h" -#include "at4800a.h" -#include "at4500.h" -#include "atlib.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 - -enum ts { undefined=0, schede=1, etichette=2, cartoline=3, donazioni=4 }; - -// definizione form per tessere associative -class TPerCodice_form : public TForm -{ -public: - - virtual TCursor* cursor() const; - virtual TRelation* relation() const; - TPrint_section& get_body() { return section('B'); } ; - TPerCodice_form(): TForm() {}; - TPerCodice_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") - : TForm(form,code,editlevel,desc) {}; - virtual ~TPerCodice_form() {}; -}; - -class TStampePerCodice : public TPrintapp -{ - TRelation* _rel; - TLocalisamfile* _donaz; - TLocalisamfile* _benem; - TRecord_array* _sdonazioni; - TRecord_array* _sbenemerenze; - TMask* _msk; - TPerCodice_form* _form_sch; - TPerCodice_form* _form_car; - TPerCodice_form* _form_eti; - TPerCodice_form* _form_don; - ts _tipostampa; - int _cur; - TDate _data_stampa; - 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; - -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); - - TMask& app_mask() { return *_msk; } - TStampePerCodice() : _data_stampa(TODAY) {} -}; - -HIDDEN inline TStampePerCodice& app() { return (TStampePerCodice&) main_app(); } - -TCursor* TPerCodice_form::cursor() const { return app().current_cursor(); } - -TRelation* TPerCodice_form::relation() const { return cursor()->relation(); } - -HIDDEN bool printer_handler(TMask_field& f, KEY k) -{ - if (k == K_SPACE) - { - TMask& m = f.mask(); - if (!m.query_mode()) - { - TString16 config; - config << "CARTOLINE"; - - TPrinter& p = printer(); - p.set_printtype(normprinter); // Force configuration update - p.read_configuration(config); - if (p.set()) - f.message_box("Stampante configurata per stampa cartoline"); - } - } - return TRUE; -} - -void TStampePerCodice::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 TStampePerCodice::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 TStampePerCodice::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()); - } - } - } - break; - case schede: - { - TPrint_section& corpo = _form_sch->get_body(); - corpo.update_and_print(printmode_normal, TRUE); - force_setpage(TRUE); - } - break; - case donazioni: - { - TPrint_section& corpo = _form_don->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; - } -} - -print_action TStampePerCodice::postprocess_print(int file, int counter) -{ - if ((_tipostampa == schede) && (_schxpag > 1)) - printer().formlen(_lenpage); - return NEXT_PAGE; -} - -bool TStampePerCodice::preprocess_page(int file, int counter) -{ - if (_tipostampa==etichette) - if (printer().rows_left() < _form_eti->get_body().height()) - printer().formfeed(); - return TRUE; -} - -bool TStampePerCodice::set_print(int m) -{ - TPrinter& p = printer(); - p.read_configuration(); - _tipostampa = undefined; - KEY tasto; - tasto = _msk->run(); - switch (tasto) - { - case F_CARTOLINE: - _tipostampa=cartoline; - break; - case F_SCHEDE: - _tipostampa=schede; - if (_schxpag > 1) - printer().formlen(_lenpage/_schxpag); - break; - case F_ETICHETTE: - _tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined; - break; - case F_DONAZIONI: - _tipostampa=donazioni; - break; - } - if (_tipostampa != undefined) - { - if (_tipostampa == cartoline) - dati_cartolina(); - const long codini = _msk->get_long(F_CODINI); - const long codfin = _msk->get_long(F_CODFIN); - TRectype da(LF_SOGGETTI); - TRectype a(LF_SOGGETTI); - if (codini!=0) - da.put(SOG_CODICE, codini); - if (codfin!=0) - a.put(SOG_CODICE, codfin); - current_cursor()->setregion(da, a); - reset_files(); - add_file(LF_SOGGETTI); - reset_print(); - return TRUE; - } - else - return FALSE; -} - -bool TStampePerCodice::user_create() -{ - _rel = new TRelation(LF_SOGGETTI); - _rel->add(LF_DONAZ, "CODICE==CODICE", 1); - _rel->add("LDN", "CODTAB==LUOGODON",1,LF_DONAZ, ALIAS_LDNDON); - _rel->add(LF_BENEM, "CODICE==CODICE", 1); - _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("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM); - _rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM); - _rel->add(LF_COMUNI, "COM==COMNASC",1,0,ALIAS_COMNAS); - _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); - _rel->add(LF_MEDICI, "CODMED==CODMED"); - _donaz = new TLocalisamfile(LF_DONAZ); - _benem = new TLocalisamfile(LF_BENEM); - _sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON); - _sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN); - - _cur = add_cursor(new TCursor(_rel, "", 1)); - _msk = new TMask("at4800a"); - //Modificato il form per le cartoline in ATCARTO2 da ATCARTO1 da Marco il 14/09/99 - _form_car = new TPerCodice_form("ATCARTO2"); - _form_don = new TPerCodice_form("ATDDONAZ"); - TConfig config(CONFIG_STUDIO); - TString16 etformato = config.get("EtFormato"); - _etlarghezza = config.get_int("EtLarghezza"); - _etcolonne = config.get_int("EtColonne"); - _form_eti = new TPerCodice_form(etformato); - TString16 schformato = config.get("SchFormato"); - _schxpag = config.get_int("SchXPag"); - _form_sch = new TPerCodice_form(schformato); - _lenpage = printer().formlen(); - return TRUE; -} - -bool TStampePerCodice::user_destroy() -{ - delete _form_sch; - delete _form_eti; - delete _form_don; - delete _form_car; - delete _msk; - delete _sbenemerenze; - delete _sdonazioni; - delete _benem; - delete _donaz; - delete _rel; - return TRUE; -} - -int at4800(int argc, char* argv[]) -{ - TStampePerCodice a; - a.run(argc, argv, "Stampe per codice"); - return 0; -} diff --git a/at/at4800a.h b/at/at4800a.h deleted file mode 100755 index 11ea2abf0..000000000 --- a/at/at4800a.h +++ /dev/null @@ -1,10 +0,0 @@ -// stampa etichette/cartoline/scehde/dettaglio donazioni per codice -// definizione campi per maschera di selezione - - -#define F_CODINI 101 // da codice -#define F_CODFIN 102 // a codice -#define F_CARTOLINE 401 -#define F_ETICHETTE 402 -#define F_SCHEDE 403 -#define F_DONAZIONI 404 diff --git a/at/at4800a.uml b/at/at4800a.uml deleted file mode 100755 index 3cce9c81a..000000000 --- a/at/at4800a.uml +++ /dev/null @@ -1,56 +0,0 @@ -#include "at4800a.h" - -TOOLBAR "" 0 20 0 2 - -BUTTON F_CARTOLINE 9 2 -BEGIN - PROMPT -15 -11 "Cartoline" - MESSAGE EXIT,F_CARTOLINE -END - -BUTTON F_ETICHETTE 9 2 -BEGIN - PROMPT -25 -11 "Etichette" - MESSAGE EXIT,F_ETICHETTE -END - -BUTTON F_SCHEDE 9 2 -BEGIN - PROMPT -35 -11 "Schede" - MESSAGE EXIT,F_SCHEDE -END - -BUTTON F_DONAZIONI 9 2 -BEGIN - PROMPT -45 -11 "Donazioni" - MESSAGE EXIT,F_DONAZIONI -END - -BUTTON DLG_QUIT 9 2 -BEGIN - PROMPT -55 -11 "" -END - -ENDPAGE - -PAGE "Stampe per codice" -1 -1 78 20 - -GROUPBOX DLG_NULL 77 4 -BEGIN - PROMPT 1 1 "Selezione intervallo codici" -END - -NUMBER F_CODINI 9 -BEGIN - PROMPT 2 2 "Codice iniziale " - HELP "Codice soggetto da cui iniziare la stampa: vuoto = inizio" -END - -NUMBER F_CODFIN 9 -BEGIN - PROMPT 2 3 "Codice finale " - HELP "Codice soggetto finale per la stampa: vuoto = fine" -END - -ENDPAGE -ENDMASK