(Lampiran 1: Struktur Organisasi) LAMPIRAN

Teks penuh

(1)

LAMPIRAN

(2)

(Lampiran 2 : Script)

index.php

<title>Login</title> <head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Login Form</title>

<link rel="stylesheet" href="css/style.css"> </head>

<h1><center><?php echo "Sistem Pencatatan Persediaan Unit Distribusi" ?></center></h1>

<h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL<br> Jl. Argo Busono No. 1 Salatiga <br> Telp (0298) 321702" ?></center></h2>

<body>

<form action="cek_login.php" method="POST" > <section class="container">

<div class="login">

<h1>Login to Web App</h1>

<p><input type="text" name="user_id" value="" placeholder="User_id"></p> <p><input type="password" name="password" placeholder="password"

id="password"></p> <p class="remember_me"> <label>

<input name="checkbox" type="checkbox" id="check" onChange="ShowHide()"> <span style="font:Verdana, Geneva, sans-serif">tampilkan password</span> <script type="text/javascript"> function ShowHide(){ if (document.getElementById('check').checked) { document.getElementById('password').type = 'text'; } else { document.getElementById('password').type = 'password'; }} </script> </label> </p>

<td colspan="3"><input type="submit" name="button" id="button" value="LOGIN" /> </td> </div> </section></form></body> koneksi.php <?php $host = "localhost"; $user_id = "root"; $password = ""; $db = "distribusi";

$connect = mysql_connect($host,$user_id,$password) or die("Gagal konek"); $pilih_db = mysql_select_db($db) or die("Database tidak ada");

?> cek_login.php <?php include ("User.php"); session_start(); $user_idx = $_POST["user_id"]; //$passwordx = md5($_POST["password"]); $passwordx = ($_POST["password"]); $user = new User();

//$status = $user->cekUserAktif($user_idx, $passwordx); $hasil = $user->cekLogin($user_idx, $passwordx); $datax = mysql_fetch_array($hasil);

$cek = mysql_num_rows($hasil); $user_id = $datax["user_id"]; $level = $datax["level"]; $nama = $datax["nama"];

(3)

//echo $cek." - ".$username." - ".$level; if($cek>0){ session_start(); $_SESSION['user_id'] = $user_idx; $_SESSION['level'] = $level; $_SESSION['nama'] = $nama; header("location: home.php"); } else { header("location: index.php");} ?> User.php <?php class User { function connect() { include("koneksi.php");} function getUser() {

$user = new User(); $user->connect();

$query = "select * FROM user order by user_id"; $hasil = mysql_query($query);

return $hasil;}

function getIdUser($user_id) {

$user = new User(); $user->connect();

$query = "SELECT user_id FROM user WHERE user_id='$user_id'"; $hasil = mysql_query($query); $x=0; while($data = mysql_fetch_array($hasil)) { $x = $x+1; } return $x; }

function insertUser($user_id, $password, $nama, $level) {

$user = new User(); $user->connect();

$query = "insert into user(user_id, password, nama, level) VALUES ('$user_id','$password', '$nama', '$level')";

$hasil = mysql_query($query); if($hasil){ return "T"; } else { return "F"; } } function getUserEdit($user_id) {

$user = new User(); $user->connect();

$query = "select * FROM user WHERE user_id='$user_id'"; $hasil = mysql_query($query);

return $hasil; }

function updateUser($user_id, $password, $nama, $level) {

$user = new User(); $user->connect();

$query = "update user set password='$password', nama='$nama', level='$level' WHERE user_id='$user_id'"; $hasil = mysql_query($query); if($hasil){ return "T"; } else { return "F"; } } function deleteUser($user_id)

(4)

{

$user = new User(); $user->connect();

$query = "delete FROM user WHERE user_id='$user_id'"; $hasil = mysql_query($query); if($hasil){ return "T"; } else { return "F"; } }

function cekLogin($user_id, $password) {

$user = new User(); $user->connect();

$query = "SELECT user_id, password, nama, level FROM user WHERE user_id='$user_id' AND password='$password'"; $hasil = mysql_query($query); $cek = mysql_num_rows($hasil); return $hasil; /*if($cek >= 1){ return $id; } else { return "gagal"; }*/}

/*function cekUserAktif($user_id, $password){ $user = new User();

$user->connect();

$query = "SELECT status FROM user WHERE id='$id' && sandi='$sandi'"; $hasil = mysql_query($query); $x=0; while($data = mysql_fetch_array($hasil)) { $res[$x] = $data["status"]; $x = $x+1; } $hsl = $res[0]; return $hsl; } */} home.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $username = $_SESSION['user_id']; $level = $_SESSION['level']; ?>

<title>Sistem Pencatatan Persediaan</title>

<link type="text/css" href="asset/css/style.css" rel="stylesheet">

<h1><center><?php echo "Sistem Pencatatan Persediaan Unit Distribusi" ?></center></h1>

<h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL<br> Jl. Argo Busono No. 1 Salatiga <br> Telp: (0298) 321702" ?></center></h2>

<div id="body"> <?php

echo "Selamat datang, Anda login sebagai $level<br><br>"; if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php"); } ?> <div id="list"> <lo><strong>USER ADMIN</strong></lo> <ul>

<li><strong>Data Anggota</strong><br />Menampilkan Data Anggota Koperasi</li></li> <li><strong>Master Barang</strong><br />Menampilkan Data Barang</li>

<li><strong>Laporan Persediaan</strong><br />Menampilkan Rekap Barang Masuk <br/>Menampilkan Rekap Barang Keluar

<br/>Persediaan Barang </li></li>

(5)

</ul>

<lo><strong>USER STAFF</strong></lo> <ul>

<li><strong>Data Barang</strong><br />Menampilkan Form Tambah Barang Masuk beserta Data Barang Masuk

<br/>Form Tambah Barang Keluar beserta Data Barang Keluar</li> <li><strong>Laporan Persediaan</strong><br />Menampilkan Rekap Barang Masuk

<br/>Menampilkan Rekap Barang Keluar <br/>Persediaan Barang </li>

<li><strong>Log Out</strong><br />Keluar dari sistem aplikasi</li> </ul> </div> </div> <?php } else header("location: index.php"); ?> menu.php <head>

<script src="asset/js/menu.js" type="text/javascript"></script> <link href="asset/css/menu.css" rel="stylesheet" type="text/css" /> </head> <div id="menu"> <div id="MainMenu"> <div id="Menu"> <div class="suckertreemenu"> <ul id="treemenu1"> <li><a href="home.php">Home</a></li>

<li><a href="data_kryn.php">Data Anggota</a></li> <li><a href="master_barang.php">Master Barang</a></li> <li><a href="#">Laporan Persediaan</a>

<ul>

<li><a href="rekap_masuk.php">Rekap Masuk</a></li> <li><a href="rekap_keluar.php">Rekap Keluar</a></li> <li><a href="barang.php">Persediaan Barang</a></li> </ul>

<li><a href="logout.php">Log Out</a></li> </ul> </div> </div> </div> <div class="cleaner_h0"></div> </div> menu_staff.php <head>

<script src="asset/js/menu.js" type="text/javascript"></script> <link href="asset/css/menu.css" rel="stylesheet" type="text/css" /> </head> <div id="menu"> <div id="MainMenu"> <div id="Menu"> <div class="suckertreemenu"> <ul id="treemenu1"> <li><a href="home.php">Home</a></li> <li><a href="#">Data Barang</a>

<ul>

<li><a href="barang_masuk.php">Barang Masuk</a></li> <li><a href="barang_keluar.php">Barang Keluar</a></li>

</ul> </li>

<li><a href="#">Laporan Persediaan</a> <ul>

<li><a href="rekap_masuk.php">Rekap Masuk</a></li> <li><a href="rekap_keluar.php">Rekap Keluar</a></li> <li><a href="barang.php">Persediaan Barang</a></li> </ul>

(6)

</ul> </div> </div> </div> <div class="cleaner_h0"></div> </div> master_barang.php <?php include('koneksi.php'); session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; ?>

<title>Sistem Pencatatan Persediaan</title> <style type="text/css"> .BLUE { color: #06C; } </style> <head> <style> .bold { font-weight: bold; } </style>

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "Primer Koperasi Karyawan Manunggal "?> </center></h2>

<div id="body"> <?php if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php"); } ?> <tr>

<td><a href="tambah_barang.php"><center>TAMBAH DATA BARANG</a></center></td></tr> </td>

<table border="1" align="center" cellpadding="5" cellspacing="0"> <thead> <tr class="bold" bgcolor="#9999CC"> <td>Kode Barang</td> <td>Nama Barang</td> <td>Harga Jual</td> <td>Satuan</td> <td>Opsi</td> </tr> </thead> <tbody> <?php

$query = mysql_query("select * from barang"); while ($data = mysql_fetch_array($query)) { ?> <tr> <td><?php echo $data['id_brg']; ?></td> <td><?php echo $data['nama_brg']; ?></td> <td><?php echo $data['harga_jual']; ?></td> <td><?php echo $data['satuan']; ?></td> <td>

<a href="delete_barang.php?id=<?php echo $data['id_brg']; ?>">Hapus</a> <a href="edit_barang.php?id=<?php echo $data['id_brg']; ?>">Edit</a> </tr>

<?php } ?> </table>

(7)

<div class="cleaner_h10"></div> </tbody> </table></body> <?php } else header("location: index.php"); ?> tambah_barang.php <title>Persediaan Barang</title> <head>

<table border=3 bordercolor="purple" width=50% align="left">

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<body>

<form name="status" action="insert_barang.php" method="post" > <tr>

<td>Kode Barang</td> <td> : </td>

