<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot').'module/mutasi_barang/business/AppMutasi.class.php';
require_once GTFWConfiguration::GetValue('application', 'docroot') . 'main/function/date.php';

class ViewRtfMutasiBarang extends RtfResponse
{
	function __construct() 
	{
	}
	function GetFileName() 
	{		
		return "mutasi_barang_" . date('d-m-Y_H-i-s') . ".rtf";
	}
	
	function ProcessRequest() 
	{
		$id = $_GET['mutasiId']->Raw();

		$Obj = new AppMutasiBarang();
		$arrMutasi = $Obj->GetMutasiDetail($id);
		$contents = GTFWConfiguration::GetValue('application', 'docroot') . 'doc/template_ba_mutasi_barang.rtf';
		$this->rtf->SetContent($contents);
		$arrMutasi = $arrMutasi[0];
	
		#set company info to rtf content
		$this->rtf->AddVar('COMPANY_NAME', GTFWConfiguration::GetValue('organization', 'company_name'));
		$this->rtf->AddVar('COMPANY_ADDRESS', GTFWConfiguration::GetValue('application', 'company_address'));
		$kota = GTFWConfiguration::GetValue('organization', 'city');
		$kota = GTFWConfiguration::GetValue('organization', 'city');
		$tgl_cetak = IndonesianDate(date('Y-m-d'), 'YYYY-MM-DD');
		$this->rtf->AddVar('KOTA_TGL_CETAK', $kota.', '. $tgl_cetak);
		
		#set data to rtf content
		$this->rtf->AddVar('UNIT_ASAL',$arrMutasi['unit_asal']);
		$this->rtf->AddVar('UNIT_TUJUAN',$arrMutasi['unit_tujuan']);
		$this->rtf->AddVar('BERITA_ACARA',$arrMutasi['ba_mutasi']);
		$this->rtf->AddVar('TGL_MUTASI',IndonesianDate($arrMutasi['tgl'], 'YYYY-MM-DD'));
		$this->rtf->AddVar('PIC',$arrMutasi['pic']);
		$this->rtf->AddVar('KEPALA', $_SESSION['username']);
	}
}
?>
