01.
<?php
02.
$strSQL
= "SELECT *
03.
FROM tb_equipment
04.
INNER JOIN tb_unit
05.
ON tb_unit.Unit_id = tb_equipment.Unit_id";
06.
$objQuery
= mysql_query(
$strSQL
)
or
die
(mysql_error());
07.
?>
08.
<!--กันBug จำนวนเบิก = 0 -->
09.
<script type=
"text/javascript"
>
10.
function
fncSubmit()
11.
{
12.
if
(document.getElementById(
'txtQty'
).value == 0)
13.
{
14.
alert(
'กรุุณาเลือกจำนวนเบิก'
);
15.
return
false;
16.
}
17.
}
18.
</script>
19.
<table id=
'example'
align=
"center"
class
=
"table table-striped table-hover"
cellpadding=
"0"
cellspacing=
"0"
>
20.
<thead>
21.
<th
class
=
"info"
><center>รหัสวัสดุ</center></th>
22.
<th
class
=
"info"
><center>รายการวัสดุ</center></th>
23.
<th
class
=
"info"
><center>คงเหลือ</center></th>
24.
<th
class
=
"info"
><center>หน่วยนับ</center></th>
25.
<th
class
=
"info"
><center>จำนวนเบิก</center></th>
26.
<th
class
=
"info"
><center>ดำเนินการ</center></th>
27.
</thead>
28.
<?php
29.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
30.
{
31.
?>
32.
<tr align=
"center"
>
33.
<form action=
"order.php?<?=$result["
preface_subject
"];?>"
method=
"post"
onSubmit=
"JavaScript:return fncSubmit();"
>
34.
<td><?php
echo
$objResult
[
"Eq_id"
];?></td>
35.
<td><?php
echo
$objResult
[
"Eq_name"
];?></td>
36.
<td><?php
echo
$objResult
[
"Eq_total"
];?></td>
37.
<td><?php
echo
$objResult
[
"Unit_name"
];?></td>
38.
<td><input type=
"hidden"
name=
"txtProductID"
value=
"<?php echo $objResult["
Eq_id
"];?>"
size=
"2"
>
39.
<select id=
"txtQty"
name=
"txtQty"
class
=
"form-control"
>
40.
<?php
for
(
$qty
=0;
$qty
<=20;
$qty
++)
41.
{
42.
?>
43.
<option value=
"<?php echo $qty;?>"
><center><?php
echo
$qty
;?></center></option>
44.
<?php
45.
}
46.
?>
47.
</select>
48.
</td>
49.
<td
class
=
"col-md-2"
><input type=
"submit"
id=
"request"
name=
"request"
class
=
"btn btn-info btn-sm"
value=
"เบิกวัสดุ"
></td>
50.
</form>
51.
</tr>
52.
<?php
53.
}
54.
?>
55.
</table>