@if ($error != '')

**{{$error}}

@else
{{-- div for Company --}} @php $company = DB::table('gnr_company')->where('id', Auth::user()->company_id_fk)->select('name','address')->first(); @endphp {{$company->name}}
{{$company->address}}
Consolited Staff Report {{$currentDate}}

{{--
--}} @php $slNo = 0; $count = 0; $loopCount = 0; $loopTracker = 0; $rowSize = sizeof($projectsName); $rowSize = $rowSize + 1; $apoointedArray = [2,3]; $projectIDappointed = [1, 15]; $projectIDs = [1,15]; @endphp @for ($i=0; $i <= sizeof($projectsName); $i++) @php ++$slNo; ++$loopCount; @endphp @if ($count == 0) @php ++$count; @endphp @endif @if ($loopCount == 3) @php ++$loopCount; ++$loopTracker; // $projectIDs = [1,15]; @endphp @php $ProjectTypeID = DB::table('gnr_project_type') ->where('name', $projectsName[$i]) ->pluck('id') ->toArray(); $currentMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '=', 1], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '>', $endDate] ]) ->orWhere([['branch_id_fk', '=', 1], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '=', '0000-00-00'] ]) ->whereIn('project_id_fk', $projectIDs) ->pluck('id') ->toArray(); $previousMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '=', 1], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '>', $endDatePrevious] ]) ->orWhere([['branch_id_fk', '=', 1], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '=', '0000-00-00'] ]) ->whereIn('project_id_fk', $projectIDs) ->pluck('id') ->toArray(); // $currentMonthAppointmentStatus = DB::table('hr_emp_org_info') // ->where([['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '>', $endDate] // ]) // ->orWhere([['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '=', '0000-00-00'] // ]) // ->whereIn('project_id_fk', $projectIDs) // ->pluck('id') // ->toArray(); @endphp @elseif ($loopTracker >= 1) @php $ProjectTypeID = DB::table('gnr_project_type') ->where('name', $projectsName[$i-1]) ->pluck('id') ->toArray(); $currentMonthStatus = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', $ProjectTypeID[0]], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '>', $endDate] ]) ->orWhere([['project_type_id_fk', $ProjectTypeID[0]], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '=', '0000-00-00'] ]) ->pluck('id') ->toArray(); $previousMonthStatus = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', $ProjectTypeID[0]], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '>', $endDatePrevious] ]) ->orWhere([['project_type_id_fk', $ProjectTypeID[0]], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '=', '0000-00-00'] ]) ->pluck('id') ->toArray(); // echo $ProjectTypeID[0]; @endphp @else @php $ProjectTypeID = DB::table('gnr_project_type') ->where('name', $projectsName[$i]) ->pluck('id') ->toArray(); $currentMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '!=', 1], ['joining_date', '<=', $endDate], ['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '>', $endDate] ]) ->orWhere([['branch_id_fk', '!=', 1], ['joining_date', '<=', $endDate], ['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '=', '0000-00-00'] ]) ->pluck('id') ->toArray(); $previousMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '!=', 1], ['joining_date', '<=', $endDate], ['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '>', $endDatePrevious] ]) ->orWhere([['branch_id_fk', '!=', 1], ['joining_date', '<=', $endDate], ['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '=', '0000-00-00'] ]) ->pluck('id') ->toArray(); @endphp @endif @endfor @php $PreviousMonthAppointmentStatus = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', '=', 2], ['branch_id_fk', '=', 1], ['joining_date', '>=', $previousMonthStartDate], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '>', $endDatePrevious] ]) ->orWhere([['project_type_id_fk', '=', 2], ['branch_id_fk', '=', 1], ['joining_date', '>=', $previousMonthStartDate], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '=', '0000-00-00'] ]) // ->whereIn('project_type_id_fk', '=', 2) ->pluck('id') ->toArray(); // dd($PreviousMonthAppointmentStatus); $currentMonthAppointmentStatus = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', '=', 2], ['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '>', $endDate] ]) ->orWhere([['project_type_id_fk', '=', 2], ['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '=', '0000-00-00'] ]) // ->whereIn('project_type_id_fk', '=', 2) ->pluck('id') ->toArray(); $PreviousMonthAppointmentStatusN = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', '=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $previousMonthStartDate], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '>', $endDatePrevious] ]) ->orWhere([['project_type_id_fk', '=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $previousMonthStartDate], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '=', '0000-00-00'] ]) // ->whereIn('project_type_id_fk', '=', 2) ->pluck('id') ->toArray(); // dd($PreviousMonthAppointmentStatus); $currentMonthAppointmentStatusN = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', '=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '>', $endDate] ]) ->orWhere([['project_type_id_fk', '=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '=', '0000-00-00'] ]) // ->whereIn('project_type_id_fk', '=', 2) ->pluck('id') ->toArray(); $PreviousMonthAppointmentStatusO = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', '!=', 2], ['project_type_id_fk', '!=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $previousMonthStartDate], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '>', $endDatePrevious] ]) ->orWhere([['project_type_id_fk', '!=', 2], ['project_type_id_fk', '!=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $previousMonthStartDate], ['joining_date', '<=', $endDatePrevious], ['terminate_resignation_date', '=', '0000-00-00'] ]) // ->whereIn('project_type_id_fk', '!=', $apoointedArray) ->pluck('id') ->toArray(); // dd($PreviousMonthAppointmentStatus); $currentMonthAppointmentStatusO = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', '!=', 2], ['project_type_id_fk', '!=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '>', $endDate] ]) ->orWhere([['project_type_id_fk', '!=', 2], ['project_type_id_fk', '!=', 3], ['branch_id_fk', '=', 1], ['joining_date', '>=', $currentMonthStartDate], ['joining_date', '<=', $endDate], ['terminate_resignation_date', '=', '0000-00-00'] ]) // ->whereIn('project_type_id_fk', '!=', $apoointedArray) ->pluck('id') ->toArray(); @endphp @php $loopCount = 0; $loopTracker = 0; $count = 0; $hello = 0; $hello1 = 0; @endphp @for ($i=0; $i <= sizeof($projectsName); $i++) @php ++$slNo; ++$loopCount; @endphp @if ($loopTracker >= 1 and $projectsName[$i-1] == 'Radio Bikrampur') @else @if ($count == 0) @php ++$count; @endphp @endif @if ($loopCount == 3) @php ++$loopCount; ++$loopTracker; $currentMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '=', 1], ['terminate_resignation_date', '>=', $currentMonthStartDate], ['terminate_resignation_date', '<=', $endDate] ]) ->whereIn('project_id_fk', $projectIDs) ->pluck('id') ->toArray(); $previousMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '=', 1], ['terminate_resignation_date', '>=', $previousMonthStartDate], ['terminate_resignation_date', '<=', $endDatePrevious] ]) ->whereIn('project_id_fk', $projectIDs) ->pluck('id') ->toArray(); @endphp @elseif ($loopTracker >= 1) @php $ProjectTypeID = DB::table('gnr_project_type') ->where('name', $projectsName[$i-1]) ->pluck('id') ->toArray(); $currentMonthStatus = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '>=', $currentMonthStartDate], ['terminate_resignation_date', '<=', $endDate] ]) ->pluck('id') ->toArray(); $previousMonthStatus = DB::table('hr_emp_org_info') ->where([['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '>=', $previousMonthStartDate], ['terminate_resignation_date', '<=', $endDatePrevious] ]) ->pluck('id') ->toArray(); @endphp @else @php $ProjectTypeID = DB::table('gnr_project_type') ->where('name', $projectsName[$i]) ->pluck('id') ->toArray(); $currentMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '!=', 1], ['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '>=', $currentMonthStartDate], ['terminate_resignation_date', '<=', $endDate] ]) ->pluck('id') ->toArray(); $previousMonthStatus = DB::table('hr_emp_org_info') ->where([['branch_id_fk', '!=', 1], ['project_type_id_fk', $ProjectTypeID[0]], ['terminate_resignation_date', '>=', $previousMonthStartDate], ['terminate_resignation_date', '<=', $endDatePrevious] ]) ->pluck('id') ->toArray(); @endphp @endif @endif @endfor @php $currentMonthStatus = DB::table('hr_emp_org_info') ->join('users', 'hr_emp_org_info.emp_id_fk', '=', 'users.emp_id_fk') ->where([['hr_emp_org_info.project_id_fk', '=', 1]]) ->pluck('users.id') ->toArray(); // dd($currentMonthStatus); $currentMonthTransferStatus = DB::table('hr_transfer') ->where([['effect_date', '>=', $currentMonthStartDate], ['effect_date', '<=', $endDate]]) // ->orWhere([['effect_date', '>=', $previousMonthStartDate], ['effect_date', '<=', $endDatePrevious]]) ->whereIn('users_id_fk', $currentMonthStatus) ->pluck('id') ->toArray(); $previousMonthTransferStatus = DB::table('hr_transfer') // ->where([['effect_date', '>=', $currentMonthStartDate], ['effect_date', '<=', $endDate]]) ->where([['effect_date', '>=', $previousMonthStartDate], ['effect_date', '<=', $endDatePrevious]]) ->whereIn('users_id_fk', $currentMonthStatus) ->pluck('id') ->toArray(); @endphp @php $permanentUsersDataCurrent = array(); $permanentUsersDataPrevious = array(); $permanentUsersDataCurrentOthers = array(); $permanentUsersDataPreviousOthers = array(); $pre = 0; $cur = 0; if (count($data['model'])>0) { foreach ($data['model'] as $key => $permanentData) { if ($permanentData->promotion_type == 'Permanent') { // dd($permanentData->effect_month, $currentMonthStartDate); if ($permanentData->effect_month >= $currentMonthStartDate and $permanentData->effect_month <= $endDate) { ++$cur; $permanentUsersDataCurrent[$cur] = $permanentData->users_id_fk; } elseif ($permanentData->effect_month >= $previousMonthStartDate and $permanentData->effect_month <= $endDatePrevious) { ++$pre; $permanentUsersDataPrevious[$pre] = $permanentData->users_id_fk; } } // else { // // dd('ok'); // if ($permanentData->effect_month >= $currentMonthStartDate and $permanentData->effect_month <= $endDate) { // ++$cur; // $permanentUsersDataCurrentOthers[$cur] = $permanentData->users_id_fk; // } // elseif ($permanentData->effect_month >= $previousMonthStartDate and $permanentData->effect_month <= $endDatePrevious) { // ++$pre; // $permanentUsersDataPreviousOthers[$pre] = $permanentData->users_id_fk; // } // } } } $permanentUsersMFPDataCurrent = DB::table('users') ->where('project_id_fk', '=', 1) ->whereIn('id', $permanentUsersDataCurrent) ->pluck('id') ->toArray(); $permanentUsersMFPDataPrevious = DB::table('users') ->where('project_id_fk', '=', 1) ->whereIn('id', $permanentUsersDataPrevious) ->pluck('id') ->toArray(); $permanentUsersOthersDataUsersIDCurrent = DB::table('hr_promotion_increment') ->where([['type', '=', 'Increment'], ['position_id_fk', '=', 66], ['effect_month', '>=', $currentMonthStartDate], ['effect_month', '<=', $endDate]]) ->pluck('users_id_fk') ->toArray(); $permanentUsersOthersDataUsersIDPrevious = DB::table('hr_promotion_increment') ->where([['type', '=', 'Increment'], ['position_id_fk', '=', 66], ['effect_month', '>=', $previousMonthStartDate], ['effect_month', '<=', $endDatePrevious]]) ->pluck('users_id_fk') ->toArray(); $permanentUsersOthersDataCurrent = $permanentUsersOthersDataUsersIDCurrent; $permanentUsersOthersDataPrevious = $permanentUsersOthersDataUsersIDPrevious; // $permanentUsersOthersDataCurrent = DB::table('hr_emp_org_info') // ->join('users', 'hr_emp_org_info.emp_id_fk', '=', 'users.emp_id_fk') // ->where([['hr_emp_org_info.project_id_fk', '!=', 1], []]) @endphp @php $actingBenefitCurrentUsers = DB::table('hr_acting_benefit') ->where([['start_from', '>=', $currentMonthStartDate], ['end_to', '<=', $endDate]]) ->pluck('users_id_fk') ->toArray(); $actingBenefitCurrent = DB::table('users') ->where('project_id_fk', '=', 1) ->whereIn('id', $actingBenefitCurrentUsers) ->pluck('id') ->toArray(); $actingBenefitPreviousUsers = DB::table('hr_acting_benefit') ->where([['start_from', '>=', $previousMonthStartDate], ['end_to', '<=', $endDatePrevious]]) ->pluck('users_id_fk') ->toArray(); $actingBenefitPrevios = DB::table('users') ->where('project_id_fk', '=', 1) ->whereIn('id', $actingBenefitPreviousUsers) ->pluck('id') ->toArray(); @endphp
SL No.
Narration
Project

