Files correlati : at0.exe at0500a.msk Ricompilazione Demo : [ ] Commento : sistemato funzionamento data di dimissione e aggiunto parametri per stampa cartoline, tessere ed etichette; modificato programma per cambio intervalli di donazione git-svn-id: svn://10.65.10.50/trunk@11641 c028cbd2-c16b-5b4b-a496-9718f37d4682
163 lines
4.0 KiB
C++
Executable File
163 lines
4.0 KiB
C++
Executable File
#include <mask.h>
|
|
#include <printapp.h>
|
|
#include <tabutil.h>
|
|
#include <recarray.h>
|
|
#include <utility.h>
|
|
#include <lffiles.h>
|
|
|
|
#include "at0.h"
|
|
#include "atlib.h"
|
|
|
|
// nomi dei campi
|
|
#include "soggetti.h"
|
|
#include "contsan.h"
|
|
#include "idoneita.h"
|
|
|
|
class TIntSI : 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:
|
|
TIntSI() {}
|
|
};
|
|
|
|
HIDDEN inline TIntSI& app() { return (TIntSI&) main_app(); }
|
|
|
|
bool TIntSI::preprocess_page(int file, int counter)
|
|
{
|
|
TDate oggi(TODAY);
|
|
bool rewrite = FALSE;
|
|
TRectype& recsog = current_cursor()->curr();
|
|
const int intsi = recsog.get_int(SOG_INTSI);
|
|
if (intsi == 110 || intsi == 120 || intsi == 180 || intsi == 320 || intsi == 360)
|
|
{
|
|
if (intsi == 110 || intsi == 120)
|
|
recsog.put(SOG_INTSI, 100);
|
|
if (intsi == 180)
|
|
recsog.put(SOG_INTSI, 160);
|
|
if (intsi == 320 || intsi == 360)
|
|
recsog.put(SOG_INTSI, 330);
|
|
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 intsi = riga.get_int(CON_INTSI);
|
|
if (intsi == 110 || intsi == 120)
|
|
riga.put(CON_INTSI, 100);
|
|
if (intsi == 180)
|
|
riga.put(CON_INTSI, 160);
|
|
if (intsi == 320)
|
|
riga.put(CON_INTSI, 330);
|
|
if (intsi == 360)
|
|
riga.put(CON_INTSI, 330);
|
|
}
|
|
/*
|
|
for (int r=1; r<=_sidoneita->rows(); r++)
|
|
{
|
|
TRectype& riga = _sidoneita->row(r, TRUE);
|
|
const TString16 tipoido = riga.get(IDO_TIPOIDO);
|
|
if (tipoido == "SI")
|
|
{
|
|
int intsi = riga.get_int(IDO_INTERVALLO);
|
|
if (intsi == 110 || intsi == 120)
|
|
riga.put(IDO_INTERVALLO, 100);
|
|
}
|
|
}
|
|
*/
|
|
_scontrolli->rewrite();
|
|
//_sidoneita->rewrite();
|
|
con_reord(recsog,_scontrolli, _sidoneita);
|
|
rewrite = TRUE;
|
|
}
|
|
}
|
|
if (rewrite)
|
|
{
|
|
recsog.put(SOG_UTENULTAGG, "PRASSI");
|
|
recsog.put(SOG_DATAULTAGG, oggi);
|
|
current_cursor()->file().rewrite();
|
|
}
|
|
return rewrite;
|
|
}
|
|
|
|
void TIntSI::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 TIntSI::set_print(int)
|
|
{
|
|
KEY tasto;
|
|
tasto = _msk->run();
|
|
if (tasto == K_ENTER)
|
|
{
|
|
TRectype da(LF_SOGGETTI);
|
|
TRectype a(LF_SOGGETTI);
|
|
da.zero();
|
|
a.zero();
|
|
TString16 codsez = "10";
|
|
da.put(SOG_CODSEZ, codsez);
|
|
a.put(SOG_CODSEZ, codsez);
|
|
current_cursor()->setregion(da,a);
|
|
//current_cursor()->setfilter(format("SESSO == '1'"));
|
|
reset_files();
|
|
add_file(LF_SOGGETTI);
|
|
reset_print();
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
bool TIntSI::user_create()
|
|
{
|
|
_msk = new TMask("at0900a");
|
|
_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, "", 3));
|
|
long items = _rel->lfile().items();
|
|
return TRUE;
|
|
}
|
|
|
|
bool TIntSI::user_destroy()
|
|
{
|
|
delete _sidoneita;
|
|
delete _idoneita;
|
|
delete _scontrolli;
|
|
delete _contsan;
|
|
delete _rel;
|
|
delete _msk;
|
|
return TRUE;
|
|
}
|
|
|
|
int at0900(int argc, char* argv[])
|
|
{
|
|
TIntSI a;
|
|
a.run(argc, argv, "Cambio intervalli SI per Lesignano");
|
|
return 0;
|
|
} |