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/old/application/models/admin/Mexpense.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Mexpense extends CI_Model {

	 /*
    author: soma
    purpose: Get active Expense list
    date: 17-9-2019
    */
    public function get_expense_active_list()
    {
        $result =  array();
        $this->db->select('*');
        $this->db->from('master_expense'); 
        $this->db->where('is_active',1);
        $this->db->order_by('expense_id','desc');      
        $query = $this->db->get();
        $result = $query->result_array();
        return $result;

    }

     /*
    author: soma
    purpose: Get deactive Expense list
    date: 17-9-2019
    */
    public function get_expense_inactive_list()
    {
        $result =  array();
        $this->db->select('*');
        $this->db->from('master_expense'); 
        $this->db->where('is_active',0);        
        $query = $this->db->get();
        $result = $query->result_array();
        return $result;

    }


    /*
    author: soma
    purpose: Add New Expense
    date: 17-9-2019
    */
    public function submitexpense($data)
    {
        $this->db->insert('master_expense', $data);
        return true;
    }

    /*
    author: soma
    purpose: Get singel Expense
    date: 17-9-2019
    */
    public function get_singl_expense($dc)
    {
        $result =  array();
        $this->db->select('*');
        $this->db->from('master_expense');       
        $this->db->where('expense_id',$dc);       
        $query = $this->db->get();
        $result = $query->row_array();
        return $result;
    }


    /*
    author: soma
    purpose: Update Expense
    date: 17-9-2019
    */
    public function updateexpense($expense_name,$updated_by,$expense_id)
    {       
        $this->db->set('expense_name',$expense_name); 
        $this->db->set('updated_by',$updated_by);
        $this->db->set('updated_ts',date('Y-m-d h:i:s'));       
        $this->db->where('expense_id',$expense_id);
        $this->db->Update('master_expense');

        return true;
    }

    /*
    author: soma
    purpose: Set a expense deactive
    date: 12-9-2019
    */
    public function set_deactive_expense($expense_id,$updated_by)
    {

        $this->db->set('is_active',0);
        $this->db->set('updated_by',$updated_by);
        $this->db->set('updated_ts',date('Y-m-d h:i:s'));                    
        $this->db->where('expense_id',$expense_id);                    
        $this->db->update('master_expense'); 
       // echo $this->db->last_query();die;
        return true;     

    }
    /*
    author: soma
    purpose: Set a expense active
    date: 12-9-2019
    */
    public function set_active_expense($expense_id,$updated_by)
    {

        $this->db->set('is_active',1);
        $this->db->set('updated_by',$updated_by);
        $this->db->set('updated_ts',date('Y-m-d h:i:s'));                
        $this->db->where('expense_id',$expense_id);                    
        $this->db->update('master_expense'); 
        return true;     

    }

  
    /*
    author: soma
    purpose: delete expense 
    date: 17-9-2019
    */
    public function delete_expense($expense_id)
    {

        $this->db->set('is_delete',1);
        $this->db->set('is_active',0);                    
        $this->db->where('expense_id',$expense_id);                    
        $this->db->update('master_expense'); 
        return true;     

    }
    /*
    author: soma
    purpose: restore expense 
    date: 17-9-2019
    */
    public function restore_expense($expense_id)
    {

        $this->db->set('is_delete',0);
        $this->db->set('is_active',1);                       
        $this->db->where('expense_id',$expense_id);                    
        $this->db->update('master_expense'); 
        return true;     

    }

}