Browse Source

規格調查(新梯、汰改)修整頁面

main
Cheng 1 year ago
parent
commit
22e75650a1
  1. 430
      wms/IncludeCommon.php
  2. 1151
      wms/cont/sign_form.php
  3. 156
      wms/cont/submit.php
  4. 8300
      wms/css/bootstrap.min.css
  5. 714
      wms/header.php
  6. 8300
      wms/mkt/css/bootstrap.min.css
  7. 4096
      wms/mkt/specsurvey-create.php
  8. 3851
      wms/mkt/specsurvey-edit.php
  9. 3812
      wms/mkt/specsurvey-view.php
  10. 4087
      wms/mkt/specsurvey_renovate-create.php
  11. 3811
      wms/mkt/specsurvey_renovate-view.php
  12. 432
      wms/rib01-create.php
  13. 13
      wms/sign/list.php

430
wms/IncludeCommon.php

@ -1,212 +1,218 @@
<?php
class IncludeCommon
{
function CheckToken($token) {
date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s");
if (!isset($token) || empty($token)) {
$data['code'] = '400';
$data['message'] = '非法请求';
return $data;
}
//对比token
$explode = explode('.', $token); //以.分割token为数组
if (!empty($explode[0]) && !empty($explode[1]) && !empty($explode[2]) && !empty($explode[3]) && !empty($explode[4])) {
$info = $explode[0] . '.' . $explode[1] . '.' . $explode[2] . '.' . $explode[3]; //信息部分
$true_signature = hash_hmac('md5', $info, $encryption_code); //正确的签名
if ($time > $explode[3]) {
$data['user_id'] = '';
$data['code'] = '401';
$data['message'] = 'Token已过期,请重新登录';
return $data;
}
if (($true_signature == $explode[4])) {
$data['user_id'] = $explode[0];
$data['code'] = '200';
$data['message'] = 'Token合法';
return $data;
} else {
$data['user_id'] = '';
$data['code'] = '400';
$data['message'] = 'Token不合法';
return $data;
}
} else {
$data['user_id'] = '';
$data['code'] = '400';
$data['message'] = 'Token不合法';
return $data;
}
}
//生成登录记录
function save_log_response($source_flag='web', $account, $response_result){
# 储存纪录并输出
#echo date("Y-m-d");
$file_path = "account_log/" . $account . "-" . date("Y-m-d") . ".ini";
$data = serialize($response_result). date("H:i:s") . "\n";
$fp = fopen($file_path,"a"); # 如果档案不存在择尝试建立再写入
fwrite($fp, $data);
fclose($fp);
if ($source_flag == "web"){
// header("Location: custom-create.php?function_list=" . serialize($response_result) .
// "&token=" . $response_result["token"]); #请输入使用者名称密码
// exit();
return true;
}else{
// echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
return false;
}
/*
if ($source_flag == "app"){
echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
}elseif ($source_flag == "web"){
header("Location: api-account-reply-functions.php?function_list=" . serialize($response_result) .
"&token=" . $response_result["token"]); #请输入使用者名称密码
exit();
}
*/
}
//生成token
function CreateToken($user_id, $user_name) {
date_default_timezone_set("Asia/Taipei");
$start_time = date("Y-m-d H:i:s");
$end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时
$info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天
$encryption_code = "MASADA!^***";
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
$signature = hash_hmac('md5', $info, $encryption_code);
//最后将这两部分拼接起来,得到最终的Token字符串
return $token = $info . '.' . $signature;
}
//生成菜单
/**
* 將模擬帳號寫入token
*/
function FakeToken($fake_user_id, $token) {
date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s");
$explode = explode('.', $token);
$info = $fake_user_id . '.' . $explode[1] . '.' . $explode[2] . '.' . $explode[3]; // 欲模擬帳號.本人帳號.有效開始時間.失效時間
$signature = hash_hmac('md5', $info, $encryption_code);
return $token = $info . '.' . $signature;
}
function menu ($from='tw',$type){
$function_type = array(
"tw" => array(
# F角色菜单
"F" => array(
"language" => "tw",
"type" => "manage",
"list" => array(
array("name" => "批量导入", "path" => "http://192.168.0.12/wms/excel-upload"),
),
"note" => "none",
"token" => ""
),
)
);
return $function_type[$from][$type];
}
/**
* 依帳號類別檢視功能目錄
*/
function menu_v2($atype="") {
global $link;
if (!$atype) return;
$sql = "select main_menu, sub_menu, sub_menu_eng, mlink from menu where accounttype = '$atype' and status = 'Y' order by main_menu_seq, sub_menu_seq";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$arr[$row["main_menu"]][$row["sub_menu"]][$row["sub_menu_eng"]] = $row["mlink"];
}
mysqli_free_result($res);
$str = json_encode($arr, JSON_UNESCAPED_UNICODE);
return $str;
}
/**
* 依帳號檢視功能目錄
* 管理者可看到全部選單
* 其餘人員依account_auth決定可檢視的選單
*/
function menu_v3($aid="", $accounttype) {
global $link;
if (!$aid) return;
$str = "";
$arr = $menu_arr = [];
$sql_cmd = ($accounttype == "E") ? "" : "where status = 'Y'";
$sql = "select main_menu, sub_menu, sub_menu_eng, mlink from menu $sql_cmd order by main_menu_seq, sub_menu_seq";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$menu_arr[$row["mlink"]]["main_menu"] = $row["main_menu"];
$menu_arr[$row["mlink"]]["sub_menu"] = $row["sub_menu"];
$menu_arr[$row["mlink"]]["sub_menu_eng"] = $row["sub_menu_eng"];
}
mysqli_free_result($res);
$sql = "select permission from account_auth where accountid = '$aid'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
$permission = empty($row)? json_encode([]): $row[0]; // $permission = $row[0]; //P0044 修改于2023/6/13 16:30
$permission_arr = json_decode($permission, true);
foreach ($menu_arr as $key => $val) {
if (($accounttype == "E") || !empty($permission_arr[$key])) {
$arr[$val["main_menu"]][$val["sub_menu"]][$val["sub_menu_eng"]] = $key;
}
}
if (!empty($arr)) $str = json_encode($arr, JSON_UNESCAPED_UNICODE);
/*
if ($permission_arr) {
foreach ($menu_arr as $key => $val) {
if ($permission_arr[$key]) {
$arr[$val["main_menu"]][$val["sub_menu"]][$val["sub_menu_eng"]] = $key;
}
}
if (!empty($arr)) $str = json_encode($arr, JSON_UNESCAPED_UNICODE);
}
*/
mysqli_free_result($res);
return $str;
/*
$str = "";
$sql = "select a.id, a.accountid, m.auth_content from account a, menu_auth m where a.accountid = '$aid' and a.accountid = m.accountid and m.status = 'Y'";
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) {
list($id, $accountid, $auth_content) = $row;
$auth_arr = json_decode($auth_content, true);
$menuid_arr = array_keys($auth_arr);
if ($menuid_arr) {
$arr = [];
$menuid_str = implode(",", $menuid_arr);
$sql2 = "select id, main_menu, sub_menu, sub_menu_eng, link from menu_tree where id in ($menuid_str) and status = 'Y' order by main_menu_seq, sub_menu_seq";
$res2 = mysqli_query($link, $sql2);
while ($row2 = mysqli_fetch_assoc($res2)) {
$arr[$row2["main_menu"]][$row2["sub_menu"]][$row2["sub_menu_eng"]] = $row2["link"]; // R+W
if ($auth_arr[$row2["id"]] == "N") $arr[$row2["main_menu"]][$row2["sub_menu"]][$row2["sub_menu_eng"]] = "";//"/wms/forbidden.php"; // R
}
mysqli_free_result($res2);
$str = json_encode($arr, JSON_UNESCAPED_UNICODE);
}
}
mysqli_free_result($res);
return $str;
*/
}
}
<?php
class IncludeCommon
{
function CheckToken($token)
{
date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s");
if (!isset($token) || empty($token)) {
$data['code'] = '400';
$data['message'] = '非法请求';
return $data;
}
//对比token
$explode = explode('.', $token); //以.分割token为数组
if (!empty($explode[0]) && !empty($explode[1]) && !empty($explode[2]) && !empty($explode[3]) && !empty($explode[4])) {
$info = $explode[0] . '.' . $explode[1] . '.' . $explode[2] . '.' . $explode[3]; //信息部分
$true_signature = hash_hmac('md5', $info, $encryption_code); //正确的签名
if ($time > $explode[3]) {
$data['user_id'] = '';
$data['code'] = '401';
$data['message'] = 'Token已过期,请重新登录';
return $data;
}
if (($true_signature == $explode[4])) {
$data['user_id'] = $explode[0];
$data['code'] = '200';
$data['message'] = 'Token合法';
return $data;
} else {
$data['user_id'] = '';
$data['code'] = '400';
$data['message'] = 'Token不合法';
return $data;
}
} else {
$data['user_id'] = '';
$data['code'] = '400';
$data['message'] = 'Token不合法';
return $data;
}
}
//生成登录记录
function save_log_response($account, $response_result, $source_flag = 'web')
{
# 储存纪录并输出
#echo date("Y-m-d");
$file_path = "account_log/" . $account . "-" . date("Y-m-d") . ".ini";
$data = serialize($response_result) . date("H:i:s") . "\n";
$fp = fopen($file_path, "a"); # 如果档案不存在择尝试建立再写入
fwrite($fp, $data);
fclose($fp);
if ($source_flag == "web") {
// header("Location: custom-create.php?function_list=" . serialize($response_result) .
// "&token=" . $response_result["token"]); #请输入使用者名称密码
// exit();
return true;
} else {
// echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
return false;
}
/*
if ($source_flag == "app"){
echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
}elseif ($source_flag == "web"){
header("Location: api-account-reply-functions.php?function_list=" . serialize($response_result) .
"&token=" . $response_result["token"]); #请输入使用者名称密码
exit();
}
*/
}
//生成token
function CreateToken($user_id, $user_name)
{
date_default_timezone_set("Asia/Taipei");
$start_time = date("Y-m-d H:i:s");
$end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时
$info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天
$encryption_code = "MASADA!^***";
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
$signature = hash_hmac('md5', $info, $encryption_code);
//最后将这两部分拼接起来,得到最终的Token字符串
return $token = $info . '.' . $signature;
}
//生成菜单
/**
* 將模擬帳號寫入token
*/
function FakeToken($fake_user_id, $token)
{
date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s");
$explode = explode('.', $token);
$info = $fake_user_id . '.' . $explode[1] . '.' . $explode[2] . '.' . $explode[3]; // 欲模擬帳號.本人帳號.有效開始時間.失效時間
$signature = hash_hmac('md5', $info, $encryption_code);
return $token = $info . '.' . $signature;
}
function menu($type, $from = 'tw')
{
$function_type = array(
"tw" => array(
# F角色菜单
"F" => array(
"language" => "tw",
"type" => "manage",
"list" => array(
array("name" => "批量导入", "path" => "http://192.168.0.12/wms/excel-upload"),
),
"note" => "none",
"token" => ""
),
)
);
return $function_type[$from][$type];
}
/**
* 依帳號類別檢視功能目錄
*/
function menu_v2($atype = "")
{
global $link;
if (!$atype) return;
$sql = "select main_menu, sub_menu, sub_menu_eng, mlink from menu where accounttype = '$atype' and status = 'Y' order by main_menu_seq, sub_menu_seq";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$arr[$row["main_menu"]][$row["sub_menu"]][$row["sub_menu_eng"]] = $row["mlink"];
}
mysqli_free_result($res);
$str = json_encode($arr, JSON_UNESCAPED_UNICODE);
return $str;
}
/**
* 依帳號檢視功能目錄
* 管理者可看到全部選單
* 其餘人員依account_auth決定可檢視的選單
*/
function menu_v3($accounttype, $aid = "")
{
global $link;
if (!$aid) return;
$str = "";
$arr = $menu_arr = [];
$sql_cmd = ($accounttype == "E") ? "" : "where status = 'Y'";
$sql = "select main_menu, sub_menu, sub_menu_eng, mlink from menu $sql_cmd order by main_menu_seq, sub_menu_seq";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$menu_arr[$row["mlink"]]["main_menu"] = $row["main_menu"];
$menu_arr[$row["mlink"]]["sub_menu"] = $row["sub_menu"];
$menu_arr[$row["mlink"]]["sub_menu_eng"] = $row["sub_menu_eng"];
}
mysqli_free_result($res);
$sql = "select permission from account_auth where accountid = '$aid'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
$permission = empty($row) ? json_encode([]) : $row[0]; // $permission = $row[0]; //P0044 修改于2023/6/13 16:30
$permission_arr = json_decode($permission, true);
foreach ($menu_arr as $key => $val) {
if (($accounttype == "E") || !empty($permission_arr[$key])) {
$arr[$val["main_menu"]][$val["sub_menu"]][$val["sub_menu_eng"]] = $key;
}
}
if (!empty($arr)) $str = json_encode($arr, JSON_UNESCAPED_UNICODE);
/*
if ($permission_arr) {
foreach ($menu_arr as $key => $val) {
if ($permission_arr[$key]) {
$arr[$val["main_menu"]][$val["sub_menu"]][$val["sub_menu_eng"]] = $key;
}
}
if (!empty($arr)) $str = json_encode($arr, JSON_UNESCAPED_UNICODE);
}
*/
mysqli_free_result($res);
return $str;
/*
$str = "";
$sql = "select a.id, a.accountid, m.auth_content from account a, menu_auth m where a.accountid = '$aid' and a.accountid = m.accountid and m.status = 'Y'";
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) {
list($id, $accountid, $auth_content) = $row;
$auth_arr = json_decode($auth_content, true);
$menuid_arr = array_keys($auth_arr);
if ($menuid_arr) {
$arr = [];
$menuid_str = implode(",", $menuid_arr);
$sql2 = "select id, main_menu, sub_menu, sub_menu_eng, link from menu_tree where id in ($menuid_str) and status = 'Y' order by main_menu_seq, sub_menu_seq";
$res2 = mysqli_query($link, $sql2);
while ($row2 = mysqli_fetch_assoc($res2)) {
$arr[$row2["main_menu"]][$row2["sub_menu"]][$row2["sub_menu_eng"]] = $row2["link"]; // R+W
if ($auth_arr[$row2["id"]] == "N") $arr[$row2["main_menu"]][$row2["sub_menu"]][$row2["sub_menu_eng"]] = "";//"/wms/forbidden.php"; // R
}
mysqli_free_result($res2);
$str = json_encode($arr, JSON_UNESCAPED_UNICODE);
}
}
mysqli_free_result($res);
return $str;
*/
}
}

