From 37b6ccc251096fb7d945f8e3d6f7952bd0b7b7d4 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 7 Dec 2020 11:45:39 +0800 Subject: [PATCH] pending customer po grouped by customer --- routes/web.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/routes/web.php b/routes/web.php index 0b21a361..37ee3796 100644 --- a/routes/web.php +++ b/routes/web.php @@ -91,14 +91,6 @@ 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(); @@ -107,14 +99,14 @@ Route::group(['middleware' => ['role:admin']], function() { }); echo "

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

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

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


"; + echo "

".$customer."(".count($bookings).")


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


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