diff --git a/mkt/IncludeCommon.php b/mkt/IncludeCommon.php index bf89ca4f..67ebdd7d 100644 --- a/mkt/IncludeCommon.php +++ b/mkt/IncludeCommon.php @@ -1,110 +1,115 @@ - $explode[2]) { - $data['user_id'] = ''; - $data['user_name'] = ''; - $data['code'] = '401'; - $data['message'] = 'Token已过期,请重新登录'; - return $data; - } - if ($true_signature == $explode[4]) { - $data['user_id'] = $explode[0]; - $data['user_name'] = $explode[3]; - $data['code'] = '200'; - $data['message'] = 'Token合法'; - return $data; - } else { - $data['user_id'] = ''; - $data['user_name'] = ''; - $data['code'] = '400'; - $data['message'] = 'Token不合法'; - return $data; - } - } else { - $data['user_id'] = ''; - $data['user_name'] = ''; - $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 . '.' . $start_time . '.' . $end_time . '.' . $user_name; //设置token过期时间为一天 - $encryption_code = "MASADA!^***"; - //根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量) - $signature = hash_hmac('md5', $info, $encryption_code); - //最后将这两部分拼接起来,得到最终的Token字符串 - return $token = $info . '.' . $signature; - } -//生成菜单 - - function menu ($from='tw',$type){ - $function_type = array( - "tw" => array( - # F角色菜单 - "H" => 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]; - - } -} \ No newline at end of file + $explode[2]) { + $data['user_id'] = ''; + $data['user_name'] = ''; + $data['code'] = '401'; + $data['message'] = 'Token已過期,請重新登入'; + return $data; + } + if ($true_signature == $explode[4]) { + $data['user_id'] = $explode[0]; + $data['user_name'] = $explode[3]; + $data['code'] = '200'; + $data['message'] = 'Token合法'; + return $data; + } else { + $data['user_id'] = ''; + $data['user_name'] = ''; + $data['code'] = '400'; + $data['message'] = 'Token不合法'; + return $data; + } + } else { + $data['user_id'] = ''; + $data['user_name'] = ''; + $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 . '.' . $start_time . '.' . $end_time . '.' . $user_name; //设置token过期时间为一天 + $encryption_code = "MASADA!^***"; + //根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量) + $signature = hash_hmac('md5', $info, $encryption_code); + //最后将这两部分拼接起来,得到最终的Token字符串 + return $token = $info . '.' . $signature; + } + //生成菜单 + + function menu($from = 'tw', $type) + { + $function_type = array( + "tw" => array( + # F角色菜单 + "H" => 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]; + } +} diff --git a/mkt/contractapply-index.php b/mkt/contractapply-index.php index 226d875c..c15c05d8 100644 --- a/mkt/contractapply-index.php +++ b/mkt/contractapply-index.php @@ -1,140 +1,143 @@ - "制式新合約", "B" => "非制式新合約"]; -$status_arr = ["I" => "申請中", "P" => "在途中", "Y" => "已完成", "X" => "作廢"]; -?> -

- - - -

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
項次申請號卷號營業員合約書號申請日期立約人申請類別合約狀態合約狀態時間案件名稱含稅貨款含稅按裝款含稅給約總價二次款建檔人建檔時間
- -

- - - -

-
-
-There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); - -include "footer.php"; + "制式新合約", "B" => "非制式新合約"]; +$status_arr = ["I" => "申請中", "P" => "在途中", "Y" => "已完成", "X" => "作廢"]; +?> +

+ + + +

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次申請號卷號營業員合約書號申請日期立約人申請類別合約狀態合約狀態時間案件名稱含稅貨款含稅按裝款含稅給約總價二次款建檔人建檔時間
+ +

+ + + +

+
+
+There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; ?> \ No newline at end of file diff --git a/mkt/database.php b/mkt/database.php index 307b3a54..265d2a47 100644 --- a/mkt/database.php +++ b/mkt/database.php @@ -31,8 +31,8 @@ try { $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } } catch (PDOException $e) { - echo "fail"; - echo $e->getMessage(); + // echo "fail"; + // echo $e->getMessage(); } //print_r($link);exit; if($link){ diff --git a/wms/Bill.txt b/wms/Bill.txt new file mode 100644 index 00000000..c8685c63 --- /dev/null +++ b/wms/Bill.txt @@ -0,0 +1,3 @@ +Array +Array +Array diff --git a/wms/IncludeCommon.php b/wms/IncludeCommon.php index bd895628..b11be99b 100644 --- a/wms/IncludeCommon.php +++ b/wms/IncludeCommon.php @@ -1,212 +1,212 @@ - $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; - */ - } + $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; + */ + } } \ No newline at end of file diff --git a/wms/T8_APItest.php b/wms/T8_APItest.php index d327c6e5..6f89ee68 100644 --- a/wms/T8_APItest.php +++ b/wms/T8_APItest.php @@ -1,91 +1,91 @@ - - \ No newline at end of file diff --git a/wms/T8_Authorization.php b/wms/T8_Authorization.php index 0a18e7ed..f383ee47 100644 --- a/wms/T8_Authorization.php +++ b/wms/T8_Authorization.php @@ -1,37 +1,37 @@ - - - - + + + \ No newline at end of file diff --git a/wms/T8_assemble_apply.php b/wms/T8_assemble_apply.php index 293d0fd3..fea8f22b 100644 --- a/wms/T8_assemble_apply.php +++ b/wms/T8_assemble_apply.php @@ -1,71 +1,71 @@ - - \ No newline at end of file diff --git a/wms/T8_purBillOrder_search.php b/wms/T8_purBillOrder_search.php index e3ff95f4..91ebfa26 100644 --- a/wms/T8_purBillOrder_search.php +++ b/wms/T8_purBillOrder_search.php @@ -1,23 +1,23 @@ -query($sql_purBillOrder); -//每筆採購單資料 -foreach($purMaster as $master){ - //print_r($master); - $BillNo = $master['BillNo']; - - //每筆採購單明細資料 - $sql_purDetail = " - SELECT * FROM purBillOrderDetail WHERE BillNo = '$BillNo'"; - $purDetail = $conn->query($sql_purDetail); - foreach($purDetail as $detail){ - print_r($detail); - } - echo "
----------------------
"; - -} - +query($sql_purBillOrder); +//每筆採購單資料 +foreach($purMaster as $master){ + //print_r($master); + $BillNo = $master['BillNo']; + + //每筆採購單明細資料 + $sql_purDetail = " + SELECT * FROM purBillOrderDetail WHERE BillNo = '$BillNo'"; + $purDetail = $conn->query($sql_purDetail); + foreach($purDetail as $detail){ + print_r($detail); + } + echo "
----------------------
"; + +} + diff --git a/wms/T8_purRequestOrder_create.php b/wms/T8_purRequestOrder_create.php index 2b441114..4df7938a 100644 --- a/wms/T8_purRequestOrder_create.php +++ b/wms/T8_purRequestOrder_create.php @@ -1,45 +1,45 @@ -query($sql); +query($sql); $conn ->query($sql_sub); \ No newline at end of file diff --git a/wms/account-create.php b/wms/account-create.php index 89f2715d..73d8f839 100644 --- a/wms/account-create.php +++ b/wms/account-create.php @@ -1,180 +1,180 @@ - - -
- - Please fill up the required field!

"; - } else { - echo "

Record has added successfully

"; - } - } - */ - ?> - - - -
"> - - -
- - - - -
- -
- - - -
- -
- - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - -
- -
- - -
- -
- - -
- -
- - - -
- -
- - - -
-
- - -
-
- - -
-
- - -

-
- -
- - -

-
- -
- -
- - -
-
- - + + +
+ + Please fill up the required field!

"; + } else { + echo "

Record has added successfully

"; + } + } + */ + ?> + + + +
"> + + +
+ + + + +
+ +
+ + + +
+ +
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ + + +
+
+ + +
+
+ + +
+
+ + +

+
+ +
+ + +

+
+ +
+ +
+ + +
+
+ + diff --git a/wms/account-delete.php b/wms/account-delete.php index 84654d95..811f23a8 100644 --- a/wms/account-delete.php +++ b/wms/account-delete.php @@ -1,19 +1,19 @@ - \ No newline at end of file diff --git a/wms/account-edit.php b/wms/account-edit.php index 1d10b8f7..3892d111 100644 --- a/wms/account-edit.php +++ b/wms/account-edit.php @@ -1,173 +1,173 @@ -getMessage(), "\n"; - } -*/ - foreach($data as $data) : -?> - -
-
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
- - -
- -
- -
-
- - +getMessage(), "\n"; + } +*/ + foreach($data as $data) : +?> + +
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +
+ +
+
+ + diff --git a/wms/account-index-submit.php b/wms/account-index-submit.php index a00176f3..26e75cc4 100644 --- a/wms/account-index-submit.php +++ b/wms/account-index-submit.php @@ -1,85 +1,85 @@ -sendx($subject, $em_body, $sendlist, "永佳捷科技", "", $file); - echo json_encode([1, "信件發送成功"]); -} +sendx($subject, $em_body, $sendlist, "永佳捷科技", "", $file); + echo json_encode([1, "信件發送成功"]); +} diff --git a/wms/account-index.php b/wms/account-index.php index df0c2d3f..acba0023 100644 --- a/wms/account-index.php +++ b/wms/account-index.php @@ -1,198 +1,198 @@ - "客戶", "B" => "保養人員", "C" => "檢查人員", "D" => "契約人員", "M" => "員工", "E" => "管理員(IT)", "X" => "未分類"]; #A=客戶 B=保養人員 C=檢查人員 D=契約人員 E=管理人員 M=永佳捷員工 X=未分類 - -// 工務總處、王凱欣可瀏覽全部資料 -$sql = "select department_id from account where accountid = '$user_id'"; -$res = mysqli_query($link, $sql); -$row = mysqli_fetch_row($res); -$user_department_id = $row[0]; -mysqli_free_result($res); - -// 設置一個空陣列來放資料 -$data = array(); -// sql語法存在變數中 -$sql_cmd = sql_myself($user_id); -if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; -$sql = "SELECT * FROM account $sql_cmd ORDER BY id"; -// 用mysqli_query方法執行(sql語法)將結果存在變數中 -$data = mysqli_query($link, $sql); -?> - - - -

- - - -

-Please fill up the required field!

"; - } else { - header("Location:account-index.php"); - } - } - -?> - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
項次帳號類型帳號姓名電話地址電子郵件Line ID微信id遠端協助維修ID直屬主管建檔人建檔時間修改新人資料
- 連結 -

- - - -

-
- -
-
- -There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); - -include "footer.php"; - + "客戶", "B" => "保養人員", "C" => "檢查人員", "D" => "契約人員", "M" => "員工", "E" => "管理員(IT)", "X" => "未分類"]; #A=客戶 B=保養人員 C=檢查人員 D=契約人員 E=管理人員 M=永佳捷員工 X=未分類 + +// 工務總處、王凱欣可瀏覽全部資料 +$sql = "select department_id from account where accountid = '$user_id'"; +$res = mysqli_query($link, $sql); +$row = mysqli_fetch_row($res); +$user_department_id = $row[0]; +mysqli_free_result($res); + +// 設置一個空陣列來放資料 +$data = array(); +// sql語法存在變數中 +$sql_cmd = sql_myself($user_id); +if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; +$sql = "SELECT * FROM account $sql_cmd ORDER BY id"; +// 用mysqli_query方法執行(sql語法)將結果存在變數中 +$data = mysqli_query($link, $sql); +?> + + + +

+ + + +

+Please fill up the required field!

"; + } else { + header("Location:account-index.php"); + } + } + +?> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次帳號類型帳號姓名電話地址電子郵件Line ID微信id遠端協助維修ID直屬主管建檔人建檔時間修改新人資料
+ 連結 +

+ + + +

+
+ +
+
+ +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; + ?> \ No newline at end of file diff --git a/wms/account-receivable-check.php b/wms/account-receivable-check.php index ce07ccdc..4ed786aa 100644 --- a/wms/account-receivable-check.php +++ b/wms/account-receivable-check.php @@ -1,245 +1,201 @@ - - -
- -
- - - -
- -
-
-
-

