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.
68 lines
2.4 KiB
68 lines
2.4 KiB
<?php
|
|
include "../header.php";
|
|
|
|
$id = $_GET['id'];
|
|
|
|
function getMI($id){
|
|
$specarr = [];
|
|
$elno = [];
|
|
require_once("./conn.php");
|
|
$sql_str = "SELECT * FROM pricereview_item WHERE mid = :id";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':id', $id);
|
|
$stmt->execute();
|
|
$price_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
foreach($price_items as $item){
|
|
if($item['item_group'] == "A"){
|
|
$openfn = trim(explode("-", $item['item_spec'])[2]);
|
|
$openname = "";
|
|
$speed = "";
|
|
if(str_contains($openfn, "2U")){
|
|
$speed = str_replace("2U", "", $openfn);
|
|
$openname = "2U";
|
|
}elseif(str_contains($openfn, "4PCO")){
|
|
$speed = str_replace("4PCO","", $openfn);
|
|
$openname = "4PCO";
|
|
}elseif(str_contains($openfn, "6PCO")){
|
|
$speed = str_replace("6PCO","", $openfn);
|
|
$openname = "6PCO";
|
|
}elseif(str_contains($openfn, "2S")){
|
|
$speed = str_replace("2S","", $openfn);
|
|
$openname = "2S";
|
|
}elseif(str_contains($openfn, "CO")){
|
|
$speed = str_replace("CO","", $openfn);
|
|
$openname = "CO";
|
|
}else{
|
|
|
|
}
|
|
|
|
// specarr[] = [trim(explode("-", $item['item_spec'])[0]), explode("*", explode("-", $item['item_spec'])[1])[1]];
|
|
$specarr[] = [trim(explode("-", $item['item_spec'])[0]), explode("*", trim(explode("-", $item['item_spec'])[1]))[0], explode("*", trim(explode("-", $item['item_spec'])[1]))[1], $openname, $speed, $item['item_weight']];
|
|
|
|
$elno[] = trim("'".explode("-", $item['item_spec'])[0]. "'");
|
|
}
|
|
}
|
|
$quotation_no = "Q2401002";
|
|
$jsonel = implode(",", $elno);
|
|
$sql_str = "SELECT * FROM elevator_mi_option WHERE elevator_type IN ($jsonel) AND quotation_no = :quotation_no";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':quotation_no', $quotation_no);
|
|
$stmt->execute();
|
|
$output_el_options = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$el_options = [];
|
|
|
|
foreach($output_el_options as $el){
|
|
foreach($specarr as $spec){
|
|
if($el['min_weight'] == $spec['5'] && $el['min_speed'] == $spec['4']){
|
|
$el_options[] = $el;
|
|
}
|
|
}
|
|
}
|
|
print_r($el_options);
|
|
}
|
|
getMI($id);
|
|
|
|
?>
|
|
|
|
|
|
|