@ -0,0 +1,71 @@ |
|||
<?php |
|||
//外購組裝單 (組裝申請單) |
|||
include "T8_Authorization.php"; |
|||
?> |
|||
<script> |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
|||
var validation = event.data; |
|||
console.log(validation); |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKASSY/PostERPData'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [{ |
|||
"name":"stkAssyMast", |
|||
"rows":[ |
|||
{ |
|||
"BillNo":"TEST02", |
|||
"OrgId":"1000", |
|||
"TypeId":"CA", |
|||
"MaterialId":"3MH00302", |
|||
"PersonId":"M0122", |
|||
"CompId":"1001", |
|||
"DeptId":"220", |
|||
"SQuantity":1, |
|||
"SUnitId":"SET", |
|||
"CurrentState":2, |
|||
"CreatorId":"M0122" |
|||
} |
|||
] |
|||
},{ |
|||
"name":"stkAssySubMatInfo", |
|||
"rows":[ |
|||
{ |
|||
"BillNo":"TEST02", |
|||
"MaterialId":"3MH00302P", |
|||
"ComponentBaseQty":1, |
|||
"UnitQty":1, |
|||
"SUnitId":"SET", |
|||
"MarkerNo":"3MH00302", |
|||
"CU_MaterialId":"3MH00302" |
|||
},{ |
|||
"BillNo":"TEST02", |
|||
"MaterialId":"MX00000001", |
|||
"ComponentBaseQty":1, |
|||
"UnitQty":3, |
|||
"SUnitId":"PCS", |
|||
"MarkerNo":"3MH00302", |
|||
"CU_MaterialId":"3MH00302" |
|||
} |
|||
] |
|||
}]; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type:'POST', |
|||
url:`${apiurl}`, |
|||
headers:headerParam, |
|||
data: json, |
|||
dataType:"json", |
|||
success: function(res){ |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
|
|||
} |
|||
}) |
|||
</script> |
@ -0,0 +1,23 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
//假設供應商代碼為P |
|||
$BizPartnerId = "P"; |
|||
$sql_purBillOrder = " |
|||
SELECT * FROM purBillOrderMaster WHERE BizPartnerId = '$BizPartnerId' AND CurrentState = 2"; |
|||
$purMaster = $conn->query($sql_purBillOrder); |
|||
//每筆採購單資料 |
|||
foreach($purMaster as $master){ |
|||
//print_r($master); |
|||
$BillNo = $master['BillNo']; |
|||
|
|||
//每筆採購單明細資料 |
|||
$sql_purDetail = " |
|||
SELECT * FROM purBillOrderDetail WHERE BillNo = '$BillNo'"; |
|||
$purDetail = $conn->query($sql_purDetail); |
|||
foreach($purDetail as $detail){ |
|||
print_r($detail); |
|||
} |
|||
echo "<br>----------------------<br>"; |
|||
|
|||
} |
|||
|
@ -0,0 +1 @@ |
|||
<?php |
@ -0,0 +1,39 @@ |
|||
<?php |
|||
include "header.php"; |
|||
// 合約收款款別名稱 |
|||
$arrayData = []; |
|||
echo "合約號;客戶名稱;1款;金額;2款;金額;3款;金額;4款;金額;5款;金額;6款;金額;7款;金額;8款;金額;9款;金額;10款;金額;11款;金額;12款</br>"; |
|||
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName |
|||
FROM salOrderStagePay AS a |
|||
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|||
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId |
|||
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4)"; |
|||
|
|||
$contract = $conn->query($sql_contract); |
|||
foreach ($contract as $cont) { |
|||
if ($cont['BillNo'] == 'SO20230801002') { |
|||
$BillNo = 'M231067'; |
|||
}else{ |
|||
$BillNo = $cont['BillNo']; |
|||
}; |
|||
$PayStage = $cont['PayStage']; |
|||
$PayAmount = $cont['PlanPayAmt']; |
|||
$partnerName = $cont['BizPartnerName']; |
|||
if(isset($arrayData[$BillNo])){ |
|||
array_push($arrayData[$BillNo], $PayStage); |
|||
array_push($arrayData[$BillNo], $PayAmount); |
|||
|
|||
}else{ |
|||
$arrayData[$BillNo][0] = $BillNo; |
|||
$arrayData[$BillNo][1] = $partnerName; |
|||
array_push($arrayData[$BillNo], $PayStage); |
|||
array_push($arrayData[$BillNo], $PayAmount); |
|||
|
|||
} |
|||
}; |
|||
foreach($arrayData as $data){ |
|||
foreach($data as $value){ |
|||
echo $value.";"; |
|||
} |
|||
echo "</br>"; |
|||
} |
@ -0,0 +1,68 @@ |
|||
<?php |
|||
require_once("../conn.php"); |
|||
ini_set ( 'date.timezone' , 'Asia/Taipei' ); |
|||
if(isset($_POST['vol_no']) && !empty($_POST['vol_no'])){ |
|||
$mid = $_POST['mid']; |
|||
$vol_no = $_POST['vol_no']; |
|||
$salesman = $_POST['salesman']; |
|||
$apply_date = $_POST['apply_date']; |
|||
$apply_type = $_POST['apply_type']; |
|||
$case_name = $_POST['case_name']; |
|||
$customer = $_POST['company']; |
|||
$manager = $_POST['manager']; |
|||
$vat = $_POST['vat']; |
|||
$total_price = $_POST['total_price']; |
|||
$buy_fee = $_POST['price_a']; |
|||
$install_fee = $_POST['price_b']; |
|||
$contact_address = $_POST['address']; |
|||
$workdeadline_a = $_POST['workdeadline_a']; |
|||
$workdeadline_b = $_POST['workdeadline_b']; |
|||
$test_time = $_POST['regulations']; |
|||
$freedeadline = $_POST['freedeadline']; |
|||
$trade_address = $_POST['tradeaddress']; |
|||
$tradedeadline = $_POST['tradedeadline']; |
|||
$progress = 0; |
|||
$status = 0; |
|||
$created_at = date('Y-m-d H:i:s'); |
|||
$created_by = $_POST['user_id']; |
|||
$isFirst = $_POST['isFirst']; |
|||
$conn->beginTransaction(); |
|||
try{ |
|||
if($isFirst == 1){ |
|||
$sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, progress, status, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :progress, :status, :created_at, :created_by)"; |
|||
$stmt = $conn -> prepare($sql_str); |
|||
$stmt ->bindParam(':mid', $mid); |
|||
$stmt ->bindParam(':contractno', $vol_no); |
|||
$stmt ->bindParam(':sales_man', $salesman); |
|||
$stmt ->bindParam(':apply_date', $apply_date); |
|||
$stmt ->bindParam(':apply_type', $apply_type); |
|||
$stmt ->bindParam(':case_name', $case_name); |
|||
$stmt ->bindParam(':customer', $customer); |
|||
$stmt ->bindParam(':manager', $manager); |
|||
$stmt ->bindParam(':vat', $vat); |
|||
$stmt ->bindParam(':total_price', $total_price); |
|||
$stmt ->bindParam(':buy_fee', $buy_fee); |
|||
$stmt ->bindParam(':install_fee', $install_fee); |
|||
$stmt ->bindParam(':contact_address', $contact_address); |
|||
$stmt ->bindParam(':workdeadline_a', $workdeadline_a); |
|||
$stmt ->bindParam(':workdeadline_b', $workdeadline_b); |
|||
$stmt ->bindParam(':test_time', $test_time); |
|||
$stmt ->bindParam(':freedeadline', $freedeadline); |
|||
$stmt ->bindParam(':trade_address', $trade_address); |
|||
$stmt ->bindParam(':tradedeadline', $tradedeadline); |
|||
$stmt ->bindParam(':progress', $progress); |
|||
$stmt ->bindParam(':status', $status); |
|||
$stmt ->bindParam(':created_at', $created_at); |
|||
$stmt ->bindParam(':created_by', $created_by); |
|||
$stmt ->execute(); |
|||
header("HTTP/1.1 201 success!"); |
|||
$conn->commit(); |
|||
} |
|||
}catch(PDOException $e){ |
|||
$conn->rollback(); |
|||
echo $e->getMessage(); |
|||
die('Error!:'.$e->getMessage()); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,477 @@ |
|||
<?php |
|||
include_once("../header.php"); |
|||
require_once("./conn.php"); |
|||
if(!(isset($_GET['id']) && !empty($_GET['id']))){ |
|||
$para = "function_name=pricereview&".$token_link; |
|||
echo "<script>alert('非法訪問!!!');</script>"; |
|||
echo "<script>window.history.go(-1);</script>"; |
|||
exit; |
|||
} |
|||
$id = $_GET["id"]; |
|||
|
|||
$sql_str = "SELECT * FROM contract_new_apply WHERE mid = :mid"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid',$id); |
|||
$stmt->execute(); |
|||
$contract_new_apply = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
if(empty($contract_new_apply)){ |
|||
|
|||
|
|||
$sql_str = "SELECT pricereview_main.*, pricereview_main.id as mainid, account.name as accountname |
|||
FROM pricereview_main |
|||
JOIN account ON pricereview_main.person = account.accountid |
|||
WHERE pricereview_main.id = :id"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':id',$id); |
|||
$stmt->execute(); |
|||
$contract = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
print_r($contract); |
|||
$accounttype = "M"; |
|||
$sql_str = "SELECT * FROM account WHERE accounttype = :accounttype"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':accounttype',$accounttype); |
|||
$stmt->execute(); |
|||
$persons = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|||
|
|||
$sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':vol_no', $contract['contractno']); |
|||
$stmt->execute(); |
|||
$customer = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
|
|||
$mid = $contract['mainid']; |
|||
$sql_str = "SELECT * FROM pricereview_pay WHERE mid = :mid ORDER BY pay_kind ASC"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->execute(); |
|||
$pays = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|||
print_r($pays); |
|||
$price_a = 0; |
|||
$price_b = 0; |
|||
foreach($pays as $pay){ |
|||
if($pay['pay_kind'] <= 4){ |
|||
$price_a = $price_a + $pay['pay_amount']; |
|||
}else{ |
|||
$price_b = $price_b + $pay['pay_amount']; |
|||
} |
|||
} |
|||
$sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A'"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->execute(); |
|||
$items = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|||
} |
|||
?> |
|||
<link rel="stylesheet" href="./styles/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="semantic/dist/semantic.min.css"> |
|||
<script defer src="./js/alpinejs/cdn.min.js"></script> |
|||
<script src="./js/axios/axios.min.js"></script> |
|||
<div class="contract-new-apply-component" x-data="contractNewApply"> |
|||
<div class="form" method="post" id="form" enctype="multipart/form-data" > |
|||
<input type="hidden" name='form_name' value="main_form" /> |
|||
<div> |
|||
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
|||
<thead> |
|||
<tr> |
|||
<td colspan="8"> |
|||
<h3 style='text-align:center'>合約書申請(新梯)</h3> |
|||
</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1"> |
|||
<tr> |
|||
<td colspan="7" style='vertical-align: middle;border-right:0px;'> |
|||
<h4>業務確認項</h4> |
|||
</td> |
|||
<td class="text-right" style='border-left:0px;'> |
|||
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button> |
|||
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td style="vertical-align: middle">卷號</td> |
|||
<td> |
|||
<div class="fixed" x-text="data.vol_no"></div> |
|||
<!-- <input class="form-control disabled_select" type="text" x-model="data.vol_no" > --> |
|||
<!-- <p class="alerttext" x-show="data.vol_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> --> |
|||
</td> |
|||
<td style="vertical-align: middle">統一編號</td> |
|||
<td> |
|||
<input class="form-control disabled_select" type="text" x-model="data.vat" > |
|||
<p class="alerttext" x-show="data.salesman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">合約書申請日期</td> |
|||
<td> |
|||
<input class="form-control disabled_select" type="date" x-model="data.apply_date" > |
|||
<p class="alerttext" x-show="data.apply_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">申請類別</td> |
|||
<td style="vertical-align: middle"> |
|||
<select class="" id="apply_type" x-model="data.apply_type"> |
|||
<option value="A">制式新合約</option> |
|||
</select> |
|||
<p class="alerttext" x-show="data.apply_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td style="vertical-align: middle">案件名稱</td> |
|||
<td style="vertical-align: middle" colspan="3"> |
|||
<input class="form-control disabled_select" type="text" x-model="data.case_name" > |
|||
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">立約人</td> |
|||
<td style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="text" x-model="data.company" > |
|||
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">負責人</td> |
|||
<td style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="text" x-model="data.manager" > |
|||
<p class="alerttext" x-show="data.manager==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td style="vertical-align: middle">含稅給約總價</td> |
|||
<td colspan="3" style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="number" x-model="data.total_price" > |
|||
<p class="alerttext" x-show="data.total_price==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">含稅貸款(A)</td> |
|||
<td style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="number" x-model="data.price_a" > |
|||
<p class="alerttext" x-show="data.price_a==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">含稅安裝款(A)</td> |
|||
<td style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="number" x-model="data.price_b" > |
|||
<p class="alerttext" x-show="data.price_b==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td style="vertical-align: middle">聯絡地址</td> |
|||
<td style="vertical-align: middle" colspan=3> |
|||
<input class="form-control disabled_select" type="text" x-model="data.address" > |
|||
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">完工期限</td> |
|||
<td style="vertical-align: middle" colspan=3> |
|||
<div class="ui labeled input"> |
|||
<div class="ui label"> |
|||
貨抵工地 |
|||
</div> |
|||
<input type="text" placeholder="30" style="width:45px;padding:0 12px;" x-model="data.workdeadline_a"> |
|||
<div class="ui label"> |
|||
天內安裝完成,甲方應於貨底工地前 |
|||
</div> |
|||
<input type="text" placeholder="7" style="width:45px;padding:0 12px;" x-model="data.workdeadline_b"> |
|||
<div class="ui label"> |
|||
天完成並整理完善。 |
|||
</div> |
|||
</div> |
|||
<!-- <input class="form-control disabled_select" type="text" x-model="data.deadline" > --> |
|||
<p class="alerttext" x-show="data.deadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td style="vertical-align: middle">附則</td> |
|||
<td style="vertical-align: middle" colspan=3> |
|||
<div class="ui labeled input"> |
|||
<div class="ui label"> |
|||
乙方應於 |
|||
</div> |
|||
<input type="text" placeholder="10" style="width:45px;padding:0 12px;" x-model="data.regulations"> |
|||
<div class="ui label"> |
|||
天內試車完成 |
|||
</div> |
|||
</div> |
|||
<p class="alerttext" x-show="data.regulations==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">免保期限</td> |
|||
<td style="vertical-align: middle" colspan=3> |
|||
<div class="ui labeled input"> |
|||
<input type="text" placeholder="18" style="width:45px;padding:0 12px;" x-model="data.freedeadline"> |
|||
<div class="ui label"> |
|||
個月 |
|||
</div> |
|||
</div> |
|||
<p class="alerttext" x-show="data.freedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
|
|||
</tr> |
|||
<tr> |
|||
<td style="vertical-align: middle">交貨地點</td> |
|||
<td style="vertical-align: middle" colspan=3> |
|||
<input class="form-control disabled_select" type="text" x-model="data.tradeaddress" > |
|||
<p class="alerttext" x-show="data.tradeaddress==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle">交貨期限</td> |
|||
<td style="vertical-align: middle" colspan=3> |
|||
<div class="ui labeled input"> |
|||
<div class="ui label"> |
|||
圖色確認第 |
|||
</div> |
|||
<input type="text" placeholder="90" style="width:45px;padding:0 12px;" x-model="data.tradedeadline"> |
|||
<div class="ui label"> |
|||
天出貨 |
|||
</div> |
|||
</div> |
|||
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
|||
<thead style="font-weight: bolder;margin-bottom: 20px"> |
|||
<tr> |
|||
<td colspan="1"> |
|||
<p style='text-align:center'>項次</p> |
|||
</td> |
|||
<td colspan="3"> |
|||
<p style='text-align:center'>規格</p> |
|||
</td> |
|||
<td colspan="1"> |
|||
<p style='text-align:center'>數量</p> |
|||
</td> |
|||
<td colspan="3"> |
|||
<p style='text-align:center'>金額</p> |
|||
</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="font-weight: bolder;margin-bottom: 20px"> |
|||
<template x-for="(item, idx) in data.items"> |
|||
<tr> |
|||
<td style="vertical-align: middle"><p x-text="idx+1"></p></td> |
|||
<td colspan="3" style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="text" x-model="item.item_spec" > |
|||
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="number" x-model="item.item_qty" > |
|||
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
<td colspan="3" style="vertical-align: middle"> |
|||
<input class="form-control disabled_select" type="number" x-model="item.item_price_ct" > |
|||
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
|||
</td> |
|||
</tr> |
|||
</template> |
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
|||
<thead style="font-weight: bolder;margin-bottom: 20px"> |
|||
<tr> |
|||
<td> |
|||
<p style='text-align:center'>合約類別</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>款別</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>條件名稱</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>收款條件日期區分</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>條件日期</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>票期</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>付款比率</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'>金額</p> |
|||
</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody style="font-weight: bolder;margin-bottom: 20px" > |
|||
<?php |
|||
$day = 0; |
|||
$styles = [ |
|||
1=> "訂金", |
|||
2=> "二次款", |
|||
3=>"貨到款", |
|||
4=>"", |
|||
5=>"安裝款", |
|||
6=>"尾款", |
|||
7=>"", |
|||
]; |
|||
$paydate = [ |
|||
1=>"合約日", |
|||
2=>"合約日", |
|||
3=>"出貨日", |
|||
4=>"", |
|||
5=>"竣檢日", |
|||
6=>"交車日", |
|||
7=>"" |
|||
]; |
|||
?> |
|||
<?php foreach($pays as $pay): |
|||
if($pay['pay_scale'] == 0) continue; |
|||
?> |
|||
<tr> |
|||
<td> |
|||
<p style='text-align:center'><?php echo ($pay['pay_kind'] <=4) ? "銷售" : "按裝"; ?></p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'><?php echo $styles[$pay['pay_kind']]; ?></p> |
|||
</td> |
|||
<td> |
|||
<?php if($pay['pay_kind'] == 1){ ?> |
|||
<template x-if="pays[1] > 0"> |
|||
<p style='text-align:center'>簽約後<span x-text="pays[1]"></span>天付訂金</p> |
|||
</template> |
|||
<template x-if="pays[1] <= 0"> |
|||
<p style='text-align:center'>簽約後付訂金</p> |
|||
</template> |
|||
<?php } elseif($pay['pay_kind'] == 2){ ?> |
|||
<template x-if="pays[2] > 0"> |
|||
<p style='text-align:center'>簽約後<span x-text="pays[2]"></span>天付二次款</p> |
|||
</template> |
|||
<template x-if="pays[2] <= 0"> |
|||
<p style='text-align:center'>簽約後付二次款</p> |
|||
</template> |
|||
<?php } elseif($pay['pay_kind'] == 3){ ?> |
|||
<p style='text-align:center'>貨抵工地付貨到款</p> |
|||
<?php } elseif($pay['pay_kind'] == 5){ ?> |
|||
<template x-if="pays[5] > 0"> |
|||
<p style='text-align:center'>安裝完成後<span x-text="pays[5]"></span>天收款</p> |
|||
</template> |
|||
<template x-if="pays[5] <= 0"> |
|||
<p style='text-align:center'>安裝完成後收款</p> |
|||
</template> |
|||
<?php } elseif($pay['pay_kind'] == 6){ ?> |
|||
<template x-if="pays[6] > 0"> |
|||
<p style='text-align:center'>交車後<span x-text="pays[6]"></span>天付尾款</p> |
|||
</template> |
|||
<template x-if="pays[6] <= 0"> |
|||
<p style='text-align:center'>交車後付尾款</p> |
|||
</template> |
|||
<?php } else{ ?> |
|||
<p style='text-align:center'>-</p> |
|||
<?php } ?> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'><?php echo $paydate[$pay['pay_kind']]; ?></p> |
|||
</td> |
|||
<td> |
|||
<div class="ui labeled input"> |
|||
<input type="number" placeholder="90" style="width:45px;padding:0 12px;" x-model="pays[<?php echo $pay['pay_kind'];?>]"> |
|||
<div class="ui label"> |
|||
天 |
|||
</div> |
|||
</div> |
|||
</td> |
|||
<td> |
|||
<div class="ui labeled input"> |
|||
<input type="number" placeholder="90" style="width:45px;padding:0 12px;" x-model="tickets[<?php echo $pay['pay_kind'];?>]"> |
|||
<div class="ui label"> |
|||
天 |
|||
</div> |
|||
</div> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center'><?php echo $pay['pay_scale'] ?>%</p> |
|||
</td> |
|||
<td> |
|||
<p style='text-align:center' x-text="localnumber(data.total_price * <?php echo $pay['pay_scale']/100 ?>)"></p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
|||
<thead style="font-weight: bolder;margin-bottom: 20px;"> |
|||
<tr> |
|||
<td colspan=8> |
|||
<h4 style='text-align:center;font-weight: bolder'>簽核流程</h4> |
|||
</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td style="font-weight:bold">業務部協理</td> |
|||
<td> |
|||
<template x-if="false"> |
|||
<span class="failtext">已退件</span> |
|||
</template> |
|||
<template x-if="false"> |
|||
<span class="readtext">審核中</span> |
|||
</template> |
|||
<template x-if="false"> |
|||
<span class="successtext">已通過</span> |
|||
</template> |
|||
</td> |
|||
<td style="font-weight:bold">業務部承辦人</td> |
|||
<td> |
|||
<template x-if="false"> |
|||
<span class="failtext">已退件</span> |
|||
</template> |
|||
<template x-if="false"> |
|||
<span class="readtext">審核中</span> |
|||
</template> |
|||
<template x-if="false"> |
|||
<span class="successtext">已通過</span> |
|||
</template> |
|||
</td> |
|||
<td style="font-weight:bold">營業經理</td> |
|||
<td> |
|||
<template x-if="false"> |
|||
<span class="failtext">已退件</span> |
|||
</template> |
|||
<template x-if="false"> |
|||
<span class="readtext">審核中</span> |
|||
</template> |
|||
<template x-if="false"> |
|||
<span class="successtext">已通過</span> |
|||
</template> |
|||
</td> |
|||
<td style="font-weight:bold">營業員</td> |
|||
<td><span x-text="data.salesmanname + '(' + data.salesman + ')'"></span></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<button x-show="true" x-on:click="" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
|||
<template x-if="!isLoading"> |
|||
<span>送審</span> |
|||
</template> |
|||
<template x-if="isLoading"> |
|||
<div class="loader"></div> |
|||
</template> |
|||
</button> |
|||
<button x-show="true" x-on:click="storageFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
|||
<template x-if="!isLoading"> |
|||
<span>暫存</span> |
|||
</template> |
|||
<template x-if="isLoading"> |
|||
<div class="loader"></div> |
|||
</template> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<script src="./js/jquery/jquery-3.1.1.min.js"></script> |
|||
<script src="semantic/dist/semantic.min.js" ></script> |
|||
<script src="./js/alpine.js"></script> |
|||
<script> |
|||
const contractno = '<?php echo $contract['contractno'] ?>'; |
|||
const salesman = '<?php echo $contract['person'] ?>'; |
|||
const salesmanname = '<?php echo $contract['accountname'] ?>'; |
|||
const apply_date = '<?php echo date('Y-m-d') ?>'; |
|||
const case_name = '<?php echo $contract['case_name'] ?>'; |
|||
const company = '<?php echo $contract['company'] ?>'; |
|||
const manager = '<?php echo $customer['manager'] ?>'; |
|||
const vat = '<?php echo $customer['uscc'] ?>'; |
|||
const price_total = <?php echo $contract['price_total'] ?>; |
|||
const address = '<?php echo $contract['address'] ?>'; |
|||
const price_a = <?php echo $price_a; ?>; |
|||
const price_b = <?php echo $price_b; ?>; |
|||
const items = [...<?php echo json_encode($items); ?>]; |
|||
const user_id = '<?php echo $user_id ?>'; |
|||
const mid = '<?php echo $_GET['id']; ?>'; |
|||
console.log(items) |
|||
</script> |
@ -0,0 +1,168 @@ |
|||
<?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'; |
|||
}elseif($id == 15){ |
|||
$kind ='B'; |
|||
$subkind = 'B1'; |
|||
} |
|||
|
|||
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,193 @@ |
|||
const priceOptionIndex = ()=>{ |
|||
return { |
|||
init(){ |
|||
this.renderPagination(); |
|||
this.initButtons(this.kind); |
|||
this.options = this.options.slice(0, this.pageLength) |
|||
}, |
|||
kind: kind, |
|||
pageLength: 50, |
|||
search: '', |
|||
orioptions: options, |
|||
options: options, |
|||
options_arr: { |
|||
1:'標', |
|||
2:'選', |
|||
}, |
|||
btntype:1, |
|||
buttons:[], |
|||
pageLength: 50, |
|||
currentpage:1, |
|||
dataLangth:options.length, |
|||
search: '', |
|||
pageNumber:1, |
|||
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'}, |
|||
] |
|||
}else if(kind == 'E'){ |
|||
this.buttons = [ |
|||
{name: '平台梯', type: 'E1'}, |
|||
] |
|||
} |
|||
this.buttons.unshift({ |
|||
name:'顯示全部',type:'1', |
|||
}) |
|||
this.btntype = this.buttons[0].type; |
|||
}, |
|||
changeType(type=this.btntype){ |
|||
this.currentpage = 1 |
|||
this.btntype = type; |
|||
this.options = this.orioptions; |
|||
this.options = this.getOptions(); |
|||
this.inputSearch() |
|||
}, |
|||
getOptions(start=0, end=this.pageLength){ |
|||
if(this.btntype != 1){ |
|||
return this.options.filter(item=>(item.subkind == this.btntype)).slice(start, end) |
|||
} |
|||
return this.options.slice(start, end); |
|||
}, |
|||
inputSearch(e=null){ |
|||
let text = e!=null ? e.target.value : this.search; |
|||
this.search = text.toLowerCase(); |
|||
if(text != ''){ |
|||
this.currentpage = 1; |
|||
this.options = this.orioptions |
|||
this.options = this.options.filter(item=>{ |
|||
if(item.subkind == this.btntype || this.btntype == 1){ |
|||
if(item.group_name == null) item.group_name = '' |
|||
if(item.spec == null) item.spec = '' |
|||
if(item.memo == null) item.memo = '' |
|||
if(item.price == null) item.price = 0 |
|||
return (item.group_name.toLowerCase().includes(text.toLowerCase()) || item.spec.toLowerCase().includes(text.toLowerCase()) || item.memo.toLowerCase().includes(text.toLowerCase()) || String(item.price).includes(text.toLowerCase())) ; |
|||
} |
|||
}).slice((Number(this.currentpage)-1)*Number(this.pageLength), (Number(this.currentpage)-1)*Number(this.pageLength) + Number(this.pageLength)) |
|||
this.dataLangth = this.options.length |
|||
}else{ |
|||
this.options = this.orioptions |
|||
if(this.btntype == 1){ |
|||
this.options = this.options.filter(item=> item.kind == this.kind) |
|||
}else{ |
|||
this.options = this.options.filter(item=> (item.subkind == this.btntype)) |
|||
} |
|||
if(this.btntype == 1){ |
|||
this.dataLangth = this.orioptions.filter(item=> (item.kind == this.kind)).length |
|||
}else{ |
|||
this.dataLangth = this.orioptions.filter(item=> (item.subkind == this.btntype)).length |
|||
} |
|||
this.options = this.options.slice((Number(this.currentpage)-1)*Number(this.pageLength), (Number(this.currentpage)-1)*Number(this.pageLength) + Number(this.pageLength)) |
|||
} |
|||
this.pageNumber = Math.ceil(Number(this.dataLangth)/Number(this.pageLength)) |
|||
this.pageNumberArr = [] |
|||
for(let i=0;i<this.pageNumber;i++){ |
|||
this.pageNumberArr.push({page:i+1, disabled:false}) |
|||
} |
|||
}, |
|||
renderPagination(){ |
|||
this.inputSearch(); |
|||
}, |
|||
switchPage(page){ |
|||
if(page == '...') return |
|||
this.currentpage = page |
|||
this.renderPagination() |
|||
}, |
|||
selectPage(e){ |
|||
this.currentpage = e.target.value |
|||
this.renderPagination() |
|||
} |
|||
} |
|||
} |
|||
|
|||
const priceOptionSelect = ()=>{ |
|||
return { |
|||
init(){ |
|||
this.renderPagination(); |
|||
this.options = this.options.slice(0, this.pageLength) |
|||
}, |
|||
orioptions: options, |
|||
options: options, |
|||
options_arr: { |
|||
1:'標', |
|||
2:'選', |
|||
}, |
|||
btntype:1, |
|||
buttons:[], |
|||
pageLength: 50, |
|||
currentpage:1, |
|||
dataLangth:options.length, |
|||
search: '', |
|||
pageNumber:1, |
|||
startpage:0, |
|||
endpage:this.startpage + this.pageLength, |
|||
pageNumberArr:[], |
|||
changeType(){ |
|||
this.options = this.orioptions; |
|||
this.options = this.getOptions(); |
|||
this.inputSearch() |
|||
}, |
|||
getOptions(start=0, end=this.pageLength){ |
|||
return this.options.slice(start, end); |
|||
}, |
|||
inputSearch(e=null){ |
|||
let text = e!=null ? e.target.value : this.search; |
|||
this.search = text.toLowerCase(); |
|||
if(text != ''){ |
|||
this.currentpage = 1; |
|||
this.options = this.orioptions |
|||
this.options = this.options.filter(item=>{ |
|||
if(item.group_name == null) item.group_name = '' |
|||
if(item.spec == null) item.spec = '' |
|||
if(item.memo == null) item.memo = '' |
|||
if(item.price == null) item.price = 0 |
|||
return (item.group_name.toLowerCase().includes(text.toLowerCase()) || item.spec.toLowerCase().includes(text.toLowerCase()) || item.memo.toLowerCase().includes(text.toLowerCase()) || String(item.price).includes(text.toLowerCase())) ; |
|||
}).slice((Number(this.currentpage)-1)*Number(this.pageLength), (Number(this.currentpage)-1)*Number(this.pageLength) + Number(this.pageLength)) |
|||
this.dataLangth = this.options.length |
|||
}else{ |
|||
this.options = this.orioptions |
|||
this.options = this.options.slice((Number(this.currentpage)-1)*Number(this.pageLength), (Number(this.currentpage)-1)*Number(this.pageLength) + Number(this.pageLength)) |
|||
this.dataLangth = this.orioptions.length |
|||
} |
|||
this.pageNumber = Math.ceil(Number(this.dataLangth)/Number(this.pageLength)) |
|||
this.pageNumberArr = [] |
|||
for(let i=0;i<this.pageNumber;i++){ |
|||
this.pageNumberArr.push({page:i+1, disabled:false}) |
|||
} |
|||
}, |
|||
renderPagination(){ |
|||
this.inputSearch(); |
|||
}, |
|||
switchPage(page){ |
|||
if(page == '...') return |
|||
this.currentpage = page |
|||
this.renderPagination() |
|||
}, |
|||
selectPage(e){ |
|||
this.currentpage = e.target.value |
|||
this.renderPagination() |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
<?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 = getenv('DB_HOST'); //資料庫主機名稱 |
|||
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號 |
|||
$db_password = getenv('DB_PASSWORD'); //登入密碼 |
|||
$db_name = getenv('DB_DATABASE'); //使用的資料庫 |
|||
$db_charset = 'utf8'; //設定字元編碼 |
|||
|
|||
|
|||
// $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,122 @@ |
|||
.price_option-select { |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
} |
|||
.price_option-select > .sidebar { |
|||
padding: 20px; |
|||
width: 15%; |
|||
min-width: 180px; |
|||
height: auto; |
|||
min-height: 80vh; |
|||
display: flex; |
|||
flex-direction: column; |
|||
border-right: 1px #ccc solid; |
|||
} |
|||
.price_option-select > .sidebar > a { |
|||
margin: 6px 0; |
|||
transition: 0.3s; |
|||
color: #666; |
|||
} |
|||
.price_option-select > .sidebar > a:hover { |
|||
color: #000; |
|||
} |
|||
.price_option-select > .sidebar > a.active { |
|||
color: #000; |
|||
font-weight: 700; |
|||
} |
|||
.price_option-select > .options { |
|||
width: 85%; |
|||
} |
|||
.price_option-select > .options > div { |
|||
width: 80%; |
|||
margin: 0 auto; |
|||
} |
|||
.price_option-select > .options > div.container { |
|||
margin-bottom: 16px; |
|||
} |
|||
|
|||
.price_option-index { |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
} |
|||
.price_option-index > .sidebar { |
|||
padding: 20px; |
|||
width: 15%; |
|||
min-width: 180px; |
|||
height: auto; |
|||
min-height: 80vh; |
|||
display: flex; |
|||
flex-direction: column; |
|||
border-right: 1px #ccc solid; |
|||
} |
|||
.price_option-index > .sidebar > a { |
|||
margin: 6px 0; |
|||
transition: 0.3s; |
|||
color: #666; |
|||
} |
|||
.price_option-index > .sidebar > a:hover { |
|||
color: #000; |
|||
} |
|||
.price_option-index > .sidebar > a.active { |
|||
color: #000; |
|||
font-weight: 700; |
|||
} |
|||
.price_option-index > .options { |
|||
width: 85%; |
|||
} |
|||
.price_option-index > .options > div { |
|||
width: 80%; |
|||
margin: 0 auto; |
|||
} |
|||
.price_option-index > .options > div.container { |
|||
margin-bottom: 16px; |
|||
} |
|||
|
|||
.btn-secondary { |
|||
background-color: #6C757D; |
|||
} |
|||
|
|||
.text-light { |
|||
color: #fff; |
|||
} |
|||
|
|||
.pagination { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
margin-top: 15px; |
|||
} |
|||
.pagination small { |
|||
color: #111; |
|||
font-size: 13px; |
|||
} |
|||
.pagination .links { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
.pagination a { |
|||
color: black; |
|||
float: left; |
|||
padding: 8px 16px; |
|||
text-decoration: none; |
|||
transition: background-color 0.3s; |
|||
} |
|||
.pagination a.active { |
|||
background-color: #1E74FD; |
|||
color: white; |
|||
border-radius: 5px; |
|||
} |
|||
.pagination a:hover:not(.active) { |
|||
background-color: #ddd; |
|||
} |
|||
.pagination a.disabled { |
|||
cursor: not-allowed; |
|||
} |
|||
.pagination a.disabled:hover:not(.active) { |
|||
background-color: transparent; |
|||
}/*# sourceMappingURL=style.css.map */ |
@ -0,0 +1 @@ |
|||
{"version":3,"sources":["style.scss","style.css"],"names":[],"mappings":"AAAA;EACI,WAAA;EACA,cAAA;EACA,aAAA;ACCJ;ADAI;EACI,aAAA;EACA,UAAA;EACA,gBAAA;EACA,YAAA;EACA,gBAAA;EACA,aAAA;EACA,sBAAA;EACA,4BAAA;ACER;ADDQ;EACI,aAAA;EACA,gBAAA;EACA,WAAA;ACGZ;ADFY;EACI,WAAA;ACIhB;ADFY;EACI,WAAA;EACA,gBAAA;ACIhB;ADAI;EACI,UAAA;ACER;ADDQ;EACI,UAAA;EACA,cAAA;ACGZ;ADFY;EACI,mBAAA;ACIhB;;ADCA;EACI,WAAA;EACA,cAAA;EACA,WAAA;EACA,cAAA;EACA,aAAA;ACEJ;ADDI;EACI,aAAA;EACA,UAAA;EACA,gBAAA;EACA,YAAA;EACA,gBAAA;EACA,aAAA;EACA,sBAAA;EACA,4BAAA;ACGR;ADFQ;EACI,aAAA;EACA,gBAAA;EACA,WAAA;ACIZ;ADHY;EACI,WAAA;ACKhB;ADHY;EACI,WAAA;EACA,gBAAA;ACKhB;ADDI;EACI,UAAA;ACGR;ADFQ;EACI,UAAA;EACA,cAAA;ACIZ;ADHY;EACI,mBAAA;ACKhB;;ADAA;EACI,yBAAA;ACGJ;;ADDA;EACI,WAAA;ACIJ;;ADFA;EACI,aAAA;EACA,mBAAA;EACA,8BAAA;EACA,gBAAA;ACKJ;ADJI;EACI,WAAA;EACA,eAAA;ACMR;ADJI;EACI,aAAA;EACA,mBAAA;EACA,uBAAA;ACMR;ADJI;EACI,YAAA;EACA,WAAA;EACA,iBAAA;EACA,qBAAA;EACA,iCAAA;ACMR;ADLQ;EACI,yBAAA;EACA,YAAA;EACA,kBAAA;ACOZ;ADLQ;EAAsB,sBAAA;ACQ9B;ADPQ;EACI,mBAAA;ACSZ;ADRY;EAAsB,6BAAA;ACWlC","file":"style.css"} |
@ -0,0 +1,115 @@ |
|||
.price_option-select{ |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
>.sidebar{ |
|||
padding: 20px; |
|||
width: 15%; |
|||
min-width: 180px; |
|||
height: auto; |
|||
min-height: 80vh; |
|||
display: flex; |
|||
flex-direction: column; |
|||
border-right:1px #ccc solid; |
|||
>a{ |
|||
margin:6px 0; |
|||
transition: .3s; |
|||
color:#666; |
|||
&:hover{ |
|||
color:#000; |
|||
} |
|||
&.active{ |
|||
color:#000; |
|||
font-weight: 700; |
|||
} |
|||
} |
|||
} |
|||
>.options{ |
|||
width: 85%; |
|||
>div{ |
|||
width: 80%; |
|||
margin:0 auto; |
|||
&.container{ |
|||
margin-bottom: 16px; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.price_option-index{ |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
width: 100%; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
>.sidebar{ |
|||
padding: 20px; |
|||
width: 15%; |
|||
min-width: 180px; |
|||
height: auto; |
|||
min-height: 80vh; |
|||
display: flex; |
|||
flex-direction: column; |
|||
border-right:1px #ccc solid; |
|||
>a{ |
|||
margin:6px 0; |
|||
transition: .3s; |
|||
color:#666; |
|||
&:hover{ |
|||
color:#000; |
|||
} |
|||
&.active{ |
|||
color:#000; |
|||
font-weight: 700; |
|||
} |
|||
} |
|||
} |
|||
>.options{ |
|||
width: 85%; |
|||
>div{ |
|||
width: 80%; |
|||
margin:0 auto; |
|||
&.container{ |
|||
margin-bottom: 16px; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.btn-secondary{ |
|||
background-color: #6C757D; |
|||
} |
|||
.text-light{ |
|||
color:#fff; |
|||
} |
|||
.pagination { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
margin-top: 15px; |
|||
small{ |
|||
color:#111; |
|||
font-size: 13px; |
|||
} |
|||
.links{ |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
a { |
|||
color: black; |
|||
float: left; |
|||
padding: 8px 16px; |
|||
text-decoration: none; |
|||
transition: background-color .3s; |
|||
&.active { |
|||
background-color: #1E74FD; |
|||
color: white; |
|||
border-radius: 5px; |
|||
} |
|||
&:hover:not(.active) {background-color: #ddd;} |
|||
&.disabled{ |
|||
cursor:not-allowed; |
|||
&:hover:not(.active) {background-color: transparent;} |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,87 +1,110 @@ |
|||
<?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); |
|||
include '../header.php'; |
|||
require_once './conn.php'; |
|||
$kind = $_GET['kind']; |
|||
$sql_str = "SELECT * FROM option_price WHERE kind = :kind AND status ='Y'"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':kind', $kind); |
|||
$stmt->execute(); |
|||
$options = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|||
$optional_arr = [1=>'標', 2=>'選']; |
|||
?> |
|||
<style> |
|||
.container { |
|||
padding-top: 10px !important; |
|||
} |
|||
#exTab1 table { |
|||
background-color : white; |
|||
padding : 5px 15px; |
|||
} |
|||
.kind-col { |
|||
color:brown; |
|||
} |
|||
</style> |
|||
<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"> |
|||
<script defer src="../contract/js/alpinejs/cdn.min.js"></script> |
|||
<script src="../contract/js/axios/axios.min.js"></script> |
|||
<div class="price_option-index" x-data="priceOptionIndex"> |
|||
<div class="sidebar"> |
|||
<a href="./price_option-select.php?<?php echo $token_link; ?> ">全部顯示</a> |
|||
<a <?php if($kind == 'A'){echo 'class="active"';} ?> href="./price_option-index.php?kind=A&<?php echo $token_link; ?>">A-1車廂意匠</a> |
|||
<a <?php if($kind == 'B'){echo 'class="active"';} ?> href="./price_option-index.php?kind=B&<?php echo $token_link; ?>">A-2車廂內裝</a> |
|||
<a <?php if($kind == 'C'){echo 'class="active"';} ?> href="./price_option-index.php?kind=C&<?php echo $token_link; ?>">A-3車廂外部</a> |
|||
<a <?php if($kind == 'D'){echo 'class="active"';} ?> href="./price_option-index.php?kind=D&<?php echo $token_link; ?>">A-4控制與其他</a> |
|||
<a <?php if($kind == 'E'){echo 'class="active"';} ?> href="./price_option-index.php?kind=E&<?php echo $token_link; ?>">B-1平台梯</a> |
|||
<a <?php if($kind == 'F'){echo 'class="active"';} ?> href="./price_option-index.php?kind=F&<?php echo $token_link; ?>">C-1汰改</a> |
|||
</div> |
|||
<div class="options"> |
|||
<div class="container"><h2>OPTION價格查詢</h2></div> |
|||
<div id="exTab1" class="container"> |
|||
<div class="toolbar"> |
|||
<label for=""> |
|||
顯示 |
|||
<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-html="option.price!=null ? Number(option.price).toLocaleString() : ''"></td> |
|||
</tr> |
|||
</template> |
|||
</table> |
|||
<div class="pagination"> |
|||
<small x-text="'顯示第'+((Number(currentpage)-1)*Number(pageLength)+1)+' 至 '+((((Number(currentpage)-1)*Number(pageLength) +Number(pageLength))< dataLangth) ? ((Number(currentpage)-1)*Number(pageLength) +Number(pageLength)) : dataLangth )+' 項結果,共 '+dataLangth+' 項'"></small> |
|||
<div class="links"> |
|||
<template x-if="currentpage>1"> |
|||
<a href="###" @click="switchPage(currentpage-1)">«</a> |
|||
</template> |
|||
<template x-if="pageNumber <= 10"> |
|||
<template x-for="page in pageNumber"> |
|||
<a href="javascript:;" @click="switchPage(page)" :class="[(page == currentpage) ? 'active' : '']" x-text="page" ></a> |
|||
</template> |
|||
</template> |
|||
<template x-if="pageNumber > 10"> |
|||
<select @change="selectPage($event)" style="width:66px;padding:8px 2px" x-model="currentpage"> |
|||
<template x-for="page in pageNumber"> |
|||
<option :value="page" x-text="page"></option> |
|||
</template> |
|||
</select> |
|||
</template> |
|||
<template x-if="currentpage<pageNumber"> |
|||
<a href="###" @click="switchPage(currentpage+1)">»</a> |
|||
</template> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<script src="./assets/js/alpine.js"></script> |
|||
<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(); |
|||
}) |
|||
const options = [...<?php echo json_encode($options); ?>]; |
|||
const kind = '<?php echo $kind; ?>'; |
|||
</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,106 @@ |
|||
<?php |
|||
include "../header.php"; |
|||
require_once('./conn.php'); |
|||
$sql_str = "SELECT * FROM option_price WHERE status = 'Y' ORDER BY kind, id"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->execute(); |
|||
$options = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|||
$optional_arr = [1=>'標', 2=>'選']; |
|||
?> |
|||
<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"> |
|||
<script defer src="../contract/js/alpinejs/cdn.min.js"></script> |
|||
<script src="../contract/js/axios/axios.min.js"></script> |
|||
<div class="price_option-select" x-data="priceOptionSelect"> |
|||
|
|||
<div class="sidebar"> |
|||
<a class="active" href="./price_option-select.php?<?php echo $token_link; ?> ">全部顯示</a> |
|||
<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; ?>">B-1平台梯</a> |
|||
<a href="./price_option-index.php?kind=F&<?php echo $token_link; ?>">C-1汰改</a> |
|||
</div> |
|||
<div class="options"> |
|||
|
|||
<div class="container"><h2>OPTION價格查詢</h2></div> |
|||
<div id="exTab1" class="container"> |
|||
<div class="toolbar"> |
|||
<label for=""> |
|||
顯示 |
|||
<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=""> |
|||
</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-html="option.price!=null ? Number(option.price).toLocaleString() : ''"></td> |
|||
</tr> |
|||
</template> |
|||
</table> |
|||
<div class="pagination"> |
|||
<small x-text="'顯示第'+((Number(currentpage)-1)*Number(pageLength)+1)+' 至 '+((((Number(currentpage)-1)*Number(pageLength) +Number(pageLength))< dataLangth) ? ((Number(currentpage)-1)*Number(pageLength) +Number(pageLength)) : dataLangth )+' 項結果,共 '+dataLangth+' 項'"></small> |
|||
<div class="links"> |
|||
<template x-if="currentpage>1"> |
|||
<a href="###" @click="switchPage(currentpage-1)">«</a> |
|||
</template> |
|||
<template x-if="pageNumber <= 10"> |
|||
<template x-for="page in pageNumber"> |
|||
<a href="javascript:;" @click="switchPage(page)" :class="[(page == currentpage) ? 'active' : '']" x-text="page" ></a> |
|||
</template> |
|||
</template> |
|||
<template x-if="pageNumber > 10"> |
|||
<select @change="selectPage($event)" style="width:66px;padding:8px 2px" x-model="currentpage"> |
|||
<template x-for="page in pageNumber"> |
|||
<option :value="page" x-text="page"></option> |
|||
</template> |
|||
</select> |
|||
</template> |
|||
<template x-if="currentpage<pageNumber"> |
|||
<a href="###" @click="switchPage(currentpage+1)">»</a> |
|||
</template> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<script src="./assets/js/alpine.js"></script> |
|||
<script> |
|||
const options = [...<?php echo json_encode($options); ?>]; |
|||
</script> |
@ -0,0 +1,12 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$BillNo = 'CM0122231106'; |
|||
$rib_query = "SELECT * FROM rib WHERE BillNo = '$BillNo'"; |
|||
$rib = mysqli_query($link, $rib_query); |
|||
foreach ($rib as $rib){ |
|||
$rib_id = $rib['rib_id']; |
|||
$BillDate = $rib['BillDate']; |
|||
|
|||
} |
|||
$OrgId = $FOrgId ='1000'; |
|||
echo $rib_id."<br>".$BillDate."<br>".$OrgId; |