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 @@
Denda
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 @@
-
-
+
+
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 @@
@@ -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 @@
-
+
@@ -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 @@
Denda
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 @@