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.
382 lines
17 KiB
382 lines
17 KiB
<?php
|
|
// ini_set('display_errors', 'on');
|
|
/**
|
|
* 權限規則:
|
|
* 1.工務:宜蘭=高培軒(M0087) 北=張潘榮(M0041) 中=林瑋隆(M0113) 南=鄭存邑(M0102)
|
|
* 2.許協理 部門代碼:320 職位大小:1
|
|
* 3.詹總 部門代碼:50 職位大小:1
|
|
* 4.許總 部門代碼:20 職位大小:1
|
|
*
|
|
*/
|
|
include "header.php";
|
|
|
|
// 設定警告出貨到期的天數
|
|
$numberOfDaysToAdd = 45;
|
|
$futureDate = date("Y/m/d", strtotime(date("Y-m-d") . " +{$numberOfDaysToAdd} days"));
|
|
|
|
include "wipwholeinstall-renovate-index-function.php";
|
|
include "css/view/wipwholeinstall-index.php";
|
|
|
|
// 宣告主資料空陣列
|
|
$data = array();
|
|
|
|
// 取得當前使用者所屬部門
|
|
$department_id = getDepartmentId($link, $user_id);
|
|
// 取得當前使用者所屬職位
|
|
$role_id = getRoleId($link, $user_id);
|
|
|
|
// 下方編輯按鈕權限
|
|
// 4=工務
|
|
|
|
$edit_flag = getEditFlag($department_id, $role_id, $user_id);
|
|
|
|
// 取得當前使用者所屬部門
|
|
$department_id = getDepartmentId($link, $user_id);
|
|
// 取得當前使用者所屬職位
|
|
$role_id = getRoleId($link, $user_id);
|
|
|
|
// 接受搜尋 post 後觸發
|
|
$contractno = empty($_REQUEST['contractno']) ? null : $_REQUEST['contractno'];
|
|
$facilityno = empty($_REQUEST['facilityno']) ? null : $_REQUEST['facilityno'];
|
|
$custom = empty($_REQUEST['custom']) ? null : $_REQUEST['custom'];
|
|
$site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ? '' : $_REQUEST['site_survey_contact_verify'];
|
|
$real_arrival_date_start = empty($_REQUEST['real_arrival_date_start']) ? null : $_REQUEST['real_arrival_date_start'];
|
|
$real_arrival_date_end = empty($_REQUEST['real_arrival_date_end']) ? null : $_REQUEST['real_arrival_date_end'];
|
|
$area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no'];
|
|
$erro_mesage_search = !isset($_REQUEST['erro_mesage_search']) ? 'A' : $_REQUEST['erro_mesage_search'];
|
|
|
|
// 取得資料 sql
|
|
$sql = getDataSql($department_id, $role_id, $user_id);
|
|
$data = mysqli_query($link, $sql);
|
|
|
|
$Tdata = [];
|
|
$Fdata = [];
|
|
|
|
foreach ($data as $row) {
|
|
if (!empty(warningMessage($row))) {
|
|
array_push($Tdata, $row);
|
|
} else {
|
|
array_push($Fdata, $row);
|
|
}
|
|
}
|
|
if ($erro_mesage_search == 'T')
|
|
$data = $Tdata;
|
|
if ($erro_mesage_search == 'F')
|
|
$data = $Fdata;
|
|
|
|
?>
|
|
|
|
<div style="overflow-x:auto;">
|
|
<form id='myForm' method='post' action='wipwholeinstall-renovate-index.php?<?= $token_link ?>'>
|
|
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
|
|
<thead>
|
|
<tr>
|
|
<td colspan="9">
|
|
<h3 style='text-align:center'>作番安裝大日程(汰改)</h3>
|
|
</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th>合約號</th>
|
|
<td><input type="text" class='form-control' id='contractno' name='contractno' value="<?php echo $contractno; ?>"></td>
|
|
<th>電梯編號</th>
|
|
<td><input type="text" class='form-control' id='facilityno' name='facilityno' value="<?php echo $facilityno; ?>"></td>
|
|
<th>客戶姓名</th>
|
|
<td><input type="text" class='form-control' id='custom' name='custom' value="<?php echo $custom; ?>"></td>
|
|
<th>預計出貨日</th>
|
|
<td colspan="2">
|
|
<input type="date" class='form-control' id='real_arrival_date_start' name='real_arrival_date_start' value="<?php echo $real_arrival_date_start; ?>" style='width:40%;display:inline;'>
|
|
~
|
|
<input type="date" class='form-control' id='real_arrival_date_end' name='real_arrival_date_end' value="<?php echo $real_arrival_date_end; ?>" style='width:40%;display:inline;'>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>
|
|
區域
|
|
</th>
|
|
<td>
|
|
<?php
|
|
$area_status = array(
|
|
"" => "全部",
|
|
"N" => "N:北區",
|
|
"Y" => "Y:宜蘭",
|
|
"T" => "T:桃竹苗",
|
|
"C" => "C:中區",
|
|
"K" => "K:南區"
|
|
);
|
|
?>
|
|
<select name="area_no" id="area_no">
|
|
<?php
|
|
foreach ($area_status as $key => $val) {
|
|
if ((string)$area_no == (string)$key) {
|
|
echo "<option value='$key' selected>$val</option>";
|
|
} else {
|
|
echo "<option value='$key'>$val</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<th>
|
|
工勘狀態
|
|
</th>
|
|
<td>
|
|
<?php
|
|
$site_survey_status = array(
|
|
"0" => "已確認",
|
|
"1" => "未確認",
|
|
"2" => "無工勘需求",
|
|
"A" => "未動工",
|
|
"B" => "地下室施工",
|
|
"C" => "打樁",
|
|
"D" => "地基",
|
|
"E" => "挖土",
|
|
"G" => "機房",
|
|
"H" => "機械式淨高",
|
|
"M" => "樓中樓",
|
|
"OH" => "最高層(頂樓高度)",
|
|
"P" => "PIT(機坑深度)",
|
|
"R" => "R 樓",
|
|
"S" => "停工",
|
|
"T" => "TOP",
|
|
"TC" => "頂部間隙",
|
|
"TS" => "行程",
|
|
"TH" => "全高",
|
|
"Y" => "已搭、已出",
|
|
"YB" => "退購結案",
|
|
"YF" => "既有建物",
|
|
"YN" => "已搭、未出"
|
|
);
|
|
for ($i = 1; $i < 200; $i++) {
|
|
$site_survey_status[$i . "F"] = $i . "F";
|
|
}
|
|
?>
|
|
<select style="width:100%;" name="site_survey_contact_verify" id="site_survey_contact_verify">
|
|
<?php
|
|
echo "<option value=''>全部</option>";
|
|
foreach ($site_survey_status as $key => $val) {
|
|
if ((string)$site_survey_contact_verify == (string)$key) {
|
|
echo "<option value='$key' selected>$val</option>";
|
|
} else {
|
|
echo "<option value='$key'>$val</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td colspan="5" style='text-align:left'>
|
|
<input type="radio" name="erro_mesage_search" id='erro_mesage_search' value='A' <?php echo $erro_mesage_search == 'A' ? "checked" : ""; ?> />
|
|
<label for="erro_mesage_search">全部</label>
|
|
<input type="radio" name="erro_mesage_search" id='erro_mesage_search_true' value='T' <?php echo $erro_mesage_search == 'T' ? "checked" : ""; ?> />
|
|
<label for="erro_mesage_search_true">已出現警示</label>
|
|
<input type="radio" name="erro_mesage_search" id='erro_mesage_search_false' value='F' <?php echo $erro_mesage_search == 'F' ? "checked" : ""; ?> />
|
|
<label for="erro_mesage_search_false">未出現警示</label>
|
|
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
|
|
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='day_before_input()'><?php echo $numberOfDaysToAdd; ?>天內資料</button>
|
|
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='day_before_all_input()'><?php echo $numberOfDaysToAdd; ?>天內資料(含今天以前)</button>
|
|
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='clean_all_input()'>清除</button>
|
|
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='generateButton()'>匯出excel</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php
|
|
$dataArr = array(
|
|
"All" => $data
|
|
);
|
|
foreach ($dataArr as $key => $val) {
|
|
if ($val) :
|
|
$dataDetailsArr = $val;
|
|
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
|
|
include "wipwholeinstall-renovate-index-table-html.php";
|
|
echo "</div>";
|
|
endif;
|
|
}
|
|
|
|
|
|
// 結束連線
|
|
mysqli_close($link);
|
|
?>
|
|
<link href="/wms/css/select2.min.css" rel="stylesheet" />
|
|
<script src="/wms/css/select2.min.js"></script>
|
|
<script src="/wms/css/dataTables.fixedColumns.min.js"></script>
|
|
<style>
|
|
.dataTables_scrollHead .dataTable {
|
|
margin-bottom: -2px;
|
|
}
|
|
|
|
.dataTables_scrollBody .dataTable {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
table {
|
|
margin-left: 0px;
|
|
}
|
|
</style>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#site_survey_contact_verify').select2();
|
|
});
|
|
|
|
|
|
const formData = new FormData();
|
|
formData.append("contractno", "<?php echo empty($_POST['contractno']) ? null : $_POST['contractno']; ?>");
|
|
formData.append("facilityno", "<?php echo empty($_POST['facilityno']) ? null : $_POST['facilityno']; ?>");
|
|
formData.append("custom", "<?php echo empty($_POST['custom']) ? null : $_POST['custom']; ?>");
|
|
formData.append("site_survey_contact_verify", "<?php echo empty($_POST['site_survey_contact_verify']) ? '' : $_POST['site_survey_contact_verify']; ?>");
|
|
formData.append("real_arrival_date_start", "<?php echo empty($_POST['real_arrival_date_start']) ? null : $_POST['real_arrival_date_start']; ?>");
|
|
formData.append("real_arrival_date_end", "<?php echo empty($_POST['real_arrival_date_end']) ? null : $_POST['real_arrival_date_end']; ?>");
|
|
formData.append("area_no", "<?php echo empty($_POST['area_no']) ? null : $_POST['area_no']; ?>");
|
|
formData.append("erro_mesage_search", "<?php echo empty($_POST['erro_mesage_search']) ? null : $_POST['erro_mesage_search']; ?>");
|
|
|
|
function generateButton() {
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open('POST', window.location.origin + "/wms/wipwholeinstall-renovate-index-export-excel.php?<?= $token_link ?>", true);
|
|
xhr.responseType = 'text';
|
|
xhr.onload = function() {
|
|
if (xhr.status === 200) {
|
|
var response = xhr.responseText;
|
|
var file_path = xhr.responseText;
|
|
var link = document.createElement('a');
|
|
link.setAttribute('href', window.location.origin + "/wms/excel/wipwholeintall.xlsx");
|
|
link.setAttribute('download', '出貨預定表(汰改).xlsx');
|
|
link.style.display = 'none';
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
}
|
|
};
|
|
xhr.send(formData);
|
|
}
|
|
|
|
function clean_all_input() {
|
|
document.getElementById("site_survey_contact_verify").value = "";
|
|
document.getElementById("contractno").value = "";
|
|
document.getElementById("facilityno").value = "";
|
|
document.getElementById("custom").value = "";
|
|
document.getElementById("real_arrival_date_start").value = "";
|
|
document.getElementById("real_arrival_date_end").value = "";
|
|
document.getElementById("myForm").submit();
|
|
}
|
|
|
|
function day_before_input() {
|
|
document.getElementById("contractno").value = "";
|
|
document.getElementById("facilityno").value = "";
|
|
document.getElementById("custom").value = "";
|
|
document.getElementById("real_arrival_date_start").value = "<?php echo date("Y-m-d"); ?>";
|
|
document.getElementById("real_arrival_date_end").value = "<?php echo date("Y-m-d", strtotime("+" . $numberOfDaysToAdd . " days")) ?>";
|
|
document.getElementById("myForm").submit();
|
|
}
|
|
|
|
function day_before_all_input() {
|
|
document.getElementById("contractno").value = "";
|
|
document.getElementById("facilityno").value = "";
|
|
document.getElementById("custom").value = "";
|
|
document.getElementById("real_arrival_date_start").value = "";
|
|
document.getElementById("real_arrival_date_end").value = "<?php echo date("Y-m-d", strtotime("+" . $numberOfDaysToAdd . " days")) ?>";
|
|
document.getElementById("myForm").submit();
|
|
}
|
|
|
|
$('#table_index2').DataTable({
|
|
scrollX: true,
|
|
fixedHeader: true,
|
|
scrollY: 500,
|
|
"language": {
|
|
"emptyTable": "無資料...",
|
|
"processing": "處理中...",
|
|
"loadingRecords": "載入中...",
|
|
"lengthMenu": "顯示_MENU_ 筆",
|
|
"zeroRecords": "沒有符合的結果",
|
|
"info": "第 _START_ 至 _END_ 項,共 _TOTAL_ 項",
|
|
"infoEmpty": "第 0 至 0 項,共 0 項",
|
|
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
|
|
"infoPostFix": "",
|
|
"search": "",
|
|
"paginate": {
|
|
"first": "第一頁",
|
|
"previous": "上一頁",
|
|
"next": "下一頁",
|
|
"last": "最後一頁"
|
|
},
|
|
"aria": {
|
|
"sortAscending": ": 升冪排列",
|
|
"sortDescending": ": 降冪排列"
|
|
}
|
|
}
|
|
}, {
|
|
"order": [
|
|
[4, "desc"],
|
|
[8, "asc"]
|
|
]
|
|
}
|
|
|
|
);
|
|
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋";
|
|
|
|
// datatable 畫面重整後保留資料
|
|
|
|
var contractno = $("#contractno").val();
|
|
var facilityno = $("#facilityno").val();
|
|
var custom = $("#custom").val();
|
|
var site_survey_contact_verify = $("#site_survey_contact_verify").val();
|
|
var real_arrival_date_start = $("#real_arrival_date_start").val();
|
|
var real_arrival_date_end = $("#real_arrival_date_end").val();
|
|
var area_no = $("#area_no").val();
|
|
var erro_mesage_search = $('input[name=erro_mesage_search]:checked').val();
|
|
|
|
var showNum = <?php echo empty($_GET['showNum']) ? '10' : $_GET['showNum']; ?>;
|
|
var nowPage = <?php echo empty($_GET['nowPage']) ? '1' : $_GET['nowPage']; ?>;
|
|
var searchContent = "<?php echo empty($_GET['searchContent']) ? '' : $_GET['searchContent']; ?>";
|
|
var orderColumn = "<?php echo empty($_GET['orderColumn']) ? '' : $_GET['orderColumn']; ?>";
|
|
var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>";
|
|
|
|
var table = $('#table_index2').DataTable();
|
|
|
|
// 设置排序信息
|
|
if (orderColumn !== '' && orderDirection !== '') {
|
|
table.order([orderColumn, orderDirection]).draw();
|
|
}
|
|
|
|
table.search(searchContent).draw();
|
|
table.page.len(showNum).draw();
|
|
table.page((nowPage) - 1).draw('page');
|
|
|
|
// 監聽排序
|
|
table.on('order.dt', function() {
|
|
var order = table.order();
|
|
orderColumn = order[0][0];
|
|
orderDirection = order[0][1];
|
|
});
|
|
|
|
// 監聽頁碼
|
|
table.on('page.dt', function() {
|
|
searchDatatable(table);
|
|
});
|
|
|
|
// 監聽資料筆數
|
|
table.on('length.dt', function(e, settings, len) {
|
|
searchDatatable(table);
|
|
});
|
|
|
|
// 監聽搜尋事件
|
|
$("#table_index2_filter > label > input").change(function() {
|
|
searchDatatable(table);
|
|
});
|
|
|
|
function searchDatatable(table) {
|
|
showNum = table.page.len();
|
|
nowPage = table.page.info().page + 1;
|
|
searchContent = table.search();
|
|
var order = table.order();
|
|
orderColumn = order[0][0]; // 获取排序的列索引
|
|
orderDirection = order[0][1]; // 获取排序的方向
|
|
window.location.href = "<?php echo "wipwholeinstall-renovate-index.php?function_name=wipinstall&$token_link"; ?>" +
|
|
"&showNum=" + showNum + "&nowPage=" + nowPage + "&searchContent=" + searchContent +
|
|
"&orderColumn=" + orderColumn + "&orderDirection=" + orderDirection +
|
|
"&contractno=" + contractno + "&facilityno=" + facilityno + "&custom=" + custom +
|
|
"&site_survey_contact_verify=" + site_survey_contact_verify + "&real_arrival_date_start=" + real_arrival_date_start +
|
|
"&real_arrival_date_end=" + real_arrival_date_end + "&area_no=" + area_no + "&erro_mesage_search=" + erro_mesage_search;
|
|
}
|
|
</script>
|