Update delivery task invoice flow

This commit is contained in:
2026-09-16 16:25:47 +05:30
parent 4d63b3e720
commit ea8f952f14
@@ -187,9 +187,9 @@ public class DeliveryTaskService(
repo.Update(task);
orderRepo.Update(order);
if (fullyDelivered)
if (fullyDelivered && order.FK_SaleId is Guid saleId)
{
var sale = await saleRepo.GetByIdAsync(order.FK_SaleId)
var sale = await saleRepo.GetByIdAsync(saleId)
?? throw new KeyNotFoundException("Sale not found");
sale.Status = SaleStatus.Completed;
sale.CompletedAt = DateTime.Now;