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.
 
 
 
 
 
 

217 lines
7.2 KiB

<?php
// error_reporting(E_ALL);
// ini_set("display_errors", "on");
/**
* 显示所有的待签 员工所有待签
*/
// 載入db.php來連結資料庫
require_once "../database.php";
require_once "../header.php";
function getWipwholestatusDataByFormkey($link, $form_key, $flow_id)
{
$sql = "
SELECT
form_id
FROM flow
WHERE form_key = '$form_key'
AND system_id = 'wws'
AND flow_id = '$flow_id'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
$sql = "
SELECT
*
FROM wipwholestatus
WHERE id = '" . $row['form_id'] . "'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
return $row;
}
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$where_system_id = " and a.system_id like '" . $system_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
$sql_get = "select c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner,
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name ,
flow_name,c.update_date ,c.create_date,b.path,d.flow_code from system_main a,flow_main b ,subflow
c,flow d
where a.system_id=b.system_id
and b.flow_id=d.flow_id
and c.current_assigner='$user_id'
and d.flow_id=b.flow_id
and c.form_key=d.form_key
$where_system_id
$where_flow_id
";
//echo $sql_get;
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
$system_name_opt = array_map(function ($item) {
return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']);
}, $res_get);
$system_name_opt = (array_unique($system_name_opt, SORT_REGULAR));
$flow_name_opt = array_map(function ($item) {
return array('flow_id' => $item['flow_id'], 'flow_name' => $item['flow_name']);
}, $res_get);
$flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
?>
<style>
table {
table-layout: fixed;
width: 90%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
vertical-align: middle !important;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
table.query-table th {
text-align: right;
}
</style>
<form method='post' action='#'>
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>待簽查詢</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='width:50px'>系統名稱</th>
<td colspan='1'>
<select class='form-control' name='system_id'>
<?php
echo " <option class='form-control' value='%' >全部</option>";
foreach ($system_name_opt as $opt) {
echo " <option class='form-control' value=" . $opt['system_id'] . " >" . $opt['system_name'] . "</option>";
}
?>
</select>
</td>
<th>流程名稱</th>
<td colspan='1'> <select class='form-control' name='flow_id'>
<?php
echo " <option class='form-control' value='%' >全部</option>";
foreach ($flow_name_opt as $opt) {
echo " <option class='form-control' value=" . $opt['flow_id'] . " >" . $opt['flow_name'] . "</option>";
}
?>
</select> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="8" style='text-align:center'>
<button type="submit" style='text-align:center; margin:0 auto;width:50px' class="btn btn-primary">查詢</button>
</td>
</tr>
</tfoot>
</table>
<div style="overflow-x:auto;width:92%;margin:0 auto">
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact">
<thead>
<tr>
<th style="width:400px;">序號</th>
<th>系統名稱</th>
<th>流程名稱</th>
<th>接收日期</th>
<th>當前簽核者</th>
<th>狀態</th>
</tr>
</thead>
<tbody>
<?php
$rowspan = 1;
foreach ($res_get as $key => $data) :
//嘗試將已結案隱藏起來 : 測試使用者體驗
if ($data['flow_code'] !== 'Z') {
?>
<tr>
<td>
<?php
if ($data['system_name'] == '作番大日程系統') {
$w_data = getWipwholestatusDataByFormkey($link, $data['form_key'], $data['flow_id']);
$facilityno = $w_data['facilityno'];
$contractno = $w_data['contractno'];
?>
<a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>">
作番大日程-合約號:<?= $contractno ?> 作番號:<?= $facilityno ?>
</a>
<?php
} else {
?>
<a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>">
<?= $data['form_key']; ?>
</a>
<?php
}
?>
</td>
<td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['update_date']; ?></td>
<td><?php echo $data['current_assigner_name']; ?></td>
<td><?php echo $data['flow_code'] == 'Z' ? "結案" : ""; ?></td>
</tr>
<?php
}
endforeach;
?>
</tbody>
</table>
</div>
</form>
<?php
#代錶結束連線
mysqli_close($link);
require_once "../footer.php";
?>