campo-sirio/in/in0700.cpp
alex 37178085ef Patch level : main 07.150
Files correlati     : nessuno
Ricompilazione Demo : [ ]
Commento            :
Riportata la versione aga 07.150 sul main trunk


git-svn-id: svn://10.65.10.50/trunk@9871 c028cbd2-c16b-5b4b-a496-9718f37d4682
2001-09-19 14:52:11 +00:00

122 lines
2.9 KiB
C++
Executable File

#include <relapp.h>
#include <recarray.h>
#include "in0.h"
#include "in0700a.h"
#include "inlib01.h"
///////////////////////////////////////////////////////////
// TRettifiche_mask
///////////////////////////////////////////////////////////
class TRettifiche_mask : public TIntra_mask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual short type_field() const { return F_TIPO; }
virtual short period_field() const { return F_PERIODO_M; }
virtual int anno() const { return get_int(O_ANNO); }
public:
TRettifiche_mask();
virtual ~TRettifiche_mask() { }
};
bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
bool ok = TIntra_mask::on_field_event(o, e, jolly);
if (ok) switch (o.dlg())
{
case F_TIPO:
if (e == fe_init || e == fe_modify)
{
// Ripeto il comportamento standard sul periodo di rettifica
show(O_PERIODO_M, field(F_PERIODO_M).shown());
show(O_PERIODO_T, field(F_PERIODO_T).shown());
show(O_PERIODO_A, field(F_PERIODO_A).shown());
}
break;
case F_VALORE_STAT:
if (e == fe_init)
{
TMask& m = o.mask();
TString key ; key << main_app().get_firm();
const bool req = frequenza(anno()) == 'M' && !cache().get(LF_NDITTE, key).get_bool("NONOBBSTAT");
const CheckType chk = req ? CHECK_REQUIRED : CHECK_NORMAL;
m.field(F_VALORE_STAT).check_type(chk);
}
break;
case O_NUM_RIG:
if ((e == fe_init || e == fe_modify) && !o.empty())
{
TEdit_field& ef = (TEdit_field&)o;
ef.check();
TCursor& cur = *ef.browse()->cursor();
bool ok = cur.ok();
enable(-GR_ORIGINAL, !ok);
if (e == fe_modify && insert_mode())
{
for (short dlg = O_STATO; dlg <= O_NOMENCLATURA3; dlg++)
{
const int pos = id2pos(dlg);
if (pos >= 0)
set(dlg + F_STATO - O_STATO, fld(pos).get());
}
}
}
break;
default:
break;
}
return ok;
}
TRettifiche_mask::TRettifiche_mask()
:TIntra_mask("in0700a")
{
first_focus(F_TIPO);
}
///////////////////////////////////////////////////////////
// Applicazione principale
///////////////////////////////////////////////////////////
class TRettifiche_intra : public TRelation_application
{
TRelation* _rel;
TMask* _msk;
protected:
virtual bool user_create();
virtual TRelation* get_relation() const { return _rel; }
virtual TMask* get_mask(int) { return _msk; }
virtual bool changing_mask(int mode) { return FALSE; }
virtual bool user_destroy();
public:
};
bool TRettifiche_intra::user_create()
{
open_files(LF_TABCOM, LF_TAB, LF_CLIFO,
LF_RIEPRETT, 0);
_rel = new TRelation(LF_RIEPRETT);
_msk = new TRettifiche_mask;
return TRUE;
}
bool TRettifiche_intra::user_destroy()
{
delete _msk;
delete _rel;
return TRUE;
}
int in0700(int argc, char* argv[])
{
TRettifiche_intra a;
a.run(argc, argv, "Rettifiche INTRA");
return 0;
}