Professional Documents
Culture Documents
Rushpasya - Final
Rushpasya - Final
Nama:
STB
151181
KELAS
Jurusan
Sistem Informasi
SOURCE CODE SISTEM MANAJEMEN LAPORAN TRANSAKSI PENJUALAN KELAPA SAWIT
Index.php
<?php
include("config.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Beranda</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<div class="jumbotron">
<center>
<h1>Aplikasi Penjualan Sawit</h1>
<p>Aplikasi Pengelolaan Laporan Penjualan Sawit</p>
<p>
<a class='btn btn-primary' href='petani.php'>Data Petani</a>
<a class='btn btn-info' href='sawit.php'>Data Sawit</a>
<a class='btn btn-danger' href='transaksi.php'>Tambah Data Transak
si</a>
<a class='btn btn-success' href='laporan.php'>Laporan</a>
</center>
</div>
</div>
</div>
</div>
<?php include("/include/footer.php"); ?>
</body>
<?php include("/include/js.php"); ?>
</html>
Petani php
<?php
include("config.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Data Petani</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<div class='panel panel-primary'>
<div class='panel-heading'>Semua Data Petani</div>
<div class='panel-body'>
<a class='btn btn-primary' href='add_petani.php'><i
class='fa fa-plus'></i> Tambah Data Petani</a>
<p>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>ID Petani</th>
<th>Nama Petani</th>
<th>Alamat Petani</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$sqlquery = "SELECT * FROM petani";
if ($result = mysqli_query($koneksi, $sqlque
ry)) {
while ($row = mysqli_fetch_assoc($result
)) {
?>
<tr>
<td><?php echo $row["id_petani"];?></td>
<td><?php echo $row["nama_petani"];?></td>
<td><?php echo $row["alamat_petani"];?></td>
<td>
<div class="btn-group">
<a href="edit_petani.php?id_petani=<?php echo
$row["id_petani"];?>" class="btn btn-xs btn-success" title='Edit'> <i class="fa
fa-edit"></i> </a>
<a onclick="return confirm('Anda yakin ingin m
enghapus data tersebut?');" href="aksi_petani.php?act=delete&id_petani=<?php echo
$row["id_petani"];?>" class="btn btn-xs btn-danger"> <i class="fa fa-remove" tit
le='Hapus'></i> </a>
</div>
</td>
</tr>
<?php
}
mysqli_free_result($result);
}
mysqli_close($koneksi);
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Sawit.php
<?php
include("config.php");
include("fungsi/fungsi_rupiah.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Data Sawit</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<div class='panel panel-info'>
<div class='panel-heading'>Semua Data Sawit</div>
<div class='panel-body'>
<a class='btn btn-info' href='add_sawit.php'><i clas
s='fa fa-plus'></i> Tambah Data Sawit</a>
<p>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>Kode Sawit</th>
<th>Jenis Buah</th>
<th>Harga Jual</th>
<th>Potongan</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$sqlquery = "SELECT * FROM sawit";
if ($result = mysqli_query($koneksi, $sqlque
ry)) {
while ($row = mysqli_fetch_assoc($result
)) {
?>
<tr>
<td><?php echo $row["kode_sawit"];?></td>
<td><?php echo $row["jenis_sawit"];?></td>
<td><?php echo rupiah($row["harga_jual"]);?
></td>
<td><?php echo $row["potongan"];?> %</td>
<td>
<div class="btn-group">
<a href="edit_sawit.php?kode_sawit=<?php echo $
row["kode_sawit"];?>" class="btn btn-xs btn-success" title='Edit'> <i class="fa
fa-edit"></i> </a>
<a onclick="return confirm('Anda yakin ingin m
enghapus data tersebut?');" href="aksi_sawit.php?act=delete&kode_sawit=<?php echo
$row["kode_sawit"];?>" class="btn btn-xs btn-danger"> <i class="fa fa-remove" ti
tle='Hapus'></i> </a>
</div>
</td>
</tr>
<?php
}
mysqli_free_result($result);
}
mysqli_close($koneksi);
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Add_sawit.php
<?php
include("config.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Tambah Data Buah</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<div class='panel panel-success'>
<div class='panel-heading'>Tambah Data Sawit</div>
<div class='panel-body'>
<form method='post' action='aksi_sawit.php?
act=input'>
<div class='form-group'>
<label>Jenis Sawit</label>
<input type='text' class='form-control' nam
e='jenis_sawit' required/>
</div>
<div class='form-group'>
<label>Harga Jual</label>
<input type='text' class='form-control' nam
e='harga_jual' required/>
</div>
<div class='form-group'>
<label>Potongan</label>
<input type='text' class='form-control' nam
e='potongan' required/>
</div>
<button type='input' name='input' class='btn btn
-success'>Simpan</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Edit petani.php
<?php
include("config.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Edit Data Petani</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<?php
$id_petani = $_GET['id_petani'];
$sqlquery = "SELECT * FROM petani WHERE id_petani='$id_p
etani'";
$result = mysqli_query($koneksi, $sqlquery) or die (mysq
li_connect_error());
$row = mysqli_fetch_assoc($result);
?>
<div class='panel panel-success'>
<div class='panel-heading'>Edit Data Petani</div>
<div class='panel-body'>
<form method='post' action='aksi_petani.php?
act=update'>
<div class='form-group'>
<input type="hidden" name="id_petani" id="id
_petani" value="<?php echo $row["id_petani"]; ?>">
<label>Nama Petani</label>
<input type='text' class='form-control' nam
e='nama_petani' value="<?php echo $row["nama_petani"]; ?>" required/>
</div>
<div class='form-group'>
<label>Alamat Petani</label>
<input type='text' class='form-control' nam
e='alamat_petani' value="<?php echo $row["alamat_petani"]; ?>" required/>
</div>
<button type='input' name='update' class='btn bt
n-success'>Edit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Edit_sawit_php
<?php
include("config.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Edit Data Sawit</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<?php
$kode_sawit = $_GET['kode_sawit'];
$sqlquery = "SELECT * FROM sawit WHERE kode_sawit='$kode
_sawit'";
$result = mysqli_query($koneksi, $sqlquery) or die (mysq
li_connect_error());
$row = mysqli_fetch_assoc($result);
?>
<div class='panel panel-success'>
<div class='panel-heading'>Edit Data Sawit</div>
<div class='panel-body'>
<form method='post' action='aksi_sawit.php?
act=update'>
<div class='form-group'>
<input type="hidden" name="kode_sawit" id="kode_
sawit" value="<?php echo $row["kode_sawit"]; ?>">
<label>Jenis Sawit</label>
<input type='text' class='form-control' nam
e='jenis_sawit' value="<?php echo $row["jenis_sawit"]; ?>" required/>
</div>
<div class='form-group'>
<label>Harga Jual</label>
<input type='text' class='form-control' nam
e='harga_jual' value="<?php echo $row["harga_jual"]; ?>" required/>
</div>
<div class='form-group'>
<label>Potongan</label>
<input type='text' class='form-control' nam
e='potongan' value="<?php echo $row["potongan"]; ?>" required/>
</div>
<button type='input' name='input' class='btn btn
-success'>Edit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Transaksi.php
<?php
include("config.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Tambah Data Transaksi</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<div class='panel panel-danger' id='tambah'>
<div class='panel-heading'>Tambah Data Transaksi</div>
<div class='panel-body'>
<form method='post' action='aksi_transaksi.php?
act=input'>
<div class='form-group'>
<label>Pilih Petani</label>
<select name='id_petani' class='form-
control'>
<?php
$sqlquery = "SELECT * FROM petani";
if ($result = mysqli_query($koneksi, $sqlque
ry)) {
while ($row = mysqli_fetch_assoc($result
)) {
$id_petani = $row["id_petani"];
$petani = $row["nama_petani"];
echo "<option value='$id_petani'>$pe
tani</option>";
}
mysqli_free_result($result);
}
?>
</select>
</div>
<div class='form-group'>
<label>Pilih Jenis Sawit</label>
<select name='kode_sawit' class='form-
control'>
<?php
$sqlquery = "SELECT * FROM sawit";
if ($result = mysqli_query($koneksi, $sqlque
ry)) {
while ($row = mysqli_fetch_assoc($result
)) {
$kode_sawit = $row["kode_sawit"];
$sawit = $row["jenis_sawit"];
echo "<option value='$kode_sawit'>$s
awit</option>";
}
mysqli_free_result($result);
}
?>
</select>
</select>
</div>
<div class='form-group'>
<label>Berat Buah (Kg)</label>
<input type='number' name='berat' class='for
m-control' required/>
</div>
<button type='input' name='input' class='btn btn
-danger'>Simpan</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Laporan.php
<?php
include("config.php");
include("fungsi/fungsi_indotgl.php");
include("fungsi/fungsi_rupiah.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Laporan</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include("include/css.php"); ?>
</head>
<body>
<header>
<?php include("include/header.php"); ?>
</header>
<div class='container' style='margin-top:70px'>
<div class='row' style='min-height:520px'>
<div class='col-md-12'>
<div class='panel panel-success'>
<div class='panel-heading'>Laporan</div>
<div class='panel-body'>
<center>
<h3></h3>
<h3>Laporan Penjualan Kelapa Sawit</h3>
<p> </p>
</center>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>No</th>
<th>Tanggal Transaksi</th>
<th>Nama Petani</th>
<th>Alamat</th>
<th>Jenis Buah </th>
<th>Harga Jual</th>
<th>Berat (Kg)</th>
<th>Potongan</th>
<th>Total</th>
<th>Bonus</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$total_semua = 0;
$sqlquery = "SELECT petani.*, sawit.*, trans
aksi.* FROM transaksi transaksi INNER JOIN petani petani ON transaksi.id_petani
= petani.id_petani INNER JOIN sawit sawit ON transaksi.kode_sawit = sawit.kode_s
awit ORDER BY transaksi.id_petani ASC";
if ($result = mysqli_query($koneksi, $sqlque
ry)) {
while ($row = mysqli_fetch_assoc($result
)) {
$potongan = ($row["harga_jual"] * $row["
berat"]) * ($row["potongan"] / 100);
$total = ($row["harga_jual"] * $row["ber
at"]) - $potongan;
$total_semua += $total;
if ($total >= 100000){
$bonus = "Topi";
} else {
$bonus = "Sepatu";
}
?>
<tr>
<td><?php echo $no ?></td>
<td><?php echo tgl_ind
o($row["tanggal_transaksi"]);?></td>
<td><?php echo $row["nama_petani"];?></td>
<td><?php echo $row["alamat_petani"];?></td>
<td><?php echo $row["jenis_sawit"];?></td>
<td><?php echo rupiah($row["harga_jual"]);?
></td>
<td><?php echo $row["berat"];?></td>
<td><?php echo rupiah($potongan);?></td>
<td><?php echo rupiah($total);?></td>
<td><?php echo $bonus;?></td>
</tr>
<?php
$no++;}
?>
<tr>
<td colspan='8'>Grand Total</td>
<td colspan='2'><?php echo rupiah($total_semua);
?></td>
</tr>
<?php
mysqli_free_result($result);
}
mysqli_close($koneksi);
?>
</tbody>
</table>
<p>
<div class='pull-right'>
Pekanbaru, <?php echo tgl_indo($hari_ini); ?><br>
<b><center>Manager Perusahaan</center></b>
<p> </p>
<p> </p>
<b><center>Rushpasya</center></b>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</body>
<?php include("include/js.php"); ?>
</html>
Aksi_petani.php
<?php
include("config.php");
$act=$_GET['act'];
if ($act=='delete'){
$id_petani=$_GET['id_petani'];
$row = mysqli_query($koneksi, "DELETE FROM petani WHERE id_petani = '$id_pet
ani'");
header('location:petani.php');
}
elseif ($act=='input'){
$nama_petani = $_POST["nama_petani"];
$alamat_petani = $_POST["alamat_petani"];
$sql = "INSERT INTO petani VALUES ('','$nama_petani','$alamat_petani')";
$aksi =mysqli_query($koneksi, $sql);
if($aksi)
{
header('location:petani.php');
}
else {echo "gagal";}
elseif ($act=='update'){
$id_petani = $_POST["id_petani"];
$nama_petani = $_POST["nama_petani"];
$alamat_petani = $_POST["alamat_petani"];
$sql = "UPDATE petani SET nama_petani='$nama_petani', alamat_petani='$alamat
_petani' WHERE id_petani='$id_petani'";
if(mysqli_query($koneksi, $sql)){
mysqli_close($koneksi);
header('location:petani.php');
}
else {
echo '<script type="text/javascript">';
echo 'alert("gagal");';
echo '</script>';
}
}
?>
Aksi_sawit.php
<?php
include("config.php");
$act=$_GET['act'];
if ($act=='delete'){
$kode_sawit=$_GET['kode_sawit'];
$row = mysqli_query($koneksi, "DELETE FROM sawit WHERE kode_sawit = '$kode_s
awit'");
header('location:sawit.php');
}
elseif ($act=='input'){
$jenis_sawit = $_POST["jenis_sawit"];
$harga_jual = $_POST["harga_jual"];
$potongan = $_POST["potongan"];
$sql = "INSERT INTO sawit VALUES ('','$jenis_sawit','$harga_jual', '$potonga
n')";
$aksi =mysqli_query($koneksi, $sql);
if($aksi)
{
header('location:sawit.php');
}
else {echo "gagal";}
elseif ($act=='update'){
$jenis_sawit = $_POST["jenis_sawit"];
$kode_sawit = $_POST["kode_sawit"];
$harga_jual = $_POST["harga_jual"];
$potongan = $_POST["potongan"];
$sql = "UPDATE sawit SET jenis_sawit='$jenis_sawit', harga_jual='$harga_jual
', potongan='$potongan' WHERE kode_sawit='$kode_sawit'";
if(mysqli_query($koneksi, $sql)){
mysqli_close($koneksi);
header('location:sawit.php');
}
else {
echo '<script type="text/javascript">';
echo 'alert("gagal");';
echo '</script>';
}
}
?>
Aksi.transaksi.php
<?php
include("config.php");
$act=$_GET['act'];
if ($act=='input'){
$id_petani = $_POST['id_petani'];
$kode_sawit = $_POST['kode_sawit'];
$berat = $_POST['berat'];
$sql = "INSERT INTO transaksi VALUES ('','$id_petani','$kode_sawit', '$berat
', '$hari_ini')";
$aksi =mysqli_query($koneksi, $sql);
if($aksi)
{
header('location:laporan.php');
}
else {echo "gagal";}
?>
Config.php
<?php
$host = "localhost";
$user = "root";
$password = "";
$database = "sawit";
$hari_ini = date("Y-m-d");
$koneksi = mysqli_connect($host, $user, $password, $database);
if (mysqli_connect_errno($koneksi)) {
//this for show failed
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
Fungsi_indotgl.php
<?php
function tgl_indo($tgl){
$tanggal = substr($tgl,8,2);
$bulan = getBulan(substr($tgl,5,2));
$tahun = substr($tgl,0,4);
return $tanggal.' '.$bulan.' '.$tahun;
}
function getBulan($bln){
switch ($bln){
case 1:
return "Januari";
break;
case 2:
return "Februari";
break;
case 3:
return "Maret";
break;
case 4:
return "April";
break;
case 5:
return "Mei";
break;
case 6:
return "Juni";
break;
case 7:
return "Juli";
break;
case 8:
return "Agustus";
break;
case 9:
return "September";
break;
case 10:
return "Oktober";
break;
case 11:
return "November";
break;
case 12:
return "Desember";
break;
}
}
?>
Fungsi_waktu.php
<?php
date_default_timezone_set('Asia/Jakarta'); // PHP 6 mengharuskan penyebutan time
zone.
$seminggu = array("Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu");
$hari = date("w");
$hari_ini = $seminggu[$hari];
$tgl_sekarang = date("Ymd");
$tgl_skrg = date("d");
$bln_sekarang = date("m");
$thn_sekarang = date("Y");
$jam_sekarang = date("H:i:s");
$nama_bln=array(1=> "Januari", "Februari", "Maret", "April", "Mei",
"Juni", "Juli", "Agustus", "September",
"Oktober", "November", "Desember");
?>
Fungsi_rupiah.php
<?php
function rupiah($angka,$pre=0){
$jadi="Rp.".number_format($angka,$pre,',','.').",-";
return $jadi;
}
?>
Css.php
<link href="css/tema1.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
Js.php
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
Footer.php
<footer style='margin-top:0px;'>
<div id="bottom-footer" style='background:#28292b'>
<div class='container'>
<div class='row'>
<span id="copy-text" class="pull-left no-float-xs block-xs a
lign-center-xs">© <?php echo date("Y"); ?> All Rights Reserved - Made With
Love Code by <a href='#'>Didik Sazali</span>
<ul id="footer-links" class="pull-right no-float-xs block-xs
align-center-xs hidden-xs">
</ul>
</div>
</div>
</div>
</footer>
Header.php
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a href="index.php" class="navbar-brand">Aplikasi Penjualan Sawit</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" dat
a-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li><a href="index.php"><i class='fa fa-home'></i> Beranda</a></li>
<li><a href="petani.php"><i class='fa fa-users'></i> Data Petan
i</a></li>
<li><a href="sawit.php"><i class='fa fa-file'></i> Data Sawi
t</a></li>
<li><a href="transaksi.php"><i class='fa fa-plus'></i> Tambah Data T
ransaksi</a></li>
<li><a href="laporan.php"><i class='fa fa-file'></i> Lapora
n</a></li>
</ul>
</div>
</div>
</div>
Tampilan