Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config.php';
- $sql = "SELECT nama_perusahaan, jumlah_pesanan, datediff(target_selesai, start) AS lama_pengerjaan, datediff(deadline, start) AS batas_waktu_pengerjaan
- FROM tbl_purchaseorder
- ORDER BY batas_waktu_pengerjaan ASC";
- $hasil = mysqli_query($con, $sql);
- $sql2 = "SELECT datediff(target_selesai, start) AS lama_pengerjaan, datediff(deadline, start) AS batas_waktu_pengerjaan, sum(datediff(target_selesai, start)) AS jml_aliran_waktu, COUNT(nomor_po) AS jml_pekerjaan, sum(datediff(target_selesai, start)) AS total_lama_pengerjaan
- FROM tbl_purchaseorder
- ORDER BY batas_waktu_pengerjaan ASC";
- $hasil2 = mysqli_query($con, $sql2);
- ?>
- <div class="card shadow mb-4">
- <div class="card-header py-3">
- <h6 class="m-0 font-weight-bold text-primary">Prediksi Perhitungan Waktu</h6>
- </div>
- <div class="card-body">
- <div class="table-responsive">
- <table class="table table-hover" width="100%" cellspacing="0">
- <tr>
- <td>Waktu Penyelesaian Rata-Rata</td>
- <td>:</td>
- <td>
- <?php
- if ($row2 = mysqli_fetch_assoc($hasil2)) {
- $waktu_penyelesaian_rata_rata = $row2['jml_aliran_waktu'] / $row2['jml_pekerjaan'];
- ?>
- <?= round($waktu_penyelesaian_rata_rata); ?>
- <?php }
- ?>
- Hari
- </td>
- <td>Utilisasi</td>
- <td>:</td>
- <td>
- <?php
- if ($row2 = mysqli_fetch_assoc($hasil2)) {
- $utilisasi = $row2['total_lama_pengerjaan'] / $row2['jml_aliran_waktu'];
- ?>
- <?= round($utilisasi); ?>
- <?php }
- ?>
- %
- </td>
- </tr>
- <tr>
- <td>Jumlah Pekerjaan Rata-Rata</td>
- <td>:</td>
- <td>
- asd
- </td>
- <td>Rata-Rata Keterlambatan</td>
- <td>:</td>
- <td>???</td>
- </tr>
- <tbody>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <div class="card shadow mb-4">
- <div class="card-header py-3">
- <h6 class="m-0 font-weight-bold text-primary">Prioritas Penjadwalan</h6>
- </div>
- <div class="card-body">
- <div class="table-responsive">
- <table class="table table-hover" id="dataTable" width="100%" cellspacing="0">
- <thead class="thead-light" align="center">
- <tr>
- <th>#</th>
- <th>Klien</th>
- <th>Jumlah Pesanan (unit)</th>
- <th>Lama Pengerjaan (hari)</th>
- <th>Aliran Waktu (hari)</th>
- <th>Batas Waktu Pengerjaan (hari)</th>
- <th>Keterlambatan (hari)</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 1;
- while ($row = mysqli_fetch_assoc($hasil)) {
- // $aliran_waktu = 0;
- $aliran_waktu += $row['lama_pengerjaan'];
- $keterlambatan = $aliran_waktu - $row['batas_waktu_pengerjaan'];
- ?>
- <tr align="center">
- <th scope="row"><?= $i++ ?></th>
- <td><?= $row['nama_perusahaan']; ?></td>
- <td><?= $row['jumlah_pesanan']; ?></td>
- <td><?= $row['lama_pengerjaan']; ?></td>
- <td><?= $aliran_waktu; ?></td>
- <td><?= $row['batas_waktu_pengerjaan']; ?></td>
- <td><?php
- if ($keterlambatan < 0) {
- $keterlambatan = 0;
- echo $keterlambatan;
- } else {
- echo $keterlambatan;
- }
- ?></td>
- </tr>
- <?php }
- ?>
- <tfoot align="center" class="thead-light">
- <th colspan="2">
- Jumlah
- </th>
- <th>??</th>
- <th>??</th>
- <th>??</th>
- <th>??</th>
- <th>??</th>
- </tfoot>
- </tbody>
- </table>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement