Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- error_reporting(1);
- if($_POST['bayar']){
- echo'<pre>';print_r($_POST);die('</pre>');
- require('proses/doInsertTransaksi.php');
- }
- ?>
- <html>
- <head>
- <title>Data List</title>
- </head>
- <body>
- <?php
- include("connect.php");
- //$id_transaksi = 0;
- $query = "SELECT max(id_transaksi) as maxID FROM master_transaksi";
- $hasil = mysql_query($query);
- $data = mysql_fetch_array($hasil);
- $idMax = $data['maxID'];
- $noUrut = (int) substr($idMax, 2, 4);
- $noUrut++;
- $newID = 'TR' . sprintf("%05s", $noUrut) . 'P';
- $date = date("F-d-Y");
- echo "<table align='center'>";
- echo "<form action='' name='formTrans' method='POST'>";
- //proses/doInsertTransaksi.php
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='center' colspan='9' >
- <font face='ARIALblack' size='20' color='white'>";
- echo " SKY.Net POS System <br>
- <br>
- </td>";
- echo"</tr>";
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='left' colspan='9'>
- <font face='calibri' color='white'>$date</td>";
- echo "</tr>";
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='left' colspan='9'>
- <font face='calibri' color='white'> No Transaksi: </br> $newID </td>";
- echo "</tr>";
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='center' width='8' >
- <font face='calibri' color='white'> No </td>";
- echo "<td align='center' width='10'>
- <font face='calibri' color='white'> ID Produk </td>";
- echo "<td align='center'>
- <font face='calibri' color='white'> Nama Produk </td>";
- echo "<td align='center'>
- <font face='calibri' color='white'> Kategori Produk </td>";
- echo "<td align='center'>
- <font face='calibri' color='white'> Harga Satuan </td>";
- echo "<td align='center'>
- <font face='calibri' color='white'> Stok </td>";
- echo "<td align='center'>
- <font face='calibri' color='white'> QTY </td>";
- echo "<td align='center'>
- <font face='calibri' color='white'> Total Harga </td>";
- echo "</tr>";
- $nomor = 0;
- $grand_total = 0;
- //foreach($_POST['merk'] as $id){
- foreach($_POST['merk'] as $id){
- $query = "select id_produk, merk_produk, kategori, harga_jual, jumlah_stok FROM master_produk " .
- "WHERE merk_produk = '$id' ";
- $result = mysql_query($query, $conn)or
- die(mysql_error()."An error occure in SQL query <br> Query: $query");
- while($line = mysql_fetch_row($result)){
- $nomor++;
- $qty = $_POST['banyak'][$id];
- $idproduk = $line[0];
- $merk = $line[1];
- $kategori = $line[2];
- $harga_jual = $line[3];
- $jumlah_stok = $line[4];
- $jumlah_harga = $harga_jual*$qty;
- $grand_total += $jumlah_harga;
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='center' >
- <font face='calibri' color='white'> $nomor </td>";
- echo "<td>
- <input type='text' size='8%' name='idproduk' value='$idproduk' disabled='disabled'>
- </td>";
- echo "<td>
- <input type='text' size='35%' name='merk' value='$merk' disabled='disabled'>
- </td>";
- echo "<td>
- <input type='text' size='13%' name='kategori' value='$kategori' disabled='disabled'>
- </td>";
- echo "<td>
- <input type='text' size='20%' name='harga' value='$harga_jual' disabled='disabled'>
- </td>";
- echo "<td>
- <input type='text' size='2%' name='stok' value='$jumlah_stok' disabled='disabled'>
- </td>";
- echo "<td>
- <input type='text' size='2%' name='QTY' value='$qty' disabled='disabled'>
- </td>";
- echo "<td>
- <input type='text' size='20%' name='total' value='$jumlah_harga' disabled='disabled'>
- </td>";
- echo "</tr>";
- }
- }
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='right' colspan='9'>
- <font face='calibri' color='white'>Grand Total: ";
- echo "<input type='text' name='total' value='$grand_total' disabled='disabled'> </td>";
- echo "</tr>";
- echo"<tr bgcolor='iceblue'>";
- echo "<td align='right' colspan='9'>
- <font face='calibri' color='white'> ";
- echo "<input type='submit' name='bayar' value='Bayar'> </td>";
- echo "</tr>";
- echo "</form>";
- echo "</table>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement