<?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 expencecategorymodel
 *
 * @author BusyMan
 */
class UnpaidCommissionModel extends CI_Model {
    //put your code here
    private $_tbl_UPC = 'tbl_unpaidcommission';
    //private $_tbl_admin = 'tbl_admin';
    public function save_unPaidCommission($data)
    {
         $data['date']=date('Y-m-d',strtotime($data['date']));
    	$this->db->insert($this->_tbl_UPC,$data);
    	return $this->db->insert_id();
    }

    public function getCommissionInfo(){
    	$query=$this->db->get($this->_tbl_UPC);
    	$result=$query->result_array();
    	if(!empty($result)){
    		return $result;
    	}
    }

    public function delete_unpaidCommission($id)
    {
    	$query=$this->db->delete($this->_tbl_UPC,array('id'=>$id));
    	return $this->db->affected_rows();
    }

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

    public function updateUnpaidCommission($data)
    {
    	$data['date']=date('Y-m-d',strtotime($data['date']));
    	//print_r($data);die();
    	$query=$this->db->update($this->_tbl_UPC,$data,array('id'=>$data['id']));
    	return $this->db->affected_rows();
    }
}