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 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 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 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.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType;
            this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName;
            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 = mdBLL.GetCurrencyByID(int.Parse(this.ViewState["CurrencyID"].ToString())).CurrencyShortName;
        }
    }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        String title = this.GetLocalResourceObject("titleLabel.Text").ToString();
        this.Page.Title = title;

        int VendorID = int.Parse(Request["VendorID"]);
        this.ViewState["VendorID"] = VendorID;

        MasterData.VendorRow vendorRow = new MasterDataBLL().GetVendorByID(VendorID);
        txtVendorName.Text = vendorRow.VendorName;
        txtVendorAddress.Text = vendorRow.VendorAddress;
        txtCity.Text = vendorRow.City;
        txtPostal.Text = vendorRow.Postal;
        txtContactName.Text = vendorRow.ContactName;
        MasterDataBLL masterDataBLL = new MasterDataBLL();
        MasterData.VendorTypeRow VendorTypeRow = masterDataBLL.GetVendorTypeById(vendorRow.VendorTypeID);
        txtVendorType.Text = VendorTypeRow.VendorTypeName;
        txtCurrency.Text = masterDataBLL.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName;
        txtCompany.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyName;
        txtCompanyCode.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode;
        this.txtPhoneNumber.Text = vendorRow.PhoneNumber;
        this.txtOneTimeVendor.Text = vendorRow.OneTimeVendor ? "Y" : "N";
        this.txtHoldVendor.Text = vendorRow.HoldVendor ? "Y" : "N";
        if (!vendorRow.IsPurchaseingPostalCodeNull()) {
            this.txtPurchaseingPostalCode.Text = vendorRow.PurchaseingPostalCode;
        }
        if (!vendorRow.IsAlphaSearchKeyNull()) {
            this.txtAlphaSearchKey.Text = vendorRow.AlphaSearchKey;
        }
        if (!vendorRow.IsPurchasingCityNull()) {
            this.txtPurchasingCity.Text = vendorRow.PurchasingCity;
        }
        if (!vendorRow.IsPurchasingContactNull()) {
            this.txtPurchasingContact.Text = vendorRow.PurchasingContact;
        }
        if (!vendorRow.IsPurchasingAddressNull()) {
            this.txtPurchasingAddress.Text = vendorRow.PurchasingAddress;
        }
        if (!vendorRow.IsPurchasePhoneNumberNull()) {
            this.txtPurchasePhoneNumber.Text = vendorRow.PurchasePhoneNumber;
        }
        this.txtBankCode.Text = vendorRow.BankCode;
        this.txtMethodPayment.Text = masterDataBLL.GetMethodPaymentById(vendorRow.MethodPaymentID)[0].MethodPaymentName;
        this.txtPaymentTerm.Text = masterDataBLL.GetPaymentTermById(vendorRow.PaymentTermID)[0].PaymentTermName;
        this.txtTransType.Text = masterDataBLL.GetTransTypeById(vendorRow.TransTypeID)[0].TransTypeName;
        txtVATRate.Text = masterDataBLL.GetVatTypeById(vendorRow.VATTypeID)[0].VatTypeName;
        txtBankName.Text = vendorRow.BankName.ToString();
        if (!vendorRow.IsAccountNoNull()) {
            txtAccountNo.Text = vendorRow.AccountNo;
        }
        if (!vendorRow.IsBankNoNull()) {
            this.txtBankNo.Text = vendorRow.BankNo;
        }
        if (!vendorRow.IsACTypeIDNull()) {
            this.txtACType.Text = masterDataBLL.GetACTypeById(vendorRow.ACTypeID)[0].ACTypeName;
        }
        if (!vendorRow.IsRemarkNull()) {
            this.txtRemark.Text = vendorRow.Remark;
        }
    }
