Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(session_id() == '') {
- session_start();
- $agenid=$_SESSION['agenid'];
- if(session_is_registered('agenid')){
- }
- else{
- header("location:admin.php");
- }
- }
- ?>
- <div class="menu">
- <?php include 'menu.php';?>
- </div>
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Transaksi</title>
- <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
- <link rel="stylesheet" href="/resources/demos/style.css">
- <script>
- $(function() {
- $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' }).val();
- });
- </script>
- </head>
- <head>
- <meta charset="utf-8">
- <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
- <link rel="stylesheet" href="/resources/demos/style.css">
- <script>
- $(function() {
- $( "#datepicker2" ).datepicker({ dateFormat: 'yy-mm-dd' }).val();
- });
- </script>
- </head>
- <body>
- <form method="GET" action="transaksi.php">
- <p>Pencarian berdasarkan tanggal: </p>
- <p>
- <label style="color:#FFF;" for="from">Dari</label>
- Dari:<input type="text" id="datepicker" name="dp1">
- <label style="color:#FFF;" for="from">Sampai</label>
- Sampai:<input type="text" id="datepicker2" name="dp2">
- <input name="tcari" type="submit" value="cari" />
- </p>
- <p> </p>
- <table width="734" border='0' align='center'>
- <tr bgcolor=#ADFF2F><th width="34">No</th><th width="97">Tanggal</th><th width="88">AGENID</th><th width="71">Nominal</th><th width="129">Nomor</th><th width="81">Status</th><th width="220">VSN</th>
- <?php
- include 'koneksi.php';
- $from = $_GET['dp1'];
- $to = $_GET['dp2'];
- if (isset($_POST['tcari'])) {
- $dataPerPage = 6;
- if(isset($_GET['paging']))
- {
- $noPage = $_GET['paging'];
- }
- else $noPage = 1;
- $offset = ($noPage - 1) * $dataPerPage;
- $query = "SELECT * from log_transaksi where tanggal >= DATE_FORMAT('" . $from . "', '%Y-%m-%d') AND tanggal <= DATE_FORMAT('" . $to . "', '%Y-%m-%d') AND agenid ='$agenid' ORDER BY tanggal,jam ASC LIMIT $offset, $dataPerPage";
- $exe = mysql_query($query);
- $query = "SELECT COUNT(*) AS jumData FROM product ";
- $hasil = mysql_query($query);
- $data = mysql_fetch_array($hasil);
- $jumData = $data['jumData'];
- $jumPage = ceil($jumData/$dataPerPage);
- $no = 1;
- $baru = "#FFFF00";
- $lama="#FFFF00";
- while($row = mysql_fetch_assoc($exe)){
- $a = $row['tanggal'];
- $b = $row['jam'];
- $c = $row['agenid'];
- $d = $row['denom'];
- $e = $row['nomor'];
- $f = $row['harga'];
- $g = $row['status'];
- $h = $row['vsn'];
- // beri warna selang seling
- if(($no % 2)==0)$warna = $baru;
- else $warna = $lama;
- echo "<tr bgcolor=$warna align=center>
- <td>$no</td>
- <td>$a<br>$b</td>
- <td>$c</td>
- <td bgcolor=blue>$d<br>$f</td>
- <td>$e</td>
- <td>$g</td>
- <td>$h</td>
- </tr>";
- $no++;
- if ($noPage > 1) echo "<a href='".$_SERVER['PHP_SELF']."?paging=".($noPage-1)."'><< Prev</a>";
- // memunculkan nomor halaman dan linknya
- for($page = 1; $page <= $jumPage; $page++)
- {
- if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage))
- {
- if (($showPage == 1) && ($page != 2)) echo "...";
- if (($showPage != ($jumPage - 1)) && ($page == $jumPage)) echo "...";
- if ($page == $noPage) echo " <b>".$page."</b> ";
- else echo " <a href='".$_SERVER['PHP_SELF']."?paging=".$page."'>".$page."</a> ";
- $showPage = $page;
- }
- }
- // menampilkan link next
- if ($noPage < $jumPage) echo "<a href='".$_SERVER['PHP_SELF']."?paging=".($noPage+1)."'>Next >></a>";
- }}
- ?>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement