show old invoices

This commit is contained in:
omair saleh
2020-09-25 18:06:01 +08:00
parent f2cf3b6f49
commit aeae631dbb
+7 -3
View File
@@ -1,5 +1,7 @@
<?php
use Carbon\Carbon;
/*
|--------------------------------------------------------------------------
| Web Routes
@@ -14,10 +16,12 @@ Route::get('/', 'WelcomeController@index');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
Route::get('/old-invoices', function(){
$bookings = \App\Booking::select('id', 'created_at',DB::raw('YEAR(created_at) year, MONTH(created_at) month'))->where('status', 6)->whereHas('purchaseOrder', function($q){
$bookings = \App\Booking::where('status', 6)->whereHas('purchaseOrder', function($q){
$q->whereNotNull('image_path');
})->groupby('year','month')->get();
dd($bookings);
})->get();
dd($bookings->groupBy(function($item) {
return Carbon::createFromFormat('Y-m-d', $item->date)->format('Y-W');
}));
echo "<h1>Total pending invoices:<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> <small>date: ".$booking->created_at."</small><br>";