Пример #1
0
 public void UpdateFormReimburseForRealPaymentInfo(int FormReimburseID, DateTime PaymentDate)
 {
     FormDS.FormReimburseRow reimburseRow = this.TAFormReimburse.GetDataByID(FormReimburseID)[0];
     reimburseRow.PaymentDate   = PaymentDate;
     reimburseRow.PaymentAmount = reimburseRow.Amount;
     this.TAFormReimburse.Update(reimburseRow);
 }
Пример #2
0
 protected void SubmitBtn_Click(object sender, EventArgs e)
 {
     try {
         if (this.cwfAppCheck.CheckInputData())
         {
             AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
             string ProxyStuffName = null;
             if (Session["ProxyStuffUserId"] != null)
             {
                 ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
             }
             new APFlowBLL().ApproveForm(CommonUtility.GetAPHelper(Session), this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                                         this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName, int.Parse(ViewState["OrganizationUnitID"].ToString()));
             //如果是票扣的话,如果拒绝的话要unlock PKRecord记录
             FormDS.FormReimburseRow row = this.SalesReimburseBLL.GetFormReimburseByID(this.cwfAppCheck.FormID)[0];
             if (!this.cwfAppCheck.GetApproveOrReject() && row.PaymentTypeID == (int)SystemEnums.PaymentType.PiaoKou)
             {
                 new PKRecordTableAdapter().UnLockPKRecord(row.FormReimburseID);
             }
             if (this.Request["Source"] != null)
             {
                 this.Response.Redirect(this.Request["Source"].ToString());
             }
             else
             {
                 this.Response.Redirect("~/Home.aspx");
             }
         }
     } catch (Exception exception) {
         this.cwfAppCheck.ReloadCtrl();
         PageUtility.DealWithException(this, exception);
     }
 }
Пример #3
0
        public void DeliveryComplete(int FormReimburseID, int UserID)
        {
            FormDS.FormReimburseRow reimburseRow = this.TAFormReimburse.GetDataByID(FormReimburseID)[0];

            reimburseRow.IsDeliveryComplete     = true;
            reimburseRow.DeliveryCompleteDate   = DateTime.Now;
            reimburseRow.DeliveryCompleteUserID = UserID;

            this.TAFormReimburse.Update(reimburseRow);
        }
Пример #4
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"];
    }