Beispiel #5
0
        private bool ExportVendorAVMX(MasterData.VendorRow vendor, int logId)
        {
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];
            try {
                string FileName = ConfigurationManager.AppSettings["ExportService.VendorAVMXFileName"];
                string spit = "\t";
                MasterDataBLL masterdatabll = new MasterDataBLL();
                MasterData.CurrencyRow currency = null;
                MasterData.VendorTypeRow vendorType = null;
                MasterData.TransTypeRow transType = null;
                MasterData.BankCodeRow bankCode = null;
                MasterData.ACTypeRow acType = null;
                vendorType = masterdatabll.GetVendorTypeById(vendor.VendorTypeID);
                currency = masterdatabll.GetCurrencyByID(vendorType.CurrencyID);

                if (!vendor.IsBankCodeIDNull()) {
                    MasterData.BankCodeDataTable tbBankCode = masterdatabll.GetBankCodeById(vendor.BankCodeID);
                    bankCode = tbBankCode[0];
                    if (bankCode.BankCode.Equals("999")) {
                        throw new Exception("BankCode为999不导出!");
                    }
                }

                if (!vendor.IsTransTypeIDNull()) {
                    MasterData.TransTypeDataTable tbTransType = masterdatabll.GetTransTypeById(vendor.TransTypeID);
                    transType = tbTransType[0];
                }

                if (!vendor.IsACTypeIDNull()) {
                    MasterData.ACTypeDataTable tbACType = masterdatabll.GetACTypeById(vendor.ACTypeID);
                    acType = masterdatabll.GetACTypeById(vendor.ACTypeID)[0];
                }
                if (vendor.IsAccountNoNull()) {
                    throw new Exception("银行账号为空的不导出!");
                }

                string content =
                   (vendor.IsActive ? "VM" : "VZ") + spit +
                       bSubstring(vendor.VendorCode, 5) + spit +
                       bSubstring(currency.CurrencyShortName, 3) + spit +
                       bSubstring(bankCode.BankCode, 3) + spit +
                       bSubstring(transType == null ? "" : transType.TransTypeName, 2) + spit +
                       bSubstring(vendor.IsBankNameNull() ? "" : vendor.BankName, 68) + spit +
                       bSubstring(vendor.IsAccountNoNull() ? "" : vendor.AccountNo, 32) + spit +
                       bSubstring(vendor.VendorName, 58) + spit +
                       bSubstring(acType == null ? "" : acType.ACTypeName, 1) + spit +
                       0 + spit +
                       bSubstring(vendor.IsBankNoNull() ? "" : vendor.BankNo, 11);
                content = content.Replace("\r", "").Replace("\n", "") + "\r\n";
                File.AppendAllText(path + FileName, content, Encoding.Default);
                File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + FileName, content, Encoding.Default);
            } catch (Exception e) {
                logbll.InsertExportLogDetail(logId, "VendorCode:" + vendor.VendorCode + ",VendorName:" + vendor.VendorName + "" + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Beispiel #6
0
        private bool ExportPO(int formid, int logId)
        {
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];
            AuthorizationBLL authorizationbll = new AuthorizationBLL();
            MasterDataBLL masterdatabll = new MasterDataBLL();
            FormQueryBLL formQueryBLL = new FormQueryBLL();
            FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
            OUTreeBLL outreebll = new OUTreeBLL();
            PurchaseDS.FormDataTable l_dtform = new PurchaseDS.FormDataTable();
            PurchaseDS.FormRow form = l_dtform.NewFormRow();
            try {
                PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(formid);

                PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(formPO.FormPOID);
                form = formPurchaseBLL.GetFormByID(formPO.FormPOID)[0];
                string POFileName = ConfigurationManager.AppSettings["ExportService.POFileName"];
                string POLineFileName = ConfigurationManager.AppSettings["ExportService.POLineFileName"];
                string spit = "\t";
                string CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetVendorTypeById(masterdatabll.GetVendorByID(formPO.VendorID).VendorTypeID).CompanyID).CompanyCode;
                string VendorCode = masterdatabll.GetVendorByID(formPO.VendorID).VendorCode;
                string POcontent = (
                   "PH" + spit +
                    "" + spit +
                   formPO.BPCSPONo + spit +
                    "0" + spit +
                    "" + spit +
                    "0" + spit +
                     CompanyCode + spit +
                    "" + spit +
                     CompanyCode + spit +
                    VendorCode + spit +
                    "0" + spit +
                    "4" + spit +
                    "" + spit +
                    masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +
                    authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                    bSubstring(formPO.DeliveryAddress, 30) + spit +
                    SpitAddress(formPO.DeliveryAddress, 60) + spit +
                    SpitAddress(formPO.DeliveryAddress, 90) + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    form.SubmitDate.ToString("yyyyMMdd") + spit +
                    "0" + spit +
                    "0" + spit +
                    "0" + spit +
                    formPODetail[0].DeliveryDate.ToString("yyyyMMdd") + spit +
                    "0" + spit +
                    "0" + spit +
                    bSubstring(formPO.Remark, 30) + spit +
                    masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit +
                    "1" + spit +
                    "" + spit +
                    outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit +
                    masterdatabll.GetShippingTermById(formPO.ShippingTermID).ShippingTermCode + spit +
                    "" + spit +
                    masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit +
                    formPO.ExchangeRate + spit +
                    formPO.ExchangeRate + spit +
                    formPODetail.Rows.Count + spit +
                    formPO.ExchangeRate + spit +
                    authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                    "" + spit +
                     authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                   form.ApprovedDate.ToString("yyyyMMdd") + spit +
                    "" + spit +
                    "0" + spit +
                    "" + spit +
                    "0" + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    "").Replace("\r", "").Replace("\n", "");
                int order = 0;
                string[] PODetailcontent = new string[formPODetail.Rows.Count];
                foreach (PurchaseDS.FormPODetailRow l_drformPODetail in formPODetail) {
                    order++;
                    PODetailcontent[order - 1] = (
                        "PO" + spit +
                         formPO.BPCSPONo + spit +
                         order + spit +
                         l_drformPODetail.ItemCode.ToUpper() + spit +
                         VendorCode + spit +
                         l_drformPODetail.Quantity + spit +
                         l_drformPODetail.Quantity + spit +
                         l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                         "" + spit +
                         "0" + spit +
                         l_drformPODetail.AmountRMB.ToString() + spit +
                         "0" + spit +
                         "0" + spit +
                         "EA" + spit +
                         "0" + spit +
                         "" + spit +
                         "0" + spit +
                         "0" + spit +
                         "" + spit +
                         "" + spit +
                         "" + spit +
                         DateTime.Now.ToString("yyyyMMdd") + spit +
                         masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit +
                         "" + spit +
                         "0" + spit +
                         "1" + spit +
                         "1" + spit +
                         "" + spit +
                         CompanyCode + spit +
                         "0" + spit +
                         "0" + spit +
                         "0" + spit +
                         "0" + spit +
                         l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                         "" + spit +
                         "0" + spit +
                         "0" + spit +
                         "" + spit +
                         masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit +
                         formPO.ExchangeRate + spit +
                         formPO.ExchangeRate + spit +
                         "0" + spit +
                         l_drformPODetail.AmountRMB.ToString() + spit +
                         "0" + spit +
                         "1" + spit +
                         "" + spit +
                          "0" + spit +
                         "0" + spit +
                         "0" + spit +
                        "" + spit +
                        "" + spit +
                        "" + spit +
                        "01" + spit +
                        "4" + spit +
                       masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +//Ship To Company
                       authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                        bSubstring(formPO.DeliveryAddress, 30) + spit +
                    SpitAddress(formPO.DeliveryAddress, 60) + spit +
                    SpitAddress(formPO.DeliveryAddress, 90) + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "0" + spit +
                       "0" + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       "0" + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       "" + spit +
                       outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit +
                       "" + spit +
                       "" + spit +
                       masterdatabll.GetCostCenterById(form.CostCenterID).CostCenterCode + spit +
                       l_drformPODetail.ItemCode.ToUpper() + spit +
                       l_drformPODetail.ItemDescription + spit +
                       "1" + spit +
                       "0" + spit +
                       "0" + spit +
                       "3" + spit +
                       "0" + spit +
                       "0" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       l_drformPODetail.Quantity).Replace("\r", "").Replace("\n", ""); ;
                }

                File.AppendAllLines(path + POLineFileName, PODetailcontent, Encoding.Default);
                File.AppendAllLines(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POLineFileName, PODetailcontent, Encoding.Default);

                File.AppendAllText(path + POFileName, POcontent + "\r\n", Encoding.Default);
                File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POFileName, POcontent, Encoding.Default);

            } catch (Exception e) {
                logbll.InsertExportLogDetail(logId, "单据编号:" + form.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(form.UserID)[0].StuffName + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Beispiel #7
0
    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()));
        }
    }
