Browse Source

20231024(二)更新CODE

gary
IA2301\M0117 2 years ago
parent
commit
c157aacff5
  1. 960
      wms/createFacilityNo.php
  2. 468
      wms/wipwhole-index-table-html.php
  3. 479
      wms/wipwhole-renovate-index-table-html.php
  4. 978
      wms/wipwhole-renovate-index.php

960
wms/createFacilityNo.php

@ -1,481 +1,481 @@
<?php <?php
ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
// 汰改 前三碼 流水號 + 後兩碼 號機 // 汰改 前三碼 流水號 + 後兩碼 號機
// 新梯 流水號 // 新梯 流水號
class CreateFacilityNo class CreateFacilityNo
{ {
/** /**
* 連接資料庫 * 連接資料庫
*/ */
function connectionDB() function connectionDB()
{ {
try { try {
$options = [ $options = [
PDO::ATTR_PERSISTENT => false, PDO::ATTR_PERSISTENT => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_STRINGIFY_FETCHES => false, PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
]; ];
$pdo = new PDO('mysql:host=localhost;port=3306;dbname=appwms', 'masadaroot', 'x6h5E5p#u8y', $options); $pdo = new PDO('mysql:host=localhost;port=3306;dbname=appwms', 'masadaroot', 'x6h5E5p#u8y', $options);
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
return $pdo; return $pdo;
} catch (PDOException $e) { } catch (PDOException $e) {
die("Something wrong: {$e->getMessage()}"); die("Something wrong: {$e->getMessage()}");
} }
} }
/** /**
* 結束資料庫連線 * 結束資料庫連線
*/ */
function endConnectionDB($pdo) function endConnectionDB($pdo)
{ {
unset($pdo); unset($pdo);
} }
/** /**
* 取得下一個新的作番 * 取得下一個新的作番
* @param string $facility_type : M:新梯 T:汰改 B:保養 * @param string $facility_type : M:新梯 T:汰改 B:保養
* @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param int $num : 號機 * @param int $num : 號機
* @return array $new_facility_arr * @return array $new_facility_arr
*/ */
function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1) function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1)
{ {
$this->checkYearAndResetAllSeq(); $this->checkYearAndResetAllSeq();
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
switch ($facility_type) { switch ($facility_type) {
case "M": case "M":
$next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1;
$new_facility_arr = []; $new_facility_arr = [];
for ($start_num = 1; $start_num <= $num; $start_num++) { for ($start_num = 1; $start_num <= $num; $start_num++) {
$facility_no_tmp = $Y . $sale_type . $make_type $facility_no_tmp = $Y . $sale_type . $make_type
. str_pad($next_seq, 5, "0", STR_PAD_LEFT); . str_pad($next_seq, 5, "0", STR_PAD_LEFT);
array_push($new_facility_arr, $facility_no_tmp); array_push($new_facility_arr, $facility_no_tmp);
$next_seq++; $next_seq++;
} }
return $new_facility_arr; return $new_facility_arr;
case "T": case "T":
$next_seq = $this->getNextFacilitySeq("tf_vol_no"); $next_seq = $this->getNextFacilitySeq("tf_vol_no");
$new_facility_arr = []; $new_facility_arr = [];
for ($start_num = 1; $start_num <= $num; $start_num++) { for ($start_num = 1; $start_num <= $num; $start_num++) {
$facility_no_tmp = $Y . $sale_type . $make_type $facility_no_tmp = $Y . $sale_type . $make_type
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($start_num, 2, "0", STR_PAD_LEFT); . str_pad($start_num, 2, "0", STR_PAD_LEFT);
array_push($new_facility_arr, $facility_no_tmp); array_push($new_facility_arr, $facility_no_tmp);
} }
return $new_facility_arr; return $new_facility_arr;
case "B": case "B":
$next_seq = $this->getNextFacilitySeq("bf_vol_no"); $next_seq = $this->getNextFacilitySeq("bf_vol_no");
$new_facility_arr = []; $new_facility_arr = [];
for ($start_num = 1; $start_num <= $num; $start_num++) { for ($start_num = 1; $start_num <= $num; $start_num++) {
$facility_no_tmp = $Y . $sale_type . $make_type $facility_no_tmp = $Y . $sale_type . $make_type
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($start_num, 2, "0", STR_PAD_LEFT); . str_pad($start_num, 2, "0", STR_PAD_LEFT);
array_push($new_facility_arr, $facility_no_tmp); array_push($new_facility_arr, $facility_no_tmp);
} }
return $new_facility_arr; return $new_facility_arr;
default: default:
return "不存在的作番類型"; return "不存在的作番類型";
} }
} }
/** /**
* 建立新的作番 * 建立新的作番
* @param string $facility_type : M:新梯 T:汰改 B:保養 * @param string $facility_type : M:新梯 T:汰改 B:保養
* @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param string $num : 號機 (非必填) * @param string $num : 號機 (非必填)
* @return string $new_facility_no * @return string $new_facility_no
*/ */
function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null) function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null)
{ {
$this->checkYearAndResetAllSeq(); $this->checkYearAndResetAllSeq();
$faclikity_details = array( $faclikity_details = array(
'facility_type' => $facility_type, 'facility_type' => $facility_type,
'sale_type' => $sale_type, 'sale_type' => $sale_type,
'make_type' => $make_type, 'make_type' => $make_type,
'num' => $num 'num' => $num
); );
switch ($facility_type) { switch ($facility_type) {
case "M": case "M":
return $this->makeNewMFacilityNo($faclikity_details); return $this->makeNewMFacilityNo($faclikity_details);
break; break;
case "T": case "T":
return $this->makeNewTFacilityNo($faclikity_details); return $this->makeNewTFacilityNo($faclikity_details);
break; break;
case "B": case "B":
return $this->makeNewBFacilityNo($faclikity_details); return $this->makeNewBFacilityNo($faclikity_details);
break; break;
default: default:
return "不存在的作番類型"; return "不存在的作番類型";
} }
} }
/** /**
* 建立作番 -- 新梯 * 建立作番 -- 新梯
*/ */
function makeNewMFacilityNo($faclikity_details) function makeNewMFacilityNo($faclikity_details)
{ {
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
$sale_type = $faclikity_details['sale_type']; $sale_type = $faclikity_details['sale_type'];
$make_type = $faclikity_details['make_type']; $make_type = $faclikity_details['make_type'];
$num = $faclikity_details['num']; $num = $faclikity_details['num'];
$next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1;
$new_facility_no_arr = []; $new_facility_no_arr = [];
for ($i = 1; $i <= $num; $i++) { for ($i = 1; $i <= $num; $i++) {
$new_facility_no = $Y . $sale_type . $make_type $new_facility_no = $Y . $sale_type . $make_type
. str_pad($next_seq, 5, "0", STR_PAD_LEFT); . str_pad($next_seq, 5, "0", STR_PAD_LEFT);
array_push($new_facility_no_arr, $new_facility_no); array_push($new_facility_no_arr, $new_facility_no);
$next_seq++; $next_seq++;
} }
foreach ($new_facility_no_arr as $new_facility_no) { foreach ($new_facility_no_arr as $new_facility_no) {
if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") { if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") {
return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
} }
// seq +1 // seq +1
$this->facilitySeqAddOne("M"); $this->facilitySeqAddOne("M");
} }
return $new_facility_no_arr; return $new_facility_no_arr;
} }
/** /**
* 建立作番 -- 汰改 * 建立作番 -- 汰改
*/ */
function makeNewTFacilityNo($faclikity_details) function makeNewTFacilityNo($faclikity_details)
{ {
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
$sale_type = $faclikity_details['sale_type']; $sale_type = $faclikity_details['sale_type'];
$make_type = $faclikity_details['make_type']; $make_type = $faclikity_details['make_type'];
$num = $faclikity_details['num']; $num = $faclikity_details['num'];
$next_seq = $this->getNextFacilitySeq("tf_vol_no"); $next_seq = $this->getNextFacilitySeq("tf_vol_no");
$new_facility_no_arr = []; $new_facility_no_arr = [];
for ($i = 1; $i <= $num; $i++) { for ($i = 1; $i <= $num; $i++) {
$new_facility_no = $Y . $sale_type . $make_type $new_facility_no = $Y . $sale_type . $make_type
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($i, 2, "0", STR_PAD_LEFT); . str_pad($i, 2, "0", STR_PAD_LEFT);
array_push($new_facility_no_arr, $new_facility_no); array_push($new_facility_no_arr, $new_facility_no);
} }
foreach ($new_facility_no_arr as $new_facility_no) { foreach ($new_facility_no_arr as $new_facility_no) {
if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") {
return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
} }
// seq +1 // seq +1
$this->facilitySeqAddOne("T"); $this->facilitySeqAddOne("T");
return $new_facility_no_arr; return $new_facility_no_arr;
} }
} }
/** /**
* 建立作番 -- 保養 * 建立作番 -- 保養
*/ */
function makeNewBFacilityNo($faclikity_details) function makeNewBFacilityNo($faclikity_details)
{ {
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
$sale_type = $faclikity_details['sale_type']; $sale_type = $faclikity_details['sale_type'];
$make_type = $faclikity_details['make_type']; $make_type = $faclikity_details['make_type'];
$num = $faclikity_details['num']; $num = $faclikity_details['num'];
$next_seq = $this->getNextFacilitySeq("bf_vol_no"); $next_seq = $this->getNextFacilitySeq("bf_vol_no");
$new_facility_no_arr = []; $new_facility_no_arr = [];
for ($i = 1; $i <= $num; $i++) { for ($i = 1; $i <= $num; $i++) {
$new_facility_no = $Y . $sale_type . $make_type $new_facility_no = $Y . $sale_type . $make_type
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($i, 2, "0", STR_PAD_LEFT); . str_pad($i, 2, "0", STR_PAD_LEFT);
array_push($new_facility_no_arr, $new_facility_no); array_push($new_facility_no_arr, $new_facility_no);
} }
foreach ($new_facility_no_arr as $new_facility_no) { foreach ($new_facility_no_arr as $new_facility_no) {
if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") {
return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details);
} }
// seq +1 // seq +1
$this->facilitySeqAddOne("B"); $this->facilitySeqAddOne("B");
return $new_facility_no_arr; return $new_facility_no_arr;
} }
} }
/** /**
* 檢查作番編列狀態 - 新梯 * 檢查作番編列狀態 - 新梯
* @param array $faclikity_details * @param array $faclikity_details
* @return string $status : 1:正確 else:error message * @return string $status : 1:正確 else:error message
*/ */
function getMakeNewMFacilityNoStatus($faclikity_details) function getMakeNewMFacilityNoStatus($faclikity_details)
{ {
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
$sale_type = $faclikity_details['sale_type']; $sale_type = $faclikity_details['sale_type'];
$make_type = $faclikity_details['make_type']; $make_type = $faclikity_details['make_type'];
$next_seq = $this->getNextFacilitySeq("mf_vol_no"); $next_seq = $this->getNextFacilitySeq("mf_vol_no");
$new_facility_no = $Y . $sale_type . $make_type . str_pad($next_seq + 1, 5, "0", STR_PAD_LEFT); $new_facility_no = $Y . $sale_type . $make_type . str_pad($next_seq + 1, 5, "0", STR_PAD_LEFT);
if ($this->checkSaleTypeStatus($sale_type) == false) if ($this->checkSaleTypeStatus($sale_type) == false)
return "銷售代號錯誤"; return "銷售代號錯誤";
if ($this->checkMakeTypeStatus($make_type) == false) if ($this->checkMakeTypeStatus($make_type) == false)
return "製造編號類型錯誤"; return "製造編號類型錯誤";
return "1"; return "1";
} }
/** /**
* 檢查作番編列狀態 - 汰改 * 檢查作番編列狀態 - 汰改
* @param array $faclikity_details * @param array $faclikity_details
* @return string $status : 1:正確 else:error message * @return string $status : 1:正確 else:error message
*/ */
function getMakeNewTFacilityNoStatus($faclikity_details) function getMakeNewTFacilityNoStatus($faclikity_details)
{ {
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
$sale_type = $faclikity_details['sale_type']; $sale_type = $faclikity_details['sale_type'];
$make_type = $faclikity_details['make_type']; $make_type = $faclikity_details['make_type'];
$num = $faclikity_details['num']; $num = $faclikity_details['num'];
$next_seq = $this->getNextFacilitySeq("mf_vol_no"); $next_seq = $this->getNextFacilitySeq("mf_vol_no");
$new_facility_no = $Y . $sale_type . $make_type $new_facility_no = $Y . $sale_type . $make_type
. str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT)
. str_pad($num, 2, "0", STR_PAD_LEFT); . str_pad($num, 2, "0", STR_PAD_LEFT);
if ($this->checkSaleTypeStatus($sale_type) == false) if ($this->checkSaleTypeStatus($sale_type) == false)
return "銷售代號錯誤"; return "銷售代號錯誤";
if ($this->checkMakeTypeStatus($make_type) == false) if ($this->checkMakeTypeStatus($make_type) == false)
return "製造編號類型錯誤"; return "製造編號類型錯誤";
return "1"; return "1";
} }
/** /**
* seq 取號 * seq 取號
* @param string $type M:新梯 T:汰改 B:保養 * @param string $type M:新梯 T:汰改 B:保養
*/ */
function facilitySeqAddOne($type) function facilitySeqAddOne($type)
{ {
$type_arr = array( $type_arr = array(
"M" => "mf_vol_no", "M" => "mf_vol_no",
"T" => "tf_vol_no", "T" => "tf_vol_no",
"B" => "bf_vol_no", "B" => "bf_vol_no",
); );
if (!empty($type_arr[$type])) { if (!empty($type_arr[$type])) {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?'); $sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?');
$sth->bindValue(1, $type_arr[$type]); $sth->bindValue(1, $type_arr[$type]);
$sth->execute(); $sth->execute();
} }
} }
/** /**
* 修正 seq 取號 * 修正 seq 取號
* @param string $type M:新梯 T:汰改 B:保養 * @param string $type M:新梯 T:汰改 B:保養
*/ */
function facilityFixSeq($type) function facilityFixSeq($type)
{ {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$type_arr = array( $type_arr = array(
"M" => "mf_vol_no", "M" => "mf_vol_no",
"T" => "tf_vol_no", "T" => "tf_vol_no",
"B" => "bf_vol_no", "B" => "bf_vol_no",
); );
$after_fix_seq = $this->getMaxSeq($type); $after_fix_seq = $this->getMaxSeq($type);
$sql = " $sql = "
UPDATE sequence UPDATE sequence
SET current_val = ? SET current_val = ?
WHERE seq_name = ? WHERE seq_name = ?
"; ";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->bindValue(1, $after_fix_seq); $sth->bindValue(1, $after_fix_seq);
$sth->bindValue(2, $type_arr[$type]); $sth->bindValue(2, $type_arr[$type]);
$sth->execute(); $sth->execute();
} }
function getMaxSeq($type) function getMaxSeq($type)
{ {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$Y = substr(date("Y"), 3, 1); $Y = substr(date("Y"), 3, 1);
$seq_num = $type == 'M' ? 5 : 3; $seq_num = $type == 'M' ? 5 : 3;
$sql = " $sql = "
SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq
FROM facility AS f FROM facility AS f
WHERE 1=1 WHERE 1=1
AND SUBSTR(f.facilityno,1,1) = ? AND SUBSTR(f.facilityno,1,1) = ?
AND f.define = ? AND f.define = ?
ORDER BY SUBSTR(f.facilityno,4,3) ASC ORDER BY SUBSTR(f.facilityno,4,3) ASC
"; ";
$sth = $pdo->prepare($sql); $sth = $pdo->prepare($sql);
$sth->bindValue(1, $seq_num); $sth->bindValue(1, $seq_num);
$sth->bindValue(2, $Y); $sth->bindValue(2, $Y);
$sth->bindValue(3, $type); $sth->bindValue(3, $type);
$sth->execute(); $sth->execute();
$result = $sth->fetch(); $result = $sth->fetch();
return $result['seq']; return $result['seq'];
} }
/** /**
* 檢查年月後 新梯及汰改seq歸零 * 檢查年月後 新梯及汰改seq歸零
*/ */
function checkYearAndResetAllSeq() function checkYearAndResetAllSeq()
{ {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?');
$sth->bindValue(1, 'mf_vol_no'); $sth->bindValue(1, 'mf_vol_no');
$sth->execute(); $sth->execute();
$result = $sth->fetch(); $result = $sth->fetch();
$yyyymm = $result['yyyymm']; $yyyymm = $result['yyyymm'];
$dataY = substr($yyyymm, 0, 4); $dataY = substr($yyyymm, 0, 4);
$today_Y = date("Y"); $today_Y = date("Y");
$today_Ym = date("Ym"); $today_Ym = date("Ym");
if ($dataY != $today_Y) { if ($dataY != $today_Y) {
$sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?'); $sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?');
$sth->bindValue(1, '0'); $sth->bindValue(1, '0');
$sth->bindValue(2, $today_Ym); $sth->bindValue(2, $today_Ym);
$sth->bindValue(3, 'mf_vol_no'); $sth->bindValue(3, 'mf_vol_no');
$sth->execute(); $sth->execute();
} }
} }
/** /**
* 檢查作番在 facility table 中是否重複 * 檢查作番在 facility table 中是否重複
* @param string|array $facility_no * @param string|array $facility_no
* @return boolean $status : true:沒重複 false:重複 * @return boolean $status : true:沒重複 false:重複
*/ */
function checkFacilityRepeatStatus($facility_no) function checkFacilityRepeatStatus($facility_no)
{ {
if (gettype($facility_no) == "string") { if (gettype($facility_no) == "string") {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?');
$sth->bindValue(1, $facility_no); $sth->bindValue(1, $facility_no);
$sth->execute(); $sth->execute();
if ($sth->rowCount() == 0) if ($sth->rowCount() == 0)
return true; return true;
return false; return false;
} }
if (gettype($facility_no) == "array") { if (gettype($facility_no) == "array") {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$status = true; $status = true;
foreach ($facility_no as $row) { foreach ($facility_no as $row) {
$sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?');
$sth->bindValue(1, $row); $sth->bindValue(1, $row);
$sth->execute(); $sth->execute();
if ($sth->rowCount() !== 0) if ($sth->rowCount() !== 0)
$status = false; $status = false;
} }
return $status; return $status;
} }
} }
/** /**
* 檢查 $sale_type 是否有存在規則之中 * 檢查 $sale_type 是否有存在規則之中
* @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @return boolean $status : true:合法代碼 false:非法代碼 * @return boolean $status : true:合法代碼 false:非法代碼
*/ */
function checkSaleTypeStatus($sale_type) function checkSaleTypeStatus($sale_type)
{ {
if (in_array($sale_type, ['M', 'E', 'T', 'J', 'X'])) if (in_array($sale_type, ['M', 'E', 'T', 'J', 'X']))
return true; return true;
return false; return false;
} }
/** /**
* 檢查 $sale_type 是否有存在規則之中 * 檢查 $sale_type 是否有存在規則之中
* @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @return boolean $status : true:合法代碼 false:非法代碼 * @return boolean $status : true:合法代碼 false:非法代碼
*/ */
function checkMakeTypeStatus($make_type) function checkMakeTypeStatus($make_type)
{ {
if (in_array($make_type, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y'])) if (in_array($make_type, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y']))
return true; return true;
return false; return false;
} }
/** /**
* 檢查 取得下個作番的 seq * 檢查 取得下個作番的 seq
* @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no * @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no
* @return int $seq : 作番流水號 * @return int $seq : 作番流水號
*/ */
function getNextFacilitySeq($seq_name) function getNextFacilitySeq($seq_name)
{ {
$pdo = $this->connectionDB(); $pdo = $this->connectionDB();
$pdo->exec('SET CHARACTER SET utf8mb4'); $pdo->exec('SET CHARACTER SET utf8mb4');
$sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?');
$sth->bindValue(1, $seq_name); $sth->bindValue(1, $seq_name);
$sth->execute(); $sth->execute();
$result = $sth->fetch(); $result = $sth->fetch();
return $result['current_val']; return $result['current_val'];
} }
/** /**
* 建立新的新梯作番 * 建立新的新梯作番
* @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param int $seq_name : 幾個案場 0-99 * @param int $seq_name : 幾個案場 0-99
* @return array $new_facilityno : 作番號 * @return array $new_facilityno : 作番號
*/ */
function makeMFacilityNo($sale_type, $make_type, $num) function makeMFacilityNo($sale_type, $make_type, $num)
{ {
$new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num); $new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num);
if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
// 如果作番號重複 使用此函數修正 // 如果作番號重複 使用此函數修正
$this->facilityFixSeq("M"); $this->facilityFixSeq("M");
} }
return $this->makeFacilityNo("M", $sale_type, $make_type, $num); return $this->makeFacilityNo("M", $sale_type, $make_type, $num);
} }
/** /**
* 建立新的汰改作番 * 建立新的汰改作番
* @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param int $seq_name : 幾個案場 0-99 * @param int $seq_name : 幾個案場 0-99
* @return array $new_facilityno : 作番號 * @return array $new_facilityno : 作番號
*/ */
function makeTFacilityNo($sale_type, $make_type, $num) function makeTFacilityNo($sale_type, $make_type, $num)
{ {
$new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num); $new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num);
if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
// 如果作番號重複 使用此函數修正 // 如果作番號重複 使用此函數修正
$this->facilityFixSeq("T"); $this->facilityFixSeq("T");
} }
return $this->makeFacilityNo("T", $sale_type, $make_type, $num); return $this->makeFacilityNo("T", $sale_type, $make_type, $num);
} }
/** /**
* 建立新的保養作番 * 建立新的保養作番
* @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品
* @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正
* @param int $seq_name : 幾個案場 0-99 * @param int $seq_name : 幾個案場 0-99
* @return array $new_facilityno : 作番號 * @return array $new_facilityno : 作番號
*/ */
function makeBFacilityNo($sale_type, $make_type, $num) function makeBFacilityNo($sale_type, $make_type, $num)
{ {
$new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num); $new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num);
if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { if ($this->checkFacilityRepeatStatus($new_facility_no) == false) {
// 如果作番號重複 使用此函數修正 // 如果作番號重複 使用此函數修正
$this->facilityFixSeq("B"); $this->facilityFixSeq("B");
} }
return $this->makeFacilityNo("B", $sale_type, $make_type, $num); return $this->makeFacilityNo("B", $sale_type, $make_type, $num);
} }
} }
$cfn = new CreateFacilityNo; $cfn = new CreateFacilityNo;
// 建立作番號 - 新梯 // 建立作番號 - 新梯
print_r($cfn->makeMFacilityNo("M", "X", 5)); print_r($cfn->makeMFacilityNo("M", "X", 5));
echo "<br/><br/>"; echo "<br/><br/>";
// 建立作番號 - 汰改 // 建立作番號 - 汰改
print_r($cfn->makeTFacilityNo( "M", "X", 1)); print_r($cfn->makeTFacilityNo( "M", "X", 1));
echo "<br/><br/>"; echo "<br/><br/>";
// 建立作番號 - 保養 // 建立作番號 - 保養
print_r($cfn->makeBFacilityNo( "M", "X", 1)); print_r($cfn->makeBFacilityNo( "M", "X", 1));
echo "<br/><br/>"; echo "<br/><br/>";

