aggiornamento tracciati su standard nazionale e miglioramento prestazioni stampe

git-svn-id: svn://10.65.10.50/trunk@3961 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1996-12-04 13:58:23 +00:00
parent 5727cf5134
commit b4724c22ba
12 changed files with 1032 additions and 1154 deletions

View File

@ -20,7 +20,7 @@
#define F_S_CODSEZ 106 #define F_S_CODSEZ 106
#define F_S_CODSOT 107 #define F_S_CODSOT 107
#define F_S_CATDON 108 #define F_S_CATDON 108
#define F_S_TESSERA 109 #define F_S_TESSAVIS 109
#define F_S_DENSEZ 201 #define F_S_DENSEZ 201
#define F_S_DENSOT 202 #define F_S_DENSOT 202
#define F_S_DESC_TIPOCON 203 #define F_S_DESC_TIPOCON 203

View File

@ -31,15 +31,17 @@ public:
class TSospesi_application : public TPrintapp class TSospesi_application : public TPrintapp
{ {
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TEti_sospesi_form* _form_eti; TEti_sospesi_form* _form_eti;
TAssoc_array _categorie;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome; TParagraph_string _cognome_nome;
TDate _data_stampa; TDate _data_stampa;
ts _tipo_stampa; ts _tipo_stampa;
TString _codsez, _codsot; TString16 _codsez, _codsot;
static bool filter_func_sospesi(const TRelation *); static bool filter_func_sospesi(const TRelation *);
@ -53,7 +55,7 @@ protected:
public: public:
void crea_intestazione(); void crea_intestazione();
void filtra_sezioni(); void filtra_sezioni();
void header_sezione(TString codsez, TString codsot); void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; } TMask& app_mask() { return *_msk; }
TSospesi_application() : _data_stampa(TODAY), _cognome_nome("",25) {} TSospesi_application() : _data_stampa(TODAY), _cognome_nome("",25) {}
}; };
@ -66,10 +68,10 @@ TRelation* TEti_sospesi_form::relation() const { return cursor()->relation(); }
void TSospesi_application::filtra_sezioni() void TSospesi_application::filtra_sezioni()
{ {
TString sezini = _msk->get(F_SEZINI); TString16 sezini = _msk->get(F_SEZINI);
TString sotini = _msk->get(F_SOTINI); TString16 sotini = _msk->get(F_SOTINI);
TString sezfin = _msk->get(F_SEZFIN); TString16 sezfin = _msk->get(F_SEZFIN);
TString sotfin = _msk->get(F_SOTFIN); TString16 sotfin = _msk->get(F_SOTFIN);
select_cursor(_cur4); select_cursor(_cur4);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
TRectype da(fl.curr()); TRectype da(fl.curr());
@ -125,44 +127,18 @@ void TSospesi_application::set_page(int file, int cnt)
} }
} }
bool TSospesi_application::filter_func_sospesi(const TRelation * rel) bool TSospesi_application::filter_func_sospesi(const TRelation* rel)
{ {
bool filtrato = TRUE; bool filtrato = TRUE;
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); TLocalisamfile& sog = rel->lfile();
TAssoc_array categorie; TAssoc_array categorie = app()._categorie;
TMask& msk = app().app_mask();
TString catpri = msk.get(F_CAT1);
TString catsec = msk.get(F_CAT2);
TString catter = msk.get(F_CAT3);
TString catqua = msk.get(F_CAT4);
TString catqui = msk.get(F_CAT5);
TString catses = msk.get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
categorie.add((const char*) catses);
if (categorie.items() != 0) if (categorie.items() != 0)
{ {
TString cat = sog->curr().get(SOG_CATDON); TString16 cat = sog.get(SOG_CATDON);
if (categorie.is_key((const char*) cat)) filtrato = categorie.is_key((const char*) cat);
filtrato = TRUE;
else
filtrato = FALSE;
} }
return filtrato; return filtrato;
} }
@ -173,14 +149,14 @@ bool TSospesi_application::preprocess_page(int file, int counter)
// per ora non c'è // per ora non c'è
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString nome = current_cursor()->curr().get(SOG_COGNOME); TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
nome << " "; nome << " ";
nome << current_cursor()->curr().get(SOG_NOME); nome << current_cursor()->curr().get(SOG_NOME);
_cognome_nome = nome; _cognome_nome = nome;
// salto pagina se cambio sezione // salto pagina se cambio sezione
TString codsez = current_cursor()->curr().get(SOG_CODSEZ); TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot)) if ((_codsez!=codsez)||(_codsot!=codsot))
{ {
//if (!_codsez.blank()) //if (!_codsez.blank())
@ -194,11 +170,11 @@ bool TSospesi_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
void TSospesi_application::header_sezione(TString codsez, TString codsot) void TSospesi_application::header_sezione(TString16 codsez, TString16 codsot)
{ {
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132); TString256 intestazione(132);
intestazione = "Sezione: "; intestazione = "Sezione: ";
intestazione << codsez; intestazione << codsez;
intestazione << "/"; intestazione << "/";
@ -240,16 +216,35 @@ bool TSospesi_application::set_print(int m)
// filtro per sezioni selezionati // filtro per sezioni selezionati
filtra_sezioni(); filtra_sezioni();
// filtro per tipo sospensione // filtro per tipo sospensione
TString tiposo = _msk->get(F_TIPO); TString16 tiposo = _msk->get(F_TIPO);
if (tiposo.not_empty() && tiposo.ok()) if (tiposo.not_empty() && tiposo.ok())
current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)tiposo)); current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)tiposo));
else else
current_cursor()->setfilter("TCS->S6 == \"S\"", TRUE); current_cursor()->setfilter("TCS->S6 == \"S\"", TRUE);
// filtro per categorie // filtro per categorie
TString16 catpri = _msk->get(F_CAT1);
TString16 catsec = _msk->get(F_CAT2);
TString16 catter = _msk->get(F_CAT3);
TString16 catqua = _msk->get(F_CAT4);
TString16 catqui = _msk->get(F_CAT5);
TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_categorie.add((const char*) catses);
current_cursor()->set_filterfunction(filter_func_sospesi); current_cursor()->set_filterfunction(filter_func_sospesi);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
return TRUE; return TRUE;
@ -264,20 +259,20 @@ void TSospesi_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = "ELENCO SOSPESI"; sep = "ELENCO SOSPESI";
TString tipo = _msk->get(F_TIPO); TString16 tipo = _msk->get(F_TIPO);
if ((tipo.ok()) && (tipo.not_empty())) if ((tipo.ok()) && (tipo.not_empty()))
{ {
sep << ": tipo "; sep << ": tipo ";
sep << tipo; sep << tipo;
TString dtipo = _msk->get(F_D_TIPO); TString80 dtipo = _msk->get(F_D_TIPO);
sep << " "; sep << " ";
sep << dtipo; sep << dtipo;
} }
sep.center_just(); sep.center_just();
set_header(2, "@0g%s", (const char*) sep); set_header(2, "@0g%s", (const char*) sep);
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2,"@0g%10s", (const char*) data_stampa);
sep = ""; sep = "";
sep << "Pag. @#"; sep << "Pag. @#";

View File

