mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
x1 and x2 reports
This commit is contained in:
+16
-13
@@ -22,23 +22,26 @@ Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
|
||||
|
||||
Route::get('/report/x1', function(){
|
||||
$this->middleware('role:admin');
|
||||
|
||||
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'like', 'x1_%')->where('is_cancel', false)->where('user_id', '!=', 1)->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');
|
||||
if($this->middleware('role:admin')){
|
||||
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'like', 'x1_%')->where('is_cancel', false)->where('user_id', '!=', 1)->get();
|
||||
$months = $bookings->groupBy(function($item) {
|
||||
return $item->created_at->format('Y-m');
|
||||
});
|
||||
|
||||
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>";
|
||||
}
|
||||
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>";
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user