File: /var/www/html/dev-hrms/app/Http/Controllers/EmployeeProfileController.php
<?php
namespace App\Http\Controllers;
use App\Models\EmployeeProfile;
use App\Models\EmployeeAddress;
use App\Models\Course;
use App\Models\Subjects;
use App\Models\FamilyMember;
use App\Models\EmployeeTrainingDetail;
use App\Models\EmployeeDisciplinaryAction;
use App\Models\ForeignVisit;
use App\Models\DivisionGrade;
use App\Models\EmployeeQualifications;
use App\Models\EmployeeNameChange;
use App\Models\AssetsLiability;
use App\Models\ConfidentialReport;
use App\Models\DeputationDetail;
use App\Models\EmployeePromotion;
use App\Models\EmployeePensionScheme;
use App\Models\EmployeeCategoryDetail;
use App\Models\EmployeeGeneralDetail;
use App\Models\EmployeePoliceVerification;
use App\Models\EmployeeMedicalCertificate;
use App\Models\EmployeeEligibilityExam;
use App\Models\EmployeePermanency;
use App\Models\EmployeeNomineeDetail;
use App\Models\EmployeePayMatrix;
use App\Models\PensionScheme;
use App\Models\EmployeeProbationPeriod;
use App\Models\EmployeeTenurePeriod;
use App\Models\PreviousJobDetail;
use App\Models\EmployeeLoanAllowance;
use App\Models\LeaveTravelConcession;
use App\Models\MaharashtraDarshanTravel;
use App\Models\EmployeeAwardDetail;
use App\Models\EmpRetirementOrder;
use App\Models\EmpAgeRelax;
use App\Models\EmployeeResignation;
use App\Models\EmployeeDeathCertificate;
use App\Models\EmployeeGratiaAmount;
use App\Models\EmployeeReAppraising;
use App\Models\EncashmentOfLeave;
use App\Models\EmployeeGratuityAmount;
use App\Models\EmployeeCommutation;
use App\Models\EmployeePension;
use App\Models\Profiles;
use App\Models\Approval;
use App\Models\EmployeeEarnedCommutedLeave;
use DB;
use App\Library\UserLib;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use Illuminate\Http\Request;
class EmployeeProfileController extends Controller
{
protected $userLib;
protected $UserSessionId;
protected $TeamList = array();
protected $LevelList = array();
protected $ViewProfileIds = array();
protected $ViewApprovalUsers = array();
public function __construct(UserLib $userLib)
{
$this->userLib = $userLib;
}
public function getAccessUserProfileList($ProfileId = '')
{
$users = Profiles::select('*')
->leftJoin('tbl_roles', 'tbl_roles.RoleId', '=', 'tbl_profiles.RoleId')
->where('tbl_roles.ReadPermission', 'like', '1')
->where('tbl_roles.WritePermission', 'like', '1')
->where('tbl_roles.UpdatePermission', 'like', '1')
->where('tbl_roles.ApprovalPermission', 'like', '1')
->where('tbl_profiles.ServiceBookApprovalPermission', 'like', 'YES')
->where('tbl_profiles.ProfileId', 'like', $ProfileId) //check not equal to user profile
->get();
if ($users->count() > 0) { //email is exist
foreach ($users as $key => $UValue) {
$ProfileId = $UValue['ProfileId'];
$ProfileName = $UValue['ProfileName'];
$ParentId = $UValue['ParentId'];
$this->TeamList[] = $UValue;
$this->ViewProfileIds[] = $ProfileId;
if ($ParentId) {
$this->getAccessUserProfileList($ParentId);
}
}
}
return $responseData = $this->ViewProfileIds;
//return response()->json($responseData);
}
// Get Approval User
public function getApprovalUserLevel($ProfileId = '', $Level = 1)
{
$users = Profiles::select('*')
->leftJoin('tbl_roles', 'tbl_roles.RoleId', '=', 'tbl_profiles.RoleId')
->where('tbl_roles.ReadPermission', 'like', '1')
->where('tbl_roles.WritePermission', 'like', '1')
->where('tbl_roles.UpdatePermission', 'like', '1')
->where('tbl_roles.ApprovalPermission', 'like', '1')
//->where('tbl_profiles.ServiceBookApprovalPermission','like','YES')
->where('tbl_profiles.ProfileId', 'like', $ProfileId) //check not equal to user profile
->get();
// echo $users;
//exit;
if ($users->count() > 0) { //email is exist
foreach ($users as $key => $UValue) {
$ProfileId = $UValue['ProfileId'];
$ProfileName = $UValue['ProfileName'];
$ParentId = $UValue['ParentId'];
$this->TeamList[] = $UValue;
$this->ViewApprovalUsers[] = $ProfileId;
//$this->LevelList[] = $Level;
//echo $Level.'-'.$ParentId.'<br/>';
if ($Level >= 2) {
continue;
}
if ($ParentId) {
$Level++;
$this->getApprovalUserLevel($ParentId, $Level);
}
}
}
return $this->ViewApprovalUsers;
}
// public function getApprovalUser($ProfileId='') {
// $UserData = $this->getApprovalUserLevel($ProfileId);
// print_r ($UserData);
// }
public function addEmployee()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.add-employee');
}
### All Employee List
public function employeeList()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$AllEmployee = EmployeeProfile::select('tbl_employees.*', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName', 'tbl_controlling_officer.ControllingOfficerName as ControllingOfficer', 'tbl_employee_name_change.ChangeOfName as ChangeOfName', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_department', 'tbl_employees.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_designation', 'tbl_employees.DesignationId', '=', 'tbl_designation.DesignationId')
->leftJoin('tbl_controlling_officer', 'tbl_employees.ControllingOfficerId', '=', 'tbl_controlling_officer.ControllingOfficerId')
->leftJoin('tbl_employee_name_change', 'tbl_employees.EmployeeId', '=', 'tbl_employee_name_change.EmployeeId')
->where('tbl_employees.IsDeleted', '=', '0')
//->where('tbl_employee_name_change.Status', '=', '1')
->groupBy('tbl_employees.EmployeeId')
->orderBy('tbl_employees.id', 'desc')
->get();
return view('admin.EmployeeProfile.all-employee', ['AllEmployee' => $AllEmployee]);
}
// View Employee Detail
public function viewEmployee($EmployeeId = '', $ModuleId = '')
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
// $AllProfileIds = $this->getAccessUserProfileList('kPpUNPQgaJngyUNr7iRIXbcalSfm6PQAw1009');
// $approvalView = 'FALSE';
// if (in_array(session('ProfileId'), $AllProfileIds))
// {
// $approvalView = 'TRUE';
// }
$GetApprovalProfileId = Approval::select('*')->where('ProfileId', session('ProfileId'))->where('UserId', session('UserId'))->where('ApprovalStatus', 0)->get();
$ApprovalView = 'FALSE';
if ($GetApprovalProfileId) {
$ApprovalView = 'TRUE';
}
$EmployeePrimaryDetail = EmployeeProfile::select('tbl_employees.*', 'tbl_name_title.NameTitle as Title', 'tbl_department.DepartmentName as DepartmentName', 'tbl_ddo.DDOName as DDOName', 'tbl_controlling_officer.ControllingOfficerName as ControllingOfficer', 'tbl_designation.DesignationName as DesignationName', 'tbl_appointment.AppointmentByName as AppointmentByName', 'tbl_actual_work_place.ActualWorkPlaceName as ActualWorkPlace', 'tbl_group.GroupName as Group', 'tbl_cadre.CadreName as Cadre', 'tbl_sanction_post.SanctionPostName as SanctionPost', 'tbl_faculty.FacultyName as Faculty', 'tbl_scheme_name.NameOfScheme as NameOfScheme', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->where('tbl_employees.EmployeeId', $EmployeeId)
->where('tbl_employees.IsDeleted', '=', '0')
->leftJoin('tbl_admin', 'tbl_employees.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_name_title', 'tbl_employees.NameTitleId', '=', 'tbl_name_title.NameTitleId')
->leftJoin('tbl_department', 'tbl_employees.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_ddo', 'tbl_employees.DDOId', '=', 'tbl_ddo.DDOId')
->leftJoin('tbl_controlling_officer', 'tbl_employees.ControllingOfficerId', '=', 'tbl_controlling_officer.ControllingOfficerId')
->leftJoin('tbl_designation', 'tbl_employees.DesignationId', '=', 'tbl_designation.DesignationId')
->leftJoin('tbl_appointment', 'tbl_employees.AppointmentBy', '=', 'tbl_appointment.AppointmentId')
->leftJoin('tbl_actual_work_place', 'tbl_employees.ActualWorkPlaceId', '=', 'tbl_actual_work_place.ActualWorkPlaceId')
->leftJoin('tbl_group', 'tbl_employees.Group', '=', 'tbl_group.GroupId')
->leftJoin('tbl_cadre', 'tbl_employees.CadreId', '=', 'tbl_cadre.CadreId')
->leftJoin('tbl_sanction_post', 'tbl_employees.SanctionPostId', '=', 'tbl_sanction_post.SanctionPostId')
->leftJoin('tbl_faculty', 'tbl_employees.FacultyId', '=', 'tbl_faculty.FacultyId')
->leftJoin('tbl_scheme_name', 'tbl_employees.SchemeNameId', '=', 'tbl_scheme_name.SchemeNameId')
->get()->first();
// print_r(json_encode($EmployeePrimaryDetail));
// exit;
$EmployeeCategoryDetail = EmployeeCategoryDetail::select('tbl_employee_category_detail.*', 'tbl_religion.ReligionName as Religion', 'tbl_caste.CasteName as Caste', 'tbl_basic_category.BasicCategoryName as BasicCategory', 'tbl_appointment_category.AppointmentCategoryName as AppointmentCategory', 'tbl_parallel_reservation.ParallelReservationName as ParallelReservation', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_category_detail.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_basic_category', 'tbl_employee_category_detail.BasicCategoryId', '=', 'tbl_basic_category.BasicCategoryId')
->leftJoin('tbl_religion', 'tbl_employee_category_detail.ReligionId', '=', 'tbl_religion.ReligionId')
->leftJoin('tbl_caste', 'tbl_employee_category_detail.CasteId', '=', 'tbl_caste.CasteId')
->leftJoin('tbl_appointment_category', 'tbl_employee_category_detail.AppointmentCategoryId', '=', 'tbl_appointment_category.AppointmentCategoryId')
->leftJoin('tbl_parallel_reservation', 'tbl_employee_category_detail.ParallelReservationId', '=', 'tbl_parallel_reservation.ParallelReservationId')
->where('tbl_employee_category_detail.EmployeeId', $EmployeeId)
->get()
->first();
$EmployeeGeneralDetail = EmployeeGeneralDetail::select('tbl_employee_general_detail.*', 'tbl_marital_status.MaritalStatusName as MaritalStatus', 'tbl_gender.GenderName as Gender', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_general_detail.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_marital_status', 'tbl_employee_general_detail.MaritalStatusId', '=', 'tbl_marital_status.MaritalStatusId')
->leftJoin('tbl_gender', 'tbl_employee_general_detail.GenderId', '=', 'tbl_gender.GenderId')
->where('tbl_employee_general_detail.EmployeeId', $EmployeeId)
->get()->first();
$EmployeePayMatrix = EmployeePayMatrix::select('tbl_employees_paymatrix.*', 'tbl_payscale.PayScaleName as PayScale', 'tbl_payband.PayBandName as PayBand', 'tbl_gradepay.GradePayName as GradePay', 'tbl_paylevel.PayLevelName as PayLevel', 'tbl_paylevel_amount.PayLevelAmount as LevelAmount', 'tbl_pay_fixation.PayFixation as PayFixation', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees_paymatrix.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_payscale', 'tbl_employees_paymatrix.PayScaleId', '=', 'tbl_payscale.PayScaleId')
->leftJoin('tbl_payband', 'tbl_employees_paymatrix.PayBandId', '=', 'tbl_payband.PayBandId')
->leftJoin('tbl_gradepay', 'tbl_employees_paymatrix.GradePayId', '=', 'tbl_gradepay.GradePayId')
->leftJoin('tbl_paylevel', 'tbl_employees_paymatrix.PayLevelId', '=', 'tbl_paylevel.PayLevelId')
->leftJoin('tbl_paylevel_amount', 'tbl_employees_paymatrix.PayLevelAmountId', '=', 'tbl_paylevel_amount.PayLevelAmountId')
->leftJoin('tbl_pay_fixation', 'tbl_employees_paymatrix.PayFixationId', '=', 'tbl_pay_fixation.PayFixationId')
->where('tbl_employees_paymatrix.EmployeeId', $EmployeeId)
->where('tbl_employees_paymatrix.IsDeleted', '0')
->orderBy('tbl_employees_paymatrix.id', 'DESC')
->get();
// Check if Pending Submit PayMatrix Approval
$GetPendingApprovalPayMatrix = EmployeePayMatrix::select('tbl_employees_paymatrix.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected PayMatrix
$GetRejectedPayMatrix = EmployeePayMatrix::select('tbl_employees_paymatrix.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request PayMatrix Approval
$GetRequestApprovalPayMatrix = EmployeePayMatrix::select('tbl_employees_paymatrix.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '=', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// echo $GetRejectedPayMatrix;
// exit;
$PoliceVerification = EmployeePoliceVerification::select('tbl_employee_police_verification.*', 'tbl_state.state_name as State', 'tbl_district.district_name as District', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_police_verification.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_state', 'tbl_employee_police_verification.StateId', '=', 'tbl_state.id')
->leftJoin('tbl_district', 'tbl_employee_police_verification.DistrictId', '=', 'tbl_district.id')
->where('tbl_employee_police_verification.EmployeeId', $EmployeeId)
->get()->first();
$MedicalCertificate = EmployeeMedicalCertificate::select('tbl_employee_medical_certificate.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_medical_certificate.Updated_by', '=', 'tbl_admin.UserId')
->where('EmployeeId', $EmployeeId)
->get()->first();
$EligibilityExam = EmployeeEligibilityExam::select('tbl_employee_eligibility_exam.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_eligibility_exam.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_eligibility_exam.EmployeeId', $EmployeeId)
->where('tbl_employee_eligibility_exam.Status', '1')
->where('tbl_employee_eligibility_exam.IsDeleted', '0')
->get();
// Check if Pending Submit EligibilityExam Approval
$GetPendingApprovalEligibilityExam = EmployeeEligibilityExam::select('tbl_employee_eligibility_exam.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected EligibilityExam
$GetRejectedEligibilityExam = EmployeeEligibilityExam::select('tbl_employee_eligibility_exam.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request EligibilityExam Approval
$GetRequestApprovalEligibilityExam = EmployeeEligibilityExam::select('tbl_employee_eligibility_exam.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
// ->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->where('ApprovalStatus', '0')
->get()->count();
// echo $GetRequestApprovalPayMatrix;
// exit;
// Get Employee Current Detail
$GetEmpCurrentDetail = EmployeePromotion::select('tbl_employees_promotion_transfer.*', 'tbl_employees.EmployeeName as EmployeeName', 'tbl_ddo.DDOName as DDOName', 'tbl_controlling_officer.ControllingOfficerName as ControllingOfficer', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName', 'tbl_actual_work_place.ActualWorkPlaceName as ActualWorkPlace', 'tbl_group.GroupName as Group', 'tbl_cadre.CadreName as Cadre', 'tbl_scheme_name.NameOfScheme as SchemeName', 'tbl_sanction_post.SanctionPostName as SanctionPost', 'tbl_faculty.FacultyName as Faculty', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees_promotion_transfer.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employees_promotion_transfer.EmployeeId', $EmployeeId)
->where('tbl_employees_promotion_transfer.IsDeleted', '=', '0')
->orderBy('tbl_employees_promotion_transfer.id', 'DESC')
->leftJoin('tbl_employees', 'tbl_employees_promotion_transfer.EmployeeId', '=', 'tbl_employees.EmployeeId')
->leftJoin('tbl_ddo', 'tbl_employees_promotion_transfer.DDOId', '=', 'tbl_ddo.DDOId')
->leftJoin('tbl_controlling_officer', 'tbl_employees_promotion_transfer.ControllingOfficerId', '=', 'tbl_controlling_officer.ControllingOfficerId')
->leftJoin('tbl_department', 'tbl_employees_promotion_transfer.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_designation', 'tbl_employees_promotion_transfer.DesignationId', '=', 'tbl_designation.DesignationId')
->leftJoin('tbl_actual_work_place', 'tbl_employees_promotion_transfer.ActualWorkPlaceId', '=', 'tbl_actual_work_place.ActualWorkPlaceId')
->leftJoin('tbl_cadre', 'tbl_employees_promotion_transfer.CadreId', '=', 'tbl_cadre.CadreId')
->leftJoin('tbl_group', 'tbl_employees_promotion_transfer.GroupId', '=', 'tbl_group.GroupId')
->leftJoin('tbl_sanction_post', 'tbl_employees_promotion_transfer.SanctionPostId', '=', 'tbl_sanction_post.SanctionPostId')
->leftJoin('tbl_scheme_name', 'tbl_employees_promotion_transfer.SchemeNameId', '=', 'tbl_scheme_name.SchemeNameId')
->leftJoin('tbl_faculty', 'tbl_employees_promotion_transfer.FacultyId', '=', 'tbl_faculty.FacultyId')
->get()->first();
$EmpAddressList = EmployeeAddress::select('tbl_employees_address.*', 'tbl_country.country_name as Country', 'tbl_state.state_name as State', 'tbl_district.district_name as District', 'tbl_city.city_name as City', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees_address.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_country', 'tbl_employees_address.PermanentCountry', '=', 'tbl_country.id')
->leftJoin('tbl_state', 'tbl_employees_address.PermanentState', '=', 'tbl_state.id')
->leftJoin('tbl_district', 'tbl_employees_address.PermanentDistrict', '=', 'tbl_district.id')
->leftJoin('tbl_city', 'tbl_employees_address.PermanentCity', '=', 'tbl_city.id')
->where('tbl_employees_address.EmployeeId', $EmployeeId)
->where('tbl_employees_address.IsDeleted', '=', '0')
->get();
// Check if Pending Submit Address Approval
$GetPendingApprovalAddress = EmployeeAddress::select('tbl_employees_address.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected Address
$GetRejectedAddress = EmployeeAddress::select('tbl_employees_address.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request Address Approval
$GetRequestApprovalAddress = EmployeeAddress::select('tbl_employees_address.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpPermanentAddress = EmployeeAddress::select('tbl_employees_address.*', 'tbl_country.country_name as Country', 'tbl_state.state_name as State', 'tbl_district.district_name as District', 'tbl_city.city_name as City', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees_address.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_country', 'tbl_employees_address.PermanentCountry', '=', 'tbl_country.id')
->leftJoin('tbl_state', 'tbl_employees_address.PermanentState', '=', 'tbl_state.id')
->leftJoin('tbl_district', 'tbl_employees_address.PermanentDistrict', '=', 'tbl_district.id')
->leftJoin('tbl_city', 'tbl_employees_address.PermanentCity', '=', 'tbl_city.id')
->where('tbl_employees_address.EmployeeId', $EmployeeId)
->where('tbl_employees_address.IsDeleted', '=', '0')
->get()
->first();
$EmpCurrentAddress = EmployeeAddress::select('tbl_employees_address.*', 'tbl_country.country_name as Country', 'tbl_state.state_name as State', 'tbl_district.district_name as District', 'tbl_city.city_name as City', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees_address.Updated_by', '=', 'tbl_admin.UserId')
->leftJoin('tbl_country', 'tbl_employees_address.CurrentCountry', '=', 'tbl_country.id')
->leftJoin('tbl_state', 'tbl_employees_address.CurrentState', '=', 'tbl_state.id')
->leftJoin('tbl_district', 'tbl_employees_address.CurrentDistrict', '=', 'tbl_district.id')
->leftJoin('tbl_city', 'tbl_employees_address.CurrentCity', '=', 'tbl_city.id')
->where('tbl_employees_address.EmployeeId', $EmployeeId)
->where('tbl_employees_address.IsDeleted', '=', '0')
->get()
->first();
$EmployeePensionScheme = EmployeePensionScheme::select('tbl_employee_pension_scheme.*', 'tbl_pension_scheme.PensionSchemeName as PensionSchemeName')
->leftJoin('tbl_pension_scheme', 'tbl_employee_pension_scheme.PensionSchemeId', 'tbl_pension_scheme.PensionSchemeId')
->where('tbl_employee_pension_scheme.EmployeeId', $EmployeeId)
->where('tbl_employee_pension_scheme.IsDeleted', '0')
->orderBy('tbl_employee_pension_scheme.id', 'DESC')
->get();
// Check if Pending Submit PensionScheme Approval
$GetPendingApprovalPensionScheme = EmployeePensionScheme::select('tbl_employee_pension_scheme.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected PensionScheme
$GetRejectedPensionScheme = EmployeePensionScheme::select('tbl_employee_pension_scheme.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request PensionScheme Approval
$GetRequestApprovalPensionScheme = EmployeePensionScheme::select('tbl_employee_pension_scheme.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->where('ApprovalStatus', '=', '0')
->get()->count();
// echo $GetRequestApprovalPayMatrix;
// exit;
$EmployeeNameChange = EmployeeNameChange::select('tbl_employee_name_change.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
// Check if Pending Submit NameChange Approval
$GetPendingApprovalNameChange = EmployeeNameChange::select('tbl_employee_name_change.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected NameChange
$GetRejectedNameChange = EmployeeNameChange::select('tbl_employee_name_change.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request NameChange Approval
$GetRequestApprovalNameChange = EmployeeNameChange::select('tbl_employee_name_change.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '=', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// echo $GetRequestApprovalPayMatrix;
// exit;
$EmployeeDeputation = DeputationDetail::select('tbl_employee_deputation_detail.*', 'tbl_sanction_post.SanctionPostName as NameOfDeputationPost')
->leftJoin('tbl_sanction_post', 'tbl_employee_deputation_detail.NameOfDeputationPost', 'tbl_sanction_post.SanctionPostId')
->where('tbl_employee_deputation_detail.EmployeeId', $EmployeeId)
->where('tbl_employee_deputation_detail.Status', '1')
->where('tbl_employee_deputation_detail.IsDeleted', '0')
->orderBy('tbl_employee_deputation_detail.id', 'DESC')
->get();
// Check if Pending Submit Deputation Approval
$GetPendingApprovalDeputation = DeputationDetail::select('tbl_employee_deputation_detail.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected DeputationDetail
$GetRejectedDeputationDetail = DeputationDetail::select('tbl_employee_deputation_detail.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request Deputation Approval
$GetRequestApprovalDeputation = DeputationDetail::select('tbl_employee_deputation_detail.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// echo $GetRequestApprovalPayMatrix;
// exit;
$EmployeePermanency = EmployeePermanency::select('tbl_employee_permanency.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get()->first();
$EmployeeProbationPeriod = EmployeeProbationPeriod::select('tbl_employee_probation_period.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
// Check if Pending Submit ProbationPeriod Approval
$GetPendingApprovalProbationPeriod = EmployeeProbationPeriod::select('tbl_employee_probation_period.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected ProbationPeriod
$GetRejectedProbationPeriod = EmployeeProbationPeriod::select('tbl_employee_probation_period.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request ProbationPeriod Approval
$GetRequestApprovalProbationPeriod = EmployeeProbationPeriod::select('tbl_employee_probation_period.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// echo $GetRequestApprovalPayMatrix;
// exit;
$EmpTransferList = EmployeePromotion::select('tbl_employees_promotion_transfer.*', 'tbl_transfer_status.TransferStatusName as AppointmentStatus', 'tbl_ddo.DDOName as DDOName', 'tbl_controlling_officer.ControllingOfficerName as ControllingOfficer', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName', 'tbl_actual_work_place.ActualWorkPlaceName as ActualWorkPlace',)
->leftJoin('tbl_ddo', 'tbl_employees_promotion_transfer.DDOId', '=', 'tbl_ddo.DDOId')
->leftJoin('tbl_controlling_officer', 'tbl_employees_promotion_transfer.ControllingOfficerId', '=', 'tbl_controlling_officer.ControllingOfficerId')
->leftJoin('tbl_department', 'tbl_employees_promotion_transfer.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_designation', 'tbl_employees_promotion_transfer.DesignationId', '=', 'tbl_designation.DesignationId')
->leftJoin('tbl_actual_work_place', 'tbl_employees_promotion_transfer.ActualWorkPlaceId', '=', 'tbl_actual_work_place.ActualWorkPlaceId')
->leftJoin('tbl_transfer_status', 'tbl_employees_promotion_transfer.AppointmentStatus', '=', 'tbl_transfer_status.TransferStatusId')
->where('tbl_employees_promotion_transfer.EmployeeId', $EmployeeId)
->where('tbl_employees_promotion_transfer.IsDeleted', '=', '0')
->where('tbl_employees_promotion_transfer.PromotionTransferCode', '!=', '')
->orderBy('tbl_employees_promotion_transfer.id', 'DESC')
->get();
// Check if Pending Submit Promotion Approval
$GetPendingApprovalPromotion = EmployeePromotion::select('tbl_employees_promotion_transfer.*')
->where('EmployeeId', $EmployeeId)
->where('PromotionTransferCode', '!=', '')
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected EmployeePromotion
$GetRejectedEmployeePromotion = EmployeePromotion::select('tbl_employees_promotion_transfer.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request Promotion Approval
$GetRequestApprovalPromotion = EmployeePromotion::select('tbl_employees_promotion_transfer.*')
->where('EmployeeId', $EmployeeId)
->where('PromotionTransferCode', '!=', '')
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// echo $GetPendingApprovalPromotion;
// exit;
$EmployeeQualification = EmployeeQualifications::select('tbl_employee_qualifications.*', 'tbl_qualifications.QualificationName as QualificationName', 'tbl_division_grade.DivisionGradeName as Division',)
->leftJoin('tbl_qualifications', 'tbl_employee_qualifications.QualificationId', 'tbl_qualifications.QualificationId')
->leftJoin('tbl_division_grade', 'tbl_employee_qualifications.Grade', 'tbl_division_grade.DivisionGradeId')
->where('tbl_employee_qualifications.EmployeeId', $EmployeeId)
->where('tbl_employee_qualifications.Status', '1')
->where('tbl_employee_qualifications.IsDeleted', '0')
->orderBy('tbl_employee_qualifications.PassingYear', 'DESC')
->get();
// Check if Pending Submit Qualification Approval
$GetPendingApprovalQualification = EmployeeQualifications::select('tbl_employee_qualifications.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected EmployeeQualifications
$GetRejectedQualification = EmployeeQualifications::select('tbl_employee_qualifications.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request Qualification Approval
$GetRequestApprovalQualification = EmployeeQualifications::select('tbl_employee_qualifications.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmployeeFamilyMemberList = FamilyMember::select('tbl_employees_family_member.*', 'tbl_employee_relation.EmployeeRelationName as Relation')
->leftJoin('tbl_employee_relation', 'tbl_employees_family_member.EmployeeRelationId', 'tbl_employee_relation.EmployeeRelationId')
->where('EmployeeId', $EmployeeId)
//->where('tbl_employees_family_member.Status', '1')
->where('tbl_employees_family_member.IsDeleted', '0')
->orderBy('tbl_employees_family_member.MemberAddedDate', 'DESC')
->get();
// Check if Pending Submit FamilyMember Approval
$GetPendingApprovalFamilyMember = FamilyMember::select('tbl_employees_family_member.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected FamilyMember
$GetRejectedFamilyMember = FamilyMember::select('tbl_employees_family_member.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request FamilyMember Approval
$GetRequestApprovalFamilyMember = FamilyMember::select('tbl_employees_family_member.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
$EmployeeNomineeList = EmployeeNomineeDetail::select('tbl_employees_nominee_details.*', 'tbl_employee_relation.EmployeeRelationName as EmployeeRelation', 'tbl_pension_scheme.PensionSchemeName as NomineeType')
->leftJoin('tbl_employee_relation', 'tbl_employees_nominee_details.EmployeeRelationId', 'tbl_employee_relation.EmployeeRelationId')
->leftJoin('tbl_pension_scheme', 'tbl_employees_nominee_details.NomineeType', 'tbl_pension_scheme.PensionSchemeId')
->where('tbl_employees_nominee_details.EmployeeId', $EmployeeId)
//->where('tbl_employees_nominee_details.Status', '1')
->where('tbl_employees_nominee_details.IsDeleted', '0')
->orderBy('tbl_employees_nominee_details.NomineeAddedDate', 'DESC')
->get();
// Check if Pending Submit Nominee Approval
$GetPendingApprovalNominee = EmployeeNomineeDetail::select('tbl_employees_nominee_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected Nominee
$GetRejectedNomineeDetail = EmployeeNomineeDetail::select('tbl_employees_nominee_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request Nominee Approval
$GetRequestApprovalNominee = EmployeeNomineeDetail::select('tbl_employees_nominee_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpPrevJob = PreviousJobDetail::select('tbl_employees_previous_job_details.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employees_previous_job_details.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employees_previous_job_details.EmployeeId', $EmployeeId)
->get();
// Check if Pending Submit PrevJob Approval
$GetPendingApprovalPrevJob = PreviousJobDetail::select('tbl_employees_previous_job_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected PreviousJobDetail
$GetRejectedPreviousJob = PreviousJobDetail::select('tbl_employees_previous_job_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request PrevJob Approval
$GetRequestApprovalPrevJob = PreviousJobDetail::select('tbl_employees_previous_job_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpTrainingDetail = EmployeeTrainingDetail::select('tbl_employees_training_details.*', 'tbl_employees.EmployeeName as EmployeeName', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_employees', 'tbl_employees_training_details.EmployeeId', 'tbl_employees.EmployeeId')
->leftJoin('tbl_admin', 'tbl_employees_training_details.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employees_training_details.EmployeeId', $EmployeeId)
->where('tbl_employees_training_details.Status', '1')
->where('tbl_employees_training_details.IsDeleted', '0')
->get();
// Check if Pending Submit TrainingDetail Approval
$GetPendingApprovalTrainingDetail = EmployeeTrainingDetail::select('tbl_employees_training_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected TrainingDetail
$GetRejectedTrainingDetail = EmployeeTrainingDetail::select('tbl_employees_training_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request TrainingDetail Approval
$GetRequestApprovalTrainingDetail = EmployeeTrainingDetail::select('tbl_employees_training_details.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpForeignVisit = ForeignVisit::select('tbl_employee_foreign_visits.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
// Check if Pending Submit ForeignVisit Approval
$GetPendingApprovalForeignVisit = ForeignVisit::select('tbl_employee_foreign_visits.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected ForeignVisit
$GetRejectedForeignVisit = ForeignVisit::select('tbl_employee_foreign_visits.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request ForeignVisit Approval
$GetRequestApprovalForeignVisit = ForeignVisit::select('tbl_employee_foreign_visits.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpDisciplinaryAction = EmployeeDisciplinaryAction::select('tbl_employees_disciplinary_action.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
// Check if Pending Submit DisciplinaryAction Approval
$GetPendingApprovalDisciplinaryAction = EmployeeDisciplinaryAction::select('tbl_employees_disciplinary_action.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected DisciplinaryAction
$GetRejectedDisciplinaryAction = EmployeeDisciplinaryAction::select('tbl_employees_disciplinary_action.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request DisciplinaryAction Approval
$GetRequestApprovalDisciplinaryAction = EmployeeDisciplinaryAction::select('tbl_employees_disciplinary_action.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpLoanAllowance = EmployeeLoanAllowance::select('tbl_employee_loan_allowance.*', 'tbl_loan_allowance_category.AllowanceCategoryName as AllowanceCategory')
->leftJoin('tbl_loan_allowance_category', 'tbl_employee_loan_allowance.AllowanceCategoryId', '=', 'tbl_loan_allowance_category.AllowanceCategoryId')
->where('tbl_employee_loan_allowance.EmployeeId', $EmployeeId)
->where('tbl_employee_loan_allowance.Status', '=', '1')
->where('tbl_employee_loan_allowance.IsDeleted', '=', '0')
->get();
// Check if Pending Submit LoanAllowance Approval
$GetPendingApprovalLoanAllowance = EmployeeLoanAllowance::select('tbl_employee_loan_allowance.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected LoanAllowance
$GetRejectedLoanAllowance = EmployeeLoanAllowance::select('tbl_employee_loan_allowance.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request LoanAllowance Approval
$GetRequestApprovalLoanAllowance = EmployeeLoanAllowance::select('tbl_employee_loan_allowance.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
// ->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpLeaveTravelConcession = LeaveTravelConcession::select('tbl_leave_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '=', '1')
->where('IsDeleted', '=', '0')
->orderBy('HomeTownBlockYear', 'DESC')
->get();
// Check if Pending Submit TravelConcession Approval
$GetPendingApprovalTravelConcession = LeaveTravelConcession::select('tbl_leave_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected TravelConcession
$GetRejectedTravelConcession = LeaveTravelConcession::select('tbl_leave_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request TravelConcession Approval
$GetRequestApprovalTravelConcession = LeaveTravelConcession::select('tbl_leave_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpMaharashtraDarshan = MaharashtraDarshanTravel::select('tbl_maharashtra_darshan_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '=', '1')
->where('IsDeleted', '=', '0')
->orderBy('MaharashtraTravelBlockYear', 'DESC')
->get();
// Check if Pending Submit MaharashtraDarshan Approval
$GetPendingApprovalMaharashtraDarshan = MaharashtraDarshanTravel::select('tbl_maharashtra_darshan_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected MaharashtraDarshan
$GetRejectedMaharashtraDarshan = MaharashtraDarshanTravel::select('tbl_maharashtra_darshan_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request MaharashtraDarshan Approval
$GetRequestApprovalMaharashtraDarshan = MaharashtraDarshanTravel::select('tbl_maharashtra_darshan_travel_concession.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$AssetsLiabilities = AssetsLiability::select('tbl_employee_assets_liabilities.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '=', '1')
->where('IsDeleted', '=', '0')
->orderBy('AssetsLiabilitiesYear', 'DESC')
->get();
// Check if Pending Submit AssetsLiabilities Approval
$GetPendingApprovalAssetsLiabilities = AssetsLiability::select('tbl_employee_assets_liabilities.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected AssetsLiabilities
$GetRejectedAssetsLiabilities = AssetsLiability::select('tbl_employee_assets_liabilities.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request AssetsLiabilities Approval
$GetRequestApprovalAssetsLiabilities = AssetsLiability::select('tbl_employee_assets_liabilities.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
$ConfidentialReport = ConfidentialReport::select('tbl_employee_confidential_report.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '=', '1')
->where('IsDeleted', '=', '0')
->orderBy('id', 'ASC')
->get();
// Check if Pending Submit ConfidentialReport Approval
$GetPendingApprovalConfidentialReport = ConfidentialReport::select('tbl_employee_confidential_report.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected ConfidentialReport
$GetRejectedConfidentialReport = ConfidentialReport::select('tbl_employee_confidential_report.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request ConfidentialReport Approval
$GetRequestApprovalConfidentialReport = ConfidentialReport::select('tbl_employee_confidential_report.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
->where('ApprovalStatus', '0')
//->where('NoOfApproval', '!=', '2')
->where('IsDeleted', '=', '0')
->get()->count();
$EmployeeAwardDetail = EmployeeAwardDetail::select('tbl_employee_award_detail.*', 'tbl_award_nature.AwardNature as AwardNature')
->leftJoin('tbl_award_nature', 'tbl_employee_award_detail.AwardNatureId', 'tbl_award_nature.AwardNatureId')
->where('EmployeeId', $EmployeeId)
->where('tbl_employee_award_detail.Status', '=', '1')
->where('tbl_employee_award_detail.IsDeleted', '=', '0')
->get();
// Check if Pending Submit AwardDetail Approval
$GetPendingApprovalAwardDetail = EmployeeAwardDetail::select('tbl_employee_award_detail.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('NoOfApproval', '0')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
// Get Rejected AwardDetail
$GetRejectedAwardDetail = EmployeeAwardDetail::select('tbl_employee_award_detail.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '0')
->where('ApprovalStatus', '2')
->where('IsDeleted', '=', '0')
->get()->count();
// Check if Pending Request AwardDetail Approval
$GetRequestApprovalAwardDetail = EmployeeAwardDetail::select('tbl_employee_award_detail.*')
->where('EmployeeId', $EmployeeId)
->where('ApprovalLock', '1')
//->where('NoOfApproval', '!=', '2')
->where('ApprovalStatus', '0')
->where('IsDeleted', '=', '0')
->get()->count();
$EmpRetirementOrder = EmpRetirementOrder::select('tbl_employee_retirement_order.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_retirement_order.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_retirement_order.EmployeeId', $EmployeeId)
->where('tbl_employee_retirement_order.Status', '=', '1')
->where('tbl_employee_retirement_order.IsDeleted', '=', '0')
->get()->first();
$EmpAgeRelax = EmpAgeRelax::select('tbl_employee_age_relax.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_age_relax.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_age_relax.EmployeeId', $EmployeeId)
->where('tbl_employee_age_relax.Status', '=', '1')
->where('tbl_employee_age_relax.IsDeleted', '=', '0')
->get()->first();
$EmpResignation = EmployeeResignation::select('tbl_employee_resignation.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_resignation.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_resignation.EmployeeId', $EmployeeId)
->where('tbl_employee_resignation.Status', '=', '1')
->where('tbl_employee_resignation.IsDeleted', '=', '0')
->get()->first();
$EmpDeathCertificate = EmployeeDeathCertificate::select('tbl_employee_death_certificate.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_death_certificate.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_death_certificate.EmployeeId', $EmployeeId)
->where('tbl_employee_death_certificate.Status', '=', '1')
->where('tbl_employee_death_certificate.IsDeleted', '=', '0')
->get()->first();
$EmpGratiaAmount = EmployeeGratiaAmount::select('tbl_employee_gratia_amount.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_gratia_amount.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_gratia_amount.EmployeeId', $EmployeeId)
->where('tbl_employee_gratia_amount.Status', '=', '1')
->where('tbl_employee_gratia_amount.IsDeleted', '=', '0')
->get()->first();
$EmpReAppraising = EmployeeReAppraising::select('tbl_employee_re_appraising.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_re_appraising.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_re_appraising.EmployeeId', $EmployeeId)
->where('tbl_employee_re_appraising.Status', '=', '1')
->where('tbl_employee_re_appraising.IsDeleted', '=', '0')
->get()->first();
$EmpEncashment = EncashmentOfLeave::select('tbl_encashment_of_leave.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_encashment_of_leave.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_encashment_of_leave.EmployeeId', $EmployeeId)
->where('tbl_encashment_of_leave.Status', '=', '1')
->where('tbl_encashment_of_leave.IsDeleted', '=', '0')
->get()->first();
$EmpGratuityAmount = EmployeeGratuityAmount::select('tbl_employee_gratuity_amount.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_gratuity_amount.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_gratuity_amount.EmployeeId', $EmployeeId)
->where('tbl_employee_gratuity_amount.Status', '=', '1')
->where('tbl_employee_gratuity_amount.IsDeleted', '=', '0')
->get()->first();
$EmpCommutation = EmployeeCommutation::select('tbl_employee_commutation.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_commutation.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_commutation.EmployeeId', $EmployeeId)
->where('tbl_employee_commutation.Status', '=', '1')
->where('tbl_employee_commutation.IsDeleted', '=', '0')
->get()->first();
$EmpPension = EmployeePension::select('tbl_employee_pension.*', 'tbl_admin.FirstName as Updated_by', 'tbl_admin.FirstName as Created_by')
->leftJoin('tbl_admin', 'tbl_employee_pension.Updated_by', '=', 'tbl_admin.UserId')
->where('tbl_employee_pension.EmployeeId', $EmployeeId)
->where('tbl_employee_pension.Status', '=', '1')
->where('tbl_employee_pension.IsDeleted', '=', '0')
->get()->first();
//get approval btn
$ApprovalBtn = 'false';
$RejectBtn = 'false';
$NumberOfApproval = 0;
$NumberOfReject = 0;
if ($ModuleId) {
$LastLoginUserProfileId = session('ProfileId');
$ApprovalDetails = Approval::select('*')->where('ApprovalStatus', '1')->where('EmployeeId', $EmployeeId)->where('ModuleId', $ModuleId)->where('ProfileId', $LastLoginUserProfileId)->where('UserId', session('UserId'))->get();
// echo $ApprovalDetails;
// exit;
$ApprovalBtn = 'true';
if ($ApprovalDetails->count() > 0) {
$ApprovalBtn = 'false';
}
$RejectDetails = Approval::select('*')->where('ApprovalStatus', '2')->where('EmployeeId', $EmployeeId)->where('ModuleId', $ModuleId)->where('ProfileId', $LastLoginUserProfileId);
$RejectBtn = 'true';
if ($RejectDetails->count() > 0) {
$RejectBtn = 'false';
}
$getTotalApprovals = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)->where('ApprovalStatus', '1')->get();
$NumberOfApproval = $getTotalApprovals->count();
$getTotalRejection = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)->where('ApprovalStatus', '2')->get();
$NumberOfReject = $getTotalRejection->count();
}
$UserProfileId = session('ProfileId');
$getApprovalAuthority = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)
->where('ProfileId', $UserProfileId)
->get();
$isManager = 'false';
if ($getApprovalAuthority->count() > 0) {
$isManager = 'true';
}
// DB::enableQueryLog();
$EmployeeEarnedCommutedLeave = EmployeeEarnedCommutedLeave::select('tbl_employee_earned_commuted_leave.*','tbl_leave.StartDate','tbl_leave.EndDate','tbl_leave.TotalLeave')
->leftJoin('tbl_leave', 'tbl_employee_earned_commuted_leave.EmployeeId','=', 'tbl_leave.EmployeeId')
->where('tbl_employee_earned_commuted_leave.EmployeeId', $EmployeeId)
->where('tbl_employee_earned_commuted_leave.Status', '1')
->where('tbl_employee_earned_commuted_leave.IsDeleted', '0')
->orderBy('tbl_employee_earned_commuted_leave.id', 'asc')
// ->groupBy('tbl_employee_earned_commuted_leave.id')
// ->groupBy('tbl_leave.id')
->get();
// dd(DB::getQueryLog());
// echo json_encode($EmployeeEarnedCommutedLeave);exit;
return view('admin.EmployeeProfile.view-employee', ['EmployeePrimaryDetail' => $EmployeePrimaryDetail, 'EmployeeCategoryDetail' => $EmployeeCategoryDetail, 'EmployeeGeneralDetail' => $EmployeeGeneralDetail, 'EmployeePayMatrix' => $EmployeePayMatrix, 'PoliceVerification' => $PoliceVerification, 'MedicalCertificate' => $MedicalCertificate, 'EligibilityExam' => $EligibilityExam, 'EmployeeQualification' => $EmployeeQualification, 'EmpPermanentAddress' => $EmpPermanentAddress, 'GetPendingApprovalAddress' => $GetPendingApprovalAddress, 'EmpCurrentAddress' => $EmpCurrentAddress, 'EmployeePensionScheme' => $EmployeePensionScheme, 'EmployeeNameChange' => $EmployeeNameChange, 'EmployeeDeputation' => $EmployeeDeputation, 'EmployeePermanency' => $EmployeePermanency, 'EmployeeFamilyMemberList' => $EmployeeFamilyMemberList, 'EmployeeNomineeList' => $EmployeeNomineeList, 'GetEmpCurrentDetail' => $GetEmpCurrentDetail, 'EmpTransferList' => $EmpTransferList, 'EmployeeProbationPeriod' => $EmployeeProbationPeriod, 'EmpAddressList' => $EmpAddressList, 'EmpPrevJob' => $EmpPrevJob, 'EmpTrainingDetail' => $EmpTrainingDetail, 'EmpForeignVisit' => $EmpForeignVisit, 'EmpDisciplinaryAction' => $EmpDisciplinaryAction, 'EmpLoanAllowance' => $EmpLoanAllowance, 'EmpLeaveTravelConcession' => $EmpLeaveTravelConcession, 'EmpMaharashtraDarshan' => $EmpMaharashtraDarshan, 'AssetsLiabilities' => $AssetsLiabilities, 'ConfidentialReport' => $ConfidentialReport, 'EmployeeAwardDetail' => $EmployeeAwardDetail, 'EmpRetirementOrder' => $EmpRetirementOrder, 'EmpAgeRelax' => $EmpAgeRelax, 'EmpResignation' => $EmpResignation, 'EmpDeathCertificate' => $EmpDeathCertificate, 'EmpGratiaAmount' => $EmpGratiaAmount, 'EmpReAppraising' => $EmpReAppraising, 'EmpEncashment' => $EmpEncashment, 'EmpGratuityAmount' => $EmpGratuityAmount, 'EmpCommutation' => $EmpCommutation, 'EmpPension' => $EmpPension, 'ApprovalView' => $ApprovalView, "ModuleId" => $ModuleId, "ApprovalBtn" => $ApprovalBtn, "RejectBtn" => $RejectBtn, "NumberOfApproval" => $NumberOfApproval, "NumberOfReject" => $NumberOfReject, 'isManager' => $isManager, 'GetRequestApprovalAddress' => $GetRequestApprovalAddress, 'GetPendingApprovalPayMatrix' => $GetPendingApprovalPayMatrix, 'GetRequestApprovalPayMatrix' => $GetRequestApprovalPayMatrix, 'GetRejectedPayMatrix' => $GetRejectedPayMatrix, 'GetPendingApprovalEligibilityExam' => $GetPendingApprovalEligibilityExam, 'GetRequestApprovalEligibilityExam' => $GetRequestApprovalEligibilityExam, 'GetPendingApprovalPensionScheme' => $GetPendingApprovalPensionScheme, 'GetRequestApprovalPensionScheme' => $GetRequestApprovalPensionScheme, 'GetPendingApprovalNameChange' => $GetPendingApprovalNameChange, 'GetRequestApprovalNameChange' => $GetRequestApprovalNameChange, 'GetPendingApprovalDeputation' => $GetPendingApprovalDeputation, 'GetRequestApprovalDeputation' => $GetRequestApprovalDeputation, 'GetPendingApprovalProbationPeriod' => $GetPendingApprovalProbationPeriod, 'GetRequestApprovalProbationPeriod' => $GetRequestApprovalProbationPeriod, 'GetPendingApprovalQualification' => $GetPendingApprovalQualification, 'GetRequestApprovalQualification' => $GetRequestApprovalQualification, 'GetPendingApprovalFamilyMember' => $GetPendingApprovalFamilyMember, 'GetRequestApprovalFamilyMember' => $GetRequestApprovalFamilyMember, 'GetPendingApprovalNominee' => $GetPendingApprovalNominee, 'GetRequestApprovalNominee' => $GetRequestApprovalNominee, 'GetPendingApprovalPrevJob' => $GetPendingApprovalPrevJob, 'GetRequestApprovalPrevJob' => $GetRequestApprovalPrevJob, 'GetPendingApprovalTrainingDetail' => $GetPendingApprovalTrainingDetail, 'GetRequestApprovalTrainingDetail' => $GetRequestApprovalTrainingDetail, 'GetPendingApprovalForeignVisit' => $GetPendingApprovalForeignVisit, 'GetRequestApprovalForeignVisit' => $GetRequestApprovalForeignVisit, 'GetPendingApprovalDisciplinaryAction' => $GetPendingApprovalDisciplinaryAction, 'GetRequestApprovalDisciplinaryAction' => $GetRequestApprovalDisciplinaryAction, 'GetPendingApprovalLoanAllowance' => $GetPendingApprovalLoanAllowance, 'GetRequestApprovalLoanAllowance' => $GetRequestApprovalLoanAllowance, 'GetPendingApprovalTravelConcession' => $GetPendingApprovalTravelConcession, 'GetRequestApprovalTravelConcession' => $GetRequestApprovalTravelConcession, 'GetPendingApprovalMaharashtraDarshan' => $GetPendingApprovalMaharashtraDarshan, 'GetRequestApprovalMaharashtraDarshan' => $GetRequestApprovalMaharashtraDarshan, 'GetPendingApprovalAssetsLiabilities' => $GetPendingApprovalAssetsLiabilities, 'GetRequestApprovalAssetsLiabilities' => $GetRequestApprovalAssetsLiabilities, 'GetPendingApprovalConfidentialReport' => $GetPendingApprovalConfidentialReport, 'GetRequestApprovalConfidentialReport' => $GetRequestApprovalConfidentialReport, 'GetPendingApprovalAwardDetail' => $GetPendingApprovalAwardDetail, 'GetRequestApprovalAwardDetail' => $GetRequestApprovalAwardDetail, 'GetPendingApprovalPromotion' => $GetPendingApprovalPromotion, 'GetRequestApprovalPromotion' => $GetRequestApprovalPromotion, 'GetRejectedEligibilityExam' => $GetRejectedEligibilityExam, 'GetRejectedAddress' => $GetRejectedAddress, 'GetRejectedPensionScheme' => $GetRejectedPensionScheme, 'GetRejectedNameChange' => $GetRejectedNameChange, 'GetRejectedDeputationDetail' => $GetRejectedDeputationDetail, 'GetRejectedProbationPeriod' => $GetRejectedProbationPeriod, 'GetRejectedEmployeePromotion' => $GetRejectedEmployeePromotion, 'GetRejectedQualification' => $GetRejectedQualification, 'GetRejectedFamilyMember' => $GetRejectedFamilyMember, 'GetRejectedNomineeDetail' => $GetRejectedNomineeDetail, 'GetRejectedPreviousJob' => $GetRejectedPreviousJob, 'GetRejectedTrainingDetail' => $GetRejectedTrainingDetail, 'GetRejectedForeignVisit' => $GetRejectedForeignVisit, 'GetRejectedDisciplinaryAction' => $GetRejectedDisciplinaryAction, 'GetRejectedLoanAllowance' => $GetRejectedLoanAllowance, 'GetRejectedTravelConcession' => $GetRejectedTravelConcession, 'GetRejectedMaharashtraDarshan' => $GetRejectedMaharashtraDarshan, 'GetRejectedAssetsLiabilities' => $GetRejectedAssetsLiabilities, 'GetRejectedConfidentialReport' => $GetRejectedConfidentialReport, 'GetRejectedAwardDetail' => $GetRejectedAwardDetail,'EmployeeEarnedCommutedLeave'=>$EmployeeEarnedCommutedLeave]);
}
public function empPreJobDetail()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.previous-job-detail');
}
public function empPreJobDetailList()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.previous-job-detail-list');
}
### Employee Qualification
public function addEmpQualification()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$AllEmployee = EmployeeProfile::select('tbl_employees.*', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName')
->leftJoin('tbl_department', 'tbl_employees.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_designation', 'tbl_employees.DesignationId', '=', 'tbl_designation.DesignationId')
->where('tbl_employees.IsDeleted', '=', '0')
->orderBy('tbl_employees.id', 'desc')
->get();
$Courses = Course::select('*')
->where('IsDeleted', '=', '0')
->orderBy('id', 'desc')
->get();
$DivisionGrade = DivisionGrade::select('*')
->where('IsDeleted', '=', '0')
->orderBy('DivisionGradeName', 'Asc')
->get();
return view('admin.EmployeeProfile.add-qualification', ['EmployeesData' => $AllEmployee, 'CoursesData' => $Courses, 'DivisionGradeData' => $DivisionGrade]);
}
public function empDetails(Request $request, $EmployeeId = '')
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$AllEmployee = EmployeeProfile::select('tbl_employees.*', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName')
->leftJoin('tbl_department', 'tbl_employees.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_designation', 'tbl_employees.DesignationId', '=', 'tbl_designation.DesignationId')
->where('tbl_employees.EmployeeId', $EmployeeId)
->where('tbl_employees.IsDeleted', '=', '0')
->orderBy('tbl_employees.id', 'desc')
->get();
if ($AllEmployee->count() > 0) {
$AllEmployee = $AllEmployee->first();
$response = [
'success' => true,
'error_message' => "Success",
'EmployeeData' => $AllEmployee,
'error_code' => "200",
];
} else {
// fail
$response = [
'success' => false,
'error_message' => "Employee not found",
'EmployeeData' => array(),
'error_code' => "201",
];
}
return response()->json($response);
}
//subjectList
public function subjectList(Request $request, $CourseId = '')
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$Subjects = Subjects::select('*')
->where('CourseId', $CourseId)
->where('IsDeleted', '=', '0')
->orderBy('CourseName', 'Asc')
->get();
$htmlOption = '';
if ($Subjects->count() > 0) {
foreach ($Subjects as $key => $SubjectValue) {
$SubjectId = $SubjectValue->SubjectId;
$SubjectName = $SubjectValue->SubjectName;
$htmlOption .= '<option value="' . $SubjectId . '">' . $SubjectName . '</option>';
}
}
echo $htmlOption;
}
### Employee Qualification Detail List
public function empQualificationList()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.qualification-list');
}
### Employee Training Detail
public function addEmpTrainingDetail()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.add-training-detail');
}
### Employee Training Detail List
public function empTrainingDetailList()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.training-detail-list');
}
### Employee Disciplinary Action Detail
public function addEmpDisciplinaryAction()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.add-disciplinary-action');
}
### Employee Disciplinary Action Detail List
public function empDisciplinaryActionList()
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
return view('admin.EmployeeProfile.disciplinary-action-detail-list');
}
### Check Duplicate Mobile Num
public function checkDuplicateMobile(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$MobileNum = EmployeeProfile::where('MobileNo', $request->MobileNo)->first();
if ($MobileNum) {
echo 'false';
} else {
echo 'true';
}
}
### Check Duplicate Mobile Num Edit case
public function checkDuplicateMobileEdit(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$MobileNo = $request->input('MobileNo');
$EmployeeId = $request->input('EmployeeId');
$MobileNum = EmployeeProfile::where('MobileNo', $MobileNo)
->where('EmployeeId', '!=', $EmployeeId)
->first();
if ($MobileNum) {
echo 'false';
} else {
echo 'true';
}
}
### Check Duplicate Pan Num
public function checkDuplicatePan(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$PanCardNo = EmployeeProfile::where('PanCardNo', $request->PanCardNo)->first();
if ($PanCardNo) {
echo 'false';
} else {
echo 'true';
}
}
### Check Duplicate Pan Num Edit case
public function checkDuplicatePanEdit(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$PanCardNo = $request->input('PanCardNo');
$EmployeeId = $request->input('EmployeeId');
$PanCardNo = EmployeeProfile::where('PanCardNo', $PanCardNo)
->where('EmployeeId', '!=', $EmployeeId)
->first();
if ($PanCardNo) {
echo 'false';
} else {
echo 'true';
}
}
### Check Duplicate Aadhar Card Num
public function checkDuplicateAdhar(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$AadharCardNo = EmployeeProfile::where('AadharCardNo', $request->AadharCardNo)->first();
if ($AadharCardNo) {
echo 'false';
} else {
echo 'true';
}
}
### Store / Save Employee Record
public function storeEmployee(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$input = $request->all();
$data = $input;
$EmployeeAadhar = $request->input('AadharCardNo');
$BirthDate = '';
if ($request->input('BirthDate')) {
$Birth = str_replace('/', '-', $request->input('BirthDate'));
}
$BirthDate = date('d-m-Y', strtotime($Birth));
$GetYearOfBirth = date('Y', strtotime($BirthDate));
$GetEmployeeAadhar = '';
if ($EmployeeAadhar) {
$GetEmployeeAadhar = substr($EmployeeAadhar, -4, 4);
}
$getLastEmployee = EmployeeProfile::select()->orderBy('Created_at', 'DESC')->get()->first();
$EmployeeCode = 'EMP-' . $GetEmployeeAadhar . '' . $GetYearOfBirth . '-' . str_pad($getLastEmployee->id + 1, 3, "0", STR_PAD_LEFT);
//$EmployeeCode = 'EMP-'.$GetEmployeeAadhar.''.$GetYearOfBirth. '-'.str_pad($getLastEmployee->Id + 1, 8, "0", STR_PAD_LEFT);
//$EmployeeCode = $GetEmployeeAadhar . '' . $GetYearOfBirth;
//Promotion/Transfer Table
$DDOId = $request->input('DDOId');
$ControllingOfficerId = $request->input('ControllingOfficerId');
$GroupId = $request->input('Group');
$CadreId = $request->input('CadreId');
$DesignationId = $request->input('DesignationId');
$AppointmentBy = $request->input('AppointmentBy');
$ActualWorkPlaceId = $request->input('ActualWorkPlaceId');
$SanctionPostId = $request->input('SanctionPostId');
$FacultyId = $request->input('FacultyId');
$SchemeNameId = $request->input('SchemeNameId');
$DepartmentId = $request->input('DepartmentId');
//$JoiningDate = $request->input('JoiningDate');
$IsTenurePeriod = $request->input('IsTenurePeriod');
// Pay Matrix
$PayScalePayCommission = $request->input('PayScalePayCommission');
$PayBandId = $request->input('PayBandId');
$PayLevelId = $request->input('PayLevelId');
$GradePayId = $request->input('GradePayId');
$PayLevelAmount = $request->input('PayLevelAmount');
$PayMatrixScale = $request->input('PayMatrixScale');
$PayLevelAmountId = $request->input('PayLevelAmountId');
// Get Date
$AppointmentOrderDate = '';
if ($request->input('OrderDate')) {
$OrderDate = str_replace('/', '-', $request->input('OrderDate'));
}
$AppointmentOrderDate = date('d-m-Y', strtotime($OrderDate));
$JoiningDate = '';
if ($request->input('DateOfJoining')) {
$DateOfJoining = str_replace('/', '-', $request->input('DateOfJoining'));
}
$JoiningDate = date('Y-m-d', strtotime($DateOfJoining));
$RetirementDate = '';
if ($request->input('DateOfRetirement')) {
$DateOfRetirement = str_replace('/', '-', $request->input('DateOfRetirement'));
}
$RetirementDate = date('Y-m-d', strtotime($DateOfRetirement));
$DateOfBirth = '';
if ($request->input('BirthDate')) {
$BirthDate = str_replace('/', '-', $request->input('BirthDate'));
}
$DateOfBirth = date('Y-m-d', strtotime($BirthDate));
$ProbationPeriodClearDate = '';
if ($request->input('ClearDateOfProbationPeriod')) {
$ClearDateOfProbationPeriod = str_replace('/', '-', $request->input('ClearDateOfProbationPeriod'));
$ProbationPeriodClearDate = date('Y-m-d', strtotime($ClearDateOfProbationPeriod));
}
$TenurePeriodClearDate = '';
if ($request->input('ClearDateOfTenurePeriod')) {
$ClearDateOfTenurePeriod = str_replace('/', '-', $request->input('ClearDateOfTenurePeriod'));
$TenurePeriodClearDate = date('Y-m-d', strtotime($ClearDateOfTenurePeriod));
}
// Insert Record in Employee Table
$data['EmployeeId'] = $this->userLib->useridGenrator();
$data['EmployeeCode'] = $EmployeeCode;
$data['AppointmentOrderDate'] = $AppointmentOrderDate;
$data['JoiningDate'] = $JoiningDate;
$data['RetirementDate'] = $RetirementDate;
$data['UserId'] = session('UserId');
$data['DateOfBirth'] = $DateOfBirth;
$data['IsDeleted'] = 0;
$data['Status'] = 1;
$data['Created_by'] = session('UserId');
$data['Created_at'] = date('Y-m-d H:i:s', time());
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
unset($data['_token']);
unset($data['DateOfJoining']);
unset($data['DateOfRetirement']);
unset($data['BirthDate']);
unset($data['OrderDate']);
unset($data['ClearDateOfProbationPeriod']);
unset($data['ClearDateOfTenurePeriod']);
unset($data['PayScalePayCommission']);
unset($data['PayLevelId']);
unset($data['PayBandId']);
unset($data['GradePayId']);
unset($data['PayLevelAmount']);
unset($data['PayMatrixScale']);
unset($data['PayLevelAmountId']);
$insert_emp = EmployeeProfile::insert($data);
if ($insert_emp) {
$latestEmployee = EmployeeProfile::orderBy('created_at', 'DESC')->first();
$EmployeeId = $latestEmployee->EmployeeId;
// If Tenure Period, data will be inserted in tbl_employee_tenure_period table
if ($IsTenurePeriod == '1') {
$tenure_data['TenurePeriodId'] = $this->userLib->useridGenrator();
$tenure_data['EmployeeId'] = $EmployeeId;
$tenure_data['EmployeeCode'] = $EmployeeCode;
$tenure_data['JoiningDate'] = $JoiningDate;
$tenure_data['JoiningTime'] = $request->input('JoiningTime');
$tenure_data['IsTenurePeriod'] = $IsTenurePeriod;
$tenure_data['TenurePeriodClearDate'] = $TenurePeriodClearDate;
$tenure_data['Created_by'] = session('UserId');
$tenure_data['Created_at'] = date('Y-m-d H:i:s', time());
$tenure_data['Updated_by'] = session('UserId');
$tenure_data['Updated_at'] = date('Y-m-d H:i:s', time());
$EmpTenurePeriod = EmployeeTenurePeriod::insert($tenure_data);
}
// Probation Period Date Table
if ($ProbationPeriodClearDate) {
$probation_data['ProbationPeriodId'] = $this->userLib->useridGenrator();
$probation_data['EmployeeId'] = $EmployeeId;
$probation_data['EmployeeCode'] = $EmployeeCode;
$probation_data['JoiningDate'] = $JoiningDate;
$probation_data['JoiningTime'] = $request->input('JoiningTime');
$probation_data['ProbationPeriodClearDate'] = $ProbationPeriodClearDate;
$probation_data['Created_by'] = session('UserId');
$probation_data['Created_at'] = date('Y-m-d H:i:s', time());
$probation_data['Updated_by'] = session('UserId');
$probation_data['Updated_at'] = date('Y-m-d H:i:s', time());
$EmpProbationPeriod = EmployeeProbationPeriod::insert($probation_data);
}
// Promotion and Transfer table
$nomination['PromotionTransferId'] = $this->userLib->useridGenrator();
$nomination['EmployeeId'] = $EmployeeId;
$nomination['EmployeeCode'] = $EmployeeCode;
$nomination['DDOId'] = $DDOId;
$nomination['ControllingOfficerId'] = $ControllingOfficerId;
$nomination['GroupId'] = $GroupId;
$nomination['CadreId'] = $CadreId;
$nomination['DesignationId'] = $DesignationId;
$nomination['AppointmentStatus'] = $AppointmentBy;
$nomination['ActualWorkPlaceId'] = $ActualWorkPlaceId;
$nomination['SanctionPostId'] = $SanctionPostId;
$nomination['FacultyId'] = $FacultyId;
$nomination['SchemeNameId'] = $SchemeNameId;
$nomination['DepartmentId'] = $DepartmentId;
$nomination['PromotionTransferDate'] = $JoiningDate;
$nomination['IsTenurePeriod'] = $IsTenurePeriod;
$nomination['Created_by'] = session('UserId');
$nomination['Created_at'] = date('Y-m-d H:i:s', time());
$nomination['Updated_by'] = session('UserId');
$nomination['Updated_at'] = date('Y-m-d H:i:s', time());
$nomination['Status'] = '1';
$nomination['IsDeleted'] = '0';
//$nomination['OrgId'] = '';
$nomination['OwnerId'] = '';
$employee_nomination = EmployeePromotion::insert($nomination);
// Employee Pay Matrix Table
$paymatrix['PayMatrixId'] = $this->userLib->useridGenrator();
$paymatrix['EmployeeId'] = $EmployeeId;
$paymatrix['EmployeeCode'] = $EmployeeCode;
$paymatrix['PayLevelAmountId'] = $PayLevelAmountId;
$paymatrix['PayLevelAmount'] = $PayLevelAmount;
$paymatrix['PayMatrixScale'] = $PayMatrixScale;
$paymatrix['PayLevelId'] = $PayLevelId;
$paymatrix['GradePayId'] = $GradePayId;
$paymatrix['PayBandId'] = $PayBandId;
$paymatrix['PayScaleId'] = $PayScalePayCommission;
$paymatrix['EffectiveDate'] = $JoiningDate;
$paymatrix['PayFixationId'] = $AppointmentBy;
$paymatrix['Created_by'] = session('UserId');
$paymatrix['Created_at'] = date('Y-m-d H:i:s', time());
$paymatrix['Updated_by'] = session('UserId');
$paymatrix['Updated_at'] = date('Y-m-d H:i:s', time());
$paymatrix['Status'] = '1';
$paymatrix['IsDeleted'] = '0';
$paymatrix['OrgId'] = '';
$paymatrix['OwnerId'] = '';
$employee_paymatrix = EmployeePayMatrix::insert($paymatrix);
if ($employee_paymatrix) {
return response()->json('status_success_paymatrix');
} else {
return response()->json('status_failed_paymatrix');
}
}
}
### Update Primary Detail Employee Record
public function updateEmpPrimaryDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$EmployeeId = $request->input('EmployeeId');
$data['NameTitleId'] = $request->input('NameTitle');
$data['EmployeeName'] = $request->input('EmployeeName');
$data['AppointmentOrderNo'] = $request->input('AppointmentOrderNo');
$data['DDOId'] = $request->input('DDO');
$data['ControllingOfficerId'] = $request->input('ControllingOfficer');
$data['ActualWorkPlaceId'] = $request->input('WorkPlace');
$data['DepartmentId'] = $request->input('DepartmentName');
$data['AppointmentBy'] = $request->input('AppointmentBy');
if ($request->input('AppointmentBy') == 'W8whXFgWakAvkHU6OTgvgXBVPZgmQNveI48YY') {
$data['LowerCadreSeniority'] = $request->input('LowerCadreSeniority');
} else {
$data['MeritListNo'] = $request->input('MeritListNo');
}
$data['Group'] = $request->input('Group');
$data['CadreId'] = $request->input('Cadre');
$data['DesignationId'] = $request->input('EmployeeDesignation');
$data['FacultyId'] = $request->input('Faculty');
$data['SanctionPostId'] = $request->input('SanctionPost');
$data['SchemeNameId'] = $request->input('SchemeNameId');
$data['JoiningTime'] = $request->input('JoiningTime');
$data['RetirementAge'] = $request->input('RetirementAge');
// Get Date
$AppointmentOrderDate = '';
if ($request->input('AppointmentOrderDate')) {
$OrderDate = str_replace('/', '-', $request->input('AppointmentOrderDate'));
}
$AppointmentOrderDate = date('d-m-Y', strtotime($OrderDate));
$data['AppointmentOrderDate'] = $AppointmentOrderDate;
$DateOfBirth = '';
if ($request->input('DateOfBirth')) {
$BirthDate = str_replace('/', '-', $request->input('DateOfBirth'));
$DateOfBirth = date('Y-m-d', strtotime($BirthDate));
$data['DateOfBirth'] = $DateOfBirth;
}
$JoiningDate = '';
if ($request->input('JoiningDate')) {
$DateOfJoining = str_replace('/', '-', $request->input('JoiningDate'));
$JoiningDate = date('Y-m-d', strtotime($DateOfJoining));
$data['JoiningDate'] = $JoiningDate;
}
$RetirementDate = '';
if ($request->input('RetirementDate')) {
$DateOfRetirement = str_replace('/', '-', $request->input('RetirementDate'));
$RetirementDate = date('Y-m-d', strtotime($DateOfRetirement));
$data['RetirementDate'] = $RetirementDate;
}
$ProbationPeriodClearDate = '';
if ($request->input('ProbationPeriodDate')) {
$ClearDateOfProbationPeriod = str_replace('/', '-', $request->input('ProbationPeriodDate'));
$ProbationPeriodClearDate = date('Y-m-d', strtotime($ClearDateOfProbationPeriod));
$data['ProbationPeriodClearDate'] = $ProbationPeriodClearDate;
}
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
$update_primary_detail = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
if ($update_primary_detail) {
// Update Approval Table Data
// $ApprovalData = array();
// $ApprovalData['ApprovalStatus'] = 0;
// $ApprovalData['Updated_by'] = session('UserId');
// $ApprovalData['Updated_at'] = date('Y-m-d H:i:s', time());
// $update_approval_status = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($ApprovalData);
// if ($update_approval_status) {
// $approval = array();
// $approval['ModuleId'] = $this->userLib->useridGenrator();
// $approval['ModuleTitle'] = 'module_employees';
// $approval['ApprovalStatus'] = '0';
// $approval['ApprovalComments'] = '';
// $approval['ApprovalFrom'] = session('UserId');
// //$approval['ApprovalLevel'] = '';
// $approval['Created_at'] = date('Y-m-d H:i:s', time());
// $approval['ApprovalBy'] = '';
// $approval['ApprovalDate'] = date('Y-m-d H:i:s', time());
// $LoginUserProfileId = session('ProfileId');
// if($LoginUserProfileId)
// {
// $ApprovalUserProfileIds = $this->getApprovalUserLevel($LoginUserProfileId);
// if(count($ApprovalUserProfileIds) > 0)
// {
// for($k=0; $k < count($ApprovalUserProfileIds); $k++)
// {
// $Pids = $ApprovalUserProfileIds[$k];
// if($Pids)
// {
// $approval['ProfileId'] = $Pids;
// $Approval = Approval::insert($approval);
// }
// }
// }
// }
// }
// Update Promotion Table Data
$update_prom['DDOId'] = $request->input('DDO');
$update_prom['ControllingOfficerId'] = $request->input('ControllingOfficer');
$update_prom['GroupId'] = $request->input('Group');
$update_prom['CadreId'] = $request->input('Cadre');
$update_prom['DesignationId'] = $request->input('EmployeeDesignation');
$update_prom['AppointmentStatus'] = $request->input('AppointmentBy');
$update_prom['ActualWorkPlaceId'] = $request->input('WorkPlace');
$update_prom['SanctionPostId'] = $request->input('SanctionPost');
$update_prom['FacultyId'] = $request->input('Faculty');
$update_prom['SchemeNameId'] = $request->input('SchemeNameId');
$update_prom['DepartmentId'] = $request->input('DepartmentName');
$update_prom['PromotionTransferDate'] = $JoiningDate;
$update_prom['Updated_by'] = session('UserId');
$update_prom['Updated_at'] = date('Y-m-d H:i:s', time());
//$nomination['IsTenurePeriod'] = $IsTenurePeriod;
$update_promo_detail = EmployeePromotion::where('EmployeeId', $EmployeeId)->where('IsDeleted', '0')->orderBy('id', 'ASC')->limit(1)->update($update_prom);
if ($update_promo_detail) {
return response()->json('status_success_promo_table');
} else {
return response()->json('status_failed_promo_table');
}
} else {
return response()->json('status_failed');
}
}
### Update Contact Detail Employee Record
public function updateEmpContactDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$EmployeeId = $request->input('EmployeeId');
$data['MobileNo'] = $request->input('MobileNo');
$data['AlternateMobileNo'] = $request->input('AlternateMobileNo');
$data['PanCardNo'] = $request->input('PanCardNo');
$data['EmailId'] = $request->input('EmailId');
$data['ApprovalStatus'] = 0;
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
$update_contact_detail = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
if ($update_contact_detail) {
return response()->json('status_success');
} else {
return response()->json('status_failed');
}
}
### Delete Employee Detail
public function deleteEmpDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$data = array();
$EmployeeId = $request->input('EmployeeId');
$data['IsDeleted'] = 1;
$data['Status'] = 0;
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
$DeleteEmp = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
$DeletePromo = EmployeePromotion::where('EmployeeId', $EmployeeId)->update($data);
if ($DeleteEmp) {
return response()->json('status_success');
} else {
return response()->json('status_failed');
}
}
### Restore Employee Detail
public function restoreEmpDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$data = array();
$EmployeeId = $request->input('EmployeeId');
$data['ApprovalStatus'] = 0;
$data['IsDeleted'] = 0;
$data['Status'] = 1;
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
$RestoreEmp = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
$RestorePromo = EmployeePromotion::where('EmployeeId', $EmployeeId)->update($data);
if ($RestoreEmp) {
return response()->json('status_success');
} else {
return response()->json('status_failed');
}
}
#### Delete Permanent Employee Detail
public function destroyEmpDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$EmployeeId = $request->input('EmployeeId');
$DestroyEmp = EmployeeProfile::where('EmployeeId', $EmployeeId)->delete();
if ($DestroyEmp) {
return response()->json('status_success');
} else {
return response()->json('status_failed');
}
}
### Get Employee detail
public function getEmployeeDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$EmployeeId = $request->input('EmployeeId');
$GetEmployee = EmployeeProfile::select('tbl_employees.*', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName', 'tbl_actual_work_place.ActualWorkPlaceName as ActualWorkPlace', 'tbl_appointment.AppointmentByName as AppointmentByName')
->where('tbl_employees.EmployeeId', $EmployeeId)
->leftJoin('tbl_department', 'tbl_employees.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_appointment', 'tbl_employees.AppointmentBy', '=', 'tbl_appointment.AppointmentId')
->leftJoin('tbl_designation', 'tbl_employees.DesignationId', '=', 'tbl_designation.DesignationId')
->leftJoin('tbl_actual_work_place', 'tbl_employees.ActualWorkPlaceId', '=', 'tbl_actual_work_place.ActualWorkPlaceId')
// ->where('Status', '1')
// ->where('IsDeleted', '0')
->get()
->first();
$GetEmpQualificationList = EmployeeQualifications::select('tbl_employee_qualifications.*', 'tbl_qualifications.QualificationName as QualificationName', 'tbl_division_grade.DivisionGradeName as Division',)
->leftJoin('tbl_qualifications', 'tbl_employee_qualifications.QualificationId', 'tbl_qualifications.QualificationId')
->leftJoin('tbl_division_grade', 'tbl_employee_qualifications.Grade', 'tbl_division_grade.DivisionGradeId')
->where('tbl_employee_qualifications.EmployeeId', $EmployeeId)
->where('tbl_employee_qualifications.Status', '1')
->where('tbl_employee_qualifications.IsDeleted', '0')
->orderBy('tbl_employee_qualifications.id', 'DESC')
->get();
// Get Family Member List selected employee
$GetFamilyMemberList = FamilyMember::select('tbl_employees_family_member.*')
->where('EmployeeId', $EmployeeId)
//->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('tbl_employees_family_member.id', 'ASC')
->get();
$GetNomineeList = EmployeeNomineeDetail::select('tbl_employees_nominee_details.*', 'tbl_employee_relation.EmployeeRelationName as EmployeeRelation', 'tbl_pension_scheme.PensionSchemeName as NomineeType')
->leftJoin('tbl_employee_relation', 'tbl_employees_nominee_details.EmployeeRelationId', 'tbl_employee_relation.EmployeeRelationId')
->leftJoin('tbl_pension_scheme', 'tbl_employees_nominee_details.NomineeType', 'tbl_pension_scheme.PensionSchemeId')
->where('tbl_employees_nominee_details.EmployeeId', $EmployeeId)
//->where('tbl_employees_nominee_details.Status', '1')
->where('tbl_employees_nominee_details.IsDeleted', '0')
->orderBy('tbl_employees_nominee_details.id', 'ASC')
->get();
$GetForeignVisitList = ForeignVisit::select('tbl_employee_foreign_visits.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
$GetEmpTrainingList = EmployeeTrainingDetail::select('tbl_employees_training_details.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
$GetDisciplinaryActionList = EmployeeDisciplinaryAction::select('tbl_employees_disciplinary_action.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'DESC')
->get();
$GetEmpNameChange = EmployeeNameChange::select('tbl_employee_name_change.*')
->where('EmployeeId', $EmployeeId)
->where('Status', '1')
->where('IsDeleted', '0')
->orderBy('id', 'ASC')
->get();
$GetEmpDeputationDetail = DeputationDetail::select('tbl_employee_deputation_detail.*', 'tbl_sanction_post.SanctionPostName as PostName')
->leftJoin('tbl_sanction_post', 'tbl_employee_deputation_detail.NameOfDeputationPost', '=', 'tbl_sanction_post.SanctionPostId')
->where('tbl_employee_deputation_detail.EmployeeId', $EmployeeId)
->where('tbl_employee_deputation_detail.Status', '1')
->where('tbl_employee_deputation_detail.IsDeleted', '0')
->orderBy('tbl_employee_deputation_detail.id', 'Desc')
->get();
// Return Respons data
return response()->json([
'status' => 200,
'GetEmployee' => $GetEmployee,
'GetFamilyMember' => $GetFamilyMemberList,
'GetNomineeList' => $GetNomineeList,
'GetForeignVisitList' => $GetForeignVisitList,
'GetEmpTrainingList' => $GetEmpTrainingList,
'GetDisciplinaryActionList' => $GetDisciplinaryActionList,
'GetEmpQualificationList' => $GetEmpQualificationList,
'GetEmpNameChange' => $GetEmpNameChange,
'GetEmpDeputationDetail' => $GetEmpDeputationDetail,
]);
}
### Get Employee Current Position Detail
public function getEmpCurrentDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$EmployeeId = $request->input('EmployeeId');
$GetEmpCurrentDetail = EmployeePromotion::select('tbl_employees_promotion_transfer.*', 'tbl_employees.EmployeeName as EmployeeName','tbl_employees.AadharCardNo as AadharCardNo', 'tbl_ddo.DDOName as DDOName', 'tbl_controlling_officer.ControllingOfficerName as ControllingOfficer', 'tbl_department.DepartmentName as DepartmentName', 'tbl_designation.DesignationName as DesignationName', 'tbl_actual_work_place.ActualWorkPlaceName as ActualWorkPlace', 'tbl_group.GroupName as Group', 'tbl_cadre.CadreName as Cadre', 'tbl_scheme_name.NameOfScheme as SchemeName', 'tbl_sanction_post.SanctionPostName as SanctionPost', 'tbl_faculty.FacultyName as Faculty')
->where('tbl_employees_promotion_transfer.EmployeeId', $EmployeeId)
->where('tbl_employees_promotion_transfer.IsDeleted', '=', '0')
->orderBy('tbl_employees_promotion_transfer.id', 'DESC')
->leftJoin('tbl_employees', 'tbl_employees_promotion_transfer.EmployeeId', '=', 'tbl_employees.EmployeeId')
->leftJoin('tbl_ddo', 'tbl_employees_promotion_transfer.DDOId', '=', 'tbl_ddo.DDOId')
->leftJoin('tbl_controlling_officer', 'tbl_employees_promotion_transfer.ControllingOfficerId', '=', 'tbl_controlling_officer.ControllingOfficerId')
->leftJoin('tbl_department', 'tbl_employees_promotion_transfer.DepartmentId', '=', 'tbl_department.DepartmentId')
->leftJoin('tbl_designation', 'tbl_employees_promotion_transfer.DesignationId', '=', 'tbl_designation.DesignationId')
->leftJoin('tbl_actual_work_place', 'tbl_employees_promotion_transfer.ActualWorkPlaceId', '=', 'tbl_actual_work_place.ActualWorkPlaceId')
->leftJoin('tbl_cadre', 'tbl_employees_promotion_transfer.CadreId', '=', 'tbl_cadre.CadreId')
->leftJoin('tbl_group', 'tbl_employees_promotion_transfer.GroupId', '=', 'tbl_group.GroupId')
->leftJoin('tbl_sanction_post', 'tbl_employees_promotion_transfer.SanctionPostId', '=', 'tbl_sanction_post.SanctionPostId')
->leftJoin('tbl_scheme_name', 'tbl_employees_promotion_transfer.SchemeNameId', '=', 'tbl_scheme_name.SchemeNameId')
->leftJoin('tbl_faculty', 'tbl_employees_promotion_transfer.FacultyId', '=', 'tbl_faculty.FacultyId')
->get()->first();
$GetEmpPayMatrix = EmployeePayMatrix::select('tbl_employees_paymatrix.*', 'tbl_payscale.PayScaleName as PayScale', 'tbl_payband.PayBandName as PayBand', 'tbl_gradepay.GradePayName as GradePay', 'tbl_paylevel.PayLevelName as PayLevel', 'tbl_paylevel_amount.PayLevelAmount as LevelAmount', 'tbl_pay_fixation.PayFixation as PayFixation')
->leftJoin('tbl_payscale', 'tbl_employees_paymatrix.PayScaleId', '=', 'tbl_payscale.PayScaleId')
->leftJoin('tbl_payband', 'tbl_employees_paymatrix.PayBandId', '=', 'tbl_payband.PayBandId')
->leftJoin('tbl_gradepay', 'tbl_employees_paymatrix.GradePayId', '=', 'tbl_gradepay.GradePayId')
->leftJoin('tbl_paylevel', 'tbl_employees_paymatrix.PayLevelId', '=', 'tbl_paylevel.PayLevelId')
->leftJoin('tbl_paylevel_amount', 'tbl_employees_paymatrix.PayLevelAmountId', '=', 'tbl_paylevel_amount.PayLevelAmountId')
->leftJoin('tbl_pay_fixation', 'tbl_employees_paymatrix.PayFixationId', '=', 'tbl_pay_fixation.PayFixationId')
->where('tbl_employees_paymatrix.EmployeeId', $EmployeeId)
->where('tbl_employees_paymatrix.Status', '1')
->where('tbl_employees_paymatrix.IsDeleted', '0')
->orderBy('tbl_employees_paymatrix.id', 'DESC')
->get()->first();
return response()->json([
'status' => 200,
'GetEmpCurrentDetail' => $GetEmpCurrentDetail,
'GetEmpPayMatrix' => $GetEmpPayMatrix,
]);
}
#### Submit For Approval
public function SubmitEmpPrimaryDetailApproval(Request $request, $ProfileId = '')
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$data = array();
$EmployeeId = $request->input('EmployeeId');
$ProfileId = $request->input('ProfileId');
$UserId = $request->input('UserId');
$ApprovalRemark = $request->input('ApprovalRemark');
// In case of Farward for review
$ModuleId = $request->input('ModuleId');
$data['ApprovalLock'] = 1;
$data['ApprovalStatus'] = 0;
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
if ($ModuleId) {
$GetNoOfApproval = EmployeeProfile::where('EmployeeId', $EmployeeId)->get()->first();
$NoOfApproval = $GetNoOfApproval->NoOfApproval + 1;
// Update Employee Profile Table
$data['NoOfApproval'] = $NoOfApproval;
// Update Approval Table in case of Farward for review
$update_approval['ApprovalStatus'] = '3'; // Approve = 1, Reject = 2, Forward = 3.
$update_approval['ApprovalLevel'] = $NoOfApproval;
$update_approval['Created_by'] = session('UserId');
$update_approval['Created_at'] = date('Y-m-d H:i:s', time());
$update_approval['Updated_by'] = session('UserId');
$update_approval['Updated_at'] = date('Y-m-d H:i:s', time());
$ApprovalRequest = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
$Update_Approval_Module = Approval::where('ModuleId', $ModuleId)->where('UserId', session('UserId'))->update($update_approval);
if ($ApprovalRequest) {
$approval = array();
$approval['ModuleId'] = $ModuleId;
$approval['EmployeeId'] = $EmployeeId;
$approval['ModuleTitle'] = 'PrimaryDetail';
$approval['ApprovalStatus'] = '0';
$approval['ApprovalComments'] = $ApprovalRemark;
$approval['ApprovalFrom'] = session('UserId');
$approval['ProfileId'] = $ProfileId;
$approval['UserId'] = $UserId;
////$approval['ApprovalLevel'] = '';
$approval['Created_at'] = date('Y-m-d H:i:s', time());
$approval['Created_by'] = session('UserId');
$approval['Updated_by'] = session('UserId');
$approval['Updated_at'] = date('Y-m-d H:i:s', time());
$Approval_Module = Approval::insert($approval);
if ($Approval_Module) {
return response()->json('status_success');
} else {
return response()->json('status_fail');
}
}
} else {
$data['NoOfApproval'] = 0;
$data['ApprovalComment'] = '';
$ApprovalRequest = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
if ($ApprovalRequest) {
$approval = array();
$approval['ModuleId'] = $this->userLib->useridGenrator();
$approval['EmployeeId'] = $EmployeeId;
$approval['ModuleTitle'] = 'PrimaryDetail';
$approval['ApprovalStatus'] = '0';
$approval['ApprovalComments'] = $ApprovalRemark;
$approval['ApprovalFrom'] = session('UserId');
$approval['ProfileId'] = $ProfileId;
$approval['UserId'] = $UserId;
////$approval['ApprovalLevel'] = '';
$approval['Created_at'] = date('Y-m-d H:i:s', time());
$approval['Created_by'] = session('UserId');
$approval['Updated_by'] = session('UserId');
$approval['Updated_at'] = date('Y-m-d H:i:s', time());
$Approval_Module = Approval::insert($approval);
if ($Approval_Module) {
return response()->json('status_success');
} else {
return response()->json('status_fail');
}
}
}
}
#### Approve Employee Primary Detail
public function ApproveEmpPrimaryDetail(Request $request, $EmployeeId = '', $ModuleId = '')
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$LoginUserProfileId = session('ProfileId');
$EmployeeId = $request->input('EmployeeId');
$ModuleId = $request->input('ModuleId');
$ApprovalStatusTbl = $request->input('ApprovalStatus');
$data = array();
$GetNoOfApproval = EmployeeProfile::where('EmployeeId', $EmployeeId)->get()->first();
$NoOfApproval = $GetNoOfApproval->NoOfApproval + 1;
$data['ApprovalStatus'] = 1;
$data['NoOfApproval'] = $NoOfApproval;
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
$approval = array();
$approval['ApprovalStatus'] = $ApprovalStatusTbl;
$approval['ApprovalLevel'] = $NoOfApproval;
$approval['Updated_by'] = session('UserId');
$approval['Updated_at'] = date('Y-m-d H:i:s', time());
$ApprovalUpdate = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)->where('UserId', session('UserId'))->where('ProfileId', $LoginUserProfileId)->update($approval);
if ($ApprovalUpdate) {
$getApprovals = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)->where('ProfileId', $LoginUserProfileId)->where('ApprovalStatus', '1')->get();
$NumberOfApproval = $getApprovals->count();
//$data['NumberOfApproval'] = $NumberOfApproval;
$approveData = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
if ($approveData) {
return response()->json('status_success');
} else {
return response()->json('status_failed');
}
} else {
return response()->json('status_failed');
}
}
#### Reject Employee Primary Detail
public function RejectEmpPrimaryDetail(Request $request)
{
$this->UserSessionId = session('UserId');
if (empty($this->UserSessionId)) {
return redirect('/');
}
$data = array();
$EmployeeId = $request->input('EmployeeId');
$Comment = $request->input('RejectComment');
$LoginUserProfileId = session('ProfileId');
$ModuleId = $request->input('ModuleId');
$ApprovalStatusTbl = $request->input('ApprovalStatus');
$GetNoOfApproval = EmployeeProfile::where('EmployeeId', $EmployeeId)->get()->first();
$NoOfApproval = $GetNoOfApproval->NoOfApproval + 1;
// Rejected = 2,
$data['ApprovalStatus'] = $ApprovalStatusTbl;
$data['ApprovalLock'] = 0;
$data['NoOfApproval'] = $NoOfApproval;
$data['ApprovalComment'] = $Comment;
$data['Updated_by'] = session('UserId');
$data['Updated_at'] = date('Y-m-d H:i:s', time());
$approval = array();
$approval['ApprovalStatus'] = $ApprovalStatusTbl;
$approval['ApprovalComments'] = $Comment;
$approval['ApprovalLevel'] = $NoOfApproval;
$approval['Updated_by'] = session('UserId');
$approval['Updated_at'] = date('Y-m-d H:i:s', time());
// $ApprovalUpdate = Approval::where('ModuleId',$ModuleId)->where('EmployeeId',$EmployeeId)->where('ProfileId',$LoginUserProfileId)->update($approval);
$ApprovalUpdate = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)->where('UserId', session('UserId'))->where('ProfileId', $LoginUserProfileId)->update($approval);
if ($ApprovalUpdate) {
$getApprovals = Approval::where('ModuleId', $ModuleId)->where('EmployeeId', $EmployeeId)->where('ProfileId', $LoginUserProfileId)->where('ApprovalStatus', '1')->get();
$NumberOfApproval = $getApprovals->count();
//$data['NumberOfApproval'] = $NumberOfApproval;
$rejectData = EmployeeProfile::where('EmployeeId', $EmployeeId)->update($data);
if ($rejectData) {
return response()->json('status_success');
} else {
return response()->json('status_failed');
}
} else {
return response()->json('status_failed');
}
}
}