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.
 
 
 
 
 
 

151 lines
5.0 KiB

<?php
include "../header.php";
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "s.creater");
if ($user_id == "M0060" || $user_id == "M0023") $sql_cmd = "";
$sql2 = (empty($sql_cmd)) ? "where" : "and";
$sql2 .= " s.mid = p.id and p.ekind = '汰改' ";
$sql2 .= "and (s.mid, s.pr_item_id, s.sub_item_id, s.version) in (select s.mid, s.pr_item_id, s.sub_item_id, max(s.version) from specsurvey_main s, pricereview_main p where s.mid = p.id group by s.mid, s.pr_item_id, s.sub_item_id)";
$sql = "select s.* from specsurvey_main s, pricereview_main p $sql_cmd $sql2 order by s.id";
// 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link, $sql);
//$rtype_arr = ["MAE100" => "MAE100小機房", "MAM200" => "MAM200無機房", "MAH100" => "MAH100小電梯", "MAQ100" => "MAQ100強驅梯", "MAF100" => "MAF100貨梯", "MAZ100" => "MAZ100雜物梯"];
$usefor_arr = [1 => "人乘", 2 => "貨梯", 3 => "觀光", 4 => "客貨", 5 => "病床", 6 => "緊急", 7 => "殘障", 8 => "緊急兼殘障", 9 => "特殊環境"];
$class_arr = [1 => "新梯", 2 => "舊改M1", 3 => "舊改M2", 4 => "舊改M3", 5 => "舊改M4", 6 => "舊改M1+M4"];
?>
<!--
<p>
<a href="specsurvey-create.php?function_name=specsurvey&<?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:specsurvey-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;
}
.btn-sm {
font-size:14px;
margin: 2px 0;
line-height: 90%;
}
</style>
<script>
$(function () {
var api = $('#table_index').dataTable().api();
api
.order([0, "desc"])
.draw();
});
</script>
<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 style="width:10%">規格</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) :
$sql2 = "select item_spec from pricereview_item where mid = '".$data["mid"]."' and item_no = '".$data["pr_item_id"]."'";
$res2 = mysqli_query($link, $sql2);
$row = mysqli_fetch_row($res2);
$item_spec = $row[0];
mysqli_free_result($res2);
?>
<tr>
<td><?php echo $data['id']; ?></td>
<td><?php echo $data['version']; ?></td>
<td><?php echo $data['contractno']; ?></td>
<td><?php echo $data['company']; ?></td>
<td><?php echo $data['facilitok_date']; ?></td>
<td><?php echo $item_spec; ?></td>
<td><?php echo $data['serial']; ?></td>
<!--<td><?php echo $data['rtype']; ?></td>
<td><?php echo $data['weight']; ?></td>
<td><?php echo $data['numberofpassenger']; ?></td>
<td><?php echo $data['numberofstop']; ?></td>
<td><?php echo $data['speed']; ?></td>-->
<td><?php echo $usefor_arr[$data['usefor']]; ?></td>
<td><?php echo $class_arr[$data['class']]; ?></td>
<td><?php echo $data['creater']; ?></td>
<td><?php echo $data['create_at']; ?></td>
<td><a href="specsurvey_renovate-view.php?pa=<?php echo $data['mid'].",".$data['pr_item_id'],",".$data['version'].",".$data['sub_item_id']; ?>&function=specsurvey_renovate&<?php echo $token_link; ?>" class="btn btn-warning btn-sm">檢視</a></td>
<!--<td>
<p>
<a href="specsurvey-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";
?>