Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Nuove voci di menu: cverifica integrità dati e correzione errato giornaliero donazioni


git-svn-id: svn://10.65.10.50/trunk@8023 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 1999-04-08 10:57:04 +00:00
parent 575e46d577
commit 3b27bf3cf1
10 changed files with 2044 additions and 9 deletions

View File

@ -116,11 +116,12 @@ Module = 0
Flags = ""
Item_01 = "Soggetti", "at0 -0", ""
Item_02 = "Giornaliero donazioni/controlli", "at0 -1", ""
Item_03 = "Giornaliero controlli", "at0 -2", ""
Item_04 = "Convocazioni su punto di prelievo", "at0 -3", ""
Item_05 = "Spostamento convocazioni", "at0 -4", ""
Item_06 = "Parametri di sezione", "at5 -0", ""
Item_07 = "Collegamento altre procedure", [AVIS_100]
Item_03 = "Correzione errato giornaliero don.", "at8 -5", ""
Item_04 = "Giornaliero controlli", "at0 -2", ""
Item_05 = "Convocazioni su punto di prelievo", "at0 -3", ""
Item_06 = "Spostamento convocazioni", "at0 -4", ""
Item_07 = "Parametri di sezione", "at5 -0", ""
Item_08 = "Collegamento altre procedure", [AVIS_100]
[AVIS_002]
Caption = "Tabelle"
@ -148,9 +149,9 @@ Picture = <at01.bmp>
Module = 0
Flags = ""
Item_01 = "Chiusura", "at0 -5", ""
Item_03 = "Sblocco sospesi", "at0 -6", ""
Item_04 = "Sblocco esclusi", "at0 -7", ""
Item_05 = "Modifica intervalli di don.", "at0 -8", ""
Item_02 = "Sblocco sospesi", "at0 -6", ""
Item_03 = "Sblocco esclusi", "at0 -7", ""
Item_04 = "Verifica integrit… dati", "at8 -4", ""
[AVIS_004]
Caption = "Stampe soggetti"

View File

@ -4,7 +4,7 @@
#include "at8.h"
#define usage "Error - usage : %s -{0|1|2|3}"
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
int main(int argc,char** argv)
@ -22,6 +22,10 @@ int main(int argc,char** argv)
rt = at8300(argc,argv) ; break;
case 3:
rt = at8400(argc,argv) ; break;
case 4:
rt = at8500(argc,argv) ; break;
case 5:
rt = at8600(argc,argv) ; break;
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -5,6 +5,8 @@ int at8100(int argc, char* argv[]);
int at8200(int argc, char* argv[]);
int at8300(int argc, char* argv[]);
int at8400(int argc, char* argv[]);
int at8500(int argc, char* argv[]);
int at8600(int argc, char* argv[]);
#endif // __AT8_H

View File

@ -22,3 +22,13 @@ MENUBAR MENU_BAR(3)
MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File"
/* at8 -4 verifica integrita' dati*/
MENUBAR MENU_BAR(4)
MENU MENU_BAR(4)
SUBMENU MENU_FILE "~File"
/* at8 -5 correzione errato giornaliero donazioni*/
MENUBAR MENU_BAR(5)
MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File"

340
at/at8500.cpp Executable file
View File

@ -0,0 +1,340 @@
#include <form.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include "at8.h"
#include "at8500a.h"
#include "atlib.h"
// nomi dei campi
#include "soggetti.h"
#include "donaz.h"
#include "contsan.h"
#include "idoneita.h"
#include "rconvoc.h"
class TIntegrita : public TPrintapp
{
static bool filter_func_integrita(const TRelation* rel);
TRelation* _rel;
TMask* _msk;
TLocalisamfile* _soggetti;
TLocalisamfile* _donaz;
TLocalisamfile* _contsan;
TLocalisamfile* _idoneita;
TRecord_array* _sdonazioni;
TRecord_array* _scontrolli;
TRecord_array* _sidoneita;
// parametri di sezione
int _intsi_f1, _intsi_f2, _intsi_m, _intaf_m, _etadonne;
int _numdon1, _numdon2;
TString16 _catini1, _catfin1, _catini2, _catfin2, _motivoid;
bool _sttess2, _dataisc, _nomessage, _autoid;
TAssoc_array _categorie;
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);
virtual print_action postprocess_print(int file, int counter);
public:
void crea_intestazione();
void filtra_sezioni();
//void header_sezione(const TString16 codsez, const TString16 codsot);
TMask& app_mask() { return *_msk; }
TIntegrita(){}
};
HIDDEN inline TIntegrita& app() { return (TIntegrita&) main_app(); }
print_action TIntegrita::postprocess_print(int file, int counter)
{
printer().formfeed();
return NEXT_PAGE;
}
void TIntegrita::filtra_sezioni()
{
const TString16 sezini = _msk->get(F_SEZINI);
const TString16 sotini = _msk->get(F_SOTINI);
const TString16 sezfin = _msk->get(F_SEZFIN);
const TString16 sotfin = _msk->get(F_SOTFIN);
TRectype da(LF_SOGGETTI);
TRectype a(LF_SOGGETTI);
if (sezini.not_empty())
da.put(SOG_CODSEZ, sezini);
if (sotini.not_empty())
da.put(SOG_CODSOT, sotini);
if (sezfin.not_empty())
a.put(SOG_CODSEZ, sezfin);
if (sotfin.not_empty())
a.put(SOG_CODSOT, sotfin);
current_cursor()->setregion(da, a);
}
void TIntegrita::set_page(int file, int cnt)
{
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
set_row(1,"@9g@S", FLD(LF_SOGGETTI,SOG_CATDON));
set_row(1,"@12g@S", FLD(LF_SOGGETTI,SOG_COGNOME));
set_row(1,"@38g@S", FLD(LF_SOGGETTI,SOG_NOME));
set_row(1,"@64g@d", FLD(LF_SOGGETTI,SOG_DATAULTDON));
set_row(2,"");
}
bool TIntegrita::filter_func_integrita(const TRelation* rel)
{
bool filtrato = TRUE;
TLocalisamfile& sog = rel->lfile();
//filtro per categorie
TAssoc_array& categorie = app()._categorie;
if (categorie.items() != 0)
{
const TString16 cat = sog.get(SOG_CATDON);
filtrato = categorie.is_key((const char*) cat);
}
return filtrato;
}
bool TIntegrita::preprocess_page(int file, int counter)
{
TRectype& recsog = current_cursor()->curr();
// salto pagina se cambio sezione
/*
const TString16 codsez = recsog.get(SOG_CODSEZ);
const TString16 codsot = recsog.get(SOG_CODSOT);
if ((_codsez!=codsez)||(_codsot!=codsot))
{
if (_codsez != "**")
printer().formfeed();
_codsez = codsez;
_codsot = codsot;
header_sezione(codsez, codsot);
}
*/
const long codice = recsog.get_long(SOG_CODICE);
TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, codice);
int err = _sdonazioni->read(key);
if ((err==NOERR) && (_sdonazioni->rows()>0))
{
const TRectype& riga = _sdonazioni->row(_sdonazioni->rows());
const TDate datadon = riga.get(DON_DATADON);
const TDate datasog = recsog.get_date(SOG_DATAULTDON);
if (datadon == datasog)
return FALSE;
else
{
calcola_donazioni_lib(recsog, _sdonazioni);
recsog.rewrite(_rel->lfile());
TRectype* key = new TRectype(LF_IDONEITA);
key->put(IDO_CODICE, recsog.get(SOG_CODICE));
_sidoneita->read(key);
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, recsog.get(SOG_CODICE));
_scontrolli->read(keyc);
if (_scontrolli->rows()>0 || _sidoneita->rows()>0)
{
con_reord(recsog,_scontrolli,_sidoneita);
recsog.rewrite(_rel->lfile());
}
TTable ctd("CTD");
TString16 catdon = recsog.get(SOG_CATDON);
const int totdon = recsog.get_int(SOG_TOTDON);
ctd.put("CODTAB",catdon);
if (ctd.read() == NOERR)
{
bool dimissione = ctd.get_bool("B0");
if (dimissione)
{
recsog.put(SOG_CATDON,ctd.get("S6"));
if (ctd.get("S6").not_empty())
catdon = ctd.get("S6");
}
if ((catdon == _catini1 || _catini1.empty()) && (totdon==_numdon1) && _catfin1.not_empty())
recsog.put(SOG_CATDON, _catfin1);
if ((catdon == _catini2 || _catini2.empty()) && (totdon>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || dimissione))
recsog.put(SOG_CATDON, _catfin2);
}
TDate dataiscsog = recsog.get_date(SOG_DATAISC);
if (!dataiscsog.ok() && _dataisc)
{
if (!recsog.get_date(SOG_DATAPRISI) == NULLDATE)
recsog.put(SOG_DATAISC,recsog.get(SOG_DATAPRISI));
else
{
const TRectype& riga = _sdonazioni->row(1);
recsog.put(SOG_DATAISC,riga.get(DON_DATADON));
}
}
const TDate dataprossi = recsog.get_date(SOG_DATAPROSSI);
const TDate dataconv = recsog.get_date(SOG_DATACONV);
const char stato = modstato_tcs(recsog.get(SOG_STATO));
const TString16 statosi = recsog.get(SOG_STATOSI);
if ((stato == 'S') || (statosi == SOSPENSIONE) || (dataprossi > dataconv) || !dataprossi.ok())
{
TLocalisamfile rconvoc(LF_RCONVOC);
rconvoc.setkey(3);
rconvoc.zero();
rconvoc.put(RCV_CODICE, recsog.get(SOG_CODICE));
rconvoc.put(RCV_DATACONV, recsog.get(SOG_DATACONV));
if (rconvoc.read() == NOERR)
{
rconvoc.put(RCV_ANNULLATO, TRUE);
int err = rconvoc.write();
}
const TDate datanulla(NULLDATE);
recsog.put(SOG_DATACONV, datanulla);
recsog.put(SOG_DATAULTSOL, datanulla);
const int numzero = 0;
recsog.put(SOG_NUMCONV,numzero);
}
recsog.put(SOG_DATAULTAGG, TODAY);
recsog.put(SOG_UTENULTAGG, "V.I.D.");
recsog.rewrite(_rel->lfile());
}
}
else
return FALSE;
return TRUE;
}
/*
void TIntegrita::header_sezione(const TString16 codsez, const TString16 codsot)
{
const TString80 densez = current_cursor()->curr(LF_SEZIONI).get(SEZ_DENSEZ);
const TString80 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 TIntegrita::set_print(int)
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
{
_codsez = "**";
_codsez = "**";
reset_files();
add_file(LF_SOGGETTI);
filtra_sezioni();
// filtro per categorie
_categorie.destroy();
const TString16 catpri = _msk->get(F_CAT1);
const TString16 catsec = _msk->get(F_CAT2);
const TString16 catter = _msk->get(F_CAT3);
const TString16 catqua = _msk->get(F_CAT4);
const TString16 catqui = _msk->get(F_CAT5);
const TString16 catses = _msk->get(F_CAT6);
if (catpri.not_empty() && 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_integrita);
reset_print();
crea_intestazione();
return TRUE;
}
else
return FALSE;
}
void TIntegrita::crea_intestazione()
{
reset_header();
TString sep(132);
sep = "VERIFICA INTEGRITA DATI";
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);
}
bool TIntegrita::user_create()
{
_msk = new TMask("at8500a");
_rel = new TRelation(LF_SOGGETTI);
_donaz = new TLocalisamfile(LF_DONAZ);
_contsan = new TLocalisamfile(LF_CONTSAN);
_idoneita = new TLocalisamfile(LF_IDONEITA);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
TConfig config(CONFIG_STUDIO);
_numdon1 = config.get_int("NumDon1");
_numdon2 = config.get_int("NumDon2");
_catini1 = config.get("CatIni1");
_catfin1 = config.get("CatFin1");
_catini2 = config.get("CatIni2");
_catfin2 = config.get("CatFin2");
_sttess2 = config.get_bool("StTess2");
_dataisc = config.get_bool("DataIsc");
_nomessage = config.get_bool("NoMessage");
_etadonne = config.get_int("EtaDonne");
_intsi_f1 = config.get_int("IntSI_F1");
_intsi_f2 = config.get_int("IntSI_F2");
_intsi_m = config.get_int("IntSI_M");
_intaf_m = config.get_int("IntAF_M");
add_cursor(new TCursor(_rel, "", 3));
return TRUE;
}
bool TIntegrita::user_destroy()
{
delete _sidoneita;
delete _scontrolli;
delete _sdonazioni;
delete _idoneita;
delete _contsan;
delete _donaz;
delete _rel;
delete _msk;
return TRUE;
}
int at8500(int argc, char* argv[])
{
TIntegrita a;
a.run(argc, argv, "Verifica integrita' dati");
return 0;
}

24
at/at8500a.h Executable file
View File

@ -0,0 +1,24 @@
// verifica integrita' dati
// definizione campi per maschera di selezione
#define F_SEZINI 101
#define F_D_SEZINI 102
#define F_SOTINI 103
#define F_D_SOTINI 104
#define F_SEZFIN 105
#define F_D_SEZFIN 106
#define F_SOTFIN 107
#define F_D_SOTFIN 108
#define F_CAT1 201
#define F_D_CAT1 202
#define F_CAT2 203
#define F_D_CAT2 204
#define F_CAT3 205
#define F_D_CAT3 206
#define F_CAT4 207
#define F_D_CAT4 208
#define F_CAT5 209
#define F_D_CAT5 210
#define F_CAT6 211
#define F_D_CAT6 212

260
at/at8500a.uml Executable file
View File

@ -0,0 +1,260 @@
#include "at8500a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -11 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Verifica integrita' dati" -1 -1 78 20
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Scelta sezioni/sottogruppi"
END
STRING F_SEZINI 2
BEGIN
PROMPT 2 2 "Da "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZINI
INPUT CODSOT F_SOTINI
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZINI CODSEZ
OUTPUT F_D_SEZINI DENSEZ
OUTPUT F_SOTINI CODSOT
OUTPUT F_D_SOTINI DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione da cui partire"
END
STRING F_D_SEZINI 25
BEGIN
PROMPT 11 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZINI
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZINI
CHECKTYPE NORMAL
HELP "Sezione da cui partire"
END
STRING F_SOTINI 2
BEGIN
PROMPT 2 3 " "
COPY ALL F_SEZINI
CHECKTYPE SEARCH
HELP "Codice sottogruppo da cui partire"
END
STRING F_D_SOTINI 25
BEGIN
PROMPT 11 3 ""
FLAGS "U"
COPY USE F_D_SEZINI
INPUT DENSEZ F_D_SEZINI
INPUT DENSOT F_D_SOTINI
COPY DISPLAY F_D_SEZINI
COPY OUTPUT F_D_SEZINI
CHECKTYPE NORMAL
HELP "Sottogruppo da cui partire"
END
STRING F_SEZFIN 2
BEGIN
PROMPT 41 2 "A "
FLAGS "U"
USE LF_SEZIONI
INPUT CODSEZ F_SEZFIN
INPUT CODSOT F_SOTFIN
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
OUTPUT F_SEZFIN CODSEZ
OUTPUT F_D_SEZFIN DENSEZ
OUTPUT F_SOTFIN CODSOT
OUTPUT F_D_SOTFIN DENSOT
CHECKTYPE SEARCH
HELP "Codice sezione finale"
END
STRING F_D_SEZFIN 25
BEGIN
PROMPT 49 2 ""
FLAGS "U"
USE LF_SEZIONI KEY 2
INPUT DENSEZ F_D_SEZFIN
DISPLAY "Sezione@25" DENSEZ
DISPLAY "Sottogruppo@25" DENSOT
DISPLAY "Cod.sez" CODSEZ
DISPLAY "Cod.sot." CODSOT
COPY OUTPUT F_SEZFIN
CHECKTYPE NORMAL
HELP "Sezione finale"
END
STRING F_SOTFIN 2
BEGIN
PROMPT 41 3 " "
COPY ALL F_SEZFIN
CHECKTYPE SEARCH
HELP "Codice sottogruppo finale"
END
STRING F_D_SOTFIN 25
BEGIN
PROMPT 49 3 ""
FLAGS "U"
COPY USE F_D_SEZFIN
INPUT DENSEZ F_D_SEZFIN
INPUT DENSOT F_D_SOTFIN
COPY DISPLAY F_D_SEZFIN
COPY OUTPUT F_D_SEZFIN
CHECKTYPE NORMAL
HELP "Sottogruppo finale"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 5 "Categorie"
END
STRING F_CAT1 2
BEGIN
PROMPT 2 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CAT1 CODTAB
OUTPUT F_D_CAT1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT1 30
BEGIN
PROMPT 8 6 ""
FLAGS "D"
END
STRING F_CAT2 2
BEGIN
PROMPT 2 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT2
COPY DISPLAY F_CAT1
OUTPUT F_CAT2 CODTAB
OUTPUT F_D_CAT2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT2 30
BEGIN
PROMPT 8 7 ""
FLAGS "D"
END
STRING F_CAT3 2
BEGIN
PROMPT 2 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT3
COPY DISPLAY F_CAT1
OUTPUT F_CAT3 CODTAB
OUTPUT F_D_CAT3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT3 30
BEGIN
PROMPT 8 8 ""
FLAGS "D"
END
STRING F_CAT4 2
BEGIN
PROMPT 40 6 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT4
COPY DISPLAY F_CAT1
OUTPUT F_CAT4 CODTAB
OUTPUT F_D_CAT4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT4 30
BEGIN
PROMPT 46 6 ""
FLAGS "D"
END
STRING F_CAT5 2
BEGIN
PROMPT 40 7 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT5
COPY DISPLAY F_CAT1
OUTPUT F_CAT5 CODTAB
OUTPUT F_D_CAT5 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT5 30
BEGIN
PROMPT 46 7 ""
FLAGS "D"
END
STRING F_CAT6 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE CTD
INPUT CODTAB F_CAT6
COPY DISPLAY F_CAT1
OUTPUT F_CAT6 CODTAB
OUTPUT F_D_CAT6 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Categoria di appartenenza"
END
STRING F_D_CAT6 30
BEGIN
PROMPT 46 8 ""
FLAGS "D"
END
ENDPAGE
ENDMASK

783
at/at8600.cpp Executable file
View File

@ -0,0 +1,783 @@
#include <applicat.h>
#include <execp.h>
#include <mask.h>
#include <msksheet.h>
#include <mailbox.h>
#include <prefix.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
#include <tabutil.h>
#include <urldefid.h>
#include <validate.h>
#include <lffiles.h>
#include "at8.h"
// nomi campi maschera
#include "at8600a.h"
#include "atlib.h"
// nomi dei campi
#include "soggetti.h"
#include "donaz.h"
#include "contsan.h"
#include "idoneita.h"
#include "rconvoc.h"
#define ALIAS_CTD 700
class TCorreggiDC : public TApplication
{
TMask* _msk;
TRelation* _rel;
TLocalisamfile* _soggetti;
TLocalisamfile* _donaz;
TLocalisamfile* _contsan;
TLocalisamfile* _idoneita;
TLocalisamfile* _rconvoc;
TRecord_array* _sdonazioni;
TRecord_array* _scontrolli;
TRecord_array* _sidoneita;
TDate _datadon, _ndatadon;
TString16 _tipodon, _luogodon, _ntipodon, _nluogodon;
// parametri di sezione
int _intsi_f1, _intsi_f2, _intsi_m, _intaf_m, _etadonne;
int _numdon1, _numdon2;
TString16 _catini1, _catfin1, _catini2, _catfin2, _motivoid;
bool _sttess2, _dataisc, _nomessage, _autoid;
protected:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual TMask& get_mask() { return *_msk; }
virtual TRelation* get_relation() const { return _rel; }
int read(TSheet_field& s);
bool modifica(TSheet_field& s);
bool elimina(TSheet_field& s);
public:
TCorreggiDC() {}
};
HIDDEN inline TCorreggiDC& app() { return (TCorreggiDC&) main_app(); }
bool TCorreggiDC::create()
{
TApplication::create();
_msk = new TMask("at8600a");
_rel = new TRelation(LF_SOGGETTI);
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_donaz = new TLocalisamfile(LF_DONAZ);
_contsan = new TLocalisamfile(LF_CONTSAN);
_idoneita = new TLocalisamfile(LF_IDONEITA);
_rconvoc = new TLocalisamfile(LF_RCONVOC);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
TConfig config(CONFIG_STUDIO);
_numdon1 = config.get_int("NumDon1");
_numdon2 = config.get_int("NumDon2");
_catini1 = config.get("CatIni1");
_catfin1 = config.get("CatFin1");
_catini2 = config.get("CatIni2");
_catfin2 = config.get("CatFin2");
_sttess2 = config.get_bool("StTess2");
_dataisc = config.get_bool("DataIsc");
_nomessage = config.get_bool("NoMessage");
_etadonne = config.get_int("EtaDonne");
_intsi_f1 = config.get_int("IntSI_F1");
_intsi_f2 = config.get_int("IntSI_F2");
_intsi_m = config.get_int("IntSI_M");
_intaf_m = config.get_int("IntAF_M");
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
}
bool TCorreggiDC::destroy()
{
delete _sidoneita;
delete _scontrolli;
delete _sdonazioni;
delete _rconvoc;
delete _idoneita;
delete _contsan;
delete _donaz;
delete _rel;
delete _msk;
return TApplication::destroy();
}
bool TCorreggiDC::menu(MENU_TAG m)
{
TMask& msk = get_mask();
msk.field(F_MODIFICA).disable();
msk.field(F_ELIMINA).disable();
msk.field(F_MODIFICA).hide();
msk.field(F_ELIMINA).hide();
KEY tasto = K_ENTER;
TSheet_field& s = (TSheet_field&)msk.field(F_SOGGETTI);
while (tasto != K_QUIT)
{
tasto = msk.run();
if (tasto == F_VISUALIZZA)
{
_datadon = msk.get_date(F_DATADON);
_tipodon = msk.get(F_TIPODON);
_luogodon = msk.get(F_LUOGODON);
int totale = TCorreggiDC::read(s);
if (totale > 0)
{
msk.set(F_TOTALE, totale);
msk.disable(F_VISUALIZZA);
msk.hide(F_VISUALIZZA);
msk.enable(F_MODIFICA);
msk.enable(F_ELIMINA);
msk.show(F_MODIFICA);
msk.show(F_ELIMINA);
}
else
error_box("ATTENZIONE! Non ci sono donazioni inserite con le caratteristiche richieste");
}
if (tasto == F_MODIFICA)
{
_ndatadon = msk.get_date(F_NDATADON);
_ntipodon = msk.get(F_NTIPODON);
_nluogodon = msk.get(F_NLUOGODON);
if (_ndatadon.ok() || !_ntipodon.blank() || !_nluogodon.blank())
{
if (yesno_box("Confermare la modifica dei dati della donazione?"))
TCorreggiDC::modifica(s);
}
else
error_box("Inserire almeno un dato da modificare");
}
if (tasto == F_ELIMINA)
{
if (yesno_box("Confermare l'eliminazione delle donazioni inserite?"))
TCorreggiDC::elimina(s);
}
if (tasto == F_MODIFICA || tasto == F_ELIMINA)
{
msk.reset();
msk.field(F_MODIFICA).disable();
msk.field(F_ELIMINA).disable();
msk.field(F_MODIFICA).hide();
msk.field(F_ELIMINA).hide();
msk.enable(F_VISUALIZZA);
msk.show(F_VISUALIZZA);
}
}
return FALSE;
}
bool TCorreggiDC::elimina(TSheet_field& s)
{
TMask& m = s.mask();
int items = s.items();
TProgind *pi;
pi = new TProgind(items,"Eliminazione donazioni", FALSE, TRUE, 10);
pi->setstatus(1);
TLocalisamfile& sog = get_relation()->lfile();
TLocalisamfile rconv(LF_RCONVOC);
for (int rigasog=1; rigasog<=s.items(); rigasog++)
{
pi->addstatus(1);
TToken_string& row = s.row(rigasog-1);
const long codsog = row.get_long(0);
if (codsog != 0)
{
sog.setkey(1);
sog.zero();
sog.put(SOG_CODICE, codsog);
int err = sog.read();
if (err == NOERR)
{
bool deleted = FALSE;
TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, row.get(0));
err = _sdonazioni->read(key);
if (err == NOERR)
{
int r=_sdonazioni->rows();
while (r>=1 && !deleted)
{
const TRectype& riga = _sdonazioni->row(r);
const TDate d = riga.get(DON_DATADON);
if (_datadon==d)
{
_sdonazioni->destroy_row(r,TRUE);
deleted=TRUE;
r=0;
}
r--;
}
}
if (deleted)
{
err = _sdonazioni->write(TRUE);
calcola_donazioni_lib(sog.curr(),_sdonazioni);
// aggiorno data e utente ultimo aggiornamento
const TDate oggi(TODAY);
sog.put(SOG_DATAULTAGG,oggi);
sog.put(SOG_UTENULTAGG,user());
if (err == NOERR)
sog.rewrite();
else
{
error_box("Errore %d durante la scrittura della riga %d", err, rigasog);
break;
}
}
}
}
}
delete pi;
return TRUE;
}
bool TCorreggiDC::modifica(TSheet_field& s)
{
s.destroy();
TLocalisamfile donaz(LF_DONAZ);
TLocalisamfile soggetti(LF_SOGGETTI);
soggetti.setkey(1);
donaz.setkey(4);
donaz.zero();
donaz.put(DON_DATADON, _datadon);
if (_tipodon.not_empty())
{
donaz.put(DON_TIPODON, _tipodon);
if (_luogodon.not_empty())
donaz.put(DON_LUOGODON, _luogodon);
}
TString16 luogodon;
bool leggi = TRUE;
TRectype r(donaz.curr());
TRectype rc(donaz.curr());
int items = 0;
for(donaz.read(); !donaz.eof(); donaz.next())
{
//if (donaz.curr() != r) break;
if (rc != r) break;
if (_tipodon.empty() && _luogodon.not_empty())
{
luogodon = donaz.get(DON_LUOGODON);
if (luogodon == _luogodon)
leggi = TRUE;
else
leggi = FALSE;
}
else
leggi = TRUE;
if (leggi)
{
rc = donaz.curr();
if (!_nluogodon.blank())
{
donaz.put(DON_LUOGODON, _nluogodon);
donaz.rewrite();
}
}
}
return TRUE;
}
int TCorreggiDC::read(TSheet_field& s)
{
s.destroy();
TLocalisamfile donaz(LF_DONAZ);
TLocalisamfile soggetti(LF_SOGGETTI);
soggetti.setkey(1);
donaz.setkey(4);
donaz.zero();
donaz.put(DON_DATADON, _datadon);
if (_tipodon.not_empty())
{
donaz.put(DON_TIPODON, _tipodon);
if (_luogodon.not_empty())
donaz.put(DON_LUOGODON, _luogodon);
}
TString16 luogodon;
bool leggi = TRUE;
TRectype r(donaz.curr());
int items = 0;
for(donaz.read(); !donaz.eof(); donaz.next())
{
if (donaz.curr() != r) break;
if (_tipodon.empty() && _luogodon.not_empty())
{
luogodon = donaz.get(DON_LUOGODON);
if (luogodon == _luogodon)
leggi = TRUE;
else
leggi = FALSE;
}
else
leggi = TRUE;
if (leggi)
{
TToken_string& row = s.row(items);
row.add(donaz.get(DON_CODICE));
soggetti.zero();
soggetti.put(SOG_CODICE,donaz.get(DON_CODICE));
int err = soggetti.read();
if (err == NOERR)
{
row.add(soggetti.get(SOG_COGNOME));
row.add(soggetti.get(SOG_NOME));
row.add(soggetti.get(SOG_TESSAVIS));
}
else
{
row.add("");
row.add("");
row.add("");
}
row.add(donaz.get(DON_TIPODON));
row.add("");
row.add(donaz.get(DON_ETICHETTA));
row.add(donaz.get(DON_PRIMADON));
row.add(""); // data donazione se diversa
if (err == NOERR)
{
row.add(soggetti.get(SOG_DATANASC));
row.add(soggetti.get(SOG_CODSEZ));
row.add(soggetti.get(SOG_CODSOT));
row.add(soggetti.get(SOG_CATDON));
row.add(soggetti.get(SOG_INTSI));
}
items++;
}
}
return items;
}
/*
int TCorreggiDC::modifica(TSheet_field& s)
{
TMask& m = s.mask();
m.disable(-1);
int items = s.items();
TProgind *pi;
pi = new TProgind(items,"Registrazione donazioni e controlli", FALSE, TRUE, 10);
pi->setstatus(1);
TLocalisamfile& sog = get_relation()->lfile();
TLocalisamfile rconv(LF_RCONVOC);
for (int rigasog=1; rigasog<=s.items(); rigasog++)
{
pi->addstatus(1);
TToken_string& row = s.row(rigasog-1);
const long codsog = row.get_long(0);
if (codsog != 0)
{
sog.setkey(1);
sog.zero();
sog.put(SOG_CODICE, codsog);
int err = sog.read();
if (err == NOERR)
{
TDate datadonazione = row.get(8);
if (!datadonazione.ok())
datadonazione = _datadon;
TString16 tipocon = row.get(5);
if (tipocon.blank())
tipocon = m.get(F_TIPOCON);
if (tipocon.not_empty())
{
TRectype* recc = new TRectype(LF_CONTSAN);
recc->put(CON_CODICE, row.get(0));
recc->put(CON_DATACON, datadonazione);
recc->put(CON_TIPOCON, tipocon);
if (modstato_tcs(tipocon) == 'I')
{
recc->put(CON_IDON1,sog.get(SOG_IDON1));
recc->put(CON_IDON2,sog.get(SOG_IDON2));
recc->put(CON_IDON3,sog.get(SOG_IDON3));
recc->put(CON_IDON4,sog.get(SOG_IDON4));
recc->put(CON_INTSI,sog.get(SOG_INTSI));
recc->put(CON_INTAF,sog.get(SOG_INTAF));
}
bool insert = FALSE;
bool exist = FALSE;
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, row.get(0));
int err = _scontrolli->read(keyc);
if (err == NOERR)
{
int r=_scontrolli->rows();
while (r>=1 && !insert && !exist)
{
const TRectype& riga = _scontrolli->row(r);
const TDate d = riga.get(CON_DATACON);
if (datadonazione==d) // esiste già un controllo in questa data
{
exist=TRUE;
r=0;
}
else
if (datadonazione > d)
{
recc->put(CON_PROGCON,r+1);
_scontrolli->insert_row(recc);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
}
}
else
if (err == _iseof || err == _isemptyfile)
{
recc->put(CON_PROGCON,1);
_scontrolli->insert_row(recc);
}
if (!exist)
{
_scontrolli->write(TRUE);
TRectype* keyc = new TRectype(LF_IDONEITA);
keyc->put(IDO_CODICE, row.get(0));
int err = _sidoneita->read(keyc);
con_reord(sog.curr(),_scontrolli,_sidoneita);
}
}
TRectype* rec = new TRectype(LF_DONAZ);
rec->put(DON_CODICE, row.get(0));
rec->put(DON_DATADON, datadonazione);
TString16 tipodon = row.get(4);
if (tipodon.blank())
tipodon = _tipodon;
rec->put(DON_TIPODON, tipodon);
rec->put(DON_LUOGODON, _luogodon);
rec->put(DON_ETICHETTA, row.get(6));
rec->put(DON_PRIMADON, row.get(7));
rec->put(DON_CODSEZ,sog.get(SOG_CODSEZ));
rec->put(DON_CODSOT,sog.get(SOG_CODSOT));
bool insert = FALSE;
bool exist = FALSE;
TRectype* key = new TRectype(LF_DONAZ);
key->put(DON_CODICE, row.get(0));
err = _sdonazioni->read(key);
if (err == NOERR)
{
int r=_sdonazioni->rows();
while (r>=1 && !insert && !exist)
{
const TRectype& riga = _sdonazioni->row(r);
const TDate d = riga.get(DON_DATADON);
if (datadonazione==d) // esiste gia' una donazione in questa data
{
exist=TRUE;
r=0;
}
else
if (datadonazione > d)
{
rec->put(DON_PROGDON,r+1);
_sdonazioni->insert_row(rec);
insert=TRUE;
}
r--;
}
if (!exist && !insert)
{
rec->put(DON_PROGDON,1);
_sdonazioni->insert_row(rec);
}
}
else
if (err == _iseof || err == _isemptyfile)
{
rec->put(DON_PROGDON,1);
_sdonazioni->insert_row(rec);
}
if (!exist)
{
err = _sdonazioni->write(TRUE);
// controllo se è idoneo
bool ctrlsi = FALSE; //devo controllare se è idoneo SI
bool ctrlaf = FALSE; //devo controllare se è idoneo AF
bool id_si = FALSE; // il soggetto è idoneo per si?
bool id_af = FALSE; // il soggetto è idoneo per af?
char modstato = ' ';
TString16 stato = sog.get(SOG_STATO); // stato attuale
TString16 statosi = sog.get(SOG_STATOSI); // stato attuale SI
TString16 statoaf = sog.get(SOG_STATOAF); // stato attuale AF
TString16 id1 = sog.get(SOG_IDON1); // idon. 1
TString16 id2 = sog.get(SOG_IDON2); // idon. 2
TString16 id3 = sog.get(SOG_IDON3); // idon. 3
TString16 id4 = sog.get(SOG_IDON4); // idon. 4
int intsi = sog.get_int(SOG_INTSI); // intervallo per SI
int intaf = sog.get_int(SOG_INTAF); // intervallo per AF
//id_si = ((is_idon(id1,id2,id3,id4,IDON_SI) || (statosi == "ID")) && intsi != 0); // il soggetto è idoneo SI
//id_af = ((is_idon(id1,id2,id3,id4,IDON_AF) || (statoaf == "ID")) && intaf != 0); // il soggetto è idoneo AF
id_si = ((statosi == "ID") && (intsi != 0)); // il soggetto è idoneo SI
id_af = ((statoaf == "ID") && (intaf != 0)); // il soggetto è idoneo AF
int totdon = sog.get_int(SOG_TOTDON);
TDate dataultdon = sog.get_date(SOG_DATAULTDON);
sog.put(SOG_TOTDON,totdon+1);
if (datadonazione > dataultdon)
{
sog.put(SOG_DATAULTDON,datadonazione);
sog.put(SOG_TIPOULTDON,tipodon);
}
if (is_donaz(tipodon,IDON_SI))
{
ctrlsi = TRUE;
totdon = sog.get_int(SOG_TOTDONSI);
sog.put(SOG_TOTDONSI,totdon+1);
dataultdon = sog.get_date(SOG_DATAULTSI);
if (datadonazione>dataultdon)
sog.put(SOG_DATAULTSI,datadonazione);
}
if (is_donaz(tipodon,IDON_AF))
{
ctrlaf = TRUE;
totdon = sog.get_int(SOG_TOTDONAF);
sog.put(SOG_TOTDONAF,totdon+1);
dataultdon = sog.get_date(SOG_DATAULTAF);
if (datadonazione>dataultdon)
sog.put(SOG_DATAULTAF,datadonazione);
}
dataultdon = sog.get_date(SOG_DATAULTDON); // data ultima donazione
const TString16 tipoultdon(sog.get(SOG_TIPOULTDON)); // tipo ultima donazione
TDate datasi(NULLDATE); // data prossima si calcolata
TDate dataaf(NULLDATE); // data prossima af calcolata
TDate dataultsi(NULLDATE); // data ultima donazione si
modstato = modstato_tcs(stato);
// il soggetto è idoneo per il tipo di donazione ?
if ((ctrlsi) && (!id_si) && (_autoid) && (modstato!='B'))
{
TRectype* key = new TRectype(LF_IDONEITA);
long codice = sog.get_long(SOG_CODICE);
key->put(IDO_CODICE, codice);
int err = _sidoneita->read(key);
int progido = _sidoneita->rows()+1;
TRectype& recido = _idoneita->curr();
recido.zero();
recido.put(IDO_CODICE, codice);
recido.put(IDO_PROGIDO, progido);
recido.put(IDO_DATAIDO, datadonazione);
recido.put(IDO_IDO_SOS, "ID");
recido.put(IDO_TIPOIDO, "SI");
TString80 resp = user();
resp << " - HA DONATO OGGI";
recido.put(IDO_RESPONSAB, resp);
recido.put(IDO_MOTIVO, _motivoid);
recido.put(IDO_INTERVALLO, sog.get(SOG_INTSI));
if (sog.get_int(SOG_INTSI) == 0)
{
const TString16 sesso = sog.get(SOG_SESSO);
if (sesso == "2")
{
TDate datanasc = sog.get_date(SOG_DATANASC);
int eta = datadonazione.year() - datanasc.year();
if(eta <= _etadonne)
recido.put(IDO_INTERVALLO, _intsi_f1);
else
recido.put(IDO_INTERVALLO, _intsi_f2);
}
else
recido.put(IDO_INTERVALLO, _intsi_m);
}
_sidoneita->add_row(recido);
_sidoneita->rewrite();
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, codice);
err = _scontrolli->read(keyc);
con_reord(sog.curr(),_scontrolli,_sidoneita);
sog.rewrite();
stato = sog.get(SOG_STATO); // stato attuale
modstato = modstato_tcs(stato);
}
if ((ctrlaf) && (!id_af) && (_autoid) && (modstato!='B'))
{
TRectype* key = new TRectype(LF_IDONEITA);
long codice = sog.get_long(SOG_CODICE);
key->put(IDO_CODICE, codice);
int err = _sidoneita->read(key);
int progido = _sidoneita->rows()+1;
TRectype& recido = _idoneita->curr();
recido.zero();
recido.put(IDO_CODICE, codice);
recido.put(IDO_PROGIDO, progido);
recido.put(IDO_DATAIDO, datadonazione);
recido.put(IDO_IDO_SOS, "ID");
recido.put(IDO_TIPOIDO, "AF");
TString80 resp = user();
resp << " - HA DONATO OGGI";
recido.put(IDO_RESPONSAB, resp);
recido.put(IDO_MOTIVO, _motivoid);
recido.put(IDO_INTERVALLO, sog.get(SOG_INTAF));
if (sog.get_int(SOG_INTAF) == 0)
recido.put(IDO_INTERVALLO, _intaf_m);
_sidoneita->add_row(recido);
_sidoneita->rewrite();
TRectype* keyc = new TRectype(LF_CONTSAN);
keyc->put(CON_CODICE, codice);
err = _scontrolli->read(keyc);
con_reord(sog.curr(),_scontrolli,_sidoneita);
sog.rewrite();
stato = sog.get(SOG_STATO); // stato attuale
modstato = modstato_tcs(stato);
}
sog.get(SOG_STATO); // stato attuale
statosi = sog.get(SOG_STATOSI); // stato attuale SI
statoaf = sog.get(SOG_STATOAF); // stato attuale AF
id1 = sog.get(SOG_IDON1); // idon. 1
id2 = sog.get(SOG_IDON2); // idon. 2
id3 = sog.get(SOG_IDON3); // idon. 3
id4 = sog.get(SOG_IDON4); // idon. 4
intsi = sog.get_int(SOG_INTSI); // intervallo per SI
intaf = sog.get_int(SOG_INTAF); // intervallo per AF
modstato = modstato_tcs(stato);
if (modstato == 'I' || modstato == 'F') // il soggetto è idoneo
{
//id_si = (is_idon(id1,id2,id3,id4,IDON_SI) && intsi != 0); // il soggetto è idoneo SI
//id_af = (is_idon(id1,id2,id3,id4,IDON_AF) && intaf != 0); // il soggetto è idoneo AF
id_si = ((statosi == "ID") && (intsi != 0)); // il soggetto è idoneo SI
id_af = ((statoaf == "ID") && (intaf != 0)); // il soggetto è idoneo AF
if (dataultdon.ok()) // se ha fatto almeno una donazione
{
if (is_donaz(tipoultdon,IDON_SI)) // se l'ultima donazione è una SI
{
if (id_si)
{
datasi=dataultdon;
datasi+=intsi;
}
if (id_af)
{
dataaf=dataultdon;
dataaf+=intaf;
}
}
if (is_donaz(tipoultdon,IDON_AF)) // se l'ultima donazione è una AF
{
dataultsi = sog.get_date(SOG_DATAULTSI);
if (id_si)
{
if (intaf != 0)
{
datasi=dataultdon;
datasi+=intaf;
}
else
{
datasi=dataultdon;
datasi+=intsi;
}
if (dataultsi.ok())
dataultsi+=intsi;
if (dataultsi > datasi)
datasi = dataultsi;
}
if (id_af)
{
dataaf=dataultdon;
dataaf+=intaf;
}
}
}
else
{
if (id_si)
datasi=sog.get_date(SOG_DATAULTID);
if (id_af)
dataaf=sog.get_date(SOG_DATAULTID);
}
}
sog.put(SOG_DATAPROSSI,datasi);
sog.put(SOG_DATAPROSAF,dataaf);
// se la data prossima SI è superiore all'ultima convocazione
// va cancellata, anche dall'archivio convocazioni
TDate dataprossi = sog.get_date(SOG_DATAPROSSI);
TDate dataconv = sog.get_date(SOG_DATACONV);
if (dataprossi >= dataconv)
{
rconv.setkey(2);
rconv.zero();
rconv.put(RCV_DATACONV, dataconv);
rconv.put(RCV_CODICE, codsog);
int err = rconv.read();
if (err == NOERR)
{
rconv.put(RCV_ANNULLATO,TRUE);
rconv.rewrite();
}
sog.put(SOG_DATACONV, NULLDATE);
sog.put(SOG_DATAULTSOL, NULLDATE);
const int zeroconv = 0;
sog.put(SOG_NUMCONV, zeroconv);
}
// controllo la sua categoria
// se dimesso diventa della categoria collegata
// se non c'e' la categoria collegata ???
TTable ctd("CTD");
TString16 catdon = sog.get(SOG_CATDON);
ctd.put("CODTAB",catdon);
if (ctd.read() == NOERR)
{
bool dimissione = ctd.get_bool("B0");
if (dimissione)
{
sog.put(SOG_CATDON,ctd.get("S6"));
if (ctd.get("S6").not_empty())
catdon = ctd.get("S6");
sog.put(SOG_DATADIM,NULLDATE);
}
if ((catdon == _catini1 || _catini1.empty()) && (totdon+1>=_numdon1) && _catfin1.not_empty())
sog.put(SOG_CATDON, _catfin1);
if ((catdon == _catini2 || _catini2.empty()) && (totdon+1>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || dimissione))
sog.put(SOG_CATDON, _catfin2);
}
TDate dataisc = sog.get_date(SOG_DATAISC);
if (dataisc.ok() && _dataisc)
{
if (sog.get_date(SOG_DATAPRISI).ok())
sog.put(SOG_DATAISC,sog.get(SOG_DATAPRISI));
else
{
const TRectype& riga = _sdonazioni->row(1);
sog.put(SOG_DATAISC,riga.get(DON_DATADON));
}
}
// aggiorno data e utente ultimo aggiornamento
const TDate oggi(TODAY);
sog.put(SOG_DATAULTAGG,oggi);
sog.put(SOG_UTENULTAGG,user());
if (err == NOERR)
sog.rewrite();
else
{
error_box("Errore %d durante la scrittura della riga %d", err, rigasog);
break;
}
}
}
}
}
delete pi;
return NOERR;
}
*/
int at8600(int argc, char* argv[])
{
TCorreggiDC a;
a.run(argc, argv, "Correzione errato giornaliero donazioni");
return 0;
}

58
at/at8600a.h Executable file
View File

@ -0,0 +1,58 @@
// correzione errato inseriemtno giornaliero donazioni
// dati dell'inserimento da correggere
#define F_DATADON 201
#define F_TIPODON 202
#define F_LUOGODON 203
#define F_DESC_TIPODON 204
#define F_DESC_LUOGODON 205
// dati nuovi
#define F_NDATADON 206
#define F_NTIPODON 207
#define F_NLUOGODON 208
#define F_DESC_NTIPODON 209
#define F_DESC_NLUOGODON 210
// operazioni possibili
#define F_VISUALIZZA 211
#define F_MODIFICA 212
#define F_ELIMINA 213
#define F_TOTALE 214
// spreadsheet
#define F_SOGGETTI 215
// pagina soggetti
#define F_S_CODICE 101
#define F_S_COGNOME 102
#define F_S_NOME 103
#define F_S_TESSAVIS 104
#define F_S_TIPODON 105
#define F_S_TIPOCON 106
#define F_S_ETICHETTA 107
#define F_S_PRIMADON 108
#define F_S_DATADON 109
#define F_S_DATANASC 110
#define F_S_CODSEZ 111
#define F_S_CODSOT 112
#define F_S_CATDON 113
#define F_S_INTSI 114
#define F_S_DENSEZ 151
#define F_S_DENSOT 152
#define F_S_DESC_TIPOCON 153
//#define F_S_DESC_CATDON 154
#define F_S_IDON1 155
#define F_S_IDON2 156
#define F_S_IDON3 157
#define F_S_IDON4 158
//#define F_S_INTSI 159
#define F_S_INTAF 160
#define F_S_PROSSTIPO 161
#define F_S_PROSSDATA 162
#define F_S_DESC_IDON1 163
#define F_S_DESC_IDON2 164
#define F_S_DESC_IDON3 165
#define F_S_DESC_IDON4 166
#define F_S_DESC_PROSSTIPO 167

