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.
 
 
 
 
 
 

44 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'];
if($spec == "MAE100"){
$elevator_type = "A";
}elseif($spec == "MAF100"){
$elevator_type = "B";
}elseif($spec == "MAM200"){
$elevator_type = "D";
}elseif($spec == "MAH100"){
$elevator_type = "E";
}
$sql_str = "SELECT * FROM maintain_standard_option WHERE elevator_type=:elevator_type AND min_speed = :min_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(':min_speed', $speed);
$stmt->bindParam(':person', $person);
$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;