-
Notifications
You must be signed in to change notification settings - Fork 7
/
pilihcoa.php
75 lines (70 loc) · 2.41 KB
/
pilihcoa.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<html>
<head>
<title>Daftar Buku</title>
<style>
body,table,input{
font-size:12px
}
</style>
<script language="javascript">
function pickCOA(id,skada,untush,name){
parent.pickCOA(id,skada,untush,name);
}
</script>
</head>
<body>
<?php
require_once('phppagination.class.php');
include '../include/globalx.php';
$nTotalItems = 0;
$nItemsPerPage = 10; // set length of page
// get page number passed via GET method
if (isset($_GET['page']))
$nCurrentPage = $_GET['page'];
else
$nCurrentPage = 1;
$sSQL = "select count(*) from coax WHERE transaksi = 1 AND unit = '1002' AND cabang = 10";
$result = mysql_query($sSQL)
or die ("Invalid query '$sSQL'");
$row=mysql_fetch_row($result);
$nTotalItems=$row[0];
// create pagination object
$oPagination = new phpPagination ($nTotalItems, $nItemsPerPage);
$SQL = "select * from coax WHERE transaksi = 1 AND unit = '1002' AND cabang = 10 LIMIT "
.($nCurrentPage-1)*$nItemsPerPage
.", $nItemsPerPage";
if(isset($_POST['search'])){
$SQL = "select * from coax WHERE transaksi = 1 AND unit = '1002' AND cabang = 10 AND (name LIKE '%$_POST[search_name]%' OR coa LIKE '%$_POST[search_name]%') LIMIT "
.($nCurrentPage-1)*$nItemsPerPage
.", $nItemsPerPage";
}
$query = mysql_query($SQL);
//echo $SQL;
?>
<form action="" method="post">
Cari nama: <input type="text" name="search_name" size="15" value="<?php echo @$_POST['search_name']; ?>" />
<input type="submit" name="search" value="Cari" />
</form>
<table width="100%" bgcolor="#000000" cellspacing="1" cellpadding="3">
<tr bgcolor="#DDDDDD">
<th>COA</th>
<th>Nama</th>
</tr>
<?php while($row = mysql_fetch_object($query)): ?>
<?php
$jkel = "Laki-laki";
if($row->jkel=="P"){ $jkel = "Perempuan"; }
?>
<tr bgcolor="#FFFFFF">
<!-- fungsi selectBuku di deklarasikan di index.html dan file ini bisa memanggilnya selama file ini
dipanggil oleh thickbox dari index.html, fungsi dari selectPegawai adalah untuk memasukan nilai
NIP dan nama pegawai dari masing-masing baris di daftar pegawai ini -->
<td align="center"><a href="javascript:pickCOA(<?php echo $row->coa?>,'<?php echo $row->coa?>','<?php echo $row->coa?>','<?php echo $row->name?>')"><?php echo $row->coa?></a></td>
<td><?php echo $row->name?></td>
</tr>
<?php endwhile; ?>
</table>
Halaman : <?php // print pagination for current page
echo $oPagination->GetHtml($nCurrentPage)."\n"; ?>
</body>
</html>