1e7361b7c2
git-svn-id: svn://10.65.10.50/trunk@5060 c028cbd2-c16b-5b4b-a496-9718f37d4682
141 lines
2.7 KiB
C++
Executable File
141 lines
2.7 KiB
C++
Executable File
#include <mask.h>
|
|
#include <printapp.h>
|
|
#include <tabutil.h>
|
|
#include <utility.h>
|
|
#include <lffiles.h>
|
|
|
|
#include "at7.h"
|
|
|
|
// nomi dei campi
|
|
#include "soggetti.h"
|
|
|
|
class TBolzano_app : public TPrintapp
|
|
{
|
|
TMask* _msk;
|
|
TRelation* _rel;
|
|
int _cur;
|
|
TString16 _cateme;
|
|
TString16 _catdec;
|
|
TString16 _fenEE;
|
|
TString16 _fenee;
|
|
|
|
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:
|
|
TBolzano_app() {}
|
|
};
|
|
|
|
HIDDEN inline TBolzano_app& app() { return (TBolzano_app&) main_app(); }
|
|
|
|
bool TBolzano_app::preprocess_page(int file, int counter)
|
|
{
|
|
bool rew = FALSE;
|
|
TRectype& recsog = current_cursor()->curr();
|
|
// luogo di lavoro == gruppo aziendale
|
|
TString16 luogo;
|
|
luogo = recsog.get(SOG_LUOGOLAV);
|
|
if (luogo.not_empty())
|
|
{
|
|
recsog.put(SOG_GRUPPOAZIE, luogo);
|
|
rew = TRUE;
|
|
}
|
|
// categorie EM/DE scambiate
|
|
TString16 cat;
|
|
cat = recsog.get(SOG_CATDON);
|
|
if (cat == _cateme)
|
|
{
|
|
recsog.put(SOG_CATDON, _catdec);
|
|
rew = TRUE;
|
|
}
|
|
if (cat == _catdec)
|
|
{
|
|
recsog.put(SOG_CATDON, _cateme);
|
|
rew = TRUE;
|
|
}
|
|
long cod = recsog.get_long(SOG_CODICE);
|
|
if (cod < 15077)
|
|
{
|
|
TString16 fenotipo;
|
|
fenotipo = recsog.get(SOG_FENOTIPORH);
|
|
if (fenotipo.not_empty())
|
|
{
|
|
int pos;
|
|
pos = fenotipo.find(_fenEE);
|
|
if (pos > 0)
|
|
{
|
|
fenotipo.overwrite(_fenee,pos);
|
|
recsog.put(SOG_FENOTIPORH,fenotipo);
|
|
rew = TRUE;
|
|
}
|
|
else
|
|
{
|
|
pos = fenotipo.find(_fenee);
|
|
if (pos > 0)
|
|
{
|
|
fenotipo.overwrite(_fenEE,pos);
|
|
recsog.put(SOG_FENOTIPORH,fenotipo);
|
|
rew = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (rew)
|
|
current_cursor()->file().rewrite();
|
|
return rew;
|
|
}
|
|
|
|
void TBolzano_app::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));
|
|
set_row(1,"@62g@S", FLD(LF_SOGGETTI,SOG_CATDON));
|
|
set_row(1,"@65g@S", FLD(LF_SOGGETTI,SOG_LUOGOLAV));
|
|
set_row(1,"@70g@S", FLD(LF_SOGGETTI,SOG_FENOTIPORH));
|
|
}
|
|
|
|
bool TBolzano_app::set_print(int)
|
|
{
|
|
KEY tasto;
|
|
tasto = _msk->run();
|
|
if (tasto == K_ENTER)
|
|
{
|
|
reset_files();
|
|
add_file(LF_SOGGETTI);
|
|
reset_print();
|
|
_cateme = "EM";
|
|
_catdec = "DE";
|
|
_fenEE = "EE";
|
|
_fenee = "ee";
|
|
return TRUE;
|
|
}
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
bool TBolzano_app::user_create()
|
|
{
|
|
_msk = new TMask("at7200a");
|
|
_rel = new TRelation(LF_SOGGETTI);
|
|
_cur = add_cursor(new TCursor(_rel, "", 1));
|
|
return TRUE;
|
|
}
|
|
|
|
bool TBolzano_app::user_destroy()
|
|
{
|
|
delete _rel;
|
|
delete _msk;
|
|
return TRUE;
|
|
}
|
|
|
|
int at7200(int argc, char* argv[])
|
|
{
|
|
TBolzano_app a;
|
|
a.run(argc, argv, "Correzioni per AVIS Bolzano");
|
|
return 0;
|
|
} |