<!DOCTYPE html>
<html lang="en">
	<head>
		<?php $this->load->view('main/head');?>
		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="dek/assets/css/bootstrap.css" />
		<link rel="stylesheet" href="dek/assets/css/font-awesome.css" />
		
		<!-- text morris -->
		<link rel="stylesheet" href="dek/chart/morris.css" />

		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="dek/assets/css/jquery-ui.custom.css" />
		<link rel="stylesheet" href="dek/assets/css/chosen.css" />
		<link rel="stylesheet" href="dek/assets/css/datepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/bootstrap-timepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/daterangepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/bootstrap-datetimepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/colorpicker.css" />

		<!-- text fonts -->
		<link rel="stylesheet" href="dek/assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="dek/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		
		<!-- ace settings handler -->
		<script src="dek/assets/js/ace-extra.js"></script>
	</head>

	<body class="no-skin">
		<!-- #section:basics/navbar.layout -->
		<?php $this->load->view('main/menu_ndhuwur');?>

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<!-- #section:basics/sidebar.horizontal -->
			<?php $this->load->view('main/top_menu');?>

			<!-- /section:basics/sidebar.horizontal -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
						<!-- #section:settings.box -->
						
						<!-- /section:settings.box -->
						<div class="page-header">
							<h1>
								Pelayanan Medis
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									Grafik Report Pasien IGD 
								</small>
							</h1>
						</div><!-- /.page-header -->

						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<?php if($this->session->flashdata('error')!=''):?>
								<div class="alert alert-danger">
									<button type="button" class="close" data-dismiss="alert">
										<i class="ace-icon fa fa-times"></i>
									</button>
									<strong>
										<i class="ace-icon fa fa-times"></i>
										Pesan Kesalahan, 
									</strong>
									<?php echo $this->session->flashdata('error');?>
									<br />
								</div>
								<?php endif;?>
								<?php if($this->session->flashdata('pesan')!=''):?>
								<div class="alert alert-success">
									<button type="button" class="close" data-dismiss="alert">
										<i class="ace-icon fa fa-times"></i>
									</button>
									<strong>
										<i class="ace-icon fa fa-times"></i>
										Pesan,
									</strong>
									<?php echo $this->session->flashdata('pesan');?>
									<br />
								</div>
								<?php endif;?>
								<form class="form-horizontal" action="report-pasien-igd.html" method="post" role="form">
									<!-- #section:elements.form -->
									
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1-1"> Tahun Periode </label>

										<div class="col-sm-2">
											<div class="input-group">
												<input name="tglawal" class="form-control date-picker-tahun" id="id-date-picker-1" data-date-format="yyyy" type="text" placeholder="Masukan Tahun" />
												<span class="input-group-addon">
													<i class="fa fa-calendar bigger-110"></i>
												</span>
											</div>
										</div>
										<!--div class="col-sm-1 text-center"><span>s/d</span></div>
										<div class="col-sm-3">
											<div class="input-group">
												<input name="tglakhir"class="form-control date-picker" id="id-date-picker-1" type="text" data-date-format="yyyy-mm-dd" />
												<span class="input-group-addon">
													<i class="fa fa-calendar bigger-110"></i>
												</span>
											</div>
										</div-->
										
										<button class="btn btn-success btn-sm" type="submit" name="bProses">
											<i class="ace-icon fa fa-gear bigger-110"></i>
											Proses
										</button>
									</div>

									<!--div class="clearfix ">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info btn-sm" type="submit" name="bProses">
											<i class="ace-icon fa fa-gear bigger-110"></i>
											Proses
										</button>
										</div>
									</div-->
								</form>
								<hr>
						<?php //if(isset($_POST['bProses'])){ ?>		
						<div class="row">
							<div class="col-sm-12">
								<!-- PAGE CONTENT BEGINS -->	
								
								<div class="row">	
									<h3 class="header smaller lighter blue text-center">Rekap Data Pasien IGD By Dokter
										<br>
										<small style="color:#8c0000;">Periode : <?php echo $tahun;?></small></h3>
											
									<div class="col-sm-4">										
										<!--div class="clearfix">											
											<div class="pull-right" style="margin-right:20px; padding-bottom:20px;"> 
												<form action="exptoexcel-rekap-kunjungan.html" method="post" >
												<input type="hidden" value="<?php //echo $_POST['statusx'];?>" name="statusx">
												<input type="hidden" value="<?php //echo $_POST['followup'];?>" name="followup">
												<input type="hidden" value="<?php //echo $_POST['tglawal'];?>" name="tglawal">
												<input type="hidden" value="<?php //echo $_POST['tglakhir'];?>" name="tglakhir">
												<button class="btn btn-xs btn-success"> Exsport to Excel</button>
												</form>
											</div>
										</div-->
										<?php if($this->session->flashdata('error')!=''):?>
										<div class="alert alert-danger">
											<button type="button" class="close" data-dismiss="alert">
												<i class="ace-icon fa fa-times"></i>
											</button>
											<strong>
												<i class="ace-icon fa fa-times"></i>
												Pesan Kesalahan, 
											</strong>
											<?php echo $this->session->flashdata('error');?>
											<br />
										</div>
										<?php endif;?>
										<?php if($this->session->flashdata('pesan')!=''):?>
										<div class="alert alert-success">
											<button type="button" class="close" data-dismiss="alert">
												<i class="ace-icon fa fa-times"></i>
											</button>
											<strong>
												<i class="ace-icon fa fa-times"></i>
												Pesan,
											</strong>
											<?php echo $this->session->flashdata('pesan');?>
											<br />
										</div>
										<?php endif;?>
										<div class="table-header">
											Data Pasien IGD
										</div>

										<!-- div.table-responsive -->

										<!-- div.dataTables_borderWrap -->
										<div>
											<table id="" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														<th>No</th>
														<th>Bulan</th>
														<th>Jml Pasien</th>					
														<th>Jml Ranap</th>					
														<th>%</th>					
													</tr>
												</thead>

												<tbody>
												<?php $no=1;$total=0;$totranap=0;$totpersen=0;$persen=0;												
												foreach($result as $dtk){ 
													$total=$total+$dtk->jml;
													$totranap=$totranap+$dtk->jml_ranap;
													
													$persen=$dtk->jml_ranap/$dtk->jml*100;
													$totpersen=$totranap/$total*100;
													?>
													<tr>
														<td><?php echo $no;?></td>
														<td class=""><?php echo setBulan($dtk->tgl_registrasi);?></td>																												
														<td class=""><?php echo $dtk->jml;?></td>
														<td class=""><?php echo $dtk->jml_ranap;?></td>
														<td class=""><?php echo number_format($persen,2);?></td>

														<!--td>
															<div class="hidden-sm hidden-xs action-buttons">																
																<a class="green ranap" href="#modal-table" data-toggle="modal" data-idkamar="<?php //echo $dtk->ID;?>">
																	<i class="ace-icon fa fa-pencil bigger-130 tooltip-dark" data-rel="tooltip" data-placement="top" title="Ubah"></i>
																</a>

																<a class="red" href="#">
																	<i class="ace-icon fa fa-trash-o bigger-130 tooltip-danger" data-rel="tooltip" data-placement="top" title="Hapus"></i>
																</a>
															</div>
														</td-->
													</tr>
												<?php 
												$no++; } ?>
													<tr style="color:#ffbf00;font-size:1.1em;background-color:#646473;">
														<td colspan="2" class="text-center"><strong>Total</strong></td>
														<td><strong><?php echo $total;?></strong></td>														
														<td><strong><?php echo $totranap;?></strong></td>														
														<td><strong><?php echo number_format($totpersen,2);?></strong></td>														
													</tr>
												</tbody>
											</table>
										</div>
									</div>
									<div class="col-sm-8">
										
										<div class="widget-box widget-color-dark">
											<div class="widget-header">
												<h5 class="widget-title">Report Pasien IGD</h5>

												<!-- #section:custom/widget-box.toolbar -->
												<div class="widget-toolbar">
													
													<a href="#" data-action="fullscreen" class="orange2">
														<i class="ace-icon fa fa-expand"></i>
													</a>
													<a href="#" data-action="collapse">
														<i class="ace-icon fa fa-chevron-up"></i>
													</a>
													<a href="#" data-action="close">
														<i class="ace-icon fa fa-times"></i>
													</a>
												</div>

												<!-- /section:custom/widget-box.toolbar -->
											</div>

											<div class="widget-body">
												<div class="widget-main">
													<canvas id="speedChart"  width="600" height="300"></canvas> 
												</div>
											</div>
										</div>
									</div>
									
								</div>
							</div>
							
						</div>
						<?php //} ?>

								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

			<?php $this->load->view('main/footer');?>

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='dek/assets/js/jquery.js'>"+"<"+"/script>");
		</script>

		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='dek/assets/js/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
		<script src="dek/assets/js/bootstrap.js"></script>
		
		<!-- page specific plugin scripts -->
		<script src="dek/assets/js/date-time/bootstrap-datepicker.js"></script>

		<!-- ace scripts -->
		<script src="dek/assets/js/ace/elements.scroller.js"></script>
		<script src="dek/assets/js/ace/elements.colorpicker.js"></script>
		<script src="dek/assets/js/ace/elements.fileinput.js"></script>
		<script src="dek/assets/js/ace/elements.typeahead.js"></script>
		<script src="dek/assets/js/ace/elements.wysiwyg.js"></script>
		<script src="dek/assets/js/ace/elements.spinner.js"></script>
		<script src="dek/assets/js/ace/elements.treeview.js"></script>
		<script src="dek/assets/js/ace/elements.wizard.js"></script>
		<script src="dek/assets/js/ace/elements.aside.js"></script>
		<script src="dek/assets/js/ace/ace.js"></script>
		<script src="dek/assets/js/ace/ace.ajax-content.js"></script>
		<script src="dek/assets/js/ace/ace.touch-drag.js"></script>
		<script src="dek/assets/js/ace/ace.sidebar.js"></script>
		<script src="dek/assets/js/ace/ace.sidebar-scroll-1.js"></script>
		<script src="dek/assets/js/ace/ace.submenu-hover.js"></script>
		<script src="dek/assets/js/ace/ace.widget-box.js"></script>
		<script src="dek/assets/js/ace/ace.settings.js"></script>
		<script src="dek/assets/js/ace/ace.settings-rtl.js"></script>
		<script src="dek/assets/js/ace/ace.settings-skin.js"></script>
		<script src="dek/assets/js/ace/ace.widget-on-reload.js"></script>
		<script src="dek/assets/js/ace/ace.searchbox-autocomplete.js"></script>
		<script type="text/javascript">
			jQuery(function($) {
				
				//datepicker plugin
				//link
				$('.date-picker').datepicker({
					autoclose: true,
					todayHighlight: true,
					
				})
				$('.date-picker-tahun').datepicker({
					//format: "MM",
					//viewMode: "months", 
					//minViewMode: "months",
					format: "yyyy",
					viewMode: "years", 
					minViewMode: "years",
					autoclose: true,
					todayHighlight: true,
					
				})
				$('.date-picker-bulan').datepicker({
					format: "mm",
					viewMode: "months", 
					minViewMode: "months",
					//format: "yyyy",
					//viewMode: "years", 
					//minViewMode: "years",
					autoclose: true,
					todayHighlight: true,
					
				})
				//show datepicker when clicking on the icon
				.next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
							
			});
		</script>

		
		<!-- the following scripts are used in demo only for onpage help and you don't need them -->
		<link rel="stylesheet" href="dek/assets/css/ace.onpage-help.css" />
		<link rel="stylesheet" href="dek/docs/assets/js/themes/sunburst.css" />

		<script type="text/javascript"> ace.vars['base'] = '..'; </script>
		<script src="dek/assets/js/ace/elements.onpage-help.js"></script>
		<script src="dek/assets/js/ace/ace.onpage-help.js"></script>
		<script src="dek/docs/assets/js/rainbow.js"></script>
		<script src="dek/docs/assets/js/language/generic.js"></script>
		<script src="dek/docs/assets/js/language/html.js"></script>
		<script src="dek/docs/assets/js/language/css.js"></script>
		<script src="dek/docs/assets/js/language/javascript.js"></script>
		
		<script src="dek/chart/Chart.bundle.js"></script>
		
		<script>
            var speedCanvas = document.getElementById("speedChart");

			Chart.defaults.global.defaultFontFamily = "Lato";
			Chart.defaults.global.defaultFontSize = 18;

			var dataFirst = {
				label: "Jumlah Px",
				data: [ <?php foreach($result as $dtj){ echo $dtj->jml.',';} ?>],
				lineTension: 0,
				fill: false,
				borderColor: 'green',
				pointBorderColor: 'green',
				pointBackgroundColor: 'green',//'rgba(255,150,0,0.5)',
				pointRadius: 5,
				pointHoverRadius: 10,
				pointHitRadius: 50,
				pointBorderWidth: 2,
				pointStyle: 'rectRounded'
			  };

			var dataSecond = {
				label: "Px Ranap",
				data: [<?php foreach($result as $dtr){ echo $dtr->jml_ranap.',';}?>,],
				lineTension: 0,
				fill: false,
			  borderColor: 'red',
			  pointBorderColor: 'red',
				pointBackgroundColor: 'red',//'rgba(255,150,0,0.5)',
				pointRadius: 5,
				pointHoverRadius: 10,
				pointHitRadius: 50,
				pointBorderWidth: 2,
				pointStyle: 'rectRounded'
			  };

			var speedData = {
			  labels: [<?php foreach($result as $dtb){ echo '"'.setBulan($dtb->tgl_registrasi).'"'.',';}?>],
			  //labels: ["0s", "10s", "20s", "30s", "40s", "50s", "60s"],
			  datasets: [dataFirst, dataSecond]
			};

			var chartOptions = {
			  legend: {
				display: true,
				position: 'top',
				labels: {
				  boxWidth: 50,
				  fontColor: 'black'
				}
			  }
			};

			var lineChart = new Chart(speedCanvas, {
			  type: 'line',
			  data: speedData,
			  options: chartOptions
			});
        </script>
		
		
	</body>
</html>