468
wms/wipwhole-index-table-html.php

@ -1,224 +1,246 @@
<table id="table_index2" class="table table-striped table-bordered" style="width:98.5%"> <?php
<thead> $tableArr = array(
<tr> "All" => "table_index2",
<th style="vertical-align: middle;text-align:center;">合約號</th> "A" => "table_index3",
<th style="vertical-align: middle;text-align:center;">電梯編號</th> "B" => "table_index4",
<th style="vertical-align: middle;text-align:center;">客戶姓名</th> "G" => "table_index5",
<th style="vertical-align: middle;text-align:center;">地址</th> "CH" => "table_index6",
<th style="vertical-align: middle;text-align:center;">工勘狀態</th> "Z" => "table_index7"
<th style="vertical-align: middle;text-align:center;">下單日<br />(普來特富)</th> );
<th style="vertical-align: middle;text-align:center;">預計到廠日<br />(觀音廠)</th> ?>
<th style="vertical-align: middle;text-align:center;">實際到廠日<br />(觀音廠)</th> <table id="<?php echo $tableArr[$key]; ?>" class="table table-striped table-bordered" style="width:98.5%">
<th style="vertical-align: middle;text-align:center;">預計出貨日<br />(到工地)</th> <thead>
<th style="vertical-align: middle;text-align:center;">營業/契約確認</th> <tr>
<th style="vertical-align: middle;text-align:center;">設計確認</th> <th style="vertical-align: middle;text-align:center;">合約號</th>
<th style="vertical-align: middle;text-align:center;">工務確認</th> <th style="vertical-align: middle;text-align:center;">電梯編號</th>
<th style="vertical-align: middle;text-align:center;">生管(業 務)確認</th> <th style="vertical-align: middle;text-align:center;">客戶姓名</th>
</tr> <th style="vertical-align: middle;text-align:center;">規格</th>
</thead> <th style="vertical-align: middle;text-align:center;">地址</th>
<tbody> <th style="vertical-align: middle;text-align:center;">工勘狀態</th>
<?php <th style="vertical-align: middle;text-align:center;">下單日<br />(普來特富)</th>
<th style="vertical-align: middle;text-align:center;">預計到廠日<br />(觀音廠)</th>
foreach ($dataDetailsArr as $key => $data) : <th style="vertical-align: middle;text-align:center;">實際到廠日<br />(觀音廠)</th>
//工務 <th style="vertical-align: middle;text-align:center;">預計出貨日<br />(到工地)</th>
$data['gongwuok'] = 0; <th style="vertical-align: middle;text-align:center;">營業/契約確認</th>
// 營業 <th style="vertical-align: middle;text-align:center;">設計確認</th>
$data['yingyeok'] = 0; <th style="vertical-align: middle;text-align:center;">工務確認</th>
// 設計 <th style="vertical-align: middle;text-align:center;">生管(業 務)確認</th>
$data['shejiok'] = 0; </tr>
// 生管 </thead>
$data['shengguanok'] = 0; <tbody>
// 財務 <?php
// $caiwuok = 0;
foreach ($dataDetailsArr as $key => $data) :
// 工務統計已確認
if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2) //規格
$data['gongwuok'] += 1; $Specification = $data['facility_kind'];
if (!in_array($data['site_survey_contact_verify'], ['1', 'A'])) $Specification .= !empty($data['numberofpassenger']) ? "-" . $data['numberofpassenger'] : "";
$data['gongwuok'] += 1; $Specification .= !empty($data['weight']) ? "-" . $data['weight'] : "";
$Specification .= !empty($data['numberofstop']) ? "-" . $data['numberofstop'] : "";
// 營業統計已確認 $Specification .= !empty($data['numberoffloor']) ? "/" . $data['numberoffloor'] : "";
if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2) $Specification .= !empty($data['opentype']) ? "-" . $data['opentype'] : "";
$data['yingyeok'] += 1; $Specification .= !empty($data['speed']) ? $data['speed'] : "";
if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2)
$data['yingyeok'] += 1; //工務
if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2) $data['gongwuok'] = 0;
$data['yingyeok'] += 1; // 營業
if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2) $data['yingyeok'] = 0;
$data['yingyeok'] += 1; // 設計
if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2) $data['shejiok'] = 0;
$data['yingyeok'] += 1; // 生管
$data['shengguanok'] = 0;
// 設計統計已確認 // 財務
if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2) // $caiwuok = 0;
$data['shejiok'] += 1;
if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2) // 工務統計已確認
$data['shejiok'] += 1; if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2)
if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2) $data['gongwuok'] += 1;
$data['shejiok'] += 1; if (!in_array($data['site_survey_contact_verify'], ['1', 'A']))
if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2) $data['gongwuok'] += 1;
$data['shejiok'] += 1;
if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2) // 營業統計已確認
$data['shejiok'] += 1; if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2)
$data['yingyeok'] += 1;
// 生管統計已確認 if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2)
if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2) $data['yingyeok'] += 1;
$data['shengguanok'] += 1; if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2)
if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2) $data['yingyeok'] += 1;
$data['shengguanok'] += 1; if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2)
if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2) $data['yingyeok'] += 1;
$data['shengguanok'] += 1; if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2)
if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2) $data['yingyeok'] += 1;
$data['shengguanok'] += 1;
if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C') // 設計統計已確認
$data['shengguanok'] += 1; if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2)
if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C') $data['shejiok'] += 1;
$data['shengguanok'] += 1; if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2)
if ($data['arrival_date_verify'] == 'A') $data['shejiok'] += 1;
$data['shengguanok'] += 1; if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2)
$data['shejiok'] += 1;
?> if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2)
<tr> $data['shejiok'] += 1;
<td> if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2)
<?php $data['shejiok'] += 1;
if (in_array($department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 513, 220, 911])) {
$sql = " // 生管統計已確認
SELECT if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2)
mid, $data['shengguanok'] += 1;
pr_item_id, if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2)
version $data['shengguanok'] += 1;
FROM specsurvey_main if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2)
WHERE contractno = '" . $data['contractno'] . "' $data['shengguanok'] += 1;
"; if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2)
$result = mysqli_query($link, $sql); $data['shengguanok'] += 1;
$row = mysqli_fetch_array($result); if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C')
if (empty($row['mid'])) { $data['shengguanok'] += 1;
echo $data['contractno']; if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C')
} else { $data['shengguanok'] += 1;
echo "<a target='_blank' href='/wms/mkt/specsurvey-view.php?pa=" . $row['mid'] . "," . $row['pr_item_id'] . "," . $row['version'] . "&$token_link'>" . $data['contractno'] . "</a>"; if ($data['arrival_date_verify'] == 'A')
} $data['shengguanok'] += 1;
} else {
echo $data['contractno']; ?>
} <tr>
?> <td>
</td> <?php
<td><?php echo $data['facilityno']; ?></td> if (in_array($department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 513, 220, 911])) {
<td><?php echo $data['custom']; ?></td> $sql = "
<td><?php echo $data['address']; ?></td> SELECT
<?php mid,
foreach ($site_survey_status as $key => $val) { pr_item_id,
if ((string)$data['site_survey_contact_verify'] == (string)$key) { version
if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) { FROM specsurvey_main
echo "<td style='color:#F00;'>$val</td>"; WHERE contractno = '" . $data['contractno'] . "'
} else { ";
echo "<td>$val</td>"; $result = mysqli_query($link, $sql);
} $row = mysqli_fetch_array($result);
} if (empty($row['mid'])) {
} echo $data['contractno'];
?> } else {
<td> echo "<a target='_blank' href='/wms/mkt/specsurvey-view.php?pa=" . $row['mid'] . "," . $row['pr_item_id'] . "," . $row['version'] . "&$token_link'>" . $data['contractno'] . "</a>";
<?php }
if (!empty($data['prattford_order_date'])) } else {
echo date("Y/m/d", strtotime($data['prattford_order_date'])); echo $data['contractno'];
?> }
</td> ?>
<td> </td>
<?php <td><?php echo $data['facilityno']; ?></td>
if (!empty($data['estimated_shipping_schedule_date'])) <td><?php echo $data['custom']; ?></td>
echo date("Y/m/d", strtotime($data['estimated_shipping_schedule_date'])); <td><?php echo $Specification; ?></td>
?> <td><?php echo $data['address']; ?></td>
</td> <?php
<td> foreach ($site_survey_status as $key => $val) {
<?php if ((string)$data['site_survey_contact_verify'] == (string)$key) {
if (!empty($data['actual_tofactory_date'])) if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) {
echo date("Y/m/d", strtotime($data['actual_tofactory_date'])); echo "<td style='color:#F00;'>$val</td>";
?> } else {
</td> echo "<td>$val</td>";
}
<?php }
if (!empty($data['real_contract_arrival_date'])) { }
if ($futureDate >= date("Y/m/d", strtotime($data['real_contract_arrival_date']))) { ?>
if ($data['yingyeok'] != '5' && $data['shejiok'] != '5' && $data['gongwuok'] != '2' && $data['shengguanok'] != '1') { <td>
echo "<td style='color:#f00;'>" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>"; <?php
} else { if (!empty($data['prattford_order_date']))
echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>"; echo date("Y/m/d", strtotime($data['prattford_order_date']));
} ?>
} else { </td>
echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>"; <td>
} <?php
} else { if (!empty($data['estimated_shipping_schedule_date']))
echo "<td></td>"; echo date("Y/m/d", strtotime($data['estimated_shipping_schedule_date']));
} ?>
?> </td>
<td>
<td> <?php
<?php if (!empty($data['actual_tofactory_date']))
$str = $data['yingyeok'] . "/5"; echo date("Y/m/d", strtotime($data['actual_tofactory_date']));
if ($edit_flag & 1 && ($user_auth & 2)) { ?>
?> </td>
<p>
<?php echo $str; ?> <?php
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> if (!empty($data['real_contract_arrival_date'])) {
<?php echo accountidToName($data['salesid']); ?> if ($futureDate >= date("Y/m/d", strtotime($data['real_contract_arrival_date']))) {
</a> if ($data['yingyeok'] != '5' && $data['shejiok'] != '5' && $data['gongwuok'] != '2' && $data['shengguanok'] != '1') {
</p> echo "<td style='color:#f00;'>" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
<?php } else {
} else echo $str . " " . accountidToName($data['salesid']); echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
?> }
</td> } else {
<td> echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
<?php }
$str = $data['shejiok'] . "/5"; } else {
if ($edit_flag & 2 && ($user_auth & 2)) { echo "<td></td>";
?> }
<p> ?>
<?php echo $str; ?>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> <td>
郭承瑋 <?php
</a> $str = $data['yingyeok'] . "/5";
</p> if ($edit_flag & 1 && ($user_auth & 2)) {
<?php ?>
} else echo $str . " 郭承瑋"; <p>
?> <?php echo $str; ?>
</td> <a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<td> <?php echo accountidToName($data['salesid']); ?>
<?php </a>
$str = $data['gongwuok'] . "/2"; </p>
if ($edit_flag & 4 && ($user_auth & 2)) { <?php
?> } else echo $str . " " . accountidToName($data['salesid']);
<p> ?>
<?php </td>
echo $str; <td>
?> <?php
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> $str = $data['shejiok'] . "/5";
<?php if ($edit_flag & 2 && ($user_auth & 2)) {
echo getGunwuName($data['address']); ?>
?> <p>
</a> <?php echo $str; ?>
</p> <a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<?php 郭承瑋
} else { </a>
echo $str; </p>
echo getGunwuName($data['address']); <?php
} } else echo $str . " 郭承瑋";
?> ?>
</td> </td>
<td> <td>
<?php <?php
$str = $data['shengguanok'] . "/7"; $str = $data['gongwuok'] . "/2";
if ($edit_flag & 8 && ($user_auth & 2)) { if ($edit_flag & 4 && ($user_auth & 2)) {
?> ?>
<p> <p>
<?php echo $str; ?> <?php
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> echo $str;
<span class="glyphicon glyphicon-pencil"></span> ?>
</a> <a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
</p> <?php
<?php echo getGunwuName($data['address']);
} else echo $str . " "; ?>
?> </a>
</td> </p>
</tr> <?php
<?php endforeach; ?> } else {
</tbody> echo $str;
echo getGunwuName($data['address']);
}
?>
</td>
<td>
<?php
$str = $data['shengguanok'] . "/7";
if ($edit_flag & 8 && ($user_auth & 2)) {
?>
<p>
<?php echo $str; ?>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</p>
<?php
} else echo $str . " ";
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table> </table>

479
wms/wipwhole-renovate-index-table-html.php

@ -1,229 +1,252 @@
<table id="table_index2" class="table table-striped table-bordered dt-responsive nowrap" style="width:98.5%"> <?php
<thead> $tableArr = array(
<tr> "All" => "table_index2",
<th style="vertical-align: middle;text-align:center;">合約號</th> "A" => "table_index3",
<th style="vertical-align: middle;text-align:center;">汰改種類</th> "B" => "table_index4",
<th style="vertical-align: middle;text-align:center;">電梯編號</th> "C" => "table_index5",
<th style="vertical-align: middle;text-align:center;">客戶姓名</th> "D" => "table_index6",
<th style="vertical-align: middle;text-align:center;">地址</th> "Z" => "table_index7"
<th style="vertical-align: middle;text-align:center;">工勘狀態</th> );
<th style="vertical-align: middle;text-align:center;">下單日<br />(普來特富)</th> ?>
<th style="vertical-align: middle;text-align:center;">預計到廠日<br />(觀音廠)</th> <table id="<?php echo $tableArr[$key]; ?>" class="table table-striped table-bordered dt-responsive nowrap" style="width:98.5%">
<th style="vertical-align: middle;text-align:center;">實際到廠日<br />(觀音廠)</th> <thead>
<th style="vertical-align: middle;text-align:center;">預計出貨日<br />(到工地)</th> <tr>
<th style="vertical-align: middle;text-align:center;">工務確認</th> <th style="vertical-align: middle;text-align:center;">合約號</th>
<th style="vertical-align: middle;text-align:center;">營業/契約確認</th> <th style="vertical-align: middle;text-align:center;">汰改種類</th>
<th style="vertical-align: middle;text-align:center;">設計確認</th> <th style="vertical-align: middle;text-align:center;">電梯編號</th>
<th style="vertical-align: middle;text-align:center;">生管(業務)<br />確認</th> <th style="vertical-align: middle;text-align:center;">客戶姓名</th>
</tr> <th style="vertical-align: middle;text-align:center;">規格</th>
</thead> <th style="vertical-align: middle;text-align:center;">地址</th>
<tbody> <th style="vertical-align: middle;text-align:center;">工勘狀態</th>
<?php <th style="vertical-align: middle;text-align:center;">下單日<br />(普來特富)</th>
foreach ($dataDetailsArr as $key => $data) : <th style="vertical-align: middle;text-align:center;">預計到廠日<br />(觀音廠)</th>
// 營業 <th style="vertical-align: middle;text-align:center;">實際到廠日<br />(觀音廠)</th>
$data['yingyeok'] = 0; <th style="vertical-align: middle;text-align:center;">預計出貨日<br />(到工地)</th>
// 設計 <th style="vertical-align: middle;text-align:center;">工務確認</th>
$data['shejiok'] = 0; <th style="vertical-align: middle;text-align:center;">營業/契約確認</th>
// 工務 <th style="vertical-align: middle;text-align:center;">設計確認</th>
$data['gongwuok'] = 0; <th style="vertical-align: middle;text-align:center;">生管(業務)<br />確認</th>
// 生管 </tr>
$data['shengguanok'] = 0; </thead>
// 財務 <tbody>
// $data['caiwuok'] = 0; <?php
foreach ($dataDetailsArr as $key => $data) :
// 工務統計已確認
if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2) //規格
$data['gongwuok'] += 1; $Specification = $data['facility_kind'];
if (!in_array($data['site_survey_contact_verify'], ['1', 'A'])) $Specification .= !empty($data['numberofpassenger']) ? "-" . $data['numberofpassenger'] : "";
$data['gongwuok'] += 1; $Specification .= !empty($data['weight']) ? "-" . $data['weight'] : "";
if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2) $Specification .= !empty($data['numberofstop']) ? "-" . $data['numberofstop'] : "";
$data['gongwuok'] += 1; $Specification .= !empty($data['numberoffloor']) ? "/" . $data['numberoffloor'] : "";
$Specification .= !empty($data['opentype']) ? "-" . $data['opentype'] : "";
// 營業統計已確認 $Specification .= !empty($data['speed']) ? $data['speed'] : "";
if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2)
$data['yingyeok'] += 1;
if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2) // 營業
$data['yingyeok'] += 1; $data['yingyeok'] = 0;
if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2) // 設計
$data['yingyeok'] += 1; $data['shejiok'] = 0;
if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2) // 工務
$data['yingyeok'] += 1; $data['gongwuok'] = 0;
// 生管
// 設計統計已確認 $data['shengguanok'] = 0;
if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2) // 財務
$data['shejiok'] += 1; // $data['caiwuok'] = 0;
if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2)
$data['shejiok'] += 1; // 工務統計已確認
if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2) if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2)
$data['shejiok'] += 1; $data['gongwuok'] += 1;
if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2) if (!in_array($data['site_survey_contact_verify'], ['1', 'A']))
$data['shejiok'] += 1; $data['gongwuok'] += 1;
if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2) if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2)
$data['shejiok'] += 1; $data['gongwuok'] += 1;
// 生管統計已確認 // 營業統計已確認
if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2) if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2)
$data['shengguanok'] += 1; $data['yingyeok'] += 1;
if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2) if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2)
$data['shengguanok'] += 1; $data['yingyeok'] += 1;
if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2) if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2)
$data['shengguanok'] += 1; $data['yingyeok'] += 1;
if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2) if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2)
$data['shengguanok'] += 1; $data['yingyeok'] += 1;
if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C')
$data['shengguanok'] += 1; // 設計統計已確認
if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C') if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2)
$data['shengguanok'] += 1; $data['shejiok'] += 1;
if ($data['arrival_date_verify'] == 'A') if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2)
$data['shengguanok'] += 1; $data['shejiok'] += 1;
if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2)
?> $data['shejiok'] += 1;
<tr> if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2)
<td> $data['shejiok'] += 1;
<?php if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2)
if (in_array($department_id, [311, 312, 313, 314,315, 501, 511, 512, 513, 514, 220, 911])) { $data['shejiok'] += 1;
$sql = "
SELECT // 生管統計已確認
mid, if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2)
pr_item_id, $data['shengguanok'] += 1;
version if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2)
FROM specsurvey_main $data['shengguanok'] += 1;
WHERE contractno = '" . $data['contractno'] . "' if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2)
"; $data['shengguanok'] += 1;
$result = mysqli_query($link, $sql); if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2)
$row = mysqli_fetch_array($result); $data['shengguanok'] += 1;
if (empty($row['mid'])) { if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C')
echo $data['contractno']; $data['shengguanok'] += 1;
} else { if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C')
echo "<a target='_blank' href='/wms/mkt/specsurvey_renovate-view.php?pa=" . $row['mid'] . "," . $row['pr_item_id'] . "," . $row['version'] . "&$token_link'>" . $data['contractno'] . "</a>"; $data['shengguanok'] += 1;
} if ($data['arrival_date_verify'] == 'A')
} else { $data['shengguanok'] += 1;
echo $data['contractno'];
} ?>
?> <tr>
</td> <td>
<td> <?php
<?php if (in_array($department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 514, 220, 911])) {
// 汰改 json 轉字串組合 ex M1+M2 $sql = "
echo implode("+", json_decode($data['renovate_type'])); SELECT
?> mid,
</td> pr_item_id,
<td><?php echo $data['facilityno']; ?></td> version
<td><?php echo $data['custom']; ?></td> FROM specsurvey_main
<td><?php echo $data['address']; ?></td> WHERE contractno = '" . $data['contractno'] . "'
<?php ";
foreach ($site_survey_status as $key => $val) { $result = mysqli_query($link, $sql);
if ((string)$data['site_survey_contact_verify'] == (string)$key) { $row = mysqli_fetch_array($result);
if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) { if (empty($row['mid'])) {
echo "<td style='color:#F00;'>$val</td>"; echo $data['contractno'];
} else { } else {
echo "<td>$val</td>"; echo "<a target='_blank' href='/wms/mkt/specsurvey_renovate-view.php?pa=" . $row['mid'] . "," . $row['pr_item_id'] . "," . $row['version'] . "&$token_link'>" . $data['contractno'] . "</a>";
} }
} } else {
} echo $data['contractno'];
?> }
<td> ?>
<?php </td>
if (!empty($data['prattford_order_date'])) <td>
echo date("Y/m/d", strtotime($data['prattford_order_date'])); <?php
?> // 汰改 json 轉字串組合 ex M1+M2
</td> echo implode("+", json_decode($data['renovate_type']));
<td> ?>
<?php </td>
if (!empty($data['estimated_shipping_schedule_date'])) <td><?php echo $data['facilityno']; ?></td>
echo date("Y/m/d", strtotime($data['estimated_shipping_schedule_date'])); <td><?php echo $data['custom']; ?></td>
?> <td><?php echo $Specification; ?></td>
</td> <td><?php echo $data['address']; ?></td>
<td> <?php
<?php foreach ($site_survey_status as $key => $val) {
if (!empty($data['actual_tofactory_date'])) if ((string)$data['site_survey_contact_verify'] == (string)$key) {
echo date("Y/m/d", strtotime($data['actual_tofactory_date'])); if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) {
?> echo "<td style='color:#F00;'>$val</td>";
</td> } else {
echo "<td>$val</td>";
<?php }
if (!empty($data['real_contract_arrival_date'])) { }
if ($futureDate >= date("Y/m/d", strtotime($data['real_contract_arrival_date']))) { }
if ($data['yingyeok'] != '4' && $data['shejiok'] != '5' && $data['gongwuok'] != '3' && $data['shengguanok'] != '1') { ?>
echo "<td style='color:#f00;'>" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>"; <td>
} else { <?php
echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>"; if (!empty($data['prattford_order_date']))
} echo date("Y/m/d", strtotime($data['prattford_order_date']));
} else { ?>
echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>"; </td>
} <td>
} else { <?php
echo "<td></td>"; if (!empty($data['estimated_shipping_schedule_date']))
} echo date("Y/m/d", strtotime($data['estimated_shipping_schedule_date']));
?> ?>
<td> </td>
<?php <td>
$str = $data['gongwuok'] . "/3"; <?php
if ($edit_flag & 4 && ($user_auth & 2)) { if (!empty($data['actual_tofactory_date']))
?> echo date("Y/m/d", strtotime($data['actual_tofactory_date']));
<p> ?>
<?php echo $str; ?> </td>
<a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<?php <?php
echo getGunwuName($data['address']); if (!empty($data['real_contract_arrival_date'])) {
?> if ($futureDate >= date("Y/m/d", strtotime($data['real_contract_arrival_date']))) {
</a> if ($data['yingyeok'] != '4' && $data['shejiok'] != '5' && $data['gongwuok'] != '3' && $data['shengguanok'] != '1') {
</p> echo "<td style='color:#f00;'>" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
<?php } else {
} else { echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
echo $str; }
echo getGunwuName($data['address']); } else {
} echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
?> }
</td> } else {
<td> echo "<td></td>";
<?php }
$str = $data['yingyeok'] . "/4"; ?>
if ($edit_flag & 1 && ($user_auth & 2)) { <td>
?> <?php
<p> $str = $data['gongwuok'] . "/3";
<?php echo $str; ?> if ($edit_flag & 4 && ($user_auth & 2)) {
<a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> ?>
<!-- <span class="glyphicon glyphicon-pencil"></span> --> <p>
<?php echo accountidToName($data['salesid']); ?> <?php echo $str; ?>
</a> <a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
</p> <?php
<?php echo getGunwuName($data['address']);
} else echo $str . " " . accountidToName($data['salesid']); ?>
?> </a>
</td> </p>
<td> <?php
<?php } else {
$str = $data['shejiok'] . "/5"; echo $str;
if ($edit_flag & 2 && ($user_auth & 2)) { echo getGunwuName($data['address']);
?> }
<p> ?>
<?php echo $str; ?> </td>
<a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> <td>
林昭翰 <?php
</a> $str = $data['yingyeok'] . "/4";
</p> if ($edit_flag & 1 && ($user_auth & 2)) {
<?php ?>
} else echo $str . "林昭翰"; <p>
?> <?php echo $str; ?>
</td> <a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<td> <!-- <span class="glyphicon glyphicon-pencil"></span> -->
<?php <?php echo accountidToName($data['salesid']); ?>
$str = $data['shengguanok'] . "/7"; </a>
if ($edit_flag & 8 && ($user_auth & 2)) { </p>
?> <?php
<p> } else echo $str . " " . accountidToName($data['salesid']);
<?php echo $str; ?> ?>
<a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm"> </td>
<span class="glyphicon glyphicon-pencil"></span> <td>
<?php
</a> $str = $data['shejiok'] . "/5";
</p> if ($edit_flag & 2 && ($user_auth & 2)) {
<?php ?>
} else echo $str . " "; <p>
?> <?php echo $str; ?>
</td> <a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
</tr> 林昭翰
<?php endforeach; ?> </a>
</tbody> </p>
<?php
} else echo $str . "林昭翰";
?>
</td>
<td>
<?php
$str = $data['shengguanok'] . "/7";
if ($edit_flag & 8 && ($user_auth & 2)) {
?>
<p>
<?php echo $str; ?>
<a target='_blank' href="wipwhole-renovate-rec-invoice-edit.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</p>
<?php
} else echo $str . " ";
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table> </table>

