<?php

class HRM extends mainController {

    public function __construct() {
        parent::__construct();
        $this->load->model('HRM');
    }

    public function landing() {
        //load model 
        //load view

        $vars['error'] = false;
        $vars['pageName'] = 'HRM';
        $vars['title'] = HRMModel::getmsg('hrm');
        $vars['system_name'] = HRMModel::getmsg('hrm');
        //$vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM']];
        //$this->_registry->employee->edit_payroll_tax_data();
        //        $vars['days'] = $this->_registry->worktimes->viewUnOrWorkingDays(1);
        //        $vars['breadCrumb'] = [[HRMModel::getmsg('dashboard'), 'HRM/HRMDashboard'], [HRMModel::getmsg('hrm'), 'HRM']];
        $vars['all_employees'] = $this->_registry->employee->viewDependantEmployee();
        //$vars['branches'] = $this->_registry->branch->view();
        //$vars['jobs'] = $this->_registry->job->getJobsWithPaygrades();
        //        $vars['roles'] = $this->_registry->role->view();
        //        $vars['parentPermissions'] = $this->_registry->permission->getRootParents();
        $vars['permissionObj'] = $this->_registry->permission;
        //        $vars['roles_permission'] = $this->_registry->role->viewRolesPermissions();
        $vars['reasons_Types'] = $this->_registry->absence->viewAbsenceReasons();
        $vars['absence_employees'] = $this->_registry->employee->returnEmployees();
        $vars['absenceactual_employees'] = $this->_registry->employee->returnEmployees(true);
        $vars['days'] = $this->_registry->worktimes->viewUnOrWorkingDays();
        //        $vars['landings'] = CommonFunctions::CommonView('tbl_landings');
        //        $vars['employees_dependant'] = $this->_registry->employee->viewEmployeeForDependent();
        $vars['all_employees_actual'] = $this->_registry->employee->viewEmployeeForDependent(true);
        $vars['all_employeesdependent_actual'] = $this->_registry->employee->viewDependantEmployee(true);
        $vars['all_school_type'] = $this->_registry->employee->getSchoolType();
        //             $data =    $this->_registry->attendance->get_non_working_days("2018-08-01","2018-08-31");
        //             echo"<pre>";die(print_r($data));

        $this->load->view('HRM', $vars);
    }

    public function addShift() {

        $vars['title'] = HRMModel::getmsg('add_shift');
        $vars['pageName'] = 'addshift';
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;
        $vars['shift_details'] = $this->_registry->worktimes->viewShiftsDetails($vars['id']);
//                echo"<pre>";die(print_r($vars['shift_details']));
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_shifts'), 'viewShifts'], [HRMModel::getmsg('add_shift'), 'addshift']];
        $vars['days'] = $this->_registry->worktimes->viewUnOrWorkingDays();
        $vars['today'] = Date::gettoday();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        //        $vars['monthName']                  = date("F", mktime(0, 0, 0, $month, 10));// get Month Name

        $this->load->view('HRM/addShift', $vars);
    }

    public function Holidays() {
        $vars['title'] = HRMModel::getmsg('view_holidays');
        $vars['pageName'] = 'viewHolidays';
        $vars['today'] = Date::getToday();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_holidays'), 'Holidays']];

        $this->load->view('HRM/Holidays', $vars);
    }

    public function viewEmployeeForPayroll() {

        $vars['title'] = HRMModel::getmsg('payroll');
        //		$vars['bread_crumb_title']	= 'Employee Payroll';
        $vars['pageName'] = 'viewEmployeeForPayroll';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll'), 'viewEmployeeForPayroll']];
        $this->load->view('HRM/viewEmployeeForPayroll', $vars);
    }

    public function viewUsers() {

        $vars['title'] = HRMModel::getmsg('view_users');
        $vars['pageName'] = 'viewUsers';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_users'), 'viewUsers']];
        $vars['users'] = $this->_registry->user->view();
        //        $vars['employee_role'] = $this->_registry->role->view();
        $vars['roles'] = $this->_registry->role->view();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $this->load->view('HRM/viewUsers', $vars);
    }

    public function viewEmployees() {

        $vars['title'] = HRMModel::getmsg('employees');
        $vars['pageName'] = 'viewEmployees';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employees'), 'viewEmployees']];
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['employee_country'] = $this->_registry->countries->viewCountries();
        $vars['employee_nationality'] = $this->_registry->employee->getNationality();
        $vars['Employee_Location'] = $this->_registry->employee->getEmployeeLcoation();
        $vars['Max_Work_ID'] = $this->_registry->employee->getMaxEmpWrkID();
        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();
        $vars['default_formula'] = $this->_registry->worktimes->get_default_salary_formula();
        $vars['details_paygrade'] = $this->_registry->job->viewPayGradesByJob();
        $vars['is_new'] = !empty($_GET['is_new']) ? 1 : 0;

        $this->load->view('HRM/viewEmployees', $vars);
    }

    public function viewEmployeesDetails() {

        $vars['title'] = HRMModel::getmsg('employee_info');
        $vars['pageName'] = 'viewEmployeesDetails';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];
        $vars['Content'] = $this->_registry->employee->viewEmployee($vars['employee_ID'], true);
        $vars['employee_nationality'] = $this->_registry->employee->getNationality();
        $vars['Employee_Location'] = $this->_registry->employee->getEmployeeLcoation();
        $vars['shifts'] = $this->_registry->employee->viewShifts();
        //        $vars['branches'] = $this->_registry->branch->viewAllDepartment();
        $vars['employee_country'] = $this->_registry->countries->viewCountries();
        $vars['details_paygrade'] = $this->_registry->job->viewPayGradesByJob();
        $vars['DocumentType'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_document_types');
        $vars['Wife_IS_Work'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_dependants');
        $vars['Accrued_Leave'] = $this->_registry->worktimes->getAvailableAccruedDays($vars['employee_ID']);

        $absence = $this->_registry->absence->viewAbsence($vars['employee_ID']);
        $accrued_leave = $this->_registry->worktimes->viewAccruedLeave($vars['employee_ID']);
        $vars['array'] = array_merge($absence, $accrued_leave);

        $vars['child_emp'] = $this->_registry->employee->viewEmployeeDependantChild($vars['employee_ID']);
        $vars['allw_war'] = $this->_registry->employee->getEmployeeAlertCount($vars['employee_ID']);
        $vars['job_desc'] = $this->_registry->employee->getEmployeeJobFile($vars['employee_ID']);
        $vars['count_trs_dys'] = $this->_registry->employee->getCountEmpTransferDay($vars['employee_ID']);
        $vars['remainig_trs_dys'] = $this->_registry->worktimes->getAvailableTrsDays($vars['employee_ID']);
        $vars['absence_taken'] = $this->_registry->employee->getCountAbsenceDysPerEmp($vars['employee_ID']);
        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();


        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employees'), 'viewEmployees'], [HRMModel::getmsg('employee_info'), 'viewEmployeesDetails/' . $vars['employee_ID']]];
        $this->load->view('HRM/viewEmployeesDetails', $vars);
    }

    public function viewEmployeeExpenses() {

        $vars['title'] = HRMModel::getmsg('employee_expenses');
        $vars['pageName'] = 'viewEmployeeExpenses';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];
        $vars['employees'] = $this->_registry->employee->viewEmployeeExpenses($vars['employee_ID']);
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employees'), 'viewEmployees'], [HRMModel::getmsg('employee_expenses'), 'viewEmployeeExpenses/' . $vars['employee_ID']]];
        $this->load->view('HRM/viewEmployeeExpenses', $vars);
    }

    public function viewEmployeeDependent() {

        $vars['title'] = HRMModel::getmsg('employee_dependant');
        $vars['pageName'] = 'viewEmployeeDependent';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];
        $vars['employees'] = $this->_registry->employee->viewEmployeeDependent($vars['employee_ID']);
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employees'), 'viewEmployees'], [HRMModel::getmsg('employee_dependant'), 'viewEmployeeDependent/' . $vars['employee_ID']]];
        $this->load->view('HRM/viewEmployeeDependent', $vars);
    }

    public function AddEmergencyContact() {

        $vars['title'] = HRMModel::getmsg('add_emergency_contact');
        $vars['pageName'] = 'addEmergencyContact';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_emergency_contact'), 'addEmergencyContact']];
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;
        $vars['emergency_details'] = $this->_registry->employee->viewEmergencyContactByID($vars['id']);

        $vars['name'] = $vars['IsEdit'] ? explode(' ', $vars['emergency_details'][0]['Contact_Name']) : '';




        $this->load->view('HRM/addEmergencyContact', $vars);
    }

    public function addEmployeeExpense() {

        $vars['title'] = HRMModel::getmsg('add_employee_expenses');
        $vars['pageName'] = 'addEmployeeExpense';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_employee_expenses'), 'addEmployeeExpense']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $this->load->view('HRM/addEmployeeExpense', $vars);
    }

    public function viewEmployeeEmergencyContact() {

        $vars['title'] = HRMModel::getmsg('emergency_contact');
        $vars['pageName'] = 'viewEmployeeEmergencyContact';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];
        $vars['employees'] = $this->_registry->employee->viewEmployeeEmergencyContact($vars['employee_ID']);
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employees'), 'viewEmployees'], [HRMModel::getmsg('emergency_contact'), 'viewEmployeeEmergencyContact/' . $vars['employee_ID']]];
        $this->load->view('HRM/viewEmployeeEmergencyContact', $vars);
    }

    public function addDeduction() {

        $vars['title'] = HRMModel::getmsg('hrm');
        $vars['pageName'] = 'addDeduction';


        $a = preg_match("/\/bonus\b/i", $_SERVER['REQUEST_URI'], $match);
        $url = explode('/', $_SERVER['REQUEST_URI']);
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;



        $vars['IsBonus'] = $a == 1 ? true : false;


        $vars['id'] = $vars['IsBonus'] ? ($url[count($url) - 2] == 0 ? $url[count($url) - 3] : $url[count($url) - 2]) :
                ($url[count($url) - 1] == 0 ? $url[count($url) - 2] : $url[count($url) - 1] );

        $vars['check'] = $vars['IsBonus'] ? $url[count($url) - 2] : $url[count($url) - 1];

        //        

        $vars['data'] = $vars['IsBonus'] ? ($url[count($url) - 2] == 0 ? $this->_registry->finance->viewsBonus($vars['id']) : $this->_registry->employee->getEmployeeDeductionNote($vars['id'])) : ($url[count($url) - 1] == 0 ? $this->_registry->finance->viewDeduction($vars['id']) : $this->_registry->employee->getEmployeeDeductionNote($vars['id']));
//        echo"<pre>";
//        print_r($vars['data']);
//        die();
        $vars['check_lock'] = is_numeric($vars['id']) ? CommonFunctions::check_lock_data(['type' => 'deduction', 'start_date' => $vars['data']['Date'], 'is_actual' => $vars['is_actual']]) : '';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], $vars['IsBonus'] ? [HRMModel::getmsg('add_bonus'), 'addDeduction/bonus'] : [HRMModel::getmsg('add_deduction'), 'addDeduction']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['max_deduction_id'] = $this->_registry->finance->getMaxDeducOrBonus("tbl_hrm_deductions", "Deduction");
        $vars['max_bonus_id'] = $this->_registry->finance->getMaxDeducOrBonus("tbl_hrm_bonuses", "Bonus");
        $vars['Number_ID'] = $vars['IsBonus'] ? $vars['max_bonus_id'] : $vars['max_deduction_id'];
        $this->load->view('HRM/addDeduction', $vars);
    }

    public function addAdvancePayment() {

        $vars['title'] = HRMModel::getmsg('hrm');
        $vars['pageName'] = 'addAdvancePayment';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_advance_payment'), 'addAdvancePayment']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['Extable'] = $this->_registry->currency->getExchangeRateTable();
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;


        $vars['data'] = $this->_registry->finance->viewAdvancePayment($vars['id']);
        $vars['check_lock'] = $vars['IsEdit'] ? CommonFunctions::check_lock_data(['type' => 'advance', 'start_date' => $vars['data']['Advance_Payment_Date'], 'is_actual' => $vars['is_actual']]) : '';


//        die(print_r($vars['data']));

        $this->load->view('HRM/addAdvancePayment', $vars);
    }

    public function addLoan() {

        $vars['title'] = HRMModel::getmsg('add_loan');
        $vars['pageName'] = 'addLoan';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_loan'), 'addLoan']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        //                echo"<pre>";
        //die(print_r($vars['payment_type']));
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;


        $vars['data'] = $vars['IsEdit'] ? $this->_registry->finance->viewsLoan($vars['id']) : array();
        $vars['check_lock'] = $vars['IsEdit'] ? CommonFunctions::check_lock_data(['type' => 'loan', 'start_date' => $vars['data']['Loan_Date'], 'is_actual' => $vars['is_actual']]) : '';


//                die(print_r($vars['data']));
        $this->load->view('HRM/addLoan', $vars);
    }

    public function addOverTime() {

        $vars['title'] = HRMModel::getmsg('add_overtime');
        $vars['pageName'] = 'addOvertime';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        preg_match("/\/ded\b/i", $_SERVER['REQUEST_URI'], $match_ded);
        $vars['is_deduction'] = count($match_ded) > 0 ? 1 : 0;
        preg_match("/\/edit\b/i", $_SERVER['REQUEST_URI'], $match_ded);
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;
        $vars['id'] = $vars['IsEdit'] ? $url[count($url) - 1] : 0;
        $vars['edit_data'] = $vars['IsEdit'] ? $this->_registry->finance->get_overtime_by_id($vars['id']) : '';
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['date'] = empty($_GET['date']) ? $vars['today'] : $_GET['date'];
        $vars['emp_id'] = empty($_GET['emp_id']) ? 0 : $_GET['emp_id'];
        $vars['emp_name'] = empty($_GET['emp_name']) ? '' : $_GET['emp_name'];
        $vars['duration_amt'] = empty($_GET['duration']) ? '' : $_GET['duration'];
        $vars['duration'] = empty($_GET['duration']) ? (($vars['IsEdit'] && !empty($vars['edit_data'])) ? $vars['edit_data']['duraton_time'] : '') : ((floor($_GET['duration'] / 24) * 24) + gmdate('H', floor($_GET['duration'] * 3600))) . ':' . gmdate('i', floor($_GET['duration'] * 3600));
        $emp_arr = empty($_GET['emp_id']) ? array() : $this->_registry->finance->returnEmployeeInfoForOverTime($vars['is_actual'], $vars['date'], $vars['emp_id']);
        $vars['hr_amount'] = empty($_GET['emp_id']) ? 0 : $emp_arr[0]['unit_hr'];
        $vars['rate'] = empty($_GET['emp_id']) ? (($vars['IsEdit'] && !empty($vars['edit_data'])) ? $vars['edit_data']['hr_rate'] : 0) : ($vars['is_deduction'] ? $emp_arr[0]['deduction_rate'] : $emp_arr[0]['overtime_rate']);
        $vars['check_lock'] = $vars['IsEdit'] ? CommonFunctions::check_lock_data(['type' => 'overtime', 'start_date' => $vars['edit_data']['OverTime_Date'], 'is_actual' => $vars['is_actual']]) : '';

//                echo"<pre>";die(print_r($vars['edit_data']));
        //         echo $_GET['duration'].'=='.(floor($_GET['duration']/24)*24).'=='.gmdate('H', floor($_GET['duration'] * 3600)).'=='.gmdate('i', floor($_GET['duration'] * 3600)).'==='.(floor($_GET['duration']/24)*24+date('H', floor($_GET['duration'] * 3600))).':'.gmdate("i", $_GET['duration']);die();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_overtime'), 'addOvertime']];

        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();
        $this->load->view('HRM/addOverTime', $vars);
    }

    public function dailyOvertime() {

        $vars['title'] = HRMModel::getmsg('daily_overtime');
        $vars['pageName'] = 'dailyOvertime';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        preg_match("/\/ded\b/i", $_SERVER['REQUEST_URI'], $match_ded);
        $vars['is_deduction'] = count($match_ded) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('daily_overtime'), 'dailyOvertime']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        //        $vars['listOverTime'] = $this->_registry->finance->viewOverTime(null, $vars['year'], $vars['month']);
