@ -1,42 +1,51 @@ |
|||
<?php |
|||
|
|||
require_once "../../mkt/conn.php"; |
|||
|
|||
$spec = $_GET['spec'] ?? ''; |
|||
$person = $_GET['person'] ?? ''; |
|||
$stop = $_GET['stop'] ?? ''; |
|||
$weight = $_GET['weight'] ?? ''; |
|||
$speed = $_GET['speed'] ?? ''; |
|||
$m1 = $_GET['m1'] ?? ''; |
|||
$method = $_GET['method'] ?? ''; |
|||
$cycle = $_GET['cycle'] ?? ''; |
|||
$elevator_type = match($spec){ |
|||
try{ |
|||
$spec = $_GET['spec'] ?? ''; |
|||
$person = $_GET['person'] ?? ''; |
|||
$stop = $_GET['stop'] ?? ''; |
|||
$weight = $_GET['weight'] ?? ''; |
|||
$speed = $_GET['speed'] ?? ''; |
|||
$m1 = $_GET['m1'] ?? ''; |
|||
$method = $_GET['method'] ?? ''; |
|||
$cycle = $_GET['cycle'] ?? ''; |
|||
$specArr = [ |
|||
"MAE100" => "A", |
|||
"MAF100" => "B", |
|||
"MAM200" => "D", |
|||
"MAH100" => "E", |
|||
}; |
|||
$sql_str = "SELECT * FROM maintain_standard_option |
|||
WHERE elevator_type=:elevator_type AND min_speed<=:speed AND max_speed>=:speed AND min_persons <= :person AND max_persons >= :person AND is_m1_bundle=:m1 |
|||
ORDER bY id DESC"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':elevator_type', $elevator_type); |
|||
$stmt->bindParam(':person', $person); |
|||
$stmt->bindParam(':speed', $speed); |
|||
$stmt->bindParam(':m1', $m1); |
|||
$stmt->execute(); |
|||
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
if(!$result){ |
|||
]; |
|||
// $elevator_type = match($spec){ |
|||
// "MAE100" => "A", |
|||
// "MAF100" => "B", |
|||
// "MAM200" => "D", |
|||
// "MAH100" => "E", |
|||
// }; |
|||
$elevator_type = $specArr[$spec]; |
|||
$sql_str = "SELECT * FROM maintain_standard_option |
|||
WHERE elevator_type=:elevator_type AND min_speed<=:speed AND max_speed>=:speed AND min_persons <= :person AND max_persons >= :person AND is_m1_bundle=:m1 |
|||
ORDER bY id DESC"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':elevator_type', $elevator_type); |
|||
$stmt->bindParam(':person', $person); |
|||
$stmt->bindParam(':speed', $speed); |
|||
$stmt->bindParam(':m1', $m1); |
|||
$stmt->execute(); |
|||
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
if(!$result){ |
|||
echo 0; |
|||
exit; |
|||
} |
|||
$differ = $stop > $result['max_floors'] ? $result['max_floors'] - $result['min_floors'] : ($stop - $result['min_floors']); |
|||
$price = $result['base_price'] + $differ * $result['floors_price'] +$result['m1_bundle_fee']; |
|||
if($cycle == 2){ |
|||
} |
|||
$differ = $stop > $result['max_floors'] ? $result['max_floors'] - $result['min_floors'] : ($stop - $result['min_floors']); |
|||
$price = $result['base_price'] + $differ * $result['floors_price'] +$result['m1_bundle_fee']; |
|||
if($cycle == 2){ |
|||
$price += $price * $result['maintenance_fee_coefficient']; |
|||
} |
|||
if($method == "A"){ |
|||
} |
|||
if($method == "A"){ |
|||
$price += $result['all_inclusive_fee']; |
|||
} |
|||
} |
|||
|
|||
echo $price; |
|||
echo $price; |
|||
}catch(PDOException $e){ |
|||
echo $e->getMessage(); |
|||
} |
@ -0,0 +1,127 @@ |
|||
<?php |
|||
|
|||
require_once('../../mkt/conn.php'); |
|||
date_default_timezone_set("Asia/Taipei"); |
|||
|
|||
$sign = $_POST['sign']; |
|||
$mid = $_POST['mid']; |
|||
$result = $_POST['result']; |
|||
$reviewcomment = $_POST['reviewcomment']; |
|||
$sign_id = $_POST['currentSignId']; |
|||
$token = $_POST['token']; |
|||
$form_key = $_POST['form_key']; |
|||
$signOff = ''; |
|||
$updated_at = date("Y-m-d H:i:s"); |
|||
|
|||
if($result == 'YY' ){ |
|||
$signOff = 'YY'; |
|||
}elseif($result == 'YN'){ |
|||
$signOff = 'N'; |
|||
}elseif($result == 'YS'){ |
|||
$signOff = 'Y'; |
|||
} |
|||
try{ |
|||
$user_id = $_POST['user_id']; |
|||
$sign_result = $user_id . "," . $signOff . "," . date("Y-m-d H:i:s"); |
|||
$sql_str = "UPDATE pricereview_maintain_sign SET sign{$sign}=:sign, sign{$sign}_note = :reviewcomment WHERE mid = :mid AND id = :sign_id"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':sign', $sign_result); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':reviewcomment', $reviewcomment); |
|||
$stmt->bindParam(':sign_id', $sign_id); |
|||
$stmt->execute(); |
|||
|
|||
if($sign == 3){ |
|||
$sql_str = "UPDATE con_maintance_examine_apply SET status=:status, updated_at=:updated_at WHERE apply_key = :apply_key "; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':status', $result); |
|||
$stmt->bindParam(':apply_key', $mid); |
|||
$stmt->bindParam(':updated_at', $updated_at); |
|||
$stmt->execute(); |
|||
}else{ |
|||
$sql_str = "UPDATE con_maintance_examine_apply SET status=:status WHERE apply_key = :apply_key "; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':status', $result); |
|||
$stmt->bindParam(':apply_key', $mid); |
|||
$stmt->execute(); |
|||
} |
|||
|
|||
|
|||
include_once "./postSystemNotice.php"; |
|||
$sql_str = "SELECT * FROM con_maintance_examine_apply WHERE apply_key = :apply_key ORDER BY create_at DESC LIMIT 1"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':apply_key', $mid); |
|||
$stmt->execute(); |
|||
$contract = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
$ekind = "保養"; |
|||
|
|||
$sql_str = "SELECT * FROM pricereview_maintain_sign WHERE mid = :mid AND id = :sign_id"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':sign_id', $sign_id); |
|||
$stmt->execute(); |
|||
$currentsign = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
$permissions = []; |
|||
$content = ""; |
|||
$url = "cont/pricereviewCheck.php?apply_key=" . $mid; |
|||
if($signOff == "YY"){ |
|||
if($currentsign['sign1']!=NULL){ $permissions[] = explode(",", $currentsign['sign1'])[0] ; } |
|||
if($currentsign['sign2']!=NULL){ $permissions[] = explode(",", $currentsign['sign2'])[0] ; } |
|||
if($currentsign['sign3']!=NULL){ $permissions[] = explode(",", $currentsign['sign3'])[0] ; } |
|||
if($currentsign['sign4']!=NULL){ $permissions[] = explode(",", $currentsign['sign4'])[0] ; } |
|||
$permissions[] = $contract['salesman']; |
|||
$title = $ekind . "價審結案通知(".$contract['vol_no']."," .$contract['customer']. ")"; |
|||
$content = "狀態:結案同意<br>"; |
|||
$current_assigner = "00000"; |
|||
}elseif($signOff == "Y"){ |
|||
if($sign == 1 || $sign == 2 || $sign == 3){ |
|||
$signer = $currentsign['sign'.($sign+1)]; |
|||
if($signer == NULL){ |
|||
$signer = $currentsign['sign'.($sign+2)]; |
|||
} |
|||
$permissions[] = explode(",", $signer)[0]; |
|||
$current_assigner = explode(",", $signer)[0]; |
|||
$title = $ekind . "價審待簽通知(".$contract['vol_no']."," .$contract['customer']. ")"; |
|||
$content = "狀態:待簽核<br>"; |
|||
} |
|||
}elseif($signOff == "N"){ |
|||
$signer = $contract['salesman']; |
|||
$permissions[] = $signer; |
|||
$title = $ekind . "價審退回通知(".$contract['vol_no']."," .$contract['customer']. ")"; |
|||
$content = "狀態:退回<br>"; |
|||
$url = "cont/pricereviewCreate.php?vol_no=" . $vol_no; |
|||
$current_assigner = "00000"; |
|||
} |
|||
|
|||
$kind = 1; |
|||
$related_id = $mid; |
|||
$content .= "合約號:".$contract['vol_no'] . "<br>"; |
|||
$content .= "客戶名稱:" . $contract['customer'] . "<br>"; |
|||
$content .= "案件名稱:" . $contract['case_name'] . "<br>"; |
|||
$content .= "時間" . date("Y-m-d H:i:s"); |
|||
// $content .= "<a href='./mkt/pricreviewCheck.php?id=".$mid.">前往查看</a>"; |
|||
$havaread = null; |
|||
$creater = "system"; |
|||
$create_at = date("Y-m-d H:i:s"); |
|||
sendSystemNotice($kind, $related_id, $title, $content, $havaread, $permissions, $creater, $create_at, $url); |
|||
|
|||
//待簽通知 |
|||
if($form_key == null){ |
|||
$sql_str = "SELECT form_key FROM flow WHERE form_id = :form_id AND system_id = 'prm' AND flow_id='prm04'"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':form_id', $mid); |
|||
$stmt->execute(); |
|||
$form_key = $stmt->fetch(PDO::FETCH_ASSOC)['form_key']; |
|||
} |
|||
include_once "./postFlow.php"; |
|||
if($signOff == "YY") $flow_code = "Z"; |
|||
if($signOff == "Y") $flow_code = "B"; |
|||
if($signOff == "N") $flow_code = "A"; |
|||
if($form_key == null){ |
|||
throw new PDOException("form_key 不存在!"); |
|||
} |
|||
createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key); |
|||
echo 1; |
|||
}catch(PDOException $e){ |
|||
echo $e->getMessage(); |
|||
} |
@ -0,0 +1,49 @@ |
|||
<?php |
|||
$envFile = __DIR__ . '/.env'; // .env 文件的路径 |
|||
|
|||
if (file_exists($envFile)) { |
|||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|||
if ($lines !== false) { |
|||
foreach ($lines as $line) { |
|||
list($key, $value) = explode('=', $line, 2); |
|||
$key = trim($key); |
|||
$value = trim($value); |
|||
// 设置环境变量 |
|||
putenv("$key=$value"); |
|||
} |
|||
} |
|||
} |
|||
$db_hostname = getenv('DB_HOST'); //資料庫主機名稱 |
|||
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號 |
|||
$db_password = getenv('DB_PASSWORD'); //登入密碼 |
|||
$db_name = getenv('DB_DATABASE'); //使用的資料庫 |
|||
$db_charset = 'utf8'; //設定字元編碼 |
|||
|
|||
|
|||
$db_hostname = 'localhost'; //資料庫主機名稱 |
|||
$db_username = 'root'; //登入資料庫的管理者的帳號 |
|||
$db_password = ''; //登入密碼 |
|||
$db_name = 'appwms'; //使用的資料庫 |
|||
$db_charset = 'utf8'; //設定字元編碼 |
|||
//建立PDO的指定工作 |
|||
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset"; |
|||
|
|||
try{ |
|||
//使用PDO連接到MySQL資料庫,建立PDO物件 |
|||
$conn = new PDO($dsn, $db_username, $db_password); |
|||
|
|||
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException) |
|||
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定 |
|||
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊 |
|||
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 |
|||
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 |
|||
//設定主動以警告的形式報錯 |
|||
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); |
|||
//如果連接錯誤,將抛出一個PDOException異常對象 |
|||
} |
|||
catch ( PDOException $e ){ |
|||
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 |
|||
die("ERROR!!!: ". $e->getMessage()); |
|||
} |
|||
|
|||
//$conn = null; //關閉資料庫的連線 |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 256 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 614 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 27 KiB |