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/pmw24/driver_settlement/applicationold/models/admin/Mcustomer.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Mcustomer extends CI_Model {




    /*
    author: soumya hazra
    purpose: Get all customer list
    date: 9-9-2019
    */
    public function get_customer()
    {
        $result =  array();
        $this->db->select('mc.*,get_full_address_customer(mc.customer_id) as full_address');
        $this->db->from('master_customer mc');       
        $this->db->where('mc.customer_status',1);       
        $this->db->order_by('mc.customer_id','DESC');       
        $query = $this->db->get();
        $result = $query->result_array();
        return $result;

    }    /*
    author: soumya hazra
    purpose: Get all customer list
    date: 9-9-2019
    */
    public function get_customers_inac()
    {
        $result =  array();
        $this->db->select('mc.*,get_full_address_customer(mc.customer_id) as full_address');
        $this->db->from('master_customer mc');       
        $this->db->where('mc.customer_status',0);       
        $this->db->order_by('mc.customer_id','DESC');       
        $query = $this->db->get();
       // echo $this->db->last_query();die;
        $result = $query->result_array();
        return $result;

    }


        /*
    author: soumya hazra
    purpose: Add New customer
    date: 9-9-2019
    */
    public function submitcustomer($data)
    {
		$this->db->insert('master_customer', $data);
		return true;
    }

    /*
    author: soumya hazra
    purpose: Update Customer
    date: 9-9-2019
    */
    public function update_submitcustomer($data,$cid)
    {
        $this->db->where('customer_id', $cid);
        $this->db->update('master_customer', $data);
        return true;
    }

    /*
    author: soumya hazra
    purpose: Get singel customer
    date: 9-9-2019
    */
    public function get_singl_customer($dc)
    {
        $result =  array();
        $this->db->select('*');
        $this->db->from('master_customer');       
        $this->db->where('customer_id',$dc);       
        $query = $this->db->get();
        $result = $query->row_array();
        return $result;
    }

/*
    author: soma
    purpose: Set a customer inactive
    date: 9-9-2019
    */
    public function set_deactive_customer($customer_id)
    {

        $this->db->set('customer_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('customer_id',$customer_id);                    
        $this->db->update('master_customer'); 

        return true;     

    }
    /*
    author: soma
    purpose: Set a customer active
    date: 9-9-2019
    */
    public function set_active_customer($customer_id)
    {

        $this->db->set('customer_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('customer_id',$customer_id);                    
        $this->db->update('master_customer'); 

        return true;     

    }
}