You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.7 KiB

<?php
include "../header.php";
$opt_data_arr = [];
$sql = "select * from option_price where status = 'Y' order by kind, id";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["memo"] = $row["memo"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["optional"] = $row["optional"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"];
}
mysqli_free_result($res);
?>
<style>
.container {
padding-top: 10px !important;
}
#exTab1 table {
background-color : white;
padding : 5px 15px;
}
.kind-col {
color:brown;
}
</style>
<script>
$(function(){
$('#table_index2').DataTable({
"language": {
"zeroRecords": "沒有符合的結果",
"search": "搜尋",
"lengthMenu": "顯示 _MENU_ 項結果",
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
},
"searching": true,
"pageLength": 50
});
//$('#table_index2_length').hide();
//$("#table_index2_paginate").hide();
})
</script>
<div style="overflow-x:auto;">
<div class="container"><h2>OPTION價格查詢</h2></div>
<div id="exTab1" class="container">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr class="kind-col">
<th scope="col" nowrap>名稱</th>
<th scope="col" nowrap>規格</th>
<th scope="col" nowrap>備註</th>
<th scope="col" nowrap>配置</th>
<th scope="col" nowrap>單位</th>
<th scope="col" nowrap>定價</th>
</tr>
</thead>
<tbody>
<?php
foreach ($opt_data_arr as $k => $v) {
foreach ($v as $k2 => $v2) {
foreach ($v2 as $k3 => $v3) {
if ($v3["optional"] == "1") $optional = "標";
elseif ($v3["optional"] == "2") $optional = "選";
echo "<tr>";
echo "<td>".$k2."</td>";
echo "<td>".$v3["spec"]."</td>";
echo "<td>".$v3["memo"]."</td>";
echo "<td>".$optional."</td>";
echo "<td>".$v3["unit"]."<input type='hidden' name='option_id' value='".$k3."'></td>";
echo "<td>".number_format($v3["price"])."</td>";
echo "</tr>";
}
}
}
?>
</tbody>
</table>
</div>
</div>
<?php
mysqli_close($link);
include "../footer.php";
?>