<?php
if($this->session->userdata('is_logged_in')===FALSE){
			redirect('login');
}

$url = "";
$judul = "";
$namafile="Instrumen-Pengembalian-Sisa-Panjar2";
$url = base_url("resources/template/new_template/peradilan_agama/template_pendukung/".$namafile.".rtf");
$Template = file_get_contents($url);

$data_p = $datapenggugat;


    foreach ($data_p->result() as $row) {
            $nomor_perkara = $row->nomor_perkara;        
            $nama_p  =$row->nama;
            $alamat_p =$row->alamat;
             

 }

if(empty($nomor_perkara)){
	$nomor_perkara = '........';
}

$namasatker = $datapengadilan->row(0)->NamaPN;
$Template = str_replace("Pengadilan Agama ",'',str_replace("#kota_satker#",ucwords(strtolower($namasatker)),$Template));
$Template = str_replace("Mahkamah Syar'iyah ",'',str_replace("#kota_satker#",ucwords(strtolower($namasatker)),$Template));

$pembuat = intval($ditetapkanoleh);
if ($pembuat==1) {
    $Template = str_replace('#JABATAN#','Panitera',$Template);
    $Template = str_replace('#atasnama#','',$Template);
    $Template = str_replace("#NAMA#",$datapengadilan->row(0)->PansekPNNama,$Template);
} else {
    $Template = str_replace('#JABATAN#','Panitera',$Template);
    $Template = str_replace('#atasnama#','a.n ',$Template);
    $Template = str_replace("#NAMA#",$datapengadilan->row(0)->WaPanNama,$Template);
}
$tanggal_now =$this->templatehelper->convertKeTglIndo(date('Y-m-d'));


$Template = str_replace("#nomor_perkara#",''.$nomor_perkara.'',$Template);
$Template = str_replace("#tanggal#",''.$tanggal_now.'',$Template);
$Template = str_replace("#nama_p#",''.$nama_p.'',$Template);
$Template = str_replace("#alamat_p#",''.$alamat_p.'',$Template);
$Template = str_replace("#jumlah#",''.$jumlah.'',$Template);

$terbilang= $this->templatehelper->Terbilang(intval(str_replace('.', '',$jumlah)));
$Template = str_replace("#terbilang#",''.$terbilang.'',$Template);


header("Content-type: application/rtf");
header("Content-disposition: inline; filename=".$namafile."-".$nomor_perkara.".rtf");
header("Content-length: ".strlen($Template));
echo $Template;


?>