include approved po's in the system

This commit is contained in:
omair saleh
2020-12-03 17:21:30 +08:00
parent 29a1f90b8e
commit 2c62a5b139
+14 -1
View File
@@ -1,5 +1,6 @@
<?php
use App\Booking;
use App\Http\Controllers\InvoiceController;
use App\Invoice;
use App\InvoiceStatuses;
@@ -28,6 +29,18 @@ Route::get('/po-approval', function(){
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>";
}
$bookings = Booking::where('admin_status', 6)->whereDoesntHave('purchaseOrder')->orWhereDoesntHave('invoice', function($q){
$q->where('invoice_path', '=', '')->orWhereNull('invoice_path');
});
echo "<h1>Total Po Pending Customer Update: <b>".count($bookings)."</b></h1>";
foreach ($bookings as $booking){
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$booking->id."/upload-invoice'>".$booking->id."</a><br>";
}
})->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 "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->booking->id."/admin/complete'>".$invoice->booking->id."</a><br>";
}
})->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){