diff --git a/ba/ba3100.cpp b/ba/ba3100.cpp index 2cac964ff..6a5e435b2 100755 --- a/ba/ba3100.cpp +++ b/ba/ba3100.cpp @@ -1,7 +1,10 @@ #include #include +#include -#include "batbreg.h" +#include "batbreg.h" +#define F_TIPODEL 133 // attenzione estratto da batbdel.h . Tenerlo aggiornato !!!! +#define F_IMPORTO 140 // attenzione estratto da batbdel.h . Tenerlo aggiornato !!!! #define REG_JOURNAL 5 @@ -10,6 +13,7 @@ class TGeneric_table_app : public Tab_application long _oldditta; int _oldanno; bool _exist_journal; + bool _stampa_intest; protected: virtual bool user_create() ; @@ -20,7 +24,7 @@ public: bool exist_journal() {return _exist_journal;} - TGeneric_table_app() {} + TGeneric_table_app() : _exist_journal(FALSE), _stampa_intest(FALSE) {} virtual ~TGeneric_table_app() {} }; @@ -34,6 +38,8 @@ void TGeneric_table_app::init_insert_mode(TMask& m) long ditta = get_firm(); int anno = atoi(m.get(F_ANNO)); + m.set(F_STAMPA_INTESTAZIONE, _stampa_intest ? "X" : ""); + if (ditta != _oldditta || anno != _oldanno) { _oldditta = ditta; @@ -83,12 +89,39 @@ HIDDEN bool tiporeg_handler(TMask_field& f, KEY k) return TRUE; } +HIDDEN bool impdel_handler(TMask_field& f, KEY k) +{ + const TMask & m = f.mask(); + + if (!m.query_mode() && k == K_ENTER) + { + const int tipo_del = m.get_int(F_TIPODEL) - 1; + + if (tipo_del < 2) + { + const real imp(m.get(F_IMPORTO)); + const double lim[2] = { 50000.0, 200000.0}; + + if (imp < lim[tipo_del]) + return yesno_box("Importo inferiore a Lit. %s. Vuoi registrare lo stesso ?", real(lim[tipo_del]).string(".")); + } + } + return TRUE; +} bool TGeneric_table_app::user_create() { Tab_application::user_create(); if (get_tabname() == "REG") + { get_mask()->set_handler(F_TIPO, tiporeg_handler); + + TConfig st(CONFIG_STUDIO, "cg"); + + _stampa_intest = st.get_bool("StiReg"); + } + if (get_tabname() == "DEL") + get_mask()->set_handler(F_IMPORTO, impdel_handler); return TRUE; }