<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of incomecategorymodel
 *
 * @author BusyMan
 */
class IncomeCategoryModel extends CI_Model {
    //put your code here
    private $_tbl_IC = 'tbl_incomecategory';

    public function saveIncomecategory($data) {
        //print_r($data);die();
        $this->db->insert($this->_tbl_IC, $data);
        return $this->db->insert_id();
    }
    public function getCategoryInfo(){
    	$query=$this->db->get($this->_tbl_IC);
    	$result=$query->result_array();
    	if(!empty($result)){
    		return $result;
    	}
    }

    public function getincomeCategoryById($id)
    {
       $query=$this->db->get_where($this->_tbl_IC,array('category_id'=>$id));
        $result=$query->row_array();
        if(!empty($result)){
            return $result;
        } 
    }

    public function updateIncomecategory($data,$category_id)
    {
        $this->db->update($this->_tbl_IC,$data,array('category_id'=>$category_id));
        return $this->db->affected_rows();
    }

    public function deleteIncomecategory($category_id){
        $this->db->delete($this->_tbl_IC,array('category_id'=>$category_id));
        return $this->db->affected_rows();
    }
}
