? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/www/savoyglobal.net/sibs_draft/system/application/controllers/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/www/savoyglobal.net/sibs_draft/system/application/controllers/hr.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php

class HR extends BaseController {

    function HR() {
        parent::BaseController();
        $this->load->model('mastermodel');
        $this->load->model('settingsmodel');
        $this->load->model('customermodel');
        $this->load->model('accountingsmodel');
        $this->load->model('documentsmodel');
        $this->load->model('hrmodel');
        $this->load->library('Fpaginate');
    }

    function index($menuid = "", $modid = "") {
        if (empty($modid)) {
            $data['modname'] = 'Home';
        } else {
            $mod_id = $this->mastermodel->get_data('modules', $modid, 'module_id', 'sort');
            foreach ($mod_id as $id) {
                $modname = $id['module_name'];
            }
            $data['modname'] = $modname;
        }
        if (empty($menuid)) {
            $tart = 'index';
            $data['menuname'] = '';
        } else {
            $tar = $this->mastermodel->get_data('menu', $menuid, 'menu_id');

            foreach ($tar as $target) {
                $tart = $target['target'];

                $data['menuname'] = $target['caption'];
            }
        }

        $data['modules'] = $this->settingsmodel->buildModule();
        $data['menus'] = $this->settingsmodel->buildMenu($modid);



        $this->load->view('' . $data['modname'] . '/' . $tart . '', $data);
    }

