This commit is contained in:
mmrbnjd
2024-05-31 00:24:45 +03:30
parent 579ccf78d6
commit 131330041c
13 changed files with 163 additions and 15 deletions

View File

@@ -2,6 +2,7 @@
using Back.Data.Contracts;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
using Back.Common;
namespace Back.Services
{
@@ -9,10 +10,13 @@ namespace Back.Services
{
private readonly IAsyncRepository<SentTax> _repoSentTax;
private readonly IAsyncRepository<Pattern> _repoPattern;
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern)
private readonly IAsyncRepository<Invoice> _invoiceRepo;
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern
, IAsyncRepository<Invoice> invoiceRepo)
{
_repoSentTax = repoSentTax;
_repoPattern = repoPattern;
_invoiceRepo = invoiceRepo;
}
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
{
@@ -34,5 +38,21 @@ namespace Back.Services
return await _repoPattern.Get(w=>w.Status).Select(s => new IdName<int> { ID = s.ID, Title = s.Title }).ToListAsync();
}
public async Task<Invoice?> GetInvoice(int CompanyID, int ID)
{
#region AdvancedSearch
var invok = _invoiceRepo
.Get(w => w.CompanyID == CompanyID && w.ID == ID && !w.IsDeleted);
#endregion
//-----------------------
return await invok
.Include(inc => inc.invoiceDetails)
.ThenInclude(inc => inc.cODItem)
.ThenInclude(inc => inc.CODUnit)
.FirstOrDefaultAsync();
}
}
}