Пример #5
0
        public void UpdateFormReimburseGoods(int FormID, SystemEnums.FormStatus StatusID, SystemEnums.FormType FormTypeID,
                                             string AttachedFileName, string RealAttachedFileName, string Remark, string FlowTemplate)
        {
            SqlTransaction transaction = null;

            try {
                //事务开始
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormReimburse, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormReimburseDetail, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormReimburseSKUDetail, transaction);

                FormDS.FormRow          formRow          = this.TAForm.GetDataByID(FormID)[0];
                FormDS.FormReimburseRow FormReimburseRow = this.TAFormReimburse.GetDataByID(FormID)[0];

                //处理单据的内容
                UtilityBLL utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo = utility.GetFormNo(formTypeString);
                }
                else
                {
                    formRow.SetFormNoNull();
                }
                formRow.StatusID     = (int)StatusID;
                formRow.SubmitDate   = DateTime.Now;
                formRow.LastModified = DateTime.Now;

                this.TAForm.Update(formRow);

                //处理FormReimburseRow的内容
                if (AttachedFileName != null && AttachedFileName != string.Empty)
                {
                    FormReimburseRow.AttachedFileName = AttachedFileName;
                }
                else
                {
                    FormReimburseRow.SetAttachedFileNameNull();
                }
                if (RealAttachedFileName != null && RealAttachedFileName != string.Empty)
                {
                    FormReimburseRow.RealAttachedFileName = RealAttachedFileName;
                }
                else
                {
                    FormReimburseRow.SetRealAttachedFileNameNull();
                }
                if (Remark != null && Remark != string.Empty)
                {
                    FormReimburseRow.Remark = Remark;
                }

                this.TAFormReimburse.Update(FormReimburseRow);

                //处理free goods明细
                foreach (FormDS.FormReimburseSKUDetailRow detailFGRow in this.FormDataSet.FormReimburseSKUDetail)
                {
                    // 与父表绑定
                    if (detailFGRow.RowState != DataRowState.Deleted)
                    {
                        detailFGRow.FormReimburseID = FormReimburseRow.FormReimburseID;
                    }
                }
                this.TAFormReimburseSKUDetail.Update(this.FormDataSet.FormReimburseSKUDetail);

                //处理明细
                decimal totalAmount = 0;
                foreach (FormDS.FormReimburseDetailRow detailRow in this.FormDataSet.FormReimburseDetail)
                {
                    if (detailRow.RowState != DataRowState.Deleted)
                    {
                        totalAmount += detailRow.Amount;
                        detailRow.FormReimburseID = FormReimburseRow.FormReimburseID;
                    }
                }
                this.TAFormReimburseDetail.Update(this.FormDataSet.FormReimburseDetail);

                FormReimburseRow.Amount = totalAmount;
                this.TAFormReimburse.Update(FormReimburseRow);

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic["Apply_Amount"] = totalAmount;
                    //dic["Dept"] = new AuthorizationDSTableAdapters.OrganizationUnitTableAdapter().GetOrganizationUnitCodeByOrganizationUnitID(formRow.OrganizationUnitID)[0].OrganizationUnitCode;
                    dic["Expense_Category"] = getExpenseCategoryIDByFormID(int.Parse(FormReimburseRow.FormApplyIds.Split(',')[0])).ToString();//此处待改动
                    APHelper AP = new APHelper();
                    new APFlowBLL().ApplyForm(AP, TAForm, null, formRow, formRow.OrganizationUnitID, FlowTemplate, StatusID, dic);
                }
                transaction.Commit();
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
Пример #6
0
        public void AddFormReimburseGoods(int?RejectedFormID, int UserID, int?ProxyUserID, int?ProxyPositionID, int OrganizationUnitID, int PositionID, SystemEnums.FormType FormTypeID,
                                          SystemEnums.FormStatus StatusID, int CustomerID, int PaymentTypeID, string AttachedFileName, string RealAttachedFileName, string Remark, string FormApplyIds, string FormApplyNos, string FlowTemplate)
        {
            SqlTransaction transaction = null;

            try {
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormReimburse, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormReimburseDetail, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormReimburseSKUDetail, transaction);

                FormDS.FormRow formRow = this.FormDataSet.Form.NewFormRow();
                if (RejectedFormID != null)
                {
                    formRow.RejectedFormID = RejectedFormID.GetValueOrDefault();
                }
                formRow.UserID = UserID;
                UtilityBLL utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo = utility.GetFormNo(formTypeString);
                }
                else
                {
                    formRow.SetFormNoNull();
                }
                if (ProxyUserID != null)
                {
                    formRow.ProxyUserID = ProxyUserID.GetValueOrDefault();
                }
                if (ProxyPositionID != null)
                {
                    formRow.ProxyPositionID = ProxyPositionID.GetValueOrDefault();
                }
                formRow.OrganizationUnitID = OrganizationUnitID;
                formRow.PositionID         = PositionID;
                formRow.FormTypeID         = (int)FormTypeID;
                formRow.StatusID           = (int)StatusID;
                formRow.SubmitDate         = DateTime.Now;
                formRow.LastModified       = DateTime.Now;
                formRow.InTurnUserIds      = "P"; //待改动
                formRow.InTurnPositionIds  = "P"; //待改动
                formRow.PageType           = (int)SystemEnums.PageType.ReimburseGoodsApply;
                this.FormDataSet.Form.AddFormRow(formRow);
                this.TAForm.Update(formRow);

                //处理申请表的内容
                FormDS.FormReimburseRow FormReimburseRow = this.FormDataSet.FormReimburse.NewFormReimburseRow();
                FormReimburseRow.FormReimburseID = formRow.FormID;
                FormReimburseRow.CustomerID      = CustomerID;
                FormReimburseRow.PaymentTypeID   = PaymentTypeID;
                FormReimburseRow.Amount          = 0;//默认值
                if (AttachedFileName != null && AttachedFileName != string.Empty)
                {
                    FormReimburseRow.AttachedFileName = AttachedFileName;
                }
                if (RealAttachedFileName != null && RealAttachedFileName != string.Empty)
                {
                    FormReimburseRow.RealAttachedFileName = RealAttachedFileName;
                }
                if (Remark != null && Remark != string.Empty)
                {
                    FormReimburseRow.Remark = Remark;
                }
                FormReimburseRow.FormApplyIds       = FormApplyIds;
                FormReimburseRow.FormApplyNos       = FormApplyNos;
                FormReimburseRow.IsDeliveryComplete = false;

                this.FormDataSet.FormReimburse.AddFormReimburseRow(FormReimburseRow);
                this.TAFormReimburse.Update(FormReimburseRow);


                //处理free goods明细
                if (RejectedFormID != null)
                {
                    FormDS.FormReimburseSKUDetailDataTable newFGTable = new FormDS.FormReimburseSKUDetailDataTable();
                    foreach (FormDS.FormReimburseSKUDetailRow detailFGRow in this.FormDataSet.FormReimburseSKUDetail)
                    {
                        // 与父表绑定
                        if (detailFGRow.RowState != DataRowState.Deleted)
                        {
                            FormDS.FormReimburseSKUDetailRow newDetailFGRow = newFGTable.NewFormReimburseSKUDetailRow();
                            newDetailFGRow.FormReimburseID = FormReimburseRow.FormReimburseID;
                            newDetailFGRow.SKUID           = detailFGRow.SKUID;
                            newDetailFGRow.PackageQuantity = detailFGRow.PackageQuantity;
                            newDetailFGRow.UnitPrice       = detailFGRow.UnitPrice;
                            newDetailFGRow.Quantity        = detailFGRow.Quantity;
                            newDetailFGRow.Amount          = detailFGRow.Amount;

                            if (!detailFGRow.IsRemarkNull())
                            {
                                newDetailFGRow.Remark = detailFGRow.Remark;
                            }
                            newFGTable.AddFormReimburseSKUDetailRow(newDetailFGRow);
                        }
                    }
                    this.TAFormReimburseSKUDetail.Update(newFGTable);
                }
                else
                {
                    foreach (FormDS.FormReimburseSKUDetailRow detailFGRow in this.FormDataSet.FormReimburseSKUDetail)
                    {
                        // 与父表绑定
                        if (detailFGRow.RowState != DataRowState.Deleted)
                        {
                            detailFGRow.FormReimburseID = FormReimburseRow.FormReimburseID;
                        }
                    }
                    this.TAFormReimburseSKUDetail.Update(this.FormDataSet.FormReimburseSKUDetail);
                }

                //明细表
                decimal totalAmount = 0;//计算总申请金额
                FormDS.FormReimburseDetailDataTable newDetailTable = new FormDS.FormReimburseDetailDataTable();
                foreach (FormDS.FormReimburseDetailRow detailRow in this.FormDataSet.FormReimburseDetail)
                {
                    // 与父表绑定
                    if (detailRow.RowState != DataRowState.Deleted)
                    {
                        totalAmount += detailRow.Amount;

                        FormDS.FormReimburseDetailRow newDetailRow = newDetailTable.NewFormReimburseDetailRow();
                        newDetailRow.FormReimburseID          = FormReimburseRow.FormReimburseID;
                        newDetailRow.FormApplyExpenseDetailID = detailRow.FormApplyExpenseDetailID;
                        newDetailRow.ApplyFormNo        = detailRow.ApplyFormNo;
                        newDetailRow.ApplyPeriod        = detailRow.ApplyPeriod;
                        newDetailRow.ShopID             = detailRow.ShopID;
                        newDetailRow.SKUID              = detailRow.SKUID;
                        newDetailRow.ExpenseItemID      = detailRow.ExpenseItemID;
                        newDetailRow.ApplyAmount        = detailRow.ApplyAmount;
                        newDetailRow.RemainAmount       = detailRow.RemainAmount;
                        newDetailRow.Amount             = detailRow.Amount;
                        newDetailRow.ApplyPaymentTypeID = detailRow.ApplyPaymentTypeID;
                        newDetailRow.FormApplyID        = detailRow.FormApplyID;
                        newDetailRow.AccruedAmount      = detailRow.IsAccruedAmountNull() ? 0 : detailRow.AccruedAmount;
                        newDetailTable.AddFormReimburseDetailRow(newDetailRow);
                    }
                }
                this.TAFormReimburseDetail.Update(newDetailTable);
                FormReimburseRow.Amount = totalAmount;
                this.TAFormReimburse.Update(FormReimburseRow);

                //作废之前的单据
                if (RejectedFormID != null)
                {
                    FormDS.FormRow oldRow = this.TAForm.GetDataByID(RejectedFormID.GetValueOrDefault())[0];
                    if (oldRow.StatusID == (int)SystemEnums.FormStatus.Rejected)
                    {
                        oldRow.StatusID = (int)SystemEnums.FormStatus.Scrap;
                        this.TAForm.Update(oldRow);
                    }
                }

                // 正式提交或草稿
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic["Apply_Amount"] = totalAmount;
                    //dic["Dept"] = new AuthorizationDSTableAdapters.OrganizationUnitTableAdapter().GetOrganizationUnitCodeByOrganizationUnitID(formRow.OrganizationUnitID)[0].OrganizationUnitCode;
                    dic["Expense_Category"] = getExpenseCategoryIDByFormID(int.Parse(FormApplyIds.Split(',')[0])).ToString();//此处待改动
                    APHelper AP = new APHelper();
                    new APFlowBLL().ApplyForm(AP, TAForm, RejectedFormID, formRow, OrganizationUnitID, FlowTemplate, StatusID, dic);
                }

                transaction.Commit();
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
Пример #7
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"];
    }
Пример #8
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;
            }
        }
    }