Beispiel #8
0
        /// <summary>
        /// Vendor导出
        /// </summary>
        /// <param name="FormID"></param>
        /// <returns></returns>
        private bool ExportVendorAVM(MasterData.VendorRow vendor, int logId)
        {
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];
            FormVendorBLL formvendorbll = new FormVendorBLL();
            MasterDataBLL masterdatabll = new MasterDataBLL();
            try {
                string FileName = ConfigurationManager.AppSettings["ExportService.VendorAVMFileName"];
                string spit = "\t";
                MasterData.PaymentTermRow paymentTerm = null;
                MasterData.VendorTypeRow vendorType = null;
                MasterData.CompanyRow company = null;
                MasterData.CurrencyRow currency = null;
                MasterData.MethodPaymentRow paymentType = null;
                MasterData.VatTypeRow VatType = null;
                MasterData.BankCodeRow bankCode = null;
                MasterData.TransTypeRow transType = null;
                MasterData.ACTypeRow acType = null;

                paymentTerm = masterdatabll.GetPaymentTermById(vendor.PaymentTermID)[0];
                vendorType = masterdatabll.GetVendorTypeById(vendor.VendorTypeID);
                company = masterdatabll.GetCompanyById(vendor.CompanyID);
                currency = masterdatabll.GetCurrencyByID(vendorType.CurrencyID);
                paymentType = masterdatabll.GetMethodPaymentById(vendor.MethodPaymentID)[0];
                VatType = masterdatabll.GetVatTypeById(vendor.VATTypeID)[0];
                bankCode = masterdatabll.GetBankCodeById(vendor.BankCodeID)[0];
                transType = masterdatabll.GetTransTypeById(vendor.TransTypeID)[0];
                acType = masterdatabll.GetACTypeById(vendor.ACTypeID)[0];
                string ActionName = "";
                string content = "";
                switch (vendor.ActionType) {
                    case 0:
                        ActionName = "D";
                        #region 删除
                        content =
                           "" + spit +
                           ActionName + spit +
                           "" + spit +
                           "VZ" + spit +
                           bSubstring(vendor.VendorCode, 5) + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                          "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + "\r\n";
                        #endregion
                        break;
                    case 1:
                        ActionName = "A";
                        #region 新增
                        content =
                           "" + spit +
                           ActionName + spit +
                           (vendor.IsActive ? "A" : "D") + spit +
                           (vendor.IsActive ? "VM" : "VZ") + spit +
                           bSubstring(vendor.VendorCode, 5) + spit +
                           bSubstring(vendor.VendorName, 28) + spit +
                           bSubstring(vendor.VendorAddress, 28) + spit +
                           SpitVendorAddress(vendor.VendorAddress) + spit +
                           bSubstring(vendor.City, 17) + spit +
                           "" + spit +
                           bSubstring(vendor.Postal, 9) + spit +
                           bSubstring(paymentTerm.PaymentTermName, 2) + spit +
                           bSubstring(vendorType.VendorTypeName, 4) + spit +
                           bSubstring(vendor.VendorCode, 5) + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "N" + spit +
                           "" + spit +
                           bSubstring(vendor.PhoneNumber, 15) + spit +
                           bSubstring(company.CompanyCode, 2) + spit +
                           bSubstring(currency.CurrencyShortName, 3) + spit +
                           bSubstring(paymentType.MethodPaymentName, 1) + spit +
                           (vendor.OneTimeVendor ? "Y" : "N") + spit +
                           0 + spit +
                           (vendor.HoldVendor ? "Y" : "N") + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           "N" + spit +
                           bSubstring(vendor.AlphaSearchKey, 10) + spit +
                           0 + spit +
                           bSubstring(vendor.ContactName, 30) + spit +
                           "" + spit +
                           0 + spit +
                           bSubstring(vendor.PurchasingAddress, 28) + spit +
                           SpitVendorAddress(vendor.PurchasingAddress) + spit +
                           bSubstring(vendor.PurchasingCity, 28) + spit +
                           "" + spit +
                           bSubstring(vendor.PurchaseingPostalCode, 9) + spit +
                           bSubstring(vendor.PurchasingContact, 30) + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           "N" + spit +
                           bSubstring(vendor.PurchasePhoneNumber, 15) + spit +
                           "" + spit +
                           "" + spit +
                           bSubstring(VatType.VatTypeName, 5) + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + "\r\n";
                        #endregion
                        break;
                    case 2:
                        ActionName = "U";
                        #region 修改
                        QueryDS.FormVendorViewDataTable l_dtformvendor = formvendorbll.GetApproveFormVendorByVendorID(vendor.VendorID);
                        if (l_dtformvendor.Rows.Count > 1) {

                            QueryDS.FormVendorViewRow l_drformvendor = l_dtformvendor[1];
                            content =
                               "" + spit +
                               ActionName + spit +
                               "" + spit +
                               (vendor.IsActive ? "VM" : "VZ") + spit +
                               bSubstring(vendor.VendorCode, 5) + spit +
                               (bSubstring(vendor.VendorName, 28) == bSubstring(l_drformvendor.VendorName, 28) ? "" : bSubstring(vendor.VendorName, 28)) + spit +
                               (bSubstring(vendor.VendorAddress, 28) == bSubstring(l_drformvendor.VendorAddress, 28) ? "" : vendor.VendorAddress) + spit +
                               (SpitVendorAddress(vendor.VendorAddress) == SpitVendorAddress(l_drformvendor.VendorAddress) ? "" : SpitVendorAddress(vendor.VendorAddress)) + spit +
                               (bSubstring(vendor.City, 17) == bSubstring(l_drformvendor.City, 17) ? "" : bSubstring(vendor.City, 17)) + spit +
                               "" + spit +
                               (bSubstring(vendor.Postal, 9) == bSubstring(l_drformvendor.Postal, 9) ? "" : bSubstring(vendor.Postal, 9)) + spit +
                              bSubstring(l_drformvendor.MethodPaymentID == vendor.MethodPaymentID ? "" : paymentTerm.PaymentTermName, 2) + spit +
                               bSubstring(vendor.VendorTypeID == l_drformvendor.VendorTypeID ? "" : vendorType.VendorTypeName, 4) + spit +
                               0 + spit +
                               0 + spit +
                               0 + spit +
                               "" + spit +
                               "" + spit +
                               "" + spit +
                               (bSubstring(vendor.PhoneNumber, 15) == bSubstring(l_drformvendor.PhoneNumber, 15) ? "" : bSubstring(vendor.PhoneNumber, 15)) + spit +
                               (bSubstring(company.CompanyCode, 2) == bSubstring(l_drformvendor.CompanyCode, 2) ? "0" : bSubstring(company.CompanyCode, 2)) + spit +
                               (bSubstring(currency.CurrencyShortName, 3) == bSubstring(l_drformvendor.CurrencyShortName, 3) ? "" : bSubstring(currency.CurrencyShortName, 3)) + spit +
                               bSubstring(l_drformvendor.MethodPaymentID == vendor.MethodPaymentID ? "" : paymentType.MethodPaymentName, 1) + spit +
                               (vendor.OneTimeVendor == l_drformvendor.OneTimeVendor ? "" : (vendor.OneTimeVendor ? "Y" : "N")) + spit +
                               0 + spit +
                               (vendor.HoldVendor == l_drformvendor.HoldVendor ? "" : (vendor.HoldVendor ? "Y" : "N")) + spit +
                               0 + spit +
                               0 + spit +
                               0 + spit +
                               0 + spit +
                               0 + spit +
                               0 + spit +
                               "" + spit +
                               (bSubstring(vendor.AlphaSearchKey, 10) == bSubstring(l_drformvendor.AlphaSearchKey, 10) ? "" : bSubstring(vendor.AlphaSearchKey, 10)) + spit +
                               0 + spit +
                               (bSubstring(vendor.ContactName, 30) == bSubstring(l_drformvendor.ContactName, 30) ? "" : bSubstring(vendor.ContactName, 30)) + spit +
                               "" + spit +
                               0 + spit +
                               (bSubstring(vendor.PurchasingAddress, 28) == bSubstring(l_drformvendor.PurchasingAddress, 28) ? "" : bSubstring(vendor.PurchasingAddress, 28)) + spit +
                               (SpitVendorAddress(vendor.PurchasingAddress) == SpitVendorAddress(l_drformvendor.PurchasingAddress) ? "" : SpitVendorAddress(vendor.PurchasingAddress)) + spit +
                              (bSubstring(vendor.PurchasingCity, 28) == bSubstring(l_drformvendor.PurchasingCity, 28) ? "" : bSubstring(vendor.PurchasingCity, 28)) + spit +
                               "" + spit +
                               (bSubstring(vendor.PurchaseingPostalCode, 9) == bSubstring(l_drformvendor.PurchaseingPostalCode, 9) ? "" : bSubstring(vendor.PurchaseingPostalCode, 9)) + spit +
                               (bSubstring(vendor.PurchasingContact, 30) == bSubstring(l_drformvendor.PurchasingContact, 30) ? "" : bSubstring(vendor.PurchasingContact, 30)) + spit +
                               "" + spit +
                               0 + spit +
                               0 + spit +
                               "" + spit +
                               (bSubstring(vendor.PurchasePhoneNumber, 15) == bSubstring(l_drformvendor.PurchasePhoneNumber, 15) ? "" : bSubstring(vendor.PurchasePhoneNumber, 15)) + spit +
                               "" + spit +
                               "" + spit +
                               bSubstring(l_drformvendor.VATTypeID == vendor.VATTypeID ? "" : VatType.VatTypeName, 5) + spit +
                               "" + spit +
                               "" + spit +
                               0 + spit +
                               0 + spit +
                               "" + spit +
                               "" + spit +
                               "" + spit +
                               "" + spit +
                               "" + spit +
                               "" + spit +
                               "" + "\r\n";
                        } else {
                            logbll.InsertExportLogDetail(logId, "未找到Vendor历史数据!");
                        }
                        #endregion
                        break;
                    case 3:
                        ActionName = "R";
                        #region 重新激活
                        content =
                           "" + spit +
                           ActionName + spit +
                           "" + spit +
                           "VM" + spit +
                           bSubstring(vendor.VendorCode, 5) + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                          "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           0 + spit +
                           0 + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + spit +
                           "" + "\r\n";
                        #endregion
                        break;
                }
                content = content.Replace("\r", "").Replace("\n", "") + "\r\n";
                File.AppendAllText(path + FileName, content, Encoding.Default);
                File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + FileName, content, Encoding.Default);
                UpdateVendorbyID(vendor.VendorID);
            } catch (Exception e) {
                logbll.InsertExportLogDetail(logId, "VendorCode:" + vendor.VendorCode + ",VendorName:" + vendor.VendorName + "" + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Beispiel #9
0
    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;
            }
        }
    }
