public DataResult AddCollectInvoice(DebitAddModel inputcontract)
        {
            #region 角色验证
            if (LoginUser.Type != 0 && LoginUser.Type != UserType.Branch)
            {
                throw new DataOperationPermissions(BusinessResourceMessage.NoPower);
            }
            #endregion

            #region 输入验证
            decimal deMoney = 0;
            if (inputcontract.SpecialId == 0)
                throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseSelect, "签约专线"));
            if (inputcontract.TypeId == 0)
                throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseSelect, "扣款类型"));
            if (!CommonValidator.isMoney(inputcontract.Money.ToString()))
                throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseInput, "扣款金额"));
            if (string.IsNullOrEmpty(inputcontract.Remark))
                throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseInput, "扣款备注"));
            //if (!CommonValidator.isDateTime(inputcontract.Time.ToString()))
            //	throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseInput, "扣款时间"));
            DateTime dtNow = DateTime.Now;
            if (!inputcontract.Time.HasValue)
                inputcontract.Time = dtNow;
            #endregion
            inputcontract.OperatorID = LoginUser.ID;
            inputcontract.OperatorName = LoginUser.Name;
            inputcontract.OptionTime = dtNow;
            debitService.AddDebit(inputcontract);
            dataResult.Code = ResponseStatusCode.Success;
            dataResult.Msg = BusinessResourceMessage.Success;
            return dataResult;
        }
        /// <summary>
        /// 添加扣款
        /// </summary>
        /// <param name="contractview"></param>
        /// <returns></returns>
        public void AddDebit(DebitAddModel contractview)
        {
            Special mSpecial = _specialRepository.GetModelTracking().Where(o => o.ID == contractview.SpecialId)
                .Include(o=>o.SpecialCapital)
                .FirstOrDefault();
            if (mSpecial == null)
                throw new BusinessException(string.Format(BusinessResourceMessage.ItemNotFound, "专线信息"));
            if (mSpecial.Status == SpecialStatus.AccountCancellation)
                throw new BusinessException(string.Format(BusinessResourceMessage.Abnormal, "专线状态"));
            Deduction mDeduction = _deductionRepository.GetModel().Where(o => o.ID == contractview.TypeId && o.Status == true).FirstOrDefault();
            if (mDeduction == null)
                throw new BusinessException(string.Format(BusinessResourceMessage.Abnormal, "扣款类型"));
            //if (mSpecial.SpecialCapital.Balance < (decimal)contractview.Money)
            //	throw new BusinessException(string.Format(BusinessResourceMessage.ItemComparison, "扣款金额","专线余额"));

            //付款发票
            Debit mDebit = new Debit();
            mDebit.SpecialId = contractview.SpecialId;
            mDebit.TypeId = contractview.TypeId;
            mDebit.Money = contractview.Money.Value;
            mDebit.Remark = contractview.Remark;
            mDebit.Time = contractview.Time.Value;
            mDebit.DebitorId = contractview.OperatorID;
            mDebit.DebitorName = contractview.OperatorName;
            //mDebit.CreateTime = contractview.OptionTime;
            _debitRepository.Insert(mDebit);

            mSpecial.SpecialCapital.Balance -= (decimal)contractview.Money;

            _specialRepository.Update(mSpecial);
        }