示例#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.PersonalReimburseBLL.GetFormByID(formID)[0];
            FormDS.FormPersonalReimburseRow rowPersonalReimburse = this.PersonalReimburseBLL.GetFormPersonalReimburseByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            //对控件进行赋值
            this.txtFormNo.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();
            this.txtPeriod.Text     = rowPersonalReimburse.Period.ToString("yyyyMM");
            if (!rowPersonalReimburse.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowPersonalReimburse.Remark;
            }

            //出差申请信息
            FormDS.FormTravelApplyRow rowTravelApply = this.PersonalReimburseBLL.GetFormTravelApplyByID(rowPersonalReimburse.FormTravelApplyID);
            if (!rowTravelApply.IsTransportFeeNull())
            {
                this.txtTransportFee.Text = rowTravelApply.TransportFee.ToString("N");
            }
            if (!rowTravelApply.IsHotelFeeNull())
            {
                this.txtHotelFee.Text = rowTravelApply.HotelFee.ToString("N");
            }
            if (!rowTravelApply.IsMealFeeNull())
            {
                this.txtMealFee.Text = rowTravelApply.MealFee.ToString("N");
            }
            if (!rowTravelApply.IsOtherFeeNull())
            {
                this.txtOtherFee.Text = rowTravelApply.OtherFee.ToString("N");
            }
            if (!rowTravelApply.IsTotalFeeNull())
            {
                this.txtTotal.Text = rowTravelApply.TotalFee.ToString("N");
            }
            //赋值
            if (!rowTravelApply.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowTravelApply.Remark;
            }

            FormDS.FormRow rowApplyForm = PersonalReimburseBLL.GetFormByID(rowTravelApply.FormTravelApplyID)[0];
            hlTravelApply.Text             = rowApplyForm.FormNo;
            this.hlTravelApply.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/OtherForm/TravelApproval.aspx?ShowDialog=1&ObjectId=" + rowApplyForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";

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

            //审批页面处理&按钮处理&预算信息
            this.txtTotalBudget.Text     = rowPersonalReimburse.TotalBudget.ToString("N");
            this.txtApprovingAmount.Text = rowPersonalReimburse.ApprovingAmount.ToString("N");
            this.txtApprovedAmount.Text  = rowPersonalReimburse.ApprovedAmount.ToString("N");
            this.txtRemainAmount.Text    = rowPersonalReimburse.RemainAmount.ToString("N");

            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.UserID == stuffUser.StuffUserId)
            {
                this.BudgetTitleDIV.Visible = false;
                this.BudgetInfoDIV.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;
                }
            }

            //保存实报金额按钮
            int opSaveId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FormPersonalReimburse, SystemEnums.OperateEnum.Other);
            AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow) this.Session["Position"];
            if (new PositionRightBLL().CheckPositionRight(position.PositionId, opSaveId) && (rowForm.StatusID == 1 || rowForm.StatusID == 2))
            {
                HasSaveRight = true;
            }
            else
            {
                HasSaveRight = false;
            }
            if (HasSaveRight)
            {
                this.SaveBtn.Visible = true;
            }
            else
            {
                this.SaveBtn.Visible = false;
            }
            //超预算提示
            if (rowPersonalReimburse.Amount > rowTravelApply.TotalFee)
            {
                this.imgOverBudget.Visible = true;
            }

            // 打开明细表
            new FormPersonalReimburseDetailTableAdapter().FillByFormID(InnerDS.FormPersonalReimburseDetail, rowForm.FormID);
            this.gvTravelReimburseDetails.DataSource = new FormPersonalReimburseDetailTableAdapter().GetDataByFormID(rowForm.FormID);
            this.gvTravelReimburseDetails.DataBind();
            this.gvFormTravelApplyDetails.DataSource = new FormTravelApplyDetailTableAdapter().GetDataByApplyID(rowTravelApply.FormTravelApplyID);
            this.gvFormTravelApplyDetails.DataBind();
        }
        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 OpenForm(int formID)
    {
        FormDS.FormRow            rowForm            = this.PersonalReimburseBLL.GetFormByID(formID)[0];
        FormDS.FormTravelApplyRow rowFormTravelApply = this.PersonalReimburseBLL.GetFormTravelApplyByID(formID);

        if (!rowFormTravelApply.IsTransportFeeNull())
        {
            this.txtTransportFee.Text = rowFormTravelApply.TransportFee.ToString("N");
        }
        else
        {
            this.txtTransportFee.Text = "0";
        }
        if (!rowFormTravelApply.IsHotelFeeNull())
        {
            this.txtHotelFee.Text = rowFormTravelApply.HotelFee.ToString("N");
        }
        else
        {
            this.txtHotelFee.Text = "0";
        }
        if (!rowFormTravelApply.IsMealFeeNull())
        {
            this.txtMealFee.Text = rowFormTravelApply.MealFee.ToString("N");
        }
        else
        {
            this.txtMealFee.Text = "0";
        }
        if (!rowFormTravelApply.IsOtherFeeNull())
        {
            this.txtOtherFee.Text = rowFormTravelApply.OtherFee.ToString("N");
        }
        else
        {
            this.txtOtherFee.Text = "0";
        }
        if (!rowFormTravelApply.IsTotalFeeNull())
        {
            this.txtTotalAmount.Text = rowFormTravelApply.TotalFee.ToString("N");
        }
        else
        {
            this.txtOtherFee.Text = "0";
        }
        //赋值
        if (!rowFormTravelApply.IsRemarkNull())
        {
            this.RemarkCtl.Text = rowFormTravelApply.Remark;
        }
        if (!rowFormTravelApply.IsAttachedFileNameNull() && !rowFormTravelApply.IsRealAttachedFileNameNull())
        {
            this.UCFileUpload.AttachmentFileName     = rowFormTravelApply.RealAttachedFileName;
            this.UCFileUpload.RealAttachmentFileName = rowFormTravelApply.RealAttachedFileName;
        }

        // 打开明细表
        FormTravelApplyDetailTableAdapter taDetail = new FormTravelApplyDetailTableAdapter();

        taDetail.FillByApplyID(this.InnerDS.FormTravelApplyDetail, formID);
    }