<?php

class AppHubunganBiaya extends Database {

	protected $mSqlFile= 'module/hubungan_biaya/business/apphubunganbiaya.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
		
	function GetDataHubunganBiaya($offset, $limit,$hubunganBiaya) {
     $result =$this->Open($this->mSqlQueries['get_data_hubungan_biaya'], array('%'.$hubunganBiaya.'%', $offset, $limit));
      return $result;
  }
  
  function GetLastIdHubunganBiaya( ){
      $result=$this->Open($this->mSqlQueries['get_last_id_hubungan_biaya'], array());
      return $result;
  }

	function GetCountDataHubunganBiaya($hubunganBiaya) {
		$result = $this->Open($this->mSqlQueries['get_count_data_hubungan_biaya'], array('%'.$hubunganBiaya.'%'));
		if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
	}

	function GetDataHubunganBiayaById($hubunganBiayaId) {
		$result = $this->Open($this->mSqlQueries['get_data_hubungan_biaya_by_id'], array($hubunganBiayaId));
		return $result;
	}

	function GetDataSmtaByArrayId($arrHubunganBiayaId) {
		$hubunganBiayaId= implode("', '", $arrHubunganBiayaId);
		$result = $this->Open($this->mSqlQueries['get_data_hubungan_biaya_by_array_id'], array($hubunganBiayaId));
		return $result;
	}

//===DO==
	
	function DoAddHubunganBiaya($hubunganBiayaId,$hubunganBiayaNama) {
		$result = $this->Execute($this->mSqlQueries['do_add_hubungan_biaya'], array($hubunganBiayaId,$hubunganBiayaNama));
      return $result;
	}
	
	function DoUpdateHubunganBiaya($hubunganBiayaNama,$hubunganBiayaId) {
		$result = $this->Execute($this->mSqlQueries['do_update_hubungan_biaya'], array($hubunganBiayaNama,$hubunganBiayaId));
		return $result;
	}
	
	function DoDeleteHubunganBiayaById($hubunganBiayaId) {
		$result=$this->Execute($this->mSqlQueries['do_delete_hubungan_biaya_by_id'], array($hubunganBiayaId));
		return $result;
	}

	function DoDeleteHubunganBiayaByArrayId($arrHubunganBiayaId) {
		$hubunganBiayaId = implode("', '", $arrHubunganBiayaId);
		$result=$this->Execute($this->mSqlQueries['do_delete_hubungan_biaya_by_array_id'], array($hubunganBiayaId));
    return $result;
	}
}
?>
