From 2c62a5b139078576c7a7375899ab30aab45a68ca Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 3 Dec 2020 17:21:30 +0800 Subject: [PATCH] include approved po's in the system --- routes/web.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 8a3e3f46..7bfb2637 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ invoice->booking->id."/upload-invoice'>".$invoice->invoice->booking->id."
"; } + $bookings = Booking::where('admin_status', 6)->whereDoesntHave('purchaseOrder')->orWhereDoesntHave('invoice', function($q){ + $q->where('invoice_path', '=', '')->orWhereNull('invoice_path'); + }); + echo "

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

"; + foreach ($bookings as $booking){ + echo "".$booking->id."
"; + } + +})->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(); $newCompletedInvoices = Invoice::whereIn('id', $approvedInvoices)->get(); $total = count($oldCompletedInvoices) + count($newCompletedInvoices); @@ -38,7 +51,7 @@ Route::get('/po-approval', function(){ foreach ($oldCompletedInvoices as $invoice){ echo "".$invoice->booking->id."
"; } -})->name('po.approval'); +})->name('po.approved'); Route::get('/old-invoices', function(){ $bookings = \App\Booking::where('status', 6)->where('user_id', '!=', 1)->whereHas('purchaseOrder', function($q){