/
persediaan_awal_load.php
198 lines (174 loc) · 5.6 KB
/
persediaan_awal_load.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
require_once('../../../../../config/config.php');
die_login();
die_app('M');
die_mod('M28');
die_ha('M28','R');
$conn = conn($sess_db);
die_conn($conn);
$per_page = (isset($_REQUEST['per_page'])) ? max(1, $_REQUEST['per_page']) : 20;
$page_num = (isset($_REQUEST['page_num'])) ? max(1, $_REQUEST['page_num']) : 1;
$s_opf1 = (isset($_REQUEST['s_opf1'])) ? clean($_REQUEST['s_opf1']) : '';
$s_opv1 = (isset($_REQUEST['s_opv1'])) ? clean($_REQUEST['s_opv1']) : '';
$status_otorisasi = (isset($_REQUEST['status_otorisasi'])) ? clean($_REQUEST['status_otorisasi']) : '';
$tombol = (isset($_REQUEST['tombol'])) ? clean($_REQUEST['tombol']) : '';
$nama_tombol = (isset($_REQUEST['nama_tombol'])) ? clean($_REQUEST['nama_tombol']) : '';
$query_search = '';
if ($status_otorisasi == 0)
{
$query_search .= "WHERE STATUS_STOK = '0' AND TERJUAL = '0' ";
}
else if ($status_otorisasi == 1)
{
$query_search .= "WHERE STATUS_STOK = '1' AND TERJUAL = '0' ";
}
else if ($status_otorisasi == 2)
{
$query_search .= "WHERE STATUS_STOK = '1' AND TERJUAL = '1' ";
}
else if ($status_otorisasi == 3)
{
$query_search .= "WHERE STATUS_STOK = '1' AND TERJUAL = '2' ";
}
if ($s_opv1 != '')
{
$query_search .= " AND $s_opf1 LIKE '%$s_opv1%' ";
}
# Pagination
$query = "
SELECT
COUNT(s.KODE_BLOK) AS TOTAL
FROM
STOK s
LEFT JOIN TIPE t ON s.KODE_TIPE = t.KODE_TIPE
LEFT JOIN HARGA_BANGUNAN hb ON s.KODE_SK_BANGUNAN = hb.KODE_SK
$query_search
";
$total_data = $conn->Execute($query)->fields['TOTAL'];
$total_page = ceil($total_data/$per_page);
$page_num = ($page_num > $total_page) ? $total_page : $page_num;
$page_start = (($page_num-1) * $per_page);
# End Pagination
?>
<table id="pagging-1" class="t-control">
<tr>
<td>
<input type="button" id="upload" value=" Upload Data Stok ">
<input type="button" id="tambah" value=" Tambah ">
<input type="button" id="hapus" value=" Hapus ">
<input type="button" id="<?php echo $tombol; ?>" value=" <?php echo $nama_tombol; ?> ">
</td>
<td class="text-right">
<input type="button" id="prev_page" value=" < ">
Hal : <input type="text" name="page_num" size="5" class="page_num apply text-center" value="<?php echo $page_num; ?>">
Dari <?php echo $total_page ?>
<input type="hidden" id="total_page" value="<?php echo $total_page; ?>">
<input type="button" id="next_page" value=" > ">
</td>
</tr>
</table>
<table class="t-data w90">
<tr>
<th rowspan="2"><input type="checkbox" id="cb_all"></th>
<th rowspan="2" >VIRTUAL ACCOUNT</th>
<th rowspan="2">KODE BLOK</th>
<th rowspan="2">LUAS <br /> SEMI GROSS (M²)</th>
<th rowspan="2">TOWER</th>
<th rowspan="2">JENIS UNIT</th>
<th rowspan="2">TIPE</th>
<th rowspan="2">CASH KERAS</th>
<th colspan="4">HARGA (Incl PPN)</th>
<th rowspan="2">STATUS</th>
</tr>
<tr>
<th>CB 36X</th>
<th>CB 48X</th>
<th>KPA 24X 40%</th>
<th>KPA 36X 40%</th>
</tr>
<?php
if ($total_data > 0)
{
$query = "
SELECT
s.NO_VA,
s.KODE_BLOK,
s.LUAS_BANGUNAN,
s.STATUS_STOK,
s.TERJUAL,
t.TIPE_BANGUNAN,
hs.HARGA_CASH_KERAS,
hs.CB36X,
hs.CB48X,
hs.KPA24X,
hs.KPA36X,
LOKASI,
JENIS_UNIT
FROM
STOK s
LEFT JOIN TIPE t ON s.KODE_TIPE = t.KODE_TIPE
LEFT JOIN HARGA_SK hs ON s.KODE_SK = hs.KODE_SK AND s.KODE_BLOK = hs.KODE_BLOK
LEFT JOIN LOKASI h ON s.KODE_LOKASI = h.KODE_LOKASI
LEFT JOIN JENIS_UNIT i ON s.KODE_UNIT = i.KODE_UNIT
$query_search
ORDER BY s.NO_VA ASC
";
$obj = $conn->SelectLimit($query, $per_page, $page_start);
while( ! $obj->EOF)
{
$id = $obj->fields['KODE_BLOK'];
if ($obj->fields['STATUS_STOK'] == '0' AND $obj->fields['TERJUAL'] == '0'){
$status = 'STOK BELUM SIAP JUAL';
}else
if ($obj->fields['STATUS_STOK'] == '1' AND $obj->fields['TERJUAL'] == '0'){
$status = 'STOK SUDAH SIAP JUAL';
}else
if ($obj->fields['STATUS_STOK'] == '1' AND $obj->fields['TERJUAL'] == '1'){
$status = 'STOK SUDAH DI RESERVE';
}else
if ($obj->fields['STATUS_STOK'] == '1' AND $obj->fields['TERJUAL'] == '2'){
$status = 'STOK SUDAH TERJUAL';
}
?>
<tr class="onclick" id="<?php echo $id; ?>">
<td class="notclick text-center"><input type="checkbox" name="cb_data[]" class="cb_data" value="<?php echo $id; ?>"></td>
<td><?php echo $obj->fields['NO_VA']; ?></td>
<td class="text-center"><?php echo $id; ?></td>
<td class="text-center"><?php echo to_decimal($obj->fields['LUAS_BANGUNAN']); ?></td>
<td><?php echo $obj->fields['LOKASI']; ?></td>
<td><?php echo $obj->fields['JENIS_UNIT']; ?></td>
<td><?php echo $obj->fields['TIPE_BANGUNAN']; ?></td>
<td class="text-right"><?php echo to_money($obj->fields['HARGA_CASH_KERAS']); ?></td>
<td class="text-right"><?php echo to_money($obj->fields['CB36X']); ?></td>
<td class="text-right"><?php echo to_money($obj->fields['CB48X']); ?></td>
<td class="text-right"><?php echo to_money($obj->fields['KPA24X']); ?></td>
<td class="text-right"><?php echo to_money($obj->fields['KPA36X']); ?></td>
<td class="text-left"><?php echo $status ?></td>
</tr>
<?php
$obj->movenext();
}
}
?>
</table>
<table id="pagging-2" class="t-control "></table>
<script type="text/javascript">
jQuery(function($) {
$(document).on('click', 'tr.onclick td:not(.notclick)', function(e) {
e.preventDefault();
var id = $(this).parent().attr('id');
showPopup1('Ubah', id);
return false;
});
/* -- BUTTON -- */
$('#pagging-2').html($('#pagging-1').html());
$('#total-data').html('<?php echo $total_data; ?>');
$('#per_page').val('<?php echo $per_page; ?>');
$('.page_num').inputmask('integer');
t_strip('.t-data');
});
</script>
<?php
close($conn);
exit;
?>