Browse Source

Merge branch 'main' into gary

gary
gary_chen\gary_chen 1 year ago
parent
commit
5f66622cff
  1. 71
      wms/T8_assemble_apply.php
  2. 23
      wms/T8_purBillOrder_search.php
  3. 1
      wms/T8_purRequestOrder_create.php
  4. BIN
      wms/WriteOff.xlsx
  5. 39
      wms/account-receivable-contract.php
  6. 77
      wms/account-receivable-index.php
  7. 68
      wms/contract/api/postContractNewApplyData.php
  8. 5
      wms/contract/api/postNewContractData.php
  9. 5
      wms/contract/api/putContractData.php
  10. 3
      wms/contract/composer.json
  11. 567
      wms/contract/composer.lock
  12. 477
      wms/contract/contract-new-apply.php
  13. 34
      wms/contract/contract-newelevator-edit.php
  14. 17
      wms/contract/contract-newelevator-input.php
  15. 168
      wms/contract/insertData.php
  16. 93
      wms/contract/js/alpine.js
  17. 92
      wms/contract/styles/style.css
  18. 2
      wms/contract/styles/style.css.map
  19. 29
      wms/contract/styles/style.scss
  20. 2
      wms/fun_global.php
  21. BIN
      wms/mkt/assets/img/1.jpg
  22. BIN
      wms/mkt/assets/img/2.jpg
  23. BIN
      wms/mkt/assets/img/3.jpg
  24. BIN
      wms/mkt/assets/img/4.jpg
  25. BIN
      wms/mkt/assets/img/5.jpg
  26. BIN
      wms/mkt/assets/img/S__14541066.jpg
  27. BIN
      wms/mkt/assets/img/curry.jpg
  28. 193
      wms/mkt/assets/js/alpine.js
  29. 49
      wms/mkt/conn.php
  30. 122
      wms/mkt/css/style.css
  31. 1
      wms/mkt/css/style.css.map
  32. 115
      wms/mkt/css/style.scss
  33. 189
      wms/mkt/price_option-index.php
  34. 87
      wms/mkt/price_option-index2.php
  35. 106
      wms/mkt/price_option-select.php
  36. 8
      wms/mkt/pricereview-check.php
  37. 14
      wms/mkt/pricereview-index.php
  38. 10
      wms/mkt/pricereview-record-check.php
  39. 17
      wms/mkt/pricereview_renovate-check.php
  40. BIN
      wms/mkt/specsurvey-edit.zip
  41. 2
      wms/mkt/specsurvey-index.php
  42. 2
      wms/mkt/specsurvey_renovate-index.php
  43. 12
      wms/rib-feeapply-test.php
  44. 109
      wms/rib-test.php
  45. 2
      wms/rib-test02.php
  46. 2
      wms/rib01-check.php
  47. 2
      wms/rib02-business-create.php

71
wms/T8_assemble_apply.php

@ -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>

23
wms/T8_purBillOrder_search.php

@ -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>";
}

1
wms/T8_purRequestOrder_create.php

@ -0,0 +1 @@
<?php

BIN
wms/WriteOff.xlsx

Binary file not shown.

39
wms/account-receivable-contract.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>";
}

77
wms/account-receivable-index.php

@ -8,7 +8,9 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
$arrayData = [];
echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;交車款;取得許可證約交款;取得許可函後6個月約交款;目前應收;總作番數;貨抵;安裝;試車;移交數;狀態</br>";
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車
//arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交
echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;官檢款;交車款;目前應收;總作番數;貨抵;安裝試車;官檢;移交數;狀態</br>";
// $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC);
@ -27,15 +29,15 @@ foreach ($contract as $cont) {
// echo "<br>";
if ($cont['BillNo'] == 'SO20230801001') {
$BillNo = 'M230947';
}elseif ($cont['BillNo'] == 'SO20230801002'){
} elseif ($cont['BillNo'] == 'SO20230801002') {
$BillNo = 'M231067';
}else{
} else {
$BillNo = $cont['BillNo'];
};
$PayStage = $cont['PayStage'];
$PayAmount = $cont['PlanPayAmt'];
$partnerName = $cont['BizPartnerName'];
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車
if (isset($arrayData[$BillNo])) {
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) {
$arrayData[$BillNo][5] = $PayAmount;
@ -43,16 +45,14 @@ foreach ($contract as $cont) {
$arrayData[$BillNo][4] = $PayAmount;
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) {
$arrayData[$BillNo][6] = $PayAmount;
} elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '試車')) {
} elseif ( stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) {
$arrayData[$BillNo][8] = $PayAmount;
} elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) {
$arrayData[$BillNo][9] = $PayAmount;
} elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) {
}elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) {
$arrayData[$BillNo][10] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) {
$arrayData[$BillNo][11] = $PayAmount;
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) {
$arrayData[$BillNo][9] = $PayAmount;
} else {
$arrayData[$BillNo][12] = $PayAmount;
}
@ -65,21 +65,20 @@ foreach ($contract as $cont) {
$arrayData[$BillNo][4] = $PayAmount;
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) {
$arrayData[$BillNo][6] = $PayAmount;
} elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '試車')) {
} elseif ( stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) {
$arrayData[$BillNo][8] = $PayAmount;
} elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) {
$arrayData[$BillNo][9] = $PayAmount;
} elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) {
}elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) {
$arrayData[$BillNo][10] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) {
$arrayData[$BillNo][11] = $PayAmount;
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) {
$arrayData[$BillNo][9] = $PayAmount;
} else {
$arrayData[$BillNo][12] = $PayAmount;
}
}
}
foreach ($arrayData as $key => $value) {
$sql = "SELECT
tmp2.*,
@ -98,6 +97,7 @@ w.actual_tofactory_date,
w.real_arrival_date,
w.install_end_date,
w.tryrun_end_date,
w.official_check_date,
w.delivery_date
from wipwholestatus AS w
left join account AS a
@ -118,10 +118,9 @@ ON d.department_id = tmp2.department_id";
$facitities = "";
$total_facility_num = 0;
$arrive_num = 0;
$install_num = 0;
$tryrun_num = 0;
$delivery_num = 0;
$official_num = 0;
$wipwhole_array = mysqli_query($link, $sql);
foreach ($wipwhole_array as $wip) {
@ -130,42 +129,48 @@ ON d.department_id = tmp2.department_id";
$value[1] = $wip['manager_name'];
$value[2] = $wip['name'];
if ($wip['delivery_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['delivery_date'] . "已移交),\n";
$facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) , \n";
$total_facility_num += 1;
$arrive_num += 1;
$install_num += 1;
$tryrun_num += 1;
$official_num += 1;
$delivery_num += 1;
} elseif ($wip['tryrun_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['tryrun_end_date'] . "試車完畢),\n";
} elseif($wip['official_check_date'] != NULL){
$facitities .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) , \n";
$total_facility_num += 1;
$arrive_num += 1;
$tryrun_num += 1;
$official_num += 1;
}elseif ($wip['tryrun_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) , \n";
$total_facility_num += 1;
$arrive_num += 1;
$install_num += 1;
$tryrun_num += 1;
} elseif ($wip['install_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['install_end_date'] . "安裝完畢),\n";
$facitities .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) , \n";
$total_facility_num += 1;
$arrive_num += 1;
$install_num += 1;
} elseif ($wip['real_arrival_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['real_arrival_date'] . "貨抵工地),\n";
$facitities .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) , \n";
$total_facility_num += 1;
$arrive_num += 1;
} elseif ($wip['actual_tofactory_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['actual_tofactory_date'] . "實際到觀音日),\n";
$facitities .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) , \n";
$total_facility_num += 1;
} elseif ($wip['estimated_shipping_date'] != NULL) {
$facitities .= $wip['facilityno'] . "(" . $wip['estimated_shipping_date'] . "預計到港),\n";
$facitities .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) , \n";
$total_facility_num += 1;
} else {
$facitities .= $wip['facilityno'] . "(預計到港日待確認),\n";
$facitities .= $wip['facilityno'] . " (預計到港日待確認) , \n";
$total_facility_num += 1;
}
}
//這是錢 4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車
//這是數量 arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交
if ($total_facility_num > 0) {
$receivable_budget = $value[4] + ($value[5] + $value[6]) * ($arrive_num / $total_facility_num) +
($value[7]) * ($install_num / $total_facility_num) + ($value[8]) * ($tryrun_num / $total_facility_num)
+ ($value[9] + $value[10] + $value[11]) * ($delivery_num / $total_facility_num);
($value[7]+$value[8]) * ($tryrun_num / $total_facility_num) + ($value[9]) * ($official_num / $total_facility_num)
+ ($value[10]) * ($delivery_num / $total_facility_num);
}
echo $key . ";" . $value[0] . ";" . $value[1] . ";" . $value[2] . ";" . $value[3] . ";" . $value[4] . ";" . $value[5] . ";" . $value[6] . ";" . $value[7] . ";" . $value[8] . ";" . $value[9] . ";" . $value[10] . ";" . $value[11] . ";" . $receivable_budget . ";" . $total_facility_num . ";" . $arrive_num . ";" . $install_num . ";" . $tryrun_num . ";" . $delivery_num . ";" . $facitities . "<br>";
echo $key . ";" . $value[0] . ";" . $value[1] . ";" . $value[2] . ";" . $value[3] . ";" . $value[4] . ";" . $value[5] . ";" . $value[6] . ";" . $value[7] . ";" . $value[8] . ";" . $value[9].";" . $value[10] . ";" . $receivable_budget . ";" . $total_facility_num . ";" . $arrive_num . ";". $tryrun_num . ";" .$official_num.";". $delivery_num . ";" . $facitities . "<br>";
}

68
wms/contract/api/postContractNewApplyData.php

@ -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());
}
}

5
wms/contract/api/postNewContractData.php

@ -22,6 +22,7 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$lm_tel = $_POST["lm_tel"];
$address = $_POST["address"];
$salesman = $_POST["salesman"];
$qc = $_POST["qc"];
$contracttype = $_POST["contracttype"];
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$files_id = null;
@ -36,6 +37,7 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
if(empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
if(empty($address)) $fail_arr[] = '地址為必填';
if(empty($salesman)) $fail_arr[] = '營業員為必填';
if(empty($qc)) $fail_arr[] = '請選擇QC或官檢';
if(count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
@ -105,7 +107,7 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$files = null;
}
$sql_str = "INSERT INTO contract_m_signed_back (contract_no, customer, manager, vat, case_name, linkman, lm_tel, address, salesman, salesman_name, files_id, created_at, created_by) VALUES (:contract_no, :customer, :manager, :vat, :case_name, :linkman, :lm_tel, :address, :salesman, :salesman_name, :files_id, :created_at, :created_by)";
$sql_str = "INSERT INTO contract_m_signed_back (contract_no, customer, manager, vat, case_name, linkman, lm_tel, address, salesman, salesman_name, files_id, created_at, created_by, qc_official_type) VALUES (:contract_no, :customer, :manager, :vat, :case_name, :linkman, :lm_tel, :address, :salesman, :salesman_name, :files_id, :created_at, :created_by, :qc)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(":contract_no",$contractno);
$stmt -> bindParam(":customer",$customer);
@ -120,6 +122,7 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$stmt -> bindParam(":files_id",$files_id);
$stmt -> bindParam(":created_at",$created_at);
$stmt -> bindParam(":created_by",$created_by);
$stmt -> bindParam(":qc",$qc);
$stmt -> execute();

5
wms/contract/api/putContractData.php

@ -17,6 +17,7 @@ if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]
$lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$qc = !empty($_POST['qc']) ? $_POST['qc'] : null;
$deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
$files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
@ -33,6 +34,7 @@ if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]
if(empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
if(empty($address)) $fail_arr[] = '地址為必填';
if(empty($salesman)) $fail_arr[] = '營業員為必填';
if(empty($qc)) $fail_arr[] = '請選擇QC或管檢';
if(count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
@ -41,7 +43,7 @@ if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]
$conn->beginTransaction();
$sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman WHERE id = :id";
$sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman, qc_official_type=:qc WHERE id = :id";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contract_no' ,$contract_no);
$stmt -> bindParam(':customer' ,$customer);
@ -52,6 +54,7 @@ if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]
$stmt -> bindParam(':lm_tel' ,$lm_tel);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':salesman' ,$salesman);
$stmt -> bindParam(':qc' ,$qc);
$stmt -> bindParam(':id' ,$id);
$stmt -> execute();
if(!empty($deletefiles)){

3
wms/contract/composer.json

@ -12,6 +12,7 @@
}
],
"require": {
"tecnickcom/tcpdf": "^6.6"
"tecnickcom/tcpdf": "^6.6",
"phpoffice/phpspreadsheet": "^1.29"
}
}

567
wms/contract/composer.lock

@ -4,8 +4,573 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c5a277735def820cc2b17b4a2b30976d",
"content-hash": "f9ceea0f00278e84ee8bc939092d4886",
"packages": [
{
"name": "ezyang/htmlpurifier",
"version": "v4.17.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"shasum": ""
},
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-tidy": "Used for pretty-printing HTML"
},
"type": "library",
"autoload": {
"files": [
"library/HTMLPurifier.composer.php"
],
"psr-0": {
"HTMLPurifier": "library/"
},
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0"
},
"time": "2023-11-17T15:01:25+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php-64bit": "^8.1"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.0"
},
"suggest": {
"guzzlehttp/psr7": "^2.4",
"psr/http-message": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"ZipStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paul Duncan",
"email": "pabs@pablotron.org"
},
{
"name": "Jonatan Männchen",
"email": "jonatan@maennchen.ch"
},
{
"name": "Jesse Donat",
"email": "donatj@gmail.com"
},
{
"name": "András Kolesár",
"email": "kolesar@kolesar.hu"
}
],
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
"keywords": [
"stream",
"zip"
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0"
},
"funding": [
{
"url": "https://github.com/maennchen",
"type": "github"
},
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2023-06-21T14:59:35+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Complex\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@lange.demon.co.uk"
}
],
"description": "PHP Class for working with complex numbers",
"homepage": "https://github.com/MarkBaker/PHPComplex",
"keywords": [
"complex",
"mathematics"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
},
"time": "2022-12-06T16:21:08+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Matrix\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@demon-angel.eu"
}
],
"description": "PHP Class for working with matrices",
"homepage": "https://github.com/MarkBaker/PHPMatrix",
"keywords": [
"mathematics",
"matrix",
"vector"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
},
"time": "2022-12-02T22:17:43+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.29.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0"
},
"time": "2023-06-14T22:48:31+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client"
},
"time": "2023-09-23T14:17:50+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
},
"time": "2023-04-10T20:10:41+00:00"
},
{
"name": "psr/http-message",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"time": "2023-04-04T09:54:51+00:00"
},
{
"name": "psr/simple-cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865",
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"support": {
"source": "https://github.com/php-fig/simple-cache/tree/3.0.0"
},
"time": "2021-10-29T13:26:27+00:00"
},
{
"name": "tecnickcom/tcpdf",
"version": "6.6.5",

477
wms/contract/contract-new-apply.php

@ -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>

34
wms/contract/contract-newelevator-edit.php

@ -54,6 +54,7 @@ $persons = array_map(function($person){
files:<?php echo $files; ?>,
newfiles:[],
deletefiles:[],
qc:"<?php echo $contract["qc_official_type"]; ?>",
files_id: "<?php echo $contract["files_id"]; ?>",
},
fail_arr:[],
@ -74,11 +75,13 @@ $persons = array_map(function($person){
form.append("case_name", this.data.case_name);
form.append("linkman", this.data.linkman);
form.append("lm_tel", this.data.lm_tel);
form.append("address", this.data.address);
form.append("address", this.data.address);user_id
form.append("salesman", this.data.salesman);
form.append("qc", this.data.qc);
form.append("deletefiles", this.data.deletefiles);
form.append("files_id", this.data.files_id);
form.append("user_id", "<?php echo $user_id; ?>");
form.append("", "<?php echo $user_id; ?>");
for (var i = 0; i < this.data.newfiles.length; i++) {
form.append("files[]", this.data.newfiles[i]);
@ -87,19 +90,8 @@ $persons = array_map(function($person){
axios.post("./api/putContractData.php", form).then(res=>{
console.log(res.data)
if(res.status === 200){
alert("更新成功")
this.step = 1
this.data.contractno=""
this.data.customer=""
this.data.manager=""
this.data.vat=""
this.data.case_name=""
this.data.linkman=""
this.data.lm_tel=""
this.data.address=""
this.data.salesman=""
this.data.files=[]
this.customize = false
alert("更新成功");
window.location.reload();
}
this.isLoading = false
}).catch(error=>{
@ -186,8 +178,18 @@ $persons = array_map(function($person){
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.lm_tel" >
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">QC和官檢</td>
<td>
<select class="" id="qc" x-model="data.qc">
<option value="">請選擇QC或官檢</option>
<option value="Q">只需QC</option>
<option value="O">只需官檢</option>
<option value="QO">QC和官檢</option>
</select>
<p class="alerttext" x-show="data.qc==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">案件名稱</td>
<td colspan=3>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.case_name" >
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
@ -239,6 +241,8 @@ $persons = array_map(function($person){
<script src="semantic/dist/semantic.min.js" ></script>
<script>
const user_id = '<?php echo $user_id; ?>';
const user_name = '<?php echo $user_name; ?>';
$('#table_index').DataTable(
{
"order": [

17
wms/contract/contract-newelevator-input.php

@ -1,5 +1,5 @@
<?php
include("../header.php");
include_once("../header.php");
require_once("./conn.php");
$accounttype = "M";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype";
@ -99,8 +99,18 @@ $persons = array_map(function($person){
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.lm_tel" >
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">QC和官檢</td>
<td>
<select class="" id="qc" x-model="data.qc">
<option value="">請選擇QC或官檢</option>
<option value="Q">只需QC</option>
<option value="O">只需官檢</option>
<option value="QO">QC和官檢</option>
</select>
<p class="alerttext" x-show="data.qc==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">案件名稱</td>
<td colspan=3>
<td >
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.case_name" >
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
@ -111,8 +121,9 @@ $persons = array_map(function($person){
<input class="form-control disabled_select" type="text" name="uscc" 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 colspan=3>
<td colspan="3">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>

168
wms/contract/insertData.php

@ -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());
}
}
}
?>

93
wms/contract/js/alpine.js

@ -812,6 +812,8 @@ const contractNewInput =()=> {
lm_tel:'',
address:'',
salesman:'',
qc:'',
qc:'',
files:[],
},
step:1,
@ -853,6 +855,7 @@ const contractNewInput =()=> {
this.data.lm_tel = res.data.lm_tel
this.data.address = res.data.address
this.data.salesman = res.data.salesman
this.data.qc = res.data.qc
}
this.step = 2
this.isLoading = false
@ -873,6 +876,7 @@ const contractNewInput =()=> {
form.append('lm_tel', this.data.lm_tel);
form.append('address', this.data.address);
form.append('salesman', this.data.salesman);
form.append('qc', this.data.qc);
form.append('contracttype', 'm');
form.append('user_id', user_id);
for (var i = 0; i < this.data.files.length; i++) {
@ -892,6 +896,7 @@ const contractNewInput =()=> {
this.data.lm_tel=''
this.data.address=''
this.data.salesman=''
this.data.qc=''
this.data.files=[]
this.customize = false
@ -1165,5 +1170,91 @@ const contractInput =()=> {
this.data.files = e.target.files
},
}
};
const contractNewApply = ()=>{
return {
step:1,
isLoading:false,
data:{
mid: mid,
vol_no: contractno,
salesman: salesman,
salesmanname:salesmanname,
apply_date: apply_date,
apply_type:'A',
case_name: case_name,
company: company,
manager: manager,
vat: vat,
total_price: price_total,
price_a: price_a,
price_b: price_b,
address: address,
workdeadline_a:30, //完工期限: 幾天內安裝完成,預設30
workdeadline_b:7, //完工期限: 幾天內整理完善,預設7
regulations:10, //附則
freedeadline:18, //免保期限(月)
tradeaddress:'', //交貨地點
tradedeadline: 90, //交貨期限
items: items,
},
pays:{
1:0,
2:0,
3:0,
4:0,
5:0,
6:0,
7:0,
},
tickets:{
1:0,
2:0,
3:0,
4:0,
5:0,
6:0,
7:0,
},
localnumber(num){
return num.toLocaleString();
},
storageFn(){
this.isLoading = true
const isFirst = 1;
const form = new FormData();
form.append('mid', this.data.mid);
form.append('vol_no', this.data.vol_no);
form.append('salesman', this.data.salesman);
form.append('apply_date', this.data.apply_date);
form.append('apply_type', this.data.apply_type);
form.append('case_name', this.data.case_name);
form.append('company', this.data.company);
form.append('manager', this.data.manager);
form.append('vat', this.data.vat);
form.append('total_price', this.data.total_price);
form.append('price_a', this.data.price_a);
form.append('price_b', this.data.price_b);
form.append('address', this.data.address);
form.append('workdeadline_a', this.data.workdeadline_a);
form.append('workdeadline_b', this.data.workdeadline_b);
form.append('regulations', this.data.regulations);
form.append('freedeadline', this.data.freedeadline);
form.append('tradeaddress', this.data.tradeaddress);
form.append('tradedeadline', this.data.tradedeadline);
form.append('isFirst', isFirst);
form.append('user_id', user_id);
axios.post('./api/postContractNewApplyData.php', form).then(res=>{
if(res.status === 200){
alert('暫存成功');
console.log(res.data);
}
this.isLoading = false
}).catch(error=>{
alert('儲存失敗!可能為以下錯誤:\n' + error.response.data)
this.isLoading = false
})
}
}
}

92
wms/contract/styles/style.css

@ -541,14 +541,14 @@ main table td, main table th {
transform: rotate(360deg);
}
}
.contract-input-component .form, .contract-management .form {
.contract-input-component .contract-input-component .form, .contract-input-component .contract-management .form, .contract-input-component .contract-new-apply-component .form, .contract-management .contract-input-component .form, .contract-management .contract-management .form, .contract-management .contract-new-apply-component .form, .contract-new-apply-component .contract-input-component .form, .contract-new-apply-component .contract-management .form, .contract-new-apply-component .contract-new-apply-component .form {
margin: 0 auto;
}
.contract-input-component .form .dropdown, .contract-management .form .dropdown {
.contract-input-component .contract-input-component .form .dropdown, .contract-input-component .contract-management .form .dropdown, .contract-input-component .contract-new-apply-component .form .dropdown, .contract-management .contract-input-component .form .dropdown, .contract-management .contract-management .form .dropdown, .contract-management .contract-new-apply-component .form .dropdown, .contract-new-apply-component .contract-input-component .form .dropdown, .contract-new-apply-component .contract-management .form .dropdown, .contract-new-apply-component .contract-new-apply-component .form .dropdown {
width: 100%;
margin-top: 7px;
}
.contract-input-component .form .savebtn, .contract-management .form .savebtn {
.contract-input-component .contract-input-component .form .savebtn, .contract-input-component .contract-management .form .savebtn, .contract-input-component .contract-new-apply-component .form .savebtn, .contract-management .contract-input-component .form .savebtn, .contract-management .contract-management .form .savebtn, .contract-management .contract-new-apply-component .form .savebtn, .contract-new-apply-component .contract-input-component .form .savebtn, .contract-new-apply-component .contract-management .form .savebtn, .contract-new-apply-component .contract-new-apply-component .form .savebtn {
margin-right: 13px;
display: flex;
justify-content: center;
@ -557,7 +557,11 @@ main table td, main table th {
height: 45px;
font-size: 15px;
}
.contract-input-component .form table .alerttext, .contract-management .form table .alerttext {
.contract-input-component .contract-input-component .form table .fixed, .contract-input-component .contract-management .form table .fixed, .contract-input-component .contract-new-apply-component .form table .fixed, .contract-management .contract-input-component .form table .fixed, .contract-management .contract-management .form table .fixed, .contract-management .contract-new-apply-component .form table .fixed, .contract-new-apply-component .contract-input-component .form table .fixed, .contract-new-apply-component .contract-management .form table .fixed, .contract-new-apply-component .contract-new-apply-component .form table .fixed {
padding: 8px 0;
cursor: not-allowed;
}
.contract-input-component .contract-input-component .form table .alerttext, .contract-input-component .contract-management .form table .alerttext, .contract-input-component .contract-new-apply-component .form table .alerttext, .contract-management .contract-input-component .form table .alerttext, .contract-management .contract-management .form table .alerttext, .contract-management .contract-new-apply-component .form table .alerttext, .contract-new-apply-component .contract-input-component .form table .alerttext, .contract-new-apply-component .contract-management .form table .alerttext, .contract-new-apply-component .contract-new-apply-component .form table .alerttext {
font-size: 13px;
color: #a00;
font-weight: 500;
@ -565,64 +569,92 @@ main table td, main table th {
font-weight: 900;
padding: 0;
}
.contract-input-component .form input[type=file], .contract-management .form input[type=file] {
.contract-input-component .contract-input-component .form input[type=file], .contract-input-component .contract-management .form input[type=file], .contract-input-component .contract-new-apply-component .form input[type=file], .contract-management .contract-input-component .form input[type=file], .contract-management .contract-management .form input[type=file], .contract-management .contract-new-apply-component .form input[type=file], .contract-new-apply-component .contract-input-component .form input[type=file], .contract-new-apply-component .contract-management .form input[type=file], .contract-new-apply-component .contract-new-apply-component .form input[type=file] {
padding: 12px 20px;
margin: 8px 0;
}
.contract-input-component .error, .contract-management .error {
.contract-input-component .contract-input-component .form span, .contract-input-component .contract-management .form span, .contract-input-component .contract-new-apply-component .form span, .contract-management .contract-input-component .form span, .contract-management .contract-management .form span, .contract-management .contract-new-apply-component .form span, .contract-new-apply-component .contract-input-component .form span, .contract-new-apply-component .contract-management .form span, .contract-new-apply-component .contract-new-apply-component .form span {
font-weight: 900;
}
.contract-input-component .contract-input-component .form span.successtext, .contract-input-component .contract-management .form span.successtext, .contract-input-component .contract-new-apply-component .form span.successtext, .contract-management .contract-input-component .form span.successtext, .contract-management .contract-management .form span.successtext, .contract-management .contract-new-apply-component .form span.successtext, .contract-new-apply-component .contract-input-component .form span.successtext, .contract-new-apply-component .contract-management .form span.successtext, .contract-new-apply-component .contract-new-apply-component .form span.successtext {
color: #0a0;
}
.contract-input-component .contract-input-component .form span.failtext, .contract-input-component .contract-management .form span.failtext, .contract-input-component .contract-new-apply-component .form span.failtext, .contract-management .contract-input-component .form span.failtext, .contract-management .contract-management .form span.failtext, .contract-management .contract-new-apply-component .form span.failtext, .contract-new-apply-component .contract-input-component .form span.failtext, .contract-new-apply-component .contract-management .form span.failtext, .contract-new-apply-component .contract-new-apply-component .form span.failtext {
color: #a00;
}
.contract-input-component .contract-input-component .form span.readtext, .contract-input-component .contract-management .form span.readtext, .contract-input-component .contract-new-apply-component .form span.readtext, .contract-management .contract-input-component .form span.readtext, .contract-management .contract-management .form span.readtext, .contract-management .contract-new-apply-component .form span.readtext, .contract-new-apply-component .contract-input-component .form span.readtext, .contract-new-apply-component .contract-management .form span.readtext, .contract-new-apply-component .contract-new-apply-component .form span.readtext {
color: #aa0;
}
.contract-input-component .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-input-component .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-input-component .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.contract-input-component .contract-input-component .form input[type=number], .contract-input-component .contract-management .form input[type=number], .contract-input-component .contract-new-apply-component .form input[type=number], .contract-management .contract-input-component .form input[type=number], .contract-management .contract-management .form input[type=number], .contract-management .contract-new-apply-component .form input[type=number], .contract-new-apply-component .contract-input-component .form input[type=number], .contract-new-apply-component .contract-management .form input[type=number], .contract-new-apply-component .contract-new-apply-component .form input[type=number] {
-moz-appearance: textfield;
}
.contract-input-component .contract-input-component .error, .contract-input-component .contract-management .error, .contract-input-component .contract-new-apply-component .error, .contract-management .contract-input-component .error, .contract-management .contract-management .error, .contract-management .contract-new-apply-component .error, .contract-new-apply-component .contract-input-component .error, .contract-new-apply-component .contract-management .error, .contract-new-apply-component .contract-new-apply-component .error {
display: flex;
flex-direction: column;
margin: 15px;
}
.contract-input-component .error .errortext, .contract-management .error .errortext {
.contract-input-component .contract-input-component .error .errortext, .contract-input-component .contract-management .error .errortext, .contract-input-component .contract-new-apply-component .error .errortext, .contract-management .contract-input-component .error .errortext, .contract-management .contract-management .error .errortext, .contract-management .contract-new-apply-component .error .errortext, .contract-new-apply-component .contract-input-component .error .errortext, .contract-new-apply-component .contract-management .error .errortext, .contract-new-apply-component .contract-new-apply-component .error .errortext {
font-size: 16px;
font-weight: 500;
color: #a00;
}
.contract-input-component .input-group-btn, .contract-management .input-group-btn {
.contract-input-component .contract-input-component .input-group-btn, .contract-input-component .contract-management .input-group-btn, .contract-input-component .contract-new-apply-component .input-group-btn, .contract-management .contract-input-component .input-group-btn, .contract-management .contract-management .input-group-btn, .contract-management .contract-new-apply-component .input-group-btn, .contract-new-apply-component .contract-input-component .input-group-btn, .contract-new-apply-component .contract-management .input-group-btn, .contract-new-apply-component .contract-new-apply-component .input-group-btn {
font-size: 16px;
}
@media screen and (max-width: 600px) {
.contract-input-component table, .contract-management table {
.contract-input-component .contract-input-component table, .contract-input-component .contract-management table, .contract-input-component .contract-new-apply-component table, .contract-management .contract-input-component table, .contract-management .contract-management table, .contract-management .contract-new-apply-component table, .contract-new-apply-component .contract-input-component table, .contract-new-apply-component .contract-management table, .contract-new-apply-component .contract-new-apply-component table {
border: 0;
}
.contract-input-component table thead, .contract-management table thead {
.contract-input-component .contract-input-component table thead, .contract-input-component .contract-management table thead, .contract-input-component .contract-new-apply-component table thead, .contract-management .contract-input-component table thead, .contract-management .contract-management table thead, .contract-management .contract-new-apply-component table thead, .contract-new-apply-component .contract-input-component table thead, .contract-new-apply-component .contract-management table thead, .contract-new-apply-component .contract-new-apply-component table thead {
display: none;
}
.contract-input-component table tr, .contract-management table tr {
.contract-input-component .contract-input-component table tr, .contract-input-component .contract-management table tr, .contract-input-component .contract-new-apply-component table tr, .contract-management .contract-input-component table tr, .contract-management .contract-management table tr, .contract-management .contract-new-apply-component table tr, .contract-new-apply-component .contract-input-component table tr, .contract-new-apply-component .contract-management table tr, .contract-new-apply-component .contract-new-apply-component table tr {
margin-bottom: 10px;
display: block;
border-bottom: 2px solid #ddd;
}
.contract-input-component table td, .contract-management table td {
.contract-input-component .contract-input-component table td, .contract-input-component .contract-management table td, .contract-input-component .contract-new-apply-component table td, .contract-management .contract-input-component table td, .contract-management .contract-management table td, .contract-management .contract-new-apply-component table td, .contract-new-apply-component .contract-input-component table td, .contract-new-apply-component .contract-management table td, .contract-new-apply-component .contract-new-apply-component table td {
display: block;
text-align: left;
font-size: 14px;
border-bottom: 1px dotted #ccc;
}
.contract-input-component table td:last-child, .contract-management table td:last-child {
.contract-input-component .contract-input-component table td:last-child, .contract-input-component .contract-management table td:last-child, .contract-input-component .contract-new-apply-component table td:last-child, .contract-management .contract-input-component table td:last-child, .contract-management .contract-management table td:last-child, .contract-management .contract-new-apply-component table td:last-child, .contract-new-apply-component .contract-input-component table td:last-child, .contract-new-apply-component .contract-management table td:last-child, .contract-new-apply-component .contract-new-apply-component table td:last-child {
border-bottom: 0;
}
.contract-input-component table td:before, .contract-management table td:before {
.contract-input-component .contract-input-component table td:before, .contract-input-component .contract-management table td:before, .contract-input-component .contract-new-apply-component table td:before, .contract-management .contract-input-component table td:before, .contract-management .contract-management table td:before, .contract-management .contract-new-apply-component table td:before, .contract-new-apply-component .contract-input-component table td:before, .contract-new-apply-component .contract-management table td:before, .contract-new-apply-component .contract-new-apply-component table td:before {
content: attr(data-label);
float: left;
text-transform: uppercase;
font-weight: bold;
}
}
.contract-input-component .images, .contract-management .images {
.contract-input-component .contract-input-component .images, .contract-input-component .contract-management .images, .contract-input-component .contract-new-apply-component .images, .contract-management .contract-input-component .images, .contract-management .contract-management .images, .contract-management .contract-new-apply-component .images, .contract-new-apply-component .contract-input-component .images, .contract-new-apply-component .contract-management .images, .contract-new-apply-component .contract-new-apply-component .images {
display: flex;
flex-wrap: wrap;
padding: 20px;
}
.contract-input-component .images > .image, .contract-management .images > .image {
.contract-input-component .contract-input-component .images > .image, .contract-input-component .contract-management .images > .image, .contract-input-component .contract-new-apply-component .images > .image, .contract-management .contract-input-component .images > .image, .contract-management .contract-management .images > .image, .contract-management .contract-new-apply-component .images > .image, .contract-new-apply-component .contract-input-component .images > .image, .contract-new-apply-component .contract-management .images > .image, .contract-new-apply-component .contract-new-apply-component .images > .image {
position: relative;
margin: 10px;
}
.contract-input-component .images > .image:hover > i, .contract-management .images > .image:hover > i {
.contract-input-component .contract-input-component .images > .image:hover > i, .contract-input-component .contract-management .images > .image:hover > i, .contract-input-component .contract-new-apply-component .images > .image:hover > i, .contract-management .contract-input-component .images > .image:hover > i, .contract-management .contract-management .images > .image:hover > i, .contract-management .contract-new-apply-component .images > .image:hover > i, .contract-new-apply-component .contract-input-component .images > .image:hover > i, .contract-new-apply-component .contract-management .images > .image:hover > i, .contract-new-apply-component .contract-new-apply-component .images > .image:hover > i {
opacity: 1;
}
.contract-input-component .images > .image > i, .contract-management .images > .image > i {
.contract-input-component .contract-input-component .images > .image > i, .contract-input-component .contract-management .images > .image > i, .contract-input-component .contract-new-apply-component .images > .image > i, .contract-management .contract-input-component .images > .image > i, .contract-management .contract-management .images > .image > i, .contract-management .contract-new-apply-component .images > .image > i, .contract-new-apply-component .contract-input-component .images > .image > i, .contract-new-apply-component .contract-management .images > .image > i, .contract-new-apply-component .contract-new-apply-component .images > .image > i {
position: absolute;
top: -12px;
right: -12px;
@ -631,37 +663,29 @@ main table td, main table th {
opacity: 0;
transition: 0.3s;
}
table {
.contract-input-component table, .contract-management table, .contract-new-apply-component table {
table-layout: fixed;
width: 100%;
}
td {
.contract-input-component td, .contract-management td, .contract-new-apply-component td {
word-wrap: break-word;
}
img {
.contract-input-component img, .contract-management img, .contract-new-apply-component img {
width: 125px;
}
.width_style_1 {
.contract-input-component .width_style_1, .contract-management .width_style_1, .contract-new-apply-component .width_style_1 {
width: 125px;
}
table {
.contract-input-component table, .contract-management table, .contract-new-apply-component table {
width: 100%;
}
#table_index_filter {
.contract-input-component #table_index_filter, .contract-management #table_index_filter, .contract-new-apply-component #table_index_filter {
float: right;
}
#table_index_paginate {
.contract-input-component #table_index_paginate, .contract-management #table_index_paginate, .contract-new-apply-component #table_index_paginate {
float: right;
}
label {
.contract-input-component label, .contract-management label, .contract-new-apply-component label {
display: inline-flex;
margin-bottom: 0.5rem;
margin-top: 0.5rem;

2
wms/contract/styles/style.css.map

File diff suppressed because one or more lines are too long

29
wms/contract/styles/style.scss

@ -562,7 +562,8 @@ main{
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.contract-input-component, .contract-management{
.contract-input-component, .contract-management, .contract-new-apply-component{
.contract-input-component, .contract-management, .contract-new-apply-component{
.form{
margin:0 auto;
.dropdown{
@ -579,6 +580,10 @@ main{
font-size: 15px;
}
table{
.fixed{
padding: 8px 0;
cursor: not-allowed;
}
.alerttext{
font-size: 13px;
color:#a00;
@ -592,6 +597,26 @@ main{
padding: 12px 20px;
margin: 8px 0;
}
span{
font-weight: 900;
&.successtext{
color:#0a0;
}
&.failtext{
color:#a00;
}
&.readtext{
color:#aa0;
}
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type=number] {
-moz-appearance: textfield;
}
}
.error{
display: flex;
@ -693,5 +718,5 @@ label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
}

2
wms/fun_global.php

@ -146,7 +146,7 @@ function check_user_permission($user_id, $token) {
global $link;
// 不檢查清單
$ignore_url_arr = ['/wms/index.php', '/wms/notice-index.php', '/wms/notice-edit.php', '/wms/change-password.php', '/wms/wipwhole-change-contractdate.php', '/wms/wipwhole-change-planning-customer-name.php','/wms/test.php'];
$ignore_url_arr = ['/wms/index.php', '/wms/notice-index.php', '/wms/notice-edit.php', '/wms/change-password.php', '/wms/wipwhole-change-contractdate.php', '/wms/wipwhole-change-planning-customer-name.php','/wms/test.php', '/wms/mkt/pricereview_mi-api.php'];
if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return;
$do = "";

BIN
wms/mkt/assets/img/1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
wms/mkt/assets/img/2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
wms/mkt/assets/img/3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
wms/mkt/assets/img/4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
wms/mkt/assets/img/5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
wms/mkt/assets/img/S__14541066.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
wms/mkt/assets/img/curry.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

193
wms/mkt/assets/js/alpine.js

@ -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()
}
}
}

49
wms/mkt/conn.php

@ -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; //關閉資料庫的連線

122
wms/mkt/css/style.css

@ -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 */

1
wms/mkt/css/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"}

115
wms/mkt/css/style.scss

@ -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;}
}
}
}

189
wms/mkt/price_option-index.php

@ -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)">&laquo;</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)">&raquo;</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";
?>

87
wms/mkt/price_option-index2.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";
?>

106
wms/mkt/price_option-select.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)">&laquo;</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)">&raquo;</a>
</template>
</div>
</div>
</div>
</div>
</div>
<script src="./assets/js/alpine.js"></script>
<script>
const options = [...<?php echo json_encode($options); ?>];
</script>

8
wms/mkt/pricereview-check.php

@ -310,6 +310,7 @@ $(function () {
$("#checker").prop("disabled", false);
$("#status_n").prop("disabled", false);
$("#status_y").prop("disabled", false);
$("#status_yy").prop("disabled", false);
$("#id").prop("disabled", false);
$("#st").prop("disabled", false);
$('#btn_close').prop("disabled", false);
@ -974,8 +975,11 @@ hr {
</table>
<label>審核人員</label>
<input type="text" name="checker" id="checker" value="<?=$user_id;?>" readonly>
<button type="submit" name="status" id="status_n" value="N" onclick="if (!confirm('確定不同意?')) return false;"><?php echo ($sign_total==$st) ? "結案(不同意)" : "不同意"; ?></button>
<button type="submit" name="status" id="status_y" value="Y" onclick="if (!confirm('確定同意?')) return false;"><?php echo ($sign_total==$st) ? "結案(同意)" : "同意"; ?></button>
<button type="submit" name="status" id="status_n" value="N" onclick="if (!confirm('確定不同意?')) return false;"><?php echo ($sign_total==$st) ? "結案(不同意)" : "不同意(退回)"; ?></button>
<button type="submit" name="status" id="status_y" value="Y" onclick="if (!confirm('確定同意?')) return false;">同意(上呈)</button>
<?php if($st == 3): ?>
<button type="submit" name="status" id="status_yy" value="YY" onclick="if (!confirm('確定同意?')) return false;">同意(結案)</button>
<?php endif; ?>
<?php } else { ?>
<button type="button" id="btn_close" class="btn btn-default">回上頁</button>
<?php } ?>

14
wms/mkt/pricereview-index.php

@ -14,7 +14,7 @@ $sql_cmd = sql_myself($user_id);
if ($user_id == "M0024" || $user_id == "M0107") {
$sql_cmd = "where create_at >= '2023-01-01 00:00:00'";
}
if ($user_id == "M0060") {
if ($user_id == "M0060" ) {
$sql_cmd = "where creater in (select accountid from account where (department_id like '3%' or department_id like '5%'))";
}
if (empty($sql_cmd)) $sql = "select * from pricereview_main where status like 'Y%' and ekind = '新梯' order by id";
@ -357,7 +357,7 @@ if ($user_id=="M0023") {
$str = $uperson = $ustatus = $udtte = "";
if (!empty($sign3)) list($uperson, $ustatus, $udtte) = explode(",", $sign3);
if ($ustatus) {
if ($ustatus == "Y") $str = "<span class=\"glyphicon glyphicon-ok\" title=\"同意\"></span>";
if ($ustatus == "Y" || $ustatus == "YY") $str = "<span class=\"glyphicon glyphicon-ok\" title=\"同意\"></span>";
elseif ($ustatus == "N") $str = "<span class=\"glyphicon glyphicon-ban-circle\" title=\"不同意\"></span>";
$str .= "<br>".$accountname_arr[$uperson]."<br>".$udtte;
} else {
@ -425,9 +425,13 @@ if ($user_id=="M0023") {
</p>
</td>-->
<td>
<?php if($data['status'] === 'YY' || $user_id=="M0107" || $user_id == "M0174"){ ?>
<a href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para?>">合約書申請</a>
<?php }else{ echo "-"; } ?>
<?php if($data['status'] !== 'YY'): ?>
<a href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">合約書申請</a>
<?php endif; ?>
<!-- 工號M0107、M0174有所有權限 -->
<?php if($data['status'] === 'YY' || $user_id == "M0174"): ?>
<a href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para?>">合約書下載</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>

10
wms/mkt/pricereview-record-check.php

@ -59,7 +59,11 @@ if (isset($_POST['status'])) {
$sql2 .= "status = 'YY'";
}
$end_flow = 1;
} else {
}elseif($status == 'YY'){
$sql2 .= "status = 'YY'";
$end_flow = 1;
}
else {
$do_assign = 1;
}
if ($item_no_all) {
@ -82,7 +86,7 @@ if (isset($_POST['status'])) {
mysqli_query($link, $db_query);
}
}
echo $status;
if ($sql) {
$db_query = "update pricereview_sign set $sql where mid = '$id'";
mysqli_query($link, $db_query);
@ -128,6 +132,6 @@ if (isset($_POST['status'])) {
}
mysqli_close($link);
echo "<script type ='text/JavaScript'>";
echo "location.href='pricereview-index.php?function_name=pricereview&".$token_link."';";
echo "location.href='pricereview-check.php?id=".$id."&function_name=pricereview&".$token_link."';";
echo "</script>";
}

17
wms/mkt/pricereview_renovate-check.php

@ -1018,7 +1018,22 @@ hr {
<td><?php echo $dtte2; ?></td>
</tr>
<tr>
<td>業務部協理</td>
<td>
<?php
require_once('./conn.php');
if(!empty($accountname_arr[$person3])){
$sql_str = "SELECT account.accountid, account.department_id, account.role_id,department.* FROM account JOIN department ON account.department_id = department.department_id AND account.role_id = department.role_id WHERE account.name = :name";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':name',$accountname_arr[$person3]);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_ASSOC);
echo $user['role'];
}else{
echo "業務部協理";
}
?>
</td>
<td><?php echo (empty($accountname_arr[$person3])) ? "---" : $accountname_arr[$person3]; ?></td>
<td><?php echo $checker_3_result; ?></td>
<td><?php echo nl2br($sign3_note); ?></td>

BIN
wms/mkt/specsurvey-edit.zip

Binary file not shown.

2
wms/mkt/specsurvey-index.php

@ -5,7 +5,7 @@ include "../header.php";
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "s.creater");
if ($user_id == "M0060") $sql_cmd = "";
if ($user_id == "M0060" || $user_id == "M0023") $sql_cmd = "";
$sql2 = (empty($sql_cmd)) ? "where" : "and";
$sql2 .= " s.mid = p.id and p.ekind = '新梯' ";
$sql2 .= "and (s.mid, s.pr_item_id, s.sub_item_id, s.version) in (select s.mid, s.pr_item_id, s.sub_item_id, max(s.version) from specsurvey_main s, pricereview_main p where s.mid = p.id group by s.mid, s.pr_item_id, s.sub_item_id)";

2
wms/mkt/specsurvey_renovate-index.php

@ -5,7 +5,7 @@ include "../header.php";
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "s.creater");
if ($user_id == "M0060") $sql_cmd = "";
if ($user_id == "M0060" || $user_id == "M0023") $sql_cmd = "";
$sql2 = (empty($sql_cmd)) ? "where" : "and";
$sql2 .= " s.mid = p.id and p.ekind = '汰改' ";
$sql2 .= "and (s.mid, s.pr_item_id, s.sub_item_id, s.version) in (select s.mid, s.pr_item_id, s.sub_item_id, max(s.version) from specsurvey_main s, pricereview_main p where s.mid = p.id group by s.mid, s.pr_item_id, s.sub_item_id)";

12
wms/rib-feeapply-test.php

@ -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;

109
wms/rib-test.php

@ -1,86 +1,75 @@
<?php
$today = strtotime("now");
echo $today;
$delivery_date = strtotime("2023-11-03");
echo "<br>".$delivery_date;
$final_date = strtotime("2023-05-03 +6 months");
echo "<br>".$final_date;
echo "<br>-------<br>".gettype($final_date);
exit();
include "T8_Authorization.php";
echo "應付確認單";
echo "發貨單";
?>
<script>
console.log(<?=$now ?>);
get_Auth();
window.addEventListener('message', function(event) {
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) {
var validation = event.data;
console.log("event");
console.log("成功要到認證");
console.log(validation);
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880/twWebAPI/V1/APCHECKBILL/PostERPData';
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALDISPATCHLIST/PostERPData';
headerParam = {
CHI_Authorization: `${validation}`,
};
var body = [{
"name": "MasterTable",
"name": "salDispatchListMaster",
"rows": [{
"BillNo": "Z004",
"BillDate": 20231030,
"BillNo": "TEST03",
"BillDate": 20231108,
"SupplyFOrgId": "1000",
"FOrgId": "1000",
"TypeId": "SP",
"OrgId": "1000",
"TypeId": "OPV",
"IsPriceWithTax":1,
"IsCounteract":1,
"BizPartnerId": "03051501",
"CurrId": "RMB",
"CurrOAmount":1,
"CurrLAmount":4,
"TaxId": "ST101",
"PersonId": "M0012",
"DeptId": "220",
"CompId": "1001",
"CreditAgeDate": 20230930,
"RecBizPartnerId": "03051501"
"ModeId": "T",
"BizPartnerId": "M230575",
"PersonId": "M0122",
"CurrId": "TWD",
"CurrOAmount": 1,
"CurrLAmount": 1,
"TrusteeWarehouseId": "",
"SendGoodsDate": 20231108,
"DueToId": "M230575",
"TaxId": "ST005",
"CreditorOrgId": "1000",
"CreditorCompId": "1001",
"CreditorCurrOAmount": 1,
"CreditorCurrLAmount": 1,
"TradeConditionId": "",
"TrusteeWarehouseBPType": 0,
"CurrentState":2
}]
},
{
"name": "DetailTable",
"name": "salDispatchListDetail",
"rows": [{
"BillNo": "Z004",
"RowCode": 1,
"RowNo": 1,
"ItemType": 0,
"TaxId": "ST101",
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity":10,
"SPrice":100,
},
// {
// "BillNo": "Z002",
// "RowCode": 2,
// "RowNo": 2,
// "ItemType": 0,
// "MaterialId": "MX00000001",
// "UnitId": "PCS",
// "MaterialSpec": "",
// "SQuantity": 15,
// // "SPrice": 210,
// "OAmountWithTax": 3150,
// // "OTax": 100.84,
// // "OAmountWithTax": 2117.7,
// "TaxId": "ST005"
// }
]
"SupplyCompId": "1001",
"SupplyOrgId": "1000",
"DispatchCompId": "1001",
"DispatchOrgId": "1000",
"SQuantity": "1",
"TaxId": "ST005",
"BillNo": "TEST03",
"RowCode": 1,
"ItemType": 0,
"MaterialId": "3JX05302",
"SUnitId": "SET",
"SPrice": "150000",
"WarehouseId":"100"
}]
}
// ,
// {
// "name":"apCheckBillInvInfo",
// "rows":[{
// "BillNo":"Z003",
// "RowCode":1,
// "RowNo":1,
// "InvoiceNo":"ap12345678",
// "InvoiceId":25,
// "TaxId":"ST005",
// "LAmountWithTax":105
// }]
// }
];
var json = JSON.stringify(body);
obj = {

2
wms/rib-test02.php

@ -11,7 +11,7 @@ $sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
var api_key = '964C834F7BF2BB70';
var validation = "";
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
var apiurl = 'http://60.244.87.101:780//twWebAPI/GetAuth';
headerParam = {
UserId: 'M0000',
Pwd: 'M012290493119',

2
wms/rib01-check.php

@ -335,7 +335,7 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
?>
<div style="width: 80%;">
<?php
if (($state == 0)||($user_id='M0056') || $user_id=='M0209') :
if (($state == 0)||($user_id=='M0056') || $user_id=='M0209') :
?>
<a href="rib02-create.php?id=<?php echo $data['rib_id'] ?>&RowCode=<?= $RowCode ?>&CurrId=<?= $CurrId ?>&<?= $token_link ?>" class="btn btn-info btn-lg pull-right" style="margin: 1 rem;">
<span class=" glyphicon glyphicon-plus"></span>

2
wms/rib02-business-create.php

@ -400,7 +400,7 @@ $conn = null;
$("#FeeDate").val('');
} else {
now.setMonth(now.getMonth() - 2);
now.setDate(01);
now.setDate(1);
now.setDate(now.getDate() - 1)
if (feedate < now) {
alert("超過兩個月的費用無法進行報銷");

Loading…
Cancel
Save