@ -37,7 +37,7 @@ class TPereta_application : public TPrintapp
TMask* _msk; TMask* _msk;
TEti_pereta_form* _form_eti; TEti_pereta_form* _form_eti;
TAssoc_array* _categorie; TAssoc_array _categorie;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome, _dencom; TParagraph_string _cognome_nome, _dencom;
@ -45,7 +45,7 @@ class TPereta_application : public TPrintapp
TDate _data_stampa; TDate _data_stampa;
TDate _dataini, _datafin; TDate _dataini, _datafin;
ts _tipo_stampa; ts _tipo_stampa;
TString _codsez, _codsot; TString16 _codsez, _codsot;
protected: protected:
@ -56,12 +56,9 @@ protected:
virtual bool preprocess_page (int file, int counter); virtual bool preprocess_page (int file, int counter);
public: public:
//void set_one_cat(short field_id);
//void set_categorie();
//TAssoc_array& get_categorie() { return *_categorie; }
void crea_intestazione(); void crea_intestazione();
void filtra_sezioni(); void filtra_sezioni();
void header_sezione(TString codsez, TString codsot); void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; } TMask& app_mask() { return *_msk; }
TPereta_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} TPereta_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
@ -134,68 +131,35 @@ void TPereta_application::set_page(int file, int cnt)
} }
} }
bool TPereta_application::filter_func_pereta(const TRelation * rel) bool TPereta_application::filter_func_pereta(const TRelation* rel)
{ {
bool filtrato = TRUE; bool filtrato = TRUE;
TLocalisamfile& sog = rel->lfile();
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); // fiiltro per categorie
TAssoc_array categorie = app()._categorie;
TAssoc_array categorie;
TMask& msk = app().app_mask();
TString catpri = msk.get(F_CAT1);
TString catsec = msk.get(F_CAT2);
TString catter = msk.get(F_CAT3);
TString catqua = msk.get(F_CAT4);
TString catqui = msk.get(F_CAT5);
TString catses = msk.get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
categorie.add((const char*) catses);
if (categorie.items() != 0) if (categorie.items() != 0)
{ {
TString cat = sog->curr().get(SOG_CATDON); TString16 cat = sog.get(SOG_CATDON);
if (categorie.is_key((const char*) cat)) filtrato = categorie.is_key((const char*) cat);
filtrato = TRUE;
else
filtrato = FALSE;
} }
// filtro per data di nascita
if (filtrato) if (filtrato)
{ {
// filtro per età TDate datanasc = sog.get(SOG_DATANASC);
TRectype from (sog->curr());
TRectype to (sog->curr());
from.zero();
to.zero();
if (app()._dataini.ok()) if (app()._dataini.ok())
from.put(SOG_DATANASC, app()._dataini); filtrato = datanasc >= app()._dataini;
if (app()._datafin.ok()) if (app()._datafin.ok())
to.put(SOG_DATANASC, app()._datafin); filtrato = (filtrato) && (datanasc <= app()._datafin);
if ((sog->curr() >= from) && (sog->curr() <= to))
filtrato = TRUE;
else
filtrato = FALSE;
} }
return filtrato; return filtrato;
} }
void TPereta_application::header_sezione(TString codsez, TString codsot) void TPereta_application::header_sezione(TString16 codsez, TString16 codsot)
{ {
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132); TString256 intestazione(132);
intestazione = "Sezione: "; intestazione = "Sezione: ";
intestazione << codsez; intestazione << codsez;
intestazione << "/"; intestazione << "/";
@ -218,11 +182,11 @@ bool TPereta_application::preprocess_page(int file, int counter)
// per ora non c'è // per ora non c'è
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString nome = current_cursor()->curr().get(SOG_COGNOME); TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
nome << " "; nome << " ";
nome << current_cursor()->curr().get(SOG_NOME); nome << current_cursor()->curr().get(SOG_NOME);
_cognome_nome = nome; _cognome_nome = nome;
TString localita = ""; TString256 localita = "";
localita << current_cursor()->curr(-ALIAS_LCP).get("S6"); localita << current_cursor()->curr(-ALIAS_LCP).get("S6");
if (localita.not_empty() && localita.ok()) if (localita.not_empty() && localita.ok())
{ {
@ -240,8 +204,8 @@ bool TPereta_application::preprocess_page(int file, int counter)
_dencom = localita; _dencom = localita;
// salto pagina se cambio sezione // salto pagina se cambio sezione
TString codsez = current_cursor()->curr().get(SOG_CODSEZ); TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot)) if ((_codsez!=codsez)||(_codsot!=codsot))
{ {
if (_codsez != "**") if (_codsez != "**")
@ -254,7 +218,7 @@ bool TPereta_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
bool TPereta_application::set_print(int) bool TPereta_application::set_print(int m)
{ {
_tipo_stampa = undefined; _tipo_stampa = undefined;
KEY tasto; KEY tasto;
@ -274,11 +238,30 @@ bool TPereta_application::set_print(int)
{ {
reset_files(); reset_files();
add_file(LF_SOGGETTI); add_file(LF_SOGGETTI);
filtra_sezioni();
_dataini = _msk->get(F_DATAINI); _dataini = _msk->get(F_DATAINI);
_datafin = _msk->get(F_DATAFIN); _datafin = _msk->get(F_DATAFIN);
filtra_sezioni(); TString16 catpri = _msk->get(F_CAT1);
//set_categorie(); TString16 catsec = _msk->get(F_CAT2);
TString16 catter = _msk->get(F_CAT3);
TString16 catqua = _msk->get(F_CAT4);
TString16 catqui = _msk->get(F_CAT5);
TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_categorie.add((const char*) catses);
current_cursor()->set_filterfunction (filter_func_pereta); current_cursor()->set_filterfunction (filter_func_pereta);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
return TRUE; return TRUE;
@ -287,33 +270,13 @@ bool TPereta_application::set_print(int)
return FALSE; return FALSE;
} }
/*
void TPereta_application::set_one_cat(short field_id)
{
const char* cat = _msk->get(field_id);
if (cat != NULL)
_categorie->add(cat);
}
void TPereta_application::set_categorie()
{
set_one_cat(F_CAT1);
set_one_cat(F_CAT2);
set_one_cat(F_CAT3);
set_one_cat(F_CAT4);
set_one_cat(F_CAT5);
set_one_cat(F_CAT6);
}
*/
void TPereta_application::crea_intestazione() void TPereta_application::crea_intestazione()
{ {
reset_header(); reset_header();
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = "ELENCO PER DATA DI NASCITA"; sep = "ELENCO PER DATA DI NASCITA";
TDate data = _msk->get(F_DATAINI); TDate data = _msk->get(F_DATAINI);
if (data.ok()) if (data.ok())
@ -329,7 +292,7 @@ void TPereta_application::crea_intestazione()
} }
sep.center_just(); sep.center_just();
set_header(2, "@0g%s", (const char*) sep); set_header(2, "@0g%s", (const char*) sep);
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2,"@0g%10s", (const char*) data_stampa);
sep = ""; sep = "";
sep << "Pag. @#"; sep << "Pag. @#";

View File

@ -37,11 +37,15 @@ class TEsclusi_application : public TPrintapp
TMask* _msk; TMask* _msk;
TEti_esclusi_form* _form_eti; TEti_esclusi_form* _form_eti;
TAssoc_array _categorie;
TString16 _tipoesc;
TDate _termineesc;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome; TParagraph_string _cognome_nome;
TDate _data_stampa; TDate _data_stampa;
ts _tipo_stampa; ts _tipo_stampa;
TString _codsez, _codsot; TString16 _codsez, _codsot;
protected: protected:
virtual bool user_create(); virtual bool user_create();
@ -53,7 +57,7 @@ protected:
public: public:
void crea_intestazione(); void crea_intestazione();
void filtra_sezioni(); void filtra_sezioni();
void header_sezione(TString codsez, TString codsot); void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; } TMask& app_mask() { return *_msk; }
TEsclusi_application() : _data_stampa(TODAY), _cognome_nome("",25) {} TEsclusi_application() : _data_stampa(TODAY), _cognome_nome("",25) {}
}; };
@ -66,10 +70,10 @@ TRelation* TEti_esclusi_form::relation() const { return cursor()->relation(); }
void TEsclusi_application::filtra_sezioni() void TEsclusi_application::filtra_sezioni()
{ {
TString sezini = _msk->get(F_SEZINI); TString16 sezini = _msk->get(F_SEZINI);
TString sotini = _msk->get(F_SOTINI); TString16 sotini = _msk->get(F_SOTINI);
TString sezfin = _msk->get(F_SEZFIN); TString16 sezfin = _msk->get(F_SEZFIN);
TString sotfin = _msk->get(F_SOTFIN); TString16 sotfin = _msk->get(F_SOTFIN);
select_cursor(_cur4); select_cursor(_cur4);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
TRectype da(fl.curr()); TRectype da(fl.curr());
@ -123,46 +127,21 @@ void TEsclusi_application::set_page(int file, int cnt)
bool TEsclusi_application::filter_func_esclusi(const TRelation * rel) bool TEsclusi_application::filter_func_esclusi(const TRelation * rel)
{ {
bool filtrato = TRUE; bool filtrato = TRUE;
TLocalisamfile sog = rel->lfile();
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI));
//filtro per categorie //filtro per categorie
TAssoc_array categorie = app()._categorie;
TMask& msk = app().app_mask();
TString catpri = msk.get(F_CAT1);
TString catsec = msk.get(F_CAT2);
TString catter = msk.get(F_CAT3);
TString catqua = msk.get(F_CAT4);
TString catqui = msk.get(F_CAT5);
TString catses = msk.get(F_CAT6);
TAssoc_array categorie;
if (catpri.not_empty() && catpri.ok())
categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
categorie.add((const char*) catses);
if (categorie.items() != 0) if (categorie.items() != 0)
{ {
TString cat = sog->curr().get(SOG_CATDON); TString16 cat = sog.get(SOG_CATDON);
if (categorie.is_key((const char*) cat)) filtrato = categorie.is_key((const char*) cat);
filtrato = TRUE;
else
filtrato = FALSE;
} }
TDate termine = msk.get_date(F_DATA); // filtro per termine esclusione
TDate terminesog = sog->curr().get_date(SOG_TERMESCL); if (filtrato && app()._termineesc.ok())
if ((filtrato) && (termine.ok())) {
if (terminesog > termine) TDate terminesog = sog.get_date(SOG_TERMESCL);
filtrato = FALSE; filtrato = terminesog <= app()._termineesc;
}
return filtrato; return filtrato;
} }
@ -172,16 +151,15 @@ bool TEsclusi_application::preprocess_page(int file, int counter)
// per ora non c'è // per ora non c'è
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString nome = current_cursor()->curr().get(SOG_COGNOME); TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
nome << " "; nome << " ";
nome << current_cursor()->curr().get(SOG_NOME); nome << current_cursor()->curr().get(SOG_NOME);
_cognome_nome = nome; _cognome_nome = nome;
// salto pagina se cambio sezione // salto pagina se cambio sezione
TString codsez = current_cursor()->curr().get(SOG_CODSEZ); TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot)) if ((_codsez!=codsez)||(_codsot!=codsot))
{ {
//if (!_codsez.blank())
if (_codsez != "**") if (_codsez != "**")
printer().formfeed(); printer().formfeed();
_codsez = codsez; _codsez = codsez;
@ -192,11 +170,11 @@ bool TEsclusi_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
void TEsclusi_application::header_sezione(TString codsez, TString codsot) void TEsclusi_application::header_sezione(TString16 codsez, TString16 codsot)
{ {
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132); TString256 intestazione(132);
intestazione = "Sezione: "; intestazione = "Sezione: ";
intestazione << codsez; intestazione << codsez;
intestazione << "/"; intestazione << "/";
@ -222,8 +200,6 @@ bool TEsclusi_application::set_print(int)
{ {
case F_ELENCO: case F_ELENCO:
_tipo_stampa = elenco; _tipo_stampa = elenco;
//_codsez.spaces(2);
//_codsot.spaces(2);
_codsez = "**"; _codsez = "**";
_codsot = "**"; _codsot = "**";
break; break;
@ -235,18 +211,39 @@ bool TEsclusi_application::set_print(int)
{ {
reset_files(); reset_files();
add_file(LF_SOGGETTI); add_file(LF_SOGGETTI);
TString tipoesc = _msk->get(F_TIPO);
TDate termineesc = _msk->get(F_DATA);
filtra_sezioni(); filtra_sezioni();
if (tipoesc.not_empty() && tipoesc.ok()) // filtro per tipo esclusione
current_cursor()->setfilter(format("ESCLUSO == \"%s\"",(const char*)tipoesc)); _tipoesc = _msk->get(F_TIPO);
if (_tipoesc.not_empty() && _tipoesc.ok())
current_cursor()->setfilter(format("ESCLUSO == \"%s\"",(const char*)_tipoesc));
else else
current_cursor()->setfilter("ESCLUSO != \"\""); current_cursor()->setfilter("ESCLUSO != \"\"");
// filtro per categorie
TString16 catpri = _msk->get(F_CAT1);
TString16 catsec = _msk->get(F_CAT2);
TString16 catter = _msk->get(F_CAT3);
TString16 catqua = _msk->get(F_CAT4);
TString16 catqui = _msk->get(F_CAT5);
TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_categorie.add((const char*) catses);
// filtro per termine esclusione
_termineesc = _msk->get(F_DATA);
current_cursor()->set_filterfunction(filter_func_esclusi); current_cursor()->set_filterfunction(filter_func_esclusi);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
return TRUE; return TRUE;
@ -261,24 +258,21 @@ void TEsclusi_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
//TString sep(132); TString256 sep(90);
TString sep(90);
sep = "ELENCO ESCLUSI"; sep = "ELENCO ESCLUSI";
TString tipo = _msk->get(F_TIPO); if ((_tipoesc.ok()) && (_tipoesc.not_empty()))
if ((tipo.ok()) && (tipo.not_empty()))
{ {
sep << " "; sep << " ";
sep << tipo; sep << _tipoesc;
} }
TDate data = _msk->get(F_DATA); if (_termineesc.ok())
if (data.ok())
{ {
sep << " termine fino al "; sep << " termine fino al ";
sep << data.string(); sep << _termineesc.string();
} }
sep.center_just(); sep.center_just();
set_header(2, "@0g%s", (const char*) sep); set_header(2, "@0g%s", (const char*) sep);
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2,"@0g%10s", (const char*) data_stampa);
sep = ""; sep = "";
sep << "Pag. @#"; sep << "Pag. @#";

View File

@ -34,14 +34,17 @@ class TIdonei_application : public TPrintapp
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TEti_idonei_form* _form_eti; TEti_idonei_form* _form_eti;
TAssoc_array _categorie;
TString16 _tipoidon;
TString16 _idon1, _idon2, _idon3, _idon4;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome; TParagraph_string _cognome_nome;
TDate _data_stampa; TDate _data_stampa;
ts _tipo_stampa; ts _tipo_stampa;
TString _codsez, _codsot; TString16 _codsez, _codsot;
static bool filter_func_idonei(const TRelation *); static bool filter_func_idonei(const TRelation* rel);
protected: protected:
virtual bool user_create(); virtual bool user_create();
@ -53,7 +56,7 @@ protected:
public: public:
void crea_intestazione(); void crea_intestazione();
void filtra_sezioni(); void filtra_sezioni();
void header_sezione(TString codsez, TString codsot); void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; } TMask& app_mask() { return *_msk; }
TIdonei_application() : _data_stampa(TODAY), _cognome_nome("",25) {} TIdonei_application() : _data_stampa(TODAY), _cognome_nome("",25) {}
}; };
@ -66,10 +69,10 @@ TRelation* TEti_idonei_form::relation() const { return cursor()->relation(); }
void TIdonei_application::filtra_sezioni() void TIdonei_application::filtra_sezioni()
{ {
TString sezini = _msk->get(F_SEZINI); TString16 sezini = _msk->get(F_SEZINI);
TString sotini = _msk->get(F_SOTINI); TString16 sotini = _msk->get(F_SOTINI);
TString sezfin = _msk->get(F_SEZFIN); TString16 sezfin = _msk->get(F_SEZFIN);
TString sotfin = _msk->get(F_SOTFIN); TString16 sotfin = _msk->get(F_SOTFIN);
select_cursor(_cur4); select_cursor(_cur4);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
TRectype da(fl.curr()); TRectype da(fl.curr());
@ -126,92 +129,39 @@ void TIdonei_application::set_page(int file, int cnt)
bool TIdonei_application::filter_func_idonei(const TRelation * rel) bool TIdonei_application::filter_func_idonei(const TRelation * rel)
{ {
bool filtrato = TRUE; bool filtrato = TRUE;
TLocalisamfile sog = rel->lfile();
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); TAssoc_array categorie = app()._categorie;
TAssoc_array categorie;
TMask& msk = app().app_mask();
TString cat = msk.get(F_CAT1);
if (cat.not_empty() && cat.ok())
categorie.add((const char*) cat);
cat = msk.get(F_CAT2);
if (cat.not_empty() && cat.ok())
categorie.add((const char*) cat);
cat = msk.get(F_CAT3);
if (cat.not_empty() && cat.ok())
categorie.add((const char*) cat);
cat = msk.get(F_CAT4);
if (cat.not_empty() && cat.ok())
categorie.add((const char*) cat);
cat = msk.get(F_CAT5);
if (cat.not_empty() && cat.ok())
categorie.add((const char*) cat);
cat = msk.get(F_CAT6);
if (cat.not_empty() && cat.ok())
categorie.add((const char*) cat);
if (categorie.items() != 0) if (categorie.items() != 0)
{ {
TString catsog = sog->curr().get(SOG_CATDON); TString16 catsog = sog.get(SOG_CATDON);
if (categorie.is_key((const char*) catsog)) filtrato = categorie.is_key((const char*) catsog);
filtrato = TRUE;
else
filtrato = FALSE;
} }
if (filtrato) if (filtrato)
{ {
TAssoc_array idoneita; TAssoc_array idoneita;
TString idonsog = sog->curr().get(SOG_IDON1); TString16 idonsog = sog.get(SOG_IDON1);
if (idonsog.not_empty() && idonsog.ok()) if (idonsog.not_empty() && idonsog.ok())
idoneita.add((const char*) idonsog); idoneita.add((const char*) idonsog);
idonsog = sog->curr().get(SOG_IDON2); idonsog = sog.get(SOG_IDON2);
if (idonsog.not_empty() && idonsog.ok()) if (idonsog.not_empty() && idonsog.ok())
idoneita.add((const char*) idonsog); idoneita.add((const char*) idonsog);
idonsog = sog->curr().get(SOG_IDON3); idonsog = sog.get(SOG_IDON3);
if (idonsog.not_empty() && idonsog.ok()) if (idonsog.not_empty() && idonsog.ok())
idoneita.add((const char*) idonsog); idoneita.add((const char*) idonsog);
idonsog = sog->curr().get(SOG_IDON4); idonsog = sog.get(SOG_IDON4);
if (idonsog.not_empty() && idonsog.ok()) if (idonsog.not_empty() && idonsog.ok())
idoneita.add((const char*) idonsog); idoneita.add((const char*) idonsog);
if (idoneita.items() != 0) if (idoneita.items() != 0)
{ {
TString idon = msk.get(F_IDON1); if (app()._idon1.not_empty() && app()._idon1.ok())
if (idon.not_empty() && idon.ok()) filtrato = idoneita.is_key((const char*) app()._idon1);
if (idoneita.is_key((const char*) idon)) if (app()._idon2.not_empty() && app()._idon2.ok())
filtrato = TRUE; filtrato = filtrato && idoneita.is_key((const char*) app()._idon2);
else if (app()._idon3.not_empty() && app()._idon3.ok())
filtrato = FALSE; filtrato = filtrato && idoneita.is_key((const char*) app()._idon3);
if (filtrato) if (app()._idon4.not_empty() && app()._idon4.ok())
{ filtrato = filtrato && idoneita.is_key((const char*) app()._idon4);
TString idon = msk.get(F_IDON2);
if (idon.not_empty() && idon.ok())
if (idoneita.is_key((const char*) idon))
filtrato = TRUE;
else
filtrato = FALSE;
}
if (filtrato)
{
TString idon = msk.get(F_IDON3);
if (idon.not_empty() && idon.ok())
if (idoneita.is_key((const char*) idon))
filtrato = TRUE;
else
filtrato = FALSE;
}
if (filtrato)
{
TString idon = msk.get(F_IDON4);
if (idon.not_empty() && idon.ok())
if (idoneita.is_key((const char*) idon))
filtrato = TRUE;
else
filtrato = FALSE;
}
} }
} }
return filtrato; return filtrato;
@ -223,17 +173,16 @@ bool TIdonei_application::preprocess_page(int file, int counter)
// per ora non c'è // per ora non c'è
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString nome = current_cursor()->curr().get(SOG_COGNOME); TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
nome << " "; nome << " ";
nome << current_cursor()->curr().get(SOG_NOME); nome << current_cursor()->curr().get(SOG_NOME);
_cognome_nome = nome; _cognome_nome = nome;
// salto pagina se cambio sezione // salto pagina se cambio sezione
TString codsez = current_cursor()->curr().get(SOG_CODSEZ); TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot)) if ((_codsez!=codsez)||(_codsot!=codsot))
{ {
//if (!_codsez.blank())
if (_codsez != "**") if (_codsez != "**")
printer().formfeed(); printer().formfeed();
_codsez = codsez; _codsez = codsez;
@ -244,11 +193,11 @@ bool TIdonei_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
void TIdonei_application::header_sezione(TString codsez, TString codsot) void TIdonei_application::header_sezione(TString16 codsez, TString16 codsot)
{ {
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132); TString256 intestazione(132);
intestazione = "Sezione: "; intestazione = "Sezione: ";
intestazione << codsez; intestazione << codsez;
intestazione << "/"; intestazione << "/";
@ -292,14 +241,40 @@ bool TIdonei_application::set_print(int m)
filtra_sezioni(); filtra_sezioni();
// filtro per tipo idoneità // filtro per tipo idoneità
TString tipoid = _msk->get(F_TIPO); _tipoidon = _msk->get(F_TIPO);
if (tipoid.not_empty() && tipoid.ok()) if (_tipoidon.not_empty() && _tipoidon.ok())
current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)tipoid)); current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)_tipoidon));
else else
current_cursor()->setfilter("(TCS->S6 == \"I\") || (TCS->S6 == \"F\")", TRUE); current_cursor()->setfilter("(TCS->S6 == \"I\") || (TCS->S6 == \"F\")", TRUE);
// filtro per categorie // filtro per categorie
TString16 catpri = _msk->get(F_CAT1);
TString16 catsec = _msk->get(F_CAT2);
TString16 catter = _msk->get(F_CAT3);
TString16 catqua = _msk->get(F_CAT4);
TString16 catqui = _msk->get(F_CAT5);
TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_categorie.add((const char*) catses);
// filtro per idoneita
_idon1 = _msk->get(F_IDON1);
_idon2 = _msk->get(F_IDON2);
_idon3 = _msk->get(F_IDON3);
_idon4 = _msk->get(F_IDON4);
current_cursor()->set_filterfunction(filter_func_idonei); current_cursor()->set_filterfunction(filter_func_idonei);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
return TRUE; return TRUE;
@ -314,44 +289,39 @@ void TIdonei_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = "ELENCO IDONEI"; sep = "ELENCO IDONEI";
TString tipo = _msk->get(F_TIPO); if ((_tipoidon.ok()) && (_tipoidon.not_empty()))
if ((tipo.ok()) && (tipo.not_empty()))
{ {
sep << ": tipo "; sep << ": tipo ";
sep << tipo; sep << _tipoidon;
TString dtipo = _msk->get(F_D_TIPO); TString80 dtipo = _msk->get(F_D_TIPO);
sep << " "; sep << " ";
sep << dtipo; sep << dtipo;
} }
TString idon = _msk->get(F_IDON1); if ((_idon1.ok()) && (_idon1.not_empty()))
if ((idon.ok()) && (idon.not_empty()))
{ {
sep << " per "; sep << " per ";
sep << idon; sep << _idon1;
} }
idon = _msk->get(F_IDON2); if ((_idon2.ok()) && (_idon2.not_empty()))
if ((idon.ok()) && (idon.not_empty()))
{ {
sep << " "; sep << " ";
sep << idon; sep << _idon2;
} }
idon = _msk->get(F_IDON3); if ((_idon3.ok()) && (_idon3.not_empty()))
if ((idon.ok()) && (idon.not_empty()))
{ {
sep << " "; sep << " ";
sep << idon; sep << _idon3;
} }
idon = _msk->get(F_IDON4); if ((_idon4.ok()) && (_idon4.not_empty()))
if ((idon.ok()) && (idon.not_empty()))
{ {
sep << " "; sep << " ";
sep << idon; sep << _idon4;
} }
sep.center_just(); sep.center_just();
set_header(2, "@0g%s", (const char*) sep); set_header(2, "@0g%s", (const char*) sep);
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2,"@0g%10s", (const char*) data_stampa);
sep = ""; sep = "";
sep << "Pag. @#"; sep << "Pag. @#";

