I.
Source Code
1. index.php
<title>PCI</title>
<link type="text/css" href="asset/css/style.css" rel="stylesheet"> <div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body">
<p>Silahkan login untuk melakukan manajemen data.</p> <div id="bg-line">
<form action = "proseslogin.php" method = "POST"> Userid :
<input type="text" name="userid" class="input-teks-login" placeholder="Masukkan userid..." />
Password :
<input type="password" name="password" class="input-teks-login" placeholder="Masukkan Password..." />
<input type="submit" value="Masuk" name="login"/> </div>
</form> </div>
2. proseslogin.php
<?php
include ("koneksi.php"); session_start();
$usernamex = $_POST["userid"]; $passwordx = $_POST["password"];
$hasil = mysql_query("SELECT * FROM user WHERE userid='$usernamex' && password='$passwordx'");
$datax = mysql_fetch_array($hasil); $cek = mysql_num_rows($hasil); $username = $datax["userid"]; $level = $datax["level"]; $nama = $datax["username"]; if($cek>0){
session_start();
$_SESSION['userid'] = $usernamex; $_SESSION['level'] = $level; $_SESSION['username'] = $nama; header("location: home.php"); }
else {
header("location: index.php"); }
?>
3. home.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>SMS Gateway</title>
<link type="text/css" href="asset/css/style.css" rel="stylesheet"> <h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include('koneksi.php'); ?>
<strong>Selamat datang di aplikasi Penjualan dan Persediaan PT. PLATINUM CROP INTERNATIONAL</strong>
<div id="list"> <ul>
<li><strong>USER</strong><br />Berfungsi untuk mengelola data user pemakai aplikasi (tambah, edit, hapus) yang tersimpan di dalam database</li>
<li><strong>CURAH</strong><br />Berfungsi untuk mengelola data benih curah dan melihat persediaan benih curah yang tersedia</li>
<li><strong>PACK</strong><br />Berfungsi untuk mengelola data benih pack dan melihat persediaan benih pack yang tersedia</li>
<li><strong>MARKETING</strong><br />Berfungsi untuk mengelola data marketing (tambah, edit, hapus) yang tersimpan di dalam database</li>
<li><strong>PELANGGAN</strong><br />Berfungsi untuk mengelola data pelanggan (tambah, edit, hapus) yang tersimpan di dalam database</li>
<li><strong>TRANSAKSI</strong><br />Berfungsi untuk memproses transaksi penjualan yang terjadi dan mencetak nota penjualan</li>
<li><strong>LAPORAN</strong><br />Berisi data-data transaksi yang telah dilakukan oleh user, seperti data penjualan, retur dan sample</li>
<li><strong>LOGOUT</strong><br />Keluar dari sistem aplikasi</li> </ul>
</div> </div> <?php } else{
header("location: index.php"); }?>
4. Daftaruser.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php"); ?>
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"> <td colspan="9" height="25" class="hurufx">Daftar User</td></tr> <tr class="hurufx" align="center">
<td>User ID</td> <td>User Name</td> <td>Level</td> <td>Password</td> <td>Aksi</td> </tr>
<?php
$query = mysql_query("SELECT * from user"); $no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<td><?php echo $data['userid']; ?></td> <td><?php echo $data['username']; ?></td> <td><?php echo $data['level']; ?></td> <td><?php echo $data['password']; ?></td>
<td><a href="deleteuser.php?userid=<?php echo $data['userid']; ?>"><div class="btn-delete">Hapus</div></a>
<a href="edituser.php?userid=<?php echo $data['userid']; ?>&username=<?php echo $data['username']; ?>&password=<?php echo $data['password']; ?>&level=<?php echo $data['level']; ?>"><div class="btn-edit">Edit</div></a></td>
</tr> <?php $no++; } ?>
</table><br><br> </div>
<?php } else
header("location: index.php"); ?>
5. Tambahuser.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body">
<div class="gap"></div> <div class="container"> <div class="row"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include('koneksi.php'); ?>
<div>1
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Input Data User</td></tr>
<form action="simpanuser.php" method="post" name="myForm" onSubmit="return cekInputan()">
<tr class="hurufx"> <td>User ID</td>
<td><input type="text" name="userid" size="30"></td> </tr>
<tr class="hurufx"> <td>User Name :</td>
<td><input type="text" name="username" size="30"></td> </tr>
<tr class="hurufx"> <td>Password :</td>
<td><input type="text" name="password" size="30"></td> </tr>
<td><input type="text" name="level" size="30"> </tr>
<tr> <td></td>
<td><input type="submit" value="Simpan" class="btn-kirim-login"><input type="reset" value="Reset" class="btn-kirim-login"></td>
</tr> </form> </table> </div> </body> </html> <?php } else
header("location: index.php"); ?>
6. Simpanuser.php
<?php
include "koneksi.php"; session_start();
$userid = $_POST['userid']; $username= $_POST['username']; $password = $_POST['password']; $level = $_POST['level'];
$query = "insert into user(userid, username, level, password) values('$userid', '$username', '$level', '$password')";
$hasil = mysql_query($query); if($hasil){
?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahuser.php'</script>
<?php } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahuser.php'</script>
<?php } ?>
7. Daftarpack.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php"); ?>
<div class="cleaner_h10"></div>
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Daftar Benih Pack</td></tr>
<tr class="hurufx" align="center"> <td>Kode Benih Pak</td>
<td>Brand</td> <td>Volume(gram)</td> <td>Jumlah(Pack)</td> <td>Aksi</td>
</tr> <?php
$query = mysql_query("SELECT t.kodepack, p.namapack, p.volumepack, (SUM( IF( t.kodetrans LIKE 'msk', t.jumlah, 0)) - SUM( IF( t.kodetrans LIKE 'kel', t.jumlah, 0 ) )) as total
FROM transaksipack t, pack p WHERE t.kodepack = p.kodepack GROUP BY kodepack");
$no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['kodepack']; ?></td> <td><?php echo $data['namapack']; ?></td> <td><?php echo $data['volumepack']; ?></td> <td><?php echo $data['total']; ?></td>
<td><a href="detailpacking.php?kodepack=<?php echo $data['kodepack']; ?>">Detail</a></td>
</tr> <?php $no++; } ?>
</table><br><br> </div>
<?php } else
header("location: index.php"); ?>
8. detailpacking.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International<br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php"); $kodepack = $_GET["kodepack"]; ?>
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr class="hurufx" align="center"> <td>Tanggal</td>
<td>Nama Pack</td> <td>Volume</td> <td>Jumlah</td> <td>Keterangan</td> </tr>
<?php
$query = mysql_query("SELECT t.tanggal, p.kodepack, p.namapack, p.volumepack, t.jumlah, t.kodetrans from transaksipack t, pack p where t.kodepack=p.kodepack and p.kodepack='$kodepack'");
$no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['tanggal']; ?></td> <td><?php echo $data['kodepack']; ?></td> <td><?php echo $data['namapack']; ?></td>
<td align="right"><?php echo $data['volumepack']; ?></td> <td align="right"><?php echo $data['jumlah']; ?></td> <td align="right"><?php echo $data['kodetrans']; ?></td> </tr>
<?php $no++; }
$querytotal = mysql_query("select (sum(if(kodetrans='msk', jumlah, 0)))-(sum(if(kodetrans='kel', jumlah, 0))) as total from transaksipack where kodepack='$kodepack'");
$datatotal = mysql_fetch_array($querytotal); ?>
<tr class="hurufx">
<td colspan="3"> </td> <td>Total Stok</td>
<td align="right"><?php echo number_format($datatotal['total'],0,',','.'); ?></td> </tr>
</table><br><br> </div>
<?php } else
header("location: index.php"); ?>
9. Tambahpack.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<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>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }?>
include('koneksi.php'); ?>
<div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<form action="simpanpack.php" method="post" name="myForm" onSubmit="return cekInputan()">
<tr class="hurufx"> <td>Tanggal :</td>
<td><input type="text" name="tanggal" id="tanggal2" size="30">
<a href="javascript: NewCssCal('tanggal2','yyyymmdd','arrow')" style="text-decoration:none"> <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>Kode Pack :</td>
<td><input type="text" name="kodepack" size="30"></td> </tr>
<tr class="hurufx"> <td>Brand :</td>
<td><input type="text" name="namapack" size="30"></td> </tr>
<tr class="hurufx"> <td>Crop :</td>
<td><input type="text" name="crop" size="30"></td> </tr>
<tr class="hurufx"> <td>Kode Curah</td>
<td><select name="kodecurah"> <?php
$querycurah = "select * FROM curah order by kodecurah"; $hasilcurah = mysql_query($querycurah);
while($row = mysql_fetch_array($hasilcurah)){ ?>
<option value="<?php echo $row["kodecurah"]; ?>"><?php echo $row["kodecurah"]." - ".$row["namacurah"]?></option>
<?php } ?>
</select></td></tr> <tr class="hurufx"> <td>Volume :</td>
<td><input type="text" name="volumepack" size="30"></td> </tr>
<tr class="hurufx"> <td>Jumlah :</td>
<td><input type="text" name="jumlah" size="30"></td> </tr>
<tr> <td></td>
<td><input type="submit" value="Simpan" class="btn-kirim-login"><input type="reset" value="Reset" class="btn-kirim-login"></td>
</tr> </form> </table> </div> </body> </html> <?php } else
header("location: index.php"); ?>
10.Simpanpack.php
<?php
include "koneksi.php"; session_start();
$kodecurah = $_POST['kodecurah']; $volumepack = $_POST['volumepack']; $jumlah = $_POST['jumlah'];
$total = $volumepack*$jumlah;
$query1 = "SELECT * FROM pack WHERE kodepack = '$kodepack'"; $hasil1 = mysql_query($query1);
$data1 = mysql_fetch_array($hasil1); $jumlahakhir = $data1['jumlah']; if (mysql_num_rows($hasil1) == 0){
$query2 = "insert into pack(kodepack, namapack, crop, kodecurah, volumepack) values('$kodepack', '$namapack', '$crop', '$kodecurah', '$volumepack')";
$hasil2 = mysql_query($query2); if($hasil2){
$query3 = "insert into transaksicurah(kodecurah, tanggal, volume, kodetrans, kodepack) values('$kodecurah', '$tanggal', '$total', 'kel', '$kodepack')";
$hasil3 = mysql_query($query3);
$query6 = "insert into transaksipack(kodepack, tanggal, jumlah, kodetrans) values('$kodepack', '$tanggal', '$jumlah', 'msk')";
$hasil6 = mysql_query($query6); if($hasil3){
?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahpack.php'</script>
<?php } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahpack.php'</script>
<?php } } else{ ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahpack.php'</script>
<?php } } else{
$query5 = "insert into transaksicurah(kodecurah, tanggal, volume, kodetrans, kodepack) values('$kodecurah', '$tanggal', '$total', 'kel', '$kodepack')";
$hasil5 = mysql_query($query5);
$query7 = "insert into transaksipack(kodepack, tanggal, jumlah, kodetrans) values('$kodepack', '$tanggal', '$jumlah', 'msk')";
$hasil7 = mysql_query($query7); if($hasil5&$hasil7){
?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahpack.php'</script>
<?php } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahpack.php'</script>
<?php } } ?>
11.Daftarcurah.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
$halaman = @$_GET['halaman']; if(empty($halaman)){
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Daftar Benih Curah</td></tr>
<tr class="hurufx" align="center"> <td>Kode</td>
<td>Nama Barang</td> <td>Stok (gram)</td> </tr>
<?php
$query = mysql_query("SELECT t.kodecurah, c.namacurah, (SUM( IF( t.kodetrans LIKE 'msk', t.volume, 0)) - SUM( IF( t.kodetrans LIKE 'kel', t.volume, 0 ) )) as total FROM transaksicurah t, curah c WHERE t.kodecurah = c.kodecurah GROUP BY kodecurah LIMIT $posisi,$batas");
$no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['kodecurah']; ?></td> <td><?php echo $data['namacurah']; ?></td>
<td align="right"><?php echo number_format($data['total'],0,',','.'); ?></td> </tr>
=$query2 = mysql_query("SELECT t.kodecurah, c.namacurah, (SUM( IF( t.kodetrans LIKE 'msk', t.volume, 0 ) ) - SUM( IF( t.kodetrans LIKE 'kel', t.volume, 0 ) )) as total FROM transaksicurah t, curah c WHERE t.kodecurah = c.kodecurah GROUP BY kodecurah");
$jmldata = mysql_num_rows($query2); $jmlhalaman = ceil($jmldata/$batas); echo "<br> Halaman : ";
for($i=1;$i<=$jmlhalaman;$i++) if ($i != $halaman){
echo " <a href=\"laporan.php?halaman=$i\">$i</a> | "; }
12.Tambahcurah.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<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>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }?>
<div class="gap"></div> <div class="container"> <div class="row"> <?php
include('koneksi.php'); ?>
<div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Input Data Benih Curah</td></tr>
<form action="simpancurah.php" method="post" name="myForm" onSubmit="return cekInputan()">
<tr class="hurufx"> <td>Tanggal :</td>
<td><input type="text" name="tanggal" id="tanggal1" size="30">
<a href="javascript: NewCssCal('tanggal1','yyyymmdd','arrow')" style="text-decoration:none"> <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>Kode :</td>
<td><input type="text" name="kodecurah" size="30"></td> </tr>
<tr class="hurufx"> <td>Nama :</td>
<td><input type="text" name="namacurah" size="30"></td> </tr>
<tr class="hurufx"> <td>Jumlah (Gram) :</td>
<td><input type="text" name="jumlah" size="30"></td> </tr>
<tr> <td></td>
<td><input type="submit" value="Simpan" class="btn-kirim-login"><input type="reset" value="Reset" class="btn-kirim-login"></td>
<?php } else
header("location: index.php"); ?>
13.Simpancurah.php
<?php
include "koneksi.php"; session_start();
$tanggal = $_POST['tanggal']; $kodecurah = $_POST['kodecurah']; $namacurah= $_POST['namacurah']; $jumlah = $_POST['jumlah'];
$query2 = "SELECT * FROM curah WHERE kodecurah = '$kodecurah'"; $hasil2 = mysql_query($query2);
$data2 = mysql_fetch_array($hasil2); if (mysql_num_rows($hasil2) == 0){
$query = "insert into curah(kodecurah, namacurah) values('$kodecurah', '$namacurah')";
$hasil = mysql_query($query); if($hasil){
$query4 = "insert into transaksicurah(kodecurah, tanggal, volume, kodetrans) values('$kodecurah', '$tanggal', '$jumlah', 'msk')";
$hasil4 = mysql_query($query4); if($hasil4){
?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahcurah.php'</script>
<?php } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahcurah.php'</script>
<?php } } else{ ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahcurah.php'</script>
<?php } } else {
$query3 = "insert into transaksicurah(kodecurah, tanggal, volume, kodetrans) values('$kodecurah', '$tanggal', '$jumlah', 'msk')";
$hasil3 = mysql_query($query3); ?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahcurah.php'</script>
<?php } ?>
14.Daftarmarketing.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php"); ?>
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Daftar Marketing</td></tr>
<tr class="hurufx" align="center"> <td>Kode Marketing</td>
<td>Nama marketing</td> <td>Wilayah</td>
<td>Aksi</td> </tr>
<?php
$query = mysql_query("SELECT kodemarketing, namamarketing, wilayah FROM marketing");
$no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['kodemarketing']; ?></td> <td><?php echo $data['namamarketing']; ?></td> <td><?php echo $data['wilayah']; ?></td>
<td><a href="deletemarketing.php?kodemarketing=<?php echo $data['kodemarketing']; ?>"><div class="btn-delete">Hapus</div></a>
<a href="editmarketing.php?kodemarketing=<?php echo $data['kodemarketing']; ?>&namamarketing=<?php echo $data['namamarketing']; ?>&wilayah=<?php echo $data['wilayah']; ?>"><div class="btn-edit">Edit</div></a></td>
</tr> <?php $no++; } ?>
</table><br><br> </div>
<?php } else
header("location: index.php"); ?>
15.Tambahmarketing.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body">
<div class="row"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include('koneksi.php'); ?>
<div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Input Data Marketing</td></tr>
<form action="simpanmarketing.php" method="post" name="myForm" onSubmit="return cekInputan()">
<tr class="hurufx"> <td>Nama :</td>
<td><input type="text" name="namamarketing" size="30"></td> </tr>
<tr class="hurufx"> <td>Wilayah :</td>
<td><input type="text" name="wilayah" size="30"></td> </tr>
<tr> <td></td>
<td><input type="submit" value="Simpan" class="btn-kirim-login"><input type="reset" value="Reset" class="btn-kirim-login"></td>
</tr> </form> </table> </div> </body> </html> <?php } else
header("location: index.php"); ?>
16.Simpanmarketing.php
<?php
include "koneksi.php"; session_start();
$namamarketing = $_POST['namamarketing']; $wilayah = $_POST['wilayah'];
$query = "insert into marketing(namamarketing, wilayah) values('$namamarketing', '$wilayah')";
$hasil = mysql_query($query); if($hasil){
?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahmarketing.php'</script>
<?php } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahmarketing.php'</script>
<?php } ?>
17.Daftarpelanggan.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
</style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php"); ?>
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Daftar Pelanggan</td></tr>
<tr class="hurufx" align="center"> <td>Kode Pelanggan</td>
<td>Nama Pelanggan</td> <td>Alamat</td>
<td>No. Telepon</td> <td>Nama Marketing</td> <td>Aksi</td>
</tr> <?php
$query = mysql_query("SELECT p.kodepelanggan, p.namapelanggan, p.alamatpelanggan, p.nomortelepon, m.namamarketing, p.kodemarketing FROM pelanggan p, marketing m where p.kodemarketing=m.kodemarketing");
$no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['kodepelanggan']; ?></td> <td><?php echo $data['namapelanggan']; ?></td> <td><?php echo $data['alamatpelanggan']; ?></td> <td><?php echo $data['nomortelepon']; ?></td> <td><?php echo $data['namamarketing']; ?></td>
<td><a href="deletepelanggan.php?kodepelanggan=<?php echo $data['kodepelanggan']; ?>"><div class="btn-delete">Hapus</div></a>
<a href="editpelanggan.php?kodepelanggan=<?php echo $data['kodepelanggan']; ?>&namapelanggan=<?php echo $data['namapelanggan']; ?>
&alamatpelanggan=<?php echo $data['alamatpelanggan']; ?>&kodemarketing=<?php echo $data['kodemarketing']; ?>¬elp=<?php echo $data['nomortelepon']; ?>"><div class="btn-edit">Edit</div></a></td>
</tr> <?php $no++; } ?>
</table><br><br> </div>
<?php } else
header("location: index.php"); ?>
18.Tambahpelanggan.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
</style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International <br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body">
<div class="gap"></div> <div class="container"> <div class="row"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include('koneksi.php'); ?>
<div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Input Data Pelanggan</td></tr>
<form action="simpanpelanggan.php" method="post" name="myForm" onSubmit="return cekInputan()">
<tr class="hurufx"> <td>Nama :</td>
<td><input type="text" name="namapelanggan" size="30"></td> </tr>
<tr class="hurufx"> <td>Alamat :</td>
<td><input type="text" name="alamatpelanggan" size="30"></td> </tr>
<tr class="hurufx"> <td>No. Telepon :</td>
<td><input type="text" name="notelp" size="30"></td> </tr>
<tr class="hurufx"> <td>Marketing :</td>
<td><select name="marketing"> <?php
$querymarketing = "select * FROM marketing order by kodemarketing"; $hasilmarketing = mysql_query($querymarketing);
while($row = mysql_fetch_array($hasilmarketing)) { ?>
<option value="<?php echo $row["kodemarketing"]; ?>"><?php echo $row["namamarketing"]?></option>
<?php } ?> </select> </tr> <tr> <td></td>
<td><input type="submit" value="Simpan" class="btn-kirim-login"><input type="reset" value="Reset" class="btn-kirim-login"></td>
</tr> </form> </table> </div> </body> </html> <?php } else
header("location: index.php"); ?>
19.Simpanpelanggan.php
<?php
session_start();
$namapelanggan = $_POST['namapelanggan']; $alamatpelanggan = $_POST['alamatpelanggan']; $marketing = $_POST['marketing'];
$notelp = $_POST['notelp'];
$query = "insert into pelanggan(namapelanggan, alamatpelanggan, kodemarketing, nomortelepon) values('$namapelanggan', '$alamatpelanggan', '$marketing', '$notelp')";
$hasil = mysql_query($query); if($hasil){
?>
<script language="JavaScript">alert('Data Berhasil Disimpan'); document.location='tambahpelanggan.php'</script>
<?php } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='tambahpelanggan.php'</script>
<?php } ?>
20.transaksipenjualan.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International<br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php");
date_default_timezone_set("Asia/Jakarta"); $today = date("m");
?>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<form name="form" action="transaksipenjualan.php" method="post">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Proses Transaksi</td></tr>
<tr class="hurufx"> <td>No. Nota</td>
<td><input type="text" name="nonota" value="<?php
$querynotrans = "SELECT max(nonota) AS last FROM transaksi WHERE nonota LIKE '%INV%$today%'";
$hasilnotrans = mysql_query($querynotrans); $datanotrans= mysql_fetch_array($hasilnotrans); $lastNoTransaksi = $datanotrans['last'];
$lastNoUrut = substr($lastNoTransaksi, 12, 4); $nextNoUrut = $lastNoUrut + 1;
$nextNoTransaksi = "INV/PCI/".$today."/".sprintf('%04s', $nextNoUrut); echo $nextNoTransaksi; ?>" readonly="readonly"></td>
</tr>
<td>Tanggal</td>
<td><input type="text" name="tanggal" value="<?php echo date("Y-m-d")?>"></td> </tr>
<tr class="hurufx"> <td>Pelanggan</td>
<td><select name="pelanggan" onchange="document.form.nsalesperson;document.form.salesperson;submit();">
<option>Pilih Pelanggan</option> <?php
$querypelanggan = "select * FROM pelanggan order by kodepelanggan"; $hasilpelanggan = mysql_query($querypelanggan);
while($row = mysql_fetch_array($hasilpelanggan)) {
?>
<?php $plg = $row['kodepelanggan'];?> <?php
if(($_POST["pelanggan"] == $plg)or($_GET["pelanggan"] == $plg)){ $selected="selected";
<option value="<?php echo $row['kodepelanggan'];?>" <?php echo $selected;?>> <?php echo $row['namapelanggan']; ?>
</option>
<tr class="hurufx"> <td>Salesperson</td> <td>
<?php
if(isset($_POST['pelanggan'])){ $kodepelanggan=$_POST['pelanggan'];
$qmarketing=mysql_query("select m.namamarketing from marketing m, pelanggan p where m.kodemarketing=p.kodemarketing and p.kodepelanggan='$kodepelanggan'"); $dmarketing=mysql_fetch_array($qmarketing);
<input type="text" name="nsalesperson" value="<?php echo $nmarketing ?>" readonly> </td>
</tr>
<tr class="hurufx"> <td>Jatuh Tempo</td> <td>
<input type="text" name="jatuhtempo" value="<?php echo $jatuhtempo ?>"></td> </tr>
</table>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr class="hurufx" align="center"> <td>Kode Pack</td>
<?php
if(isset($_POST['tambah'])){ $nonota = $_POST["nonota"]; $tanggal = $_POST["tanggal"]; $kodepack = $_POST["kodepack"]; $harga = $_POST["harga"]; $jumlah = $_POST["jumlah"]; $diskon = $_POST["diskon"];
$queryhitung = "select (SUM( IF( t.kodetrans LIKE'msk', t.jumlah, 0)) - SUM( IF( t.kodetrans LIKE'kel', t.jumlah, 0 ) )) as jumlah
FROM transaksipack t
WHERE t.kodepack = '$kodepack'";
$hasilhitung = mysql_query($queryhitung); $datahitung = mysql_fetch_array($hasilhitung); $jumlahpack = ($datahitung['jumlah']);
if($jumlah>$jumlahpack){ ?>
<script language="JavaScript">alert('Barang tidakmencukupi/tidak tersedia'); document.location='transaksipenjualan.php'</script>
<?php } else{
$query1 = "insert into detailtransaksi(nonota, kodepack, harga, jumlah, diskon) VALUES ('$nonota','$kodepack', '$harga', '$jumlah', '$diskon')";
$hasil = mysql_query($query1); }
}
else if(isset($_POST['simpan'])){ $nonota = $_POST["nonota"]; $tanggal = $_POST["tanggal"]; $pelanggan = $_POST["pelanggan"]; if($_POST["jatuhtempo"]==""){ $jatuhtempo = 0;
} else{
$jatuhtempo = $_POST["jatuhtempo"]; }
$hasilJT = date('Y-m-d', strtotime('+'.$jatuhtempo.'days', strtotime($tanggal))); $querysimpan = "insert into transaksi(nonota, tanggal, kodepelanggan, jatuhtempo) VALUES ('$nonota', '$tanggal', '$pelanggan', '$hasilJT')";
$hasilsimpan = mysql_query($querysimpan); if($hasilsimpan){
$qbayar = mysql_query("insert into pembayaran(nonota, kodepelanggan, jumlah, tanggalbayar) values('$nonota', '$pelanggan', 0, '$tanggal')");
if($qbayar){ ?>
<script language="JavaScript">
window.open('nota.php?nonota=<?php echo $nonota; ?>', '_blank'); document.location='transaksipenjualan.php'
</script> <?php } } else { ?>
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='transaksipenjualan.php'</script>
<?php } } ?> <?php
if(isset($_GET['nonota']) && isset($_GET['kodepack']) && isset($_GET['jumlah'])){ $nonota=$_GET['nonota'];
$kodepack=$_GET['kodepack']; $jumlah=$_GET['jumlah'];
$queryhapus1 = mysql_query("delete from detailtransaksi where nonota='$nonota' and kodepack='$kodepack'") or die(mysql_error());
} ?> <?php
from detailtransaksi d, pack p where d.kodepack=p.kodepack and d.nonota='$nextNoTransaksi'");
$no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['kodepack']; ?></td>
<td><?php echo $data['namapack']." @ ".$data['volumepack']." gram" ?></td> <td align="right"><?php echo $data['jumlah']; ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['harga'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['diskon'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['subtotal'],2,',','.'); ?></td>
<td><a href="transaksipenjualan.php?nonota=<?php echo $data['nonota']; ?>&kodepack=<?php echo $data["kodepack"]; ?>&jumlah=<?php echo $data["jumlah"]; ?>&pelanggan=<?php echo $_POST['pelanggan']; ?>"><div class ="btn-delete">hapus</div></a></td>
</tr> <?php $no++; } ?>
<tr class="hurufx">
<td colspan="2"><select name="kodepack"> <?php
$querypack = "select * FROM pack order by kodepack"; $hasilpack = mysql_query($querypack);
while($row = mysql_fetch_array($hasilpack)){ ?>
<option value="<?php echo $row["kodepack"]; ?>"><?php echo $row["kodepack"]." - ".$row["namapack"]." @ ".$row["volumepack"]." gram"?></option>
<?php } ?>
</select></td>
<td align="right"><input type="text" name="jumlah" id="jumlah"></td> <td align="right"><input type="text" name="harga" id="harga"></td> <td align="right"><input type="text" name="diskon" id="diskon"></td> <td></td>
<td>
<input type="submit" name="tambah" value="tambah" class="btn-edit"/> </td>
</table>
<input type="submit" name="simpan" value="simpan" class="btn-kirim-login"/> </form>
<?php } else
header("location: index.php"); ?>
21.transaksisample.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International<br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
if($level=="staff" or $level=="manager"){ $today = date("m");
?>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<form name="form" action="transaksisample.php" method="post">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="9" height="25" class="hurufx">Proses Transaksi</td></tr>
<tr class="hurufx"> <td>No. Nota</td>
<td><input type="text" name="nonota" value="<?php
$querynotrans = "SELECT max(nonota) AS last FROM transaksi WHERE nonota LIKE '%SINV%$today%'";
$hasilnotrans = mysql_query($querynotrans); $datanotrans= mysql_fetch_array($hasilnotrans); $lastNoTransaksi = $datanotrans['last'];
$lastNoUrut = substr($lastNoTransaksi, 13, 4); $nextNoUrut = $lastNoUrut + 1;
$nextNoTransaksi = "SINV/PCI/".$today."/".sprintf('%04s', $nextNoUrut); echo $nextNoTransaksi; ?>" readonly="readonly"></td>
</tr>
<tr class="hurufx"> <td>Tanggal</td>
<td><input type="text" name="tanggal" value="<?php echo date("Y-m-d")?>"></td> </tr>
<tr class="hurufx"> <td>Pelanggan</td>
<td><select name="pelanggan" onchange="document.form.nsalesperson;document.form.salesperson;submit();">
<option>Pilih Pelanggan</option> <?php
$querypelanggan = "select * FROM pelanggan order by kodepelanggan"; $hasilpelanggan = mysql_query($querypelanggan);
while($row = mysql_fetch_array($hasilpelanggan)) {
?>
<?php $plg = $row['kodepelanggan'];?> <?php
if(($_POST["pelanggan"] == $plg)or($_GET["pelanggan"] == $plg)){ $selected="selected";
<option value="<?php echo $row['kodepelanggan'];?>" <?php echo $selected;?>> <?php echo $row['namapelanggan']; ?>
</option>
<tr class="hurufx"> <td>Salesperson</td> <td>
<?php
if(isset($_POST['pelanggan'])){ $kodepelanggan=$_POST['pelanggan'];
<input type="text" name="nsalesperson" value="<?php echo $nmarketing ?>" readonly> </td>
</tr> </table>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr class="hurufx" align="center"> <td>Kode Pack</td>
<td>Nama Pack</td> <td>Jumlah</td> <td>Action</td> </tr>
<?php
if(isset($_POST['tambah'])){ $nonota = $_POST["nonota"]; $tanggal = $_POST["tanggal"]; $kodepack = $_POST["kodepack"]; $jumlah = $_POST["jumlah"];
$queryhitung = "select (SUM( IF( t.kodetrans LIKE'msk', t.jumlah, 0)) - SUM( IF( t.kodetrans LIKE'kel', t.jumlah, 0 ) )) as jumlah
FROM transaksipack t
WHERE t.kodepack = '$kodepack'";
$hasilhitung = mysql_query($queryhitung); $datahitung = mysql_fetch_array($hasilhitung); $jumlahpack = ($datahitung['jumlah']);
if($jumlah>$jumlahpack){ ?>
<script language="JavaScript">alert('Barang tidakmencukupi/tidak tersedia'); document.location='transaksisample.php'</script>
<?php } else{
$query1 = "insert into detailtransaksi(nonota, kodepack, harga, jumlah, diskon) VALUES ('$nonota','$kodepack', '0', '$jumlah', '0')";
$hasil = mysql_query($query1); }
}
else if(isset($_POST['simpan'])){ $nonota = $_POST["nonota"]; $tanggal = $_POST["tanggal"]; $pelanggan = $_POST["pelanggan"];
$querysimpan = "insert into transaksi(nonota, tanggal, kodepelanggan) VALUES ('$nonota', '$tanggal', '$pelanggan')";
$hasilsimpan = mysql_query($querysimpan); if($hasilsimpan){
?>
<script language="JavaScript">
window.open('notasample.php?nonota=<?php echo $nonota; ?>', '_blank'); document.location='transaksisample.php'
<script language="JavaScript">alert('Data Gagal Disimpan'); document.location='transaksisample.php'</script>
if(isset($_GET['nonota']) && isset($_GET['kodepack']) && isset($_GET['jumlah'])){ $nonota=$_GET['nonota'];
$kodepack=$_GET['kodepack']; $jumlah=$_GET['jumlah'];
$queryhapus1 = mysql_query("delete from detailtransaksi where nonota='$nonota' and kodepack='$kodepack'") or die(mysql_error());
} ?> <?php
$query = mysql_query("select d.nonota, d.kodepack, p.namapack, p.volumepack, d.jumlah from detailtransaksi d, pack p where d.kodepack=p.kodepack and d.nonota='$nextNoTransaksi'");
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['kodepack']; ?></td>
<td><?php echo $data['namapack']." @ ".$data['volumepack']." gram" ?></td> <td align="right"><?php echo $data['jumlah']; ?></td>
<td><a href="transaksisample.php?nonota=<?php echo $data['nonota']; ?>&kodepack=<?php echo $data["kodepack"]; ?>&jumlah=<?php echo $data["jumlah"]; ?>&pelanggan=<?php echo $_POST['pelanggan']; ?>"><div class ="btn-delete">hapus</div></a></td>
</tr> <?php $no++; } ?>
<tr class="hurufx">
<td colspan="2"><select name="kodepack"> <?php
$querypack = "select * FROM pack order by kodepack"; $hasilpack = mysql_query($querypack);
while($row = mysql_fetch_array($hasilpack)){ ?>
<option value="<?php echo $row["kodepack"]; ?>"><?php echo $row["kodepack"]." - ".$row["namapack"]." @ ".$row["volumepack"]." gram"?></option>
<?php } ?>
</select></td>
<td align="right"><input type="text" name="jumlah" id="jumlah"></td> <td>
<input type="submit" name="tambah" value="tambah" class="btn-edit"/> </td>
</table>
<input type="submit" name="simpan" value="simpan" class="btn-kirim-login"/> </form>
<?php } else
header("location: index.php"); ?>
22.laporanpiutang.php
<?php
session_start();
if (ISSET($_SESSION['userid'])) {
$nama = $_SESSION['username']; $level = $_SESSION['level']; ?>
<title>Sistem Informasi Penjualan</title> <head>
<style> </style>
<link type="text/css" href="asset/css/style.css" rel="stylesheet" /> <script src="asset/js/menu.js" type="text/javascript"></script> </head>
<div id="container">
<h1><?php echo "Sistem Informasi Penjualan dan Persediaan" ?></h1>
<h2><?php echo "PT. Platinum Crop International<br> Jl. Wuni Benoyo I No. 03 Salatiga 50742<br> Telp: (0298) 314767" ?></h2>
<div id="body"> <?php
if($level=="staff" or $level=="manager"){ include("menu.php");
} else {
include("menuadmin.php"); }
include("koneksi.php"); ?>
<div class="cleaner_h10"></div>
<form action="laporanpiutang.php" method="post" name="postform"> <table width="" border="0">
<td><b>Cari</b></td> <td>
<input type="text" name="nama" size="45"/> <select name="dasar">
<option value="pelanggan">Pelanggan</option> <option value="marketing">Marketing</option>
<input type="submit" value="cari" name="cari" class="btn-kirim-login"> </td>
<td>
<a href="export.php" class="btn-print">Export ke Excel</a> </td>
<td colspan="2"> </td> </tr>
</table> </form>
<table class="zebra-table" border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
<tr style="background-color:#000000; color:#FFFFFF;" align="center"><td colspan="11" height="25" class="hurufx">Laporan Penjualan</td></tr>
<tr class="hurufx" align="center"> <td>Tanggal<br>Nota</td>
<td>No. Nota</td>
<td>Nama<br>Pelanggan</td> <td>Nama<br>Marketing</td> <td>Total<br>Penjualan</td> <td>Diskon</td>
<td>Jumlah<br>Terbayar</td> <td>Retur</td>
<td>Jumlah<br>Piutang</td> <td>Jatuh<br>Tempo</td> <td>Aksi</td>
</tr> <?php
if(isset($_POST['cari'])){ $nama=$_POST['nama'];
if($_POST['dasar']=='pelanggan'){
$query = mysql_query("SELECT t.tanggal, t.jatuhtempo, p.kodepelanggan, p.namapelanggan, t.nonota, m.namamarketing, (select sum(d.jumlah*d.harga) from detailtransaksi d where t.nonota=d.nonota) as sold,
(select sum(d.jumlah*d.diskon) from detailtransaksi d where t.nonota=d.nonota) as diskon,
SUM(if(b.nonota=t.nonota, b.jumlah,0)) as paid,
(select ifnull(sum(if(r.nonota=t.nonota, (d.harga*d.jumlah), 0)),0) as total_retur from detailretur d, retur r where d.noretur=r.noretur) as retur,
(select sum(d.jumlah*d.harga) from detailtransaksi d where t.nonota=d.nonota)-(select sum(d.jumlah*d.diskon) from detailtransaksi d where t.nonota=d.nonota)- (select ifnull(sum(if(r.nonota=t.nonota, (d.harga*d.jumlah), 0)),0) as total_retur from detailretur d, retur r where d.noretur=r.noretur)-
(SUM(if(b.nonota=t.nonota, b.jumlah,0))) as unpaid FROM pelanggan p, marketing m, transaksi t, pembayaran b
Where p.kodepelanggan = t.kodepelanggan and p.kodepelanggan = b.kodepelanggan and m.kodemarketing = p.kodemarketing
and p.namapelanggan='$nama' and t.nonota like 'INV%' GROUP BY t.nonota");
} else{
$query = mysql_query("SELECT t.tanggal, t.jatuhtempo, p.kodepelanggan, p.namapelanggan, t.nonota, m.namamarketing, (select sum(d.jumlah*d.harga) from detailtransaksi d where t.nonota=d.nonota) as sold,
(select sum(d.jumlah*d.diskon) from detailtransaksi d where t.nonota=d.nonota) as diskon,
SUM(if(b.nonota=t.nonota, b.jumlah,0)) as paid,
(select ifnull(sum(if(r.nonota=t.nonota, (d.harga*d.jumlah), 0)),0) as total_retur from detailretur d, retur r where d.noretur=r.noretur) as retur,
(select sum(d.jumlah*d.harga) from detailtransaksi d where t.nonota=d.nonota)-(select sum(d.jumlah*d.diskon) from detailtransaksi d where t.nonota=d.nonota)- (select ifnull(sum(if(r.nonota=t.nonota, (d.harga*d.jumlah), 0)),0) as total_retur from detailretur d, retur r where d.noretur=r.noretur)-
(SUM(if(b.nonota=t.nonota, b.jumlah,0))) as unpaid FROM pelanggan p, marketing m, transaksi t, pembayaran b
Where p.kodepelanggan = t.kodepelanggan and p.kodepelanggan = b.kodepelanggan and m.kodemarketing = p.kodemarketing
GROUP BY t.nonota"); }
}else{
$query = mysql_query("SELECT t.tanggal,t.jatuhtempo, p.kodepelanggan, p.namapelanggan, t.nonota, m.namamarketing, (select sum(d.jumlah*d.harga) from detailtransaksi d where t.nonota=d.nonota) as sold,
(select sum(d.jumlah*d.diskon) from detailtransaksi d where t.nonota=d.nonota) as diskon,
SUM(if(b.nonota=t.nonota, b.jumlah,0)) as paid,
(select ifnull(sum(if(r.nonota=t.nonota, (d.harga*d.jumlah), 0)),0) as total_retur from detailretur d, retur r where d.noretur=r.noretur) as retur,
(select sum(d.jumlah*d.harga) from detailtransaksi d where t.nonota=d.nonota)-(select sum(d.jumlah*d.diskon) from detailtransaksi d where t.nonota=d.nonota)- (select ifnull(sum(if(r.nonota=t.nonota, (d.harga*d.jumlah), 0)),0) as total_retur from detailretur d, retur r where d.noretur=r.noretur)-
(SUM(if(b.nonota=t.nonota, b.jumlah,0))) as unpaid FROM pelanggan p, marketing m, transaksi t, pembayaran b
Where p.kodepelanggan = t.kodepelanggan and p.kodepelanggan = b.kodepelanggan and m.kodemarketing = p.kodemarketing and t.nonota like 'INV%'
GROUP BY t.nonota"); unset($_POST['cari']); }
?> <?php $no = 1;
while ($data = mysql_fetch_array($query)) { ?>
<tr class="hurufx">
<td><?php echo $data['tanggal']; ?></td> <td><?php echo $data['nonota']; ?></td>
<td><?php echo $data['namapelanggan']; ?></td> <td><?php echo $data['namamarketing']; ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['sold'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['diskon'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['paid'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['retur'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($data['unpaid'],2,',','.'); ?></td>
<td><?php echo $data['jatuhtempo']; ?></td> <td>
<a href="detailpenjualan.php?nonota=<?php echo $data['nonota']; ?>">DETAIL PENJUALAN</a><br>
<a href="transaksiretur.php?nonota=<?php echo $data['nonota']; ?>">PROSES RETUR</a><br>
<a href="pembayaran.php?nonota=<?php echo $data['nonota']; ?>&kodepelanggan=<?php echo $data["kodepelanggan"]; ?>">PROSES BAYAR</a><br>
<a href="detailpembayaran.php?nonota=<?php echo $data['nonota']; ?>">DETAIL BAYAR</a><br>
<?php if($level=="manager" or $level=="admin"){
?><a href="deletepenjualan.php?nonota=<?php echo $data['nonota']; ?>">BATALKAN TRANSAKSI</a><br>
<a href="editpenjualan.php?nonota=<?php echo $data['nonota']; ?>">EDIT TRANSAKSI</a>
$querytotal = mysql_query("select sum(d.jumlah*d.harga) as total from detailtransaksi d, transaksi t, pelanggan p where d.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.namapelanggan='$nama' and t.nonota like 'INV%'");
$querypaid = mysql_query("select sum(b.jumlah) as paid from pembayaran b, transaksi t, pelanggan p where b.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.namapelanggan='$nama' and t.nonota like 'INV%'");
$queryretur = mysql_query("select sum(d.jumlah*d.harga) as retur from detailretur d, transaksi t, pelanggan p, retur r where d.noretur=r.noretur and r.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.namapelanggan='$nama' and t.nonota like 'INV%'");
} else{
$querytotal = mysql_query("select sum(d.jumlah*d.harga) as total from detailtransaksi d, transaksi t, marketing m, pelanggan p where d.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.kodemarketing=m.kodemarketing and m.namamarketing='$nama' and t.nonota like 'INV%'");
$querydiskon = mysql_query("select sum(d.jumlah*d.diskon) as diskon from detailtransaksi d, transaksi t, marketing m, pelanggan p where d.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.kodemarketing=m.kodemarketing and m.namamarketing='$nama' and t.nonota like 'INV%'");
$querypaid = mysql_query("select sum(b.jumlah) as paid from pembayaran b, transaksi t, marketing m, pelanggan p where b.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.kodemarketing=m.kodemarketing and m.namamarketing='$nama' and t.nonota like 'INV%'");
$queryretur = mysql_query("select sum(d.jumlah*d.harga) as retur from detailretur d, transaksi t, marketing m, retur r, pelanggan p where d.noretur=r.noretur and r.nonota=t.nonota and t.kodepelanggan=p.kodepelanggan and p.kodemarketing=m.kodemarketing and m.namamarketing='$nama' and t.nonota like 'INV%'");
} } else{
$querytotal = mysql_query("select sum(jumlah*harga) as total from detailtransaksi where nonota like 'INV%'");
$querydiskon = mysql_query("select sum(jumlah*diskon) as diskon from detailtransaksi where nonota like 'INV%'");
$querypaid = mysql_query("select sum(jumlah) as paid from pembayaran where nonota like 'INV%'");
$queryretur = mysql_query("select sum(d.jumlah*d.harga) as retur from detailretur d, retur r where d.noretur=r.noretur and r.nonota like 'INV%'");
unset($_POST['cari']); }
$datatotal = mysql_fetch_array($querytotal); $datadiskon= mysql_fetch_array($querydiskon); $datapaid = mysql_fetch_array($querypaid); $dataretur = mysql_fetch_array($queryretur);
$unpaid = $datatotal['total']-$datadiskon['diskon']-$datapaid['paid']-$dataretur['retur'];
?>
<tr class="hurufx">
<td colspan="3"> </td> <td>Total</td>
<td align="right"><?php echo "Rp. ".number_format($datatotal['total'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($datadiskon['diskon'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($datapaid['paid'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($dataretur['retur'],2,',','.'); ?></td>
<td align="right"><?php echo "Rp. ".number_format($unpaid,2,',','.'); ?></td> </tr>
</table><br><br> </div>
<?php } else
header("location: index.php"); ?>
23.laporanretur.php
<?php
session_start();