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

[  Home  ][  C0mmand  ][  Upload File  ]

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

/**
 * Model Class To Handle All DB Operations Related To Vehicles/Vehicle Types etc.
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class VendorManagement extends CI_Model {

    function createNewVendor(array $newVedorInfo) {
        $this->db->insert('vendors_mst', $newVedorInfo);
        return $this->db->insert_id();
    }

    function getAllVendors() {
        $this->db->select("VM.ven_id,VM.ven_business_name,VM.ven_owner_name,VM.ven_mobile,VM.ven_email,VM.ven_pan,"
                . "VM.ven_gstin_no,VM.ven_alt_mobile,VM.ven_alt_email,VM.ven_website,VM.ven_addr_line_one,VM.ven_source,"
                . "VM.ven_addr_line_two,VM.ven_addr_line_three,VM.ven_zipcode,VM.state_id,VM.city_id,VM.ven_remarks,"
                . "VM.ven_added_by,VM.ven_added_on,VM.ven_updated_by,VM.ven_updated_on,TCM.city_name cityName, "
                . "TSTM.state_name stateName,VM.ven_active_status,VM.ven_delete_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_staff_members TSMA', 'VM.ven_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'VM.ven_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->order_by("VM.ven_updated_on", "desc");
        return $this->db->get();
    }
    
    function getNonDeletedActiveVendors() {
        $this->db->select("*");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->where("VM.ven_active_status", "T");
        $this->db->where("VM.ven_delete_status", "F");
        $this->db->order_by("VM.ven_updated_on", "desc");
        return $this->db->get();
    }

    function getVendorInfoBy($ven_id) {
        $this->db->select("VM.ven_id,VM.ven_business_name,VM.ven_owner_name,VM.ven_mobile,VM.ven_email,VM.ven_pan,"
                . "VM.ven_gstin_no,VM.ven_alt_mobile,VM.ven_alt_email,VM.ven_website,VM.ven_addr_line_one,VM.ven_source,"
                . "VM.ven_addr_line_two,VM.ven_addr_line_three,VM.ven_zipcode,VM.state_id,VM.city_id,VM.ven_remarks,"
                . "VM.ven_added_by,VM.ven_added_on,VM.ven_updated_by,VM.ven_updated_on,TCM.city_name cityName, "
                . "TSTM.state_name stateName,VM.ven_active_status,VM.ven_delete_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_staff_members TSMA', 'VM.ven_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'VM.ven_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->where("VM.ven_id", $ven_id);
        return $this->db->get();
    }

    function getVendorInfoByBusinessName($ven_business_name) {
        $this->db->select("VM.ven_id,VM.ven_business_name,VM.ven_owner_name,VM.ven_mobile,VM.ven_email,VM.ven_pan,"
                . "VM.ven_gstin_no,VM.ven_alt_mobile,VM.ven_alt_email,VM.ven_website,VM.ven_addr_line_one,VM.ven_source,"
                . "VM.ven_addr_line_two,VM.ven_addr_line_three,VM.ven_zipcode,VM.state_id,VM.city_id,VM.ven_remarks,"
                . "VM.ven_added_by,VM.ven_added_on,VM.ven_updated_by,VM.ven_updated_on,TCM.city_name cityName, "
                . "TSTM.state_name stateName,VM.ven_active_status,VM.ven_delete_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_staff_members TSMA', 'VM.ven_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'VM.ven_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->where("VM.ven_business_name", $ven_business_name);
        return $this->db->get();
    }
    
    function getVendorInfoByGSTIN($ven_gstin_no) {
        $this->db->select("VM.ven_id,VM.ven_business_name,VM.ven_owner_name,VM.ven_mobile,VM.ven_email,VM.ven_pan,"
                . "VM.ven_gstin_no,VM.ven_alt_mobile,VM.ven_alt_email,VM.ven_website,VM.ven_addr_line_one,VM.ven_source,"
                . "VM.ven_addr_line_two,VM.ven_addr_line_three,VM.ven_zipcode,VM.state_id,VM.city_id,VM.ven_remarks,"
                . "VM.ven_added_by,VM.ven_added_on,VM.ven_updated_by,VM.ven_updated_on,TCM.city_name cityName, "
                . "TSTM.state_name stateName,VM.ven_active_status,VM.ven_delete_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_staff_members TSMA', 'VM.ven_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'VM.ven_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->where("VM.ven_gstin_no", $ven_gstin_no);
        return $this->db->get();
    }

    function getVendorInfoByEmail($ven_email) {
        $this->db->select("VM.ven_id,VM.ven_business_name,VM.ven_owner_name,VM.ven_mobile,VM.ven_email,VM.ven_pan,"
                . "VM.ven_gstin_no,VM.ven_alt_mobile,VM.ven_alt_email,VM.ven_website,VM.ven_addr_line_one,VM.ven_source,"
                . "VM.ven_addr_line_two,VM.ven_addr_line_three,VM.ven_zipcode,VM.state_id,VM.city_id,VM.ven_remarks,"
                . "VM.ven_added_by,VM.ven_added_on,VM.ven_updated_by,VM.ven_updated_on,TCM.city_name cityName, "
                . "TSTM.state_name stateName,VM.ven_active_status,VM.ven_delete_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_staff_members TSMA', 'VM.ven_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'VM.ven_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->where("VM.ven_email", $ven_email);
        return $this->db->get();
    }

    function getVendorInfoByMobile($ven_mobile) {
        $this->db->select("VM.ven_id,VM.ven_business_name,VM.ven_owner_name,VM.ven_mobile,VM.ven_email,VM.ven_pan,"
                . "VM.ven_gstin_no,VM.ven_alt_mobile,VM.ven_alt_email,VM.ven_website,VM.ven_addr_line_one,VM.ven_source,"
                . "VM.ven_addr_line_two,VM.ven_addr_line_three,VM.ven_zipcode,VM.state_id,VM.city_id,VM.ven_remarks,"
                . "VM.ven_added_by,VM.ven_added_on,VM.ven_updated_by,VM.ven_updated_on,TCM.city_name cityName, "
                . "TSTM.state_name stateName,VM.ven_active_status,VM.ven_delete_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('vendors_mst VM');
        $this->db->join('tbl_staff_members TSMA', 'VM.ven_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'VM.ven_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join('tbl_city_master TCM', 'VM.city_id = TCM.city_id');
        $this->db->join('tbl_states_master TSTM', 'VM.state_id = TSTM.state_id');
        $this->db->where("VM.ven_mobile", $ven_mobile);
        return $this->db->get();
    }
    
    function isVendorBusinessNameSafeUpdate($ven_id, $ven_business_name) {
        $this->db->select("*");
        $this->db->from('vendors_mst');
        $this->db->where('ven_business_name', $ven_business_name);
        $this->db->where('ven_id != ' . $ven_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }
    
    function isVendorEmailSafeUpdate($ven_id, $ven_email) {
        $this->db->select("*");
        $this->db->from('vendors_mst');
        $this->db->where('ven_email', $ven_email);
        $this->db->where('ven_id != ' . $ven_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }
    
    function isVendorMobileSafeUpdate($ven_id, $ven_mobile) {
        $this->db->select("*");
        $this->db->from('vendors_mst');
        $this->db->where('ven_mobile', $ven_mobile);
        $this->db->where('ven_id != ' . $ven_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }
    
    function isVendorGSTINSafeUpdate($ven_id, $ven_gstin) {
        $this->db->select("*");
        $this->db->from('vendors_mst');
        $this->db->where('ven_gstin_no', $ven_gstin);
        $this->db->where('ven_id != ' . $ven_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }
    
    function updateVendorInfo($vendorUpdateInfo) {
        $this->db->where('ven_id', $vendorUpdateInfo['ven_id']);
        return $this->db->update('vendors_mst', $vendorUpdateInfo);
    }

}

KBHT - 2023