Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Stampa tessere: configurazione stampante + nelle signole possibilita' di fare l'elenco git-svn-id: svn://10.65.10.50/trunk@7702 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
93a37ed93c
commit
cdb37cef28
@ -46,6 +46,9 @@ class TStampaTessere : public TPrintapp
|
||||
ts _tipostampa;
|
||||
TString16 _codsez, _codsot;
|
||||
int _contatore, _totfinestampa;
|
||||
bool _sttess2;
|
||||
int _numdon2;
|
||||
TString16 _catini2, _catfin2;
|
||||
|
||||
static bool filter_func_auto(const TRelation* rel);
|
||||
|
||||
@ -73,26 +76,6 @@ TCursor* TTessere_form::cursor() const { return app().current_cursor(); }
|
||||
|
||||
TRelation* TTessere_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 << "TESSERE";
|
||||
|
||||
TPrinter& p = printer();
|
||||
p.set_printtype(normprinter); // Force configuration update
|
||||
p.read_configuration(config);
|
||||
if (p.set())
|
||||
f.message_box("Stampante configurata per stampa tessere");
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TStampaTessere::header_sezione(const TString16 codsez, const TString16 codsot)
|
||||
{
|
||||
TPrintrow row;
|
||||
@ -119,9 +102,9 @@ void TStampaTessere::header_sezione(const TString16 codsez, const TString16 cods
|
||||
printer().print(row);
|
||||
row.reset();
|
||||
printer().print(row);
|
||||
row.put("@8gCognome@34gNome@60gData nasc.@71gTessera",1);
|
||||
row.put("@8gCognome@34gNome@60gData nasc.@71gTessera@78gUld.donaz.@89gTot.",1);
|
||||
printer().print(row);
|
||||
row.put("@8g-------------------------@34g-------------------------@60g----------@71g-------",1);
|
||||
row.put("@8g-------------------------@34g-------------------------@60g----------@71g-------@78g----------@89g----",1);
|
||||
printer().print(row);
|
||||
return;
|
||||
}
|
||||
@ -213,6 +196,8 @@ void TStampaTessere::set_page(int file, int cnt)
|
||||
set_row(1,"@34g@S", FLD(LF_SOGGETTI,SOG_NOME));
|
||||
set_row(1,"@60g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
|
||||
set_row(1,"@71g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
|
||||
set_row(1,"@78g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
|
||||
set_row(1,"@89g@pn", FLD(LF_SOGGETTI,SOG_TOTDON, "###"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -275,6 +260,10 @@ bool TStampaTessere::preprocess_page(int file, int counter)
|
||||
if (_aggiorna)
|
||||
{
|
||||
sogg.put(SOG_T_STAMPATA,TRUE);
|
||||
int totdon = sogg.get_int(SOG_TOTDON);
|
||||
TString16 catdon = sogg.get(SOG_CATDON);
|
||||
if ((totdon >= _numdon2) && (catdon == _catini2))
|
||||
sogg.put(SOG_CATDON, _catfin2);
|
||||
sogg.rewrite();
|
||||
}
|
||||
}
|
||||
@ -283,6 +272,8 @@ bool TStampaTessere::preprocess_page(int file, int counter)
|
||||
|
||||
bool TStampaTessere::set_print(int m)
|
||||
{
|
||||
TPrinter& p = printer();
|
||||
p.read_configuration();
|
||||
_tipostampa = undefined;
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
@ -292,7 +283,18 @@ bool TStampaTessere::set_print(int m)
|
||||
_tipostampa = elenco;
|
||||
break;
|
||||
case F_TESSERE:
|
||||
{
|
||||
_tipostampa = tessere;
|
||||
p.read_configuration("AT_TESSERE");
|
||||
p.set_printtype(winprinter);
|
||||
if (p.set())
|
||||
message_box("Stampante configurata per stampa tessere");
|
||||
else
|
||||
{
|
||||
_tipostampa = undefined;
|
||||
message_box("Operazione di stampa tessere annullata");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (_tipostampa != undefined)
|
||||
@ -346,11 +348,12 @@ bool TStampaTessere::user_create()
|
||||
//cursore ordinamento per sezione+sottogruppo+cognome+nome
|
||||
_cur = add_cursor(new TCursor(_rel, "", 3));
|
||||
_msk = new TMask("at4500a");
|
||||
_msk->set_handler(F_PRINTER, printer_handler);
|
||||
TConfig config(CONFIG_STUDIO);
|
||||
_numdon2 = config.get_int("NumDon2");
|
||||
_catini2 = config.get("CatIni2");
|
||||
_catfin2 = config.get("CatFin2");
|
||||
_sttess2 = config.get_bool("StTess2");
|
||||
_form_pag = new TTessere_form("ATTESSER");
|
||||
TString16 config;
|
||||
config << "TESSERE";
|
||||
printer().read_configuration(config);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -382,7 +385,6 @@ void TStampaTessere::crea_intestazione()
|
||||
|
||||
bool TStampaTessere::user_destroy()
|
||||
{
|
||||
printer().read_configuration();
|
||||
delete _form_pag;
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
|
@ -29,4 +29,3 @@
|
||||
|
||||
#define F_ELENCO 401
|
||||
#define F_TESSERE 402
|
||||
#define F_PRINTER 403
|
||||
|
@ -4,24 +4,19 @@ TOOLBAR "" 0 20 0 2
|
||||
|
||||
BUTTON F_ELENCO 9 2
|
||||
BEGIN
|
||||
PROMPT -14 -11 "~Elenco"
|
||||
PROMPT -13 -11 "~Elenco"
|
||||
MESSAGE EXIT,F_ELENCO
|
||||
END
|
||||
|
||||
BUTTON F_TESSERE 9 2
|
||||
BEGIN
|
||||
PROMPT -24 -11 "~Tessere"
|
||||
PROMPT -23 -11 "~Tessere"
|
||||
MESSAGE EXIT,F_TESSERE
|
||||
END
|
||||
|
||||
BUTTON F_PRINTER 19 2
|
||||
BEGIN
|
||||
PROMPT -34 -11 "Imposta stampante"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -44 -11 ""
|
||||
PROMPT -33 -11 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
219
at/at4600.cpp
219
at/at4600.cpp
@ -15,6 +15,8 @@
|
||||
#define ALIAS_COMDOM 501
|
||||
#define ALIAS_COMNAS 500
|
||||
#define ALIAS_LCP 100
|
||||
|
||||
enum ts { undefined = 0, elenco = 1, tessere = 2 };
|
||||
|
||||
// definizione form per tessere associative
|
||||
class TTessereS_form : public TForm
|
||||
@ -41,7 +43,9 @@ class TStampaTessereS : public TPrintapp
|
||||
bool _aggiorna;
|
||||
int _cur;
|
||||
TDate _data_stampa;
|
||||
ts _tipostampa;
|
||||
TString _riepilogodon;
|
||||
int _totfinestampa;
|
||||
|
||||
protected:
|
||||
virtual bool user_create();
|
||||
@ -49,6 +53,7 @@ protected:
|
||||
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);
|
||||
|
||||
static void add_rows_soggetti(TSheet_field& s, int count = 10, int start = 1);
|
||||
static bool soggetti_notify(TSheet_field& s, int r, KEY k);
|
||||
@ -56,7 +61,9 @@ protected:
|
||||
static bool codice_handler(TMask_field& f, KEY k);
|
||||
|
||||
public:
|
||||
void filtra_codici();
|
||||
void crea_intestazione();
|
||||
void filtra_codici();
|
||||
void fine_stampa();
|
||||
TMask& app_mask() { return *_msk; }
|
||||
TStampaTessereS() : _data_stampa(TODAY), _riepilogodon(35) {}
|
||||
};
|
||||
@ -67,26 +74,6 @@ TCursor* TTessereS_form::cursor() const { return app().current_cursor(); }
|
||||
|
||||
TRelation* TTessereS_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 << "TESSERE";
|
||||
|
||||
TPrinter& p = printer();
|
||||
p.set_printtype(normprinter); // Force configuration update
|
||||
p.read_configuration(config);
|
||||
if (p.set())
|
||||
f.message_box("Stampante configurata per stampa tessere");
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TStampaTessereS::add_rows_soggetti(TSheet_field& s, int count, int start)
|
||||
{
|
||||
if (start == 1)
|
||||
@ -116,6 +103,39 @@ void TStampaTessereS::filtra_codici()
|
||||
|
||||
void TStampaTessereS::set_page(int file, int cnt)
|
||||
{
|
||||
switch (_tipostampa)
|
||||
{
|
||||
case tessere:
|
||||
{
|
||||
TPrint_section& corpo = _form_pag->get_body();
|
||||
corpo.reset();
|
||||
TForm_item& rigadon = corpo.find_field(TES_RIGADON1);
|
||||
rigadon.set(_riepilogodon);
|
||||
corpo.update();
|
||||
for (word i = 0; i < corpo.height(); i++)
|
||||
{
|
||||
TPrintrow& riga = corpo.row(i);
|
||||
set_row(i+1,riga);
|
||||
}
|
||||
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
|
||||
// altrimenti stampa sempre la stessa etichetta
|
||||
}
|
||||
break;
|
||||
case elenco:
|
||||
{
|
||||
set_row(1,"@0g@S", FLD(LF_SOGGETTI,SOG_CODSEZ));
|
||||
set_row(1,"@2g@S", FLD(LF_SOGGETTI,SOG_CODSOT));
|
||||
set_row(1,"@5g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
|
||||
set_row(1,"@31g@S", FLD(LF_SOGGETTI,SOG_NOME));
|
||||
set_row(1,"@57g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
|
||||
set_row(1,"@68g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
|
||||
set_row(1,"@75g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
|
||||
set_row(1,"@86g@pn", FLD(LF_SOGGETTI,SOG_TOTDON, "###"));
|
||||
set_row(1,"@90g@S", FLD(LF_SOGGETTI,SOG_PUNTORACC));
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*
|
||||
TPrint_section& corpo = _form_pag->get_body();
|
||||
corpo.update();
|
||||
//TForm_item& rigadon = corpo.find_field(TES_RIGADON1);
|
||||
@ -127,42 +147,77 @@ void TStampaTessereS::set_page(int file, int cnt)
|
||||
}
|
||||
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
|
||||
// altrimenti stampa sempre la stessa etichetta
|
||||
*/
|
||||
}
|
||||
|
||||
bool TStampaTessereS::preprocess_page(int file, int counter)
|
||||
{
|
||||
TLocalisamfile& sogg = current_cursor()->file(LF_SOGGETTI);
|
||||
|
||||
const int totdon = sogg.get_int(SOG_TOTDON);
|
||||
const TDate dataultima = sogg.get(SOG_DATAULTDON);
|
||||
_riepilogodon = "";
|
||||
if (totdon != 0)
|
||||
{
|
||||
_riepilogodon = "Donazioni fino al ";
|
||||
_riepilogodon << dataultima.string();
|
||||
_riepilogodon << " n.";
|
||||
_riepilogodon << totdon;
|
||||
}
|
||||
if (_aggiorna)
|
||||
{
|
||||
if (_tipostampa == tessere)
|
||||
{
|
||||
sogg.put(SOG_T_STAMPATA,TRUE);
|
||||
sogg.rewrite();
|
||||
}
|
||||
current_cursor()->file().remove();
|
||||
TLocalisamfile& sogg = current_cursor()->file(LF_SOGGETTI);
|
||||
const int totdon = sogg.get_int(SOG_TOTDON);
|
||||
const TDate dataultima = sogg.get(SOG_DATAULTDON);
|
||||
_riepilogodon = "";
|
||||
if (totdon != 0)
|
||||
{
|
||||
_riepilogodon = "Donazioni fino al ";
|
||||
_riepilogodon << dataultima.string();
|
||||
_riepilogodon << " n.";
|
||||
_riepilogodon << totdon;
|
||||
}
|
||||
if (_aggiorna)
|
||||
{
|
||||
sogg.put(SOG_T_STAMPATA,TRUE);
|
||||
sogg.rewrite();
|
||||
}
|
||||
//current_cursor()->file().remove();
|
||||
}
|
||||
else
|
||||
_totfinestampa++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampaTessereS::set_print(int m)
|
||||
{
|
||||
{
|
||||
TPrinter& p = printer();
|
||||
p.read_configuration();
|
||||
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
|
||||
s.destroy();
|
||||
s.force_update();
|
||||
if (s.items()==0)
|
||||
add_rows_soggetti(s,50);
|
||||
_tipostampa = undefined;
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
switch (tasto)
|
||||
{
|
||||
case F_ELENCO:
|
||||
_tipostampa = elenco;
|
||||
break;
|
||||
case F_TESSERE:
|
||||
{
|
||||
_tipostampa = tessere;
|
||||
p.read_configuration("AT_TESSERE");
|
||||
p.set_printtype(winprinter);
|
||||
if (p.set())
|
||||
message_box("Stampante configurata per stampa tessere");
|
||||
else
|
||||
{
|
||||
_tipostampa = undefined;
|
||||
message_box("Operazione di stampa tessere annullata");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_AZZERA:
|
||||
{
|
||||
TSheet_field& s = (TSheet_field&)_msk->field(F_SOGGETTI);
|
||||
s.destroy();
|
||||
s.force_update();
|
||||
if (s.items()==0)
|
||||
add_rows_soggetti(s,50);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (tasto==F_AZZERA)
|
||||
return TRUE;
|
||||
if (_tipostampa != undefined)
|
||||
{
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
_asoggetti.destroy();
|
||||
@ -179,13 +234,74 @@ bool TStampaTessereS::set_print(int m)
|
||||
_aggiorna = _msk->get_bool(F_AGGIORNA);
|
||||
filtra_codici();
|
||||
}
|
||||
reset_print();
|
||||
_totfinestampa = 0;
|
||||
reset_print();
|
||||
printer().footerlen(0);
|
||||
crea_intestazione();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TStampaTessereS::crea_intestazione()
|
||||
{
|
||||
reset_header();
|
||||
if (_tipostampa == elenco)
|
||||
{
|
||||
TString sep(94);
|
||||
sep = "ELENCO TESSERE RICHIESTE";
|
||||
sep.center_just(94);
|
||||
set_header(1, "@0g%s", (const char*) sep);
|
||||
TString16 data_stampa = _data_stampa.string();
|
||||
set_header(1,"@0g%10s", (const char*) data_stampa);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
set_header(1, "@86g%s", (const char*) sep);
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header(2, (const char *) sep);
|
||||
set_header(3,"@0gSeSo@5gCognome@31gNome@57gData nasc.@68gTess.@75gUlt.don.@86gTot Punto");
|
||||
set_header(4,"@0g----@5g-------------------------@31g-------------------------@57g----------@68g------@75g----------@86g--- -----");
|
||||
printer().footerlen(3);
|
||||
set_row(1,"@0g@S", FLD(LF_SOGGETTI,SOG_CODSEZ));
|
||||
set_row(1,"@2g@S", FLD(LF_SOGGETTI,SOG_CODSOT));
|
||||
set_row(1,"@5g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
|
||||
set_row(1,"@31g@S", FLD(LF_SOGGETTI,SOG_NOME));
|
||||
set_row(1,"@57g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
|
||||
set_row(1,"@68g@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
|
||||
set_row(1,"@75g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
|
||||
set_row(1,"@86g@pn", FLD(LF_SOGGETTI,SOG_TOTDON, "###"));
|
||||
set_row(1,"@90g@S", FLD(LF_SOGGETTI,SOG_PUNTORACC));
|
||||
}
|
||||
}
|
||||
|
||||
void TStampaTessereS::fine_stampa()
|
||||
{
|
||||
// stampa totale soggetti a fine stampa
|
||||
TPrintrow row;
|
||||
TString rigastampa = "";
|
||||
rigastampa.fill('-',94);
|
||||
row.put((const char*) rigastampa);
|
||||
printer().print(row);
|
||||
row.reset();
|
||||
printer().print(row);
|
||||
rigastampa.format("TOTALE TESSERE RICHIESTE %d", _totfinestampa);
|
||||
row.put((const char*) rigastampa);
|
||||
printer().print(row);
|
||||
printer().formfeed();
|
||||
}
|
||||
|
||||
print_action TStampaTessereS::postprocess_print(int file, int counter)
|
||||
{
|
||||
if (_tipostampa == elenco)
|
||||
{
|
||||
if (_totfinestampa>0)
|
||||
fine_stampa();
|
||||
}
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
bool TStampaTessereS::user_create()
|
||||
{
|
||||
_sogtmp = new TIsamtempfile(LF_SOGGETTI,NULL,TRUE,TRUE);
|
||||
@ -197,17 +313,14 @@ bool TStampaTessereS::user_create()
|
||||
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
|
||||
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
|
||||
//cursore ordinamento per sezione+sottogruppo+cognome+nome
|
||||
_cur = add_cursor(new TCursor(_rel, "", 1));
|
||||
_cur = add_cursor(new TCursor(_rel, "", 3));
|
||||
_msk = new TMask("at4600a");
|
||||
_msk->set_handler(F_PRINTER, printer_handler);
|
||||
_form_pag = new TTessereS_form("ATTESSER");
|
||||
TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
|
||||
add_rows_soggetti(ss,50);
|
||||
ss.set_notify(soggetti_notify);
|
||||
ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
|
||||
ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
|
||||
TString16 config;
|
||||
config << "TESSERE";
|
||||
printer().read_configuration(config);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -321,7 +434,7 @@ bool TStampaTessereS::user_destroy()
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _sogtmp;
|
||||
printer().read_configuration();
|
||||
//printer().read_configuration();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,9 @@
|
||||
#define F_AGGIORNA 101
|
||||
#define F_SOGGETTI 102
|
||||
|
||||
#define F_PRINTER 401
|
||||
#define F_ELENCO 401
|
||||
#define F_TESSERE 402
|
||||
#define F_AZZERA 403
|
||||
|
||||
// pagina soggetti
|
||||
#define F_S_CODICE 101
|
||||
|
@ -2,20 +2,28 @@
|
||||
|
||||
TOOLBAR "" 0 20 0 2
|
||||
|
||||
BUTTON DLG_PRINT 9 2
|
||||
BUTTON F_ELENCO 9 2
|
||||
BEGIN
|
||||
PROMPT -13 -11 "~Stampa"
|
||||
MESSAGE EXIT,K_ENTER
|
||||
PROMPT -14 -11 "~Elenco"
|
||||
MESSAGE EXIT,F_ELENCO
|
||||
END
|
||||
|
||||
BUTTON F_PRINTER 19 2
|
||||
BUTTON F_TESSERE 9 2
|
||||
BEGIN
|
||||
PROMPT -23 -11 "Imposta stampante"
|
||||
PROMPT -24 -11 "~Tessere"
|
||||
MESSAGE EXIT,F_TESSERE
|
||||
END
|
||||
|
||||
BUTTON F_AZZERA 9 2
|
||||
BEGIN
|
||||
PROMPT -34 -11 "A~zzera"
|
||||
MESSAGE EXIT,F_AZZERA
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -33 -11 ""
|
||||
PROMPT -44 -11 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
Loading…
x
Reference in New Issue
Block a user