diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp index 84669e681..8285cde80 100755 --- a/ve/ve0100.cpp +++ b/ve/ve0100.cpp @@ -187,6 +187,9 @@ void TMotore_application::init_modify_mode( TMask& m ) } m.enable(DLG_ELABORA); m.disable(F_STATO); + + cached_article_balances(NULL); // Azzera cache delle giacenze + TString80 key; key << m.get(F_CODNUM); key << m.get(F_ANNO); diff --git a/ve/velib06.cpp b/ve/velib06.cpp index c3d849654..8e1ab9732 100755 --- a/ve/velib06.cpp +++ b/ve/velib06.cpp @@ -1449,8 +1449,8 @@ void TDocumento_mask::update_giacenza() break; } - const TString8 annoes = get(F_ANNO); - TArticolo_giacenza & art = cached_article_balances(codart); + const TString& annoes = get(F_ANNO); + TArticolo_giacenza& art = cached_article_balances(codart); giac = art.disponibilita(annoes, codmag, livello, TRUE); disp = art.disponibilita(annoes, codmag, livello, FALSE); diff --git a/ve/velib06a.cpp b/ve/velib06a.cpp index 93abedfe8..1d2d8732b 100755 --- a/ve/velib06a.cpp +++ b/ve/velib06a.cpp @@ -803,14 +803,14 @@ class TPrice_sheet : public TArray_sheet protected: virtual bool get_ini_paragraph(const TEdit_field& f, TString& name) const; - virtual void handler(WINDOW win, EVENT* ep); + virtual long handler(WINDOW win, EVENT* ep); TEdit_field& field() { return _fld; } public: TPrice_sheet(TEdit_field& f); }; -void TPrice_sheet::handler(WINDOW win, EVENT* ep) +long TPrice_sheet::handler(WINDOW win, EVENT* ep) { if (ep->type == E_MOUSE_DOWN) { @@ -819,7 +819,7 @@ void TPrice_sheet::handler(WINDOW win, EVENT* ep) case 1: { MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR); - if (menu) + if (menu != NULL && menu->child != NULL) { dictionary_translate_menu(menu); const PNT& p = ep->v.mouse.where; @@ -834,7 +834,7 @@ void TPrice_sheet::handler(WINDOW win, EVENT* ep) xvt_menu_popup(menu->child, win, p, pa, NULL); xvt_res_free_menu_tree(menu); } - return; + return 0L; } break; default: @@ -848,19 +848,19 @@ void TPrice_sheet::handler(WINDOW win, EVENT* ep) { case BROWSE_BAR + 1: save_columns_order(field()); - return; + return 0L; case BROWSE_BAR + 2: set_columns_order(NULL); - return; + return 0L; case BROWSE_BAR + 3: fld(0).on_key(K_F11); - return; + return 0L; default: break; } } - TArray_sheet::handler(win, ep); + return TArray_sheet::handler(win, ep); } bool TPrice_sheet::get_ini_paragraph(const TEdit_field& field, TString& parag) const @@ -1709,34 +1709,27 @@ bool codart_handler(TMask_field& f, KEY key ) { const int lognum = anamag.num(); const TFieldref fr(conai_peso_name(type, lognum), lognum); - row_mask.fld(pos).set(fr.read(anamag)); + row_mask.fld(pos).set(fr.read(anamag)); } } const int pos = row_mask.id2pos(FR_CODIVA); - if (pos >= 0) iva_handler(row_mask.fld(pos), 0); if (found) { - TString16 caus(row_mask.get(FR_CAUS)); - - if (caus.empty()) + TString8 caus(row_mask.get(FR_CAUS)); + if (caus.blank()) caus = mask.get(F_CAUSMAG); - - if (caus.not_empty()) + if (caus.full()) { const TCausale_magazzino & c = cached_causale_magazzino(caus); - - if (!c.movimenta_sospesi()) { const TRectype & rec = cache().get(LF_ANAMAG, row_mask.get(FR_CODARTMAG)); - - - if (rec.get_bool("SOSPESO")) + if (rec.get_bool(ANAMAG_SOSPESO)) return error_box(TR("Articolo %s sospeso, quindi non movimentabile"), (const char *)codart); } } @@ -1835,7 +1828,7 @@ bool codart_handler(TMask_field& f, KEY key ) sh.select(current_doc_row-1); } } - mask.update_giacenza(); + mask.update_giacenza(); } return true;