From 48e7354b38c399310282682cd2ff1b03177c394d Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 3 Dec 2020 17:06:47 +0800 Subject: [PATCH] include approved po's in the system --- routes/web.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/routes/web.php b/routes/web.php index eea61379..79d4f53a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -28,10 +28,14 @@ Route::get('/po-approval', function(){ foreach ($invoices as $invoice){ echo "".$invoice->invoice->booking->id."
"; } - $completedInvoices = Invoice::where('invoice_path', '!=', '')->orWhereNotNull('invoice_path')->get(); - $completedInvoices = array_merge($completedInvoices, $approvedInvoices); - echo "

Total Po Approved: ".count($completedInvoices)."

"; - foreach ($completedInvoices as $invoice){ + $oldCompletedInvoices = Invoice::where('invoice_path', '!=', '')->orWhereNotNull('invoice_path')->get(); + $newCompletedInvoices = Invoice::whereIn('invoice_id', $approvedInvoices)->get(); + $total = count($oldCompletedInvoices) + count($newCompletedInvoices); + echo "

Total Po Approved: ".$total."

"; + foreach ($newCompletedInvoices as $invoice){ + echo "".$invoice->booking->id."
"; + } + foreach ($oldCompletedInvoices as $invoice){ echo "".$invoice->booking->id."
"; } })->name('po.approval');