You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
<?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){
|
|
"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){
|
|
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){
|
|
$price += $price * $result['maintenance_fee_coefficient'];
|
|
}
|
|
if($method == "A"){
|
|
$price += $result['all_inclusive_fee'];
|
|
}
|
|
|
|
echo $price;
|