//        $vars['is_approved'] = isset($_GET['is_approved']) ? $_GET['is_approved'] : '';
        $vars['overtime_id_filter'] = !empty($_GET['main_id']) ? $_GET['main_id'] : '';

        $this->load->view('HRM/dailyOvertime', $vars);
    }

    public function viewRolesModal() {

        $vars['title'] = HRMModel::getmsg('view_roles');
        $vars['pageName'] = 'viewRolesModal';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_roles'), 'viewRolesModal']];
        $this->load->view('HRM/viewRolesModal', $vars);
    }

    public function viewShifts() {

        $vars['title'] = HRMModel::getmsg('view_shifts');
        $vars['pageName'] = 'viewShifts';
        $vars['days'] = $this->_registry->worktimes->viewUnOrWorkingDays(1);
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_shifts'), 'viewShifts']];
        $vars['workingdays'] = $this->_registry->worktimes->viewUnOrWorkingDays(1);
        $this->load->view('HRM/viewShifts', $vars);
    }

    public function viewRolesPermissionModal() {

        $vars['title'] = HRMModel::getmsg('view_roles_permissions');
        $vars['pageName'] = 'viewRolesPermissionModal';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_roles_permissions'), 'viewRolesPermissionModal']];
        $vars['all_roles'] = $this->_registry->role->view();
        $vars['RolePermission'] = $this->_registry->role->viewRolesPermissions(1);
        $this->load->view('HRM/viewRolesPermissionModal', $vars);
    }

    public function TotalPayslip() {

        $vars['title'] = HRMModel::getmsg('total_payslip');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('total_payslip'), 'TotalPayslip']];
        $vars['employee'] = $this->_registry->employee;
        $vars['currency'] = $this->_registry->currency;
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['DefaultCurrSymbol'] = $this->_registry->currency->viewCurrencySymbol($vars['DefaultCurrencyID']);
        $this->load->view('HRM/TotalPayslip', $vars);
    }

    public function PayrollForEmployee() {

        $vars['title'] = HRMModel::getmsg('payroll');
        //		$vars['bread_crumb_title']	= 'Employee Payroll';
        $vars['pageName'] = 'PayrollForEmployee';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll_for_emp'), 'PayrollForEmployee']];
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['branchlist'] = $this->_registry->branch->viewAllDepartment();
        $vars['Branch_ID'] = !empty($vars['branchlist'][0]['department_id']) ? $vars['branchlist'][0]['department_id'] : 0;
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        $vars['DefaultCurrencyID'] = $this->_registry->currency->returnLocalCurrency();
        $vars['DefaultCurrSymbol'] = $this->_registry->currency->viewCurrencySymbol($vars['DefaultCurrencyID']);
        $vars['DefaultCurrName'] = $this->_registry->currency->getCurrencyByID($vars['DefaultCurrencyID']);
        //        $flag = $vars['is_actual'] == 1 ? true : false;
        //        $vars['payroll'] = $this->_registry->employee->viewPayroll(null, $vars['year'], false, $vars['month'], null, $vars['day'], null, null, null, $vars['Branch_ID'], 84, $flag);

        $this->load->view('HRM/PayrollForEmployee', $vars);
    }
    public function PayrollForEmployeeProcess() {

        $vars['title'] = HRMModel::getmsg('payroll');
        //		$vars['bread_crumb_title']	= 'Employee Payroll';
        $vars['pageName'] = 'PayrollForEmployeeProcess';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('PayrollForEmployeeProcess'), 'PayrollForEmployeeProcess']];
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
 
        $this->load->view('HRM/PayrollForEmployeeProcess', $vars);
    }
    public function TotalOvertimeDetails() {

        $vars['title'] = HRMModel::getmsg('overtime');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('total_payslip'), 'TotalPayslip'], [HRMModel::getmsg('overtime_details'), 'TotalOvertimeDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        //        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidOverTimeDetails($vars['Date']);
        $this->load->view('HRM/TotalOvertimeDetails', $vars);
    }

    public function TotalAdvanceDetails() {

        $vars['title'] = HRMModel::getmsg('payroll');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('total_payslip'), 'TotalPayslip'], [HRMModel::getmsg('advance_details'), 'TotalAdvanceDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidAdvanceDetails($vars['Date']);
        $this->load->view('HRM/TotalAdvanceDetails', $vars);
    }

    public function TotalBonusDetails() {

        $vars['title'] = HRMModel::getmsg('payroll');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll'), 'TotalPayslip'], [HRMModel::getmsg('bonus_details'), 'TotalBonusDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidBonusDetails($vars['Date']);
        $this->load->view('HRM/TotalBonusDetails', $vars);
    }

    public function TotalDeductionDetails() {

        $vars['title'] = HRMModel::getmsg('payroll');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll'), 'TotalPayslip'], [HRMModel::getmsg('deduction_details'), 'TotalDeductionDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidDeductionDetails($vars['Date']);
        $this->load->view('HRM/TotalDeductionDetails', $vars);
    }

    public function TotalLoanDetails() {

        $vars['title'] = HRMModel::getmsg('payroll');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll'), 'TotalPayslip'], [HRMModel::getmsg('loan_details'), 'TotalLoanDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidLoanDetails($vars['Date']);
        $this->load->view('HRM/TotalLoanDetails', $vars);
    }

    public function TotalPayslipDetails() {

        $vars['title'] = HRMModel::getmsg('payroll');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll'), 'TotalPayslip'], [HRMModel::getmsg('payroll_details'), 'TotalPayslipDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidDetails($vars['Date']);
        $this->load->view('HRM/TotalPayslipDetails', $vars);
    }

    public function PaidPayrollForEmployee() {

        $vars['title'] = HRMModel::getmsg('payroll');
        //		$vars['bread_crumb_title']	= 'Employee Payroll';
        $vars['pageName'] = 'viewEmployeeForPayroll';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        preg_match("/\/act/", $_SERVER['REQUEST_URI'], $match2);
        $vars['is_actual'] = count($match2) > 0 ? "1" : "0";
        $vars['empid'] = $vars['url'][count($vars['url']) - 1];

        $vars['emp_name'] = $this->_registry->employee->get_emp_name_by_id($vars['empid']);

        $vars['pay_period'] = $this->_registry->employee->returnEmployeesInfoForPayroll($vars['empid'])['pay_period'];
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
//        $vars['emp_acc'] = Employee::viewEmployeeAccount($vars['empid'])['inc'];
        $vars['today'] = $this->_registry->datetoday->getToday();

        $vars['emp_balance'] = $this->_registry->report->returnEmployeeExactBalance($vars['empid'], smc_session()["local_currency"], smc_session()['start_date'], $vars['today'], 0, $vars['is_actual'])['Balance'];
        //        echo $vars['emp_balance'];die();

        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        //        $vars['payroll'] = $this->_registry->employee->viewPayroll($emp_id, '2018-06-04', '2018-06-06');
        //        die();
        //        $vars['today'] = $this->_registry->datetoday->getToday();
        //        $vars['NewDate'] = $vars['url'][count($vars['url']) - 2];
        //        $vars['Actual'] = $vars['url'][count($vars['url']) - 1];
        //        $vars['year'] = date("Y", strtotime($vars['NewDate'])); // get the year from today
        //        $vars['month'] = date("m", strtotime($vars['NewDate'])); // get the month from today
        //        $vars['day'] = date("d", strtotime($vars['NewDate'])); // get the day from today
        //        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        //        $vars['DefaultCurrencyID'] = $this->_registry->currency->returnLocalCurrency();
        //        $vars['DefaultCurrSymbol'] = $this->_registry->currency->viewCurrencySymbol($vars['DefaultCurrencyID']);
        //        $vars['DefaultCurrName'] = $this->_registry->currency->getCurrencyByID($vars['DefaultCurrencyID']);
        //        $vars['CurrentDate'] = $vars['year'] . '-' . $vars['month'] . '-' . $vars['day'];
        //        $vars['Emp_ID'] = $vars['url'][count($vars['url']) - 1];
        //        $vars['CurrencyName'] = $vars['DefaultCurrName'];
        //        $vars['org_details'] = $this->_registry->organization->getOrganizationDetails();
        //        $vars['emp_details'] = $vars['Actual'] == 1 ? $this->_registry->employee->viewEmployee($vars['Emp_ID'], true) : $this->_registry->employee->viewEmployee($vars['Emp_ID']);
        //        $vars['Is_Paid'] = $this->_registry->employee->checkPaidMonthByEmployee($vars['Emp_ID'], $vars['CurrentDate']);
        //        $vars['payroll'] = $vars['Is_Paid'] == 1 ? $this->_registry->employee->viewPayrollDetails($vars['Emp_ID'], $vars['year'], $vars['month']) : $this->_registry->employee->viewPayroll($vars['Emp_ID'], $vars['year'], false, $vars['month'], null, $vars['day'], null, null, null, null, smc_session()['local_currency']);
        //echo"<pre>";
        //                die(print_r($vars['payroll']));
        //        die($vars['Is_Paid']);
        //$vars['Payement_Method'] = $this->_registry->employee->getPayrollPaymentAccounts();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll_for_emp'), 'PayrollForEmployee']];
        $this->load->view('HRM/PaidPayrollForEmployee', $vars);
    }

    //    public function NewAnnouncement() {
    //
    //        $vars['title'] = HRMModel::getmsg('new_annoucement');
    //        //		$vars['bread_crumb_title']	= 'New Announcement';
    //        $vars['pageName'] = 'NewAnnouncement';
    //        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('new_annoucement'), 'NewAnnouncement']];
    //        preg_match("/\/(\d+)$/", $_SERVER["REQUEST_URI"], $match);
    //        $vars['match'] = $match;
    //        $vars['PubID'] = $vars['match'] ? $match[1] : -1;
    //        $vars['Annoucements'] = $vars['match'] ? $this->_registry->announcement->viewWithAnnoucementID($vars['PubID']) : '';
    //
    //        //        echo"<pre>";die(print_r( $vars['Annoucements']));
    //
    //
    //        $vars['Title'] = $vars['match'] ? $vars['Annoucements'][1] : '';
    //        $vars['Subtitle'] = $vars['match'] ? $vars['Annoucements'][2] : '';
    //        $vars['Time'] = $vars['match'] ? $vars['Annoucements'][3] : '';
    //        $vars['Content'] = $vars['match'] ? $vars['Annoucements'][4] : '';
    //        $vars['Announcement_Type'] = $vars['match'] ? $vars['Annoucements'][6] : '';
    //        $vars['Branch_ID'] = $vars['match'] ? $vars['Annoucements'][7] : '';
    //        $vars['Branch_Name'] = $vars['match'] ? $vars['Annoucements'][8] : '';
    //        $vars['Employee_ID'] = $vars['match'] ? $vars['Annoucements'][9] : '';
    //        $vars['Employee_Name'] = $vars['match'] ? $vars['Annoucements'][10] : '';
    //        $this->load->view('HRM/NewAnnouncement', $vars);
    //    }
    public function NewAnnouncement() {
        $this->load->model('HRM');
        $vars['title'] = HRMModel::getmsg('new_annoucement');
        //		$vars['bread_crumb_title']	= 'New Announcement';
        $vars['pageName'] = 'NewAnnouncement';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('new_annoucement'), 'NewAnnouncement']];
        preg_match("/\/(\d+)$/", $_SERVER["REQUEST_URI"], $match);
        $vars['match'] = $match;
        $vars['PubID'] = $vars['match'] ? $match[1] : -1;
        $vars['Annoucements'] = $vars['match'] ? $this->_registry->announcement->viewWithAnnoucementID($vars['PubID']) : '';
