<?php

class SumberBarang extends Database {

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

   function GetCount($dt){
		$arrReturn=$this->Open($this->mSqlQueries['get_count'], array('%'.$dt['nama'].'%'));
      return $arrReturn[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($dt) {	   
      return $this->Execute($this->mSqlQueries['do_add'], array($dt['nama']));	  
   }  
	
   function DoUpdate($dt) {
      return $this->Execute($this->mSqlQueries['do_update'], array($dt['nama'],$dt['id']));         		  
   }   
	
	function DoDelete($id) {
	   return $this->Execute($this->mSqlQueries['do_delete'], array($id));		
	} 
}
?>
