From 7996b7167cbb20d73aeaef3ad68400e9e84dec77 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Tue, 22 Feb 2022 01:53:31 +0800 Subject: [PATCH] fix bill seeder --- .../Bookings/Services/CalculatesBookingTransferredAmount.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php b/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php index ce2ed75c..fc355d64 100644 --- a/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php +++ b/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php @@ -12,7 +12,9 @@ class CalculatesBookingTransferredAmount { public function execute(Booking $booking){ - return $booking->bills->sum('original_amount'); + return $booking->transactions()->payments()->complete()->whereHas('transactions', function($query){ + return $query->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]); + })->sum('original_amount'); } } \ No newline at end of file