-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
-
- - -
-
- - -
-
- - -
-
-
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
簽約款二次款貨抵工地款安裝款試車款官檢款交車款尾款
合約金額
目前應收
-
- - - - - - - - - - - - - - - - - - - - - -
目前應收已開發票金額未開發票金額已收金額未收金額
-
- - - -
-
- - - - -
- - - - - - - - - - - - - - - - - $invoice) { ?> - - - - - - - - - - - - - - - -
發票號碼發票日期發票狀態發票金額收款日期收款金額內含手續費
-
- \ No newline at end of file diff --git a/wms/account-receivable-contract.php b/wms/account-receivable-contract.php index 9eda5895..dc849699 100644 --- a/wms/account-receivable-contract.php +++ b/wms/account-receivable-contract.php @@ -1,39 +1,245 @@ -"; -$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName -FROM salOrderStagePay AS a -LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo -LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId -WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4)"; - -$contract = $conn->query($sql_contract); -foreach ($contract as $cont) { - if ($cont['BillNo'] == 'SO20230801002') { - $BillNo = 'M231067'; - }else{ - $BillNo = $cont['BillNo']; - }; - $PayStage = $cont['PayStage']; - $PayAmount = $cont['PlanPayAmt']; - $partnerName = $cont['BizPartnerName']; - if(isset($arrayData[$BillNo])){ - array_push($arrayData[$BillNo], $PayStage); - array_push($arrayData[$BillNo], $PayAmount); - - }else{ - $arrayData[$BillNo][0] = $BillNo; - $arrayData[$BillNo][1] = $partnerName; - array_push($arrayData[$BillNo], $PayStage); - array_push($arrayData[$BillNo], $PayAmount); - - } -}; -foreach($arrayData as $data){ - foreach($data as $value){ - echo $value.";"; - } - echo "
"; -} \ No newline at end of file +"; +$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName +FROM salOrderStagePay AS a +LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo +LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId +WHERE s.BillNo = '$BillNo'"; + +// T8發票 +//M220478 +$sql_invoice = "SELECT DISTINCT +a.InvoiceNo, a.InvoiceTime,a.OAmountWithTax,a.InvoiceState, +b.ProjectId +FROM arSellInvoice as a +LEFT JOIN arSellInvoiceMaterial as b +ON a.BillNo=b.BillNo +WHERE b.ProjectId='$BillNo'"; + +$contract = $conn->query($sql_contract); +$invoices = $conn->query($sql_invoice); + +// foreach($contract as $con){ +// print_r($con); +// echo "
"; +// } + + + + + +// foreach ($contract as $cont) { +// if ($cont['BillNo'] == 'SO20230801002') { +// $BillNo = 'M231067'; +// }else{ +// $BillNo = $cont['BillNo']; +// }; +// $PayStage = $cont['PayStage']; +// $PayAmount = $cont['PlanPayAmt']; +// $partnerName = $cont['BizPartnerName']; +// if(isset($arrayData[$BillNo])){ +// array_push($arrayData[$BillNo], $PayStage); +// array_push($arrayData[$BillNo], $PayAmount); + +// }else{ +// $arrayData[$BillNo][0] = $BillNo; +// $arrayData[$BillNo][1] = $partnerName; +// array_push($arrayData[$BillNo], $PayStage); +// array_push($arrayData[$BillNo], $PayAmount); + +// } +// }; +// foreach($arrayData as $data){ +// foreach($data as $value){ +// echo $value.";"; +// } +// echo "
"; +// } + + + +?> + +
+
+

+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
目前應收已開發票金額未開發票金額已收金額未收金額
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
簽約款二次款貨抵工地款安裝款試車款官檢款交車款
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
發票號碼發票日期發票金額收款日期收款金額說明功能
+ + + + + +
+
+ \ No newline at end of file diff --git a/wms/account-receivable-excel.php b/wms/account-receivable-excel.php index c6ac37d9..5fe16fc4 100644 --- a/wms/account-receivable-excel.php +++ b/wms/account-receivable-excel.php @@ -1,51 +1,102 @@ $value) { - // for ($i = 0; $i < 17; $i++) { - // $value[$i] = (isset($value[$i])) ? $value[$i] : 0; - // } - $value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; - $value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; - $value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; - $value['install'][3] = (isset($value['install'][3])) ? $value['install'][3] : 0; - $value['tryrun'][3] = (isset($value['tryrun'][3])) ? $value['tryrun'][3] : 0; - $value['check'][3] = (isset($value['check'][3])) ? $value['check'][3] : 0; - $value['delivery'][3] = (isset($value['delivery'][3])) ? $value['delivery'][3] : 0; - $value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0; - - $array_data[$key] = [ - $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - $value['sign'][1], $value['second'][1], $value['arrive'][1], $value['install'][1], $value['tryrun'][1], $value['check'][1], $value['delivery'][1], $value['final'][1], - $value['sign'][3], $value['second'][3], $value['arrive'][3], $value['install'][3], $value['tryrun'][3], $value['check'][3], $value['delivery'][3], $value['final'][3], - $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('
', '; ', $value['facilities']) - ]; -} + +// 檢查是否有 POST 資料 +// if ($_SERVER["REQUEST_METHOD"] == "POST") { +// // 獲取 POST 資料 +// // $postData = $_POST['Bill']; + +// // 指定儲存資料的檔案路徑 +// $filePath = 'Bill.txt'; + +// // 寫入檔案 +// // 使用 FILE_APPEND 選項,以便將資料附加到檔案的末尾而不是覆寫檔案 +// file_put_contents($filePath, $Bill . PHP_EOL, FILE_APPEND); + +// echo '資料已成功寫入檔案。'; +// } else { +// echo '請透過正確的方式訪問此頁面。'; +// } +// exit(); +// print_r($Bill); +// foreach ($Bill as $key => $value) { +// $value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; +// $value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; +// $value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; +// $value['install'][3] = (isset($value['install'][3])) ? $value['install'][3] : 0; +// $value['tryrun'][3] = (isset($value['tryrun'][3])) ? $value['tryrun'][3] : 0; +// $value['check'][3] = (isset($value['check'][3])) ? $value['check'][3] : 0; +// $value['delivery'][3] = (isset($value['delivery'][3])) ? $value['delivery'][3] : 0; +// $value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0; + +// $array_data[$key] = [ +// $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], +// $value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], +// $value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], +// $value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], +// $value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], +// $value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], +// $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], +// $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], +// $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], +// $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('
', '; ', $value['facilities']) + +// ]; + // $array_data[$key] = [ + // $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], + // $value['sign'][1], $value['second'][1], $value['arrive'][1], $value['install'][1], $value['tryrun'][1], $value['check'][1], $value['delivery'][1], $value['final'][1], + // $value['sign'][3], $value['second'][3], $value['arrive'][3], $value['install'][3], $value['tryrun'][3], $value['check'][3], $value['delivery'][3], $value['final'][3], + // $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('
', '; ', $value['facilities']) + // ]; +// } $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $colomnHeader = [ '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', - '簽約款', '二次款', '貨抵工地款', '安裝款', '試車款', '官檢款', '交車款', '尾款', - '目前應收簽約款', '目前應收二次款', '目前應收貨抵工地款', '目前應收安裝款', '目前應收試車款', '目前應收官檢款', '目前應收交車款', '目前應收尾款', - '目前應收', '已開發票金額', '已收金額', '作番狀態' + '簽約款', '簽約款目前應收', '簽約最大催收次數', '簽約最小應收次數', + '二次款', '二次款目前應收', '二次最大催收次數', '二次最小應收次數', + '貨抵工地款', '貨抵工地款目前應收', '貨抵工地最小催收次數', '貨抵工地最小應收次數', + '安裝款', '安裝款目前應收', '安裝最大催收次數', '安裝最小應收次數', + '試車款', '試車款目前應收', '試車最大催收次數', '試車最小應收次數', + '官檢款', '官檢款目前應收', '官檢最大催收次數', '官檢最小應收次數', + '交車款', '交車款目前應收', '交車最大催收次數', '交車最小應收次數', + '尾款', '尾款目前應收', '尾款最大催收次數', '尾款最小應收次數', + '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番狀態' ]; +// $colomnHeader = [ +// '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', +// '簽約款', '二次款', '貨抵工地款', '安裝款', '試車款', '官檢款', '交車款', '尾款', +// '目前應收簽約款', '目前應收二次款', '目前應收貨抵工地款', '目前應收安裝款', '目前應收試車款', '目前應收官檢款', '目前應收交車款', '目前應收尾款', +// '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番狀態' +// ]; $sheet->fromArray($colomnHeader, NULL, 'A1'); $rowIndex = 2; -foreach ($array_data as $key => $value) { - $sheet->fromArray([$value], NULL, 'A' . $rowIndex); - $sheet->getStyle('AB' . $rowIndex)->getAlignment()->setWrapText(true); - $column = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA']; - foreach($column as $col) { - $sheet->getColumnDimension($col)->setAutoSize(true); +foreach ($Bill as $key => $value) { + $sheet->fromArray($value, NULL, 'A' . $rowIndex); + $column = [ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS' + ]; + foreach ($column as $col) { + if ($col == 'AS') { + $sheet->getStyle('AS' . $rowIndex)->getAlignment()->setWrapText(true); + } else { + $sheet->getColumnDimension($col)->setAutoSize(true); + } } + $rowIndex++; } $writer = new Xlsx($spreadsheet); diff --git a/wms/account-receivable-index-ing.php b/wms/account-receivable-index-ing.php new file mode 100644 index 00000000..4e6ef821 --- /dev/null +++ b/wms/account-receivable-index-ing.php @@ -0,0 +1,855 @@ +0"; + +// T8核銷 +$sql_received = "SELECT +a.BillNo, a.WriteOffBizPartnerId,a.PayWriteOffOAmount, +b.FromBillDate AS ReceivedDate,b.CurrWOFeeOAmt AS Fee, +c.OrderBillNo, c.checkBillNo, c.InvoiceNo, c.BillDate AS CheckBillDate +FROM arWriteOffBill AS a +LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo +LEFT JOIN + (SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail + LEFT JOIN + (SELECT + arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo + FROM arCheckBill + LEFT JOIN arCheckBillInvInfo + ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 + ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c +ON a.BillNo=c.BillNo +WHERE DATALENGTH(c.OrderBillNo) >0"; + +//T8 銷售訂單 階段收款計畫 +$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, +c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a +LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo +LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId +WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; + +// 期初收款資訊 +$sql_opening = " +SELECT * FROM account_received "; + +// 設定權限:看到自己的/下屬的,資訊處跟財會處可以看全部的 +if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { + $sql_contract .= "AND (s.PersonId = '$user_id'"; + $sql_received .= " AND (PersonId = '$user_id'"; + $sql_opening .= " OR person_id = '$user_id'"; + if (count($follower) > 0) { + $column_str = "('$user_id'" . ",'"; + $column_str .= implode("','", $follower); + $column_str .= "')"; + $sql_contract .= " OR s.PersonId IN $column_str)"; + $sql_received .= " OR PersonId IN $column_str)"; + $sql_opening .= " OR person_id IN $column_str)"; + } else { + $sql_contract .= ")"; + $sql_received .= ")"; + $sql_opening .= ")"; + }; +} + +$contract = $conn->query($sql_contract); +$received_array = $conn->query($sql_received); +$opening_data = mysqli_query($link, $sql_opening); +$invoice_data = $conn->query($sql_invoice); + + +// 合約收款階段內容分類 +$sign60 = array('簽訂後60天', '簽約60日', '簽約後60天', '簽訂後60日內', '訂金支付後60天'); +$sign90 = array('簽約後90天', '簽約後90日', '簽訂後90天'); +$sign120 = array('簽約後120天', '簽約後120日', '簽訂後120天'); + +// 將T8合約收款階段資料依據款別分類放進arraData裡 +foreach ($contract as $cont) { + if ($cont['BillNo'] == 'SO20230801001') { + $BillNo = 'M230947'; + } elseif ($cont['BillNo'] == 'SO20230801002') { + $BillNo = 'M231067'; + } else { + $BillNo = $cont['BillNo']; + }; + $PayStage = $cont['PayStage']; + $PlanPayDate = $cont['PlanPayDate']; + $PayAmount = $cont['PlanPayAmt']; + $partnerName = $cont['BizPartnerName']; + $EnterpriseName = $cont['EnterpriseName']; + $TaxNo = $cont['TaxNo']; + $ContactAddress = $cont['ContactAddress']; + //['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 + //['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 + if (!(isset($arrayData[$BillNo]))) { + // 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 + $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + $arrayData[$BillNo][5] = $partnerName; + $arrayData[$BillNo][6] = $EnterpriseName; + $arrayData[$BillNo][7] = $TaxNo; + $arrayData[$BillNo][8] = $ContactAddress; + $arrayData[$BillNo]['total_budget'] = 0; + $arrayData[$BillNo]['invoice'] = array(); + $arrayData[$BillNo]['received_budget'] = 0; + $arrayData[$BillNo]['invoice_budget'] = 0; + $arrayData[$BillNo]['sign'][1] = $arrayData[$BillNo]['second'][1] = $arrayData[$BillNo]['arrive'][1] = $arrayData[$BillNo]['install'][1] = $arrayData[$BillNo]['tryrun'][1] = $arrayData[$BillNo]['check'][1] = $arrayData[$BillNo]['delivery'][1] = $arrayData[$BillNo]['final'][1] = 0; + $arrayData[$BillNo]['sign']['min'] = $arrayData[$BillNo]['second']['min'] = $arrayData[$BillNo]['arrive']['min'] = $arrayData[$BillNo]['install']['min'] = $arrayData[$BillNo]['tryrun']['min'] = $arrayData[$BillNo]['check']['min'] = $arrayData[$BillNo]['delivery']['min'] = $arrayData[$BillNo]['final']['min'] = array(); + $arrayData[$BillNo]['sign']['max'] = $arrayData[$BillNo]['second']['max'] = $arrayData[$BillNo]['arrive']['max'] = $arrayData[$BillNo]['install']['max'] = $arrayData[$BillNo]['tryrun']['max'] = $arrayData[$BillNo]['check']['max'] = $arrayData[$BillNo]['delivery']['max'] = $arrayData[$BillNo]['final']['max'] = array(); + $arrayData[$BillNo]['facilities'] = ""; + $arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; + } + if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60') || stristr($PayStage, '寶佳出貨後10天')) { + $arrayData[$BillNo]['second'][0] = $PayStage; + $arrayData[$BillNo]['second'][1] = $PayAmount; + $arrayData[$BillNo]['second'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + if (isset($arrayData[$BillNo]['sign'][2]) && !is_null($arrayData[$BillNo]['sign'][2])) { + $signtime = strtotime(strval($arrayData[$BillNo]['sign'][2])); + if (in_array($PayStage, $sign60)) { + $secondtime = $signtime + (60 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); + } elseif (in_array($PayStage, $sign90)) { + $secondtime = $signtime + (90 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); + } elseif (in_array($PayStage, $sign120)) { + $secondtime = $signtime + (120 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); + } elseif (stristr($PayStage, '簽訂後30天')) { + $secondtime = $signtime + (30 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); + } + } + } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工') || stristr($PayStage, '寶佳出貨前30天')) { + $arrayData[$BillNo]['sign'][0] = $PayStage; + $arrayData[$BillNo]['sign'][1] = $PayAmount; + $arrayData[$BillNo]['sign'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + $arrayData[$BillNo]['receivable_budget'] += $PayAmount; + if (isset($PlanPayDate) && !empty($PlanPayDate)) { + array_push($arrayData[$BillNo]['sign']['min'], strval($PlanPayDate)); + array_push($arrayData[$BillNo]['sign']['max'], strtotime(strval($PlanPayDate))); + } + } elseif (stristr($PayStage, '試車')) { + $arrayData[$BillNo]['tryrun'][0] = $PayStage; + $arrayData[$BillNo]['tryrun'][1] = $PayAmount; + $arrayData[$BillNo]['tryrun'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } elseif (stristr($PayStage, '安裝') || stristr($PayStage, '貨抵工地且完工')) { + $arrayData[$BillNo]['install'][0] = $PayStage; + $arrayData[$BillNo]['install'][1] = $PayAmount; + $arrayData[$BillNo]['install'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { + $arrayData[$BillNo]['arrive'][0] = $PayStage; + $arrayData[$BillNo]['arrive'][1] = $PayAmount; + $arrayData[$BillNo]['arrive'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { + $arrayData[$BillNo]['delivery'][0] = $PayStage; + $arrayData[$BillNo]['delivery'][1] = $PayAmount; + $arrayData[$BillNo]['delivery'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { + $arrayData[$BillNo]['check'][0] = $PayStage; + $arrayData[$BillNo]['check'][1] = $PayAmount; + $arrayData[$BillNo]['check'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } elseif (stristr($PayStage, '驗收完成')) { + $arrayData[$BillNo]['final'][0] = $PayStage; + $arrayData[$BillNo]['final'][1] = $PayAmount; + $arrayData[$BillNo]['final'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } else { + $arrayData[$BillNo]['other'][1] = $PayAmount; + $arrayData[$BillNo]['other'][2] = $PlanPayDate; + $arrayData[$BillNo]['total_budget'] += $PayAmount; + } +} +//取作番大日程作番與時程 +// real_contract_arrival_date 預計出貨日 +// real_arrival_date 實際出貨日 +$sql = "SELECT +tmp2.*, +d.name AS depart_name +FROM( +SELECT + a.manager, + a2.name as manager_name, + a.name, + a.department_id, + w.salesid, + w.contractno, + w.facilityno, + w.estimated_shipping_date, + w.real_contract_arrival_date, +w.actual_tofactory_date, +w.real_contract_arrival_date, + w.real_arrival_date, + w.install_end_date, + w.tryrun_end_date, + w.official_check_date, + w.delivery_date +from wipwholestatus AS w +left join account AS a +ON w.salesid = a.accountid +left join account AS a2 +ON a2.accountid = a.manager +where w.status = '1' AND w.contract_type='A' +)AS tmp2 +left join ( +SELECT DISTINCT + department_id, + name +FROM department + +) AS d +ON d.department_id = tmp2.department_id ORDER BY contractno"; +$wipwhole_array = mysqli_query($link, $sql); +foreach ($wipwhole_array as $wip) { + if (isset($arrayData[$wip['contractno']])) { + // 整理合約資料 + $arrayData[$wip['contractno']][0] = $wip['department_id'];; + $arrayData[$wip['contractno']][1] = $wip['depart_name']; + $arrayData[$wip['contractno']][2] = $wip['manager_name']; + $arrayData[$wip['contractno']][3] = $wip['salesid']; + $arrayData[$wip['contractno']][4] = $wip['name']; + $arrayData[$wip['contractno']][10] = $wip['contractno']; + // [合約號][作番號]['no'] + $arrayData[$wip['contractno']][$wip['facilityno']]['no'] = $wip['facilityno']; + + // [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] + // [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] + // [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] + $contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + foreach ($contractstage as $i) { + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['date'] = ""; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['budget'] = 0; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['date'] = ""; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['budget'] = 0; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['con']['date'] = (isset($arrayData[$wip['contractno']][$i][2])) ? $arrayData[$wip['contractno']][$i][2] : ""; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['con']['budget'] = 0; + } + // 補上寶佳 (出貨前) 收款時間 + + if (isset($arrayData[$wip['contractno']]['sign'][0]) && $arrayData[$wip['contractno']]['sign'][0] == '寶佳出貨前30天') { + if ($wip['real_arrival_date'] != NULL) { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $signtime = $estimate_delivery_time - (30 * 86400); + $signtime = date('Ymd', $signtime); + $arrayData[$wip['contractno']]['sign'][2] = strval($signtime); + array_push($arrayData[$wip['contractno']]['sign']['max'], strtotime(strval($signtime))); + array_push($arrayData[$wip['contractno']]['sign']['min'], strtotime(strval($signtime))); + } elseif ($wip['real_contract_arrival_date'] != NULL) { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $signtime = $estimate_delivery_time - (30 * 86400); + $signtime = date('Ymd', $signtime); + $arrayData[$wip['contractno']]['sign'][2] = strval($signtime); + array_push($arrayData[$wip['contractno']]['sign']['max'], strtotime(strval($signtime))); + array_push($arrayData[$wip['contractno']]['sign']['min'], strtotime(strval($signtime))); + } + } + + // 補上二次款 (出貨前) 收款時間,條件不是"出貨前"就pass + if (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前30天')) { + if (empty($wip['real_contract_arrival_date'])) { + } else { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $secondtime = $estimate_delivery_time - (30 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); + } + } elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前90天')) { + if (empty($wip['real_contract_arrival_date'])) { + } else { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $secondtime = $estimate_delivery_time - (90 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); + } + } elseif (isset($arrayData[$wip['contractno']]['second'][0]) && $arrayData[$wip['contractno']]['second'][0] == '寶佳出貨後10天') { + + if ($wip['real_arrival_date'] != NULL) { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $secondtime = $estimate_delivery_time + (10 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); + } else { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $secondtime = $estimate_delivery_time + (10 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime($secondtime)); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); + } + } + //根據作番狀態填入facilities,計算各階段數量、一個合約有幾個作番,增加作番資料 + // real_contract_arrival_date 預計出貨日=預計到貨日=預計貨抵工地 + // real_arrival_date 實際出貨日=實際到貨日=實際貨抵工地 + if ($wip['delivery_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['delivery_num'] += 1; + $arrayData[$wip['contractno']]['check_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + + if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { + $estimate_delivery_time = strtotime($wip['delivery_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['delivery'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); + array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($wip['delivery_date']))); + array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($wip['delivery_date']))); + } + if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); + array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); + } + if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { + if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { + $estimate_delivery_time = strtotime($wip['tryrun_end_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); + } + } + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['official_check_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['check_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['check']['min'], strval($wip['official_check_date'])); + array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); + } + + if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { + if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { + $estimate_delivery_time = strtotime($wip['tryrun_end_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); + } + } + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strval($wip['install_end_date'])); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['tryrun_end_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strval($wip['tryrun_end_date'])); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); + } + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strval($wip['install_end_date'])); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['install_end_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strval($wip['install_end_date'])); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strtotime(strval($wip['install_end_date'])))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['real_arrival_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { + + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + } else { + if ($wip['real_contract_arrival_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + } elseif ($wip['estimated_shipping_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + } else { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計出港日待確認)
"; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + } + } + } +} + +// 計算每個合約的應收款、作番總數 +foreach ($arrayData as &$value) { + if ($value['total_facility_num'] > 0) { + $value['receivable_budget'] += ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + + ($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) + + ($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) + + (($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num'])); + $value['sign'][3] = $value['sign'][1]; + $value['second'][3] = $value['second'][1] * ($value['second_num'] / $value['total_facility_num']); + $value['arrive'][3] = $value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num']); + $value['install'][3] = $value['install'][1] * ($value['install_num'] / $value['total_facility_num']); + $value['tryrun'][3] = $value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num']); + $value['check'][3] = $value['check'][1] * ($value['check_num'] / $value['total_facility_num']); + $value['delivery'][3] = $value['delivery'][1] * ($value['delivery_num'] / $value['total_facility_num']); + $value['final'][3] = $value['final'][1] * ($value['delivery_num'] / $value['total_facility_num']); + } + $stagearray = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + + $today = date('Ym01', strtotime('-1 month', strtotime(date('Ym01')))); + // $today = strtotime($today,); + // echo "today: " . $today . "
"; + // exit(); + // foreach ($stagearray as $stage) { + // // 計算月份差距 + // if (empty($value[$stage]['min'])==0) { + // print_r($value[$stage]['min']); + // echo "
"; + // // $maxtime = array_map('strtotime', $value[$stage]['min']); + // $earliestDate = min($value[$stage]['min']); + // $earliestMonth = date('Ym01', $earliestDate); + // echo "earliestDate: " . $earliestDate . "
"; + // // $earliestMonth = date('n', strtotime($earliestDate)); + // // 計算月份差距 + // $maxDifference = $today -$earliestMonth; + // echo "difference = ".$maxDifference."
"; + // $value[$stage]['max'] = $maxDifference; + // } else { + // $value[$stage]['max'] = 0; + // } + // echo $value[$stage]['max']; + // echo "
--------------------
"; + // exit(); + + // if(!empty($value[$stage]['max']) && $value[$stage]['max'] !==10 && $value[$stage]['max'] !==1){ + // echo "max: " . $value[$stage]['max'] . "
"; + // if (!empty($value[$stage]['max'])) { + // $mintime = array_map('strtotime', $value[$stage]['max']); + // $latestDate = max($mintime); + // $latestMonth = date('n', strtotime($latestDate)); + // $minDifference = abs($latestMonth - $today); + // $value[$stage]['min'] = $minDifference; + // } else { + // $value[$stage]['min'] = 0; + // } + // }else{ + // $value[$stage]['min'] = 0; + // } + + // } +} +// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] +// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] +// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] +foreach ($wipwhole_array as $wip) { + if (isset($arrayData[$wip['contractno']]) && isset($arrayData[$wip['contractno']][$wip['facilityno']]) && !empty($arrayData[$wip['contractno']]['total_facility_num'])) { + $stagearray = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + foreach ($stagearray as $stage) { + $arrayData[$wip['contractno']][$wip['facilityno']][$stage]['con'] = $arrayData[$wip['contractno']][$stage][1] / $arrayData[$wip['contractno']]['total_facility_num']; + } + } +} + +// [invoice][發票號碼][0 發票日期, 1 發票金額, 2 發票狀態, 3 收款日期, 4 收款金額, 5 手續費, 6 核銷單號] +foreach ($invoice_data as $invoice) { + if (isset($arrayData[$invoice['ProjectId']])) { + $arrayData[$invoice['ProjectId']]['invoice_budget'] += intval($invoice['OAmountWithTax']); + $arrayData[$invoice['ProjectId']]['invoice'][$invoice['InvoiceNo']] = [date("Ymd", strtotime($invoice['InvoiceTime'])), $invoice['OAmountWithTax'], $invoice['InvoiceState']]; + } +} + +// 把核銷單的內容補到發票資料中 +foreach ($received_array as $received) { + if ($received['OrderBillNo'] == 'SO20230801001') { + $BillNo = 'M230947'; + } elseif ($received['OrderBillNo'] == 'SO20230801002') { + $BillNo = 'M231067'; + } else { + $BillNo = $received['OrderBillNo']; + }; + if (isset($arrayData[$BillNo])) { + if (isset($arrayData[$BillNo]['invoice'][$received['InvoiceNo']])) { + $arrayData[$BillNo]['received_budget'] += $received['PayWriteOffOAmount']; + array_push($arrayData[$BillNo]['invoice'][$received['InvoiceNo']], date($received['ReceivedDate']), $received['PayWriteOffOAmount'], $received['Fee'], $received['BillNo']); + } + } +} +foreach ($arrayData as $key => $value) { + print_r($value); + echo "
"; +} + +$data = json_encode($arrayData); + +?> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $value) { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合約號部門經理營業員客戶名稱簽約款應收簽約金額簽約最大催收次數簽約最小催收次數二次款應收二次金額二次最大催收次數二次最小催收次數貨抵工地款應收貨抵工地金額貨抵工地最大催收次數貨抵工地最小催收次數安裝款應收安裝金額安裝最大催收次數安裝最小催收次數試車款應收試車金額試車最大催收次數試車最小催收次數官檢款應收官檢金額官檢最大催收次數官檢最小催收次數移交款應收移交金額移交最大催收次數移交最小催收次數尾款應收尾款金額尾款最大催收次數尾款最小催收次數合約總金額目前應收已開發票金額已收金額
+
+ \ No newline at end of file diff --git a/wms/account-receivable-index.php b/wms/account-receivable-index.php index 762335a9..190783da 100644 --- a/wms/account-receivable-index.php +++ b/wms/account-receivable-index.php @@ -32,6 +32,7 @@ LEFT JOIN ON a.BillNo=c.BillNo WHERE DATALENGTH(c.OrderBillNo) >0"; +//T8 銷售訂單 階段收款計畫 $sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo @@ -105,9 +106,9 @@ foreach ($contract as $cont) { $arrayData[$BillNo]['sign']['min'] = $arrayData[$BillNo]['second']['min'] = $arrayData[$BillNo]['arrive']['min'] = $arrayData[$BillNo]['install']['min'] = $arrayData[$BillNo]['tryrun']['min'] = $arrayData[$BillNo]['check']['min'] = $arrayData[$BillNo]['delivery']['min'] = $arrayData[$BillNo]['final']['min'] = array(); $arrayData[$BillNo]['sign']['max'] = $arrayData[$BillNo]['second']['max'] = $arrayData[$BillNo]['arrive']['max'] = $arrayData[$BillNo]['install']['max'] = $arrayData[$BillNo]['tryrun']['max'] = $arrayData[$BillNo]['check']['max'] = $arrayData[$BillNo]['delivery']['max'] = $arrayData[$BillNo]['final']['max'] = array(); $arrayData[$BillNo]['facilities'] = ""; - $arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; + $arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['sign_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; } - if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { + if (stristr($PayStage, '二次款') || (stristr($PayStage, '出貨前') && $PayStage != "寶佳出貨前30天") || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60') || stristr($PayStage, '寶佳出貨後10天')) { $arrayData[$BillNo]['second'][0] = $PayStage; $arrayData[$BillNo]['second'][1] = $PayAmount; $arrayData[$BillNo]['second'][2] = $PlanPayDate; @@ -117,28 +118,31 @@ foreach ($contract as $cont) { if (in_array($PayStage, $sign60)) { $secondtime = $signtime + (60 * 86400); $secondtime = date('Ymd', $secondtime); - $arrayData[$BillNo]['second'][2] = intval($secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); } elseif (in_array($PayStage, $sign90)) { $secondtime = $signtime + (90 * 86400); $secondtime = date('Ymd', $secondtime); - $arrayData[$BillNo]['second'][2] = intval($secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); } elseif (in_array($PayStage, $sign120)) { $secondtime = $signtime + (120 * 86400); $secondtime = date('Ymd', $secondtime); - $arrayData[$BillNo]['second'][2] = intval($secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); } elseif (stristr($PayStage, '簽訂後30天')) { $secondtime = $signtime + (30 * 86400); $secondtime = date('Ymd', $secondtime); - $arrayData[$BillNo]['second'][2] = intval($secondtime); + $arrayData[$BillNo]['second'][2] = strval($secondtime); } } - } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工')) { + } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工') || $PayStage == '寶佳出貨前30天') { $arrayData[$BillNo]['sign'][0] = $PayStage; $arrayData[$BillNo]['sign'][1] = $PayAmount; $arrayData[$BillNo]['sign'][2] = $PlanPayDate; $arrayData[$BillNo]['total_budget'] += $PayAmount; - array_push($arrayData[$BillNo]['sign']['min'], intval(substr($PlanPayDate, 4, 2))); - array_push($arrayData[$BillNo]['sign']['max'], intval(substr($PlanPayDate, 4, 2))); + $arrayData[$BillNo]['receivable_budget'] += $PayAmount; + if (isset($PlanPayDate) && !empty($PlanPayDate) && $PayStage != "寶佳出貨前30天") { + array_push($arrayData[$BillNo]['sign']['min'], strtotime(strval($PlanPayDate))); + array_push($arrayData[$BillNo]['sign']['max'], strtotime(strval($PlanPayDate))); + } } elseif (stristr($PayStage, '試車')) { $arrayData[$BillNo]['tryrun'][0] = $PayStage; $arrayData[$BillNo]['tryrun'][1] = $PayAmount; @@ -175,6 +179,9 @@ foreach ($contract as $cont) { $arrayData[$BillNo]['total_budget'] += $PayAmount; } } +//取作番大日程作番與時程 +// real_contract_arrival_date 預計出貨日 +// real_arrival_date 實際出貨日 $sql = "SELECT tmp2.*, d.name AS depart_name @@ -188,6 +195,7 @@ SELECT w.contractno, w.facilityno, w.estimated_shipping_date, + w.real_contract_arrival_date, w.actual_tofactory_date, w.real_arrival_date, w.install_end_date, @@ -208,163 +216,395 @@ SELECT DISTINCT FROM department ) AS d -ON d.department_id = tmp2.department_id"; +ON d.department_id = tmp2.department_id ORDER BY contractno"; $wipwhole_array = mysqli_query($link, $sql); foreach ($wipwhole_array as $wip) { if (isset($arrayData[$wip['contractno']])) { + // 整理合約資料 $arrayData[$wip['contractno']][0] = $wip['department_id'];; $arrayData[$wip['contractno']][1] = $wip['depart_name']; $arrayData[$wip['contractno']][2] = $wip['manager_name']; $arrayData[$wip['contractno']][3] = $wip['salesid']; $arrayData[$wip['contractno']][4] = $wip['name']; $arrayData[$wip['contractno']][10] = $wip['contractno']; + $arrayData[$wip['contractno']]['total_facility_num'] += 1; + // [合約號][作番號]['no'] + $arrayData[$wip['contractno']][$wip['facilityno']]['no'] = $wip['facilityno']; + + // [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] + // [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] + // [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] + $contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + foreach ($contractstage as $i) { + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['date'] = ""; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['budget'] = 0; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['date'] = ""; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['budget'] = 0; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['con']['date'] = (isset($arrayData[$wip['contractno']][$i][2])) ? $arrayData[$wip['contractno']][$i][2] : ""; + $arrayData[$wip['contractno']][$wip['facilityno']][$i]['con']['budget'] = 0; + } + // 補上寶佳 (出貨前) 收款時間 + + if (isset($arrayData[$wip['contractno']]['sign'][0]) && $arrayData[$wip['contractno']]['sign'][0] == '寶佳出貨前30天') { + if ($wip['real_arrival_date'] != NULL) { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $signtime = $estimate_delivery_time - (30 * 86400); + $signtime = date('Ymd', $signtime); + $arrayData[$wip['contractno']]['sign'][2] = strval($signtime); + array_push($arrayData[$wip['contractno']]['sign']['max'], strtotime(strval($signtime))); + array_push($arrayData[$wip['contractno']]['sign']['min'], strtotime(strval($signtime))); + } elseif ($wip['real_contract_arrival_date'] != NULL) { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $signtime = $estimate_delivery_time - (30 * 86400); + $signtime = date('Ymd', $signtime); + $arrayData[$wip['contractno']]['sign'][2] = strval($signtime); + array_push($arrayData[$wip['contractno']]['sign']['max'], strtotime(strval($signtime))); + array_push($arrayData[$wip['contractno']]['sign']['min'], strtotime(strval($signtime))); + } + } + + // 補上二次款 (出貨前) 收款時間,條件不是"出貨前"就pass if (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前30天')) { - $estimate_delivery_time = strtotime($wip['estimated_shipping_date']); - $secondtime = $estimate_delivery_time - (30 * 86400); - $secondtime = date('Ymd', $secondtime); - if (empty($wip['estimated_shipping_date'])) { - $arrayData[$wip['contractno']]['second']['min'] = 0; + if (empty($wip['real_contract_arrival_date'])) { } else { - array_push($arrayData[$wip['contractno']]['second']['max'], intval(substr($wip['estimated_shipping_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['second']['min'], intval(substr($wip['estimated_shipping_date'], 5, 2))); + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $secondtime = $estimate_delivery_time - (30 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); } - $arrayData[$wip['contractno']]['second'][2] = intval($secondtime); } elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前90天')) { - $estimate_delivery_time = strtotime($wip['estimated_shipping_date']); - $secondtime = $estimate_delivery_time - (90 * 86400); - $secondtime = date('Ymd', $secondtime); - $arrayData[$wip['contractno']]['second'][2] = intval($secondtime); - if (empty($wip['estimated_shipping_date'])) { - $arrayData[$wip['contractno']]['second']['min'] = 0; + if (empty($wip['real_contract_arrival_date'])) { } else { - array_push($arrayData[$wip['contractno']]['second']['max'], intval(substr($wip['estimated_shipping_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['second']['min'], intval(substr($wip['estimated_shipping_date'], 5, 2))); - } - } - if ($wip['delivery_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; - $arrayData[$wip['contractno']]['delivery_num'] += 1; - $arrayData[$wip['contractno']]['check_num'] += 1; - $arrayData[$wip['contractno']]['tryrun_num'] += 1; - $arrayData[$wip['contractno']]['install_num'] += 1; - $arrayData[$wip['contractno']]['arrive_num'] += 1; - $arrayData[$wip['contractno']]['second_num'] += 1; - array_push($arrayData[$wip['contractno']]['delivery']['min'], intval(substr($wip['delivery_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['delivery']['max'], intval(substr($wip['delivery_date'], 5, 2))); - if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['check']['min'], intval(substr($wip['official_check_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['check']['max'], intval(substr($wip['official_check_date'], 5, 2))); - } - if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['tryrun']['min'], intval(substr($wip['tryrun_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['tryrun']['max'], intval(substr($wip['tryrun_end_date'], 5, 2))); - } - if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['install']['min'], intval(substr($wip['install_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['install']['max'], intval(substr($wip['install_end_date'], 5, 2))); - } - if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['arrive']['min'], intval(substr($wip['real_arrival_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['arrive']['max'], intval(substr($wip['real_arrival_date'], 5, 2))); - } - } elseif ($wip['official_check_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; - $arrayData[$wip['contractno']]['check_num'] += 1; - $arrayData[$wip['contractno']]['tryrun_num'] += 1; - $arrayData[$wip['contractno']]['install_num'] += 1; - $arrayData[$wip['contractno']]['arrive_num'] += 1; - $arrayData[$wip['contractno']]['second_num'] += 1; - array_push($arrayData[$wip['contractno']]['check']['min'], intval(substr($wip['official_check_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['check']['max'], intval(substr($wip['official_check_date'], 5, 2))); - if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['tryrun']['min'], intval(substr($wip['tryrun_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['tryrun']['max'], intval(substr($wip['tryrun_end_date'], 5, 2))); - } - if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['install']['min'], intval(substr($wip['install_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['install']['max'], intval(substr($wip['install_end_date'], 5, 2))); - } - if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['arrive']['min'], intval(substr($wip['real_arrival_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['arrive']['max'], intval(substr($wip['real_arrival_date'], 5, 2))); - } - } elseif ($wip['tryrun_end_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; - $arrayData[$wip['contractno']]['tryrun_num'] += 1; - $arrayData[$wip['contractno']]['install_num'] += 1; - $arrayData[$wip['contractno']]['arrive_num'] += 1; - $arrayData[$wip['contractno']]['second_num'] += 1; - if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['tryrun']['min'], intval(substr($wip['tryrun_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['tryrun']['max'], intval(substr($wip['tryrun_end_date'], 5, 2))); - } - if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['install']['min'], intval(substr($wip['install_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['install']['max'], intval(substr($wip['install_end_date'], 5, 2))); - } - if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['arrive']['min'], intval(substr($wip['real_arrival_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['arrive']['max'], intval(substr($wip['real_arrival_date'], 5, 2))); - } - } elseif ($wip['install_end_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; - $arrayData[$wip['contractno']]['install_num'] += 1; - $arrayData[$wip['contractno']]['arrive_num'] += 1; - $arrayData[$wip['contractno']]['second_num'] += 1; - if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['install']['min'], intval(substr($wip['install_end_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['install']['max'], intval(substr($wip['install_end_date'], 5, 2))); + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $secondtime = $estimate_delivery_time - (90 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); } - if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['arrive']['min'], intval(substr($wip['real_arrival_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['arrive']['max'], intval(substr($wip['real_arrival_date'], 5, 2))); + } elseif (isset($arrayData[$wip['contractno']]['second'][0]) && $arrayData[$wip['contractno']]['second'][0] == '寶佳出貨後10天') { + + if ($wip['real_arrival_date'] != NULL) { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $secondtime = $estimate_delivery_time + (10 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); + } else { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $secondtime = $estimate_delivery_time + (10 * 86400); + $secondtime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['second'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['second']['max'], strtotime($secondtime)); + array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); } - } elseif ($wip['real_arrival_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; - $arrayData[$wip['contractno']]['arrive_num'] += 1; - $arrayData[$wip['contractno']]['second_num'] += 1; - if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { - array_push($arrayData[$wip['contractno']]['arrive']['min'], intval(substr($wip['real_arrival_date'], 5, 2))); - array_push($arrayData[$wip['contractno']]['arrive']['max'], intval(substr($wip['real_arrival_date'], 5, 2))); + } + //根據作番狀態填入facilities,計算各階段數量、一個合約有幾個作番,增加作番資料 + // real_contract_arrival_date 預計出貨日=預計到貨日=預計貨抵工地 + // real_arrival_date 實際出貨日=實際到貨日=實際貨抵工地 + //----------------------------------------寶佳的另外處理--------------------------------------------------- + if ($arrayData[$wip['contractno']]['sign'][0] == "寶佳出貨前30天") { + $facility_status = ""; + // if ($arrayData[$wip['contractno']]['sign'][2]) + $today = strtotime(date('Ymd')); + $contractday = strtotime($arrayData[$wip['contractno']]['sign'][2]); + if ($today > $contractday) { + $arrayData[$wip['contractno']]['sign_num'] += 1; + $facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "已過)
"; + $contractday = strtotime($arrayData[$wip['contractno']]['second'][2]); + if ($today > $contractday) { + $arrayData[$wip['contractno']]['second_num'] += 1; + $facility_status = $wip['facilityno'] . " (出貨後10天" . $arrayData[$wip['contractno']]['second'][2] . "已過)
"; + if ($wip['real_arrival_date'] != NULL) { + $estimate_time = strtotime($wip['real_arrival_date']); + $contractday = $estimate_time + (90 * 86400); + if ($today > $contractday) { + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['arrive'][2] = strval(date('Y-m-d', $contractday)); + $facility_status = $wip['facilityno'] . " (貨抵工地後90天" . $arrayData[$wip['contractno']]['arrive'][2] . "已過)
"; + if ($wip['tryrun_end_date'] != NULL) { + $estimate_time = strtotime($wip['tryrun_end_date']); + $contractday = $estimate_time + (90 * 86400); + if ($today > $contractday) { + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['tryrun'][2] = strval(date('Y-m-d', $contractday)); + $facility_status = $wip['facilityno'] . " (試車後90天" . $arrayData[$wip['contractno']]['tryrun'][2] . "已過)
"; + if ($wip['delivery_date'] != NULL) { + $estimate_time = strtotime($wip['delivery_date']); + $contractday = $estimate_time + (270 * 86400); + if ($today > $contractday) { + $arrayData[$wip['contractno']]['delivery_num'] += 1; + $arrayData[$wip['contractno']]['delivery'][2] = strval(date('Y-m-d', $contractday)); + $facility_status = $wip['facilityno'] . " (交車後270天" . $arrayData[$wip['contractno']]['delivery'][2] . "已過)
"; + } + } + } + } + } + } + } + } else { + $facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "未到)
"; } - } elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { - if ($wip['estimated_shipping_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出貨日)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['facilities'] .= $facility_status; + } else { + if ($wip['delivery_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交)
"; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + $arrayData[$wip['contractno']]['sign_num'] += 1; + + if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { + $estimate_delivery_time = strtotime($wip['delivery_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['delivery'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['delivery_num'] += 1; + $arrayData[$wip['contractno']]['check_num'] += 1; + $arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); + array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($wip['delivery_date']))); + array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($wip['delivery_date']))); + } + if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); + array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); + } + if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { + if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { + $estimate_delivery_time = strtotime($wip['tryrun_end_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); + } + } + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['official_check_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢)
"; + $arrayData[$wip['contractno']]['check_num'] += 1; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + $arrayData[$wip['contractno']]['sign_num'] += 1; + if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); + array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); + } + + if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { + if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { + $estimate_delivery_time = strtotime($wip['tryrun_end_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); + } + } + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['tryrun_end_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢)
"; + $arrayData[$wip['contractno']]['tryrun_num'] += 1; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1; - } elseif ($wip['actual_tofactory_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; + $arrayData[$wip['contractno']]['sign_num'] += 1; + if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); + array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); + } + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['install_end_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢)
"; + $arrayData[$wip['contractno']]['install_num'] += 1; + $arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1; - } else { + $arrayData[$wip['contractno']]['sign_num'] += 1; + if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { + array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); + array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strtotime(strval($wip['install_end_date'])))); + } + if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } else { + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); + } + } + } elseif ($wip['real_arrival_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地)
"; + $arrayData[$wip['contractno']]['arrive_num'] += 1; + $arrayData[$wip['contractno']]['second_num'] += 1; + $arrayData[$wip['contractno']]['sign_num'] += 1; + + if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { + $estimate_delivery_time = strtotime($wip['real_arrival_date']); + $arrivetime = $estimate_delivery_time + (90 * 86400); + $arrivetime = date('Ymd', $secondtime); + $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); + } else { + $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); + array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); + array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); + } + } elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1; + $arrayData[$wip['contractno']]['sign_num'] += 1; + } else { + $arrayData[$wip['contractno']]['sign_num'] += 1; + if ($wip['real_contract_arrival_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日)
"; + } elseif ($wip['estimated_shipping_date'] != NULL) { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日)
"; + } else { + $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計出港日待確認)
"; + } } - } elseif ($wip['estimated_shipping_date'] != NULL) { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; - } else { - $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計到港日待確認)
"; - $arrayData[$wip['contractno']]['total_facility_num'] += 1; } } } - +// 計算每個合約的應收款、作番總數 +$today_date = new DateTime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d'))))); foreach ($arrayData as &$value) { if ($value['total_facility_num'] > 0) { - $month = 11; - $value['receivable_budget'] = $value['sign'][1] + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + + $value['receivable_budget'] = $value['sign'][1] * ($value['sign_num'] / $value['total_facility_num']) + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + ($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) + ($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) + (($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num'])); - $value['sign'][3] = $value['sign'][1]; + $value['sign'][3] = $value['sign'][1] * ($value['sign_num'] / $value['total_facility_num']); $value['second'][3] = $value['second'][1] * ($value['second_num'] / $value['total_facility_num']); $value['arrive'][3] = $value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num']); $value['install'][3] = $value['install'][1] * ($value['install_num'] / $value['total_facility_num']); @@ -373,22 +613,51 @@ foreach ($arrayData as &$value) { $value['delivery'][3] = $value['delivery'][1] * ($value['delivery_num'] / $value['total_facility_num']); $value['final'][3] = $value['final'][1] * ($value['delivery_num'] / $value['total_facility_num']); } - $value['sign']['max'] = empty($value['sign']['max']) ? 0 : (($month - max($value['sign']['max'])) < 0 ? 0 : ($month - max($value['sign']['max']))); - $value['sign']['min'] = empty($value['sign']['min']) ? 0 : (($month - min($value['sign']['min'])) < 0 ? 0 : ($month - min($value['sign']['min']))); - $value['second']['max'] = empty($value['second']['max']) ? 0 : (($month - max($value['second']['max'])) < 0 ? 0 : ($month - max($value['second']['max']))); - $value['second']['min'] = empty($value['second']['min']) ? 0 : (($month - min($value['second']['min'])) < 0 ? 0 : ($month - min($value['second']['min']))); - $value['arrive']['max'] = empty($value['arrive']['max']) ? 0 : (($month - max($value['arrive']['max'])) < 0 ? 0 : ($month - max($value['arrive']['max']))); - $value['arrive']['min'] = empty($value['arrive']['min']) ? 0 : (($month - min($value['arrive']['min'])) < 0 ? 0 : ($month - min($value['arrive']['min']))); - $value['install']['max'] = empty($value['install']['max']) ? 0 : (($month - max($value['install']['max'])) < 0 ? 0 : ($month - max($value['install']['max']))); - $value['install']['min'] = empty($value['install']['min']) ? 0 : (($month - min($value['install']['min'])) < 0 ? 0 : ($month - min($value['install']['min']))); - $value['tryrun']['max'] = empty($value['tryrun']['max']) ? 0 : (($month - max($value['tryrun']['max'])) < 0 ? 0 : ($month - max($value['tryrun']['max']))); - $value['tryrun']['min'] = empty($value['tryrun']['min']) ? 0 : (($month - min($value['tryrun']['min'])) < 0 ? 0 : ($month - min($value['tryrun']['min']))); - $value['check']['max'] = empty($value['check']['max']) ? 0 : (($month - max($value['check']['max'])) < 0 ? 0 : ($month - max($value['check']['max']))); - $value['check']['min'] = empty($value['check']['min']) ? 0 : (($month - min($value['check']['min'])) < 0 ? 0 : ($month - min($value['check']['min']))); - $value['delivery']['max'] = empty($value['delivery']['max']) ? 0 : (($month - max($value['delivery']['max'])) < 0 ? 0 : ($month - max($value['delivery']['max']))); - $value['delivery']['min'] = empty($value['delivery']['min']) ? 0 : (($month - min($value['delivery']['min'])) < 0 ? 0 : ($month - min($value['delivery']['min']))); - $value['final']['max'] = empty($value['final']['max']) ? 0 : (($month - max($value['final']['max'])) < 0 ? 0 : ($month - max($value['final']['max']))); - $value['final']['min'] = empty($value['final']['min']) ? 0 : (($month - min($value['final']['min'])) < 0 ? 0 : ($month - min($value['final']['min']))); + // 計算最大催收次數與最小催收次數 + $contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + + foreach ($contractstage as $i) { + if (!empty($value[$i]['min']) && count($value[$i]['min']) > 0) { + $latest_timestamp = max($value[$i]['min']); + $latest_date = new DateTime(); + $latest_date->setTimestamp($latest_timestamp); + if ($latest_date < $today_date) { + $interval = $latest_date->diff($today_date); + $month = $interval->format('%m'); + $value[$i]['min'] = $month; + } else { + $value[$i]['min'] = 0; + } + } else { + $value[$i]['min'] = 0; + }; + if (!empty($value[$i]['max']) && count($value[$i]['max']) > 0) { + $latest_timestamp = min($value[$i]['max']); + $latest_date = new DateTime(); + $latest_date->setTimestamp($latest_timestamp); + if ($latest_date < $today_date) { + $interval = $latest_date->diff($today_date); + $month = $interval->format('%m'); + $value[$i]['max'] = $month; + } else { + $value[$i]['max'] = 0; + } + } else { + $value[$i]['max'] = 0; + }; + } +} + +// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] +// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] +// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] +foreach ($wipwhole_array as $wip) { + if (isset($arrayData[$wip['contractno']]) && isset($arrayData[$wip['contractno']][$wip['facilityno']]) && !empty($arrayData[$wip['contractno']]['total_facility_num'])) { + $stagearray = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + foreach ($stagearray as $stage) { + $arrayData[$wip['contractno']][$wip['facilityno']][$stage]['con'] = $arrayData[$wip['contractno']][$stage][1] / $arrayData[$wip['contractno']]['total_facility_num']; + } + } } // [invoice][發票號碼][0 發票日期, 1 發票金額, 2 發票狀態, 3 收款日期, 4 收款金額, 5 手續費, 6 核銷單號] foreach ($invoice_data as $invoice) { @@ -415,7 +684,74 @@ foreach ($received_array as $received) { } } -$data = json_encode($arrayData); + +//產生excel的array +$excel_aray = array(); +$boga_array = array(); +$exclude_boga_array = array(); +foreach ($arrayData as $key => $value) { + $value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; + $value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; + $value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; + $value['install'][3] = (isset($value['install'][3])) ? $value['install'][3] : 0; + $value['tryrun'][3] = (isset($value['tryrun'][3])) ? $value['tryrun'][3] : 0; + $value['check'][3] = (isset($value['check'][3])) ? $value['check'][3] : 0; + $value['delivery'][3] = (isset($value['delivery'][3])) ? $value['delivery'][3] : 0; + $value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0; + $contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); + foreach ($contractstage as $i) { + $value[$i]['max'] = (empty($value[$i]['max']) || !isset($value[$i]['max'])) ? 0 : $value[$i]['max']; + $value[$i]['min'] = (empty($value[$i]['min']) || !isset($value[$i]['min'])) ? 0 : $value[$i]['min']; + }; + + + if ($value['sign'][0] == "寶佳出貨前30天") { + $boga_array[$key] = [ + $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], + $value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], + $value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], + $value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], + $value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], + $value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], + $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], + $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], + $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], + $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('
', '; ', $value['facilities']) + ]; + }else{ + $exclude_boga_array[$key] = [ + $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], + $value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], + $value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], + $value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], + $value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], + $value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], + $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], + $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], + $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], + $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('
', '; ', $value['facilities']) + ]; + } + + + + $excel_aray[$key] = [ + $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], + $value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], + $value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], + $value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], + $value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], + $value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], + $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], + $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], + $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], + $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('
', '; ', $value['facilities']) + ]; +} + +$data = json_encode($excel_aray); +$boga_data = json_encode($boga_array); +$exclude_boga_data = json_encode($exclude_boga_array); ?> - + + + + + 合約作番明細 +
@@ -467,42 +812,42 @@ $data = json_encode($arrayData); - + - + - + - + - + - + - + - + - + @@ -511,7 +856,7 @@ $data = json_encode($arrayData); foreach ($arrayData as $key => $value) { ?> - + @@ -552,8 +897,8 @@ $data = json_encode($arrayData); - "; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + 0) { + // 如果有一筆以上代表有更新 + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/account-record-update.php b/wms/account-record-update.php index 9746db8e..b78299b8 100644 --- a/wms/account-record-update.php +++ b/wms/account-record-update.php @@ -1,66 +1,66 @@ - 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/account-user-input.php b/wms/account-user-input.php index aa3380c5..2af17727 100644 --- a/wms/account-user-input.php +++ b/wms/account-user-input.php @@ -1,65 +1,65 @@ - + diff --git a/wms/account_auth-create.php b/wms/account_auth-create.php index 4186c4e0..7448e57c 100644 --- a/wms/account_auth-create.php +++ b/wms/account_auth-create.php @@ -1,177 +1,177 @@ - - - -
- - Please fill up the required field!

"; - } else { - echo "

Record has added successfully

"; - } - } - */ - ?> - - - -
"> -
- - -
-
- - -
- -
客戶名稱 簽約款 應收簽約金額簽約最大催收次數 簽約最小催收次數簽約最大催收次數 二次款 應收二次金額二次最大催收次數 二次最小催收次數二次最大催收次數 貨抵工地款 應收貨抵工地金額貨抵工地最大催收次數 貨抵工地最小催收次數貨抵工地最大催收次數 安裝款 應收安裝金額安裝最大催收次數 安裝最小催收次數安裝最大催收次數 試車款 應收試車金額試車最大催收次數 試車最小催收次數試車最大催收次數 官檢款 應收官檢金額官檢最大催收次數 官檢最小催收次數官檢最大催收次數 移交款 應收移交金額移交最大催收次數 移交最小催收次數移交最大催收次數 尾款 應收尾款金額尾款最大催收次數 尾款最小催收次數尾款最大催收次數 合約總金額 目前應收 已開發票金額 已收金額 收款狀態
- - - - - - - - - $val) { - foreach($val as $k2 => $v2) { - if ($k2 == "main_menu") continue; - $td_str = ($k2 == 1) ? '' : ''; - $sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; -?> - > - - - - - - - -
主功能名稱子功能名稱控管
'.$val["main_menu"].' - - -
-
- - -

-
- -
- - "> -

-
- -
-
- -
- - - - -
- - + + + +
+ + Please fill up the required field!

"; + } else { + echo "

Record has added successfully

"; + } + } + */ + ?> + + + +
"> +
+ + +
+
+ + +
+ + + + + + + + + + + $val) { + foreach($val as $k2 => $v2) { + if ($k2 == "main_menu") continue; + $td_str = ($k2 == 1) ? '' : ''; + $sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; +?> + > + + + + + + + +
主功能名稱子功能名稱控管
'.$val["main_menu"].' + + +
+
+ + +

+
+ +
+ + "> +

+
+ +
+
+ +
+ + + +
+
+ + diff --git a/wms/account_auth-edit.php b/wms/account_auth-edit.php index 1e641805..a274bf1a 100644 --- a/wms/account_auth-edit.php +++ b/wms/account_auth-edit.php @@ -1,182 +1,182 @@ - 'X'"; - $result = mysqli_query($link, $sql); - while ($row_a = mysqli_fetch_row($result)) { - $person .= $row_a[1]."(".$row_a[0].")、"; - } - mysqli_free_result($result); -?> - - -
-
- - -
- - -
-
- - -
- - - - - - - - - - - - $val) { - foreach($val as $k2 => $v2) { - if ($k2 == "main_menu") continue; - $td_str = ($k2 == 1) ? '' : ''; - $sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; - $chk_r = $chk_w = ""; - if (!empty($permission_arr[$v2["mlink"]])) { - if ($permission_arr[$v2["mlink"]]&1) $chk_r = " checked"; - if ($permission_arr[$v2["mlink"]]&2) $chk_w = " checked"; - } -?> - > - - - - - - - - -
主功能名稱子功能名稱 - - - -
'.$val["main_menu"].' - - - - - -
- -
- - -
-
-
- - -
-
-
- -
- - - "> - "> - - "> -
-
- - - + 'X'"; + $result = mysqli_query($link, $sql); + while ($row_a = mysqli_fetch_row($result)) { + $person .= $row_a[1]."(".$row_a[0].")、"; + } + mysqli_free_result($result); +?> + + +
+
+ + +
+ + +
+
+ + +
+ + + + + + + + + + + + $val) { + foreach($val as $k2 => $v2) { + if ($k2 == "main_menu") continue; + $td_str = ($k2 == 1) ? '' : ''; + $sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; + $chk_r = $chk_w = ""; + if (!empty($permission_arr[$v2["mlink"]])) { + if ($permission_arr[$v2["mlink"]]&1) $chk_r = " checked"; + if ($permission_arr[$v2["mlink"]]&2) $chk_w = " checked"; + } +?> + > + + + + + + + + +
主功能名稱子功能名稱 + + + +
'.$val["main_menu"].' + + + + + +
+ +
+ + +
+
+
+ + +
+
+
+ +
+ + + "> + "> + + "> +
+
+ + + diff --git a/wms/account_auth-index.php b/wms/account_auth-index.php index 6a8d5e5f..d1dc283b 100644 --- a/wms/account_auth-index.php +++ b/wms/account_auth-index.php @@ -1,105 +1,105 @@ - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
項次部門代碼部門名稱職務代碼職務名稱建檔人建檔時間修改
-

- - - -

-
-
- -There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); -include "footer.php"; + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次部門代碼部門名稱職務代碼職務名稱建檔人建檔時間修改
+

+ + + +

+
+
+ +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); +include "footer.php"; ?> \ No newline at end of file diff --git a/wms/account_auth-record-update.php b/wms/account_auth-record-update.php index 0cdab8bc..cf0ea3c3 100644 --- a/wms/account_auth-record-update.php +++ b/wms/account_auth-record-update.php @@ -1,65 +1,65 @@ - $v) { - $$k = htmlspecialchars(stripslashes(trim($v))); - } - //print_r($_POST);exit; - - // 選單各功能的權限 - $prog_arr = []; - $opt_r_arr = explode(",", $opt_r_all); - $opt_w_arr = explode(",", $opt_w_all); - foreach ($opt_r_arr as $key => $val) { - list($menu_id, $auth_r) = explode(";", $val); - list($menu_id, $auth_w) = explode(";", $opt_w_arr[$key]); - - // 找出相關程式 - $sql = "select link_content from menu where id = '$menu_id'"; - $res = mysqli_query($link, $sql); - if ($row = mysqli_fetch_assoc($res)) { - if ($row["link_content"]) { - $tmp_arr = explode("\r\n", $row["link_content"]); - foreach ($tmp_arr as $v) { - $prog_arr[$v] = $auth_r|$auth_w; - } - } - } - mysqli_free_result($res); - - if (($key%10)==0) usleep(200000); - } - - // 開始更新權限 - $permission = json_encode($prog_arr, JSON_UNESCAPED_SLASHES); - $sql = "update department set permission = '$permission', create_at = '$create_at' where id = '$id'"; - mysqli_query($link, $sql); - $affected = mysqli_affected_rows($link); - - // 更新user權限 - $sql = "select accountid from account where department_id = '$department_id' and role_id = '$role_id'"; - $res = mysqli_query($link, $sql); - while ($row = mysqli_fetch_row($res)) { - $db_query = "insert into account_auth (accountid, permission) values ('$row[0]', '$permission') "; - $db_query .= "ON DUPLICATE KEY UPDATE accountid = '$row[0]', permission = '$permission'"; - $res_u = mysqli_query($link, $db_query); - } - mysqli_free_result($res); - - mysqli_close($link); - if ($affected > 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + //print_r($_POST);exit; + + // 選單各功能的權限 + $prog_arr = []; + $opt_r_arr = explode(",", $opt_r_all); + $opt_w_arr = explode(",", $opt_w_all); + foreach ($opt_r_arr as $key => $val) { + list($menu_id, $auth_r) = explode(";", $val); + list($menu_id, $auth_w) = explode(";", $opt_w_arr[$key]); + + // 找出相關程式 + $sql = "select link_content from menu where id = '$menu_id'"; + $res = mysqli_query($link, $sql); + if ($row = mysqli_fetch_assoc($res)) { + if ($row["link_content"]) { + $tmp_arr = explode("\r\n", $row["link_content"]); + foreach ($tmp_arr as $v) { + $prog_arr[$v] = $auth_r|$auth_w; + } + } + } + mysqli_free_result($res); + + if (($key%10)==0) usleep(200000); + } + + // 開始更新權限 + $permission = json_encode($prog_arr, JSON_UNESCAPED_SLASHES); + $sql = "update department set permission = '$permission', create_at = '$create_at' where id = '$id'"; + mysqli_query($link, $sql); + $affected = mysqli_affected_rows($link); + + // 更新user權限 + $sql = "select accountid from account where department_id = '$department_id' and role_id = '$role_id'"; + $res = mysqli_query($link, $sql); + while ($row = mysqli_fetch_row($res)) { + $db_query = "insert into account_auth (accountid, permission) values ('$row[0]', '$permission') "; + $db_query .= "ON DUPLICATE KEY UPDATE accountid = '$row[0]', permission = '$permission'"; + $res_u = mysqli_query($link, $db_query); + } + mysqli_free_result($res); + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/assets/img/icon/(Ñ╝¿╧Ñ╬)icon-star-active.png b/wms/assets/img/icon/(Ñ╝¿╧Ñ╬)icon-star-active.png new file mode 100644 index 00000000..b6da6739 Binary files /dev/null and b/wms/assets/img/icon/(Ñ╝¿╧Ñ╬)icon-star-active.png differ diff --git a/wms/assets/img/icon/(Ñ╝¿╧Ñ╬)icon-star-default.png b/wms/assets/img/icon/(Ñ╝¿╧Ñ╬)icon-star-default.png new file mode 100644 index 00000000..61dfa1ca Binary files /dev/null and b/wms/assets/img/icon/(Ñ╝¿╧Ñ╬)icon-star-default.png differ diff --git a/wms/bargain-create.php b/wms/bargain-create.php index b39c625e..4188986c 100644 --- a/wms/bargain-create.php +++ b/wms/bargain-create.php @@ -1,313 +1,313 @@ - "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; - -$sql = "select max(bargainno) as maxno from bargain"; -$res = mysqli_query($link, $sql); -$row = mysqli_fetch_row($res); -$bargainno = $row[0] ? $row[0]+1 : date("Ym")."001"; - -$sql = "select department_id from account where accountid = '$user_id'"; -$res = mysqli_query($link, $sql); -$row = mysqli_fetch_row($res); -list($department_id) = $row; -mysqli_free_result($res); - -$department_arr = []; -$sql = "select department_id, name from department"; -$res = mysqli_query($link, $sql); -while ($row = mysqli_fetch_row($res)) { - $department_arr[$row[0]] = $row[1]; -} -mysqli_free_result($res); -?> - - -
-Please fill up the required field!

"; - } else { - echo "

Record has added successfully

"; - } -} -*/ -?> - -
" enctype="multipart/form-data"> -
- - -
-
- - - -
-
- - -
-
- - -
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
-
-
- -
- -
-
-
- - -
-
- - -
-
- - -
-
-
- -
-
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

附件上傳及信息維護

序號作成單位提供◎維護信息配合單位提供◎維護信息
供應商名稱供應商報價單上傳報價備註議價後報價單上傳議價後報價備註
1
-
- - -
- - "> -

-
-
-
- -
- - - - - - - -
-
- + "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; + +$sql = "select max(bargainno) as maxno from bargain"; +$res = mysqli_query($link, $sql); +$row = mysqli_fetch_row($res); +$bargainno = $row[0] ? $row[0]+1 : date("Ym")."001"; + +$sql = "select department_id from account where accountid = '$user_id'"; +$res = mysqli_query($link, $sql); +$row = mysqli_fetch_row($res); +list($department_id) = $row; +mysqli_free_result($res); + +$department_arr = []; +$sql = "select department_id, name from department"; +$res = mysqli_query($link, $sql); +while ($row = mysqli_fetch_row($res)) { + $department_arr[$row[0]] = $row[1]; +} +mysqli_free_result($res); +?> + + +
+Please fill up the required field!

"; + } else { + echo "

Record has added successfully

"; + } +} +*/ +?> + +
" enctype="multipart/form-data"> +
+ + +
+
+ + + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

附件上傳及信息維護

序號作成單位提供◎維護信息配合單位提供◎維護信息
供應商名稱供應商報價單上傳報價備註議價後報價單上傳議價後報價備註
1
+
+ + +
+ + "> +

+
+
+
+ +
+ + + + + + + +
+
+ \ No newline at end of file diff --git a/wms/bargain-delete.php b/wms/bargain-delete.php index 51d66fd2..786bff07 100644 --- a/wms/bargain-delete.php +++ b/wms/bargain-delete.php @@ -1,29 +1,29 @@ -"; - //echo "alert('審核中,已無法刪除');"; - echo "alert('資料無法刪除');"; - echo "location.href='pricereview-index.php'"; - echo ""; - exit; -} -*/ -$db_query = "delete from bargain_supplier where bid = '$id'"; -if ($rs = mysqli_query($link, $db_query)) { - $db_query = "delete from bargain where id = '$id'"; - mysqli_query($link, $db_query); -} - -header("Refresh:0; url=bargain-index.php?function_name=bargain&".$token_link); -ob_end_flush(); +"; + //echo "alert('審核中,已無法刪除');"; + echo "alert('資料無法刪除');"; + echo "location.href='pricereview-index.php'"; + echo ""; + exit; +} +*/ +$db_query = "delete from bargain_supplier where bid = '$id'"; +if ($rs = mysqli_query($link, $db_query)) { + $db_query = "delete from bargain where id = '$id'"; + mysqli_query($link, $db_query); +} + +header("Refresh:0; url=bargain-index.php?function_name=bargain&".$token_link); +ob_end_flush(); ?> \ No newline at end of file diff --git a/wms/bargain-edit.php b/wms/bargain-edit.php index 33f6e2da..9fd09dca 100644 --- a/wms/bargain-edit.php +++ b/wms/bargain-edit.php @@ -1,375 +1,375 @@ - "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; - -$db_query = "select * from bargain where id = '$id'"; -$data = mysqli_query($link, $db_query); - -$department_arr = []; -$sql = "select department_id, name from department"; -$res = mysqli_query($link, $sql); -while ($row = mysqli_fetch_row($res)) { - $department_arr[$row[0]] = $row[1]; -} -mysqli_free_result($res); - -foreach($data as $data) : - $sql = "select name from account where accountid = '".$data['creater']."'"; - $res = mysqli_query($link, $sql); - $row = mysqli_fetch_row($res); - list($creater_name) = $row; - mysqli_free_result($res); - - $item_arr = []; - $sql = "select * from bargain_supplier where bid = '$id' order by supplier_id"; - $res = mysqli_query($link, $sql); - while ($row = mysqli_fetch_assoc($res)) { - $item_arr[$row['supplier_id']]['id'] = $row['id']; - $item_arr[$row['supplier_id']]['supplier'] = $row['supplier']; - $item_arr[$row['supplier_id']]['supplier_attatch_be'] = $row['supplier_attatch_be']; - $item_arr[$row['supplier_id']]['quote_amt_be'] = $row['quote_amt_be']; - $item_arr[$row['supplier_id']]['note_be'] = $row['note_be']; - $item_arr[$row['supplier_id']]['supplier_attatch_ar'] = $row['supplier_attatch_ar']; - $item_arr[$row['supplier_id']]['quote_amt_ar'] = $row['quote_amt_ar']; - $item_arr[$row['supplier_id']]['note_ar'] = $row['note_ar']; - } - mysqli_free_result($res); -?> - - -
-
-
- - -
-
- - - -
-
- - -
-
- - -
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - ".substr($data["attatch1"], strrpos($data["attatch1"],"/")+1).""; - ?> -
- -
-
-
- - ".substr($data["attatch2"], strrpos($data["attatch2"],"/")+1).""; - ?> -
- -
-
-
- - -
-
- - -
-
- - -
-
-
- -
-
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - $val) { - ?> - - - - - - - - - - - - - - - - - - - - - - - - -

附件上傳及信息維護

序號作成單位提供◎維護信息配合單位提供◎維護信息
供應商名稱供應商報價單上傳報價備註議價後報價單上傳議價後報價備註
- ".substr($val['supplier_attatch_be'], strrpos($val['supplier_attatch_be'],"/")+1).""; - else echo "--"; - ?> - - ".substr($val['supplier_attatch_ar'], strrpos($val['supplier_attatch_ar'],"/")+1).""; - else echo "--"; - ?> -
-
- - -
- - "> -

-
-
-
- -
- - - - - - - - - - - -
-
- "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; + +$db_query = "select * from bargain where id = '$id'"; +$data = mysqli_query($link, $db_query); + +$department_arr = []; +$sql = "select department_id, name from department"; +$res = mysqli_query($link, $sql); +while ($row = mysqli_fetch_row($res)) { + $department_arr[$row[0]] = $row[1]; +} +mysqli_free_result($res); + +foreach($data as $data) : + $sql = "select name from account where accountid = '".$data['creater']."'"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + list($creater_name) = $row; + mysqli_free_result($res); + + $item_arr = []; + $sql = "select * from bargain_supplier where bid = '$id' order by supplier_id"; + $res = mysqli_query($link, $sql); + while ($row = mysqli_fetch_assoc($res)) { + $item_arr[$row['supplier_id']]['id'] = $row['id']; + $item_arr[$row['supplier_id']]['supplier'] = $row['supplier']; + $item_arr[$row['supplier_id']]['supplier_attatch_be'] = $row['supplier_attatch_be']; + $item_arr[$row['supplier_id']]['quote_amt_be'] = $row['quote_amt_be']; + $item_arr[$row['supplier_id']]['note_be'] = $row['note_be']; + $item_arr[$row['supplier_id']]['supplier_attatch_ar'] = $row['supplier_attatch_ar']; + $item_arr[$row['supplier_id']]['quote_amt_ar'] = $row['quote_amt_ar']; + $item_arr[$row['supplier_id']]['note_ar'] = $row['note_ar']; + } + mysqli_free_result($res); +?> + + +
+
+
+ + +
+
+ + + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + ".substr($data["attatch1"], strrpos($data["attatch1"],"/")+1).""; + ?> +
+ +
+
+
+ + ".substr($data["attatch2"], strrpos($data["attatch2"],"/")+1).""; + ?> +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + $val) { + ?> + + + + + + + + + + + + + + + + + + + + + + + + +

附件上傳及信息維護

序號作成單位提供◎維護信息配合單位提供◎維護信息
供應商名稱供應商報價單上傳報價備註議價後報價單上傳議價後報價備註
+ ".substr($val['supplier_attatch_be'], strrpos($val['supplier_attatch_be'],"/")+1).""; + else echo "--"; + ?> + + ".substr($val['supplier_attatch_ar'], strrpos($val['supplier_attatch_ar'],"/")+1).""; + else echo "--"; + ?> +
+
+ + +
+ + "> +

+
+
+
+ +
+ + + + + + + + + + + +
+
+ \ No newline at end of file diff --git a/wms/bargain-index.php b/wms/bargain-index.php index 52d8daad..33afaf71 100644 --- a/wms/bargain-index.php +++ b/wms/bargain-index.php @@ -1,144 +1,144 @@ - "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; - -$sql = "select department_id, name from department"; -$res = mysqli_query($link, $sql); -while ($row = mysqli_fetch_row($res)) { - $department_arr[$row[0]] = $row[1]; -} -mysqli_free_result($res); - -// sql語法存在變數中 -$sql = "select * from bargain order by id"; - -// 用mysqli_query方法執行(sql語法)將結果存在變數中 -$data = mysqli_query($link,$sql); -?> - - -

- - - -

- -Please fill up the required field!

"; - } else { - header("Location:bargain-index.php"); - } - } - -?> - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
項次申請單號作成單位作成者收文單位回答期限項目名稱類別品牌型號預估數量建檔人建檔時間修改刪除
-

- - - -

-
-

- - - -

-
-
- -There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); - -include "footer.php"; + "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; + +$sql = "select department_id, name from department"; +$res = mysqli_query($link, $sql); +while ($row = mysqli_fetch_row($res)) { + $department_arr[$row[0]] = $row[1]; +} +mysqli_free_result($res); + +// sql語法存在變數中 +$sql = "select * from bargain order by id"; + +// 用mysqli_query方法執行(sql語法)將結果存在變數中 +$data = mysqli_query($link,$sql); +?> + + +

+ + + +

+ +Please fill up the required field!

"; + } else { + header("Location:bargain-index.php"); + } + } + +?> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次申請單號作成單位作成者收文單位回答期限項目名稱類別品牌型號預估數量建檔人建檔時間修改刪除
+

+ + + +

+
+

+ + + +

+
+
+ +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; ?> \ No newline at end of file diff --git a/wms/bargain-record-submit.php b/wms/bargain-record-submit.php index a4e2ddcf..b61ef444 100644 --- a/wms/bargain-record-submit.php +++ b/wms/bargain-record-submit.php @@ -1,149 +1,149 @@ - $v) { - $$k = htmlspecialchars(stripslashes(trim($v))); - } - - $sql = "select max(bargainno) as maxno from bargain"; - $res = mysqli_query($link, $sql); - $row = mysqli_fetch_row($res); - $bargainno_check = $row[0] ? $row[0]+1 : date("Ym")."001"; - if ($bargainno_check <> $bargainno) $bargainno = $bargainno_check; - - if ($_FILES["attatch1"]["error"] == 0) { - $file_name = $_FILES["attatch1"]["name"]; - $temp_file_name = $_FILES["attatch1"]["tmp_name"]; - $file_size = $_FILES["attatch1"]["size"]; - $target_dir = "bargain-uploads/"; - $target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); - $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); - $upload_ok = 1; - //if (file_exists($target_file1)) unlink($target_file1); - foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { - unlink($todelfile); - } - $upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); - } else $target_file1 = ""; - - if ($_FILES["attatch2"]["error"] == 0) { - $file_name = $_FILES["attatch2"]["name"]; - $temp_file_name = $_FILES["attatch2"]["tmp_name"]; - $file_size = $_FILES["attatch2"]["size"]; - $target_dir = "bargain-uploads/"; - $target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); - $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); - $upload_ok = 1; - //if (file_exists($target_file2)) unlink($target_file2); - foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { - unlink($todelfile); - } - $upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); - } else $target_file2 = ""; - - if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { - echo ""; - } - - $db_query = "insert into bargain (bargainno, department_id, proposer, receiver, response_dt, item, annual, urgent, vendor, prospecting, category, "; - $db_query .= "dealer, reason, brand, model, quantity, brandkeep, lead_time, margin, margin_day, acceptance, purchase_history, "; - $db_query .= "attatch1, attatch2, item_description, repairno, category_repair, content, quotation, creater, create_at) values ("; - $db_query .= "'$bargainno', '$department_id', '$proposer', '$receiver', '$response_dt', '$item', '$annual', '$urgent', '$vendor', '$prospecting', '$category', "; - $db_query .= "'$dealer', '$reason', '$brand', '$model', '$quantity', '$brandkeep', '$lead_time', '$margin', '$margin_day', '$acceptance', '$purchase_history', "; - $db_query .= "'$target_file1', '$target_file2', '$item_description', '$repairno', '$category_repair', '$content', '$quotation', '$user_id', '$create_at')"; - $result = mysqli_query($link, $db_query); - $affected = mysqli_affected_rows($link); - if ($result && $sup_id_all != "") { - $bid = mysqli_insert_id($link); - $sup_id_arr = explode(",", $sup_id_all); - $supplier_arr = explode(",", $supplier_all); - $quote_amt_be_arr = explode(",", $quote_amt_be_all); - $note_be_arr = explode(",", $note_be_all); - $quote_amt_ar_arr = explode(",", $quote_amt_ar_all); - $note_ar_arr = explode(",", $note_ar_all); - $item_no = 1; - - for ($i=0; $i"; - echo "alert('檔案上傳失敗,資料請重建!".$sql."');"; - echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; - echo ""; - } - - $quote_amt_be_arr[$i] = str_replace(",", "", $quote_amt_be_arr[$i]); - $quote_amt_ar_all[$i] = str_replace(",", "", $quote_amt_ar_all[$i]); - $db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; - $db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; - $db_query .= "'$bid', '$item_no', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; - $db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; - $result = mysqli_query($link, $db_query); - $item_no++; - } - } - - mysqli_close($link); - if ($affected > 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + $sql = "select max(bargainno) as maxno from bargain"; + $res = mysqli_query($link, $sql); + $row = mysqli_fetch_row($res); + $bargainno_check = $row[0] ? $row[0]+1 : date("Ym")."001"; + if ($bargainno_check <> $bargainno) $bargainno = $bargainno_check; + + if ($_FILES["attatch1"]["error"] == 0) { + $file_name = $_FILES["attatch1"]["name"]; + $temp_file_name = $_FILES["attatch1"]["tmp_name"]; + $file_size = $_FILES["attatch1"]["size"]; + $target_dir = "bargain-uploads/"; + $target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); + $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); + $upload_ok = 1; + //if (file_exists($target_file1)) unlink($target_file1); + foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { + unlink($todelfile); + } + $upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); + } else $target_file1 = ""; + + if ($_FILES["attatch2"]["error"] == 0) { + $file_name = $_FILES["attatch2"]["name"]; + $temp_file_name = $_FILES["attatch2"]["tmp_name"]; + $file_size = $_FILES["attatch2"]["size"]; + $target_dir = "bargain-uploads/"; + $target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); + $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); + $upload_ok = 1; + //if (file_exists($target_file2)) unlink($target_file2); + foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { + unlink($todelfile); + } + $upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); + } else $target_file2 = ""; + + if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { + echo ""; + } + + $db_query = "insert into bargain (bargainno, department_id, proposer, receiver, response_dt, item, annual, urgent, vendor, prospecting, category, "; + $db_query .= "dealer, reason, brand, model, quantity, brandkeep, lead_time, margin, margin_day, acceptance, purchase_history, "; + $db_query .= "attatch1, attatch2, item_description, repairno, category_repair, content, quotation, creater, create_at) values ("; + $db_query .= "'$bargainno', '$department_id', '$proposer', '$receiver', '$response_dt', '$item', '$annual', '$urgent', '$vendor', '$prospecting', '$category', "; + $db_query .= "'$dealer', '$reason', '$brand', '$model', '$quantity', '$brandkeep', '$lead_time', '$margin', '$margin_day', '$acceptance', '$purchase_history', "; + $db_query .= "'$target_file1', '$target_file2', '$item_description', '$repairno', '$category_repair', '$content', '$quotation', '$user_id', '$create_at')"; + $result = mysqli_query($link, $db_query); + $affected = mysqli_affected_rows($link); + if ($result && $sup_id_all != "") { + $bid = mysqli_insert_id($link); + $sup_id_arr = explode(",", $sup_id_all); + $supplier_arr = explode(",", $supplier_all); + $quote_amt_be_arr = explode(",", $quote_amt_be_all); + $note_be_arr = explode(",", $note_be_all); + $quote_amt_ar_arr = explode(",", $quote_amt_ar_all); + $note_ar_arr = explode(",", $note_ar_all); + $item_no = 1; + + for ($i=0; $i"; + echo "alert('檔案上傳失敗,資料請重建!".$sql."');"; + echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; + echo ""; + } + + $quote_amt_be_arr[$i] = str_replace(",", "", $quote_amt_be_arr[$i]); + $quote_amt_ar_all[$i] = str_replace(",", "", $quote_amt_ar_all[$i]); + $db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; + $db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; + $db_query .= "'$bid', '$item_no', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; + $db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; + $result = mysqli_query($link, $db_query); + $item_no++; + } + } + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/bargain-record-update.php b/wms/bargain-record-update.php index d3b27af3..097c5499 100644 --- a/wms/bargain-record-update.php +++ b/wms/bargain-record-update.php @@ -1,144 +1,144 @@ - $v) { - $$k = htmlspecialchars(stripslashes(trim($v))); - } - //print_r($_POST); - //print_r($_FILES);exit; - - $sql_atta = ""; - - $quantity = str_replace(",", "", $quantity); - $lead_time = str_replace(",", "", $lead_time); - $margin_day = str_replace(",", "", $margin_day); - - if ($_FILES["attatch1"]["error"] == 0) { - $file_name = $_FILES["attatch1"]["name"]; - $temp_file_name = $_FILES["attatch1"]["tmp_name"]; - $file_size = $_FILES["attatch1"]["size"]; - $target_dir = "bargain-uploads/"; - $target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); - $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); - $upload_ok = 1; - //if (file_exists($target_file1)) unlink($target_file1); - foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { - unlink($todelfile); - } - $upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); - $sql_atta .= "attatch1 = '$target_file1', "; - } else $target_file1 = ""; - - if ($_FILES["attatch2"]["error"] == 0) { - $file_name = $_FILES["attatch2"]["name"]; - $temp_file_name = $_FILES["attatch2"]["tmp_name"]; - $file_size = $_FILES["attatch2"]["size"]; - $target_dir = "bargain-uploads/"; - $target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); - $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); - $upload_ok = 1; - //if (file_exists($target_file2)) unlink($target_file2); - foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { - unlink($todelfile); - } - $upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); - $sql_atta .= "attatch2 = '$target_file2', "; - } else $target_file2 = ""; - - if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { - echo ""; - } - - $db_query = "update bargain set receiver = '$receiver', response_dt = '$response_dt', item = '$item', annual = '$annual', urgent = '$urgent', "; - $db_query .= "vendor = '$vendor', prospecting = '$prospecting', category = '$category', dealer = '$dealer', reason = '$reason', brand = '$brand', "; - $db_query .= "model = '$model', quantity = '$quantity', brandkeep = '$brandkeep', lead_time = '$lead_time', margin = '$margin', margin_day = '$margin_day', "; - $db_query .= "acceptance = '$acceptance', purchase_history = '$purchase_history', item_description = '$item_description', repairno = '$repairno', "; - $db_query .= $sql_atta; - $db_query .= "category_repair = '$category_repair', content = '$content', quotation = '$quotation', create_dt = '$create_at' "; - $db_query .= "where id = '$id'"; - $result = mysqli_query($link, $db_query); - $affected = mysqli_affected_rows($link); - if ($result && $sup_id_all != "") { - $bsid_arr = explode(",", $bsid_all); - $sup_id_arr = explode(",", $sup_id_all); - $supplier_arr = explode(",", rtrim($supplier_all, ",")); - $quote_amt_be_arr = explode(",", $quote_amt_be_all); - $note_be_arr = explode(",", $note_be_all); - $quote_amt_ar_arr = explode(",", $quote_amt_ar_all); - $note_ar_arr = explode(",", $note_ar_all); - $item_no = 1; - - // 有新增的供應商 - $new_sup_cnt = count($supplier_arr) - count($bsid_arr); - if ($new_sup_cnt > 0) $next_sup_id = max($sup_id_arr)+1; - $idx = 0; - for ($i=0; $i 0 && $bsid_arr[$i] == "") { // 新增 - $target_file_be = $target_file_ar = ""; - if ($_FILES["supplier_attatch_be"]["name"]) { // 有上傳檔案 - if ($_FILES["supplier_attatch_be"]["name"][$idx] && ($_FILES["supplier_attatch_be"]["error"][$idx] == 0)) { - $file_name = $_FILES["supplier_attatch_be"]["name"][$idx]; - $temp_file_name = $_FILES["supplier_attatch_be"]["tmp_name"][$idx]; - $file_size = $_FILES["supplier_attatch_be"]["size"][$idx]; - $target_dir = "bargain-uploads/supplier/"; - $target_file_be = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); - $upload_ok = 1; - $img_file_type = pathinfo($target_file_be, PATHINFO_EXTENSION); - $upload_res_be = move_uploaded_file($temp_file_name, $target_file_be); - } - } - if ($_FILES["supplier_attatch_ar"]["name"]) { // 有上傳檔案 - if ($_FILES["supplier_attatch_ar"]["name"][$idx] && ($_FILES["supplier_attatch_ar"]["error"][$idx] == 0)) { - $file_name = $_FILES["supplier_attatch_ar"]["name"][$idx]; - $temp_file_name = $_FILES["supplier_attatch_ar"]["tmp_name"][$idx]; - $file_size = $_FILES["supplier_attatch_ar"]["size"][$idx]; - $target_dir = "bargain-uploads/supplier/"; - $target_file_ar = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); - $upload_ok = 1; - $img_file_type = pathinfo($target_file_ar, PATHINFO_EXTENSION); - $upload_res_ar = move_uploaded_file($temp_file_name, $target_file_ar); - } - } - if ($upload_res_be || $upload_res_ar) $idx++; - if (($target_file_be && !$upload_res_be) || ($target_file_ar && !$upload_res_ar)) { - echo ""; - } - $db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; - $db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; - $db_query .= "'$id', '$next_sup_id', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; - $db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; - $result = mysqli_query($link, $db_query); - $next_sup_id++; - } else { // 修改(不支援重傳檔案) - $db_query = "update bargain_supplier set supplier = '$supplier_arr[$i]', quote_amt_be = '$quote_amt_be_arr[$i]', "; - $db_query .= "note_be = '$note_be_arr[$i]', quote_amt_ar = '$quote_amt_ar_arr[$i]', "; - $db_query .= "note_ar = '$note_ar_arr[$i]', create_at = '$create_at' "; - $db_query .= "where id = '$bsid_arr[$i]'"; - $result = mysqli_query($link, $db_query); - } - } - } - - mysqli_close($link); - if ($affected > 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + //print_r($_POST); + //print_r($_FILES);exit; + + $sql_atta = ""; + + $quantity = str_replace(",", "", $quantity); + $lead_time = str_replace(",", "", $lead_time); + $margin_day = str_replace(",", "", $margin_day); + + if ($_FILES["attatch1"]["error"] == 0) { + $file_name = $_FILES["attatch1"]["name"]; + $temp_file_name = $_FILES["attatch1"]["tmp_name"]; + $file_size = $_FILES["attatch1"]["size"]; + $target_dir = "bargain-uploads/"; + $target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); + $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); + $upload_ok = 1; + //if (file_exists($target_file1)) unlink($target_file1); + foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { + unlink($todelfile); + } + $upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); + $sql_atta .= "attatch1 = '$target_file1', "; + } else $target_file1 = ""; + + if ($_FILES["attatch2"]["error"] == 0) { + $file_name = $_FILES["attatch2"]["name"]; + $temp_file_name = $_FILES["attatch2"]["tmp_name"]; + $file_size = $_FILES["attatch2"]["size"]; + $target_dir = "bargain-uploads/"; + $target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); + $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); + $upload_ok = 1; + //if (file_exists($target_file2)) unlink($target_file2); + foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { + unlink($todelfile); + } + $upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); + $sql_atta .= "attatch2 = '$target_file2', "; + } else $target_file2 = ""; + + if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { + echo ""; + } + + $db_query = "update bargain set receiver = '$receiver', response_dt = '$response_dt', item = '$item', annual = '$annual', urgent = '$urgent', "; + $db_query .= "vendor = '$vendor', prospecting = '$prospecting', category = '$category', dealer = '$dealer', reason = '$reason', brand = '$brand', "; + $db_query .= "model = '$model', quantity = '$quantity', brandkeep = '$brandkeep', lead_time = '$lead_time', margin = '$margin', margin_day = '$margin_day', "; + $db_query .= "acceptance = '$acceptance', purchase_history = '$purchase_history', item_description = '$item_description', repairno = '$repairno', "; + $db_query .= $sql_atta; + $db_query .= "category_repair = '$category_repair', content = '$content', quotation = '$quotation', create_dt = '$create_at' "; + $db_query .= "where id = '$id'"; + $result = mysqli_query($link, $db_query); + $affected = mysqli_affected_rows($link); + if ($result && $sup_id_all != "") { + $bsid_arr = explode(",", $bsid_all); + $sup_id_arr = explode(",", $sup_id_all); + $supplier_arr = explode(",", rtrim($supplier_all, ",")); + $quote_amt_be_arr = explode(",", $quote_amt_be_all); + $note_be_arr = explode(",", $note_be_all); + $quote_amt_ar_arr = explode(",", $quote_amt_ar_all); + $note_ar_arr = explode(",", $note_ar_all); + $item_no = 1; + + // 有新增的供應商 + $new_sup_cnt = count($supplier_arr) - count($bsid_arr); + if ($new_sup_cnt > 0) $next_sup_id = max($sup_id_arr)+1; + $idx = 0; + for ($i=0; $i 0 && $bsid_arr[$i] == "") { // 新增 + $target_file_be = $target_file_ar = ""; + if ($_FILES["supplier_attatch_be"]["name"]) { // 有上傳檔案 + if ($_FILES["supplier_attatch_be"]["name"][$idx] && ($_FILES["supplier_attatch_be"]["error"][$idx] == 0)) { + $file_name = $_FILES["supplier_attatch_be"]["name"][$idx]; + $temp_file_name = $_FILES["supplier_attatch_be"]["tmp_name"][$idx]; + $file_size = $_FILES["supplier_attatch_be"]["size"][$idx]; + $target_dir = "bargain-uploads/supplier/"; + $target_file_be = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); + $upload_ok = 1; + $img_file_type = pathinfo($target_file_be, PATHINFO_EXTENSION); + $upload_res_be = move_uploaded_file($temp_file_name, $target_file_be); + } + } + if ($_FILES["supplier_attatch_ar"]["name"]) { // 有上傳檔案 + if ($_FILES["supplier_attatch_ar"]["name"][$idx] && ($_FILES["supplier_attatch_ar"]["error"][$idx] == 0)) { + $file_name = $_FILES["supplier_attatch_ar"]["name"][$idx]; + $temp_file_name = $_FILES["supplier_attatch_ar"]["tmp_name"][$idx]; + $file_size = $_FILES["supplier_attatch_ar"]["size"][$idx]; + $target_dir = "bargain-uploads/supplier/"; + $target_file_ar = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); + $upload_ok = 1; + $img_file_type = pathinfo($target_file_ar, PATHINFO_EXTENSION); + $upload_res_ar = move_uploaded_file($temp_file_name, $target_file_ar); + } + } + if ($upload_res_be || $upload_res_ar) $idx++; + if (($target_file_be && !$upload_res_be) || ($target_file_ar && !$upload_res_ar)) { + echo ""; + } + $db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; + $db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; + $db_query .= "'$id', '$next_sup_id', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; + $db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; + $result = mysqli_query($link, $db_query); + $next_sup_id++; + } else { // 修改(不支援重傳檔案) + $db_query = "update bargain_supplier set supplier = '$supplier_arr[$i]', quote_amt_be = '$quote_amt_be_arr[$i]', "; + $db_query .= "note_be = '$note_be_arr[$i]', quote_amt_ar = '$quote_amt_ar_arr[$i]', "; + $db_query .= "note_ar = '$note_ar_arr[$i]', create_at = '$create_at' "; + $db_query .= "where id = '$bsid_arr[$i]'"; + $result = mysqli_query($link, $db_query); + } + } + } + + mysqli_close($link); + if ($affected > 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/board-delete.php b/wms/board-delete.php index 1c9d73d9..808cf094 100644 --- a/wms/board-delete.php +++ b/wms/board-delete.php @@ -1,23 +1,23 @@ - \ No newline at end of file diff --git a/wms/board-edit.php b/wms/board-edit.php index e9f2f168..2e8c49b5 100644 --- a/wms/board-edit.php +++ b/wms/board-edit.php @@ -1,60 +1,60 @@ - - -
-
-
- - -
- -
- - -
-
- - -
- -
-
-
-
- -
-
-
- -
- -
-
- + +
+
+
+ + +
+ +
+ + +
+
+ + +
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+ \ No newline at end of file diff --git a/wms/board-file.php b/wms/board-file.php index 58d57ce8..4628950a 100644 --- a/wms/board-file.php +++ b/wms/board-file.php @@ -1,19 +1,19 @@ -"; - echo "alert('檔案下載失敗!');"; - echo ""; - header("Refresh:0; url=board-index.php?function_name=board&".$token_link); -} -ob_end_flush(); +"; + echo "alert('檔案下載失敗!');"; + echo ""; + header("Refresh:0; url=board-index.php?function_name=board&".$token_link); +} +ob_end_flush(); ?> \ No newline at end of file diff --git a/wms/board-index.php b/wms/board-index.php index ac67b1a9..80932de7 100644 --- a/wms/board-index.php +++ b/wms/board-index.php @@ -1,201 +1,201 @@ - - - - -

- - - -

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
項次主旨附件建檔人建檔時間關閉公告
- -

- - - - - -

-
-
- - - - - - - -There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); - -include "footer.php"; + + + + +

+ + + +

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
項次主旨附件建檔人建檔時間關閉公告
+ +

+ + + + + +

+
+
+ + + + + + + +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; ?> \ No newline at end of file diff --git a/wms/board-record-submit.php b/wms/board-record-submit.php index bfae3908..3a137e14 100644 --- a/wms/board-record-submit.php +++ b/wms/board-record-submit.php @@ -7,7 +7,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $$k = trim($v); } - function get_basename($filename) { + function get_basename($filename) + { return preg_replace('/^.+[\\\\\\/]/', '', $filename); } @@ -16,7 +17,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $temp_file_name = $_FILES["attatch1"]["tmp_name"]; $file_size = $_FILES["attatch1"]["size"]; $target_dir = "board-attach/"; - $target_file1 = strtolower($target_dir.get_basename($file_name)); + $target_file1 = strtolower($target_dir . get_basename($file_name)); $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); $upload_ok = 1; if (file_exists($target_file1)) unlink($target_file1); @@ -27,22 +28,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($target_file1 && !$upload_res_1) { echo ""; } $db_query = "insert into board (title, content, attach, pin, creater, create_at) values ("; - $db_query .= "'$title', '$content', '$target_file1', '1', '".$user_id."', NOW())"; + $db_query .= "'$title', '$content', '$target_file1', '1', '" . $user_id . "', NOW())"; $result = mysqli_query($link, $db_query); if (mysqli_affected_rows($link) > 0) { echo ""; - } elseif (mysqli_affected_rows($link)==0) { + } elseif (mysqli_affected_rows($link) == 0) { echo ""; } else { echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); @@ -50,4 +51,3 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { mysqli_close($link); } -?> \ No newline at end of file diff --git a/wms/board-record-update.php b/wms/board-record-update.php index e11ff195..89341386 100644 --- a/wms/board-record-update.php +++ b/wms/board-record-update.php @@ -1,52 +1,52 @@ - $v) { - $$k = htmlspecialchars(stripslashes(trim($v))); - } - //print_r($_POST); - //print_r($_FILES);exit; - - function get_basename($filename) { - return preg_replace('/^.+[\\\\\\/]/', '', $filename); - } - - $pin = ($pin == "Y") ? "99" : "1"; - $sql_atta = ""; - - if ($_FILES["attatch1"]["error"] == 0) { - $file_name = $_FILES["attatch1"]["name"]; - $temp_file_name = $_FILES["attatch1"]["tmp_name"]; - $file_size = $_FILES["attatch1"]["size"]; - $target_dir = "board-attach/"; - $target_file1 = strtolower($target_dir.get_basename($file_name)); - $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); - $upload_ok = 1; - if (file_exists($target_file1)) unlink($target_file1); - $upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); - $sql_atta .= "path = '$target_file1', "; - } else $target_file1 = ""; - - if ($target_file1 && !$upload_res_1) { - echo ""; - } - - $db_query = "update board set title = '$title', pin = '$pin', "; - $db_query .= $sql_atta; - $db_query .= "content = '$content'"; - $db_query .= "where id = '$id'"; - $result = mysqli_query($link, $db_query); - - mysqli_close($link); - - echo ""; -} + $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + //print_r($_POST); + //print_r($_FILES);exit; + + function get_basename($filename) { + return preg_replace('/^.+[\\\\\\/]/', '', $filename); + } + + $pin = ($pin == "Y") ? "99" : "1"; + $sql_atta = ""; + + if ($_FILES["attatch1"]["error"] == 0) { + $file_name = $_FILES["attatch1"]["name"]; + $temp_file_name = $_FILES["attatch1"]["tmp_name"]; + $file_size = $_FILES["attatch1"]["size"]; + $target_dir = "board-attach/"; + $target_file1 = strtolower($target_dir.get_basename($file_name)); + $img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); + $upload_ok = 1; + if (file_exists($target_file1)) unlink($target_file1); + $upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); + $sql_atta .= "path = '$target_file1', "; + } else $target_file1 = ""; + + if ($target_file1 && !$upload_res_1) { + echo ""; + } + + $db_query = "update board set title = '$title', pin = '$pin', "; + $db_query .= $sql_atta; + $db_query .= "content = '$content'"; + $db_query .= "where id = '$id'"; + $result = mysqli_query($link, $db_query); + + mysqli_close($link); + + echo ""; +} ?> \ No newline at end of file diff --git a/wms/change-password-update.php b/wms/change-password-update.php index ffdaa8ed..489350b0 100644 --- a/wms/change-password-update.php +++ b/wms/change-password-update.php @@ -1,48 +1,48 @@ - 0) { - $sql_query = "UPDATE account set pwd = '$new_pwd' where ((accountid = '$user_id') and (pwd = '$old_pwd'))"; - mysqli_query($link, $sql_query); - $result_message = " - - "; - } else { - $result_message = " - - "; - } - echo $result_message; -} - -mysqli_close($link); -?> - + "; + } else { + $result_message = " + + "; + } + echo $result_message; +} + +mysqli_close($link); +?> + \ No newline at end of file diff --git a/wms/change-password.php b/wms/change-password.php index 363eb337..8a221d76 100644 --- a/wms/change-password.php +++ b/wms/change-password.php @@ -1,77 +1,77 @@ - - - - - - -
-
-
-
-
-
- - - -
-
變更密碼
-
-
-
-
請輸入變更前後密碼!
-
-
" method="post" enctype="multipart/form-data"> - - - -
-
- - - - -
-
-
-
- - - - -
-
-
- -
-
-
-
-
- -
- + + + + + +
+
+
+
+
+
+ + + +
+
變更密碼
+
+
+
+
請輸入變更前後密碼!
+
+
" method="post" enctype="multipart/form-data"> + + + +
+
+ + + + +
+
+
+
+ + + + +
+
+
+ +
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/wms/class/Cmail.php b/wms/class/Cmail.php index f2edd6a6..51ed924b 100644 --- a/wms/class/Cmail.php +++ b/wms/class/Cmail.php @@ -1,5 +1,4 @@ charset = "UTF-8"; $this->host = "mail.masada.com.tw"; @@ -24,8 +23,8 @@ class Cmail $this->smtp_user = "notice"; // 這裡填寫SMTP登入帳號, 例如 your.gmail.name@gmail.com 則填寫your.gmail.name $this->smtp_pwd = "90493119"; // 這裡填寫SMTP登入密碼 } - - function sendx($subject = "", $em_body = "", $sendlist = array(), $from = "永佳捷科技", $bcc = "", $files = array()) + + function sendx($subject="", $em_body="", $sendlist=array(), $from="永佳捷科技", $bcc="", $files=array()) { if (!$sendlist) return; $em_body = nl2br($em_body); @@ -53,15 +52,11 @@ class Cmail //$mail->addCC("personC@gmail.com", "person C"); //$mail->addBCC("personD@gmail.com", "person D"); //$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg - foreach ($files as $v) { - list($file, $file_name) = $v; - $mail->addAttachment($file, $file_name); - } //print_r($mail);exit; - if (!$mail->Send()) { + if (!$mail->Send()){ // echo "Mailer error: " . $mail->ErrorInfo; } else { //echo "Email sent"; } } -} +} \ No newline at end of file diff --git a/wms/combo-create.php b/wms/combo-create.php index 97b39d4d..f99a86df 100644 --- a/wms/combo-create.php +++ b/wms/combo-create.php @@ -1,86 +1,86 @@ - - -
- - Please fill up the required field!

