diff --git a/wms/ngfeedback-create-submit.php b/wms/ngfeedback-create-submit.php
new file mode 100644
index 00000000..6020aa3b
--- /dev/null
+++ b/wms/ngfeedback-create-submit.php
@@ -0,0 +1,61 @@
+ date("Y-m-d H:i:s")));
+
+ if ($_FILES) {
+ $upd_base_path = "/wms/ngfeedback-uploads";
+ if (!is_dir($_SERVER["DOCUMENT_ROOT"] . "/" . $upd_base_path)) {
+ mkdir($_SERVER["DOCUMENT_ROOT"] . "/" . $upd_base_path, 0777, true);
+ }
+ // file_put_contents("./izumi_debug.log", print_r($_FILES, true)."\r\n", FILE_APPEND);
+ if ($_FILES["ngimage"]["error"] == UPLOAD_ERR_OK) {
+ # 將檔案移至指定位置
+ $data["ngimage"] = $upd_base_path . "/" . implode("__", array($data["facilityno"], strtotime($data["create_at"]))) . "." . pathinfo($_FILES["ngimage"]["name"], PATHINFO_EXTENSION);
+ move_uploaded_file($_FILES["ngimage"]["tmp_name"], $_SERVER["DOCUMENT_ROOT"] . "/" . $data["ngimage"]);
+ } else {
+ $do_ins = false;
+ echo "";
+ }
+ }
+ if ($do_ins) {
+ $db_query = sprintf("INSERT INTO ngfeedback (%s) VALUES (%s)",
+ implode(",", array_keys($data)),
+ implode(",", array_fill(0, count($data), "?")));
+ $stmt = $link->prepare($db_query);
+ // 此處僅有字串格式
+ $stmt->bind_param(implode("", array_fill(0, count($data), "s")), ...array_values($data));
+ $stmt->execute();
+ if ($mid = mysqli_insert_id($link)) {
+ // header("Location: );
+ if (mysqli_affected_rows($link) > 0) {
+ echo "";
+ //header("Location: pricereview-index.php");
+ } else {
+ echo "";
+ }
+ } else {
+ echo "";
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/wms/ngfeedback-create.php b/wms/ngfeedback-create.php
new file mode 100644
index 00000000..48e35ee7
--- /dev/null
+++ b/wms/ngfeedback-create.php
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wms/ngfeedback-index.php b/wms/ngfeedback-index.php
new file mode 100644
index 00000000..4ecc02a7
--- /dev/null
+++ b/wms/ngfeedback-index.php
@@ -0,0 +1,455 @@
+ array(
+ array(
+ "key" => "SEQ",
+ "field" => "id",
+ "label" => "項次",
+ "style" => "",
+ "width" => "60",
+ ),
+ array(
+ "key" => "create_at",
+ "field" => "create_at",
+ "label" => "反饋日期",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "facilityno",
+ "field" => "facilityno",
+ "label" => "電梯編號",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "onsite_name",
+ "field" => "sitename",
+ "label" => "現場名稱",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "onsite_address",
+ "field" => "siteaddress",
+ "label" => "現場地址",
+ "style" => "",
+ "width" => "180",
+ ),
+ array(
+ "key" => "creater",
+ "field" => "creater",
+ "label" => "不良單填單人員",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "describe",
+ "field" => "ngdescribe",
+ "label" => "簡述不良內容",
+ "style" => "",
+ "width" => "180",
+ ),
+ array(
+ "key" => "ngimage",
+ "field" => "ngimage",
+ "label" => "照片上傳",
+ "style" => "",
+ "width" => "180",
+ ),
+ array(
+ "key" => "verify",
+ "field" => "verify",
+ "label" => "品證人員",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "investigation_reason",
+ "field" => "investigationreason",
+ "label" => "現場調查原因",
+ "style" => "",
+ "width" => "180",
+ ),
+ array(
+ "key" => "countermeasure",
+ "field" => "countermeasure",
+ "label" => "對策方式及再發防止",
+ "style" => "",
+ "width" => "180",
+ ),
+ array(
+ "key" => "responsible_depart",
+ "field" => "responsibledepartment",
+ "label" => "判定責任單位",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "responsible_depart_leader",
+ "field" => "responsibledepartmentleader",
+ "label" => "責任單位主管",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "responsible_depart_responder",
+ "field" => "responder",
+ "label" => "責任單位回覆人",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "progress",
+ "field" => "progress",
+ "label" => "處理進度",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "reply_time",
+ "field" => "reply_at",
+ "label" => "回覆時間",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "reply_history",
+ "field" => "replyhistory",
+ "label" => "責任單位回覆",
+ "style" => "",
+ "width" => "360",
+ ),
+ array(
+ "key" => "update_time",
+ "field" => "update_at",
+ "label" => "更新時間",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "reviewresult",
+ "field" => "reviewresult",
+ "label" => "判定結果",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "responsiblesupplier",
+ "field" => "responsiblesupplier",
+ "label" => "責任供應商",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "closer",
+ "field" => "closer",
+ "label" => "結案人員",
+ "style" => "",
+ "width" => "120",
+ ),
+ array(
+ "key" => "close_time",
+ "field" => "close_at",
+ "label" => "結案時間",
+ "style" => "",
+ "width" => "120",
+ ),
+ ),
+ "datas" => array()
+);
+
+$progress = array(
+ "0" => "待判定",
+ "1" => "待處理",
+ "2" => "處理中",
+ "9" => "已完成"
+);
+
+$result = array(
+ "N" => "判定不良品",
+ "G" => "判定良品"
+);
+
+$sql = "select *,
+ f_return_account_name(verify) as verify_name,
+ f_return_account_name(creater) as creater_name,
+ f_return_account_name(responsibledepartmentleader) as responsibledepartmentleader_name,
+ f_return_account_name(responder) as responder_name,
+ f_return_account_name(closer) as closer_name,
+ f_return_department_name(responsibledepartment) as responsibledepartment_name
+ from ngfeedback order by id desc";
+$rtn = mysqli_query($link, $sql);
+$dt_setup["datas"] = mysqli_fetch_all($rtn, MYSQLI_ASSOC);
+
+// 結束連線
+mysqli_close($link);
+if ($user_auth&2) {
+?>
+
+
+
+
+
+
+
+ ".$col["label"]."";
+ }
+ ?>
+
+
+
+ ";
+ foreach ($dt_setup["columns"] as $col) {
+ echo "";
+ switch ($col["field"]) {
+ case "ngimage":
+ echo " ";
+ break;
+ case "reviewresult":
+ if (!$row["reviewresult"] && $row["progress"] == "9" && in_array($depart_id, array("220", "912"))) {
+ echo "品證人員填寫";
+ break;
+ }
+ case "verify":
+ if ($col["field"] == "verify" && !$row["verify"] && in_array($depart_id, array("220", "912"))) {
+ echo "品證人員填寫";
+ break;
+ }
+ case "responder":
+ if (!in_array($row["progress"], array("0", "9")) && $col["field"] == "responder" && $row["responder"] && ($depart_id == "220" || $row["responder"] == $user_id)) {
+ echo "".$row["responder"]." 填寫";
+ break;
+ }
+ default:
+ if (in_array($col["field"], array("creater", "verify", "responsibledepartmentleader", "responsibledepartment", "responder", "closer"))) {
+ echo "".implode(" ", array($row[$col["field"]], $row[$col["field"]."_name"]))." ";
+ } else if ($col["field"] == "progress" && isset($progress[$row[$col["field"]]])) {
+ echo "".$progress[$row[$col["field"]]]." ";
+ } else if ($col["field"] == "reviewresult" && isset($result[$row[$col["field"]]])) {
+ echo "".$result[$row[$col["field"]]]." ";
+ } else {
+ echo "".$row[$col["field"]]." ";
+ }
+ }
+ echo " | ";
+ }
+ echo "";
+ }
+ ?>
+
+
+
+
+
+

