gimana cara biar ada peringatan stok kurang dari permintaan keluar??
<?php
error_reporting(0);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);
error_reporting(E_ALL & ~E_NOTICE);
?>
<?php
//kondisi jika data SES_USER masih kosong maka...
if (isset($_SESSION['SES_USER'])=="") {
//merefresh halaman ke index.php
echo"<meta http-equiv='refresh' content='0;url=index.php'>";
} else { //jika SES_USER tidak kosong maka...
include "koneksi.php"; //memanggil koneksi
?>
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbstok");
$query = "select max(id_trans_klr) as Kode from brg_klr";
$hasil = mysql_query($query);
$data = mysql_fetch_array($hasil);
$kode = $data['Kode'];
$nourut = (int) substr($kode, 3, 3);
$nourut++;
//karakter tetap
$char = "OUT";
//mengatur 02 karakter berubah-ubah
$IdBaru = $char.sprintf("%03s",$nourut);
?>
<style type="text/css">
caption {font-size:x-large}
</style>
<!-- link ke jQuery-1.4.4 -->
<link rel="stylesheet" href="jQuery-1.4.4/bundle/themes/base/jquery.ui.all.css">
<script type="text/javascript" src="jQuery-1.4.4/jscript/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jQuery-1.4.4/jscript/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="jQuery-1.4.4/bundle/ui/jquery.ui.datepicker.js"></script>
<script> <!-- Javascript untuk fungsi kalender -->
$(function() {
$( "#tanggal" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat:'yy-mm-dd',
yearRange: '1980:c+9'
});
});
</script>
<style type="text/css">
a {
text-decoration: none;
}
.inputnonaktif {
background-color:#6F9;
}
</style>
<link href="thickbox/thickbox.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="jquery/jquery-1.2.6.js"></script>
<script language="javascript" src="thickbox/thickbox.js"></script>
<script language="javascript">
var $jnoc = jQuery.noConflict();
$jnoc(document).ready(function(){
$jnoc("a.slick").click(function(){
$jnoc(".active").removeClass("active");
$jnoc(this).addClass("active");
$jnoc(".content-slick").slideUp();
var content_show = $jnoc(this).attr("title");
$jnoc("#" +content_show).slideDown();
});
});
function selectbarang(kode_brg,nama_brg,kualitas,id_suplier){
$jnoc('input[@name=kode_brg]').val(kode_brg);
$jnoc('input[@name=nama_brg]').val(nama_brg);
$jnoc('input[@name=kualitas]').val(kualitas);
$jnoc('input[@name=id_suplier]').val(id_suplier);
tb_remove(); // hilangkan dialog thickbox
}
function selectbrg_klr(kode_brg,nama_brg,kualitas,id_suplier){
$jnoc('input[@name=kode_brg]').val(kode_brg);
$jnoc('input[@name=nama_brg]').val(nama_brg);
$jnoc('input[@name=kualitas]').val(kualitas);
$jnoc('input[@name=id_suplier]').val(id_suplier);
tb_remove(); // hilangkan dialog thickbox
}
</script>
<form name="frmSimpan" method="post" action="" enctype="multipart/form-data">
<table width="450" align="center">
<caption>INPUT BARANG KELUAR<br><br></caption>
<tr>
<td width="50%">ID Transaksi Keluar</td>
<td width="2%">:</td>
<td width="66%">
<!-- echo $data['nim']; digunakan untuk menampilkan data dari field nim -->
<input type="text" name="id_trans_klr" maxlength="15" size="9" required="" value="<?php echo $IdBaru; ?>" readonly>
</td>
</tr>
<tr>
<td width="50%">Kode Barang</td>
<td width="2%">:</td>
<td width="66%">
<input type="text" name="kode_brg" size="30" class="inputnonaktif" maxlength="8" required="" readonly id="kode_brg"><a href="cari_barang.php?width=400&height=400" class="thickbox"><input type="submit" name="browse" id="browse3" value="Browse" /></a>
*cari kode barang</tr></td>
<tr>
<td width="50%">Nama Barang</td>
<td width="2%">:</td>
<td width="66%">
<input name="nama_brg" size="30" maxlength="30" required="" readonly>
</td>
</tr>
<!--<input type="text" name="id_daftar" size="30" class="inputnonaktif" maxlength="8" required="" readonly id="id_daftar"><a href="cari_daftar.php?width=600&height=400" class="thickbox"><input type="submit" name="browse" id="browse3" value="Browse" /></a>
*cari id pendaftaran</tr></td> -->
<tr>
<td width="50%">Kualitas</td>
<td width="2%">:</td>
<td width="66%">
<!-- echo $data['nama']; digunakan untuk menampilkan data dari field nama -->
<input name="kualitas" size="30" maxlength="30" required="" readonly>
</td>
</tr>
<tr>
<td width="50%">ID Suplier</td>
<td width="2%">:</td>
<td width="66%">
<!-- echo $data['nama']; digunakan untuk menampilkan data dari field nama -->
<input name="id_suplier" size="30" maxlength="30" required="" readonly>
</td>
</tr>
<tr>
<td width="32%">Tanggal Keluar</td>
<td width="2%">:</td>
<td width="66%">
<input type="text" name="tgl_klr" id="tanggal"/>
</td>
</tr>
<tr>
<td width="32%">Jumlah Keluar</td>
<td width="2%">:</td>
<td width="66%">
<input name="jml_klr" size="30" maxlength="30" required="" >
</td>
</tr>
<tr>
<td width="32%"> </td>
<td width="2%"> </td>
<td width="66%">
<input name="btnSimpan" type="submit" value="Simpan">
<!-- membuat link ke mahasiswa_tampil.php pada tombol Batal -->
<input name="btnBatal" type="reset"
onclick="window.location.href='?page=barang_keluar&hal=1'" value="Batal" />
</td>
</tr>
</table>
</form>
<?php
//jika tombol Simpan di klik maka...
if (isset($_POST['btnSimpan'])) {
/*
eksekusi query untuk memasukkan data pada tb_mahasiswa dengan field yang diisi
nim,nama,jekel,alamat,sts_mhs
".$_POST['txtNIM']." digunakan menampung data dari txtNIM
... dst
*/
$sql_insert = "INSERT INTO brg_klr (id_trans_klr,tgl_klr,kode_brg,nama_brg,jml_klr,id_suplier) VALUES (
'".$_POST['id_trans_klr']."',
'".$_POST['tgl_klr']."',
'".$_POST['kode_brg']."',
'".$_POST['nama_brg']."',
'".$_POST['jml_klr']."',
'".$_POST['id_suplier']."')";
$query_insert = mysql_query($sql_insert) or die (mysql_error());
//mengcopy file gambar ke lokasi yang ditentukan [folder=imgFoto]
//jika proses penyimpanan berhasil maka...
if ($query_insert) {
//menampilkan pesan data berhasil disimpan
echo"<script>alert('Simpan data berhasil !')</script>";
//merefresh halaman ke mahasiswa_tampil.php
echo "<meta http-equiv='refresh' content='0; url=?page=barang_keluar&hal=1'>";
}
}
}//menutup kondisi jika SES_USER tidak kosong di atas
?>