laporan tugas besar pbw

77
Mudafiq Riyan Pratama, S.Kom Tugas Akhir Pemrograman Berbasis Web 1 Laporan Tugas Besar Pemrograman Berbasis Web “Aplikasi Pembelian dan Pembayaran Kredit Sepeda Motor” Disusun Oleh Fahmi luthfillah 1110651161 Nita Ayu Hidayati 1110652027 Yuldania 1110651134 Abdul Basith Kurniawan 1110651181 Program Studi Teknik Informatika Fakultas Teknik

Upload: tuan-muda-fillah

Post on 27-Nov-2014

533 views

Category:

Education


7 download

DESCRIPTION

Aplikasi sederhana Pembelian dan Pembayaran Kredit Sepeda Motor

TRANSCRIPT

Page 1: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

1

Laporan Tugas Besar

Pemrograman Berbasis Web

“Aplikasi Pembelian dan Pembayaran Kredit Sepeda Motor”

Disusun Oleh

Fahmi luthfillah 1110651161

Nita Ayu Hidayati 1110652027

Yuldania 1110651134

Abdul Basith Kurniawan 1110651181

Program Studi Teknik Informatika

Fakultas Teknik

Universitas Muhammadiyah Jember

Page 2: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

2

I. Tujuan Laporan ini membahas web “Aplikasi Penjualan Sepeda Motor” Melengkapi tugas akhir Pemrograman Berbasis Web

II. Dasar teoriWeb adalah salah satu alat komunikasi online yang menggunakan media internet dalam pendistribusiannya. Apapun bahasanya, yang pasti kita semua setuju bahwa website merupakan kumpulan halaman yang menampilkan informasi data teks, data gambar diam atau gerak, data animasi, suara, video dan atau gabungan dari semuanya, baik yang bersifat statis maupun dinamis yang membentuk satu rangkaian bangunan yang saling terkait dimana masing-masing dihubungkan dengan jaringan-jaringan halaman (hyperlink).

Sebuah Web page adalah dokumen yang ditulis dalam format HTML (Hyper Text Markup Language), yang hampir selalu bisa diakses melalui HTTP, yaitu protokol yang menyampaikan informasi dari server website untuk ditampilkan kepada para pemakai melalui web browser. Semua publikasi dari website-website tersebut dapat membentuk sebuah jaringan informasi yang sangat besar. Web page layaknya sebuah buku yang dapat menampung berbagai informasi tentang banyak hal baik bersifat komersil maupun non komersil. Melalui media web inilah seseorang dapat memberikan informasi tertentu kepada orang lain yang berada di seluruh dunia.

Html 5

HTML5 adalah bahasa markup untuk penataan dan penyajian konten untuk World Wide Web, dan merupakan teknologi inti dari Internet awalnya diusulkan oleh Opera Software. Ini adalah revisi kelima dari HTML standar (dibuat pada 1990 dan distandarisasi sebagai HTML4 pada 1997) dan, pada Mei 2012, masih dalam pengembangan.

Tujuan utamanya telah meningkatkan bahasa dengan dukungan untuk multimedia terkini dengan tetap mudah dibaca oleh manusia dan secara konsisten dimengerti oleh komputer dan perangkat (web browser, parser, dll). HTML5 dimaksudkan untuk menggolongkan tidak hanya HTML 4, tapi XHTML 1 dan DOM Level 2 HTML juga. (/wikipedia)

PHP

PHP adalah sebuah bahasa pemograman yang berjalan dalam sebuah web-server (server side). Script PHP adalah bahasa program yang berjalan pada sebuah webserver, atau sering disebut server-side. Oleh karena itu,PHP dapat melakukan apa saja yang bisa dilakukan program CGI lain, yaitu mengolah data dengan tipe apapun, menciptakan halaman web yang dinamis, serta menerima dan menciptakan cookies, dan bahkan PHP bisa melakukan lebih dari itu. Sesuai perkembangannya, php mengalami beberapa fase, mulai dari PHP/FI, PHP2.0, PHP3.0, PHP4.0 dan PHP5.0.

Page 3: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

3

Javascript

JavaScript adalah bahasa pemrograman yang khusus untuk halaman web agar halaman web menjadi lebih hidup. Kalau dilihat dari suku katanya terdiri dari dua suku kata, yaitu Java dan Script. Java adalah Bahasa pemrograman berorientasi objek, sedangkan Script adalah serangkaian instruksi program.

Jquery

jQuery adalah sebuah library Javascript yang sangat ringkas dan sederhana untuk memanipulasi komponen di dokumen HTML, menangani event, animasi, efek dan memproses interaksi ajax. jQuery dirancang sedemikian rupa supaya membuat program menggunakan Javascript menjadi relatif sangat mudah. Sesuai slogan nya, write less, do more. Menulis kode lebih sedikit, tetapi melakukan pekerjaan lebih banyak.

Anime fx

Anim Fx adalah program pembuat animasi teks bergerak yang sangat praktis dan mudah digunakan, Anda tidak akan direpotkan dengan membuat layer layer seperti di Flash MX. Pada program ini tinggal mengisikan teks yang ingin di buat animasi. Steleah itu tinggal mengklik efek yang ingin ditampilkan. Ada banyak efek yang telah disediakan, antara lain matrix, fence, flare, dll.Program ini sangat berguna bagi yang sering membuat halaman web. bisa menampilkan hasil yang anda buat di halaman WEB.

Bootstrap

Twitter Bootstrap adalah sebuah alat bantu untuk membuat sebuah tampilan halaman website yang dapat mempercepat pekerjaan seorang pengembang website ataupun pendesain halaman website. Sesuai namanya, website yang dibuat dengan alat bantu ini memiliki tampilan halaman yang sama / mirip dengan tampilan halaman Twitter atau desainer juga dapat mengubah tampilan halaman website sesuai dengan kebutuhan.

Twitter Bootstrap dibangun dengan teknologi HTML dan CSS yang dapat membuat layout halaman website, tabel, tombol, form, navigasi, dan komponen lainnya dalam sebuah website hanya dengan memanggil fungsi CSS (class) dalam berkas HTML yang telah didefinisikan. Selain itu juga terdapat komponen-komponen lainnya yang dibangun menggunakan JavaScript.

III. Pembahasan

Penjualan secara umum definisi penjualan dapat diartikan sebagai sebuah usaha atau langkah konkrit yang dilakukan untuk memindahkan suatu produk, baik itu berupa barang ataupun jasa, dari produsen kepada konsumen sebagai sasarannya. Tujuan utama penjualan yaitu mendatangkan keuntungan atau laba dari produk ataupun barang yang dihasilkan produsennya dengan pengelolaan yang baik. Dalam pelaksanaannya, penjualan sendiri tak akan dapat dilakukan tanpa adanya pelaku yng bekerja didalamnya seperti agen, pedagang dan tenaga pemasaran. 

Kredit adalah penjualan barang dengan pembayaran tidak secara tunai (pembayaran ditangguhkan atau diangsur).

Page 4: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

4

Program ini dibuat untuk membantu kegiatan usaha kredit motor dengan batasan sebagai berikut:

1. Kegiatan yang diangkat kedalam program hanya kegiatan transaksi saja.2. Analisa dan pelaporan keuangan ( accounting ) tidak diikut sertakan dalam program.3. Analisa dan pelaporan persediaan barang yang dijual ( stock ) tidak diikut sertakan dalam program.4. Keluaran program (output) berupa laporan data konsumen, data transaksi, data pembayaran cicilan, data motor yang di kreditkan.5. Harga jual motor bisa berubah sewaktu waktu sesuai kebijakan perusahaan.

Dari pembatasan masalah diatas kita bisa menganalisa lebih jauh data apa yang diolah pada program aplikasi dan data pendukung apa yang dibutuhkan. Kegiatan usaha berupa kredit motor, mungkin hasil analisanya seperti berikut :

pada kegiatan tersebut terjadi transaksi penjualan motor dengan sistem pembayaran kredit yang akan dicicil sesuai kesepakatan konsumen, atau mungkin dibayar secara tunai. Untuk itu program yang akan kita buat harus bisa memenuhi kebutuhan pencatatan data baik data jual tunai (cash) atau pencatatan data jual dengan sistem pembayaran cicilan (kredit).

Pada kegiatan ini konsumen dan motor sebagai hal penting kegiatan usaha, untuk itu dibutuhkan data pendukung mengenai konsumen dan motor. Harga jual tunai adalah akumulasi dari harga pokok dan keuntungan dari penjualan tunai yang diharapkan oleh pengusaha. Harga jual kredit adalah akumulasi dari harga pokok dan keuntungan dari penjualan kredit yang diharapkan pengusaha dengan pembayaran per cicilan ( hargajualkredit/durasikredit ).

Page 5: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

5

Database kreditmotor, tabel dan Relasinya

Perancangan Database

Page 6: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

6

PENGKODEAN / Pembuatan Program

Pada bagian ini diperlukan ketelitian dan kesabaran dalam penulisan kode program karena pada beberapa bahasa berlaku case sensitive artinya penulisan besar kecil huruf sangat berpengaruh terhadap jalannya program. Dalam program ini hanya menggunakan kode html, php, css, javascript, jquery dan mysql yang sangat sederhana. Buat folder bernama kreditmotor pada direktory utama web server yang biasanya berada pada folder xampp/htdocs.

Pada folder kreditmotor buatlah file koneksi.php untuk menghubungkan aplikasi kita pada database yang tadi sudah dibuat. Berikut script koneksi.php :

<?php

$koneksi = mysql_connect('localhost','root','');

$db = mysql_select_db('kreditmotor',$koneksi);

?>

Pada file koneksi.php ini berfungsi sebagi file penting dalam aplikasi , karena berisikan proses kita untuk otentikasi ke server basis data.

Index.php

<?phpinclude"atas.php";?> <?php

if($_GET['gue']=="home"){include"home.php";

}elseif ($_GET['gue']=="listmotor"){

include"list_motor.php";}elseif ($_GET['gue']=="listcust"){

include"list_cust.php";}elseif ($_GET['gue']=="inputmotor"){

include"input_motor.php";}elseif ($_GET['gue']=="inputcust"){

include"input_cust.php";}elseif ($_GET['gue']=="belicash"){

include"beli_cash.php";}elseif ($_GET['gue']=="listcash"){

include"list_cash.php";}elseif ($_GET['gue']=="belikredit"){

include"beli_kredit.php";}elseif ($_GET['gue']=="listkredit"){

include"list_kredit.php";

Page 7: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

7

}elseif ($_GET['gue']=="bayar"){

include"bayar.php";}elseif ($_GET['gue']=="listbayar"){

include"list_bayar.php";}elseif ($_GET['gue']=="inputuser"){

include"input_user.php";}elseif ($_GET['gue']=="listuser"){

include"list_user.php";}elseif ($_GET['gue']=="carimotor"){

include"cari_motor.php";}elseif ($_GET['gue']=="caricust"){

include"cari_cust.php";}elseif ($_GET['gue']=="rekapcash"){

include"rekap_cash.php";}elseif ($_GET['gue']=="rekapkredit"){

include"rekap_kredit.php";}elseif ($_GET['gue']=="rekapbayar"){

include"rekap_bayar.php";}elseif ($_GET['gue']=="set"){

include"set.php";}?>

