Listing Program Transaksi

dowanload file index.php admin.php. kasir.php, pemesanan_tempat. php transaksi_penjualan.php dll klik disini

———————————————

File inc.library.php

{ file inc.library.php ini disimpan di folder library yg ada di direktori weblanjut }

——————————————–

<?php

# Pengaturan tanggal komputer

date_default_timezone_set(“Asia/Jakarta”);

# Fungsi untuk membuat kode automatis

function buatKode($tabel, $inisial){

                $struktur             = mysql_query(“SELECT * FROM $tabel”);

                $field                     = mysql_field_name($struktur,0);

                $panjang             = mysql_field_len($struktur,0);

                $qry       = mysql_query(“SELECT MAX(“.$field.”) FROM “.$tabel);

                $row      = mysql_fetch_array($qry);

                if ($row[0]==””) {

                                $angka=0;

                }

                else {

                                $angka                  = substr($row[0], strlen($inisial));

                }

                $angka++;

                $angka  =strval($angka);

                $tmp     =””;

                for($i=1; $i<=($panjang-strlen($inisial)-strlen($angka)); $i++) {

                                $tmp=$tmp.”0″;              

                }

                return $inisial.$tmp.$angka;

}

# Fungsi untuk membalik tanggal dari format Indo (d-m-Y) -> English (Y-m-d)

function InggrisTgl($tanggal){

                $tgl=substr($tanggal,0,2);

                $bln=substr($tanggal,3,2);

                $thn=substr($tanggal,6,4);

                $tanggal=”$thn-$bln-$tgl”;

                return $tanggal;

}

# Fungsi untuk membalik tanggal dari format Indo (dd-mmm-yyyy) -> English (mm/dd/yyyy)

function tglDefault($tanggal){

                $bln=substr($tanggal,5,2);

                $tgl=substr($tanggal,8,2);

                $thn=substr($tanggal,0,4);

                $tanggal=”$bln/$tgl/$thn”;

                return $tanggal;

}

# Fungsi untuk membalik tanggal dari format English (Y-m-d) -> Indo (d-m-Y)

function IndonesiaTgl($tanggal){

                $tgl=substr($tanggal,8,2);

                $bln=substr($tanggal,5,2);

                $thn=substr($tanggal,0,4);

                $tanggal=”$tgl-$bln-$thn”;

                return $tanggal;

}

# Fungsi untuk membalik tanggal dari format English (Y-m-d) -> Indo (d-m-Y)

function Indonesia2Tgl($tanggal){

                $namaBln = array(“01” => “Januari”, “02” => “Februari”, “03” => “Maret”, “04” => “April”, “05” => “Mei”, “06” => “Juni”,  “07” => “Juli”, “08” => “Agustus”, “09” => “September”, “10” => “Oktober”, “11” => “November”, “12” => “Desember”);

                $tgl=substr($tanggal,8,2);

                $bln=substr($tanggal,5,2);

                $thn=substr($tanggal,0,4);

                $tanggal =”$tgl “.$namaBln[$bln].” $thn”;

                return $tanggal;

}

function hitungHari($myDate1, $myDate2){

        $myDate1 = strtotime($myDate1);

        $myDate2 = strtotime($myDate2);

        return ($myDate2 – $myDate1)/ (24 *3600);

}

# Fungsi untuk membuat format rupiah pada angka (uang)

function format_angka($angka) {

                $hasil =  number_format($angka,0, “,”,”.”);

                return $hasil;

}

# Fungsi untuk format tanggal, dipakai plugins Callendar

function form_tanggal($nama,$value=”){

                echo” <input type=’text’ name=’$nama’ id=’$nama’ size=’11’ maxlength=’20’ value=’$value’/>&nbsp;

                <img src=’gambar/calendar-add-icon.png’ align=’top’ style=’cursor:pointer; margin-top:7px;’ alt=’kalender’onclick=\”displayCalendar(document.getElementById(‘$nama’),’dd-mm-yyyy’,this)\”/>                                   

                “;

}

function angkaTerbilang($x){

  $abil = array(“”, “satu”, “dua”, “tiga”, “empat”, “lima”, “enam”, “tujuh”, “delapan”, “sembilan”, “sepuluh”, “sebelas”);

  if ($x < 12)

    return ” ” . $abil[$x];

  elseif ($x < 20)

    return angkaTerbilang($x – 10) . ” belas”;

  elseif ($x < 100)

    return angkaTerbilang($x / 10) . ” puluh” . angkaTerbilang($x % 10);

  elseif ($x < 200)

    return ” seratus” . angkaTerbilang($x – 100);

  elseif ($x < 1000)

    return angkaTerbilang($x / 100) . ” ratus” . angkaTerbilang($x % 100);

  elseif ($x < 2000)

    return ” seribu” . angkaTerbilang($x – 1000);

  elseif ($x < 1000000)

    return angkaTerbilang($x / 1000) . ” ribu” . angkaTerbilang($x % 1000);

  elseif ($x < 1000000000)

    return angkaTerbilang($x / 1000000) . ” juta” . angkaTerbilang($x % 1000000);

}

?>

                ————————————————-

File style.css

{ file style.css ini disimpan di folder fcss yg ada di direktori weblanjut }

                ————————————————-

.body{

                // background-image: url(logokecil.jpg);

                }

                .container

                {

                widht:1148px;

                }

                 p{color:blue;}

                .logo

                 {

                height:100px;

                width:150px;

                background-image:url(../gambar/logokecil.jpg);

                background-color:read;

                margin-left:150px;

                margin-bottom:2px;

                float:left;

                background-size: cover; 

                }

                .header1

                {

                height:100px;

                width:900px;

                margin-left:4px;

                margin-bottom:4px;

                float:left;

                background-image:url(../gambar/logokecil.jpg);

                }

                .login

                {

                height:200px;

                width:1050px;

                background-color:red;

                margin-left:150px;

                margin-bottom:4px;

                float:left;

                }

                .menu

                {

                height:100px;

                width:900px;

                background-color:y#008B8B;

                margin-left:150px;

                margin-bottom:4px;

                float:left;

                }

————————————————–

File index.php

————————————————–

<!DOCTYPE html>

<html>

<head>

<title>Warung Makan Serba Pedes</title>

<link href=”fcss/style.css” rel=”stylesheet” type=”text/css” media=”screen”>

</head>

<body>

                <div class=”logo”></div>

                    <div class=”header1″>

                                    <h1 class=”judul”><font size=20 color=Yellow>Warung Makan Serba Pedes</font></h1>

                                </div>

<div><center>