Beispiel #10
0
    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());
            }

            //如果是草稿进行赋值
            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();
        }
    }
Beispiel #12
0
 protected void txtVendorTypeName_TextChanged(object sender, EventArgs e)
 {
     MasterDataBLL ma = new MasterDataBLL();
     if (this.VendorTypeControl.VendorTypeID != string.Empty) {
         txtCurrency.Text = ma.GetCurrencyByID(ma.GetVendorTypeById(int.Parse(VendorTypeControl.VendorTypeID)).CurrencyID).CurrencyFullName;
         txtCompany.Text = ma.GetCompanyById(ma.GetVendorTypeById(int.Parse(VendorTypeControl.VendorTypeID)).CompanyID).CompanyName;
         txtCompanyCode.Text = ma.GetCompanyById(ma.GetVendorTypeById(int.Parse(VendorTypeControl.VendorTypeID)).CompanyID).CompanyCode;
     } else {
         txtCurrency.Text = "";
         txtCompany.Text = "";
         txtCompanyCode.Text = "";
     }
 }
Beispiel #13
0
 protected void OpenForm(int formID)
 {
     PurchaseDS.FormVendorRow FormVendorTR = FormVendorBLL.GetFormVendorByID(formID)[0];
     if (!FormVendorTR.IsVendorNameNull()) {
         txtVendorName.Text = FormVendorTR.VendorName;
     }
     if (!FormVendorTR.IsVendorAddressNull()) {
         txtVendorAddress.Text = FormVendorTR.VendorAddress;
     }
     if (!FormVendorTR.IsCityNull()) {
         txtCity.Text = FormVendorTR.City;
     }
     if (!FormVendorTR.IsPostalNull()) {
         txtPostal.Text = FormVendorTR.Postal;
     }
     if (!FormVendorTR.IsContactNameNull()) {
         txtContactName.Text = FormVendorTR.ContactName;
     }
     if (!FormVendorTR.IsVendorTypeIDNull()) {
         this.VendorTypeControl.VendorTypeID = FormVendorTR.VendorTypeID.ToString();
         MasterDataBLL ma = new MasterDataBLL();
         MasterData.VendorTypeRow VendorTypeRow = ma.GetVendorTypeById(FormVendorTR.VendorTypeID);
         VendorTypeControl.VendorTypeName = VendorTypeRow.VendorTypeName;
         txtCurrency.Text = ma.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName;
         txtCompany.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyName;
         txtCompanyCode.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode;
     }
     if (!FormVendorTR.IsPhoneNumberNull()) {
         this.txtPhoneNumber.Text = FormVendorTR.PhoneNumber;
     }
     if (!FormVendorTR.IsOneTimeVendorNull()) {
         this.ddlOneTimeVendor.SelectedValue = Convert.ToInt32(FormVendorTR.OneTimeVendor).ToString();
     }
     if (!FormVendorTR.IsHoldVendorNull()) {
         this.ddlHoldVendor.SelectedValue = Convert.ToInt32(FormVendorTR.HoldVendor).ToString();
     }
     if (!FormVendorTR.IsPurchaseingPostalCodeNull()) {
         this.txtPurchaseingPostalCode.Text = FormVendorTR.PurchaseingPostalCode;
     }
     if (!FormVendorTR.IsAlphaSearchKeyNull()) {
         this.txtAlphaSearchKey.Text = FormVendorTR.AlphaSearchKey;
     }
     if (!FormVendorTR.IsPurchasingCityNull()) {
         this.txtPurchasingCity.Text = FormVendorTR.PurchasingCity;
     }
     if (!FormVendorTR.IsPurchasingContactNull()) {
         this.txtPurchasingContact.Text = FormVendorTR.PurchasingContact;
     }
     if (!FormVendorTR.IsPurchasingAddressNull()) {
         this.txtPurchasingAddress.Text = FormVendorTR.PurchasingAddress;
     }
     if (!FormVendorTR.IsPurchasePhoneNumberNull()) {
         this.txtPurchasePhoneNumber.Text = FormVendorTR.PurchasePhoneNumber;
     }
     if (!FormVendorTR.IsBankCodeIDNull()) {
         this.ddlBankCode.DataBind();
         this.ddlBankCode.SelectedValue = FormVendorTR.BankCodeID.ToString();
     }
     if (!FormVendorTR.IsPaymentTermIDNull()) {
         this.ddlPaymentTerm.SelectedValue = FormVendorTR.PaymentTermID.ToString();
     }
     if (!FormVendorTR.IsTransTypeIDNull()) {
         this.ddlTransType.SelectedValue = FormVendorTR.TransTypeID.ToString();
     }
     if (!FormVendorTR.IsVATTypeIDNull()) {
         ddlVatRate.SelectedValue = FormVendorTR.VATTypeID.ToString();
     }
     if (!FormVendorTR.IsBankNameNull()) {
         txtBankName.Text = FormVendorTR.BankName.ToString();
     }
     if (!FormVendorTR.IsAccountNoNull()) {
         txtAccountNo.Text = FormVendorTR.AccountNo;
     }
     if (!FormVendorTR.IsBankNoNull()) {
         txtBankNo.Text = FormVendorTR.BankNo;
     }
     if (!FormVendorTR.IsACTypeIDNull()) {
         ddlACType.SelectedValue = FormVendorTR.ACTypeID.ToString();
     }
     if (!FormVendorTR.IsModifyReasonNull()) {
         this.txtModifyReason.Text = FormVendorTR.ModifyReason;
     }
     if (!FormVendorTR.IsVendorIDNull()) {
         this.trModifyReason.Visible = true;
     }
     if (!FormVendorTR.IsAttachmentFileNameNull()) {
         this.UCFileUpload.AttachmentFileName = FormVendorTR.AttachmentFileName;
         this.UCFileUpload.RealAttachmentFileName = FormVendorTR.RealAttachmentFileName;
     }
     if (!FormVendorTR.IsRemarkNull()) {
         this.txtRemark.Text = FormVendorTR.Remark;
     }
     if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Delete) {
         DisableWhenDelete();
     }
 }
