Exemplo n.º 1
0
    protected void OpenForm(int formID)
    {
        FormTableAdapter taForm = new FormTableAdapter();

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

        taFormBudgetAllocation.FillByID(this.InnerDS.FormBudgetAllocation, formID);
        FormDS.FormBudgetAllocationRow rowFormBudgetAllocation = this.InnerDS.FormBudgetAllocation[0];
        //赋值
        if (!rowFormBudgetAllocation.IsRemarkNull())
        {
            this.RemarkCtl.Text = rowFormBudgetAllocation.Remark;
        }
        if (!rowFormBudgetAllocation.IsAttachFileNameNull())
        {
            this.UCFileUpload.AttachmentFileName = rowFormBudgetAllocation.AttachFileName;
        }
        if (!rowFormBudgetAllocation.IsRealAttachFileNameNull())
        {
            this.UCFileUpload.RealAttachmentFileName = rowFormBudgetAllocation.RealAttachFileName;
        }

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

        taDetail.FillByFormID(this.InnerDS.FormBudgetAllocationDetail, formID);
    }
Exemplo n.º 2
0
        public void UpdateFormBudgetAllocation(int FormID, SystemEnums.FormStatus StatusID, SystemEnums.FormType FormTypeID, string Remark, string AttachFileName, string RealAttachFileName, string FlowTemplate)
        {
            SqlTransaction transaction = null;

            try {
                ////事务开始
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormBudgetAllocation, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormBudgetAllocationDetail, transaction);

                FormDS.FormRow formRow = this.TAForm.GetDataByID(FormID)[0];
                UtilityBLL     utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting)
                {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo            = utility.GetFormNo(formTypeString);
                    formRow.InTurnUserIds     = "P"; //待改动
                    formRow.InTurnPositionIds = "P"; //待改动
                }
                else
                {
                    formRow.SetFormNoNull();
                }
                formRow.StatusID     = (int)StatusID;
                formRow.SubmitDate   = DateTime.Now;
                formRow.LastModified = DateTime.Now;
                this.TAForm.Update(formRow);

                //处理申请表的内容
                FormDS.FormBudgetAllocationRow formBudgetAllocationRow = this.TAFormBudgetAllocation.GetDataByID(FormID)[0];
                formBudgetAllocationRow.Amount             = decimal.Zero;
                formBudgetAllocationRow.AttachFileName     = AttachFileName;
                formBudgetAllocationRow.RealAttachFileName = RealAttachFileName;
                formBudgetAllocationRow.Remark             = Remark;
                this.TAFormBudgetAllocation.Update(formBudgetAllocationRow);

                //明细表
                decimal totalAmount    = 0; //计算总申请金额
                decimal totalInAmount  = 0; //计算调入总金额
                decimal totalOutAmount = 0; //计算调出总金额

                foreach (FormDS.FormBudgetAllocationDetailRow detailRow in this.FormDataSet.FormBudgetAllocationDetail)
                {
                    // 与父表绑定
                    if (detailRow.RowState != DataRowState.Deleted)
                    {
                        detailRow.FormBudgetAllocationID = formBudgetAllocationRow.FormBudgetAllocationID;
                        if (detailRow.AllocationType == (int)SystemEnums.AllocationType.In)
                        {
                            totalInAmount += detailRow.TransferBudget;
                        }
                        else
                        {
                            totalOutAmount += detailRow.TransferBudget;
                        }
                        totalAmount += detailRow.TransferBudget;
                    }
                }

                this.TAFormBudgetAllocationDetail.Update(this.FormDataSet.FormBudgetAllocationDetail);

                formBudgetAllocationRow.Amount = totalOutAmount;
                this.TAFormBudgetAllocation.Update(formBudgetAllocationRow);

                // 正式提交或草稿

                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic["Apply_Amount"] = totalOutAmount;    //调拨金额

                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(ex.Message);
            } finally {
                transaction.Dispose();
            }
        }
Exemplo n.º 3
0
        public void AddFormBudgetAllocation(int?RejectedFormID, int UserID, int?ProxyUserID, int?ProxyPositionID, int OrganizationUnitID, int PositionID, SystemEnums.FormType FormTypeID,
                                            SystemEnums.FormStatus StatusID, string Remark, string AttachFileName, string RealAttachFileName, string FlowTemplate)
        {
            SqlTransaction transaction = null;

            try {
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormBudgetAllocation, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormBudgetAllocationDetail, 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.BudgetAllocationApply;
                this.FormDataSet.Form.AddFormRow(formRow);
                this.TAForm.Update(formRow);

                //处理申请表的内容
                FormDS.FormBudgetAllocationRow formBudgetAllocationRow = this.FormDataSet.FormBudgetAllocation.NewFormBudgetAllocationRow();
                formBudgetAllocationRow.FormBudgetAllocationID = formRow.FormID;
                formBudgetAllocationRow.Amount             = decimal.Zero;
                formBudgetAllocationRow.AttachFileName     = AttachFileName;
                formBudgetAllocationRow.RealAttachFileName = RealAttachFileName;
                formBudgetAllocationRow.Remark             = Remark;


                this.FormDataSet.FormBudgetAllocation.AddFormBudgetAllocationRow(formBudgetAllocationRow);
                this.TAFormBudgetAllocation.Update(formBudgetAllocationRow);

                //明细表
                decimal totalAmount    = 0; //计算总申请金额
                decimal totalInAmount  = 0; //计算调入总金额
                decimal totalOutAmount = 0; //计算调出总金额

                if (RejectedFormID != null)
                {
                    FormDS.FormBudgetAllocationDetailDataTable newDetailTable = new FormDS.FormBudgetAllocationDetailDataTable();
                    foreach (FormDS.FormBudgetAllocationDetailRow detailRow in this.FormDataSet.FormBudgetAllocationDetail)
                    {
                        if (detailRow.RowState != System.Data.DataRowState.Deleted)
                        {
                            FormDS.FormBudgetAllocationDetailRow newDetailRow = newDetailTable.NewFormBudgetAllocationDetailRow();
                            newDetailRow.FormBudgetAllocationID = formBudgetAllocationRow.FormBudgetAllocationID;
                            newDetailRow.CustomerID             = detailRow.CustomerID;
                            newDetailRow.CustomerName           = detailRow.CustomerName;
                            newDetailRow.ExpenseItemID          = detailRow.ExpenseItemID;
                            newDetailRow.ExpenseItemName        = detailRow.ExpenseItemName;
                            newDetailRow.Period           = detailRow.Period;
                            newDetailRow.OriginalBudget   = detailRow.OriginalBudget;
                            newDetailRow.NormalBudget     = detailRow.NormalBudget;
                            newDetailRow.AdjustBudget     = detailRow.AdjustBudget;
                            newDetailRow.TotalBudget      = detailRow.TotalBudget;
                            newDetailRow.TransferBudget   = detailRow.TransferBudget;
                            newDetailRow.AllocationType   = detailRow.AllocationType;
                            newDetailRow.BudgetSalesFeeId = detailRow.BudgetSalesFeeId;
                            totalAmount += newDetailRow.TransferBudget;
                            if (detailRow.AllocationType == (int)SystemEnums.AllocationType.In)
                            {
                                totalInAmount += detailRow.TransferBudget;
                            }
                            else
                            {
                                totalOutAmount += detailRow.TransferBudget;
                            }
                            newDetailTable.AddFormBudgetAllocationDetailRow(newDetailRow);
                        }
                    }
                    this.TAFormBudgetAllocationDetail.Update(newDetailTable);
                }
                else
                {
                    foreach (FormDS.FormBudgetAllocationDetailRow detailRow in this.FormDataSet.FormBudgetAllocationDetail)
                    {
                        // 与父表绑定
                        if (detailRow.RowState != DataRowState.Deleted)
                        {
                            detailRow.FormBudgetAllocationID = formBudgetAllocationRow.FormBudgetAllocationID;
                            if (detailRow.AllocationType == (int)SystemEnums.AllocationType.In)
                            {
                                totalInAmount += detailRow.TransferBudget;
                            }
                            else
                            {
                                totalOutAmount += detailRow.TransferBudget;
                            }
                            totalAmount += detailRow.TransferBudget;
                        }
                    }
                    this.TAFormBudgetAllocationDetail.Update(this.FormDataSet.FormBudgetAllocationDetail);
                }

                formBudgetAllocationRow.Amount = totalOutAmount;
                this.TAFormBudgetAllocation.Update(formBudgetAllocationRow);
                // 正式提交或草稿

                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic["Apply_Amount"] = totalOutAmount;    //调拨金额

                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(ex.Message);
            } finally {
                transaction.Dispose();
            }
        }
Exemplo n.º 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.BudgetAllocationApplyBLL.GetFormByID(formID)[0];
            FormDS.FormBudgetAllocationRow rowBudgetAllocation = this.BudgetAllocationApplyBLL.GetFormBudgetAllocationByID(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.RemarkCtl.Text     = rowBudgetAllocation.Remark;

            this.odsBudgetAllocationInDetails.SelectParameters["FormBudgetAllocationID"].DefaultValue  = rowBudgetAllocation.FormBudgetAllocationID.ToString();
            this.odsBudgetAllocationOutDetails.SelectParameters["FormBudgetAllocationID"].DefaultValue = rowBudgetAllocation.FormBudgetAllocationID.ToString();

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

            //审批页面处理&按钮处理
            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 && ((AuthorizationDS.StuffUserRow)Session["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;
                }
            }
            this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
            this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
            this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
        }
    }