diff --git a/wms/fun_global.php b/wms/fun_global.php index 9cf070b3..48f952b0 100644 --- a/wms/fun_global.php +++ b/wms/fun_global.php @@ -145,7 +145,7 @@ function check_user_permission($user_id, $token) { global $link; // 不檢查清單 - $ignore_url_arr = ['/wms/index.php', '/wms/notice-index.php', '/wms/notice-edit.php', '/wms/change-password.php', '/wms/wipwhole-change-contractdate.php','/wms/test.php']; + $ignore_url_arr = ['/wms/index.php', '/wms/notice-index.php', '/wms/notice-edit.php', '/wms/change-password.php', '/wms/wipwhole-change-contractdate.php', '/wms/wipwhole-change-planning-customer-name.php','/wms/test.php']; if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return; $do = ""; diff --git a/wms/wipwhole-change-contractdate.php b/wms/wipwhole-change-contractdate.php index 556b662c..5126fd22 100644 --- a/wms/wipwhole-change-contractdate.php +++ b/wms/wipwhole-change-contractdate.php @@ -1,11 +1,59 @@ ''] ; + $response_menu = $includecommon->menu_v3($user_id, $accounttype); + if (is_array($response_result["list"])) { + for ($i = 0; $i < count($response_result["list"]); $i++) { + $response_result["list"][$i]["path"] = $response_result["list"][$i]["path"] . "?token=" . $token; + } + } + $response_result["note"] = "success"; + $response_result["token"] = $token; + $farr = []; + $jsonres['menu']=$response_menu; + $login_json = json_encode($jsonres); + } +} + ?> 作番大日程 id + * - 'all_contractno_change' => 是否更改全部合約號 + * - 'real_contract_arrival_date' => 原日期 + * - 'contract_arrival_date' => 新日期 + * - 'real_address' => 原工地地址 + * - 'old_real_address' => 新工地地址 + * - 'contractno' => 合約號 + * - 'tds' => 資料時間戳記 + * - 'form_key' => 本表單 form_key + * - 'user_id' => 申請者 id (員工編號) + * - 'change_status' => 寫入簽核狀態代碼 + * + * @param object $link: 資料庫連線 + * @param string $data: 新增資料 + */ +function addWipwholeChangeContractdateDetails($link, $data) +{ + $user_id = $data['user_id']; + $tds = $data['tds']; + $id = $data['id']; + $custom_name = $data['custom_name']; + $change_status = $data['change_status']; + $sql2 = " + INSERT INTO `wipwhole_change_planning_customer_details` ( + `creater`, + `create_at`, + `wipwholestatus_id`, + `custom_name`, + `change_status` + ) VALUES ( + '$user_id', + '$tds', + '$id', + '$custom_name', + '$change_status' + ) + "; + mysqli_query($link, $sql2); +} + +function addFlow($link, $data) +{ + $last_id = $data['last_id']; + $form_key = $data['form_key']; + $flow_code = $data['change_status']; + $sql2 = " + INSERT into flow ( + system_id, + flow_id, + form_id, + form_key, + flow_code + ) VALUES ( + 'wws', + 'wws04', + '$last_id', + '$form_key', + '$flow_code' + ) + "; + mysqli_query($link, $sql2); +} + +function addSubflow($link, $data) +{ + $form_key = $data['form_key']; + $current_assigner = $data['current_assigner']; + $tds = $data['tds']; + $seq = $data['seq']; + $sql2 = " + INSERT INTO subflow ( + form_key, + seq, + current_assigner, + create_date + ) values ( + '$form_key', + '$seq', + '$current_assigner', + '$tds' + ) + "; + mysqli_query($link, $sql2); +} + +/** + * 用大日程的合約號取得大日程表單唯一值 (id) + * @param object $link:資料庫連線 + * @param string $contractno:合約編號 + * @return object 回傳 mysqli_fetch_all + */ +function getWipwholestatusIdByConstractNo($link, $contractno) +{ + $sql = " + SELECT + id + FROM wipwholestatus + WHERE contractno = '$contractno' + "; + $result = mysqli_query($link, $sql); + $data = mysqli_fetch_all($result); + mysqli_free_result($result); + return $data; +} + +/** + * 取得新申請簽核的 formk_key 用於新增 + * @param object $link 資料庫連線 + * @return string $formk_key + */ +function getFomkeySeq($link) +{ + $sql = "SELECT appwms.nextval('form_key') form_key"; + $res = mysqli_query($link, $sql); + if ($row = mysqli_fetch_row($res)) + return $row[0]; + return null; +} + +/** + * 新增通知 + * @param object $link 資料庫連線 + * @param array $data kind:通知類型 related_id:關聯序號 title:通知標題 content:通知內容 permission:觀看者 creater:建立者 create_at:建立時間 + * @return string 簽核單 cid + */ +function addNotice($link, $data) +{ + $kind = empty($data['kind']) ? "1" : $data['kind']; + $related_id = empty($data['related_id']) ? "" : $data['related_id']; + $title = empty($data['title']) ? "" : $data['title']; + $content = empty($data['content']) ? "" : $data['content']; + $permission = empty($data['permission']) ? "" : $data['permission']; + $creater = empty($data['creater']) ? "system" : $data['creater']; + $create_at = empty($data['create_at']) ? date("Y-m-d H:i:s") : $data['create_at']; + + $sql = " + INSERT INTO notice ( + kind, + related_id, + title, + content, + permission, + creater, + create_at + ) VALUES( + '$kind', + '$related_id', + '$title', + '$content', + '$permission', + '$creater', + '$create_at' + ) + "; + mysqli_query($link, $sql); +} + +/** + * 取得本次簽核的表單 cid 值 + * @param object $link 資料庫連線 + * @param string $form_key 簽核單唯一值 + * @return string 簽核單 cid + */ +function getCid($link, $form_key) +{ + $sql = " + SELECT form_id AS id FROM flow + WHERE form_key = '$form_key' + "; + $result = mysqli_query($link, $sql); + $row = mysqli_fetch_array($result); + return $row['id']; +} + +/** + * 取得此單據的大日程id值 + * @param object $link 資料庫連線 + * @param string $cid 簽核單 cid + * @return string 簽核單 form_key + */ +function getId($link, $cid) +{ + $sql = " + SELECT wipwholestatus_id AS id + FROM wipwhole_change_planning_customer_details + WHERE id = '$cid' + "; + $result = mysqli_query($link, $sql); + $row = mysqli_fetch_array($result); + return $row['id']; +} + +/** + * 取得本次簽核的表單form_key值 + * @param object $link 資料庫連線 + * @param string $form_id 簽核單 cid + * @return string 簽核單 form_key + */ +function getForm_key($link, $form_id) +{ + $sql = " + SELECT + f.form_key + FROM flow AS f + LEFT JOIN subflow AS s + ON f.form_key = s.form_key + WHERE 1=1 + AND f.system_id = 'wws' + AND f.flow_id = 'wws04' + AND f.form_id = '$form_id' + AND f.flow_code IN ('A','B','D','C','Z') + "; + $result = mysqli_query($link, $sql); + $row = mysqli_fetch_array($result); + return empty($row['form_key']) ? null : $row['form_key']; +} + +/** + * 確認目前簽核狀態 + * @param object $link 資料庫連線 + * @return string 工務部主管accountid + */ +function checkNowFormStatus($link) +{ + if (isset($_GET['cid']) || isset($_GET['form_key'])) { + $cid = isset($_GET['cid']) ? $_GET['cid'] : getCid($link, $_GET['form_key']); + $form_key = getForm_key($link, $cid); + $sql = " + SELECT + flow_code + FROM flow + WHERE 1=1 + AND form_id = '$cid' + AND form_key = '$form_key' + "; + $result = mysqli_query($link, $sql); + $row = mysqli_fetch_array($result); + return empty($row['0']) ? null : $row['0']; + } + return null; +} + +/** + * 取得工務部主管編號 + * @param object $link 資料庫連線 + * @param string $contract_type A:新梯 B:汰改 + * @return string 工務部主管accountid + */ +function getGongWuokNo($link, $contract_type) +{ + if (isset($_GET['id']) || isset($_GET['form_key'])) + $id = isset($_GET['id']) ? $_GET['id'] : getId($link, getCid($link, $_GET['form_key'])); + $sql = " + SELECT DISTINCT + SUBSTR(address,1,2) + FROM `wipwholestatus` + WHERE id = '$id' + "; + $result = mysqli_query($link, $sql); + $row = mysqli_fetch_array($result); + // 新梯 + // 宜蘭=高培軒(M0087) 北=張潘榮(M0041) 中=林瑋隆(M0113) 南=韋宗榮(M0039)改鄭存邑(M0102) + // 汰改 + // 宜蘭=高培軒(M0087) 北=吳宗紘(M0040) 中=林瑋隆(M0113) 南=韋宗榮(M0039)改鄭存邑(M0102) + $arr = array( + "宜蘭" => "M0087", + "北" => "M0041", + "台北" => "M0041", + "基隆" => "M0041", + "新北" => "M0041", + "新竹" => "M0041", + "桃園" => "M0041", + "苗栗" => "M0113", + "中" => "M0113", + "南投" => "M0113", + "台中" => "M0113", + "彰化" => "M0113", + "雲林" => "M0113", + "南" => "M0102", + "台南" => "M0102", + "嘉義" => "M0102", + "屏東" => "M0102", + "高雄" => "M0102" + ); + $arr2 = array( + "宜蘭" => "M0087", + "北" => "M0040", + "台北" => "M0040", + "基隆" => "M0040", + "新北" => "M0040", + "新竹" => "M0040", + "桃園" => "M0040", + "苗栗" => "M0113", + "中" => "M0113", + "南投" => "M0113", + "台中" => "M0113", + "彰化" => "M0113", + "雲林" => "M0113", + "南" => "M0102", + "台南" => "M0102", + "嘉義" => "M0102", + "屏東" => "M0102", + "高雄" => "M0102" + ); + if ($contract_type == 'A') { + return empty($arr[$row[0]]) ? "" : $arr[$row[0]]; + } else { + return empty($arr2[$row[0]]) ? "" : $arr2[$row[0]]; + } +} + +/** + * 取得簽核者 user_id + * @param object $link 資料庫連線 + * @param string $form_key 本簽核單唯一值 + * @param string $seq 簽核者順序 + * @return string 簽核者accountid + */ +function getCurrentAssigner($link, $form_key, $seq) +{ + $sql = " + SELECT + * + FROM subflow + WHERE form_key = '$form_key' + AND seq = '$seq' + "; + $subflow_data = mysqli_query($link, $sql); + $subflow = mysqli_fetch_array($subflow_data, MYSQLI_ASSOC); + return empty($subflow['current_assigner']) ? null : $subflow['current_assigner']; +} + +/** + * 取得本表單狀態代碼 + * @param object $link 資料庫連線 + * @param string $cid 本簽核單 id + * @return string 表單狀態代碼 + */ +function getChangeStatus($link, $cid) +{ + $sql = " + SELECT + change_status + FROM wipwhole_change_planning_customer_details + WHERE id = '$cid' + "; + $subflow_data = mysqli_query($link, $sql); + $subflow = mysqli_fetch_array($subflow_data, MYSQLI_ASSOC); + return empty($subflow['change_status']) ? null : $subflow['change_status']; +} + +/** + * 取得本表單狀態名稱 + * @param object $link 資料庫連線 + * @param string $cid 本簽核單 id + * @return string 本單據狀態名稱 + */ +function getChangeStatusName($link, $cid) +{ + $dataArr = array( + 'A' => '申請中', + 'B' => '申請中', + 'C' => '已取消', + 'D' => '工務已通過', + 'Z' => '已通過', + ); + $sql = " + SELECT + change_status + FROM wipwhole_change_planning_customer_details + WHERE id = '$cid' + "; + $subflow_data = mysqli_query($link, $sql); + $subflow = mysqli_fetch_array($subflow_data, MYSQLI_ASSOC); + return empty($subflow['change_status']) ? "" : $dataArr[$subflow['change_status']]; +} + +function getNowFormStatus($link, $cid) +{ + $sql = " + SELECT + change_status + FROM wipwhole_change_planning_customer_details + WHERE id = '$cid' + "; + $subflow_data = mysqli_query($link, $sql); + $subflow = mysqli_fetch_array($subflow_data, MYSQLI_ASSOC); + return empty($subflow['change_status']) ? "" : $subflow['change_status']; +} + +/** + * 取得許MAX options + * @param object $link:資料庫連線 + * @return object 回傳 mysqli_query + */ +function getShengguanokOptions($link) +{ + $sql = " + SELECT + accountid AS val , + name AS label + FROM `account` + WHERE `department_id` IN ('320') + AND `role_id` IN ('1') + "; + return mysqli_query($link, $sql); +} + +/** + * 取得工務部門所有員工 options + * @param object $link:資料庫連線 + * @return object 回傳 mysqli_query + */ +function getGongwuokOptions($link, $user_id) +{ + $sql = " + SELECT + a1.manager AS val , + a2.name AS label + FROM account AS a1 + LEFT JOIN account AS a2 + ON a1.manager = a2.accountid + WHERE a1.accountid = '$user_id' + "; + return mysqli_query($link, $sql); +} + +/** + * 用 user_id(員工編號) 取得部門代碼 id + * @param object $link:資料庫連線 + * @param string $user_id:使用者 id (員工編號) + * @return string 回傳 $department_id:部門代碼 + */ +function getDepartmentId($link, $user_id) +{ + $sql = " + SELECT + department_id + FROM account + WHERE accountid = '$user_id' + "; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + mysqli_free_result($res); + return $row[0]; +} +function getRoleId($link, $user_id) +{ + $sql = " + SELECT + role_id + FROM account + WHERE accountid = '$user_id' + "; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + mysqli_free_result($res); + return $row[0]; +} +/** + * 取得生管主管 options + * @param object $link:資料庫連線 + * @param string $id:作番大日程唯一值 + * @return object 回傳 mysqli_query + */ +function getWipwholestatusDetail($link, $id) +{ + $db_query = " + SELECT * FROM + wipwholestatus WHERE id = '$id' + "; + $receivabledata = mysqli_query($link, $db_query); + return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC); +} + +/** + * 取得 wipwhole_change_planning_customer_details 所有資料並放入陣列 + * @param object $link:資料庫連線 + * @param string $cid:表單唯一值 + * @return object 回傳 mysqli_fetch_array + */ +function getWipwholeChangeContractdateDetails($link, $cid) +{ + $db_query = " + SELECT * FROM wipwhole_change_planning_customer_details + WHERE id = '$cid' + "; + $receivabledata = mysqli_query($link, $db_query); + return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC); +} + +/** + * 取得生管主管 options + * @param object $link:資料庫連線 + * @param string $user_id:使用者 id (員工編號) + * @param string $id:大日程唯一值 + * @return object 回傳 mysqli_query + */ +function getDateOptions($link, $user_id, $id) +{ + if ($user_id == 'M0060') { + $sql = " + SELECT + * + FROM `wipwhole_change_planning_customer_details` + WHERE 1=1 + AND wipwholestatus_id = '$id' + AND change_status in ('A','C','D','Z') + "; + } else if (isLeader($link, $user_id)) { + $sql = " + SELECT + * + FROM `wipwhole_change_planning_customer_details` + WHERE 1=1 + AND wipwholestatus_id = '$id' + "; + } else { + $sql = " + SELECT + * + FROM `wipwhole_change_planning_customer_details` + WHERE 1=1 + AND creater = '$user_id' + AND wipwholestatus_id = '$id' + "; + } + return mysqli_query($link, $sql); +} + +/** + * 取得提交表單後的回傳訊息 + * @param string $assign_status:簽核狀態代碼 + * @return string 回傳訊息 + */ +function getAssignStatusMessage($data, $checkStatus) +{ + + if ($data['assign_status'] == 'A' || $data['assign_status'] == 'B') + if (empty($_POST['custom_name'])) + return "

請填寫 客戶姓名 !

"; + if ($data['assign_status'] == 'C') + return "

申請已取消

"; + if ($data['assign_status'] == 'Z') + return "

申請已通過

"; + if (!$checkStatus) + return "

請勿重複申請!

"; + return "

已提交申請!

"; +} + +/** + * 依照此表單狀態給予 select 選項 + * @param object $link:資料庫連線檔 + * @param string $user_id:使用者id (員工編號) + * @param string $nowFormStatus:此表單目前狀態代碼 + * @return string 回傳select字串 + */ +function getAssignStatusSelect($link, $user_id, $nowFormStatus) +{ + $options_str = ""; + return $options_str; +} + +/** + * 取得此簽核單所有人簽核狀況 + * @param object $link:資料庫連線檔 + * @param string $form_key:此簽核單唯一值 + * @return object 回傳 mysqli_query + */ +function getCurrentAssigners($link, $form_key) +{ + $sql = " + SELECT + nowData.*, + nextData.next_current_assigner + FROM( + SELECT + f.flow_code, + s.seq, + (s.seq + 1) AS next_seq , + s.current_assigner, + wccd.change_status + FROM + flow AS f + LEFT JOIN subflow AS s ON f.form_key = s.form_key + LEFT JOIN wipwhole_change_planning_customer_details AS wccd ON wccd.id = f.form_id + WHERE + f.form_key = '$form_key' + AND f.system_id = 'wws' + AND f.flow_id = 'wws04' + ) AS nowData + LEFT JOIN( + SELECT + s.seq, + s.current_assigner AS next_current_assigner + FROM + flow AS f + LEFT JOIN subflow AS s ON f.form_key = s.form_key + LEFT JOIN wipwhole_change_planning_customer_details AS wccd ON wccd.id = f.form_id + WHERE + f.form_key = '$form_key' + AND f.system_id = 'wws' + AND f.flow_id = 'wws04' + ) AS nextData + ON nowData.next_seq = nextData.seq + "; + return mysqli_query($link, $sql); +} + +function checkStatus($link, $cid, $user_id) +{ + $sql = " + SELECT + change_status + FROM wipwhole_change_planning_customer_details + WHERE creater = '$user_id' + AND wipwholestatus_id = '$cid' + AND change_status NOT IN ('C','Z') + "; + $res = mysqli_query($link, $sql); + return $res->num_rows > 0 ? false : true; +} diff --git a/wms/wipwhole-change-planning-customer-name-submit.php b/wms/wipwhole-change-planning-customer-name-submit.php new file mode 100644 index 00000000..29572e94 --- /dev/null +++ b/wms/wipwhole-change-planning-customer-name-submit.php @@ -0,0 +1,273 @@ + $id, + 'all_contractno_change' => $all_contractno_change, + 'custom_name' => $custom_name, + 'contractno' => $contractno, + 'tds' => $tds, + 'form_key' => getFomkeySeq($link), + 'user_id' => $user_id, + 'change_status' => $_POST['assign_status'] + ); + // 寫入表單主檔 + addWipwholeChangeContractdateDetails($link, $data_arr); + // 取得寫入後表單seq + $data_arr['last_id'] = $link->insert_id; + // 寫入待簽 + addFlow($link, $data_arr); + $data_arr['seq'] = '0'; + $data_arr['current_assigner'] = $user_id; + addSubflow($link, $data_arr); + $data_arr['seq'] = '1'; + $data_arr['current_assigner'] = $next_users; + addSubflow($link, $data_arr); + } + + // 批次申請 + if (($_POST['assign_status'] == 'A' || $_POST['assign_status'] == 'B') && !empty($all_contractno_change)) { + $wipwholestatus_id_arr = getWipwholestatusIdByConstractNo($link, $contractno); + foreach ($wipwholestatus_id_arr as $wipwholestatus_id) { + $data_arr = array( + 'id' => $wipwholestatus_id[0], + 'all_contractno_change' => $all_contractno_change, + 'custom_name' => $custom_name, + 'contractno' => $contractno, + 'tds' => $tds, + 'form_key' => getFomkeySeq($link), + 'user_id' => $user_id + ); + // 寫入表單主檔 + addWipwholeChangeContractdateDetails($link, $data_arr); + // 取得寫入後表單seq + $data_arr['last_id'] = $link->insert_id; + // 寫入待簽 + addFlow($link, $data_arr); + $data_arr['seq'] = '0'; + $data_arr['current_assigner'] = $user_id; + addSubflow($link, $data_arr); + $data_arr['seq'] = '1'; + $data_arr['current_assigner'] = $next_users; + addSubflow($link, $data_arr); + } + } + } + } + + // 單次申請 營業 + if ($_POST['assign_status'] == 'D') { + $tds = date("Y-m-d H:i:s"); + $next_users = $_POST['next_users']; + $seq = $_POST['seq']; + $sql = " + UPDATE wipwhole_change_planning_customer_details + SET change_status = 'D' + WHERE id = '$cid' + "; + mysqli_query($link, $sql); + $sql = " + UPDATE flow + SET flow_code = 'D' + WHERE form_key = '$form_key' + "; + mysqli_query($link, $sql); + $sql = " + INSERT into subflow ( + form_key, + seq, + current_assigner, + create_date + ) VALUES ( + '$form_key', + '2', + '$next_users', + '$tds' + ) + "; + mysqli_query($link, $sql); + } + // 取消 + if ($_POST['assign_status'] == 'C') { + $tds = date("Y-m-d H:i:s"); + $next_users = "00000"; + if ($user_id == 'M0060') { + if (getChangeStatus($link, $cid) == 'D' || getChangeStatus($link, $cid) == 'A') { + $seq = $_POST['seq']; + } + $sql = " + INSERT into subflow ( + form_key, + seq, + current_assigner, + create_date + ) VALUES ( + '$form_key', + '$seq', + '$next_users', + '$tds' + ) + "; + mysqli_query($link, $sql); + } else if (isLeader($link, $user_id)) { + if (getChangeStatus($link, $cid) == 'D') { + $sql = " + UPDATE subflow + SET current_assigner = '$next_users', + create_date = '$tds' + WHERE form_key = '$form_key' + AND seq = '$seq' + "; + mysqli_query($link, $sql); + } else if (getChangeStatus($link, $cid) == 'A') { + $seq = $_POST['seq']; + $sql = " + UPDATE subflow + SET current_assigner = '$next_users', + create_date = '$tds' + WHERE form_key = '$form_key' + AND seq = '$seq' + "; + mysqli_query($link, $sql); + } else { + $seq = $_POST['seq']; + $sql = " + INSERT into subflow ( + form_key, + seq, + current_assigner, + create_date + ) VALUES ( + '$form_key', + '$seq', + '$next_users', + '$tds' + ) + "; + mysqli_query($link, $sql); + } + } else { + $seq = $_POST['seq']; + $sql = " + UPDATE subflow + SET current_assigner = '$next_users', + create_date = '$tds' + WHERE form_key = '$form_key' + AND seq = '$seq' + "; + mysqli_query($link, $sql); + } + $sql = " + UPDATE wipwhole_change_planning_customer_details + SET change_status = 'C' + WHERE id = '$cid' + "; + mysqli_query($link, $sql); + $sql = " + UPDATE flow + SET flow_code = 'Z' + WHERE form_key = '$form_key' + "; + mysqli_query($link, $sql); + } + + // 通過 + if ($_POST['assign_status'] == 'Z') { + if ($user_id == 'M0060') { + $tds = date("Y-m-d H:i:s"); + $next_users = $_POST['next_users']; + $seq = $_POST['seq'] + 1; + $sql = " + UPDATE wipwhole_change_planning_customer_details + SET change_status = 'Z' + WHERE id = '$cid' + "; + mysqli_query($link, $sql); + $sql = " + UPDATE flow + SET flow_code = 'Z' + WHERE form_key = '$form_key' + "; + mysqli_query($link, $sql); + $sql = " + INSERT into subflow ( + form_key, + seq, + current_assigner, + create_date + ) VALUES ( + '$form_key', + '$seq', + '$next_users', + '$tds' + ) + "; + mysqli_query($link, $sql); + +// // 發送系統通知 +// $contractno = $_POST['contractno']; +// $facilityno = $_POST['facilityno']; +// $real_contract_arrival_date = $_POST['real_contract_arrival_date']; +// $salesid = $_POST['salesid']; +// $gongWuokid = $_POST['gongWuokid']; +// $old_real_address = $_POST['old_real_address']; +// $real_address = $_POST['real_address']; +// $content = "合約號 : $contractno +// 作番號 : $facilityno +// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . " +// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp; + +// // 大日程出貨日調整 通知營業人員 +// $noticeData = array( +// 'related_id' => $cid, +// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno, +// 'content' => $content, +// 'permission' => $salesid, +// ); +// addNotice($link, $noticeData); +// // 大日程出貨日調整 通知工務人員 +// $noticeData = array( +// 'related_id' => $cid, +// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno, +// 'content' => $content, +// 'permission' => $gongWuokid, +// ); +// addNotice($link, $noticeData); + +// $shengguano_arr = getShengguanokOptions($link); +// foreach ($shengguano_arr as $row) : +// $contractno = $_POST['contractno']; +// $facilityno = $_POST['facilityno']; +// $real_contract_arrival_date = $_POST['real_contract_arrival_date']; +// $gongWuokid = $_POST['gongWuokid']; +// $old_real_address = $_POST['old_real_address']; +// $real_address = $_POST['real_address']; +// $content = "合約號 : $contractno +// 作番號 : $facilityno +// 出貨日期微調: " . substr($real_contract_arrival_date, 0, 10) . " => " . substr($contract_arrival_date_tmp, 0, 10) . " +// 工地地址微調: " . $old_real_address . " => " . $real_address_tmp; + +// // 大日程出貨日調整 通知營業人員 +// $noticeData = array( +// 'related_id' => $cid, +// 'title' => '作番大日程(新梯)出貨日調整通知 > ' . $facilityno, +// 'content' => $content, +// 'permission' => $row['val'], +// ); +// addNotice($link, $noticeData); +// endforeach; + } + } +} diff --git a/wms/wipwhole-change-planning-customer-name.php b/wms/wipwhole-change-planning-customer-name.php new file mode 100644 index 00000000..0cd3d59b --- /dev/null +++ b/wms/wipwhole-change-planning-customer-name.php @@ -0,0 +1,528 @@ +''] ; + $response_menu = $includecommon->menu_v3($user_id, $accounttype); + if (is_array($response_result["list"])) { + for ($i = 0; $i < count($response_result["list"]); $i++) { + $response_result["list"][$i]["path"] = $response_result["list"][$i]["path"] . "?token=" . $token; + } + } + $response_result["note"] = "success"; + $response_result["token"] = $token; + $farr = []; + $jsonres['menu']=$response_menu; + $login_json = json_encode($jsonres); + } +} + +?> + + options +$max_options = getShengguanokOptions($link); +$self_leader_options = getGongwuokOptions($link, $user_id); + +// 帶入大日程資料 +$row = getWipwholestatusDetail($link, $id); +// 帶入所有人歷史單據 +$date_options = getDateOptions($link, $user_id, $id); +// 檢查此單據狀態非新申請則帶入申請資料 +if (!empty(checkNowFormStatus($link))) + $row2 = getWipwholeChangeContractdateDetails($link, $cid); + +?> + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

計劃圖上傳申請表

+
 
+ +
+ 申請紀錄: + + + + + 申請日期: + + + +
 
基本信息
申請人員編 + + 申請人 + + 申請人部門 + + 申請人職稱 + +
合約號 + "; + ?> +
+ + 變更此合約所有作番 + "; + ?> +
作番號 + "; + ?> + 客戶名稱 + "; + ?> + 作番大日程 + + + 開啟 + +
營業/契約
人員員編
+ + "; ?> + 營業/契約
人員
+ + 工務人員員編 + + "; ?> + 工務人員 + +
下單日
(下單普來特富)
+ + 預計發貨日
(出港日)
+ + 預計到貨日
(到觀音廠日)
+ + ' /> + + +
地址 + + 填寫客戶姓名 + "; + } else { + echo $row2["custom_name"]; + echo ""; + } + ?> + +
+ + + + + + + + + + + + + + + + + + + + + + + +
簽核操作
簽核狀態 + + 下位簽核者 + "; + foreach ($max_options as $max_option) : + echo " + + "; + endforeach; + echo ""; + } + + if (empty(checkNowFormStatus($link))) { + if (isLeader($link, $user_id)) { + echoMaxSelect($max_options); + } else if (in_array(getDepartmentId($link, $user_id), [ + '311', '312', '313', '314', '315', + '501', '511', '512', '513', '514', + '220' + ])) { + echo ""; + } + } else if (checkNowFormStatus($link) == 'A' || checkNowFormStatus($link) == 'D') { + echo " + + "; + } else if (checkNowFormStatus($link) == 'B') { + if (isLeader($link, $user_id)) { + echoMaxSelect($max_options); + } else { + echo " + + "; + } + } + ?> + + "; + echo ""; + } else if (checkNowFormStatus($link) == 'A') { + if ($user_id == 'M0060') { + echo ""; + } else if (isLeader($link, $user_id)) { + echo ""; + } else { + echo ""; + } + echo ""; + } else if (checkNowFormStatus($link) == 'B') { + if (isLeader($link, $user_id)) { + echo ""; + } else if ($user_id == 'M0060') { + echo ""; + } else { + echo ""; + } + echo ""; + } else if (checkNowFormStatus($link) == 'D') { + if (isLeader($link, $user_id)) { + echo ""; + } else if ($user_id == 'M0060') { + echo ""; + } else { + echo ""; + } + echo ""; + } + ?> +
+ + + + + +
+ +
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/wms/wipwhole-index-function.php b/wms/wipwhole-index-function.php index eda7930e..b54b8951 100644 --- a/wms/wipwhole-index-function.php +++ b/wms/wipwhole-index-function.php @@ -1057,3 +1057,19 @@ function saveInstallData($user_department_id, $role_id) return true; return false; } + + +function getWipwholeChangePlanningCustomerDetailsStatus($link,$id){ + $sql = " + SELECT + custom_name, + create_at, + change_status + FROM wipwhole_change_planning_customer_details + WHERE 1=1 + AND wipwholestatus_id = '$id' + ORDER BY create_at DESC + LIMIT 1 + "; + return mysqli_query($link, $sql); +} \ No newline at end of file diff --git a/wms/wipwhole-rec-invoice-edit.php b/wms/wipwhole-rec-invoice-edit.php index b98572a3..15cf7a1a 100644 --- a/wms/wipwhole-rec-invoice-edit.php +++ b/wms/wipwhole-rec-invoice-edit.php @@ -1,5 +1,5 @@ 工地地址
- 客戶計劃圖
(意匠圖) + + 客戶計劃圖 +
+ (意匠圖) + "; + echo "申請上傳"; + } else { + if (in_array($row2['change_status'], ['A', 'B', 'D'])) { + echo "
"; + echo "客戶姓名:" . $row2['custom_name'] . "
狀態:審核中
"; + } + if ($row2['change_status'] == 'C') { + echo "
"; + echo "客戶姓名:" . $row2['custom_name'] . "
狀態:已取消
"; + } + if ($row2['change_status'] == 'Z') { + echo "
"; + echo "客戶姓名:" . $row2['custom_name'] . "
狀態:審核通過
"; + } + } + ?> + > + > 下載附件" : ""; ?> @@ -1226,7 +1262,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; @@ -1295,11 +1331,11 @@ include "wipwhole-rec-invoice-edit-submit.php"; 預計交期(到工地) - > + > - 客戶計劃圖
(意匠圖) + + 客戶計劃圖 +
+ (意匠圖) + "; + echo "申請上傳"; + } else { + if (in_array($row2['change_status'], ['A', 'B', 'D'])) { + echo "
"; + echo "客戶姓名:" . $row2['custom_name'] . "
狀態:審核中
"; + } + if ($row2['change_status'] == 'C') { + echo "
"; + echo "客戶姓名:" . $row2['custom_name'] . "
狀態:已取消
"; + } + if ($row2['change_status'] == 'Z') { + echo "
"; + echo "客戶姓名:" . $row2['custom_name'] . "
狀態:審核通過
"; + } + } + ?> + > + > 下載附件" : ""; ?> @@ -391,7 +428,6 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; " readonly> @@ -1244,19 +1280,19 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; " readonly> @@ -1310,11 +1346,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; 預計交期(到工地) - > + >