//                echo"<pre>";die(print_r( $vars['Annoucements']));
        $vars['Title'] = $vars['match'] ? $vars['Annoucements'][1] : '';
        $vars['Subtitle'] = $vars['match'] ? $vars['Annoucements'][2] : '';
        $vars['Time'] = $vars['match'] ? $vars['Annoucements'][3] : '';
        $vars['Content'] = $vars['match'] ? $vars['Annoucements'][4] : '';
        $vars['Announcement_Type'] = $vars['match'] ? $vars['Annoucements'][6] : '';
        $vars['Announcement_Value'] = $vars['match'] ? $vars['Annoucements'][11] : '';
        $vars['privacy_value_name'] = $vars['Announcement_Type'] == 'public' ? '' : ($vars['match'] ? $vars['Annoucements'][11] : '');
        //          echo"<pre>";die(print_r( $vars['privacy_value_name']));
        $this->load->view('HRM/NewAnnouncement', $vars);
    }

    public function ViewAnnouncment() {

        $vars['title'] = HRMModel::getmsg('view_announcement');
        //		$vars['bread_crumb_title']	= 'View Announcement';
        $vars['pageName'] = 'ViewAnnouncment';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_announcement'), 'ViewAnnouncment']];
        $vars['publications'] = $this->_registry->announcement->view();
        $this->load->view('HRM/ViewAnnouncment', $vars);
    }

    public function ViewAnnouncmentDetails() {

        $vars['title'] = HRMModel::getmsg('view_announcement');
        $vars['bread_crumb_title'] = 'View Announcement Details';
        $vars['pageName'] = 'ViewAnnouncmentDetails';
        $vars['announce_id_filter'] = !empty($_GET['main_id']) ? $_GET['main_id'] : '';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_announcement'), 'ViewAnnouncmentDetails']];
        $this->load->view('HRM/ViewAnnouncmentDetails', $vars);
    }

    public function LeaveCalendar() {

        $vars['title'] = HRMModel::getmsg('leave_calendar');
        //		$vars['bread_crumb_title']	= 'Leave Calendar';
        $vars['pageName'] = 'LeaveCalendar';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('leave_calendar'), 'LeaveCalendar']];
        $vars['absence_employees'] = $this->_registry->employee->returnEmployees();

        $vars['Update'] = $this->_registry->announcement->updateLeaveStatus();
        $vars['Announce'] = $this->_registry->announcement;
        $this->load->view('HRM/LeaveCalendar', $vars);
    }

    public function EvaluationPerformance() {

        $vars['title'] = HRMModel::getmsg('ev_performance');
        //		$vars['bread_crumb_title']	= 'Evaluation Performance';
        $vars['pageName'] = 'EvaluationPerformance';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('ev_performance'), 'EvaluationPerformance']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['evaluationName'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_employee_evaluation_degree');
        $vars['Question'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_document_questions');
        $vars['Action'] = $this->_registry->employee->getInfoFromTable('tbl_performance_action');
        $this->load->view('HRM/EvaluationPerformance', $vars);
    }

    public function EvaluationGraph() {

        $vars['title'] = HRMModel::getmsg('ev_performance');
        //		$vars['bread_crumb_title']	= 'Evaluation Performance';
        $vars['pageName'] = 'EvaluationPerformance';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('ev_performance'), 'EvaluationGraph']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        $vars['all_employees'] = $this->_registry->employee->returnEmployees(false);
        $vars['Employee_ID'] = $vars['all_employees'][0]['Employee_ID'];
        $vars['EvaluationPerEmployee'] = $this->_registry->employee->getEvalutionPerformance($vars['Employee_ID'], $vars['year']);
        $vars['EvaluationEmployee'] = $this->_registry->employee->performanceGraph($vars['Employee_ID'], $vars['year']);
        $this->load->view('HRM/EvaluationGraph', $vars);
    }

    public function HRMDashboard() {

        $vars['title'] = HRMModel::getmsg('hrm');
        //		$vars['bread_crumb_title']	= 'HRM Dashboard';
        $vars['pageName'] = 'HRMDashboard';
        //		$vars['breadCrumb'] = [['HRM Dashboard ','HRM/HRMDashboard']];
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('dashboard'), 'HRM/HRMDashboard']];
        $vars['continue'] = 'Continue to System';
        $this->load->view('HRM/HRMDashboard', $vars);
    }

    public function ViewToDoList() {

        $vars['title'] = HRMModel::getmsg('todo_list');
        //		$vars['bread_crumb_title']	= 'To Do List';
        $vars['pageName'] = 'EvaluationPerformance';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('todo_list'), 'ViewToDoList']];
        $this->load->view('HRM/ViewToDoList', $vars);
    }

    public function viewEmployeesActual() {

        $vars['title'] = HRMModel::getmsg('act_employees');
        $vars['pageName'] = 'viewEmployeesActual';
        $vars['employees'] = $this->_registry->employee->viewEmployee();
        $vars['shifts'] = $this->_registry->employee->viewShifts();
        $vars['branches'] = $this->_registry->employee->viewBranches();
        $vars['employee_country'] = $this->_registry->countries->viewCountries();
        $vars['details_paygrade'] = $this->_registry->job->viewPayGradesByJob();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('act_employees'), 'viewEmployeesActual']];
        $vars['employees'] = $this->_registry->employee->viewEmployee(null, true);
        $this->load->view('HRM/viewEmployeesActual', $vars);
    }

    public function addEmergencyContactActual() {

        $vars['title'] = HRMModel::getmsg('add_act_emergency_contact');
        $vars['pageName'] = 'addEmergencyContactActual';
        $vars['employees'] = $this->_registry->employee->view(true);
        $vars['relationships'] = $this->_registry->employee->viewRelationship();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_act_emergency_contact'), 'addEmergencyContactActual']];
        $this->load->view('HRM/addEmergencyContactActual', $vars);
    }

    public function addEmployeeExpenseActual() {

        $vars['title'] = HRMModel::getmsg('add_actual_expenditures');
        $vars['pageName'] = 'addEmployeeExpenseActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_actual_expenditures'), 'addEmployeeExpenseActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $this->load->view('HRM/addEmployeeExpenseActual', $vars);
    }

    public function EvaluationPerformanceActual() {

        $vars['title'] = HRMModel::getmsg('chart_ev_performance_act');
        //		$vars['bread_crumb_title']	= 'Evaluation Performance Actual';
        $vars['pageName'] = 'EvaluationPerformanceActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('ev_performance_emp_act'), 'EvaluationPerformanceActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['evaluationName'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_employee_evaluation_degree');
        $vars['Question'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_document_questions');
        $vars['Action'] = $this->_registry->employee->getInfoFromTable('tbl_performance_action');
        $this->load->view('HRM/EvaluationPerformanceActual', $vars);
    }

    public function EvaluationGraphActual() {

        $vars['title'] = HRMModel::getmsg('chart_ev_performance_act');
        $vars['bread_crumb_title'] = 'Evaluation Performance Actual';
        $vars['pageName'] = 'EvaluationGraphActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('chart_ev_performance_act'), 'EvaluationGraphActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        $vars['all_employees'] = $this->_registry->employee->returnEmployees(true);
        $vars['Employee_ID'] = $vars['all_employees'][0]['Employee_ID'];
        $vars['EvaluationPerEmployee'] = $this->_registry->employee->getEvalutionPerformance($vars['Employee_ID'], $vars['year']);
        $vars['EvaluationEmployee'] = $this->_registry->employee->performanceGraph($vars['Employee_ID'], $vars['year']);
        $this->load->view('HRM/EvaluationGraphActual', $vars);
    }

    public function addAdvancePaymentActual() {

        $vars['title'] = HRMModel::getmsg('add_advance_pay_act');
        $vars['pageName'] = 'addAdvancePaymentActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_advance_pay_act'), 'addAdvancePaymentActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        $this->load->view('HRM/addAdvancePaymentActual', $vars);
    }

    public function addLoanActual() {

        $vars['title'] = HRMModel::getmsg('add_loan_act');
        $vars['pageName'] = 'addLoanActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_loan_act'), 'addLoanActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        $this->load->view('HRM/addLoanActual', $vars);
    }

    public function addOverTimeActual() {

        $vars['title'] = HRMModel::getmsg('add_overtime_act');
        $vars['pageName'] = 'addOverTimeActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_overtime_act'), 'addOverTimeActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $this->load->view('HRM/addOverTimeActual', $vars);
    }

    public function dailyOvertimeActual() {

        $vars['title'] = HRMModel::getmsg('daily_overtime_act');
        $vars['pageName'] = 'dailyOvertimeActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('daily_overtime_act'), 'dailyOvertimeActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        //        $vars['listOverTime'] = $this->_registry->finance->viewOverTime(null, $vars['year'], $vars['month'], true);
        $this->load->view('HRM/dailyOvertimeActual', $vars);
    }

    public function addDeductionActual() {

        $vars['title'] = HRMModel::getmsg('add_deduction');
        $vars['pageName'] = 'addDeductionActual';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['IsBonus'] = $vars['url'][count($vars['url']) - 1] == "bonus";
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], $vars['IsBonus'] ? [HRMModel::getmsg('add_bonus'), 'addDeduction/bonus'] : [HRMModel::getmsg('add_deduction'), 'addDeductionActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['max_deduction_id'] = $this->_registry->finance->getMaxDeducOrBonus("tbl_hrm_deductions", "Deduction");
        $vars['max_bonus_id'] = $this->_registry->finance->getMaxDeducOrBonus("tbl_hrm_bonuses", "Bonus");
        $var['Number_ID'] = $vars['IsBonus'] ? $vars['max_bonus_id'] : $vars['max_deduction_id'];
        $this->load->view('HRM/addDeductionActual', $vars);
    }

    public function viewUsersActual() {

        $vars['title'] = HRMModel::getmsg('view_users_act');
        $vars['pageName'] = 'viewUsersActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_users_act'), 'viewUsersActual']];
        $vars['users'] = $this->_registry->user->view(true);
        $vars['employee_role'] = $this->_registry->role->view();
        $this->load->view('HRM/viewUsersActual', $vars);
    }

    public function TotalAbsenceDetails() {

        $vars['title'] = HRMModel::getmsg('absence_details');
        $vars['pageName'] = 'TotalPayslip';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('absence_details'), 'TotalAbsenceDetails']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['Date'] = strtolower($vars['url'][count($vars['url']) - 1]);
        $vars['Total_Details'] = $this->_registry->employee->viewTotalPaidAbsenceDetails($vars['Date']);
        $this->load->view('HRM/TotalAbsenceDetails', $vars);
    }

    public function PayrollForEmployeeActual() {

        $vars['title'] = HRMModel::getmsg('payroll_emp_act');
        $vars['pageName'] = 'PayrollForEmployeeActual';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('payroll_emp_act'), 'PayrollForEmployeeActual']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['branchlist'] = $this->_registry->branch->view();
        $vars['year'] = date("Y", strtotime($vars['today'])); // get the year from today
        $vars['month'] = date("m", strtotime($vars['today'])); // get the month from today
        $vars['day'] = date("d", strtotime($vars['today'])); // get the day from today
        $vars['monthName'] = date("F", mktime(0, 0, 0, $vars['month'], 10)); // transform the month number to month name
        $vars['DefaultCurrencyID'] = $this->_registry->currency->returnLocalCurrency();
        $vars['DefaultCurrSymbol'] = $this->_registry->currency->viewCurrencySymbol($vars['DefaultCurrencyID']);
        $vars['DefaultCurrName'] = $this->_registry->currency->getCurrencyByID($vars['DefaultCurrencyID']);
        $vars['payroll'] = $this->_registry->employee->viewPayroll(null, $vars['year'], false, $vars['month'], null, $vars['day'], null, null, null, 1, 84, true);
        $this->load->view('HRM/PayrollForEmployeeActual', $vars);
    }

    public function AbsenceSetting() {

        $vars['title'] = HRMModel::getmsg('absence_setting');
        $vars['pageName'] = 'AbsenceSetting';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('absence_setting'), 'AbsenceSetting']];
        $vars['ViewAbsence'] = $this->_registry->absence->viewAbsenceReasons();



        $this->load->view('HRM/AbsenceSetting', $vars);
    }

    public function paidAccruedLeave() {

        $vars['title'] = HRMModel::getmsg('paid_accrued_leave');
        $vars['pageName'] = 'paidAccruedLeave';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('paid_accrued_leave'), 'paidAccruedLeave']];
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['currency'] = $this->_registry->currency;
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        $url = explode('/', $_SERVER['REQUEST_URI']);
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;
//        die($vars['IsEdit'] ? 'yes' : 'no');
        $vars['id'] = $vars['IsEdit'] ? $url[count($url) - 1] : 0;
        $vars['data'] = $vars['IsEdit'] ? $this->_registry->worktimes->get_paid_accrued_by_id($vars['id']) : array();