978
wms/wipwhole-renovate-index.php

@ -1,462 +1,518 @@
<?php <?php
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
/** /**
* 權限規則: * 權限規則:
* 1.營業經理查看全部 部門代碼:311 312 313 314 315 * 1.營業經理查看全部 部門代碼:311 312 313 314 315
* 2.營業員瀏覽自己合約資料 部門代碼:511 512 513 514 * 2.營業員瀏覽自己合約資料 部門代碼:511 512 513 514
* 3.設計部門代碼:911 * 3.設計部門代碼:911
* 4.工務:宜蘭=高培軒(M0087) 北=吳宗紘(M0040) 中=林瑋隆(M0113) 南=韋宗榮(M0039)改鄭存邑(M0102) * 4.工務:宜蘭=高培軒(M0087) 北=吳宗紘(M0040) 中=林瑋隆(M0113) 南=韋宗榮(M0039)改鄭存邑(M0102)
* 5.生管:伃廷(M0024) * 5.生管:伃廷(M0024)
* 6.鍾哥 部門代碼:250 職位大小:1 4 * 6.鍾哥 部門代碼:250 職位大小:1 4
* 7.許協理 部門代碼:320 職位大小:1 * 7.許協理 部門代碼:320 職位大小:1
* 8.詹總 部門代碼:50 職位大小:1 * 8.詹總 部門代碼:50 職位大小:1
* 9.許總 部門代碼:20 職位大小:1 * 9.許總 部門代碼:20 職位大小:1
* *
* 新梯 543 筆 (已匯入) * 新梯 543 筆 (已匯入)
* 舊改 141 筆 (已匯入) * 舊改 141 筆 (已匯入)
* 已簽回 684 筆 (共計) * 已簽回 684 筆 (共計)
*/ */
include "header.php"; include "header.php";
include "wipwhole-renovate-index-function.php"; include "wipwhole-renovate-index-function.php";
include "css/view/wipwhole-renovate-index.php"; include "css/view/wipwhole-renovate-index.php";
// 設定警告出貨到期的天數 // 設定警告出貨到期的天數
$numberOfDaysToAdd = 45; $numberOfDaysToAdd = 45;
$futureDate = date("Y/m/d", strtotime(date("Y-m-d") . " +{$numberOfDaysToAdd} days")); $futureDate = date("Y/m/d", strtotime(date("Y-m-d") . " +{$numberOfDaysToAdd} days"));
// 主資料陣列 // 主資料陣列
$data = array(); $data = array();
// 取得當前使用者所屬部門 // 取得當前使用者所屬部門
$department_id = getDepartmentId($link, $user_id); $department_id = getDepartmentId($link, $user_id);
// 取得當前使用者所屬職位 // 取得當前使用者所屬職位
$role_id = getRoleId($link, $user_id); $role_id = getRoleId($link, $user_id);
// 下方編輯按鈕權限 // 下方編輯按鈕權限
// 1=營叢 2=設計 4=工務 8=生管 15=其他 // 1=營叢 2=設計 4=工務 8=生管 15=其他
$edit_flag = getEditFlag($department_id, $role_id, $user_id); $edit_flag = getEditFlag($department_id, $role_id, $user_id);
// 接受搜尋 post 後觸發 // 接受搜尋 post 後觸發
$contractno = empty($_REQUEST['contractno']) ? null : $_REQUEST['contractno']; $contractno = empty($_REQUEST['contractno']) ? null : $_REQUEST['contractno'];
$facilityno = empty($_REQUEST['facilityno']) ? null : $_REQUEST['facilityno']; $facilityno = empty($_REQUEST['facilityno']) ? null : $_REQUEST['facilityno'];
$custom = empty($_REQUEST['custom']) ? null : $_REQUEST['custom']; $custom = empty($_REQUEST['custom']) ? null : $_REQUEST['custom'];
$site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ? '' : $_REQUEST['site_survey_contact_verify']; $site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ? '' : $_REQUEST['site_survey_contact_verify'];
$real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start']; $real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start'];
$real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end']; $real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end'];
$area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no']; $area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no'];
// 取得資料 sql // 取得資料 sql
$sql = getDataSql($department_id, $role_id, $user_id); $sql = getDataSql($department_id, $role_id, $user_id);
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// 取得資料(工勘部門階段) sql // 取得資料(工勘部門階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "A"); $sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "A");
$dataA = mysqli_query($link, $sql); $dataA = mysqli_query($link, $sql);
// 取得資料(營業部門階段) sql // 取得資料(營業部門階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "B"); $sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "B");
$dataB = mysqli_query($link, $sql); $dataB = mysqli_query($link, $sql);
// 取得資料(設計部門階段) sql // 取得資料(設計部門階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "C"); $sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "C");
$dataC = mysqli_query($link, $sql); $dataC = mysqli_query($link, $sql);
// 取得資料(生管階段) sql // 取得資料(生管階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "D"); $sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "D");
$dataD = mysqli_query($link, $sql); $dataD = mysqli_query($link, $sql);
// 取得資料(結案階段) sql // 取得資料(結案階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "Z"); $sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "Z");
$dataZ = mysqli_query($link, $sql); $dataZ = mysqli_query($link, $sql);
?> ?>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
<form id='myForm' method='post' action='wipwhole-renovate-index.php?<?= $token_link ?>'> <form id='myForm' method='post' action='wipwhole-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'> <table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead> <thead>
<tr> <tr>
<td colspan="9"> <td colspan="9">
<h3 style='text-align:center'>作番大日程(汰改)</h3> <h3 style='text-align:center'>作番大日程(汰改)</h3>
</td> </td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<th>合約號</th> <th>合約號</th>
<td><input type="text" class='form-control' id='contractno' name='contractno' value="<?php echo $contractno; ?>"></td> <td><input type="text" class='form-control' id='contractno' name='contractno' value="<?php echo $contractno; ?>"></td>
<th>電梯編號</th> <th>電梯編號</th>
<td><input type="text" class='form-control' id='facilityno' name='facilityno' value="<?php echo $facilityno; ?>"></td> <td><input type="text" class='form-control' id='facilityno' name='facilityno' value="<?php echo $facilityno; ?>"></td>
<th>客戶姓名</th> <th>客戶姓名</th>
<td><input type="text" class='form-control' id='custom' name='custom' value="<?php echo $custom; ?>"></td> <td><input type="text" class='form-control' id='custom' name='custom' value="<?php echo $custom; ?>"></td>
<th>預計出貨日</th> <th>預計出貨日</th>
<td colspan="2"> <td colspan="2">
<input type="date" class='form-control' id='real_contract_arrival_date_start' name='real_contract_arrival_date_start' value="<?php echo $real_contract_arrival_date_start; ?>" style='width:40%;display:inline;'> <input type="date" class='form-control' id='real_contract_arrival_date_start' name='real_contract_arrival_date_start' value="<?php echo $real_contract_arrival_date_start; ?>" style='width:40%;display:inline;'>
<input type="date" class='form-control' id='real_contract_arrival_date_end' name='real_contract_arrival_date_end' value="<?php echo $real_contract_arrival_date_end; ?>" style='width:40%;display:inline;'> <input type="date" class='form-control' id='real_contract_arrival_date_end' name='real_contract_arrival_date_end' value="<?php echo $real_contract_arrival_date_end; ?>" style='width:40%;display:inline;'>
</td> </td>
</tr> </tr>
<tr> <tr>
<th> <th>
區域 區域
</th> </th>
<td> <td>
<?php <?php
$area_status = array( $area_status = array(
"" => "全部", "" => "全部",
"N" => "N:北區", "N" => "N:北區",
"Y" => "Y:宜蘭", "Y" => "Y:宜蘭",
"T" => "T:桃區", "T" => "T:桃區",
"C" => "C:中區", "C" => "C:中區",
"K" => "K:南區" "K" => "K:南區"
); );
?> ?>
<select name="area_no" id="area_no"> <select name="area_no" id="area_no">
<?php <?php
foreach ($area_status as $key => $val) { foreach ($area_status as $key => $val) {
if ((string)$area_no == (string)$key) { if ((string)$area_no == (string)$key) {
echo "<option value='$key' selected>$val</option>"; echo "<option value='$key' selected>$val</option>";
} else { } else {
echo "<option value='$key'>$val</option>"; echo "<option value='$key'>$val</option>";
} }
} }
?> ?>
</select> </select>
</td> </td>
<th> <th>
工勘狀態 工勘狀態
</th> </th>
<td> <td>
<?php <?php
$site_survey_status = array( $site_survey_status = array(
"0" => "已確認", "0" => "已確認",
"1" => "未確認", "1" => "未確認",
"2" => "無工勘需求", "2" => "無工勘需求",
"A" => "未動工", "A" => "未動工",
"B" => "地下室施工", "B" => "地下室施工",
"C" => "打樁", "C" => "打樁",
"D" => "地基", "D" => "地基",
"E" => "挖土", "E" => "挖土",
"G" => "機房", "G" => "機房",
"H" => "機械式淨高", "H" => "機械式淨高",
"M" => "樓中樓", "M" => "樓中樓",
"OH" => "最高層(頂樓高度)", "OH" => "最高層(頂樓高度)",
"P" => "PIT(機坑深度)", "P" => "PIT(機坑深度)",
"R" => "R 樓", "R" => "R 樓",
"S" => "停工", "S" => "停工",
"T" => "TOP", "T" => "TOP",
"TC" => "頂部間隙", "TC" => "頂部間隙",
"TS" => "行程", "TS" => "行程",
"TH" => "全高", "TH" => "全高",
"Y" => "已搭、已出", "Y" => "已搭、已出",
"YB" => "退購結案", "YB" => "退購結案",
"YF" => "既有建物", "YF" => "既有建物",
"YN" => "已搭、未出" "YN" => "已搭、未出"
); );
for ($i = 1; $i < 200; $i++) { for ($i = 1; $i < 200; $i++) {
$site_survey_status[$i . "F"] = $i . "F"; $site_survey_status[$i . "F"] = $i . "F";
} }
?> ?>
<select style="width:100%;" name="site_survey_contact_verify" id="site_survey_contact_verify"> <select style="width:100%;" name="site_survey_contact_verify" id="site_survey_contact_verify">
<?php <?php
echo "<option value=''>全部</option>"; echo "<option value=''>全部</option>";
foreach ($site_survey_status as $key => $val) { foreach ($site_survey_status as $key => $val) {
if ((string)$site_survey_contact_verify == (string)$key) { if ((string)$site_survey_contact_verify == (string)$key) {
echo "<option value='$key' selected>$val</option>"; echo "<option value='$key' selected>$val</option>";
} else { } else {
echo "<option value='$key'>$val</option>"; echo "<option value='$key'>$val</option>";
} }
} }
?> ?>
</select> </select>
</td> </td>
<td colspan="5" style='text-align:left'> <td colspan="5" style='text-align:left'>
<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>
<?php <?php
if ($department_id == '321' || $department_id == '220') { if ($department_id == '321' || $department_id == '220') {
?> ?>
<a href="wipwhole-renovate-rec-invoice.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>" class="btn btn-primary btn-sm">新增</a> <a href="wipwhole-renovate-rec-invoice.php?function_name=wipwholerenstatus&<?php echo $token_link; ?>" class="btn btn-primary btn-sm">新增</a>
<?php <?php
} }
?> ?>
<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_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='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='clean_all_input()'>清除</button>
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='generateButton()'>匯出excel</button> <button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='generateButton()'>匯出excel</button>
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='estimatedShippingDateReportButton()'>出貨地區預定明細</button> <button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='estimatedShippingDateReportButton()'>出貨地區預定明細</button>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
</div> </div>
<nav class="navbar navbar-tabs" style="margin:0;margin-top:5px;"> <nav class="navbar navbar-tabs" style="margin:0;margin-top:5px;">
<div class="container-fluid"> <div class="container-fluid">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"> <li class="active">
<a href="#" onclick="showAllTable()">全部資料</a> <a href="#" onclick="showAllTable()">全部資料</a>
</li> </li>
<li> <li>
<a href="#" onclick="showATable()">廠務確認中</a> <a href="#" onclick="showATable()">廠務確認中</a>
</li> </li>
<li> <li>
<a href="#" onclick="showBTable()">營業確認中</a> <a href="#" onclick="showBTable()">營業確認中</a>
</li> </li>
<li> <li>
<a href="#" onclick="showCTable()">設計確認中</a> <a href="#" onclick="showCTable()">設計確認中</a>
</li> </li>
<li> <li>
<a href="#" onclick="showDTable()">生管理確認中</a> <a href="#" onclick="showDTable()">生管理確認中</a>
</li> </li>
<li> <li>
<a href="#" onclick="showZTable()">已結案</a> <a href="#" onclick="showZTable()">已結案</a>
</li> </li>
</ul> </ul>
</div> </div>
</nav> </nav>
<?php <?php
$dataArr = array( $dataArr = array(
"All" => $data, "All" => $data,
"A" => $dataA, "A" => $dataA,
"B" => $dataB, "B" => $dataB,
"C" => $dataC, "C" => $dataC,
"D" => $dataD, "D" => $dataD,
"Z" => $dataZ "Z" => $dataZ
); );
foreach ($dataArr as $key => $val) { foreach ($dataArr as $key => $val) {
if ($val) : if ($val) :
$dataDetailsArr = $val; $dataDetailsArr = $val;
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>"; echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-renovate-index-table-html.php"; include "wipwhole-renovate-index-table-html.php";
echo "</div>"; echo "</div>";
endif; endif;
} }
#結束連線 #結束連線
mysqli_close($link); mysqli_close($link);
?> ?>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script> <script>
var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>"; var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>";
$(document).ready(function() { $(document).ready(function() {
$('#site_survey_contact_verify').select2(); $('#site_survey_contact_verify').select2();
}); });
$(function() { $(function() {
$(".data_table_div").hide(); $(".data_table_div").hide();
showTable(sheetNum); showTable(sheetNum);
}) })
const formData = new FormData(); const formData = new FormData();
formData.append("contractno", "<?php echo empty($_POST['contractno']) ? null : $_POST['contractno']; ?>"); formData.append("contractno", "<?php echo empty($_POST['contractno']) ? null : $_POST['contractno']; ?>");
formData.append("facilityno", "<?php echo empty($_POST['facilityno']) ? null : $_POST['facilityno']; ?>"); formData.append("facilityno", "<?php echo empty($_POST['facilityno']) ? null : $_POST['facilityno']; ?>");
formData.append("custom", "<?php echo empty($_POST['custom']) ? null : $_POST['custom']; ?>"); 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("site_survey_contact_verify", "<?php echo empty($_POST['site_survey_contact_verify']) ? '' : $_POST['site_survey_contact_verify']; ?>");
formData.append("real_contract_arrival_date_start", "<?php echo empty($_POST['real_contract_arrival_date_start']) ? null : $_POST['real_contract_arrival_date_start']; ?>"); formData.append("real_contract_arrival_date_start", "<?php echo empty($_POST['real_contract_arrival_date_start']) ? null : $_POST['real_contract_arrival_date_start']; ?>");
formData.append("real_contract_arrival_date_end", "<?php echo empty($_POST['real_contract_arrival_date_end']) ? null : $_POST['real_contract_arrival_date_end']; ?>"); formData.append("real_contract_arrival_date_end", "<?php echo empty($_POST['real_contract_arrival_date_end']) ? null : $_POST['real_contract_arrival_date_end']; ?>");
formData.append("area_no", "<?php echo empty($_POST['area_no']) ? null : $_POST['area_no']; ?>"); formData.append("area_no", "<?php echo empty($_POST['area_no']) ? null : $_POST['area_no']; ?>");
// 使用 JavaScript 監聽按鈕點擊事件 // 使用 JavaScript 監聽按鈕點擊事件
function generateButton() { function generateButton() {
// 使用 XMLHttpRequest 來呼叫 PHP 檔案,生成 Excel // 使用 XMLHttpRequest 來呼叫 PHP 檔案,生成 Excel
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('POST', window.location.origin + "/wms/wipwhole-renovate-index-export-excel.php?<?= $token_link ?>", true); xhr.open('POST', window.location.origin + "/wms/wipwhole-renovate-index-export-excel.php?<?= $token_link ?>", true);
xhr.responseType = 'text'; xhr.responseType = 'text';
xhr.onload = function() { xhr.onload = function() {
if (xhr.status === 200) { if (xhr.status === 200) {
// 取得 PHP 回傳的檔案路徑 // 取得 PHP 回傳的檔案路徑
var response = xhr.responseText; var response = xhr.responseText;
console.log(xhr.responseText); console.log(xhr.responseText);
var file_path = xhr.responseText; var file_path = xhr.responseText;
// 創建下載連結 // 創建下載連結
var link = document.createElement('a'); var link = document.createElement('a');
link.setAttribute('href', window.location.origin + "/wms/excel/gary_test.xlsx"); link.setAttribute('href', window.location.origin + "/wms/excel/gary_test.xlsx");
// 設定下載的檔案名稱 // 設定下載的檔案名稱
link.setAttribute('download', '作番大日程報表(汰改).xlsx'); link.setAttribute('download', '作番大日程報表(汰改).xlsx');
link.style.display = 'none'; link.style.display = 'none';
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
} }
}; };
xhr.send(formData); xhr.send(formData);
} }
function clean_all_input() { function clean_all_input() {
document.getElementById("site_survey_contact_verify").value = ""; document.getElementById("site_survey_contact_verify").value = "";
document.getElementById("contractno").value = ""; document.getElementById("contractno").value = "";
document.getElementById("facilityno").value = ""; document.getElementById("facilityno").value = "";
document.getElementById("custom").value = ""; document.getElementById("custom").value = "";
document.getElementById("real_contract_arrival_date_start").value = ""; document.getElementById("real_contract_arrival_date_start").value = "";
document.getElementById("real_contract_arrival_date_end").value = ""; document.getElementById("real_contract_arrival_date_end").value = "";
document.getElementById("myForm").submit(); document.getElementById("myForm").submit();
} }
function day_before_input() { function day_before_input() {
document.getElementById("contractno").value = ""; document.getElementById("contractno").value = "";
document.getElementById("facilityno").value = ""; document.getElementById("facilityno").value = "";
document.getElementById("custom").value = ""; document.getElementById("custom").value = "";
document.getElementById("real_contract_arrival_date_start").value = "<?php echo date("Y-m-d"); ?>"; document.getElementById("real_contract_arrival_date_start").value = "<?php echo date("Y-m-d"); ?>";
document.getElementById("real_contract_arrival_date_end").value = "<?php echo date("Y-m-d", strtotime("+" . $numberOfDaysToAdd . " days")) ?>"; document.getElementById("real_contract_arrival_date_end").value = "<?php echo date("Y-m-d", strtotime("+" . $numberOfDaysToAdd . " days")) ?>";
document.getElementById("myForm").submit(); document.getElementById("myForm").submit();
} }
function day_before_all_input() { function day_before_all_input() {
document.getElementById("contractno").value = ""; document.getElementById("contractno").value = "";
document.getElementById("facilityno").value = ""; document.getElementById("facilityno").value = "";
document.getElementById("custom").value = ""; document.getElementById("custom").value = "";
document.getElementById("real_contract_arrival_date_start").value = ""; document.getElementById("real_contract_arrival_date_start").value = "";
document.getElementById("real_contract_arrival_date_end").value = "<?php echo date("Y-m-d", strtotime("+" . $numberOfDaysToAdd . " days")) ?>"; document.getElementById("real_contract_arrival_date_end").value = "<?php echo date("Y-m-d", strtotime("+" . $numberOfDaysToAdd . " days")) ?>";
document.getElementById("myForm").submit(); document.getElementById("myForm").submit();
} }
function estimatedShippingDateReportButton() { function estimatedShippingDateReportButton() {
window.location.href = '<?php echo "/wms/estimated_shipping_date_report.php?$token_link" ?>'; window.location.href = '<?php echo "/wms/estimated_shipping_date_report.php?$token_link" ?>';
} }
$('#table_index2,#table_index3,#table_index4,#table_index5,#table_index6,#table_index7').DataTable({ $('#table_index2,#table_index3,#table_index4,#table_index5,#table_index6,#table_index7').DataTable({
"language": { // columnDefs: [{
"emptyTable": "無資料...", // width: 100,
"processing": "處理中...", // targets: 0
"loadingRecords": "載入中...", // },{
"lengthMenu": "顯示_MENU_ 筆", // width: 100,
"zeroRecords": "沒有符合的結果", // targets: 1
"info": "第 _START_ 至 _END_ 項,共 _TOTAL_ 項", // },{
"infoEmpty": "第 0 至 0 項,共 0 項", // width: 100,
"infoFiltered": "(從 _MAX_ 項結果中過濾)", // targets: 2
"infoPostFix": "", // },{
"search": "", // width: 200,
"paginate": { // targets: 3
"first": "第一頁", // },{
"previous": "上一頁", // width: 230,
"next": "下一頁", // targets: 4
"last": "最後一頁" // },{
}, // width: 250,
"aria": { // targets: 5
"sortAscending": ": 升冪排列", // },{
"sortDescending": ": 降冪排列" // width: 100,
} // targets: 6
} // }
}, { // ,{
"order": [ // width: 100,
[4, "desc"], // targets: 7
[8, "asc"] // }
] // ,{
} // width: 100,
// targets: 8
); // }
// ,{
// width: 100,
function showAllTable() { // targets: 9
sheetNum = "All"; // }
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum; // ,{
} // width: 100,
// targets: 10
function showATable() { // }
sheetNum = "A"; // ,{
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum; // width: 100,
} // targets: 11
// }
function showBTable() { // ,{
sheetNum = "B"; // width: 100,
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum; // targets: 12
} // }
// ,{
function showCTable() { // width: 100,
sheetNum = "C"; // targets: 13
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum; // }
} // ,{
// width: 100,
function showDTable() { // targets: 14
sheetNum = "D"; // }],
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum; // fixedColumns: true,
} // paging: false,
// scrollCollapse: true,
function showZTable() { // scrollX: true,
sheetNum = "Z"; "language": {
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum; "emptyTable": "無資料...",
} "processing": "處理中...",
"loadingRecords": "載入中...",
function showTable(code) { "lengthMenu": "顯示_MENU_ 筆",
var tmp_arr = { "zeroRecords": "沒有符合的結果",
"All": "1", "info": "第 _START_ 至 _END_ 項,共 _TOTAL_ 項",
"A": "2", "infoEmpty": "第 0 至 0 項,共 0 項",
"B": "3", "infoFiltered": "(從 _MAX_ 項結果中過濾)",
"C": "4", "infoPostFix": "",
"D": "5", "search": "",
"Z": "6", "paginate": {
} "first": "第一頁",
$("body > nav.navbar.navbar-tabs > div > ul > li").attr("class", ""); "previous": "上一頁",
$("body > nav.navbar.navbar-tabs > div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active"); "next": "下一頁",
$(".data_table_div").hide(); "last": "最後一頁"
$("#data_" + code + "_table_div").show(); },
} "aria": {
"sortAscending": ": 升冪排列",
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋"; "sortDescending": ": 降冪排列"
document.querySelector("#table_index3_filter > label > input").placeholder = "快速搜尋"; }
document.querySelector("#table_index4_filter > label > input").placeholder = "快速搜尋"; }
document.querySelector("#table_index5_filter > label > input").placeholder = "快速搜尋"; }, {
document.querySelector("#table_index6_filter > label > input").placeholder = "快速搜尋"; "order": [
document.querySelector("#table_index7_filter > label > input").placeholder = "快速搜尋"; [4, "desc"],
[8, "asc"]
]
// datatable 畫面重整後保留資料 });
var contractno = $("#contractno").val();
var facilityno = $("#facilityno").val(); function showAllTable() {
var custom = $("#custom").val(); sheetNum = "All";
var site_survey_contact_verify = $("#site_survey_contact_verify").val(); window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
var real_contract_arrival_date_start = $("#real_contract_arrival_date_start").val(); }
var real_contract_arrival_date_end = $("#real_contract_arrival_date_end").val();
var area_no = $("#area_no").val(); function showATable() {
sheetNum = "A";
var showNum = <?php echo empty($_GET['showNum']) ? '10' : $_GET['showNum']; ?>; window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
var nowPage = <?php echo empty($_GET['nowPage']) ? '1' : $_GET['nowPage']; ?>; }
var searchContent = "<?php echo empty($_GET['searchContent']) ? '' : $_GET['searchContent']; ?>";
function showBTable() {
var dataArr2 = { sheetNum = "B";
"All": "table_index2", window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
"A": "table_index3", }
"B": "table_index4",
"C": "table_index5", function showCTable() {
"D": "table_index6", sheetNum = "C";
"Z": "table_index7", window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
} }
function showDTable() {
var table = $('#' + dataArr2[sheetNum]).DataTable(); sheetNum = "D";
table.search(searchContent).draw(); window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
table.page.len(showNum).draw(); }
table.page((nowPage) - 1).draw('page');
function showZTable() {
// 監聽頁碼 sheetNum = "Z";
table.on('page.dt', function() { window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
searchDatatable(table); }
});
function showTable(code) {
// 監聽資料筆數 var tmp_arr = {
table.on('length.dt', function(e, settings, len) { "All": "1",
searchDatatable(table); "A": "2",
}); "B": "3",
"C": "4",
// 監聽搜尋事件 "D": "5",
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() { "Z": "6",
searchDatatable(table); }
}); $("body > nav.navbar.navbar-tabs > div > ul > li").attr("class", "");
$("body > nav.navbar.navbar-tabs > div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
$(".data_table_div").hide();
function searchDatatable(table) { $("#data_" + code + "_table_div").show();
showNum = table.page.len(); }
nowPage = table.page.info().page + 1;
searchContent = table.search(); document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋";
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + document.querySelector("#table_index3_filter > label > input").placeholder = "快速搜尋";
"&showNum=" + showNum + "&nowPage=" + nowPage + "&searchContent=" + searchContent + "&sheetNum=" + sheetNum + document.querySelector("#table_index4_filter > label > input").placeholder = "快速搜尋";
"&contractno=" + contractno + "&facilityno=" + facilityno + "&custom=" + custom + document.querySelector("#table_index5_filter > label > input").placeholder = "快速搜尋";
"&site_survey_contact_verify=" + site_survey_contact_verify + "&real_contract_arrival_date_start=" + real_contract_arrival_date_start + document.querySelector("#table_index6_filter > label > input").placeholder = "快速搜尋";
"&real_contract_arrival_date_end=" + real_contract_arrival_date_end + "&area_no=" + area_no; document.querySelector("#table_index7_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_contract_arrival_date_start = $("#real_contract_arrival_date_start").val();
var real_contract_arrival_date_end = $("#real_contract_arrival_date_end").val();
var area_no = $("#area_no").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 dataArr2 = {
"All": "table_index2",
"A": "table_index3",
"B": "table_index4",
"C": "table_index5",
"D": "table_index6",
"Z": "table_index7",
}
var table = $('#' + dataArr2[sheetNum]).DataTable();
table.search(searchContent).draw();
table.page.len(showNum).draw();
table.page((nowPage) - 1).draw('page');
// 監聽頁碼
table.on('page.dt', function() {
searchDatatable(table);
});
// 監聽資料筆數
table.on('length.dt', function(e, settings, len) {
searchDatatable(table);
});
// 監聽搜尋事件
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() {
searchDatatable(table);
});
function searchDatatable(table) {
showNum = table.page.len();
nowPage = table.page.info().page + 1;
searchContent = table.search();
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" +
"&showNum=" + showNum + "&nowPage=" + nowPage + "&searchContent=" + searchContent + "&sheetNum=" + sheetNum +
"&contractno=" + contractno + "&facilityno=" + facilityno + "&custom=" + custom +
"&site_survey_contact_verify=" + site_survey_contact_verify + "&real_contract_arrival_date_start=" + real_contract_arrival_date_start +
"&real_contract_arrival_date_end=" + real_contract_arrival_date_end + "&area_no=" + area_no;
}
</script> </script>
Loading…
Cancel
Save