View File

@ -11,7 +11,6 @@
#include "at2600a.h" #include "at2600a.h"
#define ALIAS_LCP 100 #define ALIAS_LCP 100
//#define ALIAS_TCS 200
#define ISCRITTI 'I' #define ISCRITTI 'I'
enum ts { undefined = 0, elenco = 1, etichette = 2 }; enum ts { undefined = 0, elenco = 1, etichette = 2 };
@ -36,15 +35,17 @@ class TIscritti_application : public TPrintapp
TMask* _msk; TMask* _msk;
TEti_iscritti_form* _form_eti; TEti_iscritti_form* _form_eti;
TAssoc_array _categorie;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome; TParagraph_string _cognome_nome;
TDate _data_stampa; TDate _data_stampa;
ts _tipo_stampa; ts _tipo_stampa;
TString _codsez, _codsot; TString16 _codsez, _codsot;
char _tipo_iscdim; // iscritti o dimessi char _tipo_iscdim; // iscritti o dimessi
TDate _dataini, _datafin; TDate _dataini, _datafin;
static bool filter_func_iscritti(const TRelation *); static bool filter_func_iscritti(const TRelation* rel);
protected: protected:
virtual bool user_create(); virtual bool user_create();
@ -56,7 +57,7 @@ protected:
public: public:
void crea_intestazione(); void crea_intestazione();
void filtra_sezioni(); void filtra_sezioni();
void header_sezione(TString codsez, TString codsot); void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; } TMask& app_mask() { return *_msk; }
TIscritti_application() : _data_stampa(TODAY), _cognome_nome("",25) {} TIscritti_application() : _data_stampa(TODAY), _cognome_nome("",25) {}
}; };
@ -69,10 +70,10 @@ TRelation* TEti_iscritti_form::relation() const { return cursor()->relation(); }
void TIscritti_application::filtra_sezioni() void TIscritti_application::filtra_sezioni()
{ {
TString sezini = _msk->get(F_SEZINI); TString16 sezini = _msk->get(F_SEZINI);
TString sotini = _msk->get(F_SOTINI); TString16 sotini = _msk->get(F_SOTINI);
TString sezfin = _msk->get(F_SEZFIN); TString16 sezfin = _msk->get(F_SEZFIN);
TString sotfin = _msk->get(F_SOTFIN); TString16 sotfin = _msk->get(F_SOTFIN);
select_cursor(_cur4); select_cursor(_cur4);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
TRectype da(fl.curr()); TRectype da(fl.curr());
@ -124,66 +125,25 @@ void TIscritti_application::set_page(int file, int cnt)
bool TIscritti_application::filter_func_iscritti(const TRelation * rel) bool TIscritti_application::filter_func_iscritti(const TRelation * rel)
{ {
bool filtrato = TRUE; bool filtrato = TRUE;
TLocalisamfile sog = rel->lfile();
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); TAssoc_array categorie = app()._categorie;
TAssoc_array categorie;
TMask& msk = app().app_mask();
TString catpri = msk.get(F_CAT1);
TString catsec = msk.get(F_CAT2);
TString catter = msk.get(F_CAT3);
TString catqua = msk.get(F_CAT4);
TString catqui = msk.get(F_CAT5);
TString catses = msk.get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
categorie.add((const char*) catses);
if (categorie.items() != 0) if (categorie.items() != 0)
{ {
TString cat = sog->curr().get(SOG_CATDON); TString16 cat = sog.get(SOG_CATDON);
if (categorie.is_key((const char*) cat)) filtrato = categorie.is_key((const char*) cat);
filtrato = TRUE;
else
filtrato = FALSE;
} }
if (filtrato) if (filtrato)
{ {
TRectype from (sog->curr());
TRectype to (sog->curr());
from.zero();
to.zero();
if (app()._tipo_iscdim == ISCRITTI) if (app()._tipo_iscdim == ISCRITTI)
{ {
from.put(SOG_DATAISC, app()._dataini); TDate dataisc = sog.get(SOG_DATAISC);
to.put(SOG_DATAISC, app()._datafin); filtrato = (dataisc >= app()._dataini && dataisc <= app()._datafin);
if ((sog->curr() >= from) && (sog->curr() <= to))
filtrato = TRUE;
else
filtrato = FALSE;
} }
else else
{ {
from.put(SOG_DATADIM, app()._dataini); TDate datadim = sog.get(SOG_DATADIM);
to.put(SOG_DATADIM, app()._datafin); filtrato = (datadim >= app()._dataini && datadim <= app()._datafin);
if ((sog->curr() >= from) && (sog->curr() <= to))
filtrato = TRUE;
else
filtrato = FALSE;
} }
} }
return filtrato; return filtrato;
@ -195,17 +155,16 @@ bool TIscritti_application::preprocess_page(int file, int counter)
// per ora non c'è // per ora non c'è
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString nome = current_cursor()->curr().get(SOG_COGNOME); TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
nome << " "; nome << " ";
nome << current_cursor()->curr().get(SOG_NOME); nome << current_cursor()->curr().get(SOG_NOME);
_cognome_nome = nome; _cognome_nome = nome;
// salto pagina se cambio sezione // salto pagina se cambio sezione
TString codsez = current_cursor()->curr().get(SOG_CODSEZ); TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot)) if ((_codsez!=codsez)||(_codsot!=codsot))
{ {
//if (!_codsez.blank())
if (_codsez != "**") if (_codsez != "**")
printer().formfeed(); printer().formfeed();
_codsez = codsez; _codsez = codsez;
@ -216,11 +175,11 @@ bool TIscritti_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
void TIscritti_application::header_sezione(TString codsez, TString codsot) void TIscritti_application::header_sezione(TString16 codsez, TString16 codsot)
{ {
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132); TString256 intestazione(132);
intestazione = "Sezione: "; intestazione = "Sezione: ";
intestazione << codsez; intestazione << codsez;
intestazione << "/"; intestazione << "/";
@ -259,15 +218,34 @@ bool TIscritti_application::set_print(int m)
{ {
reset_files(); reset_files();
add_file(LF_SOGGETTI); add_file(LF_SOGGETTI);
// filtro per sezioni
_tipo_iscdim = _msk->get(F_TIPO)[0];
_dataini = _msk->get(F_DATAINI);
_datafin = _msk->get(F_DATAFIN);
// filtro per sezioni selezionati
filtra_sezioni(); filtra_sezioni();
// filtro per categorie
// filtro per categorie TString16 catpri = _msk->get(F_CAT1);
TString16 catsec = _msk->get(F_CAT2);
TString16 catter = _msk->get(F_CAT3);
TString16 catqua = _msk->get(F_CAT4);
TString16 catqui = _msk->get(F_CAT5);
TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && catpri.ok())
_categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
_categorie.add((const char*) catsec);
if (catter.not_empty() && catter.ok())
_categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok())
_categorie.add((const char*) catqua);
if (catqui.not_empty() && catqui.ok())
_categorie.add((const char*) catqui);
if (catses.not_empty() && catses.ok())
_categorie.add((const char*) catses);
// filtro per iscritti/dimessi e date
_tipo_iscdim = _msk->get(F_TIPO)[0];
_dataini = _msk->get(F_DATAINI);
_datafin = _msk->get(F_DATAFIN);
current_cursor()->set_filterfunction(filter_func_iscritti); current_cursor()->set_filterfunction(filter_func_iscritti);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
return TRUE; return TRUE;
@ -282,7 +260,7 @@ void TIscritti_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = "ELENCO "; sep = "ELENCO ";
if (_tipo_iscdim == ISCRITTI) if (_tipo_iscdim == ISCRITTI)
sep << "ISCRITTI"; sep << "ISCRITTI";
@ -300,7 +278,7 @@ void TIscritti_application::crea_intestazione()
} }
sep.center_just(); sep.center_just();
set_header(2, "@0g%s", (const char*) sep); set_header(2, "@0g%s", (const char*) sep);
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2,"@0g%10s", (const char*) data_stampa);
sep = ""; sep = "";
sep << "Pag. @#"; sep << "Pag. @#";

View File

@ -3,7 +3,7 @@
#include "at3.h" #include "at3.h"
#define usage "Error - usage : %s -[0,1,2,3,4]" #define usage "Error - usage : %s -[0,1,2,3,4,5]"
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -22,6 +22,8 @@ int main(int argc, char** argv)
rt = at3400(argc, argv); break; rt = at3400(argc, argv); break;
case 4: case 4:
rt = at3500(argc, argv); break; rt = at3500(argc, argv); break;
case 5:
rt = at3600(argc, argv); break;
default: default:
error_box(usage, argv[0]) ; rt = 1; break; error_box(usage, argv[0]) ; rt = 1; break;
} }