<?phpinclude"bawah.php";?>

Page 8: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

8

Disini saya untuk design aplikasi menggunakan cara memecah antara bagian atas dan bawah design. Ada 2 file yaitu atas.php dan bawah.php

Atas.php

<?phpsession_start();include "koneksi.php";include "cek_user.php";?>

<!DOCTYPE html><html>

<head><title>Aplikasi Pembelian dan Pembayaran Motor</title><link href="css/bootstrap.css" rel="stylesheet" type="text/css" /><script src="js/bootstrap.js" type="text/javascript"></script><script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script><link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css" /><link href="img/icon.ico" id="image/icon" rel="icon" />

</head>

<body><center>

<div id="page"> <div id="judul"><?php include"koneksi.php"; $query=mysql_query("select * from web"); $r=mysql_fetch_array($query); echo $r[head]; ?></div> <div id="header"><?php include"head/in.php"; ?></div> <div id="menu">

<ul id="MenuBar1" class="MenuBarHorizontal"><li><a href="index.php?gue=home">Beranda</a></li><li><a class="MenuBarItemSubmenu" href="#">Data</a><ul> <li><a class="MenuBarItemSubmenu" href="#">Motor</a>

<ul> <li><a href="index.php?gue=inputmotor">Input Data Motor</a></li> <li><a href="index.php?gue=listmotor">Data Motor</a></li></ul>

</li> <li><a class="MenuBarItemSubmenu" href="#">Pelanggan</a>

<ul> <li><a href="index.php?gue=inputcust">Input Data Pelanggan</a> <li><a href="index.php?gue=listcust">Data Pelanggan</a> </li></ul>

</li> </ul> <li><a class="MenuBarItemSubmenu" href="#">Transaksi</a>

<ul> <li><a href="index.php?gue=belicash">Beli Cash</a> <li><a href="index.php?gue=belikredit">Beli Kredit</a> <li><a href="index.php?gue=bayar">Bayar Cicilan</a> </li></ul>

</li>

Page 9: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

9

<li><a class="MenuBarItemSubmenu" href="#">Data Beli</a><ul> <li><a href="index.php?gue=listcash">Beli Cash</a> <li><a href="index.php?gue=listkredit">Beli Kredit</a> <li><a href="index.php?gue=listbayar">Bayar Cicilan</a> </li></ul>

</li> <li><a class="MenuBarItemSubmenu" href="#">Laporan</a>

<ul> <li><a href="index.php?gue=rekapcash">Rekap Beli Cash</a> <li><a href="index.php?gue=rekapkredit">Rekap Beli Kredit</a> <li><a href="index.php?gue=rekapbayar">Rekap Bayar Cicilan</a></li></ul>

</li> <li><a class="MenuBarItemSubmenu" href="#">Cari</a>

<ul> <li><a href="index.php?gue=carimotor">Cari Data Motor</a> <li><a href="index.php?gue=caricust">Cari Data Pelanggan</a></li></ul>

</li> <li><a class="MenuBarItemSubmenu" href="#">Pengguna</a>

<ul> <li><a href="index.php?gue=inputuser">Input Data User</a> <li><a href="index.php?gue=listuser">Data User</a> <li><a href="index.php?gue=set">Pengaturan</a></li></ul>

</li> <li><a href="log.php?gue=keluar">Keluar</a></li></ul>

</div> <div id="contentarea"><br /> <div id="sidebar"><?php include"samping.php"; ?></div><div id="content">Bawah.php

</div> </div> <div id="footer"><?php include"koneksi.php"; $query=mysql_query("select * from web"); $r=mysql_fetch_array($query); echo $r['foot']; ?></div></div></center><script type="text/javascript">var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});</script></body></html>

Bayar.php

<h3>Bayar_Cicilan</h3><form action="bayar2.php" method="post"><table width="200" id="form"> <tr>

Page 10: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

10

<td>Kode Kredit</td> <td>:</td> <td><input name="kd_kredit" type="text" size="15" maxlength="15" /></td> </tr> <tr> <td><input name="" class = "btn btn-primary" type="submit" value="Lanjut" /></td> </tr></table></form>

Bayar2.php

<?phpinclude"koneksi.php";include"atas.php";$kd_kredit = $_POST['kd_kredit'];$query = mysql_query("select * from beli_kredit where kd_kredit='$kd_kredit'");$r = mysql_fetch_array($query);if (($kd_kredit != $r['kd_kredit'])or ($kd_kredit=="")){

echo"<script>alert('Data yang anda masukkan tidak terdaftar.');window.location='index.php?gue=bayar'</script>";}else{

?> <h3>Bayar Cicilan</h3>

<form action="simpan_bayar.php" method="post"><table width="200" id="form"> <?php $query2=mysql_query("select * from bayar_cicilan order by id desc");

$r2=mysql_fetch_array($query2);$id=$r2['id']+1;$tgl=date("Y/m/d");?>

<input name="id" type="hidden" value="<?php echo $id; ?>" /> <tr> <td>Kode Bayar</td> <td>:</td> <td><input name="kd_bayar1" type="text" disabled="disabled" value="<?php echo"BYR-".$id; ?>" /> <input name="kd_bayar" type="hidden" value="<?php echo"BYR-".$id; ?>" /></td> </tr> <tr> <td>Tanggal Bayar</td> <td>:</td> <td><input name="tgl_bayar1" disabled="disabled" type="text" value="<?php echo $tgl; ?>" /> <input name="tgl_bayar" type="hidden" value="<?php echo $tgl; ?>" /></td> </tr> <tr> <td>Kode Kredit</td> <td>:</td> <td><input name="kd_kredit1" disabled="disabled" type="text" value="<?php echo $r['kd_kredit']; ?>" /> <input name="kd_kredit" type="hidden" value="<?php echo $r['kd_kredit']; ?>" /></td> </tr> <tr> <td>Jumlah Bayar</td> <td>:</td> <td><input name="jumlah" type="text" id="harga" /></td> </tr> <tr> <td>Cicilan ke</td> <td>:</td> <td><input name="cicilan1" disabled="disabled" size="5" type="text" value="<?php echo $r[angsuran_ke]+1; ?>" /> <input name="cicilan" size="5" type="hidden" value="<?php echo $r['angsuran_ke']+1; ?>" /></td>

Page 11: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

11

</tr> <tr> <td>Besar Cicilan / bulan</td> <td>:</td> <td>Rp. <input name="besar1" disabled="disabled" type="text" id="harga" maxlength="8" value="<?php echo $r[besar_cicilan]; ?>" /> <input name="besar" type="hidden" id="harga" maxlength="8" value="<?php echo $r['besar_cicilan']; ?>" /></td> </tr> <tr> <td>Keterangan</td> <td>:</td> <td><input name="ket" type="text" size="35" maxlength="35" /></td> </tr> <tr> <td><input name="" type="submit" class = "btn btn-primary" value="Simpan" /></td> </tr></table></form><?php}include"bawah.php";?>

Page 12: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

12

Beli_cash.php

<form action="beli_cash2.php" method="post"><h3>Beli Cash</h3><table width="200" id="form"> <tr> <td>Kode Pelanggan</td> <td>:</td> <td><input name="kd_cust" type="text" size="25" maxlength="15"></td> </tr> <tr> <td>Kode Motor</td> <td>:</td> <td><input name="kd_motor" type="text" size="25" maxlength="15"></td> </tr> <tr> <td colspan="3"><input name="" class = "btn btn-primary" type="submit" value="Lanjut"></td> </tr></table></form>

Beli_cash2.php

<?phpinclude"atas.php";?><form action="simpan_cash.php" method="post"><?phpinclude"koneksi.php";$kd_cust = $_POST['kd_cust'];$kd_motor = $_POST['kd_motor'];$query1 = mysql_query("select * from pelanggan where kd_cust='$kd_cust'");$r1 = mysql_fetch_array($query1);$query2 = mysql_query("select * from motor where kd_motor='$kd_motor'");$r2 = mysql_fetch_array($query2);if (($kd_cust!=$r1['kd_cust'])or($kd_cust=="")){

echo"<script>alert('Data yang anda masukkan tidak terdaftar.');window.location='index.php?gue=belicash'</script>";}else if (($kd_motor!=$r2['kd_motor'])or($kd_motor=="")){

echo"<script>alert('Data yang anda masukkan tidak terdaftar.');window.location='index.php?gue=belicash'</script>";}else{?><h3>Beli Cash</h3><table width="200" id="form"><?php$query3 = mysql_query("select * from beli_cash order by id desc");$r3 = mysql_fetch_array($query3);$id = $r3['id']+1;$tgl = date("Y/m/d");?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Cash</td> <td>:</td> <td><input name="kd_cash1" type="text" value="<?php echo"KC-".$id; ?>" disabled /><input name="kd_cash" type="hidden" value="<?php echo"KC-".$id; ?>" /></td> </tr> <tr> <td>Tanggal Cash</td> <td>:</td>

Page 13: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

13

<td><input name="tgl_cash1" type="text" value="<?php echo $tgl; ?>" disabled><input name="tgl_cash" type="hidden" value="<?php echo $tgl; ?>"></td> </tr> <tr> <td>Kode Pelanggan</td> <td>:</td> <td><input name="kd_cust1" type="text" value="<?php echo $kd_cust; ?>" disabled><input name="kd_cust" type="hidden" value="<?php echo $kd_cust; ?>"></td> </tr> <tr> <td>Kode Motor</td> <td>:</td> <td><input name="kd_cust1" type="text" value="<?php echo $kd_motor; ?>" disabled><input name="kd_motor" type="hidden" value="<?php echo $kd_motor; ?>"></td> </tr> <?php $query4 = mysql_query("select * from motor where kd_motor='$kd_motor'"); $r4 = mysql_fetch_array($query4); ?> <tr> <td>Harga</td> <td>:</td> <td><input name="harga1" type="text" id="harga" value="<?php echo $r4['harga']; ?>" disabled><input name="harga" type="hidden" id="harga" value="<?php echo $r4['harga']; ?>"></td> </tr> <tr> <td>Bayar</td> <td>:</td> <td><input name="bayar" type="text" id="harga"></td> </tr> <tr> <td>Keterangan</td> <td>:</td> <td><input name="ket" type="text" size="35"></td> </tr> <tr> <td colspan="3"><input name="" class = "btn btn-primary" type="submit" value="Simpan"></td> </tr></table><?php}?></form><?phpinclude"bawah.php";?>