+
+
+
\ No newline at end of file
diff --git a/wms/ngfeedback-update-reply-submit.php b/wms/ngfeedback-update-reply-submit.php
new file mode 100644
index 00000000..697a8b6e
--- /dev/null
+++ b/wms/ngfeedback-update-reply-submit.php
@@ -0,0 +1,45 @@
+prepare($db_query);
+ $stmt->bind_param("isisss", $_POST["no"], $data["responder"], $data["progress"], $_POST["user_id"], $_POST["user_id"], $data["replyinput"]);
+ $stmt->execute();
+
+ if (mysqli_affected_rows($link) > 0) {
+ echo "";
+ //header("Location: pricereview-index.php");
+ } else {
+ echo "";
+ }
+}
+?>
\ No newline at end of file
diff --git a/wms/ngfeedback-update-reply.php b/wms/ngfeedback-update-reply.php
new file mode 100644
index 00000000..58f845d9
--- /dev/null
+++ b/wms/ngfeedback-update-reply.php
@@ -0,0 +1,170 @@
+prepare($db_query);
+// 此處僅有字串格式
+$stmt->bind_param("i", ...[$_REQUEST["no"]]);
+$stmt->execute();
+$result = $stmt->get_result();
+$data = mysqli_fetch_assoc($result);
+
+$db_query = "SELECT accountid, name FROM account
+ WHERE accounttype NOT IN ('A', 'X') AND department_id = ?";
+$stmt = $link->prepare($db_query);
+// 此處僅有字串格式
+$stmt->bind_param("i", ...[$data["responsibledepartment"]]);
+$stmt->execute();
+$result = $stmt->get_result();
+$opts = mysqli_fetch_all($result, MYSQLI_ASSOC);
+?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wms/ngfeedback-update-submit.php b/wms/ngfeedback-update-submit.php
new file mode 100644
index 00000000..4061d012
--- /dev/null
+++ b/wms/ngfeedback-update-submit.php
@@ -0,0 +1,92 @@
+ date("Y-m-d H:i:s")));
+
+ $db_query = sprintf("UPDATE ngfeedback SET %s WHERE id = ?",
+ implode(",", array_map(
+ function ($_k) {
+ return sprintf("%s = ?", $_k);
+ }, array_keys($data)
+ )
+ ));
+ $stmt = $link->prepare($db_query);
+ // 此處僅有字串格式
+ $stmt->bind_param(implode("", array_fill(0, count($data) + 1, "s")), ...array_values(array_merge($data, array("id" => $_POST["no"]))));
+ $stmt->execute();
+ if (mysqli_affected_rows($link) > 0) {
+ echo "";
+ //header("Location: pricereview-index.php");
+ } else {
+ echo "";
+ }
+ } else {
+ $data = array_reduce(array(
+ "responsibledepartment", "investigationreason", "countermeasure", "verify"
+ ), function ($acc, $key) use ($input) {
+ switch ($key) {
+ default:
+ $acc[$key] = htmlspecialchars(stripslashes(trim($input[$key]))) ?: null;
+ }
+ return $acc;
+ }, array("progress" => "1", "update_at" => date("Y-m-d H:i:s")));
+
+ if ($data["responsibledepartment"]) {
+ $db_query = "SELECT accountid FROM account WHERE department_id = ? ORDER BY role_id ASC, create_at DESC LIMIT 0 , 1";
+ $stmt = $link->prepare($db_query);
+ // 此處僅有字串格式
+ $stmt->bind_param("s", $data["responsibledepartment"]);
+ $stmt->execute();
+ $result = $stmt->get_result();
+ $uarr = mysqli_fetch_assoc($result);
+ $data["responsibledepartmentleader"] = isset($uarr["accountid"]) ? $uarr["accountid"] : null;
+ // 責任單位回覆人預設主管
+ $data["responder"] = isset($uarr["accountid"]) ? $uarr["accountid"] : null;
+ }
+
+ if ($data["responsibledepartmentleader"]) {
+ $db_query = sprintf("UPDATE ngfeedback SET %s WHERE id = ?",
+ implode(",", array_map(
+ function ($_k) {
+ return sprintf("%s = ?", $_k);
+ }, array_keys($data)
+ )
+ ));
+ $stmt = $link->prepare($db_query);
+ // 此處僅有字串格式
+ $stmt->bind_param(implode("", array_fill(0, count($data) + 1, "s")), ...array_values(array_merge($data, array("id" => $_POST["no"]))));
+ $stmt->execute();
+ if (mysqli_affected_rows($link) > 0) {
+ echo "";
+ //header("Location: pricereview-index.php");
+ } else {
+ echo "";
+ }
+ } else {
+ echo "";
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/wms/ngfeedback-update.php b/wms/ngfeedback-update.php
new file mode 100644
index 00000000..58ced254
--- /dev/null
+++ b/wms/ngfeedback-update.php
@@ -0,0 +1,222 @@
+prepare($db_query);
+// 此處僅有字串格式
+$stmt->bind_param("i", ...[$_REQUEST["no"]]);
+$stmt->execute();
+$result = $stmt->get_result();
+$data = mysqli_fetch_assoc($result);
+
+$progress = array(
+ "0" => "待判定",
+ "1" => "待處理",
+ "2" => "處理中",
+ "9" => "已完成"
+);
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wms/ngfeedbackapi.php b/wms/ngfeedbackapi.php
new file mode 100644
index 00000000..4cdd9e8a
--- /dev/null
+++ b/wms/ngfeedbackapi.php
@@ -0,0 +1,24 @@
+prepare("SELECT facilityno, address FROM facility
+ WHERE facilityno LIKE CONCAT(?, '%') ORDER BY facilityno ASC LIMIT 0 , ?");
+ // 此處僅有字串格式term
+ $stmt->bind_param("si", ...[$_GET["term"], $_GET["rn"]]);
+ $stmt->execute();
+ $datas = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
+ break;
+ }
+
+}
+
+die(json_encode(array(
+ "count" => count($datas),
+ "data" => $datas
+)));
+exit;
+?>
\ No newline at end of file