예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案报销审批");
            this.Page.Title = "方案报销审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow          rowForm          = this.SalesReimburseBLL.GetFormByID(formID)[0];
            FormDS.FormReimburseRow rowFormReimburse = this.SalesReimburseBLL.GetFormReimburseByID(formID)[0];
            //如果单据没有审批完成的话,是不能录入或者查看发货信息的
            if (rowForm.StatusID != (int)SystemEnums.FormStatus.ApproveCompleted)
            {
                this.gvSKUDetails.Columns[6].Visible           = false;
                this.gvSKUDetails.Columns[5].HeaderStyle.Width = 400;
                this.DeliveryDIV.Visible = false;
                this.upDelivery.Visible  = false;
            }
            if (this.gvSKUDetails.SelectedIndex < 0)
            {
                this.fvDelievery.Visible = false;
            }
            //如果没有修改权限的话那么不能新增和删除
            int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.DeliveryInfo, SystemEnums.OperateEnum.Manage);
            AuthorizationDS.PositionRow position         = (AuthorizationDS.PositionRow) this.Session["Position"];
            PositionRightBLL            positionRightBLL = new PositionRightBLL();
            this.HasManageRight = positionRightBLL.CheckPositionRight(position.PositionId, opManageId);

            //流程ID
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            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();
            MasterDataBLL   masterBll = new MasterDataBLL();
            ERS.CustomerRow customer  = masterBll.GetCustomerById(rowFormReimburse.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.PaymentTypeCtl.Text  = masterBll.GetPaymentTypeById(rowFormReimburse.PaymentTypeID).PaymentTypeName;
            if (!rowFormReimburse.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormReimburse.Remark;
            }
            if (!rowFormReimburse.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormReimburse.AttachedFileName;
            }
            if (!rowFormReimburse.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormReimburse.RealAttachedFileName;
            }

            this.odsSKUDetails.SelectParameters["FormReimburseID"].DefaultValue       = rowFormReimburse.FormReimburseID.ToString();
            this.odsReimburseDetails.SelectParameters["FormReimburseID"].DefaultValue = rowFormReimburse.FormReimburseID.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 (rowForm.IsRejectedFormIDNull())
            {
                lblRejectFormNo.Text = "无";
            }
            else
            {
                FormDS.FormRow rejectedForm = this.SalesReimburseBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text        = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/OtherForm/ReimburseGoodsApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //如果是弹出,按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.gvSKUDetails.Columns[6].Visible             = false;
                    this.gvSKUDetails.Columns[5].HeaderStyle.Width   = 400;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }

            //发货完成按钮权限
            opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.DeliveryComplete, SystemEnums.OperateEnum.Other);
            position   = (AuthorizationDS.PositionRow) this.Session["Position"];
            if (positionRightBLL.CheckPositionRight(position.PositionId, opManageId) && (rowFormReimburse.IsIsDeliveryCompleteNull() || rowFormReimburse.IsDeliveryComplete == false))
            {
                this.btnDeliveryComplete.Visible = true;
            }
            else
            {
                this.btnDeliveryComplete.Visible = false;
                //this.gvDelivery.Visible = false;
                //this.gvSKUDetails.Columns[6].Visible=false;
                //this.gvSKUDetails.Columns[5].ItemStyle.Width = 400;
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案报销审批");
            this.Page.Title = "方案报销审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow          rowForm          = this.SalesReimburseBLL.GetFormByID(formID)[0];
            FormDS.FormReimburseRow rowFormReimburse = this.SalesReimburseBLL.GetFormReimburseByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            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();
            MasterDataBLL   masterBll = new MasterDataBLL();
            ERS.CustomerRow customer  = masterBll.GetCustomerById(rowFormReimburse.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.PaymentTypeCtl.Text  = masterBll.GetPaymentTypeById(rowFormReimburse.PaymentTypeID).PaymentTypeName;
            if (!rowFormReimburse.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormReimburse.Remark;
            }
            if (!rowFormReimburse.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormReimburse.AttachedFileName;
            }
            if (!rowFormReimburse.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormReimburse.RealAttachedFileName;
            }

            this.odsInvoice.SelectParameters["FormReimburseID"].DefaultValue          = rowFormReimburse.FormReimburseID.ToString();
            this.odsReimburseDetails.SelectParameters["FormReimburseID"].DefaultValue = rowFormReimburse.FormReimburseID.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 (!rowFormReimburse.IsPaymentDateNull())
            {
                this.txtPaymentDate.Text        = rowFormReimburse.PaymentDate.ToString("yyyy-MM-dd");
                this.ucPaymentDate.SelectedDate = rowFormReimburse.PaymentDate.ToString("yyyy-MM-dd");
            }


            AuthorizationDS.PositionRow position         = (AuthorizationDS.PositionRow) this.Session["Position"];
            PositionRightBLL            positionRightBLL = new PositionRightBLL();
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && positionRightBLL.CheckPositionRight(position.PositionId, (int)SystemEnums.OperateEnum.Other + (int)SystemEnums.BusinessUseCase.FormReimburse))
            {
                this.txtPaymentDate.Visible     = false;
                this.ucPaymentDate.Visible      = true;
                this.btnSavePaymentInfo.Visible = true;
            }

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

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }
        }

        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案报销");
            this.Page.Title = "方案报销";
            // 用户信息,职位信息
            AuthorizationDS.StuffUserRow stuffUser       = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            AuthorizationDS.PositionRow  rowUserPosition = (AuthorizationDS.PositionRow)Session["Position"];
            this.ViewState["StuffUserID"]  = stuffUser.StuffUserId;
            this.ViewState["PositionID"]   = rowUserPosition.PositionId;
            this.ViewState["FlowTemplate"] = new AuthorizationBLL().GetFlowTemplate((int)SystemEnums.BusinessUseCase.FormReimburse, stuffUser.StuffUserId);

            this.StuffNameCtl.Text         = stuffUser.StuffName;
            this.PositionNameCtl.Text      = rowUserPosition.PositionName;
            this.DepartmentNameCtl.Text    = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName;
            this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId;
            this.AttendDateCtl.Text        = stuffUser.AttendDate.ToShortDateString();
            if (this.Request["RejectObjectID"] != null)
            {
                this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString());
            }
            FormReimburseDetailTableAdapter taDetail = new FormReimburseDetailTableAdapter();

            //如果是草稿进行赋值
            if (Request["ObjectId"] != null)
            {
                this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]);
                FormDS.FormReimburseRow rowFormReimbuese = this.SalesReimburseBLL.GetFormReimburseByID(int.Parse(this.ViewState["ObjectId"].ToString()))[0];
                if (this.Request["RejectObjectID"] == null)
                {
                    this.DeleteBtn.Visible = true;
                }
                else
                {
                    this.DeleteBtn.Visible = false;
                }
                this.ViewState["PaymentTypeID"] = rowFormReimbuese.PaymentTypeID;
                this.ViewState["CustomerID"]    = rowFormReimbuese.CustomerID;
                this.ViewState["FormApplyIds"]  = rowFormReimbuese.FormApplyIds;
                this.ViewState["FormApplyNos"]  = rowFormReimbuese.FormApplyNos;

                if (!rowFormReimbuese.IsRemarkNull())
                {
                    this.RemarkCtl.Text = rowFormReimbuese.Remark;
                }
                if (!rowFormReimbuese.IsAttachedFileNameNull())
                {
                    this.UCFileUpload.AttachmentFileName = rowFormReimbuese.AttachedFileName;
                }
                if (!rowFormReimbuese.IsRealAttachedFileNameNull())
                {
                    this.UCFileUpload.RealAttachmentFileName = rowFormReimbuese.RealAttachedFileName;
                }
                new FormReimburseInvoiceTableAdapter().FillByFormReimburseID(this.InnerDS.FormReimburseInvoice, rowFormReimbuese.FormReimburseID);
                // 填写明细表,如果是票扣的话那么写入方法不一样
                if (int.Parse(this.ViewState["PaymentTypeID"].ToString()) == (int)SystemEnums.PaymentType.PiaoKou)
                {
                    taDetail.FillFromPKRecordByApplyNos(this.InnerDS.FormReimburseDetail, this.ViewState["FormApplyNos"].ToString());
                }
                else
                {
                    taDetail.FillCurrentDataByFormReimburseID(this.InnerDS.FormReimburseDetail, rowFormReimbuese.FormReimburseID);
                }
            }
            else
            {
                this.DeleteBtn.Visible = false;
                if (Request["PaymentTypeID"] != null)
                {
                    this.ViewState["PaymentTypeID"] = Request["PaymentTypeID"];
                }
                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["FormApplyIds"] != null)
                {
                    this.ViewState["FormApplyIds"] = Request["FormApplyIds"];
                }
                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");
                }
                // 填写明细表,如果是票扣的话那么写入方法不一样
                if (int.Parse(this.ViewState["PaymentTypeID"].ToString()) == (int)SystemEnums.PaymentType.PiaoKou)
                {
                    taDetail.FillFromPKRecordByApplyNos(this.InnerDS.FormReimburseDetail, this.ViewState["FormApplyNos"].ToString());
                }
                else
                {
                    taDetail.FillByFormApplyIds(this.InnerDS.FormReimburseDetail, this.ViewState["FormApplyIds"].ToString());
                }
            }
            ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString()));
            this.CustomerNameCtl.Text         = customer.CustomerName;
            this.PaymentTypeDDL.SelectedValue = this.ViewState["PaymentTypeID"].ToString();

            if (Session["ProxyStuffUserId"] != null)
            {
                this.SubmitBtn.Visible = false;
            }
        }
    }