Page 14: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

14

Beli_kredit.php

<form action="beli_kredit2.php" method="post"><h3>Beli Kredit</h3><table width="200" id="form"> <tr> <td>Kode Pelanggan</td> <td>:</td> <td><input name="kd_cust" type="text" size="25" maxlength="15"></td> </tr> <tr> <td>Kode Motor</td> <td>:</td> <td><input name="kd_motor" type="text" size="25" maxlength="15"></td> </tr> <tr> <td colspan="3"><input name="" class = "btn btn-primary" type="submit" value="Lanjut"></td> </tr></table></form>

Beli_kredit2.php

<?phpinclude"atas.php";?><form action="simpan_kredit.php" method="post"><?phpinclude"koneksi.php";$kd_cust = $_POST['kd_cust'];$kd_motor = $_POST['kd_motor'];$query1 = mysql_query("select * from pelanggan where kd_cust='$kd_cust' ");$r1 = mysql_fetch_array($query1);$query2 = mysql_query("select * from motor where kd_motor='$kd_motor' ");$r2 = mysql_fetch_array($query2);if (($kd_cust!=$r1['kd_cust'])or($kd_cust=="")){

echo"<script>alert('Data yang anda masukkan tidak terdaftar.');window.location='index.php?gue=belicash'</script>";}else if (($kd_motor!=$r2['kd_motor'])or($kd_motor=="")){

echo"<script>alert('Data yang anda masukkan tidak terdaftar.');window.location='index.php?gue=belicash'</script>";}else{?><h3>Beli Kredit</h3><table width="200" id="form"><?php$query3 = mysql_query("select * from beli_kredit order by id desc");$r3 = mysql_fetch_array($query3);$id = $r3['id']+1;$tgl = date("Y/m/d");?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Kredit</td> <td>:</td> <td><input name="kd_kredit1" type="text" value="<?php echo"KK-".$id; ?>" disabled /><input name="kd_kredit" type="hidden" value="<?php echo"KK-".$id; ?>" /></td> </tr> <tr> <td>Tanggal Kredit</td> <td>:</td>

Page 15: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

15

<td><input name="tgl_kredit1" type="text" value="<?php echo $tgl; ?>" disabled><input name="tgl_kredit" type="hidden" value="<?php echo $tgl; ?>"></td> </tr> <tr> <td>Kode Pelanggan</td> <td>:</td> <td><input name="kd_cust1" type="text" value="<?php echo $kd_cust; ?>" disabled><input name="kd_cust" type="hidden" value="<?php echo $kd_cust; ?>"></td> </tr> <tr> <td>Kode Motor</td> <td>:</td> <td><input name="kd_cust1" type="text" value="<?php echo $kd_motor; ?>" disabled><input name="kd_motor" type="hidden" value="<?php echo $kd_motor; ?>"></td> </tr> <?php $query4 = mysql_query("select * from motor where kd_motor='$kd_motor'"); $r4 = mysql_fetch_array($query4); ?> <tr> <td>Harga</td> <td>:</td> <td><input name="harga1" type="text" id="harga" value="<?php echo $r4['harga']; ?>" disabled><input name="harga" type="hidden" id="harga" value="<?php echo $r4['harga']; ?>"></td> </tr> <tr> <td>Uang Muka</td> <td>:</td> <td><select name="uang_muka"> <option value="1700000">Rp. 1.700.000</option> <option value="2000000">Rp. 2.000.000</option> <option value="2500000">Rp. 2.500.000</option> <option value="1700000">Rp. 3.000.000</option> </select></td> </tr> <tr> <td>Bunga</td> <td>:</td> <td><select name="bunga"> <option value="10">10 %</option> <option value="15">15 %</option> </select></td> </tr> <tr> <td>Lama Cicilan</td> <td>:</td> <td><select name="lama"> <option value="12">12 bulan</option> <option value="18">18 bulan</option> <option value="24">24 bulan</option> <option value="30">30 bulan</option> <option value="36">36 bulan</option> </select></td> </tr> <tr> <td>Angsuran ke</td> <td>:</td> <td><input name="angsuran_ke" value="0" disabled="disabled" type="text" size="5" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Telah_Bayar</td> <td>:</td>

Page 16: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

16

<td><input name="telah_bayar" value="0" disabled="disabled" type="text" id="harga" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Sisa</td> <td>:</td> <td><input name="sisa" value="0" disabled type="text" id="harga" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Keterangan</td> <td>:</td> <td><input name="ket" type="text" size="35"></td> </tr> <tr> <td colspan="3"><input name="" class = "btn btn-primary" type="submit" value="Simpan"></td> </tr></table><?php}?></form>

<?phpinclude"bawah.php";?>

Cari_cust.php

<h3>Pencarian_Data_Pelanggan</h3><form action="hasil_cust.php" method="POST"><table width="200" id="form2"> <tr> <td>Berdasarkan</td> <td>:</td> <td><select name="dasar"> <option value="kd_cust">Kode Pelanggan <option value="nama">Nama <option value="no_ktp">No KTP </select></td> </tr> <tr> <td>Masukkan_Pencarian</td> <td>:</td> <td><input name="cari" type="text" /></td> </tr> <tr> <td colspan="3"><input name="" type="button" id="button" value="Cari" /></td> </tr></table></form>

Page 17: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

17

Cari_motor.php

<h3>Pencarian Data Motor</h3><form action="hasil_motor.php" method="POST"><table width="200" id="form2"> <tr> <td>Berdasarkan</td> <td>:</td> <td><select name="dasar"> <option value="kd_motor">Kode Motor <option value="merk">Merk </select></td> </tr> <tr> <td>Masukkan Pencarian</td> <td>:</td> <td><input name="cari" type="text" /></td> </tr> <tr> <td colspan="3"><input name="" type="button" id="button" value="Cari" /></td> </tr></table></form>

Cek_admin.php

<?phpinclude"koneksi.php";if($_SESSION['level']!="admin"){

echo"<script>alert('Anda bukan admin.');window.location='login.php'</script>";}?>

Cek_user.php

<?phpinclude"koneksi.php";if (!isset($_SESSION[user])){

echo"<script>alert('Login dulu.');window.location='login.php'</script>";}?>

Delete_bayar.php

<?phpinclude"koneksi.php";$id=$_GET[id];$query=mysql_query("delete from bayar_cicilan where id='$id'");if ($query){

echo"<script>alert('Data telah terhapus.');window.location='index.php?gue=listbayar'</script>";}else{

echo"<script>alert('Data GAGAL dihapus.');window.location='index.php?gue=listbayar'</script>";}?>

Page 18: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

18

Delete_cash.php

<?phpinclude "koneksi.php";$id = $_GET['id'];$query = mysql_query("delete from beli_cash where id='$id'");if ($query){

echo "<script>alert('Data telah terhapus.');window.location='index.php?gue=listcash'</script>";}else{

echo "<script>alert('Data GAGAL dihapus.');window.location='index.php?gue=listcash'</script>";}?>

Delete_cust.php

<?phpinclude "koneksi.php";$id = $_GET['id'];$query = mysql_query("delete from pelanggan where id='$id'");if ($query){

echo "<script>alert('Data telah terhapus.');window.location='index.php?gue=listcust'</script>";}else{

echo "<script>alert('Data GAGAL dihapus.');window.location='index.php?gue=listcust'</script>";}?>

Delete_kredit.php

<?phpinclude "koneksi.php";$id = $_GET['id'];$query = mysql_query("delete from beli_kredit where id='$id'");if ($query){

echo "<script>alert('Data telah terhapus.');window.location='index.php?gue=listkredit'</script>";}else{

echo "<script>alert('Data GAGAL dihapus.');window.location='index.php?gue=listkredit'</script>";}?>

Delete_motor.php

<?phpinclude"koneksi.php";$id = $_GET['id'];$query = mysql_query("delete from motor where id='$id'");if ($query){

echo "<script>alert('Data telah terhapus.');window.location='index.php?gue=listmotor'</script>";}else{

echo "<script>alert('Data GAGAL dihapus.');window.location='index.php?gue=listmotor'</script>";}?>

Delete_user.php

<?phpinclude"koneksi.php";$user = $_GET['user']; $query = mysql_query("delete from user where user='$user'");if($query){echo"<script>alert('Data telah terhapus.');window.location='index.php?gue=listuser'</script>";}else{ echo "<script>alert('Data GAGAL dihapus.');window.location='index.php?gue=listuser'</script>";}

Page 19: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

19

?>

Page 20: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

20

Detail_bayar.php

<?phpinclude"koneksi.php";$id = $_GET['id'];$query = mysql_query("select * from bayar_cicilan where id='$id'");?><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><body onLoad="window.print()"><title>Detail Bayar_Cicilan</title><table id="detail" border="0" align="center"><tr><td align="center"><font size="3">Detail Data Bayar Cicilan</font><br><font size="2">Dealer Yamaha</font><br><font size="1">Jln. K.H. Wahid Hasyim</font><table id="detail" align="center"><?phpwhile ($r = mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Bayar</td> <td>:</td> <td><?php echo $r['kd_bayar']; ?></td> </tr> <tr> <td>Tanggal Cash</td> <td>:</td> <td><?php echo $r['tgl_bayar']; ?></td> </tr> <tr> <td>Kode Kredit</td> <td>:</td> <td><?php echo $r['kd_kredit']; ?></td> </tr> <tr> <td>Jumlah</td> <td>:</td> <td><?php echo $r['jumlah']; ?></td> </tr> <tr> <td>Cicilan</td> <td>:</td> <td><?php echo $r['cicilan']; ?></td> <tr> <td>Keterangan</td> <td>:</td> <td><?php echo $r['ket']; ?></td> </tr> <?php} ?></table></td></tr></table>

Page 21: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

21

Detail_cash.php

<?phpinclude "koneksi.php";$id = $_GET['id'];$query = mysql_query("select * from beli_cash where id='$id'");?><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><body onLoad="window.print()"><title>Detail Beli_Cash</title><table id="detail" border="0" align="center"><tr><td align="center"><font size="3">Detail Data Beli Cash</font><br><font size="2">Dealer Yamaha</font><br><font size="1">Jln. K.H. Wahid Hasyim</font><table id="detail" align="center"><?phpwhile ($r = mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Cash</td> <td>:</td> <td><?php echo $r['kd_cash']; ?></td> </tr> <tr> <td>Tanggal Cash</td> <td>:</td> <td><?php echo $r['tgl_cash']; ?></td> </tr> <tr> <td>Kode Pelanggan</td> <td>:</td> <td><?php echo $r['kd_cust']; ?></td> </tr> <tr> <td>Kode Motor</td> <td>:</td> <td><?php echo $r['kd_motor']; ?></td> </tr> <tr> <td>Harga</td> <td>:</td> <td><?php echo $r['harga']; ?></td> </tr> <tr> <td>Bayar</td> <td>:</td> <td><?php echo $r['bayar']; ?></td> </tr> <tr> <td>Keterangan</td> <td>:</td> <td><?php echo $r['ket']; ?></td> </tr> <?php} ?></table></td></tr></table>

Page 22: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

22

Detail_cust.php

<?phpinclude "koneksi.php";$id = $_GET['id'];$query = mysql_query("select * from pelanggan where id='$id'");?><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><body onLoad="window.print()"><title>Detail Pelanggan</title><table id="detail" border="0" align="center"><tr><td><h3>Detail Data Pelanggan</h3><table id="detail" align="center"><?phpwhile ($r = mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Cust</td> <td>:</td> <td><?php echo $r['kd_cust']; ?></td> </tr> <tr> <td>Nama</td> <td>:</td> <td><?php echo $r['nama']; ?></td> </tr> <tr> <td>Alamat</td> <td>:</td> <td><?php echo $r['alamat']; ?></td> </tr> <tr> <td>Telp</td> <td>:</td> <td><?php echo $r['telp']; ?></td> </tr> <tr> <td>HP</td> <td>:</td> <td><?php echo $r['hp']; ?></td> </tr> <tr> <td>No KTP</td> <td>:</td> <td><?php echo $r['no_ktp']; ?></td> </tr><tr> <td>KK</td> <td>:</td> <td><?php echo $r['kk']; ?></td> </tr> <tr> <td>Slip_Gaji</td> <td>:</td> <td>Rp.<?php echo $r['slip_gaji']; ?></td> </tr> <tr> <td>Keterangan</td> <td>:</td> <td><?php echo $r['ket']; ?></td>

Page 23: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

23

</tr> <script> function detail(){

window.open("detail_cust.php?id=<?php echo $id; ?>","Detail","width=256 height=260"); } </script> <?php} ?></table></td></tr></table>

Detail_kredit.php

<?phpinclude "koneksi.php";$kd_kredit = $_GET['kd_kredit'];$query = mysql_query("select * from beli_kredit where kd_kredit='$kd_kredit'");?><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><body onLoad="window.print()"><title>Detail Beli Kredit</title><table id="detail" border="0" align="center"><tr><td align="center"><font size="3">Detail Data Beli Kredit</font><br><font size="2">Dealer Yamaha</font><br><font size="1">Jln. K.H. Wahid Hasyim</font><table id="detail" align="center"><?phpwhile ($r = mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Kredit</td> <td>:</td> <td><?php echo $r['kd_kredit']; ?></td> </tr> <tr> <td>Tanggal Kredit</td> <td>:</td> <td><?php echo $r['tgl_kredit']; ?></td> </tr> <tr> <td>Kode Pelanggan</td> <td>:</td> <td><?php echo $r['kd_cust']; ?></td> </tr> <tr> <td>Kode Motor</td> <td>:</td> <td><?php echo $r['kd_motor']; ?></td> </tr> <tr> <td>Harga</td> <td>:</td> <td><?php echo $r['harga']; ?></td> </tr> <tr> <td>Uang Muka</td> <td>:</td> <td><?php echo $r['uang_muka']; ?></td> </tr><tr>

Page 24: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

24

<td>Bunga</td> <td>:</td> <td><?php echo $r['bunga']." %"; ?></td> </tr> <tr> <td>Besar Cicilan</td> <td>:</td> <td>Rp.<?php echo $r['besar_cicilan']; ?></td> </tr> <tr> <td>Lama Cicilan</td> <td>:</td> <td><?php echo $r['lama']; ?></td> </tr> <tr> <td>Angsuran Ke</td> <td>:</td> <td><?php echo $r['angsuran_ke']; ?></td> </tr> <tr> <td>Telah Bayar</td> <td>:</td> <td><?php echo $r['telah_bayar']; ?></td> </tr> <tr> <td>Sisa</td> <td>:</td> <td><?php echo $r['sisa']; ?></td> </tr> <tr> <td>Keterangan</td> <td>:</td> <td><?php echo $r['ket']; ?></td> </tr> <?php} ?></table></td></tr></table>

Detail_motor.php

<?phpinclude "koneksi.php";$id = $_GET['id'];$query = mysql_query("select * from motor where id='$id'");?><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><body onLoad="window.print()"><title>Detail Motor</title><table id="detail" border="0" align="center"><tr><td><center><h3>Detail Data Motor</h3></center><table width="100%" id="detail" align="center"><?phpwhile ($r = mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Motor</td> <td>:</td> <td><?php echo $r['kd_motor']; ?></td> </tr>

Page 25: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

25

<tr> <td>Merk</td> <td>:</td> <td><?php echo $r['merk']; ?></td> </tr> <tr> <td>Warna</td> <td>:</td> <td><?php echo $r['warna']; ?></td> </tr> <tr> <td>Harga</td> <td>:</td> <td>Rp.<?php echo $r['harga']; ?></td> </tr> <?php} ?></table></td></tr></table></body>

Edit_cush.php

<?phpinclude "atas.php";include "koneksi.php";$id = $_GET['id'];$query = mysql_query("select * from pelanggan where id='$id'");?><h3>Edit Data Pelanggan</h3><form action="update_cust.php" method="post"><table width="100%" id="form"><?phpwhile ($r = mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Cust</td> <td>:</td> <td><input value="<?php echo $r['kd_cust']; ?>" name="kd_cust" type="text" maxlength="15" disabled size="30"></td> </tr> <tr> <td>Nama</td> <td>:</td> <td><input value="<?php echo $r['nama']; ?>" name="nama" type="text" maxlength="20" size="30"></td> </tr> <tr> <td>Alamat</td> <td>:</td> <td><input value="<?php echo $r['alamat']; ?>" name="alamat" size="35" type="text" maxlength="30"></td> </tr> <tr> <td>Telp</td> <td>:</td> <td><input name="telp" type="text" value="<?php echo $r['telp']; ?>" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="30" maxlength="15"></td> </tr> <tr>

Page 26: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

26

<td>HP</td> <td>:</td> <td><input name="hp" type="text" value="<?php echo $r['hp']; ?>" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="30" maxlength="15"></td> </tr> <tr> <td>No KTP</td> <td>:</td> <td><input name="no_ktp" type="text" value="<?php echo $r['no_ktp']; ?>" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="30" maxlength="15"></td> </tr><tr> <td>KK</td> <td>:</td> <td><input size="10" name="kk" type="text" value="<?php echo $r['kk']; ?>" onkeypress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Slip Gaji</td> <td>:</td> <td>Rp.<input size="10" name="slip_gaji" id="harga" type="text" value="<?php echo $r['slip_gaji']; ?>" onkeypress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" maxlength="9"></td> </tr> <tr> <td>Ket</td> <td>:</td> <td><input size="35" name="ket" type="text" value="<?php echo $r['ket']; ?>"></td> </tr> <script> function detail(){

window.open("detail_cust.php?id=<?php echo $id; ?>","Detail","width=300 height=340"); } </script> <tr> <td colspan="3"><input name="" type="submit" id="button" value="Update"><input name="" onclick="detail()" type="button" id="button" value="Detail"></td> </tr> <?php} ?></table></form><?phpinclude"bawah.php";?>

Page 27: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

27

Edit_kredit.php

<?phpinclude"atas.php";?><h3>Edit Beli Kredit</h3><form action="update_kredit.php" method="post"><table width="100%" id="form"><?php$id=$_GET[id];$query=mysql_query("select * from beli_kredit where id='$id'");$r=mysql_fetch_array($query);?><input name="id" type="text" value="<?php echo $id; ?>"> <tr> <td>Kode_Kredit</td> <td>:</td> <td><input name="kd_kredit1" type="text" value="<?php echo $r[kd_kredit]; ?>" disabled /></td> </tr> <tr> <td>Tanggal_Kredit</td> <td>:</td> <td><input name="tgl_kredit" type="text" value="<?php echo $r[tgl_kredit]; ?>" disabled="disabled"></td> </tr> <tr> <td>Kode_Pelanggan</td> <td>:</td> <td><input name="kd_cust" type="text" value="<?php echo $r[kd_cust]; ?>" disabled /></td> </tr> <tr> <td>Kode_Motor</td> <td>:</td> <td><input name="kd_motor" type="text" value="<?php echo $r[kd_motor]; ?>" disabled="disabled"></td> </tr> <tr> <td>Harga</td> <td>:</td> <td><input name="harga" type="text" id="harga" value="<?php echo $r[harga]; ?>" disabled></td> </tr> <tr> <td>Angsuran_ke</td> <td>:</td> <td><input name="angsuran_ke" disabled="disabled" value="<?php echo $r[angsuran_ke]; ?>" id="harga" type="text" size="5" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Telah_Bayar</td> <td>:</td> <td><input name="telah_bayar" value="<?php echo $r[telah_bayar]; ?>" type="text" id="harga" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Sisa</td> <td>:</td> <td><input name="sisa" value="<?php echo $r[sisa]; ?>" type="text" id="harga" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr>

Page 28: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

28

<td>ket</td> <td>:</td> <td><input name="ket" type="text" value="<?php echo $r[ket]; ?>" size="35"></td> </tr> <tr> <td colspan="3"><input name="" id="button" type="submit" value="Simpan"></td> </tr></table></form>

<?phpinclude"bawah.php";?>

Edit_motor.php

<?phpinclude"atas.php";?><?phpinclude"koneksi.php";$id=$_GET[id];$query=mysql_query("select * from motor where id='$id'");?><h3>Edit Data Motor</h3><form action="update_motor.php" method="post"><table width="100%" id="form"><?phpwhile ($r=mysql_fetch_array($query)){?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode_Motor</td> <td>:</td> <td><input value="<?php echo $r[kd_motor]; ?>" name="kd_motor" type="text" maxlength="15" disabled size="30"></td> </tr> <tr> <td>Merk</td> <td>:</td> <td><input value="<?php echo $r[merk]; ?>" name="merk" size="35" type="text" maxlength="30"></td> </tr> <tr> <td>Warna</td> <td>:</td> <td><input name="warna" type="text" value="<?php echo $r[warna]; ?>" maxlength="15"></td> </tr> <tr> <td>Harga</td> <td>:</td> <td>Rp.<input size="10" name="harga" type="text" id="harga" value="<?php echo $r[harga]; ?>" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" maxlength="9"></td> </tr> <script> function detail(){

window.open("detail_motor.php?id=<?php echo $id; ?>","Detail","width=256 height=260"); } </script> <tr>

Page 29: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

29

<td colspan="3"><input name="" type="submit" id="button" value="Update"><input name="" onclick="detail()" type="button" id="button" value="Detail"></td> </tr> <?php} ?></table></form><?phpinclude"bawah.php";?>

Edit_user.php

<?phpinclude"koneksi.php";include"atas.php";$user=$_GET[user];$query=mysql_query("select * from user where user='$user'");$r=mysql_fetch_array($query);?><form action="update_user.php" method="post"><h3>Edit Data User</h3><table width="100%" id="form"> <tr> <td>Username</td> <td>:</td> <td><input name="user1" disabled value="<?php echo $r[user]; ?>" type="text" maxlength="15"> <input name="user" value="<?php echo $r[user]; ?>" type="hidden" maxlength="15"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="pass" value="<?php echo $r[pass]; ?>" type="password"></td> </tr> <tr> <td>Level</td> <td>:</td> <td><select name="level"> <option value="admin" selected>Administrator <option value="user">User </select></td> </tr> <tr> <td colspan="3"><input name="" type="submit" value="Simpan" id="button"></td> </tr></table></form><?phpinclude"bawah.php";?>

Page 30: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

30

Fla.html

<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,2,0width=660height=300><param name=movie value=photocopy.swf><param name=quality value=high><param name=BGCOLOR value=#94d5fe><param name=SCALE value=showall><embed src=photocopy.swfquality=highpluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flashwidth=660height=300bgcolor=#94d5fescale= showall></embed></object>

Gaya_gue.css

/* CSS Document */

body{margin:0;padding:0;font-family:Verdana, Geneva, sans-serif;background-color:#FFF;font-size:12px;text-align:center;

}

#page{background-image:url(img/page.png);width:900px;clear:both;background-repeat:repeat-y;text-align:center;

}

#judul{background-image:url(img/judul.png);clear:both;height:25px;width:900px;text-align:center;padding-top:2px;font-size:16px;font-weight:bold;font-family:corbel;

}

#header{background-image:url(img/header.png);width:900px;height:189px;clear:both;

}

Page 31: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

31

#menu{background-image:url(img/menu.png);width:900px;height:32px;clear:both;text-align:left;

}

#contentarea{width:900px;clear:both;

}

#sidebar{float:left;padding-left:3px;text-align:left;width:200px;margin-bottom:10px;

}

#content{float:right;padding-right:475px;width:200px;text-align:center;margin-bottom:5px;

}

#footer{background-image:url(img/footer.png);width:900px;height:30px;clear:both;text-align:center;padding-top:2px;

}

#form{font-family:Verdana, Geneva, sans-serif;font-size:12px;width:600px;

}

#login{font-family:Verdana, Geneva, sans-serif;font-size:12px;

}

#form2{font-family:Verdana, Geneva, sans-serif;font-size:12px;

}

#button{background-color:#09F;border:1px solid #0FF;color:#FFF;width:90px;

}

#list{border:1px dashed #000;

Page 32: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

32

width:670px;font-size:12px;font-family:Verdana, Geneva, sans-serif;

}

#list2{border:1px dashed #000;width:800px;font-size:11px;font-family:Verdana, Geneva, sans-serif;

}

th{text-align:center;background-color:#09F;

}

#font{width:600px;

}

#harga{text-align:right;

}

#detail{border:1px dashed #06F;font-family:"Times New Roman", Times, serif;

}

h3{font-family:Verdana, Geneva, sans-serif;font-size:16px;

}

Hasil_cust.php

<?phpinclude"atas.php";?><h3>Hasil Pencarian Data Pelanggan</h3><?phpinclude"koneksi.php";$dasar=$_POST[dasar];$cari=$_POST[cari];$query=mysql_query("select * from pelanggan where $dasar LIKE '%$cari%'");$jumlah=mysql_num_rows($query);echo"Jumlah data Pelanggan : $jumlah";?><br><table width="200" border="1" id="list"> <tr> <th>Kode_Cust</th> <th>Nama</th> <th>Alamat</th> <th>Telp</th> <?php if($_SESSION[user]=="admin"){

?> <th colspan="2"></th> <?php

}

Page 33: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

33

?> </tr> <?php while($r=mysql_fetch_array($query)){

if($_SESSION[user]=="user"){ ?> <tr> <td><?php echo $r[kd_cust]; ?></td> <td><?php echo $r[nama]; ?></td> <td><?php echo $r[alamat]; ?></td> <td><?php echo $r[telp]; ?></td> </tr> <?php

}elseif($_SESSION[user]=="admin"){?>

<tr> <td><?php echo $r[kd_cust]; ?></td> <td><?php echo $r[nama]; ?></td> <td><?php echo $r[alamat]; ?></td> <td><?php echo $r[telp]; ?></td> <td align="center"><a href="edit_cust.php?id=<?php echo $r[id]; ?>"><img src="img/edit.png"></a></td> <td align="center"><a href="delete_cust.php?id=<?php echo $r[id]; ?>"><img src="img/hapus.png"></a></td> </tr> <?php

} } ?></table><?phpinclude"bawah.php";?>

Page 34: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

34

Hasil_motor.php

<?phpinclude"atas.php";?><h3>Hasil Pencarian Data Motor</h3><?phpinclude"koneksi.php";$dasar=$_POST[dasar];$cari=$_POST[cari];$query=mysql_query("select * from motor where $dasar LIKE '%$cari%'");$jumlah=mysql_num_rows($query);echo"Jumlah data motor : $jumlah";?><br><table width="200" border="1" id="list"> <tr> <th>Kode_Motor</th> <th>Merk</th> <th>Warna</th> <th>Harga</th> <?php if($_SESSION[user]=="admin"){

?> <th colspan="2"></th> <?php

}?>

</tr> <?php while($r=mysql_fetch_array($query)){

if($_SESSION[user]=="user"){ ?> <tr> <td><?php echo $r[kd_motor]; ?></td> <td><?php echo $r[merk]; ?></td> <td><?php echo $r[warna]; ?></td> <td><?php echo $r[harga]; ?></td> </tr> <?php

}elseif($_SESSION[user]=="admin"){?>

<tr> <td><?php echo $r[kd_motor]; ?></td> <td><?php echo $r[merk]; ?></td> <td><?php echo $r[warna]; ?></td> <td><?php echo $r[harga]; ?></td> <td align="center"><a href="edit_motor.php?id=<?php echo $r[id]; ?>"><img src="img/edit.png"></a></td> <td align="center"><a href="delete_motor.php?id=<?php echo $r[id]; ?>"><img src="img/hapus.png"></a></td> </tr> <?php

} } ?></table><?phpinclude"bawah.php";?>

Page 35: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

35

Hasil_rekap_cash.php

<link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><link href="img/icon.ico" id="image/icon" rel="icon" type="icon">

<?phpinclude"koneksi.php";$radio=$_POST[radio];$hhari=$_POST[hhari];$hbulan=$_POST[hbulan];$htahun=$_POST[htahun];$bbulan=$_POST[bbulan];$btahun=$_POST[btahun];$ttahun=$_POST[ttahun];$uhari=$_POST[uhari];$ubulan=$_POST[ubulan];$utahun=$_POST[utahun];$uhari2=$_POST[uhari2];$ubulan2=$_POST[ubulan2];$utahun2=$_POST[utahun2];$harian=$_POST[harian];//rekap ya....if($radio==""){

echo"<script>alert('Pilih beberapa Pilihan rekap waktu yang ada.');window.location='index.php?gue=rekapcash'</script>";}elseif($radio=="harian"){

$tgl="$htahun-$hbulan-$hhari";$query=mysql_query("select * from beli_cash where tgl_cash='$harian' order by kd_cash");

}elseif($radio=="bulanan"){$query=mysql_query("select * from beli_cash where month(tgl_cash)='$bbulan' and

year(tgl_cash)='$btahun' order by kd_cash");}elseif($radio=="tahunan"){

$query=mysql_query("select * from beli_cash where year(tgl_cash)='$ttahun' order by kd_cash");}else{

$tgl_awal="$utahun-$ubulan-$uhari";$tgl_akhir="$utahun2-$ubulan2-$uhari2";$query=mysql_query("select * from beli_cash where tgl_cash>='$tgl_awal' and tgl_cash<='$tgl_akhir'

order by kd_cash");}$jumlah=mysql_num_rows($query);echo"Jumlah data pembelian cash : $jumlah";?><body onLoad="window.print() "><title>Rekap Data</title><table class = "table table-striped" align="center" id="list" width = "100%"> <tr> <th>No</th> <th>Kode Cash</th> <th>Tanggla Cash</th> <th>Kode Cust</th> <th>Nama</th> <th>Kode Motor</th> <th>Harga</th> <th>Bayar</th> <th>Ket</th>

</tr> <?php while($r=mysql_fetch_array($query)){ ?> <tr>

Page 36: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

36

<td><?php echo $no=$no+1; ?></td> <td><?php echo $r[kd_cash]; ?></td> <td><?php echo $r[tgl_cash]; ?></td> <td><?php echo $r[kd_cust]; ?></td> <?php $query2=mysql_query("select * from pelanggan where kd_cust='$r[kd_cust]'");

$r2=mysql_fetch_array($query2);?>

<td><?php echo $r2[nama]; ?></td> <td><?php echo $r[kd_motor]; ?></td> <td><?php echo $r[harga]; ?></td> <td><?php echo $r[bayar]; ?></td> <td><?php echo $r[ket]; ?></td>

</tr> <?php } ?></table>

Page 37: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

37

Hasil_rekap_kredit.php

<link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css"><link href="img/icon.ico" id="image/icon" rel="icon" type="icon">

<?phpinclude"koneksi.php";$radio=$_POST[radio];$hhari=$_POST[hhari];$hbulan=$_POST[hbulan];$htahun=$_POST[htahun];$bbulan=$_POST[bbulan];$btahun=$_POST[btahun];$ttahun=$_POST[ttahun];$uhari=$_POST[uhari];$ubulan=$_POST[ubulan];$utahun=$_POST[utahun];$uhari2=$_POST[uhari2];$ubulan2=$_POST[ubulan2];$utahun2=$_POST[utahun2];//rekap ya....if($radio==""){

echo"<script>alert('Pilih beberapa Pilihan rekap waktu yang ada.');window.location='index.php?gue=rekapkredit'</script>";}elseif($radio=="harian"){

$tgl="$htahun-$hbulan-$hhari";$query=mysql_query("select * from beli_kredit where tgl_kredit='$tgl' order by kd_kredit");

}elseif($radio=="bulanan"){$query=mysql_query("select * from beli_kredit where month(tgl_kredit)='$bbulan' and

year(tgl_kredit)='$btahun' order by kd_kredit");}elseif($radio=="tahunan"){

$query=mysql_query("select * from beli_kredit where year(tgl_kredit)='$ttahun' order by kd_kredit");}else{

$tgl_awal="$utahun-$ubulan-$uhari";$tgl_akhir="$utahun2-$ubulan2-$uhari2";$query=mysql_query("select * from beli_kredit where tgl_kredit>='$tgl_awal' and tgl_kredit

<='$tgl_akhir' order by kd_kredit");}$jumlah=mysql_num_rows($query);echo"Jumlah data pembelian Kredit : $jumlah";?><body onload="window.print() "><title>Rekap Data</title><table class = "table table-striped" align="center" id="list2" width = "100%"> <tr> <th>No</th> <th>Kode Kredit</th> <th>Tgl Kredit</th> <th>Kode Cust</th> <th>Nama</th> <th>Kode Motor</th> <th>Harga</th> <th>Uang Muka</th> <th>Bunga</th> <th>Lama</th> <th>Angsuran</th>

<th>Jumlah</th> <th>Sisa</th> </tr> <?php

Page 38: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

38

while($r=mysql_fetch_array($query)){ ?> <tr> <td><?php echo $no=$no+1; ?></td> <td><?php echo $r[kd_kredit]; ?></td> <td><?php echo $r[tgl_kredit]; ?></td> <td><?php echo $r[kd_cust]; ?></td> <?php $query2=mysql_query("select * from pelanggan where kd_cust='$r[kd_cust]'");

$r2=mysql_fetch_array($query2);?>

<td><?php echo $r2[nama]; ?></td> <td><?php echo $r[kd_motor]; ?></td> <td><?php echo $r[harga]; ?></td> <td><?php echo $r[uang_muka]; ?></td> <td><?php echo $r[bunga]; ?></td>

<td><?php echo $r[lama]; ?></td> <td><?php echo $r[angsuran_ke]; ?></td> <td><?php echo $r[telah_bayar]; ?></td> <td><?php echo $r[sisa]; ?></td> </tr> <?php } ?></table>

Home.php

<table id="font"><tr><td valign="bottom"><br><?phpecho"<h4>Hello $_SESSION[user] !!!</h4>";?><br><?phpinclude"fla.html";?></td></td></table>

Page 39: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

39

Input_user.php

<?phpsession_start();include"koneksi.php";include"cek_admin.php";?><h3>Input Data User</h3><form action="simpan_user.php" method="post"><table width="200" id="form"> <tr> <td>Username</td> <td>:</td> <td><input name="user" type="text" maxlength="15"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="pass" type="password"></td> </tr> <tr> <td>Level</td> <td>:</td> <td><select name="level"> <option value="admin">Administrator</option> <option value="user">User</option> </select></td> </tr> <tr> <td colspan="3"><input name="" type="submit" value="Simpan" class = "btn btn-primary"></td> </tr></table></form>

Page 40: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

40

Input_cust.php

<?phpinclude "koneksi.php";$query = mysql_query("select * from pelanggan order by id desc");?><h3>Input Data Pelanggan</h3><form action="simpan_cust.php" method="post"><table id="form"><?php$r = mysql_fetch_array($query);$id = $r[id]+1;?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Cust</td> <td>:</td> <td><input value="<?php echo"CUS-".$id; ?>" name="kd_cust1" type="text" maxlength="15" disabled size="30"> <input value="<?php echo"CUS-".$id; ?>" name="kd_cust" type="hidden" maxlength="15" size="30"></td> </tr> <tr> <td>Nama</td> <td>:</td> <td><input name="nama" type="text" maxlength="20" size="30"></td> </tr> <tr> <td>Alamat</td> <td>:</td> <td><input name="alamat" size="35" type="text" maxlength="30"></td> </tr> <tr> <td>Telp</td> <td>:</td> <td><input name="telp" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="30" maxlength="15"></td> </tr> <tr> <td>HP</td> <td>:</td> <td><input name="hp" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="30" maxlength="15"></td> </tr> <tr> <td>No KTP</td> <td>:</td> <td><input name="no_ktp" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="30" maxlength="15"></td> </tr><tr> <td>KK</td> <td>:</td> <td><input size="10" name="kk" type="text" onkeypress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;"></td> </tr> <tr> <td>Slip Gaji</td> <td>:</td> <td>Rp.<input size="10" name="slip_gaji" id="harga" type="text" onkeypress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" maxlength="9"></td>

Page 41: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

41

</tr> <tr> <td>Keterangan</td> <td>:</td> <td><input size="35" name="ket" type="text"></td> </tr> <tr> <td colspan="3"><input name="" type="submit" class = "btn btn-primary" value="Simpan"></td> </tr></table></form>

Input_motor.php

<?phpinclude"koneksi.php";$query=mysql_query("select * from motor order by id desc");?><h3>Input Data Motor</h3><form action="simpan_motor.php" method="post"><table width="200" id="form"><?php$r=mysql_fetch_array($query);$id=$r['id']+1;?><input name="id" type="hidden" value="<?php echo $id; ?>"> <tr> <td>Kode Motor</td> <td>:</td> <td><input value="<?php echo"MTR-".$id;?>" name="kd_motor1" type="text" maxlength="15" disabled size="30"> <input value="<?php echo"MTR-".$id;?>" name="kd_motor" type="hidden" maxlength="15" size="30"></td> </tr> <tr> <td>Merk</td> <td>:</td> <td><input name="merk" size="35" type="text" maxlength="30"></td> </tr> <tr> <td>Warna</td> <td>:</td> <td><input name="warna" type="text" maxlength="15"></td> </tr> <tr> <td>Harga</td> <td>:</td> <td>Rp.<input size="10" name="harga" type="text" id="harga" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" maxlength="9"></td> </tr> <tr> <td colspan="3"><input name="" type="submit" class = "btn btn-primary" value="Simpan"></td> </tr></table></form>

Page 42: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

42

Login.php

<body background="img/login_back.jpg" marginwidth="900px" marginheight="600"><link href="img/icon.ico" id="image/icon" rel="icon" /><link href="gaya_gue.css" id="text/css" rel="stylesheet" type="text/css" />

<title>Login!!!</title><form action="log.php?gue=masuk" method="post"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><table width="200" align="center" id="login"> <tr> <td>Username</td> <td>:</td> <td><input name="user" type="text" maxlength="20" /></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="pass" type="password" maxlength="20" /></td> </tr> <tr> <td colspan="3" align="right"><input name="" type="submit" value="Login" /></td> </tr></table></form>

List_bayar.php

<h3>Daftar Data Bayar Cicilan</h3><?phpinclude "koneksi.php";$query=mysql_query("select * from bayar_cicilan order by id asc");$jumlah=mysql_num_rows($query);echo"Jumlah data Bayar Cicilan : $jumlah";?><br><table width="100%" id="list" class="table table-striped"> <tr> <th>No</th> <th>Kode Bayar</th> <th>Tanggal Bayar</th> <th>Kode Kredit</th> <th>Jumlah</th> <th>Cicilan</th> <th>Ket</th> <?php if($_SESSION[user]=="admin"){

?> <th>Opsi</th> <?php

}else{?>

<th></th> </tr> <?php

} while($r=mysql_fetch_array($query)){ ?> <tr> <td><?php echo $no=$no+1; ?></td>

Page 43: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

43

<td><?php echo $r[kd_bayar]; ?></td> <td><?php echo $r[tgl_bayar]; ?></td> <td><?php echo $r[kd_kredit]; ?></td> <td><?php echo $r[jumlah]; ?></td> <td><?php echo $r[cicilan]; ?></td> <td><?php echo $r[ket]; ?></td> <?php if($_SESSION[user]=="admin"){

?> <td align="center" class="btn btn-danger" title="hapus"><a href="delete_bayar.php?id=<?php echo $r[id]; ?>"> <i class="icon-trash"></i> </a></td> <?php

}?>

<td align="center" class="btn btn-info" title="detail"><a href="detail_bayar.php?id=<?php echo $r[id]; ?>" target="_blank" > <i class="icon-file"></i> </a></td> </tr> <?php } ?></table>

List_cash.php

<h3>Daftar Data Pembelian Cash</h3><?phpinclude"koneksi.php";$query=mysql_query("select * from beli_cash order by id asc");$jumlah=mysql_num_rows($query);echo"Jumlah data pembelian cash : $jumlah";?><br><table width="100%"id="list" class = "table table-striped"> <tr> <th>No</th> <th>Kode Cash</th> <th>Tanggal Cash</th> <th>Kode Cust</th> <th>Kode Motor</th> <th>Harga</th> <th>Bayar</th> <th>Ket</th> <?php if($_SESSION[user]=="admin"){

?> <th>opsi</th> <?php

}else{?>

<th></th> </tr> <?php

} while($r=mysql_fetch_array($query)){ ?> <tr> <td><?php echo $no=$no+1; ?></td> <td><?php echo $r[kd_cash]; ?></td> <td><?php echo $r[tgl_cash]; ?></td> <td><?php echo $r[kd_cust]; ?></td> <td><?php echo $r[kd_motor]; ?></td> <td><?php echo $r[harga]; ?></td>

Page 44: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

44

<td><?php echo $r[bayar]; ?></td> <td><?php echo $r[ket]; ?></td> <?php if($_SESSION[user]=="admin"){

?> <td align="center" class="btn btn-danger"><a href="delete_cash.php?id=<?php echo $r[id]; ?>"><i class="icon-trash"></i></a></td> <?php

}?>

<td align="center" class="btn btn-info"><a href="detail_cash.php?id=<?php echo $r[id]; ?>" target="_blank" ><i class="icon-file"></i></a></td> </tr> <?php } ?></table>

List_kredit.php

<h3>Daftar Data Pembelian Kredit</h3><?phpinclude"koneksi.php";$query=mysql_query("select * from beli_kredit order by id asc");$jumlah=mysql_num_rows($query);echo"Jumlah data pembelian Kredit : $jumlah";?><br><table width="200" border="1" id="list" class = "table table-striped"> <tr> <th>No</th> <th>Kode Kredit</th> <th>Tgl Kredit</th> <th>Kode Cust</th> <th>Kode Motor</th> <th>Harga</th> <th>Uang Muka</th> <th>Bunga</th> <?php if($_SESSION[user]=="admin"){

?> <th>Opsi</th> <?php

}else{?>

<th></th> </tr> <?php

} while($r=mysql_fetch_array($query)){ ?> <tr> <td><?php echo $no=$no+1; ?></td> <td><?php echo $r[kd_kredit]; ?></td> <td><?php echo $r[tgl_kredit]; ?></td> <td><?php echo $r[kd_cust]; ?></td> <td><?php echo $r[kd_motor]; ?></td> <td><?php echo $r[harga]; ?></td> <td><?php echo $r[uang_muka]; ?></td> <td><?php echo $r[bunga]; ?></td> <?php if($_SESSION[user]=="admin"){

Page 45: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

45

?> <td align="center" class="btn btn-danger" title="hapus"> <a href="delete_kredit.php?id=<?php echo $r[id]; ?>"><i class="icon-trash"></i></a></td> <?php

}?>

<td align="center" class="btn btn-info" title="detail"> <a href="detail_kredit.php?kd_kredit=<?php echo $r[kd_kredit]; ?>" target="_blank"><i class="icon-file"></i></a></td> </tr> <?php } ?></table>

List_motor.php

<h3>Daftar Data Motor</h3><?phpinclude"koneksi.php";$query=mysql_query("select * from motor order by id asc");$jumlah=mysql_num_rows($query);echo"Jumlah data motor : $jumlah";?><br><table width="100%" id="list" class = "table table-striped"> <tr> <th>Kode Motor</th> <th>Merk</th> <th>Warna</th> <th>Harga</th> <?php if($_SESSION['user']=="admin"){

?> <th>Opsi</th> <?php

}?>

</tr> <?php while($r=mysql_fetch_array($query)){

if($_SESSION['user']=="user"){ ?> <tr> <td><?php echo $r['kd_motor']; ?></td> <td><?php echo $r['merk']; ?></td> <td><?php echo $r['warna']; ?></td> <td><?php echo $r['harga']; ?></td> </tr> <?php

}elseif($_SESSION['user']=="admin"){?>

<tr> <td><?php echo $r['kd_motor']; ?></td> <td><?php echo $r['merk']; ?></td> <td><?php echo $r['warna']; ?></td> <td><?php echo $r['harga']; ?></td> <td align="center" class="btn btn-info" title="detail"> <a href="edit_motor.php?id=<?php echo $r[id]; ?>"><i class="icon-trash"></i></a></td> <td align="center" class="btn btn-danger" title="hapus"> <a href="delete_motor.php?id=<?php echo $r[id]; ?>"><i class="icon-file"></i></a></td> </tr> <?php

Page 46: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

46

} } ?></table>

List_user.php

<?phpsession_start();include "koneksi.php";include"cek_admin.php";?><h3>Daftar Data User</h3><?php$query = mysql_query("select * from user");$jumlah = mysql_num_rows($query);echo"Jumlah data User : $jumlah";?><br><table width="200" class = "table table-striped" id="list"> <tr> <th>User</th> <th>Password</th> <th>Level</th> <th>opsi</th> </tr> <?php while($r=mysql_fetch_array($query)){ ?> <tr> <td><?php echo $r[user]; ?></td> <td align="center"><?php echo"?"; ?></td> <td><?php echo $r[level]; ?></td> <td align="center" class="btn btn-info" title="detail" > <a href="edit_user.php?user=<?php echo $r[user]; ?>"> <i class="icon-file"></i> </a></td> <td align="center" class="btn btn-danger" title ="hapus"> <a href="delete_user.php?user=<?php echo $r[user]; ?>"> <i class="icon-trash"></i> </a></td> </tr> <?php } ?></table>

Page 47: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

47

Log.php

<?phpsession_start();include"koneksi.php";$user = $_POST["user"];$pass = md5($_POST["pass"]);$gue = $_GET['gue'];

if ($gue == "masuk"){$query = mysql_query("select * from user where user='$user' and pass='$pass'");if (mysql_num_rows($query)==1){

$c = mysql_fetch_array($query);$_SESSION["user"]=$c["user"];$_SESSION["level"]=$c["level"];

}if ($c['level']=="admin"){echo"<script>alert('Selamat datang di Halaman admin.');window.location='index.php?

gue=home'</script>";}else if ($c['level']=="user"){

echo"<script>alert('Selamat datang di Halaman user.');window.location='index.php?gue=home'</script>";

}else{echo"<script>alert('Kata sandi anda tidak cocok.');window.location='login.php'</script>";

}}else if ($gue == "keluar"){

unset($_SESSION["user"]);unset($_SESSION["level"]);echo"<script>alert('Anda telah Keluar.');window.location='login.php'</script>";

}?>

Page 48: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

48

Rekap_bayar.php

<h3>Rekap Data Bayar Cicilan</h3><form action="hasil_rekap_bayar.php" method="post"><table id="form"> <tr> <td><input name="radio" type="radio" value="harian" /> Harian</td> <td>:</td> <td><select name="hhari">

<?php for($hh=1;$hh<=31;$hh++){

echo"<option value=$hh>$hh";}

?></select>- <select name="hbulan">

<?php for($hb=1;$hb<=12;$hb++){

echo"<option value=$hb>$hb";}

?></select>- <input name="htahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"> </td> </tr> <tr> <td><input name="radio" type="radio" value="bulanan" /> Bulanan</td> <td>:</td> <td><select name="bbulan">

<?php for($ht=1;$ht<=12;$ht++){

echo"<option value=$ht>$ht";}

?></select>- <input name="btahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td><input name="radio" type="radio" value="tahunan" /> Tahunan</td> <td>:</td> <td><input name="ttahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td><input name="radio" type="radio" value="tertentu" /> Tertentu</td> <td>:</td> <td><select name="uhari">

<?php for($uh=1;$uh<=31;$uh++){

echo"<option value=$uh>$uh";}

?></select>- <select name="ubulan">

<?php for($ub=1;$ub<=12;$ub++){

echo"<option value=$ub>$ub";}

?></select>- <input name="utahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"> s/d <select name="uhari2">

<?php for($uh2=1;$uh2<=31;$uh2++){

echo"<option value=$uh2>$uh2";

Page 49: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

49

} ?></select>-

<select name="ubulan2"><?php

for($ub2=1;$ub2<=12;$ub2++){echo"<option value=$ub2>$ub2";}

?></select>- <input name="utahun2" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td colspan="3"><input name="rekap" type="submit" value="Rekap" id="button"></td> </tr></table></form>

Page 50: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

50

Rekap_cash.php

<h3>Rekap Data Pembelian Cash</h3><form action="hasil_rekap_cash.php" method="post"><table id="form"> <tr> <td> Harian</td> <td><input name="radio" type="radio" value="harian" class="radio" /> &nbsp;</td> <td><input type="date" name="harian"></td> </tr> <tr> <td><input name="radio" type="radio" value="bulanan" /> Bulanan</td> <td>:</td> <td><select name="bbulan">

<?php for($ht=1;$ht<=12;$ht++){

echo"<option value=$ht>$ht";}

?></select>- <input name="btahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td><input name="radio" type="radio" value="tahunan" /> Tahunan</td> <td>:</td> <td><input name="ttahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td><input name="radio" type="radio" value="tertentu" /> Tertentu</td> <td>:</td> <td><select name="uhari">

<?php for($uh=1;$uh<=31;$uh++){

echo"<option value=$uh>$uh";}

?></select>- <select name="ubulan">

<?php for($ub=1;$ub<=12;$ub++){

echo"<option value=$ub>$ub";}

?></select>- <input name="utahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"> s/d <select name="uhari2">

<?php for($uh2=1;$uh2<=31;$uh2++){

echo"<option value=$uh2>$uh2";}

?></select>- <select name="ubulan2">

<?php for($ub2=1;$ub2<=12;$ub2++){

echo"<option value=$ub2>$ub2";}

?></select>- <input name="utahun2" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td colspan="3"><input name="rekap" type="submit" value="Rekap" id="button"></td> </tr>

Page 51: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

51

</table></form>

Rekap_kredit.php

<h3>Rekap Data Pembelian Kredit</h3><form action="hasil_rekap_kredit.php" method="post"><table id="form"> <tr> <td><input name="radio" type="radio" value="harian" /> Harian</td> <td>:</td> <td><select name="hhari">

<?php for($hh=1;$hh<=31;$hh++){

echo"<option value=$hh>$hh";}

?></select>- <select name="hbulan">

<?php for($hb=1;$hb<=12;$hb++){

echo"<option value=$hb>$hb";}

?></select>- <input name="htahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"> </td> </tr> <tr> <td><input name="radio" type="radio" value="bulanan" /> Bulanan</td> <td>:</td> <td><select name="bbulan">

<?php for($ht=1;$ht<=12;$ht++){

echo"<option value=$ht>$ht";}

?></select>- <input name="btahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td><input name="radio" type="radio" value="tahunan" /> Tahunan</td> <td>:</td> <td><input name="ttahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td><input name="radio" type="radio" value="tertentu" /> Tertentu</td> <td>:</td> <td><select name="uhari">

<?php for($uh=1;$uh<=31;$uh++){

echo"<option value=$uh>$uh";}

?></select>- <select name="ubulan">

<?php for($ub=1;$ub<=12;$ub++){

echo"<option value=$ub>$ub";}

?></select>- <input name="utahun" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"> s/d <select name="uhari2">

<?php for($uh2=1;$uh2<=31;$uh2++){

Page 52: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

52

echo"<option value=$uh2>$uh2";}

?></select>- <select name="ubulan2">

<?php for($ub2=1;$ub2<=12;$ub2++){

echo"<option value=$ub2>$ub2";}

?></select>- <input name="utahun2" type="text" onKeyPress="if (event.keyCode &lt; 48 || event.keyCode &gt; 57) event.returnValue=false;" size="3" maxlength="4"></td> </tr> <tr> <td colspan="3"><input name="rekap" type="submit" value="Rekap" id="button"></td> </tr></table></form>

Samping.php

<table id="fontsidebar"><tr><td><?php$waktu=date("D, d-M-Y");echo"<center><b>$waktu</b></center>";?><br><?php include"koneksi.php"; $query=mysql_query("select * from web"); $r=mysql_fetch_array($query); echo $r['samping']; ?></td></td></table>

Page 53: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

53

Set.php

<?phpinclude "koneksi.php";include "cek_admin.php";$query = mysql_query("select * from web");$r = mysql_fetch_array($query);?><h3>Pengaturan</h3><form action="update_set.php" method="post"><table id="form"> <tr> <td>Header</td> <td>:</td> <td><input name="head" type="text" size="80" value="<?php echo $r['head']; ?>" /></td> </tr> <tr> <td>Sidebar</td> <td>:</td> <td><textarea name="samping" cols="65" rows="20"><?php echo $r['samping']; ?></textarea></td> </tr> <tr> <td>Footer</td> <td>:</td> <td><input name="foot" type="text" size="90" value="<?php echo $r['foot']; ?>"></td> </tr> <tr> <td colspan="3"><input name="" type="submit" id="button" value="Ganti"></td> </tr></table></form>

Page 54: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

54

Simpan_bayar.php

<?phpinclude"koneksi.php";$id=$_POST[id];$kd_bayar=$_POST[kd_bayar];$tgl_bayar=$_POST[tgl_bayar];$kd_kredit=$_POST[kd_kredit];$jumlah=$_POST[jumlah];$besar=$_POST[besar];$cicilan=$_POST[cicilan];$ket=$_POST[ket];$kembalian=$jumlah-$besar;$query3=mysql_query("select * from beli_kredit where kd_kredit='$kd_kredit'");$r=mysql_fetch_array($query3);$angsuran=$r[angsuran_ke]+1;$telah=$r[telah_bayar]+$besar;$sisa=$r[harga]-$telah;if(($jumlah=="")or($ket=="")){

echo"<script>alert('Masih ada yang kosong.');window.location='index.php?gue=bayar'</script>";}else if ($jumlah < $besar){

echo"<script>alert('Uang yang anda masukkan tidak mencukupi pada harga motor yang dipilih.');window.location='index.php?gue=bayar'</script>";}else if ($cicilan > $r[angsuran_ke]){

echo"<script>alert('Pembayaran cicilan sudah memenuhi banyaknya angsuran.');window.location='index.php?gue=bayar'</script>";}elseif(($query=mysql_query("insert into bayar_cicilan values ('$id','$kd_bayar','$tgl_bayar','$kd_kredit','$jumlah','$cicilan','$ket')"))and ($query2=mysql_query("update beli_kredit set angsuran_ke='$angsuran',telah_bayar='$telah',sisa='$sisa' where kd_kredit='$kd_kredit'"))){

echo"<script>alert('Data telah tersimpan. Uang kembalian adalah : Rp.$kembalian,-.');window.location='index.php?gue=listbayar'</script>";}else{

echo"<script>alert('Data GAGAL disimpan.');window.location='index.php?gue=bayar'</script>";}?>

Page 55: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

55

Simpan_cash.php

<?phpinclude"koneksi.php";$id=$_POST[id];$kd_cash=$_POST[kd_cash];$tgl_cash=$_POST[tgl_cash];$kd_cust=$_POST[kd_cust];$kd_motor=$_POST[kd_motor];$harga=$_POST[harga];$bayar=$_POST[bayar];$ket=$_POST[ket];$kembali=$bayar-$harga;if(($bayar=="")or($ket=="")){

echo"<script>alert('Masih ada yang kosong.');window.location='index.php?gue=belicash'</script>";}else if ($bayar < $harga){

echo"<script>alert('Uang yang anda masukkan tidak mencukupi pada harga motor yang dipilih.');window.location='index.php?gue=belicash'</script>";}elseif($query=mysql_query("insert into beli_cash values ('$id','$kd_cash','$tgl_cash','$kd_cust','$kd_motor','$harga','$bayar','$ket')")){

echo"<script>alert('Data telah tersimpan. Uang kembalian adalah : Rp.$kembali,-.');window.location='index.php?gue=listcash'</script>";}else{

echo"<script>alert('Data GAGAL disimpan.');window.location='index.php?gue=belicash'</script>";}?>

Simpan_cust.php

<?phpinclude"koneksi.php";$id=$_POST[id];$kd_cust=$_POST[kd_cust];$nama=$_POST[nama];$alamat=$_POST[alamat];$telp=$_POST[telp];$hp=$_POST[hp];$no_ktp=$_POST[no_ktp];$kk=$_POST[kk];$slip_gaji=$_POST[slip_gaji];$ket=$_POST[ket];if(($nama=="") or ($alamat=="")or ($telp=="")or ($hp=="")or ($no_ktp=="")or($kk=="")or($slip_gaji=="")or($ket=="")){

echo"<script>alert('Data belum lengkap.');window.location='index.php?gue=listcust'</script>";}else if($query=mysql_query("insert into pelanggan values ('$id','$kd_cust','$nama','$alamat','$telp','$hp','$no_ktp','$kk','$slip_gaji','$ket')")){

echo"<script>alert('Data sudah disimpan.');window.location='index.php?gue=listcust'</script>";}else{

echo"<script>alert('Data GAGAL disimpan.');window.location='index.php?gue=listcust'</script>";}?>

Page 56: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

56

Simpan_motor.php

<?phpinclude"koneksi.php";$id=$_POST[id];$kd_motor=$_POST[kd_motor];$merk=$_POST[merk];$warna=$_POST[warna];$harga=$_POST[harga];if(($kd_motor=="")or($merk=="") or ($warna=="")or ($harga=="")){

echo"<script>alert('Data belum lengkap.');window.location='index.php?gue=listmotor'</script>";}else if($query=mysql_query("insert into motor values ('$id','$kd_motor','$merk','$warna','$harga')")){

echo"<script>alert('Data sudah di simpan.');window.location='index.php?gue=listmotor'</script>";}else{

echo"<script>alert('Data GAGAL di simpan.');window.location='index.php?gue=listmotor'</script>";}?>

Simpan_user.php

<?phpinclude"koneksi.php";$user=$_POST[user];$pass=md5($_POST[pass]);$level=$_POST[level];$qu=mysql_query("select * from user");$r=mysql_fetch_array($qu);if(($user=="")or($pass=="") or ($level=="")or($user==$r[user])){

echo"<script>alert('Data belum lengkap. Dan Data user sudah terdaftar.');window.location='index.php?gue=inputuser'</script>";}else if($query=mysql_query("insert into user values('$user','$pass','$level')")){

echo"<script>alert('Data sudah di simpan.');window.location='index.php?gue=listmotor'</script>";}else{

echo"<script>alert('Data GAGAL di simpan.');window.location='index.php?gue=listmotor'</script>";}?>

Page 57: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

57

Simpan_kredit.php

<?phpinclude"koneksi.php";$id=$_POST[id];$kd_kredit=$_POST[kd_kredit];$tgl_kredit=$_POST[tgl_kredit];$kd_cust=$_POST[kd_cust];$kd_motor=$_POST[kd_motor];$bunga=$_POST[bunga];$harga=($_POST[harga]*$bunga/100)+$_POST[harga];$uang_muka=$_POST[uang_muka];$lama=$_POST[lama];$angsuran_ke=0;$telah_bayar=$uang_muka;$sisa=$harga-$telah_bayar;$ket=$_POST[ket];$besar=($harga-$uang_muka)/$lama;if($ket==""){

echo"<script>alert('Masih ada yang kosong.');window.location='index.php?gue=belikredit'</script>";}elseif($query=mysql_query("insert into beli_kredit values ('$id','$kd_kredit','$tgl_kredit','$kd_cust','$kd_motor','$harga','$uang_muka','$bunga','$besar','$lama','$angsuran_ke','$telah_bayar','$sisa','$ket')")){

echo"<script>alert('Data telah tersimpan. Dengan besar cicilan per bulan : Rp.$besar,-. Pembayaran Selama : $lama. Dengan bunga sebesar $bunga % per bulan.');window.location='index.php?gue=listkredit'</script>";}else{

echo"<script>alert('Data GAGAL disimpan.');window.location='index.php?gue=belikredit'</script>";}?>

Page 58: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

58

Update_cust.php

<?phpinclude"koneksi.php";$id=$_POST[id];$nama=$_POST[nama];$alamat=$_POST[alamat];$telp=$_POST[telp];$hp=$_POST[hp];$no_ktp=$_POST[no_ktp];$kk=$_POST[kk];$slip_gaji=$_POST[slip_gaji];$ket=$_POST[ket];if(($nama=="") or ($alamat=="")or ($telp=="")or ($hp=="")or ($no_ktp=="")or($kk=="")or($slip_gaji=="")or($ket=="")){

echo"<script>alert('Data belum lengkap.');window.location='index.php?gue=listcust'</script>";}else if($query=mysql_query("update pelanggan set nama='$nama', alamat='$alamat', telp='$telp', hp='$hp', no_ktp='$no_ktp', kk='$kk', slip_gaji='$slip_gaji', ket='$ket' where id='$id'")){

echo"<script>alert('Data sudah di perbaharui.');window.location='index.php?gue=listcust'</script>";}else{

echo"<script>alert('Data GAGAL di perbaharui.');window.location='index.php?gue=listcust'</script>";}?>

Update_motor.php

<?phpinclude"koneksi.php";$id=$_POST[id];$merk=$_POST[merk];$warna=$_POST[warna];$harga=$_POST[harga];if(($merk=="") or ($warna=="")or ($harga=="")){

echo"<script>alert('Data belum lengkap.');window.location='index.php?gue=listmotor'</script>";}else if($query=mysql_query("update motor set merk='$merk', warna='$warna', harga='$harga' where id='$id'")){

echo"<script>alert('Data sudah di perbaharui.');window.location='index.php?gue=listmotor'</script>";}else{

echo"<script>alert('Data GAGAL di perbaharui.');window.location='index.php?gue=listmotor'</script>";}?>

Page 59: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

59

Update_set.php

<?phpinclude"koneksi.php";$head = $_POST['head'];$foot = $_POST['foot'];$samping = $_POST['samping'];if(($head=="") or ($foot=="")){

echo"<script>alert('Data belum lengkap.');window.location='index.php?gue=set'</script>";}else if($query=mysql_query("update web set head='$head',samping='$samping',foot='$foot'")){

echo"<script>alert('Data sudah di perbaharui.');window.location='index.php?gue=set'</script>";}else{

echo"<script>alert('Data GAGAL di perbaharui.');window.location='index.php?gue=set'</script>";}?>

Update_user.php

<?phpinclude"koneksi.php";$user=$_POST[user];$pass=md5($_POST[pass]);$level=$_POST[level];if(($pass=="") or ($level=="")){

echo"<script>alert('Data belum lengkap.');window.location='index.php?gue=listuser'</script>";}else if($query=mysql_query("update user set pass='$pass', level='$level' where user='$user'")){

echo"<script>alert('Data sudah di perbaharui.');window.location='index.php?gue=listuser'</script>";}else{

echo"<script>alert('Data GAGAL di perbaharui.');window.location='index.php?gue=listuser'</script>";}?>

Jangan lupa untuk mendownload twitterbootstrap, ada beberapa file dalam script diatas yang menggunakan bootstrap.

Page 60: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

60

Tampilan Aplikasi ketika sudah selesai melakukan pengkodean

Page 61: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

61

Page 62: Laporan tugas besar pbw

Mudafiq Riyan Pratama, S.KomTugas Akhir Pemrograman Berbasis Web

62

Aplikasi pembayaran dan pembelian kredit sepeda motor ini hanya bersifat program sangat sederhana dengan kasus yang sangat sederhana pula tentunya pengembangan lebih lanjut dibutuhkan diantaranya :

1. Dari segi tampilan, kreasi anda dibutuhkan untuk mempercatik tampilan supaya lebih menarik.

2. Fitur-fitur program, penambahan fitur yang belum diikut sertakan misalnya sistem akunting.

3. Tayangan data, pada program ini tidak disertakan bagaimana trik menampilkan data yang banyak dengan cara pembagian halaman tampil ( pagination ).

4. PopUp untuk mempermudah admin atau user melakukan transaksi dan lain-lain.