private void loadVendors()
        {
            this.vendorTableAdapter = new VendorTableAdapter();
            this.vendorTableAdapter.ClearBeforeFill = true;
            this.vendorTableAdapter.Fill(adventureWorksDataSet.Vendor);

            this.vendorsDropDownList.DataSource     = this.adventureWorksDataSet.Vendor;
            this.vendorsDropDownList.DataTextField  = "Name";
            this.vendorsDropDownList.DataValueField = "BusinessEntityID";
            this.vendorsDropDownList.DataBind();

            this.vendorsDropDownList.SelectedIndex = 1;
        }
Ejemplo n.º 2
0
        private void cmdAddVendor_Click(object sender, EventArgs e)
        {
            if (IsValidEntry())
            {
                try
                {
                    VendorTableAdapter qaAdapter = new VendorTableAdapter();
                    qaAdapter.Insert(txtVendorName.Text, txtContactPerson.Text, txtAddress.Text, txtTelephone.Text, txtHandphoneNo.Text, txtPostalCode.Text, txtFaxNo.Text, "", "", txtCity.Text, "", "", "", DateTime.Now, "", true, 45);
                    MessageBox.Show("New Vendor Added Succesfully");
                    //callingForm = new FrmDEntry();
                    //callingForm.VendorJustAdded(txtVendorName.Text,1);
                    //this.Close();
                    //return;
                    if (passControl != null)
                    {
                        passControl(txtVendorName);
                    }

                    // Close form
                    this.Hide();
                }
                catch { }
            }
        }
