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.
144 lines
3.9 KiB
144 lines
3.9 KiB
<?php
|
|
include "header.php";
|
|
|
|
// 設置一個空陣列來放資料
|
|
$data = array();
|
|
|
|
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"];
|
|
|
|
$sql = "select department_id, name from department";
|
|
$res = mysqli_query($link, $sql);
|
|
while ($row = mysqli_fetch_row($res)) {
|
|
$department_arr[$row[0]] = $row[1];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
// sql語法存在變數中
|
|
$sql = "select * from bargain order by id";
|
|
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link,$sql);
|
|
?>
|
|
|
|
<!-- <a href="create.php"><h2>新增</h2></a> -->
|
|
<p>
|
|
<a href="bargain-create.php?function_name=bargain&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
</a>
|
|
</p>
|
|
|
|
<?php
|
|
if($data):
|
|
if($_SERVER["REQUEST_METHOD"] == "POST"){
|
|
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){
|
|
echo "<p class='error'>Please fill up the required field!</p>";
|
|
} else {
|
|
header("Location:bargain-index.php");
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<style>
|
|
table {
|
|
table-layout:fixed;
|
|
width: 100%;
|
|
}
|
|
|
|
td {
|
|
word-wrap:break-word;
|
|
}
|
|
|
|
img {
|
|
width:125px;
|
|
}
|
|
|
|
.width_style_1 {
|
|
width:125px;
|
|
}
|
|
|
|
table{
|
|
width:100%;
|
|
}
|
|
#table_index_filter{
|
|
float:right;
|
|
}
|
|
#table_index_paginate{
|
|
float:right;
|
|
}
|
|
label {
|
|
display: inline-flex;
|
|
margin-bottom: .5rem;
|
|
margin-top: .5rem;
|
|
|
|
}
|
|
|
|
</style>
|
|
<div style="overflow-x:auto;">
|
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>申請單號</th>
|
|
<th>作成單位</th>
|
|
<th>作成者</th>
|
|
<th>收文單位</th>
|
|
<th>回答期限</th>
|
|
<th>項目名稱</th>
|
|
<th>類別</th>
|
|
<th>品牌</th>
|
|
<th>型號</th>
|
|
<th>預估數量</th>
|
|
<th>建檔人</th>
|
|
<th>建檔時間</th>
|
|
<th>修改</th>
|
|
<th>刪除</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach($data as $data) : ?>
|
|
<tr>
|
|
<td><?php echo $data['id']; ?></td>
|
|
<td><?php echo $data['bargainno']; ?></td>
|
|
<td><?php echo $department_arr[$data['department_id']]; ?></td>
|
|
<td><?php echo $data['proposer']; ?></td>
|
|
<td><?php echo $department_arr[$data['receiver']]; ?></td>
|
|
<td><?php echo $data['response_dt']; ?></td>
|
|
<td><?php echo $data['item']; ?></td>
|
|
<td><?php echo $category_arr[$data['category']]; ?></td>
|
|
<td><?php echo $data['brand']; ?></td>
|
|
<td><?php echo $data['model']; ?></td>
|
|
<td><?php echo number_format($data['quantity']); ?></td>
|
|
<td><?php echo $data['creater']; ?></td>
|
|
<td><?php echo $data['create_at']; ?></td>
|
|
<td>
|
|
<p>
|
|
<a href="bargain-edit.php?id=<?php echo $data['id']; ?>&function_name=bargain&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-pencil"></span>
|
|
</a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a href="bargain-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')">
|
|
<span class="glyphicon glyphicon-remove"></span>
|
|
</a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
else:
|
|
echo "<h2>There is no record!</h2>";
|
|
endif;
|
|
|
|
#代表結束連線
|
|
mysqli_close($link);
|
|
|
|
include "footer.php";
|
|
?>
|