<?php
include 'koneksi.php';
$bulans = array("Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des");
?>
<!DOCTYPE HTML>
<html>
<head>
  <title></title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="keywords" content="Modern Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
  Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
  <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
  <link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
</head>
<body style="width:100%; padding:30px;">
  <div id="wrapper">
    <div id="page-wrapper">
      <div class="graphs" style="font-family:'Tahoma';">
        <?php
        echo "<img src='logo.png' style='width:300px;margin-left:0px;margin-bottom:10px;' />";
        echo "<div class=widget_head style='margin-left:5px;'>Laporan Keluhan Pelanggan<br />Periode ".$bulans[$_GET['bulan']-1]." ".$_GET['tahun']."</div><hr>";
        ?>
        <div class="col-md-12">
          <table class="table table-bordered" style="background-color:white;text-color:black;;font-size:10px;">
            <thead>
              <tr>
                <th>No.</th>
                <th>Tanggal</th>
                <th>Pelanggan</th>
                <th>Isi Keluhan</th>
                <th>Harapan</th>
                <th>Balasan</th>
              </tr>
            </thead>
            <tbody>
              <?php
              $query2=mysqli_query($koneksi, "SELECT * FROM keluhan p, pengguna o WHERE p.id_pengguna=o.id_pengguna
                AND MONTH(p.tanggal)='".$_GET['bulan']."' AND YEAR(p.tanggal)='".$_GET['tahun']."'
                ORDER BY p.tanggal DESC");
              if(mysqli_num_rows($query2) > 0){
                $no = 1;
                while($result2=mysqli_fetch_array($query2)) {
                  echo "<tr>";
                  echo "<td style='vertical-align:middle'>".$no."</td>";
                  echo "<td style='vertical-align:middle'>".tanggalIndo($result2['tanggal'])."</td>";
                  echo "<td style='vertical-align:middle'>".$result2['nama_pengguna']."<br />".$result2['handphone']."</td>";
                  echo "<td style='vertical-align:middle'>".$result2['keluhan']."</td>";
                  echo "<td style='vertical-align:middle'>".$result2['harapan']."</td>";
                  echo "<td style='vertical-align:middle'>".$result2['balasan']."</td>";
                  echo "</tr>";
                  $no++;
                }
              } else {
                echo "<tr>";
                echo "<td colspan=10 style='vertical-align:middle'><center>Data Keluhan Kosong...</center></td>";
                echo "</tr>";
              }
              ?>
            </tbody>
          </table>
        </div>
        <div class="clearfix"></div>

      </div>
    </div>
  </div>
</body>
</html>
<script>
window.print();
</script>
