<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12" align="justify">
            <h3 class="page-wrapper">Hasil Perhitungan Suara Musyda PDPM Kabupaten Pekalongan</h3> 
            <button onclick="window.print()">Cetak Halaman</button>
            
<div class="col-lg-12">
				<hr>
			<!--	<div class="row">

					<div class="col-lg-3" align="center">
						<h1><?php echo $jmlformatur; ?></h1>
						<div class='label label-primary'>Jumlah Calon Formatur</div>
					</div>

					<!--<div class="col-lg-4" align="center">
						<h1><?php echo $sementara; ?></h1>
						<div class='label label-primary'>Pemilih Sementara</div>
					</div> 
					<div class="col-lg-3" align="center">
						<h1><?php echo $tetap; ?></h1>
						<div class='label label-primary'>Jumlah Pemilih Tetap</div>
					</div>
					
					<div class="col-lg-3" align="center">
						<h1><?php echo $sah; ?></h1>
						<div class='label label-primary'>Jumlah Sudah Memilih</div>
					</div>
				<!--	<div class="col-lg-3" align="center">
						<h1><?php echo $belumpilih; ?></h1>
						<div class='label label-primary'>Jumlah Belum Memilih</div> 
				</div>
				
			</div>
</div>-->
				
           
           
           </div>
     <hr>
			<table id="examples" class="table table-striped responsive-utilities">
                <thead>
                    <tr class="headings" align="center">
                      
                        <th class="col-lg-1">Nomor Urut Calon</th>
                        <th class="col-lg-5">Nama Calon Formatur </th>
                        <th class="col-lg-1">Perolehan Suara</th>
                        <th class="col-lg-5">Presentase Suara</th>
                    </tr>
                </thead>

                	<tbody>

					   <?php foreach($formatur->result_array() as $f) { ?>
							<?php
								$pi = 0;
								$total = $hitung->num_rows();
							?>
							<tr class="even pointer">
							    
							    <td class=" "><strong><?php echo $f['id'];?> </strong>   </td>
							    
								<td class=" "><img style="width: 5%; height: 5%" align="left" class="circle"  src="<?php echo base_url(); ?>dist/img/<?php echo $f['foto'] ?>" alt="icon"  > &nbsp; &nbsp;&nbsp; <strong> <?php echo $f['nama']; ?></strong></td>
								

								<?php foreach($hitung->result_array() as $p) { ?>
									<?php
										$pilih = $p['pilih'];
										$dd = explode(" ", $pilih);
										for($i=0;$i<count($dd);$i++)
										 { 
											if($dd[$i]==$f['id']) {
												$pi=$pi+1;
											}
										 } 
									?>

								<?php } 
									if($pi!=0){
										$persen = (100/$total)*$pi;
									} else {
										$persen = "0";
									} 
								?>
								<td class=" " align="center"><b><?php echo $pi; ?></b></td>

								<td class=" ">
									<div class="col-lg-12">
										<div class="progress progress-striped active" style="margin-top:0px; margin-bottom:0px;">
											<div class="progress-bar" style="width:<?php echo $persen; ?>%" ></div>
										</div>

									</div>
									<br/>
									<p style="margin-top:-30px; margin-bottom:0px; margin-left:15px"><small><?php echo $persen; ?> %</small></p>
								</td>
							</tr>
						<?php } ?> 
					</tbody>
            </table>
			
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /#page-wrapper -->

		<script src="<?php echo base_url(); ?>dist/js/jquery.dataTables.js"></script>
        
        <script>
        $(document).ready(function() {
            $('#examples').dataTable();
        } );

        </script>