<?php
class Komponen extends Database
{

	protected $mSqlFile= 'module/pb_pengadaan_verifikasi/business/komponen.sql.php';
	
	function __construct($connectionNumber=0)
   {
		parent::__construct($connectionNumber);
	}
		
	//-- combobox here
	function ConvertCombo($combo)
   {
      foreach ($combo as $value) $return[$value['id']] = $value['name'];
      return $return;
   }

   function GetCbxJenisKib() {
      $result = $this->Open($this->mSqlQueries['get_combo_jenis_kib'], array());
      foreach (array_keys($result) as $key)
      {
         if (strpos($result[$key]['name'], 'KIB D:') !== 0)
            $return[] = $result[$key];
         if (strpos($result[$key]['name'], 'KIB E:') !== false)
            $return[] = array('id'=>$result[$key]['id'], 'name'=>$result[$key]['name'].' (BHP)');
      }

      return $return;
   }

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

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

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

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

   function GetCbxPagar() {
      $result = $this->Open($this->mSqlQueries['get_cbx_pagar'], array());
      $array = eval('return '.str_replace('enum', 'array', $result[0]['Type']).';');
      foreach ($array as $key=>$val) $pagar[$key]['id'] = $pagar[$key]['name'] = $val;
      return $pagar;
   }

   function GetCbxSifatBangunan() {
      $result = $this->Open($this->mSqlQueries['get_cbx_sifat_bangunan'], array());
      $array = eval('return '.str_replace('enum', 'array', $result[0]['Type']).';');
      foreach ($array as $key=>$val) $pagar[$key]['id'] = $pagar[$key]['name'] = $val;
      return $pagar;
   }

   function GetCbxIMB() {
      $result = $this->Open($this->mSqlQueries['get_cbx_imb'], array());
      $array = eval('return '.str_replace('enum', 'array', $result[0]['Type']).';');
      foreach ($array as $key=>$val) $pagar[$key]['id'] = $pagar[$key]['name'] = $val;
      return $pagar;
   }

   function GetCbxPenguasaanBarang() {
      $result = $this->Open($this->mSqlQueries['get_cbx_penguasaan_barang'], array());
      return $result;
   }
	
	function GetDataBarangUsulan()
   {
		$result = $this->Open($this->mSqlQueries['get_data_barang_usulan_by_id'], array());
      return $result;
	}
}
?>
