4eb7aec100
Files correlati : Ricompilazione Demo : [ ] Commento : Corretto ordine in destroy() git-svn-id: svn://10.65.10.50/trunk@6941 c028cbd2-c16b-5b4b-a496-9718f37d4682
152 lines
3.6 KiB
C++
Executable File
152 lines
3.6 KiB
C++
Executable File
#include <mask.h>
|
|
#include <printapp.h>
|
|
#include <tabutil.h>
|
|
#include <recarray.h>
|
|
#include <utility.h>
|
|
#include <lffiles.h>
|
|
|
|
#include "at7.h"
|
|
#include "atlib.h"
|
|
|
|
// nomi dei campi
|
|
#include "soggetti.h"
|
|
#include "contsan.h"
|
|
#include "idoneita.h"
|
|
|
|
class TBologna90 : public TPrintapp
|
|
{
|
|
TMask* _msk;
|
|
TRelation* _rel;
|
|
int _cur;
|
|
TLocalisamfile* _contsan;
|
|
TRecord_array* _scontrolli;
|
|
TLocalisamfile* _idoneita;
|
|
TRecord_array* _sidoneita;
|
|
|
|
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:
|
|
TBologna90() {}
|
|
};
|
|
|
|
HIDDEN inline TBologna90& app() { return (TBologna90&) main_app(); }
|
|
|
|
bool TBologna90::preprocess_page(int file, int counter)
|
|
{
|
|
bool rewrite = FALSE;
|
|
TRectype& recsog = current_cursor()->curr();
|
|
const int intaf = recsog.get_int(SOG_INTAF);
|
|
if (intaf != 0 && intaf != 45)
|
|
{
|
|
recsog.put(SOG_INTAF, 45);
|
|
const long codice = recsog.get_long(SOG_CODICE);
|
|
TRectype* keyc = new TRectype(LF_CONTSAN);
|
|
keyc->put(CON_CODICE, codice);
|
|
int err = _scontrolli->read(keyc);
|
|
TRectype* keyi = new TRectype(LF_IDONEITA);
|
|
keyi->put(IDO_CODICE, codice);
|
|
int erri = _sidoneita->read(keyi);
|
|
if ((err == NOERR || erri == NOERR) && (_scontrolli->rows() > 0 || _sidoneita->rows() > 0))
|
|
{
|
|
for (int c=1; c<=_scontrolli->rows(); c++)
|
|
{
|
|
TRectype& riga = _scontrolli->row(c, TRUE);
|
|
int intaf = riga.get_int(CON_INTAF);
|
|
if (intaf != 0 && intaf != 45)
|
|
riga.put(CON_INTAF, 45);
|
|
}
|
|
for (int r=1; r<=_sidoneita->rows(); r++)
|
|
{
|
|
TRectype& riga = _sidoneita->row(r, TRUE);
|
|
const TString16 tipoido = riga.get(IDO_TIPOIDO);
|
|
if (tipoido == "AF")
|
|
{
|
|
int intaf = riga.get_int(IDO_INTERVALLO);
|
|
if (intaf != 0 && intaf != 45)
|
|
riga.put(CON_INTAF, 45);
|
|
}
|
|
}
|
|
_scontrolli->rewrite();
|
|
_sidoneita->rewrite();
|
|
con_reord(recsog,_scontrolli, _sidoneita);
|
|
//ido_reord(recsog,_sidoneita);
|
|
rewrite = TRUE;
|
|
}
|
|
}
|
|
if (rewrite)
|
|
current_cursor()->file().rewrite();
|
|
return rewrite;
|
|
}
|
|
|
|
void TBologna90::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 TBologna90::set_print(int)
|
|
{
|
|
KEY tasto;
|
|
tasto = _msk->run();
|
|
if (tasto == K_ENTER)
|
|
{
|
|
/*
|
|
TRectype da(LF_SOGGETTI);
|
|
TRectype a(LF_SOGGETTI);
|
|
const long codini = _msk->get_long(F_CODINI);
|
|
const long codfin = _msk->get_long(F_CODFIN);
|
|
da.zero();
|
|
a.zero();
|
|
if (codini != 0)
|
|
da.put(SOG_CODICE, codini);
|
|
if (codfin != 0)
|
|
a.put(SOG_CODICE, codfin);
|
|
current_cursor()->setregion(da,a);
|
|
*/
|
|
//current_cursor()->setfilter(format("STATO == \"RF\""));
|
|
|
|
reset_files();
|
|
add_file(LF_SOGGETTI);
|
|
reset_print();
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
bool TBologna90::user_create()
|
|
{
|
|
_msk = new TMask("at7300a");
|
|
_rel = new TRelation(LF_SOGGETTI);
|
|
_contsan = new TLocalisamfile(LF_CONTSAN);
|
|
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
|
|
_idoneita = new TLocalisamfile(LF_IDONEITA);
|
|
_sidoneita = new TRecord_array(LF_IDONEITA,IDO_PROGIDO);
|
|
_cur = add_cursor(new TCursor(_rel, "", 1));
|
|
long items = _rel->lfile().items();
|
|
return TRUE;
|
|
}
|
|
|
|
bool TBologna90::user_destroy()
|
|
{
|
|
delete _sidoneita;
|
|
delete _idoneita;
|
|
delete _scontrolli;
|
|
delete _contsan;
|
|
delete _rel;
|
|
delete _msk;
|
|
return TRUE;
|
|
}
|
|
|
|
int at7300(int argc, char* argv[])
|
|
{
|
|
TBologna90 a;
|
|
a.run(argc, argv, "Bologna: intaf = 90");
|
|
return 0;
|
|
} |