protected override string btnModify_Click() { decimal money = Convert.ToDecimal(Request.QueryString["money"]); int subid = Convert.ToInt32(Request.QueryString["subid"]); bool result = false; if (!string.IsNullOrEmpty(Request.QueryString["subid"])) { Model.ObjSub model = BLL.ObjSub.GetModel(Convert.ToInt32(Request.QueryString["subid"])); Model.Obj objmodel = BLL.Obj.GetModel(Convert.ToInt32(model.ObjID)); if ((model.ReMoney + money) > model.Money * (1 + model.CZFloat)) { return("支出失败,超出超支限额"); } decimal rmoney = Convert.ToDecimal(BLL.CommonBase.GetSingle("SELECT ISNULL(SUM(CASE WHEN ReMoney>[Money] THEN ReMoney ELSE [Money] END),0) FROM dbo.ObjSub WHERE ID<>" + model.ID + " and OBJID=" + objmodel.ID + ";")); decimal cc = (model.ReMoney + money) > model.Money ? (model.ReMoney + money) : model.Money; if ((rmoney + cc) > objmodel.Money) { return("支出失败,超出项目预算"); } model.ReMoney = model.ReMoney + money; result = BLL.ObjSub.Update(model); } if (result) { return("支出成功"); } return("支出失败"); }
protected override string btnModify_Click() { bool result = false; Model.Obj model = BLL.Obj.GetModel(Convert.ToInt32(Request.Form["oID"])); model.Name = Request.Form["txtName"]; model.Remark = Request.Form["txtRemark"]; model.Person = Request.Form["txtPerson"]; model.ImpUnit = Request.Form["txtImpType"]; model.FundID = Convert.ToInt32(Request.Form["txtFundID"]); model.TheNumID = Request.Form["txtTheNumID"]; model.DepartID = Convert.ToInt32(Request.Form["txtDepartID"]); model.Money = Convert.ToDecimal(Request.Form["txtMoney"]); model.EndDate = DateTime.MaxValue; model.State = Convert.ToInt32(Request.Form["selState"]); if (model.EndDate == DateTime.MaxValue && model.State == 1) { model.EndDate = DateTime.Now; } result = BLL.Obj.Update(model); if (result) { return("操作成功"); } return("操作失败"); }
protected override string btnModify_Click() { bool result = false; Model.ObjSub model = new Model.ObjSub(); Model.Obj objmodel = BLL.Obj.GetModel(Convert.ToInt32(Request.Form["objid"])); model.ObjID = objmodel.ID; model.Name = Request.Form["txtSubType"]; model.Remark = Request.Form["txtRemark"]; model.Person = Request.Form["txtPerson"]; model.SubType = Convert.ToInt32(Request.Form["txtSubType"]); model.Money = Convert.ToDecimal(Request.Form["txtMoney"]); model.ReMoney = Convert.ToDecimal(Request.Form["txtReMoney"]); model.CZFloat = Convert.ToDecimal(Request.Form["txtCZFloat"]); model.Money = Convert.ToDecimal(Request.Form["txtMoney"]); if (model.ReMoney > model.Money * (1 + model.CZFloat)) { return("提交失败,超出超支限额"); } decimal rmoney = Convert.ToDecimal(BLL.CommonBase.GetSingle("SELECT ISNULL(SUM(CASE WHEN ReMoney>[Money] THEN ReMoney ELSE [Money] END),0) FROM dbo.ObjSub WHERE OBJID=" + objmodel.ID + ";")); decimal cc = model.ReMoney > model.Money ? model.ReMoney : model.Money; if ((rmoney + cc) > objmodel.Money) { return("提交失败,超出项目预算"); } result = BLL.ObjSub.Add(model); if (result) { return("操作成功"); } return("操作失败"); }
protected override void SetPowerZone() { txtSubType.DataSource = BLL.ObjSubType.GetList(" 1 = 1 order by ID"); txtSubType.DataTextField = "Name"; txtSubType.DataValueField = "ID"; txtSubType.DataBind(); objid.Value = Request.QueryString["id"]; Model.Obj obj = BLL.Obj.GetModel(Convert.ToInt32(Request.QueryString["id"])); txtPerson.Value = obj.Person; }
protected override void SetPowerZone() { int oid = Convert.ToInt32(Request.QueryString["id"]); obj = BLL.Obj.GetModel(oid); totalmoney = obj.Money.ToString(); remoney = BLL.CommonBase.GetSingle("select ISNULL(SUM(remoney),0) from ObjSub where ObjID in(" + Request.QueryString["id"] + ") and IsDelete=0;").ToString(); List <Model.ImpType> implist = BLL.ImpType.GetModelList(" ID IN(" + obj.ImpUnit + "); "); foreach (Model.ImpType item in implist) { impstr += item.Name; } }
protected override void SetPowerZone() { txtFundID.DataSource = BLL.FundType.GetList(" 1 = 1 order by ID"); txtFundID.DataTextField = "Name"; txtFundID.DataValueField = "ID"; txtFundID.DataBind(); txtDepartID.DataSource = BLL.DepartType.GetList(" 1 = 1 order by ID"); txtDepartID.DataTextField = "Name"; txtDepartID.DataValueField = "ID"; txtDepartID.DataBind(); Model.Obj model = BLL.Obj.GetModel(Convert.ToInt32(Request.QueryString["ID"])); oID.Value = Request.QueryString["ID"]; txtName.Value = model.Name; txtRemark.Value = model.Remark; txtPerson.Value = model.Person; //txtImpUnit.Value = model.ImpUnit; txtFundID.Value = model.FundID.ToString(); txtTheNumID.Value = model.TheNumID; txtDepartID.Value = model.DepartID.ToString(); selState.Value = model.State.ToString(); txtMoney.Value = model.Money.ToString(); string str = ""; if (!string.IsNullOrEmpty(model.ImpUnit)) //有颜色属性 { string[] arraylist = model.ImpUnit.Split(','); for (int i = 0; i < arraylist.Length; i++) { Model.ImpType amodel = BLL.ImpType.GetModel(int.Parse(arraylist[i])); if (amodel != null) //如果有属性的话 { str += "<input type=\"checkbox\" checked=\"checked\" name=\"txtImpType\" value=" + arraylist[i] + ">" + amodel.Name; } } List <Model.ImpType> adt = BLL.ImpType.GetModelList(" ID NOT IN(" + model.ImpUnit.Substring(0, model.ImpUnit.Length) + ") order by ID ASC"); if (adt.Count > 0) { for (int i = 0; i < adt.Count; i++) { str += "<input type=\"checkbox\" name=\"txtImpType\" value=" + adt[i].ID + ">" + adt[i].Name; } } } impstr = str; }