Advertisement
kura2yamato

Source Code Cetak Form Kasir PDF

Aug 1st, 2022
1,342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Koneksi.php
  2. <?php
  3. @session_start(); //ada ini
  4. $koneksi = ....; //asumsikan sama
  5. ?>
  6.  
  7. <?php
  8.       require_once( '../koneksi.php');
  9.     error_repoting(0); //kalau bisa jangan
  10.       //session_start();
  11. ?>
  12. <!DOCTYPE html>
  13. <html>
  14. <head>
  15.   <meta charset="utf-8">
  16.   <meta http-equiv="X-UA-Compatible" content="IE=edge">
  17.   <title>LAPORAN FORM KASIR DANGROUP</title>
  18. </head>
  19.  
  20. <body>
  21.   <style type="text/css">
  22.     body{
  23.       font-family: serif, sans-serif;
  24.     }
  25.  
  26.     .table{
  27.       width: 100%;
  28.     }
  29.  
  30.     h4 {
  31.       font: 10px serif, sans-serif;
  32.     }
  33.    
  34.     th,td{
  35.       font-size: 7px;
  36.     }
  37.  
  38.     tr {
  39.     }
  40.  
  41.     .table,
  42.     .table th,
  43.     .table td,
  44.     .table tr {
  45.       padding: 8px;
  46.       border: 1px solid black;
  47.       border-collapse: collapse;
  48.     }
  49.  
  50.     .text-center{
  51.       text-align: center;
  52.     }
  53.  
  54.     .text-right{
  55.       text-align: right;
  56.     }
  57.  
  58.     .text-left{
  59.       text-align: left;
  60.     }
  61.   </style>
  62.  
  63.   <center>
  64.     <h4>LAPORAN <br/> FORM KASIR DANGROUP</h4>
  65.   </center>
  66.  
  67.   <br>
  68.  
  69.   <?php
  70.   if(isset($_GET['tanggal_sampai']) && isset($_GET['tanggal_dari'])){
  71.     $tgl_dari = $_GET['tanggal_dari'];
  72.     $tgl_sampai = $_GET['tanggal_sampai'];
  73.     $divisi_id = $_SESSION['divisi_id'];
  74.     $divisi = mysqli_query($koneksi,"select * from divisi where divisi_id='$divisi_id'");
  75.     $divisi = mysqli_fetch_assoc($divisi);
  76.     ?>
  77.  
  78.       <table style="margin-left: 5px;">
  79.         <tr>
  80.           <th class="text-left" width="3cm">DARI TANGGAL</th>
  81.           <th class="text-center" width="1cm">:</th>
  82.           <td class="text-left"><?php echo date('d-m-Y',strtotime($tgl_dari)); ?></td>
  83.         </tr>
  84.         <tr>
  85.           <th class="text-left">SAMPAI TANGGAL</th>
  86.           <th class="text-center">:</th>
  87.           <td class="text-left"><?php echo date('d-m-Y',strtotime($tgl_sampai)); ?></td>
  88.         </tr>
  89.         <tr>
  90.           <th class="text-left">DIVISI</th>
  91.           <th class="text-center">:</th>
  92.           <td><?php echo $divisi['divisi']; ?></td>
  93.         </tr>
  94.       </table>
  95.  
  96.         <table class="table">
  97.           <tr>
  98.                 <th class="text-center">TANGGAL</th>
  99.                 <th class="text-center">SHIFT</th>
  100.                 <th class="text-center">NAMA KASIR</th>
  101.                 <th class="text-center">ACC</th>
  102.                 <th class="text-center">VOUCHER</th>
  103.                 <th class="text-center">DEPOSIT</th>
  104.                 <th class="text-center">SPPOB</th>
  105.                 <th class="text-center">PPOB</th>
  106.                 <th class="text-center" >MEMBER</th>
  107.                 <th class="text-center">BANK GUDANG</th>
  108.                 <th class="text-center">BANK SERVER</th>
  109.           </tr>
  110.    
  111.           <?php
  112.             require_once( '../koneksi.php'); //kok ngulang??
  113.               $total_acc = 0;
  114.               $total_voucher = 0;
  115.               $total_deposit = 0;
  116.               $total_sppob = 0;
  117.               $total_ppob = 0;
  118.               $total_member = 0;
  119.               $sql ="SELECT * FROM form_kasir join bank on form_kasir.bank_server = bank.id_bank JOIN bank_gudang on form_kasir.bank_gudang = bank_gudang.bank_id JOIN divisi ON form_kasir.kode_divisi = divisi.divisi_id WHERE divisi_id='$_SESSION[divisi_id]' AND tanggal_form between '$tgl_dari' and '$tgl_sampai'";
  120.               $data = mysqli_query($koneksi, $sql);
  121.               while($d = mysqli_fetch_array($data))
  122.               {
  123.  
  124.               $total_acc += $d['acc'];
  125.               $total_voucher += $d['voucher'];
  126.               $total_deposit += $d['deposit'];
  127.               $total_sppob += $d['sppob'];
  128.               $total_ppob += $d['ppob'];
  129.               $total_member += $d['member'];
  130.           ?>
  131.           <tr>
  132.               <td class="text-center"><?php echo date('d-m-Y', strtotime($d['tanggal_form'])); ?></td>
  133.               <td class="text-center"><?php echo $d['shift'];?></td>
  134.               <td><?php echo $d['nama_kasir']; ?></td>
  135.               <td class="text-right"><?php echo "Rp. ".number_format($d['acc'])." ,-";?></td>
  136.               <td class="text-right"><?php echo "Rp. ".number_format($d['voucher'])." ,-";?></td>
  137.               <td class="text-right"><?php echo "Rp. ".number_format($d['deposit'])." ,-";?></td>
  138.               <td class="text-right"><?php echo "Rp. ".number_format($d['sppob'])." ,-";?></td>
  139.               <td class="text-right"><?php echo "Rp. ".number_format($d['ppob'])." ,-";?></td>
  140.               <td class="text-right"><?php echo "Rp. ".number_format($d['member'])." ,-";?></td>
  141.               <td class="text-left"><?php echo $d['nama'];?></td>
  142.               <td class="text-left"><?php echo $d['nama_bank'];?></td>
  143.           </tr>
  144.         <?php
  145.         }
  146.         ?>
  147.           <tr>
  148.             <th colspan="3" class="text-right">TOTAL</th>
  149.             <td class="text-right"><?php echo "Rp. ".number_format($total_acc)." ,-";?></td>
  150.             <td class="text-right"><?php echo "Rp. ".number_format($total_voucher)." ,-";?></td>
  151.             <td class="text-right"><?php echo "Rp. ".number_format($total_deposit)." ,-";?></td>
  152.             <td class="text-right"><?php echo "Rp. ".number_format($total_sppob)." ,-";?></td>
  153.             <td class="text-right"><?php echo "Rp. ".number_format($total_ppob)." ,-";?></td>
  154.             <td class="text-right"><?php echo "Rp. ".number_format($total_member)." ,-";?></td>
  155.             <td colspan="2"></td>
  156.           </tr>
  157.         </table>                
  158.       <?php
  159.       }
  160.       ?>
  161.  
  162. </body>
  163. </html>
  164.  
  165. <?php
  166. require_once("../library/dompdf/dompdf_config.inc.php");
  167. $dompdf = new DOMPDF();
  168. $dompdf->load_html(ob_get_clean());
  169. $dompdf->render();
  170. $dompdf->set_paper("A4",'portrait');
  171. $dompdf->stream("Laporan Form Kasir ".$divisi['divisi'].".pdf");
  172. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement