3 changed files with 142 additions and 38 deletions
@ -0,0 +1,68 @@ |
|||||
|
<?php |
||||
|
require_once("../conn.php"); |
||||
|
ini_set ( 'date.timezone' , 'Asia/Taipei' ); |
||||
|
if(isset($_POST['vol_no']) && !empty($_POST['vol_no'])){ |
||||
|
$mid = $_POST['mid']; |
||||
|
$vol_no = $_POST['vol_no']; |
||||
|
$salesman = $_POST['salesman']; |
||||
|
$apply_date = $_POST['apply_date']; |
||||
|
$apply_type = $_POST['apply_type']; |
||||
|
$case_name = $_POST['case_name']; |
||||
|
$customer = $_POST['company']; |
||||
|
$manager = $_POST['manager']; |
||||
|
$vat = $_POST['vat']; |
||||
|
$total_price = $_POST['total_price']; |
||||
|
$buy_fee = $_POST['price_a']; |
||||
|
$install_fee = $_POST['price_b']; |
||||
|
$contact_address = $_POST['address']; |
||||
|
$workdeadline_a = $_POST['workdeadline_a']; |
||||
|
$workdeadline_b = $_POST['workdeadline_b']; |
||||
|
$test_time = $_POST['regulations']; |
||||
|
$freedeadline = $_POST['freedeadline']; |
||||
|
$trade_address = $_POST['tradeaddress']; |
||||
|
$tradedeadline = $_POST['tradedeadline']; |
||||
|
$progress = 0; |
||||
|
$status = 0; |
||||
|
$created_at = date('Y-m-d H:i:s'); |
||||
|
$created_by = $_POST['user_id']; |
||||
|
$isFirst = $_POST['isFirst']; |
||||
|
$conn->beginTransaction(); |
||||
|
try{ |
||||
|
if($isFirst == 1){ |
||||
|
$sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, progress, status, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :progress, :status, :created_at, :created_by)"; |
||||
|
$stmt = $conn -> prepare($sql_str); |
||||
|
$stmt ->bindParam(':mid', $mid); |
||||
|
$stmt ->bindParam(':contractno', $vol_no); |
||||
|
$stmt ->bindParam(':sales_man', $salesman); |
||||
|
$stmt ->bindParam(':apply_date', $apply_date); |
||||
|
$stmt ->bindParam(':apply_type', $apply_type); |
||||
|
$stmt ->bindParam(':case_name', $case_name); |
||||
|
$stmt ->bindParam(':customer', $customer); |
||||
|
$stmt ->bindParam(':manager', $manager); |
||||
|
$stmt ->bindParam(':vat', $vat); |
||||
|
$stmt ->bindParam(':total_price', $total_price); |
||||
|
$stmt ->bindParam(':buy_fee', $buy_fee); |
||||
|
$stmt ->bindParam(':install_fee', $install_fee); |
||||
|
$stmt ->bindParam(':contact_address', $contact_address); |
||||
|
$stmt ->bindParam(':workdeadline_a', $workdeadline_a); |
||||
|
$stmt ->bindParam(':workdeadline_b', $workdeadline_b); |
||||
|
$stmt ->bindParam(':test_time', $test_time); |
||||
|
$stmt ->bindParam(':freedeadline', $freedeadline); |
||||
|
$stmt ->bindParam(':trade_address', $trade_address); |
||||
|
$stmt ->bindParam(':tradedeadline', $tradedeadline); |
||||
|
$stmt ->bindParam(':progress', $progress); |
||||
|
$stmt ->bindParam(':status', $status); |
||||
|
$stmt ->bindParam(':created_at', $created_at); |
||||
|
$stmt ->bindParam(':created_by', $created_by); |
||||
|
$stmt ->execute(); |
||||
|
header("HTTP/1.1 201 success!"); |
||||
|
$conn->commit(); |
||||
|
} |
||||
|
}catch(PDOException $e){ |
||||
|
$conn->rollback(); |
||||
|
echo $e->getMessage(); |
||||
|
die('Error!:'.$e->getMessage()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue