1b0f205ce0
git-svn-id: svn://10.65.10.50/trunk@6149 c028cbd2-c16b-5b4b-a496-9718f37d4682
135 lines
3.1 KiB
C++
Executable File
135 lines
3.1 KiB
C++
Executable File
#include <mask.h>
|
|
#include <printapp.h>
|
|
#include <recarray.h>
|
|
#include <tabutil.h>
|
|
#include <utility.h>
|
|
#include <lffiles.h>
|
|
|
|
#include "at7.h"
|
|
|
|
#include "atlib.h"
|
|
|
|
// nomi dei campi
|
|
#include "soggetti.h"
|
|
#include "contsan.h"
|
|
#include "donaz.h"
|
|
|
|
#define ALIAS_TCS 200
|
|
|
|
class TProblemiStato : public TPrintapp
|
|
{
|
|
TMask* _msk;
|
|
TRelation* _rel;
|
|
int _cur;
|
|
TLocalisamfile* _soggetti;
|
|
TLocalisamfile* _contsan;
|
|
TLocalisamfile* _donaz;
|
|
TRecord_array* _scontrolli;
|
|
TRecord_array* _sdonazioni;
|
|
|
|
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:
|
|
TProblemiStato() {}
|
|
};
|
|
|
|
HIDDEN inline TProblemiStato& app() { return (TProblemiStato&) main_app(); }
|
|
|
|
bool TProblemiStato::preprocess_page(int file, int counter)
|
|
{
|
|
bool rew = FALSE;
|
|
TRectype& recsog = current_cursor()->curr();
|
|
const long codice = recsog.get_long(SOG_CODICE);
|
|
TString16 idon1 = recsog.get(SOG_IDON1);
|
|
if (idon1.empty())
|
|
{
|
|
rew = TRUE;
|
|
TRectype* key = new TRectype(LF_CONTSAN);
|
|
key->put(CON_CODICE, codice);
|
|
int err = _scontrolli->read(key);
|
|
if (err == NOERR)
|
|
{
|
|
for (int r=1; r<=_scontrolli->rows(); r++)
|
|
{
|
|
TRectype& riga = _scontrolli->row(r, TRUE);
|
|
TString16 tipocon = riga.get(CON_TIPOCON);
|
|
const char stato = modstato_tcs(tipocon);
|
|
if (stato == 'I' || stato == 'F')
|
|
{
|
|
int numdonsi = recsog.get_int(SOG_TOTDONSI);
|
|
int numdonaf = recsog.get_int(SOG_TOTDONAF);
|
|
if (numdonsi != 0)
|
|
riga.put(CON_IDON1, "SI");
|
|
if (numdonaf != 0)
|
|
riga.put(CON_IDON2, "PL");
|
|
else
|
|
if (numdonaf != 0)
|
|
riga.put(CON_IDON1, "PL");
|
|
}
|
|
}
|
|
_scontrolli->rewrite();
|
|
//con_reord(recsog,_scontrolli, _sidoneita);
|
|
current_cursor()->file().rewrite();
|
|
}
|
|
}
|
|
return rew;
|
|
}
|
|
|
|
void TProblemiStato::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_COGNOME));
|
|
set_row(1,"@36g@S", FLD(LF_SOGGETTI,SOG_NOME));
|
|
}
|
|
|
|
bool TProblemiStato::set_print(int)
|
|
{
|
|
KEY tasto;
|
|
tasto = _msk->run();
|
|
if (tasto == K_ENTER)
|
|
{
|
|
reset_files();
|
|
add_file(LF_SOGGETTI);
|
|
reset_print();
|
|
current_cursor()->setfilter("((TCS->S6 == \"I\") || (TCS->S6 == \"F\"))", TRUE);
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
bool TProblemiStato::user_create()
|
|
{
|
|
_msk = new TMask("at7700a");
|
|
_rel = new TRelation(LF_SOGGETTI);
|
|
_rel->add("TCS", "CODTAB==STATO",1,0,ALIAS_TCS);
|
|
_contsan = new TLocalisamfile(LF_CONTSAN);
|
|
_donaz = new TLocalisamfile(LF_DONAZ);
|
|
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
|
|
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
|
|
_cur = add_cursor(new TCursor(_rel, "", 1));
|
|
return TRUE;
|
|
}
|
|
|
|
bool TProblemiStato::user_destroy()
|
|
{
|
|
delete _rel;
|
|
delete _msk;
|
|
delete _contsan;
|
|
delete _donaz;
|
|
delete _scontrolli;
|
|
delete _sdonazioni;
|
|
return TRUE;
|
|
}
|
|
|
|
int at7700(int argc, char* argv[])
|
|
{
|
|
TProblemiStato a;
|
|
a.run(argc, argv, "Soggetti con problemi sullo stato");
|
|
return 0;
|
|
} |