modifiche per adeguare i tracciati alle richieste della commissione informatica nazionale
git-svn-id: svn://10.65.10.50/trunk@3988 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
364e3b63f6
commit
aa008393bc
@ -43,7 +43,7 @@ class TSospesi_application : public TPrintapp
|
||||
ts _tipo_stampa;
|
||||
TString16 _codsez, _codsot;
|
||||
|
||||
static bool filter_func_sospesi(const TRelation *);
|
||||
static bool filter_func_sospesi(const TRelation* rel);
|
||||
|
||||
protected:
|
||||
virtual bool user_create();
|
||||
@ -129,11 +129,9 @@ void TSospesi_application::set_page(int file, int cnt)
|
||||
|
||||
bool TSospesi_application::filter_func_sospesi(const TRelation* rel)
|
||||
{
|
||||
|
||||
bool filtrato = TRUE;
|
||||
|
||||
TLocalisamfile& sog = rel->lfile();
|
||||
|
||||
// filtro per categorie
|
||||
TAssoc_array categorie = app()._categorie;
|
||||
if (categorie.items() != 0)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
class TPereta_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_pereta(const TRelation *);
|
||||
static bool filter_func_pereta(const TRelation* rel);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
@ -135,8 +135,7 @@ bool TPereta_application::filter_func_pereta(const TRelation* rel)
|
||||
{
|
||||
bool filtrato = TRUE;
|
||||
TLocalisamfile& sog = rel->lfile();
|
||||
|
||||
// fiiltro per categorie
|
||||
// filtro per categorie
|
||||
TAssoc_array categorie = app()._categorie;
|
||||
if (categorie.items() != 0)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
class TEsclusi_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_esclusi(const TRelation *);
|
||||
static bool filter_func_esclusi(const TRelation* rel);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
@ -127,8 +127,7 @@ 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();
|
||||
|
||||
TLocalisamfile& sog = rel->lfile();
|
||||
//filtro per categorie
|
||||
TAssoc_array categorie = app()._categorie;
|
||||
if (categorie.items() != 0)
|
||||
|
482
at/at2400.cpp
482
at/at2400.cpp
@ -1,241 +1,241 @@
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
#include "lf.h"
|
||||
#include "soggetti.h"
|
||||
#include "benem.h"
|
||||
|
||||
#include "at2.h"
|
||||
#include "at2400a.h"
|
||||
|
||||
class TBenem_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_benem(const TRelation *);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TLocalisamfile* _benem;
|
||||
TRecord_array* _sbenemerenze;
|
||||
|
||||
int _cur1, _cur2, _cur3, _cur4;
|
||||
TDate _data_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();
|
||||
|
||||
TMask& app_mask() { return *_msk; }
|
||||
TBenem_application() : _data_stampa(TODAY) {}
|
||||
};
|
||||
|
||||
HIDDEN inline TBenem_application& app() { return (TBenem_application&) main_app(); }
|
||||
|
||||
void TBenem_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 TBenem_application::set_page(int file, int cnt)
|
||||
{
|
||||
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"#########"));
|
||||
set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_CATDON));
|
||||
set_row(1,"@13g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
|
||||
set_row(1,"@39g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
|
||||
set_row(1,"@50g@S", FLD(LF_SOGGETTI,SOG_TOTDON));
|
||||
|
||||
set_row(2,"@13g@S", FLD(LF_SOGGETTI,SOG_NOME));
|
||||
set_row(2,"@50g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
|
||||
}
|
||||
|
||||
bool TBenem_application::filter_func_benem(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;
|
||||
}
|
||||
return filtrato;
|
||||
}
|
||||
|
||||
bool TBenem_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
// contatore soggetti stampati
|
||||
// per ora non c'è
|
||||
// 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;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int get_donbene(TString tipo)
|
||||
{
|
||||
int donbene = 0;
|
||||
TTable bnz("BNZ");
|
||||
bnz.put("CODTAB",tipo);
|
||||
if (bnz.read() == NOERR)
|
||||
donbene = bnz.get_int("I0");
|
||||
return donbene;
|
||||
|
||||
}
|
||||
bool TBenem_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
if (tasto == F_ELENCO)
|
||||
{
|
||||
//_codsez.spaces(2);
|
||||
//_codsot.spaces(2);
|
||||
_codsez = "**";
|
||||
_codsot = "**";
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
|
||||
TString tipoben = _msk->get(F_TIPOBEN);
|
||||
|
||||
filtra_sezioni();
|
||||
|
||||
int donbene = get_donbene(tipoben);
|
||||
|
||||
if (tipoben.not_empty() && tipoben.ok())
|
||||
current_cursor()->setfilter(format("TOTDON >= \"%i\"",donbene));
|
||||
else
|
||||
current_cursor()->setfilter(format("TOTDON >= \"%i\"",donbene));
|
||||
// current_cursor()->setfilter("ESCLUSO != \"\"");
|
||||
current_cursor()->set_filterfunction(filter_func_benem);
|
||||
crea_intestazione();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TBenem_application::crea_intestazione()
|
||||
{
|
||||
TString sep(132);
|
||||
TString data_stampa;
|
||||
|
||||
reset_header();
|
||||
|
||||
sep.fill('-');
|
||||
set_header(1, (const char *) sep);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
sep.right_just(132);
|
||||
set_header(2,(const char*) sep);
|
||||
|
||||
set_header(2,"@0gELENCO SOGGETTI CHE DEVONO RICEVERE LA BENEMERENZA xx@104gDATA");
|
||||
data_stampa = _data_stampa.string();
|
||||
set_header(2,"@109g%10s", (const char*) data_stampa);
|
||||
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header(3, (const char *) sep);
|
||||
|
||||
set_header(5,"@0gCod.@10gC.@13gCognome@39gNato il@50gData esc.");
|
||||
set_header(6,"@13gNome@50gTipo esc.");
|
||||
set_header(7,"@0g---------@10g--@13g-------------------------@39g----------@50g--------");
|
||||
}
|
||||
|
||||
bool TBenem_application::user_create()
|
||||
{
|
||||
_rel = new TRelation(LF_SOGGETTI);
|
||||
//_rel->add(LF_BENEM, "CODICE==CODICE");
|
||||
_benem = new TLocalisamfile(LF_BENEM);
|
||||
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
|
||||
|
||||
|
||||
_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
|
||||
|
||||
_msk = new TMask("at2400a");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TBenem_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _benem;
|
||||
delete _sbenemerenze;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int at2400(int argc, char* argv[])
|
||||
{
|
||||
|
||||
TBenem_application a;
|
||||
|
||||
a.run(argc, argv, "Elenco premiati");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
#include "lf.h"
|
||||
#include "soggetti.h"
|
||||
#include "benem.h"
|
||||
|
||||
#include "at2.h"
|
||||
#include "at2400a.h"
|
||||
|
||||
class TBenem_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_benem(const TRelation* rel);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TLocalisamfile* _benem;
|
||||
TRecord_array* _sbenemerenze;
|
||||
|
||||
int _cur1, _cur2, _cur3, _cur4;
|
||||
TDate _data_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();
|
||||
|
||||
TMask& app_mask() { return *_msk; }
|
||||
TBenem_application() : _data_stampa(TODAY) {}
|
||||
};
|
||||
|
||||
HIDDEN inline TBenem_application& app() { return (TBenem_application&) main_app(); }
|
||||
|
||||
void TBenem_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 TBenem_application::set_page(int file, int cnt)
|
||||
{
|
||||
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"#########"));
|
||||
set_row(1,"@10g@S", FLD(LF_SOGGETTI,SOG_CATDON));
|
||||
set_row(1,"@13g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
|
||||
set_row(1,"@39g@ld", FLD(LF_SOGGETTI,SOG_DATANASC));
|
||||
set_row(1,"@50g@S", FLD(LF_SOGGETTI,SOG_TOTDON));
|
||||
|
||||
set_row(2,"@13g@S", FLD(LF_SOGGETTI,SOG_NOME));
|
||||
set_row(2,"@50g@ld", FLD(LF_SOGGETTI,SOG_DATAULTDON));
|
||||
}
|
||||
|
||||
bool TBenem_application::filter_func_benem(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;
|
||||
}
|
||||
return filtrato;
|
||||
}
|
||||
|
||||
bool TBenem_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
// contatore soggetti stampati
|
||||
// per ora non c'è
|
||||
// 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;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int get_donbene(TString tipo)
|
||||
{
|
||||
int donbene = 0;
|
||||
TTable bnz("BNZ");
|
||||
bnz.put("CODTAB",tipo);
|
||||
if (bnz.read() == NOERR)
|
||||
donbene = bnz.get_int("I0");
|
||||
return donbene;
|
||||
|
||||
}
|
||||
bool TBenem_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
if (tasto == F_ELENCO)
|
||||
{
|
||||
//_codsez.spaces(2);
|
||||
//_codsot.spaces(2);
|
||||
_codsez = "**";
|
||||
_codsot = "**";
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
|
||||
TString tipoben = _msk->get(F_TIPOBEN);
|
||||
|
||||
filtra_sezioni();
|
||||
|
||||
int donbene = get_donbene(tipoben);
|
||||
|
||||
if (tipoben.not_empty() && tipoben.ok())
|
||||
current_cursor()->setfilter(format("TOTDON >= \"%i\"",donbene));
|
||||
else
|
||||
current_cursor()->setfilter(format("TOTDON >= \"%i\"",donbene));
|
||||
// current_cursor()->setfilter("ESCLUSO != \"\"");
|
||||
current_cursor()->set_filterfunction(filter_func_benem);
|
||||
crea_intestazione();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TBenem_application::crea_intestazione()
|
||||
{
|
||||
TString sep(132);
|
||||
TString data_stampa;
|
||||
|
||||
reset_header();
|
||||
|
||||
sep.fill('-');
|
||||
set_header(1, (const char *) sep);
|
||||
sep = "";
|
||||
sep << "Pag. @#";
|
||||
sep.right_just(132);
|
||||
set_header(2,(const char*) sep);
|
||||
|
||||
set_header(2,"@0gELENCO SOGGETTI CHE DEVONO RICEVERE LA BENEMERENZA xx@104gDATA");
|
||||
data_stampa = _data_stampa.string();
|
||||
set_header(2,"@109g%10s", (const char*) data_stampa);
|
||||
|
||||
sep = "";
|
||||
sep.fill('-');
|
||||
set_header(3, (const char *) sep);
|
||||
|
||||
set_header(5,"@0gCod.@10gC.@13gCognome@39gNato il@50gData esc.");
|
||||
set_header(6,"@13gNome@50gTipo esc.");
|
||||
set_header(7,"@0g---------@10g--@13g-------------------------@39g----------@50g--------");
|
||||
}
|
||||
|
||||
bool TBenem_application::user_create()
|
||||
{
|
||||
_rel = new TRelation(LF_SOGGETTI);
|
||||
//_rel->add(LF_BENEM, "CODICE==CODICE");
|
||||
_benem = new TLocalisamfile(LF_BENEM);
|
||||
_sbenemerenze = new TRecord_array(LF_BENEM,BEN_PROGBEN);
|
||||
|
||||
|
||||
_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
|
||||
|
||||
_msk = new TMask("at2400a");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TBenem_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _benem;
|
||||
delete _sbenemerenze;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int at2400(int argc, char* argv[])
|
||||
{
|
||||
|
||||
TBenem_application a;
|
||||
|
||||
a.run(argc, argv, "Elenco premiati");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -130,13 +130,15 @@ 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();
|
||||
TLocalisamfile& sog = rel->lfile();
|
||||
// filtro per categorie
|
||||
TAssoc_array categorie = app()._categorie;
|
||||
if (categorie.items() != 0)
|
||||
{
|
||||
TString16 catsog = sog.get(SOG_CATDON);
|
||||
filtrato = categorie.is_key((const char*) catsog);
|
||||
}
|
||||
// filtro per idoneità
|
||||
if (filtrato)
|
||||
{
|
||||
TAssoc_array idoneita;
|
||||
|
@ -126,13 +126,15 @@ 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();
|
||||
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);
|
||||
}
|
||||
// filtrp per date iscrizione/dimissione
|
||||
if (filtrato)
|
||||
{
|
||||
if (app()._tipo_iscdim == ISCRITTI)
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#define STATO_IDONEO 'I' // IDONEITA'
|
||||
#define STATO_FINESO 'F' // FINE SOSPENSIONE
|
||||
|
||||
enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 }; //tipi di stampe
|
||||
// tpi di stampa
|
||||
enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 };
|
||||
|
||||
// definizione form per etichette e cartoline
|
||||
class TConv_form : public TForm
|
||||
@ -35,7 +35,7 @@ public:
|
||||
|
||||
class TConv_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_conv(const TRelation *);
|
||||
static bool filter_func_conv(const TRelation* rel);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
@ -147,15 +147,12 @@ 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();
|
||||
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");
|
||||
|
||||
|
||||
//TDate dataultconv = sog.curr().get_date(SOG_DATAULTCONV);
|
||||
if (dataprossi.ok())
|
||||
{
|
||||
@ -163,7 +160,6 @@ bool TConv_application::filter_func_conv (const TRelation * rel)
|
||||
long intconvsi = app()._dataconv - dataprossi;
|
||||
// intervallo tra data convocazione e data ultima convocazione
|
||||
//long intultconvsi = app()._data - dataultconv;
|
||||
|
||||
if ((intconvsi >= 0) && (intconvsi < app()._intmax) && ((stato == STATO_IDONEO) || (stato == STATO_FINESO)) && (dimesso != 'X'))
|
||||
return TRUE;
|
||||
else
|
||||
|
@ -40,7 +40,7 @@ class TTessere_application : public TPrintapp
|
||||
ts _tipo_stampa;
|
||||
TString _riepilogodon;
|
||||
|
||||
static bool filter_func_tessere(const TRelation *);
|
||||
static bool filter_func_tessere(const TRelation* rel);
|
||||
|
||||
protected:
|
||||
virtual bool user_create();
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
class TUrgenze_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_urgenze(const TRelation *);
|
||||
static bool filter_func_urgenze(const TRelation* rel);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
@ -130,12 +130,10 @@ void TUrgenze_application::set_page(int file, int cnt)
|
||||
}
|
||||
}
|
||||
|
||||
bool TUrgenze_application::filter_func_urgenze(const TRelation * rel)
|
||||
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)
|
||||
@ -154,12 +152,10 @@ bool TUrgenze_application::filter_func_urgenze(const TRelation * rel)
|
||||
{
|
||||
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);
|
||||
TDate dataultdon = sog.get(SOG_DATAULTDON);
|
||||
filtrato = (dataultdon <= data);
|
||||
}
|
||||
return filtrato;
|
||||
}
|
||||
@ -196,7 +192,6 @@ bool TUrgenze_application::preprocess_page(int file, int counter)
|
||||
TString16 codsot = current_cursor()->curr().get(SOG_CODSOT);
|
||||
if ((_codsez!=codsez)||(_codsot!=codsot))
|
||||
{
|
||||
//if (!_codsez.blank())
|
||||
if (_codsez != "**")
|
||||
printer().formfeed();
|
||||
_codsez = codsez;
|
||||
@ -237,8 +232,6 @@ bool TUrgenze_application::set_print(int)
|
||||
{
|
||||
case F_ELENCO:
|
||||
_tipo_stampa = elenco;
|
||||
//_codsez.spaces(2);
|
||||
//_codsot.spaces(2);
|
||||
_codsez = "**";
|
||||
_codsot = "**";
|
||||
break;
|
||||
@ -251,7 +244,6 @@ bool TUrgenze_application::set_print(int)
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
filtra_sezioni();
|
||||
|
||||
// filtro per categorie
|
||||
TString16 catpri = _msk->get(F_CAT1);
|
||||
TString16 catsec = _msk->get(F_CAT2);
|
||||
@ -271,7 +263,6 @@ bool TUrgenze_application::set_print(int)
|
||||
_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);
|
||||
@ -289,9 +280,7 @@ bool TUrgenze_application::set_print(int)
|
||||
_sangue->put(SOG_FENOTIPORH, fenotiporh);
|
||||
if ((du.ok()) && (du.not_empty()))
|
||||
_sangue->put(SOG_DU, du);
|
||||
|
||||
long giorni = _msk->get_long(F_GIORNI);
|
||||
|
||||
_giorni = _msk->get_long(F_GIORNI);
|
||||
// filtra solo idonei
|
||||
current_cursor()->setfilter("TCS->S6 == \"I\"", TRUE);
|
||||
// filtra per categorie, tipizzazione e data donazione
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
class TModificati_application : public TPrintapp
|
||||
{
|
||||
static bool filter_func_modificati(const TRelation *);
|
||||
static bool filter_func_modificati(const TRelation* rel);
|
||||
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
@ -126,12 +126,10 @@ void TModificati_application::set_page(int file, int cnt)
|
||||
}
|
||||
}
|
||||
|
||||
bool TModificati_application::filter_func_modificati(const TRelation * rel)
|
||||
bool TModificati_application::filter_func_modificati(const TRelation* rel)
|
||||
{
|
||||
bool filtrato = TRUE;
|
||||
|
||||
TLocalisamfile sog = rel->lfile();
|
||||
|
||||
TLocalisamfile& sog = rel->lfile();
|
||||
//filtro per categorie
|
||||
TAssoc_array& categorie = app()._categorie;
|
||||
if (categorie.items() != 0)
|
||||
@ -257,7 +255,7 @@ bool TModificati_application::set_print(int)
|
||||
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();
|
||||
crea_intestazione();
|
||||
return TRUE;
|
||||
|
733
at/at3500.cpp
733
at/at3500.cpp
@ -1,373 +1,360 @@
|
||||
#include <mask.h>
|
||||
#include <form.h>
|
||||
#include <printapp.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "lf.h"
|
||||
#include "soggetti.h"
|
||||
#include "sezioni.h"
|
||||
|
||||
#include "at3.h"
|
||||
#include "at3500a.h"
|
||||
|
||||
#define ALIAS_LCP 100
|
||||
#define ALIAS_TCS 200
|
||||
#define IDON_SI "SI"
|
||||
#define IDON_AF "AF"
|
||||
|
||||
enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 };
|
||||
|
||||
// definizione form per etichette
|
||||
class TScadenze_form : public TForm
|
||||
{
|
||||
public:
|
||||
|
||||
virtual TCursor* cursor() const;
|
||||
virtual TRelation* relation() const;
|
||||
TPrint_section& get_body() { return section('B'); } ;
|
||||
TScadenze_form(): TForm() {};
|
||||
TScadenze_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
|
||||
: TForm(form,code,editlevel,desc) {};
|
||||
virtual ~TScadenze_form() {};
|
||||
};
|
||||
|
||||
class TScadenze_application : public TPrintapp
|
||||
{
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TScadenze_form* _form_eti;
|
||||
|
||||
int _cur1, _cur2, _cur3, _cur4;
|
||||
TParagraph_string _cognome_nome;
|
||||
TDate _data_stampa;
|
||||
TDate _dataini, _datafin;
|
||||
TString _procdon;
|
||||
ts _tipo_stampa;
|
||||
TString _codsez, _codsot;
|
||||
|
||||
static bool filter_func_scadenze(const TRelation *);
|
||||
|
||||
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; }
|
||||
TScadenze_application() : _data_stampa(TODAY), _cognome_nome("",25) {}
|
||||
};
|
||||
|
||||
HIDDEN inline TScadenze_application& app() { return (TScadenze_application&) main_app(); }
|
||||
|
||||
TCursor* TScadenze_form::cursor() const { return app().current_cursor(); }
|
||||
|
||||
TRelation* TScadenze_form::relation() const { return cursor()->relation(); }
|
||||
|
||||
void TScadenze_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 TScadenze_application::set_page(int file, int cnt)
|
||||
{
|
||||
// costruzione etichette
|
||||
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@ld", FLD(LF_SOGGETTI,SOG_DATAULTID)); // potremmo mettere anche datastato
|
||||
set_row(1,"@58g@S", FLD(LF_SOGGETTI,SOG_IDON1));
|
||||
set_row(1,"@61g@S", FLD(LF_SOGGETTI,SOG_IDON2));
|
||||
set_row(1,"@64g@S", FLD(LF_SOGGETTI,SOG_IDON3));
|
||||
set_row(1,"@67g@S", FLD(LF_SOGGETTI,SOG_IDON4));
|
||||
|
||||
set_row(2,"@50g@S", FLD(LF_SOGGETTI,SOG_STATO));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool TScadenze_application::filter_func_scadenze(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);
|
||||
|
||||
if (categorie.items() != 0)
|
||||
{
|
||||
TString catsog = sog->curr().get(SOG_CATDON);
|
||||
if (categorie.is_key((const char*) catsog))
|
||||
filtrato = TRUE;
|
||||
else
|
||||
filtrato = FALSE;
|
||||
}
|
||||
if (filtrato)
|
||||
{
|
||||
// filtro per età
|
||||
TRectype from (sog->curr());
|
||||
TRectype to (sog->curr());
|
||||
from.zero();
|
||||
to.zero();
|
||||
if (app()._dataini.ok())
|
||||
{
|
||||
if (app()._procdon == IDON_SI)
|
||||
from.put(SOG_DATAPROSSI, app()._dataini);
|
||||
else
|
||||
from.put(SOG_DATAPROSAF, app()._dataini);
|
||||
}
|
||||
if (app()._datafin.ok())
|
||||
{
|
||||
if (app()._procdon == IDON_SI)
|
||||
to.put(SOG_DATAPROSSI, app()._datafin);
|
||||
else
|
||||
to.put(SOG_DATAPROSAF, app()._datafin);
|
||||
}
|
||||
if ((sog->curr() >= from) && (sog->curr() <= to))
|
||||
filtrato = TRUE;
|
||||
else
|
||||
filtrato = FALSE;
|
||||
|
||||
}
|
||||
return filtrato;
|
||||
}
|
||||
|
||||
bool TScadenze_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;
|
||||
|
||||
// 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 != "**")
|
||||
printer().formfeed();
|
||||
_codsez = codsez;
|
||||
_codsot = codsot;
|
||||
header_sezione(codsez, codsot);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TScadenze_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 TScadenze_application::set_print(int m)
|
||||
{
|
||||
_tipo_stampa = undefined;
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
switch (tasto)
|
||||
{
|
||||
case F_ELENCO:
|
||||
_tipo_stampa = elenco;
|
||||
_codsez = "**";
|
||||
_codsot = "**";
|
||||
break;
|
||||
case F_ETICHETTE:
|
||||
_tipo_stampa = etichette;
|
||||
case F_CARTOLINE:
|
||||
_tipo_stampa = cartoline;
|
||||
break;
|
||||
}
|
||||
if (_tipo_stampa != undefined)
|
||||
{
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
_dataini = _msk->get(F_DATAINI);
|
||||
_datafin = _msk->get(F_DATAFIN);
|
||||
_procdon = _msk->get(F_PROCDON1);
|
||||
|
||||
// filtro per sezioni selezionati
|
||||
filtra_sezioni();
|
||||
|
||||
// filtro per idoneo e non escluso
|
||||
current_cursor()->setfilter("((TCS->S6 == \"I\" ) || (TCS->S6 == \"F\")) && (ESCLUSO == \"\")", TRUE);
|
||||
|
||||
// filtro per procedura di donazione (controllo che abbia la data)
|
||||
/* questo filtro è nella filter_function
|
||||
TString procdon = _msk->get(F_PROCDON1);
|
||||
if (procdon == IDON_SI)
|
||||
current_cursor()->setfilter("(DATAPROSSI == \"\")", TRUE);
|
||||
else
|
||||
current_cursor()->setfilter("(DATAPROSAF == \"\")", TRUE);
|
||||
*/
|
||||
// filtro per categorie
|
||||
current_cursor()->set_filterfunction(filter_func_scadenze);
|
||||
reset_print();
|
||||
crea_intestazione();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TScadenze_application::crea_intestazione()
|
||||
{
|
||||
reset_header();
|
||||
|
||||
if (_tipo_stampa == elenco)
|
||||
{
|
||||
TString sep(132);
|
||||
sep = "SCADENZE DI DONAZIONE ";
|
||||
TString procdon = _msk->get(F_PROCDON1);
|
||||
sep << procdon ;
|
||||
TDate data = _msk->get(F_DATAINI);
|
||||
if (data.ok())
|
||||
{
|
||||
sep << " dal ";
|
||||
sep << data.string();
|
||||
}
|
||||
data = _msk->get(F_DATAFIN);
|
||||
if (data.ok())
|
||||
{
|
||||
sep << " al ";
|
||||
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@47gData ID@58gTipi idon.");
|
||||
set_header(5,"@47gTipo/Esito");
|
||||
set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g----------@58g-- -- -- --");
|
||||
}
|
||||
}
|
||||
|
||||
bool TScadenze_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 la denominazione della sezione nell'intestazione
|
||||
_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
|
||||
|
||||
_msk = new TMask("at3500a");
|
||||
|
||||
_form_eti = new TScadenze_form("AT_ETSOG");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TScadenze_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _form_eti;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int at3500(int argc, char* argv[])
|
||||
{
|
||||
|
||||
TScadenze_application a;
|
||||
|
||||
a.run(argc, argv, "Scadenze di donazione");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <mask.h>
|
||||
#include <form.h>
|
||||
#include <printapp.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "lf.h"
|
||||
#include "soggetti.h"
|
||||
#include "sezioni.h"
|
||||
|
||||
#include "at3.h"
|
||||
#include "at3500a.h"
|
||||
|
||||
#define ALIAS_LCP 100
|
||||
#define ALIAS_TCS 200
|
||||
#define IDON_SI "SI"
|
||||
#define IDON_AF "AF"
|
||||
|
||||
enum ts { undefined = 0, elenco = 1, etichette = 2, cartoline = 3 };
|
||||
|
||||
// definizione form per etichette
|
||||
class TScadenze_form : public TForm
|
||||
{
|
||||
public:
|
||||
|
||||
virtual TCursor* cursor() const;
|
||||
virtual TRelation* relation() const;
|
||||
TPrint_section& get_body() { return section('B'); } ;
|
||||
TScadenze_form(): TForm() {};
|
||||
TScadenze_form(const char* form, const char * code = "", int editlevel = 0, const char* desc = "")
|
||||
: TForm(form,code,editlevel,desc) {};
|
||||
virtual ~TScadenze_form() {};
|
||||
};
|
||||
|
||||
class TScadenze_application : public TPrintapp
|
||||
{
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TScadenze_form* _form_eti;
|
||||
TAssoc_array _categorie;
|
||||
|
||||
int _cur1, _cur2, _cur3, _cur4;
|
||||
TParagraph_string _cognome_nome;
|
||||
TDate _data_stampa;
|
||||
TDate _dataini, _datafin;
|
||||
TString16 _procdon;
|
||||
ts _tipo_stampa;
|
||||
TString16 _codsez, _codsot;
|
||||
|
||||
static bool filter_func_scadenze(const TRelation* rel);
|
||||
|
||||
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; }
|
||||
TScadenze_application() : _data_stampa(TODAY), _cognome_nome("",25) {}
|
||||
};
|
||||
|
||||
HIDDEN inline TScadenze_application& app() { return (TScadenze_application&) main_app(); }
|
||||
|
||||
TCursor* TScadenze_form::cursor() const { return app().current_cursor(); }
|
||||
|
||||
TRelation* TScadenze_form::relation() const { return cursor()->relation(); }
|
||||
|
||||
void TScadenze_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 TScadenze_application::set_page(int file, int cnt)
|
||||
{
|
||||
// costruzione etichette
|
||||
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@ld", FLD(LF_SOGGETTI,SOG_DATAULTID)); // potremmo mettere anche datastato
|
||||
set_row(1,"@58g@S", FLD(LF_SOGGETTI,SOG_IDON1));
|
||||
set_row(1,"@61g@S", FLD(LF_SOGGETTI,SOG_IDON2));
|
||||
set_row(1,"@64g@S", FLD(LF_SOGGETTI,SOG_IDON3));
|
||||
set_row(1,"@67g@S", FLD(LF_SOGGETTI,SOG_IDON4));
|
||||
|
||||
set_row(2,"@50g@S", FLD(LF_SOGGETTI,SOG_STATO));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool TScadenze_application::filter_func_scadenze(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 di prossima donazione
|
||||
if (filtrato)
|
||||
{
|
||||
TRectype from = sog->curr();
|
||||
TRectype to = sog->curr();
|
||||
from.zero();
|
||||
to.zero();
|
||||
if (app()._dataini.ok())
|
||||
{
|
||||
if (app()._procdon == IDON_SI)
|
||||
from.put(SOG_DATAPROSSI, app()._dataini);
|
||||
else
|
||||
from.put(SOG_DATAPROSAF, app()._dataini);
|
||||
}
|
||||
if (app()._datafin.ok())
|
||||
{
|
||||
if (app()._procdon == IDON_SI)
|
||||
to.put(SOG_DATAPROSSI, app()._datafin);
|
||||
else
|
||||
to.put(SOG_DATAPROSAF, app()._datafin);
|
||||
}
|
||||
filtrato = (sog->curr() >= from) && (sog->curr() <= to);
|
||||
}
|
||||
return filtrato;
|
||||
}
|
||||
|
||||
bool TScadenze_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;
|
||||
|
||||
// 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 != "**")
|
||||
printer().formfeed();
|
||||
_codsez = codsez;
|
||||
_codsot = codsot;
|
||||
header_sezione(codsez, codsot);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TScadenze_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 TScadenze_application::set_print(int m)
|
||||
{
|
||||
_tipo_stampa = undefined;
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
switch (tasto)
|
||||
{
|
||||
case F_ELENCO:
|
||||
_tipo_stampa = elenco;
|
||||
_codsez = "**";
|
||||
_codsot = "**";
|
||||
break;
|
||||
case F_ETICHETTE:
|
||||
_tipo_stampa = etichette;
|
||||
case F_CARTOLINE:
|
||||
_tipo_stampa = cartoline;
|
||||
break;
|
||||
}
|
||||
if (_tipo_stampa != undefined)
|
||||
{
|
||||
reset_files();
|
||||
add_file(LF_SOGGETTI);
|
||||
_dataini = _msk->get(F_DATAINI);
|
||||
_datafin = _msk->get(F_DATAFIN);
|
||||
_procdon = _msk->get(F_PROCDON1);
|
||||
// filtro per sezioni selezionati
|
||||
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 idoneo e non escluso
|
||||
current_cursor()->setfilter("((TCS->S6 == \"I\" ) || (TCS->S6 == \"F\")) && (ESCLUSO == \"\")", TRUE);
|
||||
|
||||
// filtro per procedura di donazione (controllo che abbia la data)
|
||||
/* questo filtro è nella filter_function
|
||||
TString16 procdon = _msk->get(F_PROCDON1);
|
||||
if (procdon == IDON_SI)
|
||||
current_cursor()->setfilter("(DATAPROSSI == \"\")", TRUE);
|
||||
else
|
||||
current_cursor()->setfilter("(DATAPROSAF == \"\")", TRUE);
|
||||
*/
|
||||
// filtro per categorie
|
||||
current_cursor()->set_filterfunction(filter_func_scadenze);
|
||||
reset_print();
|
||||
crea_intestazione();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TScadenze_application::crea_intestazione()
|
||||
{
|
||||
reset_header();
|
||||
|
||||
if (_tipo_stampa == elenco)
|
||||
{
|
||||
TString256 sep(132);
|
||||
sep = "SCADENZE DI DONAZIONE ";
|
||||
TString16 procdon = _msk->get(F_PROCDON1);
|
||||
sep << procdon ;
|
||||
TDate data = _msk->get(F_DATAINI);
|
||||
if (data.ok())
|
||||
{
|
||||
sep << " dal ";
|
||||
sep << data.string();
|
||||
}
|
||||
data = _msk->get(F_DATAFIN);
|
||||
if (data.ok())
|
||||
{
|
||||
sep << " al ";
|
||||
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@47gData ID@58gTipi idon.");
|
||||
set_header(5,"@47gTipo/Esito");
|
||||
set_header(6,"@0g------@7g--@10g-------------------------@36g----------@47g----------@58g-- -- -- --");
|
||||
}
|
||||
}
|
||||
|
||||
bool TScadenze_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 la denominazione della sezione nell'intestazione
|
||||
_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
|
||||
|
||||
_msk = new TMask("at3500a");
|
||||
|
||||
_form_eti = new TScadenze_form("AT_ETSOG");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TScadenze_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
delete _form_eti;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int at3500(int argc, char* argv[])
|
||||
{
|
||||
|
||||
TScadenze_application a;
|
||||
|
||||
a.run(argc, argv, "Scadenze di donazione");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user