

<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Statistik</title>
		<script type="text/javascript" src="jquery.js"></script>
		<script src="jquery.min.js"></script>
		<script src="highcharts.js"></script>
	<script src="exporting.js"></script>
	<script src="jquery-ui.js"></script>
	<script src="jquery.ui.datepicker-id.js"></script>
	<link rel="stylesheet" href="jquery-ui.css">
	<link rel="stylesheet" href="jquery-ui.theme.css">
	<script src="multiple-select.js"></script>
		<link rel="stylesheet" href="multiple-select.css"/>
		
		
<?php
/*koneksi*/
error_reporting(2);
$db = new mysqli('localhost', 'kiosbarc_antrian_online' ,'kiosbarc_antrian_online2019', 'kiosbarc_antrian_online');
/*akhir-koneksi*/ 
 #ambil data wilayah--
$query = "SELECT distinct(kode_wilayah)as kode_wilayah FROM kode_cabang order by kode_wilayah";
$sql = mysqli_query($db, $query);
$arrkodewilayah = array();
while ($row = mysqli_fetch_assoc($sql)) {
	$arrkodewilayah [ $row['kode_wilayah'] ] = $row['kode_wilayah'];
}

/*ambil data jenistransaksi*/
if(isset($_POST['Pilih'])) {
			if((empty($_POST['datepickerawal']))||(empty($_POST['datepickerakhir']))||(empty($_POST['namacabang']))||(!isset($_POST['mintunggu']))||(!isset($_POST['mintunggu']))||(!isset($_POST['mintransaksi']))||(!isset($_POST['maxtransaksi']))){
			die("Maaf, tidak boleh ada inputan yang kosong");
			}elseif
				($_POST['mintunggu']>=$_POST['maxtunggu']||$_POST['mintransaksi']>=$_POST['maxtransaksi']){
				die("Maaf, min waktu tunggu/transaksi tidak boleh sama atau lebih besar dari max waktu tunggu/transaksi");
			}else{
				if(substr($_POST['namacabang'],0,3)=='aal'){
					$jumlahtransaksi = mysqli_query($db,"select iduser,count(nomorantrian) as jml,count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."'  
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by iduser");
	
				$jumlahtransaksipie = mysqli_query($db,"select count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)."");	  
				$lamatunggu=mysqli_query($db,"select substring(nomorantrian,1,1)as kode,jenistrx,cast(AVG( TIMEDIFF(waktupanggil,waktudatang)/60)as UNSIGNED)AS lamatunggu
				from nasabahdipanggil where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." group by kode");
				$lamatransaksi=mysqli_query($db,"select substring(nomorantrian,1,1)as kode,jenistrx,cast(AVG(TIMEDIFF(waktufinish,waktustart)/60)as UNSIGNED)AS lamatransaksi
				from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by kode");
			  
			 
				$data_jumlahtransaksi = array();
			while($row_jumlahtransaksi = mysqli_fetch_array($jumlahtransaksi)) {
				$data_jumlahtransaksi[] = $row_jumlahtransaksi;
			}
			$data_jumlahtransaksipie = array();
			while($row_jumlahtransaksipie = mysqli_fetch_array($jumlahtransaksipie)) {
			$data_jumlahtransaksipie[] = $row_jumlahtransaksipie;
			}
			$data_lamatunggu = array();
			while($row_lamatunggu = mysqli_fetch_array($lamatunggu)) {
			$data_lamatunggu[] = $row_lamatunggu;
			}
			$data_lamatransaksi = array();
			while($row_lamatransaksi = mysqli_fetch_array($lamatransaksi)) {
				$data_lamatransaksi[] = $row_lamatransaksi;
			}
			
			}elseif(substr($_POST['namacabang'],0,3)=='all'){
				die("select iduser,count(nomorantrian) as jml,count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang in(select id FROM kode_cabang WHERE kode_wilayah = substring('" .$_POST['namacabang']."',4)) 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by iduser");
				$jumlahtransaksi = mysqli_query($db,"select iduser,count(nomorantrian) as jml,count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang in(select id FROM kode_cabang WHERE kode_wilayah = substring('" .$_POST['namacabang']."',4)) 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by iduser");
			  
			$jumlahtransaksipie = mysqli_query($db,"select count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang in(select id FROM kode_cabang WHERE kode_wilayah = substring('" .$_POST['namacabang']."',4)) 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)."");	  
$lamatunggu=mysqli_query($db,"select substring(nomorantrian,1,1)as kode,jenistrx,cast(AVG( TIMEDIFF(waktupanggil,waktudatang)/60)as UNSIGNED)AS lamatunggu
	from nasabahdipanggil where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang in(select id FROM kode_cabang WHERE kode_wilayah = substring('" .$_POST['namacabang']."',4))
and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by kode");
$lamatransaksi=mysqli_query($db,"select substring(nomorantrian,1,1)as kode,jenistrx,cast(AVG(TIMEDIFF(waktufinish,waktustart)/60)as UNSIGNED)AS lamatransaksi
	from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang in(select id FROM kode_cabang WHERE kode_wilayah = substring('" .$_POST['namacabang']."',4)) and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by kode");
			  
	$data_jumlahtransaksi = array();
	while($row_jumlahtransaksi = mysqli_fetch_array($jumlahtransaksi)) {
		$data_jumlahtransaksi[] = $row_jumlahtransaksi;
	}
	$data_jumlahtransaksipie = array();
	while($row_jumlahtransaksipie = mysqli_fetch_array($jumlahtransaksipie)) {
		$data_jumlahtransaksipie[] = $row_jumlahtransaksipie;
	}
	$data_lamatunggu = array();
	while($row_lamatunggu = mysqli_fetch_array($lamatunggu)) {
		$data_lamatunggu[] = $row_lamatunggu;
	}
	$data_lamatransaksi = array();
	while($row_lamatransaksi = mysqli_fetch_array($lamatransaksi)) {
		$data_lamatransaksi[] = $row_lamatransaksi;
	}
				
}else{
$jumlahtransaksi = mysqli_query($db,"select iduser,count(nomorantrian) as jml,count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang ='" .$_POST['namacabang'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)."
			  group by iduser");
			  
$jumlahtransaksipie = mysqli_query($db,"select count(case when substring(nomorantrian,1,1)='A' then 1 else null end)setor
              ,count(case when substring(nomorantrian,1,1)='B'then 1 else null end)tarik
              ,count(case when substring(nomorantrian,1,1)='C'then 1 else null end)transferdebet
              ,count(case when substring(nomorantrian,1,1)='D'then 1 else null end)transaksilain
			  ,count(case when substring(nomorantrian,1,1)='E'then 1 else null end)openacc
              ,count(case when substring(nomorantrian,1,1)='F'then 1 else null end)cslayananlain
			  ,count(case when substring(nomorantrian,1,1)='G'then 1 else null end)pengajuan
              ,count(case when substring(nomorantrian,1,1)='H'then 1 else null end)lslayananlain
              from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang ='" .$_POST['namacabang'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)."");	  
$lamatunggu=mysqli_query($db,"select substring(nomorantrian,1,1)as kode,jenistrx,cast(AVG( TIMEDIFF(waktupanggil,waktudatang)/60)as UNSIGNED)AS lamatunggu
	from nasabahdipanggil where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang ='" .$_POST['namacabang'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by kode");
$lamatransaksi=mysqli_query($db,"select substring(nomorantrian,1,1)as kode,jenistrx,cast(AVG(TIMEDIFF(waktufinish,waktustart)/60)as UNSIGNED)AS lamatransaksi
	from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and idcabang ='" .$_POST['namacabang'] ."' and TIMESTAMPDIFF(second,waktudatang,waktupanggil)>=" .($_POST['mintunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktudatang,waktupanggil)<=" .($_POST['maxtunggu']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)>=" .($_POST['mintransaksi']*60)." 
			  and TIMESTAMPDIFF(second,waktustart,waktufinish)<=" .($_POST['maxtransaksi']*60)." group by kode");	
	
$data_jumlahtransaksi = array();
	while($row_jumlahtransaksi = mysqli_fetch_array($jumlahtransaksi)) {
		$data_jumlahtransaksi[] = $row_jumlahtransaksi;
	}
	$data_jumlahtransaksipie = array();
	while($row_jumlahtransaksipie = mysqli_fetch_array($jumlahtransaksipie)) {
		$data_jumlahtransaksipie[] = $row_jumlahtransaksipie;
	}
	$data_lamatunggu = array();
	while($row_lamatunggu = mysqli_fetch_array($lamatunggu)) {
		$data_lamatunggu[] = $row_lamatunggu;
	}
	$data_lamatransaksi = array();
	while($row_lamatransaksi = mysqli_fetch_array($lamatransaksi)) {
		$data_lamatransaksi[] = $row_lamatransaksi;
	}
}
$jamsibuk=mysqli_query($db,"select count(nomorantrian) as jml,hour(waktudatang)as jam
	from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."' and hour(waktudatang)>=7 and hour(waktudatang)<=16 group by jam");
$tglsibuk=mysqli_query($db,"select count(nomorantrian) as jml,day(waktudatang)as day
	from transaksi where date(waktudatang)>='".$_POST['datepickerawal'] ."' and date(waktudatang)<='" .$_POST['datepickerakhir'] ."'  group by day");	
			$data_jamsibuk = array();
			while($row_jamsibuk = mysqli_fetch_array($jamsibuk)) {
			$data_jamsibuk[] = $row_jamsibuk;
			}
			$data_tglsibuk = array();
			while($row_tglsibuk = mysqli_fetch_array($tglsibuk)) {
			$data_tglsibuk[] = $row_tglsibuk;
			}
}
}
?>

		<script>
		<!--datepicker-->
	
	$(document).ready(function(){
		$('.tanggal-awal').datepicker({dateFormat:'yy-mm-dd'});
		$('.tanggal-akhir').datepicker({dateFormat:'yy-mm-dd'});	
	});
		</script>
		<script>
		$(document).ready(function(){
 $("#kode_wilayah").change(function(){
  var kode_wilayah=$('#kode_wilayah').val();
  $.ajax({
  
		url:"ajax_cabang.php",
		 data: "kode_wilayah=" + kode_wilayah,
		success: function(data){		
		$('#namacabang').html(data);
		}
	});
  });
 });
			</script>
		<script type="text/javascript">
		
				

$(function () {
	  $('#jumlahtransaksi').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {
                enabled: true,
                alpha: 2,
                beta: 10,
                depth: 80
            }
        },
        title: {
            text: 'Jumlah Transaksi'
        },
        subtitle: {
            text: ''
        },
        plotOptions: {
            
			
			column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        xAxis: {
           categories: [ <?php foreach($data_jumlahtransaksi as $value): ?>
						'<?= $value['iduser'] ?>',
						<?php endforeach; ?> ]
        },
        yAxis: {
             title: {
                text: 'Dalam Satuan'
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'red'
                }
            }
        },
        series: [{
            name: 'Setor',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['setor'] ?>,  <?php endforeach; ?> ]
        }, {
            name: 'Tarik',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['tarik'] ?>,  <?php endforeach; ?> ]
        },{
            name: 'Transfer Debet',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['transferdebet'] ?>,  <?php endforeach; ?> ]
        },{
            name: 'Transaksi Lain',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['transaksilain'] ?>,  <?php endforeach; ?> ]
        },{
            name: 'Open Acc',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['openacc'] ?>,  <?php endforeach; ?> ]
        },{
            name: 'CS - Layanan Lain',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['cslayananlain'] ?>,  <?php endforeach; ?> ]
        },{
            name: 'Pengajuan',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['pengajuan'] ?>,  <?php endforeach; ?> ]
        },{
            name: 'LS - Layanan Lain',
            data: [ <?php foreach($data_jumlahtransaksi as $value): ?>  <?= $value['lslayananlain'] ?>,  <?php endforeach; ?> ]
        }]
    });
    


$('#jumlahtransaksipie').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'Presentase Jumlah Transaksi '
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.y:.0f} ({point.percentage:.1f})%</b>'
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true,
						format: '{point.y:.0f} ({point.percentage:.1f})%',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                    },
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Persentase share',
                data: [
                    ['Setor', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['setor'] ?><?php endforeach; ?>],
                    ['Tarik', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['tarik'] ?><?php endforeach; ?>],
                    ['Teller-Transfer Debet', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['transferdebet'] ?><?php endforeach; ?>],
                    ['Transaksi Lain', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['transaksilain'] ?><?php endforeach; ?>],
										{
                        name: 'Open Acc',
                        y: <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['openacc'] ?><?php endforeach; ?>,
                        sliced: true,
                        selected: true
                    },
					['CS - Layanan Lain', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['cslayananlain'] ?><?php endforeach; ?>],
					['Pengajuan', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['pengajuan'] ?><?php endforeach; ?>],
					['LS - Layanan Lain', <?php foreach($data_jumlahtransaksipie as $value): ?><?= $value['lslayananlain'] ?><?php endforeach; ?>]
                ]
            }]
        });

    
		
	$('#lamatunggu').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {
                enabled: true,
                alpha: 2,
                beta: 10,
                depth: 80
            }
        },
        title: {
            text: 'Rata-rata Lama Tunggu'
        },
        subtitle: {
            text: ''
        },
        plotOptions: {
            
			
			column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        xAxis: {
           categories: [ <?php foreach($data_lamatunggu as $value): ?>
						'<?= $value['jenistrx'] ?>',
						<?php endforeach; ?> ]
        },
        yAxis: {
             title: {
                text: 'Dalam Menit'
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'red'
                }
            }
        },
        series: [{
            name: 'Lama Tunggu',
            data: [ <?php foreach($data_lamatunggu as $value): ?>  <?= $value['lamatunggu'] ?>,  <?php endforeach; ?> ]
        }]
    });
	$('#lamatransaksi').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {
                enabled: true,
                alpha: 2,
                beta: 10,
                depth: 80
            }
        },
        title: {
            text: 'Rata-rata Lama Transaksi'
        },
        subtitle: {
            text: ''
        },
        plotOptions: {
            
			
			column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        xAxis: {
           categories: [ <?php foreach($data_lamatransaksi as $value): ?>
						'<?= $value['jenistrx'] ?>',
						<?php endforeach; ?> ]
        },
        yAxis: {
             title: {
                text: 'Dalam Menit'
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'red'
                }
            }
        },
        series: [{
            name: 'Lama Transaksi',
            data: [ <?php foreach($data_lamatransaksi as $value): ?>  <?= $value['lamatransaksi'] ?>,  <?php endforeach; ?> ]
        }]
    });
	
	$('#jamsibuk').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {
                enabled: true,
                alpha: 2,
                beta: 10,
                depth: 80
            }
        },
        title: {
            text: 'Jam Kedatangan'
        },
        subtitle: {
            text: ''
        },
        plotOptions: {
            
			
			column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        xAxis: {
           categories: [ <?php foreach($data_jamsibuk as $value): ?>
						'<?= $value['jam'] ?>',
						<?php endforeach; ?> ]
        },
        yAxis: {
             title: {
                text: 'Dalam Satuan'
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'red'
                }
            }
        },
        series: [{
            name: 'Nasabah',
            data: [ <?php foreach($data_jamsibuk as $value): ?>  <?= $value['jml'] ?>,  <?php endforeach; ?> ]
        }]
    });
	
	$('#tglsibuk').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {
                enabled: true,
                alpha: 2,
                beta: 10,
                depth: 80
            }
        },
        title: {
            text: 'Tanggal Kedatangan'
        },
        subtitle: {
            text: ''
        },
        plotOptions: {
            
			
			column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        xAxis: {
           categories: [ <?php foreach($data_tglsibuk as $value): ?>
						'<?= $value['day'] ?>',
						<?php endforeach; ?> ]
        },
        yAxis: {
             title: {
                text: 'Dalam Satuan'
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'red'
                }
            }
        },
        series: [{
            name: 'Nasabah',
            data: [ <?php foreach($data_tglsibuk as $value): ?>  <?= $value['jml'] ?>,  <?php endforeach; ?> ]
        }]
    });
	
			
		
	
});
		</script>
		<style type="text/css">
    .login {
        margin: 50px auto;
        width: 265px;
        padding: 10px;
        border: 1px solid #ccc;
        background: lightblue;
    }
    
    input[type=submit] {
        margin 5px auto;
        float: right;
        padding: 5px;
        width: 90px;
        border: 1px solid #fff;
        color: #fff;
        background: red;
        cursor: pointer;
    }
</style>
	</head>
	
	<body>
	<div class="login">
	<form name="formdatepicker" action="" method="post">
	<input type="text" placeholder="Start Date" name="datepickerawal" class="tanggal-awal" style="width:125px">
	<input type="text" placeholder="End Date" name="datepickerakhir" class="tanggal-akhir" style="width:125px">
	<br>
		<br>
	<!--wilayah-->
		<select id="kode_wilayah" name="kode_wilayah"  style="width:250px">
		<option selected="true" disabled="disabled">Kode Wilayah</option>
		<option value="all">Semua Wilayah(ALL)</option>
			<?php
			foreach($arrkodewilayah as $kode_wilayah=>$kode_wilayah) {
				echo "<option value='$kode_wilayah'>$kode_wilayah</option>";
			}
			?>
		</select>
		<br/>
		<br/>
	<!--cabang-->
	
	<select id="namacabang" name="namacabang"  style="width:250px">
			<option selected="true" disabled="disabled">Pilih Cabang (ALL)</option>
		</select>
		<br/>
		<br/>
		<!--maxtunggu-->
	<select id="mintunggu" name="mintunggu" style="width:250px">
	<option selected="true" disabled="disabled">Min Waktu Tunggu (Minute)</option>
	<?php
	for($i=0;$i<=120;$i++){
		echo "<option value='$i'>$i</option>";
		$i+=4;
	}
	?>
	</select>
	<select id="maxtunggu" name="maxtunggu" style="width:250px">
	<option selected="true" disabled="disabled">Max Waktu Tunggu (Minute)</option>
	<?php
	for($i=0;$i<=120;$i++){
		echo "<option value='$i'>$i</option>";
		$i+=4;
	}
	?>
	</select>
	<br>
	<br>
	<!--maxtransaksi-->
	<select id="mintransaksi" name="mintransaksi" style="width:250px">
	<option selected="true" disabled="disabled">Min Waktu Transaksi (Minute)</option>
	<?php
	for($i=0;$i<=120;$i++){
		echo "<option value='$i'>$i</option>";
		$i+=4;
	}
	?>
	</select>
	<select id="maxtransaksi" name="maxtransaksi" style="width:250px">
	<option selected="true" disabled="disabled">Max Waktu Transaksi (Minute)</option>
	<?php
	for($i=0;$i<=120;$i++){
		echo "<option value='$i'>$i</option>";
		$i+=4;
	}
	?>
	</select>
	<br/>
		<br/>
	<input type="submit" name="Pilih" value="Submit"  />
	<br>
	<br>
	</form>
	</div>
	<table border="1" cellspacing="0" cellpadding="0" align="center">
<tr>
	<td colspan="2"><div id="jumlahtransaksi" style="width: 1280px; height: 400px; margin: 0 auto"></div></td>
	</tr>
	<tr>
	<td colspan="2"><div id="jumlahtransaksipie" style="height: 400px;width: 1280px"></div></td>
	</tr>
<tr>
<td colspan="2"><div id="lamatunggu" style="width: 1280px; height: 400px; margin: 0 auto"></div></td>
</tr>
<tr>
<td colspan="2"><div id="lamatransaksi" style="width: 1280px; height: 400px; margin: 0 auto"></div></td>
</tr>
<tr>
<td colspan="2"><div id="jamsibuk" style="height: 400px;width: 1280px;margin: 0 auto"></div></td>
</tr>
<tr>
<td colspan="2"><div id="tglsibuk" style="height: 400px;width: 1280px;margin: 0 auto"></div></td>
</tr>
</table>	

	</body>
	</html>