public bool ValidVoucher(VoucherViewModel voucher, out string err) { err = string.Empty; //账期校验 AccountBook accBook = _accountBook.GetCurrentBook(); if (accBook.StartYear < voucher.VoucherDate.Year || (accBook.StartYear == voucher.VoucherDate.Year && accBook.StartPeriod > voucher.VoucherDate.Month)) { err = "凭证日期无效"; return(false); } //验证凭证字号 int maxSn = _voucher.GetMaxCertWordSn(voucher.VoucherDate, voucher.CwId); if (maxSn + 1 != voucher.CertWordSN) { voucher.CertWordSN = maxSn + 1; } //验证账是否平 err = _voucher.IsVoucherBalance(voucher); return(err == string.Empty ? true : false); }
public IHttpActionResult GetNewCertWordSn(DateTime vDate, int cwId) { var newSn = _voucher.GetMaxCertWordSn(vDate, cwId) + 1; return(Ok(newSn)); }