Ejemplo n.º 3
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"];

            if (new StuffUserBLL().GetCostCenterIDByPositionID(rowUserPosition.PositionId) == 0) {
                this.Session["ErrorInfor"] = "未找到成本中心,请联系管理员";
                Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
            }
            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());
            }

            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;
                }
                PurchaseDS.FormPORow rowFormPO = this.FormPurchaseBLL.GetFormPOByID(int.Parse(this.ViewState["ObjectId"].ToString()));
                this.ViewState["ParentFormID"] = rowFormPO.ParentFormID;
                this.ViewState["Period"] = rowFormPO.FPeriod.ToShortDateString();
                this.PeriodCtl.Text = rowFormPO.FPeriod.ToString("yyyy-MM");
                this.ViewState["VendorID"] = rowFormPO.VendorID.ToString();
                this.ViewState["ItemCategoryID"] = rowFormPO.ItemCategoryID.ToString();
                this.ViewState["PurchaseBudgetTypeID"] = rowFormPO.PurchaseBudgetTypeID.ToString();
                this.ViewState["CurrencyID"] = rowFormPO.CurrencyID.ToString();

                this.PurchaseTypeDDL.SelectedValue = rowFormPO.PurchaseTypeID.ToString();
                this.ShippingTermDDL.SelectedValue = rowFormPO.ShippingTermID.ToString();
                this.PaymentTermCtl.Text = rowFormPO.IsPaymentTermsNull() ? "" : rowFormPO.PaymentTerms;
                if (!rowFormPO.IsCompanyIDNull()) {
                    this.CompanyDDL.SelectedValue = rowFormPO.CompanyID.ToString();
                }
                this.RemarkCtl.Text = rowFormPO.IsRemarkNull() ? "" : rowFormPO.Remark;
                if (!rowFormPO.IsAttachedFileNameNull())
                    this.UCFileUpload.AttachmentFileName = rowFormPO.AttachedFileName;
                if (!rowFormPO.IsRealAttachedFileNameNull())
                    this.UCFileUpload.RealAttachmentFileName = rowFormPO.RealAttachedFileName;

                this.RealDeliveryAddressCtl.Text = rowFormPO.IsRealDeliveryAddressNull() ? "" : rowFormPO.RealDeliveryAddress;

                new FormPODetailTableAdapter().FillByFormPOID(this.InnerDS.FormPODetail, rowFormPO.FormPOID);
            } else {
                this.DeleteBtn.Visible = false;
                if (Request["ParentFormID"] != null) {
                    this.ViewState["ParentFormID"] = Request["ParentFormID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到申请单,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["PeriodPurchaseID"] != null) {
                    DateTime Period = new MasterDataBLL().GetPeriodPurchaseById(int.Parse(Request["PeriodPurchaseID"].ToString())).PeriodPurchase;
                    this.ViewState["Period"] = Period.ToShortDateString();
                } else {
                    this.Session["ErrorInfor"] = "没有费用期间,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["VendorID"] != null) {
                    this.ViewState["VendorID"] = Request["VendorID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到Vendor,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["ItemCategoryID"] != null) {
                    this.ViewState["ItemCategoryID"] = Request["ItemCategoryID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到Item Category,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["PurchaseBudgetTypeID"] != null) {
                    this.ViewState["PurchaseBudgetTypeID"] = Request["PurchaseBudgetTypeID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到预算类型,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["CurrencyID"] != null) {
                    this.ViewState["CurrencyID"] = Request["CurrencyID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到币种,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }

                this.PeriodCtl.Text = DateTime.Parse(this.ViewState["Period"].ToString()).ToString("yyyy-MM");
                MasterData.VendorRow vendor = new MasterDataBLL().GetVendorByID(int.Parse(this.ViewState["VendorID"].ToString()));
                MasterData.PaymentTermRow paymentTerm = new MasterDataBLL().GetPaymentTermById(vendor.PaymentTermID)[0];
                if (paymentTerm != null && !paymentTerm.IsPaymentTermNameNull()) {
                    this.PaymentTermCtl.Text = paymentTerm.PaymentTermName;
                }
            }
            MasterData.VendorRow vendor1 = new VendorTableAdapter().GetDataByID(int.Parse(this.ViewState["VendorID"].ToString()))[0];
            this.VendorCodeCtl.Text = vendor1.VendorCode;
            this.VendorNameCtl.Text = vendor1.VendorName;
            this.VendorAddressCtl.Text = vendor1.VendorAddress;

            this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(int.Parse(this.ViewState["ItemCategoryID"].ToString()))[0].ItemCategoryName;
            this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(int.Parse(this.ViewState["CurrencyID"].ToString()))[0].CurrencyShortName;
            this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(int.Parse(this.ViewState["PurchaseBudgetTypeID"].ToString()))[0].PurchaseBudgetTypeName;
            this.ViewState["ExchangeRate"] = new MasterDataBLL().GetExchangeRateByPeriod(int.Parse(ViewState["CurrencyID"].ToString()), DateTime.Parse(ViewState["Period"].ToString()));
            if (decimal.Parse(this.ViewState["ExchangeRate"].ToString()) == 0) {
                this.Session["ErrorInfor"] = "未找到汇率,请联系管理员";
                Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
            }
            this.ExchangeRateCtl.Text = this.ViewState["ExchangeRate"].ToString();

            //判断费用期间是否正确
            MasterDataBLL bll = new MasterDataBLL();
            if (!new MasterDataBLL().IsValidPeriodPurchase(DateTime.Parse(this.ViewState["Period"].ToString()))) {
                this.SubmitBtn.Visible = false;
                PageUtility.ShowModelDlg(this, "不允许申请本月项目,请删除草稿并联系财务部!");
                return;
            }
            //申请单编号和申请单金额
            PurchaseDS.FormRow applyFormRow = this.FormPurchaseBLL.GetFormByID(int.Parse(this.ViewState["ParentFormID"].ToString()))[0];
            this.ApplyFormNoCtl.Text = applyFormRow.FormNo;
            this.ViewState["ParentFormNo"] = applyFormRow.FormNo;
            string url = string.Empty;
            switch (applyFormRow.PageType) {
                case (int)SystemEnums.PageType.ActivityApply:
                    url = "/FormSale/ActivityApproval.aspx?ShowDialog=1&ObjectId=" + applyFormRow.FormID;
                    this.ViewState["POType"] = SystemEnums.POType.Sale;
                    this.ViewState["ApplyAmountRMB"] = new FormSaleBLL().GetFormSaleApplyByID(applyFormRow.FormID)[0].AmountRMB;
                    break;
                case (int)SystemEnums.PageType.NoActivityApply:
                    url = "/FormSale/NoActivityApproval.aspx?ShowDialog=1&ObjectId=" + applyFormRow.FormID;
                    this.ViewState["POType"] = SystemEnums.POType.Sale;
                    this.ViewState["ApplyAmountRMB"] = new FormSaleBLL().GetFormSaleApplyByID(applyFormRow.FormID)[0].AmountRMB;
                    break;
                case (int)SystemEnums.PageType.FormMarketingApply:
                    url = "/FormMarketing/MarketingApproval.aspx?ShowDialog=1&ObjectId=" + applyFormRow.FormID;
                    this.ViewState["POType"] = SystemEnums.POType.Marketing;
                    this.ViewState["ApplyAmountRMB"] = new FormMarketingBLL().GetFormMarketingApplyByID(applyFormRow.FormID)[0].AmountRMB;
                    break;
                case (int)SystemEnums.PageType.RDApply:
                    url = "/FormRD/RDApproval.aspx?ShowDialog=1&ObjectId=" + applyFormRow.FormID;
                    this.ViewState["POType"] = SystemEnums.POType.RD;
                    this.ViewState["ApplyAmountRMB"] = new FormRDBLL().GetFormRDApplyByID(applyFormRow.FormID)[0].AmountRMB;
                    break;
            }

            this.ApplyFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + url + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            this.ApplyAmountCtl.Text = this.ViewState["ApplyAmountRMB"].ToString();

        }
    }
Ejemplo n.º 4
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;
            PurchaseDS.FormRow rowForm = this.FormPurchaseBLL.GetFormByID(formID)[0];
            PurchaseDS.FormPRRow rowFormPR = this.FormPurchaseBLL.GetFormPRByID(formID);
            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();

            MasterData.VendorRow vendor = new VendorTableAdapter().GetDataByID(rowFormPR.VendorID)[0];
            this.VendorCodeCtl.Text = vendor.VendorCode;
            this.VendorNameCtl.Text = vendor.VendorName;
            this.VendorAddressCtl.Text = vendor.VendorAddress;
            this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(rowFormPR.ItemCategoryID)[0].ItemCategoryName;
            this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormPR.CurrencyID)[0].CurrencyShortName;
            this.ExchangeRateCtl.Text = rowFormPR.ExchangeRate.ToString();

            this.PeriodCtl.Text = rowFormPR.FPeriod.ToString("yyyy-MM");
            this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(rowFormPR.PurchaseBudgetTypeID)[0].PurchaseBudgetTypeName;
            this.PurchaseTypeCtl.Text = new PurchaseTypeTableAdapter().GetDataByID(rowFormPR.PurchaseTypeID)[0].PurchaseTypeName;
            this.ShippingTermCtl.Text = new ShippingTermTableAdapter().GetDataByID(rowFormPR.ShippingTermID)[0].ShippingTermName;
            this.PaymentTermCtl.Text = rowFormPR.IsPaymentTermsNull() ? "" : rowFormPR.PaymentTerms;
            this.DeliveryAddressCtl.Text = rowFormPR.IsDeliveryAddressNull() ? "" : rowFormPR.DeliveryAddress;
            this.RemarkCtl.Text = rowFormPR.IsRemarkNull() ? "" : rowFormPR.Remark;
            if (!rowFormPR.IsAttachedFileNameNull())
                this.UCFileUpload.AttachmentFileName = rowFormPR.AttachedFileName;
            if (!rowFormPR.IsRealAttachedFileNameNull())
                this.UCFileUpload.RealAttachmentFileName = rowFormPR.RealAttachedFileName;
            this.RealDeliveryAddressCtl.Text = rowFormPR.IsRealDeliveryAddressNull() ? "" : rowFormPR.RealDeliveryAddress;
            this.IsCloseCtl.Checked = rowFormPR.IsClose;
            //历史单据
            if (rowForm.IsRejectedFormIDNull()) {
                lblRejectFormNo.Text = "无";
            } else {
                PurchaseDS.FormRow rejectedForm = this.FormPurchaseBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/PRApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            this.TotalBudgetCtl.Text = rowFormPR.TotalBudget.ToString("N");
            this.ApprovedAmountCtl.Text = rowFormPR.ApprovedAmount.ToString("N");
            this.ApprovingAmountCtl.Text = rowFormPR.ApprovingAmount.ToString("N");
            this.ReimbursedAmountCtl.Text = rowFormPR.ReimbursedAmount.ToString("N");
            this.NonReimbursedAmountCtl.Text = rowFormPR.NonReimbursedAmount.ToString("N");
            this.RemainBudgetCtl.Text = rowFormPR.RemainBudget.ToString("N");

            //明细
            this.odsDetails.SelectParameters["FormPRID"].DefaultValue = rowFormPR.FormPRID.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;
            }

            //是否显示报销完成按钮
            this.CloseBtn.Visible = false;
            if ((!rowFormPR.IsClose) && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) {
                if (stuffUser.StuffUserId == rowForm.UserID || new AuthorizationBLL().GetProxyReimburseByParameter(rowForm.UserID, stuffUser.StuffUserId, rowForm.SubmitDate).Count > 0) {
                    this.CloseBtn.Visible = true;
                }
            }

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null) {
                if (this.Request["ShowDialog"].ToString() == "1") {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }
            //单据打印
            this.ucPrint.FormID = rowForm.FormID;
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
Ejemplo n.º 5
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"];
            if (new StuffUserBLL().GetCostCenterIDByPositionID(rowUserPosition.PositionId) == 0) {
                this.Session["ErrorInfor"] = "未找到成本中心,请联系管理员";
                Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
            }
            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());
            }
            VATRateDDL.DataBind();
            //如果是草稿进行赋值
            if (Request["ObjectId"] != null) {
                this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]);
                if (this.Request["RejectObjectID"] == null) {
                    this.DeleteBtn.Visible = true;
                } else {
                    this.DeleteBtn.Visible = false;
                }
                OpenForm(int.Parse(this.ViewState["ObjectId"].ToString()));
            } else {
                this.DeleteBtn.Visible = false;
                if (Request["PeriodPurchaseID"] != null) {
                    DateTime Period = new MasterDataBLL().GetPeriodPurchaseById(int.Parse(Request["PeriodPurchaseID"].ToString())).PeriodPurchase;
                    this.ViewState["Period"] = Period.ToShortDateString();
                } else {
                    this.Session["ErrorInfor"] = "没有费用期间,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["VendorID"] != null) {
                    this.ViewState["VendorID"] = Request["VendorID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到Vendor,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["ItemCategoryID"] != null) {
                    this.ViewState["ItemCategoryID"] = Request["ItemCategoryID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到Item Category,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["PurchaseBudgetTypeID"] != null) {
                    this.ViewState["PurchaseBudgetTypeID"] = Request["PurchaseBudgetTypeID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到预算类型,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                if (Request["CurrencyID"] != null) {
                    this.ViewState["CurrencyID"] = Request["CurrencyID"];
                } else {
                    this.Session["ErrorInfor"] = "未找到币种,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }

                this.PeriodCtl.Text = DateTime.Parse(this.ViewState["Period"].ToString()).ToString("yyyy-MM");
                this.PaymentTermCtl.Text = new MasterDataBLL().GetPaymentTermById(new VendorTableAdapter().GetDataByID(int.Parse(this.ViewState["VendorID"].ToString()))[0].PaymentTermID)[0].PaymentTermName;

            }
            MasterData.VendorRow vendor = new VendorTableAdapter().GetDataByID(int.Parse(this.ViewState["VendorID"].ToString()))[0];
            this.VendorCodeCtl.Text = vendor.VendorCode;
            this.VendorNameCtl.Text = vendor.VendorName;
            this.VendorAddressCtl.Text = vendor.VendorAddress;
            this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(int.Parse(this.ViewState["ItemCategoryID"].ToString()))[0].ItemCategoryName;
            this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(int.Parse(this.ViewState["CurrencyID"].ToString()))[0].CurrencyShortName;
            this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(int.Parse(this.ViewState["PurchaseBudgetTypeID"].ToString()))[0].PurchaseBudgetTypeName;

            this.ViewState["ExchangeRate"] = new MasterDataBLL().GetExchangeRateByPeriod(int.Parse(ViewState["CurrencyID"].ToString()), DateTime.Parse(ViewState["Period"].ToString()));
            if (decimal.Parse( this.ViewState["ExchangeRate"].ToString()) == 0) {
                this.Session["ErrorInfor"] = "未找到汇率,请联系管理员";
                Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
            }
            this.ExchangeRateCtl.Text = this.ViewState["ExchangeRate"].ToString();

            //判断费用期间是否正确
            MasterDataBLL bll = new MasterDataBLL();
            if (!new MasterDataBLL().IsValidPeriodPurchase(DateTime.Parse(this.ViewState["Period"].ToString()))) {
                this.SubmitBtn.Visible = false;
                PageUtility.ShowModelDlg(this, "不允许申请本月的PV,请删除草稿并联系财务部!");
                return;
            }

            //预算信息
            decimal[] calculateAssistant = new decimal[6];
            calculateAssistant = new BudgetBLL().GetManagingBudgetByParameter(rowUserPosition.PositionId, DateTime.Parse(ViewState["Period"].ToString()), int.Parse(this.ViewState["PurchaseBudgetTypeID"].ToString()));
            this.TotalBudgetCtl.Text = calculateAssistant[0].ToString("N");
            this.ApprovedAmountCtl.Text = calculateAssistant[1].ToString("N");
            this.ApprovingAmountCtl.Text = calculateAssistant[2].ToString("N");
            this.ReimbursedAmountCtl.Text = calculateAssistant[3].ToString("N");
            this.NonReimbursedAmountCtl.Text = calculateAssistant[4].ToString("N");
            this.RemainBudgetCtl.Text = calculateAssistant[5].ToString("N");

        }
        VATRateDDL_SelectedIndexChanged(null, null);
        //隐藏预算信息,若需要则隐藏
    }
Ejemplo n.º 6
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;
            PurchaseDS.FormRow rowForm = this.FormPurchaseBLL.GetFormByID(formID)[0];
            PurchaseDS.FormPVRow rowFormPV = this.FormPurchaseBLL.GetFormPVByID(formID);
            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();

            MasterData.VendorRow vendor = new VendorTableAdapter().GetDataByID(rowFormPV.VendorID)[0];
            this.VendorCodeCtl.Text = vendor.VendorCode;
            this.VendorNameCtl.Text = vendor.VendorName;
            this.VendorAddressCtl.Text = vendor.VendorAddress;
            this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(rowFormPV.ItemCategoryID)[0].ItemCategoryName;
            this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormPV.CurrencyID)[0].CurrencyShortName;
            this.ExchangeRateCtl.Text = rowFormPV.ExchangeRate.ToString();
            this.PeriodCtl.Text = rowFormPV.FPeriod.ToString("yyyy-MM");
            this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(rowFormPV.PurchaseBudgetTypeID)[0].PurchaseBudgetTypeName;
            this.PurchaseTypeCtl.Text = new PurchaseTypeTableAdapter().GetDataByID(rowFormPV.PurchaseTypeID)[0].PurchaseTypeName;
            MasterData.MethodPaymentRow MethodPayment = new MasterDataBLL().GetMethodPaymentById(rowFormPV.MethodPaymentID)[0];
            this.MethodPaymentCtl.Text = MethodPayment.MethodPaymentName + "-" + MethodPayment.Description;
            this.ExpectPaymentDateCtl.Text = rowFormPV.ExpectPaymentDate.ToString("yyyy-MM-dd");
            this.IsUrgentCtl.Text = rowFormPV.IsUrgent ? "Yes" : "No";
            this.IsPublicCtl.Text = rowFormPV.IsPublic ? "Yes" : "No";
            this.InvoiceStatusCtl.Text = new InvoiceStatusTableAdapter().GetDataByID(rowFormPV.InvoiceStatusID)[0].Name;
            this.VATRateCtl.Text = new MasterDataBLL().GetVatTypeById(rowFormPV.VatRateID)[0].VatTypeName;
            this.AMTTaxCtl.Text = rowFormPV.AMTTax.ToString("N");
            //payment term label名称
            if (!rowFormPV.IsIsPTChangedNull() && rowFormPV.IsPTChanged) {
                this.Form_PaymentTerms.Text = Resources.Common.Form_PaymentTerms + "(Changed)";
                this.Form_PaymentTerms.ForeColor = System.Drawing.Color.Red;
            } else {
                this.Form_PaymentTerms.Text = Resources.Common.Form_PaymentTerms;
            }
            this.PaymentTermCtl.Text = rowFormPV.PaymentTerms;
            this.PaymentAmountCtl.Text = rowForm.IsPaymentAmountNull() ? "" : rowForm.PaymentAmount.ToString("N");
            this.PaymentDateCtl.Text = rowForm.IsPaymentDateNull() ? "" : rowForm.PaymentDate.ToShortDateString();

            //历史单据
            if (rowForm.IsRejectedFormIDNull()) {
                lblRejectFormNo.Text = "无";
            } else {
                PurchaseDS.FormRow rejectedForm = this.FormPurchaseBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/PVSpecialApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }
            this.RemarkCtl.Text = rowFormPV.IsRemarkNull() ? "" : rowFormPV.Remark;
            if (!rowFormPV.IsAttachedFileNameNull())
                this.UCFileUpload.AttachmentFileName = rowFormPV.AttachedFileName;
            if (!rowFormPV.IsRealAttachedFileNameNull())
                this.UCFileUpload.RealAttachmentFileName = rowFormPV.RealAttachedFileName;

            //发票明细
            this.odsInvoice.SelectParameters["FormID"].DefaultValue = rowFormPV.FormPVID.ToString();
            this.odsDetails.SelectParameters["FormPVID"].DefaultValue = rowFormPV.FormPVID.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 (rowFormPV.InvoiceStatusID != (int)SystemEnums.InvoiceStatus.Yes && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) {
                this.odsInvoiceReverse.SelectParameters["FormID"].DefaultValue = rowForm.FormID.ToString();
                if (((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId != rowForm.UserID) {
                    this.fvInvoiceReverse.Visible = false;
                }
            } else {
                this.reverseDIV.Visible = false;
                this.upReverse.Visible = false;
            }
            this.ViewState["ApplicantID"] = rowForm.UserID;
            int opInvoiceReverseManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.InvoiceReverse, SystemEnums.OperateEnum.Manage);
            AuthorizationDS.PositionRow ViewerPosition = (AuthorizationDS.PositionRow)this.Session["Position"];
            this.HasApproveRight = new PositionRightBLL().CheckPositionRight(ViewerPosition.PositionId, opInvoiceReverseManageId);

            //判断财务摘要的显示问题
            if (!rowForm.IsFinanceRemarkNull()) {
                this.FinanceRemarkCtl.Text = rowForm.FinanceRemark;
            }
            this.UCItemCategory.ItemCategoryID = rowFormPV.FinalItemCategoryID.ToString();

            int opViewId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FinanceRemark, SystemEnums.OperateEnum.View);
            int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FinanceRemark, SystemEnums.OperateEnum.Manage);
            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;
                this.UCItemCategory.IsVisible = "display:none";
            }
            //如果没有填写的权限或者已经导出锁定了,则隐藏保存按钮
            if (HasViewRight && (!HasManageRight || (!rowForm.IsIsExportLockNull() && rowForm.IsExportLock))) {
                this.FinanceRemarkCtl.ReadOnly = true;
                this.SaveBtn.Visible = false;
                this.UCItemCategory.IsVisible = "display:none";
            }
            //如果不是审批中或者审批完成不能修改
            if (rowForm.StatusID != 1 && rowForm.StatusID != 2) {
                this.FinanceRemarkCtl.ReadOnly = true;
                this.SaveBtn.Visible = false;
                this.UCItemCategory.IsVisible = "display:none";
            }
            //单据打印
            this.ucPrint.FormID = rowForm.FormID;
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
Ejemplo n.º 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"];

            if (new StuffUserBLL().GetCostCenterIDByPositionID(rowUserPosition.PositionId) == 0) {
                this.Session["ErrorInfor"] = "未找到成本中心,请联系管理员";
                Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
            }
            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());
            }

            PurchaseDS.FormRow rowForm ;
            PurchaseDS.FormPRRow rowFormPR ;
            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;
                }
                PurchaseDS.FormPORow rowFormPO = this.FormPurchaseBLL.GetFormPOByID(int.Parse(this.ViewState["ObjectId"].ToString()));
                this.ViewState["ParentFormID"] = rowFormPO.ParentFormID;
                rowForm = this.FormPurchaseBLL.GetFormByID(rowFormPO.ParentFormID)[0];
                rowFormPR = this.FormPurchaseBLL.GetFormPRByID(rowFormPO.ParentFormID);

                this.ShippingTermDDL.SelectedValue = rowFormPO.ShippingTermID.ToString();
                this.PaymentTermCtl.Text = rowFormPO.IsPaymentTermsNull() ? "" : rowFormPO.PaymentTerms;
                this.CompanyDDL.SelectedValue = rowFormPO.CompanyID.ToString();
                this.RemarkCtl.Text = rowFormPO.IsRemarkNull() ? "" : rowFormPO.Remark;
                if (!rowFormPO.IsAttachedFileNameNull())
                    this.UCFileUpload.AttachmentFileName = rowFormPO.AttachedFileName;
                if (!rowFormPO.IsRealAttachedFileNameNull())
                    this.UCFileUpload.RealAttachmentFileName = rowFormPO.RealAttachedFileName;
                this.RealDeliveryAddressCtl.Text = rowFormPO.IsRealDeliveryAddressNull() ? "" : rowFormPO.RealDeliveryAddress;
                new FormPODetailTableAdapter().FillByFormPOID(this.InnerDS.FormPODetail, rowFormPO.FormPOID);
                //如果是草稿,那么就根据草稿的ischanged判断是否改变过
                this.ViewState["IsChanged"] = rowFormPO.IsChanged;
            } else {
                this.DeleteBtn.Visible = false;
                if (Request["ParentFormID"] != null) {
                    this.ViewState["ParentFormID"] = Request["ParentFormID"];
                } else {
                    this.Session["ErrorInfor"] = "没有找到PR,请联系管理员";
                    Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
                }
                rowForm = this.FormPurchaseBLL.GetFormByID(int.Parse(this.ViewState["ParentFormID"].ToString()))[0];
                rowFormPR = this.FormPurchaseBLL.GetFormPRByID(int.Parse(this.ViewState["ParentFormID"].ToString()));

                this.ShippingTermDDL.SelectedValue = rowFormPR.ShippingTermID.ToString();
                this.PaymentTermCtl.Text = rowFormPR.IsPaymentTermsNull() ? "" : rowFormPR.PaymentTerms;
                this.CompanyDDL.SelectedValue = rowFormPR.CompanyID.ToString();
                this.RealDeliveryAddressCtl.Text = rowFormPR.IsRealDeliveryAddressNull() ? "" : rowFormPR.RealDeliveryAddress;
                new FormPODetailTableAdapter().FillByPRID(this.InnerDS.FormPODetail, int.Parse(this.ViewState["ParentFormID"].ToString()));
                //如果是新建,那么首先赋值为没有改变
                if (this.ViewState["IsChanged"] == null) {
                    this.ViewState["IsChanged"] = false;
                }
            }
            this.FormNoCtl.Text = rowForm.FormNo;
            this.FormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/PRApproval.aspx?ShowDialog=1&ObjectId=" + rowForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            MasterData.VendorRow vendor = new VendorTableAdapter().GetDataByID(rowFormPR.VendorID)[0];
            this.VendorCodeCtl.Text = vendor.VendorCode;
            this.VendorNameCtl.Text = vendor.VendorName;
            this.VendorAddressCtl.Text = vendor.VendorAddress;
            this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(rowFormPR.ItemCategoryID)[0].ItemCategoryName;
            this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormPR.CurrencyID)[0].CurrencyShortName;
            this.ExchangeRateCtl.Text = rowFormPR.ExchangeRate.ToString();
            this.ViewState["ExchangeRate"] = rowFormPR.ExchangeRate;
            this.PeriodCtl.Text = rowFormPR.FPeriod.ToString("yyyy-MM");
            this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(rowFormPR.PurchaseBudgetTypeID)[0].PurchaseBudgetTypeName;
            this.PurchaseTypeCtl.Text = new PurchaseTypeTableAdapter().GetDataByID(rowFormPR.PurchaseTypeID)[0].PurchaseTypeName;
            this.PRAmountCtl.Text = rowFormPR.AmountRMB.ToString("N");
            this.ViewState["ItemCategoryID"] = rowFormPR.ItemCategoryID;
        }
    }
