<!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" />

		<!-- 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>
		<style type="text/css">
			
			table thxx {
				background-color:#008c23;
				color:#ffffff;				
			}
			
		</style>
	</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>
								Pendapatan
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									<?php //echo "-";?> By Penjamin
								</small>
							</h1>
						</div><!-- /.page-header -->

						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<form class="form-horizontal" action="rekap-pendapatan-perbulan.html" method="post" role="form">									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1-1"> Periode </label>

										<!--div class="col-sm-3">
											<div class="input-group">												 
												<input name="bulan" class="form-control" id="dp-bulan" type="text" />
												<span class="input-group-addon">
													<i class="fa fa-calendar bigger-110"></i>
												</span>
											</div>
										</div-->
										<div class="col-sm-3">
											<div class="input-group">
												<input name="tglawal" class="form-control date-pickerxx" id="dp-bulan" value="<?php echo date_format(date_create($tglawal),'F Y');?>" type="text" data-date-format="yyyy-mm-dd" />
												<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" id="dp-bulan1" 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-juara btn-sm" type="submit" name="bProses">
											<i class="ace-icon fa fa-gear bigger-110"></i>
											Proses
										</button>
									</div>													
								</form>
								<hr>
								<h4 class="header smaller lighter blue text-center">Rekap Pendapatan Per Bulan<br>										
								<small style="color:#8c0000;">Periode : <?php echo date_format(date_create($tglawal),'F Y');?> s/d  <?php echo date_format(date_create($tglakhir),'F Y');?> </small></h4>
								<div class="clearfix"></div>
								
								<div class="tabbable">
									<ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab4">
										<li class="active">
											<a data-toggle="tab" href="#home4">Rekap Pendapatan</a>
										</li>

										<li>
											<a data-toggle="tab" href="#profile4">Adjusment Pendapatan</a>
										</li>

										<!--li>
											<a data-toggle="tab" href="#dropdown14">Rekap Pendapatan</a>
										</li-->
									</ul>
									<!--div class="table-header">
										Rekap Pendapatan Perbulan
									</div-->

									<div class="tab-content">
										<div id="home4" class="tab-pane in active">
										  <div class="row">
											<div class="col-xs-12" style="overflow-x: auto">
											<div class="clearfix">
											<!--div class="pull-right tableTools-container"></div-->
											<div class="pull-right" style="margin-right:20px; padding-bottom:20px;"> 
											  <form action="excel-rekappendapatan-perbulan" method="post" target="_blank">
												<input type="hidden" value="<?php echo $tglawal;?>" name="tglawal">
												<input type="hidden" value="<?php echo $tglakhir;?>" name="tglakhir">
												<input type="hidden" value="1" name="sts">
												<button class="btn btn-xs btn-success"> Exsport to Excel</button>
											  </form>
											</div>
											</div>
												<table id="simple-table" class="table table-striped table-bordered table-hover">
													<thead>
														<tr>
														<?php $thn=substr($tglawal,2,2);?>
															<th class="center" width="20%" style="background-color:#008c23;color:#ffffff;">Uraian</th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Jan-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Feb-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Mar-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Apr-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Mei-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Jun-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Jul-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Agu-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Sep-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Okt-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Nov-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#008c23;color:#ffffff;">Des-<?php echo $thn;?></th>
															<th class="center" width="8%" style="background-color:#008c23;color:#ffffff;">Jumlah</th>
														</tr>
													</thead>

													<tbody>
													<?php 
													$janu=0;$janb=0;$janl=0;$febu=0;$febb=0;$febl=0;
													$maru=0;$marb=0;$marl=0;$apru=0;$aprb=0;$aprl=0;
													$meiu=0;$meib=0;$meil=0;$junu=0;$junb=0;$junl=0;
													$julu=0;$julb=0;$jull=0;$aguu=0;$agub=0;$agul=0;
													$sepu=0;$sepb=0;$sepl=0;$oktu=0;$oktb=0;$oktl=0;
													$novu=0;$novb=0;$novl=0;$desu=0;$desb=0;$desl=0;
													$jmlu=0; $jmlb=0; $jmll=0;
													$jml1=0; $jml2=0; $jml3=0;$jml4=0; $jml5=0; $jml6=0;
													$jml7=0; $jml8=0; $jml9=0;$jml10=0; $jml11=0; $jml12=0;
													?>
													<?php foreach($resultrj as $dtrj):?>
													<?php 
														if($dtrj->kd_pj=='-' OR $dtrj->kd_pj=='1')
														{
															$ketu='Umum';
															$janu=$janu+$dtrj->bln1;
															$febu=$febu+$dtrj->bln2;
															$maru=$maru+$dtrj->bln3;
															$apru=$apru+$dtrj->bln4;
															$meiu=$meiu+$dtrj->bln5;
															$junu=$junu+$dtrj->bln6;
															$julu=$julu+$dtrj->bln7;
															$aguu=$aguu+$dtrj->bln8;
															$sepu=$sepu+$dtrj->bln9;
															$oktu=$oktu+$dtrj->bln10;
															$novu=$novu+$dtrj->bln11;
															$desu=$desu+$dtrj->bln12;
															
														}else if($dtrj->kd_pj=='BPJ'){
															$ketb='BPJS Kes';
															$janb=$janb+$dtrj->bln1;
															$febb=$febb+$dtrj->bln2;
															$marb=$marb+$dtrj->bln3;
															$aprb=$aprb+$dtrj->bln4;
															$meib=$meib+$dtrj->bln5;
															$junb=$junb+$dtrj->bln6;
															$julb=$julb+$dtrj->bln7;
															$agub=$agub+$dtrj->bln8;
															$sepb=$sepb+$dtrj->bln9;
															$oktb=$oktb+$dtrj->bln10;
															$novb=$novb+$dtrj->bln11;
															$desb=$desb+$dtrj->bln12;
														}else{
															$ketl='Lainnya';
															$janl=$janl+$dtrj->bln1;
															$febl=$febl+$dtrj->bln2;
															$marl=$marl+$dtrj->bln3;
															$aprl=$aprl+$dtrj->bln4;
															$meil=$meil+$dtrj->bln5;
															$junl=$junl+$dtrj->bln6;
															$jull=$jull+$dtrj->bln7;
															$agul=$agul+$dtrj->bln8;
															$sepl=$sepl+$dtrj->bln9;
															$oktl=$oktl+$dtrj->bln10;
															$novl=$novl+$dtrj->bln11;
															$desl=$desl+$dtrj->bln12;
														}
													?>
													<?php endforeach;?>
														<tr>
															<td colspan="14"><strong>RAWAT JALAN</strong></td>
														</tr>
														<?php $jmlu=$janu+$febu+$maru+$apru+$meiu+$junu+$julu+$aguu+$sepu+$oktu+$novu+$desu ;?>
														<tr>
															<td width="20%"><?php echo $ketu;?> </td>	
															<td><span class="pull-right"><?php echo number_akt($janu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($febu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($maru);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($apru);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meiu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($julu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aguu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmlu);?></span></td>
															
														</tr>
														<?php $jmlb=$janb+$febb+$marb+$aprb+$meib+$junb+$julb+$agub+$sepb+$oktb+$novb+$desb ;?>
														<tr>
															<td><?php echo $ketb;?> </td>	
															<td><span class="pull-right"><?php echo number_akt($janb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($febb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($marb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aprb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meib);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($julb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($agub);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desb);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmlb);?></span></td>
														</tr>
														<?php $jmll=$janl+$febl+$marl+$aprl+$meil+$junl+$jull+$agul+$sepl+$oktl+$novl+$desl ;?>
														<tr>
															<td><?php echo $ketl;?></td>	
															<td><span class="pull-right"><?php echo number_akt($janl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($febl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($marl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aprl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meil);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jull);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($agul);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmll);?></span></td>
														</tr>
														<tr style="background-color:#bfffdf;">
														<?php
															$jml1=$janu+$janb+$janl; $jml2=$febu+$febb+$febl;
															$jml3=$maru+$marb+$marl; $jml4=$apru+$aprb+$aprl;
															$jml5=$meiu+$meib+$meil; $jml6=$junu+$junb+$junl;
															$jml7=$julu+$julb+$jull; $jml8=$aguu+$agub+$agul;
															$jml9=$sepu+$sepb+$sepl; $jml10=$oktu+$oktb+$oktl;
															$jml11=$novu+$novb+$novl; $jml12=$desu+$desb+$desl;
															
															$jmltot=$jmlu+$jmlb+$jmll;
														?>
															<td><strong>Total Pendapatan Rajal</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml1);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml2);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml3);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml4);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml5);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml6);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml7);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml8);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml9);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml10);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml11);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml12);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmltot);?></strong></span> </td>
														</tr>
													<?php 
													//inap
													$januri=0;$janbri=0;$janlri=0;$feburi=0;$febbri=0;$feblri=0;
													$maruri=0;$marbri=0;$marlri=0;$apruri=0;$aprbri=0;$aprlri=0;
													$meiuri=0;$meibri=0;$meilri=0;$junuri=0;$junbri=0;$junlri=0;
													$juluri=0;$julbri=0;$jullri=0;$aguuri=0;$agubri=0;$agulri=0;
													$sepuri=0;$sepbri=0;$seplri=0;$okturi=0;$oktbri=0;$oktlri=0;
													$novuri=0;$novbri=0;$novlri=0;$desuri=0;$desbri=0;$deslri=0;
													$jmluri=0; $jmlbri=0; $jmllri=0;
													$jml1ri=0; $jml2ri=0; $jml3ri=0;$jml4ri=0; $jml5ri=0; $jml6ri=0;
													$jml7ri=0; $jml8ri=0; $jml9ri=0;$jml10ri=0; $jml11ri=0; $jml12ri=0;
													?>
													<?php foreach($resultri as $dtri):?>
													<?php 
														if($dtri->kd_pj=='-' OR $dtri->kd_pj=='1')
														{
															$ketu='Umum';
															$januri=$januri+$dtri->bln1;
															$feburi=$feburi+$dtri->bln2;
															$maruri=$maruri+$dtri->bln3;
															$apruri=$apruri+$dtri->bln4;
															$meiuri=$meiuri+$dtri->bln5;
															$junuri=$junuri+$dtri->bln6;
															$juluri=$juluri+$dtri->bln7;
															$aguuri=$aguuri+$dtri->bln8;
															$sepuri=$sepuri+$dtri->bln9;
															$okturi=$okturi+$dtri->bln10;
															$novuri=$novuri+$dtri->bln11;
															$desuri=$desuri+$dtri->bln12;
															
														}else if($dtri->kd_pj=='BPJ'){
															$ketb='BPJS Kes';
															$janbri=$janbri+$dtri->bln1;
															$febbri=$febbri+$dtri->bln2;
															$marbri=$marbri+$dtri->bln3;
															$aprbri=$aprbri+$dtri->bln4;
															$meibri=$meibri+$dtri->bln5;
															$junbri=$junbri+$dtri->bln6;
															$julbri=$julbri+$dtri->bln7;
															$agubri=$agubri+$dtri->bln8;
															$sepbri=$sepbri+$dtri->bln9;
															$oktbri=$oktbri+$dtri->bln10;
															$novbri=$novbri+$dtri->bln11;
															$desbri=$desbri+$dtri->bln12;
														}else{
															$ketl='Lainnya';
															$janlri=$janlri+$dtri->bln1;
															$feblri=$feblri+$dtri->bln2;
															$marlri=$marlri+$dtri->bln3;
															$aprlri=$aprlri+$dtri->bln4;
															$meilri=$meilri+$dtri->bln5;
															$junlri=$junlri+$dtri->bln6;
															$jullri=$jullri+$dtri->bln7;
															$agulri=$agulri+$dtri->bln8;
															$seplri=$seplri+$dtri->bln9;
															$oktlri=$oktlri+$dtri->bln10;
															$novlri=$novlri+$dtri->bln11;
															$deslri=$deslri+$dtri->bln12;
														}
													?>
													<?php endforeach;?>
														<tr>
															<td colspan="14"><strong>RAWAT INAP</strong></td>
														</tr>
														<?php $jmluri=$januri+$feburi+$maruri+$apruri+$meiuri+$junuri+$juluri+$aguuri+$sepuri+$okturi+$novuri+$desuri ;?>
														<tr>
															<td width="20%"><?php echo $ketu;?> </td>	
															<td><span class="pull-right"><?php echo number_akt($januri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($feburi);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($maruri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($apruri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meiuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($juluri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aguuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($okturi);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmluri);?></span></td>
															
														</tr>
														<?php $jmlbri=$janbri+$febbri+$marbri+$aprbri+$meibri+$junbri+$julbri+$agubri+$sepbri+$oktbri+$novbri+$desbri ;?>
														<tr>
															<td><?php echo $ketb;?> </td>	
															<td><span class="pull-right"><?php echo number_akt($janbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($febbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($marbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aprbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meibri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($julbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($agubri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desbri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmlbri);?></span></td>
														</tr>
														<?php $jmllri=$janlri+$feblri+$marlri+$aprlri+$meilri+$junlri+$jullri+$agulri+$seplri+$oktlri+$novlri+$deslri ;?>
														<tr>
															<td><?php echo $ketl;?></td>	
															<td><span class="pull-right"><?php echo number_akt($janlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($feblri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($marlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aprlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meilri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jullri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($agulri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($seplri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($deslri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmllri);?></span></td>
														</tr>
														<tr style="background-color:#bfffdf;">
														<?php
															$jml1ri=$januri+$janbri+$janlri; $jml2ri=$feburi+$febbri+$feblri;
															$jml3ri=$maruri+$marbri+$marlri; $jml4ri=$apruri+$aprbri+$aprlri;
															$jml5ri=$meiuri+$meibri+$meilri; $jml6ri=$junuri+$junbri+$junlri;
															$jml7ri=$juluri+$julbri+$jullri; $jml8ri=$aguuri+$agubri+$agulri;
															$jml9ri=$sepuri+$sepbri+$seplri; $jml10ri=$okturi+$oktbri+$oktlri;
															$jml11ri=$novuri+$novbri+$novlri; $jml12ri=$desuri+$desbri+$deslri;
															
															$jmltotri=$jmluri+$jmlbri+$jmllri;
														?>
															<td><strong>Total Pendapatan Ranap</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml1ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml2ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml3ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml4ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml5ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml6ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml7ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml8ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml9ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml10ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml11ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml12ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmltotri);?></strong></span> </td>
														</tr>
														<tr style="background-color:#008c23;color:#ffffff;">
														<?php
															$tot1=$jml1+$jml1ri; $tot2=$jml1+$jml2ri;
															$tot3=$jml3+$jml3ri; $tot4=$jml4+$jml4ri;
															$tot5=$jml5+$jml5ri; $tot6=$jml6+$jml6ri;
															$tot7=$jml7+$jml7ri; $tot8=$jml8+$jml8ri;
															$tot9=$jml9+$jml9ri; $tot10=$jml10+$jml10ri;
															$tot11=$jml11+$jml11ri; $tot12=$jml12+$jml12ri;
															
															$totalall=$jmltot+$jmltotri;
														?>
															<td><strong>Total Pendapatan</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot1);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot2);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot3);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot4);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot5);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot6);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot7);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot8);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot9);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot10);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot11);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot12);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($totalall);?></strong></span> </td>
														</tr>
													</tbody>
												</table>
											</div><!-- /.span -->
										</div><!-- /.row -->
									</div>
									
									<!-- Adjudment -->
									<div id="profile4" class="tab-pane">
										<div class="row">
											<div class="col-xs-12" style="overflow-x: auto">
											<div class="clearfix">
											<!--div class="pull-right tableTools-container"></div-->
											<!--div class="pull-right" style="margin-right:20px; padding-bottom:20px;"> 
											  <form action="excel-rekappendapatan-perbulan" method="post" target="_blank">
												<input type="hidden" value="<?php echo $tglawal;?>" name="tglawal">
												<input type="hidden" value="<?php echo $tglakhir;?>" name="tglakhir">
												<input type="hidden" value="1" name="sts">
												<button class="btn btn-xs btn-success"> Exsport to Excel</button>
											  </form>
											</div-->
											</div>
											
												<table id="simple-table" class="table table-striped table-bordered table-hover">
													<thead>
														<tr>
														<?php $thn=substr($tglawal,2,2);?>
															<th class="center" width="20%" style="background-color:#ff4000;color:#ffffff;">Uraian</th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Jan-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Feb-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Mar-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Apr-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Mei-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Jun-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Jul-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Agu-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Sep-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Okt-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Nov-<?php echo $thn;?></th>
															<th class="center" width="6%" style="background-color:#ff4000;color:#ffffff;">Des-<?php echo $thn;?></th>
															<th class="center" width="8%" style="background-color:#ff4000;color:#ffffff;">Jumlah</th>
														</tr>
													</thead>

													<tbody>
													<?php 
													$janu=0;$janb=0;$janl=0;$febu=0;$febb=0;$febl=0;
													$maru=0;$marb=0;$marl=0;$apru=0;$aprb=0;$aprl=0;
													$meiu=0;$meib=0;$meil=0;$junu=0;$junb=0;$junl=0;
													$julu=0;$julb=0;$jull=0;$aguu=0;$agub=0;$agul=0;
													$sepu=0;$sepb=0;$sepl=0;$oktu=0;$oktb=0;$oktl=0;
													$novu=0;$novb=0;$novl=0;$desu=0;$desb=0;$desl=0;
													$jmlu=0; $jmlb=0; $jmll=0;
													$jml1=0; $jml2=0; $jml3=0;$jml4=0; $jml5=0; $jml6=0;
													$jml7=0; $jml8=0; $jml9=0;$jml10=0; $jml11=0; $jml12=0;
													?>
													<?php foreach($resultrj as $dtrj):?>
													<?php 
														if($dtrj->kd_pj=='-' OR $dtrj->kd_pj=='1')
														{
															$ketu='Umum';
															$janu=$janu+$dtrj->bln1;
															$febu=$febu+$dtrj->bln2;
															$maru=$maru+$dtrj->bln3;
															$apru=$apru+$dtrj->bln4;
															$meiu=$meiu+$dtrj->bln5;
															$junu=$junu+$dtrj->bln6;
															$julu=$julu+$dtrj->bln7;
															$aguu=$aguu+$dtrj->bln8;
															$sepu=$sepu+$dtrj->bln9;
															$oktu=$oktu+$dtrj->bln10;
															$novu=$novu+$dtrj->bln11;
															$desu=$desu+$dtrj->bln12;
															
														}else if($dtrj->kd_pj=='BPJ'){
															$ketb='BPJS Kes';
															$janb=$janb+$dtrj->bln1;
															$febb=$febb+$dtrj->bln2;
															$marb=$marb+$dtrj->bln3;
															$aprb=$aprb+$dtrj->bln4;
															$meib=$meib+$dtrj->bln5;
															$junb=$junb+$dtrj->bln6;
															$julb=$julb+$dtrj->bln7;
															$agub=$agub+$dtrj->bln8;
															$sepb=$sepb+$dtrj->bln9;
															$oktb=$oktb+$dtrj->bln10;
															$novb=$novb+$dtrj->bln11;
															$desb=$desb+$dtrj->bln12;
														}else{
															$ketl='Lainnya';
															$janl=$janl+$dtrj->bln1;
															$febl=$febl+$dtrj->bln2;
															$marl=$marl+$dtrj->bln3;
															$aprl=$aprl+$dtrj->bln4;
															$meil=$meil+$dtrj->bln5;
															$junl=$junl+$dtrj->bln6;
															$jull=$jull+$dtrj->bln7;
															$agul=$agul+$dtrj->bln8;
															$sepl=$sepl+$dtrj->bln9;
															$oktl=$oktl+$dtrj->bln10;
															$novl=$novl+$dtrj->bln11;
															$desl=$desl+$dtrj->bln12;
														}
													?>
													<?php endforeach;?>
													<?php foreach($resultbpjs as $dtb){
														if($dtb->status=='1'){
															$janr=$dtb->bl1;
															$febr=$dtb->bl2;
															$marr=$dtb->bl3;
															$aprr=$dtb->bl4;
															$meir=$dtb->bl5;
															$junr=$dtb->bl6;
															$julr=$dtb->bl7;
															$agur=$dtb->bl8;
															$sepr=$dtb->bl9;
															$oktr=$dtb->bl10;
															$novr=$dtb->bl11;
															$desr=$dtb->bl12;
															$ketr="BPJS Adjusment";
															$p1=$dtb->p1;
															$p2=$dtb->p2;
															$p3=$dtb->p3;
															$p4=$dtb->p4;
															$p5=$dtb->p5;
															$p6=$dtb->p6;
															$p7=$dtb->p7;
															$p8=$dtb->p8;
															$p9=$dtb->p9;
															$p10=$dtb->p10;
															$p11=$dtb->p11;
															$p12=$dtb->p12;
															
														}else{
															$janri=$dtb->bl1;
															$febri=$dtb->bl2;
															$marri=$dtb->bl3;
															$aprri=$dtb->bl4;
															$meiri=$dtb->bl5;
															$junri=$dtb->bl6;
															$julri=$dtb->bl7;
															$aguri=$dtb->bl8;
															$sepri=$dtb->bl9;
															$oktri=$dtb->bl10;
															$novri=$dtb->bl11;
															$desri=$dtb->bl12;
															$ketri="BPJS Adjusment";
															$p1ri=$dtb->p1;
															$p2ri=$dtb->p2;
															$p3ri=$dtb->p3;
															$p4ri=$dtb->p4;
															$p5ri=$dtb->p5;
															$p6ri=$dtb->p6;
															$p7ri=$dtb->p7;
															$p8ri=$dtb->p8;
															$p9ri=$dtb->p9;
															$p10ri=$dtb->p10;
															$p11ri=$dtb->p11;
															$p12ri=$dtb->p12;
														}
														
													}
													?>
														<tr>
															<td colspan="14"><strong>RAWAT JALAN</strong></td>
														</tr>
														<?php $jmlu=$janu+$febu+$maru+$apru+$meiu+$junu+$julu+$aguu+$sepu+$oktu+$novu+$desu ;?>
														<tr>
															<td width="20%"><?php echo $ketu;?> </td>	
															<td><span class="pull-right"><?php echo number_akt($janu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($febu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($maru);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($apru);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meiu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($julu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aguu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desu);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmlu);?></span></td>
															
														</tr>
														<?php $jmlb=$janb+$febb+$marb+$aprb+$meib+$junb+$julb+$agub+$sepb+$oktb+$novb+$desb ;
																$jmlr=$janr+$febr+$marr+$aprr+$meir+$junr+$julr+$agur+$sepr+$oktr+$novr+$desr ;
																$jmlri=$janri+$febri+$marri+$aprri+$meiri+$junri+$julri+$aguri+$sepri+$oktri+$novri+$desri ;
														?>
														<?php $tahun=substr($tglawal,0,4);?>
														<form action="simpan-pendapatan-adjusment2" method="post" id="">
														<tr>
															<td><?php echo $ketb;?> </td>	
															<td>
																<span class="pull-right"><?php echo number_akt($janb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $janb;?>" class="hitung" id="tagih-1" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-01';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($febb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $febb;?>" class="hitung" id="tagih-2" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-02';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($marb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $marb;?>" class="hitung" id="tagih-3" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-03';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($aprb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $aprb;?>" class="hitung" id="tagih-4" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-04';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($meib);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $meib;?>" class="hitung" id="tagih-5" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-05';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($junb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $junb;?>" class="hitung" id="tagih-6" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-06';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($julb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $julb;?>" class="hitung" id="tagih-7" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-07';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($agub);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $agub;?>" class="hitung" id="tagih-8" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-08';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($sepb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $sepb;?>" class="hitung" id="tagih-9" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-09';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($oktb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $oktb;?>" class="hitung" id="tagih-10" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-10';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($novb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $novb;?>" class="hitung" id="tagih-11" >
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-11';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($desb);?></span>
																<input type="hidden" name="tagih[]" value="<?php echo $desb;?>" class="hitung" id="tagih-12">
																<input type="hidden" name="bulan[]" value="<?php echo $tahun.'-12';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($jmlb);?></span>
															</td>
														</tr>
														<tr>
															<td>Persentase </td>	
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p1;?>" name="persen[]" id="persen-1" ></td>															
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p2;?>" name="persen[]" id="persen-2" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p3;?>" name="persen[]" id="persen-3" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p4;?>" name="persen[]" id="persen-4" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p5;?>" name="persen[]" id="persen-5" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p6;?>" name="persen[]" id="persen-6" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p7;?>" name="persen[]" id="persen-7" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p8;?>" name="persen[]" id="persen-8" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p9;?>" name="persen[]" id="persen-9" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p10;?>" name="persen[]" id="persen-10" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p11;?>" name="persen[]" id="persen-11" ></td>
															<td><input type="text" class="form-control text-right hitung" value="<?php echo $p12;?>" name="persen[]" id="persen-12" ></td>
															<td><span class="pull-right">
																<button class="btn btn-xs btn-juara"> Simpan</button></span>
																<input type="hidden" name="tgla" value="<?php echo $tglawal;?>">
																<input type="hidden" name="tglb" value="<?php echo $tglakhir;?>">
															</td>
														</tr>
														<tr>
															<td><?php echo $ketr;?> </td>	
															<td>
																<span class="pull-right" id="hasilx-1"><?php echo number_akt($janr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($janr);?>" id="hasil-1" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-2"><?php echo number_akt($febr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($febr);?>" id="hasil-2" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-3"><?php echo number_akt($marr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($marr);?>" id="hasil-3" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-4"><?php echo number_akt($aprr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($aprr);?>" id="hasil-4" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-5"><?php echo number_akt($meir);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($meir);?>" id="hasil-5" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-6"><?php echo number_akt($junr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($junr);?>" id="hasil-6" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-7"><?php echo number_akt($julr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($julr);?>" id="hasil-7" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-8"><?php echo number_akt($agur);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($agur);?>" id="hasil-8" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-9"><?php echo number_akt($sepr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($sepr);?>" id="hasil-9" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-10"><?php echo number_akt($oktr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($oktr);?>" id="hasil-10" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-11"><?php echo number_akt($novr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($novr);?>" id="hasil-11" >
															</td>
															<td>
																<span class="pull-right" id="hasilx-12"><?php echo number_akt($desr);?></span>
																<input type="hidden" class="form-control text-right" name="bayar[]" value="<?php echo number_akt($desr);?>" id="hasil-12" >
															</td>
															<td>
																<span class="pull-right" id="subtot"><?php echo number_akt($jmlr);?></span>
																<input type="hidden" class="form-control text-right" name="tot" value="<?php echo number_akt($jmlr);?>" id="subtot" >
															</td>
														</tr>
														</form>
														<?php $jmll=$janl+$febl+$marl+$aprl+$meil+$junl+$jull+$agul+$sepl+$oktl+$novl+$desl ;?>
														<tr>
															<td><?php echo $ketl;?></td>	
															<td><span class="pull-right"><?php echo number_akt($janl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($febl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($marl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aprl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meil);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jull);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($agul);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desl);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmll);?></span></td>
														</tr>
														<tr style="background-color:#bfffdf;">
														<?php
															$jml1=$janu+$janb+$janl; $jml2=$febu+$febb+$febl;
															$jml3=$maru+$marb+$marl; $jml4=$apru+$aprb+$aprl;
															$jml5=$meiu+$meib+$meil; $jml6=$junu+$junb+$junl;
															$jml7=$julu+$julb+$jull; $jml8=$aguu+$agub+$agul;
															$jml9=$sepu+$sepb+$sepl; $jml10=$oktu+$oktb+$oktl;
															$jml11=$novu+$novb+$novl; $jml12=$desu+$desb+$desl;
															
															$jmltot=$jmlu+$jmlb+$jmll;
														?>
															<td><strong>Total Pendapatan Rajal</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml1);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml2);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml3);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml4);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml5);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml6);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml7);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml8);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml9);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml10);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml11);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml12);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmltot);?></strong></span> </td>
														</tr>
														<tr style="background-color:#73ffb9;">
														<?php
															$jmlr1=$janu+$janr+$janl; $jmlr2=$febu+$febr+$febl;
															$jmlr3=$maru+$marr+$marl; $jmlr4=$apru+$aprr+$aprl;
															$jmlr5=$meiu+$meir+$meil; $jmlr6=$junu+$junr+$junl;
															$jmlr7=$julu+$julr+$jull; $jmlr8=$aguu+$agur+$agul;
															$jmlr9=$sepu+$sepr+$sepl; $jmlr10=$oktu+$oktr+$oktl;
															$jmlr11=$novu+$novr+$novl; $jmlr12=$desu+$desr+$desl;
															
															$jmltotr=$jmlu+$jmlr+$jmll;
														?>
															<td><strong>Pendapatan Rajal Adjusment</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr1);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr2);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr3);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr4);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr5);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr6);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr7);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr8);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr9);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr10);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr11);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr12);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmltotr);?></strong></span> </td>
														</tr>
													<?php 
													//inap
													$januri=0;$janbri=0;$janlri=0;$feburi=0;$febbri=0;$feblri=0;
													$maruri=0;$marbri=0;$marlri=0;$apruri=0;$aprbri=0;$aprlri=0;
													$meiuri=0;$meibri=0;$meilri=0;$junuri=0;$junbri=0;$junlri=0;
													$juluri=0;$julbri=0;$jullri=0;$aguuri=0;$agubri=0;$agulri=0;
													$sepuri=0;$sepbri=0;$seplri=0;$okturi=0;$oktbri=0;$oktlri=0;
													$novuri=0;$novbri=0;$novlri=0;$desuri=0;$desbri=0;$deslri=0;
													$jmluri=0; $jmlbri=0; $jmllri=0;
													$jml1ri=0; $jml2ri=0; $jml3ri=0;$jml4ri=0; $jml5ri=0; $jml6ri=0;
													$jml7ri=0; $jml8ri=0; $jml9ri=0;$jml10ri=0; $jml11ri=0; $jml12ri=0;
													?>
													<?php foreach($resultri as $dtri):?>
													<?php 
														if($dtri->kd_pj=='-' OR $dtri->kd_pj=='1')
														{
															$ketu='Umum';
															$januri=$januri+$dtri->bln1;
															$feburi=$feburi+$dtri->bln2;
															$maruri=$maruri+$dtri->bln3;
															$apruri=$apruri+$dtri->bln4;
															$meiuri=$meiuri+$dtri->bln5;
															$junuri=$junuri+$dtri->bln6;
															$juluri=$juluri+$dtri->bln7;
															$aguuri=$aguuri+$dtri->bln8;
															$sepuri=$sepuri+$dtri->bln9;
															$okturi=$okturi+$dtri->bln10;
															$novuri=$novuri+$dtri->bln11;
															$desuri=$desuri+$dtri->bln12;
															
														}else if($dtri->kd_pj=='BPJ'){
															$ketb='BPJS Kes';
															$janbri=$janbri+$dtri->bln1;
															$febbri=$febbri+$dtri->bln2;
															$marbri=$marbri+$dtri->bln3;
															$aprbri=$aprbri+$dtri->bln4;
															$meibri=$meibri+$dtri->bln5;
															$junbri=$junbri+$dtri->bln6;
															$julbri=$julbri+$dtri->bln7;
															$agubri=$agubri+$dtri->bln8;
															$sepbri=$sepbri+$dtri->bln9;
															$oktbri=$oktbri+$dtri->bln10;
															$novbri=$novbri+$dtri->bln11;
															$desbri=$desbri+$dtri->bln12;
														}else{
															$ketl='Lainnya';
															$janlri=$janlri+$dtri->bln1;
															$feblri=$feblri+$dtri->bln2;
															$marlri=$marlri+$dtri->bln3;
															$aprlri=$aprlri+$dtri->bln4;
															$meilri=$meilri+$dtri->bln5;
															$junlri=$junlri+$dtri->bln6;
															$jullri=$jullri+$dtri->bln7;
															$agulri=$agulri+$dtri->bln8;
															$seplri=$seplri+$dtri->bln9;
															$oktlri=$oktlri+$dtri->bln10;
															$novlri=$novlri+$dtri->bln11;
															$deslri=$deslri+$dtri->bln12;
														}
													?>
													<?php endforeach;?>
														<tr>
															<td colspan="14"><strong>RAWAT INAP</strong></td>
														</tr>
														<?php $jmluri=$januri+$feburi+$maruri+$apruri+$meiuri+$junuri+$juluri+$aguuri+$sepuri+$okturi+$novuri+$desuri ;?>
														<tr>
															<td width="20%"><?php echo $ketu;?> </td>	
															<td><span class="pull-right"><?php echo number_akt($januri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($feburi);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($maruri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($apruri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meiuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($juluri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aguuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($sepuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($okturi);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($desuri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmluri);?></span></td>
															
														</tr>
														<?php $jmlbri=$janbri+$febbri+$marbri+$aprbri+$meibri+$junbri+$julbri+$agubri+$sepbri+$oktbri+$novbri+$desbri ;?>
														<form action="simpan-pendapatan-adjusmentri2" method="post" id="">
														<tr>
															<td><?php echo $ketb;?> </td>	
															<td>
																<span class="pull-right"><?php echo number_akt($janbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $janbri;?>" class="" id="tagihri-1" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-01';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($febbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $febbri;?>" class="" id="tagihri-2" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-02';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($marbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $marbri;?>" class="" id="tagihri-3" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-03';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($aprbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $aprbri;?>" class="" id="tagihri-4" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-04';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($meibri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $meibri;?>" class="" id="tagihri-5" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-05';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($junbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $junbri;?>" class="hitungri" id="tagihri-6" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-06';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($julbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $julbri;?>" class="hitungri" id="tagihri-7" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-07';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($agubri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $agubri;?>" class="hitungri" id="tagihri-8" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-08';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($sepbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $sepbri;?>" class="hitungri" id="tagihri-9" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-09';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($oktbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $oktbri;?>" class="hitungri" id="tagihri-10" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-10';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($novbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $novbri;?>" class="hitungri" id="tagihri-11" >
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-11';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($desbri);?></span>
																<input type="hidden" name="tagihri[]" value="<?php echo $desbri;?>" class="hitungri" id="tagihri-12">
																<input type="hidden" name="bulanri[]" value="<?php echo $tahun.'-12';?>">
															</td>
															<td>
																<span class="pull-right"><?php echo number_akt($jmlbri);?></span>
															</td>
														</tr>
														
														<tr>
															<td>Persentase </td>	
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p1ri;?>" name="persenri[]" id="persenri-1" ></td>															
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p2ri;?>" name="persenri[]" id="persenri-2" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p3ri;?>" name="persenri[]" id="persenri-3" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p4ri;?>" name="persenri[]" id="persenri-4" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p5ri;?>" name="persenri[]" id="persenri-5" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p6ri;?>" name="persenri[]" id="persenri-6" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p7ri;?>" name="persenri[]" id="persenri-7" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p8ri;?>" name="persenri[]" id="persenri-8" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p9ri;?>" name="persenri[]" id="persenri-9" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p10ri;?>" name="persenri[]" id="persenri-10" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p11ri;?>" name="persenri[]" id="persenri-11" ></td>
															<td><input type="text" class="form-control text-right hitungri" value="<?php echo $p12ri;?>" name="persenri[]" id="persenri-12" ></td>
															<td><span class="pull-right">
																<button class="btn btn-xs btn-insan"> Simpan</button></span>
																<input type="hidden" name="tgla" value="<?php echo $tglawal;?>">
																<input type="hidden" name="tglb" value="<?php echo $tglakhir;?>">
															</td>
														</tr>
														<tr>
															<td>BPJS Adjusment<?php //echo $ketri;?> </td>	
															<td>
																<span class="pull-right" id="hasilxri-1"><?php echo number_akt($janri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($janri);?>" id="hasilri-1" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-2"><?php echo number_akt($febri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($febri);?>" id="hasilri-2" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-3"><?php echo number_akt($marri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($marri);?>" id="hasilri-3" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-4"><?php echo number_akt($aprri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($aprri);?>" id="hasilri-4" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-5"><?php echo number_akt($meiri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($meiri);?>" id="hasilri-5" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-6"><?php echo number_akt($junri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($junri);?>" id="hasilri-6" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-7"><?php echo number_akt($julri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($julri);?>" id="hasilri-7" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-8"><?php echo number_akt($aguri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($aguri);?>" id="hasilri-8" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-9"><?php echo number_akt($sepri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($sepri);?>" id="hasilri-9" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-10"><?php echo number_akt($oktri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($oktri);?>" id="hasilri-10" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-11"><?php echo number_akt($novri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($novri);?>" id="hasilri-11" >
															</td>
															<td>
																<span class="pull-right" id="hasilxri-12"><?php echo number_akt($desri);?></span>
																<input type="hidden" class="form-control text-right" name="bayari[]" value="<?php echo number_akt($desri);?>" id="hasilri-12" >
															</td>
															<td>
																<span class="pull-right" id="subtotri"><?php echo number_akt($jmlri);?></span>
																<input type="hidden" class="form-control text-right" name="tot" value="<?php echo number_akt($jmlri);?>" id="subtotri" >
															</td>
														</tr>
														</form>
														<?php $jmllri=$janlri+$feblri+$marlri+$aprlri+$meilri+$junlri+$jullri+$agulri+$seplri+$oktlri+$novlri+$deslri ;?>
														<tr>
															<td><?php echo $ketl;?></td>	
															<td><span class="pull-right"><?php echo number_akt($janlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($feblri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($marlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($aprlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($meilri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($junlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jullri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($agulri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($seplri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($oktlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($novlri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($deslri);?></span></td>
															<td><span class="pull-right"><?php echo number_akt($jmllri);?></span></td>
														</tr>
														<tr style="background-color:#ffcfbf;">
														<?php
															$jml1ri=$januri+$janbri+$janlri; $jml2ri=$feburi+$febbri+$feblri;
															$jml3ri=$maruri+$marbri+$marlri; $jml4ri=$apruri+$aprbri+$aprlri;
															$jml5ri=$meiuri+$meibri+$meilri; $jml6ri=$junuri+$junbri+$junlri;
															$jml7ri=$juluri+$julbri+$jullri; $jml8ri=$aguuri+$agubri+$agulri;
															$jml9ri=$sepuri+$sepbri+$seplri; $jml10ri=$okturi+$oktbri+$oktlri;
															$jml11ri=$novuri+$novbri+$novlri; $jml12ri=$desuri+$desbri+$deslri;
															
															$jmltotri=$jmluri+$jmlbri+$jmllri;
														?>
															<td><strong>Total Pendapatan Ranap</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml1ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml2ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml3ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml4ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml5ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml6ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml7ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml8ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml9ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml10ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml11ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jml12ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmltotri);?></strong></span> </td>
														</tr>
														<tr style="background-color:#ff9673;">
														<?php
															$jmlr1ri=$januri+$janri+$janlri; $jmlr2ri=$feburi+$febri+$feblri;
															$jmlr3ri=$maruri+$marri+$marlri; $jmlr4ri=$apruri+$aprri+$aprlri;
															$jmlr5ri=$meiuri+$meiri+$meilri; $jmlr6ri=$junuri+$junri+$junlri;
															$jmlr7ri=$juluri+$julri+$jullri; $jmlr8ri=$aguuri+$aguri+$agulri;
															$jmlr9ri=$sepuri+$sepri+$seplri; $jmlr10ri=$okturi+$oktri+$oktlri;
															$jmlr11ri=$novuri+$novri+$novlri; $jmlr12ri=$desuri+$desri+$deslri;
															
															$jmltotrix=$jmluri+$jmlri+$jmllri;
														?>
															<td><strong>Pendapatan Ranap Adjusment</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr1ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr2ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr3ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr4ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr5ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr6ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr7ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr8ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr9ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr10ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr11ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmlr12ri);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($jmltotrix);?></strong></span> </td>
														</tr>
														<tr style="background-color:#00d936;color:#ffffff;">
														<?php
															$tot1=$jml1+$jml1ri; $tot2=$jml2+$jml2ri;
															$tot3=$jml3+$jml3ri; $tot4=$jml4+$jml4ri;
															$tot5=$jml5+$jml5ri; $tot6=$jml6+$jml6ri;
															$tot7=$jml7+$jml7ri; $tot8=$jml8+$jml8ri;
															$tot9=$jml9+$jml9ri; $tot10=$jml10+$jml10ri;
															$tot11=$jml11+$jml11ri; $tot12=$jml12+$jml12ri;
															
															$totalall=$jmltot+$jmltotri;
														?>
															<td><strong>Total Pendapatan</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot1);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot2);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot3);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot4);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot5);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot6);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot7);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot8);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot9);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot10);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot11);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot12);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($totalall);?></strong></span> </td>
														</tr>
														<tr style="background-color:#008c23;color:#ffffff;">
														<?php
															$tot1a=$jmlr1+$jmlr1ri; $tot2a=$jmlr2+$jmlr2ri;
															$tot3a=$jmlr3+$jmlr3ri; $tot4a=$jmlr4+$jmlr4ri;
															$tot5a=$jmlr5+$jmlr5ri; $tot6a=$jmlr6+$jmlr6ri;
															$tot7a=$jmlr7+$jmlr7ri; $tot8a=$jmlr8+$jmlr8ri;
															$tot9a=$jmlr9+$jmlr9ri; $tot10a=$jmlr10+$jmlr10ri;
															$tot11a=$jmlr11+$jmlr11ri; $tot12a=$jmlr12+$jmlr12ri;
															
															$totalalla=$jmltotr+$jmltotrix;
														?>
															<td><strong>Total Pendapatan Adjusment</strong></td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot1a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot2a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot3a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot4a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot5a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot6a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot7a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot8a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot9a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot10a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot11a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($tot12a);?></strong></span> </td>
															<td><span class="pull-right"><strong><?php echo number_akt($totalalla);?></strong></span> </td>
														</tr>
													</tbody>
												</table>
											
											</div><!-- /.span -->
										</div><!-- /.row -->
									</div>
									

									
											
								</div>		
								</div>
								<?php //echo base_url(); ?>
								<div class="center">
							
								</div>

								<!-- 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 -->
		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='dek/assets/js/jquery.js'>"+"<"+"/script>");
		</script>
		<!-- <![endif]-->
	
		<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/dataTables/jquery.dataTables.js"></script>
		<script src="dek/assets/js/dataTables/jquery.dataTables.bootstrap.js"></script>
		<script src="dek/assets/js/dataTables/extensions/TableTools/js/dataTables.tableTools.js"></script>
		<script src="dek/assets/js/dataTables/extensions/ColVis/js/dataTables.colVis.js"></script>

		<script src="dek/assets/js/jquery-ui.custom.js"></script>
		<script src="dek/assets/js/jquery.ui.touch-punch.js"></script>
		<script src="dek/assets/js/chosen.jquery.js"></script>
		<script src="dek/assets/js/fuelux/fuelux.spinner.js"></script>
		<script src="dek/assets/js/date-time/bootstrap-datepicker.js"></script>
		<script src="dek/assets/js/date-time/bootstrap-timepicker.js"></script>
		<script src="dek/assets/js/date-time/moment.js"></script>
		<script src="dek/assets/js/date-time/daterangepicker.js"></script>
		<script src="dek/assets/js/date-time/bootstrap-datetimepicker.js"></script>
		<script src="dek/assets/js/bootstrap-colorpicker.js"></script>
		<script src="dek/assets/js/jquery.knob.js"></script>
		<script src="dek/assets/js/jquery.autosize.js"></script>
		<script src="dek/assets/js/jquery.inputlimiter.1.3.1.js"></script>
		<script src="dek/assets/js/jquery.maskedinput.js"></script>
		<script src="dek/assets/js/bootstrap-tag.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>
		<!-- the following scripts are used in demo only for onpage help and you don't need them -->
		<!-- inline scripts related to this page -->
		<script src="dek/assets/calx-main/jquery-calx-2.2.8.min.js"></script>
		
<script type="text/javascript">

	//hanya_angka
	function numericFilter(txb) {
		txb.value = txb.value.replace(/[^\0-9]/ig, "");
	}
</script>
<script>
	$('#calcxx').calx();
		$('#show_formula').click(function(e){
			e.preventDefault();

			if($(this).attr('data-shown') == '0'){
				$('[data-formula],[data-cell]').each(function(){
					$(this).after('<span class="formula">'+$(this).attr('data-cell')+($(this).attr('data-formula') ? ' = '+$(this).attr('data-formula') : '')+'&nbsp;</span>');
				});

				$(this).attr('data-shown', 1).html('Hide Formula');
			}else{
				$('span.formula').remove();
				$(this).attr('data-shown', 0).html('Show Formula');
			}
		});
</script>
		<script type="text/javascript">
		$('body').on('focus', '.hitung', function() {
			var hro = $(this).attr('id'),
				berhitung = hro.split('-');
			$(this).keydown(function() {				
				setTimeout(function() {			
					var tagihanx = ($('#tagih-' + berhitung[1]).val() != '' ? $('#tagih-' + berhitung[1]).val() : 0),
						persenanx = ($('#persen-' + berhitung[1]).val() != '' ? $('#persen-' + berhitung[1]).val() : 0),
												
						/* if(parseInt(persenan) >= 0){
							hasile = parseInt(tagihan) * parseInt(persenan)/100;					
							//total = parseInt(totalx) - parseInt(diskonrp);
						}else{
							hasile=0;
						} */
						hasilex = parseInt(tagihanx) * parseInt(persenanx)/100;
						hasile = Math.round(hasilex);
						//total = parseInt(hasil);
					if (!isNaN(hasile)) {
						$('#hasil-' + berhitung[1]).val(hasile);
						$('#hasilx-' + berhitung[1]).text(hasile);
						//$('#subtotx-' + berhitung[1]).val(total);
						//$('#tagihan').val(total);
						
					}
					
				}, 50); 
			});
		});

		</script>
		<script type="text/javascript">
		$('body').on('focus', '.hitungri', function() {
			var hro = $(this).attr('id'),
				berhitung = hro.split('-');
			$(this).keydown(function() {				
				setTimeout(function() {			
					var tagihanx = ($('#tagihri-' + berhitung[1]).val() != '' ? $('#tagihri-' + berhitung[1]).val() : 0),
						persenanx = ($('#persenri-' + berhitung[1]).val() != '' ? $('#persenri-' + berhitung[1]).val() : 0),
												
						/* if(parseInt(persenan) >= 0){
							hasile = parseInt(tagihan) * parseInt(persenan)/100;					
							//total = parseInt(totalx) - parseInt(diskonrp);
						}else{
							hasile=0;
						} */
						hasilex = parseInt(tagihanx) * parseInt(persenanx)/100;
						hasile = Math.round(hasilex);
						//total = parseInt(hasil);
					if (!isNaN(hasile)) {
						$('#hasilri-' + berhitung[1]).val(hasile);
						$('#hasilxri-' + berhitung[1]).text(hasile);
						//$('#subtotx-' + berhitung[1]).val(total);
						//$('#tagihan').val(total);
						
					}
					
				}, 50); 
			});
		});

		</script>
		<script type="text/javascript">
			jQuery(function($) {
				var date = new Date();
				var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
				$('#id-disable-check').on('click', function() {
					var inp = $('#form-input-readonly').get(0);
					if(inp.hasAttribute('disabled')) {
						inp.setAttribute('readonly' , 'true');
						inp.removeAttribute('disabled');
						inp.value="This text field is readonly!";
					}
					else {
						inp.setAttribute('disabled' , 'disabled');
						inp.removeAttribute('readonly');
						inp.value="This text field is disabled!";
					}
				});
			
			
				if(!ace.vars['touch']) {
					$('.chosen-select').chosen({allow_single_deselect:true}); 
					//resize the chosen on window resize
			
					$(window)
					.off('resize.chosen')
					.on('resize.chosen', function() {
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					}).trigger('resize.chosen');
					//resize chosen on sidebar collapse/expand
					$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
						if(event_name != 'sidebar_collapsed') return;
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					});
			
			
					$('#chosen-multiple-style .btn').on('click', function(e){
						var target = $(this).find('input[type=radio]');
						var which = parseInt(target.val());
						if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
						 else $('#form-field-select-4').removeClass('tag-input-style');
					});
				}
			
			
				$('[data-rel=tooltip]').tooltip({container:'body'});
				$('[data-rel=popover]').popover({container:'body'});
				
				$('textarea[class*=autosize]').autosize({append: "\n"});
				$('textarea.limited').inputlimiter({
					remText: '%n character%s remaining...',
					limitText: 'max allowed : %n.'
				});
			
				$.mask.definitions['~']='[+-]';
				$('.input-mask-date').mask('99/99/9999');
				$('.input-mask-phone').mask('(999) 999-9999');
				$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
				$(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
			
			
			
				$( "#input-size-slider" ).css('width','200px').slider({
					value:1,
					range: "min",
					min: 1,
					max: 8,
					step: 1,
					slide: function( event, ui ) {
						var sizing = ['', 'input-sm', 'input-lg', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
						var val = parseInt(ui.value);
						$('#form-field-4').attr('class', sizing[val]).val('.'+sizing[val]);
					}
				});
			
				$( "#input-span-slider" ).slider({
					value:1,
					range: "min",
					min: 1,
					max: 12,
					step: 1,
					slide: function( event, ui ) {
						var val = parseInt(ui.value);
						$('#form-field-5').attr('class', 'col-xs-'+val).val('.col-xs-'+val);
					}
				});
			
			
				
				//"jQuery UI Slider"
				//range slider tooltip example
				$( "#slider-range" ).css('height','200px').slider({
					orientation: "vertical",
					range: true,
					min: 0,
					max: 100,
					values: [ 17, 67 ],
					slide: function( event, ui ) {
						var val = ui.values[$(ui.handle).index()-1] + "";
			
						if( !ui.handle.firstChild ) {
							$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
							.prependTo(ui.handle);
						}
						$(ui.handle.firstChild).show().children().eq(1).text(val);
					}
				}).find('span.ui-slider-handle').on('blur', function(){
					$(this.firstChild).hide();
				});
				
				
				$( "#slider-range-max" ).slider({
					range: "max",
					min: 1,
					max: 10,
					value: 2
				});
				
				$( "#slider-eq > span" ).css({width:'90%', 'float':'left', margin:'15px'}).each(function() {
					// read initial values from markup and remove that
					var value = parseInt( $( this ).text(), 10 );
					$( this ).empty().slider({
						value: value,
						range: "min",
						animate: true
						
					});
				});
				
				$("#slider-eq > span.ui-slider-purple").slider('disable');//disable third item
			
				
				$('#id-input-file-1 , #id-input-file-2').ace_file_input({
					no_file:'No File ...',
					btn_choose:'Choose',
					btn_change:'Change',
					droppable:false,
					onchange:null,
					thumbnail:false //| true | large
					//whitelist:'gif|png|jpg|jpeg'
					//blacklist:'exe|php'
					//onchange:''
					//
				});
				//pre-show a file name, for example a previously selected file
				//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
			
			
				$('#id-input-file-3').ace_file_input({
					style:'well',
					btn_choose:'Drop files here or click to choose',
					btn_change:null,
					no_icon:'ace-icon fa fa-cloud-upload',
					droppable:true,
					thumbnail:'small'//large | fit
					//,icon_remove:null//set null, to hide remove/reset button
					/**,before_change:function(files, dropped) {
						//Check an example below
						//or examples/file-upload.html
						return true;
					}*/
					/**,before_remove : function() {
						return true;
					}*/
					,
					preview_error : function(filename, error_code) {
						//name of the file that failed
						//error_code values
						//1 = 'FILE_LOAD_FAILED',
						//2 = 'IMAGE_LOAD_FAILED',
						//3 = 'THUMBNAIL_FAILED'
						//alert(error_code);
					}
			
				}).on('change', function(){
					//console.log($(this).data('ace_input_files'));
					//console.log($(this).data('ace_input_method'));
				});
				
				
				//$('#id-input-file-3')
				//.ace_file_input('show_file_list', [
					//{type: 'image', name: 'name of image', path: 'http://path/to/image/for/preview'},
					//{type: 'file', name: 'hello.txt'}
				//]);
			
				
				
			
				//dynamically change allowed formats by changing allowExt && allowMime function
				$('#id-file-format').removeAttr('checked').on('change', function() {
					var whitelist_ext, whitelist_mime;
					var btn_choose
					var no_icon
					if(this.checked) {
						btn_choose = "Drop images here or click to choose";
						no_icon = "ace-icon fa fa-picture-o";
			
						whitelist_ext = ["jpeg", "jpg", "png", "gif" , "bmp"];
						whitelist_mime = ["image/jpg", "image/jpeg", "image/png", "image/gif", "image/bmp"];
					}
					else {
						btn_choose = "Drop files here or click to choose";
						no_icon = "ace-icon fa fa-cloud-upload";
						
						whitelist_ext = null;//all extensions are acceptable
						whitelist_mime = null;//all mimes are acceptable
					}
					var file_input = $('#id-input-file-3');
					file_input
					.ace_file_input('update_settings',
					{
						'btn_choose': btn_choose,
						'no_icon': no_icon,
						'allowExt': whitelist_ext,
						'allowMime': whitelist_mime
					})
					file_input.ace_file_input('reset_input');
					
					file_input
					.off('file.error.ace')
					.on('file.error.ace', function(e, info) {
						//console.log(info.file_count);//number of selected files
						//console.log(info.invalid_count);//number of invalid files
						//console.log(info.error_list);//a list of errors in the following format
						
						//info.error_count['ext']
						//info.error_count['mime']
						//info.error_count['size']
						
						//info.error_list['ext']  = [list of file names with invalid extension]
						//info.error_list['mime'] = [list of file names with invalid mimetype]
						//info.error_list['size'] = [list of file names with invalid size]
						
						
						/**
						if( !info.dropped ) {
							//perhapse reset file field if files have been selected, and there are invalid files among them
							//when files are dropped, only valid files will be added to our file array
							e.preventDefault();//it will rest input
						}
						*/
						
						
						//if files have been selected (not dropped), you can choose to reset input
						//because browser keeps all selected files anyway and this cannot be changed
						//we can only reset file field to become empty again
						//on any case you still should check files with your server side script
						//because any arbitrary file can be uploaded by user and it's not safe to rely on browser-side measures
					});
				
				});
			
				$('#spinner1').ace_spinner({value:0,min:0,max:200,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
				.closest('.ace-spinner')
				.on('changed.fu.spinbox', function(){
					//alert($('#spinner1').val())
				}); 
				$('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, touch_spinner: true, icon_up:'ace-icon fa fa-caret-up bigger-110', icon_down:'ace-icon fa fa-caret-down bigger-110'});
				$('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus bigger-110', icon_down:'ace-icon fa fa-minus bigger-110', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
				$('#spinner4').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus', icon_down:'ace-icon fa fa-minus', btn_up_class:'btn-purple' , btn_down_class:'btn-purple'});
			
				//$('#spinner1').ace_spinner('disable').ace_spinner('value', 11);
				//or
				//$('#spinner1').closest('.ace-spinner').spinner('disable').spinner('enable').spinner('value', 11);//disable, enable or change value
				//$('#spinner1').closest('.ace-spinner').spinner('value', 0);//reset to 0
			
			
				//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,
					
				})
				$('#dp-bulan').datepicker({
					autoclose: true,
					//todayHighlight: true,
					//format: 'yyyy-mm',
					format: 'MM yyyy',
					viewMode: "months",
					minViewMode: "months",
					//autoClose: true,
					toMonthHighlight: true,		
				})
				$('#dp-bulan1').datepicker({
					autoclose: true,
					//todayHighlight: true,
					//format: 'yyyy-mm',
					format: 'MM yyyy',
					viewMode: "months",
					minViewMode: "months",
					//autoClose: true,
					toMonthHighlight: true,		
				})
				
				$('#dp1').datepicker({
					autoclose: true,
					todayHighlight: true,
					
				})
				
				$('#dp2').datepicker({
					autoclose: true,
					todayHighlight: true,
					
				})
				
				$( '#dp-bulan1, #dp1, #dp2').datepicker( 'setDate', today )
				//show datepicker when clicking on the icon
				.next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
			
				//or change it into a date range picker
				$('.input-daterange').datepicker({autoclose:true});
			
			
				//to translate the daterange picker, please copy the "examples/daterange-fr.js" contents here before initialization
				$('input[name=date-range-picker]').daterangepicker({
					'applyClass' : 'btn-sm btn-success',
					'cancelClass' : 'btn-sm btn-default',
					locale: {
						applyLabel: 'Apply',
						cancelLabel: 'Cancel',
					}
				})
				.prev().on(ace.click_event, function(){
					$(this).next().focus();
				});
			
			
				$('#timepicker1').timepicker({
					minuteStep: 1,
					showSeconds: true,
					showMeridian: false
				}).next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
				
				$('#date-timepicker1').datetimepicker().next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
				
			
				$('#colorpicker1').colorpicker();
			
				$('#simple-colorpicker-1').ace_colorpicker();
				//$('#simple-colorpicker-1').ace_colorpicker('pick', 2);//select 2nd color
				//$('#simple-colorpicker-1').ace_colorpicker('pick', '#fbe983');//select #fbe983 color
				//var picker = $('#simple-colorpicker-1').data('ace_colorpicker')
				//picker.pick('red', true);//insert the color if it doesn't exist
			
			
				$(".knob").knob();
				
				
				var tag_input = $('#form-field-tags');
				try{
					tag_input.tag(
					  {
						placeholder:tag_input.attr('placeholder'),
						//enable typeahead by specifying the source array
						source: ace.vars['US_STATES'],//defined in ace.js >> ace.enable_search_ahead
						/**
						//or fetch data from database, fetch those that match "query"
						source: function(query, process) {
						  $.ajax({url: 'remote_source.php?q='+encodeURIComponent(query)})
						  .done(function(result_items){
							process(result_items);
						  });
						}
						*/
					  }
					)
			
					//programmatically add a new
					var $tag_obj = $('#form-field-tags').data('tag');
					$tag_obj.add('Programmatically Added');
				}
				catch(e) {
					//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
					tag_input.after('<textarea id="'+tag_input.attr('id')+'" name="'+tag_input.attr('name')+'" rows="3">'+tag_input.val()+'</textarea>').remove();
					//$('#form-field-tags').autosize({append: "\n"});
				}
				
				
				/////////
				$('#modal-form input[type=file]').ace_file_input({
					style:'well',
					btn_choose:'Drop files here or click to choose',
					btn_change:null,
					no_icon:'ace-icon fa fa-cloud-upload',
					droppable:true,
					thumbnail:'large'
				})
				
				//chosen plugin inside a modal will have a zero width because the select element is originally hidden
				//and its width cannot be determined.
				//so we set the width after modal is show
				$('#modal-form').on('shown.bs.modal', function () {
					if(!ace.vars['touch']) {
						$(this).find('.chosen-container').each(function(){
							$(this).find('a:first-child').css('width' , '210px');
							$(this).find('.chosen-drop').css('width' , '210px');
							$(this).find('.chosen-search input').css('width' , '200px');
						});
					}
				})
				/**
				//or you can activate the chosen plugin after modal is shown
				//this way select element becomes visible with dimensions and chosen works as expected
				$('#modal-form').on('shown', function () {
					$(this).find('.modal-chosen').chosen();
				})
				*/
			
				
				
				$(document).one('ajaxloadstart.page', function(e) {
					$('textarea[class*=autosize]').trigger('autosize.destroy');
					$('.limiterBox,.autosizejs').remove();
					$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu').remove();
				});
			
			});
		</script>
		
		<script type="text/javascript">
			jQuery(function($) {
				//initiate dataTables plugin
				var oTable1 = 
				$('#dynamic-table')
				//.wrap("<div class='dataTables_borderWrap' />")   //if you are applying horizontal scrolling (sScrollX)
				.dataTable( {
					bAutoWidth: false,
					"aoColumns": [
					  { "bSortable": false },
					  null, null,null,null,null,null,null,null,null,null,null,null,
					],
					"aaSorting": [],
			
					//,
					//"sScrollY": "200px",
					//"bPaginate": false,
			
					//"sScrollX": "100%",
					//"sScrollXInner": "120%",
					//"bScrollCollapse": true,
					//Note: if you are applying horizontal scrolling (sScrollX) on a ".table-bordered"
					//you may want to wrap the table inside a "div.dataTables_borderWrap" element
			
					"iDisplayLength": 15
			    } );
				//oTable1.fnAdjustColumnSizing();
			
			
				//TableTools settings
				TableTools.classes.container = "btn-group btn-overlap";
				TableTools.classes.print = {
					"body": "DTTT_Print",
					"info": "tableTools-alert gritter-item-wrapper gritter-info gritter-center white",
					"message": "tableTools-print-navbar"
				}
			
				//initiate TableTools extension
				var tableTools_obj = new $.fn.dataTable.TableTools( oTable1, {
					"sSwfPath": "dek/assets/js/dataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf", //in Ace demo dek/assets will be replaced by correct assets path
					
					"sRowSelector": "td:not(:last-child)",
					"sRowSelect": "multi",
					"fnRowSelected": function(row) {
						//check checkbox when row is selected
						try { $(row).find('input[type=checkbox]').get(0).checked = true }
						catch(e) {}
					},
					"fnRowDeselected": function(row) {
						//uncheck checkbox
						try { $(row).find('input[type=checkbox]').get(0).checked = false }
						catch(e) {}
					},
			
					"sSelectedClass": "success",
			        "aButtons": [
						{
							"sExtends": "copy",
							"sToolTip": "Copy to clipboard",
							"sButtonClass": "btn btn-white btn-primary btn-bold",
							"sButtonText": "<i class='fa fa-copy bigger-110 pink'></i>",
							"fnComplete": function() {
								this.fnInfo( '<h3 class="no-margin-top smaller">Table copied</h3>\
									<p>Copied '+(oTable1.fnSettings().fnRecordsTotal())+' row(s) to the clipboard.</p>',
									1500
								);
							}
						},
						
						{
							"sExtends": "csv",
							"sToolTip": "Export to CSV",
							"sButtonClass": "btn btn-white btn-primary  btn-bold",
							"sButtonText": "<i class='fa fa-file-excel-o bigger-110 green'></i>"
						},
						
						{
							"sExtends": "pdf",
							"sToolTip": "Export to PDF",
							"sButtonClass": "btn btn-white btn-primary  btn-bold",
							"sButtonText": "<i class='fa fa-file-pdf-o bigger-110 red'></i>"
						},
						
						{
							"sExtends": "print",
							"sToolTip": "Print view",
							"sButtonClass": "btn btn-white btn-primary  btn-bold",
							"sButtonText": "<i class='fa fa-print bigger-110 grey'></i>",
							
							"sMessage": "<div class='navbar navbar-default'><div class='navbar-header pull-left'><a class='navbar-brand' href='#'><small>Optional Navbar &amp; Text</small></a></div></div>",
							
							"sInfo": "<h3 class='no-margin-top'>Print view</h3>\
									  <p>Please use your browser's print function to\
									  print this table.\
									  <br />Press <b>escape</b> when finished.</p>",
						}
			        ]
			    } );
				//we put a container before our table and append TableTools element to it
			    $(tableTools_obj.fnContainer()).appendTo($('.tableTools-container'));
				
				//also add tooltips to table tools buttons
				//addding tooltips directly to "A" buttons results in buttons disappearing (weired! don't know why!)
				//so we add tooltips to the "DIV" child after it becomes inserted
				//flash objects inside table tools buttons are inserted with some delay (100ms) (for some reason)
				setTimeout(function() {
					$(tableTools_obj.fnContainer()).find('a.DTTT_button').each(function() {
						var div = $(this).find('> div');
						if(div.length > 0) div.tooltip({container: 'body'});
						else $(this).tooltip({container: 'body'});
					});
				}, 200);
				
				
				
				//ColVis extension
				var colvis = new $.fn.dataTable.ColVis( oTable1, {
					"buttonText": "<i class='fa fa-search'></i>",
					"aiExclude": [0, 6],
					"bShowAll": true,
					//"bRestore": true,
					"sAlign": "right",
					"fnLabel": function(i, title, th) {
						return $(th).text();//remove icons, etc
					}
					
				}); 
				
				//style it
				$(colvis.button()).addClass('btn-group').find('button').addClass('btn btn-white btn-info btn-bold')
				
				//and append it to our table tools btn-group, also add tooltip
				$(colvis.button())
				.prependTo('.tableTools-container .btn-group')
				.attr('title', 'Show/hide columns').tooltip({container: 'body'});
				
				//and make the list, buttons and checkboxed Ace-like
				$(colvis.dom.collection)
				.addClass('dropdown-menu dropdown-light dropdown-caret dropdown-caret-right')
				.find('li').wrapInner('<a href="javascript:void(0)" />') //'A' tag is required for better styling
				.find('input[type=checkbox]').addClass('ace').next().addClass('lbl padding-8');
			
			
				
				/////////////////////////////////
				//table checkboxes
				$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
				
				//select/deselect all rows according to table header checkbox
				$('#dynamic-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
					var th_checked = this.checked;//checkbox inside "TH" table header
					
					$(this).closest('table').find('tbody > tr').each(function(){
						var row = this;
						if(th_checked) tableTools_obj.fnSelect(row);
						else tableTools_obj.fnDeselect(row);
					});
				});
				
				//select/deselect a row when the checkbox is checked/unchecked
				$('#dynamic-table').on('click', 'td input[type=checkbox]' , function(){
					var row = $(this).closest('tr').get(0);
					if(!this.checked) tableTools_obj.fnSelect(row);
					else tableTools_obj.fnDeselect($(this).closest('tr').get(0));
				});
				
			
				
				
					$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
					e.stopImmediatePropagation();
					e.stopPropagation();
					e.preventDefault();
				});
				
				
				//And for the first simple table, which doesn't have TableTools or dataTables
				//select/deselect all rows according to table header checkbox
				var active_class = 'active';
				$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
					var th_checked = this.checked;//checkbox inside "TH" table header
					
					$(this).closest('table').find('tbody > tr').each(function(){
						var row = this;
						if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
						else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
					});
				});
				
				//select/deselect a row when the checkbox is checked/unchecked
				$('#simple-table').on('click', 'td input[type=checkbox]' , function(){
					var $row = $(this).closest('tr');
					if(this.checked) $row.addClass(active_class);
					else $row.removeClass(active_class);
				});
			
				
			
				/********************************/
				//add tooltip for small view action buttons in dropdown menu
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				
				//tooltip placement on right or left
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					//var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			
			})
		</script>
		
		<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>
	</body>
</html>
