Browse Source

價審欄位添加服務費

main
Cheng 1 year ago
parent
commit
26318a6004
  1. 225
      mkt/IncludeCommon.php
  2. 69
      wms/contract-repair/api/deleteNewContractData.php
  3. 228
      wms/contract-repair/api/getContractData.php
  4. 832
      wms/contract-repair/api/postContractData.php
  5. 364
      wms/contract-repair/api/putContractData.php
  6. 404
      wms/contract-repair/contract-repair-edit.php
  7. 358
      wms/contract-repair/contract-repair-input.php
  8. 248
      wms/contract-repair/contract-repair-management.php
  9. 2998
      wms/contract-repair/js/alpine.js
  10. 343
      wms/contract-repair/styles/style.css
  11. 2
      wms/contract-repair/styles/style.css.map
  12. 1593
      wms/contract-repair/styles/style.scss
  13. 126
      wms/mkt/pricereview_contractno-api.php
  14. 557
      wms/mkt/pricereview_repair-check.php
  15. 1087
      wms/mkt/pricereview_repair-create.php
  16. 159
      wms/mkt/pricereview_repair-record-submit.php
  17. 351
      wms/sign/list.php
  18. 1202
      wms/sign/sign_form.php

225
mkt/IncludeCommon.php

@ -1,110 +1,115 @@
<?php <?php
class IncludeCommon // phpinfo();
{ // exit;
function CheckToken($token) { class IncludeCommon
date_default_timezone_set("Asia/Taipei"); {
$encryption_code = "MASADA!^***"; function CheckToken($token)
$time = date("Y-m-d H:i:s"); {
date_default_timezone_set("Asia/Taipei");
if (!isset($token) || empty($token)) { $encryption_code = "MASADA!^***";
$data['code'] = '400'; $time = date("Y-m-d H:i:s");
$data['message'] = '非法请求';
return $data; if (!isset($token) || empty($token)) {
} $data['code'] = '400';
//对比token $data['message'] = '非法請求';
$explode = explode('.', $token); //以.分割token为数组 return $data;
if (!empty($explode[0]) && !empty($explode[1]) && !empty($explode[2]) && !empty($explode[3]) && !empty($explode[4])) { }
$info = $explode[0] . '.' . $explode[1] . '.' . $explode[2] . '.' . $explode[3]; //信息部分 //对比token
$true_signature = hash_hmac('md5', $info, $encryption_code); //正确的签名 $explode = explode('.', $token); //以.分割token为数组
if ($time > $explode[2]) { if (!empty($explode[0]) && !empty($explode[1]) && !empty($explode[2]) && !empty($explode[3]) && !empty($explode[4])) {
$data['user_id'] = ''; $info = $explode[0] . '.' . $explode[1] . '.' . $explode[2] . '.' . $explode[3]; //信息部分
$data['user_name'] = ''; $true_signature = hash_hmac('md5', $info, $encryption_code); //正确的签名
$data['code'] = '401'; if ($time > $explode[2]) {
$data['message'] = 'Token已过期,请重新登录'; $data['user_id'] = '';
return $data; $data['user_name'] = '';
} $data['code'] = '401';
if ($true_signature == $explode[4]) { $data['message'] = 'Token已過期,請重新登入';
$data['user_id'] = $explode[0]; return $data;
$data['user_name'] = $explode[3]; }
$data['code'] = '200'; if ($true_signature == $explode[4]) {
$data['message'] = 'Token合法'; $data['user_id'] = $explode[0];
return $data; $data['user_name'] = $explode[3];
} else { $data['code'] = '200';
$data['user_id'] = ''; $data['message'] = 'Token合法';
$data['user_name'] = ''; return $data;
$data['code'] = '400'; } else {
$data['message'] = 'Token不合法'; $data['user_id'] = '';
return $data; $data['user_name'] = '';
} $data['code'] = '400';
} else { $data['message'] = 'Token不合法';
$data['user_id'] = ''; return $data;
$data['user_name'] = ''; }
$data['code'] = '400'; } else {
$data['message'] = 'Token不合法'; $data['user_id'] = '';
return $data; $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"; function save_log_response($source_flag = 'web', $account, $response_result)
$data = serialize($response_result). date("H:i:s") . "\n"; {
$fp = fopen($file_path,"a"); # 如果档案不存在择尝试建立再写入 # 储存纪录并输出
fwrite($fp, $data); #echo date("Y-m-d");
fclose($fp); $file_path = "account_log/" . $account . "-" . date("Y-m-d") . ".ini";
if ($source_flag == "web"){ $data = serialize($response_result) . date("H:i:s") . "\n";
// header("Location: custom-create.php?function_list=" . serialize($response_result) . $fp = fopen($file_path, "a"); # 如果档案不存在择尝试建立再写入
// "&token=" . $response_result["token"]); #请输入使用者名称密码 fwrite($fp, $data);
// exit(); fclose($fp);
return true; if ($source_flag == "web") {
}else{ // header("Location: custom-create.php?function_list=" . serialize($response_result) .
// echo json_encode($response_result, JSON_UNESCAPED_UNICODE); // "&token=" . $response_result["token"]); #请输入使用者名称密码
return false; // exit();
} return true;
} else {
/* // echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
if ($source_flag == "app"){ return false;
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"]); #请输入使用者名称密码 if ($source_flag == "app"){
exit(); 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小时 //生成token
$info = $user_id . '.' . $start_time . '.' . $end_time . '.' . $user_name; //设置token过期时间为一天 function CreateToken($user_id, $user_name)
$encryption_code = "MASADA!^***"; {
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量) date_default_timezone_set("Asia/Taipei");
$signature = hash_hmac('md5', $info, $encryption_code); $start_time = date("Y-m-d H:i:s");
//最后将这两部分拼接起来,得到最终的Token字符串 $end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时
return $token = $info . '.' . $signature; $info = $user_id . '.' . $start_time . '.' . $end_time . '.' . $user_name; //设置token过期时间为一天
} $encryption_code = "MASADA!^***";
//生成菜单 //根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
$signature = hash_hmac('md5', $info, $encryption_code);
function menu ($from='tw',$type){ //最后将这两部分拼接起来,得到最终的Token字符串
$function_type = array( return $token = $info . '.' . $signature;
"tw" => array( }
# F角色菜单 //生成菜单
"H" => array(
"language" => "tw", function menu($from = 'tw', $type)
"type" => "manage", {
"list" => array( $function_type = array(
array("name" => "批量导入", "path" => "http://192.168.0.12/wms/excel-upload"), "tw" => array(
), # F角色菜单
"note" => "none", "H" => array(
"token" => "" "language" => "tw",
), "type" => "manage",
) "list" => array(
); array("name" => "批量导入", "path" => "http://192.168.0.12/wms/excel-upload"),
),
return $function_type[$from][$type]; "note" => "none",
"token" => ""
} ),
} )
);
return $function_type[$from][$type];
}
}

69
wms/contract-repair/api/deleteNewContractData.php

@ -1,35 +1,34 @@
<?php <?php
require_once("../conn.php"); require_once("../conn.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' ); ini_set('date.timezone', 'Asia/Taipei');
if(isset($_GET['contractid']) && $_GET['contractid']!="" && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r'){ if (isset($_GET['contractid']) && $_GET['contractid'] != "" && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r') {
try{ try {
$id = $_GET['contractid']; $id = $_GET['contractid'];
$user_id = $_GET['user_id']; $user_id = $_GET['user_id'];
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$del = 2; $del = '2';
$sql = "UPDATE contract_r_signed_back SET delete_status = :del,delete_userid= :user_id, delete_date = :date WHERE id = :id"; $sql = "UPDATE contract_r_signed_back SET delete_status = :del,delete_userid= :user_id, delete_date = :date WHERE id = :id";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->bindParam(":id",$id); $stmt->bindParam(":id", $id);
$stmt->bindParam(":del",$del); $stmt->bindParam(":del", $del);
$stmt->bindParam(":user_id",$user_id); $stmt->bindParam(":user_id", $user_id);
$stmt->bindParam(":date",$date); $stmt->bindParam(":date", $date);
$stmt->execute(); $stmt->execute();
header("HTTP/1.1 204 NO Content"); header("HTTP/1.1 204 NO Content");
}catch(PDOException $e){ } catch (PDOException $e) {
die("ERROR!!!". $e->getMessage()); die("ERROR!!!" . $e->getMessage());
} }
} }
if(isset($_GET['contractid']) && $_GET['contractid']!=""){ if (isset($_GET['contractid']) && $_GET['contractid'] != "") {
try{ try {
$id = $_GET["contractid"]; $id = $_GET["contractid"];
$sql_str = "DELETE FROM contract_m_signed_back WHERE id = :contractid"; $sql_str = "DELETE FROM contract_m_signed_back WHERE id = :contractid";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contractid", $id); $stmt->bindParam(":contractid", $id);
$stmt->execute(); $stmt->execute();
header("HTTP/1.1 204 No Content"); header("HTTP/1.1 204 No Content");
}catch(PDOException $e){ } catch (PDOException $e) {
die("ERROR!!!: ". $e->getMessage()); die("ERROR!!!: " . $e->getMessage());
} }
} }
?>

228
wms/contract-repair/api/getContractData.php

@ -1,106 +1,122 @@
<?php <?php
require_once('../conn.php'); require_once('../conn.php');
if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'b') { if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'b') {
try { try {
$contractno = $_GET['contractno']; $contractno = $_GET['contractno'];
$sql_str = "SELECT con_maintance_examine_apply.*, con_maintance_examine_clear.* FROM con_maintance_examine_apply $sql_str = "SELECT con_maintance_examine_apply.*, con_maintance_examine_clear.* FROM con_maintance_examine_apply
JOIN con_maintance_examine_clear on con_maintance_examine_apply.apply_key=con_maintance_examine_clear.apply_key JOIN con_maintance_examine_clear on con_maintance_examine_apply.apply_key=con_maintance_examine_clear.apply_key
WHERE con_maintance_examine_apply.vol_no = :vol_no ;"; WHERE con_maintance_examine_apply.vol_no = :vol_no ;";
$sql_str = "SELECT * FROM con_maintance_examine_apply WHERE vol_no = :vol_no ORDER BY create_at DESC;"; $sql_str = "SELECT * FROM con_maintance_examine_apply WHERE vol_no = :vol_no ORDER BY create_at DESC;";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $contractno); $stmt->bindParam(':vol_no', $contractno);
$stmt->execute(); $stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC); $contract = $stmt->fetch(PDO::FETCH_ASSOC);
if (empty($contract)) { if (empty($contract)) {
echo false; echo false;
exit; exit;
} }
$apply_key = $contract['apply_key']; $apply_key = $contract['apply_key'];
$sql_str = "SELECT * FROM con_maintance_examine_clear WHERE apply_key = :apply_key"; $sql_str = "SELECT * FROM con_maintance_examine_clear WHERE apply_key = :apply_key";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key); $stmt->bindParam(':apply_key', $apply_key);
$stmt->execute(); $stmt->execute();
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC); $elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = COUNT($elevators); $count = COUNT($elevators);
$contract['elevators'] = $elevators; $contract['elevators'] = $elevators;
$contract['num'] = $count; $contract['num'] = $count;
$contractResponse = json_encode($contract); $contractResponse = json_encode($contract);
// 設定回應標頭為 JSON // 設定回應標頭為 JSON
header('Content-Type: application/json'); header('Content-Type: application/json');
// 將 JSON 回應返回給客戶端 // 將 JSON 回應返回給客戶端
echo $contractResponse; echo $contractResponse;
// echo json_encode($contractResponse); // echo json_encode($contractResponse);
} catch (PDOException $e) { } catch (PDOException $e) {
die("ERROR!!!: " . $e->getMessage()); die("ERROR!!!: " . $e->getMessage());
} }
} }
if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') { if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') {
try { try {
$contractno = $_GET['contractno']; $contractno = $_GET['contractno'];
$sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC"; $sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $contractno); $stmt->bindParam(':vol_no', $contractno);
$stmt->execute(); $stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC); $contract = $stmt->fetch(PDO::FETCH_ASSOC);
$contractResponse = json_encode($contract); $contractResponse = json_encode($contract);
// 設定回應標頭為 JSON // 設定回應標頭為 JSON
header('Content-Type: application/json'); header('Content-Type: application/json');
// 將 JSON 回應返回給客戶端 // 將 JSON 回應返回給客戶端
echo $contractResponse; echo $contractResponse;
} catch (PDOException $e) { } catch (PDOException $e) {
die("ERROR!!!: " . $e->getMessage()); die("ERROR!!!: " . $e->getMessage());
} }
} }
////////////////////////////// //////////////////////////////
//// 合約簽回(修理) //// 合約簽回(修理)
//// ////
//// 製作人:梓誠 //// 製作人:梓誠
/// 時間 : /// 時間 :
////////////////////////////// //////////////////////////////
if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r') { if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r') {
try { try {
$contractno = $_GET['contractno']; $contractno = $_GET['contractno'];
$fail_arr = []; $fail_arr = [];
$d_status = '1';
$sql = "SELECT COUNT(*) AS num FROM pricereview_repair_main WHERE contractno = :contractno"; // 判斷單號是否在合約簽核已建立
$stmt = $conn->prepare($sql); $sql = "SELECT COUNT(*) AS num FROM contract_r_signed_back WHERE contractno = :contractno AND delete_status = :d_status ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(":contractno", $contractno); $stmt->bindParam(":contractno", $contractno);
$stmt->execute(); $stmt->bindParam(":d_status", $d_status);
$result = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->execute();
$count = $result['num']; $result = $stmt->fetch(PDO::FETCH_ASSOC);
if ($count > 1) { $count = $result['num'];
$fail_arr[] = '合約單號重複,請至契約管理(修理)查看。'; if ($count >= 1) {
header("HTTP/1.1 422 Unprocessable Entity"); $fail_arr[] = '合約單號重複,請至契約管理(修理)查看。';
echo json_encode($fail_arr); header("HTTP/1.1 422 Unprocessable Entity");
exit(); echo json_encode($fail_arr);
} exit();
// $contractno = $_GET['contractno']; }
$sql = "SELECT a.*,b.name,b.accountid // 判斷單號是否在價格審查中以建立。
FROM pricereview_repair_main AS a $sql = "SELECT COUNT(*) AS num FROM pricereview_repair_main WHERE contractno = :contractno";
LEFT JOIN account AS b $stmt = $conn->prepare($sql);
ON a.repairerid = b.accountid $stmt->bindParam(":contractno", $contractno);
WHERE a.contractno = :contractno "; $stmt->execute();
$stmt = $conn->prepare($sql); $result2 = $stmt->fetch(PDO::FETCH_ASSOC);
$count2 = $result2['num'];
$stmt->bindParam(':contractno', $contractno); if ($count2 == 0) {
$stmt->execute(); $fail_arr[] = '找不到單號,請再確認。';
$contract = $stmt->fetch(PDO::FETCH_ASSOC); header("HTTP/1.1 422 Unprocessable Entity");
$contractResponse = json_encode($contract); echo json_encode($fail_arr);
exit();
// 設定回應標頭為 JSON }
header('Content-Type : appliction/json');
// 將 JSON 回應給客戶端 // $contractno = $_GET['contractno'];
echo $contractResponse; $sql = "SELECT a.*,b.name,b.accountid
} catch (PDOException $e) { FROM pricereview_repair_main AS a
die("ERROR!!:" . $e->getMessage()); LEFT JOIN account AS b
} ON a.repairerid = b.accountid
} WHERE a.contractno = :contractno ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':contractno', $contractno);
$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());
}
}

832
wms/contract-repair/api/postContractData.php

@ -1,412 +1,420 @@
<?php <?php
require_once("../conn.php"); require_once("../conn.php");
include_once("./getFacilityNo.php"); include_once("./getFacilityNo.php");
include_once("./getComboNo.php"); include_once("./getComboNo.php");
include_once("./upload_chk.php"); include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' ); ini_set('date.timezone', 'Asia/Taipei');
//保養簽回 //保養簽回
if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') { if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') {
try{ try {
$created_at = date('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s');
$contractno = !empty($_POST['contractno'])? $_POST['contractno'] : null; $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null; $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$vat = !empty($_POST['vat']) ? $_POST['vat'] : null; $vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
$mtype = !empty($_POST['mtype']) ? $_POST['mtype'] :null; $mtype = !empty($_POST['mtype']) ? $_POST['mtype'] : null;
$opendoor = !empty($_POST['opendoor']) ? $_POST['opendoor']: null; $opendoor = !empty($_POST['opendoor']) ? $_POST['opendoor'] : null;
$phone = !empty($_POST['phone']) ? $_POST['phone'] : null; $phone = !empty($_POST['phone']) ? $_POST['phone'] : null;
$email = !empty($_POST['email']) ? $_POST['email'] : null; $email = !empty($_POST['email']) ? $_POST['email'] : null;
$mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : null; $mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : null;
$mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null; $mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
$salesman = !empty($_POST['salesman']) ?$_POST['salesman'] : null; $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null; $contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null;
$contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null; $contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null; $address = !empty($_POST['address']) ? $_POST['address'] : null;
$area = !empty($_POST['area']) ? $_POST['area'] : null; $area = !empty($_POST['area']) ? $_POST['area'] : null;
$customer = !empty($_POST['customer']) ? $_POST['customer'] : null; $customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
$partyA = !empty($_POST['partyA']) ? $_POST['partyA'] : null; $partyA = !empty($_POST['partyA']) ? $_POST['partyA'] : null;
$partyAaddress = !empty($_POST['partyAaddress']) ? $_POST['partyAaddress'] : null; $partyAaddress = !empty($_POST['partyAaddress']) ? $_POST['partyAaddress'] : null;
$partyAphone = !empty($_POST['partyAphone']) ? $_POST['partyAphone'] : null; $partyAphone = !empty($_POST['partyAphone']) ? $_POST['partyAphone'] : null;
$partyAemail = !empty($_POST['partyAemail']) ? $_POST['partyAemail'] : null; $partyAemail = !empty($_POST['partyAemail']) ? $_POST['partyAemail'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
$user_name = !empty($_POST['user_name']) ? $_POST['user_name'] : null; $user_name = !empty($_POST['user_name']) ? $_POST['user_name'] : null;
$num = !empty($_POST['num']) ? $_POST['num'] : null; $num = !empty($_POST['num']) ? $_POST['num'] : null;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null; $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : []; $elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
// validate // validate
$fail_arr = []; $fail_arr = [];
if($contractno === '') return $fail_arr[] = '合約號為必填'; if ($contractno === '') return $fail_arr[] = '合約號為必填';
if($total_price == '') $fail_arr[] = '合約總價為必填'; if ($total_price == '') $fail_arr[] = '合約總價為必填';
if($vat == '') $fail_arr[] = '統一編號為必填'; if ($vat == '') $fail_arr[] = '統一編號為必填';
if($mtype == '') $fail_arr[] = '維修型態為必填'; if ($mtype == '') $fail_arr[] = '維修型態為必填';
if($phone == '') $fail_arr[] = '客戶電話為必填'; if ($phone == '') $fail_arr[] = '客戶電話為必填';
if($email == '') $fail_arr[] = 'Email為必填'; if ($email == '') $fail_arr[] = 'Email為必填';
if($mworker == '') $fail_arr[] = '保養員為必填'; if ($mworker == '') $fail_arr[] = '保養員為必填';
if($mcycle == '') $fail_arr[] = '保養頻率為必填'; if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
if($salesman == '') $fail_arr[] = '營業員為必填'; if ($salesman == '') $fail_arr[] = '營業員為必填';
if($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填'; if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
if($contract_end_date == '') $fail_arr[] = '合約結束時間為必填'; if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
if($address == '') $fail_arr[] = '地址為必填'; if ($address == '') $fail_arr[] = '地址為必填';
if($area == '') $fail_arr[] = '區域為必填'; if ($area == '') $fail_arr[] = '區域為必填';
if($customer == '') $fail_arr[] = '客戶為必填'; if ($customer == '') $fail_arr[] = '客戶為必填';
if($partyA == '') $fail_arr[] = '業務聯繫人為必填'; if ($partyA == '') $fail_arr[] = '業務聯繫人為必填';
if($partyAaddress == '') $fail_arr[] = '業務聯繫人地址為必填'; if ($partyAaddress == '') $fail_arr[] = '業務聯繫人地址為必填';
if($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填'; if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填';
if($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填'; if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填';
if($num == '') $fail_arr[] = '電梯數量為必填'; if ($num == '') $fail_arr[] = '電梯數量為必填';
if(count($fail_arr) > 0) { if (count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity"); header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr); echo json_encode($fail_arr);
exit(); exit();
} }
//create account table //create account table
$accounttype = "A"; $accounttype = "A";
$accountid = $vat; $accountid = $vat;
$pwd = "123"; $pwd = "123";
$name = $partyA; $name = $partyA;
$tel = $phone ?? ''; $tel = $phone ?? '';
$repairerid = $mworker; $repairerid = $mworker;
$creater = $user_id; $creater = $user_id;
$create_at = date('Y-m-d H:i:s'); $create_at = date('Y-m-d H:i:s');
$conn->beginTransaction(); $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)"; $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 = $conn->prepare($sql_str);
$stmt -> bindParam(':accounttype' ,$accounttype); $stmt->bindParam(':accounttype', $accounttype);
$stmt -> bindParam(':accountid' ,$accountid); $stmt->bindParam(':accountid', $accountid);
$stmt -> bindParam(':pwd' ,$pwd); $stmt->bindParam(':pwd', $pwd);
$stmt -> bindParam(':name' ,$name); $stmt->bindParam(':name', $name);
$stmt -> bindParam(':tel' ,$tel); $stmt->bindParam(':tel', $tel);
$stmt -> bindParam(':address' ,$address); $stmt->bindParam(':address', $address);
$stmt -> bindParam(':email' ,$email); $stmt->bindParam(':email', $email);
$stmt -> bindParam(':repairerid' ,$repairerid); $stmt->bindParam(':repairerid', $repairerid);
$stmt -> bindParam(':creater' ,$creater); $stmt->bindParam(':creater', $creater);
$stmt -> bindParam(':create_at' ,$create_at); $stmt->bindParam(':create_at', $create_at);
$stmt -> execute(); $stmt->execute();
//create contract table //create contract table
$contracttype = $mtype; $contracttype = $mtype;
$company = $partyA; $company = $partyA;
$taxid = $vat; $taxid = $vat;
$tel = $phone; $tel = $phone;
$promiser = $partyA; $promiser = $partyA;
$contractperson = $partyA; $contractperson = $partyA;
$contractaddress = $address; $contractaddress = $address;
$contracttel = $phone; $contracttel = $phone;
$contractemail = $email; $contractemail = $email;
$contract_employee = $salesman; $contract_employee = $salesman;
$start_date = $contract_begin_date; $start_date = $contract_begin_date;
$end_date = $contract_end_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)"; $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 = $conn->prepare($sql_str);
$stmt -> bindParam(':contracttype' ,$contracttype); $stmt->bindParam(':contracttype', $contracttype);
$stmt -> bindParam(':contractno' ,$contractno); $stmt->bindParam(':contractno', $contractno);
$stmt -> bindParam(':company' ,$company); $stmt->bindParam(':company', $company);
$stmt -> bindParam(':taxid' ,$taxid); $stmt->bindParam(':taxid', $taxid);
$stmt -> bindParam(':address' ,$address); $stmt->bindParam(':address', $address);
$stmt -> bindParam(':tel' ,$tel); $stmt->bindParam(':tel', $tel);
$stmt -> bindParam(':promiser' ,$promiser); $stmt->bindParam(':promiser', $promiser);
$stmt -> bindParam(':contractperson' ,$contractperson); $stmt->bindParam(':contractperson', $contractperson);
$stmt -> bindParam(':contractaddress' ,$contractaddress); $stmt->bindParam(':contractaddress', $contractaddress);
$stmt -> bindParam(':contracttel' ,$contracttel); $stmt->bindParam(':contracttel', $contracttel);
$stmt -> bindParam(':contractemail' ,$contractemail); $stmt->bindParam(':contractemail', $contractemail);
$stmt -> bindParam(':contract_employee' ,$contract_employee); $stmt->bindParam(':contract_employee', $contract_employee);
$stmt -> bindParam(':start_date' ,$start_date); $stmt->bindParam(':start_date', $start_date);
$stmt -> bindParam(':end_date' ,$end_date); $stmt->bindParam(':end_date', $end_date);
$stmt -> bindParam(':creater' ,$creater); $stmt->bindParam(':creater', $creater);
$stmt -> bindParam(':create_at' ,$create_at); $stmt->bindParam(':create_at', $create_at);
$stmt -> execute(); $stmt->execute();
//create facility table //create facility table
$createFacilityNo = new CreateFacilityNo(); $createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [ $dailyNecessities = [
'MAE100'=>'X', 'MAE100' => 'X',
'MAM200'=>'W', 'MAM200' => 'W',
'MAH100'=>'H', 'MAH100' => 'H',
'MAQ100'=>'Z', 'MAQ100' => 'Z',
'MAF100'=>'F', 'MAF100' => 'F',
'MAZ100'=>'B', 'MAZ100' => 'B',
]; ];
$facility_arr = []; $facility_arr = [];
foreach($elevators as $elevator){ foreach ($elevators as $elevator) {
$facility_arr[] = $dailyNecessities[$elevator['spec']]; $facility_arr[] = $dailyNecessities[$elevator['spec']];
} }
echo json_encode($facility_arr); echo json_encode($facility_arr);
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num); $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
echo json_encode($facilityno); echo json_encode($facilityno);
echo '-------'; echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid"; $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accountid',$mworker); $stmt->bindParam(':accountid', $mworker);
$stmt->execute(); $stmt->execute();
$worker = $stmt->fetch(PDO::FETCH_ASSOC); $worker = $stmt->fetch(PDO::FETCH_ASSOC);
$customerid = $vat; $customerid = $vat;
$define = "B"; $define = "B";
$repairtype = $mtype; $repairtype = $mtype;
$repairerid = $mworker; $repairerid = $mworker;
$repairername = $worker['name']; $repairername = $worker['name'];
foreach($elevators as $idx=>$elevator){ 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) $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)"; 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 = $conn->prepare($sql_str);
$stmt -> bindParam(':contractno' ,$contractno); $stmt->bindParam(':contractno', $contractno);
$stmt -> bindParam(':define' ,$define); $stmt->bindParam(':define', $define);
$stmt -> bindParam(':facilityno' ,$facilityno[$idx]); $stmt->bindParam(':facilityno', $facilityno[$idx]);
$stmt -> bindParam(':latitude' ,$elevator['latitude']); $stmt->bindParam(':latitude', $elevator['latitude']);
$stmt -> bindParam(':longitude' ,$elevator['longitude']); $stmt->bindParam(':longitude', $elevator['longitude']);
$stmt -> bindParam(':customerid' ,$customerid); $stmt->bindParam(':customerid', $customerid);
$stmt -> bindParam(':weight' ,$elevator['weight']); $stmt->bindParam(':weight', $elevator['weight']);
$stmt -> bindParam(':numberofpassenger' ,$elevator['persons']); $stmt->bindParam(':numberofpassenger', $elevator['persons']);
$stmt -> bindParam(':numberofstop' ,$elevator['stop']); $stmt->bindParam(':numberofstop', $elevator['stop']);
$stmt -> bindParam(':numberoffloor' ,$elevator['floors']); $stmt->bindParam(':numberoffloor', $elevator['floors']);
$stmt -> bindParam(':opentype' ,$elevator['opendoor']); $stmt->bindParam(':opentype', $elevator['opendoor']);
$stmt -> bindParam(':speed' ,$elevator['speed']); $stmt->bindParam(':speed', $elevator['speed']);
$stmt -> bindParam(':repairtype' ,$repairtype); $stmt->bindParam(':repairtype', $repairtype);
$stmt -> bindParam(':maintainance' ,$elevator['maintainance']); $stmt->bindParam(':maintainance', $elevator['maintainance']);
$stmt -> bindParam(':facility_kind' ,$elevator['spec']); $stmt->bindParam(':facility_kind', $elevator['spec']);
$stmt -> bindParam(':address' ,$address); $stmt->bindParam(':address', $address);
$stmt -> bindParam(':repairerid' ,$repairerid); $stmt->bindParam(':repairerid', $repairerid);
$stmt -> bindParam(':repairername' ,$repairername); $stmt->bindParam(':repairername', $repairername);
$stmt -> bindParam(':creater' ,$creater); $stmt->bindParam(':creater', $creater);
$stmt -> bindParam(':create_at' ,$create_at); $stmt->bindParam(':create_at', $create_at);
$stmt -> bindParam(':area' ,$area); $stmt->bindParam(':area', $area);
$stmt -> bindParam(':takecertificatedate' ,$elevator['takecertificatedate']); $stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']);
$stmt -> bindParam(':licensedate' ,$elevator['useful_date']); $stmt->bindParam(':licensedate', $elevator['useful_date']);
$result = $stmt -> execute(); $result = $stmt->execute();
} }
//create schedule table //create schedule table
$comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date); $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
$comboArr = json_decode($comboNo->getComboNo(), true); $comboArr = json_decode($comboNo->getComboNo(), true);
foreach($facilityno as $no){ foreach ($facilityno as $no) {
foreach($comboArr as $combo){ 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)'; $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 = $conn->prepare($sql_str);
$stmt -> bindParam(':contractno' ,$contractno); $stmt->bindParam(':contractno', $contractno);
$stmt -> bindParam(':facilityno' ,$no); $stmt->bindParam(':facilityno', $no);
$stmt -> bindParam(':combono' ,$combo[0]); $stmt->bindParam(':combono', $combo[0]);
$stmt -> bindParam(':repairerid' ,$repairerid); $stmt->bindParam(':repairerid', $repairerid);
$stmt -> bindParam(':repairername' ,$repairername); $stmt->bindParam(':repairername', $repairername);
$stmt -> bindParam(':duedate' ,$combo[1]); $stmt->bindParam(':duedate', $combo[1]);
$stmt -> bindParam(':creater' ,$creater); $stmt->bindParam(':creater', $creater);
$stmt -> bindParam(':create_at' ,$create_at); $stmt->bindParam(':create_at', $create_at);
$result = $stmt -> execute(); $result = $stmt->execute();
} }
} }
// create contract_b_signed_back table // create contract_b_signed_back table
$contract_type = $mtype; $contract_type = $mtype;
$company = $customer; $company = $customer;
$customer_no = $vat; $customer_no = $vat;
$salesperson = $salesman; $salesperson = $salesman;
$customer_phone = $phone; $customer_phone = $phone;
$customer_email = $email; $customer_email = $email;
$repairman = $mworker; $repairman = $mworker;
$cycle = $mcycle; $cycle = $mcycle;
$contact_person = $partyA; $contact_person = $partyA;
$contact_address = $partyAaddress; $contact_address = $partyAaddress;
$contact_phone = $partyAphone; $contact_phone = $partyAphone;
$contract_email = $partyAemail; $contract_email = $partyAemail;
$elevators_number = $num; $elevators_number = $num;
$bonus = 1000; $bonus = 1000;
$max_bonus = 2000; $max_bonus = 2000;
if(!empty($files)){ if (!empty($files)) {
$englisharr = range('a', 'z'); $englisharr = range('a', 'z');
$file = $_FILES['files']; $file = $_FILES['files'];
$file_name = $file['name']; $file_name = $file['name'];
$file_type = $file['type']; $file_type = $file['type'];
$tmp_name = $file['tmp_name']; $tmp_name = $file['tmp_name'];
$file_size = $file['size']; $file_size = $file['size'];
$error = $file['error']; $error = $file['error'];
$newfiles = []; $newfiles = [];
foreach( $files as $file ){ foreach ($files as $file) {
$i = 0; //新陣列的索引編號 $i = 0; //新陣列的索引編號
foreach( $file as $key => $val ){ foreach ($file as $key => $val) {
$newfiles[$i]['name'] = $files['name'][$key]; $newfiles[$i]['name'] = $files['name'][$key];
$newfiles[$i]['type'] = $files['type'][$key]; $newfiles[$i]['type'] = $files['type'][$key];
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
$newfiles[$i]['error'] = $files['error'][$key]; $newfiles[$i]['error'] = $files['error'][$key];
$newfiles[$i]['size'] = $files['size'][$key]; $newfiles[$i]['size'] = $files['size'][$key];
$i++; $i++;
} //foreach 第2層 end } //foreach 第2層 end
} }
$max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M) $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型 $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/'; $path = '../images/contracts/';
if (!file_exists($path)) { mkdir($path); } if (!file_exists($path)) {
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 mkdir($path);
$datetime = (string)date('YmdHis'); }
$files_id = 'b' . $datetime; // 保養=>b + 日期時間 $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
foreach( $newfiles as $key => $file ){ $datetime = (string)date('YmdHis');
$randNum = rand(1000,9999); $files_id = 'b' . $datetime; // 保養=>b + 日期時間
$randEnglish = $englisharr[rand(0,25)]; foreach ($newfiles as $key => $file) {
$file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name']; $randNum = rand(1000, 9999);
$msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name ); $randEnglish = $englisharr[rand(0, 25)];
if($msg==1){ $file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
$msg = '檔案傳送成功!'; $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
$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)"; if ($msg == 1) {
$stmt = $conn -> prepare($sql_str); $msg = '檔案傳送成功!';
$stmt -> bindParam(':files_id' ,$files_id); $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 -> bindParam(':file_name' ,$file_name); $stmt = $conn->prepare($sql_str);
$stmt -> bindParam(':file_mime' ,$file['type']); $stmt->bindParam(':files_id', $files_id);
$stmt -> bindParam(':file_size' ,$file['size']); $stmt->bindParam(':file_name', $file_name);
$stmt -> bindParam(':created_at' ,$created_at); $stmt->bindParam(':file_mime', $file['type']);
$stmt -> bindParam(':created_by' ,$user_id); $stmt->bindParam(':file_size', $file['size']);
$stmt ->execute(); $stmt->bindParam(':created_at', $created_at);
} $stmt->bindParam(':created_by', $user_id);
$msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '<br/>'; $stmt->execute();
$src_name = $path.$file['name']; }
if( file_exists($src_name) ){ $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '<br/>';
//副檔名 $src_name = $path . $file['name'];
$extname = pathinfo($src_name, PATHINFO_EXTENSION); if (file_exists($src_name)) {
//主檔名 //副檔名
$basename = basename($src_name, '.'.$extname); $extname = pathinfo($src_name, PATHINFO_EXTENSION);
} //主檔名
$basename = basename($src_name, '.' . $extname);
} }
}else{ }
$files = null; } 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)"; $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)
$stmt = $conn -> prepare($sql_str); 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 -> bindParam(":contract_no",$contractno); $stmt = $conn->prepare($sql_str);
$stmt -> bindParam(":contract_type",$contract_type); $stmt->bindParam(":contract_no", $contractno);
$stmt -> bindParam(":company",$company); $stmt->bindParam(":contract_type", $contract_type);
$stmt -> bindParam(":customer_no",$customer_no); $stmt->bindParam(":company", $company);
$stmt -> bindParam(":salesperson",$salesperson); $stmt->bindParam(":customer_no", $customer_no);
$stmt -> bindParam(":contract_start_date",$contract_begin_date); $stmt->bindParam(":salesperson", $salesperson);
$stmt -> bindParam(":contract_end_date",$contract_end_date); $stmt->bindParam(":contract_start_date", $contract_begin_date);
$stmt -> bindParam(":total_price",$total_price); $stmt->bindParam(":contract_end_date", $contract_end_date);
$stmt -> bindParam(":customer_phone",$customer_phone); $stmt->bindParam(":total_price", $total_price);
$stmt -> bindParam(":customer_email",$customer_email); $stmt->bindParam(":customer_phone", $customer_phone);
$stmt -> bindParam(":repairman",$repairman); $stmt->bindParam(":customer_email", $customer_email);
$stmt -> bindParam(":cycle",$cycle); $stmt->bindParam(":repairman", $repairman);
$stmt -> bindParam(":contact_person",$contact_person); $stmt->bindParam(":cycle", $cycle);
$stmt -> bindParam(":contact_address",$contact_address); $stmt->bindParam(":contact_person", $contact_person);
$stmt -> bindParam(":contact_phone",$contact_phone); $stmt->bindParam(":contact_address", $contact_address);
$stmt -> bindParam(":contact_email",$contact_email); $stmt->bindParam(":contact_phone", $contact_phone);
$stmt -> bindParam(":elevators_number",$elevators_number); $stmt->bindParam(":contact_email", $contact_email);
$stmt -> bindParam(":area",$area); $stmt->bindParam(":elevators_number", $elevators_number);
$stmt -> bindParam(":address",$address); $stmt->bindParam(":area", $area);
$stmt -> bindParam(":files_id",$files_id); $stmt->bindParam(":address", $address);
$stmt -> bindParam(":bonus",$bonus); $stmt->bindParam(":files_id", $files_id);
$stmt -> bindParam(":max_bonus",$max_bonus); $stmt->bindParam(":bonus", $bonus);
$stmt -> bindParam(":created_at", $created_at); $stmt->bindParam(":max_bonus", $max_bonus);
$stmt -> bindParam(":created_by",$user_id); $stmt->bindParam(":created_at", $created_at);
$stmt->bindParam(":created_by", $user_id);
$stmt -> execute();
$stmt->execute();
header('Content-Type: application/json');
// $jsonData = json_encode($files); header('Content-Type: application/json');
// $jsonData = json_encode($files);
$conn->commit();
}catch(PDOException $e){ $conn->commit();
$conn->rollback(); } catch (PDOException $e) {
echo $e->getMessage(); $conn->rollback();
die('Error!:'.$e->getMessage()); echo $e->getMessage();
} die('Error!:' . $e->getMessage());
} }
}
//////////////////////////////
//// 合約簽回(修理) //////////////////////////////
//// //// 合約簽回(修理)
//// 製作人:梓誠 ////
/// 時間 : //// 製作人:梓誠
////////////////////////////// /// 時間 :
if(isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'r'){ //////////////////////////////
try{ if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'r') {
$created_at = date('Y-m-d H:i:s'); try {
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null; $created_at = date('Y-m-d H:i:s');
$company = !empty($_POST['company']) ? $_POST['company'] : null; $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$repairid = !empty($_POST['repairid']) ? $_POST['repairid'] : null; $company = !empty($_POST['company']) ? $_POST['company'] : null;
$facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : null; $repairid = !empty($_POST['repairid']) ? $_POST['repairid'] : null;
$taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null; $facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : null;
$invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null; $taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null; $invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null;
$repair_no = !empty($_POST['repair_no']) ? $_POST['repair_no'] : null; $address = !empty($_POST['address']) ? $_POST['address'] : null;
$total_price= !empty($_POST['total_price']) ? $_POST['total_price'] : null; $repair_no = !empty($_POST['repair_no']) ? $_POST['repair_no'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$type = !empty($_POST['type']) ? $_POST['type'] : null; $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
$sign_date = !empty($_POST['sign_date']) ? $_POST['sign_date']: null; $type = !empty($_POST['type']) ? $_POST['type'] : null;
$sign_date = !empty($_POST['sign_date']) ? $_POST['sign_date'] : null;
$fail_arr = []; $contract_status = !empty($_POST['contract_status']) ? $_POST['contract_status'] : null;
if($contractno === '') return $fail_arr[] = '合約號為必填';
if($repair_no === '') return $fail_arr[] = '報價單編號為必填'; $fail_arr = [];
if($company === '') return $fail_arr[] = '客戶名稱為必填';
// if($taxid === '') return $fail_arr[] = '統一編號為必填'; if (empty($contractno)) $fail_arr[] = '合約號為必填';
if($facilityno === '') return $fail_arr[] = '電梯編號為必填'; if (empty($repair_no)) $fail_arr[] = '報價單編號為必填';
if($address === '') return $fail_arr[] = '工程地址為必填'; if (empty($company)) $fail_arr[] = '客戶名稱為必填';
if($type === '') return $fail_arr[] = '工程類別為必填'; if (empty($repairid)) $fail_arr[] = '為保人員為必填';
if($invoice === '') return $fail_arr[] = '發票抬頭為必填'; // iempty(f($taxid === '') return $fail_arr[] = '統一編號為必填';
if(count($fail_arr)>0){ if (empty($facilityno)) $fail_arr[] = '電梯編號為必填';
header("HTTP/1.1 422 Unprocessable Entity"); if (empty($address)) $fail_arr[] = '工程地址為必填';
echo json_encode($fail_arr); if (empty($type)) $fail_arr[] = '工程類別為必填';
exit(); if (empty($invoice)) $fail_arr[] = '發票抬頭為必填';
} if (empty($taxid)) $fail_arr[] = '統一編號為必填';
// exit(); // echo json_encode($fail_arr);
//create contrac_r_signed_back table // exit;
$conn -> beginTransaction(); if (count($fail_arr) > 0) {
$sql = "INSERT INTO contract_r_signed_back( header("HTTP/1.1 422 Unprocessable Entity");
repair_no, echo json_encode($fail_arr);
contractno, exit();
company, }
taxid, // exit();
facilityno, //create contrac_r_signed_back table
address, $conn->beginTransaction();
type, $sql = "INSERT INTO contract_r_signed_back(
invoice, repair_no,
repaireid, contractno,
total_price, company,
sign_date, taxid,
create_userid, facilityno,
create_date) VALUES( address,
:repair_no, type,
:contractno, invoice,
:company, repaireid,
:taxid, total_price,
:facilityno, sign_date,
:address, contract_status,
:type, create_user,
:invoice, create_date) VALUES(
:repaireid, :repair_no,
:total_price, :contractno,
:sign_date, :company,
:create_userid, :taxid,
:create_date :facilityno,
)"; :address,
$stmt = $conn -> prepare($sql); :type,
$stmt -> bindParam(":repair_no",$repair_no); :invoice,
$stmt -> bindParam(":contractno",$contractno); :repaireid,
$stmt -> bindParam(":company",$company); :total_price,
$stmt -> bindParam(":taxid",$taxid); :sign_date,
$stmt -> bindParam(":facilityno",$facilityno); :contract_status,
$stmt -> bindParam(":address",$address); :create_userid,
$stmt -> bindParam(":type", $type); :create_date
$stmt -> bindParam(":invoice", $invoice); )";
$stmt -> bindParam(":repaireid",$repaireid); $stmt = $conn->prepare($sql);
$stmt -> bindParam(":total_price",$total_price); $stmt->bindParam(":repair_no", $repair_no);
$stmt -> bindParam(":sign_date",$sign_date); $stmt->bindParam(":contractno", $contractno);
$stmt -> bindParam(":create_userid",$user_id); $stmt->bindParam(":company", $company);
$stmt -> bindParam("create_date",$created_at); $stmt->bindParam(":taxid", $taxid);
$stmt->bindParam(":facilityno", $facilityno);
$stmt -> execute(); $stmt->bindParam(":address", $address);
header('Content-Type: application/json'); $stmt->bindParam(":type", $type);
// $jsonData = json_encode($files); $stmt->bindParam(":invoice", $invoice);
$stmt->bindParam(":repaireid", $repaireid);
$conn -> commit(); $stmt->bindParam(":total_price", $total_price);
}catch(PDOException $e){ $stmt->bindParam(":sign_date", $sign_date);
$conn -> rollback(); $stmt->bindParam(":contract_status", $contract_status);
echo $e->getMessage(); $stmt->bindParam(":create_userid", $user_id);
die('Error!' .$e->getMessage()); $stmt->bindParam("create_date", $created_at);
}
} $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());
}
}

364
wms/contract-repair/api/putContractData.php

@ -1,174 +1,190 @@
<?php <?php
require_once("../conn.php"); require_once("../conn.php");
include_once("./upload_chk.php"); include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' ); ini_set('date.timezone', 'Asia/Taipei');
// echo json_encode(explode(',', $_POST['deletefiles'])); // echo json_encode(explode(',', $_POST['deletefiles']));
if(isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_POST["id"]) && $_POST['id']!=""){ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_POST["id"]) && $_POST['id'] != "") {
try{ try {
$create_date = date('Y-m-d H:i:s'); $create_date = date('Y-m-d H:i:s');
$repair_no = !empty($POST['repair_no']) ? $_POST['repair_no'] : null; $repair_no = !empty($POST['repair_no']) ? $_POST['repair_no'] : null;
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null; $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$company = !empty($_POST['company']) ? $_POST['conpany'] : null; $company = !empty($_POST['company']) ? $_POST['company'] : null;
$taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null; $taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null;
$facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : null; $facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null; $address = !empty($_POST['address']) ? $_POST['address'] : null;
$type = !empty($_POST['type']) ? $_POST['type'] : null; $type = !empty($_POST['type']) ? $_POST['type'] : null;
$invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null; $invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null;
$repaireid = !empty($_POST['repaireid']) ? $_POST['repaireid'] : null; $repaireid = !empty($_POST['repaireid']) ? $_POST['repaireid'] : null;
// $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null; $contract_status = !empty($_POST['contract_status']) ? $_POST['contract_status'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null; // $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
$fail_arr = [];
if(empty($repair_no)) $fail_arr[] = '號為必填'; $fail_arr = [];
if(empty($contractno)) $fail_arr[] = '合約號為必填'; // if (empty($repair_no)) $fail_arr[] = '號為必填';
if(empty($company)) $fail_arr[] = '客戶名稱為必填'; if (empty($contractno)) $fail_arr[] = '合約號為必填';
if(empty($taxid)) $fail_arr[] = '統一編號為必填'; if (empty($company)) $fail_arr[] = '客戶名稱為必填';
if(empty($facilityno)) $fail_arr[] = '電梯號為必填'; if (empty($taxid)) $fail_arr[] = '統一編號為必填';
if(empty($address)) $fail_arr[] = '工程地址為必填'; if (empty($facilityno)) $fail_arr[] = '電梯號為必填';
if(empty($type)) $fail_arr[] = '工程類行為必填'; if (empty($address)) $fail_arr[] = '工程地址為必填';
if(empty($invoice)) $fail_arr[] = '發票抬頭為必填'; if (empty($type)) $fail_arr[] = '工程類行為必填';
if(empty($repaireid)) $fail_arr[] = '維修人員為必填'; if (empty($invoice)) $fail_arr[] = '發票抬頭為必填';
if(count($fail_arr) > 0){ if (empty($repaireid)) $fail_arr[] = '維修人員為必填';
header("HTTP/1.1 442 Unprocessable Entity"); if (empty($contract_status)) $fail_arr[] = '工程類別為必填';
echo json_encode($fail_arr); if (count($fail_arr) > 0) {
exit(); header("HTTP/1.1 442 Unprocessable Entity");
} echo json_encode($fail_arr);
$conn -> beginTransaction(); exit();
}
// $conn->beginTransaction();
}catch(PDOException $e){
$conn->rollback(); $sql = "UPDATE contract_r_signed_back SET
header("HTTPP/1.1 500 Internal Server Error"); repaireid = :repaireid,facilityno= :facilityno, invoice=:invoice, taxid=:taxid, address=:address,type=:type,contract_status=:contract_status,update_user=:update_user,update_date=:update_date
die('Error!:' .$e->getMessage()); WHERE id = :id";
}
} $stmt = $conn->prepare($sql);
if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]) && $_POST['id']!=""){ $stmt->bindParam(':repaireid', $repaireid);
try{ $stmt->bindParam(':facilityno', $facilityno);
$created_at = date('Y-m-d H:i:s'); $stmt->bindParam(':invoice', $invoice);
$created_by = $_POST['user_id']; $stmt->bindParam(':taxid', $taxid);
$id = $_POST["id"]; $stmt->bindParam(':address', $address);
$contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null; $stmt->bindParam(':type', $type);
$customer = !empty($_POST['customer']) ? $_POST['customer'] : null; $stmt->bindParam(':contract_status', $contract_status);
$manager = !empty($_POST['manager']) ? $_POST['manager'] : null; $stmt->bindParam(':update_user', $user_id);
$vat = !empty($_POST['vat']) ? $_POST['vat'] : null; $stmt->bindParam(':update_date', $create_date);
$case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null;
$linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null; $stmt->bindParam(':id', $_POST['id']);
$lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null; // echo json_encode($sql);
$address = !empty($_POST['address']) ? $_POST['address'] : null; // exit;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null; $stmt->execute();
$qc = !empty($_POST['qc']) ? $_POST['qc'] : null; // header("HTTP/1.1 204 NO Content");
$deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
$files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null; // $conn->commit();
$files = !empty($_FILES['files']) ? $_FILES['files'] : null; } catch (PDOException $e) {
// $conn->rollback();
$deletefilesArr = explode(',', $_POST['deletefiles']); header("HTTPP/1.1 500 Internal Server Error");
die('Error!:' . $e->getMessage());
$fail_arr = []; }
if(empty($contract_no)) $fail_arr[] = '合約號為必填'; }
if(empty($customer)) $fail_arr[] = '客戶名稱為必填'; // if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST["id"]) && $_POST['id'] != "") {
if(empty($manager)) $fail_arr[] = '負責人為必填'; // try {
if(empty($vat)) $fail_arr[] = '統編/身分證為必填'; // $created_at = date('Y-m-d H:i:s');
if(empty($case_name)) $fail_arr[] = '案名為必填'; // $created_by = $_POST['user_id'];
if(empty($linkman)) $fail_arr[] = '聯絡人為必填'; // $id = $_POST["id"];
if(empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填'; // $contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
if(empty($address)) $fail_arr[] = '地址為必填'; // $customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
if(empty($salesman)) $fail_arr[] = '營業員為必填'; // $manager = !empty($_POST['manager']) ? $_POST['manager'] : null;
if(empty($qc)) $fail_arr[] = '請選擇QC或管檢'; // $vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
if(count($fail_arr) > 0) { // $case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null;
header("HTTP/1.1 422 Unprocessable Entity"); // $linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null;
echo json_encode($fail_arr); // $lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null;
exit(); // $address = !empty($_POST['address']) ? $_POST['address'] : null;
} // $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
// $qc = !empty($_POST['qc']) ? $_POST['qc'] : null;
$conn->beginTransaction(); // $deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
// $files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null;
$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"; // $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contract_no' ,$contract_no); // $deletefilesArr = explode(',', $_POST['deletefiles']);
$stmt -> bindParam(':customer' ,$customer);
$stmt -> bindParam(':manager' ,$manager); // $fail_arr = [];
$stmt -> bindParam(':vat' ,$vat); // if (empty($contract_no)) $fail_arr[] = '合約號為必填';
$stmt -> bindParam(':case_name' ,$case_name); // if (empty($customer)) $fail_arr[] = '客戶名稱為必填';
$stmt -> bindParam(':linkman' ,$linkman); // if (empty($manager)) $fail_arr[] = '負責人為必填';
$stmt -> bindParam(':lm_tel' ,$lm_tel); // if (empty($vat)) $fail_arr[] = '統編/身分證為必填';
$stmt -> bindParam(':address' ,$address); // if (empty($case_name)) $fail_arr[] = '案名為必填';
$stmt -> bindParam(':salesman' ,$salesman); // if (empty($linkman)) $fail_arr[] = '聯絡人為必填';
$stmt -> bindParam(':qc' ,$qc); // if (empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
$stmt -> bindParam(':id' ,$id); // if (empty($address)) $fail_arr[] = '地址為必填';
$stmt -> execute(); // if (empty($salesman)) $fail_arr[] = '營業員為必填';
if(!empty($deletefiles)){ // if (empty($qc)) $fail_arr[] = '請選擇QC或管檢';
$sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)"; // if (count($fail_arr) > 0) {
$stmt = $conn -> prepare($sql_str); // header("HTTP/1.1 422 Unprocessable Entity");
$stmt -> execute(); // echo json_encode($fail_arr);
} // exit();
// }
if(!empty($files)){
$englisharr = range('a', 'z'); // $conn->beginTransaction();
$files = $_FILES['files'];
$newfiles = []; // $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";
foreach( $files as $file ){ // $stmt = $conn->prepare($sql_str);
$i = 0; //新陣列的索引編號 // $stmt->bindParam(':contract_no', $contract_no);
foreach( $file as $key => $val ){ // $stmt->bindParam(':customer', $customer);
$newfiles[$i]['name'] = $files['name'][$key]; // $stmt->bindParam(':manager', $manager);
$newfiles[$i]['type'] = $files['type'][$key]; // $stmt->bindParam(':vat', $vat);
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; // $stmt->bindParam(':case_name', $case_name);
$newfiles[$i]['error'] = $files['error'][$key]; // $stmt->bindParam(':linkman', $linkman);
$newfiles[$i]['size'] = $files['size'][$key]; // $stmt->bindParam(':lm_tel', $lm_tel);
$i++; // $stmt->bindParam(':address', $address);
} //foreach 第2層 end // $stmt->bindParam(':salesman', $salesman);
} // $stmt->bindParam(':qc', $qc);
$max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M) // $stmt->bindParam(':id', $id);
$allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型 // $stmt->execute();
$path = '../images/contracts/'; // if (!empty($deletefiles)) {
if (!file_exists($path)) { mkdir($path); } // $sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)";
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 // $stmt = $conn->prepare($sql_str);
$datetime = (string)date('YmdHis'); // $stmt->execute();
$files_id = ($files_id !== null ) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間 // }
foreach( $newfiles as $key => $file ){
$randNum = rand(1000,9999); // if (!empty($files)) {
$randEnglish = $englisharr[rand(0,25)]; // $englisharr = range('a', 'z');
$file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name']; // $files = $_FILES['files'];
$msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name ); // $newfiles = [];
if($msg==1){ // foreach ($files as $file) {
$msg = '檔案傳送成功!'; // $i = 0; //新陣列的索引編號
$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)"; // foreach ($file as $key => $val) {
$stmt = $conn -> prepare($sql_str); // $newfiles[$i]['name'] = $files['name'][$key];
$stmt -> bindParam(':files_id' ,$files_id); // $newfiles[$i]['type'] = $files['type'][$key];
$stmt -> bindParam(':file_name' ,$file_name); // $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
$stmt -> bindParam(':file_mime' ,$file['type']); // $newfiles[$i]['error'] = $files['error'][$key];
$stmt -> bindParam(':file_size' ,$file['size']); // $newfiles[$i]['size'] = $files['size'][$key];
$stmt -> bindParam(':created_at' ,$created_at); // $i++;
$stmt -> bindParam(':created_by' ,$created_by); // } //foreach 第2層 end
$stmt ->execute(); // }
}else{ // $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
throw new PDOException('檔案上傳失敗:' . $msg); // $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
} // $path = '../images/contracts/';
$msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '<br/>'; // if (!file_exists($path)) {
$src_name = $path.$file['name']; // mkdir($path);
if( file_exists($src_name) ){ // }
//副檔名 // $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$extname = pathinfo($src_name, PATHINFO_EXTENSION); // $datetime = (string)date('YmdHis');
//主檔名 // $files_id = ($files_id !== null) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間
$basename = basename($src_name, '.'.$extname); // foreach ($newfiles as $key => $file) {
} // $randNum = rand(1000, 9999);
} // $randEnglish = $englisharr[rand(0, 25)];
}else{ // $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
$files = null; // $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
} // if ($msg == 1) {
// $msg = '檔案傳送成功!';
$conn->commit(); // $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)";
}catch(PDOException $e) { // $stmt = $conn->prepare($sql_str);
$conn->rollback(); // $stmt->bindParam(':files_id', $files_id);
header("HTTP/1.1 500 Internal Server Error"); // $stmt->bindParam(':file_name', $file_name);
die('Error!:'.$e->getMessage()); // $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 . '<br/>';
// $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());
// }
// }

404
wms/contract-repair/contract-repair-edit.php

@ -1,196 +1,210 @@
<?php <?php
include("../header.php"); include("../header.php");
require_once("./conn.php"); require_once("./conn.php");
$id = $_GET['contractid']; $id = $_GET['contractid'];
$sql_str = "SELECT * FROM contract_r_signed_back WHERE id = :id ORDER BY id DESC"; $sql_str = "SELECT * FROM contract_r_signed_back WHERE id = :id ORDER BY id DESC";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':id', $id); $stmt->bindParam(':id', $id);
$stmt->execute(); $stmt->execute();
$contract = $stmt->fetch(PDO::FETCH_ASSOC); $contract = $stmt->fetch(PDO::FETCH_ASSOC);
// echo '<pre>'; // echo '<pre>';
// print_r($contract); // print_r($contract);
// echo '</pre>'; // echo '</pre>';
// $files_id = $contract['files_id']; // $files_id = $contract['files_id'];
// $sql_str = "SELECT * FROM contract_back_files WHERE files_id = :files_id "; // $sql_str = "SELECT * FROM contract_back_files WHERE files_id = :files_id ";
// $stmt = $conn->prepare($sql_str); // $stmt = $conn->prepare($sql_str);
// $stmt->bindParam(':files_id', $files_id); // $stmt->bindParam(':files_id', $files_id);
// $stmt->execute(); // $stmt->execute();
// $files= $stmt->fetchAll(PDO::FETCH_ASSOC); // $files= $stmt->fetchAll(PDO::FETCH_ASSOC);
// $files = json_encode($files); // $files = json_encode($files);
$accounttype = "M"; $accounttype = "M";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype"; $sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(":accounttype", $accounttype); $stmt->bindParam(":accounttype", $accounttype);
$stmt->execute(); $stmt->execute();
$persons = $stmt->fetchAll(PDO::FETCH_ASSOC); $persons = $stmt->fetchAll(PDO::FETCH_ASSOC);
$persons = array_map(function ($person) { $persons = array_map(function ($person) {
return [ return [
'view' => $person['accountid'] . '-' . $person['name'], 'view' => $person['accountid'] . '-' . $person['name'],
'value' => $person['accountid'], 'value' => $person['accountid'],
'name' => $person['name'] 'name' => $person['name']
]; ];
}, $persons); }, $persons);
?> $contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"];
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script defer src="./js/alpinejs/cdn.min.js"></script> ?>
<script src="./js/axios/axios.min.js"></script> <link rel="stylesheet" href="./styles/style.css">
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> <link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script> <script defer src="./js/alpinejs/cdn.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" /> <script src="./js/axios/axios.min.js"></script>
<div class="contract-management" x-data='contract_edit'> <!-- <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> -->
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="main_form" /> <script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
<div> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead> <div class="contract-management" x-data='contract_edit'>
<tr> <div class="form" method="post" id="form" enctype="multipart/form-data">
<td colspan="8"> <input type="hidden" name='form_name' value="main_form" />
<h3 style='text-align:center'>合約管理(修理)</h3> <div>
</td> <table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
</tr> <thead>
</thead> <tr>
<td colspan="8">
<tbody style="font-weight: bolder;margin-bottom: 20px"> <h3 style='text-align:center'>合約管理(修理)</h3>
<tr> </td>
<td colspan="7" style='vertical-align: middle;border-right:0px;'> </tr>
<h4>檢視合約</h4> </thead>
</td>
<td class="text-right" style='border-left:0px;'> <tbody style="font-weight: bolder;margin-bottom: 20px">
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button> <tr>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button> <td colspan="7" style='vertical-align: middle;border-right:0px;'>
</td> <h4>檢視合約</h4>
</tr> </td>
<tr> <td class="text-right" style='border-left:0px;'>
<td style="vertical-align: middle">立約人</td> <button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button>
<td> <button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button>
<input class="form-control disabled_select" type="text" x-model="data.company"> </td>
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> </tr>
</td> <tr>
<td style="vertical-align: middle">立約人</td>
<td style="vertical-align: middle">維保人員</td> <td>
<td style="vertical-align: middle"> <input class="form-control disabled_select" type="text" x-model="data.company">
<select class="repaireid" id="repaireid" x-model="data.repaireid"> <p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<option value="">選擇營業員</option> </td>
<?php foreach ($persons as $person) : ?>
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option> <td style="vertical-align: middle">維保人員</td>
<?php endforeach ?> <td style="vertical-align: middle">
</select> <select class="repaireid" id="repaireid" x-model="data.repaireid">
<p class="alerttext" x-show="data.repaireid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <option value="">選擇營業員</option>
</td> <?php foreach ($persons as $person) : ?>
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option>
<td style="vertical-align: middle">電梯編號</td> <?php endforeach ?>
<td> </select>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.facilityno"> <p class="alerttext" x-show="data.repaireid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> </td>
</td>
<td style="vertical-align: middle">電梯編號</td>
<td style="vertical-align: middle">報價單編號</td> <td>
<td> <input class="form-control disabled_select" type="text" name="uscc" x-model="data.facilityno">
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.repair_no"> <p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> </td>
</td>
</tr> <td style="vertical-align: middle">報價單編號</td>
<tr> <td>
<td style="vertical-align: middle">工程類別</td> <input class="form-control disabled_select" type="text" name="uscc" x-model="data.repair_no">
<td> <p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.type"> </td>
<p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> </tr>
</td> <tr>
<td style="vertical-align: middle">簽訂時間</td> <td style="vertical-align: middle">工程類別</td>
<td> <td>
<input class="form-control disabled_select" type="text" name="sign_date" x-model="data.sign_date"> <input class="form-control disabled_select" type="text" name="uscc" x-model="data.type">
<p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">發票抬頭</td> <td style="vertical-align: middle">簽訂時間</td>
<td> <td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.invoice"> <input class="form-control disabled_select" type="text" name="sign_date" x-model="data.sign_date">
<p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">統一編號</td> <td style="vertical-align: middle">發票抬頭</td>
<td> <td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.taxid"> <input class="form-control disabled_select" type="text" name="uscc" x-model="data.invoice">
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
</tr> <td style="vertical-align: middle">統一編號</td>
<tr> <td>
<td style="vertical-align: middle">工程地址</td> <input class="form-control disabled_select" type="text" x-model="data.taxid">
<td colspan=3> <p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.address"> </td>
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> </tr>
</td> <tr>
<!-- <td style="vertical-align: middle">附件上傳</td> <td style="vertical-align: middle">工程地址</td>
<td colspan=3> <td colspan=3>
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" /> <input class="form-control disabled_select" type="text" x-model="data.address">
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> --> </td>
<td></td> <!-- <td style="vertical-align: middle">附件上傳</td>
<td></td> <td colspan=3>
<td></td> <input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
<td></td> <p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</tr> </td> -->
<!-- <tr> <td style="vertical-align: middle">工程進度</td>
<td style="vertical-align: middle">附件</td> <td style="vertical-align: middle">
<td colspan=7> <select class="contract_status" id="contract_status" x-model="data.contract_status">
<div class="images"> <?php foreach ($contract_stauts as $key => $status) : ?>
<template x-for="file in data.files" :key="file.id"> <option value="<?php echo $key + 1; ?>"><?php echo $status; ?></option>
<div class="image"> <?php endforeach ?>
<a :href="'./images/contracts/' + file.file_name" data-fancybox="gallery" :data-src="'./images/contracts/' + file.file_name" data-caption=""> </select>
<img :src="'./images/contracts/' + file.file_name" /> <p class="alerttext" x-show="data.contract_status==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</a> </td>
<i class="fas fa-times" @click="deleteFileFn(file.id)"></i>
</div> <td></td>
</template> <td></td>
</div> </tr>
<!-- <tr>
</td> <td style="vertical-align: middle">附件</td>
</tr> --> <td colspan=7>
<div class="images">
<template x-for="file in data.files" :key="file.id">
</tbody> <div class="image">
</table> <a :href="'./images/contracts/' + file.file_name" data-fancybox="gallery" :data-src="'./images/contracts/' + file.file_name" data-caption="">
<button @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> <img :src="'./images/contracts/' + file.file_name" />
<template x-if="!isLoading"> </a>
<span>更新</span> <i class="fas fa-times" @click="deleteFileFn(file.id)"></i>
</template> </div>
<template x-if="isLoading"> </template>
<div class="loader"></div> </div>
</template>
</button> </td>
<button type="button" class="btn btn-primary btn-lg pull-right savebtn" @click="window.location.href='./contract-repair-management.php?<?php echo $token_link; ?>'">回列表</button> </tr> -->
</div>
</div>
</div> </tbody>
</table>
<button @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<script src="./js/jquery/jquery-3.1.1.min.js"></script> <template x-if="!isLoading">
<script src="semantic/dist/semantic.min.js"></script> <span>更新</span>
<script src="./js/alpine.js"></script> </template>
<script> <template x-if="isLoading">
const user_id = '<?php echo $user_id; ?>'; <div class="loader"></div>
const user_name = '<?php echo $user_name; ?>'; </template>
const id = <?php echo $contract['id'] ?>; </button>
const repair_no = '<?php echo $contract['repair_no']; ?>' <button type="button" class="btn btn-primary btn-lg pull-right savebtn" @click="window.location.href='./contract-repair-management.php?<?php echo $token_link; ?>'">回列表</button>
const contractno = '<?php echo $contract['contractno']; ?>' </div>
const company = '<?php echo $contract['company']; ?>' </div>
const taxid = '<?php echo $contract['taxid']; ?>' </div>
const facilityno = '<?php echo $contract['facilityno']; ?>'
const address = '<?php echo $contract['address']; ?>'
const type = '<?php echo $contract['type']; ?>' <script src="./js/jquery/jquery-3.1.1.min.js"></script>
const invoice = '<?php echo $contract['invoice']; ?>' <script src="semantic/dist/semantic.min.js"></script>
const repaireid = '<?php echo $contract['repaireid']; ?>' <script src="./js/alpine.js"></script>
const total_price = '<?php echo $contract['total_price']; ?>' <script>
const sign_date = '<?php echo $contract['sign_date']; ?>' const user_id = '<?php echo $user_id; ?>';
// $('#table_index').DataTable( const user_name = '<?php echo $user_name; ?>';
// { const id = <?php echo $contract['id'] ?>;
// "order": [ const repair_no = '<?php echo $contract['repair_no']; ?>';
// [0, "desc"], const contractno = '<?php echo $contract['contractno']; ?>';
// ] const company = '<?php echo $contract['company']; ?>';
// } const taxid = '<?php echo $contract['taxid']; ?>';
// ); const facilityno = '<?php echo $contract['facilityno']; ?>';
// Fancybox.bind('[data-fancybox="gallery"]', { const address = '<?php echo $contract['address']; ?>';
const type = '<?php echo $contract['type']; ?>';
// }); const repaireid = '<?php echo $contract['repaireid']; ?>';
const total_price = '<?php echo $contract['total_price']; ?>';
const sign_date = '<?php echo $contract['sign_date']; ?>';
const invoice = '<?php echo $contract['invoice']; ?>'
const contract_status = '<?php echo $contract['contract_status']; ?>'
// $('#table_index').DataTable(
// {
// "order": [
// [0, "desc"],
// ]
// }
// );
// Fancybox.bind('[data-fancybox="gallery"]', {
// });
</script> </script>

358
wms/contract-repair/contract-repair-input.php

@ -1,187 +1,173 @@
<?php <?php
include("../header.php"); include("../header.php");
require_once("./conn.php"); require_once("./conn.php");
include_once("./api/getFacilityNo.php"); include_once("./api/getFacilityNo.php");
$accounttype = "B"; $accounttype = "B";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype"; $sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accounttype',$accounttype); $stmt->bindParam(':accounttype', $accounttype);
$stmt->execute(); $stmt->execute();
$workers = $stmt->fetchAll(PDO::FETCH_ASSOC); $workers = $stmt->fetchAll(PDO::FETCH_ASSOC);
$accounttype = "M"; $accounttype = "M";
$sql_str = "SELECT id,accountid, name FROM account WHERE accounttype = :accounttype"; $sql_str = "SELECT id,accountid, name FROM account WHERE accounttype = :accounttype";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accounttype',$accounttype); $stmt->bindParam(':accounttype', $accounttype);
$stmt->execute(); $stmt->execute();
$contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC); $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<link rel="stylesheet" href="./styles/style.css"> $contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"];
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> ?>
<script defer src="./js/alpinejs/cdn.min.js"></script> <link rel="stylesheet" href="./styles/style.css">
<script src="./js/axios/axios.min.js" ></script> <link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<div class="contract-input-component" x-data="contractRepair"> <script defer src="./js/alpinejs/cdn.min.js"></script>
<div class="form" method="post" id="form" enctype="multipart/form-data" > <script src="./js/axios/axios.min.js"></script>
<input type="hidden" name='form_name' value="main_form" />
<div> <div class="contract-input-component" x-data="contractRepair">
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> <div class="form" method="post" id="form" enctype="multipart/form-data">
<thead> <input type="hidden" name='form_name' value="main_form" />
<tr> <div>
<td colspan="8"> <table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<h3 style='text-align:center'>合約入力(修理)</h3> <thead>
</td> <tr>
</tr> <td colspan="8">
</thead> <h3 style='text-align:center'>合約入力(修理)</h3>
<template x-if="step==1"> </td>
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1"> </tr>
<tr> </thead>
<td style="vertical-align: middle">合約號</td> <template x-if="step==1">
<td colspan="5"> <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1">
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno" > <tr>
<td style="vertical-align: middle">合約號</td>
</td> <td colspan="5">
<td colspan="2" style="vertical-align: middle"> <input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno">
<label for="customize">
<input type="checkbox" x-model="customize" id="customize" />自定義欄位 </td>
</label> <td colspan="2" style="vertical-align: middle">
</td> <label for="customize">
<input type="checkbox" x-model="customize" id="customize" />自定義欄位
</tr> </label>
</tbody> </td>
</template>
<template x-if="step==2"> </tr>
<!-- <template x-if="step==1"> --> </tbody>
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==2"> </template>
<!-- <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1"> --> <template x-if="step==2">
<tr> <!-- <template x-if="step==1"> -->
<td colspan="7" style='vertical-align: middle;border-right:0px;'> <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==2">
<h4>業務確認項</h4> <!-- <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1"> -->
</td> <tr>
<td class="text-right" style='border-left:0px;'> <td colspan="7" style='vertical-align: middle;border-right:0px;'>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button> <h4>業務確認項</h4>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button> </td>
</td> <td class="text-right" style='border-left:0px;'>
</tr> <button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button>
<tr> <button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button>
<td style="vertical-align: middle">立約人</td> </td>
<td> </tr>
<input type="text" x-model="data.company"/> <tr>
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td style="vertical-align: middle">立約人</td>
</td> <td>
<td style="vertical-align: middle">維保人員</td> <input type="text" x-model="data.company" />
<td> <p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input type="text" x-model="data.repairer" /> </td>
<p class="alerttext" x-show="data.repairer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td style="vertical-align: middle">維保人員</td>
</td> <td>
<td style="vertical-align: middle">電梯編號</td> <input type="text" x-model="data.repairer" />
<td> <p class="alerttext" x-show="data.repairer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input class="form-control disabled_select" type="text" name="facilityno" x-model="data.facilityno" > </td>
<p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td style="vertical-align: middle">電梯編號</td>
</td> <td>
<td style="vertical-align: middle">工程地址</td> <input class="form-control disabled_select" type="text" name="facilityno" x-model="data.facilityno">
<td> <p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input class="form-control disabled_select" type="text" name="address" x-model="data.address" > </td>
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td style="vertical-align: middle">報價單編號</td>
</td> <td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" name="repair_no" x-model="data.repair_no" disabled="disabled">
</tr> <p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<tr> </td>
<td style="vertical-align: middle">工程類別</td> </tr>
<td> <tr>
<input class="form-control disabled_select" type="text" name="type" x-model="data.type" > <td style="vertical-align: middle">工程進度</td>
<p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td>
</td> <input class="form-control disabled_select" type="text" name="type" x-model="data.type">
<p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<td style="vertical-align: middle">簽訂時間</td> </td>
<td>
<input class="form-control disabled_select" type="date" name="sign_date" x-model="data.sign_date" > <td style="vertical-align: middle">簽訂時間</td>
<p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td>
</td> <input class="form-control disabled_select" type="date" name="sign_date" x-model="data.sign_date">
<td style="vertical-align: middle">發票抬頭</td> <p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<td> </td>
<input class="form-control disabled_select" type="text" name="invoice" x-model="data.invoice" > <td style="vertical-align: middle">發票抬頭</td>
<p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td>
</td> <input class="form-control disabled_select" type="text" name="invoice" x-model="data.invoice">
<td style="vertical-align: middle">統一編號</td> <p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<td> </td>
<input class="form-control disabled_select" type="text" name="taxid" x-model="data.taxid" > <td style="vertical-align: middle">統一編號</td>
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td>
</td> <input class="form-control disabled_select" type="text" name="taxid" x-model="data.taxid">
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<!-- <td style="vertical-align: middle">維修型態</td> <tr>
<td style="vertical-align: middle"> <td style="vertical-align: middle">工程地址</td>
<select class="ui search dropdown" name="" x-model="data.mtype"> <td colspan=3>
<option value="" >選擇維修型態</option> <input class="form-control disabled_select" type="text" x-model="data.address">
<option value="A">定期保養</option> <p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</select> </td>
<p class="alerttext" x-show="data.mtype==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> --> <td style="vertical-align: middle">工程確認</td>
<td style="vertical-align: middle">
<!-- <td></td> --> <select class="contract_status" id="contract_status" x-model="data.contract_status">
<!-- <td></td> --> <?php foreach ($contract_stauts as $key => $status) : ?>
</tr> <option value="<?php echo $key + 1; ?>"><?php echo $status; ?></option>
<tr> <?php endforeach ?>
<!-- <td style="vertical-align: middle">維修人員</td> </select>
<td> <!-- <p class="alerttext" x-show="data.contract_status==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> -->
<input class="form-control disabled_select" type="text" name="repairer" x-model="data.repairer" > </td>
<p class="alerttext" x-show="data.repairer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <td></td>
</td> --> <td></td>
<td style="vertical-align: middle">報價單編號</td> </tr>
<td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" name="repair_no" x-model="data.repair_no" disabled="disabled"> </tbody>
<p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> </template>
</td> </table>
<td style="vertical-align: middle">附件</td>
<td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" /> <button x-show="step==2" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
</td> <template x-if="!isLoading">
<td></td> <span>存檔</span>
</tr> </template>
<template x-if="isLoading">
<div class="loader"></div>
<tr> </template>
</button>
</tr> <button x-show="step<=1" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
</tbody> <template x-if="!isLoading">
</template> <span>下一步</span>
</table> </template>
<template x-if="isLoading">
<div class="loader"></div>
<button x-show="step==2" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> </template>
<template x-if="!isLoading"> </button>
<span>存檔</span> <button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
</template> <template x-if="!isLoading">
<template x-if="isLoading"> <span>上一步</span>
<div class="loader"></div> </template>
</template> <template x-if="isLoading">
</button> <div class="loader"></div>
<button x-show="step<=1" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading"> </template>
<template x-if="!isLoading"> </button>
<span>下一步</span> </div>
</template> </div>
<template x-if="isLoading">
<div class="loader"></div> </div>
</template> <script src="./js/jquery/jquery-3.1.1.min.js"></script>
</button> <script src="semantic/dist/semantic.min.js"></script>
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> <script src="./js/alpine.js"></script>
<template x-if="!isLoading"> <script>
<span>上一步</span> const user_id = '<?php echo $user_id; ?>'
</template> const user_name = '<?php echo $user_name; ?>'
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
</div>
</div>
</div>
<script src="./js/jquery/jquery-3.1.1.min.js"></script>
<script src="semantic/dist/semantic.min.js" ></script>
<script src="./js/alpine.js"></script>
<script>
const user_id = '<?php echo $user_id; ?>'
const user_name = '<?php echo $user_name; ?>'
</script> </script>

248
wms/contract-repair/contract-repair-management.php

@ -1,119 +1,131 @@
<?php <?php
include("../header.php"); include("../header.php");
require_once("./conn.php"); require_once("./conn.php");
$sql_str = "SELECT * FROM contract_r_signed_back WHERE 1=1 AND delete_status = 1 ORDER BY id DESC"; $sql_str = "SELECT * FROM contract_r_signed_back WHERE 1=1 AND delete_status = 1 ORDER BY id DESC";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->execute(); $stmt->execute();
$contracts= $stmt->fetchAll(PDO::FETCH_ASSOC); $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
?> ?>
<link rel="stylesheet" href="./styles/style.css"> <link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css"> <link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script defer src="./js/alpinejs/cdn.min.js"></script> <script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js"></script> <script src="./js/axios/axios.min.js"></script>
<div class="contract-management" x-data="{ <div class="contract-management" x-data="{
deleteFn(id,user){ deleteFn(id,user){
if(confirm('確定要刪除嗎?')){ if(confirm('確定要刪除嗎?')){
axios.get('./api/deleteNewContractData.php?contracttype=r&contractid='+id+'&user_id='+user).then(res=> { axios.get('./api/deleteNewContractData.php?contracttype=r&contractid='+id+'&user_id='+user).then(res=> {
console.log(res); console.log(res);
if(res.status === 204){ if(res.status === 204){
alert('刪除成功!') alert('刪除成功!')
location.reload(); location.reload();
} }
}) })
} }
} }
}"> }">
<div style="overflow-x:auto;margin-top:12px"> <div style="overflow-x:auto;margin-top:12px">
<a href="contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> <a href="contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
</a> </a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> <table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead> <thead>
<tr> <tr>
<th>項次</th> <th>項次</th>
<th>合約號</th> <th>合約號</th>
<th>客戶名稱</th> <th>客戶名稱</th>
<th>統編</th> <th>統編</th>
<th>總金額</th> <th>總金額</th>
<th>建檔者</th> <th>工程進度</th>
<th>建立時間</th> <th>建檔者</th>
<th>操作</th> <th>建立時間</th>
</tr> <th>操作</th>
</thead> </tr>
<tbody> </thead>
<?php foreach($contracts as $key => $contract): ?> <tbody>
<tr> <?php foreach ($contracts as $key => $contract) : ?>
<td><?php echo $contract['id']; ?></td> <tr>
<td><?php echo $contract['contractno'] ?></td> <td><?php echo $contract['id']; ?></td>
<td><?php echo $contract['company'] ?></td> <td><?php echo $contract['contractno'] ?></td>
<td><?php echo $contract['taxid'] ?></td> <td><?php echo $contract['company'] ?></td>
<td><?php echo $contract['total_price']?></td> <td><?php echo $contract['taxid'] ?></td>
<td><?php echo $contract['create_userid'] ?></td> <td><?php echo $contract['total_price'] ?></td>
<td><?php echo $contract['create_date'] ?></td> <th><?php if ($contract['contract_status'] == 1) {
<td style="width:30px"> echo '合約簽回';
<p> } else if ($contract['contract_status'] == 2) {
<a href="contract-repair-edit.php?&contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> echo '採購';
<span class="glyphicon glyphicon-pencil"></span> } else if ($contract['contract_status'] == 3) {
</a> echo '工程發包';
<a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>,'<?php echo $user_id;?>')"> } else if ($contract['contract_status'] == 4) {
<span class="glyphicon glyphicon-remove"></span> echo '工程中';
</a> } else if ($contract['contract_status'] == 5) {
</p> echo '修理完成';
</td> }
</tr> ?></th>
<?php endforeach ?> <td><?php echo $contract['create_user'] ?></td>
</tbody> <td><?php echo $contract['create_date'] ?></td>
</table> <td style="width:30px">
</div> <p>
</div> <a href="contract-repair-edit.php?&contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
<style> </a>
table { <a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>,'<?php echo $user_id; ?>')">
table-layout:fixed; <span class="glyphicon glyphicon-remove"></span>
width: 100%; </a>
} </p>
</td>
td { </tr>
word-wrap:break-word; <?php endforeach ?>
} </tbody>
</table>
img { </div>
width:125px; </div>
}
<style>
.width_style_1 { table {
width:125px; table-layout: fixed;
} width: 100%;
}
table{
width:100%; td {
} word-wrap: break-word;
#table_index_filter{ }
float:right;
} img {
#table_index_paginate{ width: 125px;
float:right; }
}
label { .width_style_1 {
display: inline-flex; width: 125px;
margin-bottom: .5rem; }
margin-top: .5rem;
table {
} width: 100%;
}
</style>
<script src="semantic/dist/semantic.min.js" ></script> #table_index_filter {
float: right;
<script> }
$('#table_index').DataTable(
{ #table_index_paginate {
"order": [ float: right;
[0, "desc"], }
]
} label {
); display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<script src="semantic/dist/semantic.min.js"></script>
<script>
$('#table_index').DataTable({
"order": [
[0, "desc"],
]
});
</script> </script>

2998
wms/contract-repair/js/alpine.js

File diff suppressed because it is too large

343
wms/contract-repair/styles/style.css

@ -49,7 +49,8 @@ main .inputDiv {
main .inputDiv label { main .inputDiv label {
margin-bottom: 10px; margin-bottom: 10px;
} }
main .inputDiv label input, main .inputDiv label select { main .inputDiv label input,
main .inputDiv label select {
border: 1px #aaa solid; border: 1px #aaa solid;
outline: none; outline: none;
border-radius: 5px; border-radius: 5px;
@ -68,100 +69,140 @@ main .inputDiv label button {
font-weight: 6500; font-weight: 6500;
margin-top: 15px; margin-top: 15px;
} }
main .contract-install-component, main .contract-material-component { main .contract-install-component,
main .contract-material-component {
width: 100%; width: 100%;
max-width: 816px; max-width: 816px;
margin: 30px auto; margin: 30px auto;
background-color: #f7f7f7 !important; background-color: #f7f7f7 !important;
} }
main .contract-install-component p, main .contract-material-component p { main .contract-install-component p,
main .contract-material-component p {
margin: 0; margin: 0;
} }
main .contract-install-component > .btn-list, main .contract-material-component > .btn-list { main .contract-install-component > .btn-list,
main .contract-material-component > .btn-list {
display: flex; display: flex;
align-items: center; align-items: center;
} }
main .contract-install-component > .btn-list > button, main .contract-material-component > .btn-list > button { main .contract-install-component > .btn-list > button,
main .contract-material-component > .btn-list > button {
padding: 8px; padding: 8px;
margin: 0 4px; margin: 0 4px;
} }
main .contract-install-component > .contract, main .contract-material-component > .contract { main .contract-install-component > .contract,
main .contract-material-component > .contract {
background: #fff; background: #fff;
width: 100%; width: 100%;
margin-top: 15px; margin-top: 15px;
padding: 20px; padding: 20px;
font-family: "標楷體"; font-family: "標楷體";
} }
main .contract-install-component > .contract > h2, main .contract-material-component > .contract > h2 { main .contract-install-component > .contract > h2,
main .contract-material-component > .contract > h2 {
font-size: 18pt; font-size: 18pt;
text-align: center; text-align: center;
} }
main .contract-install-component > .contract br, main .contract-material-component > .contract br { main .contract-install-component > .contract br,
main .contract-material-component > .contract br {
line-height: 2.5; line-height: 2.5;
} }
main .contract-install-component > .contract .d-flex, main .contract-material-component > .contract .d-flex { main .contract-install-component > .contract .d-flex,
main .contract-material-component > .contract .d-flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
main .contract-install-component > .contract .mouseover, main .contract-material-component > .contract .mouseover { main .contract-install-component > .contract .mouseover,
main .contract-material-component > .contract .mouseover {
background-color: #f1f1f1; background-color: #f1f1f1;
cursor: pointer; cursor: pointer;
} }
main .contract-install-component > .contract div, main .contract-install-component > .contract section, main .contract-material-component > .contract div, main .contract-material-component > .contract section { main .contract-install-component > .contract div,
main .contract-install-component > .contract section,
main .contract-material-component > .contract div,
main .contract-material-component > .contract section {
font-size: 12pt; font-size: 12pt;
line-height: 2.5; line-height: 2.5;
} }
main .contract-install-component > .contract div.party, main .contract-install-component > .contract section.party, main .contract-material-component > .contract div.party, main .contract-material-component > .contract section.party { main .contract-install-component > .contract div.party,
main .contract-install-component > .contract section.party,
main .contract-material-component > .contract div.party,
main .contract-material-component > .contract section.party {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
main .contract-install-component > .contract div.party .company-name, main .contract-install-component > .contract section.party .company-name, main .contract-material-component > .contract div.party .company-name, main .contract-material-component > .contract section.party .company-name { main .contract-install-component > .contract div.party .company-name,
main .contract-install-component > .contract section.party .company-name,
main .contract-material-component > .contract div.party .company-name,
main .contract-material-component > .contract section.party .company-name {
text-indent: 80pt; text-indent: 80pt;
} }
main .contract-install-component > .contract div.party .notes, main .contract-install-component > .contract section.party .notes, main .contract-material-component > .contract div.party .notes, main .contract-material-component > .contract section.party .notes { main .contract-install-component > .contract div.party .notes,
main .contract-install-component > .contract section.party .notes,
main .contract-material-component > .contract div.party .notes,
main .contract-material-component > .contract section.party .notes {
margin-right: 25%; margin-right: 25%;
white-space: nowrap; white-space: nowrap;
} }
main .contract-install-component > .contract div.list-content, main .contract-install-component > .contract section.list-content, main .contract-material-component > .contract div.list-content, main .contract-material-component > .contract section.list-content { main .contract-install-component > .contract div.list-content,
main .contract-install-component > .contract section.list-content,
main .contract-material-component > .contract div.list-content,
main .contract-material-component > .contract section.list-content {
margin-left: 70px; margin-left: 70px;
} }
main .contract-install-component > .contract div.list-title, main .contract-install-component > .contract section.list-title, main .contract-material-component > .contract div.list-title, main .contract-material-component > .contract section.list-title { main .contract-install-component > .contract div.list-title,
main .contract-install-component > .contract section.list-title,
main .contract-material-component > .contract div.list-title,
main .contract-material-component > .contract section.list-title {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
} }
main .contract-install-component > .contract div.list-title > strong, main .contract-install-component > .contract section.list-title > strong, main .contract-material-component > .contract div.list-title > strong, main .contract-material-component > .contract section.list-title > strong { main .contract-install-component > .contract div.list-title > strong,
main .contract-install-component > .contract section.list-title > strong,
main .contract-material-component > .contract div.list-title > strong,
main .contract-material-component > .contract section.list-title > strong {
min-width: 70px; min-width: 70px;
} }
main .contract-install-component > .contract p, main .contract-install-component > .contract article, main .contract-install-component > .contract div, main .contract-material-component > .contract p, main .contract-material-component > .contract article, main .contract-material-component > .contract div { main .contract-install-component > .contract p,
main .contract-install-component > .contract article,
main .contract-install-component > .contract div,
main .contract-material-component > .contract p,
main .contract-material-component > .contract article,
main .contract-material-component > .contract div {
position: relative; position: relative;
display: block; display: block;
} }
main .contract-install-component > .contract .date, main .contract-material-component > .contract .date { main .contract-install-component > .contract .date,
main .contract-material-component > .contract .date {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: 100%;
margin-top: 300px; margin-top: 300px;
} }
main .contract-install-component > .contract .date p, main .contract-material-component > .contract .date p { main .contract-install-component > .contract .date p,
main .contract-material-component > .contract .date p {
width: 50%; width: 50%;
letter-spacing: 20px; letter-spacing: 20px;
} }
main .contract-install-component > .contract .date > .ml, main .contract-material-component > .contract .date > .ml { main .contract-install-component > .contract .date > .ml,
main .contract-material-component > .contract .date > .ml {
width: 50%; width: 50%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: row-reverse; flex-direction: row-reverse;
} }
main .contract-install-component > .contract .buttons, main .contract-material-component > .contract .buttons { main .contract-install-component > .contract .buttons,
main .contract-material-component > .contract .buttons {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
display: flex; display: flex;
z-index: 9; z-index: 9;
} }
main .contract-install-component > .contract .buttons > button, main .contract-material-component > .contract .buttons > button { main .contract-install-component > .contract .buttons > button,
main .contract-material-component > .contract .buttons > button {
width: 30px; width: 30px;
height: 30px; height: 30px;
border-radius: 5px; border-radius: 5px;
@ -174,89 +215,127 @@ main .contract-install-component > .contract .buttons > button, main .contract-m
color: #fff; color: #fff;
margin: 0 1px; margin: 0 1px;
} }
main .contract-install-component > .contract .buttons > button > i, main .contract-material-component > .contract .buttons > button > i { main .contract-install-component > .contract .buttons > button > i,
main .contract-material-component > .contract .buttons > button > i {
font-size: 12px; font-size: 12px;
} }
main .contract-install-component > .contract .buttons > button.edit, main .contract-material-component > .contract .buttons > button.edit { main .contract-install-component > .contract .buttons > button.edit,
main .contract-material-component > .contract .buttons > button.edit {
background-color: #5BC0DE; background-color: #5BC0DE;
} }
main .contract-install-component > .contract .buttons > button.add, main .contract-material-component > .contract .buttons > button.add { main .contract-install-component > .contract .buttons > button.add,
main .contract-material-component > .contract .buttons > button.add {
background-color: #F0AD4E; background-color: #F0AD4E;
} }
main .contract-install-component > .contract .buttons > button.delete, main .contract-material-component > .contract .buttons > button.delete { main .contract-install-component > .contract .buttons > button.delete,
main .contract-material-component > .contract .buttons > button.delete {
background-color: rgb(211, 0, 0); background-color: rgb(211, 0, 0);
} }
main .contract-install-component > .contract table, main .contract-material-component > .contract table { main .contract-install-component > .contract table,
main .contract-material-component > .contract table {
border: none; border: none;
margin-top: 30px; margin-top: 30px;
font-family: "標楷體"; font-family: "標楷體";
width: 800px; width: 800px;
} }
main .contract-install-component > .contract table tr:nth-child(even), main .contract-install-component > .contract table tr:nth-child(odd), main .contract-material-component > .contract table tr:nth-child(even), main .contract-material-component > .contract table tr:nth-child(odd) { main .contract-install-component > .contract table tr:nth-child(even),
main .contract-install-component > .contract table tr:nth-child(odd),
main .contract-material-component > .contract table tr:nth-child(even),
main .contract-material-component > .contract table tr:nth-child(odd) {
background-color: #fff; background-color: #fff;
} }
main .contract-install-component > .contract table tr, main .contract-material-component > .contract table tr { main .contract-install-component > .contract table tr,
main .contract-material-component > .contract table tr {
font-size: 12pt; font-size: 12pt;
width: 100%; width: 100%;
position: relative; position: relative;
} }
main .contract-install-component > .contract table tr.mouseover, main .contract-material-component > .contract table tr.mouseover { main .contract-install-component > .contract table tr.mouseover,
main .contract-material-component > .contract table tr.mouseover {
background-color: #f3f3f3; background-color: #f3f3f3;
} }
main .contract-install-component > .contract table tr h2, main .contract-material-component > .contract table tr h2 { main .contract-install-component > .contract table tr h2,
main .contract-material-component > .contract table tr h2 {
font-size: 18pt; font-size: 18pt;
} }
main .contract-install-component > .contract table tr td, main .contract-material-component > .contract table tr td { main .contract-install-component > .contract table tr td,
main .contract-material-component > .contract table tr td {
width: 100%; width: 100%;
height: 100%; height: 100%;
line-height: 2; line-height: 2;
display: flex; display: flex;
} }
main .contract-install-component > .contract table tr td.center, main .contract-material-component > .contract table tr td.center { main .contract-install-component > .contract table tr td.center,
main .contract-material-component > .contract table tr td.center {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
main .contract-install-component > .contract table tr td.list, main .contract-material-component > .contract table tr td.list { main .contract-install-component > .contract table tr td.list,
main .contract-material-component > .contract table tr td.list {
width: 100%; width: 100%;
height: 100%; height: 100%;
white-space: nowrap; white-space: nowrap;
display: flex; display: flex;
} }
main .contract-install-component > .contract table tr td.list span, main .contract-material-component > .contract table tr td.list span { main .contract-install-component > .contract table tr td.list span,
main .contract-material-component > .contract table tr td.list span {
width: 100px; width: 100px;
min-height: 100%; min-height: 100%;
display: block; display: block;
} }
main .contract-install-component > .contract table tr td.list > p, main .contract-material-component > .contract table tr td.list > p { main .contract-install-component > .contract table tr td.list > p,
main .contract-material-component > .contract table tr td.list > p {
display: block; display: block;
text-align: justify; text-align: justify;
} }
main .contract-install-component > .contract table tr td.list div, main .contract-install-component > .contract table tr td.list article, main .contract-material-component > .contract table tr td.list div, main .contract-material-component > .contract table tr td.list article { main .contract-install-component > .contract table tr td.list div,
main .contract-install-component > .contract table tr td.list article,
main .contract-material-component > .contract table tr td.list div,
main .contract-material-component > .contract table tr td.list article {
max-width: calc(100% - 100px); max-width: calc(100% - 100px);
white-space: normal; white-space: normal;
} }
main .contract-install-component > .contract table tr td.list div input[type=text], main .contract-install-component > .contract table tr td.list div input[type=number], main .contract-install-component > .contract table tr td.list div input, main .contract-install-component > .contract table tr td.list article input[type=text], main .contract-install-component > .contract table tr td.list article input[type=number], main .contract-install-component > .contract table tr td.list article input, main .contract-material-component > .contract table tr td.list div input[type=text], main .contract-material-component > .contract table tr td.list div input[type=number], main .contract-material-component > .contract table tr td.list div input, main .contract-material-component > .contract table tr td.list article input[type=text], main .contract-material-component > .contract table tr td.list article input[type=number], main .contract-material-component > .contract table tr td.list article input { main .contract-install-component > .contract table tr td.list div input[type=text],
main .contract-install-component > .contract table tr td.list div input[type=number],
main .contract-install-component > .contract table tr td.list div input,
main .contract-install-component > .contract table tr td.list article input[type=text],
main .contract-install-component > .contract table tr td.list article input[type=number],
main .contract-install-component > .contract table tr td.list article input,
main .contract-material-component > .contract table tr td.list div input[type=text],
main .contract-material-component > .contract table tr td.list div input[type=number],
main .contract-material-component > .contract table tr td.list div input,
main .contract-material-component > .contract table tr td.list article input[type=text],
main .contract-material-component > .contract table tr td.list article input[type=number],
main .contract-material-component > .contract table tr td.list article input {
border: none !important; border: none !important;
border-bottom: 1px #222 solid !important; border-bottom: 1px #222 solid !important;
width: 50px; width: 50px;
outline: none; outline: none;
text-align: center; text-align: center;
} }
main .contract-install-component > .contract table tr td.list div.text-justify, main .contract-install-component > .contract table tr td.list article.text-justify, main .contract-material-component > .contract table tr td.list div.text-justify, main .contract-material-component > .contract table tr td.list article.text-justify { main .contract-install-component > .contract table tr td.list div.text-justify,
main .contract-install-component > .contract table tr td.list article.text-justify,
main .contract-material-component > .contract table tr td.list div.text-justify,
main .contract-material-component > .contract table tr td.list article.text-justify {
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
} }
main .contract-install-component > .contract table tr.date td > div, main .contract-material-component > .contract table tr.date td > div { main .contract-install-component > .contract table tr.date td > div,
main .contract-material-component > .contract table tr.date td > div {
width: 100%; width: 100%;
text-align: right; text-align: right;
} }
main .contract-install-component > .contract table tr.date td > div.text-justify, main .contract-material-component > .contract table tr.date td > div.text-justify { main .contract-install-component > .contract table tr.date td > div.text-justify,
main .contract-material-component > .contract table tr.date td > div.text-justify {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
main .contract-install-component > .contract table td, main .contract-install-component > .contract table th, main .contract-material-component > .contract table td, main .contract-material-component > .contract table th { main .contract-install-component > .contract table td,
main .contract-install-component > .contract table th,
main .contract-material-component > .contract table td,
main .contract-material-component > .contract table th {
padding: 8px; padding: 8px;
} }
@keyframes modelanim { @keyframes modelanim {
@ -323,7 +402,8 @@ main .contract-model > .contract-content > .content textarea {
outline: none; outline: none;
border-radius: 6px; border-radius: 6px;
} }
main .rebtn, main .prviewbtn { main .rebtn,
main .prviewbtn {
background-color: #5BC0DE; background-color: #5BC0DE;
color: #fff; color: #fff;
outline: none; outline: none;
@ -339,7 +419,8 @@ main .prviewbtn {
background-color: #2E6DA4; background-color: #2E6DA4;
} }
input[type=checkbox].scorll, input[type=radio].scorll { input[type=checkbox].scorll,
input[type=radio].scorll {
position: relative; position: relative;
width: 50px; width: 50px;
height: 25px; height: 25px;
@ -349,7 +430,8 @@ input[type=checkbox].scorll, input[type=radio].scorll {
cursor: pointer; cursor: pointer;
border-radius: 20px; border-radius: 20px;
} }
input[type=checkbox].scorll::before, input[type=radio].scorll::before { input[type=checkbox].scorll::before,
input[type=radio].scorll::before {
content: ""; content: "";
position: absolute; position: absolute;
top: 0; top: 0;
@ -361,13 +443,16 @@ input[type=checkbox].scorll::before, input[type=radio].scorll::before {
transform: scale(0.98, 0.96); transform: scale(0.98, 0.96);
transition: 0.5s; transition: 0.5s;
} }
input[type=checkbox].scorll:checked, input[type=radio].scorll:checked { input[type=checkbox].scorll:checked,
input[type=radio].scorll:checked {
background: linear-gradient(to right, #5BC0DE, #2E6DA4); background: linear-gradient(to right, #5BC0DE, #2E6DA4);
} }
input[type=checkbox].scorll:checked::before, input[type=radio].scorll:checked::before { input[type=checkbox].scorll:checked::before,
input[type=radio].scorll:checked::before {
left: 25px; left: 25px;
} }
input[type=checkbox].scorll::after, input[type=radio].scorll::after { input[type=checkbox].scorll::after,
input[type=radio].scorll::after {
content: ""; content: "";
} }
@ -378,7 +463,8 @@ input[type=checkbox].scorll::after, input[type=radio].scorll::after {
width: 800px; width: 800px;
border: 1px #ccc solid; border: 1px #ccc solid;
} }
.prview table tr:nth-child(even), .prview table tr:nth-child(odd) { .prview table tr:nth-child(even),
.prview table tr:nth-child(odd) {
background-color: #fff; background-color: #fff;
} }
.prview table tr { .prview table tr {
@ -418,11 +504,13 @@ input[type=checkbox].scorll::after, input[type=radio].scorll::after {
display: block; display: block;
text-align: justify; text-align: justify;
} }
.prview table tr td.list div, .prview table tr td.list article { .prview table tr td.list div,
.prview table tr td.list article {
max-width: calc(100% - 100px); max-width: calc(100% - 100px);
white-space: normal; white-space: normal;
} }
.prview table tr td.list div.text-justify, .prview table tr td.list article.text-justify { .prview table tr td.list div.text-justify,
.prview table tr td.list article.text-justify {
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
@ -435,7 +523,8 @@ input[type=checkbox].scorll::after, input[type=radio].scorll::after {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.prview table td, .prview table th { .prview table td,
.prview table th {
padding: 8px; padding: 8px;
} }
@ -445,7 +534,8 @@ main table {
font-family: "標楷體"; font-family: "標楷體";
width: 800px; width: 800px;
} }
main table tr:nth-child(even), main table tr:nth-child(odd) { main table tr:nth-child(even),
main table tr:nth-child(odd) {
background-color: #fff; background-color: #fff;
} }
main table tr { main table tr {
@ -502,7 +592,8 @@ main table tr.date td > div.text-justify {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
main table td, main table th { main table td,
main table th {
padding: 8px; padding: 8px;
} }
@ -525,8 +616,10 @@ main table td, main table th {
} }
.loader { .loader {
border: 4px solid #f3f3f3; /* Light grey */ border: 4px solid #f3f3f3;
border-top: 4px solid #999; /* Blue */ /* Light grey */
border-top: 4px solid #999;
/* Blue */
border-radius: 50%; border-radius: 50%;
width: 20px; width: 20px;
height: 20px; height: 20px;
@ -541,14 +634,20 @@ main table td, main table th {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
.contract-input-component .contract-input-component .form, .contract-input-component .contract-management .form, .contract-input-component .contract-new-apply-component .form, .contract-management .contract-input-component .form, .contract-management .contract-management .form, .contract-management .contract-new-apply-component .form, .contract-new-apply-component .contract-input-component .form, .contract-new-apply-component .contract-management .form, .contract-new-apply-component .contract-new-apply-component .form { .contract-input-component .form,
.contract-management .form,
.contract-new-apply-component .form {
margin: 0 auto; margin: 0 auto;
} }
.contract-input-component .contract-input-component .form .dropdown, .contract-input-component .contract-management .form .dropdown, .contract-input-component .contract-new-apply-component .form .dropdown, .contract-management .contract-input-component .form .dropdown, .contract-management .contract-management .form .dropdown, .contract-management .contract-new-apply-component .form .dropdown, .contract-new-apply-component .contract-input-component .form .dropdown, .contract-new-apply-component .contract-management .form .dropdown, .contract-new-apply-component .contract-new-apply-component .form .dropdown { .contract-input-component .form .dropdown,
.contract-management .form .dropdown,
.contract-new-apply-component .form .dropdown {
width: 100%; width: 100%;
margin-top: 7px; margin-top: 7px;
} }
.contract-input-component .contract-input-component .form .savebtn, .contract-input-component .contract-management .form .savebtn, .contract-input-component .contract-new-apply-component .form .savebtn, .contract-management .contract-input-component .form .savebtn, .contract-management .contract-management .form .savebtn, .contract-management .contract-new-apply-component .form .savebtn, .contract-new-apply-component .contract-input-component .form .savebtn, .contract-new-apply-component .contract-management .form .savebtn, .contract-new-apply-component .contract-new-apply-component .form .savebtn { .contract-input-component .form .savebtn,
.contract-management .form .savebtn,
.contract-new-apply-component .form .savebtn {
margin-right: 13px; margin-right: 13px;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -557,11 +656,15 @@ main table td, main table th {
height: 45px; height: 45px;
font-size: 15px; font-size: 15px;
} }
.contract-input-component .contract-input-component .form table .fixed, .contract-input-component .contract-management .form table .fixed, .contract-input-component .contract-new-apply-component .form table .fixed, .contract-management .contract-input-component .form table .fixed, .contract-management .contract-management .form table .fixed, .contract-management .contract-new-apply-component .form table .fixed, .contract-new-apply-component .contract-input-component .form table .fixed, .contract-new-apply-component .contract-management .form table .fixed, .contract-new-apply-component .contract-new-apply-component .form table .fixed { .contract-input-component .form table .fixed,
.contract-management .form table .fixed,
.contract-new-apply-component .form table .fixed {
padding: 8px 0; padding: 8px 0;
cursor: not-allowed; cursor: not-allowed;
} }
.contract-input-component .contract-input-component .form table .alerttext, .contract-input-component .contract-management .form table .alerttext, .contract-input-component .contract-new-apply-component .form table .alerttext, .contract-management .contract-input-component .form table .alerttext, .contract-management .contract-management .form table .alerttext, .contract-management .contract-new-apply-component .form table .alerttext, .contract-new-apply-component .contract-input-component .form table .alerttext, .contract-new-apply-component .contract-management .form table .alerttext, .contract-new-apply-component .contract-new-apply-component .form table .alerttext { .contract-input-component .form table .alerttext,
.contract-management .form table .alerttext,
.contract-new-apply-component .form table .alerttext {
font-size: 13px; font-size: 13px;
color: #a00; color: #a00;
font-weight: 500; font-weight: 500;
@ -569,92 +672,126 @@ main table td, main table th {
font-weight: 900; font-weight: 900;
padding: 0; padding: 0;
} }
.contract-input-component .contract-input-component .form input[type=file], .contract-input-component .contract-management .form input[type=file], .contract-input-component .contract-new-apply-component .form input[type=file], .contract-management .contract-input-component .form input[type=file], .contract-management .contract-management .form input[type=file], .contract-management .contract-new-apply-component .form input[type=file], .contract-new-apply-component .contract-input-component .form input[type=file], .contract-new-apply-component .contract-management .form input[type=file], .contract-new-apply-component .contract-new-apply-component .form input[type=file] { .contract-input-component .form input[type=file],
.contract-management .form input[type=file],
.contract-new-apply-component .form input[type=file] {
padding: 12px 20px; padding: 12px 20px;
margin: 8px 0; margin: 8px 0;
} }
.contract-input-component .contract-input-component .form span, .contract-input-component .contract-management .form span, .contract-input-component .contract-new-apply-component .form span, .contract-management .contract-input-component .form span, .contract-management .contract-management .form span, .contract-management .contract-new-apply-component .form span, .contract-new-apply-component .contract-input-component .form span, .contract-new-apply-component .contract-management .form span, .contract-new-apply-component .contract-new-apply-component .form span { .contract-input-component .form span,
.contract-management .form span,
.contract-new-apply-component .form span {
font-weight: 900; font-weight: 900;
} }
.contract-input-component .contract-input-component .form span.successtext, .contract-input-component .contract-management .form span.successtext, .contract-input-component .contract-new-apply-component .form span.successtext, .contract-management .contract-input-component .form span.successtext, .contract-management .contract-management .form span.successtext, .contract-management .contract-new-apply-component .form span.successtext, .contract-new-apply-component .contract-input-component .form span.successtext, .contract-new-apply-component .contract-management .form span.successtext, .contract-new-apply-component .contract-new-apply-component .form span.successtext { .contract-input-component .form span.successtext,
.contract-management .form span.successtext,
.contract-new-apply-component .form span.successtext {
color: #0a0; color: #0a0;
} }
.contract-input-component .contract-input-component .form span.failtext, .contract-input-component .contract-management .form span.failtext, .contract-input-component .contract-new-apply-component .form span.failtext, .contract-management .contract-input-component .form span.failtext, .contract-management .contract-management .form span.failtext, .contract-management .contract-new-apply-component .form span.failtext, .contract-new-apply-component .contract-input-component .form span.failtext, .contract-new-apply-component .contract-management .form span.failtext, .contract-new-apply-component .contract-new-apply-component .form span.failtext { .contract-input-component .form span.failtext,
.contract-management .form span.failtext,
.contract-new-apply-component .form span.failtext {
color: #a00; color: #a00;
} }
.contract-input-component .contract-input-component .form span.readtext, .contract-input-component .contract-management .form span.readtext, .contract-input-component .contract-new-apply-component .form span.readtext, .contract-management .contract-input-component .form span.readtext, .contract-management .contract-management .form span.readtext, .contract-management .contract-new-apply-component .form span.readtext, .contract-new-apply-component .contract-input-component .form span.readtext, .contract-new-apply-component .contract-management .form span.readtext, .contract-new-apply-component .contract-new-apply-component .form span.readtext { .contract-input-component .form span.readtext,
.contract-management .form span.readtext,
.contract-new-apply-component .form span.readtext {
color: #aa0; color: #aa0;
} }
.contract-input-component .contract-input-component .form input[type=number]::-webkit-outer-spin-button, .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-input-component .contract-management .form input[type=number]::-webkit-outer-spin-button, .contract-input-component .form input[type=number]::-webkit-inner-spin-button,
.contract-input-component .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-input-component .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button, .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-input-component .form input[type=number]::-webkit-outer-spin-button, .contract-management .form input[type=number]::-webkit-inner-spin-button,
.contract-management .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-management .form input[type=number]::-webkit-outer-spin-button, .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button, .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button {
.contract-management .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
.contract-input-component .contract-input-component .form input[type=number], .contract-input-component .contract-management .form input[type=number], .contract-input-component .contract-new-apply-component .form input[type=number], .contract-management .contract-input-component .form input[type=number], .contract-management .contract-management .form input[type=number], .contract-management .contract-new-apply-component .form input[type=number], .contract-new-apply-component .contract-input-component .form input[type=number], .contract-new-apply-component .contract-management .form input[type=number], .contract-new-apply-component .contract-new-apply-component .form input[type=number] { .contract-input-component .form input[type=number],
.contract-management .form input[type=number],
.contract-new-apply-component .form input[type=number] {
-moz-appearance: textfield; -moz-appearance: textfield;
} }
.contract-input-component .contract-input-component .error, .contract-input-component .contract-management .error, .contract-input-component .contract-new-apply-component .error, .contract-management .contract-input-component .error, .contract-management .contract-management .error, .contract-management .contract-new-apply-component .error, .contract-new-apply-component .contract-input-component .error, .contract-new-apply-component .contract-management .error, .contract-new-apply-component .contract-new-apply-component .error { .contract-input-component .error,
.contract-management .error,
.contract-new-apply-component .error {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin: 15px; margin: 15px;
} }
.contract-input-component .contract-input-component .error .errortext, .contract-input-component .contract-management .error .errortext, .contract-input-component .contract-new-apply-component .error .errortext, .contract-management .contract-input-component .error .errortext, .contract-management .contract-management .error .errortext, .contract-management .contract-new-apply-component .error .errortext, .contract-new-apply-component .contract-input-component .error .errortext, .contract-new-apply-component .contract-management .error .errortext, .contract-new-apply-component .contract-new-apply-component .error .errortext { .contract-input-component .error .errortext,
.contract-management .error .errortext,
.contract-new-apply-component .error .errortext {
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
color: #a00; color: #a00;
} }
.contract-input-component .contract-input-component .input-group-btn, .contract-input-component .contract-management .input-group-btn, .contract-input-component .contract-new-apply-component .input-group-btn, .contract-management .contract-input-component .input-group-btn, .contract-management .contract-management .input-group-btn, .contract-management .contract-new-apply-component .input-group-btn, .contract-new-apply-component .contract-input-component .input-group-btn, .contract-new-apply-component .contract-management .input-group-btn, .contract-new-apply-component .contract-new-apply-component .input-group-btn { .contract-input-component .input-group-btn,
.contract-management .input-group-btn,
.contract-new-apply-component .input-group-btn {
font-size: 16px; font-size: 16px;
} }
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
.contract-input-component .contract-input-component table, .contract-input-component .contract-management table, .contract-input-component .contract-new-apply-component table, .contract-management .contract-input-component table, .contract-management .contract-management table, .contract-management .contract-new-apply-component table, .contract-new-apply-component .contract-input-component table, .contract-new-apply-component .contract-management table, .contract-new-apply-component .contract-new-apply-component table { .contract-input-component table,
.contract-management table,
.contract-new-apply-component table {
border: 0; border: 0;
} }
.contract-input-component .contract-input-component table thead, .contract-input-component .contract-management table thead, .contract-input-component .contract-new-apply-component table thead, .contract-management .contract-input-component table thead, .contract-management .contract-management table thead, .contract-management .contract-new-apply-component table thead, .contract-new-apply-component .contract-input-component table thead, .contract-new-apply-component .contract-management table thead, .contract-new-apply-component .contract-new-apply-component table thead { .contract-input-component table thead,
.contract-management table thead,
.contract-new-apply-component table thead {
display: none; display: none;
} }
.contract-input-component .contract-input-component table tr, .contract-input-component .contract-management table tr, .contract-input-component .contract-new-apply-component table tr, .contract-management .contract-input-component table tr, .contract-management .contract-management table tr, .contract-management .contract-new-apply-component table tr, .contract-new-apply-component .contract-input-component table tr, .contract-new-apply-component .contract-management table tr, .contract-new-apply-component .contract-new-apply-component table tr { .contract-input-component table tr,
.contract-management table tr,
.contract-new-apply-component table tr {
margin-bottom: 10px; margin-bottom: 10px;
display: block; display: block;
border-bottom: 2px solid #ddd; border-bottom: 2px solid #ddd;
} }
.contract-input-component .contract-input-component table td, .contract-input-component .contract-management table td, .contract-input-component .contract-new-apply-component table td, .contract-management .contract-input-component table td, .contract-management .contract-management table td, .contract-management .contract-new-apply-component table td, .contract-new-apply-component .contract-input-component table td, .contract-new-apply-component .contract-management table td, .contract-new-apply-component .contract-new-apply-component table td { .contract-input-component table td,
.contract-management table td,
.contract-new-apply-component table td {
display: block; display: block;
text-align: left; text-align: left;
font-size: 14px; font-size: 14px;
border-bottom: 1px dotted #ccc; border-bottom: 1px dotted #ccc;
} }
.contract-input-component .contract-input-component table td:last-child, .contract-input-component .contract-management table td:last-child, .contract-input-component .contract-new-apply-component table td:last-child, .contract-management .contract-input-component table td:last-child, .contract-management .contract-management table td:last-child, .contract-management .contract-new-apply-component table td:last-child, .contract-new-apply-component .contract-input-component table td:last-child, .contract-new-apply-component .contract-management table td:last-child, .contract-new-apply-component .contract-new-apply-component table td:last-child { .contract-input-component table td:last-child,
.contract-management table td:last-child,
.contract-new-apply-component table td:last-child {
border-bottom: 0; border-bottom: 0;
} }
.contract-input-component .contract-input-component table td:before, .contract-input-component .contract-management table td:before, .contract-input-component .contract-new-apply-component table td:before, .contract-management .contract-input-component table td:before, .contract-management .contract-management table td:before, .contract-management .contract-new-apply-component table td:before, .contract-new-apply-component .contract-input-component table td:before, .contract-new-apply-component .contract-management table td:before, .contract-new-apply-component .contract-new-apply-component table td:before { .contract-input-component table td:before,
.contract-management table td:before,
.contract-new-apply-component table td:before {
content: attr(data-label); content: attr(data-label);
float: left; float: left;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold; font-weight: bold;
} }
} }
.contract-input-component .contract-input-component .images, .contract-input-component .contract-management .images, .contract-input-component .contract-new-apply-component .images, .contract-management .contract-input-component .images, .contract-management .contract-management .images, .contract-management .contract-new-apply-component .images, .contract-new-apply-component .contract-input-component .images, .contract-new-apply-component .contract-management .images, .contract-new-apply-component .contract-new-apply-component .images { .contract-input-component .images,
.contract-management .images,
.contract-new-apply-component .images {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 20px; padding: 20px;
} }
.contract-input-component .contract-input-component .images > .image, .contract-input-component .contract-management .images > .image, .contract-input-component .contract-new-apply-component .images > .image, .contract-management .contract-input-component .images > .image, .contract-management .contract-management .images > .image, .contract-management .contract-new-apply-component .images > .image, .contract-new-apply-component .contract-input-component .images > .image, .contract-new-apply-component .contract-management .images > .image, .contract-new-apply-component .contract-new-apply-component .images > .image { .contract-input-component .images > .image,
.contract-management .images > .image,
.contract-new-apply-component .images > .image {
position: relative; position: relative;
margin: 10px; margin: 10px;
} }
.contract-input-component .contract-input-component .images > .image:hover > i, .contract-input-component .contract-management .images > .image:hover > i, .contract-input-component .contract-new-apply-component .images > .image:hover > i, .contract-management .contract-input-component .images > .image:hover > i, .contract-management .contract-management .images > .image:hover > i, .contract-management .contract-new-apply-component .images > .image:hover > i, .contract-new-apply-component .contract-input-component .images > .image:hover > i, .contract-new-apply-component .contract-management .images > .image:hover > i, .contract-new-apply-component .contract-new-apply-component .images > .image:hover > i { .contract-input-component .images > .image:hover > i,
.contract-management .images > .image:hover > i,
.contract-new-apply-component .images > .image:hover > i {
opacity: 1; opacity: 1;
} }
.contract-input-component .contract-input-component .images > .image > i, .contract-input-component .contract-management .images > .image > i, .contract-input-component .contract-new-apply-component .images > .image > i, .contract-management .contract-input-component .images > .image > i, .contract-management .contract-management .images > .image > i, .contract-management .contract-new-apply-component .images > .image > i, .contract-new-apply-component .contract-input-component .images > .image > i, .contract-new-apply-component .contract-management .images > .image > i, .contract-new-apply-component .contract-new-apply-component .images > .image > i { .contract-input-component .images > .image > i,
.contract-management .images > .image > i,
.contract-new-apply-component .images > .image > i {
position: absolute; position: absolute;
top: -12px; top: -12px;
right: -12px; right: -12px;
@ -663,29 +800,37 @@ main table td, main table th {
opacity: 0; opacity: 0;
transition: 0.3s; transition: 0.3s;
} }
.contract-input-component table, .contract-management table, .contract-new-apply-component table {
table {
table-layout: fixed; table-layout: fixed;
width: 100%; width: 100%;
} }
.contract-input-component td, .contract-management td, .contract-new-apply-component td {
td {
word-wrap: break-word; word-wrap: break-word;
} }
.contract-input-component img, .contract-management img, .contract-new-apply-component img {
img {
width: 125px; width: 125px;
} }
.contract-input-component .width_style_1, .contract-management .width_style_1, .contract-new-apply-component .width_style_1 {
.width_style_1 {
width: 125px; width: 125px;
} }
.contract-input-component table, .contract-management table, .contract-new-apply-component table {
table {
width: 100%; width: 100%;
} }
.contract-input-component #table_index_filter, .contract-management #table_index_filter, .contract-new-apply-component #table_index_filter {
#table_index_filter {
float: right; float: right;
} }
.contract-input-component #table_index_paginate, .contract-management #table_index_paginate, .contract-new-apply-component #table_index_paginate {
#table_index_paginate {
float: right; float: right;
} }
.contract-input-component label, .contract-management label, .contract-new-apply-component label {
label {
display: inline-flex; display: inline-flex;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
margin-top: 0.5rem; margin-top: 0.5rem;

2
wms/contract-repair/styles/style.css.map

File diff suppressed because one or more lines are too long

1593
wms/contract-repair/styles/style.scss

File diff suppressed because it is too large

126
wms/mkt/pricereview_contractno-api.php

@ -1,63 +1,63 @@
<?php <?php
/**
* 客戶資料 /**
* @url /pricereview_contractno-api.php * 客戶資料
* @method POST * @url /pricereview_contractno-api.php
* @return JSON * @method POST
* * @return JSON
* request *
* { * request
* "pa" * {
* } * "pa"
* pa : 合約號 * }
* respons json * pa : 合約號
* { * respons json
* "st" : "ok", * {
* "err" : "" * "st" : "ok",
* } * "err" : ""
**/ * }
ob_start(); **/
include "../header.php"; ob_start();
ob_end_clean(); include "../header.php";
$rarr = array("st" => "ok", "err" => ""); ob_end_clean();
$rarr = array("st" => "ok", "err" => "");
try {
if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty"); try {
if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty");
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v))); foreach ($_POST as $k => $v) {
} $$k = htmlspecialchars(stripslashes(trim($v)));
}
// 基本資料
$db_query = "select a.address, a.repairerid, c.contractno, c.company, c.taxid from account a, contract c "; // 基本資料
$db_query .= "where a.accountid = c.customerid and c.contractno = '$pa'"; $db_query = "select a.address, a.repairerid, c.contractno, c.company, c.taxid from account a, contract c ";
$res = mysqli_query($link, $db_query); $db_query .= "where a.accountid = c.customerid and c.contractno = '$pa'";
if ($row = mysqli_fetch_row($res)) { $res = mysqli_query($link, $db_query);
$rarr["address"] = $row[0]; if ($row = mysqli_fetch_row($res)) {
$rarr["repairerid"] = $row[1]; $rarr["address"] = $row[0];
$rarr["contractno"] = $row[2]; $rarr["repairerid"] = $row[1];
$rarr["company"] = $row[3]; $rarr["contractno"] = $row[2];
$rarr["taxid"] = $row[4]; $rarr["company"] = $row[3];
} $rarr["taxid"] = $row[4];
mysqli_free_result($res); }
mysqli_free_result($res);
// 電梯編號
$db_query = "select facilityno from facility where contractno = '$pa' order by facilityno"; // 電梯編號
$res = mysqli_query($link, $db_query); $db_query = "select facilityno from facility where contractno = '$pa' order by facilityno";
while ($row = mysqli_fetch_row($res)) { $res = mysqli_query($link, $db_query);
$rarr["faci"][] = $row[0]; while ($row = mysqli_fetch_row($res)) {
} $rarr["faci"][] = $row[0];
mysqli_free_result($res); }
mysqli_free_result($res);
if (!isset($rarr["contractno"])) {
$rarr["st"] = "err"; if (!isset($rarr["contractno"])) {
$rarr["err"] = "無資料!"; $rarr["st"] = "err";
} $rarr["err"] = "無資料!";
}catch(\Exception $e) { }
$rarr["st"] = "err"; } catch (\Exception $e) {
$rarr["err"] = $e->getMessage(); $rarr["st"] = "err";
} $rarr["err"] = $e->getMessage();
//print_r($rarr);exit; }
echo json_encode($rarr, JSON_UNESCAPED_UNICODE); //print_r($rarr);exit;
exit; echo json_encode($rarr, JSON_UNESCAPED_UNICODE);
?> exit;

557
wms/mkt/pricereview_repair-check.php

@ -1,271 +1,288 @@
<?php <?php
include "../header.php"; include "../header.php";
require_once '../cont/wf_common.php'; require_once '../cont/wf_common.php';
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : ""; $form_key = isset($_GET['form_key']) ? $_GET['form_key'] : "";
if ($form_key == "") $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); if ($form_key == "") $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
if (!empty($form_key)) { if (!empty($form_key)) {
$sql = "select form_id from flow where form_key = '$form_key'"; $sql = "SELECT form_id FROM flow where form_key = '$form_key'";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) { if ($row = mysqli_fetch_row($res)) {
$id = $row[0]; $id = $row[0];
} }
mysqli_free_result($res); mysqli_free_result($res);
// 目前簽核進度 // 目前簽核進度
$pstatus = ""; $pstatus = "";
$db_query = "select pstatus from pricereview_repair_main where id = '$id'"; $db_query = "select pstatus from pricereview_repair_main where id = '$id'";
$res_r = mysqli_query($link ,$db_query); $res_r = mysqli_query($link, $db_query);
if ($row_r = mysqli_fetch_row($res_r)) { if ($row_r = mysqli_fetch_row($res_r)) {
$pstatus = $row_r[0]; $pstatus = $row_r[0];
} }
mysqli_free_result($res_r); mysqli_free_result($res_r);
if ($pstatus != "A") { if ($pstatus != "A") {
echo "<script>"; echo "<script>";
echo "alert('請勿重覆簽核!!');"; echo "alert('請勿重覆簽核!!');";
echo "window.close();"; echo "window.close();";
echo "</script>"; echo "</script>";
exit; exit;
} }
} }
$assign_status = '<option>請選擇</option><option value="F6">呈核</option><option value="Y1">不同意</option>'; $assign_status = '<option>請選擇</option><option value="F6">呈核</option><option value="Y1">不同意</option>';
$data = []; $data = [];
$db_query = "select * from pricereview_repair_main where id = '$id'"; $db_query = "select * from pricereview_repair_main where id = '$id'";
$data = mysqli_query($link, $db_query); $data = mysqli_query($link, $db_query);
foreach($data as $data) : foreach ($data as $data) :
// 公司站點 // 公司站點
$sql = "select content from code where field_name = 'masada_addr' and code_name = '".$data["masada_addr"]."'"; $sql = "select content from code where field_name = 'masada_addr' and code_name = '" . $data["masada_addr"] . "'";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) { if ($row = mysqli_fetch_row($res)) {
$data["maddr"] = $row[0]; $data["maddr"] = $row[0];
} }
mysqli_free_result($res); mysqli_free_result($res);
// 保養人員 // 保養人員
$repairer_arr = []; $repairer_arr = [];
$sql = "select name from account where accounttype = 'B' and accountid = '".$data["repairerid"]."'"; $sql = "select name from account where accounttype = 'B' and accountid = '" . $data["repairerid"] . "'";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) { if ($row = mysqli_fetch_row($res)) {
$data["repair"] = $row[0]; $data["repair"] = $row[0];
} }
mysqli_free_result($res); mysqli_free_result($res);
// 價審明細 // 價審明細
$item_arr = []; $item_arr = [];
$sql = "select * from pricereview_repair_item where rid = '$id' order by item_no"; $sql = "select * from pricereview_repair_item where rid = '$id' order by item_no";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) { while ($row = mysqli_fetch_assoc($res)) {
$item_arr[$row["item_no"]]["title"] = $row["title"]; $item_arr[$row["item_no"]]["title"] = $row["title"];
$item_arr[$row["item_no"]]["item_unit_price"] = $row["item_unit_price"]; $item_arr[$row["item_no"]]["item_unit_price"] = $row["item_unit_price"];
$item_arr[$row["item_no"]]["item_qty"] = $row["item_qty"]; $item_arr[$row["item_no"]]["item_qty"] = $row["item_qty"];
$item_arr[$row["item_no"]]["item_price_bp"] = $row["item_price_bp"]; $item_arr[$row["item_no"]]["item_price_bp"] = $row["item_price_bp"];
$item_arr[$row["item_no"]]["memo"] = $row["memo"]; $item_arr[$row["item_no"]]["memo"] = $row["memo"];
} }
mysqli_free_result($res); mysqli_free_result($res);
// get form_key // get form_key
$sql = "select max(form_key) from assign where assign_opinion = '".$data["repair_no"]."'"; $sql = "select max(form_key) from assign where assign_opinion = '" . $data["repair_no"] . "'";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res); $row = mysqli_fetch_row($res);
$form_key = $row[0]; $form_key = $row[0];
mysqli_free_result($res); mysqli_free_result($res);
?> ?>
<style> <style>
.nextline { .nextline {
width: 100%; width: 100%;
height: 0; height: 0;
} }
input[type=submit], input[type=button] {
width: 100%; input[type=submit],
background-color: #1E74FD; input[type=button] {
color: white; width: 100%;
padding: 14px 20px; background-color: #1E74FD;
margin: 8px 0; color: white;
border: none; padding: 14px 20px;
border-radius: 4px; margin: 8px 0;
cursor: pointer; border: none;
} border-radius: 4px;
.dollar-right { cursor: pointer;
text-align: right; }
}
.star { .dollar-right {
color: red; text-align: right;
} }
</style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> .star {
<script> color: red;
$(function(){ }
$(":input").prop("disabled", true); </style>
$("#assign_status").prop("disabled", false); <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
$("#next_users").prop("disabled", false); <script>
$("#submit").prop("disabled", false); $(function() {
$("#assign_status").change(function(){ $(":input").prop("disabled", true);
if ($(this).val() == "F6") $("#next_users").html('<option value="00000">00000</option>'); $("#assign_status").prop("disabled", false);
else if ($(this).val() == "Y1") $("#next_users").html('<option value="X">退回</option>'); $("#next_users").prop("disabled", false);
else $("#next_users").html(''); $("#submit").prop("disabled", false);
}); $("#assign_status").change(function() {
if ($(this).val() == "F6") $("#next_users").html('<option value="00000">00000</option>');
$('input[name=submit]').click(function(){ else if ($(this).val() == "Y1") $("#next_users").html('<option value="X">退回</option>');
$("#id").prop("disabled", false); else $("#next_users").html('');
$("#form_key").prop("disabled", false); });
$("#token").prop("disabled", false);
}); $('input[name=submit]').click(function() {
}); $("#id").prop("disabled", false);
</script> $("#form_key").prop("disabled", false);
<div class="container"> $("#token").prop("disabled", false);
<form class="form-inline" method="post" action="pricereview_repair-record-check.php" enctype="multipart/form-data"> });
<div> });
<label for="contractno">客戶合約號</label> </script>
<input type="text" name="contractno" id="contractno" value="<?php echo $data["contractno"]; ?>"> <div class="container">
</div> <form class="form-inline" method="post" action="pricereview_repair-record-check.php" enctype="multipart/form-data">
<div> <div>
<label for="repair_no">報價單編號</label> <label for="contractno">客戶合約號</label>
<input type="text" name="repair_no" id="repair_no" value="<?php echo $data["repair_no"]; ?>"> <input type="text" name="contractno" id="contractno" value="<?php echo $data["contractno"]; ?>">
</div> </div>
<div class="nextline"></div> <div>
<div> <label for="repair_no">報價單編號</label>
<label for="sign_date">簽訂日期</label><br> <input type="text" name="repair_no" id="repair_no" value="<?php echo $data["repair_no"]; ?>">
<input type="text" name="sign_date" id="sign_date" value="<?php echo $data["sign_date"]; ?>"> </div>
</div> <div class="nextline"></div>
<div> <div>
<label for="company">公司地址</label> <label for="sign_date">簽訂日期</label><br>
<input type="text" name="masada_addr" id="masada_addr" size="46" value="<?php echo $data["maddr"]; ?>"> <input type="text" name="sign_date" id="sign_date" value="<?php echo $data["sign_date"]; ?>">
</div> </div>
<div> <div>
<label for="company">客戶名稱</label> <label for="company">公司地址</label>
<input type="text" name="company" id="company" size="30" value="<?php echo $data["company"]; ?>"> <input type="text" name="masada_addr" id="masada_addr" size="46" value="<?php echo $data["maddr"]; ?>">
</div> </div>
<div> <div>
<label for="facilityno">電梯編號</label> <label for="company">客戶名稱</label>
<input type="text" name="facilityno" value="<?php echo $data["facilityno"]; ?>"> <input type="text" name="company" id="company" size="30" value="<?php echo $data["company"]; ?>">
</div> </div>
<div class="nextline"></div> <div>
<div> <label for="facilityno">電梯編號</label>
<label for="address">工程地址</label> <input type="text" name="facilityno" value="<?php echo $data["facilityno"]; ?>">
<input type="text" name="address" id="address" size="46" value="<?php echo $data["address"]; ?>"> </div>
</div> <div class="nextline"></div>
<div> <div>
<label for="taxid">客戶統一編號</label> <label for="address">工程地址</label>
<input type="text" name="taxid" id="taxid" value="<?php echo $data["taxid"]; ?>"> <input type="text" name="address" id="address" size="46" value="<?php echo $data["address"]; ?>">
</div> </div>
<div> <div>
<label for="invoice">客戶發票抬頭</label> <label for="taxid">客戶統一編號</label>
<input type="text" name="invoice" id="invoice" size="30" value="<?php echo $data["invoice"]; ?>"> <input type="text" name="taxid" id="taxid" value="<?php echo $data["taxid"]; ?>">
</div> </div>
<div> <div>
<label for="repairerid">申請人</label> <label for="invoice">客戶發票抬頭</label>
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data["repair"]; ?>"> <input type="text" name="invoice" id="invoice" size="30" value="<?php echo $data["invoice"]; ?>">
</div> </div>
<div class="nextline"></div> <div>
<div> <label for="repairerid">申請人</label>
<label for="memo">備註</label><br> <input type="text" name="repairerid" id="repairerid" value="<?php echo $data["repair"]; ?>">
<textarea name="memo" id="memo" cols="60" rows="4"><?php echo $data["memo"]; ?></textarea> </div>
</div> <div class="nextline"></div>
<div>
<div class="nextline"></div> <label for="memo">備註</label><br>
<br> <textarea name="memo" id="memo" cols="60" rows="4"><?php echo $data["memo"]; ?></textarea>
</div>
<div class="table-responsive">
<table id="tb1" class="table table-bordered"> <div class="nextline"></div>
<thead> <br>
<tr>
<th>項次</th> <div class="table-responsive">
<th>名稱</th> <table id="tb1" class="table table-bordered">
<th>數量</th> <thead>
<th>單價</th> <tr>
<th>合計</th> <th>項次</th>
<th>備註</th> <th>名稱</th>
</tr> <th>數量</th>
</thead> <th>單價</th>
<tbody> <th>合計</th>
<?php <th>備註</th>
foreach ($item_arr as $k => $v) { </tr>
?> </thead>
<tr name="main_templ"> <tbody>
<td> <?php
<input type="text" name="item_no" class="form-control" size="3" value="<?php echo $k; ?>"> foreach ($item_arr as $k => $v) {
</td> ?>
<td> <tr name="main_templ">
<input type="text" name="item_title" class="form-control" size="40" value="<?php echo $v["title"]; ?>"> <td>
</td> <input type="text" name="item_no" class="form-control" size="3" value="<?php echo $k; ?>">
<td> </td>
<input type="text" name="item_qty" class="form-control dollar-right" size="3" value="<?php echo number_format($v["item_qty"]); ?>"> <td>
</td> <input type="text" name="item_title" class="form-control" size="40" value="<?php echo $v["title"]; ?>">
<td> </td>
<input type="text" name="item_unit_price" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_unit_price"]); ?>"> <td>
</td> <input type="text" name="item_qty" class="form-control dollar-right" size="3" value="<?php echo number_format($v["item_qty"]); ?>">
<td> </td>
<input type="text" name="item_price_bp" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_price_bp"]); ?>"> <td>
</td> <input type="text" name="item_unit_price" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_unit_price"]); ?>">
<td> </td>
<input type="text" name="item_memo" class="form-control" value="<?php echo $v["memo"]; ?>"> <td>
</td> <input type="text" name="item_price_bp" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_price_bp"]); ?>">
</tr> </td>
<?php <td>
} <input type="text" name="item_memo" class="form-control" value="<?php echo $v["memo"]; ?>">
?> </td>
<tr> </tr>
<td colspan="3"><h5>營業稅</h5></td> <?php
<td> }
<input type="text" name="sales_tax" class="dollar-right" size="10" value="<?php echo number_format($data["sales_tax"]); ?>"> ?>
</td> <tr>
<td colspan="2"></td> <td colspan="3">
</tr> <h5>服務費</h5>
<tr> </td>
<td colspan="3"><h5>總價</h5></td> <td>
<td> <input type="text" name="service_charge" class="dollar-right" size="10" value="<?php echo number_format($data["service_charge"]); ?>">
<input type="text" name="total_price" class="dollar-right" size="10" value="<?php echo number_format($data["total_price"]); ?>"> </td>
</td> <td colspan="2"></td>
<td colspan="2"></td> </tr>
</tr> <tr>
</tbody> <td colspan="3">
</table> <h5>營業稅</h5>
</div> </td>
<td>
<div class="nextline"></div> <input type="text" name="sales_tax" class="dollar-right" size="10" value="<?php echo number_format($data["sales_tax"]); ?>">
<?php </td>
if (($data["checker"] == $user_id) && ($data["pstatus"] == "A")) { <td colspan="2"></td>
?> </tr>
<div class="table-responsive"> <tr>
<table class="table table-bordered"> <td colspan="3">
<thead> <h5>總價</h5>
<tr> </td>
<th colspan="10">簽核操作<span class="star">*</span></th> <td>
</tr> <input type="text" name="total_price" class="dollar-right" size="10" value="<?php echo number_format($data["total_price"]); ?>">
</thead> </td>
<tbody> <td colspan="2"></td>
<tr> </tr>
<td><b style='float:right'>簽核狀態</b></td> </tbody>
<td> </table>
<select name="assign_status" id="assign_status" required class="form-control form-control form-control-sm"> </div>
<?php echo $assign_status; ?>
</select> <div class="nextline"></div>
</td> <?php
<td><b>下位簽核者</b></td> if (($data["checker"] == $user_id) && ($data["pstatus"] == "A")) {
<td> ?>
<select name="next_users" id="next_users" class="form-control form-control-sm" required></select> <div class="table-responsive">
</td> <table class="table table-bordered">
<td> <thead>
<input type="submit" name="submit" id="submit" value="提交"> <tr>
</td> <th colspan="10">簽核操作<span class="star">*</span></th>
</tr> </tr>
</tbody> </thead>
</table> <tbody>
</div> <tr>
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>"> <td><b style='float:right'>簽核狀態</b></td>
<input type="hidden" name="form_key" id="form_key" value="<?php echo $form_key; ?>"> <td>
<input type="hidden" name="token" id="token" value="<?php echo $token; ?>"> <select name="assign_status" id="assign_status" required class="form-control form-control form-control-sm">
<?php <?php echo $assign_status; ?>
} </select>
?> </td>
</form> <td><b>下位簽核者</b></td>
</div> <td>
<?php <select name="next_users" id="next_users" class="form-control form-control-sm" required></select>
endforeach; </td>
?> <td>
<?php <input type="submit" name="submit" id="submit" value="提交">
include "../footer.php"; </td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>">
<input type="hidden" name="form_key" id="form_key" value="<?php echo $form_key; ?>">
<input type="hidden" name="token" id="token" value="<?php echo $token; ?>">
<?php
}
?>
</form>
</div>
<?php
endforeach;
?>
<?php
include "../footer.php";
?> ?>

