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.
 
 
 
 
 
 

180 lines
6.6 KiB

<?php
include "header.php";
// 載入db.php來連結資料庫
require_once "database.php";
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$sql = "select * from maintance_contract_info order by id";
$data = mysqli_query($link,$sql);
?>
<p>
<a href="pricereview-create.php?account=<?php echo $_GET['account'];?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p>
<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>
<?php
if ($data):
?>
<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 $k=>$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 $k+1; ?></td>
<td><?php echo $data['maintance_contract_id']; ?></td>
<td><?php echo $data['sitename']; ?></td>
<td><?php echo $data['contractor']; ?></td>
<td><?php echo $data['contractsnum']; ?></td>
<td><?php echo $data['siteaddress']; ?></td>
<td><?php echo $data['contractsigningperiod']; ?></td>
<td><?php echo $data['contracttype']; ?></td>
<td><?php echo $data['Maintenanceoperationcategory']; ?></td>
<td><?php echo $data['contractsigningnature']; ?></td>
<td><?php echo $data['pricereviewer']; ?></td>
<td><?php echo $data['create_at']; ?></td>
<td>
<?php
if ($data["checker_1_result"]) {
echo "<a href=\"fault-create.php?account=".$_GET['account']."&st=1&id=".$data["maintance_contract_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=\"fault-create.php?account=".$_GET['account']."&st=1&id=".$data["maintance_contract_id"]."\" class=\"btn btn-info btn-sm\">";
echo "<span class=\"glyphicon glyphicon-plus\"></span></a>";
}
?>
</td>
<td>
<?php
if ($data["checker_2_result"]) {
echo "<a href=\"receivable-create.php?account=".$_GET['account']."&st=2&id=".$data["maintance_contract_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=\"receivable-create.php?account=".$_GET['account']."&st=2&id=".$data["maintance_contract_id"]."\" class=\"btn btn-info btn-sm\">";
echo "<span class=\"glyphicon glyphicon-plus\"></span></a>";
}
?>
</td>
<td>
<?php
if ($data["checker_3_result"]) {
echo "<a href=\"review-create.php?account=".$_GET['account']."&st=3&id=".$data["maintance_contract_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=\"review-create.php?account=".$_GET['account']."&st=3&id=".$data["maintance_contract_id"]."\" class=\"btn btn-info btn-sm\">";
echo "<span class=\"glyphicon glyphicon-plus\"></span></a>";
}
?>
</td>
<td>
<p>
<a href="pricereview-edit.php?account=<?php echo $_GET['account'];?>&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?account=<?php echo $_GET['account'];?>&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";
?>