Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- //include("koneksi.php");
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "javiscoi_task";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- session_start();
- $id_project = $_GET['id_project'];
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Purchase Order</title>
- <style>
- body {
- background: rgb(204,204,204);
- }
- page {
- background: white;
- display: block;
- margin: 0 auto;
- margin-bottom: 0.5cm;
- box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
- }
- page[size="A4"] {
- width: 21cm;
- }
- page[size="A4"][layout="portrait"] {
- width: 29.7cm;
- height: 21cm;
- }
- @media print {
- body, page {
- margin: 0;
- box-shadow: 0;
- }
- }
- .button {
- background-color: #2a3f54;
- border: none;
- color: white;
- padding: 10px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 12px;
- margin: 4px 2px;
- cursor: pointer;
- }
- .button1 {border-radius: 6px;}
- </style>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
- </head>
- <body>
- <!--<p> Test1: <button id="btnExport" onclick="javascript:xport.toXLS('testTable');"> Export to XLS</button> <em> Export the table to XLS with CSV fallback for IE & Edge</em>
- </p>-->
- <p><button id="btnExport" onclick="javascript:xport.toCSV('testTable');" class="button button1"> Export to CSV</button></p>
- <br>
- <page size="A4">
- <table id="testTable" rules="groups" frame="hsides" border="1" style="margin-left:4%;" class="table table-striped">
- <thead valign="top">
- <tbody valign="top">
- <tr>
- <th></th>
- <th colspan="7" style="font-weight: bold; padding: 5px;"> PT. Javis Teknologi Albarokah</th>
- </tr>
- <tr>
- <th></th>
- <th colspan="7" style="font-weight: bold; padding: 5px;"> Jl. Elang Jawa No.12, Yogyakarta</th>
- </tr>
- </tbody>
- <tr><td></td></tr>
- <tr>
- <th></th>
- <th colspan="7" style="font-weight: bold; padding: 5px;"> Purchase Order</th>
- </tr>
- <tr><td></td></tr>
- <tbody>
- <tr>
- <th></th>
- <?php
- $sql = "SELECT id_project, projectname, description, client, start, deadline FROM project WHERE id_project='$id_project'";
- $result = $conn->query($sql);
- foreach ($result as $value)
- ?>
- <th colspan="7" align="left" style="padding-bottom: 10px; padding-top: 10px; font-weight: bold;"> Nama Project : <?php echo $value['projectname']; ?></th>
- </tr>
- <tr>
- <th></th>
- <th colspan="7" align="left" style="padding-bottom: 10px; font-weight: bold;"> Kode Project : <?php echo $value['id_project']; ?></th>
- </tr>
- <tr>
- <th></th>
- <th colspan="7" align="left" style="padding-bottom: 10px; font-weight: bold;"> Deskripsi : <?php echo $value['description']; ?></th>
- </tr>
- <tr>
- <th></th>
- <th colspan="7" align="left" style="padding-bottom: 10px; font-weight: bold;"> Klien : <?php echo $value['client']; ?></th>
- </tr>
- <tr>
- <th></th>
- <th colspan="7" align="left" style="padding-bottom: 10px; font-weight: bold;"> Tanggal Mulai : <?php echo $value['start']; ?></th>
- </tr>
- <tr>
- <th></th>
- <th colspan="7" align="left" style="padding-bottom: 10px; font-weight: bold;"> Tanggal Akhir : <?php echo $value['deadline']; ?></th>
- </tr>
- </tbody>
- <?php
- $result = mysqli_query($conn, "SELECT id_task FROM task WHERE id_project=$id_project"); $i=0;
- $jumlahTask = mysqli_num_rows($result);
- while($row = mysqli_fetch_assoc($result)){
- $list[$i]=$row['id_task']; $i++;
- }
- for($i=0;$i<$jumlahTask;$i++){
- $result = mysqli_query($conn, "SELECT taskname, taskto, FROM task WHERE a.id_task='$list[$i]'");
- while($row = mysqli_fetch_assoc($result)){
- echo"
- <tbody>
- <tr>
- <th></th>
- <th colspan='7' align='left' style='font-weight: bold;'> Item Pekerjaan : ".$row['taskname']." </th>
- </tr>
- <tr>
- <th></th>
- <th colspan='7' align='left' style='font-weight: bold;'> Divisi Penanggung Jawab : ".$row['taskto']."</th>
- </tr>
- <tr>
- <td style='font-weight: bold; padding: 5px;'></td>
- </tr>
- </tbody>";
- $result2 = mysqli_query($conn, "SELECT a.id_order, a.part_order, a.qty_order, a.unit_order FROM orders a, task b WHERE a.id_task=b.id_task AND a.id_task=$list[$i]");
- while($row2 = mysqli_fetch_assoc($result2)){
- echo"
- <tbody>
- <tr>
- <th></th>
- <th></th>
- <th style='background-color: #2a3f54; color: #fff;' width='350px;'>Detail Item Pekerjaan</th>
- <th align='right' style='background-color: #2a3f54; color: #fff;' width='50px;'>Qty</th>
- <th align='right' style='background-color: #2a3f54; color: #fff;' width='80px;'>Satuan</th>
- <th></th>
- <th></th>
- </tr>
- </tbody>
- <tr>
- <td></td>
- <td></td>
- <td>".$row2['part_order']."</td></td>
- <td align='right'>".$row2['qty_order']."</td></td>
- <td align='right'>".$row2['unit_order']."</td></td>
- <td></td>
- <td></td>
- </tr>";
- }}}
- ?>
- </table>
- <br>
- <br>
- </page>
- <script src="js/excels.js"></script>
- <script src="js/jquery.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement