1997-03-20 10:33:28 +00:00
|
|
|
|
#include <form.h>
|
|
|
|
|
#include <mask.h>
|
|
|
|
|
#include <printapp.h>
|
|
|
|
|
#include <utility.h>
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
#include "benem.h"
|
1997-03-20 10:33:28 +00:00
|
|
|
|
#include "soggetti.h"
|
|
|
|
|
#include "sezioni.h"
|
1997-12-05 16:26:15 +00:00
|
|
|
|
#include <comuni.h>
|
1997-03-20 10:33:28 +00:00
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
#include "at1.h"
|
|
|
|
|
#include "at1300a.h"
|
1999-02-12 14:05:35 +00:00
|
|
|
|
#include "atlib.h"
|
1997-12-05 16:26:15 +00:00
|
|
|
|
|
1999-02-02 14:40:54 +00:00
|
|
|
|
#define ALIAS_BNZ 600
|
1999-02-12 14:05:35 +00:00
|
|
|
|
//#define ALIAS_LCPRES 101 // localita' postale di residenza
|
1997-12-05 16:26:15 +00:00
|
|
|
|
#define ALIAS_LCPDOM 100 // localita' postale di domicilio
|
1999-02-12 14:05:35 +00:00
|
|
|
|
//#define ALIAS_COMRES 502 // comune di residenza
|
1997-12-05 16:26:15 +00:00
|
|
|
|
#define ALIAS_COMDOM 501 // comune di domicilio
|
1999-02-12 14:05:35 +00:00
|
|
|
|
//#define ALIAS_COMNAS 500 // comune di nascita
|
1997-03-20 10:33:28 +00:00
|
|
|
|
|
1999-01-26 13:55:53 +00:00
|
|
|
|
#define ETI_COGNOME 3 // numero campo cognome e nome in etichetta (deve essere sempre cosi') per famiglie
|
1999-02-02 14:40:54 +00:00
|
|
|
|
#define LET_BENEM 10 // campo benemerenza in form per lettera
|
1999-01-26 13:55:53 +00:00
|
|
|
|
|
|
|
|
|
enum ts { undefined=0, sintetico=1, completo=2, etichette=3, lettere=4 };
|
|
|
|
|
|
|
|
|
|
// definizione form per etichette
|
|
|
|
|
class TEti_bensez_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_bensez_form(): TForm() {};
|
|
|
|
|
TEti_bensez_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
|
|
|
|
|
: TForm(form,code,editlevel,desc) {};
|
|
|
|
|
virtual ~TEti_bensez_form() {};
|
|
|
|
|
};
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
class TStampaBenemerenze : public TPrintapp
|
|
|
|
|
{
|
1998-10-16 14:16:13 +00:00
|
|
|
|
TLocalisamfile* _sezioni;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TRelation* _rel;
|
|
|
|
|
TMask* _msk;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
TEti_bensez_form* _form_eti;
|
|
|
|
|
TEti_bensez_form* _form_let;
|
2002-10-24 09:05:18 +00:00
|
|
|
|
TAssoc_array _categorie;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
int _counter;
|
|
|
|
|
int _cur;
|
1998-10-16 14:16:13 +00:00
|
|
|
|
char _tiposta;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TDate _dataini, _datafin;
|
1998-05-15 14:30:45 +00:00
|
|
|
|
TString16 _codsez, _codsot, _sezini, _sotini, _sezfin, _sotfin;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
ts _tipostampa;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TParagraph_string _cognome_nome, _dencom;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
TString16 _tipoben, _tipoold;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
int _contatore;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
int _etlarghezza, _etcolonne;
|
|
|
|
|
bool _stampa80, _etictot;
|
2002-10-24 09:05:18 +00:00
|
|
|
|
|
|
|
|
|
static bool filter_func_benem(const TRelation* rel);
|
1997-12-05 16:26:15 +00:00
|
|
|
|
|
1997-03-20 10:33:28 +00:00
|
|
|
|
protected:
|
1997-12-05 16:26:15 +00:00
|
|
|
|
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);
|
|
|
|
|
|
1997-03-20 10:33:28 +00:00
|
|
|
|
public:
|
|
|
|
|
void crea_intestazione();
|
1998-09-25 13:16:04 +00:00
|
|
|
|
void header_ben(const TString16 tipoben, const TString16 codsez, const TString16 codsot);
|
1997-12-05 16:26:15 +00:00
|
|
|
|
void footer_ben();
|
|
|
|
|
TMask& app_mask() { return *_msk; }
|
|
|
|
|
TStampaBenemerenze() : _cognome_nome("",35), _dencom("",50) {}
|
1997-03-20 10:33:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
HIDDEN inline TStampaBenemerenze& app() { return (TStampaBenemerenze&) main_app(); }
|
1997-08-01 14:49:53 +00:00
|
|
|
|
|
1999-01-26 13:55:53 +00:00
|
|
|
|
TCursor* TEti_bensez_form::cursor() const { return app().current_cursor(); }
|
|
|
|
|
|
|
|
|
|
TRelation* TEti_bensez_form::relation() const { return cursor()->relation(); }
|
|
|
|
|
|
2002-10-24 09:05:18 +00:00
|
|
|
|
bool TStampaBenemerenze::filter_func_benem(const TRelation* rel)
|
|
|
|
|
{
|
|
|
|
|
bool filtrato = TRUE;
|
|
|
|
|
TRectype recsog = rel->lfile(LF_SOGGETTI).curr();
|
|
|
|
|
// filtro per categorie
|
|
|
|
|
TAssoc_array& categorie = app()._categorie;
|
|
|
|
|
if (categorie.items() != 0)
|
|
|
|
|
{
|
|
|
|
|
const TString16 cat = recsog.get(SOG_CATDON);
|
|
|
|
|
filtrato = categorie.is_key((const char*) cat);
|
|
|
|
|
}
|
|
|
|
|
return filtrato;
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
print_action TStampaBenemerenze::postprocess_print(int file, int counter)
|
|
|
|
|
{
|
|
|
|
|
if (_contatore > 0)
|
|
|
|
|
footer_ben();
|
|
|
|
|
return NEXT_PAGE;
|
1997-08-01 14:49:53 +00:00
|
|
|
|
}
|
1997-03-20 10:33:28 +00:00
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
void TStampaBenemerenze::footer_ben()
|
1997-03-20 10:33:28 +00:00
|
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
|
// stampa totale benemerenze
|
|
|
|
|
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();
|
1997-03-20 10:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
void TStampaBenemerenze::set_page(int file, int cnt)
|
1999-01-26 13:55:53 +00:00
|
|
|
|
{
|
|
|
|
|
switch (_tipostampa)
|
|
|
|
|
{
|
|
|
|
|
case etichette:
|
|
|
|
|
{
|
|
|
|
|
TPrint_section& corpo = _form_eti->get_body();
|
|
|
|
|
for (int r=1;r<=_etcolonne;r++)
|
|
|
|
|
{
|
|
|
|
|
if (current_cursor()->pos()<current_cursor()->items())
|
|
|
|
|
{
|
|
|
|
|
bool avanza = TRUE;
|
|
|
|
|
while (avanza)
|
|
|
|
|
{
|
|
|
|
|
if (current_cursor()->pos()<current_cursor()->items())
|
|
|
|
|
avanza = !(preprocess_page(file, cnt));
|
|
|
|
|
else
|
|
|
|
|
avanza = FALSE;
|
|
|
|
|
if (avanza)
|
|
|
|
|
++(*current_cursor());
|
|
|
|
|
}
|
|
|
|
|
force_setpage(TRUE);
|
|
|
|
|
TForm_item& cognome = corpo.find_field(ETI_COGNOME);
|
|
|
|
|
cognome.set(_cognome_nome);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
bool avanza = TRUE;
|
|
|
|
|
while (avanza)
|
|
|
|
|
{
|
|
|
|
|
++(*current_cursor());
|
|
|
|
|
if (current_cursor()->pos()<current_cursor()->items())
|
|
|
|
|
avanza = !(preprocess_page(file, cnt));
|
|
|
|
|
else
|
|
|
|
|
avanza = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case lettere:
|
|
|
|
|
{
|
|
|
|
|
TPrint_section& corpo = _form_let->get_body();
|
1999-02-02 14:40:54 +00:00
|
|
|
|
TForm_item& item_benem = corpo.find_field(LET_BENEM);
|
|
|
|
|
TString80 benem = current_cursor()->curr(-ALIAS_BNZ).get("S0");
|
2003-06-23 10:26:01 +00:00
|
|
|
|
int new_x = (88-benem.len())/2;
|
1999-02-02 14:40:54 +00:00
|
|
|
|
item_benem.set_x(new_x);
|
1999-01-26 13:55:53 +00:00
|
|
|
|
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<63> alla prossima etichetta rifaccia la setpage
|
|
|
|
|
// altrimenti stampa sempre la stessa etichetta
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case completo:
|
|
|
|
|
{
|
|
|
|
|
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@S", FLD(LF_SOGGETTI,SOG_TESSAVIS));
|
|
|
|
|
set_row(2,"@49g#a", &_dencom);
|
|
|
|
|
set_row(2,"@116g@S", FLD(LF_SOGGETTI,SOG_TELALT));
|
|
|
|
|
set_row(3,"@100g@pn", FLD(LF_SOGGETTI,SOG_TOTDON,"###"));
|
|
|
|
|
set_row(4,"");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case sintetico:
|
|
|
|
|
{
|
|
|
|
|
set_row(1,"@0g#a", &_cognome_nome);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
1997-03-20 10:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
bool TStampaBenemerenze::preprocess_page(int file, int counter)
|
|
|
|
|
{
|
1999-01-26 13:55:53 +00:00
|
|
|
|
if (_tipostampa==sintetico||_tipostampa==completo)
|
|
|
|
|
{
|
|
|
|
|
TString80 nome = current_cursor()->curr(LF_SOGGETTI).get(SOG_COGNOME);
|
|
|
|
|
nome << " ";
|
|
|
|
|
nome << current_cursor()->curr(LF_SOGGETTI).get(SOG_NOME);
|
|
|
|
|
_cognome_nome = nome;
|
|
|
|
|
TString256 localita = "";
|
1999-02-02 14:40:54 +00:00
|
|
|
|
localita = current_cursor()->curr(LF_SOGGETTI).get(SOG_DOM_CAP);
|
|
|
|
|
localita << " ";
|
|
|
|
|
if (current_cursor()->curr(LF_SOGGETTI).get(SOG_DOM_CODLOC).not_empty())
|
1999-01-26 13:55:53 +00:00
|
|
|
|
{
|
|
|
|
|
localita << current_cursor()->curr(-ALIAS_LCPDOM).get("S0");
|
|
|
|
|
localita << " - ";
|
1999-02-02 14:40:54 +00:00
|
|
|
|
}
|
1999-01-26 13:55:53 +00:00
|
|
|
|
localita << current_cursor()->curr(-ALIAS_COMDOM).get(COM_DENCOM);
|
|
|
|
|
localita.trim();
|
|
|
|
|
_dencom = localita;
|
|
|
|
|
// salto pagina se cambio punto di rottura
|
|
|
|
|
const TString16 tiponew = current_cursor()->curr().get(BEN_TIPOBEN);
|
|
|
|
|
TString16 codsez, codsot;
|
|
|
|
|
if (app()._tiposta == 'S')
|
|
|
|
|
{
|
|
|
|
|
codsez = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSEZ);
|
|
|
|
|
codsot = current_cursor()->curr(LF_SOGGETTI).get(SOG_CODSOT);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
codsez = current_cursor()->curr().get(BEN_CODSEZ);
|
|
|
|
|
codsot = current_cursor()->curr().get(BEN_CODSOT);
|
|
|
|
|
}
|
|
|
|
|
if ((tiponew != _tipoold) || (_codsez!=codsez) || (_codsot!=codsot))
|
|
|
|
|
{
|
|
|
|
|
if (_tipoold != "**")
|
|
|
|
|
footer_ben();
|
|
|
|
|
_contatore = 0;
|
|
|
|
|
_tipoold = tiponew;
|
|
|
|
|
_codsez = codsez;
|
|
|
|
|
_codsot = codsot;
|
|
|
|
|
header_ben(tiponew, _codsez, _codsot);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (printer().rows_left() < 4)
|
|
|
|
|
printer().formfeed();
|
1997-12-05 16:26:15 +00:00
|
|
|
|
}
|
1999-01-26 13:55:53 +00:00
|
|
|
|
if (_tipostampa==etichette)
|
|
|
|
|
if (printer().rows_left() < _form_eti->get_body().height())
|
|
|
|
|
printer().formfeed();
|
2003-06-23 10:26:01 +00:00
|
|
|
|
if (_tipostampa==lettere)
|
|
|
|
|
if (printer().rows_left() < _form_let->get_body().height())
|
|
|
|
|
printer().formfeed();
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_contatore++;
|
|
|
|
|
return TRUE;
|
1997-03-20 10:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-09-25 13:16:04 +00:00
|
|
|
|
void TStampaBenemerenze::header_ben(const TString16 tipoben, const TString16 codsez, const TString16 codsot)
|
1997-03-20 10:33:28 +00:00
|
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TString intestazione(132);
|
|
|
|
|
intestazione = "BENEMERENZA ";
|
|
|
|
|
intestazione << tipoben;
|
1997-03-20 10:33:28 +00:00
|
|
|
|
intestazione << " ";
|
1997-12-05 16:26:15 +00:00
|
|
|
|
intestazione << current_cursor()->curr(-ALIAS_BNZ).get("S0");
|
1999-01-26 13:55:53 +00:00
|
|
|
|
if (_tipostampa==completo)
|
|
|
|
|
intestazione.center_just(132);
|
|
|
|
|
if (_tipostampa==sintetico)
|
|
|
|
|
intestazione.left_just(132);
|
1998-09-25 13:16:04 +00:00
|
|
|
|
set_header(3,"@0g%s", (const char*) intestazione);
|
1998-10-16 14:16:13 +00:00
|
|
|
|
TLocalisamfile sezioni(LF_SEZIONI);
|
|
|
|
|
sezioni.zero();
|
|
|
|
|
sezioni.put(SEZ_CODSEZ, codsez);
|
|
|
|
|
sezioni.put(SEZ_CODSOT, codsot);
|
|
|
|
|
TString80 densez, densot;
|
|
|
|
|
densez = "";
|
|
|
|
|
densot = "";
|
|
|
|
|
if (sezioni.read() == NOERR)
|
|
|
|
|
{
|
|
|
|
|
densez = sezioni.get(SEZ_DENSEZ);
|
|
|
|
|
densot = sezioni.get(SEZ_DENSOT);
|
|
|
|
|
}
|
1998-09-25 13:16:04 +00:00
|
|
|
|
intestazione = "Sezione: ";
|
|
|
|
|
intestazione << codsez;
|
|
|
|
|
intestazione << "/";
|
|
|
|
|
intestazione << codsot;
|
|
|
|
|
intestazione << " ";
|
|
|
|
|
intestazione << densez;
|
2000-10-10 08:09:56 +00:00
|
|
|
|
if (densot.not_empty())
|
1998-09-25 13:16:04 +00:00
|
|
|
|
{
|
|
|
|
|
intestazione << "/";
|
|
|
|
|
intestazione << densot;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
if (_tipostampa==completo)
|
|
|
|
|
intestazione.center_just();
|
|
|
|
|
if (_tipostampa==sintetico)
|
|
|
|
|
intestazione.left_just();
|
1998-09-25 13:16:04 +00:00
|
|
|
|
set_header(1,"@0g%s", (const char*) intestazione);
|
1997-03-20 10:33:28 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
bool TStampaBenemerenze::set_print(int m)
|
|
|
|
|
{
|
1999-02-12 14:05:35 +00:00
|
|
|
|
TPrinter& p = printer();
|
|
|
|
|
p.read_configuration();
|
1999-01-26 13:55:53 +00:00
|
|
|
|
_tipostampa = undefined;
|
1997-03-20 10:33:28 +00:00
|
|
|
|
KEY tasto;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
tasto = _msk->run();
|
|
|
|
|
switch (tasto)
|
|
|
|
|
{
|
|
|
|
|
case F_SINTETICO:
|
|
|
|
|
_tipostampa=sintetico;
|
|
|
|
|
break;
|
|
|
|
|
case F_COMPLETO:
|
|
|
|
|
_tipostampa=completo;
|
|
|
|
|
break;
|
|
|
|
|
case F_ETICHETTE:
|
1999-02-12 14:05:35 +00:00
|
|
|
|
_tipostampa = (configura_stampante(p, "AT_ETICHETTE", "etichette")) ? etichette : undefined;
|
|
|
|
|
break;
|
|
|
|
|
case F_LETTERE:
|
|
|
|
|
_tipostampa = lettere;
|
|
|
|
|
break;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
}
|
|
|
|
|
if (_tipostampa != undefined)
|
|
|
|
|
{
|
|
|
|
|
if (_tipostampa == etichette)
|
|
|
|
|
_cognome_nome.set_width(200);
|
|
|
|
|
if (_tipostampa == sintetico)
|
|
|
|
|
_cognome_nome.set_width(51);
|
1998-09-25 13:16:04 +00:00
|
|
|
|
_codsez = "**";
|
|
|
|
|
_codsot = "**";
|
1998-10-16 14:16:13 +00:00
|
|
|
|
_dataini = _msk->get_date(F_DATAINI);
|
|
|
|
|
_datafin = _msk->get_date(F_DATAFIN);
|
1999-01-26 13:55:53 +00:00
|
|
|
|
_tipoben = _msk->get(F_TIPOBEN);
|
1998-10-16 14:16:13 +00:00
|
|
|
|
_tiposta = _msk->get(F_TIPOSTA)[0];
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TRectype da(LF_BENEM);
|
|
|
|
|
TRectype a (LF_BENEM);
|
|
|
|
|
if (_dataini.ok())
|
|
|
|
|
da.put(BEN_DATABEN, _dataini);
|
|
|
|
|
if (_datafin.ok())
|
|
|
|
|
a.put(BEN_DATABEN, _datafin);
|
1998-09-25 13:16:04 +00:00
|
|
|
|
//TString80 chiave = "94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
|
1998-10-16 14:16:13 +00:00
|
|
|
|
TString80 chiave = "";
|
|
|
|
|
if (_tiposta == 'S')
|
|
|
|
|
chiave = "90->CODSEZ|90->CODSOT|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
|
|
|
|
|
else
|
|
|
|
|
chiave = "94->CODSEZ|94->CODSOT|94->TIPOBEN|UPPER(90->COGNOME)|UPPER(90->NOME)";
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_cur = add_cursor(new TSorted_cursor(_rel, (const char*) chiave, "", 2, &da, &a));
|
1998-05-15 14:30:45 +00:00
|
|
|
|
// filtro per sezioni
|
|
|
|
|
_sezini = _msk->get(F_SEZINI);
|
|
|
|
|
_sotini = _msk->get(F_SOTINI);
|
|
|
|
|
_sezfin = _msk->get(F_SEZFIN);
|
1998-10-16 14:16:13 +00:00
|
|
|
|
_sotfin = _msk->get(F_SOTFIN);
|
|
|
|
|
TString256 filtro = "";
|
|
|
|
|
if (_sezini.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (_sotini.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (_tiposta == 'S')
|
|
|
|
|
{
|
|
|
|
|
filtro << "(";
|
|
|
|
|
filtro << format("(90->CODSEZ > \"%s\")",(const char*)_sezini);
|
|
|
|
|
filtro << " || ";
|
|
|
|
|
filtro << "(" << format("(90->CODSEZ == \"%s\")",(const char*)_sezini);
|
|
|
|
|
filtro << " && ";
|
|
|
|
|
filtro << format("(90->CODSOT >= \"%s\")",(const char*)_sotini);
|
|
|
|
|
filtro << ")";
|
|
|
|
|
filtro << ")";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
filtro << "(";
|
|
|
|
|
filtro << format("(94->CODSEZ > \"%s\")",(const char*)_sezini);
|
|
|
|
|
filtro << " || ";
|
|
|
|
|
filtro << "(" << format("(94->CODSEZ == \"%s\")",(const char*)_sezini);
|
|
|
|
|
filtro << " && ";
|
|
|
|
|
filtro << format("(94->CODSOT >= \"%s\")",(const char*)_sotini);
|
|
|
|
|
filtro << ")";
|
|
|
|
|
filtro << ")";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (_tiposta == 'S')
|
|
|
|
|
filtro << format("(90->CODSEZ >= \"%s\")",(const char*)_sezini);
|
|
|
|
|
else
|
|
|
|
|
filtro << format("(94->CODSEZ >= \"%s\")",(const char*)_sezini);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (_sezfin.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (filtro.not_empty())
|
|
|
|
|
filtro << " && ";
|
|
|
|
|
if (_sotfin.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (_tiposta == 'S')
|
|
|
|
|
{
|
|
|
|
|
filtro << "(";
|
|
|
|
|
filtro << format("(90->CODSEZ < \"%s\")",(const char*)_sezfin);
|
|
|
|
|
filtro << " || ";
|
|
|
|
|
filtro << "(" << format("(90->CODSEZ == \"%s\")",(const char*)_sezfin);
|
|
|
|
|
filtro << " && ";
|
|
|
|
|
filtro << format("(90->CODSOT <= \"%s\")",(const char*)_sotfin);
|
|
|
|
|
filtro << ")";
|
|
|
|
|
filtro << ")";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
filtro << "(";
|
|
|
|
|
filtro << format("(94->CODSEZ < \"%s\")",(const char*)_sezfin);
|
|
|
|
|
filtro << " || ";
|
|
|
|
|
filtro << "(" << format("(94->CODSEZ == \"%s\")",(const char*)_sezfin);
|
|
|
|
|
filtro << " && ";
|
|
|
|
|
filtro << format("(94->CODSOT <= \"%s\")",(const char*)_sotfin);
|
|
|
|
|
filtro << ")";
|
|
|
|
|
filtro << ")";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (_tiposta == 'S')
|
|
|
|
|
filtro << format("(90->CODSEZ <= \"%s\")",(const char*)_sezfin);
|
|
|
|
|
else
|
|
|
|
|
filtro << format("(94->CODSEZ <= \"%s\")",(const char*)_sezfin);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-01-26 13:55:53 +00:00
|
|
|
|
if (_tipoben.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (filtro.not_empty())
|
|
|
|
|
filtro << " && ";
|
|
|
|
|
filtro << format("(94->TIPOBEN==\"%s\")",(const char*)_tipoben);
|
|
|
|
|
|
|
|
|
|
}
|
1997-12-05 16:26:15 +00:00
|
|
|
|
current_cursor()->setfilter((const char*) filtro, TRUE);
|
2002-10-24 09:05:18 +00:00
|
|
|
|
// filtro per categorie
|
|
|
|
|
_categorie.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())
|
|
|
|
|
_categorie.add((const char*) catpri);
|
|
|
|
|
if (catsec.not_empty())
|
|
|
|
|
_categorie.add((const char*) catsec);
|
|
|
|
|
if (catter.not_empty())
|
|
|
|
|
_categorie.add((const char*) catter);
|
|
|
|
|
if (catqua.not_empty())
|
|
|
|
|
_categorie.add((const char*) catqua);
|
|
|
|
|
if (catqui.not_empty())
|
|
|
|
|
_categorie.add((const char*) catqui);
|
|
|
|
|
if (catses.not_empty())
|
|
|
|
|
_categorie.add((const char*) catses);
|
|
|
|
|
current_cursor()->set_filterfunction(filter_func_benem);
|
1998-10-16 14:16:13 +00:00
|
|
|
|
_counter = 0;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_tipoold = "**";
|
|
|
|
|
reset_files();
|
|
|
|
|
add_file(LF_BENEM);
|
|
|
|
|
reset_print();
|
1998-09-02 14:06:20 +00:00
|
|
|
|
printer().footerlen(0);
|
1997-12-05 16:26:15 +00:00
|
|
|
|
crea_intestazione();
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
1997-03-20 10:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
void TStampaBenemerenze::crea_intestazione()
|
1997-03-20 10:33:28 +00:00
|
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
|
reset_header();
|
1999-01-26 13:55:53 +00:00
|
|
|
|
if (_tipostampa==sintetico || _tipostampa==completo)
|
|
|
|
|
{
|
|
|
|
|
TString sep(132);
|
|
|
|
|
sep = "STAMPA BENEMERENZE ATTRIBUITE dal ";
|
|
|
|
|
sep << _dataini;
|
|
|
|
|
sep << " al ";
|
|
|
|
|
sep << _datafin;
|
|
|
|
|
if (_tipostampa==completo)
|
|
|
|
|
sep.center_just(132);
|
|
|
|
|
if (_tipostampa==sintetico)
|
|
|
|
|
sep.left_just(132);
|
|
|
|
|
set_header(2,"@0g%s", (const char*) sep);
|
|
|
|
|
sep = "Pag. @#";
|
|
|
|
|
if (_tipostampa==completo)
|
|
|
|
|
set_header(2, "@110g%s", (const char*) sep);
|
|
|
|
|
if (_tipostampa==sintetico)
|
|
|
|
|
set_header(2, "@60g%s", (const char*) sep);
|
|
|
|
|
sep = "";
|
|
|
|
|
sep.fill('-');
|
|
|
|
|
set_header(4, (const char *) sep);
|
|
|
|
|
if (_tipostampa==completo)
|
|
|
|
|
{
|
|
|
|
|
set_header(5,"@0gCodice@9gC.@12gCognome e nome@38gNato il@49gIndirizzo@100gTelefono abit.@116gTelefono lavoro");
|
|
|
|
|
set_header(6,"@0gTessera@49gCAP/Localit<69>/Comune/Prov.@116gTelefono altro");
|
|
|
|
|
set_header(7,"@100gTot.don.");
|
|
|
|
|
set_header(8,"@0g--------@9g--@12g-------------------------@38g----------@49g--------------------------------------------------@100g---------------@116g---------------");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
set_header(5,"@0gCognome e nome");
|
|
|
|
|
printer().footerlen(3);
|
|
|
|
|
}
|
1997-03-20 10:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
bool TStampaBenemerenze::user_create()
|
1997-03-20 10:33:28 +00:00
|
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_rel = new TRelation(LF_BENEM);
|
|
|
|
|
_rel->add(LF_SOGGETTI, "CODICE==CODICE");
|
|
|
|
|
_rel->add("BNZ", "CODTAB==TIPOBEN",1,0,ALIAS_BNZ);
|
1999-02-12 14:05:35 +00:00
|
|
|
|
//_rel->add("LCP", "CODTAB==RES_CODLOC",1,LF_SOGGETTI,ALIAS_LCPRES);
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_rel->add("LCP", "CODTAB==DOM_CODLOC",1,LF_SOGGETTI,ALIAS_LCPDOM);
|
1999-02-12 14:05:35 +00:00
|
|
|
|
//_rel->add(LF_COMUNI, "COM==RES_CODCOM",1,LF_SOGGETTI,ALIAS_COMRES);
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,LF_SOGGETTI,ALIAS_COMDOM);
|
1999-02-12 14:05:35 +00:00
|
|
|
|
//_rel->add(LF_COMUNI, "COM==COMNASC",1,LF_SOGGETTI,ALIAS_COMNAS);
|
1998-10-16 14:16:13 +00:00
|
|
|
|
//_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
|
|
|
|
|
_sezioni = new TLocalisamfile(LF_SEZIONI);
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_msk = new TMask("at1300a");
|
2010-05-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
//controllo e caricamento dati dalla configurazione
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TConfig config(CONFIG_STUDIO);
|
2010-05-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
//etichette
|
1999-01-26 13:55:53 +00:00
|
|
|
|
TString16 etformato = config.get("EtFormato");
|
2010-05-06 13:37:46 +00:00
|
|
|
|
if (!controlla_esistenza_form(etformato, "ate10x36"))
|
|
|
|
|
return false;
|
1999-01-26 13:55:53 +00:00
|
|
|
|
_etlarghezza = config.get_int("EtLarghezza");
|
|
|
|
|
_etcolonne = config.get_int("EtColonne");
|
|
|
|
|
_form_eti = new TEti_bensez_form(etformato);
|
2010-05-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
//lettere
|
|
|
|
|
/*TString16 letformato = config.get("LetFormato");
|
|
|
|
|
if (!controlla_esistenza_form(letformato, "atlebebo"))
|
|
|
|
|
return false;*/
|
|
|
|
|
TString16 letformato = "atlebebo";
|
|
|
|
|
_form_let = new TEti_bensez_form(letformato);
|
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
_stampa80 = config.get_bool("Stampa80");
|
1999-01-26 13:55:53 +00:00
|
|
|
|
_etictot = config.get_bool("EticTot");
|
2010-05-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
return true;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
}
|
1997-03-20 10:33:28 +00:00
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
|
bool TStampaBenemerenze::user_destroy()
|
1997-03-20 10:33:28 +00:00
|
|
|
|
{
|
1999-01-26 13:55:53 +00:00
|
|
|
|
delete _form_let;
|
|
|
|
|
delete _form_eti;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
delete _msk;
|
1998-10-16 14:16:13 +00:00
|
|
|
|
delete _sezioni;
|
1997-12-05 16:26:15 +00:00
|
|
|
|
delete _rel;
|
|
|
|
|
return TRUE;
|
1997-03-20 10:33:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int at1300(int argc, char* argv[])
|
|
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
|
TStampaBenemerenze a;
|
1998-08-07 09:53:58 +00:00
|
|
|
|
a.run(argc, argv, "Elenco benemerenze attribuite");
|
1997-12-05 16:26:15 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|