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.
 
 
 
 
 
 

49 lines
1.6 KiB

<?php
require_once('../conn.php');
$spec = $_GET['spec'];
$person = $_GET['person'];
$stop = $_GET['stop'];
$open = $_GET['open'];
$speed = $_GET['speed'];
$weight = $_GET['weight'];
$sql_str = "SELECT * FROM elevator_mi_option WHERE elevator_type = :elevator_type AND max_weight = :max_weight AND max_speed = :max_speed ORDER BY id DESC LIMIT 1";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':elevator_type', $spec);
$stmt->bindParam(':max_weight', $weight);
$stmt->bindParam(':max_speed', $speed);
$stmt->execute();
$mi = $stmt->fetch(PDO::FETCH_ASSOC);
if(!$mi){
echo false;
exit;
}
$stop = $stop > $mi['max_floors'] ? $mi['max_floors'] : $stop;
$stop = $stop < 2 ? 2 : $stop;
$equipment_fee = round($mi['purchase_cost'] + ($stop - $mi['base_floor']) * $mi['material_plus']);
$customs_shipping_fee = round($equipment_fee * 0.09);
$unloading_fee = round($mi['unloading']);
$transport_site_fee = round($mi['transport_site']);
$install_fee = round(($mi['install_price'] + ($stop - $mi['base_floor']) * $mi['install_plus']) + $mi['trial_price'] + ($stop - $mi['base_floor']) * $mi['trial_plus']);
$free1y_fee = round($mi['free1y']);
$other_fee = round($mi['crane'] + $mi['wooden_box'] + $mi['consume'] + $mi['consumables']);
$add_price = 0;
if($spec == 'MAH100') $add_price = 13500;
$newMI = [
'equipment_fee'=>$equipment_fee,
'customs_shipping_fee'=>$customs_shipping_fee,
'unloading_fee'=>$unloading_fee,
'transport_site_fee'=>$transport_site_fee,
'install_fee'=>$install_fee,
'free1y_fee'=>$free1y_fee,
'other_fee'=>$other_fee,
'add_price'=>$add_price,
];
echo json_encode($newMI);