<td> <input type="text" name="id_barang" cols="50" rows="5" value="" required="required"></td>

</tr> <tr>

<td>Nama Barang</td> <td> : </td>

<td> <input type="text" name="nama_barang" cols="50" rows="5" value="" required="required"></td>

</tr> <tr>

<td>Harga Jual</td> <td> : </td>

<td> <input type="text" name="harga_jual" cols="50" rows="5" value="" required="required"></td>

</tr> <tr>

<td>Satuan</td> <td> : </td>

<td> <input type="text" name="satuan" cols="50" rows="5" value="" required="required"></td>

</tr> <tr>

<td><input type="submit" name="simpan" value="Tambah">

<input type=button value=Kembali onClick=self.history.back()></td></tr> </table> <tr> </td></form></body> insert_barang.php <?php include('koneksi.php'); $id_barang = $_POST['id_barang']; $nama_barang = $_POST['nama_barang']; $harga_jual = $_POST['harga_jual']; $satuan = $_POST['satuan']; //$stok_awal = $_POST['stok_awal']; //simpan data ke database

$query = mysql_query ("insert into barang (id_brg,nama_brg,harga_jual,satuan) values('$id_barang', '$nama_barang', '$harga_jual', '$satuan')")or

die(mysql_error()); if ($query) { header('location:master_barang.php?'); }?> edit_barang.php <?php include"koneksi.php";

(8)

?>

<title>Edit Barang</title> <head>

<table>

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<body> <?php

$edit=mysql_query("SELECT * FROM barang WHERE id_brg='$_GET[id]'"); $a=mysql_fetch_array($edit);

echo"<center><font color=blue><br>

<h1><width=400>EDIT DATA BARANG</h1></font> <form method=POST action=update_barang.php> <input type=hidden name=id_brg value=$a[id_brg]>

<table> <tr>

<td>Kode Barang</td><td>:</td><td><input type=text name='id_brg' value='$a[id_brg]'> </font></td>

</tr> <tr>

<td>Nama Barang</td><td>:</td><td><input type=text name='nama_brg' value='$a[nama_brg]'></td>

</tr> <tr>

<td>Harga Jual</td><td>:</td><td><input type=text name='harga_jual' value='$a[harga_jual]'></td>

</tr> <tr>

<td>Satuan</td><td>:</td><td><input type=text name='satuan' value='$a[satuan]'></td>

</tr>

</table><br>

<input type=submit value=UPDATE> <input type=button value=KEMBALI onClick=self.history.back()>

</form>

<width=400 size=5>

<font color=blue size=2><b></b></font>"; ?></body>

update_barang.php

<?php

include"koneksi.php";

$a=mysql_query("UPDATE barang SET

id_brg='$_POST[id_brg]',nama_brg='$_POST[nama_brg]',harga_jual='$_POST[harga_jual] ', satuan='$_POST[satuan]' WHERE id_brg='$_POST[id_brg]'");

if($a){

header('location:master_barang.php'); }

else{

echo"Daftar Gagal Diupdate<br> <a href=master_barang.php></a>"; }?> delete_barang.php <?php include('koneksi.php'); $id_brg = $_GET['id'];

$query = mysql_query("delete from barang where id_brg='$id_brg'") or die(mysql_error()); if ($query) { header('location:master_barang.php?message=delete'); } ?> data_kryn.php <?php include ("menu.php");

(9)

include('koneksi.php'); session_start(); ?> <title>Sistem Persediaan</title> <style type="text/css"> .BLUE { color: #06C; } </style> <head> <style> .bold { font-weight: bold; } </style>

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "Primer Koperasi Karyawan Manunggal "?> </center></h2>

<div id="body"> <tr>

<td><a href="tambah_kryn.php"><center>TAMBAH DATA ANGGOTA</a></center></td></tr> </td>

<table border="1" align="center" cellpadding="5" cellspacing="0"> <thead> <tr class="bold" bgcolor="#9999CC"> <td>NRK</td> <td>Nama Anggota</td> <td>Bagian</td> <td>Opsi</td> </tr> </thead> <tbody> <?php

$query = mysql_query("select * from karyawan"); while ($data = mysql_fetch_array($query)) { ?> <tr> <td><?php echo $data['nrk']; ?></td> <td><?php echo $data['nama_karyawan']; ?></td> <td><?php echo $data['bagian']; ?></td> <td>

<a href="delete_kryn.php?id=<?php echo $data['nrk']; ?>">Hapus</a> <a href="edit_kryn.php?id=<?php echo $data['nrk']; ?>">Edit</a> </tr> <?php } ?> </table> <div class="cleaner_h10"></div> </tbody> tambah_kryn.php <title>Persediaan Barang</title> <head>

<table border=3 bordercolor="purple" width=50% align="left">

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<body>

<form name="status" action="insert_kryn.php" method="post" > <tr>

<td>NRK</td> <td> : </td>

<td> <input type="text" name="nrk" cols="50" rows="5" value="" required="required"></td>

</tr> <tr>

<td>Nama Anggota</td> <td> : </td>

(10)

<td> <input type="text" name="nama_karyawan" cols="50" rows="5" value="" required="required"></td> </tr> <tr> <td>Bagian</td> <td> : </td>

<td> <input type="text" name="bagian" cols="50" rows="5" value="" required="required"></td>

</tr> <tr>

<td><input type="submit" name="simpan" value="Tambah">

<input type=button value=Kembali onClick=self.history.back()></td></tr> </table> <tr> </td></form></body> insert_kryn.php <?php include('koneksi.php'); $nrk = $_POST['nrk']; $nama_karyawan = $_POST['nama_karyawan']; $bagian = $_POST['bagian'];

//simpan data ke database

$query = mysql_query ("insert into karyawan (nrk,nama_karyawan,bagian) values('$nrk', '$nama_karyawan', '$bagian')")or die(mysql_error()); if ($query) { header('location:data_kryn.php?');} ?> edit_kryn.php <?php include"koneksi.php"; ?> <title>Edit Karyawan</title> <head> <table>

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<body> <?php

$edit=mysql_query("SELECT * FROM karyawan WHERE nrk='$_GET[id]'"); $a=mysql_fetch_array($edit);

echo"<center><font color=blue><br>

<h1><width=400>EDIT DATA KARYAWAN</h1></font> <form method=POST action=update_kryn.php> <input type=hidden name=nrk value=$a[nrk]>

<table> <tr>

<td>NRK</td><td>:</td><td><input type=text name='nrk' value='$a[nrk]'> </font></td></tr>

<tr>

<td>Nama Karyawan</td><td>:</td><td><input type=text name='nama_karyawan' value='$a[nama_karyawan]'></td></tr>

<tr>

<td>Bagian</td><td>:</td><td><input type=text name='bagian' value='$a[bagian]'></td></tr>

</table><br>

<input type=submit value=UPDATE> <input type=button value=KEMBALI onClick=self.history.back()>

</form>

<width=400 size=5>

<font color=blue size=2><b></b></font>"; ?></body>

update_kryn.php

<?php

(11)

$a=mysql_query("UPDATE karyawan SET nrk='$_POST[nrk]',nama_karyawan='$_POST[nama_karyawan]', bagian='$_POST[bagian]' WHERE nrk='$_POST[nrk]'"); if($a){ header('location:data_kryn.php'); } else{

echo"Daftar Gagal Diupdate<br> <a href=data_kryn.php></a>"; } ?> delete_kryn.php <?php include('koneksi.php'); $nrk = $_GET['id'];

$query = mysql_query("delete from karyawan where nrk='$nrk'") or die(mysql_error());

$query1 = mysql_query("delete from transaksi_penjualan where nrk='$nrk'") or die(mysql_error()); if ($query) { header('location:data_kryn.php?message=delete'); } ?> barang_masuk.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; } ?>

<title>Sistem Pencatatan Persediaan</title> <style type="text/css"> .bold { font-weight: bold; } </style> <head>

<table border=3 bordercolor="purple" width=50% align="center"> <link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL"?> </center></h2> <h3> <center><?php echo "Barang Masuk" ?> </center></h3>

<?php date_default_timezone_set("Asia/Jakarta"); $today = date("d-m-Y"); if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php");} ?> <body>

<form name="status" action="insert_masuk.php" method="post" align="center"> <br><br>

<td>Tanggal Masuk</td> <td> : </td>

<td> <input type="text" name="tanggal_masuk" cols="50" rows="5" value="<?php echo $today; ?>" readonly="readonly"></td>

</tr>

<tr class="hurufx"> <td>Kode Barang </td> <td> : </td>

<td><select name="id_barang" id="id_barang" onchange="changeKode(this.value)" > <option value=0>-Pilih-</option>

(12)

include("koneksi.php");

$result2 = mysql_query("select * from barang"); $jsArray2 = "var barang = new Array();\n"; while ($row = mysql_fetch_array($result2)) {

echo '<option value="' . $row['id_brg'] . '">' . $row['id_brg'] . '</option>'; $jsArray2 .= "barang['" . $row['id_brg'] . "'] = {nama_barang:'" .

addslashes($row['nama_brg']) . "'};\n";} echo '</select>'; ?> </td></tr> <tr> <td>Nama Barang </td> <td> : </td>

<td><input type="text" name="nama_barang" id="nama_barang" size="20"/> <script type="text/javascript"> <?php echo $jsArray2; ?> function changeKode(id){ document.getElementById('nama_barang').value = barang[id].nama_barang; }; </script> </select></td></tr> <tr> <td>Jumlah Masuk</td> <td> : </td>

<td> <input type="text" name="jumlah_masuk" cols="50" rows="5" value="" required="required"></td>

</tr> <tr> <td>

<input type="submit" name="simpan" value="Tambah"></td></tr> </table>

<tr>

</form>

<table border=3 bordercolor="purple" width=80% align="center"> <thead align="center"> <tr class="bold" bgcolor="#9999CC"> <td>Tanggal</td> <td>Kode Barang</td> <td>Nama Barang</td> <td>Jumlah Masuk</td> </tr> </thead> <tbody> <?php

$query = mysql_query("select * from barang_masuk"); while ($data = mysql_fetch_array($query)) {

?> <tr> <td><?php echo $data['tgl_masuk']; ?></td> <td><?php echo $data['id_brg']; ?></td> <td><?php echo $data['nama_brg'] ?></td> <td><?php echo $data['jml_masuk']; ?></td> </tr> <?php } ?> <div class="cleaner_h10"></div> </tbody> </table></body> barang.php <?php include('koneksi.php'); session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; ?> <title>Persediaan Barang</title> <style type="text/css"> .BLUE { color: #06C;

(13)

} </style> <head> <style> .bold { font-weight: bold; } </style>

<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "Primer Koperasi Karyawan Manunggal "?> </center></h2> <body> <?php if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php"); } ?>

<form name="status" action="insert_masuk.php" method="post" align="center"> <br>

<br>

<table border="1" align="center" cellpadding="5" cellspacing="0"> <thead> <tr class="bold" bgcolor="#9999CC"> <td>Kode Barang</td> <td>Nama Barang</td> <td>Satuan</td> <td>Harga Jual</td> <td>Barang Tersedia</td> </tr> </thead> <tbody> <?php

$query = mysql_query("select * from barang"); while ($data = mysql_fetch_array($query)) { ?> <tr> <td><?php echo $data['id_brg']; ?></td> <td><?php echo $data['nama_brg']; ?></td> <td><?php echo $data['satuan']; ?></td> <td><?php echo $data['harga_jual']; ?></td> <td><?php echo $data['barang_tersedia']; ?></td> </tr> <?php } ?> </table> </body> <div class="cleaner_h10"></div> </table> </body> <?php } else header("location: index.php"); ?> insert_masuk.php <?php include "koneksi.php"; //$tanggal_masuk = $_POST['tanggal_masuk']; $id_barang = $_POST['id_barang']; $nama_barang = $_POST['nama_barang']; $jml_masuk = $_POST['jumlah_masuk']; $query=mysql_query ("INSERT INTO

barang_masuk(tgl_masuk,id_brg,nama_brg,jml_masuk)VALUES(now(),'$id_barang','$nama_ barang','$jml_masuk');")or die (mysql_error());

(14)

$query2=mysql_query ("UPDATE barang SET barang_tersedia = barang_tersedia + '$jml_masuk' WHERE id_brg='$id_barang';")or die (mysql_error());

if($query2){ header ('location:barang_masuk.php'); }}?> barang_keluar.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; } ?>

<title>Sistem Pencatatan Persediaan</title> <style type="text/css"> .bold { font-weight: bold; } </style> <head>

<table border=3 bordercolor="purple" width=50% align="center"> <link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL"?> </center></h2> <h3> <center><?php echo "Barang Keluar" ?> </center></h3>

<?php

include ("transaksilagi.php"); $transaksilagi= new transaksilagi;

$hasil = $transaksilagi->getMaxidtransaksilagi(); error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));

$datax = mysql_fetch_array($hasil); $lastNonota= $datax['last'];

$lastNoUrut = substr($lastNonota, 4, 3); $nextNoUrut = $lastNoUrut + 1;

$nextnota = "BK".sprintf('%03s', $nextNoUrut); date_default_timezone_set("Asia/Jakarta"); $today = date("d-m-Y"); if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php"); } ?> <body>

<form name="status" action="insert_keluar.php" method="post" align="center"> <br>

<br> <tr>

<td>No Nota</td> <td> : </td>

<td> <input type="text" name="no_nota" cols="50" rows="5" value="<?php echo $nextnota; ?>" readonly="readonly"></td>

</tr> <tr>

<td>Tanggal Keluar</td> <td> : </td>

<td> <input type="text" name="tanggal_keluar" cols="50" rows="5" value="<?php echo $today; ?>" readonly="readonly"></td>

</tr>

<tr class="hurufx"> <td>NRK </td> <td> : </td>

<td><select name="nrk" id="nrk" onchange="changeKodeNRK(this.value)" > <option value=0>-Pilih-</option>

<?php

include("koneksi.php");

$result = mysql_query("select * from karyawan"); $jsArray = "var karyawan = new Array();\n";

(15)