"; - } else { - echo "

Record has added successfully

"; - } - } - */ - ?> - - - -
" enctype="multipart/form-data"> - - -
- - - -
- -
- - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - - -
- -
- - -

-
- -
- - -

-
- -
-
- -
- -
-
- - + + +
+ + Please fill up the required field!

"; + } else { + echo "

Record has added successfully

"; + } + } + */ + ?> + + + +
" enctype="multipart/form-data"> + + +
+ + + +
+ +
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + + +
+ +
+ + +

+
+ +
+ + +

+
+ +
+
+ +
+ +
+
+ + diff --git a/wms/combo-delete.php b/wms/combo-delete.php index 2a8e8814..396488b7 100644 --- a/wms/combo-delete.php +++ b/wms/combo-delete.php @@ -1,12 +1,12 @@ - \ No newline at end of file diff --git a/wms/combo-edit.php b/wms/combo-edit.php index c28c0368..7c529ace 100644 --- a/wms/combo-edit.php +++ b/wms/combo-edit.php @@ -1,93 +1,93 @@ -getMessage(), "\n"; - } -*/ - foreach($data as $data) : -?> - -
-
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - - -
- -
- - -
- -
-
- -
- -
-
- - - +getMessage(), "\n"; + } +*/ + foreach($data as $data) : +?> + +
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ + +
+ +
+
+ +
+ +
+
+ + + diff --git a/wms/combo-index.php b/wms/combo-index.php index 64b75531..4831f536 100644 --- a/wms/combo-index.php +++ b/wms/combo-index.php @@ -1,140 +1,140 @@ - - - - -