1087
wms/mkt/pricereview_repair-create.php

File diff suppressed because it is too large

159
wms/mkt/pricereview_repair-record-submit.php

@ -1,78 +1,81 @@
<?php <?php
if ($_SERVER["REQUEST_METHOD"] == "POST") { // echo '<pre>';
//print_r($_POST);exit; // print_r($_POST);
foreach ($_POST as $k => $v) { // echo '</pre>';
$$k = htmlspecialchars(stripslashes(trim($v))); // exit();
} if ($_SERVER["REQUEST_METHOD"] == "POST") {
//print_r($_POST);exit;
$sales_tax = str_replace(",", "", $sales_tax); foreach ($_POST as $k => $v) {
$total_price = str_replace(",", "", $total_price); $$k = htmlspecialchars(stripslashes(trim($v)));
$item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@")); }
$create_at = date("Y-m-d H:i:s"); $sales_tax = str_replace(",", "", $sales_tax);
$service_charge = str_replace(",", "", $service_charge);
// 避免報價單編號重覆 $total_price = str_replace(",", "", $total_price);
$repair_no_a = date("Ymd"); $item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@"));
$sql = "select max(repair_no) from pricereview_repair_main where SUBSTRING(repair_no, 1, 8) = '$repair_no_a'"; $create_at = date("Y-m-d H:i:s");
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res); // 避免報價單編號重覆
if (empty($row[0])) $serial = "001"; $repair_no_a = date("Ymd");
else $serial = str_pad(substr($row[0]+1, -3), 3, 0, STR_PAD_LEFT); $sql = "select max(repair_no) from pricereview_repair_main where SUBSTRING(repair_no, 1, 8) = '$repair_no_a'";
$new_repair_no = $repair_no_a.$serial; $res = mysqli_query($link, $sql);
if ($new_repair_no != $repair_no) $repair_no = $new_repair_no; $row = mysqli_fetch_row($res);
if (empty($row[0])) $serial = "001";
// 價審單-主文 pricereview_repair_main else $serial = str_pad(substr($row[0] + 1, -3), 3, 0, STR_PAD_LEFT);
$db_query = "insert into pricereview_repair_main(repair_no, contractno, masada_addr, company, taxid, invoice, facilityno, "; $new_repair_no = $repair_no_a . $serial;
$db_query .= "address, sales_tax, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at) values ("; if ($new_repair_no != $repair_no) $repair_no = $new_repair_no;
$db_query .= "'$repair_no', '$contractno', '$masada_addr', '$company', '$taxid', '$invoice', '$facilityno', ";
$db_query .= "'$address', $sales_tax, $total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at')"; // 價審單-主文 pricereview_repair_main
$result = mysqli_query($link, $db_query); $db_query = "INSERT INTO pricereview_repair_main(repair_no, contractno, masada_addr, company, taxid, invoice, facilityno, ";
$affected = mysqli_affected_rows($link); $db_query .= "address, sales_tax, service_charge, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at) values (";
if ($rid = mysqli_insert_id($link)) { $db_query .= "'$repair_no', '$contractno', '$masada_addr', '$company', '$taxid', '$invoice', '$facilityno', ";
// 價審單-明細項目 pricereview_repair_item $db_query .= "'$address', $sales_tax ,$service_charge ,$total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at')";
$item_title_all = str_replace("點選", "", $item_title_all); $result = mysqli_query($link, $db_query);
$item_title_arr = explode(",", $item_title_all); $affected = mysqli_affected_rows($link);
$item_qty_arr = explode(",", $item_qty_all); if ($rid = mysqli_insert_id($link)) {
$item_unit_price_arr = explode(",", $item_unit_price_all); // 價審單-明細項目 pricereview_repair_item
$item_price_bp_arr = explode(",", $item_price_bp_all); $item_title_all = str_replace("點選", "", $item_title_all);
$item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@")); $item_title_arr = explode(",", $item_title_all);
$item_no = 1; $item_qty_arr = explode(",", $item_qty_all);
for ($i=0; $i<count($item_title_arr); $i++) { $item_unit_price_arr = explode(",", $item_unit_price_all);
$item_qty_arr[$i] = str_replace(",", "", $item_qty_arr[$i]); $item_price_bp_arr = explode(",", $item_price_bp_all);
$item_unit_price_arr[$i] = str_replace(",", "", $item_unit_price_arr[$i]); $item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@"));
$item_price_bp_arr[$i] = str_replace(",", "", $item_price_bp_arr[$i]); $item_no = 1;
$db_query = "insert into pricereview_repair_item (rid, item_no, title, item_unit_price, item_qty, item_price_bp, memo) values ("; for ($i = 0; $i < count($item_title_arr); $i++) {
$db_query .= "'$rid', '$item_no', '$item_title_arr[$i]', '$item_unit_price_arr[$i]', '$item_qty_arr[$i]', '$item_price_bp_arr[$i]', '$item_memo_arr[$i]')"; $item_qty_arr[$i] = str_replace(",", "", $item_qty_arr[$i]);
$result = mysqli_query($link, $db_query); $item_unit_price_arr[$i] = str_replace(",", "", $item_unit_price_arr[$i]);
$item_no++; $item_price_bp_arr[$i] = str_replace(",", "", $item_price_bp_arr[$i]);
} $db_query = "insert into pricereview_repair_item (rid, item_no, title, item_unit_price, item_qty, item_price_bp, memo) values (";
$db_query .= "'$rid', '$item_no', '$item_title_arr[$i]', '$item_unit_price_arr[$i]', '$item_qty_arr[$i]', '$item_price_bp_arr[$i]', '$item_memo_arr[$i]')";
// 更新待簽表 $result = mysqli_query($link, $db_query);
#係統ID $item_no++;
$system_id = 'prm'; }
#流程ID
$flow_id = 'prm03'; // 更新待簽表
#表單號 $form_id; #係統ID
$form_id = $rid; $system_id = 'prm';
$wf = new WorkFlow($system_id, $flow_id, $form_id); #流程ID
$wf->initWorkFlow($user_id); $flow_id = 'prm03';
$form_key = $wf->flowContext->getFormKey(); #表單號 $form_id;
$sql = "insert into assign (form_key, seq, assigner, assign_opinion) values ('$form_key', 1, '$next_users', '$repair_no')"; $form_id = $rid;
mysqli_query($link, $sql); $wf = new WorkFlow($system_id, $flow_id, $form_id);
$sql = "update subflow set seq = seq+1, current_assigner = '$next_users', update_date = '$create_at' where form_key = '$form_key'"; $wf->initWorkFlow($user_id);
mysqli_query($link, $sql); $form_key = $wf->flowContext->getFormKey();
} $sql = "insert into assign (form_key, seq, assigner, assign_opinion) values ('$form_key', 1, '$next_users', '$repair_no')";
mysqli_query($link, $sql);
mysqli_close($link); $sql = "update subflow set seq = seq+1, current_assigner = '$next_users', update_date = '$create_at' where form_key = '$form_key'";
if ($affected > 0) { mysqli_query($link, $sql);
echo "<script type = 'text/JavaScript'>"; }
echo "alert('提交成功');";
echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&".$token_link."';"; mysqli_close($link);
echo "</script>"; if ($affected > 0) {
} else { echo "<script type = 'text/JavaScript'>";
echo "<script type = 'text/JavaScript'>"; echo "alert('提交成功');";
echo "alert('提交失敗,請重新操作');"; echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&" . $token_link . "';";
echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&".$token_link."';"; echo "</script>";
echo "</script>"; } else {
} echo "<script type = 'text/JavaScript'>";
} echo "alert('提交失敗,請重新操作');";
?> echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&" . $token_link . "';";
echo "</script>";
}
}

