<?php

class AppPenghasilan extends Database {

	protected $mSqlFile= 'module/penghasilan/business/apppenghasilan.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
		
	function GetDataPenghasilan($offset, $limit, $penghasilan='') {
		$result=$this->Open($this->mSqlQueries['get_data_penghasilan'], array('%'.$penghasilan.'%', $offset, $limit));
		
      return $result;
	}

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

	function GetDataPenghasilanById($phslrId) {
		$result = $this->Open($this->mSqlQueries['get_data_penghasilan_by_id'], array($phslrId));
		return $result;
	}

	function GetDataPenghasilanByArrayId($arrPhslrId) {
		$phslrId = implode("', '", $arrPhslrId);
		$result = $this->Open($this->mSqlQueries['get_data_penghasilan_by_array_id'], array($phslrId));
		return $result;
	}
	function GetMaxId() {
		$result = $this->Open($this->mSqlQueries['get_max_id'], array());
		return $result;
	}

//===DO==
	
	function DoAddPenghasilan($phslrBesar,$phslrUrutan) {
		$result = $this->Execute($this->mSqlQueries['do_add_penghasilan'], array($phslrBesar,$phslrUrutan));
		#print($this->GetLastError());
		return $result;
	}
	
	function DoUpdatePenghasilan($phslrBesar, $phslrUrutan, $phslrId) {
		$result = $this->Execute($this->mSqlQueries['do_update_penghasilan'], array($phslrBesar,$phslrUrutan, $phslrId));
	  //$debug = sprintf($this->mSqlQueries['do_update_agama'], $phslrId, $phslrBesar, $phslrKode);
	  //echo $debug;
		return $result;
	}
	
	function DoDeletePenghasilanById($phslrId) {
		$result=$this->Execute($this->mSqlQueries['do_delete_penghasilan_by_id'], array($phslrId));
		return $result;
	}

	function DoDeletePenghasilanByArrayId($arrPhslrId) {
		$phslrId = implode("', '", $arrPhslrId);
		$result=$this->Execute($this->mSqlQueries['do_delete_penghasilan_by_array_id'], array($phslrId));
		return $result;
	}
}
?>
