HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/taxicamera/old/applicationold/models/admin/Mcompany.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Mcompany extends CI_Model {

	/*
	Author: soumya Hazra
	purpose: insert new car details
	date:6-9-2019
	*/
	public function submitcompany($data)
	{
		$this->db->insert('master_company', $data);
		return true;
	}


	/*
	Author: soumya Hazra
	purpose: get active company
	date:6-9-2019
	*/
	public function get_company()
	{
		$result = array();

		$this->db->select('mc.*,get_full_address_company(mc.company_id) as full_address');
		$this->db->from('master_company mc');		
		$this->db->where('mc.company_status',1);		
		$this->db->order_by('mc.company_id','DESC');		
		$query = $this->db->get();
		$result = $query->result_array();

		return $result;
	}
	/*
	Author: soma
	purpose: get inactive company
	date:18-9-2019
	*/
	public function get_inactive_company()
	{
		$result = array();

		$this->db->select('mc.*,get_full_address_company(mc.company_id) as full_address');
		$this->db->from('master_company mc');		
		$this->db->where('mc.company_status',0);		
		$this->db->order_by('mc.company_id','DESC');		
		$query = $this->db->get();
		$result = $query->result_array();

		return $result;
	}


	/*
	Author: soumya Hazra
	purpose: get single company
	date:6-9-2019
	*/
	public function get_single_company($cid)
	{
		$result = array();

		$this->db->select('*');
		$this->db->from('master_company');		
		$this->db->where('company_id',$cid);					
		$query = $this->db->get();
		$result = $query->row_array();

		return $result;
	}	


	/*
	Author: soumya Hazra
	purpose: get single company
	date:6-9-2019
	*/
	public function updatecompany($cid,$data)
	{
		$result = array();

		$this->db->select('*');
		$this->db->from('master_company');		
		$this->db->where('company_id',$cid);					
		$this->db->update('master_company',$data);		

		return true;
	}	

	/*
	Author: soumya Hazra
	purpose: Remove Company
	date:6-9-2019
	*/
	public function delcompany($cid)
	{
		$this->db->set('company_status',0);			
		$this->db->where('company_id',$cid);		
		$this->db->update('master_company');		
		
		return true;
	}

	 /*
    author: soma
    purpose: Set a company deactive
    date: 18-9-2019
    */
    public function set_deactive_company($company_id)
    {

        $this->db->set('company_status',0);
        $this->db->set('updated_by',$this->session->userdata('user_data'));
        $this->db->set('updated_ts',date('Y-m-d H:i:s'));                    
        $this->db->where('company_id',$company_id);                    
        $this->db->update('master_company'); 
       // echo $this->db->last_query();die;
        return true;     

    }
    /*
    author: soma
    purpose: Set a company active
    date: 18-9-2019
    */
    public function set_active_company($company_id)
    {

        $this->db->set('company_status',1);
        $this->db->set('updated_by',$this->session->userdata('user_data'));
        $this->db->set('updated_ts',date('Y-m-d H:i:s'));                     
        $this->db->where('company_id',$company_id);                    
        $this->db->update('master_company'); 
        return true;     

    }

  
    /*
    author: soma
    purpose: delete company 
    date: 18-9-2019
    */
    public function delete_company($company_id)
    {

        $this->db->set('is_delete',1);
        $this->db->set('company_status',0);                    
        $this->db->where('company_id',$company_id);                    
        $this->db->update('master_company'); 
        return true;     

    }
    /*
    author: soma
    purpose: restore company 
    date: 18-9-2019
    */
    public function restore_company($company_id)
    {

        $this->db->set('is_delete',0);
        $this->db->set('company_status',1);                       
        $this->db->where('company_id',$company_id);                    
        $this->db->update('master_company'); 
        return true;     

    }






}