protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { PageUtility.SetContentTitle(this.Page, "方案申请"); this.Page.Title = "方案申请"; // 用户信息,职位信息 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; AuthorizationDS.PositionRow rowUserPosition = (AuthorizationDS.PositionRow)Session["Position"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; this.ViewState["PositionID"] = rowUserPosition.PositionId; this.ViewState["FlowTemplate"] = new AuthorizationBLL().GetFlowTemplate((int)SystemEnums.BusinessUseCase.FormApply, stuffUser.StuffUserId); this.StuffNameCtl.Text = stuffUser.StuffName; this.PositionNameCtl.Text = rowUserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); if (this.Request["RejectObjectID"] != null) { this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString()); } //如果是草稿进行赋值 if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } OpenForm(int.Parse(this.ViewState["ObjectId"].ToString())); } else { this.DeleteBtn.Visible = false; if (Request["CustomerID"] != null) { this.ViewState["CustomerID"] = Request["CustomerID"]; } else { this.Session["ErrorInfor"] = "未找到客户,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["BeginPeriod"] != null && Request["EndPeriod"] != null) { this.ViewState["BeginPeriod"] = Request["BeginPeriod"]; this.ViewState["EndPeriod"] = Request["EndPeriod"]; } else { this.Session["ErrorInfor"] = "没有费用期间,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["ExpenseSubCategoryID"] != null) { this.ViewState["ExpenseSubCategoryID"] = Request["ExpenseSubCategoryID"]; } else { this.Session["ErrorInfor"] = "未找到费用小类,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } this.BeginPeriodCtl.Text = DateTime.Parse(this.ViewState["BeginPeriod"].ToString()).ToString("yyyy-MM"); this.EndPeriodCtl.Text = DateTime.Parse(this.ViewState["EndPeriod"].ToString()).ToString("yyyy-MM"); this.ExpenseSubCategoryCtl.Text = new MasterDataBLL().GetExpenseSubCateNameById(int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString())); this.CustomerNameCtl.Text = customer.CustomerName; //this.CustomerTypeCtl.Text = new MasterDataBLL().GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName; this.odsShop.SelectParameters["CustomerID"].DefaultValue = customer.CustomerID.ToString(); } //判断费用期间是否正确 MasterDataBLL bll = new MasterDataBLL(); if (!bll.IsValidApplyYear(DateTime.Parse(this.ViewState["BeginPeriod"].ToString()).AddMonths(-3).Year)) { this.SubmitBtn.Visible = false; PageUtility.ShowModelDlg(this, "不允许申请本财年项目,请联系财务部!"); return; } //预算信息 decimal[] calculateAssistant = new decimal[14]; calculateAssistant = new BudgetBLL().GetSalesBudgetByParameter(int.Parse(this.ViewState["CustomerID"].ToString()), DateTime.Parse(this.ViewState["BeginPeriod"].ToString()), int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); this.CustomerBudgetCtl.Text = calculateAssistant[0].ToString("N"); this.CustomerBudgetRemainCtl.Text = calculateAssistant[5].ToString("N"); this.OUBudgetCtl.Text = calculateAssistant[7].ToString("N"); this.OUApprovedAmountCtl.Text = calculateAssistant[8].ToString("N"); this.OUApprovingAmountCtl.Text = calculateAssistant[9].ToString("N"); this.OUCompletedAmountCtl.Text = calculateAssistant[10].ToString("N"); this.OUReimbursedAmountCtl.Text = calculateAssistant[11].ToString("N"); this.OUBudgetRemainCtl.Text = calculateAssistant[12].ToString("N"); this.OUBudgetRateCtl.Text = ((decimal)(calculateAssistant[13] * 100)).ToString("N") + "%"; if (Session["ProxyStuffUserId"] != null) { this.SubmitBtn.Visible = false; } } // 打开明细表 FormApplyDetailViewTableAdapter taDetail = new FormApplyDetailViewTableAdapter(); int customerID = int.Parse(this.ViewState["CustomerID"].ToString()); DateTime period = DateTime.Parse(this.ViewState["BeginPeriod"].ToString()); taDetail.FillDataFromRebate(this.InnerDS.FormApplyDetailView, customerID, period.Year, period.Month); //隐藏预算信息 this.OUBudgetCtl.Text = ""; this.OUApprovedAmountCtl.Text = ""; this.OUApprovingAmountCtl.Text = ""; this.OUCompletedAmountCtl.Text = ""; this.OUReimbursedAmountCtl.Text = ""; this.OUBudgetRemainCtl.Text = ""; this.OUBudgetRateCtl.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { PageUtility.SetContentTitle(this.Page, "��������"); this.Page.Title = "��������"; // �û���Ϣ��ְλ��Ϣ AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; AuthorizationDS.PositionRow rowUserPosition = (AuthorizationDS.PositionRow)Session["Position"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; this.ViewState["PositionID"] = rowUserPosition.PositionId; this.ViewState["FlowTemplate"] = new AuthorizationBLL().GetFlowTemplate((int)SystemEnums.BusinessUseCase.FormApply, stuffUser.StuffUserId); this.StuffNameCtl.Text = stuffUser.StuffName; this.PositionNameCtl.Text = rowUserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); if (this.Request["RejectObjectID"] != null) { this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString()); } //����Dzݸ���и�ֵ if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } OpenForm(int.Parse(this.ViewState["ObjectId"].ToString())); } else { this.DeleteBtn.Visible = false; if (Request["CustomerID"] != null) { this.ViewState["CustomerID"] = Request["CustomerID"]; } else { this.Session["ErrorInfor"] = "δ�ҵ��ͻ�������ϵ����Ա"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["BeginPeriod"] != null && Request["EndPeriod"] != null) { this.ViewState["BeginPeriod"] = Request["BeginPeriod"]; this.ViewState["EndPeriod"] = Request["EndPeriod"]; } else { this.Session["ErrorInfor"] = "û�з����ڼ䣬����ϵ����Ա"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["ExpenseSubCategoryID"] != null) { this.ViewState["ExpenseSubCategoryID"] = Request["ExpenseSubCategoryID"]; } else { this.Session["ErrorInfor"] = "δ�ҵ�����С�࣬����ϵ����Ա"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } this.BeginPeriodCtl.Text = DateTime.Parse(this.ViewState["BeginPeriod"].ToString()).ToString("yyyy-MM"); this.EndPeriodCtl.Text = DateTime.Parse(this.ViewState["EndPeriod"].ToString()).ToString("yyyy-MM"); this.ExpenseSubCategoryCtl.Text = new MasterDataBLL().GetExpenseSubCateNameById(int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString())); this.CustomerNameCtl.Text = customer.CustomerName; //this.CustomerTypeCtl.Text = new MasterDataBLL().GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName; this.odsShop.SelectParameters["CustomerID"].DefaultValue = customer.CustomerID.ToString(); } //�жϷ����ڼ��Ƿ���ȷ MasterDataBLL bll = new MasterDataBLL(); if (!bll.IsValidApplyYear(DateTime.Parse(this.ViewState["BeginPeriod"].ToString()).AddMonths(-3).Year)) { this.SubmitBtn.Visible = false; PageUtility.ShowModelDlg(this, "���������뱾������Ŀ������ϵ����!"); return; } //Ԥ����Ϣ decimal[] calculateAssistant = new decimal[14]; calculateAssistant = new BudgetBLL().GetSalesBudgetByParameter(int.Parse(this.ViewState["CustomerID"].ToString()), DateTime.Parse(this.ViewState["BeginPeriod"].ToString()), int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); this.CustomerBudgetCtl.Text = calculateAssistant[0].ToString("N"); this.CustomerBudgetRemainCtl.Text = calculateAssistant[5].ToString("N"); this.OUBudgetCtl.Text = calculateAssistant[7].ToString("N"); this.OUApprovedAmountCtl.Text = calculateAssistant[8].ToString("N"); this.OUApprovingAmountCtl.Text = calculateAssistant[9].ToString("N"); this.OUCompletedAmountCtl.Text = calculateAssistant[10].ToString("N"); this.OUReimbursedAmountCtl.Text = calculateAssistant[11].ToString("N"); this.OUBudgetRemainCtl.Text = calculateAssistant[12].ToString("N"); this.OUBudgetRateCtl.Text = ((decimal)(calculateAssistant[13] * 100)).ToString("N") + "%"; if (Session["ProxyStuffUserId"] != null) { this.SubmitBtn.Visible = false; } } // ����ϸ�� FormApplyDetailViewTableAdapter taDetail = new FormApplyDetailViewTableAdapter(); int customerID = int.Parse(this.ViewState["CustomerID"].ToString()); DateTime period = DateTime.Parse(this.ViewState["BeginPeriod"].ToString()); taDetail.FillDataFromRebate(this.InnerDS.FormApplyDetailView, customerID, period.Year, period.Month); //����Ԥ����Ϣ this.OUBudgetCtl.Text = ""; this.OUApprovedAmountCtl.Text = ""; this.OUApprovingAmountCtl.Text = ""; this.OUCompletedAmountCtl.Text = ""; this.OUReimbursedAmountCtl.Text = ""; this.OUBudgetRemainCtl.Text = ""; this.OUBudgetRateCtl.Text = ""; }