<td>Kode</td> <td>Judul</td> <td>Tgl. Pinjam</td> <td>Jatuh Tempo</td> <td>Tgl. Kembali</td> <td>Status</td> </tr> </thead> <?php $book = new buku(); ?> <?php $i = 1; $kembali = 0; while ($p = mysql_fetch_array($sql)) { $book->setKode($p['buku']); if ($p['kembali'] == 0) { $kembali++; } ?> <tr> <td><?php echo $i; ?> </td> <td><a class="list" href='#' onclick='window.location="?pencarian=<?php echo $p['siswa']; ?> &where=siswa&kembali=all<?php //echo $kembaline;
<table width="100%" class="table table-striped table-hover"> <thead style="font-weight:bold;"> <tr> <td>Kode</td> <td>Judul</td> <td>Tgl.Pinjam</td> <td>Jatuh Tempo</td> <td></td> </tr> </thead> <tbody id="tbody"> <?php $id = 1; $book = new buku(); while ($d = mysql_fetch_array($sql)) { $book->setKode($d["buku"]); ?> <tr class="item" id="row-<?php echo $id; ?> "> <td><?php echo $d["buku"]; ?> </td> <td><?php echo $book->getJudul(); ?> </td> <td><?php echo $d["tgl_pinjam"];
//echo "SIswa akan meminjam buku $buku <br>"; $siswa = new siswa(); $buku = new buku(); $buku->setKode($_GET["buku"]); /*******Simpan Peminjaman**************/ if ($_GET["mode"] == "pinjam") { $dsiswa = $_GET["siswa"]; $dbuku = $_GET["buku"]; $kembali = $_GET["kembali"]; //Inisialisasi data siswa $cSiswa = new siswa(); $cSiswa->setInduk($dsiswa); $meminjam = $cSiswa->getMeminjam() + 1; //Inisialisasi data buku $cBuku = new buku(); $cBuku->setKode($dbuku); $count = $cBuku->getCount() + 1; //Petugas $ptgs = $_SESSION['uid']; //Sql Query $peminjaman = mysql_query("INSERT INTO tbl_peminjaman SET siswa=\"{$dsiswa}\", buku=\"{$dbuku}\", tgl_tempo=\"{$tgl_kembali}\", tgl_pinjam=\"{$tgl_pinjam}\", id_petugas=\"{$ptgs}\""); //Debug // echo "INSERT INTO tbl_peminjaman SET siswa=\"$dsiswa\", buku=\"$dbuku\", tgl_kembali=\"2013-01-01\", tgl_pinjam=\"2013-01-01\", id_petugas=\"99\""; if ($peminjaman) { $buku = mysql_query("UPDATE tbl_buku SET status=\"0\", peminjam=\"{$dsiswa}\", count=\"{$count}\" WHERE kd_buku=\"{$dbuku}\""); if ($buku) { $qSiswa = mysql_query("UPDATE tbl_anggota SET count=\"{$meminjam}\" WHERE no_induk=\"{$dsiswa}\""); if ($qSiswa) { catat(get_pustakawan($ptgs), "Melayani " . $cSiswa->getNama() . " meminjam " . $cBuku->getJudul()); echo "<script>\$('#pop-pinjam').modal('hide');</script>"; echo "<script type='text/javascript'>window.location.reload(true);</script>";
$hari2 = $x['0']; $bulan2 = $x['1']; $tahun2 = date('Y'); $bln2 = $indo[$bulan2 - 1]; //**waktu kembali yg sudah fix**// $kembali = "{$hari2} {$bln2} {$tahun2}"; //run $kemarin = $waktu = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + $tglK, date("Y"))); //echo $kemarin."<br>"; $temSql = mysql_query("SELECT * FROM tbl_peminjaman WHERE kembali='0' AND tgl_tempo='{$kemarin}'"); $count = 0; if ($tglK < 0) { $book = new buku(); while ($l = mysql_fetch_array($temSql)) { $sis = $l['siswa']; $book->setKode($l['buku']); //echo "------------------".$sis."<br>"; $buku = mysql_real_escape_string($l['buku']); $judul = $book->getJudul(); $tgl = $l['tgl_tempo']; //echo "------------------ $tgl <br>"; $si = mysql_query("SELECT no_induk, nama FROM tbl_anggota WHERE no_induk='{$sis}'"); $sisw = mysql_fetch_array($si); $sis = mysql_real_escape_string($sisw['nama']); $indk = $sisw['no_induk']; $key = md5($sis . $buku . $tgl); $c = mysql_query("SELECT * FROM tbl_telat WHERE kunci = '{$key}'"); $ce = mysql_num_rows($c); if ($ce == '0') { // echo "Belum ada record<br>"; // echo "Kode $key | $sis memijam buku $buku dengan judul $judul dan jatuh tempo pada tanggal $tgl<br><br>";