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

@ -35,11 +35,13 @@ class TSospesi_application : public TPrintapp
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;
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);
TAssoc_array categorie = app()._categorie;
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 << "/";
@ -242,14 +218,33 @@ bool TSospesi_application::set_print(int m)
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 // filtro per termine esclusione
filtrato = FALSE; if (filtrato && app()._termineesc.ok())
{
TDate terminesog = sog.get_date(SOG_TERMESCL);
filtrato = terminesog <= app()._termineesc;
} }
TDate termine = msk.get_date(F_DATA);
TDate terminesog = sog->curr().get_date(SOG_TERMESCL);
if ((filtrato) && (termine.ok()))
if (terminesog > termine)
filtrato = FALSE;
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
filtra_sezioni();
// 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]; _tipo_iscdim = _msk->get(F_TIPO)[0];
_dataini = _msk->get(F_DATAINI); _dataini = _msk->get(F_DATAINI);
_datafin = _msk->get(F_DATAFIN); _datafin = _msk->get(F_DATAFIN);
// filtro per sezioni selezionati
filtra_sezioni();
// filtro per categorie
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

@ -6,6 +6,7 @@ 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

@ -36,6 +36,9 @@ class TUrgenze_application : public TPrintapp
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TUrgenze_form* _form_eti; TUrgenze_form* _form_eti;
TRectype* _sangue;
TAssoc_array _categorie;
long _giorni;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome, _dencom; TParagraph_string _cognome_nome, _dencom;
@ -43,7 +46,7 @@ class TUrgenze_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,8 +59,9 @@ 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; }
TRectype& get_sangue() { return *_sangue; }
TUrgenze_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} TUrgenze_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
}; };
@ -70,10 +74,10 @@ TRelation* TUrgenze_form::relation() const { return cursor()->relation(); }
void TUrgenze_application::filtra_sezioni() void TUrgenze_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());
@ -115,7 +119,7 @@ void TUrgenze_application::set_page(int file, int cnt)
set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@10g#a", &_cognome_nome); set_row(1,"@10g#a", &_cognome_nome);
set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@47g#a", &_dencom); set_row(2,"@47g#a", &_dencom);
@ -130,81 +134,32 @@ bool TUrgenze_application::filter_func_urgenze(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
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;
} }
TRectype from (sog->curr()); // filtro per tipizzazione
if (filtrato) if (filtrato)
{ {
// filtro per tipizzazione TRectype from = app().get_sangue();
from.zero(); filtrato = (sog.curr()==from);
TString gruppoab0 = msk.get(F_GRUPPOAB0);
TString rhantid = msk.get(F_RHANTID);
TString kell = msk.get(F_KELL);
TString fenotiporh = msk.get(F_FENOTIPORH);
TString du = msk.get(F_DU);
if ((gruppoab0.ok()) && (gruppoab0.not_empty()))
from.put(SOG_GRUPPOAB0, gruppoab0);
if ((rhantid.ok()) && (rhantid.not_empty()))
from.put(SOG_RHANTID, rhantid);
if ((kell.ok()) && (kell.not_empty()))
from.put(SOG_KELL, kell);
if ((fenotiporh.ok()) && (fenotiporh.not_empty()))
from.put(SOG_FENOTIPORH, fenotiporh);
if ((du.ok()) && (du.not_empty()))
from.put(SOG_DU, du);
if (sog->curr()==from)
filtrato = TRUE;
else
filtrato = FALSE;
} }
// filtro su data donazione // filtro su data donazione
if (filtrato) if (filtrato)
{ {
long giorni = msk.get_long(F_GIORNI); long giorni_sez = rel->lfile(LF_SEZIONI).get_long(SEZ_INTMINCONV);
long giorni_sez = rel->lfile(LF_SEZIONI).curr().get_long(SEZ_INTMINCONV); long giorni = (giorni_sez > app()._giorni) ? giorni_sez : app()._giorni;
TRectype from = sog.curr();
giorni = (giorni_sez > giorni) ? giorni_sez : giorni;
from.zero(); from.zero();
TDate data(TODAY); TDate data(TODAY);
data = data - (const long) giorni; data = data - (const long) giorni;
from.put(SOG_DATAULTDON, data); from.put(SOG_DATAULTDON, data);
if ((sog->curr()<= from)) filtrato = (sog.curr()<= from);
filtrato = TRUE;
else
filtrato = FALSE;
} }
return filtrato; return filtrato;
} }
@ -215,11 +170,11 @@ bool TUrgenze_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())
{ {
@ -237,8 +192,8 @@ bool TUrgenze_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.blank()) //if (!_codsez.blank())
@ -252,11 +207,11 @@ bool TUrgenze_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
void TUrgenze_application::header_sezione(TString codsez, TString codsot) void TUrgenze_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 << "/";
@ -297,9 +252,49 @@ bool TUrgenze_application::set_print(int)
add_file(LF_SOGGETTI); add_file(LF_SOGGETTI);
filtra_sezioni(); filtra_sezioni();
// 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 tipizzazione
_sangue->zero();
TString16 gruppoab0 = _msk->get(F_GRUPPOAB0);
TString16 rhantid = _msk->get(F_RHANTID);
TString16 kell = _msk->get(F_KELL);
TString16 fenotiporh = _msk->get(F_FENOTIPORH);
TString16 du = _msk->get(F_DU);
if ((gruppoab0.ok()) && (gruppoab0.not_empty()))
_sangue->put(SOG_GRUPPOAB0, gruppoab0);
if ((rhantid.ok()) && (rhantid.not_empty()))
_sangue->put(SOG_RHANTID, rhantid);
if ((kell.ok()) && (kell.not_empty()))
_sangue->put(SOG_KELL, kell);
if ((fenotiporh.ok()) && (fenotiporh.not_empty()))
_sangue->put(SOG_FENOTIPORH, fenotiporh);
if ((du.ok()) && (du.not_empty()))
_sangue->put(SOG_DU, du);
long giorni = _msk->get_long(F_GIORNI);
// filtra solo idonei // filtra solo idonei
current_cursor()->setfilter("TCS->S6 == \"I\"", TRUE); current_cursor()->setfilter("TCS->S6 == \"I\"", TRUE);
// filtra per tipizzazione e data donazione // filtra per categorie, tipizzazione e data donazione
current_cursor()->set_filterfunction (filter_func_urgenze, TRUE); current_cursor()->set_filterfunction (filter_func_urgenze, TRUE);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
@ -315,11 +310,11 @@ void TUrgenze_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = "CONVOCAZIONI URGENTI"; sep = "CONVOCAZIONI URGENTI";
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. @#";
@ -351,6 +346,7 @@ bool TUrgenze_application::user_create()
_form_eti = new TUrgenze_form("AT_ETSOG"); _form_eti = new TUrgenze_form("AT_ETSOG");
_msk = new TMask("at3300a"); _msk = new TMask("at3300a");
_sangue = new TRectype(LF_SOGGETTI);
return TRUE; return TRUE;
} }
@ -359,6 +355,7 @@ bool TUrgenze_application::user_destroy()
delete _msk; delete _msk;
delete _rel; delete _rel;
delete _form_eti; delete _form_eti;
delete _sangue;
return TRUE; return TRUE;
} }