View File

@ -1,11 +1,12 @@
#ifndef __AT3_H #ifndef __AT3_H
#define __AT3_H #define __AT3_H
int at3100(int argc, char* argv[]); // convocazioni int at3100(int argc, char* argv[]); // convocazioni
int at3200(int argc, char* argv[]); // tessere e pagine int at3200(int argc, char* argv[]); // tessere e pagine
int at3300(int argc, char* argv[]); // urgenze int at3300(int argc, char* argv[]); // urgenze
int at3400(int argc, char* argv[]); // elenco soggetti modificati int at3400(int argc, char* argv[]); // elenco soggetti modificati
int at3500(int argc, char* argv[]); // scadenze di donazione int at3500(int argc, char* argv[]); // scadenze di donazione
int at3600(int argc, char* argv[]); // convocazioni su punto di raccolta
#endif // __AT3_H
#endif // __AT3_H

View File

@ -10,16 +10,14 @@
#include "at3.h" #include "at3.h"
#include "at3100a.h" #include "at3100a.h"
#define ALIAS_TABCTD 100 // alias tabella categorie donatori #define ALIAS_TABCTD 100 // alias tabella categorie donatori
#define ALIAS_TABTCS 200 // alias tabella tipi/esiti controlli sanitari #define ALIAS_TABTCS 200 // alias tabella tipi/esiti controlli sanitari
#define ALIAS_TABLCP 300 // alias tabella località postali #define ALIAS_TABLCP 300 // alias tabella località postali
#define STATO_IDONEO 'I' // IDONEITA' #define STATO_IDONEO 'I' // IDONEITA'
#define STATO_FINESO 'F' // FINE SOSPENSIONE #define STATO_FINESO 'F' // FINE SOSPENSIONE
enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 }; enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 }; //tipi di stampe
// definizione form per etichette e cartoline // definizione form per etichette e cartoline
class TConv_form : public TForm class TConv_form : public TForm
@ -43,9 +41,7 @@ class TConv_application : public TPrintapp
TMask* _msk; TMask* _msk;
TConv_form* _form_eti; // per etichette TConv_form* _form_eti; // per etichette
TConv_form* _form_car; // per cartoline TConv_form* _form_car; // per cartoline
TAssoc_array _asezioni;
TAssoc_array* _asezioni; // array per controllare che non venga convocata
// 2 volte la stessa sezione/sottogruppo
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TDate _data_stampa; TDate _data_stampa;
@ -55,7 +51,7 @@ class TConv_application : public TPrintapp
bool _intesta; bool _intesta;
// completare con tutti i dati selezionabili // completare con tutti i dati selezionabili
TString _codsez, _codsot; TString16 _codsez, _codsot;
TDate _dataconv; TDate _dataconv;
long _intmin, _intmax; long _intmin, _intmax;
@ -68,7 +64,6 @@ protected:
virtual void print(); virtual void print();
virtual bool preprocess_page (int file, int counter); virtual bool preprocess_page (int file, int counter);
virtual TAssoc_array& get_array_sez() { return *_asezioni; }
static bool check_sez_sheet(const char* codice); static bool check_sez_sheet(const char* codice);
static bool convocazioni_notify(TSheet_field& s, int r, KEY k); static bool convocazioni_notify(TSheet_field& s, int r, KEY k);
static void add_rows_convocazioni(TSheet_field& s, int count = 10, int start = 1); static void add_rows_convocazioni(TSheet_field& s, int count = 10, int start = 1);
@ -154,8 +149,8 @@ void TConv_application::set_page(int file, int cnt)
bool TConv_application::filter_func_conv (const TRelation * rel) bool TConv_application::filter_func_conv (const TRelation * rel)
{ {
TLocalisamfile& sog = rel->lfile(LF_SOGGETTI); TLocalisamfile& sog = rel->lfile();
TDate dataprossi = sog.curr().get_date(SOG_DATAPROSSI); TDate dataprossi = sog.get_date(SOG_DATAPROSSI);
const char stato = rel->curr(-ALIAS_TABTCS).get_char("S6"); const char stato = rel->curr(-ALIAS_TABTCS).get_char("S6");
const bool dimesso = rel->curr(-ALIAS_TABCTD).get_char("B0"); const bool dimesso = rel->curr(-ALIAS_TABCTD).get_char("B0");
@ -210,11 +205,11 @@ void TConv_application::filtra_sezione()
_codsot = row.get(); _codsot = row.get();
_dataconv = row.get(); _dataconv = row.get();
// deve diventare un membro // deve diventare un membro
TString _giorno = row.get(); TString16 _giorno = row.get();
_intmin = row.get_int(); _intmin = row.get_int();
_intmax = row.get_int(); _intmax = row.get_int();
// deve diventare un membro // deve diventare un membro
TString _tipoconv = row.get(); TString16 _tipoconv = row.get();
select_cursor(_cur4); select_cursor(_cur4);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
@ -241,15 +236,15 @@ bool TConv_application::set_print(int)
TSheet_field& s = (TSheet_field&)_msk->field(F_CONVOCAZIONI); TSheet_field& s = (TSheet_field&)_msk->field(F_CONVOCAZIONI);
if (s.items()==0) if (s.items()==0)
add_rows_convocazioni(s,8); add_rows_convocazioni(s,8);
_asezioni->destroy(); _asezioni.destroy();
for (int r=0; r < s.items(); r++) for (int r=0; r < s.items(); r++)
{ {
TToken_string& row = s.row(r); TToken_string& row = s.row(r);
TString codice = row.get(0); TString16 codice = row.get(0);
TString codsot = row.get(); TString16 codsot = row.get();
codice << codsot; codice << codsot;
if (codice.not_empty()) if (codice.not_empty())
_asezioni->add(codice); _asezioni.add(codice);
} }
_tipo_stampa = undefined; _tipo_stampa = undefined;
KEY tasto; KEY tasto;
@ -307,7 +302,7 @@ void TConv_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = ""; sep = "";
sep.fill('-'); sep.fill('-');
set_header(3, (const char *) sep); set_header(3, (const char *) sep);
@ -320,9 +315,9 @@ void TConv_application::crea_intestazione()
void TConv_application::header_sezione() void TConv_application::header_sezione()
{ {
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132); TString256 intestazione(132);
intestazione = "Sezione: "; intestazione = "Sezione: ";
intestazione << _codsez; intestazione << _codsez;
intestazione << "/"; intestazione << "/";
@ -341,7 +336,7 @@ void TConv_application::header_sezione()
intestazione << _dataconv.string(); intestazione << _dataconv.string();
intestazione.center_just(); intestazione.center_just();
set_header(2, "@0g%s", (const char*) intestazione); set_header(2, "@0g%s", (const char*) intestazione);
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); set_header(2,"@0g%10s", (const char*) data_stampa);
intestazione = ""; intestazione = "";
intestazione << "Pag. @#"; intestazione << "Pag. @#";
@ -370,8 +365,6 @@ bool TConv_application::user_create()
_form_eti = new TConv_form("AT_ETSOG"); _form_eti = new TConv_form("AT_ETSOG");
_form_car = new TConv_form("AT_CARTO"); _form_car = new TConv_form("AT_CARTO");
_asezioni = new TAssoc_array();
return TRUE; return TRUE;
} }
@ -381,18 +374,17 @@ bool TConv_application::user_destroy()
delete _rel; delete _rel;
delete _form_eti; delete _form_eti;
delete _form_car; delete _form_car;
delete _asezioni;
return TRUE; return TRUE;
} }
bool TConv_application::check_sez_sheet(const char* codice) bool TConv_application::check_sez_sheet(const char* codice)
{ {
TAssoc_array& array_sez = app().get_array_sez(); TAssoc_array& sez = app()._asezioni;
if (array_sez.is_key(codice)) if (sez.is_key(codice))
return FALSE; return FALSE;
else else
{ {
array_sez.add(codice); sez.add(codice);
return TRUE; return TRUE;
} }
} }
@ -407,12 +399,12 @@ bool TConv_application::convocazioni_notify(TSheet_field& s, int r, KEY k)
// entrata riga // entrata riga
{ {
TToken_string& row = s.row(r); TToken_string& row = s.row(r);
TString codice = row.get(0); TString16 codice = row.get(0);
TString codsot = row.get(); TString16 codsot = row.get();
codice << codsot; codice << codsot;
if (codice.not_empty()) if (codice.not_empty())
{ {
TAssoc_array& array_sez = app().get_array_sez(); TAssoc_array& array_sez = app()._asezioni;
if (array_sez.is_key(codice)) if (array_sez.is_key(codice))
array_sez.remove(codice); array_sez.remove(codice);
} }
@ -427,8 +419,8 @@ bool TConv_application::convocazioni_notify(TSheet_field& s, int r, KEY k)
// uscita riga // uscita riga
{ {
TToken_string& row = s.row(r); TToken_string& row = s.row(r);
TString codice = row.get(0); TString16 codice = row.get(0);
TString codsot = row.get(); TString16 codsot = row.get();
codice << codsot; codice << codsot;
if (codice.not_empty()) if (codice.not_empty())
{ {

View File

@ -82,7 +82,7 @@ void TTessere_application::set_page(int file, int cnt)
break; break;
case tessere: case tessere:
{ {
TString data_stampa = _data_stampa.string(); TString16 data_stampa = _data_stampa.string();
set_row(3, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSEZ)); set_row(3, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSEZ));
set_row(4, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSOT)); set_row(4, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSOT));
set_row(9,"@33g%s@1j@pn", "Cod. prov.",FLD(LF_SOGGETTI,SOG_CODICE,"#########")); set_row(9,"@33g%s@1j@pn", "Cod. prov.",FLD(LF_SOGGETTI,SOG_CODICE,"#########"));
@ -93,7 +93,7 @@ void TTessere_application::set_page(int file, int cnt)
set_row(18,"@45g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(18,"@45g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(20,"@10g@ls@1j@2s",FLD(-ALIAS_COMRES,COM_DENCOM),FLD(-ALIAS_COMRES,COM_PROVCOM)); set_row(20,"@10g@ls@1j@2s",FLD(-ALIAS_COMRES,COM_DENCOM),FLD(-ALIAS_COMRES,COM_PROVCOM));
set_row(20,"@45g@15ls", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(20,"@45g@15ls", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(22,"@2g@50ls", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); set_row(22,"@2g@50ls", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(24,"@10g@16ls", FLD(LF_SOGGETTI,SOG_CF)); set_row(24,"@10g@16ls", FLD(LF_SOGGETTI,SOG_CF));
set_row(28,"@4g@4ls", FLD(LF_SOGGETTI,SOG_GRUPPOAB0)); set_row(28,"@4g@4ls", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
set_row(28,"@17g@3ls", FLD(LF_SOGGETTI,SOG_RHANTID)); set_row(28,"@17g@3ls", FLD(LF_SOGGETTI,SOG_RHANTID));
@ -155,8 +155,8 @@ bool TTessere_application::set_print(int m)
void TTessere_application::crea_intestazione() void TTessere_application::crea_intestazione()
{ {
TString sep(132); TString256 sep(132);
TString data_stampa; TString16 data_stampa;
reset_header(); reset_header();

View File

@ -1,373 +1,370 @@
#include <mask.h> #include <mask.h>
#include <form.h> #include <form.h>
#include <printapp.h> #include <printapp.h>
#include "lf.h" #include "lf.h"
#include "soggetti.h" #include "soggetti.h"
#include "sezioni.h" #include "sezioni.h"
#include <comuni.h> #include <comuni.h>
#include "at3.h" #include "at3.h"
#include "at3300a.h" #include "at3300a.h"
#define ALIAS_LCP 100 #define ALIAS_LCP 100
#define ALIAS_TCS 200 #define ALIAS_TCS 200
enum ts { undefined = 0, elenco = 1, etichette = 2 }; enum ts { undefined = 0, elenco = 1, etichette = 2 };
// definizione form per etichette // definizione form per etichette
class TUrgenze_form : public TForm class TUrgenze_form : public TForm
{ {
public: public:
virtual TCursor* cursor() const; virtual TCursor* cursor() const;
virtual TRelation* relation() const; virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ; TPrint_section& get_body() { return section('B'); } ;
TUrgenze_form(): TForm() {}; TUrgenze_form(): TForm() {};
TUrgenze_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") TUrgenze_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {}; : TForm(form,code,editlevel,desc) {};
virtual ~TUrgenze_form() {}; virtual ~TUrgenze_form() {};
}; };
class TUrgenze_application : public TPrintapp class TUrgenze_application : public TPrintapp
{ {
static bool filter_func_urgenze(const TRelation *); static bool filter_func_urgenze(const TRelation *);
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TUrgenze_form* _form_eti; TUrgenze_form* _form_eti;
TRectype* _sangue;
int _cur1, _cur2, _cur3, _cur4; TAssoc_array _categorie;
TParagraph_string _cognome_nome, _dencom; long _giorni;
TDate _data_stampa; int _cur1, _cur2, _cur3, _cur4;
TDate _dataini, _datafin; TParagraph_string _cognome_nome, _dencom;
ts _tipo_stampa;
TString _codsez, _codsot; TDate _data_stampa;
TDate _dataini, _datafin;
ts _tipo_stampa;
protected: TString16 _codsez, _codsot;
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int m); protected:
virtual void set_page(int file, int cnt); virtual bool user_create();
virtual bool preprocess_page (int file, int counter); virtual bool user_destroy();
virtual bool set_print(int m);
public: virtual void set_page(int file, int cnt);
void crea_intestazione(); virtual bool preprocess_page (int file, int counter);
void filtra_sezioni();
void header_sezione(TString codsez, TString codsot); public:
TMask& app_mask() { return *_msk; } void crea_intestazione();
void filtra_sezioni();
TUrgenze_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} void header_sezione(TString16 codsez, TString16 codsot);
}; TMask& app_mask() { return *_msk; }
TRectype& get_sangue() { return *_sangue; }
HIDDEN inline TUrgenze_application& app() { return (TUrgenze_application&) main_app(); }
TUrgenze_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
TCursor* TUrgenze_form::cursor() const { return app().current_cursor(); } };
TRelation* TUrgenze_form::relation() const { return cursor()->relation(); } HIDDEN inline TUrgenze_application& app() { return (TUrgenze_application&) main_app(); }
void TUrgenze_application::filtra_sezioni() TCursor* TUrgenze_form::cursor() const { return app().current_cursor(); }
{
TString sezini = _msk->get(F_SEZINI); TRelation* TUrgenze_form::relation() const { return cursor()->relation(); }
TString sotini = _msk->get(F_SOTINI);
TString sezfin = _msk->get(F_SEZFIN); void TUrgenze_application::filtra_sezioni()
TString sotfin = _msk->get(F_SOTFIN); {
select_cursor(_cur4); TString16 sezini = _msk->get(F_SEZINI);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); TString16 sotini = _msk->get(F_SOTINI);
TRectype da(fl.curr()); TString16 sezfin = _msk->get(F_SEZFIN);
TRectype a(fl.curr()); TString16 sotfin = _msk->get(F_SOTFIN);
da.zero(); select_cursor(_cur4);
a.zero(); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
if ((sezini.not_empty()) && (sezini.ok())) TRectype da(fl.curr());
da.put(SOG_CODSEZ, sezini); TRectype a(fl.curr());
if ((sotini.not_empty()) && (sotini.ok())) da.zero();
da.put(SOG_CODSOT, sotini); a.zero();
if ((sezfin.not_empty()) && (sezfin.ok())) if ((sezini.not_empty()) && (sezini.ok()))
a.put(SOG_CODSEZ, sezfin); da.put(SOG_CODSEZ, sezini);
if ((sotfin.not_empty()) && (sotfin.ok())) if ((sotini.not_empty()) && (sotini.ok()))
a.put(SOG_CODSOT, sotfin); da.put(SOG_CODSOT, sotini);
current_cursor()->setregion(da, a); if ((sezfin.not_empty()) && (sezfin.ok()))
} a.put(SOG_CODSEZ, sezfin);
if ((sotfin.not_empty()) && (sotfin.ok()))
void TUrgenze_application::set_page(int file, int cnt) a.put(SOG_CODSOT, sotfin);
{ current_cursor()->setregion(da, a);
switch (_tipo_stampa) }
{
case etichette: void TUrgenze_application::set_page(int file, int cnt)
{ {
TPrint_section& corpo = _form_eti->get_body(); switch (_tipo_stampa)
corpo.reset(); {
corpo.update(); case etichette:
for (int i = 0; i < corpo.height(); i++) {
{ TPrint_section& corpo = _form_eti->get_body();
TPrintrow& riga = corpo.row(i); corpo.reset();
set_row(i+1,riga); corpo.update();
} for (int i = 0; i < corpo.height(); i++)
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage {
// altrimenti stampa sempre la stessa etichetta TPrintrow& riga = corpo.row(i);
} set_row(i+1,riga);
break; }
case elenco: force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
{ // altrimenti stampa sempre la stessa etichetta
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######")); }
set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); break;
set_row(1,"@10g#a", &_cognome_nome); case elenco:
set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); {
set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######"));
set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(1,"@10g#a", &_cognome_nome);
set_row(2,"@47g#a", &_dencom); set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT)); set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(2,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON)); set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI));
} set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
break; set_row(2,"@47g#a", &_dencom);
} set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT));
} set_row(2,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
}
bool TUrgenze_application::filter_func_urgenze(const TRelation * rel) break;
{ }
bool filtrato = TRUE; }
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI)); bool TUrgenze_application::filter_func_urgenze(const TRelation * rel)
{
//filtro per categorie bool filtrato = TRUE;
TMask& msk = app().app_mask(); TLocalisamfile& sog = rel->lfile();
TString catpri = msk.get(F_CAT1);
TString catsec = msk.get(F_CAT2); //filtro per categorie
TString catter = msk.get(F_CAT3); TAssoc_array& categorie = app()._categorie;
TString catqua = msk.get(F_CAT4); if (categorie.items() != 0)
TString catqui = msk.get(F_CAT5); {
TString catses = msk.get(F_CAT6); TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
TAssoc_array categorie; }
if (catpri.not_empty() && catpri.ok()) // filtro per tipizzazione
categorie.add((const char*) catpri); if (filtrato)
if (catsec.not_empty() && catsec.ok()) {
categorie.add((const char*) catsec); TRectype from = app().get_sangue();
if (catter.not_empty() && catter.ok()) filtrato = (sog.curr()==from);
categorie.add((const char*) catter); }
if (catqua.not_empty() && catqua.ok()) // filtro su data donazione
categorie.add((const char*) catqua); if (filtrato)
if (catqui.not_empty() && catqui.ok()) {
categorie.add((const char*) catqui); long giorni_sez = rel->lfile(LF_SEZIONI).get_long(SEZ_INTMINCONV);
if (catses.not_empty() && catses.ok()) long giorni = (giorni_sez > app()._giorni) ? giorni_sez : app()._giorni;
categorie.add((const char*) catses); TRectype from = sog.curr();
from.zero();
if (categorie.items() != 0) TDate data(TODAY);
{ data = data - (const long) giorni;
TString cat = sog->curr().get(SOG_CATDON); from.put(SOG_DATAULTDON, data);
if (categorie.is_key((const char*) cat)) filtrato = (sog.curr()<= from);
filtrato = TRUE; }
else return filtrato;
filtrato = FALSE; }
}
TRectype from (sog->curr()); bool TUrgenze_application::preprocess_page(int file, int counter)
if (filtrato) {
{ // contatore soggetti stampati
// filtro per tipizzazione // per ora non c'è
from.zero(); if (_tipo_stampa == elenco)
TString gruppoab0 = msk.get(F_GRUPPOAB0); {
TString rhantid = msk.get(F_RHANTID); TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
TString kell = msk.get(F_KELL); nome << " ";
TString fenotiporh = msk.get(F_FENOTIPORH); nome << current_cursor()->curr().get(SOG_NOME);
TString du = msk.get(F_DU); _cognome_nome = nome;
TString256 localita = "";
if ((gruppoab0.ok()) && (gruppoab0.not_empty())) localita << current_cursor()->curr(-ALIAS_LCP).get("S6");
from.put(SOG_GRUPPOAB0, gruppoab0); if (localita.not_empty() && localita.ok())
if ((rhantid.ok()) && (rhantid.not_empty())) {
from.put(SOG_RHANTID, rhantid); localita << " ";
if ((kell.ok()) && (kell.not_empty())) localita << current_cursor()->curr(-ALIAS_LCP).get("S0");
from.put(SOG_KELL, kell); localita << " - ";
if ((fenotiporh.ok()) && (fenotiporh.not_empty())) }
from.put(SOG_FENOTIPORH, fenotiporh); else
if ((du.ok()) && (du.not_empty())) {
from.put(SOG_DU, du); localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM);
if (sog->curr()==from) localita << " ";
filtrato = TRUE; }
else localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
filtrato = FALSE; localita.trim();
} _dencom = localita;
// filtro su data donazione
if (filtrato) // salto pagina se cambio sezione
{ TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
long giorni = msk.get_long(F_GIORNI); TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
long giorni_sez = rel->lfile(LF_SEZIONI).curr().get_long(SEZ_INTMINCONV); if ((_codsez!=codsez)||(_codsot!=codsot))
{
giorni = (giorni_sez > giorni) ? giorni_sez : giorni; //if (!_codsez.blank())
from.zero(); if (_codsez != "**")
TDate data(TODAY); printer().formfeed();
data = data - (const long) giorni; _codsez = codsez;
from.put(SOG_DATAULTDON, data); _codsot = codsot;
if ((sog->curr()<= from)) header_sezione(codsez, codsot);
filtrato = TRUE; }
else }
filtrato = FALSE; return TRUE;
} }
return filtrato;
} void TUrgenze_application::header_sezione(TString16 codsez, TString16 codsot)
{
bool TUrgenze_application::preprocess_page(int file, int counter) TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
{ TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
// contatore soggetti stampati TString256 intestazione(132);
// per ora non c'è intestazione = "Sezione: ";
if (_tipo_stampa == elenco) intestazione << codsez;
{ intestazione << "/";
TString nome = current_cursor()->curr().get(SOG_COGNOME); intestazione << codsot;
nome << " "; intestazione << " ";
nome << current_cursor()->curr().get(SOG_NOME); intestazione << densez;
_cognome_nome = nome; if ((densot.ok())&& (densot.not_empty()))
TString localita = ""; {
localita << current_cursor()->curr(-ALIAS_LCP).get("S6"); intestazione << "/";
if (localita.not_empty() && localita.ok()) intestazione << densot;
{ }
localita << " "; intestazione.center_just();
localita << current_cursor()->curr(-ALIAS_LCP).get("S0"); set_header(1,"@0g%s", (const char*) intestazione);
localita << " - "; return;
} }
else
{ bool TUrgenze_application::set_print(int)
localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM); {
localita << " "; _tipo_stampa = undefined;
} KEY tasto;
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM); tasto = _msk->run();
localita.trim(); switch (tasto)
_dencom = localita; {
case F_ELENCO:
// salto pagina se cambio sezione _tipo_stampa = elenco;
TString codsez = current_cursor()->curr().get(SOG_CODSEZ); //_codsez.spaces(2);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); //_codsot.spaces(2);
if ((_codsez!=codsez)||(_codsot!=codsot)) _codsez = "**";
{ _codsot = "**";
//if (!_codsez.blank()) break;
if (_codsez != "**") case F_ETICHETTE:
printer().formfeed(); _tipo_stampa = etichette;
_codsez = codsez; break;
_codsot = codsot; }
header_sezione(codsez, codsot); if (_tipo_stampa != undefined)
} {
} reset_files();
return TRUE; add_file(LF_SOGGETTI);
} filtra_sezioni();
void TUrgenze_application::header_sezione(TString codsez, TString codsot) // filtro per categorie
{ TString16 catpri = _msk->get(F_CAT1);
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); TString16 catsec = _msk->get(F_CAT2);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); TString16 catter = _msk->get(F_CAT3);
TString intestazione(132); TString16 catqua = _msk->get(F_CAT4);
intestazione = "Sezione: "; TString16 catqui = _msk->get(F_CAT5);
intestazione << codsez; TString16 catses = _msk->get(F_CAT6);
intestazione << "/"; if (catpri.not_empty() && catpri.ok())
intestazione << codsot; _categorie.add((const char*) catpri);
intestazione << " "; if (catsec.not_empty() && catsec.ok())
intestazione << densez; _categorie.add((const char*) catsec);
if ((densot.ok())&& (densot.not_empty())) if (catter.not_empty() && catter.ok())
{ _categorie.add((const char*) catter);
intestazione << "/"; if (catqua.not_empty() && catqua.ok())
intestazione << densot; _categorie.add((const char*) catqua);
} if (catqui.not_empty() && catqui.ok())
intestazione.center_just(); _categorie.add((const char*) catqui);
set_header(1,"@0g%s", (const char*) intestazione); if (catses.not_empty() && catses.ok())
return; _categorie.add((const char*) catses);
}
// filtro per tipizzazione
bool TUrgenze_application::set_print(int) _sangue->zero();
{ TString16 gruppoab0 = _msk->get(F_GRUPPOAB0);
_tipo_stampa = undefined; TString16 rhantid = _msk->get(F_RHANTID);
KEY tasto; TString16 kell = _msk->get(F_KELL);
tasto = _msk->run(); TString16 fenotiporh = _msk->get(F_FENOTIPORH);
switch (tasto) TString16 du = _msk->get(F_DU);
{ if ((gruppoab0.ok()) && (gruppoab0.not_empty()))
case F_ELENCO: _sangue->put(SOG_GRUPPOAB0, gruppoab0);
_tipo_stampa = elenco; if ((rhantid.ok()) && (rhantid.not_empty()))
//_codsez.spaces(2); _sangue->put(SOG_RHANTID, rhantid);
//_codsot.spaces(2); if ((kell.ok()) && (kell.not_empty()))
_codsez = "**"; _sangue->put(SOG_KELL, kell);
_codsot = "**"; if ((fenotiporh.ok()) && (fenotiporh.not_empty()))
break; _sangue->put(SOG_FENOTIPORH, fenotiporh);
case F_ETICHETTE: if ((du.ok()) && (du.not_empty()))
_tipo_stampa = etichette; _sangue->put(SOG_DU, du);
break;
} long giorni = _msk->get_long(F_GIORNI);
if (_tipo_stampa != undefined)
{ // filtra solo idonei
reset_files(); current_cursor()->setfilter("TCS->S6 == \"I\"", TRUE);
add_file(LF_SOGGETTI); // filtra per categorie, tipizzazione e data donazione
filtra_sezioni(); current_cursor()->set_filterfunction (filter_func_urgenze, TRUE);
reset_print();
// filtra solo idonei crea_intestazione();
current_cursor()->setfilter("TCS->S6 == \"I\"", TRUE); return TRUE;
// filtra per tipizzazione e data donazione }
current_cursor()->set_filterfunction (filter_func_urgenze, TRUE); else
reset_print(); return FALSE;
crea_intestazione(); }
return TRUE;
} void TUrgenze_application::crea_intestazione()
else {
return FALSE; reset_header();
}
if (_tipo_stampa == elenco)
void TUrgenze_application::crea_intestazione() {
{ TString256 sep(132);
reset_header(); sep = "CONVOCAZIONI URGENTI";
sep.center_just();
if (_tipo_stampa == elenco) set_header(2, "@0g%s", (const char*) sep);
{ TString16 data_stampa = _data_stampa.string();
TString sep(132); set_header(2,"@0g%10s", (const char*) data_stampa);
sep = "CONVOCAZIONI URGENTI"; sep = "";
sep.center_just(); sep << "Pag. @#";
set_header(2, "@0g%s", (const char*) sep); set_header(2, "@120g%s", (const char*) sep);
TString data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa); sep = "";
sep = ""; sep.fill('-');
sep << "Pag. @#"; set_header(3, (const char *) sep);
set_header(2, "@120g%s", (const char*) sep);
set_header(4,"@0gCod.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro");
sep = ""; set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro");
sep.fill('-'); set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------");
set_header(3, (const char *) sep); }
}
set_header(4,"@0gCod.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro");
set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro"); bool TUrgenze_application::user_create()
set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------"); {
} _rel = new TRelation(LF_SOGGETTI);
} _rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP);
bool TUrgenze_application::user_create() _rel->add(LF_COMUNI, "COM==COM");
{ // per stampare nell'intestazione la denominazione della sezione
_rel = new TRelation(LF_SOGGETTI); _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
_rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP); _cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice
_rel->add(LF_COMUNI, "COM==COM"); _cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome
// per stampare nell'intestazione la denominazione della sezione _cur3 = add_cursor(new TCursor(_rel, "", 3)); //cursore ordinamento per sezione+sottogruppo+codice
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); _cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome
_cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice _form_eti = new TUrgenze_form("AT_ETSOG");
_cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome _msk = new TMask("at3300a");
_cur3 = add_cursor(new TCursor(_rel, "", 3)); //cursore ordinamento per sezione+sottogruppo+codice _sangue = new TRectype(LF_SOGGETTI);
_cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome return TRUE;
}
_form_eti = new TUrgenze_form("AT_ETSOG");
_msk = new TMask("at3300a"); bool TUrgenze_application::user_destroy()
return TRUE; {
} delete _msk;
delete _rel;
bool TUrgenze_application::user_destroy() delete _form_eti;
{ delete _sangue;
delete _msk; return TRUE;
delete _rel; }
delete _form_eti;
return TRUE; int at3300(int argc, char* argv[])
} {
int at3300(int argc, char* argv[]) TUrgenze_application a;
{
a.run(argc, argv, "Urgenze");
TUrgenze_application a;
return 0;
a.run(argc, argv, "Urgenze"); }
return 0;
}