while ($row = mysql_fetch_array($result)) {

echo '<option value="' . $row['nrk'] . '">' . $row['nrk'] . '</option>'; $jsArray .= "karyawan['" . $row['nrk'] . "'] = {nama_karyawan:'" .

addslashes($row['nama_karyawan']) . "',bagian:'".addslashes($row['bagian'])."'};\n"; } echo '</select>'; ?> <script type="text/javascript"> <?php echo $jsArray; ?> function changeKodeNRK(nrk){ document.getElementById('nama_karyawan').value = karyawan[nrk].nama_karyawan; document.getElementById('bagian').value = karyawan[nrk].bagian; }; </script> </select> <tr> <td>Nama </td> <td> : </td>

<td><input type="text" name="nama_karyawan" id="nama_karyawan" size="20" readonly="readonly"/></td></tr>

<tr>

<td>Bagian</td> <td>:</td>

<td><input type="text" name="bagian" id="bagian" size="20" readonly="readonly"/></td>

</tr> <tr class="hurufx"> <td>Kode Barang</td> <td> : </td>

<td><select name="id_brg" id="id_brg" onchange="changeKodeBRG(this.value)" > <option value=0>-Pilih-</option>

<?php

include("koneksi.php");

$result2 = mysql_query("select * from barang"); $jsArray2 = "var barang = new Array();\n"; while ($row = mysql_fetch_array($result2)) {

echo '<option value="' . $row['id_brg'] . '">' . $row['id_brg'] . '</option>'; $jsArray2 .= "barang['" . $row['id_brg'] . "'] =

{nama_barang:'" . addslashes($row['nama_brg']) . "',harga:'".addslashes($row['harga_jual'])."'};\n"; } echo '</select>'; ?> <script type="text/javascript"> <?php echo $jsArray2; ?> function changeKodeBRG(id){ document.getElementById('nama_barang').value = barang[id].nama_barang; document.getElementById('harga').value = barang[id].harga; }; </script> </select> <tr> <td>Nama Barang </td> <td> : </td>

<td><input type="text" name="nama_barang" id="nama_barang" size="20" readonly="readonly"/></td>

</tr> <tr>

<td>Harga</td> <td>:</td>

<td><input type="text" name="harga" id="harga" size="20" readonly="readonly"/></td></tr>

<tr>

<td>Jumlah Beli</td> <td> : </td>

<td> <input type="text" name="jumlah_keluar" cols="50" rows="5" value="" required="required"></td></tr>

<tr> <td>

<input type="submit" name="simpan" value="Tambah"></td></tr> </table>

<tr> </form>

(16)

<thead align="center"> <tr class="bold" bgcolor="#9999CC"> <td>No_Nota</td> <td>Tanggal</td> <td>NRK</td> <td>Nama</td> <td>Bagian</td> <td>Kode Barang</td> <td>Nama Barang</td> <td>Harga</td> <td>Jumlah</td> <td>Total</td> </tr> </thead> <tbody> <?php

$query = mysql_query("select * from transaksi_penjualan"); while ($data = mysql_fetch_array($query)) {

?> <tr> <td><?php echo $data['no_nota']; ?></td> <td><?php echo $data['tanggal']; ?></td> <td><?php echo $data['nrk']; ?></td> <td><?php echo $data['nama_karyawan']; ?></td> <td><?php echo $data['bagian']; ?></td> <td><?php echo $data['id_brg']; ?></td> <td><?php echo $data['nama_brg']; ?></td> <td><?php echo $data['harga']; ?></td> <td><?php echo $data['jml']; ?></td> <td><?php echo $data['total']; ?></td> </tr> <?php } ?> <div class="cleaner_h10"></div> </tbody> </table> </body> transaksilagi.php <?php class transaksilagi { function connect() { include("koneksi.php"); } function gettransaksilagi(){

$transaksilagi = new transaksilagi(); $transaksilagi->connect();

$query = "select * FROM transaksi_penjualan order by no_nota"; $hasil = mysql_query($query);

return $hasil; }

function cekidtransaksilagi($no_nota) {

$transaksilagi = new transaksilagi(); $transaksilagi->connect();

$query = "SELECT no_nota FROM transaksi_penjualan WHERE no_nota='$no_nota'"; $hasil = mysql_query($query); $x=0; while($data = mysql_fetch_array($hasil)) { $x = $x+1; } return $x; } function getMaxidtransaksilagi(){

$transaksilagi= new transaksilagi(); $transaksilagi->connect();

$query = "SELECT max(no_nota) AS last from transaksi_penjualan where no_nota like 'BK%'";

(17)

$hasil = mysql_query($query); return $hasil;

}

function getHistoryTransaksilagi($tanggal_awal, $tanggal_akhir, $barang){ $transaksilagi = new transaksilagi();

$transaksi->connect(); $tanggal_awal=strtotime($tanggal_awal); $awal=date("Y-m-d H:i:s",mktime(0,0,0,date("m",$tanggal_awal),date("d",$tanggal_awal),date("Y",$tang gal_awal))); $tanggal_akhir=strtotime($tanggal_akhir); $akhir=date("Y-m-d H:i:s",mktime(23,59,59,date("m",$tanggal_akhir),date("d",$tanggal_akhir),date("Y", $tanggal_akhir)));

$query = "SELECT * FROM transaksi WHERE (tgl_jam_masuk BETWEEN

'$awal' AND '$akhir') AND kode_barang='$barang' ORDER BY id_transaksi ASC"; $hasil = mysql_query($query); return $hasil; } }?> insert_keluar.php <?php include "koneksi.php"; $no_nota = $_POST['no_nota']; //$tgl = $_POST['tanggal_keluar']; $nrk = $_POST['nrk']; $nama = $_POST['nama_karyawan']; $bagian = $_POST['bagian']; $id_barang = $_POST['id_brg']; $nama_barang = $_POST['nama_barang']; $harga = $_POST['harga']; $jumlah_keluar = $_POST['jumlah_keluar']; $total = $harga*$jumlah_keluar;

$query=mysql_query ("INSERT INTO transaksi_penjualan

(no_nota,tanggal,nrk,nama_karyawan,bagian,id_brg,nama_brg,harga,jml,total) VALUES ('$no_nota',now(),'$nrk','$nama','$bagian','$id_barang','$nama_barang','$harga','$ jumlah_keluar','$total')") or die (mysql_error());

if ($query) {

$query2=mysql_query ("UPDATE barang SET barang_tersedia = barang_tersedia - '$jumlah_keluar' WHERE id_brg='$id_barang';")or die (mysql_error()); if($query2){ header('location:barang_keluar.php'); } }?> rekap_masuk.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; ?>

<title>Rekap Pencatatan Persediaan</title> <style type="text/css"> .bold { font-weight: bold; } </style> <head>

<table border=3 bordercolor="purple" width=50% align="center"> <link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"

src="asset/js/datetimepicker_css.js"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL"?> </center></h2> <h3> <center><?php echo "REKAP BARANG MASUK" ?> </center></h3>

(18)

<?php if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php");} ?> <body>

<form name="status" action="rekap2_masuk.php" method="post" align="center"> <br><br>

<tr class="hurufx"> <td>Tanggal Awal</td>

<td><input type="text" name="tanggal_awal" id="demo33" readonly="readonly"><a href="javascript:

NewCssCal('demo33','yyyymmdd','arrow')"

style="text-decoration:none">&nbsp;&nbsp;<img src="asset/images/cal.gif" width="16" height="16" border="0" style="text-decoration:none"></a><font

face="Tahoma" size="2"></font></td> </tr>

<tr class="hurufx"> <td>Tanggal Akhir</td>

<td><input type="text" name="tanggal_akhir" id="demo43" readonly="readonly"><a href="javascript:

NewCssCal('demo43','yyyymmdd','arrow')"

style="text-decoration:none">&nbsp;&nbsp;<img src="asset/images/cal.gif" width="16" height="16" border="0" style="text-decoration:none"></a><font

face="Tahoma" size="2"></font></td> </tr>

<tr class="hurufx"> <td></td>

<td><input type="submit" name="tombol" value="Lihat" class="btn-kirim-login"></td> </tr> <tr class="hurufx"> <td colspan="2"> <tr> </tr> </form> </table> <?php } else header("location: index.php"); ?> rekap2_masuk.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; ?>

<title>Rekap Pencatatan Persediaan</title> <style type="text/css"> .bold { font-weight: bold; } </style> <head>

<table border=3 bordercolor="purple" width=50% align="center"> <link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"

src="asset/js/datetimepicker_css.js"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL"?> </center></h2> <h3> <center><?php echo "REKAP BARANG MASUK" ?> </center></h3>

<?php

if($level=="admin"){ include("menu.php"); } else {

(19)

include("menu_staff.php");} $tanggal_awal = $_POST["tanggal_awal"]; $tanggal_akhir = $_POST["tanggal_akhir"]; include("koneksi.php"); ?> <body>

<table border="0" align=center width=100%> <tr class="hurufx"><td><b></b><br><b><?php

echo "REKAP BARANG MASUK dari tanggal $tanggal_awal sampai dengan tanggal $tanggal_akhir";

?></b></td></tr> <tr><td>

<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">

<thead>

<tr style="background-color:#b67a57; color:#000000;" align="center" class="hurufx" width=100%> <td align="center"><b>No.</b></td> <td align="center"><b>Tanggal Masuk</b></td> <td align="center"><b>Kode Barang</b></td> <td align="center"><b>Nama Barang</b></td> <td align="center"><b>Jumlah Barang</b></td> </tr></thead> <tbody> <?php

$a = mysql_query("select * from barang_masuk where tgl_masuk BETWEEN '$tanggal_awal' AND '$tanggal_akhir' order by tgl_masuk");

$no = 1;

while ($data = mysql_fetch_array($a)) {

?>

<tr align="center" class="hurufx">

<td align="center"><?php echo $no; ?></td>

<td align="center"><?php echo $data['tgl_masuk']; ?></td> <td align="center" ><?php echo $data['id_brg']; ?></td> <td align="center"><?php echo $data['nama_brg']; ?></td> <td align="center"><?php echo $data['jml_masuk']; ?></td></tr> <?php $no++;} ?> </tbody></table></td></tr></table> </body> <?php } else header("location: index.php"); ?> rekap_keluar.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; ?>

<title>Rekap Pencatatan Persediaan</title> <style type="text/css"> .bold { font-weight: bold; } </style> <head>

<table border=3 bordercolor="purple" width=50% align="center"> <link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"

src="asset/js/datetimepicker_css.js"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL "?> </center></h2> <h3> <center><?php echo "REKAP BARANG KELUAR" ?> </center></h3>

(20)

<?php if($level=="admin"){ include("menu.php"); } else { include("menu_staff.php"); } ?> <body>

<form name="status" action="rekap2_keluar.php" method="post" align="center"> <br><br>

<tr class="hurufx"> <td>Tanggal Awal</td>

<td><input type="text" name="tanggal_awal" id="demo33" readonly="readonly"><a href="javascript:

NewCssCal('demo33','yyyymmdd','arrow')"

style="text-decoration:none">&nbsp;&nbsp;<img src="asset/images/cal.gif" width="16" height="16" border="0" style="text-decoration:none"></a><font

face="Tahoma" size="2"></font></td> </tr>

<tr class="hurufx"> <td>Tanggal Akhir</td>

<td><input type="text" name="tanggal_akhir" id="demo43" readonly="readonly"><a href="javascript:

NewCssCal('demo43','yyyymmdd','arrow')"

style="text-decoration:none">&nbsp;&nbsp;<img src="asset/images/cal.gif" width="16" height="16" border="0" style="text-decoration:none"></a><font

face="Tahoma" size="2"></font></td> </tr>

<tr class="hurufx"> <td></td>

<td><input type="submit" name="tombol" value="Lihat" class="btn-kirim-login"></td> </tr> <tr class="hurufx"> <td colspan="2"> <tr> </tr> </form> </table> <?php } else header("location: index.php"); ?> rekap2_keluar.php <?php session_start(); if (ISSET($_SESSION['user_id'])) { $nama = $_SESSION['nama']; $level = $_SESSION['level']; ?>

<title>Rekap Pencatatan Persediaan</title> <style type="text/css"> .bold { font-weight: bold; } </style> <head>

<table border=3 bordercolor="purple" width=50% align="center"> <link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"

src="asset/js/datetimepicker_css.js"></script> </head>

<h1> <center><?php echo "Sistem Pencatatan Persediaan" ?> </center></h1> <h2><center><?php echo "PRIMER KOPERASI KARYAWAN MANUNGGAL"?> </center></h2> <h3> <center><?php echo "REKAP BARANG KELUAR" ?> </center></h3>

<?php

if($level=="admin"){ include("menu.php");

(21)

} else { include("menu_staff.php"); } $tanggal_awal = $_POST["tanggal_awal"]; $tanggal_akhir = $_POST["tanggal_akhir"]; include("koneksi.php"); ?> <body>

<table border="0" align=center width=100%> <tr class="hurufx"><td><b></b><br><b><?php

echo "REKAP BARANG KELUAR dari tanggal $tanggal_awal sampai dengan tanggal $tanggal_akhir";

?></b></td></tr> <tr><td>

<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">

<thead>

<tr style="background-color:#b67a57; color:#000000;" align="center" class="hurufx" width=100%> <td align="center"><b>No.</b></td> <td align="center"><b>Tanggal Keluar</b></td> <td align="center"><b>Kode Barang</b></td> <td align="center"><b>Nama Barang</b></td> <td align="center"><b>Jumlah Barang</b></td> </tr></thead> <tbody> <?php

$a = mysql_query("select * from transaksi_penjualan where tanggal BETWEEN '$tanggal_awal' AND '$tanggal_akhir' order by tanggal");

$no = 1;

while ($data = mysql_fetch_array($a)) {

?>

<tr align="center" class="hurufx">

<td align="center"><?php echo $no; ?></td>

<td align="center"><?php echo $data['tanggal']; ?></td> <td align="center" ><?php echo $data['id_brg']; ?></td> <td align="center"><?php echo $data['nama_brg']; ?></td> <td align="center"><?php echo $data['jml']; ?></td></tr> <?php $no++; } ?> </tbody></table></td></tr></table> </body> <?php } else header("location: index.php"); ?> logout.php <?php session_start(); if($_REQUEST['out']=="ya") { if(ISSET($_SESSION['user_id'])) { UNSET($_SESSION ['user_id']); } } header("location: index.php"); session_destroy(); ?>

(22)
(23)
(24)
(25)
(26)
(27)
(28)
(29)
(30)
(31)

Figur

Memperbarui...

Referensi

Memperbarui...

Related subjects :