Warning: Undefined variable $monthORyear in /home/shikkhaplus/public_html/guk_bk/resources/views/hr/consolitedStaffReport/consolitedStaffReportTable.blade.php on line 105
Previous Month ({{$previousDate}})

Warning: Undefined variable $monthORyear in /home/shikkhaplus/public_html/guk_bk/resources/views/hr/consolitedStaffReport/consolitedStaffReportTable.blade.php on line 109
Current Month ({{$currentDate}})
Difference
{{$slNo}}Total EmployeeHead Office (PKSF, Non-PKSF, General) {{sizeof($previousMonthStatus)}} {{sizeof($currentMonthStatus)}} {{sizeof($currentMonthStatus)-sizeof($previousMonthStatus)}}{{$projectsName[$i-1]}} {{sizeof($previousMonthStatus)}} {{sizeof($currentMonthStatus)}} {{sizeof($currentMonthStatus)-sizeof($previousMonthStatus)}}{{$projectsName[$i]}} {{sizeof($previousMonthStatus)}} {{sizeof($currentMonthStatus)}} {{sizeof($currentMonthStatus)-sizeof($previousMonthStatus)}}
{{++$slNo}} Appointed PKSF (Branch) {{sizeof($PreviousMonthAppointmentStatus)}} {{sizeof($currentMonthAppointmentStatus)}} {{sizeof($currentMonthAppointmentStatus)-sizeof($PreviousMonthAppointmentStatus)}}
{{++$slNo}} Non-PKSF (Branch) {{sizeof($PreviousMonthAppointmentStatusN)}} {{sizeof($currentMonthAppointmentStatusN)}} {{sizeof($currentMonthAppointmentStatusN)-sizeof($PreviousMonthAppointmentStatusN)}}
{{++$slNo}} Others {{sizeof($PreviousMonthAppointmentStatusO)}} {{sizeof($currentMonthAppointmentStatusO)}} {{sizeof($currentMonthAppointmentStatusO)-sizeof($PreviousMonthAppointmentStatusO)}}
{{$slNo}}Retirement/TerminatedHead Office (PKSF, Non-PKSF, General) {{sizeof($previousMonthStatus)}} {{sizeof($currentMonthStatus)}} {{sizeof($currentMonthStatus)-sizeof($previousMonthStatus)}}{{$projectsName[$i-1]}} {{sizeof($previousMonthStatus)}} {{sizeof($currentMonthStatus)}} {{sizeof($currentMonthStatus)-sizeof($previousMonthStatus)}}{{$projectsName[$i]}} {{sizeof($previousMonthStatus)}} {{sizeof($currentMonthStatus)}} {{sizeof($currentMonthStatus)-sizeof($previousMonthStatus)}}
{{++$slNo}} TransferMFP (Branch) {{sizeof($previousMonthTransferStatus)}} {{sizeof($currentMonthTransferStatus)}} {{sizeof($currentMonthTransferStatus)-sizeof($previousMonthTransferStatus)}}
{{++$slNo}} Permanent MFP (Brnach) {{sizeof($permanentUsersMFPDataPrevious)}} {{sizeof($permanentUsersMFPDataCurrent)}} {{sizeof($permanentUsersMFPDataCurrent)-sizeof($permanentUsersMFPDataPrevious)}}
{{++$slNo}} Others (Salary increment of cook) {{sizeof($permanentUsersOthersDataPrevious)}} {{sizeof($permanentUsersOthersDataCurrent)}} {{sizeof($permanentUsersOthersDataCurrent)-sizeof($permanentUsersOthersDataPrevious)}}
{{++$slNo}} Acting Responsible Person MFP (Branch) {{sizeof($actingBenefitPrevios)}} {{sizeof($actingBenefitCurrent)}} {{sizeof($actingBenefitCurrent)-sizeof($actingBenefitPrevios)}}
{{--
Prepared By :
Date :
Verified By :
Date :
Approved By :
Date :
--}}
@php // dd($permanentUsersDataCurrent, $permanentUsersDataPrevious); // dd($data['model']); @endphp @endif