<form name=”logForm” method=”post” action=”login_validasi.php“>

  <table class=”table-common” width=”500″ border=”0″ cellpadding=”2″ cellspacing=”1″ bgcolor=”#999999″>

    <tr>

      <td width=”106″ rowspan=”5″ align=”center” bgcolor=”#FFFFFF”><img src=”gambar/login-key.jpg” width=”116″ height=”75″ /></td>

      <th colspan=”2″ bgcolor=”#CCCCCC”><b>LOGIN SYSTEM </b></td>     

    </tr>

    <tr>

      <td width=”117″ bgcolor=”#FFFFFF”><b>Username</b></td>

      <td width=”263″ bgcolor=”#FFFFFF”><b>:

        <input type=”Text” name=”username” size=”30″ maxlength=”20″ />

      </b></td>

    </tr>

    <tr>

      <td bgcolor=”#FFFFFF”><b>Password</b></td>

      <td bgcolor=”#FFFFFF”><b>:

        <input name=”pass” type=”password” size=”30″ maxlength=”20″ />

      </b></td>

    </tr>

    <tr>

      <td bgcolor=”#FFFFFF”><b>Hak Akses</b></td>

      <td bgcolor=”#FFFFFF”><b>:

        <select name=”cmbLevel”>

                                <option value=”BLANK”>….</option>

                                <?php

                                $pilihan = array(“Kasir”, “Admin”);

                                foreach ($pilihan as $nilai) {

                                                if ($_POST[‘cmbLevel’]==$nilai) {

                                                                $cek=”selected”;

                                                } else { $cek = “”; }

                                                echo “<option value=’$nilai’ $cek>$nilai</option>”;

                                }

                                ?>

                                </select>

      </b></td>

      </tr>

    <tr>

      <td bgcolor=”#FFFFFF”>&nbsp;</td>

      <td bgcolor=”#FFFFFF”><input type=”submit” name=”btnLogin” value=” Login ” /></td>

    </tr>

  </table>

</form>

</center></div>

<div class=”content”>

<div id=”home”>

<h1><center> Selamat Bekerja, Ingat !!!, Pembeli adalah Raja</center></h1>

</div>

</div>

<div class=”footer”><center>Warung Serba Pedes, Jl. Ngabei Raya No. 10 Semarang, 2019<center></div>

</body>

</html>

——————————————

File login_validasi.php

—————————————–

<?php

session_start();

include ‘koneksidb.php’;

//$kd_user = $_POST[‘kd_user’];

$username = $_POST[‘username’];

$password = $_POST[‘pass’];

$cmblevel =        $_POST[‘cmbLevel’];

// query untuk mendapatkan record dari username

$query = “SELECT * FROM userlogin WHERE username = ‘$username’ AND level=’$cmblevel'”;

$hasil = mysql_query($query);

$data = mysql_fetch_array($hasil);

// cek kesesuaian password

if ($password == $data[‘password’] AND ($cmblevel=$data[‘level’]))

{

echo “sukses”;

    // menyimpan username dan level ke dalam session

                $_SESSION[‘kd_user’] = $data[‘kd_user’];

    $_SESSION[‘level’] = $data[‘level’];

    $_SESSION[‘username’] = $data[‘username’];

    header(‘location: admin.php’);

}

else

echo ‘<h1>Login gagal</h1>’;

?>

——————————-

File admin.php

——————————–

<!DOCTYPE html>

<html>

<head>

<title>Warung Makan Serba Pedes</title>

<link href=”fcss/style.css” rel=”stylesheet” type=”text/css” media=”screen”>

</head>

    <body>

                    <div class=”logo”>

                                </div>

                    <div class=”header1″>

                                    <h1 class=”judul”><font size=20 color=black>Resto Serba Pedes</font></h1>

                                </div>

                                <div class=”menu”>

                                   <div>

                                                <?php

                                                // memulai session

                                                session_start();

                                                error_reporting(0);

                                                if (isset($_SESSION[‘level’]))

                                                {

                                                // jika level admin

                                                if ($_SESSION[‘level’] == “Admin”)

                                                   {  

                                                   }

                                                   // jika kondisi level user maka akan diarahkan ke halaman lain

                                                   else if ($_SESSION[‘level’] == “Kasir”)

                                                   {

                                                                   header(‘location:kasir.php’);

                                                   }

                                                }

                                                if (!isset($_SESSION[‘level’]))

                                                {

                                                                header(‘location:admin.php’);

                                                }

                                                 ?>

                                                <ul>

                                                                <li><a href=’admin.php’>Home</a></li>

                                                                <li><a href=’user.php’>Input user Kasir</a></li>

                                                                <li><a href=’kategori.php’>Kategori</a></li>

                                                                <li><a href=’menu.php’ >Menu Makanan</a></li>

                                                                <li><a href=’pemesanan_tempat.php’>Pememesanan Tempat</a></li>

                                                                <li><a href=’transaksi_pembelian.php’>Transaksi Pembelian</a> </li>

                                                                <li><a href=’transaksi_penjualan.php’>Transaksi Penjualan</a></li>

                                                                <li><a href=’laporan.php’>Laporan</a></li>

                                                                <li><a href=’logout.php’>Logout</a></li>

                                                </ul>

                                <div class=”content”>

                                <!– div class=”scroll” –>

                                <div id=”home”>

                                                <h1><center> Selamat Bekerja, Ingat !!!, Pembeli adalah Raja</center></h1>

                                                </div>

                                                <!– /div –>

                                </div>

                                <div class=”footer”><center>Warung Serba Pedes, Jl. Ngabei Raya No. 10 Semarang, 2019<center>

                                </div

  </body>

</html>

——————————-

File kasir.php

——————————–

<!DOCTYPE html>

<html>

<head>

<title>Warung Makan Serba Pedes</title>

<style type=text/css>

</style>

</head>

 <body>

                    <div class=”logo”></div>

                    <div class=”header1″>

                                    <h1 class=”judul”><font size=20 color=red>Resto Serba Pedes</font></h1>

                                </div>

                                <div class=”menu”>

                                <div>

                                                                <?php

                                                                error_reporting(0);

                                                                session_start();

                                                                if (isset($_SESSION[‘level’]))

                                                                {

                                                                   if ($_SESSION[‘level’] == “Admin”)

                                                                   {

                                                                                  include ‘admin.php‘;

                                                                   }

                                                                   else if ($_SESSION[‘level’] == “Kasir”)

                                                                   {

                                                                                   include ‘kasir.php‘;

                                                                   }

                                                                }

                                                                ?>

                                                <ul>

                                                                <li><a href=’admin.php’>Home</a></li>

                                                                <li><a href=’tampil_data_kategori.php’>Kategori</a></li>

                                                                <li><a href=’tampil_data_menu.php’ >Menu Makanan</a></li>

                                                                <li><a href=’tampil_pemesanan_tempat.php’>Pememesanan Tempat</a></li>

                                                                <li><a href=’transaksi_pembelian.php’>Transaksi Pembelian</a> </li>

                                                                <li><a href=’transaksi_penjualan.php’>Transaksi Penjualan</a></li>

                                                                <li><a href=’laporan.php’>Laporan</a></li>

                                                                <li><a href=’logout.php’>Logout</a></li>

                                                </ul>

                                </div>

                                </div>

                                <div class=”content”></div>

                                <div id=”home”><h1><center> Selamat Bekerja, Ingat !!!, Pembeli adalah Raja</center></h1></div>

                                <div class=”footer”><center>Warung Serba Pedes, Jl. Ngabei Raya No. 10 Semarang, 2019<center></div

  </body>