Beispiel #14
0
    public void FillFormByVendorID(int VendorID)
    {
        MasterData.VendorRow vendorRow = new MasterDataBLL().GetVendorByID(VendorID);
        txtVendorName.Text = vendorRow.VendorName;
        txtVendorAddress.Text = vendorRow.VendorAddress;
        txtCity.Text = vendorRow.City;
        txtPostal.Text = vendorRow.Postal;
        txtContactName.Text = vendorRow.ContactName;
        this.VendorTypeControl.VendorTypeID = vendorRow.VendorTypeID.ToString();
        MasterDataBLL ma = new MasterDataBLL();
        MasterData.VendorTypeRow VendorTypeRow = ma.GetVendorTypeById(vendorRow.VendorTypeID);
        VendorTypeControl.VendorTypeName = VendorTypeRow.VendorTypeName;
        txtCurrency.Text = ma.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName;
        txtCompany.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyName;
        txtCompanyCode.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode;
        if (!vendorRow.IsPhoneNumberNull()) {
            this.txtPhoneNumber.Text = vendorRow.PhoneNumber;
        }
        if (!vendorRow.IsOneTimeVendorNull()) {
            this.ddlOneTimeVendor.SelectedValue = Convert.ToInt32(vendorRow.OneTimeVendor).ToString();
        }
        if (!vendorRow.IsHoldVendorNull()) {
            this.ddlHoldVendor.SelectedValue = Convert.ToInt32(vendorRow.HoldVendor).ToString();
        }
        if (!vendorRow.IsPurchaseingPostalCodeNull()) {
            this.txtPurchaseingPostalCode.Text = vendorRow.PurchaseingPostalCode;
        }
        if (!vendorRow.IsAlphaSearchKeyNull()) {
            this.txtAlphaSearchKey.Text = vendorRow.AlphaSearchKey;
        }
        if (!vendorRow.IsPurchasingCityNull()) {
            this.txtPurchasingCity.Text = vendorRow.PurchasingCity;
        }
        if (!vendorRow.IsPurchasingContactNull()) {
            this.txtPurchasingContact.Text = vendorRow.PurchasingContact;
        }
        if (!vendorRow.IsPurchasingAddressNull()) {
            this.txtPurchasingAddress.Text = vendorRow.PurchasingAddress;
        }
        if (!vendorRow.IsPurchasePhoneNumberNull()) {
            this.txtPurchasePhoneNumber.Text = vendorRow.PurchasePhoneNumber;
        }
        this.ddlPaymentTerm.SelectedValue = vendorRow.PaymentTermID.ToString();
        if (!vendorRow.IsTransTypeIDNull()) {
            this.ddlTransType.SelectedValue = vendorRow.TransTypeID.ToString();
        }
        this.ddlBankCode.DataBind();
        if (!vendorRow.IsBankCodeIDNull()) {
            this.ddlBankCode.SelectedValue = vendorRow.BankCodeID.ToString();
        }
        ddlVatRate.SelectedValue = vendorRow.VATTypeID.ToString();

        txtBankName.Text = vendorRow.BankName.ToString();
        txtAccountNo.Text = vendorRow.AccountNo;
        if (!vendorRow.IsRemarkNull()) {
            this.txtRemark.Text = vendorRow.Remark;
        }
        if (!vendorRow.IsBankNoNull()) {
            this.txtBankNo.Text = vendorRow.BankNo;
        }
        ddlACType.SelectedValue = vendorRow.ACTypeID.ToString();

        if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Add) {
            this.trModifyReason.Visible = true;
        }
        if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Delete || int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Reactive) {
            DisableWhenDelete();
        }
    }
    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);

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            PurchaseDS.FormRow rowForm = this.FormVendorBLL.GetFormByID(formID)[0];
            PurchaseDS.FormVendorRow rowForVendor = this.FormVendorBLL.GetFormVendorByID(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();

            //历史单据
            if (rowForm.IsRejectedFormIDNull()) {
                lblRejectFormNo.Text = "无";
            } else {
                PurchaseDS.FormRow rejectedForm = this.FormVendorBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/FormVendorApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            PurchaseDS.FormVendorRow FormVendorTR = FormVendorBLL.GetFormVendorByID(formID)[0];
            if (!FormVendorTR.IsVendorNameNull()) {
                txtVendorName.Text = FormVendorTR.VendorName;
            }
            if (!FormVendorTR.IsVendorAddressNull()) {
                txtVendorAddress.Text = FormVendorTR.VendorAddress;
            }
            if (!FormVendorTR.IsCityNull()) {
                txtCity.Text = FormVendorTR.City;
            }
            if (!FormVendorTR.IsPostalNull()) {
                txtPostal.Text = FormVendorTR.Postal;
            }
            if (!FormVendorTR.IsContactNameNull()) {
                txtContactName.Text = FormVendorTR.ContactName;
            }
            MasterDataBLL masterDataBLL = new MasterDataBLL();
            if (!FormVendorTR.IsVendorTypeIDNull()) {
                this.VendorTypeControl.VendorTypeID = FormVendorTR.VendorTypeID.ToString();
                MasterData.VendorTypeRow VendorTypeRow = masterDataBLL.GetVendorTypeById(FormVendorTR.VendorTypeID);
                txtCurrency.Text = masterDataBLL.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName;
                txtCompany.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyName;
                txtCompanyCode.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode;
            }
            if (!FormVendorTR.IsPhoneNumberNull()) {
                this.txtPhoneNumber.Text = FormVendorTR.PhoneNumber;
            }
            if (!FormVendorTR.IsOneTimeVendorNull()) {
                this.txtOneTimeVendor.Text = FormVendorTR.OneTimeVendor ? "Y" : "N";
            }
            if (!FormVendorTR.IsHoldVendorNull()) {
                this.txtHoldVendor.Text = FormVendorTR.HoldVendor ? "Y" : "N";
            }
            if (!FormVendorTR.IsPurchaseingPostalCodeNull()) {
                this.txtPurchaseingPostalCode.Text = FormVendorTR.PurchaseingPostalCode;
            }
            if (!FormVendorTR.IsAlphaSearchKeyNull()) {
                this.txtAlphaSearchKey.Text = FormVendorTR.AlphaSearchKey;
            }
            if (!FormVendorTR.IsPurchasingCityNull()) {
                this.txtPurchasingCity.Text = FormVendorTR.PurchasingCity;
            }
            if (!FormVendorTR.IsPurchasingContactNull()) {
                this.txtPurchasingContact.Text = FormVendorTR.PurchasingContact;
            }
            if (!FormVendorTR.IsPurchasingAddressNull()) {
                this.txtPurchasingAddress.Text = FormVendorTR.PurchasingAddress;
            }
            if (!FormVendorTR.IsPurchasePhoneNumberNull()) {
                this.txtPurchasePhoneNumber.Text = FormVendorTR.PurchasePhoneNumber;
            }
            if (!FormVendorTR.IsBankCodeNull()) {
                this.txtBankCode.Text = FormVendorTR.BankCode;
            }
            if (!FormVendorTR.IsMethodPaymentIDNull()) {
                this.txtMethodPayment.Text = masterDataBLL.GetMethodPaymentById(FormVendorTR.MethodPaymentID)[0].MethodPaymentName;
            }
            if (!FormVendorTR.IsPaymentTermIDNull()) {
                this.txtPaymentTerm.Text = masterDataBLL.GetPaymentTermById(FormVendorTR.PaymentTermID)[0].PaymentTermName;
            }
            if (!FormVendorTR.IsTransTypeIDNull()) {
                this.txtTransType.Text = masterDataBLL.GetTransTypeById(FormVendorTR.TransTypeID)[0].TransTypeName;
            }
            if (!FormVendorTR.IsVATTypeIDNull()) {
                txtVATRate.Text = masterDataBLL.GetVatTypeById(FormVendorTR.VATTypeID)[0].VatTypeName;
            }
            if (!FormVendorTR.IsBankNameNull()) {
                txtBankName.Text = FormVendorTR.BankName.ToString();
            }
            if (!FormVendorTR.IsAccountNoNull()) {
                txtAccountNo.Text = FormVendorTR.AccountNo;
            }
            if (!FormVendorTR.IsBankNoNull()) {
                this.txtBankNo.Text = FormVendorTR.BankNo;
            }
            if (!FormVendorTR.IsACTypeIDNull()) {
                this.txtACType.Text = masterDataBLL.GetACTypeById(FormVendorTR.ACTypeID)[0].ACTypeName;
            }
            if (!FormVendorTR.IsAttachmentFileNameNull()) {
                this.UCFileUpload.AttachmentFileName = FormVendorTR.AttachmentFileName;
                this.UCFileUpload.RealAttachmentFileName = FormVendorTR.RealAttachmentFileName;
            }
            if (!FormVendorTR.IsModifyReasonNull()) {
                this.txtModifyReason.Text = FormVendorTR.ModifyReason;
            }
            if (!FormVendorTR.IsRemarkNull()) {
                this.txtRemark.Text = FormVendorTR.Remark;
            }
            //通过判断FormVendor有没有VendorID,判断是新增还是修改Vendor
            if (!FormVendorTR.IsVendorIDNull()) {
                this.ViewState["VendorID"] = FormVendorTR.VendorID;
            }
            if (FormVendorTR.ActionType != (int)SystemEnums.VendorActionType.Add) {
                this.trModifyReason.Visible = true;
            }

            //是新增还是修改
            this.ViewState["ActionType"] = FormVendorTR.ActionType;
            this.txtActionType.Text = CommonUtility.GetVendorActionTypeName(FormVendorTR.ActionType);

            //Vendor
            if (!FormVendorTR.IsVendorIDNull()) {
                hlVendor.Text = new MasterDataBLL().GetVendorByID(FormVendorTR.VendorID).VendorCode;
                hlVendor.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/Dialog/VendorDetail.aspx?ShowDialog=1&VendorID=" + FormVendorTR.VendorID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            } else {
                hlVendor.Text = "无";
            }

            //审批页面处理&按钮处理
            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;
                }
            }

            //是否有修改VendorType的权限
            int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.VendorTypeModify, SystemEnums.OperateEnum.Manage);
            AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"];
            PositionRightBLL positionRightBLL = new PositionRightBLL();
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Awaiting && positionRightBLL.CheckPositionRight(position.PositionId, opManageId)) {
                this.VendorTypeControl.IsVisible = "inline";
                this.btnSave.Visible = true;
            } else {
                this.VendorTypeControl.IsVisible = "none";
                this.btnSave.Visible = false;
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }