Advertisement
cahyadsn

Angka Kebutuhan Guru

Aug 3rd, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.81 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set('display_errors', 1);
  4. require_once "../../Config/setup.php";
  5. require_once "../../Includes/2006/function/func_getKelompok.php";
  6. include "../../includes/2006/function/func_viewNasional1.php";
  7. include "../../includes/2006/array/arr_getMapel_id1.php";
  8. include "../../includes/2006/function/func_viewProduktip.php";
  9. if (isset($_POST['status']) && isset($_POST['ptk'])) {
  10.     if ($_POST['status'] === "0") {
  11.         $status = ">= 1";
  12.         $stat = "SEMUA";
  13.     } elseif($_POST['status'] === "1") {
  14.         $status = "= 1";
  15.         $stat = "NEGERI";
  16.     } else {
  17.         $status = "= 2";
  18.         $stat = "SWASTA";
  19.     }
  20.      if ($_POST['ptk'] === "0") {
  21.         $ptk = "> 1";
  22.         $pt = "SEMUA";
  23.     } elseif($_POST['ptk'] === "1"){
  24.         $ptk = "<= 3";
  25.         $pt = "PNS";
  26.     } else {
  27.         $ptk = "> 3";
  28.         $pt = "NON PNS";
  29.     }
  30. }
  31. ?>
  32. <!DOCTYPE html>
  33. <html>
  34. <head>
  35.     <title>Angka Kebutuhan Guru - <?php echo $site_name?></title>
  36.     <meta charset="utf-8">
  37.     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  38.     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  39.     <?php include('../../Config/css.php');?>
  40. </head>
  41. <body>
  42.     <div class="blog-masthead">
  43.         <div class="container">
  44.             <?php include('../../Template/nav.php'); ?>
  45.         </div>
  46.     </div>
  47. <div class="container">
  48.     <h4 class="blog-header">ADAPTIF/NORMATIF/BK</h4>
  49.     <?php
  50.     $mapel = array(
  51.       'agama'=>'Agama & Budi Pekerti',
  52.       'pkn'=>'PKN',
  53.       'indo'=>'B. Indo',
  54.       'penjas'=>'Penjas',
  55.       'senibudaya'=>'Seni Budaya',
  56.       'inggris'=>'B. Inggr',
  57.       'mtk'=>'MTK',
  58.       'ipa'=>'IPA',
  59.       'fisika'=>'Fisika',
  60.       'kimia'=>'Kimia',
  61.       'biologi'=>'Biologi',
  62.       'ips'=>'IPS',
  63.       'kkpi'=>'KKPI',
  64.       'mulok'=>'Mulok',
  65.       'wirausaha'=>'Wirausaha',
  66.       'BK'=>'BK');
  67.     ?>
  68.     <div class="table-responsive">
  69.         <table id="mapel" class="table table-bordered table-striped table-hover">
  70.             <thead>
  71.             <tr>
  72.                 <th align="center" rowspan="2" class="active">NO</th>
  73.                 <th align="center" rowspan="2" class="active">PROPINSI</th>
  74.                 <?php foreach($mapel as $mp) echo "<th align='center' colspan='3' class='active'>{$mp}</th>";?>
  75.                 <th align="center" colspan="3" class="success">Total KG</th>
  76.             </tr>
  77.             <tr>
  78.                 <?php str_repeat("<th>A</th><th>I</th><th>LK</th>",16);?>
  79.                 <th align="center" class="success">A</th>
  80.                 <th align="center" class="success">I</th>
  81.                 <th align="center" class="success">LK</th>
  82.             </tr>
  83.             </thead>
  84.             <tbody>
  85.             <?php
  86.                 $no=1;
  87.                 $jenis=array('a','i','lk');
  88.                 $data=array();
  89.                 $total=array();
  90.                 foreach($jenis as $j) $data[$j]=array();
  91.                 $results = tampilNasional($conn, $status, $ptk);
  92.                 while($row = sqlsrv_fetch_array($results, SQLSRV_FETCH_ASSOC))
  93.                 {
  94.                   foreach($mapel as $m=>$v)
  95.                     foreach($jenis as $j)
  96.                       $data[$j][$m]=(isset($data[$j][$m])?$data[$j][$m]:0)+$row[$j.'_'.$m];
  97.                   foreach($jenis as $j)
  98.                     $total[$j]=(isset($total[$j])?$total[$j]:0)
  99.                               +(isset($row['total_'.$j])?$row['total_'.$j]:$row['total_a']-$row['total_i']);
  100.                 ?>
  101.                 <tr>
  102.                     <td><?php echo $no++;?></td>
  103.                     <td style="min-width:200px"><a href="propinsi.php?propinsi=<?php echo $row['kode_wilayah']?>">
  104.                     <?php echo $row['propinsi']?></a></td>
  105.                     <?php
  106.                       foreach($mapel as $m=>$v)
  107.                         foreach($jenis as $j)
  108.                           echo "<td>".round($row[$j.'_'.$m])."</td>";
  109.                     ?>
  110.                     <td class="success"><?php echo round($row['total_a']);?>{</td>
  111.                     <td class="success"><?php echo round($row['total_i']);?></td>
  112.                     <td class="success"><?php echo round($row['total_a']-$row['total_i'])?></td>
  113.                  <?php
  114.                  }
  115.                  ?>
  116.                 </tr>
  117.                 <tr>
  118.                     <th class = "success" align="center"></th>
  119.                     <th class = "success" align="center">TOTAL/MAPEL</th>
  120.                     <?php
  121.                     foreach($mapel as $m=>$v)
  122.                       foreach($jenis as $j)
  123.                         echo "<th class='success'>".round($data[$j][$m])."</th>";
  124.                     foreach($jenis as $j) echo "<th class='success'>".round($total[$j])."</th>";
  125.                     ?>
  126.                 </tr>
  127.             </tbody>
  128.         </table>
  129.     </div><!-- /.box-body -->
  130. </div>
  131. <br />
  132.  <div class="container">
  133.         <h4>PRODUKTIF</h4>
  134.         <div class="table-responsive">
  135.             <table id="prodi" class="table table-bordered table-striped table-hover">
  136.                 <?php
  137.                 $prov = '';
  138.                 $data = array();
  139.                 $jur= array();
  140.                 $result = viewProduktip($conn);
  141.                 while($row = sqlsrv_fetch_array($result)){
  142.                     if($prov != $row['propinsi']){
  143.                         $prov = $row['propinsi'];
  144.                         $data[$prov]=array();
  145.                     }
  146.                     $data[$prov][$row['jurusan_id']] = array(
  147.                         "a"=>$row['a_produktif'],
  148.                         "i"=>$row['i_produktip'],
  149.                         "lk"=>$row['a_produktif']-$row['i_produktif']);
  150.                     $jur[$row['jurusan_id']]=$row['nama_jurusan'];
  151.                 }
  152.                 ?>
  153.                 <thead>
  154.                     <tr>
  155.                         <th align="center" rowspan="2" class="active">NO</th>
  156.                         <th align="center" rowspan="2" class="active" style="min-width:200px">SEKOLAH</th>
  157.                         <?php foreach($jur as $j) echo "<th align='center' colspan='3' class='active'>{$j}</th>";?>
  158.                         <th align="center" colspan="3" class="success">TOTAL/PROPINSI</th>
  159.                     </tr>
  160.                     <tr>
  161.                         <?php echo str_repeat("<th>A</th><th>I</th><th>LK</th>",count($jur)); ?>
  162.                         <th align="center" class="success">A</th>
  163.                         <th align="center" class="success">I</th>
  164.                         <th align="center" class="success">LK</th>
  165.                     </tr>
  166.                 </thead>
  167.                 <tbody>
  168.                   <?php
  169.                   $no = 0;
  170.                   $type=array('a','i','lk');
  171.                   $subtotal=array();
  172.                   $total=array();
  173.                   foreach ($data as $prov => $jurusan){
  174.                     $subtotal[$prov]=array();
  175.                     echo "
  176.                      <tr>
  177.                        <td align='center' class='active'>".($no++)."</td>
  178.                        <td class='active' style='min-width:200px'>{$prov}</td>";
  179.                         foreach ($jurusan as $j=>$jrs){
  180.                           if(!isset($total[$j])) $total[$j]=array();
  181.                           foreach($type as $t)
  182.                           {
  183.                             $subtotal[$prov][$t]=(isset($subtotal[$prov][$t])?$subtotal[$prov][$t]:0)+$jrs[$t];
  184.                             $total[$j][$t]=(isset($total[$j][$t])?$total[$j][$t]:0)+$jrs[$t];
  185.                             echo "<td>".round($jrs[$t])."</td>";
  186.                           }
  187.                           foreach($type as $t) echo "<td align='center' class='success'>{$subtotal[$prov][$t]}</td>";
  188.                         }
  189.                     echo "</tr>";
  190.                   }
  191.                   ?>
  192.                   <tr>
  193.                     <td align="center" class="success"></td>
  194.                     <td align="center" class="success"> TOTAL/JURUSAN </td>
  195.                     <!-- TOTAL BAWAH -->
  196.                     <?php
  197.                       $grandtotal=array();
  198.                       foreach($jur as $j=>$v)
  199.                         foreach($type as $t)
  200.                         {
  201.                           echo "<td align='center' class='success'>{$total[$j][$t]}</td>";
  202.                           $grandtotal[$t]=(isset($grandtotal[$t])?$grandtotal[$t]:0)+$total[$j][$t];
  203.                         }
  204.                       foreach($type as $t) echo "<td align='center' class='success'>{$grandtotal[$t]}</td>";
  205.                     ?>
  206.                   </tr>
  207.                 </tbody>
  208.             </table>
  209.         </div><!-- /.box-body -->
  210.     </div><!-- /.container -->
  211.     <?php include('../../Template/footer.php'); ?>
  212.     <?php include('../../Config/js.php'); ?>
  213.     <script type="text/javascript">
  214.         $(document).ready(function() {
  215.             var table = $('#mapel').DataTable( {
  216.                 scrollY:        "400px",
  217.                 scrollX:        true,
  218.                 scrollCollapse: true,
  219.                 paging:         false,
  220.                 bSort:          false,
  221.                 bFilter:        true
  222.             } );
  223.  
  224.             new $.fn.dataTable.FixedColumns( table, {
  225.                 leftColumns: 2
  226.             } );
  227.         } );
  228.         $(document).ready(function() {
  229.             var table = $('#prodi').DataTable( {
  230.                 scrollY:        "400px",
  231.                 scrollX:        true,
  232.                 scrollCollapse: true,
  233.                 paging:         false,
  234.                 bSort:          false,
  235.                 bFilter:        true
  236.             } );
  237.  
  238.             new $.fn.dataTable.FixedColumns( table, {
  239.                 leftColumns: 2
  240.             } );
  241.         } );
  242.     </script>
  243. </body>
  244. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement