This commit is contained in:
mmrbnjd
2024-08-08 18:20:21 +03:30
parent cd95332a3d
commit 70df7d48b4
5 changed files with 119 additions and 19 deletions

View File

@@ -12,6 +12,7 @@ namespace Back.Services
{
private readonly IAsyncRepository<SentTax> _repoSentTax;
private readonly IAsyncRepository<Pattern> _repoPattern;
private readonly IAsyncRepository<BillType> _repoBillType;
private readonly IAsyncRepository<Invoice> _invoiceRepo;
private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo;
private readonly IAsyncRepository<FildModeInPattern> _fildModeInPatternRepo;
@@ -20,7 +21,7 @@ namespace Back.Services
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern
, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<FildModeInPattern> fildModeInPatternRepo
, IAsyncRepository<Coding> codingRepo, IAsyncRepository<SpecialCondition> specialConditionRepo
, IAsyncRepository<InvoiceItem> invoiceitemRepo)
, IAsyncRepository<InvoiceItem> invoiceitemRepo, IAsyncRepository<BillType> repoBillType)
{
_repoSentTax = repoSentTax;
_repoPattern = repoPattern;
@@ -29,6 +30,7 @@ namespace Back.Services
_codingRepo = codingRepo;
_specialConditionRepo = specialConditionRepo;
_invoiceitemRepo = invoiceitemRepo;
_repoBillType = repoBillType;
}
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
{
@@ -45,10 +47,19 @@ namespace Back.Services
&& (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send || w.SentStatus == SentStatus.pending)
&& w.invoice.CompanyID != CompanyID).AnyAsync();
}
public async Task<List<IdName<int>>> GetPatterns()
public async Task<List<IdName<int>>> GetPatterns(bool inp=false)
{
if(inp)
return await _repoPattern.Get(w => w.Status).Select(s => new IdName<int> { ID = s.inp, Title = s.Title }).ToListAsync();
else
return await _repoPattern.Get(w=>w.Status).Select(s => new IdName<int> { ID = s.ID, Title = s.Title }).ToListAsync();
}
public async Task<List<IdName<int>>> GetBillTypes()
{
return await _repoBillType.GetAll().Select(s => new IdName<int> { ID = s.inty, Title = s.Title }).ToListAsync();
}
public async Task<bool> UpdateInvoice(Invoice invoice)
{