2001-09-19 14:52:11 +00:00
|
|
|
|
#include <automask.h>
|
|
|
|
|
#include <recarray.h>
|
|
|
|
|
#include <relapp.h>
|
|
|
|
|
#include <defmask.h>
|
|
|
|
|
|
|
|
|
|
#include "celib.h"
|
|
|
|
|
#include "ce1400a.h"
|
|
|
|
|
|
|
|
|
|
#include "catdi.h"
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Applicazione principale
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TScelta_amm_cat : public TRelation_application
|
|
|
|
|
{
|
|
|
|
|
TRelation* _rel;
|
|
|
|
|
TAutomask* _msk[4];
|
|
|
|
|
int _tipo;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool user_create();
|
|
|
|
|
virtual bool user_destroy();
|
|
|
|
|
virtual TRelation* get_relation() const { return _rel; }
|
|
|
|
|
virtual bool changing_mask(int) { return TRUE; }
|
|
|
|
|
virtual TMask* get_mask(int mode);
|
|
|
|
|
virtual bool protected_record(TRelation& rel);
|
|
|
|
|
|
|
|
|
|
void init_mask(TMask& m);
|
|
|
|
|
virtual void init_query_mode(TMask& m);
|
|
|
|
|
virtual void init_query_insert_mode(TMask& m);
|
|
|
|
|
virtual void init_insert_mode(TMask& m);
|
|
|
|
|
virtual void init_modify_mode(TMask& m);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void set_tipo_beni(int t) { _tipo = t; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline TScelta_amm_cat& app() { return (TScelta_amm_cat&)main_app(); }
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Maschera di query
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TSac_mask : public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TSac_mask() : TAutomask("ce1400a") { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TSac_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch (o.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_ESERCIZIO:
|
|
|
|
|
case F_GRUPPO:
|
|
|
|
|
case F_SPECIE:
|
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
|
{
|
|
|
|
|
const int ese = get_int(F_ESERCIZIO);
|
|
|
|
|
const int gru = get_int(F_GRUPPO);
|
|
|
|
|
const char* spe = get(F_SPECIE);
|
|
|
|
|
TString16 str;
|
|
|
|
|
str.format("%04d%02d%-4s", ese, gru, spe);
|
|
|
|
|
const TRectype& curr_ccb = cache().get("CCB", str);
|
|
|
|
|
const bool can_create = !curr_ccb.get_bool("B1"); // Bollato stampato
|
|
|
|
|
enable(DLG_NEWREC, can_create);
|
|
|
|
|
enable(DLG_DELREC, can_create);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_CATEGORIA:
|
|
|
|
|
case F_DESC_CAT:
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
bool ok = dc.on_category_event(o, e, jolly);
|
2002-02-26 16:20:19 +00:00
|
|
|
|
if (ok)
|
|
|
|
|
set(F_CATEGORIA2, get(F_CATEGORIA));
|
|
|
|
|
else
|
2001-09-19 14:52:11 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
case F_CATEGORIA2:
|
|
|
|
|
case F_DESC_CAT2:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
const int gr = get_int(F_GRUPPO);
|
|
|
|
|
const char* sp = get(F_SPECIE);
|
2002-02-26 16:20:19 +00:00
|
|
|
|
const int ca = get_int(F_CATEGORIA2);
|
2001-09-19 14:52:11 +00:00
|
|
|
|
const TRectype& cac = dc.categoria(gr, sp, ca);
|
|
|
|
|
bool ok = !cac.empty();
|
|
|
|
|
if (ok && (o.dlg() == F_CATEGORIA || o.dlg() == F_CATEGORIA2))
|
|
|
|
|
{
|
|
|
|
|
set(o.dlg() == F_CATEGORIA ? F_DESC_CAT : F_DESC_CAT2, cac.get("S0"));
|
|
|
|
|
|
|
|
|
|
if (cac.get_bool("B0"))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("Categoria non ammortizzabile"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
|
|
|
|
|
const int tb = cac.get_int("I0");
|
|
|
|
|
app().set_tipo_beni(tb);
|
|
|
|
|
switch (tb)
|
|
|
|
|
{
|
|
|
|
|
case 1: // Beni immateriali
|
|
|
|
|
{
|
|
|
|
|
const bool amm_per_anni = cac.get_int("I1") <= 1;
|
|
|
|
|
if (amm_per_anni)
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("La categoria prevede un ammortamento per anni:\n"
|
|
|
|
|
"Effettuare le scelte sul cespite"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2: // Costi pluriennali
|
|
|
|
|
{
|
|
|
|
|
const int vincolo = cac.get_int("I2");
|
|
|
|
|
if (vincolo == 3) // Quote
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("La categoria prevede un ammortamento per quote costanti:\n"
|
|
|
|
|
"Effettuare le scelte sul cespite"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-02-26 16:20:19 +00:00
|
|
|
|
if (!ok && !o.empty() && o.dlg() == F_CATEGORIA2)
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("E' neccessario specificare una categoria valida"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (ok && e == fe_button && o.dlg() == F_CATEGORIA)
|
|
|
|
|
send_key(K_ENTER, 0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Maschera di beni materiali
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TMat_mask : public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
bool test_min(short quota, short minimo) const;
|
|
|
|
|
bool test_max(short nor, short ant, short acc) const;
|
|
|
|
|
bool test_rit(short quota, short minimo) const;
|
|
|
|
|
bool is_max(short quota, short massimo) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TMat_mask() : TAutomask("ce1400b") { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TMat_mask::test_min(short quota, short minimo) const
|
|
|
|
|
{
|
|
|
|
|
bool warning = FALSE;
|
|
|
|
|
const bool ammrit = get_bool(F_AMMRIT);
|
|
|
|
|
if (!ammrit)
|
|
|
|
|
{
|
2004-03-13 09:12:24 +00:00
|
|
|
|
const real perq(get(quota));
|
|
|
|
|
const real minq(get(minimo));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
warning = perq < minq;
|
|
|
|
|
}
|
|
|
|
|
return warning;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TMat_mask::test_rit(short quota, short minimo) const
|
|
|
|
|
{
|
|
|
|
|
bool warning = FALSE;
|
|
|
|
|
const bool ammrit = get_bool(F_AMMRIT);
|
|
|
|
|
if (ammrit)
|
|
|
|
|
{
|
2004-03-13 09:12:24 +00:00
|
|
|
|
const real perq(get(quota));
|
|
|
|
|
const real minq(get(minimo));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
warning = perq >= minq;
|
|
|
|
|
}
|
|
|
|
|
return warning;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TMat_mask::test_max(short nor, short ant, short acc) const
|
|
|
|
|
{
|
|
|
|
|
real tot;
|
|
|
|
|
tot += get_real(nor);
|
|
|
|
|
tot += get_real(ant);
|
|
|
|
|
tot += get_real(acc);
|
|
|
|
|
return tot > 100.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TMat_mask::is_max(short quota, short massima) const
|
|
|
|
|
{
|
2004-03-13 09:12:24 +00:00
|
|
|
|
const real perq(get(quota));
|
|
|
|
|
const real maxq(get(massima));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
return perq >= maxq;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TMat_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch (o.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_CATEGORIA:
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
dc.on_category_event(o, e, jolly);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_NORFIS_87:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
if (test_min(F_NORFIS_87, F_MIN_87))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
warning_box(TR("L'ammortamento normale <20> inferiore al minimo della tabella ministeriale:\n"
|
|
|
|
|
"Se non si seleziona l'ammortamento ritardato verrano generate delle quote perse"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (test_max(F_NORFIS_87, F_ANTFIS_87, F_ACCFIS))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("Il totale delle percentuali di ammortamento supera il 100%"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (test_rit(F_NORFIS_87, F_MIN_87))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("In caso di ammortamento ritardato si deve specificare una quota inferiore al minimo ministeriale"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_NORFIS_88:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
if (test_min(F_NORFIS_88, F_MIN_88))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
warning_box(TR("L'ammortamento normale <20> inferiore al minimo della tabella ministeriale:\n"
|
|
|
|
|
"Se non si seleziona l'ammortamento ritardato verrano generate delle quote perse"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (test_max(F_NORFIS_88, F_ANTFIS_88, F_ACCFIS))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("Il totale delle percentuali di ammortamento supera il 100%"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (test_rit(F_NORFIS_88, F_MIN_88))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("In caso di ammortamento ritardato si deve specificare una quota inferiore al minimo ministeriale"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_NORFIS_89:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
if (test_min(F_NORFIS_89, F_MIN_89))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
warning_box(TR("L'ammortamento normale <20> inferiore al minimo della tabella ministeriale:\n"
|
|
|
|
|
"Se non si seleziona l'ammortamento ritardato verrano generate delle quote perse"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (test_max(F_NORFIS_89, F_ANTFIS_89, F_ACCFIS))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("Il totale delle percentuali di ammortamento supera il 100%"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
if (test_rit(F_NORFIS_89, F_MIN_89))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("In caso di ammortamento ritardato si deve specificare una quota inferiore al minimo ministeriale"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_ANTFIS_87:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
if (!o.empty() && !is_max(F_NORFIS_87, F_MAX_87))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("E' necessario completare l'ammortamento normale prima di calcolare quello anticipato"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_ANTFIS_88:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
if (!o.empty() && !is_max(F_NORFIS_88, F_MAX_88))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("E' necessario completare l'ammortamento normale prima di calcolare quello anticipato"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_ANTFIS_89:
|
|
|
|
|
if (e == fe_modify || e == fe_close)
|
|
|
|
|
{
|
|
|
|
|
if (!o.empty() && !is_max(F_NORFIS_89, F_MAX_89))
|
2003-05-12 15:03:40 +00:00
|
|
|
|
return error_box(TR("E' necessario completare l'ammortamento normale prima di calcolare quello anticipato"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Maschera di beni immateriali
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TImm_mask : public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TImm_mask() : TAutomask("ce1400c") { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TImm_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch (o.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_CATEGORIA:
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
return dc.on_category_event(o, e, jolly);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Maschera di costi pluriennali
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TPlu_mask : public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TPlu_mask() : TAutomask("ce1400d") { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TPlu_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch (o.dlg())
|
2002-02-26 16:20:19 +00:00
|
|
|
|
{
|
2001-09-19 14:52:11 +00:00
|
|
|
|
case F_CATEGORIA:
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
return dc.on_category_event(o, e, jolly);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Applicazione principale
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TMask* TScelta_amm_cat::get_mask(int mode)
|
|
|
|
|
{
|
|
|
|
|
TMask* m = NULL;
|
|
|
|
|
if (mode == MODE_QUERY || mode == MODE_QUERYINS)
|
|
|
|
|
{
|
|
|
|
|
if (_msk[0] == NULL)
|
|
|
|
|
_msk[0] = new TSac_mask;
|
|
|
|
|
m = _msk[0];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch(_tipo)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
if (_msk[2] == NULL)
|
|
|
|
|
_msk[2] = new TImm_mask;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
if (_msk[3] == NULL)
|
|
|
|
|
_msk[3] = new TPlu_mask;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (_msk[1] == NULL)
|
|
|
|
|
_msk[1] = new TMat_mask;
|
2002-02-26 16:20:19 +00:00
|
|
|
|
_tipo = 0;
|
2001-09-19 14:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
m = _msk[_tipo+1];
|
|
|
|
|
}
|
|
|
|
|
return m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TScelta_amm_cat::user_create()
|
|
|
|
|
{
|
|
|
|
|
open_files(LF_TABCOM, LF_CATDI, 0);
|
|
|
|
|
_rel = new TRelation(LF_CATDI);
|
|
|
|
|
memset(_msk, 0, sizeof(_msk));
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TScelta_amm_cat::user_destroy()
|
|
|
|
|
{
|
|
|
|
|
for (int m = 3; m >= 0; m--)
|
|
|
|
|
if (_msk[m]) delete _msk[m];
|
|
|
|
|
delete _rel;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TScelta_amm_cat::protected_record(TRelation& rel)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& curr = rel.curr();
|
|
|
|
|
const int annoes = curr.get_int(CATDI_CODES);
|
|
|
|
|
int gruppo = curr.get_int(CATDI_CODCGRA);
|
|
|
|
|
if (gruppo <= 0) gruppo = curr.get_int(CATDI_CODCGR);
|
|
|
|
|
TString4 specie = curr.get(CATDI_CODSPA);
|
|
|
|
|
if (specie.blank())
|
|
|
|
|
specie = curr.get(CATDI_CODSP);
|
|
|
|
|
|
|
|
|
|
TString16 str;
|
|
|
|
|
str.format("%04d%02d%-4s", annoes, gruppo, (const char*)specie);
|
|
|
|
|
const TRectype& curr_ccb = cache().get("CCB", str);
|
|
|
|
|
const bool protect = curr_ccb.get_bool("B1"); // Bollato stampato
|
|
|
|
|
return protect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TScelta_amm_cat::init_query_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
ditta_cespiti().init_mask(m);
|
|
|
|
|
set_search_field(F_CATEGORIA2);
|
|
|
|
|
m.show(F_CATEGORIA2); m.show(F_DESC_CAT2);
|
|
|
|
|
m.hide(F_CATEGORIA); m.hide(F_DESC_CAT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TScelta_amm_cat::init_query_insert_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
ditta_cespiti().init_mask(m);
|
|
|
|
|
set_search_field(F_CATEGORIA);
|
|
|
|
|
m.show(F_CATEGORIA); m.show(F_DESC_CAT);
|
|
|
|
|
m.hide(F_CATEGORIA2); m.hide(F_DESC_CAT2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TScelta_amm_cat::init_mask(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
const int ese = _msk[0]->get_int(F_ESERCIZIO);
|
|
|
|
|
const int gru = _msk[0]->get_int(F_GRUPPO);
|
|
|
|
|
const char* spe = _msk[0]->get(F_SPECIE);
|
2002-02-26 16:20:19 +00:00
|
|
|
|
const int cat = _msk[0]->get_int(F_CATEGORIA2);
|
2001-09-19 14:52:11 +00:00
|
|
|
|
dc.set_attivita(ese, gru, spe);
|
|
|
|
|
dc.init_mask(m);
|
2002-02-26 16:20:19 +00:00
|
|
|
|
m.set(F_CATEGORIA, cat);
|
2001-09-19 14:52:11 +00:00
|
|
|
|
|
|
|
|
|
const TRectype& cac = dc.categoria(gru, spe, cat);
|
|
|
|
|
switch (_tipo)
|
|
|
|
|
{
|
2004-08-05 07:50:40 +00:00
|
|
|
|
case 1: // Immateriali
|
2001-09-19 14:52:11 +00:00
|
|
|
|
m.set(F_TIPOAMM, cac.get("I1"));
|
|
|
|
|
m.set(F_MAX_AMM, cac.get("R13"));
|
|
|
|
|
m.set(F_ANNI, cac.get("I3"));
|
|
|
|
|
break;
|
2004-08-05 07:50:40 +00:00
|
|
|
|
case 2: // Pluriennali
|
2001-09-19 14:52:11 +00:00
|
|
|
|
m.set(F_TIPOVINC, cac.get("I2"));
|
|
|
|
|
m.set(F_MIN_AMM, cac.get("R14"));
|
|
|
|
|
m.set(F_MAX_AMM, cac.get("R15"));
|
|
|
|
|
m.set(F_ANNI, cac.get("I3"));
|
|
|
|
|
break;
|
2004-08-05 07:50:40 +00:00
|
|
|
|
default: // Materiali
|
2001-09-19 14:52:11 +00:00
|
|
|
|
{
|
2004-03-13 09:12:24 +00:00
|
|
|
|
const real r11 = cac.get_real("R11");
|
|
|
|
|
const real r12 = cac.get_real("R12");
|
2001-09-19 14:52:11 +00:00
|
|
|
|
m.set(F_MIN_87, real(r12/2.0));
|
|
|
|
|
m.set(F_MIN_88, real(r12/2.0));
|
|
|
|
|
m.set(F_MIN_89, real(r11/2.0));
|
|
|
|
|
m.set(F_MAX_87, r12);
|
|
|
|
|
m.set(F_MAX_88, r12);
|
|
|
|
|
m.set(F_MAX_89, r11);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-02-26 16:20:19 +00:00
|
|
|
|
|
|
|
|
|
const bool can_edit = !dc.bollato_stampato();
|
|
|
|
|
m.enable(DLG_SAVEREC, can_edit);
|
|
|
|
|
m.enable(DLG_NEWREC, can_edit);
|
|
|
|
|
m.enable(DLG_DELREC, can_edit);
|
2001-09-19 14:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TScelta_amm_cat::init_insert_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
init_mask(m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TScelta_amm_cat::init_modify_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
init_mask(m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ce1400(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TScelta_amm_cat sac;
|
2003-05-12 15:03:40 +00:00
|
|
|
|
sac.run(argc, argv, TR("Scelta ammortamento per categoria"));
|
2001-09-19 14:52:11 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|