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_CODSOT 107
#define F_S_CATDON 108
#define F_S_TESSERA 109
#define F_S_TESSAVIS 109
#define F_S_DENSEZ 201
#define F_S_DENSOT 202
#define F_S_DESC_TIPOCON 203

View File

@ -31,15 +31,17 @@ public:
class TSospesi_application : public TPrintapp
{
TRelation* _rel;
TMask* _msk;
TEti_sospesi_form* _form_eti;
TRelation* _rel;
TMask* _msk;
TEti_sospesi_form* _form_eti;
TAssoc_array _categorie;
int _cur1, _cur2, _cur3, _cur4;
TParagraph_string _cognome_nome;
TDate _data_stampa;
ts _tipo_stampa;
TString _codsez, _codsot;
TString16 _codsez, _codsot;
static bool filter_func_sospesi(const TRelation *);
@ -53,7 +55,7 @@ protected:
public:
void crea_intestazione();
void filtra_sezioni();
void header_sezione(TString codsez, TString codsot);
void header_sezione(TString16 codsez, TString16 codsot);
TMask& app_mask() { return *_msk; }
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()
{
TString sezini = _msk->get(F_SEZINI);
TString sotini = _msk->get(F_SOTINI);
TString sezfin = _msk->get(F_SEZFIN);
TString sotfin = _msk->get(F_SOTFIN);
TString16 sezini = _msk->get(F_SEZINI);
TString16 sotini = _msk->get(F_SOTINI);
TString16 sezfin = _msk->get(F_SEZFIN);
TString16 sotfin = _msk->get(F_SOTFIN);
select_cursor(_cur4);
TLocalisamfile& fl = current_cursor()->file(LF_SOGGETTI);
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;
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)
{
TString cat = sog->curr().get(SOG_CATDON);
if (categorie.is_key((const char*) cat))
filtrato = TRUE;
else
filtrato = FALSE;
TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
return filtrato;
}
@ -173,14 +149,14 @@ bool TSospesi_application::preprocess_page(int file, int counter)
// per ora non c'è
if (_tipo_stampa == elenco)
{
TString nome = current_cursor()->curr().get(SOG_COGNOME);
TString80 nome = current_cursor()->curr().get(SOG_COGNOME);
nome << " ";
nome << current_cursor()->curr().get(SOG_NOME);
_cognome_nome = nome;
// salto pagina se cambio sezione
TString codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString codsot = current_cursor()->curr().get(SOG_CODSOT);
TString16 codsez = current_cursor()->curr().get(SOG_CODSEZ);
TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
//if (!_codsez.blank())
@ -194,11 +170,11 @@ bool TSospesi_application::preprocess_page(int file, int counter)
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);
TString densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString intestazione(132);
TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
TString80 densot = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSOT);
TString256 intestazione(132);
intestazione = "Sezione: ";
intestazione << codsez;
intestazione << "/";
@ -240,16 +216,35 @@ bool TSospesi_application::set_print(int m)
// filtro per sezioni selezionati
filtra_sezioni();
// filtro per tipo sospensione
TString tiposo = _msk->get(F_TIPO);
TString16 tiposo = _msk->get(F_TIPO);
if (tiposo.not_empty() && tiposo.ok())
current_cursor()->setfilter(format("STATO == \"%s\"",(const char*)tiposo));
else
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);
reset_print();
crea_intestazione();
return TRUE;
@ -264,20 +259,20 @@ void TSospesi_application::crea_intestazione()
if (_tipo_stampa == elenco)
{
TString sep(132);
TString256 sep(132);
sep = "ELENCO SOSPESI";
TString tipo = _msk->get(F_TIPO);
TString16 tipo = _msk->get(F_TIPO);
if ((tipo.ok()) && (tipo.not_empty()))
{
sep << ": tipo ";
sep << tipo;
TString dtipo = _msk->get(F_D_TIPO);
TString80 dtipo = _msk->get(F_D_TIPO);
sep << " ";
sep << dtipo;
}
sep.center_just();
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);
sep = "";
sep << "Pag. @#";

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#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)
{
@ -22,6 +22,8 @@ int main(int argc, char** argv)
rt = at3400(argc, argv); break;
case 4:
rt = at3500(argc, argv); break;
case 5:
rt = at3600(argc, argv); break;
default:
error_box(usage, argv[0]) ; rt = 1; break;
}

View File

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

View File

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

View File

@ -82,7 +82,7 @@ void TTessere_application::set_page(int file, int cnt)
break;
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(4, "@30g@S", FLD(LF_SEZIONI,SEZ_DENSOT));
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(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(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(28,"@4g@4ls", FLD(LF_SOGGETTI,SOG_GRUPPOAB0));
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()
{
TString sep(132);
TString data_stampa;
TString256 sep(132);
TString16 data_stampa;
reset_header();

View File

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

View File

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