-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_pemesanan.php
176 lines (110 loc) · 4.07 KB
/
view_pemesanan.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<div class="col-md-12" style="text-align: center; margin-left: 2%;" >
<?php
include "koneksi.php";
$nama_klien=$_SESSION['nama_klien'];
$per_page=10;
if (isset($_GET['pg'])) {
$page = $_GET['pg'];
}else {
$page=1;
}
// Page will start from 0 and Multiple by Per Page
$start_from = ($page-1) * $per_page;
$query_limit = "LIMIT $start_from, $per_page";
$query = "SELECT * FROM pesan WHERE nama_klien='$nama_klien'
AND konfirm = 0 AND fixed = 0 ";
$sql = mysqli_query($connect,$query);
?>
<div class="box">
<h2>PEMESANAN</h2>
<?php
$sqlNama = "SELECT * FROM pesan WHERE nama_klien = '$nama_klien' ";
$query = mysqli_query($connect,$sqlNama);
$tmp = mysqli_fetch_array($query);
?>
<div class="panel panel-default">
<div class="panel-body text-left" style="background-color: #E5E4E2">
<table>
<tr>
<td align="left">NIK : <?php echo $tmp['nik']; ?></td>
</tr>
<tr>
<td align="left">Nama Pemesan : <?php echo $tmp['nama_klien']; ?></td>
</tr>
</table>
</div>
</div>
<br>
<br>
<table class='table table-stripted-bordered'>
<thead>
<tr>
<th>No</th>
<th>Tanggal</th>
<th>Kategori</th>
<th>Tarif</th>
<th>Detail</th>
</tr>
</thead>
<?php
$no = 1;
$count = mysqli_num_rows($sql);
if($count<1){
echo "<tr><td colspan='9'><center>Data Tidak Ditemukan!</center></td></tr>";
}else{
while($data=mysqli_fetch_array($sql,MYSQLI_BOTH)){
?>
<tr>
<td align="left"><?php echo $no++; ?></td>
<td align="left"><?php echo $data['tgl']; ?></td>
<td align="left"><?php echo $data['kategori']; ?></td>
<td align="left">Rp. <?php echo number_format($data['harga']); ?></td>
<td width="50"><a id="recruit_detail" href="index.php?pg=detail&&id=<?php echo $data['id_pesan'];?>"><span class="glyphicon glyphicon-edit"></span></a>
<a id="actdelete" href="proses_pesanan.php?del=1&id=<?php echo $data['id_pesan'];?>"><span class="glyphicon glyphicon-trash"></span></a></td>
</tr>
<?php
}
}
?>
</table>
<?php
//sum harga
$sqlSum = "SELECT SUM(harga) as total FROM pesan
WHERE nama_klien = '$nama_klien' AND konfirm = 0 AND fixed = 0";
$query = mysqli_query($connect,$sqlSum);
$total = mysqli_fetch_array($query);
?>
<form action="proses_bayar.php" method="POST">
<table class="table table-stripted-bordered">
<tr>
<td>Total Pembayaran (Rp. )</td><td>:</td><td><input type="text" name="total" id="total" class="form-control responsive" value="<?php echo $total['total']; ?>" readonly="readonly" ></td>
</tr>
<input type="hidden" name="nik" class="form-control responsive" value="<?php echo $tmp['nik']; ?>" >
<input type="hidden" name="nama" class="form-control responsive" value="<?php echo $tmp['nama_klien']; ?>" >
<!-- <td>Bayar (Rp. )</td><td>:</td><td><input type="text" name="bayar" id="bayar" class="form-control responsive" value="" ></td>
</tr>
<td>Kembali (Rp. )</td><td>:</td><td><input type="text" name="kembali" id="kembali" class="form-control responsive" value="" ></td> -->
</tr>
</table>
<div class="col-md-8">
<center><input type="submit" name="submit" class="btn btn-warning" /></center>
</form>
<script type="text/javascript">
var total_form = document.getElementById('total');
var total = parseInt(total_form.value);
var bayar_form = document.getElementById('bayar');
bayar_form.onkeyup = function(){
var total_form = document.getElementById('total');
var total = parseInt(total_form.value);
// var bayar_form = document.getElementById('bayar');
// var bayar = parseInt(bayar_form.value);
// var kembali_form = document.getElementById('kembali');
// var kembali = parseInt(kembali_form.value);
// var kembalian = 0 ;
// kembalian = bayar - total;
// kembali_form.value = kembalian;
}
</script>
</div>
</div>
</div>