mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-20 21:13:59 +00:00
18 lines
499 B
PHP
18 lines
499 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Bookings\Services;
|
|
|
|
use App\Models\Booking;
|
|
|
|
class CalculatesBookingFloatingAmount
|
|
{
|
|
|
|
public function execute(Booking $booking, int $type){
|
|
return $type === 1 ?
|
|
$booking->transactions()->payments()->inComplete()
|
|
->selectRaw('sum(amount - service_charge - tax) as sub_total')
|
|
->get()->sum('sub_total')
|
|
: $booking->transactions()->payments()->inComplete()->get()->sum('original_amount');
|
|
}
|
|
|
|
} |