include approved po's in the system

This commit is contained in:
omair saleh
2020-12-03 17:01:43 +08:00
parent dd0ed824d8
commit 47690061e5
+11 -6
View File
@@ -1,6 +1,7 @@
<?php
use App\Http\Controllers\InvoiceController;
use App\Invoice;
use App\InvoiceStatuses;
use Carbon\Carbon;
use Illuminate\Support\Facades\File;
@@ -20,15 +21,19 @@ Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->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 "<h1>Total PO Pending Approval:<b>".count($invoices)."</b></h1>";
$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 "<h1>Total PO Pending Approval: <b>".count($invoices)."</b></h1>";
foreach ($invoices as $invoice){
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->invoice->booking->id."/upload-invoice'>".$invoice->invoice->booking->id."</a><br>";
}
$completedInvoices = Invoice::where('invoice_path', '!=', '')->orWhereNotNull('invoice_path')->get();
$completedInvoices = array_merge($completedInvoices, $approvedInvoices);
echo "<h1>Total Po Approved: <b>".count($completedInvoices)."</b></h1>";
foreach ($completedInvoices as $invoice){
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->booking->id."/admin/complete'>".$invoice->booking->id."</a><br>";
}
})->name('po.approval');
Route::get('/old-invoices', function(){