This commit is contained in:
mmrbnjd
2024-08-15 19:15:51 +03:30
parent 4c82d49a0e
commit 21eeb4d11b
9 changed files with 259 additions and 139 deletions

View File

@@ -15,13 +15,14 @@ namespace Back.Services
private readonly IAsyncRepository<BillType> _repoBillType;
private readonly IAsyncRepository<Invoice> _invoiceRepo;
private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo;
private readonly IAsyncRepository<InvoicePayment> _invoicePaymentRepo;
private readonly IAsyncRepository<FildModeInPattern> _fildModeInPatternRepo;
private readonly IAsyncRepository<Coding> _codingRepo;
private readonly IAsyncRepository<SpecialCondition> _specialConditionRepo;
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern
, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<FildModeInPattern> fildModeInPatternRepo
, IAsyncRepository<Coding> codingRepo, IAsyncRepository<SpecialCondition> specialConditionRepo
, IAsyncRepository<InvoiceItem> invoiceitemRepo, IAsyncRepository<BillType> repoBillType)
, IAsyncRepository<InvoiceItem> invoiceitemRepo, IAsyncRepository<BillType> repoBillType, IAsyncRepository<InvoicePayment> invoicePaymentRepo)
{
_repoSentTax = repoSentTax;
_repoPattern = repoPattern;
@@ -31,6 +32,7 @@ namespace Back.Services
_specialConditionRepo = specialConditionRepo;
_invoiceitemRepo = invoiceitemRepo;
_repoBillType = repoBillType;
_invoicePaymentRepo= invoicePaymentRepo;
}
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
{
@@ -214,6 +216,18 @@ namespace Back.Services
if (!await _invoiceitemRepo.UpdateAsync(invoiceDetItem))
return false;
}
foreach (var pitem in FildItems.Payments)
{
var invoicepayments = InvoiceItem.payments.Where(w => w.ID == pitem.ID).FirstOrDefault();
foreach (var item in pitem.filds.Where(w => w.InputBox == "fild" || w.InputBox == "fromdb"))
{
if (invoicepayments != null)
SetValue(item, ref invoicepayments);
}
if (!await _invoicePaymentRepo.UpdateAsync(invoicepayments))
return false;
}
}
else return false;
return true;