    function adddesignation() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('designation', 'Designation Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/31/11');
            // $this->index('31', '11');
        } else {

            $res = $this->mastermodel->add('designation');
            redirect('master/index/31/11');
            //$this->index('31', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function adddepartment() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('departmentname', 'Department Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/32/11');
            // $this->index('32', '11');
        } else {

            $res = $this->mastermodel->add('department');
            redirect('master/index/32/11');
            //$this->index('32', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function addassignleave() {


        $res = $this->hrmodel->addassignleave();
        redirect('master/index/48/11');
        //$this->index('48', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addgrade() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('gradename', 'Grade Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/33/11');
            // $this->index('33', '11');
        } else {

            $res = $this->mastermodel->add('grade');
            redirect('master/index/33/11');
            //$this->index('33', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function add_sal_settlement() {
        $this->load->view('HR/add_sal_settlement');
    }

    function addstatus() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('statusname', 'Status Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/34/11');
            //$this->index('34', '11');
        } else {

            $res = $this->mastermodel->add('status');
            redirect('master/index/34/11');
            // $this->index('34', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function addsettlement_types() {
        $res = $this->hrmodel->addsettlement_types();
        redirect('master/index/120/11');
        //$this->index('37', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addallowdeduc() {


        $res = $this->hrmodel->addallowdeduction();
        redirect('master/index/37/11');
        //$this->index('37', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addsalarypayment() {

        $res = $this->hrmodel->insertsalarypayment();
        redirect('master/index/47/11');
        // $this->index('47', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addsalarysettlement() {

        $res = $this->hrmodel->insertsalarysettlement();
        redirect('master/index/117/11');
        // $this->index('47', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
//        else echo 1;
    }

    function updatesalarysettlement() {
        $res = $this->hrmodel->updatesalarysettlement();
        redirect('master/index/117/11');
        // $this->index('47', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function postsalarysettlement() {
        $res = $this->hrmodel->postsalarysettlement();
        redirect('master/index/117/11');
        // $this->index('47', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addcommissionpayment() {

        $res = $this->hrmodel->insertcommissionpayment();
        redirect('master/index/50/11');
        //$this->index('50', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addleavetype() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('leavename', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/38/11');
            //$this->index('38', '11');
        } else {

            $res = $this->mastermodel->add('leavetype');
            redirect('master/index/38/11');
            // $this->index('38', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function addleaveallocation() {

        $res = $this->hrmodel->insertleaveallocation('leaveallocation');
        // $this->index('49', '11');
        redirect('master/index/49/11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addholidays() {
        $res = $this->hrmodel->addholidays();
        redirect('master/index/39/11');
    }

    function addweeklyholidays() {

        $res = $this->hrmodel->addweeklyholiday();
        redirect('master/index/111/11');
        $this->load->view('HR/success');
        if ($res == 1) {
            
        }
    }

    function addworkshifts() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('work_shift_name', 'Work Shift Name', 'required');
        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/112/11');
        } else {
            $res = $this->hrmodel->addworkshift();
            redirect('master/index/112/11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function addbulkattendance() {
        
        $res = $this->hrmodel->insertbulkattendance();
        redirect('master/index/113/11');

        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addupdateattendance() {
        $res = $this->hrmodel->insertupdateattendance();
        redirect('master/index/114/11');
        $this->load->view('HR/success');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addmarkattendance() {
        $res = $this->hrmodel->insertmarkattendance();
        redirect('master/index/116/11');
        $this->load->view('HR/success');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addstaffsalary() {


        $res = $this->hrmodel->insertstaffsalary('staffsalary');
        redirect('master/index/45/11');
        // $this->index('45', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addstaff() {

        $res = $this->hrmodel->insertstaff();
        redirect('master/index/40/11');
        //$this->index('40', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function addcommissionsettings() {

        $res = $this->hrmodel->insertcommissionsettings('commissionsettings');
        redirect('master/index/46/11');
        //$this->index('46', '11');
        if ($res == 1) {
            $this->load->view('HR/success');
        }
    }

    function view($type = "") {
        if ($type == 'ajax') {
            $this->load->view('refinesearch');
        }
    }

    function addresumemanagement() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('name', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/44/11');
            //$this->index('44', '11');
        } else {


            //$data=$_FILES['userfile']['name'];
            //echo $data;
            $config['upload_path'] = './resume/';
            $config['allowed_types'] = 'gif|jpg|png|doc|pdf|txt|xls|csv|docx'; // by extension, will check for whether it is an image
            $config['max_size'] = '100000'; // in kb

            $this->load->library('upload', $config);

            if (!$this->upload->do_upload()) {



                $error = array('error' => $this->upload->display_errors());
            } else {

                $data = array('upload_data' => $this->upload->data());
            }
            // var_dump($files);
            $res = $this->hrmodel->addresume('resumemanagement');
            redirect('master/index/44/11');
            //$this->index('44', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function addofferletter() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('name', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/51/11');
            //$this->index('51', '11');
        } else {



            //$data=$_FILES['userfile']['name'];
            //echo $data;
            $config['upload_path'] = './offerletter/';
            $config['allowed_types'] = 'gif|jpg|png|doc|pdf|txt|xls|csv|docx'; // by extension, will check for whether it is an image
            $config['max_size'] = '100000'; // in kb

            $this->load->library('upload', $config);

            if (!$this->upload->do_upload()) {



                $error = array('error' => $this->upload->display_errors());
            } else {

                $data = array('upload_data' => $this->upload->data());
            }
            // var_dump($files);
            $res = $this->hrmodel->addoffer('offerletter');

            redirect('master/index/51/11');
            //$this->index('51', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function LoadWeeklyHoliday($page) {
        $this->load->view('HR/' . $page);
    }

    function ajaxload($page, $table, $pagenum = "", $selectsearch = "", $search = "") {

        $data['nooflist'] = '4';
        $data['perpage'] = '10';
        $data['pagenum'] = $pagenum;


        if ($data['pagenum'] == 1 || $data['pagenum'] == "")
            $data['no'] = 1;
        else
            $data['no'] = (($data['pagenum'] - 1) * $data['perpage']) + 1;
        if ($search == "") {
            $data['property'] = 'view';

            $data['count'] = $this->mastermodel->count_all('' . $table . '');
            $data['pages'] = ceil($data['count'] / $data['perpage']);
            $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
            $data['startpage'] = $arr[0];
            $data['endpage'] = $arr[1];
            $data['inscompany'] = $this->mastermodel->getdatas('insurance_company');
            $data['methods'] = $this->mastermodel->getdatas('payment_methods', 'sort');
            $data['segment'] = $this->mastermodel->getdatas('segment_insurances');
            $data['cover_insurance'] = $this->mastermodel->getdatas('covers');
            $data['viewinfo'] = $this->mastermodel->view('' . $table . '', $data['pagenum'], $data['perpage']);


            $data['searchinfo'] = "";
            $data['searchtxt'] = "";
            $data['searchoption'] = "";
        } else {
            $search = str_replace("~", " ", $search);
            $search = str_replace("_", "/", $search);

            $data['searchoption'] = $selectsearch;

            if ($selectsearch == 'date' || $selectsearch == 'joiningdate') {
                $qdate = $this->mastermodel->convdatformat($search);
                $search = $qdate;
            }

            $data['searchtxt'] = $search;
            $data['property'] = 'search';

            if ($table == "staffpersonaldetails") {
                $data['searchinfo'] = $this->hrmodel->get_data_search($table, $search, $selectsearch, $data['pagenum'], $data['perpage']);
                $data['count'] = $this->hrmodel->get_data_search_all($table, $search, $selectsearch);
                $data['pages'] = ceil($data['count'] / $data['perpage']);
            } else {
                $data['searchinfo'] = $this->hrmodel->get_data_search_others($table, $search, $selectsearch, $data['pagenum'], $data['perpage']);
                $data['count'] = $this->hrmodel->get_data_search_others_all($table, $search, $selectsearch);
                $data['pages'] = ceil($data['count'] / $data['perpage']);
            }

            $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
            $data['startpage'] = $arr[0];
            $data['endpage'] = $arr[1];
            $data['selectsearch'] = $selectsearch;
            $data['search'] = $search;
            $data['viewinfo'] = "";
        }
        $data['action'] = 'add';
        $data['norecords'] = $this->hrmodel->norecords('' . $table . '');
        $data['directory'] = $this->mastermodel->getdatas('directory');

        $this->load->view('HR/' . $page . '', $data);
    }

    function listSearchstaff($pagenum, $searchBy = "", $staffname = "") {


        //echo 'page no:'. $pagenum .' Searchby:'. $searchBy.' valuie:'.$staffname;

        $data['per_page'] = 6;

        if ($pagenum != 1) {
            $data['id'] = ($pagenum - 1) * $data['per_page'] + 1;
        } else {
            $data['id'] = 1;
        }


        $data['searchBy'] = $searchBy;
        $data['currentpage'] = $pagenum;
        $data['custname'] = $staffname;
        $counts = $this->documentsmodel->count_alls('staffpersonaldetails', 'id', '');
        if ($counts == 0) {
            $data['Maxpage'] = 1;
        } else {
            $data['Maxpage'] = ceil($counts / $data['per_page']);
        }
        $data['viewinfo'] = $this->hrmodel->employeelistpagination($pagenum, $data['per_page'], $staffname, $searchBy);

        $this->load->view('HR/loadstafflist', $data);
    }

    function loadWorkshift($page, $table, $pagenum = "", $searchoption = "", $searchtxt = "") {
        $data['viewinfo'] = $this->mastermodel->getdatas('' . $table . '');
        $data['searchoption'] = $searchoption;
        $data['searchtxt'] = $searchtxt;
        $data['pagenum'] = $pagenum;
        $data['count'] = $this->mastermodel->count_alldata('' . $table . '');
        $data['pages'] = ceil($data['count'] / 10);
        $arr = $this->fpaginate->paginate($pagenum, $data['pages'], 4);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $this->load->view('HR/' . $page . '', $data);
    }

    function loadallemp($page, $table) {
        $data['viewinfo'] = $this->mastermodel->getdatas('' . $table . '');
        $this->load->view('HR/' . $page . '', $data);
    }

    function ajaxloadnew($page, $table, $pagenum = "", $selectsearch = "", $search = "") {
        $data['nooflist'] = '4';
        $data['perpage'] = '10';
        $data['pagenum'] = $pagenum;
        $_SESSION['pagenum'] = $pagenum;
        $_SESSION['searchoption'] = $selectsearch;
        $_SESSION['searchtxt'] = $search;

        if ($data['pagenum'] == 1 || $data['pagenum'] == "")
            $data['no'] = 1;
        else
            $data['no'] = (($data['pagenum'] - 1) * $data['perpage']) + 1;
        if ($search == "") {
            $data['property'] = 'view';

            $data['count'] = $this->mastermodel->count_alldata('' . $table . '');
            $data['pages'] = ceil($data['count'] / $data['perpage']);
            $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
            $data['startpage'] = $arr[0];
            $data['endpage'] = $arr[1];
            $data['inscompany'] = $this->mastermodel->getdatas('insurance_company');
            $data['methods'] = $this->mastermodel->getdatas('payment_methods');
            $data['segment'] = $this->mastermodel->getdatas('segment_insurances');
            $data['cover_insurance'] = $this->mastermodel->getdatas('covers');
            $data['viewinfo'] = $this->mastermodel->viewnew('' . $table . '', $data['pagenum'], $data['perpage']);

            $data['searchinfo'] = "";
            $data['searchtxt'] = "";
            $data['searchoption'] = "";
        } else {
            $search = str_replace("~", " ", $search);
            $search = str_replace("_", "/", $search);

            $data['searchoption'] = $selectsearch;

            if ($selectsearch == 'date' || $selectsearch == 'joiningdate') {
                $qdate = $this->mastermodel->convdatformat($search);
                $search = $qdate;
            }

            $data['searchtxt'] = $search;
            $data['property'] = 'search';

            if ($table == "staffpersonaldetails") {
                $data['searchinfo'] = $this->hrmodel->get_data_searchnew($table, $search, $selectsearch, $data['pagenum'], $data['perpage']);
                $data['count'] = $this->hrmodel->get_data_search_allnew($table, $search, $selectsearch);
                $data['pages'] = ceil($data['count'] / $data['perpage']);
            } else {
                $data['searchinfo'] = $this->hrmodel->get_data_search_othersnew($table, $search, $selectsearch, $data['pagenum'], $data['perpage']);
                $data['count'] = $this->hrmodel->get_data_search_others_allnew($table, $search, $selectsearch);
                $data['pages'] = ceil($data['count'] / $data['perpage']);
            }

            $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
            $data['startpage'] = $arr[0];
            $data['endpage'] = $arr[1];
            $data['selectsearch'] = $selectsearch;
            $data['search'] = $search;
            $data['viewinfo'] = "";
        }
        $data['action'] = 'add';
        $data['norecords'] = $this->hrmodel->norecords('' . $table . '');
        $data['directory'] = $this->mastermodel->getdatas('directory');
        $this->load->view('HR/' . $page . '', $data);
    }

    function edit($page, $table, $field, $id) {

        $data['viewinfo'] = $this->mastermodel->get_data($table, $id, $field);
        $data['action'] = 'update';
        $data['id'] = $id;
        $data['design'] = $this->mastermodel->getdatas('designation');
        $data['viewedu'] = $this->mastermodel->get_data('staffeduquali', $id, 'staffid');
        $data['viewcert'] = $this->mastermodel->get_data('staffaddcert', $id, 'staffid');
        $data['viewprof'] = $this->mastermodel->get_data('staffproffexp', $id, 'staffid');
        $data['directory'] = $this->mastermodel->getdatas('directory');
        $data['medical'] = $this->mastermodel->get_data('staffsalarymedical', $id, 'staffsalaryid');
        $data['staff_files'] = $this->mastermodel->get_data('staff_files', $id, 'staffid');
        $data['methods'] = $this->mastermodel->getdatas('payment_methods');
        $this->load->view('HR/' . $page . '', $data);
    }

    function editcomstaff($page, $table, $field, $id) {

        $data['viewinfo'] = $this->mastermodel->get_data($table, $id, $field);
        $data['action'] = 'update';
        $data['staffid'] = $id;
        $this->load->view('HR/' . $page . '', $data);
    }

    function edit_sal_settlement($id, $pageno, $field, $text = "") {
        $data['viewinfo'] = $this->mastermodel->get_data_srow('emp_settlement', $id, 'id');
        $data['employee'] = $this->mastermodel->get_data_srow('staffpersonaldetails', $data['viewinfo']->employee_id, 'id');
        $data['allowdeduct'] = $this->mastermodel->get_data('salarysettlementallowdeduc', $id, 'salarysettlementid');
        $pay_date = $this->mastermodel->convdatformat($data['viewinfo']->pay_date);
        $data['salpay'] = $this->hrmodel->get_sal_data('staffsalary', $data['employee']->id, $pay_date);
        $data['emp_settlement_types'] = $this->mastermodel->get_data('emp_settlement_types', $id, 'salarysettlementid');
        $data['saldate'] = $pay_date;
        $data['action'] = 'update';
        $data['emp_settlement_id'] = $id;
        $this->load->view('HR/edit_sal_settlement', $data);
    }

    function post_sal_settlement($id, $pageno, $field, $text = "") {


        $data['viewinfo'] = $this->mastermodel->get_data_srow('emp_settlement', $id, 'id');
        $data['employee'] = $this->mastermodel->get_data_srow('staffpersonaldetails', $data['viewinfo']->employee_id, 'id');
        $data['allowdeduct'] = $this->mastermodel->get_data('salarysettlementallowdeduc', $id, 'salarysettlementid');
        $pay_date = $this->mastermodel->convdatformat($data['viewinfo']->pay_date);
        $data['salpay'] = $this->hrmodel->get_sal_data('staffsalary', $data['employee']->id, $pay_date);
         $data['emp_settlement_types'] = $this->mastermodel->get_data('emp_settlement_types', $id, 'salarysettlementid');
        $data['saldate'] = $pay_date;
        $data['action'] = 'update';
        $data['emp_settlement_id'] = $id;
        $this->load->view('HR/post_sal_settlement', $data);
    }

    function single_sal_settlement($id, $pageno, $field, $text = "") {
        $data['viewinfo'] = $this->mastermodel->get_data_srow('emp_settlement', $id, 'id');
        $data['employee'] = $this->mastermodel->get_data_srow('staffpersonaldetails', $data['viewinfo']->employee_id, 'id');
        $data['allowdeduct'] = $this->mastermodel->get_data('salarysettlementallowdeduc', $id, 'salarysettlementid');
        $pay_date = $this->mastermodel->convdatformat($data['viewinfo']->pay_date);
        $data['salpay'] = $this->hrmodel->get_sal_data('staffsalary', $data['employee']->id, $pay_date);
        $data['settlement_types'] = $this->mastermodel->get_data('emp_settlement_types', $id, 'salarysettlementid');
        $data['saldate'] = $pay_date;
        $data['action'] = 'update';
        $data['emp_settlement_id'] = $id;
        $this->load->view('HR/single_sal_settlement', $data);
    }

    function viewsingle_sal_settlement($id, $pageno, $field, $text = "") {
        $data['viewinfo'] = $this->mastermodel->get_data_srow('emp_settlement', $id, 'id');
        $data['employee'] = $this->mastermodel->get_data_srow('staffpersonaldetails', $data['viewinfo']->employee_id, 'id');
        $data['allowdeduct'] = $this->mastermodel->get_data('salarysettlementallowdeduc', $id, 'salarysettlementid');
        $pay_date = $this->mastermodel->convdatformat($data['viewinfo']->pay_date);
        $data['salpay'] = $this->hrmodel->get_sal_data('staffsalary', $data['employee']->id, $pay_date);
        $data['settlement_types'] = $this->mastermodel->get_data('emp_settlement_types', $id, 'salarysettlementid');
        $data['saldate'] = $pay_date;
        $data['action'] = 'update';
        $data['emp_settlement_id'] = $id;
        $this->load->view('HR/viewsingle_sal_settlement', $data);
    }

    function single($page, $table, $field, $id) {

        $data['viewinfo'] = $this->mastermodel->get_data($table, $id, $field);
        //$data['action']='update';
        $data['id'] = $id;
        $data['tablename'] = 'staff_files';
        $data['fieldname'] = 'staffid';
        $data['viewedu'] = $this->mastermodel->get_data('staffeduquali', $id, 'staffid');
        $data['viewcert'] = $this->mastermodel->get_data('staffaddcert', $id, 'staffid');
        $data['viewprof'] = $this->mastermodel->get_data('staffproffexp', $id, 'staffid');
        $data['directory'] = $this->mastermodel->getdatas('directory');
        $data['staff_files'] = $this->mastermodel->get_data('staff_files', $id, 'staffid');
        $data['viewactivity'] = $this->mastermodel->get_data('staffsalarymedical', $id, 'staffsalaryid');
        $data['viewactivity1'] = $this->mastermodel->get_data('staffsalarytickets', $id, 'staffsalaryid');

        $this->load->view('HR/' . $page . '', $data);
    }

    function single_report($table, $page, $repgen = "", $selectsearch = "", $search = "", $fromdate = "", $todate = "") {
        $data['segment'] = $this->mastermodel->getdatas('segment_insurances');
        $data['cover_insurance'] = $this->mastermodel->getdatas('covers');
        $this->load->view('HR/' . $page . '', $data);
    }

    function singlecomstaff($page, $table, $field, $staffid) {
        $data['viewinfo'] = $this->hrmodel->getcomset($table, $staffid, $field);
        $data['staffid'] = $staffid;
        $this->load->view('HR/' . $page . '', $data);
    }

    function leavestaff($page, $table, $field, $id) {
        $data['leavalloc'] = $this->hrmodel->getstfleavalloc($table, $id, $field);
        $data['leaveapply'] = $this->hrmodel->getstfleavapply($id);
        $this->load->view('HR/' . $page . '', $data);
    }

    function editdesignation() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('designation', 'Designation Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/31/11');
            //$this->index('31', '11');
        } else {

            $this->hrmodel->updatedesignation('designation');
            redirect('master/index/31/11');
            // $this->index('31', '11');
        }
    }

    function editdepartment() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('departmentname', 'Department Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/32/11');
            //$this->index('32', '11');
        } else {

            $this->hrmodel->updatedepartment('department');
            redirect('master/index/32/11');
            // $this->index('32', '11');
        }
    }

    function editassignleave() {


        $this->hrmodel->updateassignleave('assignleave');
        redirect('master/index/48/11');
        // $this->index('48', '11');
    }

    function editassignleavepermit() {
        $this->hrmodel->updateassignleavepermit('assignleave');
        redirect('master/index/48/11');
    }

    function editleaveallocation() {


        $this->hrmodel->updateleaveallocation('leaveallocation');
        redirect('master/index/49/11');
        // $this->index('49', '11');
    }

    function editofferletter() {


        $this->hrmodel->updateofferletter('offerletter');
        redirect('master/index/51/11');
        // $this->index('51', '11');
    }

    function editcommissionsettings() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('cover_id', 'Cover Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/46/11');
            //$this->index('46', '11');
        } else {

            $res = $this->hrmodel->updatecommissionsettings('commissionsettings');
            redirect('master/index/46/11');
            //$this->index('46', '11');
            if ($res == 1) {
                $this->load->view('HR/success');
            }
        }
    }

    function editgrade() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('gradename', 'Grade Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/33/11');
            //$this->index('33', '11');
        } else {

            $this->hrmodel->updategrade('grade');
            redirect('master/index/33/11');
            //$this->index('33', '11');
        }
    }

    function editstatus() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('statusname', 'Status Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/34/11');
            //$this->index('34', '11');
        } else {

            $this->hrmodel->updatestatus('status');
            redirect('master/index/34/11');
            //$this->index('34', '11');
        }
    }

    function editstaffsalary() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('employee_id', 'Employee Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/45/11');
            //$this->index('45', '11');
        } else {

            $this->hrmodel->updatestaffsalary('staffsalary');
            redirect('master/index/45/11');
            // $this->index('45', '11');
        }
    }

    function editsettlement_types() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('settlement_name', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/120/11');
            //$this->index('37', '11');
        } else {

            $this->hrmodel->updatesettlement_types('settlement_types');
            redirect('master/index/120/11');
            //$this->index('37', '11');
        }
    }

    function editallowdeduc() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('allowdeducname', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/37/11');
            //$this->index('37', '11');
        } else {

            $this->hrmodel->updateallowdeduc('allowdeduc');
            redirect('master/index/37/11');
            //$this->index('37', '11');
        }
    }

    function editleavetype() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('leavename', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/38/11');
            // $this->index('38', '11');
        } else {

            $this->hrmodel->updateleavetype('leavetype');
            redirect('master/index/38/11');
            // $this->index('38', '11');
        }
    }

    function editholidays() {

        $this->hrmodel->updateholidays('holidays');
        redirect('master/index/39/11');
    }

    function editworkshifts() {

        $this->load->library('form_validation');
        $this->form_validation->set_rules('work_shift_name', 'Shift Name', 'required');
        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/112/11');
        } else {

            $this->hrmodel->updateworkshifts();
            redirect('master/index/112/11');
        }
    }

    function get_employee_attendance_info($device_no, $from_date, $to_date) {
        $data = array();
        $data['viewinfo'] = $this->hrmodel->get_employee_attendance($device_no, $from_date, $to_date);
        $data['employee'] = $this->mastermodel->get_data_srow('staffemployeedetails', $device_no, 'device_no');
        $this->load->view('HR/employee_attendance_info', $data);
    }

    function editresumemanagement() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('name', 'Name', 'required');

        if ($this->form_validation->run() == FALSE) {
            redirect('master/index/44/11');
            // $this->index('44', '11');
        } else {

            $this->hrmodel->updateresumemanagement('resumemanagement');
            redirect('master/index/44/11');
            // $this->index('44', '11');
        }
    }

    function editstaff() {

        // $data=array_filter($_FILES['userfile']['name']);
        $config['allowed_types'] = 'gif|jpg|png|doc|pdf|txt|xls|csv|docx'; // by extension, will check for whether it is an image
        $config['max_size'] = '100000'; // in kb
        $config['max_width'] = '1024';
        $config['max_height'] = '768';

        $this->load->library('upload', $config);
        $this->load->library('Multi_upload');

        $files = $this->multi_upload->go_upload();
        $files = $this->multi_upload->go_upload();
        $this->hrmodel->updatestaff();
        redirect('master/index/40/11');
        //$this->index('40', '11');
    }

    function updatecomstaff() {


        $this->hrmodel->updatecomstafffin('staffcommissionsettings');
        redirect('master/index/40/11');
        // $this->index('40', '11');
    }

    function delete($table, $id, $menu) {

        $data = $this->mastermodel->check_permissions(3);
        if (!$data) {

            $this->index($menu, '11');
            $this->load->view('Master/nopermission');
        } else {

            try {
                $res = $this->mastermodel->deletedata($table, $id);
                ;

                if ($res != 1) {
                    throw new Exception("Error");
                }
                $this->index($menu, '11');
            } catch (Exception $exception) {

                $this->index($menu, '11');
                $this->load->view('Master/checkexist');
            }
        }
    }

    function liststaff($staffname = "") {

        $data['viewinfo'] = $this->hrmodel->employeelist($staffname);
        $this->load->view('HR/loadstafflist', $data);
    }

    function getleavedata($id) {
        $gender = $this->customermodel->getSingleFieldValue('staffpersonaldetails ', 'gender', 'id', $id);
        $data['leavetype'] = $this->mastermodel->getleavedata($gender);
        $this->load->view('HR/loadleave', $data);
    }

    function ajaxloadcovercom($page, $arg1) {
        $data['covercom'] = $this->mastermodel->get_data('covers', $arg1, 'segment_id');
        $this->load->view('HR/' . $page . '', $data);
    }

    function ajaxloadsalpay($page, $arg1, $arg2) {
        $salcount = $this->hrmodel->numcount_data_sal('staffsalary', $arg1, $arg2);

        if ($salcount == 0) {

            echo "<script>alert('Salary not set');</script>";
        } else {
            $data['salpay'] = $this->hrmodel->get_sal_data('staffsalary', $arg1, $arg2);
            // $data['comset']=$this->hrmodel->get_com_data('settarget',$arg1,$arg2);
            $data['premiumgen'] = $this->hrmodel->get_com_premgen($arg1, $arg2);
            $data['premiumpay'] = $this->hrmodel->get_com_prempay($arg1, $arg2);
            $data['staffid'] = $arg1;
            $data['saldate'] = $arg2;
            $this->load->view('HR/' . $page . '', $data);
        }
    }

    function ajaxloadsalpayselected() {
        $arg1 = $_POST['id'];
        $arg2 = $_POST['date'];
        $salcount = $this->hrmodel->numcount_data_sal('staffsalary', $arg1, $arg2);

        if ($salcount == 0) {

            echo "<script>alert('Salary not set');</script>";
        } else {
            $data['salpay'] = $this->hrmodel->get_sal_data('staffsalary', $arg1, $arg2);
            // $data['comset']=$this->hrmodel->get_com_data('settarget',$arg1,$arg2);
            $data['premiumgen'] = $this->hrmodel->get_com_premgen($arg1, $arg2);
            $data['premiumpay'] = $this->hrmodel->get_com_prempay($arg1, $arg2);
            $data['staffid'] = $arg1;
            $data['saldate'] = $arg2;
            echo $this->load->view('HR/viewemployeesalpay', $data);
        }
    }

    function viewSelectedEmployeeSalpay() {
//        echo json_encode($_POST);
        $employee = $_POST['salempdet'];
        $date = $_POST['date'];
        $data['salcount'] = $this->hrmodel->numcount_data_employee_sal('staffsalary', $employee, $date);
        $data['salpay'] = $this->hrmodel->get_employee_sal_data('staffsalary', $employee, $date);
        $data['staff'] = $employee;
        $data['saldate'] = $date;
        echo $this->load->view('HR/viewemployeesalpay', $data);
//        $data['premiumgen'] = $this->hrmodel->get_employee_com_premgen($employee, $date);
//        $data['premiumpay'] = $this->hrmodel->get_employee_com_prempay($employee, $date);
//        var_dump($data['premiumgen']);
    }

    function ajaxloadcompay($page, $arg1, $arg2) {
        $data['premiumgen'] = $this->hrmodel->get_com_premgen($arg1, $arg2);
        $data['premiumpay'] = $this->hrmodel->get_com_prempay($arg1, $arg2);
        $data['staffid'] = $arg1;
        $data['date'] = $arg2;
        $this->load->view('HR/' . $page . '', $data);
    }

    function filecheck($table, $file) {
        $exist = $this->hrmodel->filecheck($file, $table);
        echo $exist;
    }

    function checksalarymonthforsettlement() {
        $data = array();
        $data['info'] = $_POST;

        $salcount = $this->hrmodel->numcount_data_sal('staffsalary', $data['info']['id'], $data['info']['date']);
        if ($salcount == 0) {

            echo "no";
        } else {
            echo 1;
        }
    }

    function checksalarymonth() {
        $data = array();
        $data['info'] = $_POST;

        $salcount = $this->hrmodel->numcount_data_sal('staffsalary', $data['info']['id'], $data['info']['date']);
        if ($salcount == 0) {

            echo "no";
        } else {

            $slexist = $this->hrmodel->checksalarymonth($data['info']['id'], $data['info']['date']);
            echo $slexist;
        }
    }

    function multiplesalarypayment() {
        $res = $this->hrmodel->multiplesalarypayment();
    }

    function loadsalary($page, $post, $date) {

        $data['viewinfo'] = $this->hrmodel->loademployeesalary($post, $date);
        $this->load->view('HR/' . $page . '', $data);
    }

    function loadunpostedsalary($page, $salid) {

        $data['salpay'] = $this->mastermodel->get_data('emp_salary_slip', $salid, 'id');
        $this->load->view('HR/' . $page . '', $data);
    }

    function postsalarypayment() {
        $res = $this->hrmodel->postsalarypayment();
    }

    function multiplepostsalarypayment() {
        $res = $this->hrmodel->multiplepostsalarypayment();
    }

    function quickeditassignleave_permit($id) {
        $data['leaveid'] = $id;
        $this->load->view('HR/quickeditassignleave_permit', $data);
    }

    function updateleavestatus() {
        $res = $this->hrmodel->updateleavestatus();
        if ($res >= 1) {
            echo "Leave status updated";
        } else {
            echo "Error While Adding";
        }
    }

    function monthlyattendancereport() {
        $output = $this->hrmodel->get_monthly_attendance_report();

        $this->load->plugin('to_pdf');
        if (!empty($output)) {
            $data['report'] = $output;
            $data['month'] = $_POST['month'];
            $data['year'] = $_POST['year'];
            $page = $_POST['report_type'] . '_monthly_attendance_report';
            $this->load->view('HR/' . $page . '', $data);
        } else {
            redirect('master/index/' . $_SESSION['current_mode'] . '/11');
        }
    }

    function monthlytimereport() {
        $output = $this->hrmodel->get_monthly_attendance_report();

        $this->load->plugin('to_pdf');
        if (!empty($output)) {
            $data['report'] = $output;
            $data['month'] = $_POST['month'];
            $data['year'] = $_POST['year'];
            $page = $_POST['report_type'] . '_monthly_time_report';
            $this->load->view('HR/' . $page . '', $data);
        } else {
            redirect('master/index/' . $_SESSION['current_mode'] . '/11');
        }
    }

    function latereport() {
        $output = $this->hrmodel->get_monthly_attendance_report();

        $this->load->plugin('to_pdf');
        if (!empty($output)) {
            $data['report'] = $output;
            $data['month'] = $_POST['month'];
            $data['year'] = $_POST['year'];
            $page = $_POST['report_type'] . '_late_report';
            $this->load->view('HR/' . $page . '', $data);
        } else {
            redirect('master/index/' . $_SESSION['current_mode'] . '/11');
        }
    }

    function punchreport() {
        $output = $this->hrmodel->get_monthly_attendance_report();
        $this->load->plugin('to_pdf');
        if (!empty($output)) {
            $data['report'] = $output;
            $data['starting_date'] = $_POST['starting_date'];
            $data['ending_date'] = $_POST['ending_date'];
            $page = $_POST['report_type'] . '_punch_report';
            $this->load->view('HR/' . $page . '', $data);
        } else {
            redirect('master/index/' . $_SESSION['current_mode'] . '/11');
        }
    }

    function employeetimesheetreport() {
        $output = $this->hrmodel->get_employee_timesheet_report();

        $this->load->plugin('to_pdf');
        if (!empty($output)) {
            $data['report'] = $output;
            $data['month'] = $_POST['month'];
            $data['year'] = $_POST['year'];
            $page = $_POST['report_type'] . '_employee_timesheet_report';
            $this->load->view('HR/' . $page . '', $data);
        } else {
            redirect('master/index/' . $_SESSION['current_mode'] . '/11');
        }
    }

    function post_settlement() {
        $id = $_POST['id'];
        $res = $this->hrmodel->post_sal_settlement($id);
        echo $res;
    }

    function viewsettlement($model_function, $unposted, $pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;

        $data['totrecord'] = $this->settingsmodel->count_alls('emp_settlement', 'unpost', $unposted);

        if ($field == 'emp_settlement.relieving_date' || $field == 'emp_settlement.pay_date') {
            $value = $this->mastermodel->convdatformat($value);
        }

        $data['unpost'] = $unposted;
        $data['field'] = $field;
        $data['text'] = $value;
        $data['viewinfo'] = $this->hrmodel->$model_function('emp_settlement', $unposted, $field, $value, $pageno);
        $this->load->view('HR/view_settlement', $data);
    }
    
    function unposted_payslip_pdf($salid) 
    {
        $data = array();
        $this->load->plugin('to_pdf');
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        //"shajn";
        $data['salpay'] = $this->hrmodel->unpostedpayslip($salid);
        //var_dump($data);
        //die();
        $this->load->view('HR/posted_payslip_pdf', $data);
    }

}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net