- - - -

- -Please fill up the required field!

"; - } else { - header("Location:combo-index.php"); - } - } - -?> - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
項次保養套餐號部位部位類別部位類別序號保養內容是否啟用建檔人建檔時間修改刪除
-

- - - -

-
-

- - - -

-
-
- -There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); - -include "footer.php"; - + + + + +

+ + + +

+ +Please fill up the required field!

"; + } else { + header("Location:combo-index.php"); + } + } + +?> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次保養套餐號部位部位類別部位類別序號保養內容是否啟用建檔人建檔時間修改刪除
+

+ + + +

+
+

+ + + +

+
+
+ +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; + ?> \ No newline at end of file diff --git a/wms/combo-record-submit.php b/wms/combo-record-submit.php index f7994b9e..aca5529d 100644 --- a/wms/combo-record-submit.php +++ b/wms/combo-record-submit.php @@ -1,42 +1,42 @@ - 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} -?> + 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} +?> diff --git a/wms/combo-record-update.php b/wms/combo-record-update.php index a59b305b..9aef6af5 100644 --- a/wms/combo-record-update.php +++ b/wms/combo-record-update.php @@ -1,41 +1,41 @@ - 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/combo-user-input.php b/wms/combo-user-input.php index af1ef76d..6c5e5e9b 100644 --- a/wms/combo-user-input.php +++ b/wms/combo-user-input.php @@ -1,54 +1,54 @@ - - + + diff --git a/wms/cont/MICalculator.php b/wms/cont/MICalculator.php index 73283ee9..8b087582 100644 --- a/wms/cont/MICalculator.php +++ b/wms/cont/MICalculator.php @@ -1,322 +1,324 @@ - 'fail', - 'message' => '無此項目,請聯係業務部創建MI' - ]; - } - public function success($price) - { - return [ - 'status' => 'ok', - 'price' => $price - ]; - } -} + 'fail', + 'message' => '無此項目,請聯係業務部創建MI' + ]; + } + public function success($price) + { + return [ + 'status' => 'ok', + 'price' => $price + ]; + } +} diff --git a/wms/cont/MSCalculator.php b/wms/cont/MSCalculator.php index a5415e76..7aabafcc 100644 --- a/wms/cont/MSCalculator.php +++ b/wms/cont/MSCalculator.php @@ -1,322 +1,322 @@ - 'fail', - 'message' => '無此項目,請聯係業務部創建標準成本' - ]; - } - public function success($price) - { - return [ - 'status' => 'ok', - 'price' => $price - ]; - } -} + 'fail', + 'message' => '無此項目,請聯係業務部創建標準成本' + ]; + } + public function success($price) + { + return [ + 'status' => 'ok', + 'price' => $price + ]; + } +} diff --git a/wms/cont/apply_form.php b/wms/cont/apply_form.php index 34fb54a8..e64a3027 100644 --- a/wms/cont/apply_form.php +++ b/wms/cont/apply_form.php @@ -1,796 +1,858 @@ -0) { - echo""; - exit; -} -*/ - -#係統ID -$system_id = 'con'; -#流程ID -$flow_id = 'con01'; -#表單號 $form_id; -$form_id = ""; -#價審單狀態 -$apply_st = ""; -list($apply_key, $form_key)=DB::fields("select apply_key, form_key from con_maintance_examine_apply where vol_no='$vol_no' order by apply_key desc limit 0, 1"); -if (empty($apply_key)) $apply_st = 1; // 準備新增 -else { - //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); - list($current_assigner)=DB::fields("select current_assigner from subflow where form_key = '$form_key' order by seq desc limit 0, 1"); - if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 - else $apply_st = 9; // 已到下一關,無法䖺改 -} - -if ($apply_st > 2) { - echo""; - exit; -} - -if ($apply_st==1) { - $wf = new WorkFlow($system_id, $flow_id, $form_id); - $wf->initWorkFlow($user_id); - $form_key = $wf->flowContext->getFormKey(); -} else { - $wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); -} - -#獲取簽核意見 -$assign_opinions = Assign::get_records($form_key); - -#會簽部門意見 -$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); - -//預設冇有摺扣 -$wf->setFormData(['discount' => 100]); -$flowName = $wf->getFlowName(); -$assigner = $wf->getAssignerList(); -$assign_status = $wf->getAssignStatus($assigner); -$if_show_assign = true; -//加載流程圖 -//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); -//$path = $fc[0]->wf_file; -//echo dirname(__DIR__)."/../"."$path"; - -//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); -#是否可會簽 -$isSplitable = $wf->isSplitable(); - -//表單數據 -#客戶表 -#1.電梯品牌選項 -$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by code_name asc "; -$elevator_brand_opt = DB::result($sql); -#2.保養方式 -$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; -$maintain_kind_opt = DB::result($sql); -#3.電梯類型 -$sql = "select code_name value ,content label from code where field_name='maintain_elevator_kind'"; -$elevator_kind_opt = DB::result($sql); -#4.付款方式 -$sql = "select code_name value ,content label from code where field_name='payment_kind' order by code_name+ 0 asc"; -$payment_kind_opt = DB::result($sql); -#5.契約性質 -$sql = "select code_name value ,content label from code where field_name='contract_kind'"; -$contract_kind_opt = DB::result($sql); -#6.是否贈送M1 -$is_m1_bundle_opt = [ - ['label' => '是', 'value' => 'Y'], - ['label' => '否', 'value' => 'N'] - -]; -#7.機種 -$sql = "select code_name value ,content label from code where field_name='fp_kind'"; -$fp_kind_opt = DB::result($sql); -#抓取有望客戶資料 - - -$vol_no = $_GET['vol_no']; -$where = " and vol_no='$vol_no'"; -$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; -$hope_contract = DB::result($sql); -$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; -#寫入 con_maintance_examine_apply -if ($apply_st==1) { - #獲取評審單號 - $apply_key = get_sequnece_no('cmea_apply_key', date('ym')); - //var_dump($hope_contract); - $insert_data = [ - 'apply_key' => $apply_key, - 'vol_no' => $vol_no, - 'form_key' => $form_key, - 'address' => $hope_contract['address'], - 'case_name' => $hope_contract['customer'], - 'num' => $hope_contract['num'], - 'brand' => '', - 'customer' => $hope_contract['customer'], - 'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], - 'progress_remark' => $hope_contract['progress_status'] - //'platform_company'=>'', - // 'platforom_company_tel'=> '' - - ]; - //var_dump($insert_data); - DB::insert_table('con_maintance_examine_apply', $insert_data); -} - -$table = 'con_maintance_examine_apply'; -#可編輯的列 -$editableColumn = [ - 'apply_key' => [ - 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', - 'attr' => [ - 'readonly=true ', - 'class' => 'form-control form-control-sm' - ] - ], - 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], - 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], - 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], - 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], - 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - - 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], - -]; -$where = " and apply_key='$apply_key'"; - -$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; -$data = []; -$data = DB::result($sql); - -#電梯詳細資料 -$con_maintance_examine_clear_columm = [ - 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], - 'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], - 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], - 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - 'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], - 'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - - 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], - 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'class' => 'form-control form-control-sm']], - - 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'form-control form-control-sm ']], - - 'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], - 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], - 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], - -]; -$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . - " FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); -$j = 0; -$col_count = 12; -$cmecRow = " "; -foreach ($con_maintance_examine_clear_columm as $key => $val) { - $fieldVal = ""; - $_input = $val['tag'] == 'select' ? - FormHelper::select('', $val['options'], $fieldVal, $val['attr']) - : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); - // : ""; - $cmecRow .= "
$_input"; - if ((++$j % $col_count) == 0) { - if ($j == $col_count) $cmecRow .= ""; - $cmecRow .= ""; - } -} - - -$cmecRow .= ""; -function base_url($url) -{ - return "https://www.masada.com.tw/static/" . $url; -} -function get_sequnece_no($seq_name = '', $p_yyyymm = '') -{ - - if (empty($p_yyyymm) || empty($seq_name)) return null; - #當前年月 - list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); - if ($p_yyyymm != $yyyymm) { - DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); - } - // echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; - list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); - - - return $seq_no; -} - - -?> - - - - - - - - - - - - - - - - - - -
- - - - -
- -
- -
-
- - - ' /> - - - -
-
-
-

保養契約價格審核單

-
-
- -
-
- 契約信息 -
-
- - "; - foreach ($editableColumn as $key => $val) { - $j = (($i++) % 4); - $fieldVal = empty($data) ? "" : $data[0][$key]; - - $_input = $val['tag'] == 'select' ? - FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) - : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); - //""; - if ($i != 1 && $j == 0) { - echo " -
-
- "; - } - echo "
- " . $val['label'] . " -
-
- $_input -
- "; - } - echo "
"; - - ?> - -
-
- 洽商進度 -
-
- - -
-
-
-
- 電梯詳細資料 -
- - - - - - - - - - - empty($val['attr']['colspan']) ? 1 : $val['attr']['colspan']], $val['label']); - //echo ""; - if ((++$j % $col_count) == 0) { - if ($j == $col_count) echo ""; - - - echo ""; - } - } - - - - - ?> - - - - - $val) { - $j = 0; - $cmecRow = " "; - foreach ($con_maintance_examine_clear_columm as $col => $col_def) { - - $fieldVal = empty($val) ? "" : $val[$col]; - $_input = $col_def['tag'] == 'select' ? - FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr']) - : FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']); - $cmecRow .= ""; - if ((++$j % $col_count) == 0) { - $cmecRow .= ""; - $cmecRow .= ""; - } - } - - - echo $cmecRow . ""; - } - ?> - -
- 註意事項: -

1.速度單位是 米/分.

-

2.選擇贈送M1,保養月數需填寫60.

-

3.標準價格未帶出,請聯係業務部建立該規格報價.

-

4.無機房速度20~60米 以60米為標準.

- - -
" . $val['label'] . "操作
- $_input
- -
- -
-
- 簽核操作 -
-
- -
-
-
-
- 簽核狀態 -
-
- -
- -
- 下位簽核者 -
-
- - -
-
-   - -
- -
-
-
- -
-
-
- - -
- -
- - - - ' . $wf->getNodeDescriptions($as['flow_code']) . ' -
'; - $tmp_code = $as['flow_code']; - ?> -
"> -
- - - - -   - " . $as['position_name'] . " "; ?> - - - - - - -   - 申請人 "; ?> - 退回"; ?> - 會簽"; ?> - - - - 簽核於: - - - -
-
- -
- -
- -
- - - -
-
- -
-
-
- - - -
- - - - - +0) { + echo""; + exit; +} +*/ + +#係統ID +$system_id = 'con'; +#流程ID +$flow_id = 'con01'; +#表單號 $form_id; +$form_id = ""; +#價審單狀態 +$apply_st = ""; +list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1"); +// echo '
';
+// print_r($apply_key);
+// echo '
'; +// exit; +// if ($salesman != $user_id) { +// echo ''; +// exit; +// } +if (empty($apply_key)) $apply_st = 1; // 準備新增 +else { + //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); + list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); + if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 + else $apply_st = 9; // 已到下一關,無法䖺改 +} + +// if ($apply_st > 2) { +// echo ""; +// exit; +// } + +if ($apply_st == 1) { + $wf = new WorkFlow($system_id, $flow_id, $form_id); + $wf->initWorkFlow($user_id); + $form_key = $wf->flowContext->getFormKey(); +} else { + $wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); +} + +#獲取簽核意見 +$assign_opinions = Assign::get_records($form_key); + +#會簽部門意見 +$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); + +//預設冇有摺扣 +$wf->setFormData(['discount' => 100]); +$flowName = $wf->getFlowName(); +$assigner = $wf->getAssignerList(); +$assign_status = $wf->getAssignStatus($assigner); + +$if_show_assign = true; +//加載流程圖 +//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); +//$path = $fc[0]->wf_file; +//echo dirname(__DIR__)."/../"."$path"; + +//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); +#是否可會簽 +$isSplitable = $wf->isSplitable(); + +//表單數據 +#客戶表 +#1.電梯品牌選項 +$sql = "SELECT code_name value ,content label FROM code WHERE field_name='elevator_brand' order by code_name asc "; +$elevator_brand_opt = DB::result($sql); +#2.保養方式 +$sql = "SELECT code_name value ,content label FROM code WHERE field_name='maintain_kind'"; +$maintain_kind_opt = DB::result($sql); +#3.電梯類型 +$sql = "SELECT code_name value ,content label FROM code WHERE field_name='maintain_elevator_kind'"; +$elevator_kind_opt = DB::result($sql); +#4.付款方式 +$sql = "SELECT code_name value ,content label FROM code WHERE field_name='payment_kind' order by code_name+ 0 asc"; +$payment_kind_opt = DB::result($sql); +#5.契約性質 +$sql = "SELECT code_name value ,content label FROM code WHERE field_name='contract_kind'"; +$contract_kind_opt = DB::result($sql); +#6.是否贈送M1 +$is_m1_bundle_opt = [ + ['label' => '是', 'value' => 'Y'], + ['label' => '否', 'value' => 'N'] + +]; +#7.機種 +$sql = "SELECT code_name value ,content label FROM code WHERE field_name='fp_kind'"; +$fp_kind_opt = DB::result($sql); +#抓取有望客戶資料 + + +$vol_no = $_GET['vol_no']; +$where = " and vol_no='$vol_no'"; +$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; +// print_r($sql); +$hope_contract = DB::result($sql); +$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; +#寫入 con_maintance_examine_apply +if ($apply_st == 1) { + #獲取評審單號 + $apply_key = get_sequnece_no('cmea_apply_key', date('ym')); + //var_dump($hope_contract); + $insert_data = [ + 'apply_key' => $apply_key, + 'vol_no' => $vol_no, + 'form_key' => $form_key, + 'address' => $hope_contract['address'], + 'case_name' => $hope_contract['customer'], + 'num' => $hope_contract['num'], + 'brand' => '', + 'customer' => $hope_contract['customer'], + 'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], + 'progress_remark' => $hope_contract['progress_status'] + //'platform_company'=>'', + // 'platforom_company_tel'=> '' + + ]; + //var_dump($insert_data); + DB::insert_table('con_maintance_examine_apply', $insert_data); +} + +$table = 'con_maintance_examine_apply'; +#可編輯的列 +$editableColumn = [ + 'apply_key' => [ + 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', + 'attr' => [ + 'readonly=true ', + 'class' => 'form-control form-control-sm' + ] + ], + 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], + 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], + 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], + 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], + 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + + 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], + +]; +$where = " and apply_key='$apply_key'"; + +$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; +$data = []; +$data = DB::result($sql); + +#電梯詳細資料 +$con_maintance_examine_clear_columm = [ + 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], + 'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], + 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], + 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], + 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], + 'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], + 'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], + 'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], + + 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], + 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], + 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], + + 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], + + 'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], + 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], + 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], + 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'placeholder' => '契約成交價', 'class' => 'form-control form-control-sm']], + +]; +$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . + " FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); + +$j = 0; +$col_count = 12; +$cmecRow = " "; +foreach ($con_maintance_examine_clear_columm as $key => $val) { + $fieldVal = ""; + $_input = $val['tag'] == 'select' ? + FormHelper::select('', $val['options'], $fieldVal, $val['attr']) + : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); + // : ""; + $cmecRow .= "
$_input"; + if ((++$j % $col_count) == 0) { + if ($j == $col_count) $cmecRow .= ""; + $cmecRow .= ""; + } +} +$cmecRow .= ""; +function base_url($url) +{ + return "https://www.masada.com.tw/static/" . $url; +} +function get_sequnece_no($seq_name = '', $p_yyyymm = '') +{ + + if (empty($p_yyyymm) || empty($seq_name)) return null; + #當前年月 + list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); + if ($p_yyyymm != $yyyymm) { + DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); + } + // echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; + list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); + + + return $seq_no; +} +$sql = "SELECT * FROM account WHERE accountid = '$user_id' "; +list($result) = DB::result($sql); +if ($result['department_id'] == '511') { + $managerid = 'M0137'; + $managername = '劉永德'; +} else if ($result['department_id'] == '512') { + $managerid = 'M0137'; + $managername = '劉永德'; +} else if ($result['department_id'] == '513') { + $managerid = 'M0086'; + $managername = '李烘銘'; +} else if ($result['department_id'] == '514') { + $managerid = 'M0033'; + $managername = '吳育宗'; +} + +if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') { + $managerid = 'M0008'; + $managername = '詹益彰'; +} + +?> + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ +
+
+ + + ' /> + + + +
+
+
+

保養契約價格審核單

+
+
+ +
+
+ 契約信息 +
+
+ + "; + foreach ($editableColumn as $key => $val) { + $j = (($i++) % 4); + $fieldVal = empty($data) ? "" : $data[0][$key]; + + $_input = $val['tag'] == 'select' ? + FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) + : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); + //""; + if ($i != 1 && $j == 0) { + echo " +
+
+ "; + } + echo "
+ " . $val['label'] . " +
+
+ $_input +
+ "; + } + echo "
"; + + ?> + +
+
+ 洽商進度 +
+
+ + +
+
+
+
+ 電梯詳細資料 +
+ + + + + + + + + + + "; + + $i = 0; + $cmecRow = ''; + foreach ($con_maintance_examine_clear_columm as $col => $col_def) { + echo FormHelper::tag("th", ['colspan' => empty($col_def['attr']['colspan']) ? 1 : $col_def['attr']['colspan']], $col_def['label']); + + if ((++$j % $col_count) == 0) { + if ($j == $col_count) echo ""; + echo ""; + } + } + echo ''; + + + ?> + + + + + + $val) { + $j = 0; + $cmecRow = ""; + foreach ($con_maintance_examine_clear_columm as $col => $col_def) { + + $fieldVal = empty($val) ? "" : $val[$col]; + $_input = $col_def['tag'] == 'select' ? + FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr']) + : FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']); + $cmecRow .= ""; + if ((++$j % $col_count) == 0) { + $cmecRow .= ""; + $cmecRow .= ""; + } + } + + + echo $cmecRow . ""; + } + ?> + + +
+ 註意事項: +

1.速度單位是 米/分.

+

2.選擇贈送M1,保養月數需填寫60.

+

3.標準價格未帶出,請聯係業務部建立該規格報價.

+

4.無機房速度20~60米 以60米為標準.

+ + +
操作
+ $_input
+ +
+ +
+
+ 簽核操作 +
+
+ +
+
+
+
+ 簽核狀態 +
+
+ +
+ +
+ 下位簽核者 +
+
+ + +
+
+   + +
+ +
+
+
+ +
+
+
+ + +
+ +
+ + + + ' . $wf->getNodeDescriptions($as['flow_code']) . ' +
'; + $tmp_code = $as['flow_code']; + ?> +
"> +
+ + + + +   + " . $as['position_name'] . " "; ?> + + + + + + +   + 申請人 "; ?> + 退回"; ?> + 會簽"; ?> + + + + 簽核於: + + + +
+
+ +
+ +
+ +
+ + + +
+
+ +
+
+
+ + + +
+ + + + + \ No newline at end of file diff --git a/wms/cont/apply_form1.php b/wms/cont/apply_form1.php new file mode 100644 index 00000000..2e035859 --- /dev/null +++ b/wms/cont/apply_form1.php @@ -0,0 +1,912 @@ +0) { + echo""; + exit; +} +*/ + +#係統ID +$system_id = 'con'; +#流程ID +$flow_id = 'con01'; +#表單號 $form_id; +$form_id = ""; +#價審單狀態 +$apply_st = ""; +list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1"); +// echo '
';
+// print_r($salesman);
+// echo '
'; +// exit; +if ($salesman != $user_id) { + echo ''; + exit; +} +if (empty($apply_key)) $apply_st = 1; // 準備新增 +else { + //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); + list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); + if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 + else $apply_st = 9; // 已到下一關,無法䖺改 +} + +// if ($apply_st > 2) { +// echo ""; +// exit; +// } + +if ($apply_st == 1) { + $wf = new WorkFlow($system_id, $flow_id, $form_id); + $wf->initWorkFlow($user_id); + $form_key = $wf->flowContext->getFormKey(); +} else { + $wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); +} + +#獲取簽核意見 +$assign_opinions = Assign::get_records($form_key); + +#會簽部門意見 +$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); + +//預設冇有摺扣 +$wf->setFormData(['discount' => 100]); +$flowName = $wf->getFlowName(); +$assigner = $wf->getAssignerList(); +$assign_status = $wf->getAssignStatus($assigner); +$if_show_assign = true; +//加載流程圖 +//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); +//$path = $fc[0]->wf_file; +//echo dirname(__DIR__)."/../"."$path"; + +//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); +#是否可會簽 +$isSplitable = $wf->isSplitable(); + +//表單數據 +#客戶表 +#1.電梯品牌選項 +$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by code_name asc "; +$elevator_brand_opt = DB::result($sql); +#2.保養方式 +$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; +$maintain_kind_opt = DB::result($sql); +#3.電梯類型 +$sql = "select code_name value ,content label from code where field_name='maintain_elevator_kind'"; +$elevator_kind_opt = DB::result($sql); +#4.付款方式 +$sql = "select code_name value ,content label from code where field_name='payment_kind' order by code_name+ 0 asc"; +$payment_kind_opt = DB::result($sql); +#5.契約性質 +$sql = "select code_name value ,content label from code where field_name='contract_kind'"; +$contract_kind_opt = DB::result($sql); +#6.是否贈送M1 +$is_m1_bundle_opt = [ + ['label' => '是', 'value' => 'Y'], + ['label' => '否', 'value' => 'N'] + +]; +#7.機種 +$sql = "select code_name value ,content label from code where field_name='fp_kind'"; +$fp_kind_opt = DB::result($sql); +#抓取有望客戶資料 + +$vol_no = $_GET['vol_no']; +$where = " and vol_no='$vol_no'"; +$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; +$hope_contract = DB::result($sql); +$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; +#寫入 con_maintance_examine_apply +if ($apply_st == 1) { + #獲取評審單號 + $apply_key = get_sequnece_no('cmea_apply_key', date('ym')); + //var_dump($hope_contract); + $insert_data = [ + 'apply_key' => $apply_key, + 'vol_no' => $vol_no, + 'form_key' => $form_key, + 'address' => $hope_contract['address'], + 'case_name' => $hope_contract['customer'], + 'num' => $hope_contract['num'], + 'brand' => '', + 'customer' => $hope_contract['customer'], + 'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], + 'progress_remark' => $hope_contract['progress_status'] + //'platform_company'=>'', + // 'platforom_company_tel'=> '' + + ]; + //var_dump($insert_data); + DB::insert_table('con_maintance_examine_apply', $insert_data); +} +#抓使用者主管 +$sql = "SELECT * FROM account WHERE accountid = '$user_id' "; +list($result) = DB::result($sql); +if ($result['department_id'] == '511') { + $managerid = 'M0137'; + $managername = '劉永德'; +} else if ($result['department_id'] == '512') { + $managerid = 'M0137'; + $managername = '劉永德'; +} else if ($result['department_id'] == '513') { + $managerid = 'M0086'; + $managername = '李烘銘'; +} else if ($result['department_id'] == '514') { + $managerid = 'M0033'; + $managername = '吳育宗'; +} + +if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') { + $managerid = 'M0008'; + $managername = '詹益彰'; +} + +if ($result['department_id'] == 'M0008') { + $managerid = 'M0008'; + $managername = '詹益彰'; +} +$table = 'con_maintance_examine_apply'; +#可編輯的列 +$editableColumn = [ + 'apply_key' => [ + 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', + 'attr' => [ + 'readonly=true ', + 'class' => 'form-control form-control-sm' + ] + ], + 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], + 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], + 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], + 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], + 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + + 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], + +]; +$where = " and apply_key='$apply_key'"; + +$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; +$data = []; +$data = DB::result($sql); + +#電梯詳細資料 +$con_maintance_examine_clear_columm = [ + 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], + 'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], + 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], + 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], + 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], + 'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], + 'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], + 'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], + + 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], + 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], + 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], + + 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], + + 'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], + 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], + 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], + 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], + +]; +$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . + " FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); +$j = 0; +$col_count = 12; +$cmecRow = " "; + +foreach ($con_maintance_examine_clear_columm as $key => $val) { + $fieldVal = ""; + $_input = $val['tag'] == 'select' ? + FormHelper::select('', $val['options'], $fieldVal, $val['attr']) + : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); + // : ""; + $cmecRow .= "
$_input"; + if ((++$j % $col_count) == 0) { + if ($j == $col_count) $cmecRow .= ""; + $cmecRow .= ""; + } +} + + +$cmecRow .= ""; +function base_url($url) +{ + return "https://www.masada.com.tw/static/" . $url; +} +function get_sequnece_no($seq_name = '', $p_yyyymm = '') +{ + + if (empty($p_yyyymm) || empty($seq_name)) return null; + #當前年月 + list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); + if ($p_yyyymm != $yyyymm) { + DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); + } + // echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; + list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); + + + return $seq_no; +} + + +?> + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ +
+
+ + + ' /> + + + +
+
+
+

保養契約價格審核單

+
+
+ +
+
+ 契約信息 +
+
+ + "; + foreach ($editableColumn as $key => $val) { + $j = (($i++) % 4); + $fieldVal = empty($data) ? "" : $data[0][$key]; + + $_input = $val['tag'] == 'select' ? + FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) + : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); + //""; + if ($i != 1 && $j == 0) { + echo " +
+
+ "; + } + echo "
+ " . $val['label'] . " +
+
+ $_input +
+ "; + } + echo "
"; + + ?> + +
+
+ 洽商進度 +
+
+ + +
+
+
+
+ 電梯詳細資料 +
+ + + + + + + + + + +
+ 註意事項: +

1.速度單位是 米/分.

+

2.選擇贈送M1,保養月數需填寫60.

+

3.標準價格未帶出,請聯係業務部建立該規格報價.

+

4.無機房速度20~60米 以60米為標準.

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
電梯許可代碼品牌電梯類型規格型號載重(KG)速度(m/min)停數層數人乘保養次數保養月數保養周期贈送M1
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
竣工檢查年度上次年檢日期年檢費用(元)標準價格(元/月)契約報價(元/月)契約成交價(元/月)刪除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+ 簽核操作 +
+
+ +
+
+
+
+ 簽核狀態 +
+
+ +
+ +
+ 下位簽核者 +
+
+ + +
+
+   + +
+ +
+
+
+ +
+
+
+ +
+ +
+ + + + ' . $wf->getNodeDescriptions($as['flow_code']) . ' +
'; + $tmp_code = $as['flow_code']; + ?> +
"> +
+ + + + +   + " . $as['position_name'] . " "; ?> + + + + + + +   + 申請人 "; ?> + 退回"; ?> + 會簽"; ?> + + + + 簽核於: + + + +
+
+ +
+ +
+ +
+ + + +
+
+ +
+
+
+ + + +
+ + + + + + \ No newline at end of file diff --git a/wms/cont/conn.php b/wms/cont/conn.php new file mode 100644 index 00000000..1476902e --- /dev/null +++ b/wms/cont/conn.php @@ -0,0 +1,42 @@ +errorInfo()的形式獲取錯誤資訊 + //PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 + //PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 + //設定主動以警告的形式報錯 + $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + //如果連接錯誤,將抛出一個PDOException異常對象 +} catch (PDOException $e) { + //如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 + die("ERROR!!!: " . $e->getMessage()); +} + +//$conn = null; //關閉資料庫的連線 \ No newline at end of file diff --git a/wms/cont/query_form.php b/wms/cont/query_form.php index 2c9a47b6..f3495f14 100644 --- a/wms/cont/query_form.php +++ b/wms/cont/query_form.php @@ -1,510 +1,511 @@ -vol_no; -require_once './MICalculator.php'; -require_once './FormHelper.php'; -require_once './wf_common.php'; -list($form_key) = DB::fields("select form_key from con_maintance_examine_apply where apply_key='$apply_key'"); -//echo $form_key; -$flow = new Flow($form_key); -// 當前節點簽核開始 -//var_dump($flow); -$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); -#獲取簽核意見 -$assign_opinions = Assign::get_records($form_key); -$flowName = $wf->getFlowName(); -$assigner = $wf->getAssignerList(); -$assign_status = $wf->getAssignStatus($assigner); -//表單數據 -#客戶表 -#客戶表 -#1.電梯品牌選項 -$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; -$elevator_brand_opt = DB::result($sql); -#2.保養方式 -$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; -$maintain_kind_opt = DB::result($sql); -#3.電梯類型 -$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; -$elevator_kind_opt = DB::result($sql); -#4.付款方式 -$sql = "select code_name value ,content label from code where field_name='payment_kind'"; -$payment_kind_opt = DB::result($sql); -#5.契約性質 -$sql = "select code_name value ,content label from code where field_name='contract_kind'"; -$contract_kind_opt = DB::result($sql); -#6.是否贈送M1 -$is_m1_bundle_opt = [ - ['label' => '是', 'value' => 'Y'], - ['label' => '否', 'value' => 'N'] -]; -#7.機種 -$sql = "select code_name value ,content label from code where field_name='fp_kind'"; -$fp_kind_opt = DB::result($sql); -$table = 'con_maintance_examine_apply'; -#可編輯的列 -$editableColumn = [ - 'apply_key' => [ - 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', - 'attr' => [ - 'readonly=true ', - 'class' => 'form-control form-control-sm' - ] - ], - 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], - 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'num' => ['label' => "數量", "value" => "", "tag" => 'number', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], - 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], - 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], - 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - - // 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - // 'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], - -]; -$where = " and apply_key='$apply_key'"; - -$sql = "SELECT * FROM $table where 1=1 $where ORDER BY apply_key"; -$data = []; -list($data) = DB::result($sql); - -#電梯詳細資料 -$con_maintance_examine_clear_columm = [ - 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], - //'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], - 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], - 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - //'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], - 'floors' => ['label' => "層數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - - 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - - - // 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], - 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], - 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], - //'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], - // 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], - // 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], - // 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], - 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], - //'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], - 'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - 'stand_price' => ['label' => "標準價格A(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], - 'contract_price' => ['label' => "契約報價B(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], - 'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], - - - 'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true','disabled', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], - 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true','disabled', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], - 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true','disabled', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], - -]; -$con_maintance_examine_clear = DB::result("SELECT register_code, - f_return_content('elevator_brand',elevator_brand) elevator_brand, - f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, - elevator_kind con_elevator_kind, - spec, - weight, - speed, - floors, - persons, - maintain_times, - maintain_months, - maintain_period, - is_m1_bundle, - - useful_years, - last_check_date, - speed_governors_check_expense, - service_expense, - commission_expense, - management_expense, - annual_survey_expense, - stand_price, - contract_price, - sold_price, - 0 mi_cost , - 0 discount, - 0 gross_profit - FROM - con_maintance_examine_clear - WHERE - 1 = 1 - AND apply_key='" . $apply_key . "' and cmstatus = 'Y'"); - -function base_url($url) -{ - return "https://www.masada.com.tw/static/" . $url; -} - - -?> - - - - - - - <?php echo $flowName; ?> - - - - - - - - - - - - - - - - - - - -
- -
-
- - - - -
-
-
-

保養契約價格審核單

-
-
- -
-
- 契約信息 -
-
- - "; - foreach ($editableColumn as $key => $val) { - $j = (($i++) % 4); - $fieldVal = empty($data) ? "" : $data[$key]; - $fieldVal = empty($data) ? "" : $data[$key]; - - $_input = $val['tag'] == 'select' ? - FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : - FormHelper::tag("label", $val['attr'], $fieldVal); - - //""; - if ($i != 1 && $j == 0) { - echo " -
-
- "; - } - echo "
- " . $val['label'] . " -
-
- $_input -
- "; - } - echo "
"; - - ?> - -
-
- 洽商進度 -
-
- - -
-
- -
-
- 電梯詳細資料 -
- - - - - - empty($val['attr']['colspan']) - ? 1 : $val['attr']['colspan']], $val['label']); - - if ((++$j % 14) == 0) { - // if ($j == 12) echo ""; - - - echo ""; - } - } - - ?> - - - - - $val) { - $j = 0; - - $cmecRow = " "; - - foreach ($con_maintance_examine_clear_columm as $col => $col_def) { - $fieldVal = empty($val) ? "" : $val[$col]; - if ($col == 'mi_cost') { - $param = [ - 'elevator_type' => $val['con_elevator_kind'], - 'floors' => $val['floors'], - 'speed' => $val['speed'], - 'persons' => $val['persons'], - 'weight' => $val['weight'], - 'maintain_times' => $val['maintain_times'], - 'maintain_months' => $val['maintain_months'], - 'maintain_kind' => $data['maintain_kind'], - 'maintain_period' => $val['maintain_period'], - 'is_m1_bundle' => $val['is_m1_bundle'], - ]; - $mic = new MICalculator(); - $res = $mic->cal($param); - #MI報價 - $con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = $res['status'] == 'ok' ? $res['price'] : $res['message']; - $con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" - #扣率 - $val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; - } - - $_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 - : $col_def['attr']['colspan']], $fieldVal); - $cmecRow .= ""; - - $cmecRow = (++$j % 14 == 0) ? $cmecRow . "" : $cmecRow; - } - $tr_class = $tr_class == 'odd' ? "even" : "odd"; - echo $cmecRow . ""; - } - ?> - - - - - - - -
操作
$_input
-
- - - - - -
-
- -
- - - -
-
- -
-
-
- - -
- -
- - - - ' . $wf->getNodeDescriptions($as['flow_code']) . ' -
'; - $tmp_code = $as['flow_code']; - ?> -
"> -
- - - - -   - " . $as['position_name'] . " "; ?> - - - - - - -   - 申請人 "; ?> - 退回"; ?> - 會簽"; ?> - - - - 簽核於: - - - -
-
- -
- -
- -
- - - -
-
- -
-
-
- - - - - - - - +vol_no; +require_once './MICalculator.php'; +require_once './FormHelper.php'; +require_once './wf_common.php'; +list($form_key) = DB::fields("select form_key from con_maintance_examine_apply where apply_key='$apply_key'"); +//echo $form_key; +$flow = new Flow($form_key); +// 當前節點簽核開始 +//var_dump($flow); +$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); +#獲取簽核意見 +$assign_opinions = Assign::get_records($form_key); +$flowName = $wf->getFlowName(); +$assigner = $wf->getAssignerList(); +$assign_status = $wf->getAssignStatus($assigner); +//表單數據 +#客戶表 +#客戶表 +#1.電梯品牌選項 +$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; +$elevator_brand_opt = DB::result($sql); +#2.保養方式 +$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; +$maintain_kind_opt = DB::result($sql); +#3.電梯類型 +$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; +$elevator_kind_opt = DB::result($sql); +#4.付款方式 +$sql = "select code_name value ,content label from code where field_name='payment_kind'"; +$payment_kind_opt = DB::result($sql); +#5.契約性質 +$sql = "select code_name value ,content label from code where field_name='contract_kind'"; +$contract_kind_opt = DB::result($sql); +#6.是否贈送M1 +$is_m1_bundle_opt = [ + ['label' => '是', 'value' => 'Y'], + ['label' => '否', 'value' => 'N'] +]; +#7.機種 +$sql = "select code_name value ,content label from code where field_name='fp_kind'"; +$fp_kind_opt = DB::result($sql); +$table = 'con_maintance_examine_apply'; +#可編輯的列 +$editableColumn = [ + 'apply_key' => [ + 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', + 'attr' => [ + 'readonly=true ', + 'class' => 'form-control form-control-sm' + ] + ], + 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], + 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'num' => ['label' => "數量", "value" => "", "tag" => 'number', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], + 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], + 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], + 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + + // 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + // 'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], + +]; +$where = " and apply_key='$apply_key'"; + +$sql = "SELECT * FROM $table where 1=1 $where ORDER BY apply_key"; +$data = []; +list($data) = DB::result($sql); + +#電梯詳細資料 +$con_maintance_examine_clear_columm = [ + 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], + //'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], + 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], + 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'min=0', 'required', 'class' => 'form-control form-control-sm']], + //'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], + 'floors' => ['label' => "層數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + + 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], + + + // 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], + 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], + 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], + //'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], + // 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], + // 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], + // 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], + 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], + //'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], + 'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], + 'stand_price' => ['label' => "標準價格A(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], + 'contract_price' => ['label' => "契約報價B(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], + 'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], + + + 'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], + 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], + 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], + +]; +$con_maintance_examine_clear = DB::result("SELECT register_code, + f_return_content('elevator_brand',elevator_brand) elevator_brand, + f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, + elevator_kind con_elevator_kind, + spec, + weight, + speed, + floors, + persons, + maintain_times, + maintain_months, + maintain_period, + is_m1_bundle, + + useful_years, + last_check_date, + speed_governors_check_expense, + service_expense, + commission_expense, + management_expense, + annual_survey_expense, + stand_price, + contract_price, + sold_price, + 0 mi_cost , + 0 discount, + 0 gross_profit + FROM + con_maintance_examine_clear + WHERE + 1 = 1 + AND apply_key='" . $apply_key . "' and cmstatus = 'Y'"); + +function base_url($url) +{ + return "https://www.masada.com.tw/static/" . $url; +} + + +?> + + + + + + + <?php echo $flowName; ?> + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + +
+
+
+

保養契約價格審核單

+
+
+ +
+
+ 契約信息 +
+
+ + "; + foreach ($editableColumn as $key => $val) { + // print_r($val['label']); + $j = (($i++) % 4); + $fieldVal = empty($data) ? "" : $data[$key]; + $fieldVal = empty($data) ? "" : $data[$key]; + + $_input = $val['tag'] == 'select' ? + FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : + FormHelper::tag("label", $val['attr'], $fieldVal); + + // ""; + if ($i != 1 && $j == 0) { + echo " +
+
+ "; + } + echo "
+ " . $val['label'] . " +
+
+ $_input +
+ "; + } + echo "
"; + + ?> + +
+
+ 洽商進度 +
+
+ + +
+
+ +
+
+ 電梯詳細資料 +
+ + + + + + empty($val['attr']['colspan']) + ? 1 : $val['attr']['colspan']], $val['label']); + + if ((++$j % 14) == 0) { + // if ($j == 12) echo ""; + + + echo ""; + } + } + + ?> + + + + + $val) { + $j = 0; + + $cmecRow = " "; + + foreach ($con_maintance_examine_clear_columm as $col => $col_def) { + $fieldVal = empty($val) ? "" : $val[$col]; + if ($col == 'mi_cost') { + $param = [ + 'elevator_type' => $val['con_elevator_kind'], + 'floors' => $val['floors'], + 'speed' => $val['speed'], + 'persons' => $val['persons'], + 'weight' => $val['weight'], + 'maintain_times' => $val['maintain_times'], + 'maintain_months' => $val['maintain_months'], + 'maintain_kind' => $data['maintain_kind'], + 'maintain_period' => $val['maintain_period'], + 'is_m1_bundle' => $val['is_m1_bundle'], + ]; + $mic = new MICalculator(); + $res = $mic->cal($param); + #MI報價 + $con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = $res['status'] == 'ok' ? $res['price'] : $res['message']; + $con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" + #扣率 + $val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; + } + + $_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 + : $col_def['attr']['colspan']], $fieldVal); + $cmecRow .= ""; + + $cmecRow = (++$j % 14 == 0) ? $cmecRow . "" : $cmecRow; + } + $tr_class = $tr_class == 'odd' ? "even" : "odd"; + echo $cmecRow . ""; + } + ?> + + + + + + + +
操作
$_input
+
+ + + + + +
+
+ +
+ + + +
+
+ +
+
+
+ + +
+ +
+ + + + ' . $wf->getNodeDescriptions($as['flow_code']) . ' +
'; + $tmp_code = $as['flow_code']; + ?> +
"> +
+ + + + +   + " . $as['position_name'] . " "; ?> + + + + + + +   + 申請人 "; ?> + 退回"; ?> + 會簽"; ?> + + + + 簽核於: + + + +
+
+ +
+ +
+ +
+ + + +
+
+ +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/wms/cont/sign_form.php b/wms/cont/sign_form.php index 307f1585..428e3a88 100644 --- a/wms/cont/sign_form.php +++ b/wms/cont/sign_form.php @@ -1,576 +1,577 @@ -vol_no; -require_once './FormHelper.php'; -require_once '../cont/MICalculator.php'; - -require_once './wf_common.php'; -$flow = new Flow($form_key); -// 當前節點簽核開始 - -$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); -#獲取簽核意見 -$assign_opinions = Assign::get_records($form_key); -$flowName = $wf->getFlowName(); - -//表單數據 -#客戶表 -#1.電梯品牌選項 -$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; -$elevator_brand_opt = DB::result($sql); -#2.保養方式 -$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; -$maintain_kind_opt = DB::result($sql); -#3.電梯類型 -$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; -$elevator_kind_opt = DB::result($sql); -#4.付款方式 -$sql = "select code_name value ,content label from code where field_name='payment_kind'"; -$payment_kind_opt = DB::result($sql); -#5.契約性質 -$sql = "select code_name value ,content label from code where field_name='contract_kind'"; -$contract_kind_opt = DB::result($sql); -#6.是否贈送M1 -$is_m1_bundle_opt = [ - ['label' => '是', 'value' => 'Y'], - ['label' => '否', 'value' => 'N'] -]; -#7.機種 -$sql = "select code_name value ,content label from code where field_name='fp_kind'"; -$fp_kind_opt = DB::result($sql); -$table = 'con_maintance_examine_apply'; -#可編輯的列 -$editableColumn = [ - 'apply_key' => [ - 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', - 'attr' => [ - 'readonly=true ', - 'class' => 'form-control form-control-sm' - ] - ], - 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], - 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'num' => ['label' => "數量", "value" => "", "tag" => 'number', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], - 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], - 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], - 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - - 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], - -]; -$where = " and form_key='$form_key'"; - -$sql = "SELECT " . implode(',', array_keys($editableColumn)) . -" ,progress_remark FROM $table where 1=1 $where ORDER BY apply_key"; - -$data = []; -list($data) = DB::result($sql); - -#電梯詳細資料 -$con_maintance_examine_clear_columm = [ - 'register_code' => ['label' => "電梯註冊代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], - //'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], - 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], - 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - //'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], - 'floors' => ['label' => "層數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - - 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - - - // 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], - 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], - 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], - //'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], - // 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], - // 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], - // 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], - //'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], - //'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], - 'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], - 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], - 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], - - - 'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], - 'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], - 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], - 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], - -]; -$con_maintance_examine_clear = DB::result("SELECT register_code, - f_return_content('elevator_brand',elevator_brand) elevator_brand, - f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, - elevator_kind con_elevator_kind, - spec, - weight, - speed, - floors, - persons, - maintain_times, - maintain_months, - maintain_period, - is_m1_bundle, - - useful_years, - last_check_date, - speed_governors_check_expense, - service_expense, - - stand_price, - contract_price, - sold_price, - 0 mi_cost , - 0 discount, - 0 gross_profit - FROM - con_maintance_examine_clear - WHERE - 1 = 1 - AND apply_key='" . $data['apply_key'] . "' and cmstatus='Y'"); - -#總臺數 -$count = count($con_maintance_examine_clear); -$total_sold_price = 0; -#總成交價 -#總標準價格 -$total_stand_price = 0; -#總標準成本 -foreach ($con_maintance_examine_clear as $val) { - $total_sold_price += $val['sold_price']; - $total_stand_price += $val['stand_price']; -} -$total_discount_rate = $total_sold_price == 0 ? 0 - : (100*round($total_sold_price / $total_stand_price, 4)) . "%"; - -$wf->setFormData(['discount' => substr($total_discount_rate, 0, -1)]); -$assigner = $wf->getAssignerList(); -$assign_status = $wf->getAssignStatus($assigner); - - -function base_url($url) -{ - return "https://www.masada.com.tw/static/" . $url; -} -function get_sequnece_no($seq_name = '', $p_yyyymm = '') -{ - - if (empty($p_yyyymm) || empty($seq_name)) return null; - #當前年月 - //echo "select yyyymm from sequence where seq_name='$seq_name' "; - list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); - if ($p_yyyymm != $yyyymm) { - DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); - } - // echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; - list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring(nextval('$seq_name'),2)) seq_no "); - - - return $seq_no; -} - - -?> - - - - - - - - - - - - - - - - - - - - - - -
- 流程: - - - -
- -
- -
-
- - - ' /> - - - - -
-
-
-

保養契約價格審核單

-
-
- -
-
- 契約信息 -
-
- - "; - foreach ($editableColumn as $key => $val) { - $j = (($i++) % 4); - $fieldVal = empty($data) ? "" : $data[$key]; - - $_input = $val['tag'] == 'select' ? - FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : - FormHelper::tag("label", $val['attr'], $fieldVal); - - //""; - if ($i != 1 && $j == 0) { - echo " -
-
- "; - } - echo "
- " . $val['label'] . " -
-
- $_input -
- "; - } - echo "
"; - - ?> - -
-
- 洽商進度 -
-
- - -
-
-
-
- 電梯詳細資料 -
- - - - - - empty($val['attr']['colspan']) - ? 1 : $val['attr']['colspan']], $val['label']); - - if ((++$j % 14) == 0) { - // if ($j == 12) echo ""; - - - echo ""; - } - } - - ?> - - - - - $val) { - $j = 0; - - $cmecRow = " "; - - foreach ($con_maintance_examine_clear_columm as $col => $col_def) { - $fieldVal = empty($val) ? "" : $val[$col]; - if ($col == 'mi_cost') { - $param = [ - 'elevator_type' => $val['con_elevator_kind'], - 'floors' => $val['floors'], - 'speed' => $val['speed'], - 'persons' => $val['persons'], - 'weight' => $val['weight'], - 'maintain_times' => $val['maintain_times'], - 'maintain_months' => $val['maintain_months'], - 'maintain_kind' => $data['maintain_kind'], - 'maintain_period' => $val['maintain_period'], - 'is_m1_bundle' => $val['is_m1_bundle'], - ]; - $mic = new MICalculator(); - $res = $mic->cal($param); - #MI報價 - $con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = ($res['status'] - == 'ok' ? $res['price'] : $res['message']); - $con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" - #扣率 - $val['discount'] = (100*round($val['sold_price'] / $val['stand_price'], 4)) . "%"; - } - - $_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 - : $col_def['attr']['colspan']], $fieldVal); - $cmecRow .= ""; - - $cmecRow = (++$j % 14 == 0) ? $cmecRow . "" : $cmecRow; - } - $tr_class = $tr_class == 'odd' ? "even" : "odd"; - echo $cmecRow . ""; - } - ?> - - - - - - - -
操作
$_input
-
- - - - - -
-
- -
- -
-
- 簽核意見 -
- -
- -
-
-
-
- 簽核狀態 -
-
- -
- -
- 下位簽核者 -
-
- - -
-
- -
- -
-
-
- -
-
-
- - -
- -
- - - - ' . $wf->getNodeDescriptions($as['flow_code']) . ' -
'; - $tmp_code = $as['flow_code']; - ?> -
"> -
- - - - -   - " . $as['position_name'] . " "; ?> - - - - - - -   - 申請人 "; ?> - 退回"; ?> - 會簽"; ?> - - - - 簽核於: - - - -
-
- -
- -
- -
- - - -
-
- -
-
-
- - - - - - - - +vol_no; +require_once './FormHelper.php'; +require_once '../cont/MICalculator.php'; + +require_once './wf_common.php'; +$flow = new Flow($form_key); +// 當前節點簽核開始 + +$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); +#獲取簽核意見 +$assign_opinions = Assign::get_records($form_key); +$flowName = $wf->getFlowName(); + +//表單數據 +#客戶表 +#1.電梯品牌選項 +$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; +$elevator_brand_opt = DB::result($sql); +#2.保養方式 +$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; +$maintain_kind_opt = DB::result($sql); +#3.電梯類型 +$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; +$elevator_kind_opt = DB::result($sql); +#4.付款方式 +$sql = "select code_name value ,content label from code where field_name='payment_kind'"; +$payment_kind_opt = DB::result($sql); +#5.契約性質 +$sql = "select code_name value ,content label from code where field_name='contract_kind'"; +$contract_kind_opt = DB::result($sql); +#6.是否贈送M1 +$is_m1_bundle_opt = [ + ['label' => '是', 'value' => 'Y'], + ['label' => '否', 'value' => 'N'] +]; +#7.機種 +$sql = "select code_name value ,content label from code where field_name='fp_kind'"; +$fp_kind_opt = DB::result($sql); +$table = 'con_maintance_examine_apply'; +#可編輯的列 +$editableColumn = [ + 'apply_key' => [ + 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', + 'attr' => [ + 'readonly=true ', + 'class' => 'form-control form-control-sm' + ] + ], + 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], + 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'num' => ['label' => "數量", "value" => "", "tag" => 'number', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], + 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], + 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], + 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], + 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], + 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + + 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], + +]; +$where = " and form_key='$form_key'"; + +$sql = "SELECT " . implode(',', array_keys($editableColumn)) . + " ,progress_remark FROM $table where 1=1 $where ORDER BY apply_key"; + +$data = []; +list($data) = DB::result($sql); + +#電梯詳細資料 +$con_maintance_examine_clear_columm = [ + 'register_code' => ['label' => "電梯註冊代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], + //'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], + 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], + 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], + 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'min=0', 'required', 'class' => 'form-control form-control-sm']], + //'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], + 'floors' => ['label' => "層數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + + 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], + + + // 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], + 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], + 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], + //'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], + // 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], + // 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], + // 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], + //'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], + //'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], + 'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], + 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], + 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], + 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], + + + 'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], + 'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], + 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], + 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], + +]; +$con_maintance_examine_clear = DB::result("SELECT register_code, + f_return_content('elevator_brand',elevator_brand) elevator_brand, + f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, + elevator_kind con_elevator_kind, + spec, + weight, + speed, + floors, + persons, + maintain_times, + maintain_months, + maintain_period, + is_m1_bundle, + + useful_years, + last_check_date, + speed_governors_check_expense, + service_expense, + + stand_price, + contract_price, + sold_price, + 0 mi_cost , + 0 discount, + 0 gross_profit + FROM + con_maintance_examine_clear + WHERE + 1 = 1 + AND apply_key='" . $data['apply_key'] . "' and cmstatus='Y'"); + +#總臺數 +$count = count($con_maintance_examine_clear); +$total_sold_price = 0; +#總成交價 +#總標準價格 +$total_stand_price = 0; +#總標準成本 +foreach ($con_maintance_examine_clear as $val) { + $total_sold_price += $val['sold_price']; + $total_stand_price += $val['stand_price']; +} +$total_discount_rate = $total_sold_price == 0 ? 0 + : (100 * round($total_sold_price / $total_stand_price, 4)) . "%"; + +$wf->setFormData(['discount' => substr($total_discount_rate, 0, -1)]); +$assigner = $wf->getAssignerList(); +$assign_status = $wf->getAssignStatus($assigner); + + +function base_url($url) +{ + return "https://www.masada.com.tw/static/" . $url; +} +function get_sequnece_no($seq_name = '', $p_yyyymm = '') +{ + + if (empty($p_yyyymm) || empty($seq_name)) return null; + #當前年月 + //echo "select yyyymm from sequence where seq_name='$seq_name' "; + list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); + if ($p_yyyymm != $yyyymm) { + DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); + } + // echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; + list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring(nextval('$seq_name'),2)) seq_no "); + + + return $seq_no; +} + + +?> + + + + + + + + + + + + + + + + + + + + + + +
+ 流程: + + + +
+ +
+ +
+
+ + + ' /> + + + + +
+
+
+

保養契約價格審核單

+
+
+ +
+
+ 契約信息 +
+
+ + "; + foreach ($editableColumn as $key => $val) { + $j = (($i++) % 4); + $fieldVal = empty($data) ? "" : $data[$key]; + + $_input = $val['tag'] == 'select' ? + FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : + FormHelper::tag("label", $val['attr'], $fieldVal); + + //""; + if ($i != 1 && $j == 0) { + echo " +
+
+ "; + } + echo "
+ " . $val['label'] . " +
+
+ $_input +
+ "; + } + echo "
"; + + ?> + +
+
+ 洽商進度 +
+
+ + +
+
+
+
+ 電梯詳細資料 +
+ + + + + + empty($val['attr']['colspan']) + ? 1 : $val['attr']['colspan']], $val['label']); + + if ((++$j % 14) == 0) { + // if ($j == 12) echo ""; + + + echo ""; + } + } + + ?> + + + + + $val) { + $j = 0; + + $cmecRow = " "; + + foreach ($con_maintance_examine_clear_columm as $col => $col_def) { + $fieldVal = empty($val) ? "" : $val[$col]; + if ($col == 'mi_cost') { + $param = [ + 'elevator_type' => $val['con_elevator_kind'], + 'floors' => $val['floors'], + 'speed' => $val['speed'], + 'persons' => $val['persons'], + 'weight' => $val['weight'], + 'maintain_times' => $val['maintain_times'], + 'maintain_months' => $val['maintain_months'], + 'maintain_kind' => $data['maintain_kind'], + 'maintain_period' => $val['maintain_period'], + 'is_m1_bundle' => $val['is_m1_bundle'], + ]; + $mic = new MICalculator(); + $res = $mic->cal($param); + #MI報價 + $con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = ($res['status'] + == 'ok' ? $res['price'] : $res['message']); + $con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" + #扣率 + $val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; + } + + $_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 + : $col_def['attr']['colspan']], $fieldVal); + $cmecRow .= ""; + + $cmecRow = (++$j % 14 == 0) ? $cmecRow . "" : $cmecRow; + } + $tr_class = $tr_class == 'odd' ? "even" : "odd"; + echo $cmecRow . ""; + } + ?> + + + + + + + +
操作
$_input
+
+ + + + + +
+
+ +
+ +
+
+ 簽核意見 +
+ +
+ +
+
+
+
+ 簽核狀態 +
+
+ +
+ +
+ 下位簽核者 +
+
+ + +
+
+ +
+ +
+
+
+ +
+
+
+ + +
+ +
+ + + + ' . $wf->getNodeDescriptions($as['flow_code']) . ' +
'; + $tmp_code = $as['flow_code']; + ?> +
"> +
+ + + + +   + " . $as['position_name'] . " "; ?> + + + + + + +   + 申請人 "; ?> + 退回"; ?> + 會簽"; ?> + + + + 簽核於: + + + +
+
+ +
+ +
+ +
+ + + +
+
+ +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/wms/cont/sign_list.php b/wms/cont/sign_list.php index 0d942a5e..feba52e0 100644 --- a/wms/cont/sign_list.php +++ b/wms/cont/sign_list.php @@ -3,30 +3,34 @@ require_once "../header.php"; // 載入db.php來連結資料庫 $table = 'con_maintance_examine_apply'; +$para = "function_name=pricereview&" . $token_link; + +$status_arr = ["Y1" => "暫存", "YS" => "簽核中", "YY" => "結案同意", "YN" => "結案不同意"]; + #可編輯的列 -$editableColumn = [ - 'apply_key' => [ - 'label' => "評審單號", "value" => "", "tag" => 'text', - 'attr' => [ - 'readonly=true ', - 'class' => 'form-control form-control-sm' - ] - ], - 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], - 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'num' => ['label' => "電梯臺數", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']], - 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']], - 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - 'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - //'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], - -]; +// $editableColumn = [ +// 'apply_key' => [ +// 'label' => "評審單號", "value" => "", "tag" => 'text', +// 'attr' => [ +// 'readonly=true ', +// 'class' => 'form-control form-control-sm' +// ] +// ], +// 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], +// 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], +// 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], +// 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm']], +// 'num' => ['label' => "電梯臺數", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], +// 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], +// 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']], +// 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], +// 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], +// 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']], +// 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], +// 'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], +// //'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], + +// ]; // 設置一個空陣列來放資料 $data = array(); @@ -41,7 +45,7 @@ $res = mysqli_query($link, $sql); $row = mysqli_fetch_row($res); $user_department_id = $row[0]; mysqli_free_result($res); -if (in_array($user_department_id, $depart_arr) || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0006") $where = ""; +if (in_array($user_department_id, $depart_arr) || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0006" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "M0225") $where = ""; // 電梯廠牌 $elevator_brand_arr = []; @@ -59,6 +63,7 @@ $sql = "SELECT case_name, brand , num , +salesman as salesman_id, f_return_name(salesman) salesman, f_return_content('maintain_kind',maintain_kind ) maintain_kind, date_format(contract_begin_date,'%Y/%m/%d') contract_begin_date, @@ -67,11 +72,13 @@ f_return_content('contract_kind',contract_kind ) contract_kind, platform_company, platforom_company_tel, form_key, - +status, f_return_content('payment_kind',payment_kind ) payment_kind FROM $table where 1=1 $where ORDER BY vol_no"; - +// echo $sql; $data = mysqli_query($link, $sql); + + ?> - + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + - - -
評審單號卷號現場地址現場名稱電梯品牌電梯台數營業員保養方式契約期限開始契約期限結束契約性質加盟公司名稱加盟公司電話是否結案合約下載
-

(契約)價審單查詢

-
- - - "; - foreach ($editableColumn as $key => $val) { - - echo ""; - } - echo ""; - // echo ""; - echo ""; - ?> - - - - - $val) { - if ( $key =='apply_key') { - echo ""; - } elseif ($key == 'brand') { - echo ""; + + + "; - } - } - //list($signer)=DB::fields("); -//echo " select f_return_name(current_assigner) signer from subflow where form_key='". $row['form_key'] ."'"; ". (is_array($row['form_key'])?'': $row['form_key']) ." - list($signer)=mysqli_fetch_array(mysqli_query($link, "select max(f_return_name(current_assigner) ) signer from subflow where form_key='". $row['form_key'] ."'" )); - - echo ""; - - ?> - - - - -
".$val['label']."是否結案刪除
" . $row[$key] . "" . (!empty($row[$key])?$elevator_brand_arr[$row[$key]]:"") . " + + " . $row[$key] . "" .(empty($signer)?"結案":"N") . "
+ echo '檢視'; + } ?> + + + 待簽核
+ + + -- + + + 下載 + + + + + +
"; - echo "alert('請確認電梯資料或未選擇下位簽核者!');"; - echo "history.go(-1);"; - echo ""; - 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 ""; +"; + echo "alert('請確認電梯資料或未選擇下位簽核者!');"; + echo "history.go(-1);"; + echo ""; + 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 ""; diff --git a/wms/cont/t.php b/wms/cont/t.php index f6103f08..180a88c8 100644 --- a/wms/cont/t.php +++ b/wms/cont/t.php @@ -1,84 +1,84 @@ - 'A', - 'floors' => 7, - 'speed' => 1, - 'persons' => 6, - 'weight' => 1000, - 'maintain_times' => 1, - 'maintain_months' => 12, - 'maintain_kind' => 2, - 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 - 'is_m1_bundle' => 'N', -]; -*/ -/* //货梯 -$param = [ - - 'elevator_type' => 'B', - 'floors' => 7, - 'speed' => 1, - 'persons' => 6, - 'weight' => 1000, - 'maintain_times' => 1, - 'maintain_months' => 12, - 'maintain_kind' => 2, - 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 - 'is_m1_bundle' => 'N', -]; -*/ - -/*//病床梯 -$param = [ - - 'elevator_type' => 'C', - 'floors' => 28, - 'speed' => 1, - 'persons' => 6, - 'weight' => 1000, - 'maintain_times' => 2, //病床梯一月2次保养 - 'maintain_months' => 12, - 'maintain_kind' => 2, - 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 - 'is_m1_bundle' => 'N', -];*/ - -/*//无机房 -$param = [ - 'elevator_type' => 'D', - 'floors' => 3, - 'speed' => 1, - 'persons' => 6, - 'weight' => 1000, - 'maintain_times' => 1, //病床梯一月2次保养 - 'maintain_months' => 12, - 'maintain_kind' => 3, - 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 - 'is_m1_bundle' => 'N', -]; - -*/ -//家用梯 -$param = [ - 'elevator_type' => 'E', - 'floors' => 3, - 'speed' => 1, - 'persons' => 6, - 'weight' => 1000, - 'maintain_times' => 1, //病床梯一月2次保养 - 'maintain_months' => 60, - 'maintain_kind' => 2, - 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 - 'is_m1_bundle' => 'Y', -]; - -$mic = new MSCalculator(); -$price = $mic->cal($_GET); -echo json_encode($price); + 'A', + 'floors' => 7, + 'speed' => 1, + 'persons' => 6, + 'weight' => 1000, + 'maintain_times' => 1, + 'maintain_months' => 12, + 'maintain_kind' => 2, + 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 + 'is_m1_bundle' => 'N', +]; + +//货梯 +$param = [ + + 'elevator_type' => 'B', + 'floors' => 7, + 'speed' => 1, + 'persons' => 6, + 'weight' => 1000, + 'maintain_times' => 1, + 'maintain_months' => 12, + 'maintain_kind' => 2, + 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 + 'is_m1_bundle' => 'N', +]; + + +//病床梯 +$param = [ + + 'elevator_type' => 'C', + 'floors' => 28, + 'speed' => 1, + 'persons' => 6, + 'weight' => 1000, + 'maintain_times' => 2, //病床梯一月2次保养 + 'maintain_months' => 12, + 'maintain_kind' => 2, + 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 + 'is_m1_bundle' => 'N', +]; + +//无机房 +$param = [ + 'elevator_type' => 'D', + 'floors' => 3, + 'speed' => 1, + 'persons' => 6, + 'weight' => 1000, + 'maintain_times' => 1, //病床梯一月2次保养 + 'maintain_months' => 12, + 'maintain_kind' => 3, + 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 + 'is_m1_bundle' => 'N', +]; + + +//家用梯 +$param = [ + 'elevator_type' => 'E', + 'floors' => 3, + 'speed' => 1, + 'persons' => 6, + 'weight' => 1000, + 'maintain_times' => 1, //病床梯一月2次保养 + 'maintain_months' => 60, + 'maintain_kind' => 2, + 'maintain_period' => 1, //默认为1月1次, 2是为2月一次 + 'is_m1_bundle' => 'Y', +]; + +$mic = new MSCalculator(); +$price = $mic->cal($_GET); +echo json_encode($price); diff --git a/wms/contract-create.php b/wms/contract-create.php index b1241568..3e28f217 100644 --- a/wms/contract-create.php +++ b/wms/contract-create.php @@ -1,126 +1,126 @@ - - -
- - Please fill up the required field!

"; - } else { - echo "

Record has added successfully

"; - } - } - */ - ?> - - - -
" enctype="multipart/form-data"> - - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- -
- -
-
- -
- -
- - -

-
- -
- - -

-
- -
-
- -
- -
-
- - + + +
+ + Please fill up the required field!

"; + } else { + echo "

Record has added successfully

"; + } + } + */ + ?> + + + +
" enctype="multipart/form-data"> + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ +
+ +
+
+ +
+ +
+ + +

+
+ +
+ + +

+
+ +
+
+ +
+ +
+
+ + diff --git a/wms/contract-delete.php b/wms/contract-delete.php index 10371003..a8884d8b 100644 --- a/wms/contract-delete.php +++ b/wms/contract-delete.php @@ -1,12 +1,12 @@ - \ No newline at end of file diff --git a/wms/contract-edit.php b/wms/contract-edit.php index 9df494e6..c643d2a6 100644 --- a/wms/contract-edit.php +++ b/wms/contract-edit.php @@ -1,142 +1,142 @@ -getMessage(), "\n"; - } -*/ - foreach($data as $data) : -?> - -
-
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
- -
- -
-
- - +getMessage(), "\n"; + } +*/ + foreach($data as $data) : +?> + +
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ +
+ +
+
+ + diff --git a/wms/contract-index.php b/wms/contract-index.php index 8f510483..bde2374d 100644 --- a/wms/contract-index.php +++ b/wms/contract-index.php @@ -1,162 +1,162 @@ - - - - -

- - - -

-Please fill up the required field!

"; - } else { - header("Location:contract-index.php"); - } - } - -?> - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
項次合約類型合約號公司名稱統一編號地址電話立約人客戶維護帳號業務聯繫人業務聯繫人地址業務聯繫人電話業務聯繫人郵件地址契約人員工號合約起始日合約終止日建檔人建檔時間修改
-

- - - -

-
-
- -There is no record!"; -endif; - -#代表結束連線 -mysqli_close($link); - -include "footer.php"; - -?> + + + + +

+ + + +

+Please fill up the required field!

"; + } else { + header("Location:contract-index.php"); + } + } + +?> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
項次合約類型合約號公司名稱統一編號地址電話立約人客戶維護帳號業務聯繫人業務聯繫人地址業務聯繫人電話業務聯繫人郵件地址契約人員工號合約起始日合約終止日建檔人建檔時間修改
+

+ + + +

+
+
+ +There is no record!"; +endif; + +#代表結束連線 +mysqli_close($link); + +include "footer.php"; + +?> diff --git a/wms/contract-record-submit.php b/wms/contract-record-submit.php index 7b6ea47e..724e430a 100644 --- a/wms/contract-record-submit.php +++ b/wms/contract-record-submit.php @@ -1,61 +1,61 @@ - 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} -?> + 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} +?> diff --git a/wms/contract-record-update.php b/wms/contract-record-update.php index fabd375f..443f06ee 100644 --- a/wms/contract-record-update.php +++ b/wms/contract-record-update.php @@ -1,50 +1,50 @@ - 0) { - echo ""; - } elseif ($affected == 0) { - echo ""; - } else { - echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); - } -} + 0) { + echo ""; + } elseif ($affected == 0) { + echo ""; + } else { + echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); + } +} ?> \ No newline at end of file diff --git a/wms/contract-repair/api/deleteNewContractData.php b/wms/contract-repair/api/deleteNewContractData.php new file mode 100644 index 00000000..d2d7b6b7 --- /dev/null +++ b/wms/contract-repair/api/deleteNewContractData.php @@ -0,0 +1,34 @@ +prepare($sql); + $stmt->bindParam(":id", $id); + $stmt->bindParam(":del", $del); + $stmt->bindParam(":user_id", $user_id); + $stmt->bindParam(":date", $date); + $stmt->execute(); + header("HTTP/1.1 204 NO Content"); + } catch (PDOException $e) { + die("ERROR!!!" . $e->getMessage()); + } +} +if (isset($_GET['contractid']) && $_GET['contractid'] != "") { + try { + $id = $_GET["contractid"]; + $sql_str = "DELETE FROM contract_m_signed_back WHERE id = :contractid"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(":contractid", $id); + $stmt->execute(); + header("HTTP/1.1 204 No Content"); + } catch (PDOException $e) { + die("ERROR!!!: " . $e->getMessage()); + } +} diff --git a/wms/contract-repair/api/getComboNo.php b/wms/contract-repair/api/getComboNo.php new file mode 100644 index 00000000..c258be15 --- /dev/null +++ b/wms/contract-repair/api/getComboNo.php @@ -0,0 +1,59 @@ +'BW002', + 'month'=>'EM002', + 'quarter'=>'EQ002', + 'half'=>'HY002', + 'year'=>'EY002' + ]; + private $bwarr = [ + 'week','month','week','month','week','quarter', + 'week','month','week','month','week','half', + 'week','month','week','month','week','quarter', + 'week','month','week','month','week','year' + ]; + private $emarr = [ + 'month','month','quarter','month','month','half', + 'month','month','quarter','month','month','year' + ]; + private $combo; + private $startdate; + private $enddate; + public function __construct($combo, $startdate, $enddate){ + $this->combo = $combo; + $this->startdate = $startdate; + $this->enddate = $enddate; + } + public function getComboNo(){ + $comboarr = (array) $this->combo === 'bw' ? $this->bwarr : $this->emarr; + + $startdate = new DateTime($this->startdate); + $enddate = new DateTime($this->enddate); + + $interval = date_diff($startdate, $enddate); + + $months = $interval->y * 12 + $interval->m; + $months = $this->combo === 'bw' ? $months*2 : $months; + + $newarr = []; + $idx = 0; + $ori_first_month = date('m', strtotime($this->startdate)); + $first_day = date('Y-m-d', strtotime($this->startdate. ' + 3 days')); + $new_first_month = date('m', strtotime($first_day)); + if($ori_first_month != $new_first_month){ + $first_day = date('Y-m-t', strtotime($this->startdate)); + } + $scheduleDate = new DateTime($first_day); + for ($i = 0; $i < $months; $i++){ + $newarr[] = [$this->comboarr[$comboarr[$idx]], $scheduleDate->format("Y-m-d")]; + $idx ++; + $scheduleDate = $startdate->modify("+1 month"); + if($idx >= count($comboarr)){ + $idx = 0; + } + } + return json_encode($newarr); + } +} \ No newline at end of file diff --git a/wms/contract-repair/api/getContractData.php b/wms/contract-repair/api/getContractData.php new file mode 100644 index 00000000..aceedd0a --- /dev/null +++ b/wms/contract-repair/api/getContractData.php @@ -0,0 +1,122 @@ +prepare($sql_str); + $stmt->bindParam(':vol_no', $contractno); + $stmt->execute(); + $contract = $stmt->fetch(PDO::FETCH_ASSOC); + + if (empty($contract)) { + echo false; + exit; + } + $apply_key = $contract['apply_key']; + $sql_str = "SELECT * FROM con_maintance_examine_clear WHERE apply_key = :apply_key"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':apply_key', $apply_key); + $stmt->execute(); + $elevators = $stmt->fetchAll(PDO::FETCH_ASSOC); + $count = COUNT($elevators); + $contract['elevators'] = $elevators; + $contract['num'] = $count; + + $contractResponse = json_encode($contract); + + // 設定回應標頭為 JSON + header('Content-Type: application/json'); + + // 將 JSON 回應返回給客戶端 + echo $contractResponse; + // echo json_encode($contractResponse); + } catch (PDOException $e) { + die("ERROR!!!: " . $e->getMessage()); + } +} + +if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') { + try { + $contractno = $_GET['contractno']; + $sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':vol_no', $contractno); + $stmt->execute(); + $contract = $stmt->fetch(PDO::FETCH_ASSOC); + $contractResponse = json_encode($contract); + + // 設定回應標頭為 JSON + header('Content-Type: application/json'); + + // 將 JSON 回應返回給客戶端 + echo $contractResponse; + } catch (PDOException $e) { + die("ERROR!!!: " . $e->getMessage()); + } +} +////////////////////////////// +//// 合約簽回(修理) +//// +//// 製作人:梓誠 +/// 時間 : +////////////////////////////// +if (isset($_GET['repair_no']) && $_GET['repair_no'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r') { + try { + $repair_no = $_GET['repair_no']; + $fail_arr = []; + $d_status = '1'; + // 判斷單號是否在合約簽核已建立 + $sql = "SELECT COUNT(*) AS num FROM contract_r_signed_back WHERE repair_no = :repair_no AND delete_status = :d_status "; + $stmt = $conn->prepare($sql); + $stmt->bindParam(":repair_no", $repair_no); + $stmt->bindParam(":d_status", $d_status); + $stmt->execute(); + $result = $stmt->fetch(PDO::FETCH_ASSOC); + $count = $result['num']; + if ($count >= 1) { + $fail_arr[] = '合約單號重複,請至契約管理(修理)查看。'; + header("HTTP/1.1 422 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + // 判斷單號是否在價格審查中以建立。 + $sql = "SELECT COUNT(*) AS num FROM pricereview_repair_main WHERE repair_no = :repair_no"; + $stmt = $conn->prepare($sql); + $stmt->bindParam(":repair_no", $repair_no); + $stmt->execute(); + $result2 = $stmt->fetch(PDO::FETCH_ASSOC); + $count2 = $result2['num']; + if ($count2 == 0) { + $fail_arr[] = '找不到單號,請再確認。'; + header("HTTP/1.1 422 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + + + // $contractno = $_GET['contractno']; + $sql = "SELECT a.*,b.name,b.accountid + FROM pricereview_repair_main AS a + LEFT JOIN account AS b + ON a.repairerid = b.accountid + WHERE a.repair_no = :repair_no "; + $stmt = $conn->prepare($sql); + + $stmt->bindParam(':repair_no', $repair_no); + $stmt->execute(); + $contract = $stmt->fetch(PDO::FETCH_ASSOC); + $contractResponse = json_encode($contract); + + // 設定回應標頭為 JSON + header('Content-Type : appliction/json'); + + // 將 JSON 回應給客戶端 + echo $contractResponse; + } catch (PDOException $e) { + die("ERROR!!:" . $e->getMessage()); + } +} diff --git a/wms/contract-repair/api/getFacilityNo.php b/wms/contract-repair/api/getFacilityNo.php new file mode 100644 index 00000000..fcf0b76f --- /dev/null +++ b/wms/contract-repair/api/getFacilityNo.php @@ -0,0 +1,518 @@ + false, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_EMULATE_PREPARES => false, + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', + ]; + $pdo = new PDO('mysql:host=' . $host . ';port=' . $dbport . ';dbname=' . $dbname . '', $dbuser, $dbpassword, $options); + $pdo->exec('SET CHARACTER SET utf8mb4'); + return $pdo; + } catch (PDOException $e) { + die("Something wrong: {$e->getMessage()}"); + } + } + + /** + * 結束資料庫連線 + */ + function endConnectionDB($pdo) + { + unset($pdo); + } + + /** + * 取得下一個新的作番 + * @param string $facility_type : M:新梯 T:汰改 B:保養 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $num : 號機 + * @return array $new_facility_arr + */ + function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1) + { + $this->checkYearAndResetAllSeq(); + $Y = substr(date("Y"), 3, 1); + + switch ($facility_type) { + case "M": + $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; + $new_facility_arr = []; + for ($start_num = 1; $start_num <= $num; $start_num++) { + $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1] + . str_pad($next_seq, 5, "0", STR_PAD_LEFT); + array_push($new_facility_arr, $facility_no_tmp); + $next_seq++; + } + return $new_facility_arr; + case "T": + $next_seq = $this->getNextFacilitySeq("tf_vol_no"); + $new_facility_arr = []; + for ($start_num = 1; $start_num <= $num; $start_num++) { + $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1] + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($start_num, 2, "0", STR_PAD_LEFT); + array_push($new_facility_arr, $facility_no_tmp); + } + return $new_facility_arr; + case "B": + $next_seq = $this->getNextFacilitySeq("bf_vol_no"); + $new_facility_arr = []; + for ($start_num = 1; $start_num <= $num; $start_num++) { + $facility_no_tmp = $Y . $sale_type . $make_type[$start_num - 1] + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($start_num, 2, "0", STR_PAD_LEFT); + array_push($new_facility_arr, $facility_no_tmp); + } + return $new_facility_arr; + default: + return "不存在的作番類型"; + } + } + + /** + * 建立新的作番 + * @param string $facility_type : M:新梯 T:汰改 B:保養 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param string $num : 號機 (非必填) + * @return string $new_facility_no + */ + function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null) + { + + $this->checkYearAndResetAllSeq(); + + $faclikity_details = array( + 'facility_type' => $facility_type, + 'sale_type' => $sale_type, + 'make_type' => $make_type, + 'num' => $num + ); + + switch ($facility_type) { + case "M": + return $this->makeNewMFacilityNo($faclikity_details); + break; + case "T": + return $this->makeNewTFacilityNo($faclikity_details); + break; + case "B": + return $this->makeNewBFacilityNo($faclikity_details); + break; + default: + return "不存在的作番類型"; + } + } + + /** + * 建立作番 -- 新梯 + */ + function makeNewMFacilityNo($faclikity_details) + { + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; + $new_facility_no_arr = []; + + for ($i = 1; $i <= $num; $i++) { + $new_facility_no = $Y . $sale_type . $make_type[$i - 1] + . str_pad($next_seq, 5, "0", STR_PAD_LEFT); + array_push($new_facility_no_arr, $new_facility_no); + $next_seq++; + } + + foreach ($new_facility_no_arr as $new_facility_no) { + if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") { + return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); + } + // seq +1 + $this->facilitySeqAddOne("M"); + } + return $new_facility_no_arr; + } + + /** + * 建立作番 -- 汰改 + */ + function makeNewTFacilityNo($faclikity_details) + { + + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("tf_vol_no"); + $new_facility_no_arr = []; + + for ($i = 1; $i <= $num; $i++) { + $new_facility_no = $Y . $sale_type . $make_type[$i - 1] + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($i, 2, "0", STR_PAD_LEFT); + array_push($new_facility_no_arr, $new_facility_no); + } + + foreach ($new_facility_no_arr as $new_facility_no) { + if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { + return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); + } + // seq +1 + $this->facilitySeqAddOne("T"); + return $new_facility_no_arr; + } + } + + /** + * 建立作番 -- 保養 + */ + function makeNewBFacilityNo($faclikity_details) + { + + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("bf_vol_no"); + $new_facility_no_arr = []; + + for ($i = 1; $i <= $num; $i++) { + $new_facility_no = $Y . $sale_type . $make_type[$i - 1] + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($i, 2, "0", STR_PAD_LEFT); + array_push($new_facility_no_arr, $new_facility_no); + } + + foreach ($new_facility_no_arr as $new_facility_no) { + if ($this->getMakeNewBFacilityNoStatus($faclikity_details) !== "1") { + return $new_facility_no . ":" . $this->getMakeNewBFacilityNoStatus($faclikity_details); + } + // seq +1 + $this->facilitySeqAddOne("B"); + return $new_facility_no_arr; + } + } + + /** + * 檢查作番編列狀態 - 新梯 + * @param array $faclikity_details + * @return string $status : 1:正確 else:error message + */ + function getMakeNewMFacilityNoStatus($faclikity_details) + { + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + + if ($this->checkSaleTypeStatus($sale_type) == false) + return "銷售代號錯誤"; + if ($this->checkMakeTypeStatus($make_type) == false) + return "製造編號類型錯誤"; + return "1"; + } + + /** + * 檢查作番編列狀態 - 汰改 + * @param array $faclikity_details + * @return string $status : 1:正確 else:error message + */ + function getMakeNewTFacilityNoStatus($faclikity_details) + { + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + + if ($this->checkSaleTypeStatus($sale_type) == false) + return "銷售代號錯誤"; + if ($this->checkMakeTypeStatus($make_type) == false) + return "製造編號類型錯誤"; + return "1"; + } + + /** + * 檢查作番編列狀態 - 保養 + * @param array $faclikity_details + * @return string $status : 1:正確 else:error message + */ + function getMakeNewBFacilityNoStatus($faclikity_details) + { + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + + if ($this->checkSaleTypeStatus($sale_type) == false) + return "銷售代號錯誤"; + if ($this->checkMakeTypeStatus($make_type) == false) + return "製造編號類型錯誤"; + return "1"; + } + + /** + * seq 取號 + * @param string $type M:新梯 T:汰改 B:保養 + */ + function facilitySeqAddOne($type) + { + $type_arr = array( + "M" => "mf_vol_no", + "T" => "tf_vol_no", + "B" => "bf_vol_no", + ); + if (!empty($type_arr[$type])) { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?'); + $sth->bindValue(1, $type_arr[$type]); + $sth->execute(); + } + } + + /** + * 修正 seq 取號 + * @param string $type M:新梯 T:汰改 B:保養 + */ + function facilityFixSeq($type) + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $type_arr = array( + "M" => "mf_vol_no", + "T" => "tf_vol_no", + "B" => "bf_vol_no", + ); + $after_fix_seq = $this->getMaxSeq($type); + $sql = " + UPDATE sequence + SET current_val = ? + WHERE seq_name = ? + "; + $sth = $pdo->prepare($sql); + $sth->bindValue(1, $after_fix_seq); + $sth->bindValue(2, $type_arr[$type]); + $sth->execute(); + } + + function getMaxSeq($type) + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $Y = substr(date("Y"), 3, 1); + $seq_num = $type == 'M' ? 5 : 3; + $sql = " + SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq + FROM facility AS f + WHERE 1=1 + AND SUBSTR(f.facilityno,1,1) = ? + AND f.define = ? + ORDER BY SUBSTR(f.facilityno,4,3) ASC + "; + $sth = $pdo->prepare($sql); + $sth->bindValue(1, $seq_num); + $sth->bindValue(2, $Y); + $sth->bindValue(3, $type); + $sth->execute(); + $result = $sth->fetch(); + return $result['seq']; + } + + /** + * 檢查年月後 新梯及汰改seq歸零 + */ + function checkYearAndResetAllSeq() + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); + $sth->bindValue(1, 'mf_vol_no'); + $sth->execute(); + $result = $sth->fetch(); + $yyyymm = $result['yyyymm']; + $dataY = substr($yyyymm, 0, 4); + $today_Y = date("Y"); + $today_Ym = date("Ym"); + if ($dataY != $today_Y) { + $sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?'); + $sth->bindValue(1, '0'); + $sth->bindValue(2, $today_Ym); + $sth->bindValue(3, 'mf_vol_no'); + $sth->execute(); + } + } + + /** + * 檢查作番在 facility table 中是否重複 + * @param string|array $facility_no + * @return boolean $status : true:沒重複 false:重複 + */ + function checkFacilityRepeatStatus($facility_no) + { + if (gettype($facility_no) == "string") { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); + $sth->bindValue(1, $facility_no); + $sth->execute(); + if ($sth->rowCount() == 0) + return true; + return false; + } + if (gettype($facility_no) == "array") { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $status = true; + foreach ($facility_no as $row) { + $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); + $sth->bindValue(1, $row); + $sth->execute(); + if ($sth->rowCount() !== 0) + $status = false; + } + return $status; + } + } + + /** + * 檢查 $sale_type 是否有存在規則之中 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @return boolean $status : true:合法代碼 false:非法代碼 + */ + function checkSaleTypeStatus($sale_type) + { + + if (!in_array($sale_type, ['M', 'E', 'T', 'J', 'X'])) + return false; + return true; + } + + /** + * 檢查 $sale_type 是否有存在規則之中 + * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @return boolean $status : true:合法代碼 false:非法代碼 + */ + function checkMakeTypeStatus($make_type) + { + foreach ($make_type as $row) + if (!in_array($row, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y'])) + return false; + return true; + } + + /** + * 檢查 取得下個作番的 seq + * @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no + * @return int $seq : 作番流水號 + */ + function getNextFacilitySeq($seq_name) + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); + $sth->bindValue(1, $seq_name); + $sth->execute(); + $result = $sth->fetch(); + return $result['current_val']; + } + + /** + * 建立新的新梯作番 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $seq_name : 幾個案場 0-99 + * @return array $new_facilityno : 作番號 + */ + function makeMFacilityNo($sale_type, $make_type, $num) + { + if (count($make_type) !== $num) + return "陣列數量不一致!"; + $new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num); + if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { + // 如果作番號重複 使用此函數修正 + $this->facilityFixSeq("M"); + } + return $this->makeFacilityNo("M", $sale_type, $make_type, $num); + } + + /** + * 建立新的汰改作番 + * @param array $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $seq_name : 幾個案場 0-99 + * @return array $new_facilityno : 作番號 + */ + function makeTFacilityNo($sale_type, $make_type, $num) + { + if (count($make_type) !== $num) + return "陣列數量不一致!"; + $new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num); + if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { + // 如果作番號重複 使用此函數修正 + $this->facilityFixSeq("T"); + } + return $this->makeFacilityNo("T", $sale_type, $make_type, $num); + } + + /** + * 建立新的保養作番 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param array $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $seq_name : 幾個案場 0-99 + * @return array $new_facilityno : 作番號 + */ + function makeBFacilityNo($sale_type, $make_type, $num = 1) + { + if (count($make_type) !== $num) + return "陣列數量不一致!"; + $new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num); + if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { + // 如果作番號重複 使用此函數修正 + $this->facilityFixSeq("B"); + } + return $this->makeFacilityNo("B", $sale_type, $make_type, $num); + } +} + + +// $cfn = new CreateFacilityNo; +// // 建立作番號 - 新梯 +// print_r($cfn->makeMFacilityNo("M", ["X", "W"], 2)); +// echo "