553
at/at8600a.uml Executable file
View File

@ -0,0 +1,553 @@
#include "at8600a.h"
TOOLBAR "" 0 20 0 2
BUTTON F_VISUALIZZA 10 2
BEGIN
PROMPT -14 -11 "~Visualizza"
MESSAGE EXIT,F_VISUALIZZA
END
BUTTON F_MODIFICA 10 2
BEGIN
PROMPT -24 -11 "~Modifica"
MESSAGE EXIT,F_MODIFICA
END
BUTTON F_ELIMINA 10 2
BEGIN
PROMPT -34 -11 "~Elimina"
MESSAGE EXIT,F_ELIMINA
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -44 -11 "~Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Correzione errato giornaliero donazioni" -1 -1 78 20
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 0 "Dati dell'inserimento errato"
FLAGS "R"
END
DATE F_DATADON
BEGIN
PROMPT 2 1 "Data donazione "
CHECKTYPE REQUIRED
HELP "Data donazione"
END
STRING F_TIPODON 2
BEGIN
PROMPT 2 2 "Tipo donazione "
FLAGS "U"
USE TDN
INPUT CODTAB F_TIPODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_TIPODON CODTAB
OUTPUT F_DESC_TIPODON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo donazione"
END
STRING F_LUOGODON 4
BEGIN
PROMPT 2 3 "Punto prelievo "
FLAGS "U"
USE LDN
INPUT CODTAB F_LUOGODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_LUOGODON CODTAB
OUTPUT F_DESC_LUOGODON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Punto di prelievo"
END
STRING F_DESC_TIPODON 30
BEGIN
PROMPT 26 2 ""
FLAGS "D"
END
STRING F_DESC_LUOGODON 50
BEGIN
PROMPT 26 3 ""
FLAGS "D"
END
NUMBER F_TOTALE 8
BEGIN
PROMPT 50 1 "Totale soggetti "
FLAGS "D"
END
GROUPBOX DLG_NULL 77 5
BEGIN
PROMPT 1 5 "Dati corretti"
FLAGS "R"
END
DATE F_NDATADON
BEGIN
PROMPT 2 6 "Data donazione "
HELP "Data donazione"
//GROUP 1
FLAGS "D"
END
STRING F_NTIPODON 2
BEGIN
PROMPT 2 7 "Tipo donazione "
FLAGS "U"
USE TDN
INPUT CODTAB F_NTIPODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_NTIPODON CODTAB
OUTPUT F_DESC_NTIPODON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo donazione"
//GROUP 1
FLAGS "D"
END
STRING F_NLUOGODON 4
BEGIN
PROMPT 2 8 "Punto prelievo "
FLAGS "U"
USE LDN
INPUT CODTAB F_NLUOGODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_NLUOGODON CODTAB
OUTPUT F_DESC_NLUOGODON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Punto di prelievo"
GROUP 1
END
STRING F_DESC_NTIPODON 30
BEGIN
PROMPT 26 7 ""
FLAGS "D"
GROUP 1
END
STRING F_DESC_NLUOGODON 50
BEGIN
PROMPT 26 8 ""
FLAGS "D"
GROUP 1
END
SPREADSHEET F_SOGGETTI
BEGIN
PROMPT 2 10 "Soggetti"
ITEM "Codice@8"
ITEM "Cognome@25"
ITEM "Nome@25"
ITEM "Tessera"
ITEM "Don."
ITEM "Con."
ITEM "Et. sacca"
ITEM "1ø"
ITEM "Data don."
ITEM "Nato il@10"
ITEM "Sez."
ITEM "Sot."
ITEM "Cat."
ITEM "Int.SI"
END
ENDPAGE
ENDMASK
PAGE "Soggetto " -1 -1 78 20
GROUPBOX DLG_NULL 77 6
BEGIN
PROMPT 1 0 "Soggetto donatore"
FLAGS "R"
END
NUMBER F_S_CODICE 8
BEGIN
PROMPT 2 1 "Codice "
FLAGS "RG"
USE LF_SOGGETTI KEY 1
INPUT CODICE F_S_CODICE
DISPLAY "Codice@8" CODICE
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
DISPLAY "Nato il@10" DATANASC
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
OUTPUT F_S_CODICE CODICE
OUTPUT F_S_COGNOME COGNOME
OUTPUT F_S_NOME NOME
OUTPUT F_S_DATANASC DATANASC
OUTPUT F_S_CODSEZ CODSEZ
OUTPUT F_S_CODSOT CODSOT
OUTPUT F_S_CATDON CATDON
OUTPUT F_S_TESSAVIS TESSAVIS
OUTPUT F_S_INTSI INTSI
// CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_COGNOME 25
BEGIN
PROMPT 2 2 "Cognome e nome "
USE LF_SOGGETTI KEY 2
INPUT COGNOME F_S_COGNOME
INPUT NOME F_S_NOME
INPUT DATANASC F_S_DATANASC
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
DISPLAY "Nato il@10" DATANASC
DISPLAY "Codice@8" CODICE
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Tessera" TESSAVIS
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
OUTPUT F_S_CODICE CODICE
OUTPUT F_S_COGNOME COGNOME
OUTPUT F_S_NOME NOME
OUTPUT F_S_DATANASC DATANASC
OUTPUT F_S_CODSEZ CODSEZ
OUTPUT F_S_CODSOT CODSOT
OUTPUT F_S_CATDON CATDON
OUTPUT F_S_TESSAVIS TESSAVIS
OUTPUT F_S_INTSI INTSI
HELP "Cognome del soggetto"
// CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_NOME 25
BEGIN
PROMPT 46 2 ""
COPY ALL F_S_COGNOME
HELP "Nome del soggetto"
// CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_TESSAVIS 6
BEGIN
PROMPT 33 3 "Tessera AVIS "
USE LF_SOGGETTI KEY 4
INPUT TESSAVIS F_S_TESSAVIS
DISPLAY "Tessera" TESSAVIS
DISPLAY "Cognome@25" COGNOME
DISPLAY "Nome@25" NOME
DISPLAY "Nato il@10" DATANASC
DISPLAY "Codice@8" CODICE
DISPLAY "Sez." CODSEZ
DISPLAY "Sot." CODSOT
DISPLAY "C." CATDON
DISPLAY "Gr.AB0" GRUPPOAB0
DISPLAY "Rh " RHANTID
DISPLAY "Int.SI" INTSI
OUTPUT F_S_CODICE CODICE
OUTPUT F_S_COGNOME COGNOME
OUTPUT F_S_NOME NOME
OUTPUT F_S_DATANASC DATANASC
OUTPUT F_S_CODSEZ CODSEZ
OUTPUT F_S_CODSOT CODSOT
OUTPUT F_S_CATDON CATDON
OUTPUT F_S_TESSAVIS TESSAVIS
OUTPUT F_S_INTSI INTSI
HELP "Cognome del soggetto"
// CHECKTYPE NORMAL
ADD RUN at0 -0
END
STRING F_S_TIPODON 2
BEGIN
PROMPT 2 16 "Tipo donazione "
FLAGS "U"
USE TDN
INPUT CODTAB F_S_TIPODON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_S_TIPODON CODTAB
//OUTPUT F_S_DESC_TIPODON S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo donazione (se diverso da dati fissi)"
END
GROUPBOX DLG_NULL 77 9
BEGIN
PROMPT 1 6 "Dati del controllo sanitario effettuato"
END
STRING F_S_TIPOCON 2
BEGIN
PROMPT 2 7 "Tipo controllo "
FLAGS "U"
USE TCS SELECT S6=="N"
INPUT CODTAB F_S_TIPOCON
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_S_TIPOCON CODTAB
OUTPUT F_S_DESC_TIPOCON S0
WARNING "Codice non presente"
HELP "Tipo/Esito controllo sanitario"
END
GROUPBOX DLG_NULL 77 3
BEGIN
PROMPT 1 15 "Dati complementari della donazione"
END
NUMBER F_S_ETICHETTA 9
BEGIN
PROMPT 30 16 "Etichetta sacca "
END
BOOLEAN F_S_PRIMADON
BEGIN
PROMPT 60 16 "Prima donazione"
END
DATE F_S_DATADON
BEGIN
PROMPT 2 16 "Data don. "
END
DATE F_S_DATANASC
BEGIN
PROMPT 2 3 "Nato il "
FLAGS "D"
END
STRING F_S_CODSEZ 2
BEGIN
PROMPT 2 4 "Sez./Sottog. "
FLAGS "D"
END
STRING F_S_DENSEZ 25 23
BEGIN
PROMPT 20 4 ""
FLAGS "D"
END
STRING F_S_CODSOT 2
BEGIN
PROMPT 46 4 ""
FLAGS "D"
USE LF_SEZIONI
INPUT CODSEZ F_S_CODSEZ
INPUT CODSOT F_S_CODSOT
OUTPUT F_S_DENSEZ DENSEZ
OUTPUT F_S_DENSOT DENSOT
CHECKTYPE NORMAL
END
STRING F_S_DENSOT 25 23
BEGIN
PROMPT 49 4 ""
FLAGS "D"
END
STRING F_S_CATDON 2
BEGIN
PROMPT 60 3 "Categoria "
FLAGS "D"
// USE CTD
// INPUT CODTAB F_S_CATDON
// OUTPUT F_S_DESC_CATDON S0
// CHECKTYPE NORMAL
END
NUMBER F_S_INTSI 3 0
BEGIN
PROMPT 40 12 "Sangue intero "
FLAGS "D"
END
STRING F_S_DESC_TIPOCON 25
BEGIN
PROMPT 23 7 ""
FLAGS "D"
END
//STRING F_S_DESC_CATDON 25 15
//BEGIN
// PROMPT 61 3 ""
// FLAGS "D"
//END
TEXT DLG_NULL
BEGIN
PROMPT 2 8 "Se idoneita': tipi donazione ammessi"
END
STRING F_S_IDON1 2
BEGIN
PROMPT 40 8 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON1
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@40" S0
OUTPUT F_S_IDON1 CODTAB
OUTPUT F_S_DESC_IDON1 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Idoneita' alla donazione"
END
STRING F_S_IDON2 2
BEGIN
PROMPT 40 9 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON2
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@40" S0
OUTPUT F_S_IDON2 CODTAB
OUTPUT F_S_DESC_IDON2 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Idoneita' alla donazione"
END
STRING F_S_IDON3 2
BEGIN
PROMPT 40 10 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON3
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@40" S0
OUTPUT F_S_IDON3 CODTAB
OUTPUT F_S_DESC_IDON3 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Idoneita' alla donazione"
END
STRING F_S_IDON4 2
BEGIN
PROMPT 40 11 ""
FLAGS "U"
USE IDO
INPUT CODTAB F_S_IDON4
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@40" S0
OUTPUT F_S_IDON4 CODTAB
OUTPUT F_S_DESC_IDON4 S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Idoneita' alla donazione"
END
TEXT DLG_NULL
BEGIN
PROMPT 2 12 " intervalli"
END
//NUMBER F_S_INTSI 3 0
//BEGIN
// PROMPT 29 12 "Sangue intero "
// FLAGS "U"
//END
NUMBER F_S_INTAF 3 0
BEGIN
PROMPT 59 12 "Aferesi "
FLAGS "U"
END
STRING F_S_PROSSTIPO 2
BEGIN
PROMPT 2 13 "Prossimo tipo "
FLAGS "U"
USE TCS
INPUT CODTAB F_S_PROSSTIPO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@40" S0
OUTPUT F_S_PROSSTIPO CODTAB
OUTPUT F_S_DESC_PROSSTIPO S0
CHECKTYPE NORMAL
WARNING "Codice non presente"
HELP "Tipo/Esito controllo sanitario"
END
DATE F_S_PROSSDATA
BEGIN
PROMPT 55 13 "Data "
HELP "Data controllo"
END
STRING F_S_DESC_IDON1 25
BEGIN
PROMPT 45 8 ""
FLAGS "D"
END
STRING F_S_DESC_IDON2 25
BEGIN
PROMPT 45 9 ""
FLAGS "D"
END
STRING F_S_DESC_IDON3 25
BEGIN
PROMPT 45 10 ""
FLAGS "D"
END
STRING F_S_DESC_IDON4 25
BEGIN
PROMPT 45 11 ""
FLAGS "D"
END
STRING F_S_DESC_PROSSTIPO 25
BEGIN
PROMPT 23 13 ""
FLAGS "D"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -23 -1 ""
END
ENDPAGE
ENDMASK