|
@ -1,4 +1,5 @@ |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 組sql語法:限制可查詢範圍 |
|
|
* 組sql語法:限制可查詢範圍 |
|
|
* 系統管理員、總經理權限全開 |
|
|
* 系統管理員、總經理權限全開 |
|
@ -8,7 +9,8 @@ |
|
|
* |
|
|
* |
|
|
* @return string |
|
|
* @return string |
|
|
*/ |
|
|
*/ |
|
|
function sql_myself($user_id, $column="creater") { |
|
|
function sql_myself($user_id, $column = "creater") |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$follower_arr = []; // 下屬列表 |
|
|
$follower_arr = []; // 下屬列表 |
|
@ -36,7 +38,8 @@ function sql_myself($user_id, $column="creater") { |
|
|
* @param array $ret:下屬ID |
|
|
* @param array $ret:下屬ID |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
function find_follow($user_id, &$ret=[]) { |
|
|
function find_follow($user_id, &$ret = []) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$sql = "select accountid from account where manager = '$user_id'"; |
|
|
$sql = "select accountid from account where manager = '$user_id'"; |
|
@ -56,7 +59,8 @@ function find_follow($user_id, &$ret=[]) { |
|
|
* @param array $ret:上級主管ID |
|
|
* @param array $ret:上級主管ID |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
function manage_class($user_id, &$ret=[]) { |
|
|
function manage_class($user_id, &$ret = []) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$sql = "select manager from account where accountid = '$user_id'"; |
|
|
$sql = "select manager from account where accountid = '$user_id'"; |
|
@ -79,7 +83,8 @@ function manage_class($user_id, &$ret=[]) { |
|
|
* @return array |
|
|
* @return array |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
function pricereview_class($rate, $user_id, &$ret=[]) { |
|
|
function pricereview_class($rate, $user_id, &$ret = []) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$sql = "select manager from account where accountid = '$user_id'"; |
|
|
$sql = "select manager from account where accountid = '$user_id'"; |
|
@ -87,7 +92,7 @@ function pricereview_class($rate, $user_id, &$ret=[]) { |
|
|
while ($row = mysqli_fetch_assoc($res)) { |
|
|
while ($row = mysqli_fetch_assoc($res)) { |
|
|
if ($row["manager"] == "M0001") return; // 董事長略過 |
|
|
if ($row["manager"] == "M0001") return; // 董事長略過 |
|
|
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") { |
|
|
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") { |
|
|
$ret[1] = $row["manager"].",,"; |
|
|
$ret[1] = $row["manager"] . ",,"; |
|
|
pricereview_class($rate, $row["manager"], $ret); |
|
|
pricereview_class($rate, $row["manager"], $ret); |
|
|
} else { |
|
|
} else { |
|
|
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人) |
|
|
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人) |
|
@ -108,7 +113,8 @@ function pricereview_class($rate, $user_id, &$ret=[]) { |
|
|
* @return array |
|
|
* @return array |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
function pricereview_renovate_class($rate, $user_id, $renovate_flag) { |
|
|
function pricereview_renovate_class($rate, $user_id, $renovate_flag) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$sql = "select manager from account where accountid = '$user_id'"; |
|
|
$sql = "select manager from account where accountid = '$user_id'"; |
|
@ -142,11 +148,20 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag) { |
|
|
* @param string $token |
|
|
* @param string $token |
|
|
* @return string |
|
|
* @return string |
|
|
*/ |
|
|
*/ |
|
|
function check_user_permission($user_id, $token) { |
|
|
function check_user_permission($user_id, $token) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
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/wipwhole-change-planning-customer-name.php','/wms/test.php', '/wms/mkt/pricereview_mi-api.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; |
|
|
if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return; |
|
|
|
|
|
|
|
|
$do = ""; |
|
|
$do = ""; |
|
@ -169,9 +184,12 @@ function check_user_permission($user_id, $token) { |
|
|
mysqli_free_result($res); |
|
|
mysqli_free_result($res); |
|
|
|
|
|
|
|
|
if (!$do) { |
|
|
if (!$do) { |
|
|
echo "無權限操作,請洽管理員。"; |
|
|
// 判斷是否從藍凌過來 |
|
|
exit; |
|
|
if (!empty($_GET['employee_no'])) { |
|
|
echo "<script>alert('無權限操作,請洽管理員。');if (history.length==1) location.href='/wms/index.php?token=".$token."'; else history.go(-1);</script>"; |
|
|
echo "無權限操作,請洽管理員。"; |
|
|
|
|
|
exit; |
|
|
|
|
|
} |
|
|
|
|
|
echo "<script>alert('無權限操作,請洽管理員。');if (history.length==1) location.href='/wms/index.php?token=" . $token . "'; else history.go(-1);</script>"; |
|
|
} else return $do; |
|
|
} else return $do; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -179,7 +197,8 @@ function check_user_permission($user_id, $token) { |
|
|
* 員工編號對應姓名表 |
|
|
* 員工編號對應姓名表 |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
function accountid2name() { |
|
|
function accountid2name() |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$arr = []; |
|
|
$arr = []; |
|
@ -198,7 +217,8 @@ function accountid2name() { |
|
|
* @param array $uid 員工編號 |
|
|
* @param array $uid 員工編號 |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
function accountid2email($uid) { |
|
|
function accountid2email($uid) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
if (is_array($uid)) $accountid = implode("','", $uid); |
|
|
if (is_array($uid)) $accountid = implode("','", $uid); |
|
@ -224,7 +244,8 @@ function accountid2email($uid) { |
|
|
* @param string|array $user_id:下位簽核者 |
|
|
* @param string|array $user_id:下位簽核者 |
|
|
* @param string $seq:順序 |
|
|
* @param string $seq:順序 |
|
|
*/ |
|
|
*/ |
|
|
function do_assign($flow_id, $id, $content, $user_id, $seq=0) { |
|
|
function do_assign($flow_id, $id, $content, $user_id, $seq = 0) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$tds = date("Y-m-d H:i:s"); |
|
|
$tds = date("Y-m-d H:i:s"); |
|
@ -279,7 +300,8 @@ function do_assign($flow_id, $id, $content, $user_id, $seq=0) { |
|
|
* @param string $id:價審單序號 |
|
|
* @param string $id:價審單序號 |
|
|
* @param string $content:卷號 |
|
|
* @param string $content:卷號 |
|
|
*/ |
|
|
*/ |
|
|
function end_flow($system_id, $flow_id, $id, $content) { |
|
|
function end_flow($system_id, $flow_id, $id, $content) |
|
|
|
|
|
{ |
|
|
global $link; |
|
|
global $link; |
|
|
|
|
|
|
|
|
$tds = date("Y-m-d H:i:s"); |
|
|
$tds = date("Y-m-d H:i:s"); |
|
@ -297,7 +319,7 @@ function end_flow($system_id, $flow_id, $id, $content) { |
|
|
$sql = "select ekind, person from pricereview_main where id = '$id'"; |
|
|
$sql = "select ekind, person from pricereview_main where id = '$id'"; |
|
|
$res = mysqli_query($link, $sql); |
|
|
$res = mysqli_query($link, $sql); |
|
|
if ($row = mysqli_fetch_row($res)) { |
|
|
if ($row = mysqli_fetch_row($res)) { |
|
|
$content = $row[0]."價格審查結案通知 > ".$content; |
|
|
$content = $row[0] . "價格審查結案通知 > " . $content; |
|
|
$kind = ($row[0] == "新梯") ? 3 : 4; |
|
|
$kind = ($row[0] == "新梯") ? 3 : 4; |
|
|
$sql2 = "insert into notice (kind, related_id, title, permission, creater, create_at) values ("; |
|
|
$sql2 = "insert into notice (kind, related_id, title, permission, creater, create_at) values ("; |
|
|
$sql2 .= "'$kind', '$id', '$content', '$row[1]', 'system', '$tds')"; |
|
|
$sql2 .= "'$kind', '$id', '$content', '$row[1]', 'system', '$tds')"; |
|
@ -388,7 +410,7 @@ function postCheck($post_val, $default_val = null) |
|
|
*/ |
|
|
*/ |
|
|
function do_wws2_assign($user_id, $form_id, $flow_code) |
|
|
function do_wws2_assign($user_id, $form_id, $flow_code) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
global $link; |
|
|
global $link; |
|
|
$tds = date("Y-m-d H:i:s"); |
|
|
$tds = date("Y-m-d H:i:s"); |
|
|
$sql = "select appwms.nextval('form_key') form_key"; |
|
|
$sql = "select appwms.nextval('form_key') form_key"; |
|
@ -493,47 +515,50 @@ function accountidToRoleName($accountid) |
|
|
* @param array $arr:[電梯種類,人乘/載重,停數,開門方式,速度] |
|
|
* @param array $arr:[電梯種類,人乘/載重,停數,開門方式,速度] |
|
|
* @return string 規格名,載重 |
|
|
* @return string 規格名,載重 |
|
|
*/ |
|
|
*/ |
|
|
function facility_spec($arr) { |
|
|
function facility_spec($arr) |
|
|
|
|
|
{ |
|
|
if (empty($arr)) return; |
|
|
if (empty($arr)) return; |
|
|
list($kind, $seat, $stop, $op, $speed) = $arr; |
|
|
list($kind, $seat, $stop, $op, $speed) = $arr; |
|
|
if (strlen($speed) == 1) $speed = str_pad($speed, 2, "0", STR_PAD_LEFT); |
|
|
if (strlen($speed) == 1) $speed = str_pad($speed, 2, "0", STR_PAD_LEFT); |
|
|
$seat2weight_arr = ["A3" => 320, "A8" => 320, "G10" => 320, "G20" => 320, "G5" => 320, "G6" => 320, |
|
|
$seat2weight_arr = [ |
|
|
"280-1-A" => 280, "280-1-L" => 280, "280-2-A" => 280, "280-2-L" => 280, |
|
|
"A3" => 320, "A8" => 320, "G10" => 320, "G20" => 320, "G5" => 320, "G6" => 320, |
|
|
"320-1-A" => 320, "320-1-L" => 320, "320-2-A" => 320, "320-2-L" => 320, |
|
|
"280-1-A" => 280, "280-1-L" => 280, "280-2-A" => 280, "280-2-L" => 280, |
|
|
"6" => 450, "8" => 550, "9" => 600, "10" => 700, "11" => 750, "12" => 800, |
|
|
"320-1-A" => 320, "320-1-L" => 320, "320-2-A" => 320, "320-2-L" => 320, |
|
|
"13" => 900, "15" => 1000, "17" => 1150, "20" => 1350, "24" => 1600]; |
|
|
"6" => 450, "8" => 550, "9" => 600, "10" => 700, "11" => 750, "12" => 800, |
|
|
|
|
|
"13" => 900, "15" => 1000, "17" => 1150, "20" => 1350, "24" => 1600 |
|
|
|
|
|
]; |
|
|
switch ($kind) { |
|
|
switch ($kind) { |
|
|
case "MAQ100": |
|
|
case "MAQ100": |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$ret = $kind."-".$weight."-".$stop."-".$op.$speed; |
|
|
$ret = $kind . "-" . $weight . "-" . $stop . "-" . $op . $speed; |
|
|
break; |
|
|
break; |
|
|
case "MAP100": |
|
|
case "MAP100": |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$ret = $kind."-".$weight."*".$stop."-".$op.$speed; |
|
|
$ret = $kind . "-" . $weight . "*" . $stop . "-" . $op . $speed; |
|
|
break; |
|
|
break; |
|
|
case "MAM200": |
|
|
case "MAM200": |
|
|
case "MAH100": |
|
|
case "MAH100": |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$ret = $kind."-".$seat."*".$stop."-".$op.$speed; |
|
|
$ret = $kind . "-" . $seat . "*" . $stop . "-" . $op . $speed; |
|
|
break; |
|
|
break; |
|
|
case "MAF100": |
|
|
case "MAF100": |
|
|
$weight = $seat; |
|
|
$weight = $seat; |
|
|
$ret = $kind."-".$seat."*".$stop."-".$op.$speed; |
|
|
$ret = $kind . "-" . $seat . "*" . $stop . "-" . $op . $speed; |
|
|
break; |
|
|
break; |
|
|
case "MAE100": |
|
|
case "MAE100": |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$ret = $kind."-".$seat."*".$stop."-".$op.$speed; |
|
|
$ret = $kind . "-" . $seat . "*" . $stop . "-" . $op . $speed; |
|
|
break; |
|
|
break; |
|
|
case "M1+M4(2:1)": |
|
|
case "M1+M4(2:1)": |
|
|
case "M1+M4(1:1)": |
|
|
case "M1+M4(1:1)": |
|
|
case "M1": |
|
|
case "M1": |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$weight = $seat2weight_arr[$seat]; |
|
|
$ret = "P".$seat."-".$seat2weight_arr[$seat]."-".$op."-".$speed."-".$stop; |
|
|
$ret = "P" . $seat . "-" . $seat2weight_arr[$seat] . "-" . $op . "-" . $speed . "-" . $stop; |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
$weight = $ret = ""; |
|
|
$weight = $ret = ""; |
|
|
} |
|
|
} |
|
|
return $ret.",".$weight; |
|
|
return $ret . "," . $weight; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -541,7 +566,8 @@ function facility_spec($arr) { |
|
|
* @param array $arr:[簽核人1,簽核人2,簽核人3,簽核人4] |
|
|
* @param array $arr:[簽核人1,簽核人2,簽核人3,簽核人4] |
|
|
* @return array 進度,下位審批人 |
|
|
* @return array 進度,下位審批人 |
|
|
*/ |
|
|
*/ |
|
|
function sign_status($arr) { |
|
|
function sign_status($arr) |
|
|
|
|
|
{ |
|
|
$ret = []; |
|
|
$ret = []; |
|
|
foreach ($arr as $k => $sign) { |
|
|
foreach ($arr as $k => $sign) { |
|
|
$sign_nos = 0; |
|
|
$sign_nos = 0; |
|
@ -554,7 +580,7 @@ function sign_status($arr) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (count($sign_arr) == $sign_nos) { |
|
|
if (count($sign_arr) == $sign_nos) { |
|
|
$ret["sign_st"] = $k+1; |
|
|
$ret["sign_st"] = $k + 1; |
|
|
$ret["sign_nt"] = $sign_nt_arr; |
|
|
$ret["sign_nt"] = $sign_nt_arr; |
|
|
return $ret; |
|
|
return $ret; |
|
|
} |
|
|
} |
|
@ -566,9 +592,10 @@ function sign_status($arr) { |
|
|
return $ret; |
|
|
return $ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getAccounttype($link,$user_id){ |
|
|
function getAccounttype($link, $user_id) |
|
|
$sql = "SELECT * FROM account where accountid = '$user_id'"; |
|
|
{ |
|
|
$data = mysqli_query($link, $sql); |
|
|
$sql = "SELECT * FROM account where accountid = '$user_id'"; |
|
|
|
|
|
$data = mysqli_query($link, $sql); |
|
|
$row = mysqli_fetch_array($data, MYSQLI_ASSOC); |
|
|
$row = mysqli_fetch_array($data, MYSQLI_ASSOC); |
|
|
return $row['accounttype']; |
|
|
return $row['accounttype']; |
|
|
} |
|
|
} |
|
|