diff --git a/routes/web.php b/routes/web.php index d28151ea..069eb9bf 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,6 +36,7 @@ use App\Classes\Modules\Transactions\Services\DeletesTransaction; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use App\Classes\General\AWSS3Helper; +use App\Classes\Modules\Bookings\Services\CalculatesBookingPaidAmount; use Illuminate\Support\Facades\File; @@ -1368,3 +1369,45 @@ Route::get('/test-test', function () { Route::get('/maintenance', function () { return response()->view('errors.503', [], 503); }); + +Route::get('/preview-unfinished-payment-orders', function (Request $request) { + echo ''; + echo ' + + + + + + + '; + echo ''; + + $cutOffDate = $request->cut_off_date; + $cutOffDate = Carbon::parse($cutOffDate); + + $bookings = Booking::where('status', '<', ApprovalStatus::COMPLETED); + if ($cutOffDate) { + $bookings->where('created_at', '<=', $cutOffDate); + } + $bookings = $bookings->orderBy('id', 'desc')->get(); + + $calculateBookingPaidAmount = new CalculatesBookingPaidAmount(); + + foreach ($bookings as $booking) { + $paid = $calculateBookingPaidAmount->execute($booking); + $outstanding = $booking->fix_amount - $paid; + + if ($paid > 0 && $outstanding > 0) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + } + + echo '
Order RefBooking AmountPaid AmountOutstanding AmountCustomerOrder Created Date
'.$booking->marking.'' . number_format($booking->fix_amount, 2) . '' . number_format($paid, 2) . '' . number_format($outstanding, 2) . ''.$booking->company->reference.'' . $booking->created_at->format('d-m-Y') . '
'; +}); \ No newline at end of file