Exemple #1
0
    protected void OpenForm(int formID)
    {
        FormTableAdapter taForm = new FormTableAdapter();

        taForm.FillByID(this.InnerDS.Form, formID);
        FormDS.FormRow rowForm = this.InnerDS.Form[0];
        FormPersonalReimburseTableAdapter taFormTravelReimburse = new FormPersonalReimburseTableAdapter();

        taFormTravelReimburse.FillByID(this.InnerDS.FormPersonalReimburse, formID);
        FormDS.FormPersonalReimburseRow rowFormTravelReimburse = this.InnerDS.FormPersonalReimburse[0];
        this.ViewState["FormTravelApplyID"] = rowFormTravelReimburse.FormTravelApplyID;
        //赋值
        this.PeriodDDL.DataSourceID = "odsPeriod";
        this.PeriodDDL.DataBind();
        ListItem item = this.PeriodDDL.Items.FindByText(rowFormTravelReimburse.Period.ToString("yyyy-MM"));

        if (item != null)
        {
            this.PeriodDDL.SelectedValue = item.Value;
        }
        if (!rowFormTravelReimburse.IsRemarkNull())
        {
            this.RemarkCtl.Text = rowFormTravelReimburse.Remark;
        }
        if (!rowFormTravelReimburse.IsAttachedFileNameNull())
        {
            this.UCFileUpload.AttachmentFileName = rowFormTravelReimburse.AttachedFileName;
        }
        if (!rowFormTravelReimburse.IsRealAttachedFileNameNull())
        {
            this.UCFileUpload.RealAttachmentFileName = rowFormTravelReimburse.RealAttachedFileName;
        }

        OpenTravelApplyForm(rowFormTravelReimburse.FormTravelApplyID);
        // 打开明细表
        FormPersonalReimburseDetailTableAdapter taDetail = new FormPersonalReimburseDetailTableAdapter();

        taDetail.FillByFormID(this.InnerDS.FormPersonalReimburseDetail, formID);
    }
    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;
            }

            // ����ϸ��
            FormPersonalReimburseDetailTableAdapter taDetail = new FormPersonalReimburseDetailTableAdapter();
            taDetail.FillByFormID(this.InnerDS.FormPersonalReimburseDetail, formID);

            //��ʷ����
            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;
                }
            }

            //�Ƿ���ʾ���ư�ť
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && stuffUser.StuffUserId == rowForm.UserID) {
                this.UCPeriod.Visible = true;
                this.CopyBtn.Visible = true;
            } else {
                this.UCPeriod.Visible = false;
                this.CopyBtn.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;
            }

        }
        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)
        {
            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;
            }

            // 打开明细表
            FormPersonalReimburseDetailTableAdapter taDetail = new FormPersonalReimburseDetailTableAdapter();
            taDetail.FillByFormID(this.InnerDS.FormPersonalReimburseDetail, formID);

            //历史单据
            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;
                }
            }

            //是否显示复制按钮
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.UCPeriod.Visible = true;
                this.CopyBtn.Visible  = true;
            }
            else
            {
                this.UCPeriod.Visible = false;
                this.CopyBtn.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;
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
    protected void OpenForm(int formID)
    {
        FormTableAdapter taForm = new FormTableAdapter();
        taForm.FillByID(this.InnerDS.Form, formID);
        FormDS.FormRow rowForm = this.InnerDS.Form[0];
        FormPersonalReimburseTableAdapter taFormTravelReimburse = new FormPersonalReimburseTableAdapter();
        taFormTravelReimburse.FillByID(this.InnerDS.FormPersonalReimburse, formID);
        FormDS.FormPersonalReimburseRow rowFormTravelReimburse = this.InnerDS.FormPersonalReimburse[0];
        this.ViewState["FormTravelApplyID"] = rowFormTravelReimburse.FormTravelApplyID;
        //��ֵ
        this.PeriodDDL.DataSourceID = "odsPeriod";
        this.PeriodDDL.DataBind();
        ListItem item = this.PeriodDDL.Items.FindByText(rowFormTravelReimburse.Period.ToString("yyyy-MM"));
        if (item != null) {
            this.PeriodDDL.SelectedValue = item.Value;
        }
        if (!rowFormTravelReimburse.IsRemarkNull()) {
            this.RemarkCtl.Text = rowFormTravelReimburse.Remark;
        }
        if (!rowFormTravelReimburse.IsAttachedFileNameNull()) {
            this.UCFileUpload.AttachmentFileName = rowFormTravelReimburse.AttachedFileName;
        }
        if (!rowFormTravelReimburse.IsRealAttachedFileNameNull()) {
            this.UCFileUpload.RealAttachmentFileName = rowFormTravelReimburse.RealAttachedFileName;
        }

        OpenTravelApplyForm(rowFormTravelReimburse.FormTravelApplyID);
        // ����ϸ��
        FormPersonalReimburseDetailTableAdapter taDetail = new FormPersonalReimburseDetailTableAdapter();
        taDetail.FillByFormID(this.InnerDS.FormPersonalReimburseDetail, formID);
    }
    protected void OpenForm(int formID)
    {
        FormDS.FormRow rowForm = this.FormTEBLL.GetFormByID(formID)[0];
        FormDS.FormPersonalReimburseRow rowFormPersonalReimburse = this.FormTEBLL.GetFormPersonalReimburseByID(formID)[0];
        //赋值
        PeriodDDL.DataBind();
        if (!rowFormPersonalReimburse.IsPeriodNull()) {
            ListItem item = this.PeriodDDL.Items.FindByText(rowFormPersonalReimburse.Period.ToString("yyyy-MM"));
            if (item != null) {
                this.PeriodDDL.SelectedValue = item.Value;
            }
        }
        if (!rowFormPersonalReimburse.IsRemarkNull()) {
            this.RemarkCtl.Text = rowFormPersonalReimburse.Remark;
        }
        if (!rowFormPersonalReimburse.IsAttachedFileNameNull())
            this.UCFileUpload.AttachmentFileName = rowFormPersonalReimburse.AttachedFileName;
        if (!rowFormPersonalReimburse.IsRealAttachedFileNameNull())
            this.UCFileUpload.RealAttachmentFileName = rowFormPersonalReimburse.RealAttachedFileName;

        // 打开明细表
        FormPersonalReimburseDetailTableAdapter taDetail = new FormPersonalReimburseDetailTableAdapter();
        taDetail.FillByFormPersonalReimburseID(this.InnerDS.FormPersonalReimburseDetail, formID);
    }