<!-- load css dan js -->
<link type="text/css" rel="stylesheet" href="<?php echo ASSETS_URL;?>plugins/datatables/dataTables.bootstrap.css" />
<script src="<?php echo ASSETS_URL;?>plugins/datatables/jquery.dataTables.js"></script>
<script src="<?php echo ASSETS_URL;?>plugins/datatables/dataTables.bootstrap.min.js"></script>

<script src="<?php echo ASSETS_URL;?>plugins/form/jquery.validate.js"></script>

<link rel="stylesheet" href="<?php echo ASSETS_URL;?>plugins/bootcomplete/bootcomplete.css" type="text/css"/>
<script src="<?php echo ASSETS_URL;?>plugins/bootcomplete/jquery.bootcomplete.js"></script>    

<!-- end load css dan js -->


<section class="content-header">
	<h1>
		<?php echo $app_title;?>
		<small><?php echo $app_desc;?></small>
	</h1>
</section>

<section class="content">
	<div class="box box-solid box-info">
		<div class="box-header">
			<h3 class="box-title"><i class="fa fa-search fax2"></i> Search <?php echo $app_title;?></h3>
		</div> <!-- .box-header -->
		<div class="box-body">
			<form name="frmResponden" id="frmResponden" method="post" class="form-horizontal">
				<div class="form-group">
					<label class="col-md-1">Customers</label>
					<div class="col-md-5">
						<input type="text" name="f_name" id="f_name" class="form-control" required value="<?php echo $this->input->get_post('f_name');?>" placeholder="Ketik dan Klik Rekomendasi">
						<input type="hidden" name="f_name_id" id="f_name_id" value="<?php echo $this->input->get_post('f_name_id');?>">
					</div>
					<label class="col-md-1">Periode</label>
					<div class="col-md-5">
						<input type="text" name="f_event" id="f_event" class="form-control" data-rule-digits="true" required value="<?php echo $this->input->get_post('f_event');?>" placeholder="Ketik dan Klik Rekomendasi">
						<input type="hidden" name="f_event_id" id="f_event_id" value="<?php echo $this->input->get_post('f_event_id');?>">
					</div>

				</div>
			<?php echo form_close();?>	
		</div> <!-- .box-body -->
		<div class="box-footer" align="center">
			<button class="btn btn-info" id="button-cari"><i class="fa fa-search"></i> Cari</button> &nbsp;&nbsp;
			<?php 			
				echo form_reset('reset','Reset', "id = 'button-reset' class='btn btn-default'" );
			?>
		</div>  <!-- .box-footer -->
	</div> <!-- .box -->

<?php if($result)  { ?>

	<section class="content-header">
		<h1>Report <small><?php echo $_POST['f_name'];?></small></h1>
		<span class="breadcrumb">
		<a class="btn btn-sm" title="Excel" id="button-excel1" onClick="cetakExcel(<?php echo $this->input->get_post('f_name_id').",".$this->input->get_post('f_event_id');?>)"><i class="fa fa-file-excel-o fa-2x"></i></a>
		<a class="btn btn-sm" title="Print" id="button-print"><i class="fa fa-print fa-2x"></i></a>
		</span>
	</section>
	<br/>

<div id="toPrint"> <!-- Start PrintArea-->
	
	<div class="row">
		<div class="col-md-12">
		<!-- content di sini -->
		<!-- -----------------------------------------------
			 halaman sampul
			 @ nama account
			 @ nama sistem
			 @ tanggal renderasi report
			------------------------------------------------ -->

			<div class="box box-solid box-default">
				<div class="box-header">
					<?php echo $_POST['f_name'];?>
					<div class="box-tools pull-right">
						<p>Periode : <?php echo $_POST['f_event'];?></p>
					</div> <!-- /.box-tool -->		
				</div>
				<div class="box-body">
					<h1 style="text-align:center"> &nbsp; <br> <?php echo $_POST['f_name'];?> <br> (<?php echo count($result);?>) </h1>
					<p  style="text-align:center">Prepared by: <?php echo $this->session->userdata('sName');?> <br> <?php echo date('M d, Y');?></p>
				</div>
			</div>
		</div> <!-- /.col-md-12 -->
	</div> <!-- /.row -->
		
	<div class="page-break"></div>
	
	<div class="box box-solid"> <!-- start .box -->
		<div class="box-body"> <!-- start .box-body -->
<?php
		// Lembar 1
		$i=1; $data_pensiun = array(); $data_pensiun1 = array(); $total_pensiun =0; $total_pensiun1 =0;
		foreach($result as $a)
		{
			$h=0;$j=0; $modus = array();
			foreach($subkategori[1] as $b => $c)
			{
				$d = $a['f_survey']['subkategori'][$b];
				foreach($a['f_survey']['subkategori'][$b] as $e => $f)
				{
					if($e == 6 && $f['urut'] == $d[1]['urut'] || $e == 7 && $f['urut'] == $d[2]['urut'] || $e == 8 && $f['urut'] == $d[3]['urut'] || $e == 9 && $f['urut'] == $d[4]['urut'] || $e == 10 && $f['urut'] == $d[5]['urut'])
					{
						$hasil_akhir = 0;
					}
					else
					{
						$hasil_akhir = $f['jawab'];
					}
					
					//echo "<td>".$hasil_akhir."</td>";
					$modus[$h] = $hasil_akhir;
					$j += $hasil_akhir;
					$h++;
				}
			}
			// Total Kesiapan dan Hasilnya
			//echo "<td>".$j."</td>";
			//echo "<td>".kesiapan($j)."</td>";
			$data_pensiun[kesiapan($j)] += 1;
			$total_pensiun += 1;

			// Modus dan Hasilnya
			$values = array_count_values($modus);
			asort($values);
			$hmodus = array_search(max($values), $values); 
			//echo "<td>".$hmodus."</td>";
			//echo "<td>".tipe_pensiun($hmodus)."</td>";
			$data_pensiun1[tipe_pensiun($hmodus)] += 1;
			//echo "</tr>";
			$i++;
		}		

		
		//echo "<pre>";echo print_r($hmodus)."</pre><br/>";
		//echo "<pre>";echo print_r($cemas)."</pre><br/>";

$pensiun = array(
	0 => 'Sangat Siap',
	1 => 'Siap',
	2 => 'Belum Cukup Siap',
	3 => 'Kurang Siap',
	4 => 'Tidak Siap',
	5 => 'Sangat Tidak Siap',
);

	//krsort($pensiun);
	//echo "<pre>";echo print_r($pensiun)."</pre><br/>";
?>

	<!-- Data Pertama  -->
	<div class="row">
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Keterangan Skor</th>
						<th style="text-align:center;">Q</th>
						<th style="text-align:center;">%</th>
					</tr>
				</thead>
				<tbody>
				<?php
					$total = 0;
					foreach($pensiun as $a => $b)
					{
						echo "<tr>";
						echo "<td>".$b."</td>";
						$st = ($data_pensiun[$b]) ? $data_pensiun[$b]:0;
						echo "<td style=\"text-align:center;\">".$st."</td>";
						$p1 = ($st) ? round(($st*100)/$total_pensiun,2):0;
						echo "<td style=\"text-align:center;\">".$p1." %</td>";
						echo "</tr>";
						$total += $st;
					}
				?>	
				</tbody>
				<tfoot>
					<tr>
						<th>Total Peserta</th>
						<th  style="text-align:center;"><?php echo $total;?></th>
						<th></th>
					</tr>
				</tfoot>
			</table>
		</div> <!-- /.col-md-6 -->
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor2">
				<thead>
					<tr>
						<th>Hasil Analisa Tingkat Kesiapan Pensiun</th>
						<th>%</th>
					</tr>
				</thead>
				<tbody>
				<?php
					krsort($pensiun); 
					$pie1 = array(
						"name" => 'Brands',
						"colorByPoint" => true,
					);			
					foreach($pensiun as $a => $b)
					{
						echo "<tr>";
						echo "<td>Peserta Yang ".$b."</td>";
						$st = ($data_pensiun[$b]) ? round(($data_pensiun[$b]*100)/$total,2):0;
						echo "<td style=\"text-align:center;\">".$st." %</td>";
						echo "</tr>";
						$pie1['data'][] = array(
							'name' => $b,
							'y' => $st,
						);
					}
				?>	
				</tbody>
			</table>
		</div> <!-- /.col-md-6 -->
		<div class="col-md-12">
			<div id="pie1" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
		</div>
	</div> <!-- /.row -->
	<div class="page-break"></div>

	<!-- Data Kedua  -->
<?php
$tipe_pensiun = array(
	1 => 'Berlibur',
	2 => 'Istirahat',
	3 => 'Aktif',
	4 => 'Terencana',
);
krsort($tipe_pensiun);
	//echo "<pre>";echo print_r($tipe_pensiun)."</pre><br/>";

?>
	<div class="row">
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Kode</th>
						<th>Tipe Pensiun</th>
						<th>Tallies</th>
					</tr>
				</thead>
				<tbody>
				<?php
					$total = 0;
					foreach($tipe_pensiun as $a => $b)
					{
						echo "<tr>";
						echo "<td>".$a."</td>";
						echo "<td>".$b."</td>";
						$st = ($data_pensiun1[$b]) ? $data_pensiun1[$b]:0;
						echo "<td style=\"text-align:center;\">".$st."</td>";
						echo "</tr>";
						$total += $st;
					}
				?>	
				</tbody>
				<tfoot>
					<tr>
						<th colspan="2">Total Peserta</th>
						<th style="text-align:center;"><?php echo $total;?></th>
					</tr>
				</tfoot>
			</table>
		</div>
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Hasil Analisa Tipe Pensiun</th>
						<th>%</th>
					</tr>
				</thead>
				<tbody>
				<?php
					ksort($tipe_pensiun);
					$pie2 = array(
						"name" => 'Brands',
						"colorByPoint" => true,
					);
					foreach($tipe_pensiun as $a => $b)
					{
						echo "<tr>";
						echo "<td>Peserta Yang Masih Dalam Tipe ".$b."</td>";
						$st = ($data_pensiun1[$b]) ? round(($data_pensiun1[$b]*100)/$total,2):0;
						echo "<td style=\"text-align:center;\">".$st." %</td>";
						echo "</tr>";
						$pie2['data'][] = array(
							'name' => $b,
							'y' => $st,
						);
					}
				?>	
				</tbody>
			</table>
		</div>
		<div class="col-md-12">
			<div id="pie2" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
		</div>
	</div>

	<div class="page-break"></div>	
	
	<!-- Data Laporan Kecemasan-->
<?php

	// Lembar 2
	$i=1; $data_cemas = array(); $data_cemas1 = array();
	foreach($result as $a)
	{
		$h=0;$j=0; $modus = array();
		foreach($subkategori[2] as $b => $c)
		{
			$d = $a['f_survey']['subkategori'][$b];
			foreach($a['f_survey']['subkategori'][$b] as $e => $f)
			{
				if($e == 16 && $f['urut'] == $d[11]['urut'] || $e == 17 && $f['urut'] == $d[12]['urut'] || $e == 18 && $f['urut'] == $d[13]['urut'] || $e == 19 && $f['urut'] == $d[14]['urut'] || $e == 20 && $f['urut'] == $d[15]['urut'])
				{
					$hasil_akhir = 0;
				}
				else
				{
					$hasil_akhir = $f['jawab'];
				}
				
				$cemas[$i][$hasil_akhir] .= $c['desc'].',';
				//$data_cemas1[$hasil_akhir][$c['desc']] += 1;
				$modus[$h] = $hasil_akhir;
				$j += $hasil_akhir;
				$h++;
			}
		}
		
		// Total Kesiapan dan Hasilnya
		//echo "<td>".$j."</td>";
		//echo "<td>".kecemasan($j)."</td>";
		$data_cemas[kecemasan($j)] += 1;
		// Modus dan Hasilnya
		//echo "<pre>$i Modus ";echo print_r($modus)."</pre><br/>";
		$values[$i] = array_count_values($modus);
		//echo "<pre>$i values 1 ";echo print_r($values[$i])."</pre><br/>";
		ksort($values[$i]);
		//echo "<pre>$i values 2 ";echo print_r($values[$i])."</pre><br/>";
		//echo "<pre>$i values Key = ";echo key($values[$i])."</pre><br/>";
		//echo "<pre>Min 1 ";echo print_r(min($values))."</pre><br/>";
		$hmodus = array_search(key($values[$i]), $values[$i]); 
		$hmodus1[$i] = array_search(key($values[$i]), $values[$i]); 
		//$trim = trim($cemas[$i][$hmodus],',');
		$trim = trim($cemas[$i][key($values[$i])],',');
		//echo "<td>".$trim."</td>";
		$explode = explode(',',$trim);
		foreach($explode as $x => $y)
		{
			$data_cemas1[$y] +=1;
		}
		//echo "<pre>$i Hasil Modus ";echo $hmodus1[$i]."</pre><br/>";
		//echo "</tr>";
		$i++;
	}

$cemas = array(
	0 => array("range" => "< 20","name" => "Panik"),
	1 => array("range" => "21 - 23","name" => "Agak Panik"),
	2 => array("range" => "24 - 27","name" => "Kecemasan Sedang"),
	3 => array("range" => "28 - 31","name" => "Cukup Cemas"),
	4 => array("range" => "> 32","name" => "Kecemasan Ringan"),
);

$cemas1 = array(
	0 => array('val'=>'Hilang Pekerjaan','name'=>'Kehilangan Pekerajaan'),
	1 => array('val'=>'Hilang Keuangan','name'=>'Kehilangan Sumber Keuangan'),
	2 => array('val'=>'Hilang Rekan','name'=>'Kehilangan Rekan Kerja'),
	3 => array('val'=>'Hilang Kesehatan','name'=>'Menurunnya Tingkar Kesehatan'),
	4 => array('val'=>'Hilang Jabatan','name'=>'Kehilangan Jabatan'),
);
?>	
	<div class="row">
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Range Skor</th>
						<th>Tallies</th>
						<th>Tipe Kecemasan Pensiun</th>
					</tr>
				</thead>
				<tbody>
				<?php
					$total1 = 0;
					foreach($cemas as $a => $b)
					{
						echo "<tr>";
						echo "<td>".$b['range']."</td>";
						$st = ($data_cemas[$b['name']]) ? $data_cemas[$b['name']]:0;
						echo "<td style=\"text-align:center;\">".$st."</td>";
						echo "<td>".$b['name']."</td>";
						echo "</tr>";
						$total1 += $st;
					}
				?>	
				</tbody>
				<tfoot>
					<tr>
						<th>Total</th>
						<th style="text-align:center;"><?php echo $total1;?></th>
						<th></th>
					</tr>
				</tfoot>
			</table>
		</div>
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Range</th>
						<th>Tipe Kecemasan</th>
						<th>Persentase</th>
					</tr>
				</thead>
				<tbody>
				<?php
					$pie3 = array(
						"name" => 'Brands',
						"colorByPoint" => true,
					);
					
					foreach($cemas as $a => $b)
					{
						echo "<tr>";
						echo "<td>".$b['range']."</td>";
						echo "<td>".$b['name']."</td>";
						$st = ($data_cemas[$b['name']]) ? round(($data_cemas[$b['name']]*100)/ $total1,2) :0;
						echo "<td style=\"text-align:center;\">".$st." %</td>";
						echo "</tr>";
						$pie3['data'][] = array(
							'name' => $b['name'],
							'y' => $st,
						);
					}
				?>	
				</tbody>
			</table>
		</div>
		<div class="col-md-12">
			<div id="pie3" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
		</div>
	</div>
	
	<div class="page-break"></div>	

	<div class="row">
		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Penyebab Kecemasan Utama</th>
						<th>Tallies</th>
					</tr>
				</thead>
				<tbody>
				<?php
					$total1 = 0;
					foreach($cemas1 as $a => $b)
					{
						echo "<tr>";
						echo "<td>".$b['name']."</td>";
						$st = ($data_cemas1[$b['val']]) ? $data_cemas1[$b['val']]:0;
						echo "<td style=\"text-align:center;\">".$st."</td>";
						echo "</tr>";
						$total1 += $st;
					}
				?>	
				</tbody>
				<tfoot>
					<tr>
						<th>Total Penyebab Kecemasan</th>
						<th style="text-align:center;"><?php echo $total1;?></th>
					</tr>
				</tfoot>
			</table>
		</div>

		<div class="col-md-6">
			<table class="table tabled-bordered tabled-striped" id="nomor3">
				<thead>
					<tr>
						<th>Tipe Kecemasan Utama</th>
						<th>%</th>
					</tr>
				</thead>
				<tbody>
				<?php
					$pie4 = array(
						"name" => 'Brands',
						"colorByPoint" => true,
					);
					foreach($cemas1 as $a => $b)
					{
						echo "<tr>";
						echo "<td>".$b['name']."</td>";
						$st = ($data_cemas1[$b['val']]) ? round(($data_cemas1[$b['val']]*100)/$total1,2):0;
						echo "<td style=\"text-align:center;\">".$st." %</td>";
						echo "</tr>";
						$pie4['data'][] = array(
							'name' => $b['name'],
							'y' => $st,
						);
					}
				?>	
				</tbody>
			</table>
		</div>

		<div class="col-md-12">
			<div id="pie4" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
		</div>
			
	</div>
		</div> <!-- end .box-body -->
		<div class="box-footer" align="right"> <!-- start box-footer -->
		  <p>Page rendered in <strong>{elapsed_time}</strong> seconds</p>
		</div> <!-- end .box-footer-->
	</div> <!-- end .box -->

</div> <!-- End PrintArea-->

<?php
	//echo "<pre>";echo print_r($data_cemas1)."</pre><br/>";
	//echo "<pre>";echo json_encode($pie3)."</pre><br/>";
} // end if result
?>

