Guest User

Untitled

a guest
Jan 4th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php
  2.     include"koneksi.php";
  3.    
  4.     $sebelum = $_GET['season']-1;
  5.    
  6.     $sql = "SELECT DISTINCT t_order.refbuyer,t_order.nama    FROM `t_kirim`,`t_order` WHERE
  7.     t_order.buyer LIKE '%$_GET[buyer]%'
  8.     AND t_kirim.buyer LIKE '%$_GET[buyer]%'
  9.     AND t_order.refbuyer = t_kirim.refbuyer
  10.     AND t_order.season BETWEEN '$sebelum'
  11.     AND '$_GET[season]' AND t_kirim.season BETWEEN '$sebelum'
  12.     AND '$_GET[season]'
  13.     ORDER BY t_order.refbuyer ASC ";
  14.    
  15.     $result = $conn->query($sql);
  16.    
  17. ?>
  18. <center> Season <b><?php echo $sebelum; ?> - <?php echo $_GET['season']; ?></b> | Buyer <b><?php echo $_GET['buyer']; ?></b></center>
  19. <hr>
  20. <div class="scroll">
  21. <table style="font-size:12px;" class="table table-hover">
  22.     <thead>
  23.         <tr bgcolor="#00A3FF" style="color:#FFFFFF";>
  24.             <th class="col-xs-2"> Ref Buyer </th>
  25.             <th width="250px"> Item </th>
  26.             <th> Order </th>
  27.             <th> Kirim </th>
  28.             <th> Balance </th>
  29.         </tr>
  30.     </thead>
  31.     <tbody>
  32.     <?php while($c = $result->fetch_assoc()) : extract($c);
  33.     $data_qorder=0;
  34.     $data_qkirim=0;
  35.     $sql2 = "SELECT t_order.qorder,t_kirim.qkirim
  36.     FROM t_order
  37.         inner join t_kirim
  38.             on t_order.refbuyer=t_kirim.refbuyer
  39.    WHERE   t_order.refbuyer='$refbuyer'
  40.    ORDER BY t_order.refbuyer ASC"
  41.  
  42.     $result2 = $conn->query($sql2);
  43.     while($c = $result->fetch_assoc()) : extract($c);
  44.          $data_qorder += $qorder;
  45.          $data_qkirim += $qkirim;
  46.     endWhile;
  47.     $balance = $data_qorder-$data_qkirim;
  48.        
  49.     ?>
  50.     <tr>
  51.         <td> <?php echo $refbuyer; ?> </td>
  52.         <td> <?php echo $nama; ?> </td>
  53.         <td> <?php echo $data_qorder; ?></td>
  54.         <th> <?php echo $data_qkirim; ?> </th>
  55.         <th> <?php echo $balance; ?> </th>
  56.     </tr>
  57.     <?php endWhile; ?>
  58.     </tbody>
  59. </table>
  60. </div>
Advertisement
Add Comment
Please, Sign In to add comment