@ -0,0 +1,165 @@ |
|||||
|
<?php |
||||
|
require_once('./conn.php'); |
||||
|
require 'vendor/autoload.php'; |
||||
|
ini_set ( 'date.timezone' , 'Asia/Taipei' ); |
||||
|
$id = $_GET['id']; |
||||
|
use PhpOffice\PhpSpreadsheet\IOFactory; |
||||
|
|
||||
|
// 指定要讀取的 Excel 文件 |
||||
|
$filePath = './option/option'.$id.'.xlsx'; |
||||
|
|
||||
|
// 嘗試讀取文件 |
||||
|
try { |
||||
|
$spreadsheet = IOFactory::load($filePath); |
||||
|
} catch (\PhpOffice\PhpSpreadsheet\Reader\Exception $e) { |
||||
|
die('Error loading file: ' . $e->getMessage()); |
||||
|
} |
||||
|
|
||||
|
// 獲取活動工作表 |
||||
|
$sheet = $spreadsheet->getActiveSheet(); |
||||
|
|
||||
|
|
||||
|
$create_at = date('Y-m-d H:i:s'); |
||||
|
$sql_str = "INSERT INTO option_price (kind, subkind, group_name, spec, memo, optional, unit, price, status, create_at) VALUES (:kind, :subkind, :group_name, :spec, :memo, :optional, :unit, :price, :status, :create_at)"; |
||||
|
$sql_str_mi = "INSERT INTO option_mi (option_price_id, min_weight, max_weight, open_kind, base_floor, base_floor_plus, price, quotation_no, create_at) VALUES (:option_price_id, :min_weight, :max_weight, :open_kind, :base_floor, :base_floor_plus, :price, :quotation_no, :create_at)"; |
||||
|
$open_kind_arr = ['CO', '2S']; |
||||
|
// 遍歷工作表中的每一行 |
||||
|
foreach ($sheet->getRowIterator() as $key=>$row) { |
||||
|
// 獲得單元格迭代器 |
||||
|
$cellIterator = $row->getCellIterator(); |
||||
|
$cellIterator->setIterateOnlyExistingCells(false); // This loops through all cells, |
||||
|
// even if a cell value is not set. |
||||
|
// By default, only cells that have a value set will be iterated. |
||||
|
foreach ($cellIterator as $idx=>$cell) { |
||||
|
if ($cell !== null) { |
||||
|
// 打印單元格數據 |
||||
|
// echo $cell->getValue() . '///'; |
||||
|
} |
||||
|
if($idx == 'B'){ |
||||
|
$group_name = $cell->getValue(); |
||||
|
echo $group_name; |
||||
|
}elseif($idx == 'C'){ |
||||
|
$spec = $cell->getValue(); |
||||
|
echo $spec; |
||||
|
}elseif($idx == 'D'){ |
||||
|
$memo = $cell->getValue(); |
||||
|
echo $memo; |
||||
|
}elseif($idx == 'E'){ |
||||
|
if($cell->getValue() == "標配"){ |
||||
|
$optional = 1; |
||||
|
}else{ |
||||
|
$optional = 2; |
||||
|
} |
||||
|
echo $optional; |
||||
|
}elseif($idx == 'F'){ |
||||
|
$cost = $cell->getValue(); |
||||
|
} |
||||
|
elseif($idx == 'G'){ |
||||
|
$price = $cell->getValue(); |
||||
|
echo $price; |
||||
|
}elseif($idx == 'H'){ |
||||
|
$unit = $cell->getValue(); |
||||
|
echo $unit; |
||||
|
} |
||||
|
} |
||||
|
echo "<br>"; // 換行,以分隔不同的行 |
||||
|
|
||||
|
$status = "Y"; |
||||
|
$kindArr = ['A', 'B','C', 'D']; |
||||
|
if($id == 1){ |
||||
|
$kind = 'A'; |
||||
|
$subkind = 'A1'; |
||||
|
}elseif($id == 2){ |
||||
|
$kind = 'B'; |
||||
|
$subkind = 'B1'; |
||||
|
}elseif($id == 3){ |
||||
|
$kind = 'B'; |
||||
|
$subkind = 'B2'; |
||||
|
}elseif($id == 4){ |
||||
|
$kind ='B'; |
||||
|
$subkind = 'B3'; |
||||
|
}elseif($id == 5){ |
||||
|
$kind ='B'; |
||||
|
$subkind = 'B4'; |
||||
|
}elseif($id == 6){ |
||||
|
$kind ='B'; |
||||
|
$subkind = 'B5'; |
||||
|
}elseif($id == 7){ |
||||
|
$kind ='B'; |
||||
|
$subkind = 'B6'; |
||||
|
}elseif($id == 8){ |
||||
|
$kind ='B'; |
||||
|
$subkind = 'B7'; |
||||
|
}elseif($id == 9){ |
||||
|
$kind ='C'; |
||||
|
$subkind = 'C1'; |
||||
|
}elseif($id == 10){ |
||||
|
$kind ='C'; |
||||
|
$subkind = 'C2'; |
||||
|
}elseif($id == 11){ |
||||
|
$kind ='C'; |
||||
|
$subkind = 'C3'; |
||||
|
}elseif($id == 12){ |
||||
|
$kind ='C'; |
||||
|
$subkind = 'C4'; |
||||
|
}elseif($id == 13){ |
||||
|
$kind ='D'; |
||||
|
$subkind = 'D1'; |
||||
|
}elseif($id == 14){ |
||||
|
$kind ='D'; |
||||
|
$subkind = 'D2'; |
||||
|
} |
||||
|
|
||||
|
if(isset($_GET['id'])){ |
||||
|
try{ |
||||
|
$stmt = $conn -> prepare($sql_str); |
||||
|
$stmt ->bindParam(':kind', $kind); |
||||
|
$stmt ->bindParam(':subkind', $subkind); |
||||
|
$stmt ->bindParam(':group_name', $group_name); |
||||
|
$stmt ->bindParam(':spec', $spec); |
||||
|
$stmt ->bindParam(':memo', $memo); |
||||
|
$stmt ->bindParam(':optional', $optional); |
||||
|
$stmt ->bindParam(':unit', $unit); |
||||
|
$stmt ->bindParam(':price', $price); |
||||
|
$stmt ->bindParam(':status', $status); |
||||
|
$stmt ->bindParam(':create_at', $create_at); |
||||
|
// 遍歷當前行的每一個單元格 |
||||
|
$stmt ->execute(); |
||||
|
|
||||
|
$last_id = $conn->lastInsertId(); |
||||
|
|
||||
|
|
||||
|
$option_price_id = $last_id; |
||||
|
$option_price = $cost; |
||||
|
$quotation_no = 'Q2311001'; |
||||
|
foreach($open_kind_arr as $kind){ |
||||
|
$min_weight = 1; |
||||
|
$max_weight = 1600; |
||||
|
$open_kind = $kind; |
||||
|
$base_floor = 0; |
||||
|
$base_floor_plus = 0; |
||||
|
$sale_price = $option_price; |
||||
|
$stmt = $conn -> prepare($sql_str_mi); |
||||
|
$stmt ->bindParam(':option_price_id', $option_price_id); |
||||
|
$stmt ->bindParam(':min_weight', $min_weight); |
||||
|
$stmt ->bindParam(':max_weight', $max_weight); |
||||
|
$stmt ->bindParam(':open_kind', $open_kind); |
||||
|
$stmt ->bindParam(':base_floor', $base_floor); |
||||
|
$stmt ->bindParam(':base_floor_plus', $base_floor_plus); |
||||
|
$stmt ->bindParam(':price', $sale_price); |
||||
|
$stmt ->bindParam(':quotation_no', $quotation_no); |
||||
|
$stmt ->bindParam(':create_at', $create_at); |
||||
|
$stmt ->execute(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}catch(PDOException $e){ |
||||
|
echo $e->getMessage(); |
||||
|
die('Error!:'.$e->getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
?> |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 27 KiB |
@ -0,0 +1,72 @@ |
|||||
|
const priceOptionIndex = ()=>{ |
||||
|
return { |
||||
|
init(){ |
||||
|
console.log(this.kind); |
||||
|
this.initButtons(this.kind); |
||||
|
}, |
||||
|
kind: kind, |
||||
|
pageLength: 999999, |
||||
|
search: '', |
||||
|
orioptions: options, |
||||
|
options: options, |
||||
|
options_arr: { |
||||
|
1:'標', |
||||
|
2:'選', |
||||
|
}, |
||||
|
btntype:'', |
||||
|
buttons:[], |
||||
|
initButtons(kind){ |
||||
|
if(kind == 'A'){ |
||||
|
this.buttons = [ |
||||
|
{name: '車廂意匠', type: 'A1'} |
||||
|
] |
||||
|
}else if(kind == 'B'){ |
||||
|
this.buttons = [ |
||||
|
{name: '天井', type: 'B1'}, |
||||
|
{name: '地板', type: 'B2'}, |
||||
|
{name: '操縱盤', type: 'B3'}, |
||||
|
{name: '扶手', type: 'B4'}, |
||||
|
{name: '車廂門與層門(轎門/層門)', type: 'B5'}, |
||||
|
{name: '轎壁(車廂側板)', type: 'B6'}, |
||||
|
{name: '其他車廂內裝配件', type: 'B7'}, |
||||
|
] |
||||
|
}else if(kind == 'C'){ |
||||
|
this.buttons = [ |
||||
|
{name: '框', type: 'C1'}, |
||||
|
{name: '乘場指示器', type: 'C2'}, |
||||
|
{name: '燈', type: 'C3'}, |
||||
|
{name: '方式與門', type: 'C4'}, |
||||
|
] |
||||
|
}else if(kind == 'D'){ |
||||
|
this.buttons = [ |
||||
|
{name: '功能與配置', type: 'D1'}, |
||||
|
{name: 'OH與樓高', type: 'D2'}, |
||||
|
] |
||||
|
} |
||||
|
this.buttons.unshift({ |
||||
|
name:'顯示全部',type:'1', |
||||
|
}) |
||||
|
this.btntype = this.buttons[0].type; |
||||
|
}, |
||||
|
changeType(type = this.btntype){ |
||||
|
this.btntype = type |
||||
|
this.options = this.orioptions; |
||||
|
this.options = this.getOptions(); |
||||
|
this.inputSearch() |
||||
|
}, |
||||
|
getOptions(){ |
||||
|
if(this.btntype != 1){ |
||||
|
return this.options.filter(item=>(item.subkind == this.btntype)).slice(0, this.pageLength) |
||||
|
} |
||||
|
return this.options.slice(0, this.pageLength); |
||||
|
}, |
||||
|
inputSearch(e=null){ |
||||
|
let text = e!=null ? e.target.value : this.search; |
||||
|
this.search = text |
||||
|
this.options = this.orioptions |
||||
|
this.options = this.getOptions().filter(item=>{ |
||||
|
return (item.group_name.includes(text)) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
<?php |
||||
|
$envFile = __DIR__ . '/.env'; // .env 文件的路径 |
||||
|
|
||||
|
if (file_exists($envFile)) { |
||||
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
||||
|
if ($lines !== false) { |
||||
|
foreach ($lines as $line) { |
||||
|
list($key, $value) = explode('=', $line, 2); |
||||
|
$key = trim($key); |
||||
|
$value = trim($value); |
||||
|
// 设置环境变量 |
||||
|
putenv("$key=$value"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
$db_hostname = 'localhost'; //資料庫主機名稱 |
||||
|
$db_username = 'masadaroot'; //登入資料庫的管理者的帳號 |
||||
|
$db_password = 'x6h5E5p#u8y'; //登入密碼 |
||||
|
$db_name = 'appwms'; //使用的資料庫 |
||||
|
$db_charset = 'utf8'; //設定字元編碼 |
||||
|
|
||||
|
//建立PDO的指定工作 |
||||
|
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset"; |
||||
|
|
||||
|
try{ |
||||
|
//使用PDO連接到MySQL資料庫,建立PDO物件 |
||||
|
$conn = new PDO($dsn, $db_username, $db_password); |
||||
|
|
||||
|
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException) |
||||
|
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定 |
||||
|
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊 |
||||
|
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 |
||||
|
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 |
||||
|
//設定主動以警告的形式報錯 |
||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); |
||||
|
//如果連接錯誤,將抛出一個PDOException異常對象 |
||||
|
} |
||||
|
catch ( PDOException $e ){ |
||||
|
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 |
||||
|
die("ERROR!!!: ". $e->getMessage()); |
||||
|
} |
||||
|
|
||||
|
//$conn = null; //關閉資料庫的連線 |
@ -0,0 +1,75 @@ |
|||||
|
.price_option-select { |
||||
|
width: 100%; |
||||
|
max-width: 1200px; |
||||
|
margin: 0 auto; |
||||
|
display: flex; |
||||
|
} |
||||
|
.price_option-select > .sidebar { |
||||
|
width: 10%; |
||||
|
min-width: 180px; |
||||
|
height: 100%; |
||||
|
min-height: 80vh; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
border-right: 1px #ccc solid; |
||||
|
} |
||||
|
.price_option-select > .sidebar > a { |
||||
|
margin: 6px 0; |
||||
|
transition: 0.3s; |
||||
|
} |
||||
|
.price_option-select > .sidebar > a:hover { |
||||
|
color: #00b; |
||||
|
} |
||||
|
.price_option-select > .content { |
||||
|
display: grid; |
||||
|
grid-template-columns: repeat(3, 33.3%); |
||||
|
grid-row-gap: 12px; |
||||
|
grid-column-gap: 12px; |
||||
|
} |
||||
|
.price_option-select > .content > a { |
||||
|
width: 100%; |
||||
|
display: block; |
||||
|
height: 300px; |
||||
|
position: relative; |
||||
|
} |
||||
|
.price_option-select > .content > a:hover > div { |
||||
|
opacity: 1; |
||||
|
} |
||||
|
.price_option-select > .content > a > img { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
-o-object-fit: cover; |
||||
|
object-fit: cover; |
||||
|
} |
||||
|
.price_option-select > .content > a > div { |
||||
|
opacity: 0; |
||||
|
transition: 0.3s; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
position: absolute; |
||||
|
top: 0; |
||||
|
right: 0; |
||||
|
background-color: rgba(0, 0, 0, 0.7); |
||||
|
} |
||||
|
.price_option-select > .content > a > div p { |
||||
|
color: #fff; |
||||
|
font-size: 17px; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
|
||||
|
.price_option-index { |
||||
|
width: 100%; |
||||
|
max-width: 1200px; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
|
||||
|
.btn-secondary { |
||||
|
background-color: #6C757D; |
||||
|
} |
||||
|
|
||||
|
.text-light { |
||||
|
color: #fff; |
||||
|
}/*# sourceMappingURL=style.css.map */ |
@ -0,0 +1 @@ |
|||||
|
{"version":3,"sources":["style.scss","style.css"],"names":[],"mappings":"AAAA;EACI,WAAA;EACA,iBAAA;EACA,cAAA;EACA,aAAA;ACCJ;ADAI;EACI,UAAA;EACA,gBAAA;EACA,YAAA;EACA,gBAAA;EACA,aAAA;EACA,sBAAA;EACA,4BAAA;ACER;ADDQ;EACI,aAAA;EACA,gBAAA;ACGZ;ADFY;EACI,WAAA;ACIhB;ADAI;EACI,aAAA;EACA,uCAAA;EACA,kBAAA;EACA,qBAAA;ACER;ADDQ;EACI,WAAA;EACA,cAAA;EACA,aAAA;EACA,kBAAA;ACGZ;ADFY;EACI,UAAA;ACIhB;ADFY;EACI,WAAA;EACA,YAAA;EACA,oBAAA;KAAA,iBAAA;ACIhB;ADFY;EACI,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,kBAAA;EACA,MAAA;EACA,QAAA;EACA,oCAAA;ACIhB;ADHgB;EACI,WAAA;EACA,eAAA;EACA,gBAAA;ACKpB;;ADCA;EACI,WAAA;EACA,iBAAA;EACA,cAAA;ACEJ;;ADAA;EACI,yBAAA;ACGJ;;ADDA;EACI,WAAA;ACIJ","file":"style.css"} |
@ -0,0 +1,71 @@ |
|||||
|
.price_option-select{ |
||||
|
width: 100%; |
||||
|
max-width: 1200px; |
||||
|
margin: 0 auto; |
||||
|
display: flex; |
||||
|
>.sidebar{ |
||||
|
width: 10%; |
||||
|
min-width: 180px; |
||||
|
height: 100%; |
||||
|
min-height: 80vh; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
border-right:1px #ccc solid; |
||||
|
>a{ |
||||
|
margin:6px 0; |
||||
|
transition: .3s; |
||||
|
&:hover{ |
||||
|
color:#00b; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
>.content{ |
||||
|
display: grid; |
||||
|
grid-template-columns: repeat(3,33.3%); |
||||
|
grid-row-gap: 12px; |
||||
|
grid-column-gap: 12px; |
||||
|
>a{ |
||||
|
width: 100%; |
||||
|
display: block; |
||||
|
height: 300px; |
||||
|
position: relative; |
||||
|
&:hover > div{ |
||||
|
opacity: 1; |
||||
|
} |
||||
|
>img{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
object-fit: cover; |
||||
|
} |
||||
|
>div{ |
||||
|
opacity: 0; |
||||
|
transition: .3s; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
position: absolute; |
||||
|
top: 0; |
||||
|
right:0; |
||||
|
background-color: rgba($color: #000, $alpha: .7); |
||||
|
p{ |
||||
|
color:#fff; |
||||
|
font-size: 17px; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.price_option-index{ |
||||
|
width: 100%; |
||||
|
max-width: 1200px; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
.btn-secondary{ |
||||
|
background-color: #6C757D; |
||||
|
} |
||||
|
.text-light{ |
||||
|
color:#fff; |
||||
|
} |
@ -1,87 +1,76 @@ |
|||||
<?php |
<?php |
||||
include "../header.php"; |
include '../header.php'; |
||||
|
require_once './conn.php'; |
||||
$opt_data_arr = []; |
$kind = $_GET['kind']; |
||||
$sql = "select * from option_price where status = 'Y' order by kind, id"; |
$sql_str = "SELECT * FROM option_price WHERE kind = :kind AND status ='Y'"; |
||||
$res = mysqli_query($link, $sql); |
$stmt = $conn->prepare($sql_str); |
||||
while ($row = mysqli_fetch_assoc($res)) { |
$stmt->bindParam(':kind', $kind); |
||||
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"]; |
$stmt->execute(); |
||||
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["memo"] = $row["memo"]; |
$options = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["optional"] = $row["optional"]; |
$optional_arr = [1=>'標', 2=>'選']; |
||||
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"]; |
|
||||
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"]; |
|
||||
} |
|
||||
mysqli_free_result($res); |
|
||||
?> |
?> |
||||
<style> |
<link rel="stylesheet" href="./css/style.css"> |
||||
.container { |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
padding-top: 10px !important; |
<link rel="stylesheet" href="../contract/semantic/dist/semantic.min.css"> |
||||
} |
<script defer src="../contract/js/alpinejs/cdn.min.js"></script> |
||||
#exTab1 table { |
<script src="../contract/js/axios/axios.min.js"></script> |
||||
background-color : white; |
<div class="price_option-index" x-data="priceOptionIndex"> |
||||
padding : 5px 15px; |
<div class="container"><h2>OPTION價格查詢</h2></div> |
||||
} |
<div id="exTab1" class="container"> |
||||
.kind-col { |
<div class="toolbar"> |
||||
color:brown; |
<label for=""> |
||||
} |
顯示 |
||||
</style> |
<select x-model="pageLength" @change="changeType()"> |
||||
|
<option value="10">10</option> |
||||
|
<option value="25">25</option> |
||||
|
<option value="50">50</option> |
||||
|
<option value="100">100</option> |
||||
|
<option value="999999">顯示全部</option> |
||||
|
</select> |
||||
|
</label> |
||||
|
<label for=""> |
||||
|
<template x-for="btn in buttons"> |
||||
|
<button style="margin-right:4px" :class="['btn', (btn.type == btntype) ? 'btn-primary' : 'btn-secondary text-light']" x-text="btn.name" @click="changeType(btn.type)"></button> |
||||
|
</template> |
||||
|
</label> |
||||
|
<label for=""> |
||||
|
搜尋 |
||||
|
<input type="text" @keyup="inputSearch($event)" /> |
||||
|
</label> |
||||
|
</div> |
||||
|
<table id="table_index2" class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr class="kind-col"> |
||||
|
<th scope="col" nowrap>名稱</th> |
||||
|
<th scope="col" nowrap>規格</th> |
||||
|
<th scope="col" nowrap>備註</th> |
||||
|
<th scope="col" nowrap>配置</th> |
||||
|
<th scope="col" nowrap>單位</th> |
||||
|
<th scope="col" nowrap>定價</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<template x-if="options.length <= 0"> |
||||
|
<tr> |
||||
|
<td colspan="6"><p style="font-size:13px;color:#a00">沒有符合的結果。</p></td> |
||||
|
</tr> |
||||
|
</template> |
||||
|
<template x-for="option in options"> |
||||
|
<tr> |
||||
|
<td x-text="option.group_name"></td> |
||||
|
<td x-text="option.spec"></td> |
||||
|
<td x-text="option.memo"></td> |
||||
|
<td x-text="options_arr[option.optional]"></td> |
||||
|
<td x-text="option.unit"></td> |
||||
|
<td x-text="option.price!=null ? option.price.toLocaleString() : ''"></td> |
||||
|
</tr> |
||||
|
</template> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script src="./assets/js/alpine.js"></script> |
||||
<script> |
<script> |
||||
$(function(){ |
const options = [...<?php echo json_encode($options); ?>]; |
||||
$('#table_index2').DataTable({ |
const kind = '<?php echo $kind; ?>'; |
||||
"language": { |
|
||||
"zeroRecords": "沒有符合的結果", |
|
||||
"search": "搜尋", |
|
||||
"lengthMenu": "顯示 _MENU_ 項結果", |
|
||||
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項", |
|
||||
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項", |
|
||||
"infoFiltered": "(從 _MAX_ 項結果中過濾)", |
|
||||
}, |
|
||||
"searching": true, |
|
||||
"pageLength": 50 |
|
||||
}); |
|
||||
//$('#table_index2_length').hide(); |
|
||||
//$("#table_index2_paginate").hide(); |
|
||||
}) |
|
||||
</script> |
</script> |
||||
<div style="overflow-x:auto;"> |
|
||||
|
|
||||
<div class="container"><h2>OPTION價格查詢</h2></div> |
|
||||
<div id="exTab1" class="container"> |
|
||||
<table id="table_index2" class="table table-striped table-bordered" style="width:100%"> |
|
||||
<thead> |
|
||||
<tr class="kind-col"> |
|
||||
<th scope="col" nowrap>名稱</th> |
|
||||
<th scope="col" nowrap>規格</th> |
|
||||
<th scope="col" nowrap>備註</th> |
|
||||
<th scope="col" nowrap>配置</th> |
|
||||
<th scope="col" nowrap>單位</th> |
|
||||
<th scope="col" nowrap>定價</th> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<?php |
|
||||
foreach ($opt_data_arr as $k => $v) { |
|
||||
foreach ($v as $k2 => $v2) { |
|
||||
foreach ($v2 as $k3 => $v3) { |
|
||||
if ($v3["optional"] == "1") $optional = "標"; |
|
||||
elseif ($v3["optional"] == "2") $optional = "選"; |
|
||||
echo "<tr>"; |
|
||||
echo "<td>".$k2."</td>"; |
|
||||
echo "<td>".$v3["spec"]."</td>"; |
|
||||
echo "<td>".$v3["memo"]."</td>"; |
|
||||
echo "<td>".$optional."</td>"; |
|
||||
echo "<td>".$v3["unit"]."<input type='hidden' name='option_id' value='".$k3."'></td>"; |
|
||||
echo "<td>".number_format($v3["price"])."</td>"; |
|
||||
echo "</tr>"; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
?> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
</div> |
|
||||
<?php |
|
||||
mysqli_close($link); |
|
||||
include "../footer.php"; |
|
||||
?> |
|
@ -0,0 +1,87 @@ |
|||||
|
<?php |
||||
|
include "../header.php"; |
||||
|
|
||||
|
$opt_data_arr = []; |
||||
|
$sql = "select * from option_price where status = 'Y' order by kind, id"; |
||||
|
$res = mysqli_query($link, $sql); |
||||
|
while ($row = mysqli_fetch_assoc($res)) { |
||||
|
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"]; |
||||
|
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["memo"] = $row["memo"]; |
||||
|
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["optional"] = $row["optional"]; |
||||
|
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"]; |
||||
|
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"]; |
||||
|
} |
||||
|
mysqli_free_result($res); |
||||
|
?> |
||||
|
<style> |
||||
|
.container { |
||||
|
padding-top: 10px !important; |
||||
|
} |
||||
|
#exTab1 table { |
||||
|
background-color : white; |
||||
|
padding : 5px 15px; |
||||
|
} |
||||
|
.kind-col { |
||||
|
color:brown; |
||||
|
} |
||||
|
</style> |
||||
|
<script> |
||||
|
$(function(){ |
||||
|
$('#table_index2').DataTable({ |
||||
|
"language": { |
||||
|
"zeroRecords": "沒有符合的結果", |
||||
|
"search": "搜尋", |
||||
|
"lengthMenu": "顯示 _MENU_ 項結果", |
||||
|
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項", |
||||
|
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項", |
||||
|
"infoFiltered": "(從 _MAX_ 項結果中過濾)", |
||||
|
}, |
||||
|
"searching": true, |
||||
|
"pageLength": 50 |
||||
|
}); |
||||
|
//$('#table_index2_length').hide(); |
||||
|
//$("#table_index2_paginate").hide(); |
||||
|
}) |
||||
|
</script> |
||||
|
<div style="overflow-x:auto;"> |
||||
|
|
||||
|
<div class="container"><h2>OPTION價格查詢</h2></div> |
||||
|
<div id="exTab1" class="container"> |
||||
|
<table id="table_index2" class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr class="kind-col"> |
||||
|
<th scope="col" nowrap>名稱</th> |
||||
|
<th scope="col" nowrap>規格</th> |
||||
|
<th scope="col" nowrap>備註</th> |
||||
|
<th scope="col" nowrap>配置</th> |
||||
|
<th scope="col" nowrap>單位</th> |
||||
|
<th scope="col" nowrap>定價</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php |
||||
|
foreach ($opt_data_arr as $k => $v) { |
||||
|
foreach ($v as $k2 => $v2) { |
||||
|
foreach ($v2 as $k3 => $v3) { |
||||
|
if ($v3["optional"] == "1") $optional = "標"; |
||||
|
elseif ($v3["optional"] == "2") $optional = "選"; |
||||
|
echo "<tr>"; |
||||
|
echo "<td>".$k2."</td>"; |
||||
|
echo "<td>".$v3["spec"]."</td>"; |
||||
|
echo "<td>".$v3["memo"]."</td>"; |
||||
|
echo "<td>".$optional."</td>"; |
||||
|
echo "<td>".$v3["unit"]."<input type='hidden' name='option_id' value='".$k3."'></td>"; |
||||
|
echo "<td>".number_format($v3["price"])."</td>"; |
||||
|
echo "</tr>"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<?php |
||||
|
mysqli_close($link); |
||||
|
include "../footer.php"; |
||||
|
?> |
@ -0,0 +1,47 @@ |
|||||
|
<?php |
||||
|
include "../header.php"; |
||||
|
?> |
||||
|
<link rel="stylesheet" href="./css/style.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<link rel="stylesheet" href="../contract/semantic/dist/semantic.min.css"> |
||||
|
<div class="price_option-select"> |
||||
|
<div class="sidebar"> |
||||
|
<a href="./price_option-index.php?kind=A&<?php echo $token_link; ?>">A-1車廂意匠</a> |
||||
|
<a href="./price_option-index.php?kind=B&<?php echo $token_link; ?>">A-2車廂內裝</a> |
||||
|
<a href="./price_option-index.php?kind=C&<?php echo $token_link; ?>">A-3車廂外部</a> |
||||
|
<a href="./price_option-index.php?kind=D&<?php echo $token_link; ?>">A-4控制與其他</a> |
||||
|
<a href="./price_option-index.php?kind=E&<?php echo $token_link; ?>">A-5汰改</a> |
||||
|
</div> |
||||
|
<div class="content"> |
||||
|
<a href="./price_option-index.php?kind=A&<?php echo $token_link; ?>"> |
||||
|
<img src="./assets/img/1.jpg" /> |
||||
|
<div> |
||||
|
<p>車廂意匠</p> |
||||
|
</div> |
||||
|
</a> |
||||
|
<a href="./price_option-index.php?kind=B&<?php echo $token_link; ?>"> |
||||
|
<img src="./assets/img/2.jpg" /> |
||||
|
<div> |
||||
|
<p>車廂內裝</p> |
||||
|
</div> |
||||
|
</a> |
||||
|
<a href="./price_option-index.php?kind=C&<?php echo $token_link; ?>"> |
||||
|
<img src="./assets/img/3.jpg" /> |
||||
|
<div> |
||||
|
<p>車廂外部</p> |
||||
|
</div> |
||||
|
</a> |
||||
|
<a href="./price_option-index.php?kind=D&<?php echo $token_link; ?>"> |
||||
|
<img src="./assets/img/4.jpg" /> |
||||
|
<div> |
||||
|
<p>控制與其他</p> |
||||
|
</div> |
||||
|
</a> |
||||
|
<a href="./price_option-index.php?kind=E&<?php echo $token_link; ?>"> |
||||
|
<img src="./assets/img/5.jpg" /> |
||||
|
<div> |
||||
|
<p>汰改</p> |
||||
|
</div> |
||||
|
</a> |
||||
|
</div> |
||||
|
</div> |