Beispiel #1
0
        protected void Finish(CostReportInfo model)
        {
            decimal realityCost = model.RealityCost;//当是预借款最后一次时,判断金额大小之后,RealityCost的值已经被改变,故此处需要用一个变量提前暂存

            #region 结算账号
            IBankAccounts bankAccounts    = new BankAccounts(GlobalConfig.DB.FromType.Read);
            var           bankAccountInfo = bankAccounts.GetBankAccounts(model.PayBankAccountId);
            string        payBankAccount  = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model, payBankAccount);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model, payBankAccount);
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    _costReport.UpdatePayCostAndExecuteDate(model.ReportId, realityCost);
                    _utility.UpdateFieldByPk("lmShop_CostReportAmount", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                    _utility.UpdateFieldByPk("lmShop_CostReportBill", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                    model.RealityCost = realityCost;
                    string errorMessage;
                    bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                    if (!result)
                    {
                        throw new Exception(errorMessage);
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
        protected void AuditPass(CostReportInfo model)
        {
            bool execute = false;

            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Paying)
            {
                execute = true;
                //已扣款核销
                PayVerification(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model);
            }
            else if (model.ReportKind == (int)CostReportKind.FeeIncome)
            {
                //费用收入
                FeeIncome(model);
            }

            model.AuditingMan  = Personnel.PersonnelId;
            model.AuditingDate = DateTime.Now;

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    if (execute)
                    {
                        _costReport.UpdatePayCostAndExecuteDate(model.ReportId, model.RealityCost);
                        string errorMessage;
                        bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                        if (!result)
                        {
                            throw new Exception(errorMessage);
                        }
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
        protected void PayAndReceive(CostReportInfo model)
        {
            bool    execute         = false;             //是否执行完成操作
            bool    need            = false;             //是否需要完成
            decimal realityCost     = model.RealityCost; //当是预借款最后一次时,判断金额大小之后,RealityCost的值已经被改变,故此处需要用一个变量提前暂存
            var     bankAccountInfo = _bankAccounts.GetBankAccounts(model.PayBankAccountId);

            #region 结算账号
            string payBankAccount = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            if (model.CostType.Equals(1) || (model.CostType.Equals(2) && (bankAccountInfo != null && !bankAccountInfo.IsFinish)))
            {
                //在申请页面完成
                need = true;
            }
            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model, need, payBankAccount, out execute);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model, need, payBankAccount);
            }
            else if (model.ReportKind == (int)CostReportKind.FeeIncome)
            {
                execute = true;
                //费用收入
                FeeIncome(model, payBankAccount);
            }

            if (bankAccountInfo != null && bankAccountInfo.IsMain)
            {
                model.IsOut = true;
            }
            else
            {
                model.IsOut = false;
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);
                    if (execute || need)
                    {
                        _costReport.UpdatePayCostAndExecuteDate(model.ReportId, realityCost);
                        _utility.UpdateFieldByPk("lmShop_CostReportAmount", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                        _utility.UpdateFieldByPk("lmShop_CostReportBill", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                        model.RealityCost = realityCost;
                        string errorMessage;
                        bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                        if (!result)
                        {
                            throw new Exception(errorMessage);
                        }
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
Beispiel #4
0
        //审核通过
        protected void btn_Pass_Click(object sender, EventArgs e)
        {
            #region 验证数据
            var errorMsg = CheckData();
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));
            if (model.State != (int)CostReportState.Auditing)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            bool execute = false;
            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Paying)
            {
                execute = true;
                //已扣款核销
                PayVerification(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model);
            }
            else if (model.ReportKind == (int)CostReportKind.FeeIncome)
            {
                //费用收入
                FeeIncome(model);
            }

            model.AssumeBranchId = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId  = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId   = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.AuditingMan    = Personnel.PersonnelId;
            model.AuditingDate   = DateTime.Now;
            model.AuditingMemo   = txt_AuditingMemo.Text;

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    if (execute)
                    {
                        _costReport.UpdatePayCostAndExecuteDate(model.ReportId, model.RealityCost);
                        string errorMessage;
                        bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                        if (!result)
                        {
                            throw new Exception(errorMessage);
                        }
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
Beispiel #5
0
        //付款
        protected void btn_Pay_Click(object sender, EventArgs e)
        {
            #region 验证数据
            var errorMsg = CheckData();
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));
            if (model.State != (int)CostReportState.WaitVerify)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            var bankAccountInfo = _bankAccounts.GetBankAccounts(new Guid(rcb_PayBankAccount.SelectedValue));

            #region 结算账号
            string payBankAccount = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            //费用收入(押金)
            FeeIncome(model, payBankAccount);

            #region 额外可修改的项
            UpdateItem(model);
            #endregion

            model.AssumeBranchId   = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId    = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId     = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.PayBankAccountId = string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue) ? Guid.Empty : new Guid(rcb_PayBankAccount.SelectedValue);
            model.AssumeFilialeId  = string.IsNullOrEmpty(ddl_AssumeFiliale.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeFiliale.SelectedValue);
            model.Poundage         = string.IsNullOrEmpty(txt_Poundage.Text) ? 0 : decimal.Parse(txt_Poundage.Text);
            model.TradeNo          = txt_TradeNo.Text;
            model.AuditingMemo     = txt_AuditingMemo.Text;
            if (bankAccountInfo != null && bankAccountInfo.IsMain)
            {
                model.IsOut = true;
            }
            else
            {
                model.IsOut = false;
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    _costReport.UpdatePayCostAndExecuteDate(model.ReportId, model.ReportCost);
                    string errorMessage;
                    bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                    if (!result)
                    {
                        throw new Exception(errorMessage);
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }