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.
 
 
 
 
 
 

190 lines
6.3 KiB

<?php
// 載入db.php來連結資料庫
require_once "database.php";
include "header.php";
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$sql = "select * from pricereview_main order by id";
$data = mysqli_query($link,$sql);
?>
<p>
<a href="pricereview-create.php" 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:pricereview-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>
<th>修改</th>
<th>刪除</th>
</tr>
</thead>
<tbody>
<?php
foreach($data as $data) :
$allow_st = "";
if (!$data["checker_1"] && !$data["checker_2"] && !$data["checker_3"]) $allow_st = 1;
else if (!$data["checker_2"] && !$data["checker_3"]) $allow_st = 2;
else if (!$data["checker_3"]) $allow_st = 3;
?>
<tr>
<td><?php echo $data['id']; ?></td>
<td><?php echo $data['contractno']; ?></td>
<td><?php echo $data['person']; ?></td>
<td><?php echo $data['company']; ?></td>
<td><?php echo $data['case_name']; ?></td>
<td><?php echo $data['compete']; ?></td>
<td><?php echo number_format($data['price_lowest']); ?></td>
<td><?php echo number_format($data['price_total']); ?></td>
<td><?php echo $data['predeal_date']; ?></td>
<td><?php echo $data['facilitok_date']; ?></td>
<td><?php echo $data['creater']; ?></td>
<td><?php echo $data['create_dt']; ?></td>
<td>
<?php
if ($data["checker_1_result"]) {
echo "<a href=\"pricereview-check.php?st=1&id=".$data["id"]."\" class=\"btn btn-lg\">";
if ($data["checker_1_result"] == "Y") {
echo "<span class=\"glyphicon glyphicon-ok\" title=\"通過\"></span></a>";
} else {
echo "<span class=\"glyphicon glyphicon-ban-circle\" title=\"拒絕\"></span></a>";
}
echo "<br>".$data["checker_1"]."<br>".$data["checker_1_dt"];
} else {
echo "<a href=\"pricereview-check.php?st=1&id=".$data["id"]."\" class=\"btn btn-info btn-sm\">";
echo "<span class=\"glyphicon glyphicon-user\"></span></a>";
}
?>
</td>
<td>
<?php
if ($data["checker_2_result"]) {
echo "<a href=\"pricereview-check.php?st=2&id=".$data["id"]."\" class=\"btn btn-lg\">";
if ($data["checker_2_result"] == "Y") {
echo "<span class=\"glyphicon glyphicon-ok\" title=\"通過\"></span></a>";
} else {
echo "<span class=\"glyphicon glyphicon-ban-circle\" title=\"拒絕\"></span></a>";
}
echo "<br>".$data["checker_2"]."<br>".$data["checker_2_dt"];
} else if ($data["checker_1_result"] == "N") {
echo "-";
} else {
echo "<a href=\"pricereview-check.php?st=2&id=".$data["id"]."\" class=\"btn btn-info btn-sm\">";
echo "<span class=\"glyphicon glyphicon-user\"></span></a>";
}
?>
</td>
<td>
<?php
if ($data["checker_3_result"]) {
echo "<a href=\"pricereview-check.php?st=3&id=".$data["id"]."\" class=\"btn btn-lg\">";
if ($data["checker_3_result"] == "Y") {
echo "<span class=\"glyphicon glyphicon-ok\" title=\"通過\"></span></a>";
} else {
echo "<span class=\"glyphicon glyphicon-ban-circle\" title=\"拒絕\"></span></a>";
}
echo "<br>".$data["checker_3"]."<br>".$data["checker_3_dt"];
} else if ($data["checker_1_result"] == "N" || $data["checker_2_result"] == "N") {
echo "-";
} else {
echo "<a href=\"pricereview-check.php?st=3&id=".$data["id"]."\" class=\"btn btn-info btn-sm\">";
echo "<span class=\"glyphicon glyphicon-user\"></span></a>";
}
?>
</td>
<td>
<p>
<a href="pricereview-edit.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</p>
</td>
<td>
<?php if (!$allow_st || $allow_st > 1) echo "--"; else { ?>
<p>
<a href="pricereview-delete.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')">
<span class="glyphicon glyphicon-remove"></span>
</a>
</p>
<?php } ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php
else:
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>