Lampiran 1: Source Code dalam setiap form
Kode Program 1
Kode program Koneksi
<?php
$host = "localhost"; $username = "root"; $password = "";
$databasename = "tagihan_ta";
$connection = mysql_connect($host, $username, $password) or die("Kesalahan Koneksi ... !!");
mysql_select_db($databasename, $connection) or die("Databasenya Error");
?>
Kode Program
2 Kode program halaman login
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title>HALAMAN LOGIN</title>
<table width="1000" border="1" height="100"> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC="IMG_20150608_151637.gif" WIDTH=500 HEIGHT=100>
</tr>
</table><Br /><Br />
<table align="center" width="200" align="center" border=0> <form action="proses.php" method="POST" >
<tr>
<td align="Center" bgcolor="#33CCFF">Sign In<br></td> </tr>
<tr>
<td align="left" bgcolor="#FFFFFF">Username<br>
<input type="text" name="username" id="username" size=40> </td></tr>
<tr>
<td align="left" bgcolor="#FFFFFF">Password<br>
<input type="password" name="password" id="password" size=40></td> </tr>
<tr>
<td bgcolor="#FFFFFF">
<center><input name="login" type="submit" value="LOGIN" width=40></center>
</td></tr> </form> </table>
Kode Program 3
Kode Program proses
<?php
include"koneksi.php"; session_start();
if(isset($_POST['login'])) { $username = $_POST['username']; $password = $_POST['password'];
$sql = mysql_query("SELECT * FROM t_pegawai WHERE nama_peg='$username' &&
password='$password'"); $num = mysql_num_rows($sql); if($num==1) {
$_SESSION['username'] = $username; $_SESSION['password'] = $password; ?>
<script language="JavaScript">
document.location='home.php'</script><?php } else {
?><script language="JavaScript">
document.location='index.php'</script><?php }
} ?>
Kode Program 3
Kode Program
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title>HOME</title>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100> </tr>
</table><Br>";
echo "<table Width='100%' border='0'> <tr>
<td width='25%'>"; session_start();
if (!isset($_SESSION['username']) or $_SESSION['password']=="") { header("location:index.php?");
exit; }else{
}
echo"<li><a href='home.php'>HOME</a></li> <li><a href='master.php'>MASTER</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='75%' align='left' valign='top'> </td>
</tr>
</table> "; ?>
Kode Program 4
Desain Customer
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title> DATA CUSTOMER</title>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='0'> <tr>
<td width='25%' valign='top'>"; session_start();
include "koneksi.php";
$query=mysql_query ("SELECT * FROM t_customer ")or die (mysql_error());
$jumlah = mysql_num_rows($query);
if (!isset($_SESSION['username']) or $_SESSION['password']=="") { header("location:index.php?");
exit; }else{
echo "Selamat datang ".$_SESSION['username']; echo "<br>";
}
echo" <li><a href='home.php'>HOME</a></li>
<li><a href='tambah_customer.php'>ADD CUSTOMER</a></li> <li><a href='logout.php'>LOGOUT</a></li>
</td>
<td width='75%' align='left' valign='top'> <table border= '1'>
<tr>
DATA CUSTOMER
<td width=50 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>NO</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Customer Name</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>NPWP</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Address</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Action</font></td>
</tr>"; $j=0;
while ($row=mysql_fetch_array($query)) { echo "<tr><td align='center'>";
echo $j+1;
echo"</td><td align='center'>"; echo $row["customer_code"]; echo"</td><td align='center'>"; echo $row["customer_name"]; echo"</td><td align='center'>"; echo $row["npwp"];
echo"</td><td align='center'>"; echo $row["address"];
echo"</td><td align='center'>";
echo "<a href='hapuscustomer.php?id=".$row['no']."'> Hapus";
; $j++; }
echo "</table><br> </table>
</td> </tr> <tr> </tr> </table> "; ?>
Kode Program 5
Tambah Customer (desain)
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title> TAMBAH CUSTOMER</title>
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='1'> <tr>
<td width='25%' valign='top'>";
echo "<table Width='100%' border='1'> <tr>
<td width='25%' valign='top'>";
echo" <li><a href='home.php'>HOME</a></li> <li><a href='master.php'>MASTER</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='75%' align='left' valign='top'>
<form action='tambahcustomer.php' method='POST'>
No Code<br>
<input type='text' name='no' size=40><br> Customer Code<br>
<input type='text' name='code' size=40><br> Costumer Name<br>
<input type='text' name='name' size=40><br> Npwp<br>
<input type='text' name='npwp' size=40><br> Address<br>
<input type='text' name='address' size=40><br>
<input name='add' type='submit' value='Save' width=40> </form>
</td> </tr> <tr> </tr> </table> "; ?>
Kode Program 6
Proses Tambah Customer
<?php
$add = $_POST['address'];
$query=mysql_query ("INSERT INTO t_customer(no,customer_code, customer_name,npwp,address)
VALUES ('$no','$kode','$nama','$npwp','$add')",$connection)or die (mysql_error());
if($query) { ?>
<script language="JavaScript">
document.location='tambah_customer.php'</script> <?php
} ?>
Kode program 7
Hapus Customer
<?php
include "koneksi.php"; $id = $_GET['id'];
$query = "DELETE FROM t_customer WHERE no = $id"; mysql_query($query);
?>
<script language="JavaScript">
document.location='customer.php'</script> <?php
?>
Kode Program 8
Barang (desain)
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title> DATA BARANG</title>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='0'> <tr>
<td width='25%' valign='top'>"; session_start();
include "koneksi.php";
if (!isset($_SESSION['username']) or $_SESSION['password']=="") { header("location:index.php?");
exit;
}else{
echo "Selamat datang ".$_SESSION['username']; echo "<br>";
}
echo" <li><a href='home.php'>HOME</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='75%' align='left' valign='top'> <table border= '1'>
<form action = 'tambahbarang.php' method = 'POST'> <input type= 'text' name= 'no'
placeholder='No'>
<input type= 'text' name= 'k_barang' placeholder='Kode barang'>
<input type= 'text' name= 'n_barang' placeholder='Nama barang'>
<input type= 'text' name= 'price'
placeholder='Price'> <br>
<br>
<input type='submit' value='Tambah Barang'> </form>
<br> <br> <tr>
<td width=120 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>No</font></td>
<td width=120 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Kode Barang</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Nama Barang</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Harga</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Action</font></td>
</tr>"; $j=0;
while ($row=mysql_fetch_array($query)) { echo "<tr><td align='center'>";
echo $j+1;
echo"</td><td align='center'>"; echo $row["kode_brg"];
echo"</td><td align='center'>"; echo $row["harga"];
echo"</td><td align='center'>";
echo "<a href='hapusbarang.php?id=".$row['no']."'> Hapus"; ;
$j++; }
echo "</table><br> </table>
</td> </tr> <tr> </tr> </table> "; ?>
Kode Program 9
Proses Tambah Barang
<?php
include "koneksi.php"; $no = $_POST['no'];
$kode = $_POST['k_barang']; $nama = $_POST['n_barang']; $price = $_POST['price'];
$query=mysql_query ("INSERT INTO t_barang(no,kode_brg, nama_brg,harga)
VALUES ('$no','$kode','$nama','$price')",$connection)or die (mysql_error());
if($query) { ?>
<script language="JavaScript">
document.location='barang.php'</script> <?php
} ?>
Kode Program 10
Proses Hapus barang
<?php
include "koneksi.php"; $id = $_GET['id'];
mysql_query($query); ?>
<script language="JavaScript">
document.location='barang.php'</script> <?php
?>
Kode Program 11
Desain Tambah PO
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title> TAMBAH PO</title>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='1'> <tr>
<td width='25%' valign='top'>";
echo "<table Width='100%' border='1'> <tr>
<td width='25%' valign='top'>";
echo" <li><a href='home.php'>HOME</a></li> <li><a href='master.php'>MASTER</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='75%' align='left' valign='top'>";
echo "<form action='tambahpo.php' method='POST'>
Tanggal<br><input type='text' name='tanggal' size=40><br> No Invoice<br><input type='text' name='invoice' size=40><br>"; echo "Kode Customer<br>";?>
<?php
include 'koneksi.php';
echo "<select name='customer' id='nim' onchange='changeValue(this.value)' >";
echo "<option value=0 selected>- Code Customer -</option> "; $resul = mysql_query("select * from t_customer");
echo '<option value="' . $row['customer_code'] . '">' . $row['customer_code'] . '</option>';
$jsArray .= "customer['" . $row['customer_code'] . "'] = {nama:'" . addslashes($row['customer_name']) ."'};\n";
}
echo "</select> ";?>
<script type="text/javascript"> <?php echo $jsArray; ?>
function changeValue(nim){
document.getElementById('nm').value = customer[nim].nama; };
</script> <?php echo "
<input name='add' type='submit' value='Save' width=40> </form>";
echo"</td> </tr> <tr> </tr> </table> "; ?>
Kode Program 12
Tambah PO
<?php
include "koneksi.php"; session_start();
// menyimpan informasi pada session $_SESSION["nota"] = $_POST['invoice']; $tanggal = $_POST['tanggal'];
$no = $_POST['invoice'];
$kodecus = $_POST['customer'];
$query=mysql_query ("INSERT INTO t_po (no, tgl, kode_Customer) VALUES ('$no','$tanggal','$kodecus')",$connection)or die
(mysql_error()); if($query) { ?>
<script language="JavaScript">
document.location='input_detail.php'</script> <?php
} ?>
Kode Program 13
Desain Tambah Detail PO
<title> DETAIL PO</title> <?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='0'> <tr>
<td width='25%' valign='top'>"; session_start();
include "koneksi.php";
$query=mysql_query ("SELECT * FROM detail_po")or die (mysql_error());
$jumlah = mysql_num_rows($query);
if (!isset($_SESSION['username']) or $_SESSION['password']=="") { header("location:index.php?");
exit;
}else{
echo "Selamat datang ".$_SESSION['username']; echo "<br>";
}
echo" <li><a href='home.php'>HOME</a></li> <li><a href='input_po.php'>INPUT PO</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='90%' align='left' valign='top'> <table border= '1'>
<tr>
<td width=120 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>No</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>invoice</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Customer code</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Status</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Mat code & Desc Mat</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Jumlah</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Price</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Sub Total</font></td>
$j=0;
while ($row=mysql_fetch_array($query)) { echo "<tr><td align='center'>";
echo $j+1;
echo"</td><td align='center'>"; echo $row["invoice"];
echo"</td><td align='center'>"; echo $row["customer_code"]; echo"</td><td align='center'>"; echo $row["Status"];
echo"</td><td align='center'>"; echo $row["mat"];
echo"</td><td align='center'>"; echo $row["jumlah"];
echo"</td><td align='center'>"; echo $row["price"];
echo"</td><td align='center'>"; echo $row["sub_total"];
; $j++; }
echo "</table><br> </table>
</td> </tr> <tr> </tr> </table> "; ?>
Kode program 14
Tambah Detail PO
<?php
include "koneksi.php"; $no = $_POST['invoice']; $barang = $_POST['custom']; $jum = $_POST['jumlah']; $price = $_POST['price']; $sub = $_POST['subtotal'];
$query=mysql_query ("INSERT INTO detail_po (no,kode_barang, jumlah,price, sub_total)
if($query) { ?>
<script language="JavaScript">
document.location='input_detail.php'</script> <?php
} ?>
Kode Program 15 Search Invoice
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title>MASTER</title>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG
SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100> </tr>
</table><Br>";
echo "<table Width='100%' border='1'> <tr>
<td width='25%'>"; session_start();
if (!isset($_SESSION['username']) or $_SESSION['password']=="") { header("location:index.php?");
exit;
}else{
echo "Selamat Datang : ".$_SESSION['username']; echo "<br>";
}
echo"<li><a href='home.php'>HOME</a></li> <li><a href='customer.php'>CUSTOMER</a></li> <li><a href='barang.php'>BARANG</a></li> <li><a href='input_po.php'>INPUT PO</a></li> <li><a href='search.php'>DETAIL PO</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='75%' align='left' valign='top'><br> <form action='hasil.php' method='POST'>
Masukan No Invoice :<br><input type= 'text' name= 'invoice' > <input name='add' type='submit' value='Cari' width=40>
</table> "; ?>
Kode Program 16
Detail Invoice
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title> DETAIL INVOICE</title>
<script type="text/javascript"> </script>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='0'> <tr>
<td width='25%' valign='top'>"; session_start();
include "koneksi.php";
$query=mysql_query ("SELECT * FROM detail_po")or die (mysql_error());
$jumlah = mysql_num_rows($query);
if (!isset($_SESSION['username']) or $_SESSION['password']=="") { header("location:index.php?");
exit;
}else{
echo "Selamat datang ".$_SESSION['username']; echo "<br>";
}
echo" <li><a href='home.php'>HOME</a></li> <li><a href='logout.php'>LOGOUT</a></li> </td>
<td width='75%' align='left' valign='top'> <table border= '1'>
<form action = 'tambahpo.php' method = 'POST'> <input type= 'text' name= 'invoice'
placeholder='Invoice'>
<input type= 'text' name= 'c_code' placeholder='Customer code'>
<input type= 'text' name= 'status'
<input type= 'text' name= 'mat' placeholder='Mat code & Mat desc'>
<input type= 'text' name= 'jumlah'
placeholder='Jumlah'> <input type= 'text' name= 'price'
placeholder='Price'> <input type= 'text' name= 'total'
placeholder='Total'>
<br>
<input type='submit' value='Save'>
</form>
<form action = 'hasil.php' method = 'POST'> <input type='submit' value='Cetak'>
</form>
<br> <tr>
<td width=120 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>No</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>invoice</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Customer code</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Status</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Mat code & Desc Mat</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Jumlah</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Price</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Sub Total</font></td>
</tr>"; $j=0;
while ($row=mysql_fetch_array($query)) { echo "<tr><td align='center'>";
echo $j+1;
echo"</td><td align='center'>"; echo $row["invoice"];
echo $row["Status"];
echo"</td><td align='center'>"; echo $row["mat"];
echo"</td><td align='center'>"; echo $row["jumlah"];
echo"</td><td align='center'>"; echo $row["price"];
echo"</td><td align='center'>"; echo $row["sub_total"];
; $j++; }
echo "</table><br> </table>
</td> </tr> <tr> </tr> </table> "; ?>
Kode Program 17
Hasil
<link type="text/css" href="tampilan.css" rel="stylesheet" /> <title> HASIL</title>
<?php
echo "<table width='1000' border='0' height='100'> <tr>
<td ALIGN=LEFT VALIGN=MIDDLE><IMG SRC='IMG_20150608_151637.gif' WIDTH=500 HEIGHT=100>
</tr>
</table><Br>";
echo "<table Width='100%' border='0'> <tr>
<td width='25%' valign='top'>"; echo"<a href='master.php'>BACK</a>"; session_start();
include "koneksi.php"; $code = $_POST['invoice']; $query=mysql_query ("select
t_po.no,tgl,kode_customer,customer_name,kode_barang,nama_brg,jumlah, price,sub_total
from t_po
inner join detail_po on t_po.no=detail_po.no
WHERE t_po.no='$code';") or die (mysql_error());
$jumlah = mysql_num_rows($query);
echo " <td width='75%' align='left' valign='top'> <table border= '1'>
<tr>
<font size = 5> LAPORAN HASIL TAGIHAN </font><br>
<td width=50 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>NO</font></td>
<td width=120 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Tanggal</font></td>
<td width=120 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Kode Pelanggan</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>namaPelanggan</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Kode Barang</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Nama Barang</font></td>
<td width=100 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Jumlah</font></td>
<td width=130 bgcolor='#33CCFF' align='center'><font color='white' face='Tahoma' size=2>Harga</font></td>
</tr>"; $j=0;
while ($row=mysql_fetch_array($query)) { echo "<tr><td align='center'>";
echo $j+1;
echo"</td><td align='center'>"; echo $row["tgl"];
echo"</td><td align='center'>"; echo $row["kode_customer"]; echo"</td><td align='center'>"; echo $row["customer_name"]; echo"</td><td align='center'>"; echo $row["kode_barang"];
echo"</td><td align='center'>"; echo $row["nama_brg"];
echo"</td><td align='center'>"; echo $row["jumlah"];
; $j++; }
echo "</table><br> </table>
</td> </tr> <tr> </tr> </table> "; ?>
Kode Program 18
Logout
<?php
session_start(); session_destroy();