1151
wms/cont/sign_form.php

File diff suppressed because it is too large

156
wms/cont/submit.php

@ -1,78 +1,78 @@
<?php
//require_once "../database.php";
require_once './wf_common.php';
require_once './model/ConMaintanceExamineApplyModel.php';
require_once './model/ConMaintanceExamineClearModel.php';
//print_r($_POST);exit;
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST;
$tosign = ($request["btn_save"] == "tosign") ? 1 : 0; // 1:提交
if ($request["form_src"] == "apply_form" && $tosign && (!isset($request["register_code"]) || empty($request["register_code"][0]) || !isset($request["next_users"]) || empty($request["next_users"]))) {
echo "<script type = 'text/JavaScript'>";
echo "alert('請確認電梯資料或未選擇下位簽核者!');";
echo "history.go(-1);";
echo "</script>";
exit;
}
//更新表单ConMaintanceExamineApplyModel
$cmea = new ConMaintanceExamineApplyModel();
$apply_key=$request['apply_key'];
$cmea->update(['apply_key', $apply_key], array_diff_key($request, ['apply_key' => '']));
//更新电梯列表
if (!empty($request["reg_del"])) {
$register_code_del_arr = explode(",", rtrim($request["reg_del"], ","));
foreach ($register_code_del_arr as $val) {
$sql = "update con_maintance_examine_clear set cmstatus = 'D' where apply_key = '$apply_key' and register_code = '$val' and cmstatus <> 'D'";
DB::query($sql);
}
}
if (!empty($request['register_code']) && count($request['register_code']) > 0) {
$cmec = new ConMaintanceExamineClearModel();
for ($i = 0; $i < count($request['register_code']); $i++) {
$data = [
'apply_key' => $request['apply_key']
];
$cols = array_diff($cmec->fillable, ['apply_key']);
foreach ($cols as $col) {
$data[$col] = empty($request[$col][$i]) ? '' : $request[$col][$i];
if ($col=="annual_survey_expense") $data[$col] = '0.00';
}
$cmec->create($data);
}
}
//var_dump($_POST);
//var_dump($_GET);
if ($tosign) {
#流程开始,var_dump($request);
$flow = new Flow($request['form_key']);
// 当前节点签核开始
$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $request['form_key']);
$wf->setFormData($request);
$wf->submit($request['next_users'], $request['assign_status'], $request['assign_opinion']);
//当前节点签核结束
$responses['flowName'] = $wf->getFlowName();
$responses['form_key'] = $request['form_key'];
//var_dump($request);
#結案發通知給營業員
if ($request['assign_status'] == 'F4') {
list($salesman, $case_name ) = DB::fields("select salesman ,case_name from con_maintance_examine_apply where apply_key='" . $apply_key. "' ");
$ins_notice_sql = "INSERT INTO `notice` ( `kind`,`title`, `content`, `permission`)
VALUES ( '1', '契約價審單結案通知(" .$case_name . ")', '契約價審單結案通知(" . $case_name . ")', ' $salesman')";
DB::query($ins_notice_sql);
// echo $ins_notice_sql;
}
}
echo "<script type = 'text/JavaScript'>";
//echo "<h4 style='text-align:center'>成功提交<a href='https://www.masada.com.tw/wms/sign/list.php?function_name=show&token=" . $request['token'] . "'>返回待签 </a></h4>";
if ($tosign) {
echo "alert('成功提交');";
echo "location.href='../cont/sign_list.php?function_name=sign_list&token=".$request['token']."';";
} else {
echo "alert('資料已保存');";
echo "location.href='../crm/crmm02-index.php?function_name=contract_customer&token=".$request['token']."';";
}
echo "</script>";
<?php
//require_once "../database.php";
require_once './wf_common.php';
require_once './model/ConMaintanceExamineApplyModel.php';
require_once './model/ConMaintanceExamineClearModel.php';
//print_r($_POST);exit;
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST;
$tosign = ($request["btn_save"] == "tosign") ? 1 : 0; // 1:提交
if ($request["form_src"] == "apply_form" && $tosign && (!isset($request["register_code"]) || empty($request["register_code"][0]) || !isset($request["next_users"]) || empty($request["next_users"]))) {
echo "<script type = 'text/JavaScript'>";
echo "alert('請確認電梯資料或未選擇下位簽核者!');";
echo "history.go(-1);";
echo "</script>";
exit;
}
//更新表单ConMaintanceExamineApplyModel
$cmea = new ConMaintanceExamineApplyModel();
$apply_key = $request['apply_key'];
$cmea->update(['apply_key', $apply_key], array_diff_key($request, ['apply_key' => '']));
//更新电梯列表
if (!empty($request["reg_del"])) {
$register_code_del_arr = explode(",", rtrim($request["reg_del"], ","));
foreach ($register_code_del_arr as $val) {
$sql = "UPDATE con_maintance_examine_clear SET cmstatus = 'D' WHERE apply_key = '$apply_key' AND register_code = '$val' AND cmstatus <> 'D'";
DB::query($sql);
}
}
if (!empty($request['register_code']) && count($request['register_code']) > 0) {
$cmec = new ConMaintanceExamineClearModel();
for ($i = 0; $i < count($request['register_code']); $i++) {
$data = [
'apply_key' => $request['apply_key']
];
$cols = array_diff($cmec->fillable, ['apply_key']);
foreach ($cols as $col) {
$data[$col] = empty($request[$col][$i]) ? '' : $request[$col][$i];
if ($col == "annual_survey_expense") $data[$col] = '0.00';
}
$cmec->create($data);
}
}
//var_dump($_POST);
//var_dump($_GET);
if ($tosign) {
#流程开始,var_dump($request);
$flow = new Flow($request['form_key']);
// 当前节点签核开始
$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $request['form_key']);
$wf->setFormData($request);
$wf->submit($request['next_users'], $request['assign_status'], $request['assign_opinion']);
//当前节点签核结束
$responses['flowName'] = $wf->getFlowName();
$responses['form_key'] = $request['form_key'];
//var_dump($request);
#結案發通知給營業員
if ($request['assign_status'] == 'F4') {
list($salesman, $case_name) = DB::fields("select salesman ,case_name from con_maintance_examine_apply where apply_key='" . $apply_key . "' ");
$ins_notice_sql = "INSERT INTO `notice` ( `kind`,`title`, `content`, `permission`)
VALUES ( '1', '契約價審單結案通知(" . $case_name . ")', '契約價審單結案通知(" . $case_name . ")', ' $salesman')";
DB::query($ins_notice_sql);
// echo $ins_notice_sql;
}
}
echo "<script type = 'text/JavaScript'>";
//echo "<h4 style='text-align:center'>成功提交<a href='https://www.masada.com.tw/wms/sign/list.php?function_name=show&token=" . $request['token'] . "'>返回待签 </a></h4>";
if ($tosign) {
echo "alert('成功提交');";
echo "location.href='../wms/index.php.php?function_name=sign_list&token=" . $request['token'] . "';";
} else {
echo "alert('資料已保存');";
echo "location.href='../crm/crmm02-index.php?function_name=contract_customer&token=" . $request['token'] . "';";
}
echo "</script>";

8300
wms/css/bootstrap.min.css

File diff suppressed because one or more lines are too long

714
wms/header.php

@ -1,355 +1,361 @@
<?php
// ini_set('display_errors', 'off');
// 維護專用
// include "maintenance.php";
// $maintenancePeriod = "2023-11-17 15:30 AM 至 17:30 PM";
// $maintenancePage = new MaintenancePage($maintenancePeriod);
// $maintenancePage->displayPage();
function CreateToken($user_id, $user_name) {
date_default_timezone_set("Asia/Taipei");
$start_time = date("Y-m-d H:i:s");
$end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时
$info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天
$encryption_code = "MASADA!^***";
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
$signature = hash_hmac('md5', $info, $encryption_code);
//最后将这两部分拼接起来,得到最终的Token字符串
return $token = $info . '.' . $signature;
}
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
if (isset($_REQUEST["function_name"])) {
$function_name = $_REQUEST["function_name"];
$function_flag = True;
} else {
$function_name = "";
$function_flag = False;
}
/**
* 連線T8 MSSQL
*/
// try {
// $conn = new PDO("sqlsrv:Server=10.10.145.2;Database=T8MASADA", "masada", "@m222222");
// if ($conn) {
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// }
// } catch (PDOException $e) {
// //echo "fail";
// //echo $e->getMessage();
// }
/*****************************
* global:
* $token
* $token_link 含token的連結
* $user_id 使用者ID
* $user_name 使用者姓名
* $login_dt 登入時間
* $user_auth 使用權限:1,2,3
*****************************/
$token = $_REQUEST["token"];
if (count(explode(".", $token)) > 1) {
$token_link = "token=" . $_REQUEST["token"];
list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
$user_name = urldecode(base64_decode($enc_user_name));
} else {
$user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id;
$login_dt = !empty($_GET["timestamp"]) ? substr($_GET["timestamp"], 0, 10) : $login_dt;
$login_dt = date('Y-m-d H:i:s', $login_dt);
$user_name = accountid2name()[$user_id];
$token = CreateToken($user_id,$user_name);
$token_link = "token=" . $token;
}
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);
}
?>
<script>
res = eval("(" + JSON.stringify(<?php echo $login_json; ?>) + ")");
window.localStorage.setItem("menu_<?php echo $user_id; ?>", res.menu);
</script>
<?php
// echo $token;
// exit;
// uesr可操作權限
$user_auth = check_user_permission($user_id, $token);
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Masada後臺系統</title>
<link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/styles.css" />
<link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.css">
<style>
a svg {
display: inline-block;
vertical-align: text-top;
}
.nav .icon {
display: none;
}
input:read-only {
background-color: #eee5e5;
}
@media screen and (max-width: 992px) {
.header-right {
float: left !important;
margin-top: -40px;
margin-left: -15px;
}
/*.nav.navbar-nav a:not(:last-child), .dropdown {*/
.nav.navbar-nav a,
.dropdown {
display: none;
}
.nav.navbar-nav .icon {
color: #fff;
display: block;
position: fixed;
right: 0;
top: 0;
}
}
@media screen and (max-width: 992px) {
.nav.navbar-nav.responsive {
position: relative;
}
.nav.navbar-nav.responsive a.icon {
position: fixed;
right: 0;
top: 0;
}
.nav.navbar-nav.responsive li {
float: none;
display: block;
text-align: left;
}
.nav.navbar-nav.responsive .dropdown {
float: none;
}
.nav.navbar-nav.responsive .dropdown li {
position: relative;
}
.nav.navbar-nav.responsive .dropdown a {
display: block;
width: 100%;
text-align: left;
top: -10px;
line-height: 10px;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #000;
}
.nav.navbar-nav.responsive .dropdown ul {
width: 200px;
background-color: #fff;
}
.navbar-nav .open .dropdown-menu {
position: absolute;
}
}
@media screen and (max-width: 992px) {
#member_content_phone {
display: inline-grid !important;
}
}
</style>
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.dataTables.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/dataTables.bootstrap4.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/function.js"></script>
<script>
$(document).ready(function() {
if ($('#table_index').length !== 0) $('#table_index').DataTable();
if (window.localStorage) {
//var tokendata=window.localStorage.getItem("token");
//var namedata=window.localStorage.getItem("name");
//var logindata=window.localStorage.getItem("login");
var menudata = window.localStorage.getItem("menu_<?php echo $user_id; ?>");
//if(tokendata==null || namedata==null || menudata==null){
if (menudata == null) {
window.location.href = "<?php dirname(__DIR__); ?>/wms/login.php";
}
} else {
// var tokendata=$.cookie("token");
}
var url = "<?php dirname(__DIR__); ?>/wms/headerapi.php";
$.ajax({
method: 'post',
url: url,
data: {
token: '<?php echo $token; ?>'
},
success: function(data) {
var res = eval('(' + data + ')');
//console.log(res);
if (res.code != '200') {
window.location.href = '<?php dirname(__DIR__); ?>/wms/login.php?errno=3';
}
}
});
var mdata = JSON.parse(menudata);
var menuStr = '';
var checkAuth = 0;
var m = 1;
for (var i in mdata) {
menuStr += '<li class="dropdown">';
menuStr += '<a class="dropdown-toggle" data-toggle="dropdown" href="#">' + i;
menuStr += '<span class="caret"></span></a>';
menuStr += '<ul class="dropdown-menu">';
for (var j in mdata[i]) {
for (var k in mdata[i][j]) {
menuStr += '<li';
if (k == '<?php echo $function_name; ?>') menuStr += " class='active'";
menuStr += '><a href="<?php dirname(__DIR__); ?>/wms/' + mdata[i][j][k] + '?function_name=' + k + '&<?php echo $token_link; ?>"';
if (k.indexOf('open-') !== -1) menuStr += ' target="_blank"';
menuStr += '>' + j + '</a></li>';
if (mdata[i][j][k] == window.location.pathname) checkAuth = 1;
m++;
}
}
menuStr += '</ul>';
menuStr += '</li>';
}
menuStr += '<li><a href="javascript:void(0);" class="icon" onclick="myFunction()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grid-3x3-gap-fill" viewBox="0 0 16 16"><path d="M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V2zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V7zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2z"/></svg></a></li>';
/*
if (checkAuth == 0 && ('/wms/custom-create.php' != window.location.pathname)) {
window.location.href='login.php?errno=4';
}
*/
$('#menu_content').html(menuStr);
$('.dropdown a').on('click', function() {
$('.dropdown').removeClass('open');
});
});
function myFunction() {
var x = document.getElementById("menu_content");
if (x.className === "nav navbar-nav") {
x.className += " responsive";
} else {
x.className = "nav navbar-nav";
}
}
</script>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="<?php dirname(__DIR__); ?>/wms/index.php?<?php echo $token_link; ?>">Masada</a>
</div>
<ul class="nav navbar-nav" id="menu_content">
</ul>
<!--
<div class="topnav" id="myTopnav">
<a href="#home" class="active">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<div class="dropdown">
<button class="dropbtn">Dropdown
<span class="caret"></span></a>
</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<a href="#about">About</a>
<a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
</div>
-->
<div class="header-right">
<ul class="nav navbar-nav" id="member_content">
<li class="dropdown d-lg-none">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" style='padding:0px;padding-top:5px;'>
<?php echo $user_name . "(" . $user_id . ")" . "<br/>" . $login_dt; ?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<rect width="24" height="24" fill="white"></rect>
<path d="M2.5 12C2.5 12.2761 2.72386 12.5 3 12.5C3.27614 12.5 3.5 12.2761 3.5 12H2.5ZM3.5 12C3.5 7.30558 7.30558 3.5 12 3.5V2.5C6.75329 2.5 2.5 6.75329 2.5 12H3.5ZM12 3.5C15.3367 3.5 18.2252 5.4225 19.6167 8.22252L20.5122 7.77748C18.9583 4.65062 15.7308 2.5 12 2.5V3.5Z" fill="#000000"></path>
<path d="M20.4716 2.42157V8.07843H14.8147" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M21.5 12C21.5 11.7239 21.2761 11.5 21 11.5C20.7239 11.5 20.5 11.7239 20.5 12L21.5 12ZM20.5 12C20.5 16.6944 16.6944 20.5 12 20.5L12 21.5C17.2467 21.5 21.5 17.2467 21.5 12L20.5 12ZM12 20.5C8.66333 20.5 5.77477 18.5775 4.38328 15.7775L3.48776 16.2225C5.04168 19.3494 8.26923 21.5 12 21.5L12 20.5Z" fill="#000000"></path>
<path d="M3.52844 21.5784L3.52844 15.9216L9.18529 15.9216" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</svg>
更改密碼
</a>
</li>
<li>
<a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg>
登出
</a>
</li>
</ul>
</li>
</ul>
<div id="member_content_phone" style="display:none">
<span class="navbar-brand">
<h5><?php echo $user_name . "(" . $user_id . ")" . $login_dt; ?></h5>
</span>
<a href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
更改密碼</a>
<a href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg>
登出</a>
</div>
</div>
<?php
// ini_set('display_errors', 'off');
// 維護專用
// include "maintenance.php";
// $maintenancePeriod = "2023-11-17 15:30 AM 至 17:30 PM";
// $maintenancePage = new MaintenancePage($maintenancePeriod);
// $maintenancePage->displayPage();
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
function CreateToken($user_id, $user_name)
{
date_default_timezone_set("Asia/Taipei");
$start_time = date("Y-m-d H:i:s");
$end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时
$info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天
$encryption_code = "MASADA!^***";
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
$signature = hash_hmac('md5', $info, $encryption_code);
//最后将这两部分拼接起来,得到最终的Token字符串
return $token = $info . '.' . $signature;
}
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
if (isset($_REQUEST["function_name"])) {
$function_name = $_REQUEST["function_name"];
$function_flag = True;
} else {
$function_name = "";
$function_flag = False;
}
/**
* 連線T8 MSSQL
*/
// try {
// $conn = new PDO("sqlsrv:Server=10.10.145.2;Database=T8MASADA", "masada", "@m222222");
// if ($conn) {
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// }
// } catch (PDOException $e) {
// //echo "fail";
// //echo $e->getMessage();
// }
/*****************************
* global:
* $token
* $token_link 含token的連結
* $user_id 使用者ID
* $user_name 使用者姓名
* $login_dt 登入時間
* $user_auth 使用權限:1,2,3
*****************************/
$token = $_REQUEST["token"];
if (count(explode(".", $token)) > 1) {
$token_link = "token=" . $_REQUEST["token"];
list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
$user_name = urldecode(base64_decode($enc_user_name));
} else {
$user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id;
$login_dt = !empty($_GET["timestamp"]) ? substr($_GET["timestamp"], 0, 10) : $login_dt;
$login_dt = date('Y-m-d H:i:s', $login_dt);
$user_name = accountid2name()[$user_id];
$token = CreateToken($user_id, $user_name);
$token_link = "token=" . $token;
}
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);
}
?>
<script>
res = eval("(" + JSON.stringify(<?php echo $login_json; ?>) + ")");
window.localStorage.setItem("menu_<?php echo $user_id; ?>", res.menu);
</script>
<?php
// echo $token;
// exit;
// uesr可操作權限
$user_auth = check_user_permission($user_id, $token);
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Masada後臺系統</title>
<link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/styles.css" />
<link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.css">
<style>
a svg {
display: inline-block;
vertical-align: text-top;
}
.nav .icon {
display: none;
}
input:read-only {
background-color: #eee5e5;
}
@media screen and (max-width: 992px) {
.header-right {
float: left !important;
margin-top: -40px;
margin-left: -15px;
}
/*.nav.navbar-nav a:not(:last-child), .dropdown {*/
.nav.navbar-nav a,
.dropdown {
display: none;
}
.nav.navbar-nav .icon {
color: #fff;
display: block;
position: fixed;
right: 0;
top: 0;
}
}
@media screen and (max-width: 992px) {
.nav.navbar-nav.responsive {
position: relative;
}
.nav.navbar-nav.responsive a.icon {
position: fixed;
right: 0;
top: 0;
}
.nav.navbar-nav.responsive li {
float: none;
display: block;
text-align: left;
}
.nav.navbar-nav.responsive .dropdown {
float: none;
}
.nav.navbar-nav.responsive .dropdown li {
position: relative;
}
.nav.navbar-nav.responsive .dropdown a {
display: block;
width: 100%;
text-align: left;
top: -10px;
line-height: 10px;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #000;
}
.nav.navbar-nav.responsive .dropdown ul {
width: 200px;
background-color: #fff;
}
.navbar-nav .open .dropdown-menu {
position: absolute;
}
}
@media screen and (max-width: 992px) {
#member_content_phone {
display: inline-grid !important;
}
}
</style>
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.dataTables.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/dataTables.bootstrap4.min.js"></script>
<script src="<?php dirname(__DIR__); ?>/wms/css/function.js"></script>
<script>
$(document).ready(function() {
if ($('#table_index').length !== 0) $('#table_index').DataTable();
if (window.localStorage) {
//var tokendata=window.localStorage.getItem("token");
//var namedata=window.localStorage.getItem("name");
//var logindata=window.localStorage.getItem("login");
var menudata = window.localStorage.getItem("menu_<?php echo $user_id; ?>");
//if(tokendata==null || namedata==null || menudata==null){
if (menudata == null) {
window.location.href = "<?php dirname(__DIR__); ?>/wms/login.php";
}
} else {
// var tokendata=$.cookie("token");
}
var url = "<?php dirname(__DIR__); ?>/wms/headerapi.php";
$.ajax({
method: 'post',
url: url,
data: {
token: '<?php echo $token; ?>'
},
success: function(data) {
var res = eval('(' + data + ')');
//console.log(res);
if (res.code != '200') {
window.location.href = '<?php dirname(__DIR__); ?>/wms/login.php?errno=3';
}
}
});
var mdata = JSON.parse(menudata);
var menuStr = '';
var checkAuth = 0;
var m = 1;
for (var i in mdata) {
menuStr += '<li class="dropdown">';
menuStr += '<a class="dropdown-toggle" data-toggle="dropdown" href="#">' + i;
menuStr += '<span class="caret"></span></a>';
menuStr += '<ul class="dropdown-menu">';
for (var j in mdata[i]) {
for (var k in mdata[i][j]) {
menuStr += '<li';
if (k == '<?php echo $function_name; ?>') menuStr += " class='active'";
menuStr += '><a href="<?php dirname(__DIR__); ?>/wms/' + mdata[i][j][k] + '?function_name=' + k + '&<?php echo $token_link; ?>"';
if (k.indexOf('open-') !== -1) menuStr += ' target="_blank"';
menuStr += '>' + j + '</a></li>';
if (mdata[i][j][k] == window.location.pathname) checkAuth = 1;
m++;
}
}
menuStr += '</ul>';
menuStr += '</li>';
}
menuStr += '<li><a href="javascript:void(0);" class="icon" onclick="myFunction()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grid-3x3-gap-fill" viewBox="0 0 16 16"><path d="M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V2zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V7zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2z"/></svg></a></li>';
/*
if (checkAuth == 0 && ('/wms/custom-create.php' != window.location.pathname)) {
window.location.href='login.php?errno=4';
}
*/
$('#menu_content').html(menuStr);
$('.dropdown a').on('click', function() {
$('.dropdown').removeClass('open');
});
});
function myFunction() {
var x = document.getElementById("menu_content");
if (x.className === "nav navbar-nav") {
x.className += " responsive";
} else {
x.className = "nav navbar-nav";
}
}
</script>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="<?php dirname(__DIR__); ?>/wms/index.php?<?php echo $token_link; ?>">Masada</a>
</div>
<ul class="nav navbar-nav" id="menu_content">
</ul>
<!--
<div class="topnav" id="myTopnav">
<a href="#home" class="active">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<div class="dropdown">
<button class="dropbtn">Dropdown
<span class="caret"></span></a>
</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<a href="#about">About</a>
<a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a>
</div>
-->
<div class="header-right">
<ul class="nav navbar-nav" id="member_content">
<li class="dropdown d-lg-none">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" style='padding:0px;padding-top:5px;'>
<?php echo $user_name . "(" . $user_id . ")" . "<br/>" . $login_dt; ?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<rect width="24" height="24" fill="white"></rect>
<path d="M2.5 12C2.5 12.2761 2.72386 12.5 3 12.5C3.27614 12.5 3.5 12.2761 3.5 12H2.5ZM3.5 12C3.5 7.30558 7.30558 3.5 12 3.5V2.5C6.75329 2.5 2.5 6.75329 2.5 12H3.5ZM12 3.5C15.3367 3.5 18.2252 5.4225 19.6167 8.22252L20.5122 7.77748C18.9583 4.65062 15.7308 2.5 12 2.5V3.5Z" fill="#000000"></path>
<path d="M20.4716 2.42157V8.07843H14.8147" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M21.5 12C21.5 11.7239 21.2761 11.5 21 11.5C20.7239 11.5 20.5 11.7239 20.5 12L21.5 12ZM20.5 12C20.5 16.6944 16.6944 20.5 12 20.5L12 21.5C17.2467 21.5 21.5 17.2467 21.5 12L20.5 12ZM12 20.5C8.66333 20.5 5.77477 18.5775 4.38328 15.7775L3.48776 16.2225C5.04168 19.3494 8.26923 21.5 12 21.5L12 20.5Z" fill="#000000"></path>
<path d="M3.52844 21.5784L3.52844 15.9216L9.18529 15.9216" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</svg>
更改密碼
</a>
</li>
<li>
<a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg>
登出
</a>
</li>
</ul>
</li>
</ul>
<div id="member_content_phone" style="display:none">
<span class="navbar-brand">
<h5><?php echo $user_name . "(" . $user_id . ")" . $login_dt; ?></h5>
</span>
<a href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
更改密碼</a>
<a href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg>
登出</a>
</div>
</div>
</nav>

8300
wms/mkt/css/bootstrap.min.css

File diff suppressed because one or more lines are too long

4096
wms/mkt/specsurvey-create.php

File diff suppressed because it is too large

3851
wms/mkt/specsurvey-edit.php

File diff suppressed because it is too large

3812
wms/mkt/specsurvey-view.php

File diff suppressed because it is too large

4087
wms/mkt/specsurvey_renovate-create.php

File diff suppressed because it is too large

3811
wms/mkt/specsurvey_renovate-view.php

File diff suppressed because it is too large

432
wms/rib01-create.php

@ -1,218 +1,216 @@
<?php
use function PHPSTORM_META\type;
include "./header.php";
// 產生mysql單據編號
$MaxBillNo = 0;
$curreny_date = date('ym');
$query_rib = array();
$sqlname = "C" . $user_id;
$sqlname .= $curreny_date;
$date_sql = "SELECT BillNo from rib WHERE (BillNo LIKE '$sqlname%')";
$query_rib = mysqli_query($link, $date_sql);
$myNo = mysqli_fetch_all($query_rib);
foreach ($myNo as $thisMyNo) {
$thisMyNo = (int)substr($thisMyNo[0], -2);
if ($thisMyNo > $MaxBillNo) {
$MaxBillNo = $thisMyNo;
}
}
$BillNo = $sqlname;
$today = (int)date('Ymd');
// 連線T8MASADA
$member = array();
//取得人員名單與使用者的部門
$sql_mydept = "SELECT UserId, Username FROM capMembership WHERE ValidityToDate >$today";
$deptmem = $conn->query($sql_mydept);
foreach ($deptmem as $mem) {
$userid = $mem['UserId'];
$username = $mem['Username'];
$member["$userid"] = [$username];
};
$sql_dept = "SELECT DeptId, PersonId FROM comPerson WHERE (DeptId!='0001')";
$allpeople = $conn->query($sql_dept);
foreach ($allpeople as $man) {
if ($man['PersonId'] == $user_id) {
$mydepart = $man['DeptId'];
}
$personid = $man['PersonId'];
$depart = $man['DeptId'];
if (isset($member["$personid"])) {
array_push($member["$personid"], "$depart");
};
}
//取得部門代碼
$sql_department = "SELECT DeptId,DeptName FROM comDepartment WHERE DeptId!='0001'";
$deptype = $conn->query($sql_department);
$MaxBillNo += 1;
if ($MaxBillNo < 10) {
$BillNo .= "0" . strval($MaxBillNo);
} else {
$BillNo .= strval($MaxBillNo);
}
?>
<div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;">
<a href="rib01-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-home"></span>
</a>
</div>
</div>
<div class="container" id="ribadd">
<div class="text-center">
<h3>報銷單據</h3>
</div>
<form class="form-horizontal" name="ribadd" id="ribadd" method="POST" action="rib01-submit.php?submit=add&state=0&<?= $token_link ?>" enctype="multipart/form-data">
<div class="form-group">
<div class="col-md-3">
<label for="BillNo" style="color: red;">單據編號</label>
<input class="form-control" type="text" name="BillNo" id="BillNo" value="<?php echo $BillNo ?>" disabled>
</div>
<div class="col-md-3">
<label for="BillDate" style="color: red;">單據日期</label>
<input class="form-control" type="number" name="BillDate" id="BillDate" value=<?= date('Ymd') ?> placeholder="西元年(4碼)+月(2碼)+日(2碼)" disabled>
</div>
<div class="col-md-3">
<label for="CurrId" style="color: red;">幣別</label>
<select name="CurrId" id="CurrId" class="form-control">
<option value="TWD" selected>台幣</option>
<option value="CNY">人民幣</option>
<option value="EUR">歐元</option>
<option value="HKD">港幣</option>
<option value="USD">美元</option>
</select>
</div>
<div class="col-md-3">
<label for="TransactId" style="color: red;">經辦人</label>
<select name="TransactId" class="form-control" required>
<option value="<?php echo $user_id; ?>"> <?php echo $user_name; ?> </option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="DeptId" style="color: red;">報銷單位</label>
<select name="DeptId" id="DeptId" class="form-control" required>
<?php
foreach ($deptype as $dept) { ?>
<option value="<?php echo $dept['DeptId']; ?>" <?php
if ($dept['DeptId'] == $mydepart) {
echo "selected";
} ?>><?php echo $dept['DeptName']; ?></option>
<?php };
?>
</select>
</div>
<div class="col-md-3">
<label for="WriteOffId" style="color: red;">報銷人</label>
<select name="WriteOffId" id="WriteOffId" class="form-control" required>
<option value="" style="display:flex" id="WriteOffoption">請選擇報銷人</option>
<?php
foreach ($member as $key => $value) { ?>
<!-- <option value="<?php echo $value['UserId']; ?>" style="display:none" id="<?= 'WriteOff' . $value['UserId'] . $key ?>" <?php if ($value['UserId'] == $user_id) {
echo "selected";
} ?>> <?php echo $value['Username']; ?> </option> -->
<option value="<?php echo $key; ?>" id="<?= 'WriteOff' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected";
} ?>> <?php echo $value[0]; ?> </option>
<?php }
?>
</select>
</div>
<div class="col-md-3">
<label for="pay_type">付款方式</label>
<select name="pay_type" id="pay_type" class="form-control" required>
<option value=0>現金</option>
<option value=1 selected>銀行轉帳</option>
</select>
</div>
<div class="col-md-3">
<label for="GatheringPersonId" style="color: red;">收款人</label>
<select name="GatheringPersonId" id="GatheringPersonId" class="form-control">
<option value="" style="display:flex" id="GatheringOption">請選擇收款人</option>
<?php
// foreach ($deptmem as $key => $value) {
foreach ($member as $key => $value) {
?>
<!-- <option value="<?php echo $value['accountid']; ?>" id="<?= 'Gathering' . $value['department_id'] ?>" <?php if ($value['accountid'] == $user_id) {
echo "selected";
} ?>> <?php echo $value['name']; ?> </option> -->
<option value="<?php echo $key; ?>" id="<?= 'Gathering' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected";
} ?>> <?php echo $value[0]; ?> </option>
<?php }; ?>
</select>
</div>
</div>
<div class="form-group">
</div>
<hr>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="type" id="type" value="rib">
<div class="form-group">
<div class="col-md-3">
</div>
<div class="col-md-9 ">
<button onclick="send()" class="btn btn-primary btn-lg pull-right">下一步</button>
</div>
</div>
</form>
</div>
<script>
$(function() {
$("#DeptId").change(function() {
changeWriteOffId($('#DeptId').val());
})
})
function changeWriteOffId(SelectedDept) {
var GatheringSelectDeptId = 'Gathering' + SelectedDept + "-";
var SelectDeptId = 'WriteOff' + SelectedDept + "-";
for (var i = 0; i < WriteOffId.options.length; i++) {
WriteOffId.options[i].selected = false;
let thisid = WriteOffId.options[i].id
if (thisid.search(SelectDeptId) === 0) {
WriteOffId.options[i].style['display'] = '';
} else {
WriteOffId.options[i].style['display'] = 'none';
};
};
for (var j = 0; j < GatheringPersonId.options.length; j++) {
let Gatherid = GatheringPersonId.options[j].id
if (Gatherid.search(GatheringSelectDeptId) === 0 || GatheringPersonId.options[j].value === "<?= $user_id ?>") {
GatheringPersonId.options[j].style['display'] = '';
} else {
GatheringPersonId.options[j].style['display'] = 'none';
};
}
};
function send() {
$("#BillNo").prop("disabled", false);
$('#ribadd').submit();
}
<?php
use function PHPSTORM_META\type;
include "./header.php";
// 產生mysql單據編號
$MaxBillNo = 0;
$curreny_date = date('ym');
$query_rib = array();
$sqlname = "C" . $user_id;
$sqlname .= $curreny_date;
$date_sql = "SELECT BillNo from rib WHERE (BillNo LIKE '$sqlname%')";
$query_rib = mysqli_query($link, $date_sql);
$myNo = mysqli_fetch_all($query_rib);
foreach ($myNo as $thisMyNo) {
$thisMyNo = (int)substr($thisMyNo[0], -2);
if ($thisMyNo > $MaxBillNo) {
$MaxBillNo = $thisMyNo;
}
}
$BillNo = $sqlname;
$today = (int)date('Ymd');
// 連線T8MASADA
$member = array();
//取得人員名單與使用者的部門
$sql_mydept = "SELECT UserId, Username FROM capMembership WHERE ValidityToDate >$today";
$deptmem = $conn->query($sql_mydept);
foreach ($deptmem as $mem) {
$userid = $mem['UserId'];
$username = $mem['Username'];
$member["$userid"] = [$username];
};
// print_r($member);
$sql_dept = "SELECT DeptId, PersonId FROM comPerson WHERE (DeptId!='0001')";
$allpeople = $conn->query($sql_dept);
foreach ($allpeople as $man) {
if ($man['PersonId'] == $user_id) {
$mydepart = $man['DeptId'];
}
$personid = $man['PersonId'];
$depart = $man['DeptId'];
if (isset($member["$personid"])) {
array_push($member["$personid"], "$depart");
};
}
//取得部門代碼
$sql_department = "SELECT DeptId,DeptName FROM comDepartment WHERE DeptId!='0001'";
$deptype = $conn->query($sql_department);
$MaxBillNo += 1;
if ($MaxBillNo < 10) {
$BillNo .= "0" . strval($MaxBillNo);
} else {
$BillNo .= strval($MaxBillNo);
}
?>
<div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;">
<a href="rib01-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-home"></span>
</a>
</div>
</div>
<div class="container" id="ribadd">
<div class="text-center">
<h3>報銷單據</h3>
</div>
<form class="form-horizontal" name="ribadd" id="ribadd" method="POST" action="rib01-submit.php?submit=add&state=0&<?= $token_link ?>" enctype="multipart/form-data">
<div class="form-group">
<div class="col-md-3">
<label for="BillNo" style="color: red;">單據編號</label>
<input class="form-control" type="text" name="BillNo" id="BillNo" value="<?php echo $BillNo ?>" disabled>
</div>
<div class="col-md-3">
<label for="BillDate" style="color: red;">單據日期</label>
<input class="form-control" type="number" name="BillDate" id="BillDate" value=<?= date('Ymd') ?> placeholder="西元年(4碼)+月(2碼)+日(2碼)" disabled>
</div>
<div class="col-md-3">
<label for="CurrId" style="color: red;">幣別</label>
<select name="CurrId" id="CurrId" class="form-control">
<option value="TWD" selected>台幣</option>
<option value="CNY">人民幣</option>
<option value="EUR">歐元</option>
<option value="HKD">港幣</option>
<option value="USD">美元</option>
</select>
</div>
<div class="col-md-3">
<label for="TransactId" style="color: red;">經辦人</label>
<select name="TransactId" class="form-control" required>
<option value="<?php echo $user_id; ?>"> <?php echo $user_name; ?> </option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="DeptId" style="color: red;">報銷單位</label>
<select name="DeptId" id="DeptId" class="form-control" required>
<?php
foreach ($deptype as $dept) { ?>
<option value="<?php echo $dept['DeptId']; ?>" <?php
if ($dept['DeptId'] == $mydepart) {
echo "selected";
} ?>><?php echo $dept['DeptName']; ?></option>
<?php };
?>
</select>
</div>
<div class="col-md-3">
<label for="WriteOffId" style="color: red;">報銷人</label>
<select name="WriteOffId" id="WriteOffId" class="form-control" required>
<option value="" style="display:flex" id="WriteOffoption">請選擇報銷人</option>
<?php
foreach ($member as $key => $value) { ?>
<option value="<?php echo $key; ?>" id="<?= 'WriteOff' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected";
} ?>> <?php echo $value[0]; ?> </option>
<?php }
?>
</select>
</div>
<div class="col-md-3">
<label for="pay_type">付款方式</label>
<select name="pay_type" id="pay_type" class="form-control" required>
<option value=0>現金</option>
<option value=1 selected>銀行轉帳</option>
</select>
</div>
<div class="col-md-3">
<label for="GatheringPersonId" style="color: red;">收款人</label>
<select name="GatheringPersonId" id="GatheringPersonId" class="form-control">
<option value="" style="display:flex" id="GatheringOption">請選擇收款人</option>
<?php
// foreach ($deptmem as $key => $value) {
foreach ($member as $key => $value) {
?>
<!-- <option value="<?php echo $value['accountid']; ?>" id="<?= 'Gathering' . $value['department_id'] ?>" <?php if ($value['accountid'] == $user_id) {
echo "selected";
} ?>> <?php echo $value['name']; ?> </option> -->
<option value="<?php echo $key; ?>" id="<?= 'Gathering' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected";
} ?>> <?php echo $value[0]; ?> </option>
<?php }; ?>
</select>
</div>
</div>
<div class="form-group">
</div>
<hr>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="type" id="type" value="rib">
<div class="form-group">
<div class="col-md-3">
</div>
<div class="col-md-9 ">
<button onclick="send()" class="btn btn-primary btn-lg pull-right">下一步</button>
</div>
</div>
</form>
</div>
<script>
$(function() {
$("#DeptId").change(function() {
changeWriteOffId($('#DeptId').val());
})
})
function changeWriteOffId(SelectedDept) {
var GatheringSelectDeptId = 'Gathering' + SelectedDept + "-";
var SelectDeptId = 'WriteOff' + SelectedDept + "-";
for (var i = 0; i < WriteOffId.options.length; i++) {
WriteOffId.options[i].selected = false;
let thisid = WriteOffId.options[i].id
if (thisid.search(SelectDeptId) === 0) {
WriteOffId.options[i].style['display'] = '';
} else {
WriteOffId.options[i].style['display'] = 'none';
};
};
for (var j = 0; j < GatheringPersonId.options.length; j++) {
let Gatherid = GatheringPersonId.options[j].id
if (Gatherid.search(GatheringSelectDeptId) === 0 || GatheringPersonId.options[j].value === "<?= $user_id ?>") {
GatheringPersonId.options[j].style['display'] = '';
} else {
GatheringPersonId.options[j].style['display'] = 'none';
};
}
};
function send() {
$("#BillNo").prop("disabled", false);
$('#ribadd').submit();
}
</script>

13
wms/sign/list.php

@ -32,8 +32,16 @@ $sql_get = "SELECT c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_a
$where_system_id
$where_flow_id
";
echo $sql_get;
$result = mysqli_query($link, $sql_get);
if ($result == false) {
die(mysqli_error($link));
}
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
// echo '<pre>';
// print_r($res_get);
// echo '</pre>';
// exit;
$system_name_opt = array_map(function ($item) {
return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']);
@ -146,12 +154,13 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
<?php
$rowspan = 1;
$path = "localhost:3000/wms/sign/list.php";
foreach ($res_get as $key => $data) :
//嘗試將已結案隱藏起來 : 測試使用者體驗
if ($data['flow_code'] !== 'Z') {
?>
<tr>
<td><a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>"><?= $data['form_key']; ?></a></td>
<td><a target="_blank" href="<?= $path . "?form_key=" . $data['form_key'] . "&token=$token" ?>"><?= $data['form_key']; ?></a></td>
<td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['update_date']; ?></td>

Loading…
Cancel
Save