<?php

class SatuanBarang extends Database {

   protected $mSqlFile= 'module/satuan_barang/business/satuan_barang.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);     
   }
//==GET==      
   function GetData ($offset, $limit, $data) { 
      $result = $this->Open($this->mSqlQueries['get_data'], array('%'.$data['nama'].'%',                                                                 																                                                              															  
																  $offset,$limit));       																  
	  return $result;
   }

   function GetCount ($data) {
     $result = $this->Open($this->mSqlQueries['get_count'], array('%'.$data['nama'].'%'));  
     if (!$result)
       return 0;
     else
       return $result[0]['total'];    
   }
   
   function GetDataById($id) {      
      $result = $this->Open($this->mSqlQueries['get_data_by_id'], array($id)); 
	  if($result)
	     return $result[0];
	  else
	     return $result;	  
   }  
   
   function DoAdd($data) {	   
      $ret = $this->Execute($this->mSqlQueries['do_add'], array($data['nama']));	  
      return $ret;
   }  
	
   function DoUpdate($data) {
     $ret = $this->Execute($this->mSqlQueries['do_update'], array($data['nama'],
		                                                          $data['id']
															      ));         		  
		//$this->mdebug();  
      return $ret;
   }   
	
	function DoDelete($id) {
	   $ret = $this->Execute($this->mSqlQueries['do_delete'], array($id));		
       return $ret;
	}


   
}
?>
