diff --git a/routes/web.php b/routes/web.php index f8f06b6b..0b21a361 100644 --- a/routes/web.php +++ b/routes/web.php @@ -90,6 +90,32 @@ Route::group(['middleware' => ['role:admin']], function() { })->name('po.approval'); + Route::get('/po-pending-customers', function(){ + $approvedInvoices = InvoiceStatuses::where('status', 'approve')->distinct()->get(['invoice_id'])->pluck('invoice_id'); + $pendingChangeInvoices = InvoiceStatuses::where('status', 'request_change')->distinct()->get(['invoice_id'])->pluck('invoice_id'); + $invoices = InvoiceStatuses::whereNotIn('invoice_id', $approvedInvoices)->whereNotIn('invoice_id', $pendingChangeInvoices)->get(); + echo "

Total PO Pending Approval: ".count($invoices)."

"; + foreach ($invoices as $invoice){ + echo "".$invoice->invoice->booking->id."
"; + } + + $bookings = Booking::where('admin_status', 6)->where(function($q){ + $q->WhereDoesntHave('invoice')->WhereDoesntHave('purchaseOrder'); + })->get(); + $customers = $bookings->groupBy(function($item) { + return $item->user_id; + }); + echo "

Total Po Pending Customer Update: ".count($bookings)."

"; + foreach ($customers as $customer => $bookings) { + echo "

".$bookings->user->marking."(".count($bookings).")


"; + foreach ($bookings as $booking) { + echo "".$booking->id." ".$booking->user->marking." / ".$booking->created_at."
"; + } + echo "


"; + } + + })->name('po.approval'); + Route::get('/po-approved', function(){ $approvedInvoices = InvoiceStatuses::where('status', 'approve')->distinct()->get(['invoice_id'])->pluck('invoice_id'); $oldCompletedInvoices = Invoice::where('invoice_path', '!=', '')->orWhereNotNull('invoice_path')->get();