MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.53
Web Server : LiteSpeed
System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64
User : celkcksm ( 1031)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, popen, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/celkcksm/demo.ncriptech.com/../ecampus.ncriptech.com/application/helpers/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/demo.ncriptech.com/../ecampus.ncriptech.com/application/helpers/employee_helper.php
<?php


function store_employee($data){

    $data_to_store=array(
        'emp_inst_id'=>$data['inst_id'],
        'emp_role'=>$data['emp_role'],
        'emp_dept_id'=>$data['emp_dept_id'],
        'emp_code'=>$data['emp_code'],
        'emp_desig_id'=>$data['emp_desig_id'],
        'emp_first_name'=>$data['emp_first_name'],
        'emp_mid_name'=>$data['emp_mid_name'],
        'emp_last_name'=>$data['emp_last_name'],
        'emp_father_name'=>$data['emp_father_name'],
        'emp_mother_name'=>$data['emp_mother_name'],
        'emp_gender'=>$data['emp_gender'],
        'emp_email'=>$data['emp_email'],
        'emp_ph_no'=>$data['emp_ph_no'],
        'emp_ph_no_alter'=>$data['emp_ph_no_alter'],
        'emp_whatsapp_no'=>$data['emp_whatsapp_no'],
        'emp_blood_group'=>$data['emp_blood_group'],
        'emp_father_name'=>$data['emp_father_name'],
        'emp_mother_name'=>$data['emp_mother_name'],
        'emp_spouse_name'=>$data['emp_spouse_name'],
        'emp_national_id'=>$data['emp_national_id'],
        'emp_national_id_type'=>$data['emp_national_id_type'],
        'emp_pan_no'=>$data['emp_pan_no'],
        'emp_uan_no'=>$data['emp_uan_no'],
        'emp_marital_status'=>$data['emp_marital_status'],        
        'emp_type'=>$data['emp_type'],
        'emp_status'=>$data['emp_status'],
        'emp_dob'=>$data['emp_dob'],
        'emp_doj'=>$data['emp_doj'],
        'emp_doc'=>$data['emp_doc'],
        'emp_expense_limit'=>$data['emp_expense_limit'],
        'emp_do_expense'=>$data['emp_do_expense'],
        'emp_expense_limit_point'=>$data['emp_expense_limit_point']
    );

    $emp_profile_id=CI()->em->store_employee($data_to_store);

    if($emp_profile_id){
        if(!empty($data['emp_password'])){
            $emp_password=$data['emp_password'];
        }else{
            $emp_password='Password@123';
        }

        $password=password_hash($emp_password, PASSWORD_BCRYPT, array('cost'=>12));

        $emp_user_data=array(
            'user_code'=>$data['inst_code'],
            'user_role'=>$data['emp_role'],
            'user_name'=>$data['emp_username'],
            'user_password'=>$password,
            'user_password_visible'=>encode_data($emp_password),
            'user_type'=>'employee',
            'user_permissions'=>$data['permissions'],
            'user_status'=>$data['emp_status'],
            'created_by_type'=>$data['inst_type'],
            'created_by'=>$data['inst_id']
        );

        $emp_user_id=CI()->um->store_users($emp_user_data);
    }

    if($emp_user_id>0){
        if(!empty($emp_user_id)){
            $address_data=array(
                'emp_user_id'=>$emp_user_id,
                'emp_c_o'=>$data['emp_c_o'],
                'emp_city_village'=>$data['emp_city_village'],
                'emp_district'=>$data['emp_district'],
                'emp_p_o'=>$data['emp_p_o'],
                'emp_state'=>$data['emp_state'],
                'emp_pincode'=>$data['emp_pincode'],
                'emp_address_landmark'=>$data['emp_address_landmark'],
                'emp_perma_c_o'=>$data['emp_perma_c_o'],                
                'emp_perma_city_village'=>$data['emp_perma_city_village'],
                'emp_perma_district'=>$data['emp_perma_district'],
                'emp_perma_p_o'=>$data['emp_perma_p_o'],
                'emp_perma_state'=>$data['emp_perma_state'],
                'emp_perma_pincode'=>$data['emp_perma_pincode'],
                'emp_perma_address_landmark'=>$data['emp_perma_address_landmark'],
                'address_same_as'=>$data['address_same_as']
            );

            CI()->em->update_employee(array('emp_user_id'=>$emp_user_id),array('emp_id'=>$emp_profile_id));
        }
    }

    return $emp_user_id;
}

MMCT - 2023