Stampe per categorie: possibilita' di stampare l'elenco con formato

personalizzato
Patch level         :
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@6244 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1998-02-23 08:30:28 +00:00
parent c0de0aedf5
commit 70e1e78e25
3 changed files with 85 additions and 25 deletions

View File

@ -31,7 +31,7 @@
#define ALIAS_BNZ 600 // benemerenze
#define ALIAS_GAZ 300 // gruppi aziendale
enum ts { undefined=0, sintetico=1, completo=2, schede=3, etichette=4, cartoline=5 };
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
@ -41,6 +41,8 @@ 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) {};
@ -59,6 +61,7 @@ class TStampaPerCategorie : public TPrintapp
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;
@ -250,6 +253,22 @@ void TStampaPerCategorie::set_page(int file, int cnt)
}
}
break;
case personale:
{
TPrint_section& corpo = _form_per->get_body();
force_setpage(TRUE);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
TPrintrow& riga = corpo.row(i);
TString256 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();
@ -462,9 +481,9 @@ void TStampaPerCategorie::header_sezione(const TString16 codsez, const TString16
bool TStampaPerCategorie::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
if (_tipostampa==sintetico||_tipostampa==completo)
{
TRectype& recsog = current_cursor()->curr();
TString80 nome = recsog.get(SOG_COGNOME);
nome << " ";
nome << recsog.get(SOG_NOME);
@ -505,7 +524,10 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
}
benemerenza.cut(21);
_benemerenza = benemerenza;
// salto pagina se cambio sezione o gruppo aziendale
}
// 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);
@ -531,10 +553,10 @@ bool TStampaPerCategorie::preprocess_page(int file, int counter)
_codsot = codsot;
header_sezione(codsez, codsot);
}
}
if ((printer().rows_left()<2 && _tipostampa==sintetico) || (printer().rows_left()<6 && _tipostampa==completo))
printer().formfeed();
}
if ((printer().rows_left()<2 && _tipostampa==sintetico) || (printer().rows_left()<6 && _tipostampa==completo))
printer().formfeed();
}
}
if (_tipostampa==etichette)
if (printer().rows_left() < _form_eti->get_body().height())
printer().formfeed();
@ -555,6 +577,9 @@ bool TStampaPerCategorie::set_print(int m)
case F_COMPLETO:
_tipostampa=completo;
break;
case F_PERSONALE:
_tipostampa=personale;
break;
case F_SCHEDE:
_tipostampa=schede;
if (_schxpag > 1)
@ -577,12 +602,6 @@ bool TStampaPerCategorie::set_print(int m)
_contatore = 0;
TString80 chiave = "";
_pergruppo = _msk->get_bool(F_PERGRUPPO);
if (_pergruppo)
{
_gruppoazie = _msk->get(F_GRUPPOAZIE);
if (_gruppoazie.empty())
chiave << "90->GRUPPOAZIE|";
}
bool percap = _msk->get_bool(F_PERCAP);
_capini = _msk->get(F_CAPINI);
_capfin = _msk->get(F_CAPFIN);
@ -590,10 +609,21 @@ bool TStampaPerCategorie::set_print(int m)
_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
chiave << "UPPER(90->COGNOME)|UPPER(90->NOME)";
{
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);
@ -711,6 +741,25 @@ void TStampaPerCategorie::crea_intestazione()
sep.fill('-');
set_header(3, (const char *) sep);
}
if (_tipostampa==personale)
{
TPrint_section& testata = _form_per->get_head();
testata.update();
for (word i=0; i<testata.height(); i++)
{
TPrintrow& riga = testata.row(i);
TString256 riga1 = riga.row();
set_header(i+1,riga1);
}
TPrint_section& piede = _form_per->get_foot();
piede.update();
for (i=0; i<piede.height(); i++)
{
TPrintrow& riga = piede.row(i);
TString256 riga1 = riga.row();
set_footer(i+1,riga1);
}
}
if (_tipostampa==sintetico)
{
_dencom.set_width(50);
@ -762,7 +811,7 @@ bool TStampaPerCategorie::user_create()
_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","",3));
add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ|SOG_CODSOT","",3));
_msk = new TMask("at2700a");
TConfig config(CONFIG_STUDIO);
@ -775,6 +824,8 @@ bool TStampaPerCategorie::user_create()
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;
}
@ -789,7 +840,7 @@ bool TStampaPerCategorie::user_destroy()
delete _form_eti;
delete _form_car;
delete _form_sch;
delete _form_per;
return TRUE;
}

View File

@ -48,6 +48,8 @@
#define F_SINTETICO 501
#define F_COMPLETO 502
#define F_SCHEDE 503
#define F_ETICHETTE 504
#define F_CARTOLINE 505
#define F_PERSONALE 503
#define F_SCHEDE 504
#define F_ETICHETTE 505
#define F_CARTOLINE 506

View File

@ -4,37 +4,44 @@ TOOLBAR "" 0 20 0 2
BUTTON F_SINTETICO 9 2
BEGIN
PROMPT -16 -11 "Sintetico"
PROMPT -17 -11 "Sintetico"
MESSAGE EXIT,F_SINTETICO
END
BUTTON F_COMPLETO 9 2
BEGIN
PROMPT -26 -11 "Completo"
PROMPT -27 -11 "Completo"
MESSAGE EXIT,F_COMPLETO
END
BUTTON F_PERSONALE 9 2
BEGIN
PROMPT -37 -11 "Personale"
MESSAGE EXIT,F_PERSONALE
END
BUTTON F_SCHEDE 9 2
BEGIN
PROMPT -36 -11 "Schede"
PROMPT -47 -11 "Schede"
MESSAGE EXIT,F_SCHEDE
END
BUTTON F_ETICHETTE 9 2
BEGIN
PROMPT -46 -11 "Etichette"
PROMPT -57 -11 "Etichette"
MESSAGE EXIT,F_ETICHETTE
END
BUTTON F_CARTOLINE 9 2
BEGIN
PROMPT -56 -11 "Cartoline"
PROMPT -67 -11 "Cartoline"
MESSAGE EXIT,F_CARTOLINE
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -66 -11 ""
PROMPT -77 -11 ""
END
ENDPAGE