Ejemplo n.º 8
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"];
            if (new StuffUserBLL().GetCostCenterIDByPositionID(rowUserPosition.PositionId) == 0) {
                this.Session["ErrorInfor"] = "未找到成本中心,请联系管理员";
                Response.Redirect("~/ErrorPage/SystemErrorPage.aspx");
            }
            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());
            }
            VATRateDDL.DataBind();
            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;
                }
                PurchaseDS.FormPVRow rowFormPV = this.FormPurchaseBLL.GetFormPVByID(int.Parse(this.ViewState["ObjectId"].ToString()));
                this.ViewState["PVType"] = rowFormPV.PVType;

                this.PeriodCtl.Text = rowFormPV.FPeriod.ToString("yyyy-MM");
                MasterData.VendorRow vendor = new VendorTableAdapter().GetDataByID(rowFormPV.VendorID)[0];
                this.VendorCodeCtl.Text = vendor.VendorCode;
                this.VendorNameCtl.Text = vendor.VendorName;
                this.VendorAddressCtl.Text = vendor.VendorAddress;
                this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(rowFormPV.ItemCategoryID)[0].ItemCategoryName;
                this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormPV.CurrencyID)[0].CurrencyShortName;
                this.ExchangeRateCtl.Text = rowFormPV.ExchangeRate.ToString();
                this.ViewState["ExchangeRate"] = rowFormPV.ExchangeRate;
                this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(rowFormPV.PurchaseBudgetTypeID)[0].PurchaseBudgetTypeName;
                this.PurchaseTypeCtl.Text = new PurchaseTypeTableAdapter().GetDataByID(rowFormPV.PurchaseTypeID)[0].PurchaseTypeName;
                this.ParentFormNoCtl.Text = rowFormPV.ParentFormNo.ToString();
                this.ViewState["ParentFormNo"] = rowFormPV.ParentFormNo.ToString();
                this.ShippingTermCtl.Text = new ShippingTermTableAdapter().GetDataByID(rowFormPV.ShippingTermID)[0].ShippingTermName;
                this.PaymentTermCtl.Text = rowFormPV.PaymentTerms;
                this.RealDeliveryAddressCtl.Text = rowFormPV.RealDeliveryAddress;
                this.ApplyAmountCtl.Text = rowFormPV.ApplyAmount.ToString("N");
                if (rowFormPV.PVType == (int)SystemEnums.PVType.PR) {
                    this.ViewState["ParentFormID"] = rowFormPV.FormPRID;
                    this.ParentFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/PRApproval.aspx?ShowDialog=1&ObjectId=" + rowFormPV.FormPRID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
                    this.PayedAmountCtl.Text = this.FormPurchaseBLL.GetReimbursedPVAmountByPRID(rowFormPV.FormPRID).ToString("N");
                    new FormPRPODetailViewTableAdapter().FillByPRID(this.InnerDS.FormPRPODetailView, rowFormPV.FormPRID);
                } else {
                    this.ViewState["ParentFormID"] = rowFormPV.FormPOID;
                    this.ParentFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/POApproval.aspx?ShowDialog=1&ObjectId=" + rowFormPV.FormPOID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
                    this.PayedAmountCtl.Text = this.FormPurchaseBLL.GetReimbursedPVAmountByPOID(rowFormPV.FormPOID).ToString("N");
                    new FormPRPODetailViewTableAdapter().FillByPOID(this.InnerDS.FormPRPODetailView, rowFormPV.FormPOID);
                }
                //PV本身的
                this.MethodPaymentDDL.SelectedValue = rowFormPV.MethodPaymentID.ToString();
                if (!rowFormPV.IsExpectPaymentDateNull()) {
                    UCExpectPaymentDateCtl.SelectedDate = rowFormPV.ExpectPaymentDate.ToString("yyyy-MM-dd");
                }
                this.IsUrgentDDL.SelectedValue = rowFormPV.IsUrgent ? "1" : "0";
                this.IsPublicDDL.SelectedValue = rowFormPV.IsPublic ? "1" : "0";
                this.InvoiceStatusDDL.SelectedValue = rowFormPV.InvoiceStatusID.ToString();
                this.RemarkCtl.Text = rowFormPV.IsRemarkNull() ? "" : rowFormPV.Remark;
                if (!rowFormPV.IsAttachedFileNameNull())
                    this.UCFileUpload.AttachmentFileName = rowFormPV.AttachedFileName;
                if (!rowFormPV.IsRealAttachedFileNameNull())
                    this.UCFileUpload.RealAttachmentFileName = rowFormPV.RealAttachedFileName;

                this.AMTBeforeTaxCtl.Text = rowFormPV.AMTBeforeTax.ToString();
                this.AMTTaxCtl.Text = rowFormPV.AMTTax.ToString();
                this.AmountCtl.Text = rowFormPV.Amount.ToString("N");
                this.AmountRMBCtl.Text = rowFormPV.AmountRMB.ToString("N");
                if (!rowFormPV.IsVatRateIDNull()) {
                    this.VATRateDDL.SelectedValue = rowFormPV.VatRateID.ToString();
                }
                //invoice 明细
                new FormInvoiceTableAdapter().FillByFormID(this.InnerDS.FormInvoice, rowFormPV.FormPVID);

            } else {
                this.DeleteBtn.Visible = false;
                this.ViewState["PVType"] = Request["PVType"];
                this.ViewState["ParentFormID"] = Request["ParentFormID"];
                this.ViewState["ParentFormNo"] = Request["ParentFormNo"];
                PurchaseDS.FormPRRow rowFormPR;
                PurchaseDS.FormPORow rowFormPO;

                //如果是PR类
                if (int.Parse(Request["PVType"].ToString()) == (int)SystemEnums.PVType.PR) {
                    rowFormPR = this.FormPurchaseBLL.GetFormPRByID(int.Parse(this.ViewState["ParentFormID"].ToString()));
                    this.ShippingTermCtl.Text = new ShippingTermTableAdapter().GetDataByID(rowFormPR.ShippingTermID)[0].ShippingTermName;
                    this.PaymentTermCtl.Text = rowFormPR.PaymentTerms;
                    this.RealDeliveryAddressCtl.Text = rowFormPR.IsRealDeliveryAddressNull() ? "" : rowFormPR.RealDeliveryAddress;
                    this.ParentFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/PRApproval.aspx?ShowDialog=1&ObjectId=" + rowFormPR.FormPRID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
                    this.ApplyAmountCtl.Text = rowFormPR.AmountRMB.ToString("N");
                    this.PayedAmountCtl.Text = this.FormPurchaseBLL.GetReimbursedPVAmountByPRID(rowFormPR.FormPRID).ToString("N");
                    //明细
                    new FormPRPODetailViewTableAdapter().FillByPRID(this.InnerDS.FormPRPODetailView, rowFormPR.FormPRID);
                } else {
                    rowFormPO = this.FormPurchaseBLL.GetFormPOByID(int.Parse(this.ViewState["ParentFormID"].ToString()));
                    rowFormPR = this.FormPurchaseBLL.GetFormPRByID(rowFormPO.ParentFormID);
                    this.ShippingTermCtl.Text = new ShippingTermTableAdapter().GetDataByID(rowFormPO.ShippingTermID)[0].ShippingTermName;
                    this.PaymentTermCtl.Text = rowFormPO.PaymentTerms;
                    this.RealDeliveryAddressCtl.Text = rowFormPO.IsRealDeliveryAddressNull() ? "" : rowFormPO.RealDeliveryAddress;
                    this.ParentFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/POApproval.aspx?ShowDialog=1&ObjectId=" + rowFormPO.FormPOID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
                    this.ApplyAmountCtl.Text = rowFormPO.AmountRMB.ToString("N");
                    this.PayedAmountCtl.Text = this.FormPurchaseBLL.GetReimbursedPVAmountByPOID(rowFormPO.FormPOID).ToString("N");
                    //明细
                    new FormPRPODetailViewTableAdapter().FillByPOID(this.InnerDS.FormPRPODetailView, rowFormPO.FormPOID);
                }
                this.PeriodCtl.Text = rowFormPR.FPeriod.ToString("yyyy-MM");
                MasterData.VendorRow vendor = new VendorTableAdapter().GetDataByID(rowFormPR.VendorID)[0];
                this.VendorCodeCtl.Text = vendor.VendorCode;
                this.VendorNameCtl.Text = vendor.VendorName;
                this.VendorAddressCtl.Text = vendor.VendorAddress;
                this.ItemCategoryCtl.Text = new ItemCategoryTableAdapter().GetDataByID(rowFormPR.ItemCategoryID)[0].ItemCategoryName;
                this.CurrencyCtl.Text = new CurrencyTableAdapter().GetDataByID(rowFormPR.CurrencyID)[0].CurrencyShortName;
                this.ExchangeRateCtl.Text = rowFormPR.ExchangeRate.ToString();
                this.ViewState["ExchangeRate"] = rowFormPR.ExchangeRate;
                this.PurchaseBudgetTypeCtl.Text = new PurchaseBudgetTypeTableAdapter().GetDataByID(rowFormPR.PurchaseBudgetTypeID)[0].PurchaseBudgetTypeName;
                this.PurchaseTypeCtl.Text = new PurchaseTypeTableAdapter().GetDataByID(rowFormPR.PurchaseTypeID)[0].PurchaseTypeName;
                this.ParentFormNoCtl.Text = this.ViewState["ParentFormNo"].ToString();
            }
            VATRateDDL_SelectedIndexChanged(null, null);
        }
        this.AMTBeforeTaxCtl.Attributes.Add("onchange", "ParameterChanged('" + AMTBeforeTaxCtl.ClientID + "','" + AMTTaxCtl.ClientID + "','" + AmountCtl.ClientID + "','" + AmountRMBCtl.ClientID + "','" + this.ViewState["ExchangeRate"].ToString() + "')");
        this.AMTTaxCtl.Attributes.Add("onchange", "ParameterChanged('" + AMTBeforeTaxCtl.ClientID + "','" + AMTTaxCtl.ClientID + "','" + AmountCtl.ClientID + "','" + AmountRMBCtl.ClientID + "','" + this.ViewState["ExchangeRate"].ToString() + "')");
    }