Browse Source

修正版本

gary
gary_chen\gary_chen 1 year ago
parent
commit
665009aae8
  1. 1
      .gitignore
  2. 37
      wms/api/bpm/addConstructOutsource.ini
  3. 102
      wms/api/bpm/addConstructOutsource.php
  4. 31
      wms/api/bpm/addConstructOutsource.txt
  5. 121
      wms/css/view/wipwhole-index.php
  6. 3
      wms/frame/api_getdata.php
  7. 5
      wms/notice-edit.php
  8. 138
      wms/sign/list.php
  9. 12
      wms/wipwhole-index-function.php
  10. 64
      wms/wipwhole-rec-invoice-edit-submit.php
  11. 18
      wms/wipwhole-renovate-index-function.php
  12. 373
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  13. 14
      wms/wipwhole-renovate-rec-invoice-edit.php
  14. 123
      wms/wipwhole-wipinstallstatus-index-modal.php
  15. 307
      wms/wipwhole-wipinstallstatus-index.php
  16. 5
      wms/wipwholeinstall-index-function.php
  17. 5
      wms/wipwholeinstall-renovate-index-function.php

1
.gitignore

@ -26,3 +26,4 @@ wms/contract/images/contracts
wms/test.php wms/test.php
app/account_log/ app/account_log/
wms/gary2.php wms/gary2.php
wms/chinese.php

37
wms/api/bpm/addConstructOutsource.ini

@ -0,0 +1,37 @@
[1704265677]
test = "test"
[1704265897]
fdSignEnable = ""
fdNumber = "D022"
fd_3c7c8fe420374a = "test"
fd_3c7d1b1c73adc0 = "12345678"
docSubject = "工程A"
fd_3c7d1c085a7922 = "100"
fd_3c7d23c16f9606 = "100"
fdIsFiling = ""
fd_3c7d217e9aee76 = "100"
fd_3c7d1b36e1bf06 = "328桃園市觀音區崙坪村8鄰140號"
fdCanCircularize = ""
fd_3c7c8f83024a64 = "工程A"
docStatus = "20"
docCreateTime = "2024-01-03 15:11:00.0"
fd_3c7c8e9cdb7b84 = "abc1234"
fd_3c7d1be15a905a = "0987980607"
fdId = "18cce2968e5df283fcfe62c4b8487aac"
fd_3c7d1b06bde1d4 = "負責人A"
fd_3c7c8f95d36a78 = "328桃園市觀音區崙坪村8鄰140號"
fd_3c7d1ad092a344 = "永佳捷科技股份有限公司"
[1704267391]
fd_3c7d23c16f9606 = "100"
[1704267579]
fd_3c7d23c16f9606 = "100"
[1704267778]
fd_3c7d23c16f9606 = "100"
[1704268463]
fdId = "18cce504901cfe97c572b7548da9349e"

102
wms/api/bpm/addConstructOutsource.php

@ -0,0 +1,102 @@
<?php
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
show405Error();
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$request_data_json = file_get_contents('php://input');
$request_data = json_decode(file_get_contents('php://input'), true);
if (empty($request_data)) {
show400Error();
exit;
}
writePostIni($request_data);
writePostIniJson($request_data);
$fd_id = $request_data[$fd_id];
// $dsn = 'mysql:host=localhost;dbname=appwms_test';
// $username = 'masadaroot';
// $password = 'x6h5E5p#u8y';
// try {
// $pdo = new PDO($dsn, $username, $password);
// $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// $pdo->exec('SET CHARACTER SET utf8mb4');
// $pdo->beginTransaction();
// $sth = $pdo->prepare("INSERT INTO account (accounttype , accountid) VALUES (?, ?)");
// $sth->bindValue(1, 'mf_vol_no');
// $sth->execute();
// $pdo->commit();
// showSuccessMessage();
// } catch (PDOException $e) {
// $pdo->rollBack();
// echo "Transaction failed: " . $e->getMessage();
// }
}
function showSuccessMessage()
{
$response = array('status' => 'success', 'message' => 'Data received and stored successfully');
header('Content-Type: application/json');
echo json_encode($response);
}
function showErrorMessage()
{
$response = array('status' => 'error', 'message' => 'Data received and stored error');
header('Content-Type: application/json');
echo json_encode($response);
}
function show400Error()
{
http_response_code(400);
echo 'Invalid request data';
}
function show405Error()
{
http_response_code(405);
echo 'Method Not Allowed';
}
function writePostIni($request_data)
{
// 讀取現有 ini 檔案的資料
$ini_file = 'addConstructOutsource.ini';
$existing_data = parse_ini_file($ini_file, true);
// 將接收到的資料加入現有資料
$timestamp = time();
$existing_data[$timestamp] = $request_data;
// 將資料寫入 ini 檔
$ini_content = '';
foreach ($existing_data as $key => $value) {
$ini_content .= "[$key]\n";
foreach ($value as $k => $v) {
$ini_content .= "$k = \"$v\"\n";
}
$ini_content .= "\n";
}
file_put_contents($ini_file, $ini_content);
}
function writePostIniJson($request_data)
{
$txt_file = 'addConstructOutsource.txt';
$txt = "";
$file = fopen($txt_file, 'a');
foreach($request_data as $k => $v){
$txt .= "$k = \"$v\"\n";
}
fwrite($file, $txt . PHP_EOL);
fclose($file);
}

31
wms/api/bpm/addConstructOutsource.txt

@ -0,0 +1,31 @@
test = "test"
fdSignEnable = ""
fdNumber = "D022"
fd_3c7c8fe420374a = "test"
fd_3c7d1b1c73adc0 = "12345678"
docSubject = "工程A"
fd_3c7d1c085a7922 = "100"
fd_3c7d23c16f9606 = "100"
fdIsFiling = ""
fd_3c7d217e9aee76 = "100"
fd_3c7d1b36e1bf06 = "328桃園市觀音區崙坪村8鄰140號"
fdCanCircularize = ""
fd_3c7c8f83024a64 = "工程A"
docStatus = "20"
docCreateTime = "2024-01-03 15:11:00.0"
fd_3c7c8e9cdb7b84 = "abc1234"
fd_3c7d1be15a905a = "0987980607"
fdId = "18cce2968e5df283fcfe62c4b8487aac"
fd_3c7d1b06bde1d4 = "負責人A"
fd_3c7c8f95d36a78 = "328桃園市觀音區崙坪村8鄰140號"
fd_3c7d1ad092a344 = "永佳捷科技股份有限公司"
fd_3c7d23c16f9606 = "100"
fd_3c7d23c16f9606 = "100"
fd_3c7d23c16f9606 = "100"
fdId = "18cce504901cfe97c572b7548da9349e"

121
wms/css/view/wipwhole-index.php

