diff --git a/class/crud.php b/class/crud.php index c086684..088b345 100644 --- a/class/crud.php +++ b/class/crud.php @@ -1,11 +1,13 @@ -con = new PDO("mysql:host=$server;dbname=$db",$user,$pass); + $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } function simpan($tabel,$val){ $qw = "INSERT INTO $tabel VALUES ($val)"; @@ -22,10 +24,24 @@ function hapus($tabel,$property){ function tampil($select,$tabel,$property){ $qw = "SELECT $select FROM $tabel $property"; $tam = $this->con->query($qw); - return $tam; + return $tam; + } + function getKodePinjam() + { + $sql = "SELECT MAX(id_pinjam) as kode FROM detail_pinjam"; + $ex = $this->con->query($sql); + $dt = $ex->fetch(); + $kode = $dt['kode']; + + $nu = (int) substr($kode, 3,4); + $nu++; + + $char = "PNJ"; + $newid = $char . sprintf("%04s",$nu); + return $newid; } } - class input{ + class inputClass{ function input($type=null,$nama=null,$val=null,$property=null){ $input = ""; return $input; @@ -74,10 +90,9 @@ function form($sts=null,$action=null){ } } function base_url($folder){ - $url = "http://localhost:81/perpustakaan".$folder; + $url = "http://localhost:8080/perpustakaan".$folder; echo $url; } } $proses = new proses; - $form = new input; - ?> \ No newline at end of file + $form = new inputClass; diff --git a/content/cetak_kembali_buku.php b/content/cetak_kembali_buku.php index ee7c04d..11766d1 100644 --- a/content/cetak_kembali_buku.php +++ b/content/cetak_kembali_buku.php @@ -1,11 +1,11 @@ - Laporan Peminjaman Buku

Laporan Pengembalian Buku

-

Perpustakaan SMK Wikrama 1 Jepara

+

Perpustakaan SMK Wikrama 1 Jepara

@@ -19,7 +19,7 @@ tampil("*","detail_pinjam,anggota,buku,pengembalian,peminjaman","WHERE pengembalian.tgl_kembali BETWEEN '$_GET[tgl1]' AND '$_GET[tgl2]' AND pengembalian.id_pinjam = detail_pinjam.id_pinjam AND peminjaman.id_anggota = pengembalian.id_anggota AND pengembalian.id_anggota = anggota.id_anggota AND buku.id_buku = detail_pinjam.id_buku AND detail_pinjam.status = 'kembali' "); + $sql = $proses->tampil("anggota.nama,pengembalian.*,buku.judul,detail_pinjam.tgl_pinjam,detail_pinjam.lama_pinjam,detail_pinjam.denda","pengembalian","INNER JOIN detail_pinjam ON pengembalian.id_pinjam=detail_pinjam.id_pinjam INNER JOIN buku ON detail_pinjam.id_buku = buku.id_buku INNER JOIN anggota ON pengembalian.id_anggota=anggota.id_anggota WHERE pengembalian.tgl_kembali BETWEEN '$_GET[tgl1]' AND '$_GET[tgl2]' AND detail_pinjam.status = 'kembali' "); $no = 1; foreach ($sql as $data) { ?> @@ -27,16 +27,16 @@ - - + +
Denda
Rp.
- tampil("SUM(detail_pinjam.denda)","detail_pinjam,anggota,buku,pengembalian,peminjaman","WHERE pengembalian.tgl_kembali BETWEEN '$_GET[tgl1]' AND '$_GET[tgl2]' AND pengembalian.id_pinjam = detail_pinjam.id_pinjam AND peminjaman.id_anggota = pengembalian.id_anggota AND pengembalian.id_anggota = anggota.id_anggota AND buku.id_buku = detail_pinjam.id_buku AND detail_pinjam.status = 'kembali' "); + tampil("SUM(detail_pinjam.denda)","pengembalian","INNER JOIN detail_pinjam ON pengembalian.id_pinjam=detail_pinjam.id_pinjam INNER JOIN buku ON detail_pinjam.id_buku = buku.id_buku INNER JOIN anggota ON pengembalian.id_anggota=anggota.id_anggota WHERE pengembalian.tgl_kembali BETWEEN '$_GET[tgl1]' AND '$_GET[tgl2]' AND detail_pinjam.status = 'kembali' "); $jml = $qr->fetch(); ?> @@ -86,4 +86,4 @@ function cetak() { window.print(); } - \ No newline at end of file + diff --git a/content/detail_pinjam.php b/content/detail_pinjam.php index ebf4832..346d71c 100644 --- a/content/detail_pinjam.php +++ b/content/detail_pinjam.php @@ -1,9 +1,9 @@ -tampil("*","detail_pinjam","WHERE id_pinjam = '$_GET[id]'"); + $qr = $proses->tampil("detail_pinjam.*,anggota.nama","detail_pinjam","INNER JOIN peminjaman ON detail_pinjam.id_pinjam = peminjaman.id_pinjam INNER JOIN anggota ON peminjaman.id_anggota = anggota.id_anggota WHERE detail_pinjam.id_pinjam = '$_GET[id]'"); $dt = $qr->fetch(); - ?> + ?> @@ -12,7 +12,7 @@

daftar buku yang di pinjam

-

ID Pinjam

+

ID Pinjam : || Nama Peminjam :

@@ -100,10 +100,10 @@ } .content .table-detail td{ border-bottom: 1px solid #888; - height: 30px; + height: 30px; } .content .table-detail tr:hover{ background-color: #eeeeee; cursor: default; } - \ No newline at end of file + diff --git a/content/input_pinjam.php b/content/input_pinjam.php index bc3c21b..a08ac5f 100644 --- a/content/input_pinjam.php +++ b/content/input_pinjam.php @@ -1,18 +1,6 @@ getKodePinjam(); $date = date('Y-m-d'); $selisih = date('Y-m-d',strtotime('+7 day')); @@ -71,7 +59,7 @@
- +
@@ -115,4 +103,4 @@ border: 1px solid; cursor: pointer; } - \ No newline at end of file + diff --git a/content/tampil_jenis_b.php b/content/tampil_jenis_b.php index f84199d..1383493 100644 --- a/content/tampil_jenis_b.php +++ b/content/tampil_jenis_b.php @@ -1,4 +1,4 @@ -

Data Jenis Buku

@@ -10,7 +10,7 @@ - +
No.
@@ -61,4 +61,4 @@ - \ No newline at end of file + diff --git a/content/tampil_pinjam.php b/content/tampil_pinjam.php index f09042a..e6b59a8 100644 --- a/content/tampil_pinjam.php +++ b/content/tampil_pinjam.php @@ -1,4 +1,4 @@ -

Data Peminjaman Buku

@@ -22,25 +22,25 @@ Tanggal Transaksi Total Pinjam ID Anggota + Nama Action tampil("*", + $tamp = $proses->tampil("peminjaman.*,nama", "peminjaman", - ""); - + "INNER JOIN anggota ON peminjaman.id_anggota = anggota.id_anggota"); + $no=1; - foreach ($tamp as $data) { - - ?> + foreach ($tamp as $data) {?> +

Hapus

@@ -50,9 +50,9 @@ Detail - +

+

- \ No newline at end of file + diff --git a/proses/p_s_kembali.php b/proses/p_s_kembali.php index 1561505..f6bbd99 100644 --- a/proses/p_s_kembali.php +++ b/proses/p_s_kembali.php @@ -1,9 +1,9 @@ -tampil("*","pengembalian","WHERE id_pinjam = '$_POST[id_pinjam]' "); $d = $sqlp->fetch(); - $jml_denda = $d['jumlah_denda']+$_POST['jumlah_denda']; + $jml_denda = @$d['jumlah_denda']+$_POST['jumlah_denda']; $rowp = $sqlp->rowCount(); $qr = $proses->tampil("*","detail_pinjam","WHERE id_pinjam = '$_POST[id_pinjam]' AND status = 'pinjam'"); @@ -39,7 +39,7 @@ denda = '$_POST[denda]'"," id_detail_pinjam = '$_POST[id_detail_pinjam]'"); $kembalikan = $proses->simpan("pengembalian"," - '', + NULL, '$_POST[tgl_kembali]', '$_POST[denda]', '$_POST[id_anggota]', @@ -52,7 +52,7 @@ denda = '$_POST[denda]'"," id_detail_pinjam = '$_POST[id_detail_pinjam]'"); $kembalikan = $proses->simpan("pengembalian"," - '', + NULL, '$_POST[tgl_kembali]', '$_POST[denda]', '$_POST[id_anggota]', @@ -60,4 +60,3 @@ echo "berhasil"; } } - ?> \ No newline at end of file diff --git a/proses/p_simpan_buku.php b/proses/p_simpan_buku.php index 13c0aaa..aeaef1e 100644 --- a/proses/p_simpan_buku.php +++ b/proses/p_simpan_buku.php @@ -1,7 +1,7 @@ -simpan("buku"," - '', + NULL, '$_POST[judul_buku]', '$_POST[penerbit_buku]', '$_POST[thn_terbit_buku]', @@ -10,4 +10,4 @@ '$_POST[stok_buku]' "); echo "Berhasil"; - ?> \ No newline at end of file + ?> diff --git a/proses/p_simpan_dtl_pinjam.php b/proses/p_simpan_dtl_pinjam.php index ff4d2da..90b028d 100644 --- a/proses/p_simpan_dtl_pinjam.php +++ b/proses/p_simpan_dtl_pinjam.php @@ -1,4 +1,4 @@ -tampil("detail_pinjam.id_buku","detail_pinjam","WHERE detail_pinjam.id_pinjam = '$_POST[id_pinjam]' AND detail_pinjam.id_buku = '$_POST[id_buku]' AND detail_pinjam.status = 'pinjam'"); $data = $sql->fetch(); - $id_buku = $_POST['id_buku']; - if ($id_buku == $data['id_buku']) { + if ($_POST['id_buku'] === @$data['id_buku']) { echo "Gagal"; }else{ - $s_detail = $proses->simpan("detail_pinjam"," - '', + $proses->simpan("detail_pinjam"," + NULL, '$_POST[id_pinjam]', '$_POST[id_buku]', '$_POST[jumlah]', @@ -23,4 +22,4 @@ '$denda'"); echo "Berhasil"; } - ?> \ No newline at end of file + ?> diff --git a/proses/p_simpan_jenis.php b/proses/p_simpan_jenis.php index ea28dfe..f628eb9 100644 --- a/proses/p_simpan_jenis.php +++ b/proses/p_simpan_jenis.php @@ -1,8 +1,8 @@ -simpan("jenis"," - '', + NULL, '$_POST[nama_jenis_b]', '$_POST[keterangan_b]'"); echo "Berhasil"; - ?> \ No newline at end of file + ?> diff --git a/proses/p_simpan_pinjam.php b/proses/p_simpan_pinjam.php index c45b504..e7b6785 100644 --- a/proses/p_simpan_pinjam.php +++ b/proses/p_simpan_pinjam.php @@ -1,12 +1,10 @@ -tampil("*","peminjaman,detail_pinjam","WHERE peminjaman.id_anggota = '$_POST[id_anggota]' AND detail_pinjam.id_pinjam = peminjaman.id_pinjam AND detail_pinjam.status = 'pinjam'"); $data = $sql->fetch(); - $id_anggota = $_POST['id_anggota']; - - if ($id_anggota == $data['id_anggota']) { + if ($_POST['id_anggota'] === @$data['id_anggota']) { echo "Gagal"; }else{ $simpan = $proses->simpan("peminjaman"," @@ -16,4 +14,4 @@ '$_POST[id_anggota]'"); echo "Berhasil"; } - ?> \ No newline at end of file + ?> diff --git a/table/lap_kembali_buku.php b/table/lap_kembali_buku.php index b8b40e3..9d65b11 100644 --- a/table/lap_kembali_buku.php +++ b/table/lap_kembali_buku.php @@ -1,4 +1,4 @@ - @@ -12,7 +12,7 @@ tampil("*","detail_pinjam,anggota,buku,pengembalian,peminjaman","WHERE pengembalian.tgl_kembali BETWEEN '$_POST[tgl1]' AND '$_POST[tgl2]' AND pengembalian.id_pinjam = detail_pinjam.id_pinjam AND peminjaman.id_anggota = pengembalian.id_anggota AND pengembalian.id_anggota = anggota.id_anggota AND buku.id_buku = detail_pinjam.id_buku AND detail_pinjam.status = 'kembali' "); + $sql = $proses->tampil("anggota.nama,pengembalian.*,buku.judul,detail_pinjam.tgl_pinjam,detail_pinjam.lama_pinjam,detail_pinjam.denda","pengembalian","INNER JOIN detail_pinjam ON pengembalian.id_pinjam=detail_pinjam.id_pinjam INNER JOIN buku ON detail_pinjam.id_buku = buku.id_buku INNER JOIN anggota ON pengembalian.id_anggota=anggota.id_anggota WHERE pengembalian.tgl_kembali BETWEEN '$_POST[tgl1]' AND '$_POST[tgl2]' AND detail_pinjam.status = 'kembali' "); $no = 1; foreach ($sql as $data) { ?> @@ -20,9 +20,9 @@ - - - + + + diff --git a/table/lap_pinjam.php b/table/lap_pinjam.php index 64d4d45..46e93ce 100644 --- a/table/lap_pinjam.php +++ b/table/lap_pinjam.php @@ -1,4 +1,4 @@ -
Denda
Hari Rp.
diff --git a/table/lap_pinjam_buku.php b/table/lap_pinjam_buku.php index 5047bed..812cf57 100644 --- a/table/lap_pinjam_buku.php +++ b/table/lap_pinjam_buku.php @@ -1,4 +1,4 @@ -
diff --git a/table/table_pinjam.php b/table/table_pinjam.php index be0e5b0..bb6eb3c 100644 --- a/table/table_pinjam.php +++ b/table/table_pinjam.php @@ -1,18 +1,6 @@ -getKodePinjam(); if (isset($_GET['id_pinjam'])) { $id = $_GET['id_pinjam']; @@ -44,7 +32,7 @@ "buku,detail_pinjam", "WHERE detail_pinjam.id_pinjam = '$id' AND buku.id_buku = detail_pinjam.id_buku AND detail_pinjam.status = 'pinjam'"); - $row = $sql->rowCount(); + $row = $sql->rowCount(); foreach ($sql as $data) { ?> @@ -60,7 +48,7 @@
- +

Total Pinjam


@@ -98,4 +86,4 @@ function tam_pinjam(id) { } }) } - \ No newline at end of file + diff --git a/thickbox/input_anggota.php b/thickbox/input_anggota.php index a9eb444..4d173b9 100644 --- a/thickbox/input_anggota.php +++ b/thickbox/input_anggota.php @@ -1,4 +1,4 @@ -X

ID Anggota

- + " onclick="validation('id_anggota')" onchange="validation('id_anggota')" onkeyup="validation('id_anggota')">

Nama Anggota

- + " onclick="validation('nama_anggota')" onchange="validation('nama_anggota')" onkeyup="validation('nama_anggota')">

Alamat

- +

No Telephone

- + " onclick="validation('no_telephon')" onchange="validation('no_telephon')" onkeyup="validation('no_telephon')">

Tanggal Mendaftar

- + " onclick="validation('tgl_daftar')" onchange="validation('tgl_daftar')" onkeyup="validation('tgl_daftar')" readonly>

Tanggal Kadaluarsa

- + " onclick="validation('tgl_expired')" onchange="validation('tgl_expired')" onkeyup="validation('tgl_expired')"> - \ No newline at end of file + diff --git a/thickbox/tambah_buku.php b/thickbox/tambah_buku.php index ac67a6d..54f90c8 100644 --- a/thickbox/tambah_buku.php +++ b/thickbox/tambah_buku.php @@ -1,4 +1,4 @@ - X

Judul Buku

- + " onclick="validation('judul')" onchange="validation('judul')" onkeyup="validation('judul')">

Penerbit

- + " onclick="validation('penerbit')" onchange="validation('penerbit')" onkeyup="validation('penerbit')">

Tahun Terbit

+ " onclick="validation('harga')" onchange="validation('harga')" onkeyup="validation('harga')">

Jenis Buku

Stok Buku

- + " onclick="validation('stok')" onchange="validation('stok')" onkeyup="validation('stok')">

- \ No newline at end of file + diff --git a/thickbox/tambah_jenis.php b/thickbox/tambah_jenis.php index a5e0e1f..a5f24fa 100644 --- a/thickbox/tambah_jenis.php +++ b/thickbox/tambah_jenis.php @@ -1,4 +1,4 @@ -X

Nama Jenis Buku

- + " onclick="validation('nama_jenis')" onchange="validation('nama_jenis')" onkeyup="validation('nama_jenis')">

No Rak Buku

- + " onclick="validation('keterangan')" onchange="validation('keterangan')" onkeyup="validation('keterangan')"> - \ No newline at end of file +