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

@@ -48,7 +48,7 @@ namespace Back.Services
return inquiryResultModels[0];
return null;
}
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, PaymentDto payment)
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, List<PaymentDto> payments)
{
//return new TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>
// ( body: new AsyncResponseModel(
@@ -62,7 +62,7 @@ namespace Back.Services
{
new()
{
Header =header,Body =InvoiceBody,Payments = new() {payment}
Header =header,Body =InvoiceBody,Payments = payments
}
}
, null);

View File

@@ -39,7 +39,7 @@ namespace Back.Services
.ThenInclude(inc => inc.CODUnit)
.Include(inc => inc.Customer)
.Include(inc => inc.sentTax)
//.Include(inc => inc.payments)
.Include(inc => inc.payments)
.Include(inc => inc.pattern)
.ThenInclude(inc => inc.BillType)
@@ -92,22 +92,22 @@ namespace Back.Services
vra = x.vra,
prdis = x.prdis
}).ToList(),
payments = new List<InvoicePaymentDTO>()
//s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
//{
// ID = x.ID,
// acn = x.acn,
// iinn = x.acn,
// pcn = x.acn,
// pdt = x.pdt,
// PaymentDateTime=x.PaymentDateTime,
// pid = x.pid,
// pmt = x.pmt,
// pv = x.pv,
// trmn = x.trmn,
// trn = x.acn
//}).ToList()
};
payments =
item.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
{
ID = x.ID,
acn = x.acn,
iinn = x.acn,
pcn = x.acn,
pdt = x.pdt,
PaymentDateTime = x.PaymentDateTime,
pid = x.pid,
pmt = x.pmt,
pv = x.pv,
trmn = x.trmn,
trn = x.acn
}).ToList()
};
}

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;