Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Messaggi più precisi + corretto ordine di distruzione degli oggetti nella user_destroy() git-svn-id: svn://10.65.10.50/trunk@6910 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b2c68e593c
commit
35654588b3
163
at/at0200.cpp
163
at/at0200.cpp
@ -65,6 +65,7 @@ protected:
|
|||||||
bool check_sog_sheet(const char* codsog);
|
bool check_sog_sheet(const char* codsog);
|
||||||
static bool nome_handler(TMask_field& f, KEY k);
|
static bool nome_handler(TMask_field& f, KEY k);
|
||||||
static bool codice_handler(TMask_field& f, KEY k);
|
static bool codice_handler(TMask_field& f, KEY k);
|
||||||
|
static bool tipodon_handler(TMask_field& f, KEY k);
|
||||||
static bool soggetti_notify(TSheet_field& s, int r, KEY k);
|
static bool soggetti_notify(TSheet_field& s, int r, KEY k);
|
||||||
void add_rows_soggetti(TSheet_field& s, int count = 20, int start = 0);
|
void add_rows_soggetti(TSheet_field& s, int count = 20, int start = 0);
|
||||||
static bool ins_controlli_handler(TMask_field& f, KEY k);
|
static bool ins_controlli_handler(TMask_field& f, KEY k);
|
||||||
@ -117,6 +118,7 @@ bool TGiornalieroDC::create()
|
|||||||
ss.set_notify(soggetti_notify);
|
ss.set_notify(soggetti_notify);
|
||||||
ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
|
ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
|
||||||
ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
|
ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
|
||||||
|
ss.sheet_mask().set_handler(F_S_TIPODON,tipodon_handler);
|
||||||
TConfig config(CONFIG_STUDIO);
|
TConfig config(CONFIG_STUDIO);
|
||||||
_numdon1 = config.get_int("NumDon1");
|
_numdon1 = config.get_int("NumDon1");
|
||||||
_numdon2 = config.get_int("NumDon2");
|
_numdon2 = config.get_int("NumDon2");
|
||||||
@ -137,16 +139,16 @@ bool TGiornalieroDC::create()
|
|||||||
|
|
||||||
bool TGiornalieroDC::destroy()
|
bool TGiornalieroDC::destroy()
|
||||||
{
|
{
|
||||||
|
delete _asoggetti;
|
||||||
|
delete _sidoneita;
|
||||||
|
delete _scontrolli;
|
||||||
|
delete _sdonazioni;
|
||||||
|
delete _rconvoc;
|
||||||
|
delete _idoneita;
|
||||||
|
delete _contsan;
|
||||||
|
delete _donaz;
|
||||||
delete _rel;
|
delete _rel;
|
||||||
delete _msk;
|
delete _msk;
|
||||||
delete _donaz;
|
|
||||||
delete _contsan;
|
|
||||||
delete _idoneita;
|
|
||||||
delete _rconvoc;
|
|
||||||
delete _sdonazioni;
|
|
||||||
delete _scontrolli;
|
|
||||||
delete _sidoneita;
|
|
||||||
delete _asoggetti;
|
|
||||||
return TApplication::destroy();
|
return TApplication::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,6 +496,29 @@ int TGiornalieroDC::write(TSheet_field& s)
|
|||||||
bool id_af = FALSE; // il soggetto è idoneo per af?
|
bool id_af = FALSE; // il soggetto è idoneo per af?
|
||||||
|
|
||||||
modstato = modstato_tcs(stato);
|
modstato = modstato_tcs(stato);
|
||||||
|
/*
|
||||||
|
if (!(modstato == 'I' || modstato == 'F')) // il soggetto non è idoneo
|
||||||
|
{
|
||||||
|
TTable tcs("TCS");
|
||||||
|
tcs.put("CODTAB",stato);
|
||||||
|
if (tcs.read() == NOERR)
|
||||||
|
{
|
||||||
|
if (tcs.get("S7").not_empty())
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
TDate dataultid
|
||||||
|
while (r>=1 &&
|
||||||
|
|
||||||
|
modstato = modstato_tcs(stato);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (modstato == 'I' || modstato == 'F') // il soggetto è idoneo
|
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_si = (is_idon(id1,id2,id3,id4,IDON_SI) && intsi != 0); // il soggetto è idoneo SI
|
||||||
@ -586,15 +611,16 @@ int TGiornalieroDC::write(TSheet_field& s)
|
|||||||
{
|
{
|
||||||
bool dimissione = ctd.get_bool("B0");
|
bool dimissione = ctd.get_bool("B0");
|
||||||
if (dimissione)
|
if (dimissione)
|
||||||
sog.put(SOG_CATDON,ctd.get("S6"));
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
sog.put(SOG_CATDON,ctd.get("S6"));
|
||||||
|
if (ctd.get("S6").not_empty())
|
||||||
|
catdon = ctd.get("S6");
|
||||||
|
}
|
||||||
if ((catdon == _catini1 || _catini1.empty()) && (totdon+1>=_numdon1) && _catfin1.not_empty())
|
if ((catdon == _catini1 || _catini1.empty()) && (totdon+1>=_numdon1) && _catfin1.not_empty())
|
||||||
sog.put(SOG_CATDON, _catfin1);
|
sog.put(SOG_CATDON, _catfin1);
|
||||||
if ((catdon == _catini2 || _catini2.empty()) && (totdon+1>=_numdon2) && _catfin2.not_empty() && !_sttess2)
|
if ((catdon == _catini2 || _catini2.empty()) && (totdon+1>=_numdon2) && _catfin2.not_empty() && (!_sttess2 || dimissione))
|
||||||
sog.put(SOG_CATDON, _catfin2);
|
sog.put(SOG_CATDON, _catfin2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
TDate dataisc = sog.get_date(SOG_DATAISC);
|
TDate dataisc = sog.get_date(SOG_DATAISC);
|
||||||
if (dataisc.empty() && _dataisc)
|
if (dataisc.empty() && _dataisc)
|
||||||
{
|
{
|
||||||
@ -762,11 +788,14 @@ bool TGiornalieroDC::codice_handler(TMask_field& f, KEY k)
|
|||||||
m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
|
m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
|
||||||
m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
|
m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
|
||||||
m.set(F_S_CATDON, sog.get(SOG_CATDON));
|
m.set(F_S_CATDON, sog.get(SOG_CATDON));
|
||||||
|
/*
|
||||||
if (!(app()._ricerca))
|
if (!(app()._ricerca))
|
||||||
{
|
{
|
||||||
const int totdon = sog.get_int(SOG_TOTDON);
|
const int totdon = sog.get_int(SOG_TOTDON);
|
||||||
if (totdon == 0)
|
if (totdon == 0)
|
||||||
m.set(F_S_PRIMADON, 'X');
|
m.set(F_S_PRIMADON, 'X');
|
||||||
|
if (!app()._nomessage)
|
||||||
|
{
|
||||||
TTable ctd("CTD");
|
TTable ctd("CTD");
|
||||||
ctd.zero();
|
ctd.zero();
|
||||||
ctd.put("CODTAB", sog.get(SOG_CATDON));
|
ctd.put("CODTAB", sog.get(SOG_CATDON));
|
||||||
@ -797,10 +826,115 @@ bool TGiornalieroDC::codice_handler(TMask_field& f, KEY k)
|
|||||||
messaggio << "Soggetto non idoneo al tipo donazione\n";
|
messaggio << "Soggetto non idoneo al tipo donazione\n";
|
||||||
else
|
else
|
||||||
if (datapros > datadon)
|
if (datapros > datadon)
|
||||||
messaggio << "Il soggetto ha donato prima della scadenza\n";
|
messaggio << "Il soggetto ha donato prima della scadenza del " << datapros.string() << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
messaggio << "Stato soggetto non compatibile con la donazione\n";
|
{
|
||||||
|
messaggio << "Stato soggetto " << stato << " non compatibile con la donazione\n";
|
||||||
|
TTable tcs("TCS");
|
||||||
|
tcs.put("CODTAB",stato);
|
||||||
|
if (tcs.read() == NOERR)
|
||||||
|
{
|
||||||
|
if (tcs.get("S7").empty())
|
||||||
|
messaggio << "Verificare la situazione del soggetto";
|
||||||
|
else
|
||||||
|
messaggio << "Cambio stato automatico";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ok = FALSE; // codice non esistente
|
||||||
|
//if (messaggio.not_empty() && !app()._ricerca && !app()._nomessage)
|
||||||
|
// warning_box(messaggio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGiornalieroDC::tipodon_handler(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
bool ok = TRUE;
|
||||||
|
if (f.to_check(k))
|
||||||
|
{
|
||||||
|
TString256 messaggio = "";
|
||||||
|
TMask& m = f.mask();
|
||||||
|
long codsog = m.get_long(F_S_CODICE);
|
||||||
|
if (codsog != 0)
|
||||||
|
{
|
||||||
|
TLocalisamfile& sog = app().get_relation()->lfile();
|
||||||
|
sog.setkey(1);
|
||||||
|
sog.zero();
|
||||||
|
sog.put(SOG_CODICE, codsog);
|
||||||
|
int err = sog.read();
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
m.set(F_S_COGNOME, sog.get(SOG_COGNOME));
|
||||||
|
m.set(F_S_NOME, sog.get(SOG_NOME));
|
||||||
|
m.set(F_S_DATANASC, sog.get(SOG_DATANASC));
|
||||||
|
m.set(F_S_TESSAVIS, sog.get(SOG_TESSAVIS));
|
||||||
|
m.set(F_S_CODSEZ, sog.get(SOG_CODSEZ));
|
||||||
|
m.set(F_S_CODSOT, sog.get(SOG_CODSOT));
|
||||||
|
m.set(F_S_CATDON, sog.get(SOG_CATDON));
|
||||||
|
*/
|
||||||
|
if (!(app()._ricerca))
|
||||||
|
{
|
||||||
|
const int totdon = sog.get_int(SOG_TOTDON);
|
||||||
|
if (totdon == 0)
|
||||||
|
m.set(F_S_PRIMADON, 'X');
|
||||||
|
if (!app()._nomessage)
|
||||||
|
{
|
||||||
|
TTable ctd("CTD");
|
||||||
|
ctd.zero();
|
||||||
|
ctd.put("CODTAB", sog.get(SOG_CATDON));
|
||||||
|
if (ctd.read() == NOERR)
|
||||||
|
{
|
||||||
|
bool dimissione = ctd.get_bool("B0");
|
||||||
|
if (dimissione)
|
||||||
|
{
|
||||||
|
TString16 catcoll = ctd.get("S6");
|
||||||
|
if (catcoll.empty())
|
||||||
|
messaggio << "Soggetto dimesso senza categoria collegata\n";
|
||||||
|
else
|
||||||
|
messaggio << "Soggetto dimesso, cambio categoria automatico\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TString16 stato = sog.get(SOG_STATO);
|
||||||
|
char modstato = modstato_tcs(stato);
|
||||||
|
if (modstato == 'I' || modstato == 'F') // il soggetto è idoneo
|
||||||
|
{
|
||||||
|
TDate datapros(NULLDATE);
|
||||||
|
TString16 tipodon = m.get(F_S_TIPODON);
|
||||||
|
if (tipodon.empty())
|
||||||
|
tipodon = app().get_mask().get(F_TIPODON);
|
||||||
|
TDate datadon = app().get_mask().get_date(F_DATADON);
|
||||||
|
if (is_donaz(tipodon,IDON_SI))
|
||||||
|
datapros = sog.get_date(SOG_DATAPROSSI);
|
||||||
|
else
|
||||||
|
datapros = sog.get_date(SOG_DATAPROSAF);
|
||||||
|
if (datapros.empty())
|
||||||
|
messaggio << "Soggetto non idoneo al tipo donazione\n";
|
||||||
|
else
|
||||||
|
if (datapros > datadon)
|
||||||
|
messaggio << "Il soggetto ha donato prima della scadenza del " << datapros.string() << "\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
messaggio << "Stato soggetto " << stato << " non compatibile con la donazione\n";
|
||||||
|
TTable tcs("TCS");
|
||||||
|
tcs.put("CODTAB",stato);
|
||||||
|
if (tcs.read() == NOERR)
|
||||||
|
{
|
||||||
|
if (tcs.get("S7").empty())
|
||||||
|
messaggio << "Verificare la situazione del soggetto";
|
||||||
|
else
|
||||||
|
messaggio << "Cambio stato automatico";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -813,7 +947,6 @@ bool TGiornalieroDC::codice_handler(TMask_field& f, KEY k)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int at0200(int argc, char* argv[])
|
int at0200(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TGiornalieroDC a;
|
TGiornalieroDC a;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user