//        echo"<pre>";die(print_r($vars['payment_type']));
        $vars['check_lock'] = $vars['IsEdit'] ? CommonFunctions::check_lock_data(['type' => 'paid_accrued', 'start_date' => $vars['data']['Paid_Date'], 'is_actual' => $vars['is_actual']]) : '';

        $this->load->view('HRM/paidAccruedLeave', $vars);
    }

    public function calendarmaterial() {

        $vars['title'] = HRMModel::getmsg('absence_details');
        //		$vars['bread_crumb_title']	= 'Leave Calendar';
        $vars['pageName'] = 'LeaveCalendar';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('leave_calendar'), 'calendarmaterial']];
        //		$vars['absence_employees']  =   $this->_registry->employee->returnEmployees();
        $vars['Update'] = $this->_registry->announcement->updateLeaveStatus();
        //		$vars['Announce']  =   $this->_registry->announcement;
        $this->load->view('HRM/calendarmaterial', $vars);
    }

    public function AbsenceList() {

        $vars['title'] = HRMModel::getmsg('absence_details');
        $vars['pageName'] = 'addAbsence';
        $vars['reasons_Types'] = $this->_registry->absence->viewAbsenceReasons();
        $vars['absence_employees'] = $this->_registry->employee->returnEmployees();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['is_new'] = !empty($_GET['is_new']) ? $_GET['is_new'] : 0;
        $vars['emp_id'] = !empty($_GET['emp_id']) ? $_GET['emp_id'] : 0;
        $vars['emp_name'] = !empty($_GET['emp_name']) ? $_GET['emp_name'] : 0;
//        $vars['is_approved'] = isset($_GET['is_approved']) ? $_GET['is_approved'] : '';
        $vars['absence_id_filter'] = !empty($_GET['main_id']) ? $_GET['main_id'] : '';
        //        echo $vars['emp_name'].'==';die();
        //         $vars['permissionObj'] = $this->_registry->permission;
        //        echo $vars['emp_name'] <> 0 ? $vars['emp_name'] : ($this->_registry->per->hasPermission('ApproveLeave') ? '' : smc_session()['user_details']['Employee_Name']).'==';die();
        $vars['today'] = Date::getToday();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('absence_details'), 'AbsenceList']];
        $this->load->view('HRM/AbsenceList', $vars);
    }

    public function AccruedList() {


        $vars['today'] = Date::getToday();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        preg_match("/\/hol\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_holiday'] = count($match_act) > 0 ? 1 : 0;
        $vars['title'] = HRMModel::getmsg($vars['is_actual'] == 1 ? ($vars['is_holiday'] == 1 ? 'emp_holiday_act' : 'assign_accrued_leave_act') : ($vars['is_holiday'] == 1 ? 'emp_holiday' : 'assign_accrued_leave'));
        $vars['pageName'] = $vars['is_actual'] == 1 ? ($vars['is_holiday'] == 1 ? 'employee_holiday_act' : 'AssignLeaveActual') : ($vars['is_holiday'] == 1 ? 'employee_holiday' : 'AssignLeave');
        $flag = $vars['is_actual'] ? true : false;
        $vars['absence_employees'] = $this->_registry->employee->returnEmployees($flag);
        $vars['is_new'] = !empty($_GET['is_new']) ? $_GET['is_new'] : 0;
        $vars['emp_id'] = !empty($_GET['emp_id']) ? $_GET['emp_id'] : 0;
        $vars['emp_name'] = !empty($_GET['emp_name']) ? $_GET['emp_name'] : 0;
//        $vars['is_approved'] = isset($_GET['is_approved']) ? $_GET['is_approved'] : '';
        $vars['leave_id_filter'] = !empty($_GET['main_id']) ? $_GET['main_id'] : '';
        //        echo $vars['emp_name'].'==';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [$vars['title'], 'AccruedList' . ( $vars['is_holiday'] == 1 ? '/hol' : '') . ($vars['is_actual'] == 1 ? '/act' : '')]];
        $this->load->view('HRM/AccruedList', $vars);
    }

    public function calendar() {


        $vars['title'] = HRMModel::getmsg('leave_calendar');
        $vars['pageName'] = 'LeaveCalendar';
        $vars['today'] = $this->_registry->datetoday->getToday();
        $vars['resources'] = $this->_registry->absence->viewAbsence();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('leave_calendar'), 'calendar']];
        $this->load->view('HRM/calendar', $vars);
    }

    public function viewEmployeeChild() {

        $vars['title'] = HRMModel::getmsg('viewEmployeeChild');
        $vars['pageName'] = 'viewEmployeeChild';
        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();
        $vars['DefaultCurrencyID'] = $this->_registry->currency->getDefaultCurrency();
        $vars['DefaultCurrencyCode'] = $this->_registry->currency->getCurrencyByID($vars['DefaultCurrencyID']);
        $vars['DefaultCurrencySymbol'] = $this->_registry->currency->viewCurrencySymbol($vars['DefaultCurrencyID']);
        $vars['resources'] = $this->_registry->employee->viewEmployeeChild();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('viewEmployeeChild'), 'viewEmployeeChild']];
        $this->load->view('HRM/viewEmployeeChild', $vars);
    }

    public function viewemployeedeductionnote() {

        $vars['title'] = HRMModel::getmsg('viewemployeedeductionnote');
        $vars['pageName'] = 'viewemployeedeductionnote';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('viewemployeedeductionnote'), 'viewemployeedeductionnote']];
        $this->load->view('HRM/viewemployeedeductionnote', $vars);
    }

    public function viewdeduction() {

        preg_match("/\/bonus\b/i", $_SERVER['REQUEST_URI'], $match);

        $vars['IsBonus'] = count($match) > 0 ? 1 : 0;
        $vars['title'] = $vars['IsBonus'] ? HRMModel::getmsg('viewbonus') : HRMModel::getmsg('viewdeduction');
        $vars['pageName'] = $vars['IsBonus'] ? 'viewbonus' : 'viewdeduction';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], $vars['IsBonus'] ? [HRMModel::getmsg('viewbonus'), 'viewdeduction/bonus'] : [HRMModel::getmsg('viewdeduction'), 'viewdeduction']];
        $this->load->view('HRM/viewdeduction', $vars);
    }

    public function viewAdvancePayment() {

        $vars['title'] = HRMModel::getmsg('view_advance_payment');
        $vars['pageName'] = 'view_advance_payment';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_advance_payment'), 'viewAdvancePayment']];
//        $vars['is_approved'] = isset($_GET['is_approved']) ? $_GET['is_approved'] : '';
        $vars['advance_id_filter'] = !empty($_GET['main_id']) ? $_GET['main_id'] : '';

        $this->load->view('HRM/viewAdvancePayment', $vars);
    }

    public function viewLoans() {

        $vars['title'] = HRMModel::getmsg('view_loan');
        $vars['pageName'] = 'view_loan';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_loan'), 'viewLoans']];
//        $vars['is_approved'] = isset($_GET['is_approved']) ? $_GET['is_approved'] : '';
        $vars['loan_id_filter'] = !empty($_GET['main_id']) ? $_GET['main_id'] : '';

        $this->load->view('HRM/viewLoans', $vars);
    }

    public function employeeAttendance() {

        $vars['title'] = HRMModel::getmsg('employeeAttendance');
        $vars['pageName'] = 'employeeAttendance';
        $vars['template'] = $this->_registry->attendance->get_att_templates();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employeeAttendance'), 'employeeAttendance']];
        $this->load->view('HRM/employeeAttendance', $vars);
    }

    public function MedicalSetting() {

        $vars['title'] = HRMModel::getmsg('medical_setting');
        $vars['pageName'] = 'MedicalSetting';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('medical_setting'), 'MedicalSetting']];
        $this->load->view('HRM/MedicalSetting', $vars);
    }

    public function MedicalLocation() {

        $vars['title'] = HRMModel::getmsg('medical_location');
        $vars['pageName'] = 'MedicalLocation';
        $vars['Medical_Type'] = $this->_registry->employee->viewAllMedicalType();
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;
        $vars['data'] = array();
        if ($vars['IsEdit'])
            $vars['data'] = $this->_registry->employee->viewMedicalPlace($vars['id']);
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('medical_location'), 'MedicalLocation']];
        $this->load->view('HRM/MedicalLocation', $vars);
    }

    public function viewMedicalLocation() {

        $vars['title'] = HRMModel::getmsg('view_medical_location');
        $vars['pageName'] = 'viewMedicalLocation';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_medical_location'), 'viewMedicalLocation']];
        $this->load->view('HRM/viewMedicalLocation', $vars);
    }

    public function medicalEmployee() {

        $vars['title'] = HRMModel::getmsg('medical_employee');
        $vars['pageName'] = 'medicalEmployee';
        $vars['Medical_Type'] = $this->_registry->employee->viewAllMedicalType();
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['IsEdit'] = is_numeric($url[count($url) - 1]) ? true : false;
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['data'] = $this->_registry->employee->viewMedicalEmployee($vars['id']);
        //        echo"<pre>";
        //        die(print_r($vars['data']));
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('medical_employee'), 'medicalEmployee']];
        $this->load->view('HRM/medicalEmployee', $vars);
    }

    public function viewMedicalEmployee() {

        $vars['title'] = HRMModel::getmsg('view_medical_employee');
        $vars['pageName'] = 'viewMedicalEmployee';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_medical_employee'), 'viewMedicalEmployee']];
        $this->load->view('HRM/viewMedicalEmployee', $vars);
    }

    public function addEmployeeAttendanceManual() {

        $vars['title'] = HRMModel::getmsg('add_emp_att_manual');
        $vars['pageName'] = 'addEmployeeAttendanceManual';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['from_date'] = date('Y-m-01');
//        die($vars['from_date']);
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('add_emp_att_manual'), 'addEmployeeAttendanceManual']];
        $this->load->view('HRM/addEmployeeAttendanceManual', $vars);
    }

    public function compareAttendanceSheet() {

        $vars['title'] = HRMModel::getmsg('attendance_sheet');
        $vars['pageName'] = 'attendance_sheet';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('attendance_sheet'), 'compareAttendanceSheet']];
        $this->load->view('HRM/compareAttendanceSheet', $vars);
    }

    public function attendanceReport() {

        $vars['title'] = HRMModel::getmsg('attendance_report');
        $vars['pageName'] = 'attendance_report';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;

        //        $this->_registry->attendance->employee_absence_leave(19, '2018-06-01', '2018-06-30');
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('attendance_report'), 'attendanceReport' . ($vars['is_actual'] ? '/act' : '')]];
        $this->load->view('HRM/attendanceReport', $vars);
    }

    public function printEmpDetails() {


        $vars['title'] = HRMModel::getmsg('employee_info');
        $vars['pageName'] = 'viewEmployeesDetails';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];

        $vars['Content'] = $this->_registry->employee->viewEmployee($vars['employee_ID'], true);
        $vars['Wife_IS_Work'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_dependants');
        $vars['Accrued_Leave'] = $this->_registry->worktimes->getAvailableAccruedDays($vars['employee_ID']);
        $vars['child_emp'] = $this->_registry->employee->viewEmployeeDependantChild($vars['employee_ID']);
        $vars['emp_emergency'] = $this->_registry->employee->viewEmployeeEmergencyContact($vars['employee_ID']);
        $vars['remainig_trs_dys'] = $this->_registry->worktimes->getAvailableTrsDays($vars['employee_ID']);
        $vars['allw_war'] = $this->_registry->employee->getEmployeeAlertCount($vars['employee_ID']);
        $vars['absence_taken'] = $this->_registry->employee->getCountAbsenceDysPerEmp($vars['employee_ID']);
        //        echo "<pre>";die(print_r($vars['Content']));
        $this->load->view('HRM/printEmpDetails', $vars);
    }

    public function downloadexcel() {

        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['entry_id'] = $url[count($url) - 1];
        $vars['emp_id'] = $url[count($url) - 2];

        $vars['excel'] = $this->_registry->employee->printExcelSheetPerEmpChild($vars['emp_id'], $vars['entry_id']);
    }

    public function viewEmployeeAlert() {

        $vars['title'] = HRMModel::getmsg('viewEmployeeAlert');
        $vars['pageName'] = 'viewEmployeeAlert';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('viewEmployeeAlert'), 'viewEmployeeAlert']];
        $this->load->view('HRM/viewEmployeeAlert', $vars);
    }

    public function viewEmpTransferDay() {

        $vars['title'] = HRMModel::getmsg('viewEmpTransferDay');
        $vars['pageName'] = 'viewEmpTransferDay';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('viewEmpTransferDay'), 'viewEmpTransferDay']];
        $this->load->view('HRM/viewEmpTransferDay', $vars);
    }

    public function viewUserGroup() {

        $vars['title'] = HRMModel::getmsg('viewUserGroup');
        $vars['pageName'] = 'viewUserGroup';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('viewUserGroup'), 'viewUserGroup']];
        $this->load->view('HRM/viewUserGroup', $vars);
    }

    public function VolunteerTeam() {

        $vars['title'] = HRMModel::getmsg('volunteer_team');
        $vars['pageName'] = 'volunteer_team';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('volunteer_team'), 'VolunteerTeam']];
        $this->load->view('HRM/VolunteerTeam', $vars);
    }

    public function Volunteerskills() {

        $vars['title'] = HRMModel::getmsg('volunteer_skills');
        $vars['pageName'] = 'volunteer_skills';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('volunteer_skills'), 'Volunteerskills']];
        $this->load->view('HRM/Volunteerskills', $vars);
    }

    public function Volunteernotice() {

        $vars['title'] = HRMModel::getmsg('volunteer_notice');
        $vars['pageName'] = 'volunteer_notice';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('volunteer_notice'), 'Volunteernotice']];
        $this->load->view('HRM/Volunteernotice', $vars);
    }

    public function VolunteerList() {

        $vars['title'] = HRMModel::getmsg('volunteer_list');
        $vars['pageName'] = 'volunteer_list';
        $vars['employee_country'] = $this->_registry->countries->viewCountries();
        $vars['Max_Work_ID'] = $this->_registry->employee->getMaxVolunteerWrkID();
        $vars['employee_nationality'] = $this->_registry->employee->getNationality();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('volunteer_list'), 'VolunteerList']];
        $this->load->view('HRM/VolunteerList', $vars);
    }

    public function viewVolunteersDetails() {

        $vars['title'] = HRMModel::getmsg('volunteer_info');
        $vars['pageName'] = 'viewVolunteersDetails';
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];
        $vars['Content'] = $this->_registry->employee->viewVolunteerDetails($vars['employee_ID']);

        $vars['employee_nationality'] = $this->_registry->employee->getNationality();
        $vars['employee_country'] = $this->_registry->countries->viewCountries();
        $vars['DocumentType'] = $this->_registry->employee->getInfoFromTable('tbl_hrm_document_types');
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('volunteer_list'), 'VolunteerList'], [HRMModel::getmsg('volunteer_info'), 'viewVolunteersDetails/' . $vars['employee_ID']]];
        $this->load->view('HRM/viewVolunteersDetails', $vars);
    }

    public function printVltDetails() {

        $vars['title'] = HRMModel::getmsg('volunteer_info');
        $vars['pageName'] = 'viewVolunteersDetails';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM']];
        $vars['url'] = explode('/', $_SERVER['REQUEST_URI']);
        $vars['employee_ID'] = $vars['url'][count($vars['url']) - 1];
        $vars['Content'] = $this->_registry->employee->viewVolunteerDetails($vars['employee_ID']);
        $this->load->view('HRM/printVltDetails', $vars);
    }

    public function proList() {
        $vars['title'] = HRMModel::getmsg('pro_list');
        $vars['pageName'] = 'pro_list';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('pro_list'), 'proList']];
        $this->load->view('HRM/proList', $vars);
    }

    public function ViewDepartment() {

        $vars['title'] = HRMModel::getmsg('department');
        $vars['pageName'] = 'ViewDepartment';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('department'), 'ViewDepartment']];
        $vars['DepartmentList'] = $this->_registry->employee->ViewDepartment();
        $this->load->view('HRM/ViewDepartment', $vars);
    }

    public function ViewDepartmentDetails() {
        $vars['title'] = HRMModel::getmsg('view_department_details');
        $vars['pageName'] = 'ViewDepartment';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_department_details'), 'ViewDepartmentDetails']];
        $vars['DepartmentList'] = $this->_registry->employee->ViewDepartment();

        $this->load->view('HRM/ViewDepartmentDetails', $vars);
    }

    public function addJob() {

        $vars['title'] = HRMModel::getmsg('jobs');
        $vars['pageName'] = 'addJob';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('jobs'), ''], [HRMModel::getmsg('add_job'), 'addJob']];

        $vars['currency'] = $this->_registry->currency;

        $this->load->view('HRM/addJob', $vars);
    }

    public function viewJobs() {

        $vars['title'] = HRMModel::getmsg('view_job');
        $vars['pageName'] = 'viewJobs';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_job'), 'viewJobs']];
        $vars['list'] = $this->_registry->job->getJobsInfo();
        $vars['currency'] = $this->_registry->currency;

        $this->load->view('HRM/viewJobs', $vars);
    }

    public function ManagePaygrade() {

        $vars['title'] = HRMModel::getmsg('manage_paygrade');
        $vars['pageName'] = 'ManagePaygrade';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('manage_paygrade'), 'ManagePaygrade']];
        $vars['jobnames'] = $this->_registry->job->getJobsInfo();
        $vars['currency'] = $this->_registry->currency;
        $this->load->view('HRM/ManagePaygrade', $vars);
    }

    public function salary_unit_formulas() {
        $vars['title'] = HRMModel::getmsg('salary_unit_formulas');
        $vars['pageName'] = 'salary_unit_formulas';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('salary_unit_formulas'), 'salary_unit_formulas']];
        $this->load->view('HRM/salary_unit_formulas', $vars);
    }

    public function piece_price() {
        $vars['title'] = HRMModel::getmsg('piece_price');
        $vars['pageName'] = 'piece_price';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();
        $vars['piece_service'] = CommonFunctions::CommonView('tbl_piece_service');
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('piece_price'), 'piece_price']];
        $this->load->view('HRM/piece_price', $vars);
    }

    public function piece_price_list() {
        $vars['title'] = HRMModel::getmsg('piece_price_list');
        $vars['pageName'] = 'piece_price_list';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('piece_price_list'), 'piece_price_list']];
        $this->load->view('HRM/piece_price_list', $vars);
    }

    public function piece_payment_report() {
        $vars['title'] = HRMModel::getmsg('piece_payment_report');
        $vars['pageName'] = 'piece_payment_report';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('piece_payment_report'), 'piece_payment_report']];
        $this->load->view('HRM/piece_payment_report', $vars);
    }

    public function piece_service() {
        $vars['title'] = HRMModel::getmsg('piece_service');
        $vars['pageName'] = 'piece_service';
        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('piece_service'), 'piece_service']];
        $this->load->view('HRM/piece_service', $vars);
    }

    public function employee_due_payments() {
        $vars['title'] = HRMModel::getmsg('employee_due_payments');
        $vars['pageName'] = 'employee_due_payments';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employee_due_payments'), 'employee_due_payments']];
        $this->load->view('HRM/employee_due_payments', $vars);
    }

    public function basic_salary_periods() {
        $vars['title'] = HRMModel::getmsg('salary_periods');
        $vars['pageName'] = 'salary_periods';
        $vars['default_formula'] = $this->_registry->worktimes->get_default_salary_formula();
        $vars['CurList'] = CurrencyFactory::GetLIListCurrency();

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('salary_periods'), 'salary_periods']];
        $this->load->view('HRM/basic_salary_periods', $vars);
    }

    public function attendance_setting() {
        $vars['title'] = HRMModel::getmsg('attendance_setting');
        $vars['pageName'] = 'attendance_setting';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('attendance_setting'), 'attendance_setting']];
        $this->load->view('HRM/attendance_setting', $vars);
    }

    public function emp_locations() {
        $vars['title'] = HRMModel::getmsg('employee_location');
        $vars['pageName'] = 'employee_location';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employee_location'), 'emp_locations']];
        $this->load->view('HRM/emp_locations', $vars);
    }

    public function employee_banks() {
        $vars['title'] = HRMModel::getmsg('employee_banks');
        $vars['pageName'] = 'employee_banks';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employee_banks'), 'employee_banks']];
        $this->load->view('HRM/employee_banks', $vars);
    }

    public function employee_bank_info() {

        $vars['title'] = HRMModel::getmsg('employee_bank_info');
        $vars['pageName'] = 'employee_bank_info';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employee_bank_info'), 'employee_bank_info']];
        $this->load->view('HRM/employee_bank_info', $vars);
    }

    public function employee_advance_payment() {
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['title'] = HRMModel::getmsg($vars['is_actual'] == 1 ? 'employee_advance_payment_act' : 'employee_advance_payment');
        $vars['pageName'] = $vars['is_actual'] == 1 ? 'employee_advance_payment_act' : 'employee_advance_payment';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg($vars['is_actual'] == 1 ? 'employee_advance_payment_act' : 'employee_advance_payment'), 'employee_advance_payment' . ($vars['is_actual'] == 1 ? '/act' : '')]];
        $this->load->view('HRM/employee_advance_payment', $vars);
    }

    public function employee_att_template() {

        $vars['title'] = HRMModel::getmsg('att_template');
        $vars['pageName'] = 'att_template';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('att_template'), 'employee_att_template']];
        $this->load->view('HRM/employee_att_template', $vars);
    }

    public function multi_payroll() {
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['title'] = HRMModel::getmsg($vars['is_actual'] ? 'actual_multi_payroll' : 'multi_payroll');
        $vars['pageName'] = $vars['is_actual'] ? 'actual_multi_payroll' : 'multi_payroll';
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [$vars['title'], 'multi_payroll' . ($vars['is_actual'] ? '/act' : '')]];
        $this->load->view('HRM/multi_payroll', $vars);
    }

    public function att_location_report() {

        $vars['title'] = HRMModel::getmsg('att_location_report');
        $vars['pageName'] = 'att_location_report';
        $vars['today'] = Date::getToday();

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('att_location_report'), 'att_location_report']];
        $this->load->view('HRM/att_location_report', $vars);
    }

    public function att_location_details() {

        $vars['title'] = HRMModel::getmsg('att_location_details');
        $vars['pageName'] = 'att_location_details';
        $vars['today'] = Date::getToday();

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('att_location_details'), 'att_location_details']];
        $this->load->view('HRM/att_location_details', $vars);
    }

    public function interior_ministry_report() {

        $vars['title'] = HRMModel::getmsg('interior_ministry_report');
        $vars['pageName'] = 'interior_ministry_report';
        $vars['today'] = Date::getToday();

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('interior_ministry_report'), 'interior_ministry_report']];
        $this->load->view('HRM/interior_ministry_report', $vars);
    }

    public function multi_advance_payment() {
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['title'] = HRMModel::getmsg($vars['is_actual'] == 1 ? 'multi_advance_payment_act' : 'multi_advance_payment');
        $vars['pageName'] = $vars['is_actual'] == 1 ? 'multi_advance_payment_act' : 'multi_advance_payment';
        $vars['payment_type'] = $this->_registry->payment->viewPaymentTypes();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg($vars['is_actual'] == 1 ? 'multi_advance_payment_act' : 'multi_advance_payment'), 'multi_advance_payment' . ($vars['is_actual'] == 1 ? '/act' : '')]];
        $this->load->view('HRM/multi_advance_payment', $vars);
    }

    public function view_ntf() {
        $this->load->model('HRM');
        $vars['title'] = HRMModel::getmsg('view_ntf');
        $vars['pageName'] = 'view_ntf';
        $vars['from_date'] = !empty(smc_session()['from_date_ntf']) ? smc_session()['from_date_ntf'] : Date::getToday();
        $vars['to_date'] = !empty(smc_session()['to_date_ntf']) ? smc_session()['to_date_ntf'] : Date::getToday();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_ntf'), 'view_ntf']];
        $this->load->view('HRM/view_ntf', $vars);
    }

    public function non_att_emp_dates() {

        $vars['title'] = HRMModel::getmsg('non_att_emp_dates');
        $vars['pageName'] = 'non_att_emp_dates';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['absence'] = $this->_registry->absence->viewAbsenceReasons();
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('non_att_emp_dates'), 'non_att_emp_dates']];
        $this->load->view('HRM/non_att_emp_dates', $vars);
    }

    public function view_advance_payment() {

        $vars['title'] = HRMModel::getmsg('hrm');
        $vars['pageName'] = 'view_advance_payment';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_advance_payment'), 'view_advance_payment']];
        $url = explode('/', $_SERVER['REQUEST_URI']);

        $vars['id'] = $url[count($url) - 1];
        $vars['List'] = $this->_registry->finance->viewAdvancePayment($vars['id']);

        //        echo"<pre>";die(print_r($vars['data']));
        $this->load->view('HRM/view_advance_payment', $vars);
    }

    public function view_loan_payment() {
        $vars['title'] = HRMModel::getmsg('hrm');
        $vars['pageName'] = 'view_loan_payment';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_loan_payment'), 'view_loan_payment']];
        $url = explode('/', $_SERVER['REQUEST_URI']);
        $vars['id'] = $url[count($url) - 1];
        $vars['List'] = $this->_registry->finance->get_loan_plan($vars['id']);
        $this->load->view('HRM/view_loan_payment', $vars);
    }

    public function emp_opening() {
        $vars['title'] = HRMModel::getmsg('emp_opening');
        $vars['pageName'] = 'emp_opening_data';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('emp_opening'), 'emp_opening']];
        $this->load->view('HRM/emp_opening', $vars);
    }

    public function employee_leave_absence_report() {

        $vars['title'] = HRMModel::getmsg('employee_leave_absence_report');
        $vars['pageName'] = 'employee_leave_absence_report';
        $vars['today'] = Date::getToday();
        $vars['reasons'] = $this->_registry->absence->get_absence_reasons();

//        $this->_registry->absence->employee_leave_report('2018-01-01','2018-10-30');
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('employee_leave_absence_report'), 'employee_leave_absence_report']];
        $this->load->view('HRM/employee_leave_absence_report', $vars);
    }

    public function manage_emp_leaves() {

        $vars['title'] = HRMModel::getmsg('manage_emp_leaves');
        $vars['pageName'] = 'manage_emp_leaves';
        $vars['today'] = Date::getToday();
//        $this->_registry->absence->employee_leave_report('2018-01-01','2018-10-30');
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('manage_emp_leaves'), 'manage_emp_leaves']];
        $this->load->view('HRM/manage_emp_leaves', $vars);
    }

    public function paid_accrued_leave_list() {

        $vars['title'] = HRMModel::getmsg('paid_accrued_leave');
        $vars['today'] = Date::getToday();
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['pageName'] = $vars['is_actual'] ? 'act_paid_accrued_leave_list' : 'paid_accrued_leave_list';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg($vars['is_actual'] ? 'paid_accrued_leave_act' : 'paid_accrued_leave'), 'paid_accrued_leave_list' . ($vars['is_actual'] ? '/act' : '')]];
        $this->load->view('HRM/paid_accrued_leave_list', $vars);
    }

    public function commission_setting() {
        $vars['title'] = HRMModel::getmsg('commission_setting');
        $vars['pageName'] = 'commission_setting';
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('commission_setting'), 'commission_setting']];
        $this->load->view('HRM/commission_setting', $vars);
    }

    public function sales_commission() {
        $vars['title'] = HRMModel::getmsg('salesman_commission');
        $vars['pageName'] = 'hrm_sales_commission';
        $vars['current_type'] = 'hrm';
        $vars['current_color'] = 'success';
        preg_match("/\/act\b/i", $_SERVER['REQUEST_URI'], $match_act);
        $vars['is_actual'] = count($match_act) > 0 ? 1 : 0;
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('salesman_commission'), 'sales_commission']];
        $this->load->view('Inventory/sales_commission', $vars);
    }

    public function view_department_employee() {
        $vars['title'] = HRMModel::getmsg('view_department_employee');
        $vars['pageName'] = 'ViewDepartment';

        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('view_department_employee'), 'view_department_employee']];
        $vars['DepartmentList'] = $this->_registry->employee->ViewDepartment();

        $this->load->view('HRM/view_department_employee', $vars);
    }

    public function emp_absence_setting() {

        $vars['title'] = HRMModel::getmsg('emp_absence_setting');
        $vars['pageName'] = 'emp_absence_setting';
        $vars['today'] = Date::getToday();
        $vars['reasons'] = $this->_registry->absence->get_absence_reasons();
        // echo "<pre>";die(print_r( $vars['reasons']));
//        echo $_SESSION[str_replace('/', '__', $_SERVER['REQUEST_URI'])];die();
//        $this->_registry->absence->employee_leave_report('2018-01-01','2018-10-30');
        $vars['breadCrumb'] = [[HRMModel::getmsg('hrm'), 'HRM'], [HRMModel::getmsg('emp_absence_setting'), 'emp_absence_setting']];
        $this->load->view('HRM/emp_absence_setting', $vars);
    }

    //view_employee_alert
    public function view_employee_alert() {
        $vars['title'] = inventoryModel::getmsg('viewEmployeeAlert');
        $vars['system_name'] = inventoryModel::getmsg('viewEmployeeAlert');
        $url = explode('/', $_SERVER['REQUEST_URI']);


        $alert_id = $url[count($url) - 1];
        $data = $this->_registry->employee->getEmpAlert($alert_id);
        $vars['pageName'] = $data['is_actual'] ? "print_act_employee_alert" : "print_employee_alert";

//                echo"<pre>";print_r($data);exit;
        if (!empty($data)) {
            $template_key = 'employee_alert';
            $template_row = Forms::build_print_template($template_key, $data);
        } else
            $template_row['html'] = 'you can not view this employee alert! 
        <br>
        This employee alert is not available.';
        echo $template_row['html'];
        echo '<script src="' . SITE_LINK . '/Theme/plugins/jquery/jquery-2.1.1.js" type="text/javascript"></script>';
        //        $this->load->view_html($template_row['html'], $vars);
        exit;
    }

    public function print_payroll() {
        $vars['title'] = inventoryModel::getmsg('payroll');
        $vars['system_name'] = inventoryModel::getmsg('payroll');
        $vars['pageName'] = 'viewEmployeeForPayroll';
        $data = $this->_registry->employee->get_payroll_to_print($_GET['emp_id'], $_GET['from_date'], $_GET['to_date']);
        $template_row = Forms::build_print_template('payroll', $data, array('details' => $data['details']));
        echo $template_row['html'];
        echo '<script src="' . SITE_LINK . '/Theme/plugins/jquery/jquery-2.1.1.js" type="text/javascript"></script>';
        exit;
    }

}
