{{--
--}}
@php // Filter the bookings to exclude those with 'outsourceExpense' $filteredBookings = $bookings->filter(function ($booking) { return !$booking->outsourceExpense; }); // Further filter for 'outsource' being 1 $filteredBookings = $filteredBookings->filter(function ($booking) { return $booking->outsource == 1; }); // Calculate the sums and difference $outsourcePurchaseSum = $filteredBookings->sum('outsource_purchase'); $outsourceCreditSum = $filteredBookings->sum('outsource_credit'); $difference = $outsourcePurchaseSum - $outsourceCreditSum; @endphp