diff --git a/lv/lv3100.cpp b/lv/lv3100.cpp index a3067ce60..85c090453 100755 --- a/lv/lv3100.cpp +++ b/lv/lv3100.cpp @@ -387,7 +387,7 @@ bool TGestione_bolle_msk::lv_bolla_handler(TMask_field& f, KEY k) //e il campo "dotazione temporanea" (se la causale è giusta) bool TGestione_bolle_msk::lv_ritirato_handler(TMask_field& f, KEY k) { - if (f.to_check(k) && !f.empty()) + if (f.to_check(k) && !f.empty()) { TMask& msk = f.mask(); real ritirato = f.get(); @@ -424,7 +424,6 @@ bool TGestione_bolle_msk::lv_ritirato_handler(TMask_field& f, KEY k) msk.set(FR_JOLLY2, dotmp); } } - sheet->force_update(); } return true; } @@ -440,36 +439,38 @@ bool TGestione_bolle_msk::lv_consegnato_handler(TMask_field& f, KEY k) default: break; } - TMask& msk = f.mask(); - real consegnato = f.get(); - //gestione campi dotazione odierna e dotazione temporanea - TSheet_field* sheet = msk.get_sheet(); - TDocumento_mask& dmask = (TDocumento_mask&)sheet->mask(); - TRiga_documento& rdoc = dmask.doc()[sheet->selected()+1]; - rdoc.put(RDOC_QTAGG1,consegnato); - - TGiac_per_cli& giac = gbapp().giacenza(); - long dotod = giac.giac_att(rdoc, true); - - msk.set(FR_JOLLY1, dotod); - - //instanzio una cache sulla tabella delle causali - TString4 causale = rdoc.get(RDOC_CODAGG1); - const TRectype& cau = cache().get("&CAU", causale); - - //movimento o meno la dotazione temporanea a seconda di cosa prevede la causale - if (cau.get_bool("B0") || cau.get_bool("B1")) + if (f.to_check(k)) { - const TRectype& caumagr = cache().get("%CAU", cau.get(cau.get_bool("B0") ? "S1": "S2")); - TString4 str = caumagr.get("S2").mid(32,2); + TMask& msk = f.mask(); + real consegnato = f.get(); + //gestione campi dotazione odierna e dotazione temporanea + TSheet_field* sheet = msk.get_sheet(); + TDocumento_mask& dmask = (TDocumento_mask&)sheet->mask(); + TRiga_documento& rdoc = dmask.doc()[sheet->selected()+1]; + rdoc.put(RDOC_QTAGG1,consegnato); - if (atoi(str) != ZERO) + TGiac_per_cli& giac = gbapp().giacenza(); + long dotod = giac.giac_att(rdoc, true); + + msk.set(FR_JOLLY1, dotod); + + //instanzio una cache sulla tabella delle causali + TString4 causale = rdoc.get(RDOC_CODAGG1); + const TRectype& cau = cache().get("&CAU", causale); + + //movimento o meno la dotazione temporanea a seconda di cosa prevede la causale + if (cau.get_bool("B0") || cau.get_bool("B1")) { - long dotmp = giac.giac_att(rdoc, false); - msk.set(FR_JOLLY2, dotmp); + const TRectype& caumagr = cache().get("%CAU", cau.get(cau.get_bool("B0") ? "S1": "S2")); + TString4 str = caumagr.get("S2").mid(32,2); + + if (atoi(str) != ZERO) + { + long dotmp = giac.giac_att(rdoc, false); + msk.set(FR_JOLLY2, dotmp); + } } } - sheet->force_update(); return ok; } @@ -507,11 +508,12 @@ bool TGestione_bolle_msk::lv_codart_handler(TMask_field& f, KEY k) //cerco la causale relativa all'articolo; se non la trovo prendo quella standard TString4 causale = rcont.get(LVRCONDV_CAUSLAV); - if (causale.blank() || causale == "000") + if (causale.blank() || atoi(causale) == 0 ) { TConfig* configlv = new TConfig(CONFIG_DITTA,"lv"); - causale = configlv->get("CAUSLAV"); + causale = configlv->get("CAUSLAV"); } + msk.set(FR_CODAGG1, causale); //controllo se si vuole aggiungere un eventuale nuovo articolo al contratto if (rcont.empty() &&