<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot') . 'module/pb_pengadaan_barang/business/PengadaanBarang.class.php';

class PopupPengadaanBarangDetil extends HtmlResponse {
   
	function TemplateModule()
   {
      $this->SetTemplateBasedir(GTFWConfiguration::GetValue('application','docroot') . 'module/pb_pengadaan_barang/template');
      $this->SetTemplateFile('popup_pengadaan_barang_detil.html');
   }
   
   function ProcessRequest()
   {
   	$Obj = new PengadaanBarang();   	
      $data = $Obj->GetDataPengadaanBarangById($_GET['id']);
		$return['data'] = $data;
      
      return $return;
   }
   
	function ParseTemplate($data = NULL)
   {  
		$dataForm = $data['data'][0]; 
		$this->mrTemplate->AddVars('content', $dataForm, '');
		
      // Render data grid
		if (empty($data['data']) || $data['data'][0]['brgId'] == '')
		{
			$this->mrTemplate->AddVar('data', 'DATA_EMPTY', 'YES');
			return;
		}
			else 
		{	
			$this->mrTemplate->AddVar('data', 'DATA_EMPTY', 'NO');
      
			$i = 1;
			foreach ($data['data'] as $value)
			{
				$value['nomor'] = $i;
				$value['brgNilaiSat']=number_format($value['brgNilaiSat'], 0, ',', '.');
				$value['brgNominalSat']=number_format($value['brgNominalSat'], 2, ',', '.');
				$value['brgNominalVat']=number_format($value['brgNominalVat'], 2, ',', '.');
				
				$this->mrTemplate->AddVars('data_item', $value, '');
				$this->mrTemplate->parseTemplate('data_item', 'a');		
				
				$i++;
			}
		}
   }
}
?>
