1997-06-17 15:50:08 +00:00
|
|
|
#include <mask.h>
|
|
|
|
#include <printapp.h>
|
|
|
|
#include <tabutil.h>
|
1997-12-05 16:26:15 +00:00
|
|
|
#include <recarray.h>
|
1997-06-17 15:50:08 +00:00
|
|
|
#include <utility.h>
|
1997-08-14 13:08:40 +00:00
|
|
|
#include <lffiles.h>
|
1997-06-17 15:50:08 +00:00
|
|
|
|
|
|
|
#include "at7.h"
|
|
|
|
|
|
|
|
// nomi dei campi
|
|
|
|
#include "soggetti.h"
|
1997-12-05 16:26:15 +00:00
|
|
|
#include "donaz.h"
|
1997-06-17 15:50:08 +00:00
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
class TPrimaDon : public TPrintapp
|
1997-06-17 15:50:08 +00:00
|
|
|
{
|
|
|
|
TMask* _msk;
|
|
|
|
TRelation* _rel;
|
|
|
|
int _cur;
|
1997-12-05 16:26:15 +00:00
|
|
|
TLocalisamfile* _donaz;
|
|
|
|
TRecord_array* _sdonazioni;
|
1997-06-17 15:50:08 +00:00
|
|
|
|
|
|
|
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:
|
1997-12-05 16:26:15 +00:00
|
|
|
TPrimaDon() {}
|
1997-06-17 15:50:08 +00:00
|
|
|
};
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
HIDDEN inline TPrimaDon& app() { return (TPrimaDon&) main_app(); }
|
1997-06-17 15:50:08 +00:00
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
bool TPrimaDon::preprocess_page(int file, int counter)
|
1997-06-17 15:50:08 +00:00
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
bool rewrite = FALSE;
|
1997-06-17 15:50:08 +00:00
|
|
|
TRectype& recsog = current_cursor()->curr();
|
1997-12-05 16:26:15 +00:00
|
|
|
const long codice = recsog.get_long(SOG_CODICE);
|
|
|
|
TRectype* keyd = new TRectype(LF_DONAZ);
|
|
|
|
keyd->put(DON_CODICE, codice);
|
|
|
|
int errd = _sdonazioni->read(keyd);
|
|
|
|
if ((errd == NOERR) && (_sdonazioni->rows()>0))
|
|
|
|
{
|
|
|
|
TDate dataprisi = recsog.get(SOG_DATAPRISI);
|
|
|
|
TDate datapriaf = recsog.get(SOG_DATAPRIAF);
|
|
|
|
|
|
|
|
TRectype& riga = _sdonazioni->row(1, TRUE);
|
|
|
|
TDate datadon = riga.get(DON_DATADON);
|
|
|
|
if (datadon==dataprisi || datadon==datapriaf)
|
1997-08-01 14:49:53 +00:00
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
rewrite = TRUE;
|
|
|
|
riga.put(DON_PRIMADON, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((!dataprisi.ok()) && (!datapriaf.ok()))
|
1997-08-01 14:49:53 +00:00
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
rewrite = TRUE;
|
|
|
|
riga.put(DON_PRIMADON, TRUE);
|
|
|
|
}
|
|
|
|
if (rewrite)
|
|
|
|
_sdonazioni->rewrite();
|
|
|
|
}
|
|
|
|
return rewrite;
|
1997-06-17 15:50:08 +00:00
|
|
|
}
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
void TPrimaDon::set_page(int file, int cnt)
|
1997-06-17 15:50:08 +00:00
|
|
|
{
|
|
|
|
set_row(1,"@0g@pn", FLD(LF_SOGGETTI,SOG_CODICE,"########"));
|
|
|
|
}
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
bool TPrimaDon::set_print(int)
|
1997-06-17 15:50:08 +00:00
|
|
|
{
|
|
|
|
KEY tasto;
|
|
|
|
tasto = _msk->run();
|
|
|
|
if (tasto == K_ENTER)
|
|
|
|
{
|
|
|
|
reset_files();
|
|
|
|
add_file(LF_SOGGETTI);
|
|
|
|
reset_print();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
bool TPrimaDon::user_create()
|
1997-06-17 15:50:08 +00:00
|
|
|
{
|
|
|
|
_msk = new TMask("at7200a");
|
|
|
|
_rel = new TRelation(LF_SOGGETTI);
|
1997-12-05 16:26:15 +00:00
|
|
|
_donaz = new TLocalisamfile(LF_DONAZ);
|
|
|
|
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
|
1997-08-01 14:49:53 +00:00
|
|
|
_cur = add_cursor(new TCursor(_rel, "", 1));
|
1997-06-17 15:50:08 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1997-12-05 16:26:15 +00:00
|
|
|
bool TPrimaDon::user_destroy()
|
1997-06-17 15:50:08 +00:00
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
delete _sdonazioni;
|
1998-08-07 10:53:38 +00:00
|
|
|
delete _donaz;
|
|
|
|
delete _rel;
|
|
|
|
delete _msk;
|
1997-06-17 15:50:08 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int at7200(int argc, char* argv[])
|
|
|
|
{
|
1997-12-05 16:26:15 +00:00
|
|
|
TPrimaDon a;
|
|
|
|
a.run(argc, argv, "Marca prime donazioni");
|
1997-06-17 15:50:08 +00:00
|
|
|
return 0;
|
|
|
|
}
|