</section><!-- /.content -->

<script src="<?php echo ASSETS_URL;?>plugins/highcharts/highcharts.js" type="text/javascript"></script>
<script src="<?php echo ASSETS_URL;?>plugins/highcharts/highcharts-more.js" type="text/javascript"></script>
<script src="<?php echo ASSETS_URL;?>plugins/highcharts/modules/exporting.js" type="text/javascript"></script>

<script>
var oTable; var optionPie;
$(document).ready(function(){
	$('#frmResponden').validate({
		highlight: function(element, errorClass, validClass) {
			$(element).parents('.form-group').removeClass('has-success').addClass('has-error');
		},
		unhighlight: function(element, errorClass, validClass) {
			$(element).parents('.form-group').removeClass('has-error').addClass('has-success');
		}		
	});
	
	$('#f_name').bootcomplete({
		minLength : 2,
		url: '<?php echo site_url('responden/fnListCustomers');?>',
	});

	$('#f_event').bootcomplete({
		minLength : 0,
		//url: '<?php echo site_url('responden/reports/fnListCustomersEvent');?>/'+$('#f_name_id').val()+'/',
		url: '<?php echo site_url('responden/reports/fnListCustomersEvent');?>',
		formParams: {
            'group' : $('#f_name_id')
        }
	});
	
	$('#button-cari').click(function(e)	{
		e.preventDefault();
		if($("#f_name_id").val() > 0 && $("#f_event_id").val() > 0 )
		{
			$("#frmResponden").submit();
		}
		else
		{
			infoDialog.realize();
			infoDialog.setTitle('Info').setMessage('<center>Customers/Event belum terdaftar !!</center>').setType(BootstrapDialog.TYPE_DANGER).open();
		}
		
	});
<?php if($result)  {	?>
	//$("#lembar11").dataTable({
        //"sScrollY": "250px",
        //"bPaginate": false,
        //"bScrollCollapse": true,
        //"bSort": false,
        //"bAutoWidth": false,
		////"aoColumns": [ 
			////{'sClass':'center'}, {'sClass':'left'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, null, {'sClass':'center'}, null, 
		////]
	//});

	////$("#no2").dataTable({
        //////"scrollY":        "300px",
        //////"scrollCollapse": true,
        //////"paging":         false,
		////"aoColumns": [ 
			////{'sClass':'center'}, null, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'}, {'sClass':'center'},  
		////]
	////});
	
	//$(".dataTables_filter input").attr("placeholder","Cari Kata disini ...");

	$("#button-excel").click(function(e){
		BootstrapDialog.confirm({
            title: 'WARNING',
            message: 'Anda akan melakukan Export data mentah ?',
            type: BootstrapDialog.TYPE_WARNING, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
            //closable: false, // <-- Default value is false
            //draggable: false, // <-- Default value is false
            btnCancelLabel: 'Batal', // <-- Default value is 'Cancel',
            btnOKLabel: 'Lanjut !', // <-- Default value is 'OK',
            btnOKClass: 'btn-warning', // <-- If you didn't specify it, dialog type will be used,
            callback: function(result) {
                if(result) {
                    alert('Yup.');
                }
            }
        });
	});
	
	optionPie = {
		chart: {
			plotBackgroundColor: null,
			plotBorderWidth: null,
			plotShadow: false,
			type: 'pie'
		},
		title: {
			text: ''
		},
		tooltip: {
			pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
		},
		plotOptions: {
			pie: {
				allowPointSelect: true,
				cursor: 'pointer',
				//dataLabels: {
					//enabled: false
				//},
				dataLabels: {
	                enabled: true,
	                format: '<b>{point.name}</b>: {point.percentage:.1f} %',
	                style: {
	                    color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
	                }
	            },				
				showInLegend: true
			}
		},
		series: [],
		credits : {enabled : false},
	};
	
    optionPie.chart.renderTo = 'pie1';
    optionPie.title.text = 'Hasil Analisa<br/>Tingkat Kesiapan Pensiun';
    optionPie.series[0]	= <?php echo json_encode($pie1,JSON_NUMERIC_CHECK);?>;
    var chart1 = new Highcharts.Chart(optionPie);

    optionPie.chart.renderTo = 'pie2';
    optionPie.title.text = 'Hasil Analisa<br/>Tipe Pensiun';
    optionPie.series[0]	= <?php echo json_encode($pie2,JSON_NUMERIC_CHECK);?>;
    var chart2 = new Highcharts.Chart(optionPie);

    optionPie.chart.renderTo = 'pie3';
    optionPie.title.text = 'Hasil Analisa<br/>Tingkat Kecemasan Pensiun';
    optionPie.series[0]	= <?php echo json_encode($pie3,JSON_NUMERIC_CHECK);?>;
    var chart3 = new Highcharts.Chart(optionPie);

    optionPie.chart.renderTo = 'pie4';
    optionPie.title.text = 'Proporsi Penyebab<br/>Kecemasan Utama';
    optionPie.series[0]	= <?php echo json_encode($pie4,JSON_NUMERIC_CHECK);?>;
    var chart4 = new Highcharts.Chart(optionPie);
    
<?php }	?>
<?php if($this->session->userdata('SUCMSG'))
{	
	echo "infoDialog.realize();";
	echo "infoDialog.setTitle('Info').setMessage('<center>".$this->session->userdata('SUCMSG')."</center>').open();";
	$this->session->unset_userdata('SUCMSG');
}
?>
});

function cetakExcel(x,y)
{
	BootstrapDialog.confirm({
		title: 'WARNING',
		message: 'Anda akan melakukan Export data mentah ?',
		type: BootstrapDialog.TYPE_WARNING, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
		//closable: false, // <-- Default value is false
		//draggable: false, // <-- Default value is false
		btnCancelLabel: 'Batal', // <-- Default value is 'Cancel',
		btnOKLabel: 'Lanjut !', // <-- Default value is 'OK',
		btnOKClass: 'btn-warning', // <-- If you didn't specify it, dialog type will be used,
		callback: function(result) {
			if(result) {
				window.location.href = "<?php echo site_url('responden/reports/cetakExcel');?>/"+x+"/"+y;
				//window.location.href = "<?php echo site_url('responden/simulasi');?>/"+x+"/"+y;
			}
		}
	});	
}
</script>

<style>
aside.right-side{
	font-size:13px;
	background: #ffffff;
}
table th {
	background-color:#D2D6DE;
}

table.plot tr td{
	padding:0 3px;
	border-bottom:1px solid #D2D6DE;
	border-collapse:collapse;
}

table.keterangan tr td{
	padding:2px 10px;
	border-collapse:collapse;
}

@media all {
 .page-break  { display: none; }
}

@media print {
 .page-break  { display: block; page-break-before: always; }
 table th {
	background-color:#D2D6DE;
}

}
</style>

<?php if($result)  {	?>
<script src="<?php echo ASSETS_URL;?>plugins/jQuery/jquery-1.4.2.min.js"></script>
<script src="<?php echo ASSETS_URL;?>plugins/jquery.printElement.min.js" type="text/javascript"></script>

<script>
var j = jQuery.noConflict();
j("#button-print").click(function() {
		printElem({ overrideElementCSS: ['<?php echo ASSETS_URL;?>bootstrap/css/bootstrap.min.css','<?php echo ASSETS_URL;?>AdminLTE/css/AdminLTE.min.css','<?php echo ASSETS_URL;?>css/report.css'] });
});

function printElem(options){
 j('#toPrint').printElement(options);
}
</script>
<?php }	?>


