x1 and x2 reports

This commit is contained in:
omair saleh
2020-12-05 12:02:56 +08:00
parent bcd748e1cc
commit b7003b4f15
+15 -1
View File
@@ -40,8 +40,22 @@ Route::get('/report/x1', function(){
});
Route::get('/report/x2', function(){
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'x2');
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'like', 'x2_%')->where('is_cancel', false)->where('user_id', '!=', 1)->whereYear('created_at', 2020)->get();
$months = $bookings->groupBy(function($item) {
return $item->created_at->format('Y-m');
});
foreach($months as $month => $bookings){
echo "<h1>".Carbon::parse($month)->format('m-Y').": <small style='color: green; font-size: larger'>".$bookings->sum('bia')." MYR</small></h1>";
$days = $bookings->groupBy(function($item){
return $item->created_at->format('Y-m-d');
});
foreach($days as $day => $bookings ){
echo "<p>".Carbon::parse($day)->format('d-m-Y').": <small style='color: green; font-size: large'>".$bookings->sum('bia')." MYR</small></p>";
}
}
});
Route::get('/po-approval', function(){