<?php
require_once GTFWConfiguration::GetValue('application', 'docroot').'module/'.Dispatcher::Instance()->mModule.'/business/LapMutasiBarang.class.php';

class PopupDetailMutasiBarang extends HtmlResponse
{
	function TemplateModule ()
   {
		$this->SetTemplateBasedir(GTFWConfiguration::GetValue('application','docroot').'module/'.Dispatcher::Instance()->mModule.'/template');
		$this->SetTemplateFile('popup_detail_mutasi_barang.html');
	}
	
	function ProcessRequest ()
   {
		$detilObj = new LapMutasiBarang;

			if($_GET['idMutasi']->raw()!='')
			{
				$MutasiId=Dispatcher::Instance()->Decrypt($_GET['idMutasi']);
			}
				else
			{
				$MutasiId='';
			}

		$detilMutasi = $detilObj->GetDetilMutasi($MutasiId);
		//print_r($detilMutasi);exit;
		$return['detilMutasi']=$detilMutasi;
      return $return;
	}
	
	function ParseTemplate ($data = NULL)
   {

   if (empty($data['detilMutasi'])) {
			$this->mrTemplate->AddVar('data_mutasi', 'MUTASI_EMPTY', 'YES');
		} else {
			//$decPage = Dispatcher::Instance()->Decrypt($_REQUEST['page']);
			//$encPage = Dispatcher::Instance()->Encrypt($decPage);
			$this->mrTemplate->AddVar('data_mutasi', 'MUTASI_EMPTY', 'NO');
			$detilMutasi = $data['detilMutasi'];
			$this->mrTemplate->AddVar('content', 'UNIT_ASAL',$detilMutasi[0]['unit_asal']);
			$this->mrTemplate->AddVar('content', 'TUJUAN_ASAL',$detilMutasi[0]['tujuan_asal']);
				for ($i=0; $i<sizeof($detilMutasi); $i++) {
					$no = $i+1;
					$detilMutasi[$i]['number'] = $no;
					if ($no % 2 != 0) $detilMutasi[$i]['class_name'] = 'table-common-even';
					else $detilMutasi[$i]['class_name'] = '';
						
						$tanggal=$detilMutasi[$i]['tanggal'];//membuat agar tanggal saja
						$pisahtanggal=explode(" ",$tanggal);
						$detilMutasi[$i]['tanggal']=$pisahtanggal[0];
				
					$this->mrTemplate->AddVars('detil_mutasi', $detilMutasi[$i],'DETILMUTASI_');
					$this->mrTemplate->parseTemplate('detil_mutasi', 'a');	 
				}
		}	
	}
}
?>
