// echo "tglAkhirMutasiAwal =".$tglAkhirMutasiAwal;
// echo "<br>";
// exit;
$REPORT=new report_engine();

$gambar = $FILE_GAMBAR_KABUPATEN;

//create temp table
$hit = 2;
$flag = '';
$TypeRprtr = 'neraca';
$Info = '';
$exeTempTable = $REPORT->TempTable($hit,$flag,$TypeRprtr,$Info,$tglawalperolehan,$tglAkhirMutasiAwal,
$skpd_id);
// exit;
$resultParamGol = $REPORT->ceckneraca($skpd_id,$tglawalperolehan,$tglAkhirMutasiAwal);	
// pr($resultParamGol);
// exit;	

//retrieve html
$html=$REPORT->retrieve_html_rekap_mutasi($resultParamGol,$gambar,$skpd_id,
$tglawalperolehan,$tglAkhirMutasiAwal,$tglakhirperolehan);
/*$count = count($html);
	for ($i = 0; $i < $count; $i++) {
		 
		 echo $html[$i];     
	}
exit;*/

if($tipe!="2"){
$REPORT->show_status_download_kib();
	/*if ($tglawalperolehan !='' && $tglakhirperolehan)
	{
		$get_satker = $REPORT->validasi_data_satker_id($satker);
		
	}*/
// pr($get_satker);
// exit;
$hit = 2;
$flag = '';
$TypeRprtr = 'neraca';
$Info = '';

$exeTempTable = $REPORT->TempTable($hit,$flag,$TypeRprtr,$Info,$tglawalperolehan,$tglakhirperolehan,
$skpd_id);
// exit;
$resultParamGol = $REPORT->ceckneraca($skpd_id,$tglawalperolehan,$tglakhirperolehan);	
// pr($resultParamGol);
// exit;	

$serviceJson=json_encode($resultParamGol);
//retrieve html
$html=$REPORT->retrieve_html_neraca($resultParamGol,$gambar,$skpd_id,$tglawalperolehan,$tglakhirperolehan,$tahun_neraca);
/*$count = count($html);
	for ($i = 0; $i < $count; $i++) {
		 
		 echo $html[$i];     
	}
exit;*/

if($tipe=="3"){
	echo $serviceJson;