<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class API_Model extends CI_Model {
 
  
  
  function __construct() 
  {
    /* Call the Model constructor */
    parent::__construct();
     $this->db->query("SET sql_mode=(SELECT REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''));");
  }

	function save_grn_master($data){
		 $this->db->insert('purchases',$data);
		 return $this->db->insert_id();
	}
	
	function save_grn_items($data){
		 $this->db->insert('purchase_items',$data);
		 return $this->db->insert_id();
	}
	
	//added by namal 
	public function update_transfer_master($id,$data){
	    if($id>0){
	   	    $this->db->where('stm_id', $id);
		    return $this->db->update('stock_transfer_master',$data);
	     }else{
	        return false;
	    }
	}

	
}