Merge branch 'vapor/production' of https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0 into vapor/staging

This commit is contained in:
Edmond Lang
2025-07-24 22:30:33 +08:00
+43
View File
@@ -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 '<table style="border-collapse: collapse; width: 100%;" border="1">';
echo '<thead><tr>
<th>Order Ref</th>
<th>Booking Amount</th>
<th>Paid Amount</th>
<th>Outstanding Amount</th>
<th>Customer</th>
<th>Order Created Date</th>
</tr></thead>';
echo '<tbody>';
$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 '<tr>';
echo '<td><a href="'.route('booking.details', $booking->marking).'" target="_blank">'.$booking->marking.'</a></td>';
echo '<td>' . number_format($booking->fix_amount, 2) . '</td>';
echo '<td>' . number_format($paid, 2) . '</td>';
echo '<td>' . number_format($outstanding, 2) . '</td>';
echo '<td><a href="'.route('customer.profile', $booking->company->reference).'" target="_blank">'.$booking->company->reference.'</a></td>';
echo '<td>' . $booking->created_at->format('d-m-Y') . '</td>';
echo '</tr>';
}
}
echo '</tbody></table>';
});