View File

@ -1,350 +1,336 @@
#include <mask.h> #include <mask.h>
#include <form.h> #include <form.h>
#include <printapp.h> #include <printapp.h>
#include "lf.h" #include "lf.h"
#include "soggetti.h" #include "soggetti.h"
#include "sezioni.h" #include "sezioni.h"
#include <comuni.h> #include <comuni.h>
#include "at3.h" #include "at3.h"
#include "at3400a.h" #include "at3400a.h"
#define ALIAS_LCP 100 #define ALIAS_LCP 100
//#define ALIAS_TCS 200 //#define ALIAS_TCS 200
enum ts { undefined = 0, elenco = 1, pagine = 2 }; enum ts { undefined = 0, elenco = 1, pagine = 2 };
// definizione form per pagine anagrafiche // definizione form per pagine anagrafiche
class TModificati_form : public TForm class TModificati_form : public TForm
{ {
public: public:
virtual TCursor* cursor() const; virtual TCursor* cursor() const;
virtual TRelation* relation() const; virtual TRelation* relation() const;
TPrint_section& get_body() { return section('B'); } ; TPrint_section& get_body() { return section('B'); } ;
TModificati_form(): TForm() {}; TModificati_form(): TForm() {};
TModificati_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "") TModificati_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
: TForm(form,code,editlevel,desc) {}; : TForm(form,code,editlevel,desc) {};
virtual ~TModificati_form() {}; virtual ~TModificati_form() {};
}; };
class TModificati_application : public TPrintapp class TModificati_application : public TPrintapp
{ {
static bool filter_func_modificati(const TRelation *); static bool filter_func_modificati(const TRelation *);
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TModificati_form* _form_pag; TModificati_form* _form_pag;
TAssoc_array _categorie;
int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome, _dencom; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome, _dencom;
TDate _data_stampa;
TDate _dataini, _datafin; TDate _data_stampa;
ts _tipo_stampa; TDate _dataini, _datafin;
TString _codsez, _codsot; ts _tipo_stampa;
TString16 _codsez, _codsot;
protected:
virtual bool user_create(); protected:
virtual bool user_destroy(); virtual bool user_create();
virtual bool set_print(int m); virtual bool user_destroy();
virtual void set_page(int file, int cnt); virtual bool set_print(int m);
virtual bool preprocess_page (int file, int counter); virtual void set_page(int file, int cnt);
virtual bool preprocess_page (int file, int counter);
public:
void crea_intestazione(); public:
void filtra_sezioni(); void crea_intestazione();
void header_sezione(TString codsez, TString codsot); void filtra_sezioni();
TMask& app_mask() { return *_msk; } void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; }
TModificati_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
}; TModificati_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
};
HIDDEN inline TModificati_application& app() { return (TModificati_application&) main_app(); }
HIDDEN inline TModificati_application& app() { return (TModificati_application&) main_app(); }
TCursor* TModificati_form::cursor() const { return app().current_cursor(); }
TCursor* TModificati_form::cursor() const { return app().current_cursor(); }
TRelation* TModificati_form::relation() const { return cursor()->relation(); }
TRelation* TModificati_form::relation() const { return cursor()->relation(); }
void TModificati_application::filtra_sezioni()
{ void TModificati_application::filtra_sezioni()
TString sezini = _msk->get(F_SEZINI); {
TString sotini = _msk->get(F_SOTINI); TString16 sezini = _msk->get(F_SEZINI);
TString sezfin = _msk->get(F_SEZFIN); TString16 sotini = _msk->get(F_SOTINI);
TString sotfin = _msk->get(F_SOTFIN); TString16 sezfin = _msk->get(F_SEZFIN);
select_cursor(_cur4); TString16 sotfin = _msk->get(F_SOTFIN);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI); select_cursor(_cur4);
TRectype da(fl.curr()); TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
TRectype a(fl.curr()); TRectype da(fl.curr());
da.zero(); TRectype a(fl.curr());
a.zero(); da.zero();
if ((sezini.not_empty()) && (sezini.ok())) a.zero();
da.put(SOG_CODSEZ, sezini); if ((sezini.not_empty()) && (sezini.ok()))
if ((sotini.not_empty()) && (sotini.ok())) da.put(SOG_CODSEZ, sezini);
da.put(SOG_CODSOT, sotini); if ((sotini.not_empty()) && (sotini.ok()))
if ((sezfin.not_empty()) && (sezfin.ok())) da.put(SOG_CODSOT, sotini);
a.put(SOG_CODSEZ, sezfin); if ((sezfin.not_empty()) && (sezfin.ok()))
if ((sotfin.not_empty()) && (sotfin.ok())) a.put(SOG_CODSEZ, sezfin);
a.put(SOG_CODSOT, sotfin); if ((sotfin.not_empty()) && (sotfin.ok()))
current_cursor()->setregion(da, a); a.put(SOG_CODSOT, sotfin);
} current_cursor()->setregion(da, a);
}
void TModificati_application::set_page(int file, int cnt)
{ void TModificati_application::set_page(int file, int cnt)
switch (_tipo_stampa) {
{ switch (_tipo_stampa)
case pagine: {
{ case pagine:
TPrint_section& corpo = _form_pag->get_body(); {
corpo.reset(); TPrint_section& corpo = _form_pag->get_body();
corpo.update(); corpo.reset();
for (int i = 0; i < corpo.height(); i++) corpo.update();
{ for (int i = 0; i < corpo.height(); i++)
TPrintrow& riga = corpo.row(i); {
set_row(i+1,riga); 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 force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
} // altrimenti stampa sempre la stessa etichetta
break; }
case elenco: break;
{ case elenco:
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######")); {
set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"######"));
set_row(1,"@10g#a", &_cognome_nome); set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(1,"@10g#a", &_cognome_nome);
set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(2,"@47g#a", &_dencom); set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT)); set_row(2,"@47g#a", &_dencom);
} set_row(2,"@114g@S", FLD(LF_SOGGETTI,SOG_TELALT));
break; }
} break;
} }
}
bool TModificati_application::filter_func_modificati(const TRelation * rel)
{ bool TModificati_application::filter_func_modificati(const TRelation * rel)
bool filtrato = TRUE; {
bool filtrato = TRUE;
TLocalisamfile* sog = &(rel->lfile(LF_SOGGETTI));
TLocalisamfile sog = rel->lfile();
//filtro per categorie
//filtro per categorie
TMask& msk = app().app_mask(); TAssoc_array& categorie = app()._categorie;
TString catpri = msk.get(F_CAT1); if (categorie.items() != 0)
TString catsec = msk.get(F_CAT2); {
TString catter = msk.get(F_CAT3); TString16 cat = sog.get(SOG_CATDON);
TString catqua = msk.get(F_CAT4); filtrato = categorie.is_key((const char*) cat);
TString catqui = msk.get(F_CAT5); }
TString catses = msk.get(F_CAT6); // filtro per data aggiornamento
if (filtrato && app()._dataini.ok())
TAssoc_array categorie; {
if (catpri.not_empty() && catpri.ok()) TDate datamod = sog.get(SOG_DATAULTAGG);
categorie.add((const char*) catpri); filtrato = (datamod > app()._dataini);
if (catsec.not_empty() && catsec.ok()) }
categorie.add((const char*) catsec); return filtrato;
if (catter.not_empty() && catter.ok()) }
categorie.add((const char*) catter);
if (catqua.not_empty() && catqua.ok()) bool TModificati_application::preprocess_page(int file, int counter)
categorie.add((const char*) catqua); {
if (catqui.not_empty() && catqui.ok()) // contatore soggetti stampati
categorie.add((const char*) catqui); // per ora non c'è
if (catses.not_empty() && catses.ok()) if (_tipo_stampa == elenco)
categorie.add((const char*) catses); {
TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
if (categorie.items() != 0) nome << " ";
{ nome << current_cursor()->curr().get(SOG_NOME);
TString cat = sog->curr().get(SOG_CATDON); _cognome_nome = nome;
if (categorie.is_key((const char*) cat)) TString256 localita = "";
filtrato = TRUE; localita << current_cursor()->curr(-ALIAS_LCP).get("S6");
else if (localita.not_empty() && localita.ok())
filtrato = FALSE; {
} localita << " ";
if (filtrato) localita << current_cursor()->curr(-ALIAS_LCP).get("S0");
{ localita << " - ";
// filtro per data aggiornamento }
TRectype from (sog->curr()); else
//TRectype to (sog->curr()); {
from.zero(); localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM);
//to.zero(); localita << " ";
if (app()._dataini.ok()) }
from.put(SOG_DATAULTAGG, app()._dataini); localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM);
//if (app()._datafin.ok()) localita.trim();
// to.put(SOG_DATANASC, app()._datafin); _dencom = localita;
//if ((sog->curr() >= from) && (sog->curr() <= to))
if (sog->curr() >= from) // salto pagina se cambio sezione
filtrato = TRUE; TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
else TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
filtrato = FALSE; if ((_codsez!=codsez)||(_codsot!=codsot))
} {
return filtrato; //if (!_codsez.blank())
} if (_codsez != "**")
printer().formfeed();
bool TModificati_application::preprocess_page(int file, int counter) _codsez = codsez;
{ _codsot = codsot;
// contatore soggetti stampati header_sezione(codsez, codsot);
// per ora non c'è }
if (_tipo_stampa == elenco) }
{ return TRUE;
TString nome = current_cursor()->curr().get(SOG_COGNOME); }
nome << " ";
nome << current_cursor()->curr().get(SOG_NOME); void TModificati_application::header_sezione(TString16 codsez, TString16 codsot)
_cognome_nome = nome; {
TString localita = ""; TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
localita << current_cursor()->curr(-ALIAS_LCP).get("S6"); TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
if (localita.not_empty() && localita.ok()) TString256 intestazione(132);
{ intestazione = "Sezione: ";
localita << " "; intestazione << codsez;
localita << current_cursor()->curr(-ALIAS_LCP).get("S0"); intestazione << "/";
localita << " - "; intestazione << codsot;
} intestazione << " ";
else intestazione << densez;
{ if ((densot.ok())&& (densot.not_empty()))
localita = current_cursor()->curr(LF_COMUNI).get(COM_CAPCOM); {
localita << " "; intestazione << "/";
} intestazione << densot;
localita << current_cursor()->curr(LF_COMUNI).get(COM_DENCOM); }
localita.trim(); intestazione.center_just();
_dencom = localita; set_header(1,"@0g%s", (const char*) intestazione);
return;
// salto pagina se cambio sezione }
TString codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT); bool TModificati_application::set_print(int)
if ((_codsez!=codsez)||(_codsot!=codsot)) {
{ _tipo_stampa = undefined;
//if (!_codsez.blank()) KEY tasto;
if (_codsez != "**") tasto = _msk->run();
printer().formfeed(); switch (tasto)
_codsez = codsez; {
_codsot = codsot; case F_ELENCO:
header_sezione(codsez, codsot); _tipo_stampa = elenco;
} //_codsez.spaces(2);
} //_codsot.spaces(2);
return TRUE; _codsez = "**";
} _codsez = "**";
break;
void TModificati_application::header_sezione(TString codsez, TString codsot) case F_PAGINE:
{ _tipo_stampa = pagine;
TString densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ); break;
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT); }
TString intestazione(132); if (_tipo_stampa != undefined)
intestazione = "Sezione: "; {
intestazione << codsez; reset_files();
intestazione << "/"; add_file(LF_SOGGETTI);
intestazione << codsot; _dataini = _msk->get(F_DATAINI);
intestazione << " "; filtra_sezioni();
intestazione << densez;
if ((densot.ok())&& (densot.not_empty())) // filtro per categorie
{ TString16 catpri = _msk->get(F_CAT1);
intestazione << "/"; TString16 catsec = _msk->get(F_CAT2);
intestazione << densot; TString16 catter = _msk->get(F_CAT3);
} TString16 catqua = _msk->get(F_CAT4);
intestazione.center_just(); TString16 catqui = _msk->get(F_CAT5);
set_header(1,"@0g%s", (const char*) intestazione); TString16 catses = _msk->get(F_CAT6);
return; if (catpri.not_empty() && catpri.ok())
} _categorie.add((const char*) catpri);
if (catsec.not_empty() && catsec.ok())
bool TModificati_application::set_print(int) _categorie.add((const char*) catsec);
{ if (catter.not_empty() && catter.ok())
_tipo_stampa = undefined; _categorie.add((const char*) catter);
KEY tasto; if (catqua.not_empty() && catqua.ok())
tasto = _msk->run(); _categorie.add((const char*) catqua);
switch (tasto) if (catqui.not_empty() && catqui.ok())
{ _categorie.add((const char*) catqui);
case F_ELENCO: if (catses.not_empty() && catses.ok())
_tipo_stampa = elenco; _categorie.add((const char*) catses);
//_codsez.spaces(2);
//_codsot.spaces(2); current_cursor()->set_filterfunction (filter_func_modificati);
_codsez = "**"; reset_print();
_codsez = "**"; crea_intestazione();
break; return TRUE;
case F_PAGINE: }
_tipo_stampa = pagine; else
break; return FALSE;
} }
if (_tipo_stampa != undefined)
{ void TModificati_application::crea_intestazione()
reset_files(); {
add_file(LF_SOGGETTI); reset_header();
_dataini = _msk->get(F_DATAINI);
filtra_sezioni(); if (_tipo_stampa == elenco)
current_cursor()->set_filterfunction (filter_func_modificati); {
reset_print(); TString256 sep(132);
crea_intestazione(); sep = "ELENCO MODIFICATI";
return TRUE; TDate data = _msk->get(F_DATAINI);
} if (data.ok())
else {
return FALSE; sep << " dal ";
} sep << data.string();
}
void TModificati_application::crea_intestazione() sep.center_just();
{ set_header(2, "@0g%s", (const char*) sep);
reset_header(); TString16 data_stampa = _data_stampa.string();
set_header(2,"@0g%10s", (const char*) data_stampa);
if (_tipo_stampa == elenco) sep = "";
{ sep << "Pag. @#";
TString sep(132); set_header(2, "@120g%s", (const char*) sep);
sep = "ELENCO MODIFICATI";
TDate data = _msk->get(F_DATAINI); sep = "";
if (data.ok()) sep.fill('-');
{ set_header(3, (const char *) sep);
sep << " dal ";
sep << data.string(); set_header(4,"@0gCod.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro");
} set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro");
sep.center_just(); set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------");
set_header(2, "@0g%s", (const char*) sep); }
TString data_stampa = _data_stampa.string(); }
set_header(2,"@0g%10s", (const char*) data_stampa);
sep = ""; bool TModificati_application::user_create()
sep << "Pag. @#"; {
set_header(2, "@120g%s", (const char*) sep); _rel = new TRelation(LF_SOGGETTI);
//_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
sep = ""; _rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP);
sep.fill('-'); _rel->add(LF_COMUNI, "COM==COM");
set_header(3, (const char *) sep); // per stampare nell'intestazione la denominazione della sezione
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT");
set_header(4,"@0gCod.@7gC.@10gCognome e nome@36gNato il@47gIndirizzo@98gTelefono abit.@114gTelefono lavoro");
set_header(5,"@47gCAP/Località/Comune/Prov.@114gTelefono altro"); _cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice
set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g--------------------------------------------------@98g---------------@114g---------------"); _cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome
} _cur3 = add_cursor(new TCursor(_rel, "", 3)); //cursore ordinamento per sezione+sottogruppo+codice
} _cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome
bool TModificati_application::user_create() _form_pag = new TModificati_form("AT_PAGIN");
{ _msk = new TMask("at3400a");
_rel = new TRelation(LF_SOGGETTI); return TRUE;
//_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS); }
_rel->add("LCP", "CODTAB==LOCALITA",1,0,ALIAS_LCP);
_rel->add(LF_COMUNI, "COM==COM"); bool TModificati_application::user_destroy()
// per stampare nell'intestazione la denominazione della sezione {
_rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); delete _msk;
delete _rel;
_cur1 = add_cursor(new TCursor(_rel, "", 1)); //cursore ordinamento per codice delete _form_pag;
_cur2 = add_cursor(new TCursor(_rel, "", 2)); //cursore ordinamento per cognome e nome return TRUE;
_cur3 = add_cursor(new TCursor(_rel, "", 3)); //cursore ordinamento per sezione+sottogruppo+codice }
_cur4 = add_cursor(new TCursor(_rel, "", 4)); //cursore ordinamento per sezione+sottogruppo+cognome e nome
int at3400(int argc, char* argv[])
_form_pag = new TModificati_form("AT_PAGIN"); {
_msk = new TMask("at3400a");
return TRUE; TModificati_application a;
}
a.run(argc, argv, "Elenco soggetti modificati");
bool TModificati_application::user_destroy()
{ return 0;
delete _msk; }
delete _rel;
delete _form_pag;
return TRUE;
}
int at3400(int argc, char* argv[])
{
TModificati_application a;
a.run(argc, argv, "Elenco soggetti modificati");
return 0;
}