@ -71,6 +71,127 @@
text-align: center; text-align: center;
} }
#loadingOverlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.7);
/* 透明度的背景颜色 */
z-index: 9999;
/* 确保在最上层显示 */
/* 添加加载动画的样式 */
}
.hidden {
display: none;
}
#loadingOverlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.7);
/* 半透明的背景 */
z-index: 9999;
/* 确保显示在最上层 */
display: flex;
justify-content: center;
align-items: center;
}
.loading-text {
text-align: center;
margin-top: 10px;
/* 调整文字与图标之间的间距 */
font-size: 16px;
color: #333;
/* 文字颜色 */
}
.loading-icon {
/* 这里是你加载图标的样式,可以是一个动画、GIF图或者SVG等 */
/* 例如一个简单的加载圆圈动画 */
border: 10px solid #f3f3f3;
/* 灰色边框 */
border-top: 10px solid #3498db;
/* 蓝色顶部边框 */
border-radius: 50%;
width: 80px;
height: 80px;
animation: spin 2s linear infinite;
/* 旋转动画 */
}
/* The Modal (background) */
.modal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
padding-top: 100px;
/* Location of the box */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
}
.modal .back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
/* Black w/ opacity */
}
/* Modal Content */
.modal-content {
z-index: 9;
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {

3
wms/frame/api_getdata.php

@ -84,7 +84,8 @@ function get_notice($token)
$sql .= "where ( $sql .= "where (
permission like '%" . $user_id . "%' permission like '%" . $user_id . "%'
or permission = 'ALL' or permission = 'ALL'
-- or creater = '$user_id') -- or creater = '$user_id'
)
"; ";
$sql .= "and (haveread != '1' or haveread is null) "; $sql .= "and (haveread != '1' or haveread is null) ";
$sql .= "order by id desc limit 0, 6"; $sql .= "order by id desc limit 0, 6";

5
wms/notice-edit.php

@ -38,7 +38,10 @@ foreach ($data as $data) :
<div class="nextline"></div> <div class="nextline"></div>
<div> <div>
<label for="content">內容</label><br> <label for="content">內容</label><br>
<textarea class="form-control2" name="content" id="content" rows="8" cols="100" required><?php echo $data['content']; ?></textarea> <div>
<?php echo nl2br(str_replace("{token_link}", $token_link, $data['content'])); ?>
</div>
<!-- <textarea class="form-control2" name="content" id="content" rows="8" cols="100" required><?php echo $data['content']; ?></textarea> -->
</div> </div>
<div class="nextline"></div> <div class="nextline"></div>
<div> <div>

138
wms/sign/list.php

@ -1,8 +1,6 @@
<?php <?php
// phpinfo(); // error_reporting(E_ALL);
// exit(); // ini_set("display_errors", "on");
error_reporting(E_ALL);
ini_set("display_errors", "on");
/** /**
* 显示所有的待签 员工所有待签 * 显示所有的待签 员工所有待签
*/ */
@ -13,6 +11,61 @@ require_once "../database.php";
require_once "../header.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'] . "'
ANd status = '1'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
return $row;
}
function getwipwholeChangeContractdateDetailsDataByFormkey($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
wipwholestatus_id
FROM wipwhole_change_contractdate_details
WHERE id = '" . $row['form_id'] . "'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
$sql = "
SELECT
*
FROM wipwholestatus
WHERE id = '" . $row['wipwholestatus_id'] . "'
ANd status = '1'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
return $row;
}
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id']; $system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$where_system_id = " and a.system_id like '" . $system_id . "%'"; $where_system_id = " and a.system_id like '" . $system_id . "%'";
@ -20,28 +73,33 @@ $where_system_id = " and a.system_id like '" . $system_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id']; $flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$where_flow_id = " and b.flow_id like '" . $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, $sql_get = "
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name , select
flow_name,c.update_date ,c.create_date,b.path,d.flow_code FROM system_main a,flow_main b ,subflow c.form_key,
c,flow d a.system_id,
WHERE a.system_id=b.system_id b.flow_id ,
AND b.flow_id=d.flow_id a.system_name,
AND c.current_assigner='$user_id' c.current_assigner,
AND d.flow_id=b.flow_id concat(
AND c.form_key=d.form_key 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_system_id
$where_flow_id $where_flow_id
"; ";
//echo $sql_get;
$result = mysqli_query($link, $sql_get);
if ($result == false) {
die(mysqli_error($link));
}
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); $res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
// echo '<pre>';
// print_r($sql_get);
// echo '</pre>';
// exit;
$system_name_opt = array_map(function ($item) { $system_name_opt = array_map(function ($item) {
return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']); return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']);
@ -142,7 +200,7 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact"> <table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact">
<thead> <thead>
<tr> <tr>
<th>序號</th> <th style="width:400px;">序號</th>
<th>系統名稱</th> <th>系統名稱</th>
<th>流程名稱</th> <th>流程名稱</th>
<th>接收日期</th> <th>接收日期</th>
@ -154,18 +212,46 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
<?php <?php
$rowspan = 1; $rowspan = 1;
$path = "localhost:3000/wms/sign/list.php";
foreach ($res_get as $key => $data) : foreach ($res_get as $key => $data) :
//嘗試將已結案隱藏起來 : 測試使用者體驗 //嘗試將已結案隱藏起來 : 測試使用者體驗
if ($data['flow_code'] !== 'Z') { if ($data['flow_code'] !== 'Z') {
?> ?>
<tr> <tr>
<td><a target="_blank" href="<?= $path . "?form_key=" . $data['form_key'] . "&token=$token" ?>"><?= $data['form_key']; ?></a></td> <td>
<?php
if (in_array($data['flow_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'] . "?fromsign=1&form_key=" . $data['form_key'] . "&token=$token" ?>">
作番大日程-合約號:<?= $contractno ?> 作番號:<?= $facilityno ?>
</a>
<?php
} else if (in_array($data['flow_name'], ['預計出貨日調整申請流程'])) {
$w_data = getwipwholeChangeContractdateDetailsDataByFormkey($link, $data['form_key'], $data['flow_id']);
$facilityno = $w_data['facilityno'];
$contractno = $w_data['contractno'];
?>
<a target="_blank" href="<?= $data['path'] . "?fromsign=1&form_key=" . $data['form_key'] . "&token=$token" ?>">
作番大日程-合約號:<?= $contractno ?> 作番號:<?= $facilityno ?>
</a>
<?php
} else {
?>
<a target="_blank" href="<?= $data['path'] . "?fromsign=1&form_key=" . $data['form_key'] . "&token=$token" ?>">
<?= $data['form_key']; ?>
</a>
<?php
}
?>
</td>
<td><?php echo $data['system_name']; ?></td> <td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['flow_name']; ?></td> <td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['update_date']; ?></td> <td><?php echo $data['update_date']; ?></td>
<td><?php echo $data['current_assigner_name']; ?></td> <td><?php echo $data['current_assigner_name']; ?></td>
<td><?php echo $data['flow_code'] == 'Z' ? "結案" : "未結案"; ?></td> <td><?php echo $data['flow_code'] == 'Z' ? "結案" : ""; ?></td>
</tr> </tr>

12
wms/wipwhole-index-function.php

@ -143,7 +143,7 @@ function getDataSql($department_id, $role_id, $user_id)
// 營業員主管或營業員 // 營業員主管或營業員
$department_arr = [ $department_arr = [
'310', '311', '312', '313', '314', '315', '310', '311', '312', '313', '314', '315',
'511', '512', '513', '514' '511', '512', '513', '514', '515'
]; ];
// 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘 // 補丁 黃孟澤 & 葉博澄 權限 = 李烘銘
@ -967,14 +967,14 @@ function getMarketingStatus($link, $user_department_id, $role_id, $status)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
return ""; return "";
if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) { if (in_array($user_department_id, [311, 312, 313, 314, 315])) {
if ($status == 1) { if ($status == 1) {
return checkNowFormStatus($link) == 'A' ? "" : "disabled"; return checkNowFormStatus($link) == 'A' ? "" : "disabled";
} else { } else {
return ""; return "";
} }
} }
if ($user_department_id == 501 || $user_department_id == 511 || $user_department_id == 512 || $user_department_id == 513 || $user_department_id == 514) { if (in_array($user_department_id, [501, 511, 512, 513, 514, 515])) {
if ($status == 1) { if ($status == 1) {
return checkNowFormStatus($link) == 'A' ? "" : "disabled"; return checkNowFormStatus($link) == 'A' ? "" : "disabled";
} else { } else {
@ -1258,7 +1258,7 @@ function getSaveEstimateInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8'])) if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '6', '9']))
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
@ -1277,7 +1277,7 @@ function saveInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6', '9']))
return true; return true;
if ($user_department_id == '545' && in_array($role_id, ['3', '6'])) if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true; return true;
@ -1347,4 +1347,4 @@ function checkUseridIsManager($user_id)
if (in_array($user_id, ['M0033'])) if (in_array($user_id, ['M0033']))
return true; return true;
return false; return false;
} }

64
wms/wipwhole-rec-invoice-edit-submit.php

@ -166,7 +166,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
} }
// 工勘變更通知繪圖人員
if (!empty($official_check_date)) { if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) { if ($official_check_date !== $old_official_check_date) {
$sql = " $sql = "
@ -252,7 +251,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($desin_documents_verify_file)) { if (!empty($desin_documents_verify_file)) {
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件"; $title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件"; $content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
";
$data = array( $data = array(
'kind' => 1, 'kind' => 1,
'related_id' => $id, 'related_id' => $id,
@ -522,25 +523,46 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|| in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545]) || in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])
) { ) {
$qc_official_type = $_POST['qc_official_type2'] ?: $row['qc_official_type']; // $outsourcer_type = $_POST['outsourcer_type'];
$outsourcer_type = $_POST['outsourcer_type']; // $qc_official_type = $_POST['qc_official_type2'] ?: $row['qc_official_type'];
$qc_date = $_POST['qc_date2'] ?: $row['qc_date']; // $qc_date = $_POST['qc_date2'] ?: $row['qc_date'];
$qc_date_owner = $_POST['qc_date2_owner'] ?: $row['qc_date_owner']; // $qc_date_owner = $_POST['qc_date2_owner'] ?: $row['qc_date_owner'];
$end_qc_date = $_POST['end_qc_date2'] ?: $row['end_qc_date']; // $end_qc_date = $_POST['end_qc_date2'] ?: $row['end_qc_date'];
$end_qc_date_owner = $_POST['end_qc_date2_owner'] ?: $row['end_qc_date_owner']; // $end_qc_date_owner = $_POST['end_qc_date2_owner'] ?: $row['end_qc_date_owner'];
$official_check_date = $_POST['official_check_date2'] ?: $row['official_check_date']; // $official_check_date = $_POST['official_check_date2'] ?: $row['official_check_date'];
$old_official_check_date = $_POST['old_official_check_date2'] ?: $row['old_official_check_date']; // $old_official_check_date = $_POST['old_official_check_date2'] ?: $row['old_official_check_date'];
$official_check_date_owner = $_POST['official_check_date2_owner'] ?: $row['official_check_date_owner']; // $official_check_date_owner = $_POST['official_check_date2_owner'] ?: $row['official_check_date_owner'];
$delivery_date = $_POST['delivery_date2'] ?: $row['delivery_date']; // $delivery_date = $_POST['delivery_date2'] ?: $row['delivery_date'];
$delivery_date_owner = $_POST['delivery_date2_owner'] ?: $row['delivery_date_owner']; // $delivery_date_owner = $_POST['delivery_date2_owner'] ?: $row['delivery_date_owner'];
$install_start_date = $_POST['install_start_date2'] ?: $row['install_start_date']; // $install_start_date = $_POST['install_start_date2'] ?: $row['install_start_date'];
$install_start_date_owner = $_POST['install_start_date2_owner'] ?: $row['install_start_date_owner']; // $install_start_date_owner = $_POST['install_start_date2_owner'] ?: $row['install_start_date_owner'];
$install_end_date = $_POST['install_end_date2'] ?: $row['install_end_date']; // $install_end_date = $_POST['install_end_date2'] ?: $row['install_end_date'];
$install_end_date_owner = $_POST['install_end_date2_owner'] ?: $row['install_end_date_owner']; // $install_end_date_owner = $_POST['install_end_date2_owner'] ?: $row['install_end_date_owner'];
$tryrun_start_date = $_POST['tryrun_start_date2'] ?: $row['tryrun_start_date']; // $tryrun_start_date = $_POST['tryrun_start_date2'] ?: $row['tryrun_start_date'];
$tryrun_start_date_owner = $_POST['tryrun_start_date2_owner'] ?: $row['tryrun_start_date_owner']; // $tryrun_start_date_owner = $_POST['tryrun_start_date2_owner'] ?: $row['tryrun_start_date_owner'];
$tryrun_end_date = $_POST['tryrun_end_date2'] ?: $row['tryrun_end_date']; // $tryrun_end_date = $_POST['tryrun_end_date2'] ?: $row['tryrun_end_date'];
$tryrun_end_date_owner = $_POST['tryrun_end_date2_owner'] ?: $row['tryrun_end_date_owner']; // $tryrun_end_date_owner = $_POST['tryrun_end_date2_owner'] ?: $row['tryrun_end_date_owner'];
$outsourcer_type = isset($_POST['outsourcer_type'])? $_POST['outsourcer_type'] : $row['outsourcer_type'];
$qc_official_type = isset($_POST['qc_official_type2'])? $_POST['qc_official_type2'] : $row['qc_official_type'];
$qc_date = isset($_POST['qc_date2'])? $_POST['qc_date2'] : $row['qc_date'];
$qc_date_owner = isset($_POST['qc_date2_owner'])? $_POST['qc_date2_owner'] : $row['qc_date_owner'];
$end_qc_date = isset($_POST['end_qc_date2'])? $_POST['end_qc_date2'] : $row['end_qc_date'];
$end_qc_date_owner = isset($_POST['end_qc_date2_owner'])? $_POST['end_qc_date2_owner'] : $row['end_qc_date_owner'];
$official_check_date = isset($_POST['official_check_date2'])? $_POST['official_check_date2'] : $row['official_check_date'];
$old_official_check_date = isset($_POST['old_official_check_date2'])? $_POST['old_official_check_date2'] : $row['old_official_check_date'];
$official_check_date_owner = isset($_POST['official_check_date2_owner'])? $_POST['official_check_date2_owner'] : $row['official_check_date_owner'];
$delivery_date = isset($_POST['delivery_date2'])? $_POST['delivery_date2'] : $row['delivery_date'];
$delivery_date_owner = isset($_POST['delivery_date2_owner'])? $_POST['delivery_date2_owner'] : $row['delivery_date_owner'];
$install_start_date = isset($_POST['install_start_date2'])? $_POST['install_start_date2'] : $row['install_start_date'];
$install_start_date_owner = isset($_POST['install_start_date2_owner'])? $_POST['install_start_date2_owner'] : $row['install_start_date_owner'];
$install_end_date = isset($_POST['install_end_date2'])? $_POST['install_end_date2'] : $row['install_end_date'];
$install_end_date_owner = isset($_POST['install_end_date2_owner'])? $_POST['install_end_date2_owner'] : $row['install_end_date_owner'];
$tryrun_start_date = isset($_POST['tryrun_start_date2'])? $_POST['tryrun_start_date2'] : $row['tryrun_start_date'];
$tryrun_start_date_owner = isset($_POST['tryrun_start_date2_owner'])? $_POST['tryrun_start_date2_owner'] : $row['tryrun_start_date_owner'];
$tryrun_end_date = isset($_POST['tryrun_end_date2'])? $_POST['tryrun_end_date2'] : $row['tryrun_end_date'];
$tryrun_end_date_owner = isset($_POST['tryrun_end_date2_owner'])? $_POST['tryrun_end_date2_owner'] : $row['tryrun_end_date_owner'];
$updatesql .= " $updatesql .= "
qc_official_type = '$qc_official_type', qc_official_type = '$qc_official_type',

18
wms/wipwhole-renovate-index-function.php

@ -414,7 +414,7 @@ function getDataSql($department_id, $role_id, $user_id)
// 營業員主管或營業員 // 營業員主管或營業員
$department_arr = [ $department_arr = [
'310', '311', '312', '313', '314', '315', '310', '311', '312', '313', '314', '315',
'511', '512', '513', '514' '511', '512', '513', '514', '515'
]; ];
$sql_cmd = sql_myself($user_id, "salesid"); $sql_cmd = sql_myself($user_id, "salesid");
@ -631,7 +631,7 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
$contract_type = 'B'; $contract_type = 'B';
// 營業員主管或營業員 // 營業員主管或營業員
$department_arr = ['501', '511', '512', '513', '514']; $department_arr = ['501', '511', '512', '513', '514', '515'];
$sql_cmd = sql_myself($user_id, "salesid"); $sql_cmd = sql_myself($user_id, "salesid");
$sql = " $sql = "
@ -967,14 +967,14 @@ function getMarketingStatus($link, $user_department_id, $role_id, $status)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
return ""; return "";
if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) { if (in_array($user_department_id, [311, 312, 313, 314, 315])) {
if ($status == 1) { if ($status == 1) {
return checkNowFormStatus($link) == 'B' ? "" : "disabled"; return checkNowFormStatus($link) == 'B' ? "" : "disabled";
} else { } else {
return ""; return "";
} }
} }
if ($user_department_id == 501 || $user_department_id == 511 || $user_department_id == 512 || $user_department_id == 513 || $user_department_id == 514) { if (in_array($user_department_id, [501, 511, 512, 513, 514, 515])) {
if ($status == 1) { if ($status == 1) {
return checkNowFormStatus($link) == 'B' ? "" : "disabled"; return checkNowFormStatus($link) == 'B' ? "" : "disabled";
} else { } else {
@ -1060,7 +1060,7 @@ function getYingyeokOptions($link)
accountid AS val , accountid AS val ,
name AS label name AS label
FROM `account` FROM `account`
WHERE `department_id` IN ('311','312','313','314','315','511','512','513','514') WHERE `department_id` IN ('311','312','313','314','315','511','512','513','514','515')
ORDER BY accountid ASC ORDER BY accountid ASC
"; ";
return mysqli_query($link, $sql); return mysqli_query($link, $sql);
@ -1172,7 +1172,7 @@ function getWipwholeChangeButtonStatus($user_department_id)
{ {
if (in_array($user_department_id, [311, 312, 313, 314, 315])) if (in_array($user_department_id, [311, 312, 313, 314, 315]))
return true; return true;
if (in_array($user_department_id, [501, 511, 512, 513, 514])) if (in_array($user_department_id, [501, 511, 512, 513, 514, 515]))
return true; return true;
if (in_array($user_department_id, [521, 531, 220, 250])) if (in_array($user_department_id, [521, 531, 220, 250]))
return true; return true;
@ -1202,7 +1202,7 @@ function getSaveEstimateInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8'])) if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '6', '9']))
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
@ -1221,7 +1221,7 @@ function getSaveInstallDataButtonStatus($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6', '9']))
return true; return true;
if ($user_department_id == '545' && in_array($role_id, ['3', '6'])) if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true; return true;
@ -1289,4 +1289,4 @@ function checkUseridIsManager($user_id)
if (in_array($user_id, ['M0033'])) if (in_array($user_id, ['M0033']))
return true; return true;
return false; return false;
} }

373
wms/wipwhole-renovate-rec-invoice-edit-submit.php

@ -1,6 +1,8 @@
<?php <?php
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
include("class/Cnotice.php");
$cn = new Cnotice();
if ($_POST['form_name'] == 'main_form') { if ($_POST['form_name'] == 'main_form') {
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
@ -8,28 +10,17 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));
} }
// 時間戳記
$datetime = date("Y-m-d H:i:s"); $datetime = date("Y-m-d H:i:s");
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
// 合約號
$contractno = $_POST['contractno']; $contractno = $_POST['contractno'];
// 號機
$facility_temp_no = $_POST['facility_temp_no']; $facility_temp_no = $_POST['facility_temp_no'];
// 汰改方案 B
$renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE); $renovate_type = json_encode($_POST['renovate_type'], JSON_UNESCAPED_UNICODE);
// 作番號
$facilityno = $_POST['facilityno']; $facilityno = $_POST['facilityno'];
// 客戶名稱
$custom = $_POST['custom']; $custom = $_POST['custom'];
// 工地負責人
$site_manager = $_POST['site_manager']; $site_manager = $_POST['site_manager'];
// 緯度
$latitude = $_POST['latitude']; $latitude = $_POST['latitude'];
// 經度
$longitude = $_POST['longitude']; $longitude = $_POST['longitude'];
$weight = $_POST['weight']; $weight = $_POST['weight'];
$numberofpassenger = $_POST['numberofpassenger']; $numberofpassenger = $_POST['numberofpassenger'];
$numberofstop = $_POST['numberofstop']; $numberofstop = $_POST['numberofstop'];
$numberoffloor = $_POST['numberoffloor']; $numberoffloor = $_POST['numberoffloor'];
@ -38,64 +29,45 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$facility_kind = $_POST['facility_kind']; $facility_kind = $_POST['facility_kind'];
$address = $_POST['address']; $address = $_POST['address'];
$real_address = $_POST['real_address']; $real_address = $_POST['real_address'];
//合約到貨日
$contract_arrival_date = $_POST['contract_arrival_date']; $contract_arrival_date = $_POST['contract_arrival_date'];
//合約到貨日
$real_contract_arrival_date = $_POST['real_contract_arrival_date']; $real_contract_arrival_date = $_POST['real_contract_arrival_date'];
//营业规格确认
$sales_spec_verify = $_POST['sales_spec_verify']; $sales_spec_verify = $_POST['sales_spec_verify'];
$sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at']; $sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at'];
$sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner']; $sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner'];
//客户颜色确认
$customer_color_verify = $_POST['customer_color_verify']; $customer_color_verify = $_POST['customer_color_verify'];
$customer_color_verify_at = $_POST['customer_color_verify_at'] ?: $row['customer_color_verify_at']; $customer_color_verify_at = $_POST['customer_color_verify_at'] ?: $row['customer_color_verify_at'];
$customer_color_verify_owner = $_POST['customer_color_verify_owner'] ?: $row['customer_color_verify_owner']; $customer_color_verify_owner = $_POST['customer_color_verify_owner'] ?: $row['customer_color_verify_owner'];
//客户颜色确认
$customer_style_verify = $_POST['customer_style_verify']; $customer_style_verify = $_POST['customer_style_verify'];
$customer_style_verify_at = $_POST['customer_style_verify_at'] ?: $row['customer_style_verify_at']; $customer_style_verify_at = $_POST['customer_style_verify_at'] ?: $row['customer_style_verify_at'];
$customer_style_verify_owner = $_POST['customer_style_verify_owner'] ?: $row['customer_style_verify_owner']; $customer_style_verify_owner = $_POST['customer_style_verify_owner'] ?: $row['customer_style_verify_owner'];
//工勘聯絡表
$site_survey_contact_form_verify = $_POST['site_survey_contact_form_verify']; $site_survey_contact_form_verify = $_POST['site_survey_contact_form_verify'];
$site_survey_contact_form_verify_at = $_POST['site_survey_contact_form_verify_at'] ?: $row['site_survey_contact_form_verify_at']; $site_survey_contact_form_verify_at = $_POST['site_survey_contact_form_verify_at'] ?: $row['site_survey_contact_form_verify_at'];
$site_survey_contact_form_verify_owner = $_POST['site_survey_contact_form_verify_owner'] ?: $row['site_survey_contact_form_verify_owner']; $site_survey_contact_form_verify_owner = $_POST['site_survey_contact_form_verify_owner'] ?: $row['site_survey_contact_form_verify_owner'];
//设计规格确认
$desin_spec_verify = $_POST['desin_spec_verify']; $desin_spec_verify = $_POST['desin_spec_verify'];
$desin_spec_verify_at = $_POST['desin_spec_verify_at'] ?: $row['desin_spec_verify_at']; $desin_spec_verify_at = $_POST['desin_spec_verify_at'] ?: $row['desin_spec_verify_at'];
$desin_spec_verify_owner = $_POST['desin_spec_verify_owner'] ?: $row['desin_spec_verify_owner']; $desin_spec_verify_owner = $_POST['desin_spec_verify_owner'] ?: $row['desin_spec_verify_owner'];
//设计计划图确认
$desin_planning_verify = $_POST['desin_planning_verify']; $desin_planning_verify = $_POST['desin_planning_verify'];
$desin_planning_verify_at = $_POST['desin_planning_verify_at'] ?: $row['desin_planning_verify_at']; $desin_planning_verify_at = $_POST['desin_planning_verify_at'] ?: $row['desin_planning_verify_at'];
$desin_planning_verify_owner = $_POST['desin_planning_verify_owner'] ?: $row['desin_planning_verify_owner']; $desin_planning_verify_owner = $_POST['desin_planning_verify_owner'] ?: $row['desin_planning_verify_owner'];
//设计颜色确认
$desin_color_verify = $_POST['desin_color_verify']; $desin_color_verify = $_POST['desin_color_verify'];
$desin_color_verify_at = $_POST['desin_color_verify_at'] ?: $row['desin_color_verify_at']; $desin_color_verify_at = $_POST['desin_color_verify_at'] ?: $row['desin_color_verify_at'];
$desin_color_verify_owner = $_POST['desin_color_verify_owner'] ?: $row['desin_color_verify_owner']; $desin_color_verify_owner = $_POST['desin_color_verify_owner'] ?: $row['desin_color_verify_owner'];
//设计仕样确认
$desin_style_verify = $_POST['desin_style_verify']; $desin_style_verify = $_POST['desin_style_verify'];
$desin_style_verify_at = $_POST['desin_style_verify_at'] ?: $row['desin_style_verify_at']; $desin_style_verify_at = $_POST['desin_style_verify_at'] ?: $row['desin_style_verify_at'];
$desin_style_verify_owner = $_POST['desin_style_verify_owner'] ?: $row['desin_style_verify_owner']; $desin_style_verify_owner = $_POST['desin_style_verify_owner'] ?: $row['desin_style_verify_owner'];
//设计主管確認
$desin_leader_verify = $_POST['desin_leader_verify']; $desin_leader_verify = $_POST['desin_leader_verify'];
$desin_leader_verify_at = $_POST['desin_leader_verify_at'] ?: $row['desin_leader_verify_at']; $desin_leader_verify_at = $_POST['desin_leader_verify_at'] ?: $row['desin_leader_verify_at'];
$desin_leader_verify_owner = $_POST['desin_leader_verify_owner'] ?: $row['desin_leader_verify_owner']; $desin_leader_verify_owner = $_POST['desin_leader_verify_owner'] ?: $row['desin_leader_verify_owner'];
//楼高通报
$building_heigh_verify = $_POST['building_heigh_verify']; $building_heigh_verify = $_POST['building_heigh_verify'];
$building_heigh_verify_at = $_POST['building_heigh_verify_at'] ?: $row['building_heigh_verify_at']; $building_heigh_verify_at = $_POST['building_heigh_verify_at'] ?: $row['building_heigh_verify_at'];
$building_heigh_verify_owner = $_POST['building_heigh_verify_owner'] ?: $row['building_heigh_verify_owner']; $building_heigh_verify_owner = $_POST['building_heigh_verify_owner'] ?: $row['building_heigh_verify_owner'];
//客户计划图确认
$customer_planning_verify = $_POST['customer_planning_verify']; $customer_planning_verify = $_POST['customer_planning_verify'];
$customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at']; $customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at'];
$customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner']; $customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner'];
//工勘
$site_survey_contact_verify = $_POST['site_survey_contact_verify']; $site_survey_contact_verify = $_POST['site_survey_contact_verify'];
$site_survey_contact_verify_at = $_POST['site_survey_contact_verify_at'] ?: $row['site_survey_contact_verify_at']; $site_survey_contact_verify_at = $_POST['site_survey_contact_verify_at'] ?: $row['site_survey_contact_verify_at'];
$site_survey_contact_verify_owner = $_POST['site_survey_contact_verify_owner'] ?: $row['site_survey_contact_verify_owner']; $site_survey_contact_verify_owner = $_POST['site_survey_contact_verify_owner'] ?: $row['site_survey_contact_verify_owner'];
$old_site_survey_contact_verify = $_POST['old_site_survey_contact_verify']; $old_site_survey_contact_verify = $_POST['old_site_survey_contact_verify'];
// 工務助理
$outsourcer_type = $_POST['outsourcer_type']; $outsourcer_type = $_POST['outsourcer_type'];
$install_outsourcer = $_POST['install_outsourcer']; $install_outsourcer = $_POST['install_outsourcer'];
$install_outsourcer_owner = $_POST['install_outsourcer_owner']; $install_outsourcer_owner = $_POST['install_outsourcer_owner'];
@ -114,148 +86,37 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$estimate_tryrun_end_date = $_POST['estimate_tryrun_end_date']; $estimate_tryrun_end_date = $_POST['estimate_tryrun_end_date'];
$estimate_tryrun_end_date_owner = $_POST['estimate_tryrun_end_date_owner']; $estimate_tryrun_end_date_owner = $_POST['estimate_tryrun_end_date_owner'];
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark']; $warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
$warehouseid = $_POST['warehouseid'] ?: $row['warehouseid'];
$old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid'];
// 指派工勘人員
if ($warehouseid !== $old_warehouseid) {
if (checkNowFormStatus($link) == 'A') {
$sql = "SELECT form_key FROM flow
WHERE form_id = '$id'
AND flow_id = 'wws02'
AND flow_code = 'A'
";
$result = mysqli_query($link, $sql);
$form_key = $result->fetch_row()[0];
if (!empty($form_key)) {
$sql = "UPDATE wipwholestatus
SET warehouseid = '$warehouseid'
WHERE id = '$id';
";
mysqli_query($link, $sql);
$sql = "UPDATE subflow
SET current_assigner = '$warehouseid'
WHERE 1 = 1
AND seq = '1'
AND form_key = '$form_key';
";
mysqli_query($link, $sql);
}
}
}
// 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array(
"1" => "請選擇",
"0" => "已確認",
"2" => "無工勘需求",
"A" => "未動工",
"B" => "地下室施工",
"C" => "打樁",
"D" => "地基",
"E" => "挖土",
"G" => "機房",
"H" => "機械式淨高",
"M" => "樓中樓",
"OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)",
"R" => "R 樓",
"S" => "停工",
"T" => "TOP",
"TC" => "頂部間隙",
"TS" => "行程",
"TH" => "全高",
"Y" => "已搭、已出",
"YB" => "退購結案",
"YF" => "既有建物",
"YN" => "已搭、未出"
);
$sql = "
SELECT accountid
FROM account
WHERE department_id = '321'
AND role_id IN ('2','3','5');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
$content = "客戶:$custom
作番:$facilityno
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
$sql = "
INSERT INTO notice(
kind,
related_id,
title,
content,
haveread,
permission,
creater,
create_at
)VALUES(
'1',
'$id',
'$title',
'$content',
null,
'$permission',
'$creater',
'$create_at'
);
";
mysqli_query($link, $sql);
}
}
//是否齊備
$shengguanok_status = $_POST['shengguanok_status']; $shengguanok_status = $_POST['shengguanok_status'];
$shengguanok_status_at = $_POST['shengguanok_status_at']; $shengguanok_status_at = $_POST['shengguanok_status_at'];
$shengguanok_status_owner = $_POST['shengguanok_status_owner'] ?: $row['shengguanok_status_owner']; $shengguanok_status_owner = $_POST['shengguanok_status_owner'] ?: $row['shengguanok_status_owner'];
//下單日(普萊特富)
$prattford_order_date_verify = $_POST['prattford_order_date_verify']; $prattford_order_date_verify = $_POST['prattford_order_date_verify'];
$prattford_order_date = $_POST['prattford_order_date']; $prattford_order_date = $_POST['prattford_order_date'];
$prattford_order_date_owner = $_POST['prattford_order_date_owner'] ?: $row['prattford_order_date_owner']; $prattford_order_date_owner = $_POST['prattford_order_date_owner'] ?: $row['prattford_order_date_owner'];
// 預計發貨日(到港日)
$estimated_shipping_date_verify = $_POST['estimated_shipping_date_verify']; $estimated_shipping_date_verify = $_POST['estimated_shipping_date_verify'];
$estimated_shipping_date = $_POST['estimated_shipping_date']; $estimated_shipping_date = $_POST['estimated_shipping_date'];
$estimated_shipping_date_owner = $_POST['estimated_shipping_date_owner'] ?: $row['estimated_shipping_date_owner']; $estimated_shipping_date_owner = $_POST['estimated_shipping_date_owner'] ?: $row['estimated_shipping_date_owner'];
// 預計船期(改成預計到廠日)
$estimated_shipping_schedule_date_verify = $_POST['estimated_shipping_schedule_date_verify']; $estimated_shipping_schedule_date_verify = $_POST['estimated_shipping_schedule_date_verify'];
$estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date']; $estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date'];
$estimated_shipping_schedule_date_owner = $_POST['estimated_shipping_schedule_date_owner'] ?: $row['estimated_shipping_schedule_date_owner']; $estimated_shipping_schedule_date_owner = $_POST['estimated_shipping_schedule_date_owner'] ?: $row['estimated_shipping_schedule_date_owner'];
// 普來特富發貨類別
$goods_type = $_POST['goods_type'] ?: $row['goods_type']; $goods_type = $_POST['goods_type'] ?: $row['goods_type'];
$goods_type_date = $_POST['goods_type_date']; $goods_type_date = $_POST['goods_type_date'];
$goods_type_owner = $_POST['goods_type_owner'] ?: $row['goods_type_owner']; $goods_type_owner = $_POST['goods_type_owner'] ?: $row['goods_type_owner'];
// 台灣自理發貨類別
$taiwan_goods_type = $_POST['taiwan_goods_type'] ?: $row['taiwan_goods_type']; $taiwan_goods_type = $_POST['taiwan_goods_type'] ?: $row['taiwan_goods_type'];
$taiwan_goods_type_date = $_POST['taiwan_goods_type_date']; $taiwan_goods_type_date = $_POST['taiwan_goods_type_date'];
$taiwan_goods_type_owner = $_POST['taiwan_goods_type_owner'] ?: $row['taiwan_goods_type_owner']; $taiwan_goods_type_owner = $_POST['taiwan_goods_type_owner'] ?: $row['taiwan_goods_type_owner'];
// 實際到貨日
$arrival_date_verify = $_POST['arrival_date_verify'] ?: $row['arrival_date_verify']; $arrival_date_verify = $_POST['arrival_date_verify'] ?: $row['arrival_date_verify'];
$actual_tofactory_date = $_POST['actual_tofactory_date']; $actual_tofactory_date = $_POST['actual_tofactory_date'];
$arrival_date_owner = $_POST['arrival_date_owner'] ?: $row['arrival_date_owner']; $arrival_date_owner = $_POST['arrival_date_owner'] ?: $row['arrival_date_owner'];
// 各部門備註
$marketing_remark = $_POST['marketing_remark'] ?: $row['marketing_remark']; $marketing_remark = $_POST['marketing_remark'] ?: $row['marketing_remark'];
$desin_remark = $_POST['desin_remark'] ?: $row['desin_remark']; $desin_remark = $_POST['desin_remark'] ?: $row['desin_remark'];
$desin_leader_remark = $_POST['desin_leader_remark'] ?: $row['desin_leader_remark']; $desin_leader_remark = $_POST['desin_leader_remark'] ?: $row['desin_leader_remark'];
$warehouse_remark = $_POST['warehouse_remark'] ?: $row['warehouse_remark']; $warehouse_remark = $_POST['warehouse_remark'] ?: $row['warehouse_remark'];
$yewu_remark = $_POST['yewu_remark'] ?: $row['yewu_remark']; $yewu_remark = $_POST['yewu_remark'] ?: $row['yewu_remark'];
$shengguan_remark = $_POST['shengguan_remark'] ?: $row['shengguan_remark']; $shengguan_remark = $_POST['shengguan_remark'] ?: $row['shengguan_remark'];
// 台製件
$desin_taiwan_items_no = json_encode($_POST['desin_taiwan_items_no'], JSON_UNESCAPED_UNICODE); $desin_taiwan_items_no = json_encode($_POST['desin_taiwan_items_no'], JSON_UNESCAPED_UNICODE);
$desin_taiwan_items_name = json_encode($_POST['desin_taiwan_items_name'], JSON_UNESCAPED_UNICODE); $desin_taiwan_items_name = json_encode($_POST['desin_taiwan_items_name'], JSON_UNESCAPED_UNICODE);
$desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no; $desin_taiwan_items_no = $desin_taiwan_items_no == 'null' ? null : $desin_taiwan_items_no;
$desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name; $desin_taiwan_items_name = $desin_taiwan_items_name == 'null' ? null : $desin_taiwan_items_name;
// 品証部
$qc_date = $_POST['qc_date'] ?: $row['qc_date']; $qc_date = $_POST['qc_date'] ?: $row['qc_date'];
$qc_date_owner = $_POST['qc_date_owner'] ?: $row['qc_date_owner']; $qc_date_owner = $_POST['qc_date_owner'] ?: $row['qc_date_owner'];
$end_qc_date = $_POST['end_qc_date'] ?: $row['end_qc_date']; $end_qc_date = $_POST['end_qc_date'] ?: $row['end_qc_date'];
@ -267,19 +128,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date']; $old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date'];
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner']; $delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
$warehouseid = $_POST['warehouseid'] ?: $row['warehouseid'];
$old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid'];
$creater = $_POST['creater']; $creater = $_POST['creater'];
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
// 上傳附件 // 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php"; include "wipwhole-rec-invoice-edit-fileupload.php";
// 指派工勘人員 // 指派工勘人員
if ($warehouseid !== $old_warehouseid) { if ($warehouseid !== $old_warehouseid) {
if (checkNowFormStatus($link) == 'G') { if (checkNowFormStatus($link) == 'A') {
$sql = "SELECT form_key FROM flow $sql = "SELECT form_key FROM flow
WHERE form_id = '$id' WHERE form_id = '$id'
AND flow_id = 'wws01' AND flow_id = 'wws02'
AND flow_code = 'G' AND flow_code = 'A'
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$form_key = $result->fetch_row()[0]; $form_key = $result->fetch_row()[0];
@ -300,44 +164,144 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
} }
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
FROM account
WHERE department_id = '250'
AND role_id IN ('1','2','3','4');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
}
// 工勘變更通知繪圖人員 // 工勘變更通知繪圖人員
if ($official_check_date !== $old_official_check_date) { if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array(
"1" => "請選擇",
"0" => "已確認",
"2" => "無工勘需求",
"A" => "未動工",
"B" => "地下室施工",
"C" => "打樁",
"D" => "地基",
"E" => "挖土",
"G" => "機房",
"H" => "機械式淨高",
"M" => "樓中樓",
"OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)",
"R" => "R 樓",
"S" => "停工",
"T" => "TOP",
"TC" => "頂部間隙",
"TS" => "行程",
"TH" => "全高",
"Y" => "已搭、已出",
"YB" => "退購結案",
"YF" => "既有建物",
"YN" => "已搭、未出"
);
$sql = " $sql = "
SELECT accountid SELECT accountid
FROM account FROM account
WHERE department_id = '250' WHERE department_id = '321'
AND role_id IN ('1','2','3','4'); AND role_id IN ('2','3','5');
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
foreach ($result as $row) { foreach ($result as $row) {
$permission = $row["accountid"]; $permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更"; $title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
$content = "客戶:$custom $content = "客戶:$custom
作番:$facilityno 作番:$facilityno
官檢日 $old_official_check_date => $official_check_date"; 工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
$sql = " $data = array(
INSERT INTO notice( 'kind' => 1,
kind, 'related_id' => $id,
related_id, 'title' => $title,
title, 'content' => $content,
content, 'permission' => $permission,
haveread, 'creater' => $creater,
permission, 'create_at' => date("Y-m-d H:i:s")
creater,
create_at
)VALUES(
'1',
'$id',
'$title',
'$content',
null,
'$permission',
'$creater',
'" . date("Y-m-d H:i:s") . "'
); );
"; $cn->sendx($data);
mysqli_query($link, $sql); }
}
if (!empty($desin_documents_verify_file)) {
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => "M0168",
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
// 官檢日及移交日通知生管人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$permission = "M0168";
$title = "官檢日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
}
}
if (!empty($delivery_date)) {
if ($delivery_date !== $old_delivery_date) {
$permission = "M0168";
$title = "移交日變更 客戶:$custom 作番:$facilityno";
$content = "客戶:$custom
作番:$facilityno
移交日 $old_delivery_date => $delivery_date";
$data = array(
'kind' => 1,
'related_id' => $id,
'title' => $title,
'content' => $content,
'permission' => $permission,
'creater' => $creater,
'create_at' => date("Y-m-d H:i:s")
);
$cn->sendx($data);
} }
} }
@ -361,7 +325,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
$updatesql .= empty($building_heigh_verify_file) ? "" : "building_heigh_verify_file = '$building_heigh_verify_file',"; $updatesql .= empty($building_heigh_verify_file) ? "" : "building_heigh_verify_file = '$building_heigh_verify_file',";
$updatesql .= empty($site_survey_contact_verify_file) ? "" : "site_survey_contact_verify_file = '$site_survey_contact_verify_file',"; $updatesql .= empty($site_survey_contact_verify_file) ? "" : "site_survey_contact_verify_file = '$site_survey_contact_verify_file',";
} }
if (in_array($user_department_id, [311, 312, 313, 314, 315, 511, 512, 513, 514, 515])) { if (in_array($user_department_id, [311, 312, 313, 314, 315, 511, 512, 513, 514, 515])) {
@ -554,8 +517,69 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
// 工務助理 // 工務助理
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117'])) { if (
in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117', 'M0054'])
|| in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])
) {
// $outsourcer_type = $_POST['outsourcer_type'];
// $qc_official_type = $_POST['qc_official_type2'] ?: $row['qc_official_type'];
// $qc_date = $_POST['qc_date2'] ?: $row['qc_date'];
// $qc_date_owner = $_POST['qc_date2_owner'] ?: $row['qc_date_owner'];
// $end_qc_date = $_POST['end_qc_date2'] ?: $row['end_qc_date'];
// $end_qc_date_owner = $_POST['end_qc_date2_owner'] ?: $row['end_qc_date_owner'];
// $official_check_date = $_POST['official_check_date2'] ?: $row['official_check_date'];
// $old_official_check_date = $_POST['old_official_check_date2'] ?: $row['old_official_check_date'];
// $official_check_date_owner = $_POST['official_check_date2_owner'] ?: $row['official_check_date_owner'];
// $delivery_date = $_POST['delivery_date2'] ?: $row['delivery_date'];
// $delivery_date_owner = $_POST['delivery_date2_owner'] ?: $row['delivery_date_owner'];
// $install_start_date = $_POST['install_start_date2'] ?: $row['install_start_date'];
// $install_start_date_owner = $_POST['install_start_date2_owner'] ?: $row['install_start_date_owner'];
// $install_end_date = $_POST['install_end_date2'] ?: $row['install_end_date'];
// $install_end_date_owner = $_POST['install_end_date2_owner'] ?: $row['install_end_date_owner'];
// $tryrun_start_date = $_POST['tryrun_start_date2'] ?: $row['tryrun_start_date'];
// $tryrun_start_date_owner = $_POST['tryrun_start_date2_owner'] ?: $row['tryrun_start_date_owner'];
// $tryrun_end_date = $_POST['tryrun_end_date2'] ?: $row['tryrun_end_date'];
// $tryrun_end_date_owner = $_POST['tryrun_end_date2_owner'] ?: $row['tryrun_end_date_owner'];
$outsourcer_type = isset($_POST['outsourcer_type']) ? $_POST['outsourcer_type'] : $row['outsourcer_type'];
$qc_official_type = isset($_POST['qc_official_type2']) ? $_POST['qc_official_type2'] : $row['qc_official_type'];
$qc_date = isset($_POST['qc_date2']) ? $_POST['qc_date2'] : $row['qc_date'];
$qc_date_owner = isset($_POST['qc_date2_owner']) ? $_POST['qc_date2_owner'] : $row['qc_date_owner'];
$end_qc_date = isset($_POST['end_qc_date2']) ? $_POST['end_qc_date2'] : $row['end_qc_date'];
$end_qc_date_owner = isset($_POST['end_qc_date2_owner']) ? $_POST['end_qc_date2_owner'] : $row['end_qc_date_owner'];
$official_check_date = isset($_POST['official_check_date2']) ? $_POST['official_check_date2'] : $row['official_check_date'];
$old_official_check_date = isset($_POST['old_official_check_date2']) ? $_POST['old_official_check_date2'] : $row['old_official_check_date'];
$official_check_date_owner = isset($_POST['official_check_date2_owner']) ? $_POST['official_check_date2_owner'] : $row['official_check_date_owner'];
$delivery_date = isset($_POST['delivery_date2']) ? $_POST['delivery_date2'] : $row['delivery_date'];
$delivery_date_owner = isset($_POST['delivery_date2_owner']) ? $_POST['delivery_date2_owner'] : $row['delivery_date_owner'];
$install_start_date = isset($_POST['install_start_date2']) ? $_POST['install_start_date2'] : $row['install_start_date'];
$install_start_date_owner = isset($_POST['install_start_date2_owner']) ? $_POST['install_start_date2_owner'] : $row['install_start_date_owner'];
$install_end_date = isset($_POST['install_end_date2']) ? $_POST['install_end_date2'] : $row['install_end_date'];
$install_end_date_owner = isset($_POST['install_end_date2_owner']) ? $_POST['install_end_date2_owner'] : $row['install_end_date_owner'];
$tryrun_start_date = isset($_POST['tryrun_start_date2']) ? $_POST['tryrun_start_date2'] : $row['tryrun_start_date'];
$tryrun_start_date_owner = isset($_POST['tryrun_start_date2_owner']) ? $_POST['tryrun_start_date2_owner'] : $row['tryrun_start_date_owner'];
$tryrun_end_date = isset($_POST['tryrun_end_date2']) ? $_POST['tryrun_end_date2'] : $row['tryrun_end_date'];
$tryrun_end_date_owner = isset($_POST['tryrun_end_date2_owner']) ? $_POST['tryrun_end_date2_owner'] : $row['tryrun_end_date_owner'];
$updatesql .= " $updatesql .= "
qc_official_type = '$qc_official_type',
install_start_date = '$install_start_date',
install_start_date_owner = '$install_start_date_owner',
install_end_date = '$install_end_date',
install_end_date_owner = '$install_end_date_owner',
tryrun_start_date = '$tryrun_start_date',
tryrun_start_date_owner = '$tryrun_start_date_owner',
tryrun_end_date = '$tryrun_end_date',
tryrun_end_date_owner = '$tryrun_end_date_owner',
delivery_date = '$delivery_date',
delivery_date_owner = '$delivery_date_owner',
qc_date = '$qc_date',
qc_date_owner = '$qc_date_owner',
end_qc_date = '$end_qc_date',
end_qc_date_owner = '$end_qc_date_owner',
official_check_date = '$official_check_date',
official_check_date_owner = '$official_check_date_owner',
outsourcer_type = '$outsourcer_type', outsourcer_type = '$outsourcer_type',
install_outsourcer = '$install_outsourcer', install_outsourcer = '$install_outsourcer',
install_outsourcer_owner = '$install_outsourcer_owner', install_outsourcer_owner = '$install_outsourcer_owner',
@ -575,6 +599,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
estimate_tryrun_end_date_owner = '$estimate_tryrun_end_date_owner', estimate_tryrun_end_date_owner = '$estimate_tryrun_end_date_owner',
warehouse_assistant_remark = '$warehouse_assistant_remark', warehouse_assistant_remark = '$warehouse_assistant_remark',
"; ";
if (!empty($plan_diagram_file)) { if (!empty($plan_diagram_file)) {
$updatesql .= "plan_diagram_file = '$plan_diagram_file', "; $updatesql .= "plan_diagram_file = '$plan_diagram_file', ";
$updatesql .= " $updatesql .= "
@ -588,7 +613,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
"; ";
} }
if (!empty($outsourcer_contract_file)) { if (!empty($outsourcer_contract_file)) {
$updatesql .= "outsourcer_contract_file = '$outsourcer_contract_file', "; echo $updatesql .= "outsourcer_contract_file = '$outsourcer_contract_file', ";
} }
} }

14
wms/wipwhole-renovate-rec-invoice-edit.php

@ -567,6 +567,20 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<div id="tabs-1"> <div id="tabs-1">
<table class="table table-bordered" style="width:100%"> <table class="table table-bordered" style="width:100%">
<tbody style="font-weight: bolder;margin-bottom: 20px"> <tbody style="font-weight: bolder;margin-bottom: 20px">
<tr>
<td>營業人員確認項</td>
<td>
<?php
echo "營業擔當:" . $row['salesid'] . accountid2name()[$row['salesid']];
?>
<br />
<?php
if (!checkUseridIsManager($row['salesid'])) {
echo "營業擔當主管:" . manage_class($row['salesid'])[0] . accountid2name(manage_class($row['salesid'])[0])[manage_class($row['salesid'])[0]];
}
?>
</td>
</tr>
<tr> <tr>
<td style="vertical-align: middle;width:auto;">營業確認規格</td> <td style="vertical-align: middle;width:auto;">營業確認規格</td>
<td style="width:150px;"> <td style="width:150px;">

123
wms/wipwhole-wipinstallstatus-index-modal.php

@ -0,0 +1,123 @@
<?php
// ini_set('display_errors', 'on');
include "database.php";
$method = $_POST['method'];
$type = $_POST['contract_type'];
$mtype = $_POST['renovate_type'];
$radsY = $_POST['radsY'];
$radsM = str_pad($_POST['radsM'], 2, "0", STR_PAD_LEFT);
$year = $_POST['radsYi'];
$month = str_pad($_POST['start_month'], 2, "0", STR_PAD_LEFT);
if ($method == 'getShippingDetails')
echo getShippingDetails($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getEndingDetails')
echo getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getInstallingDetails')
echo getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getInstalling2Details')
echo getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month);
// 出貨台數
function getShippingDetails($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 工收台數
function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
AND (delivery_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
OR
official_check_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 試車完台數
function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
AND tryrun_end_date <= '$year-$month-31'
AND tryrun_end_date != ''
AND tryrun_end_date IS NOT NULL
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 在裝中台數
function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
AND (
delivery_date IS NULL
OR delivery_date = ''
OR delivery_date >= '$year-$month-31'
)
AND(
official_check_date IS NULL
OR official_check_date = ''
OR official_check_date >= '$year-$month-31'
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}

307
wms/wipwhole-wipinstallstatus-index.php

@ -27,7 +27,6 @@ function getShipping($type, $mtype, $radsY, $radsM, $year, $month)
"; ";
$sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
// echo $sql . "<br/>";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC); $data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count']; return $data['all_count'];
@ -55,13 +54,11 @@ function getInstalling($type, $mtype, $radsY, $radsM, $year, $month)
"; ";
$sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
// echo $sql."<br/>";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC); $data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count']; return $data['all_count'];
} }
// 工收台數 // 工收台數
function getEnding($type, $mtype, $radsY, $radsM, $year, $month) function getEnding($type, $mtype, $radsY, $radsM, $year, $month)
{ {
@ -84,7 +81,6 @@ function getEnding($type, $mtype, $radsY, $radsM, $year, $month)
"; ";
$sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
// echo $sql . "<br/>";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC); $data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count']; return $data['all_count'];
@ -153,7 +149,6 @@ function getInstalling2($type, $mtype, $radsY, $radsM, $year, $month)
<td style='text-align:center'> <td style='text-align:center'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button> <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='clean_all_input()'>清除</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> </td>
</tr> </tr>
</tfoot> </tfoot>
@ -189,10 +184,8 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
<?php <?php
} }
?> ?>
<!-- <th style='width:200px' colspan="3" rowspan="2">總計(全部)</th> -->
</tr> </tr>
<tr> <tr>
<!-- <th style="width:150px;"></th> -->
<?php <?php
$start_y = $radsY; $start_y = $radsY;
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) {
@ -219,7 +212,6 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
<?php <?php
} }
?> ?>
<!-- <th style='width:200px' colspan="3" rowspan="2"></th> -->
</tr> </tr>
<tr> <tr>
<th>種類</th> <th>種類</th>
@ -252,9 +244,6 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
<?php <?php
} }
?> ?>
<!-- <th style="background-color:#FF8040;">出貨</th>
<th style="background-color:#FFAF60;">工收</th>
<th style="background-color:#9D9D9D;">試車完</th> -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -284,29 +273,47 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
// 新梯出貨 // 新梯出貨
$all_count = 0; $all_count = 0;
$all_count = getShipping("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getShipping("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#CECECE;'>$all_count</td>"; ?>
<td style='background-color:#CECECE;'>
<a href='#' onclick='showDetails("getShippingDetails","A","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// 新梯工收 // 新梯工收
$all_count = 0; $all_count = 0;
$all_count = getEnding("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getEnding("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; ?>
<td style='background-color:#DEDEDE;'>
<a href='#' onclick='showDetails("getEndingDetails","A","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// 新梯試車完 // 新梯試車完
$all_count = 0; $all_count = 0;
$all_count = getInstalling("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#EEEEEE;'>$all_count</td>"; ?>
<td style='background-color:#EEEEEE;'>
<a href='#' onclick='showDetails("getInstallingDetails","A","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// 新梯在裝中 // 新梯在裝中
$all_count = 0; $all_count = 0;
$all_count = getInstalling2("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling2("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#FFFFFF;'>$all_count</td>"; ?>
<td style='background-color:#FFFFFF;'>
<a href='#' onclick='showDetails("getInstalling2Details","A","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
} }
?> ?>
<?php <?php
} }
// echo "<td style='background-color:#FF8040;'>$a_count</td>";
// echo "<td style='background-color:#FFAF60;'>$b_count</td>";
// echo "<td style='background-color:#9D9D9D;'>$c_count</td>";
?> ?>
</tr> </tr>
<tr> <tr>
@ -335,29 +342,47 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
// M1出貨 // M1出貨
$all_count = 0; $all_count = 0;
$all_count = getShipping("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getShipping("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#CECECE;'>$all_count</td>"; ?>
<td style='background-color:#CECECE;'>
<a href='#' onclick='showDetails("getShippingDetails","B","M1","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// M1工收 // M1工收
$all_count = 0; $all_count = 0;
$all_count = getEnding("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getEnding("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; ?>
<td style='background-color:#DEDEDE;'>
<a href='#' onclick='showDetails("getEndingDetails","B","M1","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// M1試車完 // M1試車完
$all_count = 0; $all_count = 0;
$all_count = getInstalling("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#EEEEEE;'>$all_count</td>"; ?>
<td style='background-color:#EEEEEE;'>
<a href='#' onclick='showDetails("getInstallingDetails","B","M1","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// M1在裝中 // M1在裝中
$all_count = 0; $all_count = 0;
$all_count = getInstalling2("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling2("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#FFFFFF;'>$all_count</td>"; ?>
<td style='background-color:#FFFFFF;'>
<a href='#' onclick='showDetails("getInstalling2Details","B","M1","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
} }
?> ?>
<?php <?php
} }
// echo "<td style='background-color:#FF8040;'>$a_count</td>";
// echo "<td style='background-color:#FFAF60;'>$b_count</td>";
// echo "<td style='background-color:#9D9D9D;'>$c_count</td>";
?> ?>
</tr> </tr>
<tr> <tr>
@ -386,29 +411,47 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
// MA出貨 // MA出貨
$all_count = 0; $all_count = 0;
$all_count = getShipping("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getShipping("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#CECECE;'>$all_count</td>"; ?>
<td style='background-color:#CECECE;'>
<a href='#' onclick='showDetails("getShippingDetails","B","MA","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// MA工收 // MA工收
$all_count = 0; $all_count = 0;
$all_count = getEnding("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getEnding("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; ?>
<td style='background-color:#DEDEDE;'>
<a href='#' onclick='showDetails("getEndingDetails","B","MA","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// MA試車完 // MA試車完
$all_count = 0; $all_count = 0;
$all_count = getInstalling("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#EEEEEE;'>$all_count</td>"; ?>
<td style='background-color:#EEEEEE;'>
<a href='#' onclick='showDetails("getInstallingDetails","B","MA","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// MA在裝中 // MA在裝中
$all_count = 0; $all_count = 0;
$all_count = getInstalling2("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling2("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#FFFFFF;'>$all_count</td>"; ?>
<td style='background-color:#FFFFFF;'>
<a href='#' onclick='showDetails("getInstalling2Details","B","MA","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
} }
?> ?>
<?php <?php
} }
// echo "<td style='background-color:#FF8040;'>$a_count</td>";
// echo "<td style='background-color:#FFAF60;'>$b_count</td>";
// echo "<td style='background-color:#9D9D9D;'>$c_count</td>";
?> ?>
</tr> </tr>
<tr> <tr>
@ -437,33 +480,187 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
// 出貨 // 出貨
$all_count = 0; $all_count = 0;
$all_count = getShipping("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getShipping("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#CECECE;'>$all_count</td>"; ?>
<td style='background-color:#CECECE;'>
<a href='#' onclick='showDetails("getShippingDetails","","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// 工收 // 工收
$all_count = 0; $all_count = 0;
$all_count = getEnding("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getEnding("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; ?>
<td style='background-color:#DEDEDE;'>
<a href='#' onclick='showDetails("getEndingDetails","","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// 試車完 // 試車完
$all_count = 0; $all_count = 0;
$all_count = getInstalling("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#EEEEEE;'>$all_count</td>"; ?>
<td style='background-color:#EEEEEE;'>
<a href='#' onclick='showDetails("getInstallingDetails","","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
// 在裝中 // 在裝中
$all_count = 0; $all_count = 0;
$all_count = getInstalling2("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); $all_count = getInstalling2("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT));
echo "<td style='background-color:#FFFFFF;'>$all_count</td>"; ?>
<td style='background-color:#FFFFFF;'>
<a href='#' onclick='showDetails("getInstalling2Details","","","<?php echo $radsY ?>","<?php echo $radsM ?>","<?php echo $radsYi ?>","<?php echo $start_month ?>")'>
<?php echo $all_count ?>
</a>
</td>
<?php
} }
?> ?>
<?php <?php
} }
// echo "<td style='background-color:#FF8040;'>$a_count</td>";
// echo "<td style='background-color:#FFAF60;'>$b_count</td>";
// echo "<td style='background-color:#9D9D9D;'>$c_count</td>";
?> ?>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div id="myModal" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'>
<div class='row'>
<div class='col-12'>
<table id="myTable" class="table table-bordered" style="width:50%; margin:0 auto;">
<thead>
<tr>
<td>序列</td>
<td>合約號</td>
<td>作番號</td>
<td>出貨日</td>
<td>試車完工日</td>
<td>官檢日</td>
<td>移交日</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<style>
/* The Modal (background) */
.modal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
padding-top: 100px;
/* Location of the box */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
}
.modal .back {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
/* Black w/ opacity */
}
/* Modal Content */
.modal-content {
z-index: 9;
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
<script> <script>
var modal = document.getElementById("myModal");
function showDetails(method, contract_type, renovate_type, radsY, radsM, radsYi, start_month) {
$("#myModal").show();
$.ajax({
type: "POST",
dataType: "json",
url: "wipwhole-wipinstallstatus-index-modal.php",
data: {
method: method,
contract_type: contract_type,
renovate_type: renovate_type,
radsY: radsY,
radsM: radsM,
radsYi: radsYi,
start_month: start_month
},
success: function(data) {
var str = "";
for (var i = 0; i < data.length; i++) {
var contractno = data[i].contractno;
var facilityno = data[i].facilityno
var real_arrival_date = data[i].real_arrival_date == null ? "" : data[i].real_arrival_date
var tryrun_end_date = data[i].tryrun_end_date == null ? "" : data[i].tryrun_end_date
var official_check_date = data[i].official_check_date == null ? "" : data[i].official_check_date
var delivery_date = data[i].delivery_date == null ? "" : data[i].delivery_date
str += "<tr>";
str += "<td>" + (i + 1) + "</td>";
str += "<td>" + contractno + "</td>";
str += "<td>" + facilityno + "</td>";
str += "<td>" + real_arrival_date + "</td>";
str += "<td>" + tryrun_end_date + "</td>";
str += "<td>" + official_check_date + "</td>";
str += "<td>" + delivery_date + "</td>";
str += "</tr>";
}
$("#myTable tbody").html(str);
},
error: function(data) {
console.log(data);
}
})
}
$("#myCloseBtn").click(function(e) {
$("#myModal").hide();
});
$(".back").click(function(e) {
$("#myModal").hide();
});
</script> </script>

5
wms/wipwholeinstall-index-function.php

@ -899,11 +899,10 @@ function getMarketingStatus($link, $user_department_id, $role_id)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
return ""; return "";
if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) if (in_array($user_department_id, [311, 312, 313, 314, 315]))
return checkNowFormYDStatus($link) == 'A' ? "" : "disabled"; return checkNowFormYDStatus($link) == 'A' ? "" : "disabled";
if ($user_department_id == 501 || $user_department_id == 511 || $user_department_id == 512 || $user_department_id == 513 || $user_department_id == 514) if (in_array($user_department_id, [501, 511, 512, 513, 514, 515]))
return checkNowFormYDStatus($link) == 'A' ? "" : "disabled"; return checkNowFormYDStatus($link) == 'A' ? "" : "disabled";
return "disabled"; return "disabled";
} }

5
wms/wipwholeinstall-renovate-index-function.php

@ -920,11 +920,10 @@ function getMarketingStatus($link, $user_department_id, $role_id)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
return ""; return "";
if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) if (in_array($user_department_id, [311, 312, 313, 314, 315]))
return checkNowFormYDStatus($link) == 'A' ? "" : "disabled"; return checkNowFormYDStatus($link) == 'A' ? "" : "disabled";
if ($user_department_id == 501 || $user_department_id == 511 || $user_department_id == 512 || $user_department_id == 513 || $user_department_id == 514) if (in_array($user_department_id, [501, 511, 512, 513, 514, 515]))
return checkNowFormYDStatus($link) == 'A' ? "" : "disabled"; return checkNowFormYDStatus($link) == 'A' ? "" : "disabled";
return "disabled"; return "disabled";
} }

Loading…
Cancel
Save