feat: add scheme discount calculation to invoice processing

This commit is contained in:
2026-10-22 10:39:01 +05:30
parent 872fd42c4a
commit 2be2928ad1
4 changed files with 26 additions and 6 deletions
@@ -51,6 +51,11 @@ public class InvoiceRepository(AppDBContext context) : IInvoiceRepository
.Where(i => i.IsActive && i.PaymentStatus != PaymentStatus.Paid)
.ToListAsync();
public async Task<decimal> GetSchemeDiscountAsync(Guid shopPOId) =>
await context.SchemeRedemptions
.Where(r => r.FK_ShopPOId == shopPOId)
.SumAsync(r => r.DiscountAmount) ?? 0m;
public async Task AddAsync(Models.Invoice invoice) =>
await context.Invoices.AddAsync(invoice);