</html>

—————————————

File pemesanan_tambah.php

————————————-

<?php

   include ‘koneksidb.php’;

if($_GET) {

                if(isset($_POST[‘btnSave’])){

                                # Validasi form, jika kosong sampaikan pesan error

                                $pesanError = array();

                                if (trim($_POST[‘tdttanggalpesan’])==””) {

                                                $pesanError[] = “Data <b>Tanggal Pemesanan</b> belum diisi, pilih pada combo !”;                      

                                }

                                if (trim($_POST[‘txtJam’])==””) {

                                                $pesanError[] = “Data <b>Jam Makan</b> tidak boleh kosong !”;                            

                                }

                                if (trim($_POST[‘txtNoMeja’])==””) {

                                                $pesanError[] = “Data <b>Nomor Meja</b> tidak boleh kosong !”;                         

                                }

                                if (trim($_POST[‘txtJumlahOrg’])==””) {

                                                $pesanError[] = “Data <b>Jumlah Orang</b> tidak boleh kosong !”;                       

                                }

                                if (trim($_POST[‘txtNamaPesan’])==””) {

                                                $pesanError[] = “Data <b>Nama pemesanan</b> tidak boleh kosong !”;                              

                                }

                                if (trim($_POST[‘txtKeterangan’])==””) {

                                                $pesanError[] = “Data <b>keterangan Lengkap</b> tidak boleh kosong !”;                         

                                }

                                if (trim($_POST[‘txtTelepon’])==””) {

                                                $pesanError[] = “Data <b>No Telpon</b> tidak boleh kosong !”;                              

                                }

                                # Baca Variabel Form

                                $dtTanggal                          = $_POST[‘tdttanggalpesan’];

                                $txtJam                                            = $_POST[‘txtJam’];

                                $txtNoMeja                       = $_POST[‘txtNoMeja’];

                                $txtJumlahOrg                  = $_POST[‘txtJumlahOrg’];

                                $txtNamaPesan                                = $_POST[‘txtNamaPesan’];

                                $txtTelepon                       = $_POST[‘txtTelepon’];

                                $txtKeterangan                                = $_POST[‘txtKeterangan’];

                                # JIKA ADA PESAN ERROR DARI VALIDASI

                                if (count($pesanError)>=1 ){

            echo “<div class=’mssgBox’>”;

                                                echo “<img src=’images/attention.png’> <br><hr>”;

                                                                $noPesan=0;

                                                                foreach ($pesanError as $indeks=>$pesan_tampil) {

                                                                $noPesan++;

                                                                echo “&nbsp;&nbsp; $noPesan. $pesan_tampil<br>”;  

                                                                }

                                                echo “</div> <br>”;

                                }

                                else {

                                                # SIMPAN DATA KE DATABASE.

                                                // Jika tidak menemukan error, simpan data ke database             

                                                function ubahTanggal($dtTanggal){

                                                $pisah = explode(‘/’,$dtTanggal);

                                                $array = array($pisah[2],$pisah[0],$pisah[1]);

                                                $satukan = implode(‘-‘,$array);

                                                return $satukan;

                                }

                                $tgl_pesan = ubahTanggal($dtTanggal);

                                $mySql = “INSERT INTO pemesanan (tanggal, jam, nomor_meja, jumlah_orang, nama_pemesan, no_telepon, keterangan)

                                                VALUES (‘$tgl_pesan’, ‘$txtJam’, ‘$txtNoMeja’, ‘$txtJumlahOrg’, ‘$txtNamaPesan’, ‘$txtTelepon’, ‘$txtKeterangan’)”;

                                                $myQry                = mysql_query($mySql, $koneksidb) or die (“Gagal query”.mysql_error());

                                                if($myQry){

                                                                echo “<meta http-equiv=’refresh’ content=’0; url=?page=Pemesanan-Data’>”;

                                                }

                                                exit;

                                }             

                } // Penutup POST

                # MASUKKAN DATA KE VARIABEL

                $dataTanggal                     = isset($_POST[‘tdttanggalpesan’]) ? $_POST[‘tdttanggalpesan’] : date(‘d-m-Y’);

                $dataJam                             = isset($_POST[‘txtJam’]) ? $_POST[‘txtJam’] : ”;

                $dataNoMeja                    = isset($_POST[‘txtNoMeja’]) ? $_POST[‘txtNoMeja’] : ”;

                $dataJumlahOrg               = isset($_POST[‘txtJumlahOrg’]) ? $_POST[‘txtJumlahOrg’] : ”;

                $dataNama                         = isset($_POST[‘txtNamaPesan’]) ? $_POST[‘txtNamaPesan’] : ”;

                $dataTelepon                    = isset($_POST[‘txtTelepon’]) ? $_POST[‘txtTelepon’] : ”;

                $dataKeterangan             = isset($_POST[‘txtKeterangan’]) ? $_POST[‘txtKeterangan’] : ”;

}// Penutup GET

?>

<html>

