From 47690061e5469258525cffc85eac61d697a17799 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 3 Dec 2020 17:01:43 +0800 Subject: [PATCH] include approved po's in the system --- routes/web.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/routes/web.php b/routes/web.php index 7c1c936c..ae5fc51a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,7 @@ name('password.reset'); Route::get('/po-approval', function(){ - $approvedInvoices = InvoiceStatuses::where(function($q) { - $q->where('status', 'approve') - ->orWhere('status', 'request_change'); - })->distinct()->get(['invoice_id'])->pluck('invoice_id'); - $invoices = InvoiceStatuses::whereNotIn('invoice_id', $approvedInvoices)->get(); - echo "

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

"; + $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($pendingChangeInvoices)->get(); + echo "

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

"; 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){ + echo "".$invoice->booking->id."
"; + } })->name('po.approval'); Route::get('/old-invoices', function(){