protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); MasterDataBLL mdBLL = new MasterDataBLL(); int formID = int.Parse(Request["ObjectId"]); this.ViewState["ObjectId"] = formID; FormDS.FormSalePaymentRow rowFormPayment = this.FormSaleBLL.GetFormSalePaymentByID(int.Parse(this.ViewState["ObjectId"].ToString())); FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(formID)[0]; if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } this.FormNoCtl.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = CommonUtility.GetStaffFullName(applicant); this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName; if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null) { this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName; } this.StuffNoCtl.Text = applicant.IsStuffNoNull() ? "" : applicant.StuffNo; this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); this.ApplyFormNoCtl.Text = this.FormSaleBLL.GetFormByID(rowFormPayment.FormSaleApplyID)[0].FormNo; FormDS.FormSaleApplyRow rowFormApply = this.FormSaleBLL.GetFormSaleApplyByID(rowFormPayment.FormSaleApplyID)[0]; this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); MasterData.CustomerRow customer = mdBLL.GetCustomerById(rowFormApply.CustomerID)[0]; this.CustomerNameCtl.Text = customer.CustomerName; this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = mdBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID); this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormApply.CurrencyID).CurrencyShortName; this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString(); this.ShopNameCtl.Text = rowFormApply.IsShopNameNull() ? "" : rowFormApply.ShopName; this.ShopCountCtl.Text = rowFormApply.IsShopCountNull() ? "" : rowFormApply.ShopCount.ToString(); this.ProjectNameCtl.Text = rowFormApply.IsProjectNameNull() ? "" : rowFormApply.ProjectName; this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(rowForm.CostCenterID); if (!rowFormApply.IsActivityBeginDateNull()) { this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName; if (!rowFormPayment.IsRemarkNull()) { this.RemarkCtl.Text = rowFormPayment.Remark; } if (!rowFormPayment.IsAttachedFileNameNull()) { this.UCPaymentFile.AttachmentFileName = rowFormPayment.AttachedFileName; } if (!rowFormPayment.IsRealAttachedFileNameNull()) { this.UCPaymentFile.RealAttachmentFileName = rowFormPayment.RealAttachedFileName; } this.InvoiceStatusCtl.Text = new InvoiceStatusTableAdapter().GetDataByID(rowFormPayment.InvoiceStatusID)[0].Name; if (!rowFormPayment.IsVendorIDNull()) { MasterData.VendorRow vendor = mdBLL.GetVendorByID(rowFormPayment.VendorID); this.VendorCtl.Text = vendor.VendorName + "-" + vendor.VendorCode; } this.txtVatType.Text = mdBLL.GetVatTypeById(rowFormPayment.VatTypeID)[0].VatTypeName; //PO if (!rowFormPayment.IsFormPOIDNull()) { FormDS.FormRow rowFormPO = this.FormSaleBLL.GetFormByID(rowFormPayment.FormPOID)[0]; this.hlPO.Text = rowFormPO.FormNo; this.hlPO.NavigateUrl = CommonUtility.GetPOPostBackUrl(rowFormPO.FormID); } else { this.hlPO.Text = "无"; } //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = this.FormSaleBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/NoActivityAdvancedPaymentApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } //明细 this.odsInvoice.SelectParameters["FormID"].DefaultValue = rowFormPayment.FormSalePaymentID.ToString(); this.odsPaymentDetails.SelectParameters["FormSalePaymentID"].DefaultValue = rowFormPayment.FormSalePaymentID.ToString(); //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P")) { this.SubmitBtn.Visible = true; this.cwfAppCheck.IsView = false; this.ViewState["IsView"] = false; } else { this.SubmitBtn.Visible = false; this.cwfAppCheck.IsView = true; this.ViewState["IsView"] = true; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID) { this.EditBtn.Visible = true; this.ScrapBtn.Visible = true; } else { this.EditBtn.Visible = false; this.ScrapBtn.Visible = false; } //如果是弹出,取消按钮不可见 if (this.Request["ShowDialog"] != null) { if (this.Request["ShowDialog"].ToString() == "1") { this.upButton.Visible = false; this.Master.FindControl("divMenu").Visible = false; this.Master.FindControl("tbCurrentPage").Visible = false; } } //判断财务摘要的显示问题 if (!rowForm.IsFinanceRemarkNull()) { this.FinanceRemarkCtl.Text = rowForm.FinanceRemark; } int opViewId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FinanceRemark, SystemEnums.OperateEnum.View); int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FinanceRemark, SystemEnums.OperateEnum.Manage); AuthorizationDS.PositionRow ViewerPosition = (AuthorizationDS.PositionRow)this.Session["Position"]; PositionRightBLL positionRightBLL = new PositionRightBLL(); bool HasViewRight = positionRightBLL.CheckPositionRight(ViewerPosition.PositionId, opViewId); bool HasManageRight = positionRightBLL.CheckPositionRight(ViewerPosition.PositionId, opManageId); //如果没有权限则隐藏 if (!HasViewRight && !HasManageRight) { this.FinanceRemarkTitleDIV.Visible = false; this.FinanceRemarkDIV.Visible = false; this.SaveBtn.Visible = false; } //如果没有填写的权限或者已经填写了,则隐藏保存按钮 if (HasViewRight && (!HasManageRight || !rowForm.IsFinanceRemarkNull())) { this.FinanceRemarkCtl.ReadOnly = true; this.SaveBtn.Visible = false; } //如果不是审批中或者审批完成不能修改 if (rowForm.StatusID != 1 && rowForm.StatusID != 2) { this.FinanceRemarkCtl.ReadOnly = true; this.SaveBtn.Visible = false; } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); MasterDataBLL mdBLL = new MasterDataBLL(); int formID = int.Parse(Request["ObjectId"]); this.ViewState["ObjectId"] = formID; FormDS.FormSalePaymentRow rowFormPayment = this.FormSaleBLL.GetFormSalePaymentByID(int.Parse(this.ViewState["ObjectId"].ToString())); FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(formID)[0]; if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } this.FormNoCtl.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = CommonUtility.GetStaffFullName(applicant); this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName; if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null) { this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName; } this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); FormDS.FormSaleSettlementRow rowFormSettlement = this.FormSaleBLL.GetFormSaleSettlementByID(rowFormPayment.FormSaleSettlementID); FormDS.FormRow settlementForm = this.FormSaleBLL.GetFormByID(rowFormPayment.FormSaleSettlementID)[0]; MasterData.CustomerRow customer = mdBLL.GetCustomerById(rowFormSettlement.CustomerID)[0]; this.CustomerNameCtl.Text = customer.CustomerName; this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = mdBLL.GetBrandById(rowFormSettlement.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormSettlement.ExpenseSubCategoryID); this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormSettlement.CurrencyID).CurrencyShortName; this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(rowForm.CostCenterID); this.SettlementRemarkCtl.Text = rowFormSettlement.IsRemarkNull() ? "" : rowFormSettlement.Remark; if (!rowFormSettlement.IsAttachedFileNameNull()) this.UCSettlementFile.AttachmentFileName = rowFormSettlement.AttachedFileName; if (!rowFormSettlement.IsRealAttachedFileNameNull()) this.UCSettlementFile.RealAttachmentFileName = rowFormSettlement.RealAttachedFileName; if (!rowFormPayment.IsRemarkNull()) { this.RemarkCtl.Text = rowFormPayment.Remark; } if (!rowFormPayment.IsAttachedFileNameNull()) { this.UCPaymentFile.AttachmentFileName = rowFormPayment.AttachedFileName; } if (!rowFormPayment.IsRealAttachedFileNameNull()) { this.UCPaymentFile.RealAttachmentFileName = rowFormPayment.RealAttachedFileName; } this.PaymentTypeCtl.Text = new MasterDataBLL().GetPaymentTypeById(rowFormPayment.PaymentTypeID).PaymentTypeName; if (!rowFormPayment.IsVendorIDNull()) { MasterData.VendorRow vendor = new MasterDataBLL().GetVendorByID(rowFormPayment.VendorID); this.VendorCtl.Text = vendor.VendorName + "-" + vendor.VendorCode; } this.SettlementFormNoCtl.Text = settlementForm.FormNo; this.SettlementFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/SettlementApproval.aspx?ShowDialog=1&ObjectId=" + rowFormPayment.FormSaleSettlementID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = this.FormSaleBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/PaymentFreeGoodsApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } //费用合计信息 ApplyAmountRMBCtl.Text = rowFormSettlement.IsApplyAmountRMBNull() ? "" : rowFormSettlement.ApplyAmountRMB.ToString(); ForecastOrderAmountCtl.Text = rowFormSettlement.IsForecastOrderAmountNull() ? "" : rowFormSettlement.ForecastOrderAmount.ToString(); CostBenefitRateCtl.Text = rowFormSettlement.IsCostBenefitRateNull() ? "" : rowFormSettlement.CostBenefitRate.ToString(); AmountRMBCtl.Text = rowFormSettlement.AmountRMB.ToString(); ActualOrderAmountCtl.Text = rowFormSettlement.IsActualOrderAmountNull() ? "" : rowFormSettlement.ActualOrderAmount.ToString(); ActualCostBenefitRateCtl.Text = rowFormSettlement.IsActualCostBenefitRateNull() ? "" : rowFormSettlement.ActualCostBenefitRate.ToString(); //判断是Activity还是NoActivity,如果NoActivity那么需要隐藏 if (settlementForm.PageType == (int)SystemEnums.PageType.NoActivitySettlementApply) { this.FeeSumTR.Visible = false; this.SKUDiv.Visible = false; this.gvSKUDetails.Visible = false; } //明细 this.odsFreeGoods.SelectParameters["FormSalePaymentID"].DefaultValue = rowFormPayment.FormSalePaymentID.ToString(); this.odsSKUDetails.SelectParameters["FormSaleSettlementID"].DefaultValue = rowFormPayment.FormSaleSettlementID.ToString(); this.odsPaymentDetails.SelectParameters["FormSalePaymentID"].DefaultValue = rowFormPayment.FormSalePaymentID.ToString(); //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P")) { this.SubmitBtn.Visible = true; this.cwfAppCheck.IsView = false; this.ViewState["IsView"] = false; } else { this.SubmitBtn.Visible = false; this.cwfAppCheck.IsView = true; this.ViewState["IsView"] = true; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID) { this.EditBtn.Visible = true; this.ScrapBtn.Visible = true; } else { this.EditBtn.Visible = false; this.ScrapBtn.Visible = false; } //如果是弹出,取消按钮不可见 if (this.Request["ShowDialog"] != null) { if (this.Request["ShowDialog"].ToString() == "1") { this.upButton.Visible = false; this.Master.FindControl("divMenu").Visible = false; this.Master.FindControl("tbCurrentPage").Visible = false; } } //单据打印 this.ucPrint.FormID = rowForm.FormID; FormDS.FormDeliveryGoodsDataTable tbDelivery= new FormSaleBLL().GetFormDeliveryGoodByFormID(formID); if (tbDelivery.Count > 0) { this.gvDeliveryInfo.DataSource = tbDelivery; this.gvDeliveryInfo.DataBind(); } else { this.divDeliveryInfo.Visible = false; this.gvDeliveryInfo.Visible = false; } //发货完成按钮权限 int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.DeliveryComplete, SystemEnums.OperateEnum.Other); AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"]; PositionRightBLL positionRightBLL = new PositionRightBLL(); if (positionRightBLL.CheckPositionRight(position.PositionId, opManageId) && (rowFormPayment.IsIsDeliveryCompleteNull() || rowFormPayment.IsDeliveryComplete == false)) { this.DeliveryCompleteBtn.Visible = false; } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
protected void OpenForm(int formID) { FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(formID)[0]; FormDS.FormSaleApplyRow rowFormApply = this.FormSaleBLL.GetFormSaleApplyByID(formID)[0]; MasterDataBLL MasterDataBLL = new MasterDataBLL(); //赋值 this.ViewState["FPeriod"] = rowFormApply.FPeriod.ToShortDateString(); this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); this.ViewState["CustomerID"] = rowFormApply.CustomerID.ToString(); this.ViewState["BrandID"] = rowFormApply.BrandID.ToString(); this.ViewState["ExpenseSubCategoryID"] = rowFormApply.ExpenseSubCategoryID.ToString(); this.ViewState["CurrencyID"] = rowFormApply.CurrencyID.ToString(); MasterData.CustomerRow customer = MasterDataBLL.GetCustomerById(rowFormApply.CustomerID)[0]; this.txtCustomerCode.Text = customer.CustomerNo; this.CustomerNameCtl.Text = customer.CustomerName; this.ViewState["CustomerChannelID"] = customer.CustomerChannelID.ToString(); this.CustomerChannelCtl.Text = MasterDataBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CustomerRegionCtl.Text = MasterDataBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = MasterDataBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = MasterDataBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID); this.ExpenseCategoryCtl.Text = MasterDataBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormApply.CurrencyID)[0].CurrencyShortName; this.ShopNameCtl.Text = rowFormApply.IsShopNameNull() ? "" : rowFormApply.ShopName; this.ShopCountCtl.Text = rowFormApply.IsShopCountNull() ? "" : rowFormApply.ShopCount.ToString(); this.ProjectNameCtl.Text = rowFormApply.IsProjectNameNull() ? "" : rowFormApply.ProjectName; if (!rowForm.IsCostCenterIDNull()) { this.CostCenterDDL.SelectedValue = rowForm.CostCenterID.ToString(); } this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName; //促销信息 this.DisplayTypeDDL.SelectedValue = rowFormApply.DisplayTypeID.ToString(); this.DisplayAreaCtl.Text = rowFormApply.IsDisplayAreaNull() ? "" : rowFormApply.DisplayArea.ToString(); this.DMDDL.SelectedValue = rowFormApply.IsDM ? "1" : "0"; this.DiscountTypeDDL.SelectedValue = rowFormApply.DiscountTypeID.ToString(); if (!rowFormApply.IsActivityBeginDateNull()) { this.UCActivityBegin.SelectedDate = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.UCActivityEnd.SelectedDate = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryBeginDateNull()) { this.UCDeliveryBegin.SelectedDate = rowFormApply.DeliveryBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryEndDateNull()) { this.UCDeliveryEnd.SelectedDate = rowFormApply.DeliveryEndDate.ToString("yyyy-MM-dd"); } // 打开明细表 FormSaleSKUDetailTableAdapter taSKUDetail = new FormSaleSKUDetailTableAdapter(); taSKUDetail.FillByFormSaleApplyID(this.InnerDS.FormSaleSKUDetail, formID); FormSaleExpenseDetailTableAdapter taExpenseDetail = new FormSaleExpenseDetailTableAdapter(); taExpenseDetail.FillByFormSaleApplyID(this.InnerDS.FormSaleExpenseDetail, formID); //如果打开的是有pricediscount的单据,应该在明细中先删除,然后再保存时再添加 for (int index = 0; index < this.InnerDS.FormSaleExpenseDetail.Count; index++) { MasterData.ExpenseItemRow expenseItem = new MasterDataBLL().GetExpenseItemById(this.InnerDS.FormSaleExpenseDetail[index].ExpenseItemID); if (expenseItem.IsPriceDiscount) { this.InnerDS.FormSaleExpenseDetail.Rows[index].Delete(); } } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(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.StuffNameCtl.Text = CommonUtility.GetStaffFullName(stuffUser); this.PositionNameCtl.Text = rowUserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId; this.StuffNoCtl.Text = stuffUser.IsStuffNoNull() ? "" : stuffUser.StuffNo; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); if (this.Request["RejectObjectID"] != null) { this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString()); } //如果是草稿进行赋值 MasterDataBLL MasterDataBLL = new MasterDataBLL(); 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["PeriodSaleID"] != null) { DateTime FPeriod = MasterDataBLL.GetPeriodSaleById(int.Parse(Request["PeriodSaleID"].ToString())).PeriodSale; this.ViewState["FPeriod"] = new MasterDataBLL().GetPeriodSaleById(int.Parse(Request["PeriodSaleID"].ToString())).PeriodSale.ToShortDateString(); } else { this.Session["ErrorInfor"] = "没有费用期间,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["CustomerID"] != null) { this.ViewState["CustomerID"] = Request["CustomerID"]; } else { this.Session["ErrorInfor"] = "未找到客户,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["BrandID"] != null) { this.ViewState["BrandID"] = Request["BrandID"]; } else { this.Session["ErrorInfor"] = "未找到Brand,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["ExpenseSubCategoryID"] != null) { this.ViewState["ExpenseSubCategoryID"] = Request["ExpenseSubCategoryID"]; } else { this.Session["ErrorInfor"] = "未找到费用小类,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["CurrencyID"] != null) { this.ViewState["CurrencyID"] = Request["CurrencyID"]; } else { this.Session["ErrorInfor"] = "未找到币种,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } this.PeriodCtl.Text = DateTime.Parse(this.ViewState["FPeriod"].ToString()).ToString("yyyy-MM"); MasterData.CustomerRow customer = MasterDataBLL.GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString()))[0]; this.txtCustomerCode.Text = customer.CustomerNo; this.CustomerNameCtl.Text = customer.CustomerName; ViewState["CustomerChannelID"] = customer.CustomerChannelID.ToString(); this.CustomerChannelCtl.Text = MasterDataBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CustomerRegionCtl.Text = MasterDataBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = MasterDataBLL.GetBrandById(int.Parse(this.ViewState["BrandID"].ToString()))[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = MasterDataBLL.GetExpenseSubCategoryById(int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); this.ExpenseCategoryCtl.Text = MasterDataBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(int.Parse(this.ViewState["CurrencyID"].ToString()))[0].CurrencyShortName; } this.ExpenseSubCategoryID.Value = this.ViewState["ExpenseSubCategoryID"].ToString(); this.BrandID.Value = this.ViewState["BrandID"].ToString(); this.ViewState["ExchangeRate"] = new MasterDataBLL().GetExchangeRateByPeriod(int.Parse(ViewState["CurrencyID"].ToString()), DateTime.Parse(ViewState["FPeriod"].ToString())); if (decimal.Parse(this.ViewState["ExchangeRate"].ToString()) == 0) { this.Session["ErrorInfor"] = "未找到汇率,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } this.ExchangeRateCtl.Text = this.ViewState["ExchangeRate"].ToString(); //判断费用期间是否正确 MasterDataBLL bll = new MasterDataBLL(); if (!new MasterDataBLL().IsValidPeriodSale(DateTime.Parse(this.ViewState["FPeriod"].ToString()))) { this.SubmitBtn.Visible = false; PageUtility.ShowModelDlg(this, "不允许申请本月项目,请删除草稿并联系财务部!"); return; } //预算信息 this.ViewState["ExpenseCategoryID"] = new MasterDataBLL().GetExpenseSubCategoryById(int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())).ExpenseCategoryID.ToString(); decimal[] calculateAssistant = new decimal[6]; calculateAssistant = new BudgetBLL().GetSalesBudgetByParameter(rowUserPosition.PositionId, DateTime.Parse(ViewState["FPeriod"].ToString()), int.Parse(this.ViewState["ExpenseCategoryID"].ToString()), int.Parse(ViewState["CustomerChannelID"].ToString()), int.Parse(this.ViewState["BrandID"].ToString())); this.TotalBudgetCtl.Text = calculateAssistant[0].ToString("N"); this.ApprovedAmountCtl.Text = calculateAssistant[1].ToString("N"); this.ApprovingAmountCtl.Text = calculateAssistant[2].ToString("N"); this.CompletedAmountCtl.Text = calculateAssistant[3].ToString("N"); this.ReimbursedAmountCtl.Text = calculateAssistant[4].ToString("N"); this.RemainBudgetCtl.Text = calculateAssistant[5].ToString("N"); } //查看预算权限 int opViewId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.ViewBudget, SystemEnums.OperateEnum.Manage); AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"]; bool HasManageRight = new PositionRightBLL().CheckPositionRight(position.PositionId, opViewId); this.divBudgetInfo.Visible = HasManageRight; this.divBudgetInfoTitle.Visible = HasManageRight; }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(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.StuffNameCtl.Text = CommonUtility.GetStaffFullName(stuffUser); 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(); this.StuffNoCtl.Text = stuffUser.IsStuffNoNull() ? "" : stuffUser.StuffNo; 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; } FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(int.Parse(this.ViewState["ObjectId"].ToString()))[0]; FormDS.FormSaleSettlementRow rowFormSettlement = this.FormSaleBLL.GetFormSaleSettlementByID(int.Parse(this.ViewState["ObjectId"].ToString())); //赋值 this.ViewState["CustomerID"] = rowFormSettlement.CustomerID.ToString(); this.ViewState["BrandID"] = rowFormSettlement.BrandID.ToString(); this.ViewState["ExpenseSubCategoryID"] = rowFormSettlement.ExpenseSubCategoryID.ToString(); this.ViewState["CurrencyID"] = rowFormSettlement.CurrencyID.ToString(); this.ViewState["FormApplyNos"] = rowFormSettlement.FormApplyNos; this.ViewState["FormApplyIds"] = rowFormSettlement.FormApplyIds; this.ViewState["CostCenterID"] = rowForm.CostCenterID.ToString(); if (!rowFormSettlement.IsRemarkNull()) { this.RemarkCtl.Text = rowFormSettlement.Remark; } if (!rowFormSettlement.IsAttachedFileNameNull()) { this.UCSettlementFile.AttachmentFileName = rowFormSettlement.AttachedFileName; } if (!rowFormSettlement.IsRealAttachedFileNameNull()) { this.UCSettlementFile.RealAttachmentFileName = rowFormSettlement.RealAttachedFileName; } this.PaymentTypeDDL.SelectedValue = rowFormSettlement.PaymentTypeID.ToString(); //处理明细 new FormSettlementSKUDetailTableAdapter().FillByFormSaleSettlementID(this.InnerDS.FormSettlementSKUDetail, rowFormSettlement.FormSaleSettlementID); new FormSettlementExpenseDetailTableAdapter().FillCurrentDataByFormSaleSettlementID(this.InnerDS.FormSettlementExpenseDetail, rowFormSettlement.FormSaleSettlementID); } else { this.DeleteBtn.Visible = false; if (Request["FormApplyIds"] != null) { this.ViewState["FormApplyIds"] = Request["FormApplyIds"]; } else { this.Session["ErrorInfor"] = "没有选择申请单,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["CustomerID"] != null) { this.ViewState["CustomerID"] = Request["CustomerID"]; } else { this.Session["ErrorInfor"] = "未找到客户,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["BrandID"] != null) { this.ViewState["BrandID"] = Request["BrandID"]; } else { this.Session["ErrorInfor"] = "未找到Brand,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["ExpenseSubCategoryID"] != null) { this.ViewState["ExpenseSubCategoryID"] = Request["ExpenseSubCategoryID"]; } else { this.Session["ErrorInfor"] = "未找到费用小类,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["CurrencyID"] != null) { this.ViewState["CurrencyID"] = Request["CurrencyID"]; } else { this.Session["ErrorInfor"] = "未找到币种,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["CostCenterID"] != null) { this.ViewState["CostCenterID"] = Request["CostCenterID"]; } else { this.Session["ErrorInfor"] = "未找到成本中心,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["FormApplyNos"] != null) { this.ViewState["FormApplyNos"] = Request["FormApplyNos"]; } else { this.Session["ErrorInfor"] = "没有选择申请单,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } //处理明细 new FormSettlementSKUDetailTableAdapter().FillByApplyIds(this.InnerDS.FormSettlementSKUDetail, this.ViewState["FormApplyIds"].ToString()); new FormSettlementExpenseDetailTableAdapter().FillByApplyIds(this.InnerDS.FormSettlementExpenseDetail, this.ViewState["FormApplyIds"].ToString()); } MasterDataBLL mdBLL = new MasterDataBLL(); MasterData.CustomerRow customer = mdBLL.GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString()))[0]; this.CustomerNameCtl.Text = customer.CustomerName; ViewState["CustomerChannelID"] = customer.CustomerChannelID.ToString(); this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CityCtl.Text = customer.City; this.BrandCtl.Text = mdBLL.GetBrandById(int.Parse(this.ViewState["BrandID"].ToString()))[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(int.Parse(this.ViewState["CurrencyID"].ToString()))[0].CurrencyShortName; } }
protected void CreateBtn_Click(object sender, EventArgs e) { string strFormID = string.Empty; string strFormNo = string.Empty; bool isSameCustID = true; bool isSameBrandID = true; bool isSameYear = true; bool isSameSubCategoryID = true; bool isSameCurrencyID = true; bool isSameCostCenter = true; int custID = 0; int brandID = 0; int year = 0; int subCategoryID = 0; int currencyID = 0; int pageType = 0; decimal NeedCreatePOAmount = Convert.ToDecimal(ConfigurationManager.AppSettings["NeedCreatePOAmount"]); int costCenterID = 0; String NeedPOFormNo = string.Empty; MasterDataBLL masterBLL = new MasterDataBLL(); FormPurchaseBLL purchaseBLL = new FormPurchaseBLL(); string intFormID = string.Empty; foreach (GridViewRow row in this.gvApplyList.Rows) { CheckBox CheckCtl = (CheckBox)row.FindControl("CheckCtl"); if (CheckCtl.Checked) { QueryDS.FormSaleApplyViewRow formApply = new FormQueryBLL().GetFormSaleApplyViewByID((int)this.gvApplyList.DataKeys[row.RowIndex].Value); FormDS.FormRow form = new FormSaleBLL().GetFormByID((int)this.gvApplyList.DataKeys[row.RowIndex].Value)[0]; intFormID = formApply.FormID.ToString(); pageType = formApply.PageType; if (custID == 0) { custID = formApply.CustomerID; } else { if (custID != formApply.CustomerID) { isSameCustID = false; break; } } if (brandID == 0) { brandID = formApply.BrandID; } else { if (brandID != formApply.BrandID) { isSameBrandID = false; break; } } if (year == 0) { year = formApply.FPeriod.AddMonths(5).Year; } else { if (year != formApply.FPeriod.AddMonths(5).Year) { isSameYear = false; break; } } if (subCategoryID == 0) { subCategoryID = formApply.ExpenseSubCategoryID; } else { if (subCategoryID != formApply.ExpenseSubCategoryID) { isSameSubCategoryID = false; break; } } if (currencyID == 0) { currencyID = formApply.CurrencyID; } else { if (currencyID != formApply.CurrencyID) { isSameCurrencyID = false; break; } } if (strFormID == string.Empty) { strFormID = this.gvApplyList.DataKeys[row.RowIndex].Value.ToString(); } else { strFormID = strFormID + "," + this.gvApplyList.DataKeys[row.RowIndex].Value.ToString(); } if (strFormNo == string.Empty) { strFormNo = "P" + form.FormNo + "P"; } else { strFormNo = strFormNo + "P" + form.FormNo + "P"; } if (costCenterID == 0) { costCenterID = formApply.CostCenterID; } else { if (costCenterID != formApply.CostCenterID) { isSameCostCenter = false; break; } } //�жϽ�����X����Ҫ�½�PO MasterData.ExpenseCategoryRow ecr = masterBLL.GetExpenseCategoryById(masterBLL.GetExpenseSubCategoryById(formApply.ExpenseSubCategoryID).ExpenseCategoryID); if (formApply.AmountRMB > NeedCreatePOAmount && ecr.NeedPO) { if (purchaseBLL.QueryPOCountByParentFormID(formApply.FormID) <= 0) { NeedPOFormNo += formApply.FormNo + ","; } } } } if (strFormID == string.Empty) { PageUtility.ShowModelDlg(this, "��ѡ�����뵥!"); return; } if (!isSameCustID) { PageUtility.ShowModelDlg(this, "��ѡ����ͬ�ͻ������뵥!"); return; } if (!isSameBrandID) { PageUtility.ShowModelDlg(this, "��ѡ����ͬBrand�����뵥!"); return; } if (!isSameYear) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ������뵥!"); return; } if (!isSameSubCategoryID) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ����С������뵥!"); return; } if (!isSameCurrencyID) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ���ֵ����뵥!"); return; } if (!isSameCostCenter) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ�ɱ����ĵ����뵥!"); return; } if (NeedPOFormNo != string.Empty) { PageUtility.ShowModelDlg(this, string.Format("���뵥{0}������{1}����Ҫ����PO��", NeedPOFormNo, NeedCreatePOAmount)); return; } string url = string.Empty; if (pageType == (int)SystemEnums.PageType.ActivityApply) { if (this.ViewState["SearchCondition"] != null) { url = "~/FormSale/ActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID+"&CostCenterID="+costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx?" + this.ViewState["SearchCondition"].ToString()); } else { url = "~/FormSale/ActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx"); } } else { if (this.ViewState["SearchCondition"] != null) { url = "~/FormSale/NoActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx?" + this.ViewState["SearchCondition"].ToString()); } else { url = "~/FormSale/NoActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx"); } } Response.Redirect(url); }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); MasterDataBLL mdBLL = new MasterDataBLL(); int formID = int.Parse(Request["ObjectId"]); this.ViewState["ObjectId"] = formID; FormDS.FormRow rowForm = this.FormMarketingBLL.GetFormByID(formID)[0]; FormDS.FormMarketingApplyRow rowFormApply = this.FormMarketingBLL.GetFormMarketingApplyByID(formID)[0]; if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } this.FormNoCtl.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = CommonUtility.GetStaffFullName(applicant); this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName; if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null) { this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName; } this.StuffNoCtl.Text = applicant.IsStuffNoNull() ? "" : applicant.StuffNo; this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); this.CustomerChannelCtl.Text = MasterDataBLL.GetCustomerChannelById(rowFormApply.CustomerChannelID)[0].CustomerChannelName; this.BrandCtl.Text = MasterDataBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; this.CurrencyCtl.Text = MasterDataBLL.GetCurrencyByID(rowFormApply.CurrencyID).CurrencyShortName; this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString(); if (!rowFormApply.IsMarketingProjectIDNull()) { this.ProjectNameCtl.Text = MasterDataBLL.GetMarketingProjectById(rowFormApply.MarketingProjectID).MarketingProjectName; } this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowFormApply.ExpenseCategoryID).ExpenseCategoryName; //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = this.FormMarketingBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormMarketing/MarketingApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName; if (!rowFormApply.IsActivityBeginDateNull()) { this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(rowForm.CostCenterID); this.TotalBudgetCtl.Text = rowFormApply.TotalBudget.ToString("N"); this.ApprovedAmountCtl.Text = rowFormApply.ApprovedAmount.ToString("N"); this.ApprovingAmountCtl.Text = rowFormApply.ApprovingAmount.ToString("N"); this.ReimbursedAmountCtl.Text = rowFormApply.ReimbursedAmount.ToString("N"); this.RemainBudgetCtl.Text = rowFormApply.RemainBudget.ToString("N"); //明细 this.odsDetails.SelectParameters["FormMarketingApplyID"].DefaultValue = rowFormApply.FormMarketingApplyID.ToString(); //按钮控制 //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P")) { this.SubmitBtn.Visible = true; this.ViewState["IsView"] = false; } else { this.SubmitBtn.Visible = false; this.ViewState["IsView"] = true; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID) { this.EditBtn.Visible = true; this.ScrapBtn.Visible = true; } else { this.EditBtn.Visible = false; this.ScrapBtn.Visible = false; } //是否显示报销完成按钮 this.CloseBtn.Visible = false; if ((!rowFormApply.IsClose) && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) { if (stuffUser.StuffUserId == rowForm.UserID || new AuthorizationBLL().GetProxyReimburseByParameter(rowForm.UserID, stuffUser.StuffUserId, rowForm.SubmitDate).Count > 0) { this.CloseBtn.Visible = true; } } //如果是弹出,取消按钮不可见 if (this.Request["ShowDialog"] != null) { if (this.Request["ShowDialog"].ToString() == "1") { this.upButton.Visible = false; this.Master.FindControl("divMenu").Visible = false; this.Master.FindControl("tbCurrentPage").Visible = false; } } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
protected void OpenForm(int formID) { FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(formID)[0]; FormDS.FormSaleApplyRow rowFormApply = this.FormSaleBLL.GetFormSaleApplyByID(formID)[0]; MasterDataBLL MasterDataBLL = new MasterDataBLL(); //赋值 this.ViewState["FPeriod"] = rowFormApply.FPeriod.ToShortDateString(); this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); this.ViewState["CustomerID"] = rowFormApply.CustomerID.ToString(); this.ViewState["BrandID"] = rowFormApply.BrandID.ToString(); this.ViewState["ExpenseSubCategoryID"] = rowFormApply.ExpenseSubCategoryID.ToString(); this.ViewState["CurrencyID"] = rowFormApply.CurrencyID.ToString(); MasterData.CustomerRow customer = MasterDataBLL.GetCustomerById(rowFormApply.CustomerID)[0]; this.txtCustomerNo.Text = customer.CustomerNo; this.CustomerNameCtl.Text = customer.CustomerName; this.ViewState["CustomerChannelID"] = customer.CustomerChannelID.ToString(); this.CustomerChannelCtl.Text = MasterDataBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CustomerRegionCtl.Text = MasterDataBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = MasterDataBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = MasterDataBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID); this.ExpenseCategoryCtl.Text = MasterDataBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormApply.CurrencyID)[0].CurrencyShortName; this.ShopNameCtl.Text = rowFormApply.IsShopNameNull() ? "" : rowFormApply.ShopName; this.ShopCountCtl.Text = rowFormApply.IsShopCountNull() ? "" : rowFormApply.ShopCount.ToString(); this.ProjectNameCtl.Text = rowFormApply.IsProjectNameNull() ? "" : rowFormApply.ProjectName; if (!rowForm.IsCostCenterIDNull()) { this.CostCenterDDL.SelectedValue = rowForm.CostCenterID.ToString(); } if (!rowFormApply.IsActivityBeginDateNull()) { this.UCActivityBegin.SelectedDate = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.UCActivityEnd.SelectedDate = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName; // 打开明细表 new FormSaleExpenseDetailTableAdapter().FillByFormSaleApplyID(this.InnerDS.FormSaleExpenseDetail, formID); }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(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.StuffNameCtl.Text = CommonUtility.GetStaffFullName(stuffUser); this.PositionNameCtl.Text = rowUserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId; this.StuffNoCtl.Text = stuffUser.IsStuffNoNull() ? "" : stuffUser.StuffNo; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); if (this.Request["RejectObjectID"] != null) { this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString()); } VATTypeDDL.DataBind(); PaymentTypeDDL.DataBind(); PaymentTypeDDL_SelectedIndexChanged(null, null); InvoiceStatusDDL.DataBind(); //如果是草稿进行赋值 int formApplyID; if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); FormDS.FormRDPaymentRow rowFormPayment = this.FormRDBLL.GetFormRDPaymentByID(int.Parse(this.ViewState["ObjectId"].ToString())); formApplyID = rowFormPayment.FormRDApplyID; this.ViewState["FormRDApplyID"] = formApplyID; if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } //赋值备注等 this.PaymentTypeDDL.SelectedValue = rowFormPayment.PaymentTypeID.ToString(); PaymentTypeDDL_SelectedIndexChanged(null, null); InvoiceStatusDDL.DataBind(); if (!rowFormPayment.IsVATTypeIDNull()) { VATTypeDDL.SelectedValue = rowFormPayment.VATTypeID.ToString(); } this.InvoiceStatusDDL.SelectedValue = rowFormPayment.InvoiceStatusID.ToString(); if (!rowFormPayment.IsPaymentFileNameNull()) { this.UCFliePayment.AttachmentFileName = rowFormPayment.PaymentFileName; } if (!rowFormPayment.IsPaymentRealFileNameNull()) { this.UCFliePayment.RealAttachmentFileName = rowFormPayment.PaymentRealFileName; } if (!rowFormPayment.IsRemarkNull()) { this.RemarkCtl.Text = rowFormPayment.Remark; } new FormRDPaymentDetailTableAdapter().FillCurrentData(this.InnerDS.FormRDPaymentDetail, rowFormPayment.FormRDPaymentID, rowFormPayment.FormRDApplyID); new FormInvoiceTableAdapter().FillByFormID(this.InnerDS.FormInvoice, rowFormPayment.FormRDPaymentID); } else { formApplyID = int.Parse(Request["FormRDApplyID"]); this.ViewState["FormRDApplyID"] = formApplyID; new FormRDPaymentDetailTableAdapter().FillByRDApplyID(this.InnerDS.FormRDPaymentDetail, formApplyID); } MasterDataBLL mdBLL = new MasterDataBLL(); this.FormNoCtl.Text = this.FormRDBLL.GetFormByID(formApplyID)[0].FormNo; FormDS.FormRDApplyRow rowFormApply = this.FormRDBLL.GetFormRDApplyByID(formApplyID)[0]; this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(rowFormApply.CustomerChannelID)[0].CustomerChannelName; this.BrandCtl.Text = mdBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormApply.CurrencyID).CurrencyShortName; this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString(); MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID); MasterData.ExpenseCategoryRow rowExpenseCategory = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID); this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.ViewState["NeedPO"] = rowExpenseCategory.NeedPO; if (!rowFormApply.IsProjectNameNull()) { this.ProjectNameCtl.Text = rowFormApply.ProjectName; } this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileApply.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileApply.RealAttachmentFileName = rowFormApply.ApplyRealFileName; if (!rowFormApply.IsActivityBeginDateNull()) { this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } this.ViewState["CostCenterID"] = this.FormRDBLL.GetFormByID(int.Parse(this.ViewState["FormRDApplyID"].ToString()))[0].CostCenterID; this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(int.Parse(this.ViewState["CostCenterID"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); MasterDataBLL mdBLL = new MasterDataBLL(); int formID = int.Parse(Request["ObjectId"]); this.ViewState["ObjectId"] = formID; FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(formID)[0]; FormDS.FormSaleApplyRow rowFormApply = this.FormSaleBLL.GetFormSaleApplyByID(formID)[0]; if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } this.FormNoCtl.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = CommonUtility.GetStaffFullName(applicant); this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName; if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null) { this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName; } //this.StuffNoCtl.Text = applicant.IsStuffNoNull() ? "" : applicant.StuffNo; this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); MasterData.CustomerRow customer = mdBLL.GetCustomerById(rowFormApply.CustomerID)[0]; this.txtCustomerNo.Text = customer.CustomerNo; this.CustomerNameCtl.Text = customer.CustomerName; this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = mdBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID); this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormApply.CurrencyID).CurrencyShortName; this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString(); this.ShopNameCtl.Text = rowFormApply.IsShopNameNull() ? "" : rowFormApply.ShopName; this.ShopCountCtl.Text = rowFormApply.IsShopCountNull() ? "" : rowFormApply.ShopCount.ToString(); this.ProjectNameCtl.Text = rowFormApply.IsProjectNameNull() ? "" : rowFormApply.ProjectName; this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(rowForm.CostCenterID); //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = this.FormSaleBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/ActivityApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } //结案单编号 int SaleSettlementID = this.FormSaleBLL.GetValidSaleSettlementIDBySaleApplyID(formID); if (SaleSettlementID == 0) { this.hlSettlementFormNo.Text = "未结案"; } else { FormDS.FormRow settledForm = this.FormSaleBLL.GetFormByID(SaleSettlementID)[0]; this.hlSettlementFormNo.Text = settledForm.FormNo; this.hlSettlementFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/SettlementApproval.aspx?ShowDialog=1&ObjectId=" + settledForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName; //促销信息 this.DisplayTypeCtl.Text = mdBLL.GetDisplayTypeById(rowFormApply.DisplayTypeID).DisplayTypeName; this.DisplayAreaCtl.Text = rowFormApply.IsDisplayAreaNull() ? "" : rowFormApply.DisplayArea.ToString(); this.IsDMCtl.Text = rowFormApply.IsDM ? "Yes" : "No"; this.DiscountTypeCtl.Text = mdBLL.GetDiscountTypeById(rowFormApply.DiscountTypeID).DiscountTypeName; if (!rowFormApply.IsActivityBeginDateNull()) { this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryBeginDateNull()) { this.DeliveryBeginCtl.Text = rowFormApply.DeliveryBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryEndDateNull()) { this.DeliveryEndCtl.Text = rowFormApply.DeliveryEndDate.ToString("yyyy-MM-dd"); } this.TotalBudgetCtl.Text = rowFormApply.TotalBudget.ToString("N"); this.ApprovedAmountCtl.Text = rowFormApply.ApprovedAmount.ToString("N"); this.ApprovingAmountCtl.Text = rowFormApply.ApprovingAmount.ToString("N"); this.CompletedAmountCtl.Text = rowFormApply.CompletedAmount.ToString("N"); this.ReimbursedAmountCtl.Text = rowFormApply.ReimbursedAmount.ToString("N"); this.RemainBudgetCtl.Text = rowFormApply.RemainBudget.ToString("N"); //明细 this.odsSKUDetails.SelectParameters["FormSaleApplyID"].DefaultValue = rowFormApply.FormSaleApplyID.ToString(); this.odsExpenseDetails.SelectParameters["FormSaleApplyID"].DefaultValue = rowFormApply.FormSaleApplyID.ToString(); //费用统计信息 if (!rowFormApply.IsPriceDiscountAmountRMBNull()) { this.PriceDiscountAmountRMBCtl.Text = rowFormApply.PriceDiscountAmountRMB.ToString("N"); } if (!rowFormApply.IsOtherAmountRMBNull()) { this.OtherAmountRMBCtl.Text = rowFormApply.OtherAmountRMB.ToString("N"); } this.AmountRMBCtl.Text = rowFormApply.AmountRMB.ToString("N"); if (!rowFormApply.IsForecastOrderAmountNull()) { this.ForecastOrderAmountCtl.Text = rowFormApply.ForecastOrderAmount.ToString("N"); } if (!rowFormApply.IsCostBenefitRateNull()) { this.CostBenefitRateCtl.Text = rowFormApply.CostBenefitRate.ToString("N"); } this.odsExpenseSummary.SelectParameters["FormSaleApplyID"].DefaultValue = rowFormApply.FormSaleApplyID.ToString(); //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P")) { this.SubmitBtn.Visible = true; this.cwfAppCheck.IsView = false; this.ViewState["IsView"] = false; } else { this.SubmitBtn.Visible = false; this.cwfAppCheck.IsView = true; this.ViewState["IsView"] = true; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID) { this.EditBtn.Visible = true; this.ScrapBtn.Visible = true; } else { this.EditBtn.Visible = false; this.ScrapBtn.Visible = false; } //如果是弹出,取消按钮不可见 if (this.Request["ShowDialog"] != null) { if (this.Request["ShowDialog"].ToString() == "1") { this.upButton.Visible = false; this.Master.FindControl("divMenu").Visible = false; this.Master.FindControl("tbCurrentPage").Visible = false; } } //查看报销单按钮 if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) { this.IsVisible = ""; } else { this.IsVisible = "none"; } } //查看预算权限 int opViewId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.ViewBudget, SystemEnums.OperateEnum.Manage); AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"]; bool HasManageRight = new PositionRightBLL().CheckPositionRight(position.PositionId, opViewId); this.divBudgetInfo.Visible = HasManageRight; this.divBudgetInfoTitle.Visible = HasManageRight; //流程控件赋值 this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(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.StuffNameCtl.Text = CommonUtility.GetStaffFullName(stuffUser); 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()); } MasterDataBLL mdBLL = new MasterDataBLL(); //赋值备注等 this.PaymentTypeDDL.DataSource = mdBLL.GetPaymentTypeForDDL(); this.PaymentTypeDDL.DataTextField = "PaymentTypeName"; this.PaymentTypeDDL.DataValueField = "PaymentTypeID"; this.PaymentTypeDDL.DataBind(); this.VATTypeDDL.DataBind(); PaymentTypeDDL_SelectedIndexChanged(null, null); //如果是草稿进行赋值 int FormSaleSettlementID; if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); FormDS.FormSalePaymentRow rowFormPayment = this.FormSaleBLL.GetFormSalePaymentByID(int.Parse(this.ViewState["ObjectId"].ToString())); FormSaleSettlementID = rowFormPayment.FormSaleSettlementID; this.ViewState["FormSaleSettlementID"] = FormSaleSettlementID; if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } this.PaymentTypeDDL.SelectedValue = rowFormPayment.PaymentTypeID.ToString(); PaymentTypeDDL_SelectedIndexChanged(null, null); this.InvoiceStatusDDL.SelectedValue = rowFormPayment.InvoiceStatusID.ToString(); if (!rowFormPayment.IsRemarkNull()) { this.RemarkCtl.Text = rowFormPayment.Remark; } if (!rowFormPayment.IsAttachedFileNameNull()) { this.UCPaymentFile.AttachmentFileName = rowFormPayment.AttachedFileName; } if (!rowFormPayment.IsRealAttachedFileNameNull()) { this.UCPaymentFile.RealAttachmentFileName = rowFormPayment.RealAttachedFileName; } if (!rowFormPayment.IsVendorIDNull()) { this.UCVendor.VendorID = rowFormPayment.VendorID.ToString(); } if (!rowFormPayment.IsFormPOIDNull()) { this.UCPO.FormID = rowFormPayment.FormPOID.ToString(); } if (!rowFormPayment.IsVatTypeIDNull()) { VATTypeDDL.SelectedValue = rowFormPayment.VatTypeID.ToString(); } new FormSalePaymentDetailTableAdapter().FillCurrentDataForNormal(this.InnerDS.FormSalePaymentDetail, rowFormPayment.FormSalePaymentID); new FormInvoiceTableAdapter().FillByFormID(this.InnerDS.FormInvoice, rowFormPayment.FormSalePaymentID); } else { this.DeleteBtn.Visible = false; FormSaleSettlementID = int.Parse(Request["FormSaleSettlementID"]); this.ViewState["FormSaleSettlementID"] = FormSaleSettlementID; new FormSalePaymentDetailTableAdapter().FillByFormSaleSettlementID(this.InnerDS.FormSalePaymentDetail, FormSaleSettlementID); } FormDS.FormSaleSettlementRow rowFormSettlement = this.FormSaleBLL.GetFormSaleSettlementByID(FormSaleSettlementID); FormDS.FormRow settlementForm = this.FormSaleBLL.GetFormByID(FormSaleSettlementID)[0]; MasterData.CustomerRow customer = mdBLL.GetCustomerById(rowFormSettlement.CustomerID)[0]; this.CustomerNameCtl.Text = customer.CustomerName; this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = mdBLL.GetBrandById(rowFormSettlement.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormSettlement.ExpenseSubCategoryID); MasterData.ExpenseCategoryRow rowExpenseCategory = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID); this.ExpenseCategoryCtl.Text = rowExpenseCategory.ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.ViewState["NeedPO"] = rowExpenseCategory.NeedPO; this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormSettlement.CurrencyID).CurrencyShortName; this.ViewState["CostCenterID"] = this.FormSaleBLL.GetFormByID(FormSaleSettlementID)[0].CostCenterID; this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(int.Parse(this.ViewState["CostCenterID"].ToString())); this.SettlementRemarkCtl.Text = rowFormSettlement.IsRemarkNull() ? "" : rowFormSettlement.Remark; if (!rowFormSettlement.IsAttachedFileNameNull()) this.UCSettlementFile.AttachmentFileName = rowFormSettlement.AttachedFileName; if (!rowFormSettlement.IsRealAttachedFileNameNull()) this.UCSettlementFile.RealAttachmentFileName = rowFormSettlement.RealAttachedFileName; this.SettlementFormNoCtl.Text = settlementForm.FormNo; this.SettlementFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/SettlementApproval.aspx?ShowDialog=1&ObjectId=" + FormSaleSettlementID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; //费用合计信息 ApplyAmountRMBCtl.Text = rowFormSettlement.IsApplyAmountRMBNull() ? "" : rowFormSettlement.ApplyAmountRMB.ToString(); ForecastOrderAmountCtl.Text = rowFormSettlement.IsForecastOrderAmountNull() ? "" : rowFormSettlement.ForecastOrderAmount.ToString(); CostBenefitRateCtl.Text = rowFormSettlement.IsCostBenefitRateNull() ? "" : rowFormSettlement.CostBenefitRate.ToString(); AmountRMBCtl.Text = rowFormSettlement.AmountRMB.ToString(); ActualOrderAmountCtl.Text = rowFormSettlement.IsActualOrderAmountNull() ? "" : rowFormSettlement.ActualOrderAmount.ToString(); ActualCostBenefitRateCtl.Text = rowFormSettlement.IsActualCostBenefitRateNull() ? "" : rowFormSettlement.ActualCostBenefitRate.ToString(); this.odsSKUDetails.SelectParameters["FormSaleSettlementID"].DefaultValue = rowFormSettlement.FormSaleSettlementID.ToString(); //判断是Activity还是NoActivity,如果NoActivity那么需要隐藏 if (settlementForm.PageType == (int)SystemEnums.PageType.NoActivitySettlementApply) { this.FeeSumTR.Visible = false; this.SKUDiv.Visible = false; this.gvSKUDetails.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(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.StuffNameCtl.Text = CommonUtility.GetStaffFullName(stuffUser); 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()); } //如果是草稿进行赋值 int formApplyID; if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); FormDS.FormSalePaymentRow rowFormPayment = this.FormSaleBLL.GetFormSalePaymentByID(int.Parse(this.ViewState["ObjectId"].ToString())); formApplyID = rowFormPayment.FormSaleApplyID; this.ViewState["FormSaleApplyID"] = formApplyID; if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } //赋值备注等 this.InvoiceStatusDDL.SelectedValue = rowFormPayment.InvoiceStatusID.ToString(); if (!rowFormPayment.IsRemarkNull()) { this.RemarkCtl.Text = rowFormPayment.Remark; } if (!rowFormPayment.IsAttachedFileNameNull()) { this.UCPaymentFile.AttachmentFileName = rowFormPayment.AttachedFileName; } if (!rowFormPayment.IsRealAttachedFileNameNull()) { this.UCPaymentFile.RealAttachmentFileName = rowFormPayment.RealAttachedFileName; } if (!rowFormPayment.IsVendorIDNull()) { this.UCVendor.VendorID = rowFormPayment.VendorID.ToString(); } if (!rowFormPayment.IsVatTypeIDNull()) { this.VATTypeDDL.SelectedValue = rowFormPayment.VatTypeID.ToString(); } new FormSalePaymentDetailTableAdapter().FillCurrentDataForAdvanced(this.InnerDS.FormSalePaymentDetail, rowFormPayment.FormSalePaymentID, rowFormPayment.FormSaleApplyID); new FormInvoiceTableAdapter().FillByFormID(this.InnerDS.FormInvoice, rowFormPayment.FormSalePaymentID); } else { this.DeleteBtn.Visible = false; formApplyID = int.Parse(Request["FormSaleApplyID"]); this.ViewState["FormSaleApplyID"] = formApplyID; new FormSalePaymentDetailTableAdapter().FillByFormSaleApplyID(this.InnerDS.FormSalePaymentDetail, formApplyID); } MasterDataBLL mdBLL = new MasterDataBLL(); this.FormNoCtl.Text = this.FormSaleBLL.GetFormByID(formApplyID)[0].FormNo; FormDS.FormSaleApplyRow rowFormApply = this.FormSaleBLL.GetFormSaleApplyByID(formApplyID)[0]; this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM"); MasterData.CustomerRow customer = mdBLL.GetCustomerById(rowFormApply.CustomerID)[0]; this.CustomerNameCtl.Text = customer.CustomerName; this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName; this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType; this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName; this.CityCtl.Text = customer.City; this.BrandCtl.Text = mdBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName; MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID); this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName; this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName; this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormApply.CurrencyID).CurrencyShortName; this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString(); this.ShopNameCtl.Text = rowFormApply.IsShopNameNull() ? "" : rowFormApply.ShopName; this.ShopCountCtl.Text = rowFormApply.IsShopCountNull() ? "" : rowFormApply.ShopCount.ToString(); this.ProjectNameCtl.Text = rowFormApply.IsProjectNameNull() ? "" : rowFormApply.ProjectName; this.ViewState["CostCenterID"] = this.FormSaleBLL.GetFormByID(formApplyID)[0].CostCenterID; this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(int.Parse(this.ViewState["CostCenterID"].ToString())); this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc; if (!rowFormApply.IsApplyFileNameNull()) this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName; if (!rowFormApply.IsApplyRealFileNameNull()) this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName; //促销信息 this.DisplayTypeCtl.Text = mdBLL.GetDisplayTypeById(rowFormApply.DisplayTypeID).DisplayTypeName; this.DisplayAreaCtl.Text = rowFormApply.IsDisplayAreaNull() ? "" : rowFormApply.DisplayArea.ToString(); this.IsDMCtl.Text = rowFormApply.IsDM ? "Yes" : "No"; this.DiscountTypeCtl.Text = mdBLL.GetDiscountTypeById(rowFormApply.DiscountTypeID).DiscountTypeName; if (!rowFormApply.IsActivityBeginDateNull()) { this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsActivityEndDateNull()) { this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryBeginDateNull()) { this.DeliveryBeginCtl.Text = rowFormApply.DeliveryBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryEndDateNull()) { this.DeliveryEndCtl.Text = rowFormApply.DeliveryEndDate.ToString("yyyy-MM-dd"); } //明细 this.odsSKUDetails.SelectParameters["FormSaleApplyID"].DefaultValue = this.ViewState["FormSaleApplyID"].ToString(); } }
protected void gvApplyList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Apply") { String[] param = e.CommandArgument.ToString().Split(','); int FormID = Convert.ToInt32(param[0]); decimal ApplyAmount = Convert.ToDecimal(param[1]); int PageType = Convert.ToInt32(param[2]); FormDS.FormSaleApplyRow formApply = new FormSaleBLL().GetFormSaleApplyByID(FormID)[0]; MasterDataBLL masterBLL = new MasterDataBLL(); MasterData.ExpenseCategoryRow ecr = masterBLL.GetExpenseCategoryById(masterBLL.GetExpenseSubCategoryById(formApply.ExpenseSubCategoryID).ExpenseCategoryID); decimal NeedCreatePOAmount = Convert.ToDecimal(ConfigurationManager.AppSettings["NeedCreatePOAmount"]); if (ApplyAmount > NeedCreatePOAmount && ecr.NeedPO) { if (FormPurchaseBLL.QueryPOCountByParentFormID(FormID) <= 0) { PageUtility.ShowModelDlg(this, String.Format("���������{0}�������ȴ���PO!", NeedCreatePOAmount), String.Format("You need create po first when amount more than {0}!", NeedCreatePOAmount)); return; } } if (PageType == (int)SystemEnums.PageType.ActivityApply) { if (this.ViewState["SearchCondition"] != null) { this.Response.Redirect("~/FormSale/ActivityAdvancedPaymentApply.aspx?FormSaleApplyID=" + FormID + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectListForAdvanced.aspx?" + this.ViewState["SearchCondition"].ToString())); } else { this.Response.Redirect("~/FormSale/ActivityAdvancedPaymentApply.aspx?FormSaleApplyID=" + FormID + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectListForAdvanced.aspx")); } } else { if (this.ViewState["SearchCondition"] != null) { this.Response.Redirect("~/FormSale/NoActivityAdvancedPaymentApply.aspx?FormSaleApplyID=" + FormID + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectListForAdvanced.aspx?" + this.ViewState["SearchCondition"].ToString())); } else { this.Response.Redirect("~/FormSale/NoActivityAdvancedPaymentApply.aspx?FormSaleApplyID=" + FormID + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectListForAdvanced.aspx")); } } } }