351
wms/sign/list.php

@ -1,176 +1,177 @@
<?php <?php
error_reporting(E_ALL); // phpinfo();
ini_set("display_errors", "on"); // exit();
/** error_reporting(E_ALL);
* 显示所有的待签 员工所有待签 ini_set("display_errors", "on");
*/ /**
* 显示所有的待签 员工所有待签
*/
// 載入db.php來連結資料庫
require_once "../database.php";
require_once "../header.php"; // 載入db.php來連結資料庫
require_once "../database.php";
require_once "../header.php";
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$where_system_id = " and a.system_id like '" . $system_id . "%'";
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id']; $where_system_id = " and a.system_id like '" . $system_id . "%'";
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$sql_get = "select c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner, $where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name ,
flow_name,c.update_date ,c.create_date,b.path,d.flow_code from system_main a,flow_main b ,subflow $sql_get = "SELECT c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner,
c,flow d concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name ,
where a.system_id=b.system_id flow_name,c.update_date ,c.create_date,b.path,d.flow_code FROM system_main a,flow_main b ,subflow
and b.flow_id=d.flow_id c,flow d
and c.current_assigner='$user_id' WHERE a.system_id=b.system_id
and d.flow_id=b.flow_id AND b.flow_id=d.flow_id
and c.form_key=d.form_key AND c.current_assigner='$user_id'
$where_system_id AND d.flow_id=b.flow_id
$where_flow_id AND c.form_key=d.form_key
"; $where_system_id
//echo $sql_get; $where_flow_id
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); ";
echo $sql_get;
$system_name_opt = array_map(function ($item) { $res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']);
}, $res_get); $system_name_opt = array_map(function ($item) {
$system_name_opt = (array_unique($system_name_opt, SORT_REGULAR)); return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']);
}, $res_get);
$system_name_opt = (array_unique($system_name_opt, SORT_REGULAR));
$flow_name_opt = array_map(function ($item) {
return array('flow_id' => $item['flow_id'], 'flow_name' => $item['flow_name']);
}, $res_get); $flow_name_opt = array_map(function ($item) {
$flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR)); return array('flow_id' => $item['flow_id'], 'flow_name' => $item['flow_name']);
}, $res_get);
?> $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
<style>
table { ?>
table-layout: fixed; <style>
width: 90%; table {
} table-layout: fixed;
width: 90%;
td { }
word-wrap: break-word;
} td {
word-wrap: break-word;
img { }
width: 125px;
} img {
width: 125px;
.width_style_1 { }
width: 125px;
} .width_style_1 {
width: 125px;
.table>tbody>tr>td, }
.table>tbody>tr>th,
.table>tfoot>tr>td, .table>tbody>tr>td,
.table>tfoot>tr>th, .table>tbody>tr>th,
.table>thead>tr>td, .table>tfoot>tr>td,
.table>thead>tr>th { .table>tfoot>tr>th,
vertical-align: middle !important; .table>thead>tr>td,
} .table>thead>tr>th {
vertical-align: middle !important;
#table_index_filter { }
float: right;
} #table_index_filter {
float: right;
#table_index_paginate { }
float: right;
} #table_index_paginate {
float: right;
}
table.query-table th {
text-align: right;
} table.query-table th {
text-align: right;
</style> }
<form method='post' action='#'> </style>
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'> <form method='post' action='#'>
<thead> <table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'>
<tr> <thead>
<td colspan="8"> <tr>
<h3 style='text-align:center'>待簽查詢</h3> <td colspan="8">
</td> <h3 style='text-align:center'>待簽查詢</h3>
</tr> </td>
</tr>
</thead>
<tbody> </thead>
<tr> <tbody>
<th style='width:50px'>系統名稱</th> <tr>
<td colspan='1'> <th style='width:50px'>系統名稱</th>
<select class='form-control' name='system_id'> <td colspan='1'>
<?php <select class='form-control' name='system_id'>
echo " <option class='form-control' value='%' >全部</option>"; <?php
foreach ($system_name_opt as $opt) { echo " <option class='form-control' value='%' >全部</option>";
echo " <option class='form-control' value=" . $opt['system_id'] . " >" . $opt['system_name'] . "</option>"; foreach ($system_name_opt as $opt) {
} echo " <option class='form-control' value=" . $opt['system_id'] . " >" . $opt['system_name'] . "</option>";
?> }
</select> ?>
</td> </select>
<th>流程名稱</th> </td>
<td colspan='1'> <select class='form-control' name='flow_id'> <th>流程名稱</th>
<?php <td colspan='1'> <select class='form-control' name='flow_id'>
echo " <option class='form-control' value='%' >全部</option>"; <?php
foreach ($flow_name_opt as $opt) { echo " <option class='form-control' value='%' >全部</option>";
echo " <option class='form-control' value=" . $opt['flow_id'] . " >" . $opt['flow_name'] . "</option>"; foreach ($flow_name_opt as $opt) {
} echo " <option class='form-control' value=" . $opt['flow_id'] . " >" . $opt['flow_name'] . "</option>";
?> }
</select> </td> ?>
</select> </td>
</tr>
</tbody> </tr>
<tfoot> </tbody>
<tr> <tfoot>
<td colspan="8" style='text-align:center'> <tr>
<button type="submit" style='text-align:center; margin:0 auto;width:50px' class="btn btn-primary">查詢</button> <td colspan="8" style='text-align:center'>
</td> <button type="submit" style='text-align:center; margin:0 auto;width:50px' class="btn btn-primary">查詢</button>
</tr> </td>
</tfoot> </tr>
</table> </tfoot>
<div style="overflow-x:auto;width:92%;margin:0 auto"> </table>
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact"> <div style="overflow-x:auto;width:92%;margin:0 auto">
<thead> <table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact">
<tr> <thead>
<th>序號</th> <tr>
<th>系統名稱</th> <th>序號</th>
<th>流程名稱</th> <th>系統名稱</th>
<th>接收日期</th> <th>流程名稱</th>
<th>當前簽核者</th> <th>接收日期</th>
<th>狀態</th> <th>當前簽核者</th>
</tr> <th>狀態</th>
</thead> </tr>
<tbody> </thead>
<tbody>
<?php
$rowspan = 1; <?php
foreach ($res_get as $key => $data) : $rowspan = 1;
//嘗試將已結案隱藏起來 : 測試使用者體驗 foreach ($res_get as $key => $data) :
if ($data['flow_code'] !== 'Z') { //嘗試將已結案隱藏起來 : 測試使用者體驗
?> if ($data['flow_code'] !== 'Z') {
<tr> ?>
<td><a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>"><?= $data['form_key']; ?></a></td> <tr>
<td><?php echo $data['system_name']; ?></td> <td><a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>"><?= $data['form_key']; ?></a></td>
<td><?php echo $data['flow_name']; ?></td> <td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['update_date']; ?></td> <td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['current_assigner_name']; ?></td> <td><?php echo $data['update_date']; ?></td>
<td><?php echo $data['flow_code'] == 'Z' ? "結案" : ""; ?></td> <td><?php echo $data['current_assigner_name']; ?></td>
</tr> <td><?php echo $data['flow_code'] == 'Z' ? "結案" : ""; ?></td>
</tr>
<?php
} <?php
endforeach; }
?> endforeach;
</tbody> ?>
</table> </tbody>
</div> </table>
</form> </div>
<?php </form>
#代錶結束連線 <?php
mysqli_close($link); #代錶結束連線
require_once "../footer.php"; mysqli_close($link);
require_once "../footer.php";
?> ?>

1202
wms/sign/sign_form.php

File diff suppressed because it is too large
Loading…
Cancel
Save