<head>

  <link rel=”stylesheet” type=”text/css” href=”js/smoothness/jquery-ui.css”/>

  <script type=”text/javascript” src=”js/external/jquery/jquery.js”></script>

  <script type=”text/javascript” src=”js/jquery-ui.js”></script>

  <script type=”text/javascript” src=”js/jquery-ui.min.js”></script>

  <link rel=”stylesheet” type=”text/css” href=”js/jquery-ui.theme.css”>

  <script type=”text/javascript”>

                $(document).ready(function(){

                                $(‘#tanggalpesan’).datepicker();                              

                });

  </script>

</head>

<form action=”?page=pemesanan_tambah.php” method=”post” name=”frmadd”>

<table width=”100%” cellpadding=”2″ cellspacing=”1″ class=”table-list” style=”margin-top:0px;”>

                <tr>

                  <th colspan=”3″>PEMESANAN TEMPAT</th>

                </tr>

                <tr>

                  <td>&nbsp;</td>

                  <td>&nbsp;</td>

                  <td align=”left”>[ <a href=”tampil_pemesanan_tempat.php” target=”_self”>Daftar Pesanan</a> ] </td>

    </tr>

                <tr class=”table-common”>

      <td><b>Tanggal Makan</b></td>

                  <td><b>:</b></td>

                  <td> <input type=”text” name=”tdttanggalpesan” id=”tanggalpesan”/></td>

    </tr>

                <tr>

      <td><b>Jam Makan </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtJam”  size=”60″ maxlength=”40″/></td>

    </tr>

                <tr>

      <td><b>Nomor Meja </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtNoMeja” size=”60″ maxlength=”40″/></td>

    </tr>

                <tr>

                  <td width=”15%”><b>Jumlah Orang </b></td>

                  <td width=”1%”><b>:</b></td>

                  <td width=”84%”><input name=”txtJumlahOrg” size=”60″ maxlength=”40″/></td></tr>

                <tr>

                  <td><b>Nama Pemesan </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtNamaPesan” size=”60″ maxlength=”60″ /></td>

                </tr>

                <tr>

      <td><b>No Telpon </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtTelepon”  size=”20″ maxlength=”20″ /></td>

    </tr>

                <tr>

      <td><b>Keterangan (Menu) </b></td>

                  <td><b>:</b></td>

                  <td><textarea name=”txtKeterangan” cols=”45″ rows=”3″> </textarea></td>

    </tr>

                <tr><td>&nbsp;</td>

                  <td>&nbsp;</td>

                  <td><input type=”submit” name=”btnSave” value=” SIMPAN ” style=”cursor:pointer;”></td>

    </tr>

</table>

</form>

————————————–

File tampil_pemesanan_tempat.php

—————————————-

<?php

include ‘koneksidb.php’;

include_once ‘library/inc.library.php’;

# UNTUK PAGING (PEMBAGIAN HALAMAN)

$row = 20;

$hal = isset($_GET[‘hal’]) ? $_GET[‘hal’] : 0;

$pageSql = “SELECT * FROM pemesanan”;

$pageQry = mysql_query($pageSql, $koneksidb) or die (“error paging: “.mysql_error());

$jml       = mysql_num_rows($pageQry);

$max     = ceil($jml/$row);

?>

<table width=”800″ border=”0″ cellpadding=”2″ cellspacing=”1″ class=”table-border”>

  <tr>

    <td colspan=”2″ align=”right”><h1><b>DAFTAR PEMESANAN TEMPAT</b></h1></td>

  </tr>

  <tr>

    <td colspan=”2″><a href=”pemesanan_tambah.php“>Tambah Pemesanan</a></td>

  </tr>

  <tr>

    <td colspan=”2″>&nbsp;</td>

  </tr>

  <tr>

    <td colspan=”2″>

                <table class=”table-list” width=”100%” border=”1″ cellspacing=”1″ cellpadding=”2″>

      <tr>

        <th width=”21″ align=”center”><b>No</b></th>

        <th width=”80″ align=”center”>Tanggal</th>

        <th width=”70″>Jam</th>

        <th width=”100″>No Meja </th>

        <th width=”160″><b>Nama Pemesan </b></th>

        <th width=”237″><b>Keterangan</b></th>

        <td width=”34″ align=”center” bgcolor=”#CCCCCC”><b>Edit</b></td>

        <td width=”51″ align=”center” bgcolor=”#CCCCCC”><b>Delete</b></td>

      </tr>

      <?php

                $mySql = “SELECT * FROM pemesanan ORDER BY id DESC LIMIT $hal, $row”;

                $myQry = mysql_query($mySql, $koneksidb)  or die (“Query salah : “.mysql_error());

                $nomor  = 0;

                while ($kolomData = mysql_fetch_array($myQry)) {

                                $nomor++;

                                $Kode = $kolomData[‘id’];

                ?>

      <tr>

        <td align=”center”><?php echo $nomor; ?></td>

        <td align=”center”><?php echo indonesiaTgl($kolomData[‘tanggal’]); ?></td>

        <td><?php echo $kolomData[‘jam’]; ?></td>

        <td><?php echo $kolomData[‘nomor_meja’]; ?></td>

        <td><?php echo $kolomData[‘nama_pemesan’]; ?></td>

        <td><?php echo $kolomData[‘keterangan’]; ?></td>

        <td align=”center”><a href=”pemesanan_koreksi.php?id=<?php echo $kolomData[‘id’]; ?>” target=”_self” alt=”Edit Data”>Koreksi</a></td>

      <td align=”center”><a href=”proses_hapus_pemesanan_tempat.php?id=<?php echo $kolomData[‘id’];?>” target=”_self” alt=”Delete Data”>Hapus</a></td>

      </tr>

      <?php } ?>

    </table></td>

  </tr>

  <tr class=”selKecil”>

    <td><b>Jumlah Data :</b> <?php echo $jml; ?> </td>

    <td align=”right”><b>Halaman ke :</b>

                <?php

                for ($h = 1; $h <= $max; $h++) {

                                $list[$h] = $row * $h – $row;

                                echo ” <a href=’?page=Pemesanan-Data&hal=$list[$h]’>$h</a> “;

                }

                ?>

                </td>

  </tr>

  <tr>

                <td><a href=’admin.php’>Kembali Ke Menu</a></td>

</tr>

</table>

————————————–

File pemesanan_koreksi.php

—————————————-

<?php

include ‘koneksidb.php’;

include_once ‘library/inc.library.php’;

  # TAMPIL-KAN DATA LOGIN UNTUK DIEDIT

                $id                          = isset($_GET[‘id’]) ?  $_GET[‘id’] : $_POST[‘id’];

                $sqlShow             = “SELECT * FROM pemesanan WHERE id=’$id'”;

                $qryShow            = mysql_query($sqlShow, $koneksidb)  or die (“Query ambil data salah : “.mysql_error());

                $dataShow         = mysql_fetch_array($qryShow);

 ?>

<html> 

 <head>

  <link rel=”stylesheet” type=”text/css” href=”js/smoothness/jquery-ui.css”/>

  <script type=”text/javascript” src=”js/external/jquery/jquery.js”></script>

  <script type=”text/javascript” src=”js/jquery-ui.js”></script>

  <script type=”text/javascript” src=”js/jquery-ui.min.js”></script>

  <link rel=”stylesheet” type=”text/css” href=”js/jquery-ui.theme.css”>

  <script type=”text/javascript”>

                $(document).ready(function(){

                $(‘#tanggalpesan’).datepicker();                              

                });

  </script>

</head>

<form method=”post” action=”proses_simpan_koreksi_pemesanan.php?id=<?php echo $id; ?>” enctype=”multipart/form-data”>

<table class=”table-list” width=”100%” style=”margin-top:0px;”>

                <tr>

                  <th colspan=”3″> KOREKSI PEMESANAN TEMPAT <br>

       <td><input name=”txtid” type=”hidden” value=”<?php echo $dataShow[‘id’]; ?>” /></td>

                  </th>

                </tr>

                <tr class=”table-common”>

      <td><b>Tanggal Makan</b></td>

                  <td><b>:</b></td>

                   <td><input type=”text” name=”tdttanggalpesan” id=”tanggalpesan” value=”<?php echo tglDefault($dataShow[‘tanggal’]) ?>”>[mm/dd/yyyy]</td>

    </tr>

                <tr>

      <td width=”15%”><b>Jam Makan </b></td>

                  <td width=”1%”><b>:</b></td>

                  <td width=”84%”><input name=”txtJam” value=”<?php echo $dataShow[‘jam’]; ?>” size=”60″ maxlength=”40″/></td>

    </tr>

                <tr>

      <td><b>Nomor Meja </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtNoMeja” value=”<?php echo $dataShow[‘nomor_meja’]; ?>” size=”60″ maxlength=”40″/></td>

    </tr>

                <tr>

      <td><b>Jumlah Orang </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtJumlahOrg” value=”<?php echo $dataShow[‘jumlah_orang’]; ?>” size=”60″ maxlength=”40″/></td>

    </tr>

                <tr>

                  <td><b>Nama Pemesan </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtNamaPesan” type=”text” value=”<?php echo $dataShow[‘nama_pemesan’]; ?>” size=”60″ maxlength=”60″ /></td></tr>

                <tr>

      <td><b>No Telpon </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtTelepon” value=”<?php echo $dataShow[‘no_telepon’]; ?>” size=”20″ maxlength=”20″ /></td>

    </tr>

                <tr>

      <td><b>Keterangan (Menu) </b></td>

                  <td><b>:</b></td>

                  <td><textarea name=”txtKeterangan” cols=”45″ rows=”3″><?php echo $dataShow[‘keterangan’]; ?></textarea></td>

    </tr>

                <tr><td>&nbsp;</td>

                  <td>&nbsp;</td>

                  <td><input type=”submit” value=”simpan” style=”cursor:pointer;”></td>

    </tr>

</table>

</form>

</html>

————————————————————

File proses_simpan_koreksi_pemesanan.php

———————————————————–

<?php

include ‘koneksidb.php’;

include_once ‘library/inc.library.php’;

# Baca Variabel Form     

                $id                                          = $_GET[‘id’];

                $dtTanggal                          = $_POST[‘tdttanggalpesan’];

                $Jam                                      = $_POST[‘txtJam’];

                $NoMeja                             = $_POST[‘txtNoMeja’];

                $JumlahOrg                        = $_POST[‘txtJumlahOrg’];

                $NamaPesan                     = $_POST[‘txtNamaPesan’];

                $Telepon                             = $_POST[‘txtTelepon’];

                $Keterangan                      = $_POST[‘txtKeterangan’];

# SIMPAN DATA KE DATABASE.

function ubahTanggal($dtTanggal){

$pisah = explode(‘/’,$dtTanggal);

$array = array($pisah[2],$pisah[0],$pisah[1]);

$satukan = implode(‘-‘,$array);

return $satukan;

}

$tgl_pesan = ubahTanggal($dtTanggal);

# SIMPAN PERUBAHAN DATA, Jika jumlah error pesanError tidak ada, simpan datanya

$mySql=”UPDATE pemesanan SET tanggal='”.$tgl_pesan.”‘,jam='”.$Jam.”‘,nomor_meja='”.$NoMeja.”‘,jumlah_orang='”.$JumlahOrg.”‘,nama_pemesan='”.$NamaPesan.”‘,no_telepon ='”.$Telepon.”‘,keterangan ='”.$Keterangan.”‘ WHERE id ='”.$id.”‘”;

$myQry                = mysql_query($mySql, $koneksidb);

if($myQry){ // Cek jika proses simpan ke database sukses atau tidak

// Jika Sukses, Lakukan :

                header(“location: tampil_pemesanan_tempat.php“);

                // Jika Gagal, Lakukan :

echo “Maaf, Terjadi kesalahan saat mencoba untuk menyimpan data ke database.”;

echo “<br><a href=‘pemesanan_koreksi.php’>Kembali Ke Form</a>”;

}

 ?>

———————————————————-

File proses_hapus_pemesanan_tempat.php

———————————————————

<?php

include “koneksidb.php”;

$kodepesan=$_GET[‘id’];

$query2 = “DELETE FROM pemesanan WHERE id='”.$kodepesan.”‘”;

$sql2 = mysql_query($query2); // Eksekusi/Jalankan query dari variabel $query

if($sql2){ // Cek jika proses simpan ke database sukses atau tidak

                // Jika Sukses, Lakukan :

                header(“location: tampil_pemesanan_tempat.php“); // Redirect ke halaman index.php

}else{

                // Jika Gagal, Lakukan :

                echo “Data gagal dihapus. <a href=‘tampil_pemesanan_tempat.php‘>Kembali</a>”;

}

?>

—————————————

File transaksi_penjualan.php

<?php

session_start();

include ‘koneksidb.php’;

include_once “library/inc.library.php”;

if($_GET) {

                # HAPUS DAFTAR barang DI TMP

                if(isset($_GET[‘Act’])){

                                if(trim($_GET[‘Act’])==”Delete”){

                                                # Hapus Tmp jika datanya sudah dipindah

                                                $mySql = “DELETE FROM tmp_penjualan WHERE id='”.$_GET[‘id’].”‘ AND kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                mysql_query($mySql, $koneksidb) or die (“Gagal kosongkan tmp”.mysql_error());

                                }

                                if(trim($_GET[‘Act’])==”Sucsses”){

                                                echo “<b>DATA BERHASIL DISIMPAN</b> <br><br>”;

                                }

                }

                // =========================================================================

                # TOMBOL PILIH (KODE barang) DIKLIK

                if(isset($_POST[‘btnPilih’])){

                                $pesanError = array();

                                if (trim($_POST[‘cmbMenu’])==”BLANK”) {

                                                $pesanError[] = “<b>Nama Menu Makan belum diisi</b>, pilih pada daftar menu !”;                     

                                }

                                if (trim($_POST[‘txtJumlah’])==”” OR ! is_numeric(trim($_POST[‘txtJumlah’]))) {

                                                $pesanError[] = “Data <b>Jumlah Porsi (Qty) belum diisi</b>, silahkan <b>isi dengan angka</b> !”;                               

                                }

                                # Baca variabel

                                $cmbMenu         = $_POST[‘cmbMenu’];

                                $txtJumlah          = $_POST[‘txtJumlah’];

                                # JIKA ADA PESAN ERROR DARI VALIDASI

                                if (count($pesanError)>=1 ){

                                                echo “<div class=’mssgBox’>”;

                                                echo “<img src=’gambar/attention.png’> <br><hr>”;

                                                                $noPesan=0;

                                                                foreach ($pesanError as $indeks=>$pesan_tampil) {

                                                                $noPesan++;

                                                                                echo “&nbsp;&nbsp; $noPesan. $pesan_tampil<br>”;  

                                                                }

                                                echo “</div> <br>”;

                                }

                                else {

                                                # Jika jumlah error pesanError tidak ada                                               

                                                # Jika sudah pernah dipilih, cukup datanya di update jumlahnya                                               

                                                $cekSql =”SELECT * FROM tmp_penjualan WHERE kd_menu=’$cmbMenu’ AND kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                $cekQry = mysql_query($cekSql, $koneksidb) or die (“Gagal Query”.mysql_error());

                                                if (mysql_num_rows($cekQry) >= 1) {

                                                                // Jika tadi sudah dipilih, cukup jumlahnya diupdate

                                                                $tmpSql = “UPDATE tmp_penjualan SET jumlah=jumlah + $txtJumlah

                                                                                                                WHERE kd_menu=’$cmbMenu’ AND kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                                mysql_query($tmpSql, $koneksidb) or die (“Gagal Query : “.mysql_error());

                                                }

                                                else {

                                                                $menuSql =”SELECT * FROM menu WHERE kd_menu=’$cmbMenu'”;

                                                                $menuQry = mysql_query($menuSql, $koneksidb) or die (“Gagal Query”.mysql_error());

                                                                $menuRow = mysql_fetch_array($menuQry);

                                                                if (mysql_num_rows($menuQry) >= 1) {

                                                                                # Hitung Diskon (Jika Ada), dan Harga setelah diskon

                                                                                //$besarDiskon = intval($menuRow[‘harga’]) * (intval($menuRow[‘diskon’])/100);

                                                                                //$hargaDiskon = intval($menuRow[‘harga’]) – $besarDiskon;

                                                                                $dataHarga = $menuRow[‘harga’];

                                                                                $tmp2Sql = “INSERT INTO tmp_penjualan SET

                                                                                                                                                                                kd_menu=’$cmbMenu’,

                                                                                                                                                                                harga=’$dataHarga’,

                                                                                                                                                                                jumlah=’$txtJumlah’,

                                                                                                                                                                                kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                                                mysql_query($tmp2Sql, $koneksidb) or die (“Gagal Query detail barang : “.mysql_error());

                                                                }

                                                }

                                }

                }

                // ============================================================================

                # JIKA TOMBOL SIMPAN DIKLIK

                if(isset($_POST[‘btnSave’])){

                                $pesanError = array();

                                if (trim($_POST[‘cmbTanggal’])==””) {

                                                $pesanError[] = “Data <b>Tanggal transaksi</b> belum diisi, pilih pada combo !”;                            

                                }

                                if (trim($_POST[‘txtNoMeja’])==””) {

                                                $pesanError[] = “Data <b> Nomor Meja</b> belum diisi, isi dengan informasi meja”;                     

                                }

                                if (trim($_POST[‘txtUangBayar’])==””  OR ! is_numeric(trim($_POST[‘txtUangBayar’]))) {

                                                $pesanError[] = “Data <b> Uang Bayar</b> belum diisi, isi dengan uang (Rp) !”;                

                                }

                                if (trim($_POST[‘txtUangBayar’]) < trim($_POST[‘txtTotBayar’])) {

                                                $pesanError[] = “Data <b> Uang Bayar Belum Cukup</b>”;                         

                                }

                                $tmpSql =”SELECT COUNT(*) As qty FROM tmp_penjualan WHERE kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                $tmpQry = mysql_query($tmpSql, $koneksidb) or die (“Gagal Query Tmp”.mysql_error());

                                $tmpRow = mysql_fetch_array($tmpQry);

                                if ($tmpRow[‘qty’] < 1) {

                                                $pesanError[] = “<b>Item Menu</b> belum ada yang dimasukan, <b>minimal 1 menu</b>.”;

                                }

                                # Baca variabel

                                $txtNoMeja                       = $_POST[‘txtNoMeja’];

                                $txtPelanggan   = $_POST[‘txtPelanggan’];

                                $txtKeterangan                = $_POST[‘txtKeterangan’];

                                $txtUangBayar  = $_POST[‘txtUangBayar’];

                                $cmbTanggal      = $_POST[‘cmbTanggal’];

                                # JIKA ADA PESAN ERROR DARI VALIDASI

                                if (count($pesanError)>=1 ){

                                                echo “<div class=’mssgBox’>”;

                                                echo “<img src=’gambar/attention.png’> <br><hr>”;

                                                                $noPesan=0;

                                                                foreach ($pesanError as $indeks=>$pesan_tampil) {

                                                                $noPesan++;

                                                                                echo “&nbsp;&nbsp; $noPesan. $pesan_tampil<br>”;  

                                                                }

                                                echo “</div> <br>”;

                                }

                                else {

                                                # SIMPAN DATA KE DATABASE

                                                # Jika jumlah error pesanError tidak ada

                                                $noTransaksi = buatKode(“penjualan”, “JL”);

                                                $mySql = “INSERT INTO penjualan SET

                                                                no_penjualan=’$noTransaksi’,

                                                                tgl_penjualan='”.InggrisTgl($_POST[‘cmbTanggal’]).”‘,

                                                                nomor_meja=’$txtNoMeja’,

                                                                pelanggan=’$txtPelanggan’,

                                                                keterangan=’$txtKeterangan’,

                                                                uang_bayar=’$txtUangBayar’,

                                                                kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                $myQry=mysql_query($mySql, $koneksidb) or die (“Gagal query”.mysql_error());

                                                if($myQry){

                                                                # …LANJUTAN, SIMPAN DATA

                                                                # Ambil semua data barang yang dipilih, berdasarkan kasir yg login

                                                                $tmpSql =”SELECT * FROM tmp_penjualan WHERE kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                                $tmpQry = mysql_query($tmpSql, $koneksidb) or die (“Gagal Query Tmp”.mysql_error());

                                                                while ($tmpRow = mysql_fetch_array($tmpQry)) {

                                                                                $dataKode =      $tmpRow[‘kd_menu’];

                                                                                $dataHarga=      $tmpRow[‘harga’];

                                                                                $dataJumlah=$tmpRow[‘jumlah’];

                                                                                // Masukkan semua data dari tabel TMP ke tabel ITEM

                                                                                $itemSql = “INSERT INTO penjualan_item SET

                                                                                                no_penjualan=’$noTransaksi’,

                                                                                                kd_menu=’$dataKode’,

                                                                                                harga=’$dataHarga’,

                                                                                                jumlah=’$dataJumlah'”;

                                                                                mysql_query($itemSql, $koneksidb) or die (“Gagal Query “.mysql_error());

                                                                                // Skrip Update stok

                                                                                //$stokSql = “UPDATE barang SET stok = stok – $tmpRow[jumlah] WHERE kd_barang=’$tmpRow[kd_barang]'”;

                                                                                //mysql_query($stokSql, $koneksidb) or die (“Gagal Query Edit Stok”.mysql_error());

                                                                }

                                                                # Kosongkan Tmp jika datanya sudah dipindah

                                                                $hapusSql = “DELETE FROM tmp_penjualan WHERE kd_user='”.$_SESSION[‘kd_user’].”‘”;

                                                                mysql_query($hapusSql, $koneksidb) or die (“Gagal kosongkan tmp”.mysql_error());

                                                                // Refresh form

                                                                echo “<meta http-equiv=’refresh’ content=’0; url=transaksi_penjualan2_view.php?noNota=$noTransaksi’>”;

                                                }

                                                else{

                                                                $pesanError[] = “Gagal penyimpanan ke database”;

                                                }

                                }             

                }

                // ============================================================================

} // Penutup GET

# TAMPILKAN DATA KE FORM

$noTransaksi      = buatKode(“penjualan”, “JL”);

$tglTransaksi      = isset($_POST[‘cmbTanggal’]) ? $_POST[‘cmbTanggal’] : date(‘d-m-Y’);

$dataNoMeja                    = isset($_POST[‘txtNoMeja’]) ? $_POST[‘txtNoMeja’] : ‘1’;

$dataPelanggan                = isset($_POST[‘txtPelanggan’]) ? $_POST[‘txtPelanggan’] : ‘Pelanggan’;

$dataKeterangan             = isset($_POST[‘txtKeterangan’]) ? $_POST[‘txtKeterangan’] : ”;

$dataUangBayar               = isset($_POST[‘txtUangBayar’]) ? $_POST[‘txtUangBayar’] : ”;

?>

<form action=”?page=Transaksi-Penjualan” method=”post”  name=”frmadd”>

<table width=”700″ cellpadding=”3″ cellspacing=”1″ class=”table-common” style=”margin-top:0px;”>

                <tr>

                  <td colspan=”3″ align=”right”><h1>TRANSAKSI  PENJUALAN</h1> </td>

                </tr>

                <tr>

                  <td bgcolor=”#CCCCCC”><b>DATA TRANSAKSI </b></td>

                  <td bgcolor=”#CCCCCC”>&nbsp;</td>

                  <td>&nbsp;</td>

    </tr>

                <tr>

                  <td width=”21%”><b>No Penjualan </b></td>

                  <td width=”1%”><b>:</b></td>

                  <td width=”78%”><input name=”txtNomor” value=”<?php echo $noTransaksi; ?>” size=”11″ maxlength=”11″ readonly=”readonly”/></td></tr>

                <tr>

      <td><b>Tanggal Transaksi </b></td>

                  <td><b>:</b></td>

                  <td><?php echo form_tanggal(“cmbTanggal”,$tglTransaksi); ?></td>

    </tr>

                <tr>

      <td><b>Nomor Meja </b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtNoMeja” value=”<?php echo $dataNoMeja; ?>” size=”55″ maxlength=”60″/></td>

    </tr>

                <tr>

      <td><b>Pelanggan</b></td>

                  <td><b>:</b></td>

                  <td><input name=”txtPelanggan” id=”txtPelanggan”

                                                 onfocus=”if (value == ‘Umum’) {value =”}”

                                                                 onBlur=”if (value == ”) {value = ‘Umum’}” value=”<?php echo $dataPelanggan; ?>” size=”55″ maxlength=”30″/>

      * Diisi nama pelanggan</td>

    </tr>

                <tr>

      <td><strong>Keterangan</strong></td>

                  <td><b>:</b></td>

                  <td><input name=”txtKeterangan” value=”<?php echo $dataKeterangan; ?>” size=”55″ maxlength=”100″ /></td>

    </tr>

                <tr><td>&nbsp;</td>

                  <td>&nbsp;</td>

                  <td>&nbsp;</td>

    </tr>

                <tr>

                  <td bgcolor=”#CCCCCC”><b>PESAN MENU </b></td>

                  <td bgcolor=”#CCCCCC”>&nbsp;</td>

                  <td>&nbsp;</td>

    </tr>

                <tr>

                  <td><b>Menu Makan </b></td>

                  <td><b>:</b></td>

                  <td><b>

                    <select name=”cmbMenu”>

          <option value=”BLANK”>….</option>

          <?php

                  $mySql = “SELECT * FROM menu ORDER BY kd_menu”;

                  $myQry = mysql_query($mySql, $koneksidb) or die (“Gagal Query”.mysql_error());

                  while ($kolomData = mysql_fetch_array($myQry)) {

                                echo “<option value=’$kolomData[kd_menu]’>[ $kolomData[kd_menu] ] $kolomData[nm_menu]</option>”;

                  }

                  $mySql =””;

                  ?>

        </select>

Jumlah Porsi :

<input class=”angkaC” name=”txtJumlah” size=”2″ maxlength=”4″ value=”1″

                                                 onblur=”if (value == ”) {value = ‘1’}”

                                 onfocus=”if (value == ‘1’) {value =”}”/>

<input name=”btnPilih” type=”submit” style=”cursor:pointer;” value=” Pilih ” />

      </b></td>

    </tr>

                <tr>

                  <td>&nbsp;</td>

                  <td>&nbsp;</td>

                  <td>&nbsp;</td>

    </tr>

</table>

<table class=”table-list” width=”700″ border=”0″ cellspacing=”1″ cellpadding=”2″>

  <tr>

    <th colspan=”7″>DAFTAR  ITEM</th>

    </tr>

  <tr>

    <td width=”25″ align=”center” bgcolor=”#CCCCCC”><b>No</b></td>

    <td width=”63″ align=”center” bgcolor=”#CCCCCC”><b>Kode</b></td>

    <td width=”325″ bgcolor=”#CCCCCC”><b>Nama Menu </b></td>

    <td width=”97″ align=”right” bgcolor=”#CCCCCC”><b>Harga (Rp.) </b></td>

    <td width=”59″ align=”center” bgcolor=”#CCCCCC”><b>Jumlah</b></td>

    <td width=”100″ align=”right” bgcolor=”#CCCCCC”><b>Subtotal (Rp.) </b></td>

    <td width=”45″ align=”center” bgcolor=”#FFCC00″><b>Delete</b></td>

  </tr>

<?php

//  tabel menu

$tmpSql =”SELECT menu.*, tmp_penjualan.id, tmp_penjualan.jumlah

                                FROM menu, tmp_penjualan

                                WHERE menu.kd_menu=tmp_penjualan.kd_menu

                                AND tmp_penjualan.kd_user='”.$_SESSION[‘kd_user’].”‘

                                ORDER BY menu.kd_menu “;

$tmpQry = mysql_query($tmpSql, $koneksidb) or die (“Gagal Query Tmp”.mysql_error());

$totalBayar = 0; $qtyItem = 0; $nomor=0;

while($tmpRow = mysql_fetch_array($tmpQry)) {

                $nomor++;

                $id                                          = $tmpRow[‘id’];

                $subSotal            = $tmpRow[‘jumlah’] * $tmpRow[‘harga’];

                $totalBayar         = $totalBayar + $subSotal;

                $qtyItem             = $qtyItem + $tmpRow[‘jumlah’];

?>

  <tr>

    <td align=”center”><?php echo $nomor; ?></td>

    <td align=”center”><b><?php echo $tmpRow[‘kd_menu’]; ?></b></td>

    <td><?php echo $tmpRow[‘nm_menu’]; ?></td>

    <td align=”right”><?php echo format_angka($tmpRow[‘harga’]); ?></td>

    <td align=”center”><?php echo $tmpRow[‘jumlah’]; ?></td>

    <td align=”right”><?php echo format_angka($subSotal); ?></td>

    <td align=”center” bgcolor=”#FFFFCC”><a href=”?page=Transaksi-Penjualan&Act=Delete&id=<?php echo $id; ?>” target=”_self”><img src=”gambar/hapus.gif” width=”16″ height=”16″ border=”0″ /></a></td>

  </tr>

<?php

}?>

  <tr>

    <td colspan=”4″ align=”right” bgcolor=”#F5F5F5″><b>Total Bayar (Rp.) : </b></td>

    <td align=”center” bgcolor=”#F5F5F5″><b><?php echo $qtyItem; ?></b></td>

    <td align=”right” bgcolor=”#F5F5F5″><b><?php echo format_angka($totalBayar); ?></b></td>

    <td align=”center” bgcolor=”#F5F5F5″>&nbsp;</td>

  </tr>

  <tr>

    <td colspan=”4″ align=”right” bgcolor=”#F5F5F5″><b>Uang  Bayar (Rp.) : </b></td>

    <td align=”center” bgcolor=”#F5F5F5″>&nbsp;</td>

    <td align=”right” bgcolor=”#F5F5F5″><input name=”txtUangBayar” value=”<?php echo $dataUangBayar; ?>” size=”16″ maxlength=”12″/></td>

    <td align=”center” bgcolor=”#F5F5F5″>&nbsp;</td>

  </tr>

  <tr>

    <td colspan=”4″ align=”right”>&nbsp;</td>

    <td align=”center”>&nbsp;</td>

    <td align=”right”><input name=”txtTotBayar” type=”hidden” value=”<?php echo $totalBayar; ?>” /></td>

    <td align=”center”>&nbsp;</td>

  </tr>

  <tr>

    <td colspan=”6″ align=”right”><input name=”btnSave” type=”submit” style=”cursor:pointer;” value=” SIMPAN TRANSAKSI ” /></td>

    <td align=”center”>&nbsp;</td>

  </tr>

</table>

</form>

———————————————–

File transaksi_penjualan_view.php

———————————————-

<?php

include_once “library/inc.library.php”;

# Baca variabel URL

$kodeTransaksi = $_GET[‘noNota’];

# Perintah untuk mendapatkan data dari tabel penjualan

$mySql = “SELECT penjualan.*, user.nm_user FROM penjualan, user

                WHERE penjualan.kd_user=user.kd_user AND no_penjualan=’$kodeTransaksi'”;

$myQry = mysql_query($mySql, $koneksidb)  or die (“Query penjualan salah : “.mysql_error());

$kolomData = mysql_fetch_array($myQry);

?>

<html>

<head>

<title> :: Nota Penjualan – Warung Serba Pedes</title>

<link href=”styles/style.css” rel=”stylesheet” type=”text/css”>

</head>

<body>

<table width=”550″ border=”0″ cellspacing=”1″ cellpadding=”4″ class=”table-print”>

  <tr>

    <td width=”59″ rowspan=”2″ align=”center”><img src=”images/logo_kecil.png” width=”97″ height=”61″ /></td>

    <td width=”208″><strong>

      <h3> Wr. LOMBOK LONDO</h3>

    </strong></td>

    <td width=”217″><strong>Way Jepara,</strong> <?php echo IndonesiaTgl($kolomData[‘tgl_penjualan’]); ?></td>

  </tr>

  <tr>

    <td>Jl. Suhada, No 31, Labuhan Ratu Baru, Way Jepara, Lampung Timur <br> Telpon : 07241111111 </td>

    <td valign=”top”><strong>Kepada Yth.</strong> <?php echo $kolomData[‘pelanggan’]; ?> .. ….. … .. … … …. . …. … … .. …. ….. ……. ……. …. … … … … …. …. ….</td>

  </tr>

</table>

<table class=”table-list” width=”550″ border=”0″ cellspacing=”1″ cellpadding=”2″>

  <tr>

    <td colspan=”5″><strong>No Nota : <?php echo $kolomData[‘no_penjualan’]; ?></strong></td>

  </tr>

  <tr>

    <td width=”37″ align=”center” bgcolor=”#CCCCCC”><b>No</b></td>

    <td width=”277″ bgcolor=”#CCCCCC”><b>Daftar  Menu </b></td>

    <td width=”71″ align=”center” bgcolor=”#CCCCCC”><b>Harga (Rp) </b></td>

    <td width=”49″ align=”center” bgcolor=”#CCCCCC”><strong>Jumlah</strong></td>

    <td width=”90″ align=”right” bgcolor=”#CCCCCC”><b>Subtotal (Rp)</b></td>

  </tr>

<?php

                                # Menampilkan List Item menu yang dibeli untuk Nomor Transaksi Terpilih

                                $notaSql = “SELECT menu.*, penjualan_item.* FROM menu, penjualan_item

                                                WHERE menu.kd_menu=penjualan_item.kd_menu AND penjualan_item.no_penjualan=’$kodeTransaksi’

                                                ORDER BY menu.kd_menu ASC”;

                                $notaQry = mysql_query($notaSql, $koneksidb)  or die (“Query list menu salah : “.mysql_error());

                                $nomor  = 0;  $totalBelanja = 0;

                                while ($notaRow = mysql_fetch_array($notaQry)) {

                                $nomor++;

                                # Hitung Diskon (jika ada), dan Harga setelah diskon

                                //$besarDiskon = intval($notaRow[‘harga’]) * (intval($notaRow[‘diskon’])/100);

                                //$hargaDiskon = intval($notaRow[‘harga’]) – $besarDiskon;

                                # Membuat Subtotal

                                $subtotal  = $notaRow[‘harga’] * intval($notaRow[‘jumlah’]);

                                # Menghitung Total Belanja keseluruhan

                                $totalBelanja = $totalBelanja + intval($subtotal);

                                # Hitung sisa bayar (pengembalian)

                                $UangKembali = $kolomData[‘uang_bayar’] – $totalBelanja;

                ?>

  <tr>

    <td align=”center”><?php echo $nomor; ?></td>

    <td><?php echo $notaRow[‘nm_menu’]; ?></td>

    <td align=”right”><?php echo format_angka($notaRow[‘harga’]); ?></td>

    <td align=”center”><?php echo $notaRow[‘jumlah’]; ?></td>

    <td align=”right”><?php echo format_angka($subtotal); ?></td>

  </tr>

  <?php } ?>

  <tr>

    <td colspan=”4″ align=”right”><b>Total Bayar (Rp) : </b></td>

    <td align=”right” bgcolor=”#F5F5F5″><b><?php echo format_angka($totalBelanja); ?></b></td>

  </tr>

  <tr>

    <td colspan=”4″ align=”right”><b>Uang  Bayar (Rp) : </b></td>

    <td align=”right” bgcolor=”#F5F5F5″><b><?php echo format_angka($kolomData[‘uang_bayar’]); ?></b></td>

  </tr>

  <tr>

    <td colspan=”4″ align=”right”><b>Pengembalian (Rp) : </b></td>

    <td align=”right” bgcolor=”#CCFFFF”><b><?php echo format_angka($UangKembali); ?></b></td>

  </tr>

  <tr>

    <td colspan=”5″><strong>Kasir :</strong> <?php echo $kolomData[‘nm_user’]; ?></td>

  </tr>

</table>

<br/>

<table class=”table-print” width=”550″ border=”0″ cellspacing=”1″ cellpadding=”2″>

  <tr>

    <td width=”140″ align=”center”>&nbsp;</td>

    <td width=”204″>&nbsp;</td>

    <td width=”140″ align=”center”>Hoarmat kami,<br /><br /><br />

                (  Warus Makan Serba Pedes ) </td>

  </tr>

</table>

<img src=”images/btn_print.png” width=”40″ height=”44″ onClick=”javascript:window.print()” />

</body>

</html>

Leave a Reply

Your email address will not be published. Required fields are marked *