show total in x1 report

This commit is contained in:
omair saleh
2021-02-08 19:11:55 +08:00
parent b1d31bf056
commit e1547f986a
+1 -1
View File
@@ -24,10 +24,10 @@ Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('p
Route::group(['middleware' => ['role:admin']], function() {
Route::get('/report/x1', function(){
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'like', 'x1_%')->where('is_cancel', false)->where('user_id', '!=', 1)->get();
echo "Total: ".$bookings->sum('bia');
$months = $bookings->groupBy(function($item) {
return $item->created_at->format('Y-m');
});
foreach($months as $month => $bookings){
$newCustomers = \App\User::whereYear('created_at', '=', Carbon::parse($month)->format('Y')) ->whereMonth('created_at', '=', Carbon::parse($month)->format('m'))->get();
echo "<h1>".Carbon::parse($month)->format('m-Y').": <small style='color: green; font-size: larger'>".$bookings->sum('bia')." MYR</small></h1>";