20 changed files with 27504 additions and 90 deletions
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,23 @@ |
|||||
|
<?php |
||||
|
require_once('../conn.php'); |
||||
|
if(isset($_GET['contractno']) && $_GET['contractno']!=''){ |
||||
|
try{ |
||||
|
$contractno = $_GET['contractno']; |
||||
|
$sql_str = "SELECT * FROM con_maintance_examine_apply |
||||
|
LEFT 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"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':vol_no', $contractno); |
||||
|
$stmt->execute(); |
||||
|
$contract = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
$contractResponse = json_encode($contract); |
||||
|
|
||||
|
// 設定回應標頭為 JSON |
||||
|
header('Content-Type: application/json'); |
||||
|
|
||||
|
// 將 JSON 回應返回給客戶端 |
||||
|
echo json_encode($contract); |
||||
|
}catch (PDOException $e ){ |
||||
|
die("ERROR!!!: ". $e->getMessage()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
<?php |
||||
|
require_once("../conn.php"); |
||||
|
ini_set ( 'date.timezone' , 'Asia/Taipei' ); |
||||
|
if(isset($_POST["contractno"]) && $_POST["contractno"] != "") { |
||||
|
try{ |
||||
|
$conn->beginTransaction(); |
||||
|
|
||||
|
$contractno = $_POST['contractno'] ?? ''; |
||||
|
$total_price = $_POST['total_price'] ?? ''; |
||||
|
$vat = $_POST['vat'] ?? ''; |
||||
|
$mtype = $_POST['mtype'] ?? ''; |
||||
|
$opendoor = $_POST['opendoor'] ?? ''; |
||||
|
$phone = $_POST['phone'] ?? ''; |
||||
|
$email = $_POST['email'] ?? ''; |
||||
|
$mworker = $_POST['mworker'] ?? ''; |
||||
|
$mcycle = $_POST['mcycle'] ?? ''; |
||||
|
$salesman = $_POST['salesman'] ?? ''; |
||||
|
$contract_begin_date = $_POST['contract_begin_date'] ?? ''; |
||||
|
$contract_end_date = $_POST['contract_end_date'] ?? ''; |
||||
|
$address = $_POST['address'] ?? ''; |
||||
|
$customer = $_POST['customer'] ?? ''; |
||||
|
$partyA = $_POST['partyA'] ?? ''; |
||||
|
$partyAaddress = $_POST['partyAaddress'] ?? ''; |
||||
|
$partyAphone = $_POST['partyAphone'] ?? ''; |
||||
|
$partyAemail = $_POST['partyAemail'] ?? ''; |
||||
|
$user_id = $_POST['user_id'] ?? ''; |
||||
|
$files = $_FILES['files'] ?? ''; |
||||
|
|
||||
|
//create account table |
||||
|
$accounttype = "A"; |
||||
|
$accountid = $vat; |
||||
|
$pwd = "123"; |
||||
|
$name = $partyA; |
||||
|
$tel = $phone ?? ''; |
||||
|
$repairerid = $mworker; |
||||
|
$creater = $user_id; |
||||
|
$create_at = date('Y-m-d H:i:s'); |
||||
|
|
||||
|
|
||||
|
$sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)"; |
||||
|
$stmt = $conn -> prepare($sql_str); |
||||
|
$stmt -> bindParam(':accounttype' ,$accounttype); |
||||
|
$stmt -> bindParam(':accountid' ,$accountid); |
||||
|
$stmt -> bindParam(':pwd' ,$pwd); |
||||
|
$stmt -> bindParam(':name' ,$name); |
||||
|
$stmt -> bindParam(':tel' ,$tel); |
||||
|
$stmt -> bindParam(':address' ,$address); |
||||
|
$stmt -> bindParam(':email' ,$email); |
||||
|
$stmt -> bindParam(':repairerid' ,$repairerid); |
||||
|
$stmt -> bindParam(':creater' ,$creater); |
||||
|
$stmt -> bindParam(':create_at' ,$create_at); |
||||
|
$stmt -> execute(); |
||||
|
|
||||
|
header('Content-Type: application/json'); |
||||
|
$jsonData = json_encode($files); |
||||
|
echo $jsonData; |
||||
|
|
||||
|
$conn->commit(); |
||||
|
}catch(PDOException $e){ |
||||
|
$conn->rollBack(); |
||||
|
die('Error!:'.$e->getMessage()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,33 @@ |
|||||
|
<?php |
||||
|
date_default_timezone_set("Asia/Taipei"); |
||||
|
$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"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
date_default_timezone_set("Asia/Taipei"); |
||||
|
$host = getenv('DB_HOST'); |
||||
|
$dbuser = getenv('DB_USERNAME'); |
||||
|
$dbpassword = getenv('DB_PASSWORD'); |
||||
|
$dbname = getenv('DB_DATABASE'); |
||||
|
$link = mysqli_connect($host,$dbuser,$dbpassword,$dbname); |
||||
|
|
||||
|
if($link){ |
||||
|
mysqli_query($link,'SET NAMES utf8'); |
||||
|
// echo "正確連接資料庫"; |
||||
|
} |
||||
|
else { |
||||
|
echo "不正確連接資料庫</br>" . mysqli_connect_error(); |
||||
|
} |
||||
|
|
||||
|
?> |
||||
|
|
Loading…
Reference in new issue