fix
This commit is contained in:
@@ -31,7 +31,7 @@ class BudgetHelper
|
|||||||
|
|
||||||
// Add the used budget per model for the specified month and year to the usedBudget array
|
// Add the used budget per model for the specified month and year to the usedBudget array
|
||||||
$users = UserHasCabang::where('cabang_id', $cabang_id)->get();
|
$users = UserHasCabang::where('cabang_id', $cabang_id)->get();
|
||||||
$userIds = $users->pluck('user_id')->toArray();
|
$userIds = $users->pluck('user_id')->toArray();
|
||||||
$forms = FormHelper::getFormsByUserIds($userIds, $month, $year)->sortByDesc('tanggal')->sortByDesc('created_at');
|
$forms = FormHelper::getFormsByUserIds($userIds, $month, $year)->sortByDesc('tanggal')->sortByDesc('created_at');
|
||||||
$usedBudget += $forms->sum('approved_total');
|
$usedBudget += $forms->sum('approved_total');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,36 @@ class DashboardController extends Controller
|
|||||||
{
|
{
|
||||||
$role = auth()->user()->getRoleNames()[0];
|
$role = auth()->user()->getRoleNames()[0];
|
||||||
$forms = [
|
$forms = [
|
||||||
'vehicle' => FormVehicleRunningCost::query(),
|
'vehicle' => FormVehicleRunningCost::whereMonth('tanggal', date('m'))
|
||||||
'upcountry' => FormUpCountry::query(),
|
->whereYear('tanggal', date('Y'))
|
||||||
'entertainment' => FormEntertaimentPresentation::query(),
|
->where('tanggal', '<=', date('Y-m-10'))
|
||||||
'meeting' => FormMeetingSeminar::query(),
|
->whereRaw('DAY(CURDATE()) <= 10')
|
||||||
'others' => FormOthers::query(),
|
->orderBy('tanggal', 'desc')
|
||||||
|
->get(),
|
||||||
|
'upcountry' => FormUpCountry::whereMonth('tanggal', date('m'))
|
||||||
|
->whereYear('tanggal', date('Y'))
|
||||||
|
->where('tanggal', '<=', date('Y-m-10'))
|
||||||
|
->whereRaw('DAY(CURDATE()) <= 10')
|
||||||
|
->orderBy('tanggal', 'desc')
|
||||||
|
->get(),
|
||||||
|
'entertainment' => FormEntertaimentPresentation::whereMonth('tanggal', date('m'))
|
||||||
|
->whereYear('tanggal', date('Y'))
|
||||||
|
->where('tanggal', '<=', date('Y-m-10'))
|
||||||
|
->whereRaw('DAY(CURDATE()) <= 10')
|
||||||
|
->orderBy('tanggal', 'desc')
|
||||||
|
->get(),
|
||||||
|
'meeting' => FormMeetingSeminar::whereMonth('created_at', date('m'))
|
||||||
|
->whereYear('created_at', date('Y'))
|
||||||
|
->where('created_at', '<=', date('Y-m-10'))
|
||||||
|
->whereRaw('DAY(CURDATE()) <= 10')
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get(),
|
||||||
|
'others' => FormOthers::whereMonth('tanggal', date('m'))
|
||||||
|
->whereYear('tanggal', date('Y'))
|
||||||
|
->where('tanggal', '<=', date('Y-m-10'))
|
||||||
|
->whereRaw('DAY(CURDATE()) <= 10')
|
||||||
|
->orderBy('tanggal', 'desc')
|
||||||
|
->get(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($role == 'Admin Region' || $role == 'Marketing Operational Manager Region') {
|
if ($role == 'Admin Region' || $role == 'Marketing Operational Manager Region') {
|
||||||
|
|||||||
Reference in New Issue
Block a user