<?php

$url = "";
$judul = "";

foreach ($template->result() as $template)
{
    $filename=$template->kdtemplate;
    $namafile=str_replace(" ","",$template->namatemplate);
}

$url = base_url("resources/template/skum/".$filename.".rtf");

$Template = file_get_contents($url);
if($getdataskum->num_rows()>0){
    foreach ($getdataskum->result() as $rows) {
        $terbilang= $this->templatehelper->Terbilang(intval(str_replace('.', '',intval($rows->jumlah))));
        $Template = str_replace('#NOMOR_PERKARA#',$rows->nomor_perkara,$Template);
        $Template = str_replace('#NAMA#',$rows->nama,$Template);
        $Template = str_replace('#SEBAGAI#',$rows->sebagai,$Template);
        if($rows->jumlah == 0){$jumlah = "-";}else{$jumlah = number_format($rows->jumlah, 0, ',', '.');}
        $Template = str_replace('#PANJAR#',$jumlah,$Template);
        $Template = str_replace('#TERBILANG#',ltrim($terbilang).' rupiah',$Template);
        $Template = str_replace('#JENIS_BIAYA#',$rows->uraian,$Template);
        $Template = str_replace('#TANGGAL#',$this->templatehelper->convertKeTglIndo($rows->tanggal_transaksi),$Template);
    }
}
$satker = $this->templatehelper->standradnaming($getsatker->result()[0]->nama_satker);
$Template = str_replace('#NAMA_SATKER#',$getsatker->result()[0]->nama_satker,$Template);
$Template = str_replace('#KOTA_SATKER#',$this->templatehelper->namaKota($satker),$Template);
$Template = str_replace('#ALAMAT_SATKER#',$getalamatsatker->result()[0]->alamat_satker,$Template);
$Template = str_replace('#NAMA_KASIR#',$getkasir->result()[0]->nama_kasir,$Template);
$Template = str_replace('#PANITERA#',$getpanitera->result()[0]->nama_panitera,$Template);


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


?>