Ejemplo n.º 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 PayVerification(CostReportInfo model)
        {
            model.State = (int)CostReportState.NoAuditing;//状态:票据待受理

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

            model.Memo = ERP.UI.Web.Common.WebControl.RetrunUserAndTime("[【审核】:审核通过;]") + ERP.UI.Web.Common.WebControl.RetrunUserAndTime("[【已付款】:已支付" + ERP.UI.Web.Common.WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
        }