diff --git a/ba/ba3100.cpp b/ba/ba3100.cpp index 7bfcb0ea3..41f107318 100755 --- a/ba/ba3100.cpp +++ b/ba/ba3100.cpp @@ -21,6 +21,8 @@ #define TAB_REGISTRI "REG" #define TAB_VALUTE "%VAL" #define TAB_VERSAMENTI "%VER" +#define TAB_MAGAZZINI "MAG" +#define TAB_GRMERC "GMC" class TGeneric_table_app : public TTable_application { @@ -47,6 +49,8 @@ protected: static bool valute_decimals_handler(TMask_field& f, KEY k); static bool change_decimals_handler(TMask_field& f, KEY k); static bool codcab_handler(TMask_field& f, KEY k); + static bool codmag_handler(TMask_field& f, KEY k); + static bool codgmc_handler(TMask_field& f, KEY k); public: bool exist_journal() { return _exist_journal; } @@ -291,11 +295,6 @@ HIDDEN bool coddel_handler(TMask_field& f, KEY k) const short id = f.dlg(); const long cod = m.get_long(id == F_BANCA1 ? F_BANCA1 : F_CONCESSIONE); - //if (id == F_BANCA1) - // if (cod != 0) - // m.hide(F_CONCESSIONE); - - //if (id == F_CONCESSIONE || id == F_BANCA1) if (cod != 0) { const long firm = m.get_long(F_DITTA); @@ -409,7 +408,7 @@ HIDDEN bool impdel_handler(TMask_field& f, KEY k) HIDDEN bool mese_handler(TMask_field& f, KEY k) { -// if (!f.mask().query_mode() && k == K_ENTER) + if (k == K_ENTER) { TMask& m = f.mask(); @@ -545,6 +544,40 @@ bool TGeneric_table_app::codcab_handler(TMask_field& f, KEY k) } return TRUE; } + +bool TGeneric_table_app::codmag_handler(TMask_field& f, KEY k) +{ + TMask& m = f.mask(); + if (m.query_mode() && k == K_ENTER) + { + const TString& codice = m.get(f.dlg()); //stringa immessa nella maschera + const TString& codtab = cache().get("MAG", codice, "CODTAB"); //stringa cercata nella tabella + if (codtab.empty()) //se non trovi la stringa in tabella (in codice magazzino non esiste->se in insert mode) + { + const int lungh = codice.len(); + if (lungh > 0 && lungh < 3) + return f.error_box("Il codice magazzino deve avere obbligatoriamente lunghezza 3"); + } + } + return TRUE; +} + +bool TGeneric_table_app::codgmc_handler(TMask_field& f, KEY k) +{ + TMask& m = f.mask(); + if (m.query_mode() && k == K_ENTER) + { + const TString& codice = m.get(f.dlg()); //stringa immessa nella maschera + const TString& codtab = cache().get("GMC", codice, "CODTAB"); //stringa cercata nella tabella + if (codtab.empty()) //se non trovi la stringa in tabella (in codice magazzino non esiste->se in insert mode) + { + const int lungh = codice.len(); + if (lungh > 0 && lungh < 3) + return f.error_box("Il codice del gruppo merceologico deve avere obbligatoriamente lunghezza 3"); + } + } + return TRUE; +} bool TGeneric_table_app::user_create() { @@ -602,6 +635,12 @@ bool TGeneric_table_app::user_create() if (name == TAB_BANCHE) mask.set_handler(102, codcab_handler); + + if (name == TAB_MAGAZZINI) + mask.set_handler(101, codmag_handler); + + if (name == TAB_GRMERC) + mask.set_handler(101, codgmc_handler); } return ok;