public DataResult AbandonedCollectInvoice(CollectInvoiceStatusModel inputCollectInvoice) { #region 角色验证 if (LoginUser.Type != 0 && LoginUser.Type != UserType.Branch) { throw new DataOperationPermissions(BusinessResourceMessage.NoPower); } #endregion #region 输入验证 if (inputCollectInvoice.ID == 0) throw new DataValidationException(string.Format(BusinessResourceMessage.Inexistent, "付款发票")); //if (string.IsNullOrEmpty(inputCollectInvoice.Remark)) // throw new DataValidationException(string.Format(BusinessResourceMessage.ItemCanNotNull, "废弃发票备注")); #endregion inputCollectInvoice.OperatorID = LoginUser.ID; inputCollectInvoice.OperatorName = LoginUser.Name; inputCollectInvoice.OptionTime = DateTime.Now; inputCollectInvoice.Status = CollectInvoiceStatus.Discard; collectinvoiceService.EditCollectInvoiceStatus(inputCollectInvoice); dataResult.Code = ResponseStatusCode.Success; dataResult.Msg = BusinessResourceMessage.Success; return dataResult; }
/// <summary> /// 修改付款发票状态 /// </summary> /// <param name="collectinvoicemodel"></param> public void EditCollectInvoiceStatus(CollectInvoiceStatusModel collectinvoicemodel) { ///付款收票表 CollectInvoice mCollectInvoice = _collectinvoiceRepository.GetModelTracking() .Include(o => o.Payment) .Include(o => o.Payment.Special) .Include(o => o.Payment.Special.SpecialCapital) .Where(o => o.ID == collectinvoicemodel.ID) .FirstOrDefault(); if (mCollectInvoice == null) throw new BusinessException(string.Format(BusinessResourceMessage.ItemNotFound, "收票信息")); SpecialCapital mTempSpecialCapital = mCollectInvoice.Payment.Special.SpecialCapital; //付款收票对应所有发票 var lstDetail = (from p in _collectinvoicedetailRepository.GetModel() where p.CollectInvoiceId == mCollectInvoice.ID select p).ToList(); ///发票总金额 decimal deMoney = lstDetail.Sum(o => o.Money); ///收票 if (collectinvoicemodel.Status == CollectInvoiceStatus.HasCollectInvoice) { //_collectinvoiceRepository.Update(x => x.ID == collectinvoicemodel.ID, u => new CollectInvoice //{ // Status = collectinvoicemodel.Status, // Remark = collectinvoicemodel.Remark, // UpdaterId = collectinvoicemodel.OperatorID, // UpdaterName = collectinvoicemodel.OperatorName, // UpdateTime = collectinvoicemodel.OptionTime //}); mCollectInvoice.Status = collectinvoicemodel.Status; mCollectInvoice.Remark = collectinvoicemodel.Remark; mCollectInvoice.UpdaterId = collectinvoicemodel.OperatorID; mCollectInvoice.UpdaterName = collectinvoicemodel.OperatorName; mCollectInvoice.UpdateTime = collectinvoicemodel.OptionTime; mCollectInvoice.Payment.Special.SpecialCapital.InvoiceCollect += deMoney; mCollectInvoice.Payment.Special.UpdaterId = collectinvoicemodel.OperatorID; mCollectInvoice.Payment.Special.UpdaterName = collectinvoicemodel.OperatorName; mCollectInvoice.Payment.Special.UpdateTime = collectinvoicemodel.OptionTime; _collectinvoiceRepository.Update(mCollectInvoice); //SpecialCapital mSpecialCapital = new SpecialCapital(); //mSpecialCapital.InvoiceCollect = mSpecialCapital.InvoiceCollect + deMoney; //_specialRepository.Update(x => x.ID == mCollectInvoice.Payment.SpecialId, u => new Special //{ // SpecialCapital = mSpecialCapital, // UpdaterId = collectinvoicemodel.OperatorID, // UpdaterName = collectinvoicemodel.OperatorName, // UpdateTime = collectinvoicemodel.OptionTime //}); } else { _collectinvoiceRepository.Update(x => x.ID == collectinvoicemodel.ID, u => new CollectInvoice { Status = collectinvoicemodel.Status, Remark = collectinvoicemodel.Remark, UpdaterId = collectinvoicemodel.OperatorID, UpdaterName = collectinvoicemodel.OperatorName, UpdateTime = collectinvoicemodel.OptionTime }); } }
public DataResult ExamineCollectInvoice(CollectInvoiceStatusModel inputCollectInvoice) { #region 角色验证 if (LoginUser.Type != 0 && LoginUser.Type != UserType.Branch) { throw new DataOperationPermissions(BusinessResourceMessage.NoPower); } #endregion #region 输入验证 if (inputCollectInvoice.ID == 0) throw new DataValidationException(string.Format(BusinessResourceMessage.Inexistent, "付款发票")); #endregion inputCollectInvoice.OperatorID = LoginUser.ID; inputCollectInvoice.OperatorName = LoginUser.Name; inputCollectInvoice.OptionTime = DateTime.Now; inputCollectInvoice.Status = CollectInvoiceStatus.HasCollectInvoice; collectinvoiceService.EditCollectInvoiceStatus(inputCollectInvoice); dataResult.Code = ResponseStatusCode.Success; dataResult.Msg = BusinessResourceMessage.Success; return dataResult; }