示例#1
0
        public ResultModel PayApplyUpdate(UserModel user, Apply apply, PayApply payApply, List<StockPayApply> stockDetails)
        {
            ResultModel result = new ResultModel();

            try
            {
                ApplyDAL applyDAL = new ApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();
                StockPayApplyDAL stockPayApplyDAL = new StockPayApplyDAL();
                StockDAL stockDAL = new StockDAL();
                StockLogDAL stockLogDAL = new StockLogDAL();
                ContractSubDAL subDAL = new ContractSubDAL();

                using (TransactionScope scope = new TransactionScope())
                {
                    //获取主申请
                    result = applyDAL.Get(user, apply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Apply resultApply = result.ReturnValue as Apply;
                    if (resultApply == null || resultApply.ApplyId <= 0)
                    {
                        result.Message = "主申请获取失败";
                        result.ResultStatus = -1;
                        return result;
                    }

                    resultApply.EmpId = user.EmpId;
                    resultApply.ApplyDept = apply.ApplyDept;
                    resultApply.ApplyCorp = apply.ApplyCorp;
                    resultApply.ApplyDesc = apply.ApplyDesc;
                    resultApply.ApplyTime = apply.ApplyTime;

                    result = applyDAL.Update(user, resultApply);
                    if (result.ResultStatus != 0)
                        return result;

                    //获取付款申请
                    result = this.payapplyDAL.Get(user, payApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    PayApply resultPayApply = result.ReturnValue as PayApply;
                    if (resultPayApply == null || resultPayApply.PayApplyId <= 0)
                    {
                        result.Message = "付款申请获取失败";
                        result.ResultStatus = -1;
                        return result;
                    }
                    if (resultPayApply.ApplyId != resultApply.ApplyId)
                    {
                        result.Message = "付款申请与主申请不一致,更新失败";
                        result.ResultStatus = -1;
                        return result;
                    }

                    resultPayApply.RecCorpId = payApply.RecCorpId;
                    resultPayApply.RecBankId = payApply.RecBankId;
                    resultPayApply.RecBankAccountId = payApply.RecBankAccountId;
                    resultPayApply.RecBankAccount = payApply.RecBankAccount;
                    resultPayApply.ApplyBala = payApply.ApplyBala;
                    resultPayApply.CurrencyId = payApply.CurrencyId;
                    resultPayApply.PayMode = payApply.PayMode;
                    resultPayApply.PayDeadline = payApply.PayDeadline;
                    resultPayApply.PayMatter = payApply.PayMatter;
                    resultPayApply.SpecialDesc = payApply.SpecialDesc;

                    if (stockDetails.Count > 0)
                        resultPayApply.PayApplySource = (int)FundsStyleEnum.StockPayApply;
                    else
                        resultPayApply.PayApplySource = (int)FundsStyleEnum.ContractPayApply;

                    result = this.payapplyDAL.Update(user, resultPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    //获取合约关联付款申请
                    result = contractPayApplyDAL.GetByPayApplyId(user, resultPayApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    ContractPayApply contractPayApply = result.ReturnValue as ContractPayApply;
                    if (contractPayApply == null || contractPayApply.RefId <= 0)
                    {
                        result.Message = "合约关联付款申请获取失败";
                        result.ResultStatus = -1;
                        return result;
                    }

                    contractPayApply.ApplyBala = resultPayApply.ApplyBala;
                    result = contractPayApplyDAL.Update(user, contractPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    //获取现有库存明细
                    result = stockPayApplyDAL.Load(user, resultPayApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    List<StockPayApply> resultDetails = result.ReturnValue as List<StockPayApply>;
                    if (resultDetails == null)
                    {
                        result.Message = "库存付款申请获取失败";
                        result.ResultStatus = -1;
                        return result;
                    }

                    //作废现有库存明细
                    foreach (StockPayApply stockPayApply in resultDetails)
                    {
                        stockPayApply.RefStatus = StatusEnum.已录入;
                        result = stockPayApplyDAL.Invalid(user, stockPayApply);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    //新增库存付款申请
                    if (stockDetails != null && stockDetails.Count > 0)
                    {
                        foreach (StockPayApply detail in stockDetails)
                        {
                            detail.ContractId = contractPayApply.ContractId;
                            detail.ContractRefId = contractPayApply.RefId;
                            detail.PayApplyId = contractPayApply.PayApplyId;
                            detail.RefStatus = StatusEnum.已生效;
                            detail.SubId = contractPayApply.ContractSubId;
                            result = stockPayApplyDAL.Insert(user, detail);
                            if (result.ResultStatus != 0)
                                return result;
                        }
                    }

                    if (result.ResultStatus == 0)
                        result.ReturnValue = payApply.PayApplyId;

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#2
0
        public ResultModel PayApplyStockCreate(UserModel user, PayApply payApply, List<StockPayApply> stockPayApplies, string memo, int deptId, int corpId)
        {
            ResultModel result = new ResultModel();

            try
            {
                StockPayApplyDAL stockPayApplyDAL = new StockPayApplyDAL();
                ApplyDAL applyDAL = new ApplyDAL();
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();

                StockLogDAL stockLogDAL = new StockLogDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //验证可申请金额
                    //NFMT.Data.Model.FuturesPrice futuresPrice = NFMT.Data.BasicDataProvider.FuturesPrices[0];

                    //验证库存流水是否在同一子合约中
                    int subId = 0;
                    int contractId = 0;
                    foreach (StockPayApply stockPayApply in stockPayApplies)
                    {
                        result = stockLogDAL.Get(user, stockPayApply.StockLogId);
                        if (result.ResultStatus != 0)
                            return result;

                        StockLog stockLog = result.ReturnValue as StockLog;
                        if (stockLog == null || stockLog.StockLogId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "库存流水不存在";
                            return result;
                        }

                        if (subId == 0)
                        {
                            subId = stockLog.SubContractId;
                            contractId = stockLog.ContractId;
                        }

                        if (stockLog.SubContractId != subId)
                        {
                            result.ResultStatus = -1;
                            result.Message = "不能同时申请不同子合约中的库存付款";
                            return result;
                        }
                    }

                    //新增申请主表
                    Department dept = UserProvider.Departments.FirstOrDefault(temp => temp.DeptId == deptId);
                    if (dept == null || dept.DeptId < 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请部门不存在";
                        return result;
                    }

                    int applyId = 0;
                    Apply apply = new Apply();

                    apply.ApplyDept = dept.DeptId;
                    apply.ApplyCorp = corpId;
                    apply.ApplyDesc = memo;
                    apply.ApplyTime = DateTime.Now;
                    apply.ApplyType = ApplyType.付款申请;
                    apply.EmpId = user.EmpId;

                    result = applyDAL.Insert(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out applyId))
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请主表新增失败";
                        return result;
                    }

                    decimal sumApplyBala = stockPayApplies.Sum(temp => temp.ApplyBala);
                    //新增付款申请表
                    payApply.ApplyId = applyId;
                    payApply.PayApplySource = (int)FundsStyleEnum.StockPayApply;
                    payApply.ApplyBala = sumApplyBala;
                    result = payapplyDAL.Insert(user, payApply);
                    if (result.ResultStatus != 0)
                        return result;
                    int payApplyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out payApplyId))
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请新增失败";
                        return result;
                    }

                    //新增合约付款申请关联表
                    ContractPayApply payApplyContract = new ContractPayApply();
                    payApplyContract.ApplyBala = sumApplyBala;
                    payApplyContract.ContractId = contractId;
                    payApplyContract.ContractSubId = subId;
                    payApplyContract.PayApplyId = payApplyId;

                    result = contractPayApplyDAL.Insert(user, payApplyContract);
                    if (result.ResultStatus != 0)
                        return result;

                    int contractRefId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out contractRefId) || contractRefId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "新增付款申请失败";
                        return result;
                    }

                    //新增dbo.Fun_StockPayApply_Ref库存付款申请
                    foreach (StockPayApply stockPayApply in stockPayApplies)
                    {
                        stockPayApply.ContractId = contractId;
                        stockPayApply.ContractRefId = contractRefId;
                        stockPayApply.SubId = subId;
                        stockPayApply.PayApplyId = payApplyId;
                        stockPayApply.RefStatus = StatusEnum.已生效;
                        result = stockPayApplyDAL.Insert(user, stockPayApply);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#3
0
        public ResultModel PayApplyStockUpdate(UserModel user, PayApply payApply, List<StockPayApply> stockPayApplies, string memo, int deptId, int corpId)
        {
            ResultModel result = new ResultModel();
            try
            {
                StockPayApplyDAL stockPayApplyDAL = new StockPayApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();
                ApplyDAL applyDAL = new ApplyDAL();
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                StockLogDAL stockLogDAL = new StockLogDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //验证可申请金额
                    //NFMT.Data.Model.FuturesPrice futuresPrice = NFMT.Data.BasicDataProvider.FuturesPrices[0];

                    //获取付款申请
                    result = payapplyDAL.Get(user, payApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;
                    PayApply resultObj = result.ReturnValue as PayApply;
                    if (resultObj == null || resultObj.PayApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请不存在";
                        return result;
                    }

                    //获取申请主表
                    result = applyDAL.Get(user, resultObj.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Apply apply = result.ReturnValue as Apply;
                    if (apply == null || apply.ApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请主表获取失败";
                        return result;
                    }

                    //获取库存明细列表
                    result = stockPayApplyDAL.Load(user, payApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    List<StockPayApply> readyStockPayApplies = result.ReturnValue as List<StockPayApply>;
                    if (readyStockPayApplies == null)
                    {
                        result.ResultStatus = -1;
                        result.Message = "库存申请明细获取失败";
                        return result;
                    }

                    //更新申请主表
                    Department dept = UserProvider.Departments.FirstOrDefault(temp => temp.DeptId == deptId);
                    if (dept == null || dept.DeptId < 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请部门不存在";
                        return result;
                    }

                    apply.ApplyDept = dept.DeptId;
                    apply.ApplyCorp = corpId;
                    apply.ApplyDesc = memo;
                    apply.ApplyType = ApplyType.付款申请;
                    apply.EmpId = user.EmpId;

                    result = applyDAL.Update(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    //更新付款申请表
                    resultObj.RecCorpId = payApply.RecCorpId;
                    resultObj.RecBankId = payApply.RecBankId;
                    resultObj.RecBankAccountId = payApply.RecBankAccountId;
                    resultObj.RecBankAccount = payApply.RecBankAccount;
                    resultObj.ApplyBala = payApply.ApplyBala;
                    resultObj.CurrencyId = payApply.CurrencyId;
                    resultObj.PayMode = payApply.PayMode;
                    resultObj.PayDeadline = payApply.PayDeadline;
                    resultObj.PayMatter = payApply.PayMatter;
                    resultObj.SpecialDesc = payApply.SpecialDesc;

                    result = payapplyDAL.Update(user, resultObj);
                    if (result.ResultStatus != 0)
                        return result;

                    //作废现有已生效库存分配明细
                    foreach (StockPayApply stockPayApply in readyStockPayApplies)
                    {
                        stockPayApply.RefStatus = StatusEnum.已录入;
                        result = stockPayApplyDAL.Invalid(user, stockPayApply);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    //获取合约付款申请
                    result = contractPayApplyDAL.GetByPayApplyId(user, payApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    ContractPayApply contractPayApply = result.ReturnValue as ContractPayApply;
                    if (contractPayApply == null || contractPayApply.RefId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "获取对应合约付款失败";
                        return result;
                    }

                    //验证库存流水是否在同一子合约中
                    int subId = 0;
                    int contractId = 0;
                    foreach (StockPayApply stockPayApply in stockPayApplies)
                    {
                        result = stockLogDAL.Get(user, stockPayApply.StockLogId);
                        if (result.ResultStatus != 0)
                            return result;

                        StockLog stockLog = result.ReturnValue as StockLog;
                        if (stockLog == null || stockLog.StockLogId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "库存流水不存在";
                            return result;
                        }

                        if (subId == 0)
                        {
                            subId = stockLog.SubContractId;
                            contractId = stockLog.ContractId;
                        }

                        if (stockLog.SubContractId != subId)
                        {
                            result.ResultStatus = -1;
                            result.Message = "不能同时申请不同子合约中的库存付款";
                            return result;
                        }
                    }

                    //更新合约付款
                    contractPayApply.ApplyBala = stockPayApplies.Sum(temp => temp.ApplyBala);
                    contractPayApply.ContractId = contractId;
                    contractPayApply.ContractSubId = subId;

                    result = contractPayApplyDAL.Update(user, contractPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    //新增dbo.Fun_StockPayApply_Ref库存付款申请
                    foreach (StockPayApply stockPayApply in stockPayApplies)
                    {
                        stockPayApply.ContractId = contractPayApply.ContractId;
                        stockPayApply.ContractRefId = contractPayApply.RefId;
                        stockPayApply.SubId = contractPayApply.ContractSubId;
                        stockPayApply.PayApplyId = contractPayApply.PayApplyId;
                        stockPayApply.RefStatus = StatusEnum.已生效;
                        result = stockPayApplyDAL.Insert(user, stockPayApply);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#4
0
        public ResultModel PayApplyInvoiceUpdate(UserModel user, Apply apply, PayApply payApply, List<InvoicePayApply> details)
        {
            ResultModel result = new ResultModel();

            try
            {
                InvoicePayApplyDAL invoicePayApplyDAL = new InvoicePayApplyDAL();
                ApplyDAL applyDAL = new ApplyDAL();
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                InvoiceDAL invoiceDAL = new InvoiceDAL();
                SIDAL sIDAL = new SIDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (details == null || details.Count == 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "未选中任务发票";
                        return result;
                    }

                    //验证总额
                    decimal sumApplyBala = details.Sum(temp => temp.ApplyBala);
                    if (sumApplyBala != payApply.ApplyBala)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请总额与分项总额不相等";
                        return result;
                    }

                    //获取付款申请
                    result = this.payapplyDAL.Get(user, payApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    PayApply resultPayApply = result.ReturnValue as PayApply;
                    if (resultPayApply == null || resultPayApply.PayApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请不存在";
                        return result;
                    }

                    //获取发票申请列表
                    result = invoicePayApplyDAL.Load(user, resultPayApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    List<InvoicePayApply> resultDetails = result.ReturnValue as List<InvoicePayApply>;
                    if (resultDetails == null)
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请发票明细列表获取失败";
                        return result;
                    }

                    //作废原有发票申请明细
                    foreach (InvoicePayApply detail in resultDetails)
                    {
                        detail.DetailStatus = StatusEnum.已录入;
                        result = invoicePayApplyDAL.Invalid(user, detail);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    //验证发票
                    int payDept = 0;
                    int outCorpId = 0;
                    foreach (InvoicePayApply detail in details)
                    {
                        //获取价外票
                        result = sIDAL.Get(user, detail.SIId);
                        if (result.ResultStatus != 0)
                            return result;

                        SI sI = result.ReturnValue as SI;
                        if (sI == null || sI.SIId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "价外票不存在";
                            return result;
                        }

                        //获取发票
                        result = invoiceDAL.Get(user, detail.InvoiceId);
                        if (result.ResultStatus != 0)
                            return result;

                        Operate.Model.Invoice invoice = result.ReturnValue as Operate.Model.Invoice;
                        if (invoice == null || invoice.InvoiceId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票不存在";
                            return result;
                        }

                        //验证币种
                        if (payApply.CurrencyId != invoice.CurrencyId)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票币种不一致";
                            return result;
                        }

                        //验证开票抬头
                        if (outCorpId == 0) { outCorpId = invoice.OutCorpId; }
                        if (outCorpId != invoice.OutCorpId)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票开票公司不一致";
                            return result;
                        }

                        //验证成本部门
                        if (payDept == 0) { payDept = sI.PayDept; }
                        if (payDept != sI.PayDept)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票成本部门不一致";
                            return result;
                        }

                        //验证可申请余额
                        result = invoicePayApplyDAL.LoadByInvoice(user, detail.InvoiceId);
                        if (result.ResultStatus != 0)
                            return result;
                        resultDetails = result.ReturnValue as List<InvoicePayApply>;
                        if (resultDetails == null)
                        {
                            result.ResultStatus = -1;
                            result.Message = "获取发票已申请列表失败";
                            return result;
                        }

                        decimal applyBala = resultDetails.Sum(temp => temp.ApplyBala);
                        if (applyBala >= invoice.InvoiceBala)
                        {
                            result.ResultStatus = -1;
                            result.Message = string.Format("发票{0}款项已全部申请", invoice.InvoiceNo);
                            return result;
                        }

                        if (invoice.InvoiceBala - applyBala < detail.ApplyBala)
                        {
                            result.ResultStatus = -1;
                            result.Message = string.Format("发票{0}申请金额超过可申请余额,申请失败", invoice.InvoiceNo);
                            return result;
                        }
                    }

                    //更新申请主表
                    Department dept = UserProvider.Departments.FirstOrDefault(temp => temp.DeptId == apply.ApplyDept);
                    if (dept == null || dept.DeptId < 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请部门不存在";
                        return result;
                    }

                    //获取主申请
                    result = applyDAL.Get(user, resultPayApply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Apply resultApply = result.ReturnValue as Apply;
                    if (resultApply == null || resultApply.ApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "主申请获取失败";
                        return result;
                    }

                    resultApply.ApplyDept = dept.DeptId;
                    resultApply.ApplyCorp = apply.ApplyCorp;
                    resultApply.ApplyDesc = apply.ApplyDesc;
                    resultApply.ApplyTime = apply.ApplyTime;
                    resultApply.EmpId = user.EmpId;
                    result = applyDAL.Update(user, resultApply);
                    if (result.ResultStatus != 0)
                        return result;

                    //更新付款申请表
                    resultPayApply.RecCorpId = payApply.RecCorpId;
                    resultPayApply.RecBankId = payApply.RecBankId;
                    resultPayApply.RecBankAccountId = payApply.RecBankAccountId;
                    resultPayApply.RecBankAccount = payApply.RecBankAccount;
                    resultPayApply.CurrencyId = payApply.CurrencyId;
                    resultPayApply.ApplyBala = sumApplyBala;
                    resultPayApply.PayMode = payApply.PayMode;
                    resultPayApply.PayDeadline = payApply.PayDeadline;
                    resultPayApply.PayMatter = payApply.PayMatter;
                    resultPayApply.SpecialDesc = payApply.SpecialDesc;

                    result = payapplyDAL.Update(user, resultPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    //新增发票付款申请关联表
                    foreach (InvoicePayApply detail in details)
                    {
                        detail.DetailStatus = StatusEnum.已生效;
                        detail.PayApplyId = resultPayApply.PayApplyId;

                        result = invoicePayApplyDAL.Insert(user, detail);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#5
0
        public ResultModel PayApplyMultiCreate(UserModel user, Apply apply, PayApply payApply, List<StockPayApply> stockDetails, bool isAudit)
        {
            ResultModel result = new ResultModel();

            try
            {
                ApplyDAL applyDAL = new ApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();
                StockPayApplyDAL stockPayApplyDAL = new StockPayApplyDAL();

                using (TransactionScope scope = new TransactionScope())
                {
                    //新增主申请
                    apply.ApplyStatus = StatusEnum.已录入;
                    apply.ApplyType = ApplyType.PayApply;
                    apply.EmpId = user.EmpId;
                    result = applyDAL.Insert(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    int applyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out applyId) || applyId <= 0)
                    {
                        result.Message = "主申请新增失败";
                        result.ResultStatus = -1;
                        return result;
                    }
                    apply.ApplyId = applyId;

                    //新增付款申请
                    payApply.ApplyId = apply.ApplyId;
                    payApply.PayApplySource = (int)FundsStyleEnum.ContractPayApply;
                    if (stockDetails != null && stockDetails.Any())
                        payApply.PayApplySource = (int)FundsStyleEnum.StockPayApply;

                    result = this.payapplyDAL.Insert(user, payApply);
                    if (result.ResultStatus != 0)
                        return result;

                    int payApplyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out payApplyId) || payApplyId <= 0)
                    {
                        result.Message = "付款申请新增失败";
                        result.ResultStatus = -1;
                        return result;
                    }
                    payApply.PayApplyId = payApplyId;

                    if (stockDetails != null)
                        foreach (int subId in stockDetails.Select(a => a.SubId).Distinct())
                        {
                            List<Model.StockPayApply> stockPayApplyDetails = stockDetails.Where(a => a.SubId == subId).ToList();

                            //新增合约付款申请
                            ContractPayApply contractPayApply = new ContractPayApply
                            {
                                ApplyBala = stockPayApplyDetails.Sum(a=>a.ApplyBala),
                                ContractId = stockPayApplyDetails.First().ContractId,
                                ContractSubId = subId,
                                PayApplyId = payApply.PayApplyId,
                                Status = StatusEnum.已录入
                            };
                            result = contractPayApplyDAL.Insert(user, contractPayApply);
                            if (result.ResultStatus != 0)
                                return result;

                            int contractPayApplyId = 0;
                            if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out contractPayApplyId) || contractPayApplyId <= 0)
                            {
                                result.Message = "合约关联新增失败";
                                result.ResultStatus = -1;
                                return result;
                            }
                            contractPayApply.RefId = contractPayApplyId;

                            foreach (StockPayApply detail in stockPayApplyDetails)
                            {
                                detail.ContractId = contractPayApply.ContractId;
                                detail.ContractRefId = contractPayApply.RefId;
                                detail.PayApplyId = contractPayApply.PayApplyId;
                                detail.RefStatus = StatusEnum.已生效;
                                detail.SubId = contractPayApply.ContractSubId;
                                result = stockPayApplyDAL.Insert(user, detail);
                                if (result.ResultStatus != 0)
                                    return result;
                            }
                        }

                    if (result.ResultStatus == 0)
                        result.ReturnValue = payApply;

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#6
0
        public ResultModel PayApplyCreate(UserModel user, Apply apply, PayApply payApply, List<StockPayApply> stockDetails, int subId, bool isAudit)
        {
            ResultModel result = new ResultModel();

            try
            {
                ApplyDAL applyDAL = new ApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();
                StockPayApplyDAL stockPayApplyDAL = new StockPayApplyDAL();
                StockDAL stockDAL = new StockDAL();
                StockLogDAL stockLogDAL = new StockLogDAL();
                ContractSubDAL subDAL = new ContractSubDAL();

                using (TransactionScope scope = new TransactionScope())
                {
                    //新增主申请
                    apply.ApplyStatus = StatusEnum.已录入;
                    apply.ApplyType = ApplyType.PayApply;
                    apply.EmpId = user.EmpId;
                    result = applyDAL.Insert(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    int applyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out applyId) || applyId <= 0)
                    {
                        result.Message = "主申请新增失败";
                        result.ResultStatus = -1;
                        return result;
                    }
                    apply.ApplyId = applyId;

                    //新增付款申请
                    payApply.ApplyId = apply.ApplyId;
                    payApply.PayApplySource = (int)FundsStyleEnum.ContractPayApply;
                    if (stockDetails != null && stockDetails.Count > 0)
                        payApply.PayApplySource = (int)FundsStyleEnum.StockPayApply;

                    result = this.payapplyDAL.Insert(user, payApply);
                    if (result.ResultStatus != 0)
                        return result;

                    int payApplyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out payApplyId) || payApplyId <= 0)
                    {
                        result.Message = "付款申请新增失败";
                        result.ResultStatus = -1;
                        return result;
                    }
                    payApply.PayApplyId = payApplyId;

                    //获取子合约
                    result = subDAL.Get(user, subId);
                    if (result.ResultStatus != 0)
                        return result;

                    ContractSub sub = result.ReturnValue as ContractSub;
                    if (sub == null || sub.SubId <= 0)
                    {
                        result.Message = "子合约获取失败";
                        result.ResultStatus = -1;
                        return result;
                    }

                    if (sub.SubStatus != StatusEnum.已生效)
                    {
                        result.Message = "子合约状态不正确,不能进行付款申请";
                        result.ResultStatus = -1;
                        return result;
                    }
                    //新增合约付款申请
                    ContractPayApply contractPayApply = new ContractPayApply();
                    contractPayApply.ApplyBala = payApply.ApplyBala;
                    contractPayApply.ContractId = sub.ContractId;
                    contractPayApply.ContractSubId = sub.SubId;
                    contractPayApply.PayApplyId = payApply.PayApplyId;
                    contractPayApply.Status = StatusEnum.已录入;
                    result = contractPayApplyDAL.Insert(user, contractPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    int contractPayApplyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out contractPayApplyId) || contractPayApplyId <= 0)
                    {
                        result.Message = "合约关联新增失败";
                        result.ResultStatus = -1;
                        return result;
                    }
                    contractPayApply.RefId = contractPayApplyId;

                    //新增库存付款申请
                    if (stockDetails != null && stockDetails.Count > 0)
                    {
                        foreach (StockPayApply detail in stockDetails)
                        {
                            detail.ContractId = contractPayApply.ContractId;
                            detail.ContractRefId = contractPayApply.RefId;
                            detail.PayApplyId = contractPayApply.PayApplyId;
                            detail.RefStatus = StatusEnum.已生效;
                            detail.SubId = contractPayApply.ContractSubId;
                            result = stockPayApplyDAL.Insert(user, detail);
                            if (result.ResultStatus != 0)
                                return result;
                        }
                    }

                    if (result.ResultStatus == 0)
                        result.ReturnValue = payApply;

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#7
0
        public ResultModel PayApplyInvoiceCreate(UserModel user, Apply apply, PayApply payApply, List<InvoicePayApply> details)
        {
            ResultModel result = new ResultModel();

            try
            {
                InvoicePayApplyDAL invoicePayApplyDAL = new InvoicePayApplyDAL();
                ApplyDAL applyDAL = new ApplyDAL();
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                InvoiceDAL invoiceDAL = new InvoiceDAL();
                SIDAL sIDAL = new SIDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (details == null || details.Count == 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "未选中任务发票";
                        return result;
                    }

                    //验证总额
                    decimal sumApplyBala = details.Sum(temp => temp.ApplyBala);
                    if (sumApplyBala != payApply.ApplyBala)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请总额与分项总额不相等";
                        return result;
                    }

                    //验证发票
                    int payDept = 0;
                    int outCorpId = 0;
                    foreach (InvoicePayApply detail in details)
                    {
                        //获取价外票
                        result = sIDAL.Get(user, detail.SIId);
                        if (result.ResultStatus != 0)
                            return result;

                        SI sI = result.ReturnValue as SI;
                        if (sI == null || sI.SIId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "价外票不存在";
                            return result;
                        }

                        //获取发票
                        result = invoiceDAL.Get(user, detail.InvoiceId);
                        if (result.ResultStatus != 0)
                            return result;

                        Operate.Model.Invoice invoice = result.ReturnValue as Operate.Model.Invoice;
                        if (invoice == null || invoice.InvoiceId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票不存在";
                            return result;
                        }

                        //验证币种
                        if (payApply.CurrencyId != invoice.CurrencyId)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票币种不一致";
                            return result;
                        }

                        //验证开票抬头
                        if (outCorpId == 0) { outCorpId = invoice.OutCorpId; }
                        if (outCorpId != invoice.OutCorpId)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票开票公司不一致";
                            return result;
                        }

                        //验证成本部门
                        if (payDept == 0) { payDept = sI.PayDept; }
                        if (payDept != sI.PayDept)
                        {
                            result.ResultStatus = -1;
                            result.Message = "发票成本部门不一致";
                            return result;
                        }

                        //验证可申请余额
                        result = invoicePayApplyDAL.LoadByInvoice(user, detail.InvoiceId);
                        if (result.ResultStatus != 0)
                            return result;
                        List<InvoicePayApply> resultDetails = result.ReturnValue as List<InvoicePayApply>;
                        if (resultDetails == null)
                        {
                            result.ResultStatus = -1;
                            result.Message = "获取发票已申请列表失败";
                            return result;
                        }

                        decimal applyBala = resultDetails.Sum(temp => temp.ApplyBala);
                        if (applyBala >= invoice.InvoiceBala)
                        {
                            result.ResultStatus = -1;
                            result.Message = string.Format("发票{0}款项已全部申请", invoice.InvoiceNo);
                            return result;
                        }

                        if (invoice.InvoiceBala - applyBala < detail.ApplyBala)
                        {
                            result.ResultStatus = -1;
                            result.Message = string.Format("发票{0}申请金额超过可申请余额,申请失败", invoice.InvoiceNo);
                            return result;
                        }
                    }

                    //新增申请主表
                    Department dept = UserProvider.Departments.FirstOrDefault(temp => temp.DeptId == apply.ApplyDept);
                    if (dept == null || dept.DeptId < 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请部门不存在";
                        return result;
                    }

                    int applyId = 0;
                    apply.ApplyDept = dept.DeptId;
                    apply.ApplyType = ApplyType.付款申请;
                    apply.EmpId = user.EmpId;
                    apply.ApplyStatus = StatusEnum.已录入;
                    result = applyDAL.Insert(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out applyId))
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请主表新增失败";
                        return result;
                    }

                    //新增付款申请表
                    payApply.ApplyId = applyId;
                    payApply.PayApplySource = (int)FundsStyleEnum.InvoicePayApply;
                    payApply.ApplyBala = sumApplyBala;
                    result = payapplyDAL.Insert(user, payApply);
                    if (result.ResultStatus != 0)
                        return result;
                    int payApplyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out payApplyId))
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请新增失败";
                        return result;
                    }

                    //新增发票付款申请关联表
                    foreach (InvoicePayApply detail in details)
                    {
                        detail.DetailStatus = StatusEnum.已生效;
                        detail.PayApplyId = payApplyId;

                        result = invoicePayApplyDAL.Insert(user, detail);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#8
0
        public ResultModel PayApplyContractUpdate(UserModel user, PayApply payApply, string memo, int deptId, int corpId)
        {
            ResultModel result = new ResultModel();

            try
            {
                ContractSubDAL subDAL = new ContractSubDAL();
                ApplyDAL applyDAL = new ApplyDAL();
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //验证付款申请
                    result = payApplyDAL.Get(user, payApply.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;
                    PayApply resultObj = result.ReturnValue as PayApply;
                    if (resultObj == null || resultObj.PayApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请不存在";
                        return result;
                    }

                    //验证申请主表
                    result = applyDAL.Get(user, resultObj.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;
                    Apply apply = result.ReturnValue as Apply;
                    if (apply == null || apply.ApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请主表不存在";
                        return result;
                    }

                    //验证合约付款申请关联表
                    result = contractPayApplyDAL.GetByPayApplyId(user, resultObj.PayApplyId);
                    if (result.ResultStatus != 0)
                        return result;
                    ContractPayApply contractPayApply = result.ReturnValue as ContractPayApply;
                    if (contractPayApply == null || contractPayApply.RefId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "与合约关联错误";
                        return result;
                    }

                    //验证子合约信息
                    result = subDAL.Get(user, contractPayApply.ContractSubId);
                    if (result.ResultStatus != 0)
                        return result;
                    ContractSub sub = result.ReturnValue as ContractSub;
                    if (sub == null || sub.SubId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "子合约不存在";
                        return result;
                    }

                    //验证可申请金额
                    //NFMT.Data.Model.FuturesPrice futuresPrice = NFMT.Data.BasicDataProvider.FuturesPrices[0];

                    //更新申请主表
                    Department dept = UserProvider.Departments.FirstOrDefault(temp => temp.DeptId == deptId);
                    if (dept == null || dept.DeptId < 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请部门不存在";
                        return result;
                    }

                    apply.ApplyDept = dept.DeptId;
                    apply.ApplyCorp = corpId;
                    apply.ApplyDesc = memo;
                    apply.ApplyType = ApplyType.付款申请;
                    apply.EmpId = user.EmpId;

                    result = applyDAL.Update(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    //更新付款申请表
                    resultObj.PayApplySource = (int)FundsStyleEnum.ContractPayApply;
                    resultObj.RecCorpId = payApply.RecCorpId;
                    resultObj.RecBankId = payApply.RecBankId;
                    resultObj.RecBankAccountId = payApply.RecBankAccountId;
                    resultObj.RecBankAccount = payApply.RecBankAccount;
                    resultObj.ApplyBala = payApply.ApplyBala;
                    resultObj.CurrencyId = payApply.CurrencyId;
                    resultObj.PayMode = payApply.PayMode;
                    resultObj.PayDeadline = payApply.PayDeadline;
                    resultObj.PayMatter = payApply.PayMatter;
                    resultObj.SpecialDesc = payApply.SpecialDesc;

                    result = payapplyDAL.Update(user, resultObj);
                    if (result.ResultStatus != 0)
                        return result;

                    //更新Fun_ContractPayApply_Ref合约付款申请
                    contractPayApply.ApplyBala = payApply.ApplyBala;
                    result = contractPayApplyDAL.Update(user, contractPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#9
0
        public ResultModel PayApplyContractCreate(UserModel user, PayApply payApply, int subId, string memo, int deptId, int corpId)
        {
            ResultModel result = new ResultModel();

            try
            {
                ContractSubDAL subDAL = new ContractSubDAL();
                ApplyDAL applyDAL = new ApplyDAL();
                PayApplyDAL payApplyDAL = new PayApplyDAL();
                ContractPayApplyDAL contractPayApplyDAL = new ContractPayApplyDAL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //验证子合约信息
                    result = subDAL.Get(user, subId);
                    if (result.ResultStatus != 0)
                        return result;
                    ContractSub sub = result.ReturnValue as ContractSub;
                    if (sub == null || sub.SubId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "子合约不存在";
                        return result;
                    }

                    //验证可申请金额
                    //NFMT.Data.Model.FuturesPrice futuresPrice = NFMT.Data.BasicDataProvider.FuturesPrices[0];

                    //新增申请主表
                    Department dept = UserProvider.Departments.FirstOrDefault(temp => temp.DeptId == deptId);
                    if (dept == null || dept.DeptId < 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请部门不存在";
                        return result;
                    }

                    int applyId = 0;
                    Apply apply = new Apply();

                    apply.ApplyDept = dept.DeptId;
                    apply.ApplyCorp = corpId;
                    apply.ApplyDesc = memo;
                    apply.ApplyTime = DateTime.Now;
                    apply.ApplyType = ApplyType.付款申请;
                    apply.EmpId = user.EmpId;

                    result = applyDAL.Insert(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out applyId))
                    {
                        result.ResultStatus = -1;
                        result.Message = "申请主表新增失败";
                        return result;
                    }

                    //新增付款申请表
                    payApply.ApplyId = applyId;
                    payApply.PayApplySource = (int)FundsStyleEnum.ContractPayApply;
                    result = payapplyDAL.Insert(user, payApply);
                    if (result.ResultStatus != 0)
                        return result;
                    int payApplyId = 0;
                    if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out payApplyId))
                    {
                        result.ResultStatus = -1;
                        result.Message = "付款申请新增失败";
                        return result;
                    }

                    //新增Fun_ContractPayApply_Ref合约付款申请
                    ContractPayApply contractPayApply = new ContractPayApply();
                    contractPayApply.ContractId = sub.ContractId;
                    contractPayApply.ContractSubId = sub.SubId;
                    contractPayApply.PayApplyId = payApplyId;
                    contractPayApply.ApplyBala = payApply.ApplyBala;

                    result = contractPayApplyDAL.Insert(user, contractPayApply);
                    if (result.ResultStatus != 0)
                        return result;

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            VerificationUtility ver = new VerificationUtility();
            ver.JudgeOperate(this.Page, 52, new List<OperateEnum>() { OperateEnum.修改 });

            if (!IsPostBack)
            {
                UserModel user = UserUtility.CurrentUser;
                this.curUser = user;

                this.PayMatterStyle = (int)StyleEnum.付款事项;
                this.PayModeStyle = (int)StyleEnum.PayMode;

                string redirectUrl = "PayApplyList.aspx";

                this.navigation1.Routes.Add("付款申请列表", redirectUrl);
                this.navigation1.Routes.Add("付款申请明细", string.Empty);

                int applyId = 0, payApplyId = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["aid"]))
                    int.TryParse(Request.QueryString["aid"], out applyId);
                if (applyId <= 0 && (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out payApplyId)))
                    this.WarmAlert("付款申请序号错误", redirectUrl);

                ResultModel result = new ResultModel();

                //获取付款申请
                PayApplyBLL payApplyBLL = new PayApplyBLL();
                if (applyId > 0)
                    result = payApplyBLL.GetByApplyId(user, applyId);
                else
                    result = payApplyBLL.Get(user, payApplyId);

                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款申请失败", redirectUrl);

                PayApply payApply = result.ReturnValue as PayApply;
                if (payApply == null || payApply.PayApplyId <= 0)
                    this.WarmAlert("获取付款申请失败", redirectUrl);

                this.curPayApply = payApply;

                //获取主申请
                ApplyBLL applyBLL = new ApplyBLL();
                result = applyBLL.Get(user, payApply.ApplyId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取主申请失败", redirectUrl);

                Apply apply = result.ReturnValue as Apply;
                if (apply == null || apply.ApplyId <= 0)
                    this.WarmAlert("获取主申请失败", redirectUrl);

                this.curApply = apply;

                //获取合约付款申请
                ContractPayApplyBLL contractPayApplyBLL = new ContractPayApplyBLL();
                result = contractPayApplyBLL.GetByPayApplyId(user, payApply.PayApplyId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                ContractPayApply contractPayApply = result.ReturnValue as ContractPayApply;
                if (contractPayApply == null || contractPayApply.RefId <= 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                //获取子合约
                ContractSubBLL subBll = new ContractSubBLL();
                result = subBll.Get(user, contractPayApply.ContractSubId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取子合约失败", redirectUrl);
                ContractSub sub = result.ReturnValue as ContractSub;
                if (sub == null || sub.ContractId == 0)
                    this.WarmAlert("获取子合约失败", redirectUrl);

                this.curSub = sub;

                //合约
                ContractBLL bll = new ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId == 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;

                SelectModel select = payApplyBLL.GetPayApplyStocksSelect(1, 100, "spa.RefId desc", payApply.PayApplyId);
                result = payApplyBLL.Load(user, select, DefaultValue.ClearAuth);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款库存列表失败", redirectUrl);

                DataTable dt = result.ReturnValue as DataTable;
                if (dt == null)
                    this.WarmAlert("获取付款库存列表失败", redirectUrl);

                this.StockDetailsJson = JsonConvert.SerializeObject(dt, new DataTableConverter());

                //付款明细
                PaymentBLL paymentBLL = new PaymentBLL();
                select = paymentBLL.GetSelectModel(1, 100, "pay.PaymentId desc", DefaultValue.DefaultTime, DefaultValue.DefaultTime, 0, 0, (int)StatusEnum.已生效, payApply.PayApplyId);
                result = paymentBLL.Load(user, select, DefaultValue.ClearAuth);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款明细失败", redirectUrl);

                dt = result.ReturnValue as DataTable;
                if (dt == null)
                    this.WarmAlert("获取付款明细失败", redirectUrl);
                this.PaymentJson = JsonConvert.SerializeObject(dt, new DataTableConverter());

                //审核实体
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string json = serializer.Serialize(apply);
                this.hidModel.Value = json;

                FundsStyleEnum fundsStyle = (FundsStyleEnum)payApply.PayApplySource;
                result = payApplyBLL.GetAuditInfo(user, payApply.ApplyId, fundsStyle);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款申请审核信息失败", redirectUrl);

                //this.txbAuditInfo.InnerHtml = result.ReturnValue.ToString();

                if (apply.ApplyStatus != StatusEnum.已录入 && apply.ApplyStatus != StatusEnum.待审核 && apply.ApplyStatus != StatusEnum.审核拒绝
                    && apply.ApplyStatus != StatusEnum.已撤返)
                {
                    //this.jqxAuditInfoExpander.Visible = false;
                }
                else if (apply.ApplyStatus == StatusEnum.已生效 || apply.ApplyStatus == StatusEnum.已完成)
                {

                }
            }
        }
示例#11
0
        public ResultModel GetByApplyId(UserModel user, int applyId)
        {
            ResultModel result = new ResultModel();

            if (applyId < 1)
            {
                result.Message = "序号不能小于1";
                return result;
            }

            List<SqlParameter> paras = new List<SqlParameter>();
            SqlParameter para = new SqlParameter("@applyId", SqlDbType.Int, 4);
            para.Value = applyId;
            paras.Add(para);

            SqlDataReader dr = null;

            try
            {
                string cmdText = "select * from dbo.Fun_PayApply where ApplyId=@applyId";
                dr = SqlHelper.ExecuteReader(ConnectString, CommandType.Text, cmdText, paras.ToArray());

                PayApply payapply = new PayApply();

                if (dr.Read())
                {
                    int indexPayApplyId = dr.GetOrdinal("PayApplyId");
                    payapply.PayApplyId = Convert.ToInt32(dr[indexPayApplyId]);

                    int indexApplyId = dr.GetOrdinal("ApplyId");
                    if (dr["ApplyId"] != DBNull.Value)
                    {
                        payapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
                    }

                    int indexPayApplySource = dr.GetOrdinal("PayApplySource");
                    if (dr["PayApplySource"] != DBNull.Value)
                    {
                        payapply.PayApplySource = Convert.ToInt32(dr[indexPayApplySource]);
                    }

                    int indexRecBlocId = dr.GetOrdinal("RecBlocId");
                    if (dr["RecBlocId"] != DBNull.Value)
                    {
                        payapply.RecBlocId = Convert.ToInt32(dr[indexRecBlocId]);
                    }

                    int indexRecCorpId = dr.GetOrdinal("RecCorpId");
                    if (dr["RecCorpId"] != DBNull.Value)
                    {
                        payapply.RecCorpId = Convert.ToInt32(dr[indexRecCorpId]);
                    }

                    int indexRecBankId = dr.GetOrdinal("RecBankId");
                    if (dr["RecBankId"] != DBNull.Value)
                    {
                        payapply.RecBankId = Convert.ToInt32(dr[indexRecBankId]);
                    }

                    int indexRecBankAccountId = dr.GetOrdinal("RecBankAccountId");
                    if (dr["RecBankAccountId"] != DBNull.Value)
                    {
                        payapply.RecBankAccountId = Convert.ToInt32(dr[indexRecBankAccountId]);
                    }

                    int indexRecBankAccount = dr.GetOrdinal("RecBankAccount");
                    if (dr["RecBankAccount"] != DBNull.Value)
                    {
                        payapply.RecBankAccount = Convert.ToString(dr[indexRecBankAccount]);
                    }

                    int indexApplyBala = dr.GetOrdinal("ApplyBala");
                    if (dr["ApplyBala"] != DBNull.Value)
                    {
                        payapply.ApplyBala = Convert.ToDecimal(dr[indexApplyBala]);
                    }

                    int indexCurrencyId = dr.GetOrdinal("CurrencyId");
                    if (dr["CurrencyId"] != DBNull.Value)
                    {
                        payapply.CurrencyId = Convert.ToInt32(dr[indexCurrencyId]);
                    }

                    int indexPayMode = dr.GetOrdinal("PayMode");
                    if (dr["PayMode"] != DBNull.Value)
                    {
                        payapply.PayMode = Convert.ToInt32(dr[indexPayMode]);
                    }

                    int indexPayDeadline = dr.GetOrdinal("PayDeadline");
                    if (dr["PayDeadline"] != DBNull.Value)
                    {
                        payapply.PayDeadline = Convert.ToDateTime(dr[indexPayDeadline]);
                    }

                    int indexSpecialDesc = dr.GetOrdinal("SpecialDesc");
                    if (dr["SpecialDesc"] != DBNull.Value)
                    {
                        payapply.SpecialDesc = Convert.ToString(dr[indexSpecialDesc]);
                    }

                    int indexPayMatter = dr.GetOrdinal("PayMatter");
                    if (dr["PayMatter"] != DBNull.Value)
                    {
                        payapply.PayMatter = Convert.ToInt32(dr[indexPayMatter]);
                    }

                    int indexRealPayCorpId = dr.GetOrdinal("RealPayCorpId");
                    if (dr["RealPayCorpId"] != DBNull.Value)
                    {
                        payapply.RealPayCorpId = Convert.ToInt32(dr[indexRealPayCorpId]);
                    }

                    int indexCreatorId = dr.GetOrdinal("CreatorId");
                    if (dr["CreatorId"] != DBNull.Value)
                    {
                        payapply.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
                    }

                    int indexCreateTime = dr.GetOrdinal("CreateTime");
                    if (dr["CreateTime"] != DBNull.Value)
                    {
                        payapply.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
                    }

                    int indexLastModifyId = dr.GetOrdinal("LastModifyId");
                    if (dr["LastModifyId"] != DBNull.Value)
                    {
                        payapply.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
                    }

                    int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
                    if (dr["LastModifyTime"] != DBNull.Value)
                    {
                        payapply.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
                    }

                    result.AffectCount = 1;
                    result.Message = "读取成功";
                    result.ResultStatus = 0;
                    result.ReturnValue = payapply;
                }
                else
                {
                    result.Message = "读取失败或无数据";
                    result.AffectCount = 0;
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            finally
            {
                if (dr != null)
                    dr.Dispose();
            }
            return result;
        }
示例#12
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            PayApply payapply = new PayApply();

            int indexPayApplyId = dr.GetOrdinal("PayApplyId");
            payapply.PayApplyId = Convert.ToInt32(dr[indexPayApplyId]);

            int indexApplyId = dr.GetOrdinal("ApplyId");
            if (dr["ApplyId"] != DBNull.Value)
            {
                payapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
            }

            int indexPayApplySource = dr.GetOrdinal("PayApplySource");
            if (dr["PayApplySource"] != DBNull.Value)
            {
                payapply.PayApplySource = Convert.ToInt32(dr[indexPayApplySource]);
            }

            int indexRecBlocId = dr.GetOrdinal("RecBlocId");
            if (dr["RecBlocId"] != DBNull.Value)
            {
                payapply.RecBlocId = Convert.ToInt32(dr[indexRecBlocId]);
            }

            int indexRecCorpId = dr.GetOrdinal("RecCorpId");
            if (dr["RecCorpId"] != DBNull.Value)
            {
                payapply.RecCorpId = Convert.ToInt32(dr[indexRecCorpId]);
            }

            int indexRecBankId = dr.GetOrdinal("RecBankId");
            if (dr["RecBankId"] != DBNull.Value)
            {
                payapply.RecBankId = Convert.ToInt32(dr[indexRecBankId]);
            }

            int indexRecBankAccountId = dr.GetOrdinal("RecBankAccountId");
            if (dr["RecBankAccountId"] != DBNull.Value)
            {
                payapply.RecBankAccountId = Convert.ToInt32(dr[indexRecBankAccountId]);
            }

            int indexRecBankAccount = dr.GetOrdinal("RecBankAccount");
            if (dr["RecBankAccount"] != DBNull.Value)
            {
                payapply.RecBankAccount = Convert.ToString(dr[indexRecBankAccount]);
            }

            int indexApplyBala = dr.GetOrdinal("ApplyBala");
            if (dr["ApplyBala"] != DBNull.Value)
            {
                payapply.ApplyBala = Convert.ToDecimal(dr[indexApplyBala]);
            }

            int indexCurrencyId = dr.GetOrdinal("CurrencyId");
            if (dr["CurrencyId"] != DBNull.Value)
            {
                payapply.CurrencyId = Convert.ToInt32(dr[indexCurrencyId]);
            }

            int indexPayMode = dr.GetOrdinal("PayMode");
            if (dr["PayMode"] != DBNull.Value)
            {
                payapply.PayMode = Convert.ToInt32(dr[indexPayMode]);
            }

            int indexPayDeadline = dr.GetOrdinal("PayDeadline");
            if (dr["PayDeadline"] != DBNull.Value)
            {
                payapply.PayDeadline = Convert.ToDateTime(dr[indexPayDeadline]);
            }

            int indexSpecialDesc = dr.GetOrdinal("SpecialDesc");
            if (dr["SpecialDesc"] != DBNull.Value)
            {
                payapply.SpecialDesc = Convert.ToString(dr[indexSpecialDesc]);
            }

            int indexPayMatter = dr.GetOrdinal("PayMatter");
            if (dr["PayMatter"] != DBNull.Value)
            {
                payapply.PayMatter = Convert.ToInt32(dr[indexPayMatter]);
            }

            int indexRealPayCorpId = dr.GetOrdinal("RealPayCorpId");
            if (dr["RealPayCorpId"] != DBNull.Value)
            {
                payapply.RealPayCorpId = Convert.ToInt32(dr[indexRealPayCorpId]);
            }

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            if (dr["CreatorId"] != DBNull.Value)
            {
                payapply.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
            }

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            if (dr["CreateTime"] != DBNull.Value)
            {
                payapply.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
            }

            int indexLastModifyId = dr.GetOrdinal("LastModifyId");
            if (dr["LastModifyId"] != DBNull.Value)
            {
                payapply.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
            }

            int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
            if (dr["LastModifyTime"] != DBNull.Value)
            {
                payapply.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
            }

            return payapply;
        }