View File

@ -36,6 +36,7 @@ class TModificati_application : public TPrintapp
TRelation* _rel; TRelation* _rel;
TMask* _msk; TMask* _msk;
TModificati_form* _form_pag; TModificati_form* _form_pag;
TAssoc_array _categorie;
int _cur1, _cur2, _cur3, _cur4; int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome, _dencom; TParagraph_string _cognome_nome, _dencom;
@ -43,7 +44,7 @@ class TModificati_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,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; }
TModificati_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {} TModificati_application() : _data_stampa(TODAY), _cognome_nome("",25), _dencom("",50) {}
@ -70,10 +71,10 @@ TRelation* TModificati_form::relation() const { return cursor()->relation(); }
void TModificati_application::filtra_sezioni() void TModificati_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());
@ -115,7 +116,7 @@ void TModificati_application::set_page(int file, int cnt)
set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON)); set_row(1,"@7g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@10g#a", &_cognome_nome); set_row(1,"@10g#a", &_cognome_nome);
set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC)); set_row(1,"@36g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_INDIRIZZO)); set_row(1,"@47g@S", FLD(LF_SOGGETTI,SOG_DOM_INDIR));
set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI)); set_row(1,"@98g@S", FLD(LF_SOGGETTI,SOG_TELABI));
set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV)); set_row(1,"@114g@S", FLD(LF_SOGGETTI,SOG_TELLAV));
set_row(2,"@47g#a", &_dencom); set_row(2,"@47g#a", &_dencom);
@ -129,56 +130,20 @@ 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
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;
} }
if (filtrato)
{
// filtro per data aggiornamento // filtro per data aggiornamento
TRectype from (sog->curr()); if (filtrato && app()._dataini.ok())
//TRectype to (sog->curr()); {
from.zero(); TDate datamod = sog.get(SOG_DATAULTAGG);
//to.zero(); filtrato = (datamod > app()._dataini);
if (app()._dataini.ok())
from.put(SOG_DATAULTAGG, app()._dataini);
//if (app()._datafin.ok())
// to.put(SOG_DATANASC, app()._datafin);
//if ((sog->curr() >= from) && (sog->curr() <= to))
if (sog->curr() >= from)
filtrato = TRUE;
else
filtrato = FALSE;
} }
return filtrato; return filtrato;
} }
@ -189,11 +154,11 @@ bool TModificati_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())
{ {
@ -211,8 +176,8 @@ bool TModificati_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.blank()) //if (!_codsez.blank())
@ -226,11 +191,11 @@ bool TModificati_application::preprocess_page(int file, int counter)
return TRUE; return TRUE;
} }
void TModificati_application::header_sezione(TString codsez, TString codsot) void TModificati_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 << "/";
@ -271,6 +236,27 @@ bool TModificati_application::set_print(int)
add_file(LF_SOGGETTI); add_file(LF_SOGGETTI);
_dataini = _msk->get(F_DATAINI); _dataini = _msk->get(F_DATAINI);
filtra_sezioni(); filtra_sezioni();
// 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_modificati); current_cursor()->set_filterfunction (filter_func_modificati);
reset_print(); reset_print();
crea_intestazione(); crea_intestazione();
@ -286,7 +272,7 @@ void TModificati_application::crea_intestazione()
if (_tipo_stampa == elenco) if (_tipo_stampa == elenco)
{ {
TString sep(132); TString256 sep(132);
sep = "ELENCO MODIFICATI"; sep = "ELENCO MODIFICATI";
TDate data = _msk->get(F_DATAINI); TDate data = _msk->get(F_DATAINI);
if (data.ok()) if (data.ok())
@ -296,7 +282,7 @@ void TModificati_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. @#";