Guest User

Untitled

a guest
Apr 3rd, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.  
  6.   <?php $this->load->view("admin/_partials/head.php") ?>
  7.  
  8. </head>
  9.  
  10. <body id="page-top">
  11.  
  12.   <!-- Page Wrapper -->
  13.   <div id="wrapper">
  14.  
  15.     <?php $this->load->view("admin/_partials/sidebar.php") ?>
  16.  
  17.     <!-- Content Wrapper -->
  18.     <div id="content-wrapper" class="d-flex flex-column">
  19.  
  20.       <!-- Main Content -->
  21.       <div id="content">
  22.  
  23.         <?php $this->load->view("admin/_partials/navbar.php") ?>
  24.  
  25.         <!-- Begin Page Content -->
  26.         <div class="container-fluid">
  27.           <?php //$this->load->view("admin/_partials/breadcrumb.php") ?>
  28.  
  29.           <!-- Page Heading -->
  30.           <div class="d-sm-flex align-items-center justify-content-between mb-4">
  31.             <h1 class="h3 mb-0 text-gray-800">Cashier - <?php echo $_SESSION['role'] ?></h1>
  32.            
  33.           </div>
  34.  
  35.           <div class="row">
  36.                 <div class="col-sm-7">
  37.                     <div class="card mb-3">
  38.                         <div class="card-header">
  39.                             <a href="#">Books</a>
  40.                         </div>
  41.                         <div class="card-body">
  42.                        
  43.                         <form action="<?php echo site_url('admin/transactions') ?>" method="post" enctype="multipart/form-data" >
  44.                         <div class="form-group row">
  45.                             <div class="col-sm-5">
  46.                                 <input type="text" class="form-control" name="keyword" placeholder="Search...">
  47.                             </div>
  48.                             <input type="submit" class="btn btn-right btn-info" name="search_submit" value="Search">
  49.                         </div>
  50.                         </form>
  51.  
  52.                         <div class="table-responsive">
  53.                             <table class="table table-hover">
  54.                                 <thead>
  55.                                     <tr>
  56.                                         <th>Book ID</th>
  57.                                         <th>Title</th>
  58.                                         <th>Price</th>
  59.                                         <th>Stock</th>
  60.                                         <th>Action</th>
  61.                                     </tr>
  62.                                 </thead>
  63.                                 <tbody>
  64.                                 <?php foreach ($books as $book): ?>
  65.                                     <tr>
  66.                                         <td>
  67.                                             <?php echo $book->book_id ?>
  68.                                         </td>
  69.                                         <td>
  70.                                             <?php echo $book->title ?>
  71.                                         </td>
  72.                                        
  73.                                         <td>
  74.                                             Rp. <?php echo number_format($book->price) ?>
  75.                                         </td>
  76.                                         <td>
  77.                                             <?php echo $book->stock ?>
  78.                                         </td>
  79.                                         <td>
  80.                                         <a href="<?php echo site_url('admin/transactions/buy/'.$book->book_id)
  81.                                         ?>"> Buy </a>
  82.                                         </td>
  83.                                     </tr>
  84.                                 <?php endforeach; ?>
  85.                                 </tbody>
  86.                             </table>
  87.                         </div>
  88.                         </div>
  89.                     </div>
  90.                 </div>
  91.                 <div class="col-sm-5">
  92.                     <div class="card mb-3">
  93.                         <div class="card-header">
  94.                             <a href="#">Cart</a>
  95.                         </div>
  96.                         <div class="card-body">
  97.                        
  98.                             <p> Transaction code: <?php echo $kode_jual; ?></p>
  99.                             <div class="table-responsive">
  100.                             <table class="table table-hover">
  101.                                 <thead>
  102.                                     <tr>
  103.                                         <th>No</th>
  104.                                         <th>Title</th>
  105.                                         <th>Price</th>
  106.                                         <th>Qty</th>
  107.                                         <th>Total</th>
  108.                                         <th>Action</th>
  109.                                     </tr>
  110.                                 </thead>
  111.                                 <tbody>
  112.                                 <?php $no=1;foreach ($details as $buy): ?>
  113.                                     <tr>
  114.                                         <td>
  115.                                             <?php echo $no ?>
  116.                                         </td>
  117.                                         <td>
  118.                                             <?php echo $buy->title ?>
  119.                                         </td>
  120.                                        
  121.                                         <td>
  122.                                             Rp. <?php echo number_format($buy->price) ?>
  123.                                         </td>
  124.                                         <td>
  125.                                             <?php echo $buy->qty ?>
  126.                                         </td>
  127.                                         <td>
  128.                                         Rp. <?php echo number_format( $buy->subtotal) ?>
  129.                                         </td>
  130.                                         <td>
  131.                                         <a href="<?php echo site_url('admin/transactions/remove/'.$kode_jual.'-'.$buy->book_id)
  132.                                         ?>"> Remove </a>
  133.                                         </td>
  134.                                     </tr>
  135.                                 <?php $no++; endforeach; ?>
  136.                                     <tr>
  137.                                         <td colspan="4">Total</td>
  138.                                         <td colspan="2"><strong>Rp. <?php echo number_format($subtotal->total) ?></strong></td>
  139.                                     </tr>
  140.                                 </tbody>
  141.                             </table>
  142.  
  143.  
  144.                             <form action="<?php echo site_url('admin/transactions/checkout/'.$subtotal->total) ?>" method="post" enctype="multipart/form-data" >
  145.                             <table>
  146.                                
  147.                                 <tr>
  148.                                     <td style="width:760px;" rowspan="2"><button type="submit" class="btn btn-info btn-lg">Checkout</button></td>
  149.                                     <th style="width:300px;">Total (Rp)</th>
  150.                                     <th style="text-align:right;width:450px;"><input type="text" name="total2" value="<?php echo $subtotal->total ?>" class="form-control input-sm" style="text-align:right;margin-bottom:5px;" readonly></th>
  151.                                     <input type="hidden" id="total" name="total" value="<?php echo $subtotal->total;?>" class="form-control input-sm" style="text-align:right;margin-bottom:5px;" readonly>
  152.                                 </tr>
  153.                                 <tr>
  154.                                     <th>Paid (Rp)</th>
  155.                                     <th style="text-align:right;"><input type="text" id="jml_uang" name="jml_uang" class="jml_uang form-control input-sm" style="text-align:right;margin-bottom:5px;" required></th>
  156.                                     <input type="hidden" id="jml_uang2" name="jml_uang2" class="form-control input-sm" style="text-align:right;margin-bottom:5px;" required>
  157.                                 </tr>
  158.                                 <tr>
  159.                                     <td></td>
  160.                                     <th>Change (Rp)</th>
  161.                                     <th style="text-align:right;"><input type="text" id="kembalian" name="kembalian" class="form-control input-sm" style="text-align:right;margin-bottom:5px;" required></th>
  162.                                 </tr>
  163.                                 <input type="hidden" name="user" value="<?php echo $_SESSION['username'] ?>" >
  164.                             </table>
  165.                            
  166.                             </form>
  167.                         </div>
  168.                         </div>
  169.                     </div>
  170.                 </div>
  171.             </div>
  172.  
  173.         </div>
  174.         <!-- /.container-fluid -->
  175.  
  176.       </div>
  177.       <!-- End of Main Content -->
  178.  
  179.       <!-- Footer -->
  180.       <?php $this->load->view("admin/_partials/footer.php") ?>
  181.       <!-- End of Footer -->
  182.  
  183.     </div>
  184.     <!-- End of Content Wrapper -->
  185.  
  186.   </div>
  187.   <!-- End of Page Wrapper -->
  188.  
  189.   <?php $this->load->view("admin/_partials/scrolltop.php") ?>
  190.   <?php $this->load->view("admin/_partials/modal.php") ?>
  191.   <?php $this->load->view("admin/_partials/js.php") ?>
  192.   <script type="text/javascript">
  193.         $(function(){
  194.             $('#jml_uang').on("input",function(){
  195.                 var total=$('#total').val();
  196.                 var jumuang=$('#jml_uang').val();
  197.                 var hsl=jumuang.replace(/[^\d]/g,"");
  198.                 $('#jml_uang2').val(hsl);
  199.                 $('#kembalian').val(hsl-total);
  200.             })
  201.            
  202.         });
  203.     </script>
  204. </body>
  205.  
  206. </html>
Advertisement
Add Comment
Please, Sign In to add comment