"; +// // 建立作番號 - 汰改 +// print_r($cfn->makeTFacilityNo("M", ["X", "W"], 2)); +// echo "

"; +// // 建立作番號 - 保養 +// print_r($cfn->makeBFacilityNo("M", ["X", "W"], 2)); +// echo "

"; diff --git a/wms/contract-repair/api/getPriceview.php b/wms/contract-repair/api/getPriceview.php new file mode 100644 index 00000000..0d52f0a8 --- /dev/null +++ b/wms/contract-repair/api/getPriceview.php @@ -0,0 +1,16 @@ +prepare($sql_str); + $stmt->bindParam(':id',$id); + $stmt->execute(); + $prices = $stmt->fetch(PDO::FETCH_ASSOC); + header("Content-Type: application/json"); + + echo json_encode(['prices'=> $prices]); + +}catch (PDOException $e ){ + die("ERROR!!!: ". $e->getMessage()); +} \ No newline at end of file diff --git a/wms/contract-repair/api/postContractData.php b/wms/contract-repair/api/postContractData.php new file mode 100644 index 00000000..b4815669 --- /dev/null +++ b/wms/contract-repair/api/postContractData.php @@ -0,0 +1,423 @@ + 0) { + header("HTTP/1.1 422 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + + //create account table + $accounttype = "A"; + $accountid = $vat; + $pwd = "123"; + $name = $partyA; + $tel = $phone ?? ''; + $repairerid = $mworker; + $creater = $user_id; + $create_at = date('Y-m-d H:i:s'); + + $conn->beginTransaction(); + + $sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':accounttype', $accounttype); + $stmt->bindParam(':accountid', $accountid); + $stmt->bindParam(':pwd', $pwd); + $stmt->bindParam(':name', $name); + $stmt->bindParam(':tel', $tel); + $stmt->bindParam(':address', $address); + $stmt->bindParam(':email', $email); + $stmt->bindParam(':repairerid', $repairerid); + $stmt->bindParam(':creater', $creater); + $stmt->bindParam(':create_at', $create_at); + $stmt->execute(); + + //create contract table + + $contracttype = $mtype; + $company = $partyA; + $taxid = $vat; + $tel = $phone; + $promiser = $partyA; + $contractperson = $partyA; + + $contractaddress = $address; + $contracttel = $phone; + $contractemail = $email; + $contract_employee = $salesman; + $start_date = $contract_begin_date; + $end_date = $contract_end_date; + + $sql_str = "INSERT INTO contract (contracttype, contractno, company, taxid, address, tel, promiser, contractperson, contractaddress, contracttel, contractemail, contract_employee, start_date, end_date, creater, create_at) VALUES (:contracttype, :contractno, :company, :taxid, :address, :tel, :promiser, :contractperson, :contractaddress, :contracttel, :contractemail, :contract_employee, :start_date, :end_date, :creater, :create_at)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contracttype', $contracttype); + $stmt->bindParam(':contractno', $contractno); + $stmt->bindParam(':company', $company); + $stmt->bindParam(':taxid', $taxid); + $stmt->bindParam(':address', $address); + $stmt->bindParam(':tel', $tel); + $stmt->bindParam(':promiser', $promiser); + $stmt->bindParam(':contractperson', $contractperson); + $stmt->bindParam(':contractaddress', $contractaddress); + $stmt->bindParam(':contracttel', $contracttel); + $stmt->bindParam(':contractemail', $contractemail); + $stmt->bindParam(':contract_employee', $contract_employee); + $stmt->bindParam(':start_date', $start_date); + $stmt->bindParam(':end_date', $end_date); + $stmt->bindParam(':creater', $creater); + $stmt->bindParam(':create_at', $create_at); + $stmt->execute(); + + //create facility table + $createFacilityNo = new CreateFacilityNo(); + $dailyNecessities = [ + 'MAE100' => 'X', + 'MAM200' => 'W', + 'MAH100' => 'H', + 'MAQ100' => 'Z', + 'MAF100' => 'F', + 'MAZ100' => 'B', + ]; + $facility_arr = []; + foreach ($elevators as $elevator) { + $facility_arr[] = $dailyNecessities[$elevator['spec']]; + } + echo json_encode($facility_arr); + $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num); + echo json_encode($facilityno); + echo '-------'; + $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':accountid', $mworker); + $stmt->execute(); + $worker = $stmt->fetch(PDO::FETCH_ASSOC); + $customerid = $vat; + $define = "B"; + $repairtype = $mtype; + $repairerid = $mworker; + $repairername = $worker['name']; + foreach ($elevators as $idx => $elevator) { + $sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate) + VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contractno', $contractno); + $stmt->bindParam(':define', $define); + $stmt->bindParam(':facilityno', $facilityno[$idx]); + $stmt->bindParam(':latitude', $elevator['latitude']); + $stmt->bindParam(':longitude', $elevator['longitude']); + $stmt->bindParam(':customerid', $customerid); + $stmt->bindParam(':weight', $elevator['weight']); + $stmt->bindParam(':numberofpassenger', $elevator['persons']); + $stmt->bindParam(':numberofstop', $elevator['stop']); + $stmt->bindParam(':numberoffloor', $elevator['floors']); + $stmt->bindParam(':opentype', $elevator['opendoor']); + $stmt->bindParam(':speed', $elevator['speed']); + $stmt->bindParam(':repairtype', $repairtype); + $stmt->bindParam(':maintainance', $elevator['maintainance']); + $stmt->bindParam(':facility_kind', $elevator['spec']); + $stmt->bindParam(':address', $address); + $stmt->bindParam(':repairerid', $repairerid); + $stmt->bindParam(':repairername', $repairername); + $stmt->bindParam(':creater', $creater); + $stmt->bindParam(':create_at', $create_at); + $stmt->bindParam(':area', $area); + $stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']); + $stmt->bindParam(':licensedate', $elevator['useful_date']); + $result = $stmt->execute(); + } + + //create schedule table + + $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date); + $comboArr = json_decode($comboNo->getComboNo(), true); + foreach ($facilityno as $no) { + foreach ($comboArr as $combo) { + $sql_str = 'INSERT INTO schedule (contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES (:contractno, :facilityno, :combono, :repairerid, :repairername, :duedate, :creater, :create_at)'; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contractno', $contractno); + $stmt->bindParam(':facilityno', $no); + $stmt->bindParam(':combono', $combo[0]); + $stmt->bindParam(':repairerid', $repairerid); + $stmt->bindParam(':repairername', $repairername); + $stmt->bindParam(':duedate', $combo[1]); + $stmt->bindParam(':creater', $creater); + $stmt->bindParam(':create_at', $create_at); + $result = $stmt->execute(); + } + } + // create contract_b_signed_back table + $contract_type = $mtype; + $company = $customer; + $customer_no = $vat; + $salesperson = $salesman; + $customer_phone = $phone; + $customer_email = $email; + $repairman = $mworker; + $cycle = $mcycle; + $contact_person = $partyA; + $contact_address = $partyAaddress; + $contact_phone = $partyAphone; + $contract_email = $partyAemail; + $elevators_number = $num; + $bonus = 1000; + $max_bonus = 2000; + + if (!empty($files)) { + $englisharr = range('a', 'z'); + $file = $_FILES['files']; + $file_name = $file['name']; + $file_type = $file['type']; + $tmp_name = $file['tmp_name']; + $file_size = $file['size']; + $error = $file['error']; + $newfiles = []; + foreach ($files as $file) { + $i = 0; //新陣列的索引編號 + foreach ($file as $key => $val) { + $newfiles[$i]['name'] = $files['name'][$key]; + $newfiles[$i]['type'] = $files['type'][$key]; + $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; + $newfiles[$i]['error'] = $files['error'][$key]; + $newfiles[$i]['size'] = $files['size'][$key]; + $i++; + } //foreach 第2層 end + } + $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M) + $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型 + $path = '../images/contracts/'; + if (!file_exists($path)) { + mkdir($path); + } + $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 + $datetime = (string)date('YmdHis'); + $files_id = 'b' . $datetime; // 保養=>b + 日期時間 + foreach ($newfiles as $key => $file) { + $randNum = rand(1000, 9999); + $randEnglish = $englisharr[rand(0, 25)]; + $file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name']; + $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name); + if ($msg == 1) { + $msg = '檔案傳送成功!'; + $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':files_id', $files_id); + $stmt->bindParam(':file_name', $file_name); + $stmt->bindParam(':file_mime', $file['type']); + $stmt->bindParam(':file_size', $file['size']); + $stmt->bindParam(':created_at', $created_at); + $stmt->bindParam(':created_by', $user_id); + $stmt->execute(); + } + $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '
'; + $src_name = $path . $file['name']; + if (file_exists($src_name)) { + //副檔名 + $extname = pathinfo($src_name, PATHINFO_EXTENSION); + //主檔名 + $basename = basename($src_name, '.' . $extname); + } + } + } else { + $files = null; + } + $sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price, customer_phone, customer_email, repairman, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by) + VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(":contract_no", $contractno); + $stmt->bindParam(":contract_type", $contract_type); + $stmt->bindParam(":company", $company); + $stmt->bindParam(":customer_no", $customer_no); + $stmt->bindParam(":salesperson", $salesperson); + $stmt->bindParam(":contract_start_date", $contract_begin_date); + $stmt->bindParam(":contract_end_date", $contract_end_date); + $stmt->bindParam(":total_price", $total_price); + $stmt->bindParam(":customer_phone", $customer_phone); + $stmt->bindParam(":customer_email", $customer_email); + $stmt->bindParam(":repairman", $repairman); + $stmt->bindParam(":cycle", $cycle); + $stmt->bindParam(":contact_person", $contact_person); + $stmt->bindParam(":contact_address", $contact_address); + $stmt->bindParam(":contact_phone", $contact_phone); + $stmt->bindParam(":contact_email", $contact_email); + $stmt->bindParam(":elevators_number", $elevators_number); + $stmt->bindParam(":area", $area); + $stmt->bindParam(":address", $address); + $stmt->bindParam(":files_id", $files_id); + $stmt->bindParam(":bonus", $bonus); + $stmt->bindParam(":max_bonus", $max_bonus); + $stmt->bindParam(":created_at", $created_at); + $stmt->bindParam(":created_by", $user_id); + + $stmt->execute(); + + header('Content-Type: application/json'); + // $jsonData = json_encode($files); + + $conn->commit(); + } catch (PDOException $e) { + $conn->rollback(); + echo $e->getMessage(); + die('Error!:' . $e->getMessage()); + } +} + + +////////////////////////////// +//// 合約簽回(修理) +//// +//// 製作人:梓誠 +/// 時間 : +////////////////////////////// +if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'r') { + // echo $_POST; + // exit; + try { + $created_at = date('Y-m-d H:i:s'); + $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null; + $company = !empty($_POST['company']) ? $_POST['company'] : null; + $repairid = !empty($_POST['repairid']) ? $_POST['repairid'] : null; + $facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : null; + $taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null; + $invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null; + $address = !empty($_POST['address']) ? $_POST['address'] : null; + $repair_no = !empty($_POST['repair_no']) ? $_POST['repair_no'] : null; + $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null; + $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; + $type = !empty($_POST['type']) ? $_POST['type'] : null; + $sign_date = !empty($_POST['sign_date']) ? $_POST['sign_date'] : null; + $contract_status = !empty($_POST['contract_status']) ? $_POST['contract_status'] : 1; + + $fail_arr = []; + + if (empty($contractno)) $fail_arr[] = '合約號為必填'; + if (empty($repair_no)) $fail_arr[] = '報價單編號為必填'; + if (empty($company)) $fail_arr[] = '客戶名稱為必填'; + if (empty($repairid)) $fail_arr[] = '為保人員為必填'; + // iempty(f($taxid === '') return $fail_arr[] = '統一編號為必填'; + if (empty($facilityno)) $fail_arr[] = '電梯編號為必填'; + if (empty($address)) $fail_arr[] = '工程地址為必填'; + if (empty($type)) $fail_arr[] = '工程類別為必填'; + if (empty($invoice)) $fail_arr[] = '發票抬頭為必填'; + if (empty($taxid)) $fail_arr[] = '統一編號為必填'; + // echo json_encode($fail_arr); + // exit; + if (count($fail_arr) > 0) { + header("HTTP/1.1 422 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + // exit(); + //create contrac_r_signed_back table + $conn->beginTransaction(); + $sql = "INSERT INTO contract_r_signed_back( + repair_no, + contractno, + company, + taxid, + facilityno, + address, + type, + invoice, + repaireid, + total_price, + sign_date, + contract_status, + create_user, + create_date) VALUES( + :repair_no, + :contractno, + :company, + :taxid, + :facilityno, + :address, + :type, + :invoice, + :repaireid, + :total_price, + :sign_date, + :contract_status, + :create_userid, + :create_date + )"; + $stmt = $conn->prepare($sql); + $stmt->bindParam(":repair_no", $repair_no); + $stmt->bindParam(":contractno", $contractno); + $stmt->bindParam(":company", $company); + $stmt->bindParam(":taxid", $taxid); + $stmt->bindParam(":facilityno", $facilityno); + $stmt->bindParam(":address", $address); + $stmt->bindParam(":type", $type); + $stmt->bindParam(":invoice", $invoice); + $stmt->bindParam(":repaireid", $repairid); + $stmt->bindParam(":total_price", $total_price); + $stmt->bindParam(":sign_date", $sign_date); + $stmt->bindParam(":contract_status", $contract_status); + $stmt->bindParam(":create_userid", $user_id); + $stmt->bindParam("create_date", $created_at); + + $stmt->execute(); + header('Content-Type: application/json'); + // $jsonData = json_encode($files); + + $conn->commit(); + } catch (PDOException $e) { + $conn->rollback(); + header("HTTP/1.1 422 Unprocessable Entity"); + echo $e->getMessage(); + die('Error!' . $e->getMessage()); + } +} diff --git a/wms/contract-repair/api/postContractNewApplyData.php b/wms/contract-repair/api/postContractNewApplyData.php new file mode 100644 index 00000000..f0032a78 --- /dev/null +++ b/wms/contract-repair/api/postContractNewApplyData.php @@ -0,0 +1,68 @@ +beginTransaction(); + try{ + if($isFirst == 1){ + $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, progress, status, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :progress, :status, :created_at, :created_by)"; + $stmt = $conn -> prepare($sql_str); + $stmt ->bindParam(':mid', $mid); + $stmt ->bindParam(':contractno', $vol_no); + $stmt ->bindParam(':sales_man', $salesman); + $stmt ->bindParam(':apply_date', $apply_date); + $stmt ->bindParam(':apply_type', $apply_type); + $stmt ->bindParam(':case_name', $case_name); + $stmt ->bindParam(':customer', $customer); + $stmt ->bindParam(':manager', $manager); + $stmt ->bindParam(':vat', $vat); + $stmt ->bindParam(':total_price', $total_price); + $stmt ->bindParam(':buy_fee', $buy_fee); + $stmt ->bindParam(':install_fee', $install_fee); + $stmt ->bindParam(':contact_address', $contact_address); + $stmt ->bindParam(':workdeadline_a', $workdeadline_a); + $stmt ->bindParam(':workdeadline_b', $workdeadline_b); + $stmt ->bindParam(':test_time', $test_time); + $stmt ->bindParam(':freedeadline', $freedeadline); + $stmt ->bindParam(':trade_address', $trade_address); + $stmt ->bindParam(':tradedeadline', $tradedeadline); + $stmt ->bindParam(':progress', $progress); + $stmt ->bindParam(':status', $status); + $stmt ->bindParam(':created_at', $created_at); + $stmt ->bindParam(':created_by', $created_by); + $stmt ->execute(); + header("HTTP/1.1 201 success!"); + $conn->commit(); + } + }catch(PDOException $e){ + $conn->rollback(); + echo $e->getMessage(); + die('Error!:'.$e->getMessage()); + } + + +} \ No newline at end of file diff --git a/wms/contract-repair/api/postNewContractData.php b/wms/contract-repair/api/postNewContractData.php new file mode 100644 index 00000000..001fe1f5 --- /dev/null +++ b/wms/contract-repair/api/postNewContractData.php @@ -0,0 +1,139 @@ + 0) { + header("HTTP/1.1 422 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + + + $conn->beginTransaction(); + + $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC"; + $stmt = $conn -> prepare($sql_str); + $stmt -> bindParam(":accountid",$salesman); + $stmt -> execute(); + $saleman = $stmt->fetch(PDO::FETCH_ASSOC); + $salesman_name = $saleman['name']; + if(!empty($files)){ + $englisharr = range('a', 'z'); + $files = $_FILES['files']; + $newfiles = []; + foreach( $files as $file ){ + $i = 0; //新陣列的索引編號 + foreach( $file as $key => $val ){ + $newfiles[$i]['name'] = $files['name'][$key]; + $newfiles[$i]['type'] = $files['type'][$key]; + $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; + $newfiles[$i]['error'] = $files['error'][$key]; + $newfiles[$i]['size'] = $files['size'][$key]; + $i++; + } //foreach 第2層 end + } + $max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M) + $allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型 + $path = '../images/contracts/'; + if (!file_exists($path)) { mkdir($path); } + $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 + $datetime = (string)date('YmdHis'); + $files_id = 'm' . $datetime; // 保養=>b + 日期時間 + foreach( $newfiles as $key => $file ){ + $randNum = rand(1000,9999); + $randEnglish = $englisharr[rand(0,25)]; + $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name']; + $msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name ); + if($msg==1){ + $msg = '檔案傳送成功!'; + $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)"; + $stmt = $conn -> prepare($sql_str); + $stmt -> bindParam(':files_id' ,$files_id); + $stmt -> bindParam(':file_name' ,$file_name); + $stmt -> bindParam(':file_mime' ,$file['type']); + $stmt -> bindParam(':file_size' ,$file['size']); + $stmt -> bindParam(':created_at' ,$created_at); + $stmt -> bindParam(':created_by' ,$created_by); + $stmt ->execute(); + }else{ + throw new PDOException('檔案上傳失敗:' . $msg); + } + $msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '
'; + $src_name = $path.$file['name']; + if( file_exists($src_name) ){ + //副檔名 + $extname = pathinfo($src_name, PATHINFO_EXTENSION); + //主檔名 + $basename = basename($src_name, '.'.$extname); + } + } + }else{ + $files = null; + } + + $sql_str = "INSERT INTO contract_m_signed_back (contract_no, customer, manager, vat, case_name, linkman, lm_tel, address, salesman, salesman_name, files_id, created_at, created_by, qc_official_type) VALUES (:contract_no, :customer, :manager, :vat, :case_name, :linkman, :lm_tel, :address, :salesman, :salesman_name, :files_id, :created_at, :created_by, :qc)"; + $stmt = $conn -> prepare($sql_str); + $stmt -> bindParam(":contract_no",$contractno); + $stmt -> bindParam(":customer",$customer); + $stmt -> bindParam(":manager",$manager); + $stmt -> bindParam(":vat",$vat); + $stmt -> bindParam(":case_name",$case_name); + $stmt -> bindParam(":linkman",$linkman); + $stmt -> bindParam(":lm_tel",$lm_tel); + $stmt -> bindParam(":address",$address); + $stmt -> bindParam(":salesman",$salesman); + $stmt -> bindParam(":salesman_name",$salesman_name); + $stmt -> bindParam(":files_id",$files_id); + $stmt -> bindParam(":created_at",$created_at); + $stmt -> bindParam(":created_by",$created_by); + $stmt -> bindParam(":qc",$qc); + $stmt -> execute(); + + + $result = $conn->commit(); + if($result){ + header("HTTP/1.1 201 Created"); + } + + }catch(PDOException $e){ + $conn->rollback(); + header("HTTP/1.1 500 Internal Server Error"); + die('Error!:'.$e->getMessage()); + } + } \ No newline at end of file diff --git a/wms/contract-repair/api/putContractData.php b/wms/contract-repair/api/putContractData.php new file mode 100644 index 00000000..cffa48a0 --- /dev/null +++ b/wms/contract-repair/api/putContractData.php @@ -0,0 +1,190 @@ + 0) { + header("HTTP/1.1 442 Unprocessable Entity"); + echo json_encode($fail_arr); + exit(); + } + // $conn->beginTransaction(); + + $sql = "UPDATE contract_r_signed_back SET + repaireid = :repaireid,facilityno= :facilityno, invoice=:invoice, taxid=:taxid, address=:address,type=:type,contract_status=:contract_status,update_user=:update_user,update_date=:update_date + WHERE id = :id"; + + $stmt = $conn->prepare($sql); + $stmt->bindParam(':repaireid', $repaireid); + $stmt->bindParam(':facilityno', $facilityno); + $stmt->bindParam(':invoice', $invoice); + $stmt->bindParam(':taxid', $taxid); + $stmt->bindParam(':address', $address); + $stmt->bindParam(':type', $type); + $stmt->bindParam(':contract_status', $contract_status); + $stmt->bindParam(':update_user', $user_id); + $stmt->bindParam(':update_date', $create_date); + + $stmt->bindParam(':id', $_POST['id']); + // echo json_encode($sql); + // exit; + $stmt->execute(); + // header("HTTP/1.1 204 NO Content"); + + // $conn->commit(); + } catch (PDOException $e) { + // $conn->rollback(); + header("HTTPP/1.1 500 Internal Server Error"); + die('Error!:' . $e->getMessage()); + } +} +// if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST["id"]) && $_POST['id'] != "") { +// try { +// $created_at = date('Y-m-d H:i:s'); +// $created_by = $_POST['user_id']; +// $id = $_POST["id"]; +// $contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null; +// $customer = !empty($_POST['customer']) ? $_POST['customer'] : null; +// $manager = !empty($_POST['manager']) ? $_POST['manager'] : null; +// $vat = !empty($_POST['vat']) ? $_POST['vat'] : null; +// $case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null; +// $linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null; +// $lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null; +// $address = !empty($_POST['address']) ? $_POST['address'] : null; +// $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null; +// $qc = !empty($_POST['qc']) ? $_POST['qc'] : null; +// $deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null; +// $files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null; +// $files = !empty($_FILES['files']) ? $_FILES['files'] : null; + +// $deletefilesArr = explode(',', $_POST['deletefiles']); + +// $fail_arr = []; +// if (empty($contract_no)) $fail_arr[] = '合約號為必填'; +// if (empty($customer)) $fail_arr[] = '客戶名稱為必填'; +// if (empty($manager)) $fail_arr[] = '負責人為必填'; +// if (empty($vat)) $fail_arr[] = '統編/身分證為必填'; +// if (empty($case_name)) $fail_arr[] = '案名為必填'; +// if (empty($linkman)) $fail_arr[] = '聯絡人為必填'; +// if (empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填'; +// if (empty($address)) $fail_arr[] = '地址為必填'; +// if (empty($salesman)) $fail_arr[] = '營業員為必填'; +// if (empty($qc)) $fail_arr[] = '請選擇QC或管檢'; +// if (count($fail_arr) > 0) { +// header("HTTP/1.1 422 Unprocessable Entity"); +// echo json_encode($fail_arr); +// exit(); +// } + +// $conn->beginTransaction(); + +// $sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman, qc_official_type=:qc WHERE id = :id"; +// $stmt = $conn->prepare($sql_str); +// $stmt->bindParam(':contract_no', $contract_no); +// $stmt->bindParam(':customer', $customer); +// $stmt->bindParam(':manager', $manager); +// $stmt->bindParam(':vat', $vat); +// $stmt->bindParam(':case_name', $case_name); +// $stmt->bindParam(':linkman', $linkman); +// $stmt->bindParam(':lm_tel', $lm_tel); +// $stmt->bindParam(':address', $address); +// $stmt->bindParam(':salesman', $salesman); +// $stmt->bindParam(':qc', $qc); +// $stmt->bindParam(':id', $id); +// $stmt->execute(); +// if (!empty($deletefiles)) { +// $sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)"; +// $stmt = $conn->prepare($sql_str); +// $stmt->execute(); +// } + +// if (!empty($files)) { +// $englisharr = range('a', 'z'); +// $files = $_FILES['files']; +// $newfiles = []; +// foreach ($files as $file) { +// $i = 0; //新陣列的索引編號 +// foreach ($file as $key => $val) { +// $newfiles[$i]['name'] = $files['name'][$key]; +// $newfiles[$i]['type'] = $files['type'][$key]; +// $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; +// $newfiles[$i]['error'] = $files['error'][$key]; +// $newfiles[$i]['size'] = $files['size'][$key]; +// $i++; +// } //foreach 第2層 end +// } +// $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M) +// $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型 +// $path = '../images/contracts/'; +// if (!file_exists($path)) { +// mkdir($path); +// } +// $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 +// $datetime = (string)date('YmdHis'); +// $files_id = ($files_id !== null) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間 +// foreach ($newfiles as $key => $file) { +// $randNum = rand(1000, 9999); +// $randEnglish = $englisharr[rand(0, 25)]; +// $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name']; +// $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name); +// if ($msg == 1) { +// $msg = '檔案傳送成功!'; +// $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)"; +// $stmt = $conn->prepare($sql_str); +// $stmt->bindParam(':files_id', $files_id); +// $stmt->bindParam(':file_name', $file_name); +// $stmt->bindParam(':file_mime', $file['type']); +// $stmt->bindParam(':file_size', $file['size']); +// $stmt->bindParam(':created_at', $created_at); +// $stmt->bindParam(':created_by', $created_by); +// $stmt->execute(); +// } else { +// throw new PDOException('檔案上傳失敗:' . $msg); +// } +// $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '
'; +// $src_name = $path . $file['name']; +// if (file_exists($src_name)) { +// //副檔名 +// $extname = pathinfo($src_name, PATHINFO_EXTENSION); +// //主檔名 +// $basename = basename($src_name, '.' . $extname); +// } +// } +// } else { +// $files = null; +// } + +// $conn->commit(); +// } catch (PDOException $e) { +// $conn->rollback(); +// header("HTTP/1.1 500 Internal Server Error"); +// die('Error!:' . $e->getMessage()); +// } +// } diff --git a/wms/contract-repair/api/store_contract.php b/wms/contract-repair/api/store_contract.php new file mode 100644 index 00000000..e69de29b diff --git a/wms/contract-repair/api/upload_chk.php b/wms/contract-repair/api/upload_chk.php new file mode 100644 index 00000000..958cb6d5 --- /dev/null +++ b/wms/contract-repair/api/upload_chk.php @@ -0,0 +1,61 @@ + $max_size ){ + //當目前檔案容量超過容量限制時, 以下準備顯示的資訊 + if( $max_size >= 4096*4096 ){ + $max_size /= (4096*4096); + $max_size .= 'M'; + }elseif( $max_size >= 4096 ){ + $max_size /= 4096; + $max_size .= 'K'; + } + $msg ='上傳檔案過大,請選擇容量小於 '.$max_size.' 的檔案'; + + //3.判斷檔案類型 =========================================== + //in_array($ext, $allow_ext) 判斷 $ext變數的值 是否在 $allow_ext 這個陣列變數中 + }elseif( !in_array( $ext, $allow_ext ) ){ + $allow_str = ''; //準備將允許檔案類型的陣列內容, 組合成字串 + foreach( $allow_ext as $key=>$value ){ + //if的縮寫語法:條件?成立執行的工作:不成立執行的工作; + $key==0? $allow_str.= $value : $allow_str.=', '.$value; + } + $msg = '檔案類型不符合,請選擇 '.$allow_str.' 檔案'; + + //4.以上條件都沒問題的話, 則進行最後else中的工作=============== + }else{ + //搬移檔案 move_uploaded_file(要搬移的檔案, 目的地位置及目的檔案名稱), 成功傳回true(1) + $msg = @move_uploaded_file($tmp_name, $path.$file_name); + } + }else{ + //這裡表示上傳有錯誤, 匹配錯誤編號顯示對應的訊息 ====================================== + switch ($error) { + case 1: $msg = '上傳檔案超過 upload_max_filesize 容量最大值'; break; + case 2: $msg = '上傳檔案超過 post_max_size 總容量最大值'; break; + case 3: $msg = '檔案只有部份被上傳'; break; + case 4: $msg = '沒有檔案被上傳'; break; + case 6: $msg = '找不到主機端暫存檔案的目錄位置'; break; + case 7: $msg = '檔案寫入失敗'; break; + case 8: $msg = '上傳檔案被PHP程式中斷,表示主機端系統錯誤'; break; + } + } //if( $error == 0 ){ ..... end + + return $msg; //回傳$msg的結果 + } \ No newline at end of file diff --git a/wms/contract-repair/conn.php b/wms/contract-repair/conn.php new file mode 100644 index 00000000..b92e67e5 --- /dev/null +++ b/wms/contract-repair/conn.php @@ -0,0 +1,43 @@ +errorInfo()的形式獲取錯誤資訊 + //PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 + //PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 + //設定主動以警告的形式報錯 + $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); + //如果連接錯誤,將抛出一個PDOException異常對象 +} +catch ( PDOException $e ){ + //如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 + die("ERROR!!!: ". $e->getMessage()); +} + +//$conn = null; //關閉資料庫的連線 \ No newline at end of file diff --git a/wms/contract-repair/contract-download.php b/wms/contract-repair/contract-download.php new file mode 100644 index 00000000..f4c132fd --- /dev/null +++ b/wms/contract-repair/contract-download.php @@ -0,0 +1,567 @@ +prepare($sql); + $stmt->bindParam(':apply_key', $apply_key); + $stmt->execute(); + $contract_maintance = $stmt->fetchALL(PDO::FETCH_ASSOC); + echo '
';
+        print_r($contract_maintance);
+        echo '
'; + // echo $contract_maintance; + // $stmt = $conn->prepare($sql_str); + // $stmt->bindParam(':id',$id); + // $stmt->execute(); + // $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); + + + // $sql_str = "SELECT contract_new_apply.*, + // contract_new_apply_pays.pay_kind, contract_new_apply_pays.pay_scale, contract_new_apply_pays.pay_amount, contract_new_apply_pays.pay_period, contract_new_apply_pays.condition_date + // FROM contract_new_apply + // JOIN contract_new_apply_pays ON contract_new_apply.id = contract_new_apply_pays.contract_apply_id + // WHERE contract_new_apply.mid = :id"; + // $stmt = $conn->prepare($sql_str); + // $stmt->bindParam(':id', $id); + // $stmt->execute(); + // $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); + // $contract = $contracts[0]; + // $contract_apply_id = $contract['id']; + // if (($contract['status'] !== "YY" && $user_id != 'M0107') && $user_id != 'M0174' || $user_id != 'M0225') { + // echo ''; + // exit; + // } + + // 抓有望客戶的資料 + $sql_str = "SELECT * FROM hope_contract_customer WHERE vol_no = :vol_no"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':vol_no', $contract_maintance['vol_no']); + $stmt->execute(); + $customer = $stmt->fetchAll(PDO::FETCH_ASSOC); + // if (count($customer) <= 0) { + // echo ""; + // exit; + // } + + $buyArr = []; + $buyNo2Pay = false; + $buy_total_price = 0; + $installArr = []; + $install_total_price = 0; + // $noteArr = explode(",", $contracts[0]['note']); + $noteArr = array(1, 1, 1, 1, 1); + $qty = $contract_maintance[0]['num']; + // echo $qty; + // foreach ($contract_maintance as $idx => $amount) { + // $isset = false; + // if ($amount['payment_kind'] == 5 || $amount['payment_kind'] == 6) { + // if ($amount['pay_scale'] >= 0) { + // $install_total_price = $install_total_price + $amount['pay_amount']; + // $installArr[] = ['installment' => $amount['pay_kind'], 'scale' => $amount['pay_scale'], 'amount' => $amount['pay_amount'], 'pay_period' => $amount['pay_period']]; + // } + // } + // if ($amount['pay_kind'] == 1 || $amount['pay_kind'] == 2 || $amount['pay_kind'] == 3) { + // if ($amount['pay_scale'] > 0) { + // $buy_total_price = $buy_total_price + $amount['pay_amount']; + // foreach ($buyArr as $buy) { + // if ($buy['installment'] == $amount['pay_kind']) { + // $isset = true; + // } + // } + // if (!$isset) { { + // $buyArr[] = ['installment' => $amount['pay_kind'], 'scale' => $amount['pay_scale'], 'amount' => $amount['pay_amount'], 'pay_period' => $amount['pay_period']]; + // } + // if ($amount['pay_kind'] == 2) { + // $buyNo2Pay = true; + // } + // } + // } + // } + // } + $sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL"; + $sql_str = "SELECT contract_apply_files.*, contract_new_apply.id as apply_id FROM contract_apply_files LEFT JOIN contract_new_apply ON contract_apply_files.contract_id = contract_new_apply.id WHERE contract_new_apply.mid = :mid AND contract_apply_files.deleted_at IS NULL"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $id); + $stmt->execute(); + $files = $stmt->fetchAll(PDO::FETCH_ASSOC); + $files_count = count($files); + } catch (PDOException $e) { + die("ERROR!!!: " . $e->getMessage()); + } +} +?> + + + + + + +
+ +
+ + + + + + +
+
+
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+

電梯買賣合約書

+
+ 立契約人 甲方:
+
+
+ 乙方:
+
+
+
+

一二營造有限公司

+
+
(即買方,以下簡稱為甲方)
+
立合約書人
+
+

永佳捷科技股份有限公司

+
+
(即賣方,以下簡稱為乙方)
+
+ +
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+

電梯買賣合約書

+
+ 合約書編號:
+
+
+

+
+
(即買方,以下簡稱為甲方)
+
立合約書人
+
+

永佳捷科技股份有限公司

+
+
(即賣方,以下簡稱為乙方)
+
+ +
+
+
+
+
+
+
+
+ + +
+
+
+
+ + + +
+
+ +
+ + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + +
+

電梯安裝合約書

+
+ 合約書編號:
+
+
+

一二營造有限公司

+
+
(即買方,以下簡稱為甲方)
+
立合約書人
+
+

永佳捷科技股份有限公司

+
+
(即賣方,以下簡稱為乙方)
+
+ +
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
+

電梯安裝合約書

+
+ 合約書編號:
+
+
+

一二營造有限公司

+
+
(即買方,以下簡稱為甲方)
+
立合約書人
+
+

永佳捷科技股份有限公司

+
+
(即賣方,以下簡稱為乙方)
+
+ +
+
+ + + +
+
+ + + + + \ No newline at end of file diff --git a/wms/contract-repair/contract-repair-edit.php b/wms/contract-repair/contract-repair-edit.php new file mode 100644 index 00000000..c1b940e9 --- /dev/null +++ b/wms/contract-repair/contract-repair-edit.php @@ -0,0 +1,214 @@ +prepare($sql_str); +$stmt->bindParam(':id', $id); +$stmt->execute(); +$contract = $stmt->fetch(PDO::FETCH_ASSOC); + +// echo '
';
+// print_r($contract['contract_status'] + 1);
+// echo '
'; + +// $files_id = $contract['files_id']; +// $sql_str = "SELECT * FROM contract_back_files WHERE files_id = :files_id "; +// $stmt = $conn->prepare($sql_str); +// $stmt->bindParam(':files_id', $files_id); +// $stmt->execute(); +// $files= $stmt->fetchAll(PDO::FETCH_ASSOC); +// $files = json_encode($files); +$accounttype = "M"; +$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype"; +$stmt = $conn->prepare($sql_str); +$stmt->bindParam(":accounttype", $accounttype); +$stmt->execute(); +$persons = $stmt->fetchAll(PDO::FETCH_ASSOC); +$persons = array_map(function ($person) { + return [ + 'view' => $person['accountid'] . '-' . $person['name'], + 'value' => $person['accountid'], + 'name' => $person['name'] + ]; +}, $persons); +$contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"]; + + + +?> + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

合約管理(修理)

+
+

檢視合約

+
+ + +
立約人 + +

未填寫

+
維保人員 + +

未填寫

+
電梯編號 + +

未填寫

+
報價單編號 + +

未填寫

+
工程類別 + +

未填寫

+
簽訂時間 + +

未填寫

+
發票抬頭 + +

未填寫

+
統一編號 + +

未填寫

+
工程地址 + +

未填寫

+
工程進度 + +

未填寫

+
+ + +
+
+
+ + + + + + \ No newline at end of file diff --git a/wms/contract-repair/contract-repair-input.php b/wms/contract-repair/contract-repair-input.php new file mode 100644 index 00000000..525e7ab3 --- /dev/null +++ b/wms/contract-repair/contract-repair-input.php @@ -0,0 +1,185 @@ +prepare($sql_str); +$stmt->bindParam(':accounttype', $accounttype); +$stmt->execute(); +$workers = $stmt->fetchAll(PDO::FETCH_ASSOC); +$accounttype = "M"; +$sql_str = "SELECT id,accountid, name FROM account WHERE accounttype = :accounttype"; +$stmt = $conn->prepare($sql_str); +$stmt->bindParam(':accounttype', $accounttype); +$stmt->execute(); +$contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC); +$persons = array_map(function ($person) { + return [ + 'view' => $person['accountid'] . '-' . $person['name'], + 'value' => $person['accountid'], + 'name' => $person['name'] + ]; +}, $contractpersons); +$contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"]; + +?> + + + + + + +
+
+ +
+ + + + + + + + +
+

合約入力(修理)

+
+ + + + + +
+
+ +
+ + + + \ No newline at end of file diff --git a/wms/contract-repair/contract-repair-management.php b/wms/contract-repair/contract-repair-management.php new file mode 100644 index 00000000..8aed456e --- /dev/null +++ b/wms/contract-repair/contract-repair-management.php @@ -0,0 +1,131 @@ +prepare($sql_str); +$stmt->execute(); +$contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); +?> + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + $contract) : ?> + + + + + + + + + + + + + +
項次合約號客戶名稱統編總金額工程進度建檔者建立時間操作
+

+ + + + + + +

+
+
+
+ + + + + \ No newline at end of file diff --git a/wms/contract-repair/contract_maintance.php b/wms/contract-repair/contract_maintance.php new file mode 100644 index 00000000..5bcb7389 --- /dev/null +++ b/wms/contract-repair/contract_maintance.php @@ -0,0 +1,662 @@ +alert('非法訪問!!!');"; +// echo ""; +// exit; +// } +$id = $_GET["id"]; + +$sql_str = "SELECT contract_new_apply.*, account.name as review_person_name +FROM contract_new_apply +LEFT JOIN account ON contract_new_apply.review_person_id = account.accountid +WHERE contract_new_apply.mid = :mid"; +$stmt = $conn->prepare($sql_str); +$stmt->bindParam(':mid', $id); +$stmt->execute(); +$contract_new_apply = $stmt->fetch(PDO::FETCH_ASSOC); +$contract = $contract_new_apply; +$isFirst = empty($contract_new_apply) ? 1 : 0; +if (empty($contract_new_apply)) { + $sql_str = "SELECT pricereview_main.contractno, pricereview_main.ekind, pricereview_main.person, pricereview_main.company, pricereview_main.case_name, pricereview_main.address, pricereview_main.price_lowest, pricereview_main.price_total, pricereview_main.price_rate, pricereview_main.status as priceview_status, pricereview_main.id as mainid, account.name as accountname + FROM pricereview_main + JOIN account ON pricereview_main.person = account.accountid + WHERE pricereview_main.id = :id"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':id', $id); + $stmt->execute(); + $contract = $stmt->fetch(PDO::FETCH_ASSOC); + // print_r($contract); + $accounttype = "M"; + $sql_str = "SELECT * FROM account WHERE accounttype = :accounttype"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':accounttype', $accounttype); + $stmt->execute(); + $persons = $stmt->fetchAll(PDO::FETCH_ASSOC); + $sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':vol_no', $contract['contractno']); + $stmt->execute(); + $customer = $stmt->fetch(PDO::FETCH_ASSOC); + + $mid = $contract['mainid']; + + $sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A'"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->execute(); + $items = $stmt->fetchAll(PDO::FETCH_ASSOC); + $total_items = 0; + foreach ($items as $item) { + $total_items += $item['item_qty']; + } + $sql_str = "SELECT * FROM pricereview_pay WHERE mid = :mid ORDER BY pay_kind ASC"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->execute(); + $pays = $stmt->fetchAll(PDO::FETCH_ASSOC); + $price_a = 0; + $price_b = 0; + foreach ($pays as $pay) { + if ($pay['pay_kind'] <= 4) { + $price_a = $price_a + $pay['pay_amount']; + } else { + $price_b = $price_b + $pay['pay_amount']; + } + } +} else { + $mid = $contract['mid']; + $contract_new_apply_id = $contract_new_apply['id']; + $sql_str = "SELECT * FROM contract_new_apply_pays WHERE mid = :mid ORDER BY pay_kind ASC"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->execute(); + $pays = $stmt->fetchAll(PDO::FETCH_ASSOC); + + $sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A'"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->execute(); + $items = $stmt->fetchAll(PDO::FETCH_ASSOC); + $price_a = 0; + $price_b = 0; + foreach ($pays as $pay) { + if ($pay['pay_kind'] <= 4) { + $price_a = $price_a + $pay['pay_amount']; + } else { + $price_b = $price_b + $pay['pay_amount']; + } + } + + $sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contract_id', $id); + $stmt->execute(); + $files = $stmt->fetchAll(PDO::FETCH_ASSOC); + print_r($files); +} +$secondPayDeadline = $contract['secondPayDeadline'] ?? 0; +$status = isset($contract['status']) ? $contract['status'] : -1; +$person = $contract['person']; + +?> + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

合約書申請(新梯)

+
+

業務確認項

+
+ + +
卷號 +
+ + +
統一編號 + +

未填寫

+
合約書申請日期 + +

未填寫

+
申請類別 + +

未填寫

+
案件名稱 + +

未填寫

+
立約人 + +

未填寫

+
負責人 + +

未填寫

+
含稅給約總價 + +

未填寫

+
含稅貸款(A) + +

未填寫

+
含稅安裝款(A) + +

未填寫

+
聯絡地址 + +

未填寫

+
完工期限 +
+
+ 貨抵工地 +
+ +
+ 天內安裝完成,甲方應於貨底工地前 +
+ +
+ 天完成並整理完善。 +
+
+ +

未填寫

+
附則 +
+
+ 乙方應於 +
+ +
+ 天內試車完成 +
+
+

未填寫

+
免保期限 +
+ +
+ 個月 +
+
+

未填寫

+
交貨地點 + +

未填寫

+
交貨期限 +
+
+ 圖色確認第 +
+ +
+ 天出貨 +
+
+

未填寫

+
+ + + + + + + + + + + + + + + + + +
+

項次

+
+

規格

+
+

數量

+
+

金額

+
電梯總數
+ + + + + + + + + + + + + + + + "訂金", + 2 => "二次款", + 3 => "貨到款", + 4 => "", + 5 => "安裝款", + 6 => "尾款", + 7 => "", + ]; + $paydate = [ + 1 => "合約日", + 2 => "合約日", + 3 => "出貨日", + 4 => "", + 5 => "竣檢日", + 6 => "交車日", + 7 => "" + ]; + ?> + + + + + + + + + + + + + +
+

合約類別

+
+

款別

+
+

條件名稱

+
+

收款條件日期區分

+
+

條件日期

+
+

票期

+
+

付款比率

+
+

金額

+
+

+
+

+
+ + + + + + + +

貨抵工地付貨到款

+ + + + + + + +

-

+ +
+

+
+
+ +
+ 天 +
+
+
+
+ +
+ 天 +
+
+
+

%

+
+

+
+ + + + + + + + + + + + + + +
+

附件上傳

+
附件上傳 + + + + + X
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

簽核流程

+
審核審核人結果意見時間審核意見
營業員 + = 1) : ?>已送審 + 暫存 + 未提交 + --- + + + +
業務承辦人 + 結案同意 + 結案不同意 + --- +
+ + + + + + + + + +
+
+
+ + + + + + + + + + + + + 0 || ($person != $user_id && $user_id != "M0174")) : ?> + + + \ No newline at end of file diff --git a/wms/contract-repair/js/alpine.js b/wms/contract-repair/js/alpine.js new file mode 100644 index 00000000..06d5dc7b --- /dev/null +++ b/wms/contract-repair/js/alpine.js @@ -0,0 +1,842 @@ +const contractDownload = () => { + return { + init() { + this.standarDate = this.deepClone(this.data); + this.onstandarViewData = this.deepClone(this.data); + this.buystandarData = this.deepClone(this.buydata); + this.buyonstandardViewData = this.deepClone(this.buydata); + }, + css: `table { background - color: #fff; border: none; margin - top: 30px; font - family: '標楷體'; width: 600px; } table tr: nth - child(even), table tr: nth - child(odd) { background - color: #fff; } table tr { font - size: 12pt; width: 100 %; } table tr h2 { font - size: 18pt; } table tr td { width: 100 %; height: 100 %; line - height: 2; display: flex; } table tr td.center { display: flex; justify - content: center; align - items: center; } table tr td.list { width: 100 %; height: 100 %; white - space: nowrap; display: flex; } table tr td.list span { width: 60px; min - height: 100 %; display: block; } table tr td.list > p { display: block; text - align: justify; } table tr td.list div { max - width: calc(100 % - 60px); white - space: normal; } table tr td.list div.text - justify { display: flex; width: 100 %; justify - content: space - between; } table tr.date td > div { width: 100 %; text - align: right; } table tr.date td > div.text - justify { display: flex; justify - content: space - between; } table td, table th { padding: 8px; }`, + data: { + illustrate: { + editshow: false, + plaintext: '茲因甲乙雙方就電梯設備保養.檢修事宜,同意訂定本契約,議定條款如后,並相互遵守條款約定。', + }, + partyA: { + editshow: false, + plaintext: partyAcompany, + }, + partyAcontractno: { + editshow: false, + plaintext: partyAcontractno, + }, + list: { + plaintext: [ + { + editshow: false, + origin: true, + text: ``, + deleted: false, + id: 0, + input_id: null + }, + { + editshow: false, + origin: true, + text: `規格`, + type: 'title', + deleted: false, + id: 1, + input_id: null + }, + { + editshow: false + } + ] + } + }, + buydata: { + + }, + exportFn(type) { + const form = this.$refs.form; + const prviewType = this.$refs.form.querySelector('#prview-type'); + const list = this.$refs.form.querySelector('#privew-list'); + const standardList = this.$refs.form.querySelector('#standard-prview-list'); + const illustrate = this.$refs.form.querySelector('illustrate'); + const standardIllustrate = this.$refs.form.querySelector('#standard-illustrate'); + const partyA = this.$refs.form.querySelector('#partyA'); + const partyAcontractno = this.$refs.form.querySelector('#partyAcontractno'); + const total_price = this.$refs.form.querySelector('#total_price'); + prviewType.value = type; + if (type === 1) { + const standarJsonText = this.buystandarDate.list.plaintext.map((item, idx) => { + let text = ''; + text = item.text.replace(/\s+/g, ""); + this.buydata.list.plaintext[idx].text = this.buydata.list.plaintext[idx].text.replace(/\s+/g, ""); + + return { + text: text, + id: item.id + } + }); + + const jsonText = this.buydata.list.plaintext.map(item => { + let text = ''; + text = item.text; + return { + text: text, + origin: item.origin ? 1 : 0, + deleted: item.deleted ? 1 : 0, + id: item.id, + updated: item.updated ? 1 : 0 + } + }); + list.value = JSON.stringify(jsonText); + standardList.value = JSON.stringify(standarJsonText); + illustrate.value = this.buydata.illustrate.plaintext; + standardIllustrate.value = this.buyonstandardViewData.illustrate.plaintext; + partyA.value = this.buydata.partyA.plaintext; + partyAcontractno.value = this.buydata.partyAcontractno.plaintext; + total_price.value = totalBuyPrice; + form.submit(); + return; + } + + if (type === 2) { + const standardJsonText = this.standarData.list.plaintext.map((item, idx) => { + let text = ''; + text = item.text.replace(/\s+/g, ""); + if (this.data.list.plaintext[idx] !== undefined) { + this.data.list.plaintext[idx].text = this.data.list.plaintext[idx].text.replace(/\s+/g, ""); + } + return { + text: text, + id: item.id + } + }) + const jsonText = this.data.list.plaintext.map(item => { + let text = ''; + item.text; + text = item.text; + return { + text: text, + origin: item.origin ? 1 : 0, + deleted: item.deleted ? 1 : 0, + id: item.id, + updated: item.updated ? 1 : 0 + } + }) + list.value = JSON.stringify(jsonText); + standardList.value = JSON.stringify(standarJsonText); + illustrate.value = this.data.illustrate.plaintext; + standardIllustrate.value = this.standardData.illustrate.plaintext; + partyA.value = this.data.partyA.plaintext; + partyAcontractno.value = this.data.partyAcontractno.plaintext; + total_price.value = totalInstallPrice; + form.submit(); + + return; + } + + } + + } +}; + +const contractNewInput = () => { + return { + init() { }, + data: { + contractno: '', + customer: '', + manager: '', + vat: '', + case_name: '', + linkman: '', + lm_tel: '', + address: '', + salesman: '', + qc: '', + qc: '', + // files:[], + }, + step: 1, + isLoading: false, + customize: false, + nextStepFn() { + if (this.data.contractno == '') return alert('合約號為必填') + this.isLoading = true + if (this.step == 1) { + this.getContractDate(); + } + }, + nextStepKeyupFn(e) { + if (e.keyCode != 13) return + if (this.step == 1) { + this.getContractDate(); + console.log(this.step); + } + }, + preStepFn() { + if (this.step == 2) { + this.step = 1 + } + }, + getContractDate() { + axios.get('./api/getContractData.php?contracttype=m&contractno=' + this.data.contractno).then(res => { + if (!res.data) { + this.step = 2 + this.isLoading = false + return + } + if (!this.customize) { + console.log(res.data); + this.data.customer = res.data.customer + this.data.manager = res.data.manager + this.data.vat = res.data.uscc + this.data.case_name = res.data.case_name + this.data.linkman = res.data.linkman + this.data.lm_tel = res.data.lm_tel + this.data.address = res.data.address + this.data.salesman = res.data.salesman + this.data.qc = res.data.qc + } + this.step = 2 + this.isLoading = false + }).catch(err => { + console.error(err) + this.isLoading = false + }) + }, + save() { + this.isLoading = true + const form = new FormData(); + form.append('contractno', this.data.contractno); + form.append('customer', this.data.customer); + form.append('manager', this.data.manager); + form.append('vat', this.data.vat); + form.append('case_name', this.data.case_name); + form.append('linkman', this.data.linkman); + form.append('lm_tel', this.data.lm_tel); + form.append('address', this.data.address); + form.append('salesman', this.data.salesman); + form.append('qc', this.data.qc); + form.append('contracttype', 'm'); + form.append('user_id', user_id); + for (var i = 0; i < this.data.files.length; i++) { + form.append('files[]', this.data.files[i]); + } + axios.post('./api/postNewContractData.php', form).then(res => { + console.log(res); + if (res.status === 201) { + alert('儲存成功'); + this.step = 1 + this.data.contractno = '' + this.data.customer = '' + this.data.manager = '' + this.data.vat = '' + this.data.case_name = '' + this.data.linkman = '' + this.data.lm_tel = '' + this.data.address = '' + this.data.salesman = '' + this.data.qc = '' + this.data.files = [] + this.customize = false + + } else { + alert('儲存失敗!可能為以下錯誤:\n' + res.data) + } + this.isLoading = false + }).catch(error => { + let code = error.response.status; + if (code == 422) { + this.fail_arr = error.response.data + this.errorFn(); + } + if (code == 500) { + alert('儲存失敗!可能為以下錯誤:\n' + error.response.data) + } + + this.isLoading = false + }) + }, + errorFn() { + let msg = '' + for (let i = 0; i < this.fail_arr.length; i++) { + msg += this.fail_arr[i] + '、' + } + alert(msg) + }, + uploadFiles(e) { + this.data.files = e.target.files + }, + } +}; + +////////////////////////////// +//// 合約簽回(修理) +//// +//// 製作人:梓誠 +/// 時間 : +////////////////////////////// +const contractRepair = () => { + return { + init() { }, + data: { + contractno: '', + company: '', + repairer: '', + repaireid: '', + facilityno: '', + taxid: '', + invoice: '', //發票抬頭 + type: '', //工程類別需新增,用 post + address: '', + repair_no: '', + total_price: '', + sign_date: '', + contract_status: '' + }, + step: 1, + isLoading: false, + customize: false, + + + nextStepFn() { + if (this.data.contractno == '') return alert('合約號為必填') + this.isLoading = true + if (this.step == 1) { + this.getContractDate(); + } + }, + nextStepKeyupFn(e) { + if (e.keyCode != 13) return + if (this.step == 1) { + this.getContractDate(); + console.log(this.step); + } + }, + // 抓資料 + getContractDate() { + axios.get('./api/getContractData.php?contracttype=r&repair_no=' + this.data.repair_no).then(res => { + if (!res.data) { + this.step = 2; + this.isLoading = false; + // console.log(123); + return + } + if (!this.customize) { + // console.log(res.data); + this.data.contractno = res.data.contractno; + this.data.company = res.data.company; + this.data.repairer = res.data.name; + this.data.facilityno = res.data.facilityno; + this.data.taxid = res.data.taxid; + this.data.invoice = res.data.invoice; + this.data.address = res.data.address; + this.data.repair_no = res.data.repair_no; + this.data.total_price = res.data.total_price; + this.data.repaireid = res.data.repairerid; + this.data.sign_date = res.data.sign_date; + this.data.contract_status = res.data.contract_status; + } + this.step = 2; + this.isLoading = false; + // console.log(user_name); + // console.log(this.data.sign_date); + }).catch(err => { + console.log(err); + alert(err.response.data); + this.isLoading = false + }) + }, + preStepFn() { + if (this.step == 2) { + if (confirm('回到上一頁會初始化資料,確定要返回嗎?')) { + this.step = 1; + this.data.contractno = ''; + this.data.company = ''; + this.data.repairer = ''; + this.data.facilityno = ''; + this.data.taxid = ''; + this.data.invoice = ''; + this.data.address = ''; + this.data.repair_no = ''; + this.data.total_price = ''; + this.data.repaireid = ''; + this.data.sign_date = ''; + this.data.contract_status = ''; + + return; + } + } + }, + save() { + this.isLoading = true; + const form = new FormData(); + form.append('contractno', this.data.contractno); + form.append('company', this.data.company); + form.append('repairid', this.data.repaireid); + form.append('facilityno', this.data.facilityno); + form.append('taxid', this.data.taxid); + form.append('invoice', this.data.invoice); + form.append('address', this.data.address); + form.append('repair_no', this.data.repair_no); + form.append('total_price', this.data.total_price); + form.append('sign_date', this.data.sign_date); + form.append('contract_status', this.data.contract_status); + form.append('contracttype', 'r'); + form.append('user_id', user_id); + form.append('type', this.data.type); + axios.post('./api/postContractData.php', form).then(res => { + console.log(res.status); + if (res.status === 200) { + alert('儲存成功'); + this.step = 1; + this.data.contractno = ''; + this.data.company = ''; + this.data.repaireid = ''; + this.data.facilityno = ''; + this.data.repairer = ''; + this.data.taxid = ''; + this.data.invoice = ''; + this.data.address = ''; + this.data.repair_no = ''; + this.data.total_price = ''; + this.data.user_id = ''; + this.data.type = ''; + this.data.sign_date = ''; + this.data.contract_status = ''; + } + this.isLoading = false; + }).catch(error => { + let code = error.response.status; + if (code == 422) { + this.fail_arr = error.response.data; + this.errorFn(); + console.log(error.response.data); + } + if (code == 500) { + alert('儲存失敗!可能為以下錯誤:\n' + error.response.data); + } + + this.isLoading = false; + }) + }, + errorFn() { + let msg = ''; + for (let i = 0; i < this.fail_arr.length; i++) { + msg += this.fail_arr[i] + '、'; + } + alert(msg); + }, + uploadFiles(e) { + this.data.files = e.target.files; + } + + } +}; + +const contractInput = () => { + return { + init() { + $('.contract-input-component .form .dropdown').dropdown(); + + axios.get('./twzip.json').then(res => { + this.cities = res.data.cities + }) + }, + cities: [], + data: { + contractno: 'B23100060', + total_price: '', //合約總價 + vat: '', //統一編號 + mtype: 'A', //維修型態 + phone: '', //客戶電話 + email: '', //Email + mworker: '', //保養員 + mcycle: '', //保養頻率 + salesman: '', //營業員 + contract_begin_date: '', //合約開始時間 + contract_end_date: '', //合約終止時間 + area: '', //區域 + zip: '', //郵遞區號 + address: '', //地址 + customer: '', //立約人 + partyA: '', //業務聯繫人 + partyAaddress: '', //業務聯繫人地址 + partyAphone: '', //業務聯繫人電話 + partyAemail: '', //業務聯繫人email + files: [], //附件檔案 + num: '', //電梯數量 + disabled: false, //資料庫是否有電梯數量資料 + elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期 + }, + customize: false, + step: 1, + isLoading: false, + fail_arr: [], + nextStepFn() { + if (this.step == 1) { + if (this.data.repair_no == '') return alert('請輸入合約號'); + this.isLoading = true + this.getContractDate(); + } else if (this.step == 2) { + if (this.data.num <= 0) return alert('請填寫電梯數量!') + if (!this.data.disabled) { + this.createElevator(); + } + this.step = 3 + } + }, + nextStepKeyupFn(e) { + if (e.keyCode !== 13) return + if (this.step == 1) { + if (this.data.repair_no == '') return alert('請輸入合約號'); + this.isLoading = true + this.getContractDate(); + + } else if (this.step == 2) { + this.step = 3 + } + }, + createElevator() { + for (let i = 0; i < this.data.num; i++) { + this.data.elevators.push({ + spec: '', //規格 + weight: '', //載重 + speed: '', //速度 + persons: '', //人乘 + stop: '', //樓停 + floors: '', //樓層 + latitude: '', //緯度 + longitude: '', //經度 + elevator_brand: '', //廠牌 + opendoor: '', //開門方式 + maintainance: '', //保養別 + takecertificatedate: '', //竣檢日 + useful_date: '', //許可證有效日期 + }) + } + }, + getContractDate() { + axios.get('./api/getContractData.php?contracttype=b&contractno=' + this.data.contractno).then(res => { + if (!res.data) { + this.step = 2 + this.isLoading = false + return + } + if (!this.customize) { + console.log(res.data); + this.data.total_price = res.data.sold_price + this.data.salesman = res.data.salesman + this.data.contract_begin_date = res.data.contract_begin_date + this.data.contract_end_date = res.data.contract_end_date + this.data.address = res.data.address + this.data.customer = res.data.customer + this.data.partyA = res.data.customer + this.data.partyAaddress = res.data.address + this.data.num = res.data.num + this.data.disabled = (res.data.num > 0) ? true : false; + this.data.elevators = res.data.elevators + let cityIndex = this.data.address.indexOf('市'); + console.log(cityIndex); + if (cityIndex == -1) { + cityIndex = this.data.address.indexOf('縣'); + } + if (cityIndex > 1) { + // 獲取''市''前面的兩個字 + let city = this.data.address.substring(cityIndex - 2, cityIndex + 1); + this.data.area = city; + } else { + this.data.area = '' + } + } + this.step = 2 + this.isLoading = false + }).catch(err => { + console.error(err) + this.isLoading = false + }) + }, + preStepFn() { + if (this.step == 2) { + if (confirm('回到上一頁會將會初始化資料,確定返回嗎?')) { + this.step = 1 + this.data.total_price = '' + this.data.salesman = '' + this.data.contract_begin_date = '' + this.data.contract_end_date = '' + this.data.address = '' + this.data.customer = '' + this.data.partyA = '' + this.data.partyAaddress = '' + this.step = 1 + this.data.num = '' + this.data.disabled = false + this.data.elevators = [] + this.data.files = [] + this.data.vat = '' + this.data.mtype = '' + this.data.phone = '' + this.data.email = '' + this.data.mworker = '' + this.data.mcycle = '' + this.data.area = '' + this.data.zip = '' + this.data.partyAphone = '' + this.data.partyAemail = '' + return; + } + } else if (this.step == 3) { + this.step = 2 + } + }, + save() { + this.isLoading = true + const form = new FormData(); + form.append('contractno', this.data.contractno); + form.append('total_price', this.data.total_price); + form.append('vat', this.data.vat); + form.append('mtype', this.data.mtype); + form.append('phone', this.data.phone); + form.append('email', this.data.email); + form.append('mworker', this.data.mworker); + form.append('mcycle', this.data.mcycle); + form.append('salesman', this.data.salesman); + form.append('contract_begin_date', this.data.contract_begin_date); + form.append('contract_end_date', this.data.contract_end_date); + form.append('address', this.data.address); + form.append('area', this.data.area); + form.append('customer', this.data.customer); + form.append('partyA', this.data.partyA); + form.append('partyAaddress', this.data.partyAaddress); + form.append('partyAphone', this.data.partyAphone); + form.append('partyAemail', this.data.partyAemail); + form.append('user_id', user_id); + form.append('user_name', user_name); + form.append('num', this.data.num); + form.append('elevators', JSON.stringify(this.data.elevators)); + form.append('contracttype', 'b'); + + // 如果有附件檔案,可以逐一加入 + for (var i = 0; i < this.data.files.length; i++) { + form.append('files[]', this.data.files[i]); + } + axios.post('./api/postContractData.php', form).then(res => { + console.log(res.status); + if (res.status === 200) { + alert('儲存成功'); + this.step = 1 + this.data.total_price = '' + this.data.salesman = '' + this.data.contract_begin_date = '' + this.data.contract_end_date = '' + this.data.address = '' + this.data.customer = '' + this.data.partyA = '' + this.data.partyAaddress = '' + this.step = 1 + this.data.num = '' + this.data.disabled = false + this.data.elevators = [] + this.data.files = [] + this.data.vat = '' + this.data.mtype = '' + this.data.phone = '' + this.data.email = '' + this.data.mworker = '' + this.data.mcycle = '' + this.data.area = '' + this.data.zip = '' + this.data.partyAphone = '' + this.data.partyAemail = '' + } + this.isLoading = false + }).catch(error => { + let code = error.response.status; + if (code == 422) { + this.fail_arr = error.response.data + this.errorFn(); + } + if (code == 500) { + alert('儲存失敗!可能為以下錯誤:\n' + error.response.data) + } + + this.isLoading = false + }) + }, + errorFn() { + let msg = '' + for (let i = 0; i < this.fail_arr.length; i++) { + msg += this.fail_arr[i] + '、' + } + alert(msg) + }, + uploadFiles(e) { + this.data.files = e.target.files + }, + } +}; + +const contractNewApply = () => { + return { + step: 1, + isLoading: false, + data: { + mid: mid, + vol_no: contractno, + salesman: salesman, + salesmanname: salesmanname, + apply_date: apply_date, + apply_type: 'A', + case_name: case_name, + company: company, + manager: manager, + vat: vat, + total_price: price_total, + price_a: price_a, + price_b: price_b, + address: address, + workdeadline_a: 30, //完工期限: 幾天內安裝完成,預設30 + workdeadline_b: 7, //完工期限: 幾天內整理完善,預設7 + regulations: 10, //附則 + freedeadline: 18, //免保期限(月) + tradeaddress: '', //交貨地點 + tradedeadline: 90, //交貨期限 + items: items, + }, + pays: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + 6: 0, + 7: 0, + }, + tickets: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + 6: 0, + 7: 0, + }, + localnumber(num) { + return num.toLocaleString(); + }, + storageFn() { + this.isLoading = true + const isFirst = 1; + const form = new FormData(); + form.append('mid', this.data.mid); + form.append('vol_no', this.data.vol_no); + form.append('salesman', this.data.salesman); + form.append('apply_date', this.data.apply_date); + form.append('apply_type', this.data.apply_type); + form.append('case_name', this.data.case_name); + form.append('company', this.data.company); + form.append('manager', this.data.manager); + form.append('vat', this.data.vat); + form.append('total_price', this.data.total_price); + form.append('price_a', this.data.price_a); + form.append('price_b', this.data.price_b); + form.append('address', this.data.address); + form.append('workdeadline_a', this.data.workdeadline_a); + form.append('workdeadline_b', this.data.workdeadline_b); + form.append('regulations', this.data.regulations); + form.append('freedeadline', this.data.freedeadline); + form.append('tradeaddress', this.data.tradeaddress); + form.append('tradedeadline', this.data.tradedeadline); + form.append('isFirst', isFirst); + form.append('user_id', user_id); + axios.post('./api/postContractNewApplyData.php', form).then(res => { + if (res.status === 200) { + alert('暫存成功'); + console.log(res.data); + } + this.isLoading = false + }).catch(error => { + alert('儲存失敗!可能為以下錯誤:\n' + error.response.data) + this.isLoading = false + }) + } + } +} + +const contract_edit = () => { + console.log(contract_status); + return { + isLoading: false, + data: { + id: id, + repair_no: repair_no, + contractno: contractno, + company: company, + taxid: taxid, + facilityno: facilityno, + address: address, + type: type, + invoice: invoice, + repaireid: repaireid, + total_price: total_price, + sign_date: sign_date, + user_id: user_id, + contract_status: contract_status + + }, + fail_arr: [], + deleteFileFn(id) { + if (!confirm("確定要刪除嗎?")) return + this.data.files = this.data.files.filter(file => id != file.id) + this.data.deletefiles.push(id) + console.log(this.data.deletefiles); + }, + save() { + this.isLoading = true + const form = new FormData(); + form.append("id", this.data.id); + form.append("repair_no", this.data.repair_no); + form.append("contractno", this.data.contractno); + form.append("company", this.data.company); + form.append("taxid", this.data.taxid); + form.append("facilityno", this.data.facilityno); + form.append("address", this.data.address); + form.append("type", this.data.type); + form.append("invoice", this.data.invoice); + form.append("repaireid", this.data.repaireid); + form.append("total_price", this.data.total_price); + form.append("sign_date", this.data.sign_date); + form.append("user_id", user_id); + form.append("contract_status", this.data.contract_status); + form.append('contracttype', 'r'); + + axios.post("./api/putContractData.php", form).then(res => { + console.log(res); + if (res.status === 200) { + alert("更新成功"); + window.location.reload(); + } + this.isLoading = false + }).catch(error => { + console.log(this.data); + console.log(error); + let code = error.response.status; + if (code == 422) { + this.fail_arr = error.response.data + this.errorFn() + } + if (code == 500) { + alert("更新失敗!可能為以下錯誤:\n" + error.response.data) + } + this.isLoading = false + }) + + }, + uploadFiles(e) { + this.data.newfiles = e.target.files + }, + errorFn() { + let msg = "" + for (let i = 0; i < this.fail_arr.length; i++) { + msg += this.fail_arr[i] + "、" + } + alert(msg) + } + } + +} \ No newline at end of file diff --git a/wms/contract-repair/js/alpinejs/cdn.min.js b/wms/contract-repair/js/alpinejs/cdn.min.js new file mode 100644 index 00000000..922cc02e --- /dev/null +++ b/wms/contract-repair/js/alpinejs/cdn.min.js @@ -0,0 +1,5 @@ +(()=>{var Ze=!1,Qe=!1,H=[],et=-1;function zt(e){En(e)}function En(e){H.includes(e)||H.push(e),vn()}function we(e){let t=H.indexOf(e);t!==-1&&t>et&&H.splice(t,1)}function vn(){!Qe&&!Ze&&(Ze=!0,queueMicrotask(Sn))}function Sn(){Ze=!1,Qe=!0;for(let e=0;ee.effect(t,{scheduler:r=>{tt?zt(r):r()}}),rt=e.raw}function nt(e){I=e}function qt(e){let t=()=>{};return[n=>{let i=I(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),L(i))},i},()=>{t()}]}function q(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function O(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>O(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)O(n,t,!1),n=n.nextElementSibling}function v(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Ut=!1;function Wt(){Ut&&v("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Ut=!0,document.body||v("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `"; + } + $sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL"; + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contract_id', $contract_id); + $stmt->execute(); + $files = $stmt->fetchAll(PDO::FETCH_ASSOC); + function numberToChinese($num) + { + $chineseNumbers = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十']; + $units = ['', '十', '百', '千', '万']; + + if ($num <= 10) { + return $chineseNumbers[$num]; + } elseif ($num < 20) { + return $units[1] . $chineseNumbers[$num % 10]; + } elseif ($num < 100) { + return $chineseNumbers[intval($num / 10)] . $units[1] . ($num % 10 > 0 ? $chineseNumbers[$num % 10] : ''); + } else { + // 處理大於 99 的数字 + $result = ''; + $strNum = strval($num); + $length = strlen($strNum); + for ($i = 0; $i < $length; $i++) { + $currentDigit = intval($strNum[$i]); + if ($currentDigit > 0) { + $result .= $chineseNumbers[$currentDigit] . $units[$length - $i - 1]; + } else { + $result .= $chineseNumbers[$currentDigit]; + } + } + return $result; + } + } + function removeTrailingBr($string) + { + //刪除字串尾巴的

+ return preg_replace('/()+$/', '', $string); + } + +?> + + + + + + + + + +
') + form.append('party_a', '') + form.append('total_price', ) + form.append('accound_id', '') + form.append('times', 1) + form.append('random', this.random) + form.append('hash', newtoken) + form.append('url', formattedDate+'.pdf' ); + form.append('created_by', '') + form.append('delivery_term', '') + form.append('install_period', '') + form.append('free_maintainance', '') + axiosClient({ + method:'post', + url:'./store-contract.php', + data:form + }).then(res=>{ + console.log(res); + }) + }, + }"> + + + + + +
+
+ 修改的條列 +
+ 新增的條列 +
+ 刪除的條列 +
+ +
+

+

合約書編號:

+ + + + + + +
(即買方,以下簡稱為甲方)
+

立合約書人

+ + + + + + +
永佳捷科技股份有限公司(即賣方,以下簡稱為乙方)
+

+ + $item) { + ?> + + + + + +
+
+ + +
+
+

+

合約書編號:

+ + + + + + +
(即買方,以下簡稱為甲方)
+

立合約書人

+ + + + + + +
永佳捷科技股份有限公司(即賣方,以下簡稱為乙方)
+

+ + $item) { + ?> + + + + + +
+
+ +
+

+

合約書編號:

+ + + + + + +
(即買方,以下簡稱為甲方)
+

立合約書人

+ + + + + + +
永佳捷科技股份有限公司(即賣方,以下簡稱為乙方)
+ +

+ + $item) { + ?> + + + + + + + + 15) { ?> + + + + + + +
+
+ +
+ +
+

升降設備除外工程表

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
一、機械室之建造,含預留出入口、通風照明、自動閉鎖裝置,及天花板上之保養用吊鉤。
二、通往機械室之樓梯及加護欄杆工程。
三、機械室基礎台需用防濕之瀝青鐵筋混凝土及地板防塵工事。
四、機械室及升降路中間之橫樑或工字樑之安裝工程。
五、自屋外至機械室之動力及照明用配線電源開關插座,及接地線等電路工程。
六、升降路及機械室以外監視盤、電鈴、電話之配管與配線工程。
七、升降路之建造及底部之防水工程及緩衝器水泥台工程。
八、機坑照明保養用之開關及插座,鐵爬梯。
九、各樓按鈕開關之留洞工程及安裝後之固定與週邊裝飾工程。
十、升降路內甲方不得裝設有任何與升降設備無關之配線、電線配管、水管、風管等設備。
十一、安裝所需水泥、砂石、水電與供試車用動力電源。
十二、升降路及機房之建造,電源設備之容量及位置等,需符合國家標準(CNS-2866)及建築法規等規定。
十三、機械運抵工地後供給儲存倉庫。
備註:CNS-2866國家標準建築物電梯有關之法規:
1.機械室內應設有照明及通風設備,以利管理檢查,照明應在100LUX(米一燭光)以上,通風設備應能使室內溫度保持在攝氏40度以下。
2.機械室之出入口應加鎖,其裝置應良好。
3.由機械室至走廊,樓梯間應便於通行,樓梯應加裝扶手,其與水平面之傾斜角度,應不超過60度。
4.機械室出入門之構造,應有下述裝置:
+ A:能自動關閉者。
+ B:有彈簧鎖或其類似裝置,以便室內不用鎖匙,而能開門。
+ C:除屋頂開口部份以外,機械式牆壁,應能耐火。(二小時防火時效) +
5.升降路內不得設置與升降機無關之配管及配線。
6.任一升降路下部之任何部份,供人使用或類似使用時配重側比照車廂,同樣必須裝設緊急安全裝置。
7.若有火警受信總機時,甲方需提供"火警受信總機"檢出信號及通往升降道內之配管配線(0.75MM² × 3)
+
+
+ + + +alert('非法訪問!');window.history.back();"; +} +?> \ No newline at end of file diff --git a/wms/contract-repair/semantic/.browserlistrc b/wms/contract-repair/semantic/.browserlistrc new file mode 100644 index 00000000..ef556a3a --- /dev/null +++ b/wms/contract-repair/semantic/.browserlistrc @@ -0,0 +1,5 @@ +last 2 versions +> 1% +opera 12.1 +bb 10 +android 4 diff --git a/wms/contract-repair/semantic/.csscomb.json b/wms/contract-repair/semantic/.csscomb.json new file mode 100644 index 00000000..86db5608 --- /dev/null +++ b/wms/contract-repair/semantic/.csscomb.json @@ -0,0 +1,322 @@ +{ + "remove-empty-rulesets": true, + "always-semicolon": true, + "color-case": "upper", + "block-indent": " ", + "color-shorthand": false, + "element-case": "lower", + "leading-zero": true, + "space-after-colon": " ", + "space-before-combinator": " ", + "space-after-combinator": " ", + "space-between-declarations": "\n", + "space-before-opening-brace": " ", + "space-after-opening-brace": "\n", + "space-after-selector-delimiter": "\n", + "space-before-selector-delimiter": "", + "space-before-closing-brace": "\n", + "strip-spaces": true, + "tab-size": true, + "vendor-prefix-align": true, + "sort-order": [ + [ + "display", + "visibility", + "float", + "clear", + "overflow", + "overflow-x", + "overflow-y", + "-webkit-box-sizing", + "-moz-box-sizing", + "box-sizing", + "-ms-overflow-x", + "-ms-overflow-y", + "clip", + "zoom", + "flex-direction", + "flex-order", + "flex-pack", + "flex-align" + ], + [ + "position", + "z-index", + "top", + "right", + "bottom", + "left" + ], + [ + "font", + "font-family", + "font-size", + "font-weight", + "font-style", + "font-variant", + "font-size-adjust", + "font-stretch", + "font-effect", + "font-emphasize", + "font-emphasize-position", + "font-emphasize-style", + "font-smooth", + "line-height" + ], + [ + "width", + "min-width", + "max-width", + "height", + "min-height", + "max-height", + "margin", + "margin-top", + "margin-right", + "margin-bottom", + "margin-left", + "padding", + "padding-top", + "padding-right", + "padding-bottom", + "padding-left" + ], + [ + "table-layout", + "empty-cells", + "caption-side", + "border-spacing", + "border-collapse", + "list-style", + "list-style-position", + "list-style-type", + "list-style-image" + ], + [ + "opacity", + "filter:progid:DXImageTransform.Microsoft.Alpha(Opacity", + "-ms-filter:\\'progid:DXImageTransform.Microsoft.Alpha", + "-ms-interpolation-mode", + "color", + "border", + "border-width", + "border-style", + "border-color", + "border-top", + "border-top-width", + "border-top-style", + "border-top-color", + "border-right", + "border-right-width", + "border-right-style", + "border-right-color", + "border-bottom", + "border-bottom-width", + "border-bottom-style", + "border-bottom-color", + "border-left", + "border-left-width", + "border-left-style", + "border-left-color", + "-webkit-border-radius", + "-moz-border-radius", + "border-radius", + "-webkit-border-top-left-radius", + "-moz-border-radius-topleft", + "border-top-left-radius", + "-webkit-border-top-right-radius", + "-moz-border-radius-topright", + "border-top-right-radius", + "-webkit-border-bottom-right-radius", + "-moz-border-radius-bottomright", + "border-bottom-right-radius", + "-webkit-border-bottom-left-radius", + "-moz-border-radius-bottomleft", + "border-bottom-left-radius", + "-webkit-border-image", + "-moz-border-image", + "-o-border-image", + "border-image", + "-webkit-border-image-source", + "-moz-border-image-source", + "-o-border-image-source", + "border-image-source", + "-webkit-border-image-slice", + "-moz-border-image-slice", + "-o-border-image-slice", + "border-image-slice", + "-webkit-border-image-width", + "-moz-border-image-width", + "-o-border-image-width", + "border-image-width", + "-webkit-border-image-outset", + "-moz-border-image-outset", + "-o-border-image-outset", + "border-image-outset", + "-webkit-border-image-repeat", + "-moz-border-image-repeat", + "-o-border-image-repeat", + "border-image-repeat", + "outline", + "outline-width", + "outline-style", + "outline-color", + "outline-offset", + "background", + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader", + "background-color", + "background-image", + "background-repeat", + "background-attachment", + "background-position", + "background-position-x", + "-ms-background-position-x", + "background-position-y", + "-ms-background-position-y", + "-webkit-background-clip", + "-moz-background-clip", + "background-clip", + "background-origin", + "-webkit-background-size", + "-moz-background-size", + "-o-background-size", + "background-size", + "box-decoration-break", + "-webkit-box-shadow", + "-moz-box-shadow", + "box-shadow", + "filter:progid:DXImageTransform.Microsoft.gradient", + "-ms-filter:\\'progid:DXImageTransform.Microsoft.gradient", + "text-shadow" + ], + + [ + "content", + "quotes", + "counter-reset", + "counter-increment", + "resize", + "cursor", + "-webkit-user-select", + "-moz-user-select", + "-ms-user-select", + "user-select", + "nav-index", + "nav-up", + "nav-right", + "nav-down", + "nav-left", + "-webkit-transition", + "-moz-transition", + "-ms-transition", + "-o-transition", + "transition", + "-webkit-transition-delay", + "-moz-transition-delay", + "-ms-transition-delay", + "-o-transition-delay", + "transition-delay", + "-webkit-transition-timing-function", + "-moz-transition-timing-function", + "-ms-transition-timing-function", + "-o-transition-timing-function", + "transition-timing-function", + "-webkit-transition-duration", + "-moz-transition-duration", + "-ms-transition-duration", + "-o-transition-duration", + "transition-duration", + "-webkit-transition-property", + "-moz-transition-property", + "-ms-transition-property", + "-o-transition-property", + "transition-property", + "-webkit-transform", + "-moz-transform", + "-ms-transform", + "-o-transform", + "transform", + "-webkit-transform-origin", + "-moz-transform-origin", + "-ms-transform-origin", + "-o-transform-origin", + "transform-origin", + "-webkit-animation", + "-moz-animation", + "-ms-animation", + "-o-animation", + "animation", + "-webkit-animation-name", + "-moz-animation-name", + "-ms-animation-name", + "-o-animation-name", + "animation-name", + "-webkit-animation-duration", + "-moz-animation-duration", + "-ms-animation-duration", + "-o-animation-duration", + "animation-duration", + "-webkit-animation-play-state", + "-moz-animation-play-state", + "-ms-animation-play-state", + "-o-animation-play-state", + "animation-play-state", + "-webkit-animation-timing-function", + "-moz-animation-timing-function", + "-ms-animation-timing-function", + "-o-animation-timing-function", + "animation-timing-function", + "-webkit-animation-delay", + "-moz-animation-delay", + "-ms-animation-delay", + "-o-animation-delay", + "animation-delay", + "-webkit-animation-iteration-count", + "-moz-animation-iteration-count", + "-ms-animation-iteration-count", + "-o-animation-iteration-count", + "animation-iteration-count", + "-webkit-animation-direction", + "-moz-animation-direction", + "-ms-animation-direction", + "-o-animation-direction", + "animation-direction", + "text-align", + "-webkit-text-align-last", + "-moz-text-align-last", + "-ms-text-align-last", + "text-align-last", + "vertical-align", + "white-space", + "text-decoration", + "text-emphasis", + "text-emphasis-color", + "text-emphasis-style", + "text-emphasis-position", + "text-indent", + "-ms-text-justify", + "text-justify", + "letter-spacing", + "word-spacing", + "-ms-writing-mode", + "text-outline", + "text-transform", + "text-wrap", + "text-overflow", + "-ms-text-overflow", + "text-overflow-ellipsis", + "text-overflow-mode", + "-ms-word-wrap", + "word-wrap", + "word-break", + "-ms-word-break", + "-moz-tab-size", + "-o-tab-size", + "tab-size", + "-webkit-hyphens", + "-moz-hyphens", + "hyphens", + "pointer-events" + ] + ] +} \ No newline at end of file diff --git a/wms/contract-repair/semantic/.csslintrc b/wms/contract-repair/semantic/.csslintrc new file mode 100644 index 00000000..8786e82e --- /dev/null +++ b/wms/contract-repair/semantic/.csslintrc @@ -0,0 +1,18 @@ +{ + "vendor-prefix" : true, + "duplicate-properties" : true, + "display-property-grouping" : true, + "empty-rules" : true, + + "adjoining-classes" : false, + "box-model" : false, + "compatible-vendor-prefixes" : false, + "box-sizing" : false, + "duplicate-background-images" : false, + "floats" : false, + "important" : false, + "overqualified-elements" : false, + "rules-count" : false, + "shorthand" : false, + "zero-units" : false +} \ No newline at end of file diff --git a/wms/contract-repair/semantic/.github/ISSUE_TEMPLATE.md b/wms/contract-repair/semantic/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..a0950781 --- /dev/null +++ b/wms/contract-repair/semantic/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,24 @@ +✖ USAGE QUESTIONS → Use these dedicated resources: + Docs - http://www.semantic-ui.com + Chat - https://gitter.im/Semantic-Org/Semantic-UI + SO - https://stackoverflow.com/questions/tagged/semantic-ui?sort=votes + +✔ Enhancements → Be specific. Assume backwards compatibility is a necessity. Suggest implementation when possible. +✔ BUGS → ❤❤❤. Keep in mind some bugs may not be immediately fixable due to backwards compatibility or CSS limitations. + +### Title (Put in field above) +Use the format: [Component] Component Should Do X +i.e. [Checkbox] onChange Should Fire When Update Triggered via DOM + +### Steps + +### Expected Result + +### Actual Result + +### Version +x.y.z + +### Testcase +[Fork, update, and replace to show the bug]: +https://jsfiddle.net/ca0rovs3/ diff --git a/wms/contract-repair/semantic/.github/PULL_REQUEST_TEMPLATE.md b/wms/contract-repair/semantic/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..53af7dc0 --- /dev/null +++ b/wms/contract-repair/semantic/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ +✖ Multiple features in one PR +✖ New Components Unless Previously Discussed with Maintainers (Consider creating separate repo, I'll link out to you) + +✔ Add comments to complex/confusing code in "code" view of PR +✔ BUGS → This form is required: +✔ Enhancements → Only specific enhancements with detailed descriptions. + +### Issue Titles + +Use the format: [Component] Adds Support for Thing + +For example: [Build Tools] Adds Source Map Support +Or: [Button] Fixes Inheritance for Red Basic Active State + +### Closed Issues +#222 #333 #444 + +### Description + +### Testcase + +[Show before with this fiddle] +https://jsfiddle.net/ca0rovs3/ + +[Consider showing "fixed" case with your fiddle]() + +You can link to your JS using https://rawgit.com/ + diff --git a/wms/contract-repair/semantic/.github/stale.yml b/wms/contract-repair/semantic/.github/stale.yml new file mode 100644 index 00000000..e99f6ebe --- /dev/null +++ b/wms/contract-repair/semantic/.github/stale.yml @@ -0,0 +1,33 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 90 + +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 90 + +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security + +# Label to use when marking an issue as stale +staleLabel: stale + +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + There has been no activity in this thread for 90 days. While we care about + every issue and we’d love to see this fixed, the core team’s time is + limited so we have to focus our attention on the issues that are most + pressing. Therefore, we will likely not be able to get to this one. + + + However, PRs for this issue will of course be accepted and welcome! + + + If there is no more activity in the next 90 days, this issue will be closed + automatically for housekeeping. To prevent this, simply leave a reply here. + Thanks! + +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: > + This issue will be closed due to lack of activity for 6 months. If you’d + like this to be reopened, just leave a comment; we do monitor them! diff --git a/wms/contract-repair/semantic/.gitignore b/wms/contract-repair/semantic/.gitignore new file mode 100644 index 00000000..c788f288 --- /dev/null +++ b/wms/contract-repair/semantic/.gitignore @@ -0,0 +1,38 @@ +node_modules/ +test/coverage/ +coverage/ +src/**/site/ +theme.config +semantic.json +tasks/**/oauth.js +package-lock.json + +# Numerous always-ignore extensions +*.diff +*.err +*.orig +*.log +*.rej +*.swo +*.swp +*.zip +*.vi +*~ +*.sass-cache +*.ruby-version + +# OS or Editor folders +.DS_Store +._* +Thumbs.db +.cache +.project +.settings +.tmproj +.docpad.db +*.esproj +nbproject +*.sublime-project +*.sublime-workspace +.build* +.idea diff --git a/wms/contract-repair/semantic/.jshintrc b/wms/contract-repair/semantic/.jshintrc new file mode 100644 index 00000000..d2386396 --- /dev/null +++ b/wms/contract-repair/semantic/.jshintrc @@ -0,0 +1,38 @@ +{ + + "globals": { + "$" : true, + "afterEach" : true, + "AnimatedPNG" : true, + "beforeEach" : true, + "console" : true, + "describe" : true, + "expect" : true, + "it" : true, + "jQuery" : true, + "loadFixtures" : true, + "module" : true, + "requestAnimationFrame" : true, + "require" : true, + "semantic" : true + }, + + "debug" : false, + "devel" : true, + + "browser" : true, + "curly" : true, + "immed" : true, + "latedef" : true, + "loopfunc" : true, + "noarg" : true, + "undef" : true, + "sub" : true, + "loopfunc" : true, + + "laxbreak" : true, + "evil" : true, + "indent" : false, + "trailing" : false + +} \ No newline at end of file diff --git a/wms/contract-repair/semantic/CONTRIBUTING.md b/wms/contract-repair/semantic/CONTRIBUTING.md new file mode 100644 index 00000000..d811dd16 --- /dev/null +++ b/wms/contract-repair/semantic/CONTRIBUTING.md @@ -0,0 +1,58 @@ +# Contributing to Semantic UI + +### Usage Questions + +Questions about usage should be asked in our [Gitter chatroom](https://gitter.im/Semantic-Org/Semantic-UI), on [Semantic UI forums](http://forums.semantic-ui.com) or [StackOverflow](http://stackoverflow.com/questions/tagged/semantic-ui). + +Examples of usage questions +* *Why isn't my code working?* +* *Can Semantic UI do this?* + +Once you receive feedback through community channels you may find your question is actually a bug. At this point it's a good idea to submit it as a bug report. Just keep in mind the following suggestions. + +### Creating Bug Reports + +[Github Issues Tracker](https://github.com/Semantic-Org/Semantic-UI/issues) is used to track all upcoming milestones and changes to the project. + +**Please create a fork of this [JSFiddle](https://jsfiddle.net/ca0rovs3/) to demonstrate bugs.** + +When submiting a bug report, include a set of steps to reproduce the issue and any related information, browser, OS etc. If we can't reproduce the issue then it will make solving things much more difficult. + +If your bug uses a third party framework like Ember, Meteor, or Angular. Be sure to submit the issue to their respective issues boards. If you are confident the bug is part of the 'vanilla' SUI release, keep in mind not all maintainers are familiar with all framework and a simple test case is greatly appreciated. + +If your bug is reproduced by a maintainer it will be assigned the [`confirmed bug`](https://github.com/Semantic-Org/Semantic-UI/issues?q=is%3Aopen+is%3Aissue+label%3A%22Confirmed+Bug%22) tag. Browsing this tag is a good way to keep track of known issues with SUI. + +#### Naming Issues + +Semantic UI boards use a special naming convention to help tag issue titles by the component the issue is related to. + +##### Bugs +Please tag titles in the format "[Component] *Sub-type* should do *correct behavior*". Please use standard [title case](http://www.titlecase.com) for titles, including the bracketed tag. + +For example +* [Dropdown] Multiple Selection Should Preserve "Set Selected" Order +* [Validation] - E-mail Validation Should Handle Cyrillic +* [Button] - Grouped Buttons Should Display Correctly on Mobile + +##### Enhancements + +For new feature requests, you can use the format "[Component] Add *new feature*" + +For example +* [Dropdown] Add "Clearable" Setting +* [Validation] Add Rules for Zipcode Validation +* [API] Add "onProgress" callback setting + + +### Tracking Issue Progress + +As bugs and features are triaged they will be assigned to milestones. The best indication of when a change will land is to check the date on the [upcoming milestones](https://github.com/Semantic-Org/Semantic-UI/milestones) page. + +### Creating Pull Requests + +**All pull requests should be merged into the `next` branch.** + +Anyone can jump on the issues board and grab off bugs to fix. This is probably the best way to become a contributor to Semantic. Be sure to adhere to the style guides when submitting code. + +* [Create a Pull Request](https://github.com/Semantic-Org/Semantic-UI/compare) +* [View Open Issues](https://github.com/Semantic-Org/Semantic-UI/issues) diff --git a/wms/contract-repair/semantic/LICENSE.md b/wms/contract-repair/semantic/LICENSE.md new file mode 100644 index 00000000..62df7662 --- /dev/null +++ b/wms/contract-repair/semantic/LICENSE.md @@ -0,0 +1,7 @@ +# The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/wms/contract-repair/semantic/README.md b/wms/contract-repair/semantic/README.md new file mode 100644 index 00000000..acd9fc45 --- /dev/null +++ b/wms/contract-repair/semantic/README.md @@ -0,0 +1,112 @@ +![Semantic](http://semantic-ui.com/images/logo.png) + +# Semantic UI + +[![Join the chat at https://gitter.im/Semantic-Org/Semantic-UI](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Semantic-Org/Semantic-UI?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +[![CDNJS](https://img.shields.io/cdnjs/v/semantic-ui.svg)](https://cdnjs.com/libraries/semantic-ui/) + +[Semantic](http://www.semantic-ui.com) is a UI framework designed for theming. + +Key Features +* 50+ UI elements +* 3000 + CSS variables +* 3 Levels of variable inheritance (similar to SublimeText) +* Built with EM values for responsive design +* Flexbox friendly + +Semantic allows developers to build beautiful websites fast, with **concise HTML**, **intuitive javascript**, and **simplified debugging**, helping make front-end development a delightful experience. Semantic is responsively designed allowing your website to scale on multiple devices. Semantic is production ready and partnered with frameworks such as **React**, **Angular**, **Meteor**, and **Ember**, which means you can integrate it with any of these frameworks to organize your UI layer alongside your application logic. + +## 2.5.0 Release (Oct 6, 2022) + +Semantic UI is now compatible with Node 18 and Gulp 4. + +## User Support + +Please help us keep the issue tracker organized. For technical questions that do not include a specific [JSFiddle test case](https://jsfiddle.net/ca0rovs3/) (bug reports), or feature request please use [StackOverflow](http://stackoverflow.com/questions/tagged/semantic-ui) to find a solution. + +Visit our [contributing guide](https://github.com/Semantic-Org/Semantic-UI/blob/master/CONTRIBUTING.md) for more on what should be posted to GitHub Issues. + +## Install + +#### Recommended Install +```bash +npm install semantic-ui # Use themes, import build/watch tasks into your own gulpfile. +``` + +Semantic UI includes an interactive installer to help setup your project. + +* For more details on setup visit our [getting started guide](http://semantic-ui.com/introduction/getting-started.html). +* To learn more about theming please read our [theming guide](http://www.semantic-ui.com/usage/theming.html) + +#### Additional Versions + +Environment | Install Script | Repo +--- | --- | --- | +CSS Only | `npm install semantic-ui-css` | [CSS Repo](https://github.com/Semantic-Org/Semantic-UI-CSS) +[LESS](https://github.com/less/less.js/) Only | `npm install semantic-ui-less` | [LESS Repo](https://github.com/Semantic-Org/Semantic-UI-LESS) +[LESS](https://github.com/less/less.js/) plugin | `npm install less-plugin-semantic-ui` | [LESS Plugin Repo](https://github.com/bassjobsen/less-plugin-semantic-ui/) +[EmberJS](http://emberjs.com/) | `ember install:addon semantic-ui-ember` | [Ember Repo](https://github.com/Semantic-Org/Semantic-UI-Ember) +|[Meteor](https://www.meteor.com/) - [LESS](https://github.com/less/less.js/) | `meteor add semantic:ui` | [Meteor Repo](https://github.com/Semantic-Org/Semantic-UI-Meteor) | +|[Meteor](https://www.meteor.com/) - CSS | `meteor add semantic:ui-css` | [CSS Repo](https://github.com/Semantic-Org/Semantic-UI-CSS) | +[Bower](http://bower.io/) | `bower install semantic-ui` | + +Check out our [integration wiki](https://github.com/Semantic-Org/Semantic-UI/wiki/Integration) for more options. + +#### Browser Support + +* Last 2 Versions FF, Chrome, Safari Mac +* IE 11+ +* Android 4.4+, Chrome for Android 44+ +* iOS Safari 7+ +* Microsoft Edge 12+ + +Although some components will work in IE9, [grids](http://semantic-ui.com/collections/grid.html) and other [flexbox](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes) components are not supported by IE9 and may not appear correctly. + +## Community + +#### Getting Help +Please **do not post** usage questions to GitHub Issues. For these types of questions use our [Gitter chatroom][Gitter.im Room] or [StackOverflow](http://stackoverflow.com/questions/tagged/semantic-ui). + +#### Submitting Bugs and Enhancements +[GitHub Issues](https://github.com/Semantic-Org/Semantic-UI/issues) is for suggesting enhancements and reporting bugs. Before submiting a bug make sure you do the following: +* Check out our [contributing guide](https://github.com/Semantic-Org/Semantic-UI/blob/master/CONTRIBUTING.md) for info on our release cycle. +* [Fork this boilerplate JSFiddle](https://jsfiddle.net/ca0rovs3/) to create a test case for your bug. If a bug is apparent in the docs, that's ok as a test case, just make it clear exactly how to reproduce the issue. Only bugs that include a test case can be triaged. + + +#### Pull Requests + +When adding pull requests, be sure to merge into the [next](https://github.com/Semantic-Org/Semantic-UI/tree/next) branch. If you need to demonstrate a fix in ``next`` release, you can use [this JSFiddle](https://jsfiddle.net/ca0rovs3/) + + +#### International + +* **Chinese** A Chinese mirror site is available at [http://www.semantic-ui.cn](http://www.semantic-ui.cn). +* **Right-to-Left (RTL)** An RTL version can be created using our build tools by selecting `rtl` from the install script. +* **Translation** To help translate see the [Wiki Guide](https://github.com/Semantic-Org/Semantic-UI/wiki/Translating-Semantic-UI-Docs) for translations. + +#### Resources + +Resource | Description +--- | --- | +Bugs & Feature Requests | All bug submission **require** a link to a test case, and a set of steps to reproduce the issue. You can make a test case by forking this [JSFiddle](https://jsfiddle.net/ca0rovs3/), then submit your [bug report on GitHub Issues](https://github.com/Semantic-Org/Semantic-UI/issues) +Live Chat | Join our [Gitter.im Room][Gitter.im Room] +Newsletter Updates | Sign up for updates at [semantic-ui.com](http://www.semantic-ui.com) +Additional Resources | Submit a question on [StackOverflow](http://stackoverflow.com/questions/tagged/semantic-ui) or ask our [Google Group](https://groups.google.com/forum/#!forum/semantic-ui) + +#### Places to Help + +Project | How To Help | Next Step +--- | --- | --- | +Localization | Help us translate Semantic UI into your language | [Join our Translation Community](https://github.com/Semantic-Org/Semantic-UI/wiki/Translating-Semantic-UI-Docs) +[SCSS](http://sass-lang.com/) | SASS needs PR to support variables inside `@import` | [Add Pull Request](https://github.com/sass/sass/pulls) for [#739](https://github.com/sass/sass/issues/739#issuecomment-73984809) +[Angular](https://angularjs.org/) | Help develop angular bindings | Reach Out on [GitHub Issues](https://github.com/Semantic-Org/Semantic-UI-Angular/issues/8) +Guides & Tutorials | Help write guides and tutorials | [Join the discussion](https://github.com/Semantic-Org/Semantic-UI/issues/1571) + +#### Reaching Out + +If you'd like to start a conversation about Semantic feel free to e-mail me at [jack@semantic-ui.com](mailto:jack@semantic-ui.com) + + + +[Gitter.im Room]: https://gitter.im/Semantic-Org/Semantic-UI diff --git a/wms/contract-repair/semantic/RELEASE-NOTES.md b/wms/contract-repair/semantic/RELEASE-NOTES.md new file mode 100644 index 00000000..1a11701b --- /dev/null +++ b/wms/contract-repair/semantic/RELEASE-NOTES.md @@ -0,0 +1,2959 @@ +## RELEASE NOTES + +### Version 2.5.0 - Oct 6, 2022 + +**Note** +> Special Note: If you run into any breaking changes with Gulp 4. Please reach out to me at jack@semantic-ui.com with bug reports + +**Critical Fix** +- **CSS** - Fix extra semicolon causing CSS build of Semantic UI to fail compilation with various systems #7065 [React Issue](https://github.com/Semantic-Org/Semantic-UI-React/issues/4287) [CSS Repo Issue #81](https://github.com/Semantic-Org/Semantic-UI-CSS/issues/81) [CSS Issue #75](https://github.com/Semantic-Org/Semantic-UI-CSS/issues/75) + +**Breaking Changes** +- **Gulp 4** -All tasks have been rewritten to work with Gulp 4. This should fix SUI to install correctly on Node 12 or greater (see [Gulp3 Issue](https://github.com/gulpjs/gulp/issues/2324) for more details) + +**Build** +- **Node** - Updated scripts to build in Node 18 via vanilla install. +- **Theme** - Allow site's global site theme to be missing #6876 **Thanks @cruzdanillo** +- **Meteor** - Fix issue with misuse of `api.addAssets` #6790 **Thanks @gimco** +- **Gulp** - Report errors in build #7005 **Thanks @bundyo** + +**Examples** +- **Modal** - Fixed mutation observer was not properly disconnected +- **Sticky** - Adds new example for sticky to highlight behavior when sticky/context height varies + +**Bug Fixes** +- **Dropdown** - Fix issue where dropdown menu could not open to right when in `right menu` inside a `ui menu` (See examples/sticky.html) for use-case +- **Sticky** - Fix issue where element might be `bound bottom` (fixed to bottom of context) if the sticky element is larger than the context +- **Sticky** - Fix issue when sticky size is larger than context size caused context `min-height` not to be set correctly. +- **Button** - Fix usage of loading on in labeled button #7023 thanks @flppv + +### Version 2.4.2 - Oct 21, 2018 + +**Build** +- Fix issue that could prevent `gulp build` from running due to updates to gulp dependencies **Thanks for assistance @himanshu230** [#6631](https://github.com/Semantic-Org/Semantic-UI/issues/6631) [#6622](https://github.com/Semantic-Org/Semantic-UI/issues/6622) [#6067](https://github.com/Semantic-Org/Semantic-UI/issues/6067) + +### Version 2.4.1 - Oct 13, 2018 + +**Note** +> If you are using the `semantic-ui-less` package with versions of LESS before 3.5 some `calc` values will not be computed correctly due to changes in variable interpolation. It is recommended that you upgrade to at least 3.5 to continue using new versions of SUI. For more information see [#6512](https://github.com/Semantic-Org/Semantic-UI/issues/6512) + +**Build** +- **LESS** - SUI now supports less versions greater than `3.5.0` **Thanks @sciyoshi** [#6512](https://github.com/Semantic-Org/Semantic-UI/issues/6512) +- **Gulp** - Migrated deprecated `gulp-util` to `replace-ext` **Thanks @stevelacy** [#6322](https://github.com/Semantic-Org/Semantic-UI/issues/6322) +- **Gulp** - Updated all gulp dependencies to most recent released versions with modifications to tasks as necessary. + +**Bug Fixes** +- **Dropdown** - `clearable` dropdown now works with dropdown that arent `on:click`, like `hover` or `manual` triggers. [#6594](https://github.com/Semantic-Org/Semantic-UI/issues/6594) +- **Modal** - Fixed `fullscreen modal` having incorrect left offset with flex modals [#6587](https://github.com/Semantic-Org/Semantic-UI/issues/6587) +- **Embed** - Embed will now correctly remove DOM metadata on `destroy` +- **Grid** - Fix issue with `very relaxed vertically divided grid` having wrong margins on dividers + +### Version 2.4.0 - Sep 17, 2018 + +> `2.4.0` includes a new component `placeholder`. To use this component in your existing SUI site, be sure to add `@placeholder: 'default';` to your `theme.config`. You can see an example in `theme.config.example` + +**New Components** +- **Placeholder** - Added `ui placeholder` that can be used to show where content will soon appear. + +**New UI Type** +- **Segment** - Added new `ui placeholder segment` used to reserve space for UI when content is missing or empty. + +**Major Enhancements** +- **Dropdown** - Added `clearable` dropdowns. When `clearable: true` is specified an (X) will appear to clear dropdown selection [#2072](https://github.com/Semantic-Org/Semantic-UI/issues/2072) +- **Modal/Dimmer** - Modals and dimmers now include a new setting `useFlex` which defaults to `auto`. Modals and dimmers will automatically revert to using non-flex layouts when there may be layout issues with using flexbox. Modals will fall back to JS position when `detachable: false` is used or with IE11/Edge (Absolutely positioned elements inside flex containers in IE behave differently). + +**Critical Bugs** +- **Modal** - Fixed issue where `scrolling modal` would not allow for scrolling with touch devices. [#6449](https://github.com/Semantic-Org/Semantic-UI/issues/6449) +- **Label** - Fixed issue where `basic label` were appearing incorrectly **Thanks @lasley / @ColinFrick** [#6582](https://github.com/Semantic-Org/Semantic-UI/issues/6582) [#6440](https://github.com/Semantic-Org/Semantic-UI/issues/6440) +- **Menu/Dropdown** - Fixed `left menu` inside `ui menu` would display horizontally as `flex` [#6359](https://github.com/Semantic-Org/Semantic-UI/issues/6359) + +**Bugs** +- **Dimmer** - Dimmer now sets `variation` at runtime, to support run-time swapping between `top aligned` and `middle aligned` using `.dimmer('setting', 'variation', 'top aligned')` +- **Dropdown** - Fixed issue where `onChange` when used with `action: hide` would be missing the third param `$item` [#6555](https://github.com/Semantic-Org/Semantic-UI/issues/6555) +- **Flag** - Add `uk` alias for `united kingdom` **Thanks @PhilipGarnero** [#6531](https://github.com/Semantic-Org/Semantic-UI/issues/6531) +- **Icon** - Fixes missing `disk outline icon` alias [#6556](https://github.com/Semantic-Org/Semantic-UI/issues/6556) +- **List** - Fixed issue where list `content` would not take up 100% width when used alongside `img` or `icon` +- **Menu/Dropdown** - Fixes dropdown item margin not obeyed inside `labeled icon menu` [#6557](https://github.com/Semantic-Org/Semantic-UI/issues/6557) +- **Modal** - Fixes `@mobileTopAlignedMargin` theming variable was not implemented +- **Modal** - Modal now will remove `blurring` after undimming, to prevent issues with `position: fixed` [#6520](https://github.com/Semantic-Org/Semantic-UI/issues/6520) + +**Minor Changes** +- **Dropdown** - `inline dropdown` `close icon` default right margin default spacing slightly modified. + + +### Version 2.3.3 - July 8th, 2018 + +**Bug Fixes** +- **Search** - Passing in `cache: false` will now affect default settings for `apiSettings` when using a remote endpoint. Previously you would also have to pass in `apiSettings: { cache: false}` as well +- **CSS** - Update LESS syntax to be compatible with LESS 3.0 **Thanks @sciyoshi** [#6447](https://github.com/Semantic-Org/Semantic-UI/pull/6447) +- **Icon** - Several icon names have been deprecated due to incompatibility with `transition in` and `transition out` used in animations. + +* `linkedin in` is now `linkedin alternate` +* `zoom in` is now `zoom-in` +* `zoom out` is now `zoom-out` +* `sign in` is now `sign-in` +* `sign out` is now `sign-out` +* `log out` is now `logout` +* `in cart` is now `in-cart` + +### Version 2.3.2 - June 18, 2018 + +**Enhancements** +- **Modal** - Modal and Dimmer now prevent background page from scrolling on mobile or where touch events are present +- **Button** - Add `inverted` and `inverted basic` variations for `primary` and `secondary` buttons **Thanks @hammy2899** [#6242](https://github.com/Semantic-Org/Semantic-UI/issues/6242) + +**Theming** +- **Global** - Add `hover` `down` `active` and `focus` variables for `@invertedPrimaryColor` and `@invertedSecondaryColor` + +**Bugs** +- **Dropdown** Fixed bug that could cause dropdown to recursively trigger network requests specifically when using `apiSettings` with a url that returns valid response but with no results when clicking directly on the `dropdown icon`. **Thanks @vpeti** [#5231](https://github.com/Semantic-Org/Semantic-UI/issues/5231) [#5809](https://github.com/Semantic-Org/Semantic-UI/issues/5809) +- **Statistics** - Fix issue where grouped statistics would have excess bottom margin if they are `:last-child` +- **Label** - Fix `basic label` does not use `@basicBackground` variables **Thanks @levithomson** +- **Modal** - Modal will not refocus a field if field is already focused **Thanks @nikolaybobrovskiy** [#6301](https://github.com/Semantic-Org/Semantic-UI/issues/6301) +- **Icon** - Fix `wechat icon` not displaying due to typo **Thanks @alex-karo** [#6429](https://github.com/Semantic-Org/Semantic-UI/issues/6429) + +### Version 2.3.1 - Mar 18, 2018 + +> **A Special Message about Flex Modals** +> There will be an update shortly to resolve issues related to flex modals when using multiple modals and `detachable: false`, in order to not hold up this release, we've decided to move forward without a fix. + +> A general solution will most likely require branching code for IE11 which will disable flex (as IE11 doesnt correctly implement the latest spec for [absolute positioned flex containers](https://developers.google.com/web/updates/2016/06/absolute-positioned-children)). + +**Critical Bugs** +- **Dropdown** - Fixed issue in `2.3.0` that could cause multiselect dropdowns initialized by converting `` DOM node is replaced with a different select, and not just if new `