//回傳值 true.通過驗證 false.未通過驗證, protected override bool WfItemCheck(object sender, ItemCheckInfo e) { try { vw_glai100 masterModel; int iChkCnts = 0; masterModel = DrMaster.ToItem <vw_glai100>(); #region 單頭-pick vw_glai100 if (e.Row.Table.Prefix.ToLower() == "vw_glai100") { switch (e.Column.ToLower()) { case "gba06": //統制明細別 WfSetGba07ReadOnly(masterModel.gba06); if (masterModel.gba06 == "3") { DrMaster["gba07"] = ""; } else { if (GlobalFn.varIsNull(masterModel.gba07)) { DrMaster["gba07"] = "root"; } } break; case "gba07": //所屬統制科目 if (GlobalFn.varIsNull(e.Value) || e.Value.ToString().ToLower() == "root") { return(true); } if (GlobalFn.varIsNull(masterModel.gba01)) { WfShowErrorMsg("請先輸入會計科目"); WfItemChkForceFocus(ute_gba01); return(false); } var glai100Model = BoGla.OfGetGbaModel(e.Value.ToString()); if (glai100Model == null) { WfShowErrorMsg("無此會科,請檢核!"); return(false); } if (glai100Model.gba06 != "1") { WfShowErrorMsg("此會科非統制科目,請檢核!"); return(false); } if (glai100Model.gbavali == "N") { WfShowErrorMsg("此會科非有效科目,請檢核!"); return(false); } //todo:需加入檢查是否為下階科目 if (FormEditMode == YREditType.修改 && e.Value.ToString().ToLower() != "root") { var activeNode = uTree.GetNodeByKey(masterModel.gba01); if (activeNode == null) { WfShowErrorMsg("查無作用節點!"); return(false); } var checkNode = uTree.GetNodeByKey(e.Value.ToString()); if (activeNode.IsAncestorOf(checkNode)) { WfShowErrorMsg("所屬統制科目,不可為下階科目!"); return(false); } } break; } } #endregion return(true); } catch (Exception ex) { throw ex; } }
//回傳值 true.通過驗證 false.未通過驗證,會把值還原 protected override bool WfItemCheck(object sender, ItemCheckInfo e) { int iChkCnts = 0; vw_cari030 masterModel = null; gba_tb gbaModel = null; try { masterModel = DrMaster.ToItem <vw_cari030>(); #region 單頭 vw_cart100 if (e.Row.Table.Prefix.ToLower() == "vw_cari030") { switch (e.Column.ToLower()) { case "cba01": if (GlobalFn.isNullRet(e.Value, "") == "") { return(true); } if (FormEditMode == YREditType.新增) { if (BoCar.OfChkCbaPKExists(masterModel.cba01) == true) { WfShowErrorMsg("此科目分類碼已存在,請檢查!"); return(false); } } break; case "cba03": //應收帳款 if (GlobalFn.isNullRet(e.Value, "") == "") { return(true); } gbaModel = BoGla.OfGetGbaModel(e.Value.ToString()); if (gbaModel == null) { WfShowErrorMsg("無此會計科目,請檢核!"); return(false); } if (gbaModel.gbavali != "Y") { WfShowErrorMsg("此會計科目已失效,請檢核!"); return(false); } if (gbaModel.gba06 != "2" && gbaModel.gba06 != "3") { WfShowErrorMsg("會計科目非明細或獨立科目,請檢核!"); return(false); } break; case "cba04": //銷貨收入 if (GlobalFn.isNullRet(e.Value, "") == "") { return(true); } gbaModel = BoGla.OfGetGbaModel(e.Value.ToString()); if (gbaModel == null) { WfShowErrorMsg("無此會計科目,請檢核!"); return(false); } if (gbaModel.gbavali != "Y") { WfShowErrorMsg("此會計科目已失效,請檢核!"); return(false); } if (gbaModel.gba06 != "2" && gbaModel.gba06 != "3") { WfShowErrorMsg("會計科目非明細或獨立科目,請檢核!"); return(false); } break; case "cba05": //銷項稅額 if (GlobalFn.isNullRet(e.Value, "") == "") { return(true); } gbaModel = BoGla.OfGetGbaModel(e.Value.ToString()); if (gbaModel == null) { WfShowErrorMsg("無此會計科目,請檢核!"); return(false); } if (gbaModel.gbavali != "Y") { WfShowErrorMsg("此會計科目已失效,請檢核!"); return(false); } if (gbaModel.gba06 != "2" && gbaModel.gba06 != "3") { WfShowErrorMsg("會計科目非明細或獨立科目,請檢核!"); return(false); } break; } } #endregion return(true); } catch (Exception ex) { throw ex; } }