private void DoAuditExit(string YearMonth, int depid, int pici, DataTable dt, int prid) { BG_MonPayPlanRemark mppr = BG_MonPayPlanRemarkManager.GetBG_MonPayPlanRemarkByPRID(prid); mppr.MASta = "审核不通过"; mppr.MACause = txtReason.Text; BG_MonPayPlanRemarkManager.ModifyBG_MonPayPlanRemark(mppr); DataTable paydt = BG_MonPayPlanGenerateLogic.GetMonPayTimepici(YearMonth, depid, common.IntSafeConvert(cmbpici.SelectedItem.Text)); for (int i = 0; i < paydt.Rows.Count; i++) { BG_MonPayPlan_His bgMonPayPlanHis = new BG_MonPayPlan_His(); bgMonPayPlanHis.CPID = common.IntSafeConvert(paydt.Rows[i]["CPID"]); bgMonPayPlanHis.DeptID = depid; bgMonPayPlanHis.MPFunding = ParseUtil.ToDecimal(paydt.Rows[i]["MPFunding"].ToString(), 0); bgMonPayPlanHis.MPPHisTime = DateTime.Now; bgMonPayPlanHis.PIID = common.IntSafeConvert(paydt.Rows[i]["PIID"]); bgMonPayPlanHis.MPRemark = "审核不通过"; bgMonPayPlanHis.MPFundingAdd = ParseUtil.ToDecimal(paydt.Rows[i]["MPFundingAdd"].ToString(), 0); bgMonPayPlanHis.MPTime = Convert.ToDateTime(paydt.Rows[i]["MPTime"]); bgMonPayPlanHis.MPFundingAddTimes = common.IntSafeConvert(paydt.Rows[i]["MPFundingAddTimes"]); BG_MonPayPlan_HisManager.AddBG_MonPayPlan_His(bgMonPayPlanHis); } }
private static void DoAudit(string YearMonth, int depid, int pici, DataTable dt, int prid) { BG_MonPayPlanRemark mppr = BG_MonPayPlanRemarkManager.GetBG_MonPayPlanRemarkByPRID(prid); mppr.MASta = "审核通过"; if (BG_MonPayPlanRemarkManager.ModifyBG_MonPayPlanRemark(mppr)) { DataTable paydt = BG_MonPayPlanGenerateLogic.GetMonPayTimepici(YearMonth, depid, pici); for (int i = 0; i < paydt.Rows.Count; i++) { BG_MonPayPlan_His bgMonPayPlanHis = new BG_MonPayPlan_His(); bgMonPayPlanHis.CPID = common.IntSafeConvert(paydt.Rows[i]["CPID"]); bgMonPayPlanHis.DeptID = depid; bgMonPayPlanHis.MPFunding = ParseUtil.ToDecimal(paydt.Rows[i]["MPFunding"].ToString(), 0); bgMonPayPlanHis.MPPHisTime = DateTime.Now; bgMonPayPlanHis.PIID = common.IntSafeConvert(paydt.Rows[i]["PIID"]); bgMonPayPlanHis.MPRemark = "审核通过"; bgMonPayPlanHis.MPFundingAdd = ParseUtil.ToDecimal(paydt.Rows[i]["MPFundingAdd"].ToString(), 0); bgMonPayPlanHis.MPTime = Convert.ToDateTime(paydt.Rows[i]["MPTime"]); bgMonPayPlanHis.MPFundingAddTimes = common.IntSafeConvert(paydt.Rows[i]["MPFundingAddTimes"]); BG_MonPayPlan_HisManager.AddBG_MonPayPlan_His(bgMonPayPlanHis); } for (int i = 0; i < dt.Rows.Count; i++) { int CashierID = BG_CashierLogic.GetCashierIDAudit_RemarkByPiid(depid, YearMonth, common.IntSafeConvert(dt.Rows[i]["PIID"])); if (CashierID > 0) { BG_Cashier bgCashier = BG_CashierManager.GetBG_CashierByCashierid(CashierID); bgCashier.BQMon += ParToDecimal.ParToDel(dt.Rows[i]["MPFundingAdd"].ToString()); bgCashier.BgMon += ParToDecimal.ParToDel(dt.Rows[i]["MPFundingAdd"].ToString()); bgCashier.CashierBalance += ParToDecimal.ParToDel(dt.Rows[i]["MPFundingAdd"].ToString()); bgCashier.CZMon = 0; bgCashier.QTMon = 0; bgCashier.CTime = mppr.MATime; bgCashier.Piid = common.IntSafeConvert(dt.Rows[i]["PIID"]); bgCashier.DepID = mppr.DeptID; BG_CashierManager.ModifyBG_Cashier(bgCashier); } else { BG_Cashier bgCashier = new BG_Cashier(); bgCashier.BQMon += ParToDecimal.ParToDel(dt.Rows[i]["MPFundingAdd"].ToString()); bgCashier.BgMon += ParToDecimal.ParToDel(dt.Rows[i]["MPFundingAdd"].ToString()); bgCashier.CashierBalance += ParToDecimal.ParToDel(dt.Rows[i]["MPFundingAdd"].ToString()); bgCashier.CZMon = 0; bgCashier.QTMon = 0; bgCashier.CTime = mppr.MATime; bgCashier.Piid = common.IntSafeConvert(dt.Rows[i]["PIID"]); bgCashier.DepID = mppr.DeptID; BG_CashierManager.AddBG_Cashier(bgCashier); } } } }
private void ApplyLimitStoreBind() { int month = common.IntSafeConvert(cmbmonth.SelectedItem.Value); string months = ""; // if (month == 1) // { // X.Msg.Alert("提示", "一月无法查询").Show(); // } // else if (month - 1 < 10) { months = "0" + (month - 1).ToString(); } else { months = (month - 1).ToString(); } string yearMonth = cmbyear.SelectedItem.Value + "-" + months; string now = cmbyear.SelectedItem.Value + "-" + cmbmonth.SelectedItem.Value; decimal total = 0; DataTable dtpay = BG_MonPayPlanGenerateLogic.GetMonPay(common.IntSafeConvert(CurrentYear), DepID); for (int i = 0; i < dtpay.Rows.Count; i++) { total += ParToDecimal.ParToDel(dtpay.Rows[i][1].ToString()) + ParToDecimal.ParToDel(dtpay.Rows[i][2].ToString()); } DataTable dt = new DataTable(); dt.Columns.Add("depName"); dt.Columns.Add("totalBG"); dt.Columns.Add("LastmonthBalance"); dt.Columns.Add("Application"); dt.Columns.Add("CurrentAvailable"); dt.Columns.Add("Execute"); if ((UserLimStr == "录入员")) { Execute.Hidden = false; DataRow dr = dt.NewRow(); dr["depName"] = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(depid)).DepName; dr["totalBG"] = total * 10000; decimal sq = BG_MonPayPlanGenerateLogic.GetsqMont(now, depid); //decimal sx = BG_MonPayPlanGenerateLogic.GetbxMon(now,depid); dr["LastmonthBalance"] = (total - sq) * 10000; decimal s_q = BG_MonPayPlanGenerateLogic.GetsqMon(now, depid); dr["Application"] = s_q * 10000; decimal extdc = 0; if (!BG_ApplyReimburLogic.ISApplyBackMon(yearMonth, DepID)) { extdc = BG_ApplyReimburLogic.ApplyMon(now, DepID); } else { extdc = BG_ApplyReimburLogic.ApplyMon(now, DepID) - BG_ApplyReimburLogic.ApplyBackMon(yearMonth, DepID); } dr["Execute"] = extdc * 10000; dr["CurrentAvailable"] = (sq - extdc) * 10000; dt.Rows.Add(dr); } else { int deptid = 0; deptid = common.IntSafeConvert(cmbDep.SelectedItem.Value); if (deptid > 0) { DataRow dr = dt.NewRow(); dr["depName"] = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(deptid)).DepName; dr["totalBG"] = total * 10000; decimal sq = BG_MonPayPlanGenerateLogic.GetsqMont(yearMonth, deptid); //decimal sx = BG_MonPayPlanGenerateLogic.GetbxMon(yearMonth,deptid); dr["LastmonthBalance"] = (total - sq) * 10000; decimal s_q = BG_MonPayPlanGenerateLogic.GetsqMon(now, deptid); dr["Application"] = s_q * 10000; dr["CurrentAvailable"] = (sq) * 10000; dt.Rows.Add(dr); } else { DataTable dtdep = BG_MonPayPlanGenerateLogic.GetMonByTime(yearMonth); if (dtdep == null) { } else { for (int i = 0; i < dtdep.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr["depName"] = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dtdep.Rows[i]["Deptid"])) .DepName; dr["totalBG"] = total * 10000; decimal sq = BG_MonPayPlanGenerateLogic.GetsqMont(yearMonth, common.IntSafeConvert(dtdep.Rows[i]["Deptid"])); //decimal sx = BG_MonPayPlanGenerateLogic.GetbxMon(yearMonth, common.IntSafeConvert(dtdep.Rows[i]["Deptid"])); dr["LastmonthBalance"] = (total - sq) * 10000; decimal s_q = BG_MonPayPlanGenerateLogic.GetsqMon(now, common.IntSafeConvert(dtdep.Rows[i]["Deptid"])); dr["Application"] = s_q * 10000; dr["CurrentAvailable"] = (sq) * 10000; dt.Rows.Add(dr); } } } } if (dt.Rows.Count == 0) { X.Msg.Alert("提示", yearMonth + "没有查询到数据!").Show(); } ApplyLimit.DataSource = dt; ApplyLimit.DataBind(); }
//protected void GetSelect_DirectClick(object sender, DirectEventArgs e) //{ // string Strincome = Hidselector.Value.ToString(); // string[] income = Strincome.Split(','); // DataTable dt = null; // dt.Columns.Add(); // for (int i = 0; i < income.Count(); i++) // { // } //} protected void RemoteEdit(object sender, RemoteEditEventArgs e) { if (ParToDecimal.ParToDel(HidSupp.Text.ToString()) < 0 || ParToDecimal.ParToDel(HidBAA.Text.ToString()) < 0) { if (ParToDecimal.ParToDel(HidSupp.Text) < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); return; } if (ParToDecimal.ParToDel(HidBAA.Text) < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); return; } } e.Accept = true; string[] idStrArr = HidSlist.Text.ToString().TrimEnd('&').Split('&'); List <int> slist = new List <int>(); foreach (string item in idStrArr) { int IntId = common.IntSafeConvert(item); if (!slist.Contains(IntId)) { slist.Add(IntId); } } int piid = common.IntSafeConvert(e.NodeID); RowChanges rc = e.Changes[0]; //if (rc.Value<float>() <= 0 && rc.OldValue<float>() <= 0) //{ // X.Msg.Alert("提示", "填写数字不能为0").Show(); // return; //} if (e.Json == null) { return; } if (!slist.Contains(piid)) { X.Msg.Alert("提示", "此处不可填写,请填写到正确位置").Show(); return; } else { int year = common.IntSafeConvert(CurrentYear); decimal baamon = 0; decimal suppmon = 0; BG_BudgetAllocation bg = BG_BudgetAllocationLogic.GetMonDT(year, piid, depid); if (bg == null) { BG_BudgetAllocation bgadd = new BG_BudgetAllocation(); foreach (RowChanges change in e.Changes) { if (change.Field == "BAAMon" && change.IsDirty <float>()) { bgadd.BAAMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) - bgadd.BAAMon; if (baamon < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } else if (change.Field == "SuppMon" && change.IsDirty <float>()) { bgadd.SuppMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); suppmon = ParToDecimal.ParToDel(HidSupp.Text) - bgadd.SuppMon; if (suppmon < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } } bgadd.PIID = piid; bgadd.BAAYear = year; bgadd.DepID = depid; if (BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd).BAAID > 0) { BG_BudgetAllocationHis bgBudgetAllocationHis = new BG_BudgetAllocationHis(); bgBudgetAllocationHis.BAAID = bgadd.BAAID; bgBudgetAllocationHis.NewBAAMon = bgadd.BAAMon; bgBudgetAllocationHis.Crtime = DateTime.Now; bgBudgetAllocationHis.DepID = bgadd.DepID; bgBudgetAllocationHis.PIID = bgadd.PIID; bgBudgetAllocationHis.NewSuppMon = bgadd.SuppMon; bgBudgetAllocationHis.UserOp = UserName; bgBudgetAllocationHis.OldBAAMon = rc.Field == "BAAMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bgadd.BAAMon; bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bgadd.SuppMon; bgBudgetAllocationHis.AddBAAMon = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon; bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon; bgBudgetAllocationHis.DepName = BG_DepartmentManager.GetBG_DepartmentByDepID(bgadd.DepID).DepName; BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis); } DtDataBind(); //if (baamon < 0 || suppmon < 0) //{ // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } //} //else //{ // BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd); // DtDataBind(); //} } else { decimal Mon = BG_MonPayPlanGenerateLogic.GetMonPayYear(piid, depid, year); decimal UseMon = BG_ApplyReimburLogic.GetARUseMon(piid, depid, year); //if (ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) - ParToDecimal.ParToDel(rc.Value<float>().ToString())-(Mon - UseMon) > 0) //{ if (Mon > 0) { X.Msg.Alert("提示", "分配金额小于期初分配金额,会影响月度用款申请及预算执行!").Show(); } foreach (RowChanges change in e.Changes) { if (change.Field == "BAAMon" && change.IsDirty <float>()) { bg.BAAMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue <float>().ToString()) - bg.BAAMon; if (baamon < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } else if (change.Field == "SuppMon" && change.IsDirty <float>()) { bg.SuppMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue <float>().ToString()) - bg.SuppMon; if (suppmon < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } } //} if (BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg)) { BG_BudgetAllocationHis bgBudgetAllocationHis = new BG_BudgetAllocationHis(); bgBudgetAllocationHis.BAAID = bg.BAAID; bgBudgetAllocationHis.NewBAAMon = bg.BAAMon; bgBudgetAllocationHis.Crtime = DateTime.Now; bgBudgetAllocationHis.DepID = bg.DepID; bgBudgetAllocationHis.PIID = bg.PIID; bgBudgetAllocationHis.NewSuppMon = bg.SuppMon; bgBudgetAllocationHis.UserOp = UserName; bgBudgetAllocationHis.OldBAAMon = rc.Field == "BAAMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bg.BAAMon; bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bg.SuppMon; bgBudgetAllocationHis.AddBAAMon = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon; bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon; bgBudgetAllocationHis.DepName = BG_DepartmentManager.GetBG_DepartmentByDepID(bg.DepID).DepName; BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis); } DtDataBind(); //if (baamon < 0 || suppmon < 0) //{ // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } //} //else //{ // BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg); // DtDataBind(); //} #region 8-8 修改后总分配额不能少于已经审核通过的金额 //if (Mon - ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) + ParToDecimal.ParToDel(rc.Value<float>().ToString()) - UseMon < 0) //{ // X.Msg.Alert("提示", "修改后总分配额不能少于已经审核通过的金额").Show(); // rc.SetValue(rc.OldValue<float>()); //} //else //{ // foreach (RowChanges change in e.Changes) // { // if (change.Field == "BAAMon" && change.IsDirty<float>()) // { // bg.BAAMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); // baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.BAAMon; // } // else if (change.Field == "SuppMon" && change.IsDirty<float>()) // { // bg.SuppMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); // suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.SuppMon; // } // } // if (baamon < 0 || suppmon < 0) // { // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // } // else // { // BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg); // DtDataBind(); // } //} #endregion } } HidBind(); TPPayIncome.Listeners.AddScript("GetTotal();"); }