From 54c4ce2cd99f84d706fdebcbc737db83ad0777ba Mon Sep 17 00:00:00 2001 From: "gary_chen\\gary_chen" Date: Tue, 28 Nov 2023 09:43:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=81=B8=E5=96=AE=E6=96=B0=E5=A2=9E=E9=83=A8?= =?UTF-8?q?=E9=96=80=E5=8F=AF=E4=BB=A5=E6=89=B9=E6=AC=A1=E5=8F=AF=E8=AE=80?= =?UTF-8?q?=E5=8F=AF=E5=AF=AB=202.=E4=BF=AE=E6=AD=A3=E5=A4=A7=E6=97=A5?= =?UTF-8?q?=E7=A8=8B=E5=80=89=E7=AE=A1=E7=9A=84edit=E6=A8=99=E7=B1=A4=203.?= =?UTF-8?q?=E7=B3=BB=E7=B5=B1=E6=94=B9=E7=82=BA=E7=B6=B2=E5=9D=80=E6=9C=89?= =?UTF-8?q?=E5=B8=B6=E5=85=A5=20token=20=E5=8D=B3=E5=8F=AF=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E7=99=BB=E5=85=A5=E7=B3=BB=E7=B5=B1=204.=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9C=A8=E8=A3=9D=E4=B8=AD=E7=B5=B1=E8=A8=88=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/fun_global.php | 7 + wms/header.php | 22 +- wms/menu-edit.php | 357 ++++++++-- wms/menu-record-update.php | 142 +++- wms/wipwhole-change-contractdate.php | 30 - ...wipwhole-change-planning-customer-name.php | 31 - wms/wipwhole-index-function.php | 2 +- wms/wipwhole-renovate-index-function.php | 2 +- wms/wipwhole-wipinstallstatus-index.php | 673 ++++++++++++++++++ 9 files changed, 1119 insertions(+), 147 deletions(-) create mode 100644 wms/wipwhole-wipinstallstatus-index.php diff --git a/wms/fun_global.php b/wms/fun_global.php index b00c9d19..86b987db 100644 --- a/wms/fun_global.php +++ b/wms/fun_global.php @@ -562,4 +562,11 @@ function sign_status($arr) { $ret["sign_nt"] = ""; } return $ret; +} + +function getAccounttype($link,$user_id){ + $sql = "SELECT * FROM account where accountid = '$user_id'"; + $data = mysqli_query($link, $sql); + $row = mysqli_fetch_array($data, MYSQLI_ASSOC); + return $row['accounttype']; } \ No newline at end of file diff --git a/wms/header.php b/wms/header.php index 569ebda1..92c40db5 100644 --- a/wms/header.php +++ b/wms/header.php @@ -23,7 +23,7 @@ if (isset($_REQUEST["function_name"])) { try { $conn = new PDO("sqlsrv:Server=60.244.87.101;Database=T8MASADA", "masada", "@m222222"); if ($conn) { - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } } catch (PDOException $e) { //echo "fail"; @@ -46,6 +46,24 @@ $token_link = "token=" . $_REQUEST["token"]; list($user_id, $enc_user_name, $login_dt) = explode(".", $token); $user_name = urldecode(base64_decode($enc_user_name)); +$user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id; +$login_dt = !empty($_GET["timestamp"]) ? $_GET["timestamp"] : $login_dt; + +include 'IncludeCommon.php'; +$includecommon = new IncludeCommon(); +$accounttype = getAccounttype($link, $user_id); +$login_json = null; +if (strlen($accounttype) != 0) { + $jsonres['menu'] = $includecommon->menu_v3($user_id, $accounttype); + $login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE); +} +?> + + diff --git a/wms/menu-edit.php b/wms/menu-edit.php index b7602d89..d202247c 100644 --- a/wms/menu-edit.php +++ b/wms/menu-edit.php @@ -1,95 +1,302 @@ + + - +//$link_content = str_replace(',', PHP_EOL, $data['link_content']); +?>
-
- - -
-
- - +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - + +
+
+ + +
+
+ + + + + +
+
+ + +
-
- - + +
+
+ + +
+
+ + + + + +
+
+ + +
- - -
-
- + +
+
+ + +
">
+ + \ No newline at end of file diff --git a/wms/menu-record-update.php b/wms/menu-record-update.php index 81d07022..41fd609d 100644 --- a/wms/menu-record-update.php +++ b/wms/menu-record-update.php @@ -1,9 +1,133 @@ $v) { - $$k = htmlspecialchars(stripslashes(trim($v))); +$auth_change_status = false; + +if (isset($_POST['update'])) { + + if (!empty($_POST['can_read'])) { + $auth_change_status = true; + $link_content = explode("\r\n", $_POST['link_content']); + foreach ($_POST['can_read'] as $id) { + + // 更新部門可寫權限 json + $permission = []; + $department_id = 0; + $role_id = 0; + + $sql = " + SELECT + department_id, + role_id, + permission + FROM department + WHERE 1=1 + AND id = '$id' + "; + $result = mysqli_query($link, $sql); + $data = mysqli_fetch_assoc($result); + $department_id = $data['department_id']; + $role_id = $data['role_id']; + mysqli_free_result($result); + $permission = json_decode($data['permission'], true); + foreach ($link_content as $row) { + $permission[$row] = '1'; + } + $new_permiccion = json_encode($permission); + + // 更改此職位權限 + $sql = " + UPDATE department + SET permission = '$new_permiccion' + WHERE 1=1 + AND id = '$id' + "; + mysqli_query($link, $sql); + + // 更改此職位底下所有員工的權限 + $sql = " + SELECT accountid + FROM account + WHERE 1=1 + AND department_id = '$department_id' + AND role_id = '$role_id' + "; + $result = mysqli_query($link, $sql); + $data2 = mysqli_fetch_all($result, MYSQLI_ASSOC); + mysqli_free_result($result); + foreach ($data2 as $row) { + $sql = " + UPDATE account_auth + SET permission = '$new_permiccion' + WHERE 1=1 + AND accountid = '" . $row['accountid'] . "' + "; + mysqli_query($link, $sql); + } + } + } + + if (!empty($_POST['can_write'])) { + $auth_change_status = true; + $link_content = explode("\r\n", $_POST['link_content']); + foreach ($_POST['can_write'] as $id) { + + // 更新部門可寫權限 json + $permission = []; + $department_id = 0; + $role_id = 0; + + $sql = " + SELECT + department_id, + role_id, + permission + FROM department + WHERE 1=1 + AND id = '$id' + "; + $result = mysqli_query($link, $sql); + $data = mysqli_fetch_assoc($result); + $department_id = $data['department_id']; + $role_id = $data['role_id']; + mysqli_free_result($result); + $permission = json_decode($data['permission'], true); + foreach ($link_content as $row) { + $permission[$row] = '3'; + } + $new_permiccion = json_encode($permission); + + // 更改此職位權限 + $sql = " + UPDATE department + SET permission = '$new_permiccion' + WHERE 1=1 + AND id = '$id' + "; + mysqli_query($link, $sql); + + // 更改此職位底下所有員工的權限 + $sql = " + SELECT accountid + FROM account + WHERE 1=1 + AND department_id = '$department_id' + AND role_id = '$role_id' + "; + $result = mysqli_query($link, $sql); + $data2 = mysqli_fetch_all($result, MYSQLI_ASSOC); + mysqli_free_result($result); + foreach ($data2 as $row) { + $sql = " + UPDATE account_auth + SET permission = '$new_permiccion' + WHERE 1=1 + AND accountid = '" . $row['accountid'] . "' + "; + mysqli_query($link, $sql); + } + } } //$link_content = str_replace(PHP_EOL, ',', $link_content); @@ -15,15 +139,19 @@ if(isset($_POST['update'])) { if ($affected > 0) { echo ""; + }elseif($auth_change_status == true){ + echo ""; } elseif ($affected == 0) { echo ""; + echo "location.href='menu-index.php?function_name=menu&" . $token_link . "';"; + echo ""; } else { echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); } } -?> \ No newline at end of file diff --git a/wms/wipwhole-change-contractdate.php b/wms/wipwhole-change-contractdate.php index ee6ff0f3..695e0adb 100644 --- a/wms/wipwhole-change-contractdate.php +++ b/wms/wipwhole-change-contractdate.php @@ -1,36 +1,6 @@ menu_v3($user_id, $accounttype); - $login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE); -} - -?> - -menu_v3($user_id, $accounttype); - $login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE); -} - -?> - -num_rows; +$Adata = $result->fetch_all(MYSQLI_ASSOC); + +// 新梯-在裝台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'A' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND ( + delivery_date IS NULL + OR delivery_date = '' + )AND ( + official_check_date IS NULL + OR official_check_date = '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$Adata2 = $result->fetch_all(MYSQLI_ASSOC); + +// 新梯-工收台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'A' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND (( + delivery_date IS NOT NULL + AND delivery_date != '' + )OR ( + official_check_date IS NOT NULL + AND official_check_date != '' + )) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$Adata3 = $result->fetch_all(MYSQLI_ASSOC); + + +// M1-出貨台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'B' + AND renovate_type like '%M1%' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$M1data = $result->fetch_all(MYSQLI_ASSOC); + +// M1-在裝台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'B' + AND renovate_type like '%M1%' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND ( + delivery_date IS NULL + OR delivery_date = '' + )AND ( + official_check_date IS NULL + OR official_check_date = '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$M1data2 = $result->fetch_all(MYSQLI_ASSOC); + +// M1-工收台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'B' + AND renovate_type like '%M1%' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND (( + delivery_date IS NOT NULL + AND delivery_date != '' + )OR ( + official_check_date IS NOT NULL + AND official_check_date != '' + )) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$M1data3 = $result->fetch_all(MYSQLI_ASSOC); + + +// MA-出貨台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'B' + AND renovate_type like '%MA%' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$Madata = $result->fetch_all(MYSQLI_ASSOC); + +// MA-在裝台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'B' + AND renovate_type like '%MA%' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND ( + delivery_date IS NULL + OR delivery_date = '' + )AND ( + official_check_date IS NULL + OR official_check_date = '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$Madata2 = $result->fetch_all(MYSQLI_ASSOC); + +// MA-工收台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND contract_type = 'B' + AND renovate_type like '%MA%' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND (( + delivery_date IS NOT NULL + AND delivery_date != '' + )OR ( + official_check_date IS NOT NULL + AND official_check_date != '' + )) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$Madata3 = $result->fetch_all(MYSQLI_ASSOC); + + +// 合計-出貨台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$data = $result->fetch_all(MYSQLI_ASSOC); + +// 合計-在裝台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND ( + delivery_date IS NULL + OR delivery_date = '' + )AND ( + official_check_date IS NULL + OR official_check_date = '' + ) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$data2 = $result->fetch_all(MYSQLI_ASSOC); + +// 合計-工收台數 +$sql = " + SELECT + SUBSTR(real_arrival_date,1,4) AS year, + SUBSTR(real_arrival_date,6,2) AS month, + COUNT(real_arrival_date) AS all_count + FROM wipwholestatus + WHERE status = '1' + AND ( + real_arrival_date IS NOT NULL + AND real_arrival_date != '' + )AND (( + delivery_date IS NOT NULL + AND delivery_date != '' + )OR ( + official_check_date IS NOT NULL + AND official_check_date != '' + )) + GROUP BY year, month +"; +$result = mysqli_query($link, $sql); +$data_count = $result->num_rows; +$data3 = $result->fetch_all(MYSQLI_ASSOC); + +?> +
+ + + + + + + + + + + + + + + + + +
+

在裝中統計表

+
+ (int)$radeY . $radeM) { + echo "結束時間不可小於開始時間"; + } + ?> +
+ + ~ + +
+ + + +
+
+ (int)$radeY . $radeM) { + exit; +} +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $all_count"; + $all_count = 0; + foreach ($Adata3 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $b_count += $all_count; + break; + } + } + echo ""; + $all_count = 0; + foreach ($Adata2 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $c_count += $all_count; + break; + } + } + echo ""; + } + ?> + $a_count"; + echo ""; + echo ""; + ?> + + + + $all_count"; + $all_count = 0; + foreach ($M1data3 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $b_count += $all_count; + break; + } + } + echo ""; + $all_count = 0; + foreach ($M1data2 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $c_count += $all_count; + break; + } + } + echo ""; + } + ?> + $a_count"; + echo ""; + echo ""; + ?> + + + + $all_count"; + $all_count = 0; + foreach ($Madata3 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $b_count += $all_count; + break; + } + } + echo ""; + $all_count = 0; + foreach ($Madata2 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $c_count += $all_count; + break; + } + } + echo ""; + } + ?> + $a_count"; + echo ""; + echo ""; + ?> + + + + $all_count"; + $all_count = 0; + foreach ($data3 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $b_count += $all_count; + break; + } + } + echo ""; + $all_count = 0; + foreach ($data2 as $row) { + if ($radsYi == $row['year'] && $start_month == $row['month']) { + $all_count = $row['all_count']; + $c_count += $all_count; + break; + } + } + echo ""; + } + ?> + $a_count"; + echo ""; + echo ""; + ?> + + +
出貨年月總計(全部)
種類出貨工收在裝出貨工收在裝
新梯$all_count$all_count$b_count$c_count
M1$all_count$all_count$b_count$c_count
MA$all_count$all_count$b_count$c_count
合計$all_count$all_count$b_count$c_count
+ \ No newline at end of file