Cheng 1 year ago
parent
commit
aa93211004
  1. 1
      .gitignore
  2. 3
      wms/T8_Authorization_from_bpm.php
  3. 523
      wms/account-receivable-maintainance-index.php
  4. 329
      wms/cont/css/pricereview.css
  5. 1
      wms/cont/css/pricereview.css.map
  6. 348
      wms/cont/css/pricereview.scss
  7. 5
      wms/cont/js/alpinejs/cdn.min.js
  8. 118
      wms/cont/js/pricereviewAlpine.js
  9. 4
      wms/cont/pricereviewCheck.php
  10. 519
      wms/cont/pricereviewCreate.php
  11. 2
      wms/contract/api/postContractData.php
  12. 39
      wms/contract/api/postContractNewApplyData.php
  13. 58
      wms/contract/api/postFlow.php
  14. 67
      wms/contract/contract-new-apply.php
  15. 13
      wms/contract/js/alpine.js
  16. 2
      wms/crm/crmm02-index.php
  17. 2
      wms/crm/crmm06_submit.php
  18. 7
      wms/fun_global.php
  19. 3
      wms/login.php
  20. 5
      wms/mkt/api/postNewElevatorPricereview.php
  21. 20
      wms/mkt/api/postPricereviewSign.php
  22. 9
      wms/mkt/pricereview-index.php
  23. 3
      wms/mkt/pricereviewCreate.php

1
.gitignore

@ -29,3 +29,4 @@ wms/gary2.php
wms/chinese.php
phpinfo.php
wms/account_receivable_sql_file.sql
wms/account_receivable_maintainance_sql.sql

3
wms/T8_Authorization_from_bpm.php

@ -1,6 +1,9 @@
<?php
function get_Auth($user_id = "M0000", $user_password = "M012290493119")
// echo $validation = get_Auth($user_id, $user_password);
// function get_Auth($user_id = "ADMIN", $user_password = "chi")
function get_Auth($user_id = "M0000", $user_password = "M012290493119")
{
$currentTime = time();

523
wms/account-receivable-maintainance-index.php

@ -0,0 +1,523 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start'];
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end'];
$start_SignDate = empty($_POST['date_Signstart']) ? null : $_POST['date_Signstart'];
$end_SignDate = empty($_POST['date_Signend']) ? null : $_POST['date_Signend'];
$sql = "
SELECT
siam.PersonId,
cp.PersonName,
cd.DeptId,
cd.DeptName,
cd.LeaderId,
lcp.PersonName AS LeaderName,
siam.BizPartnerId,
cbp.BizPartnerName,
siamd.RowCode,
siam.BillNo,
siamd.ProjectId,
siamd.CU_EstPayDate,
siamd.UnTransCheckBLAmtWTax ,
siamd.HadTransCheckBLAmtWTax,
siamd.OAmountWithTax,
siamd.CU_MaterialId,
acb_tmp.BillNo2,
acb_tmp.RowCode2,
acb_tmp.checkOAmount,
asim.BillNo AS BillNo3,
asim.InvoiceName,
asim.OAmountWithTax AS InvoiceOAmount,
asi.InvoiceNo,
asi.InvoiceTime,
writeoff.BillDate AS WriteOffDate,
SUM(arwobd.CurrStandOffOAmount) AS TotalCurrStandOffOAmount
FROM salIncomeApplyMaster AS siam -- 收入申請單
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細
ON siam.BillNo = siamd.BillNo
LEFT JOIN comGroupPerson AS cp -- 員工主檔
ON siam.PersonId = cp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON siam.DeptId = cd.DeptId
LEFT JOIN comGroupPerson AS lcp
ON lcp.PersonId= cd.LeaderId
LEFT JOIN (
SELECT
acbd.FromRowCode,
acb.FromBillNo,
acbd.BillNo AS BillNo2,
acbd.RowCode AS RowCode2,
acbd.LAmountWithTax AS checkOAmount
FROM arCheckBill AS acb -- 應收確認單
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細
ON acb.BillNo = acbd.BillNo
WHERE 1 = 1
AND acb.TypeId = 'RVS') AS acb_tmp
ON siamd.RowCode = acb_tmp.FromRowCode
AND siamd.BillNo = acb_tmp.FromBillNo
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細
ON asim.FromBillNo = acb_tmp.BillNo2
AND asim.RowCode = acb_tmp.RowCode2
LEFT JOIN arSellInvoice AS asi
ON asim.BillNo = asi.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON siam.BizPartnerId = cbp.BizPartnerId
LEFT JOIN
arWriteOffBillDetail AS arwobd
ON acb_tmp.BillNo2 = arwobd.FromBillNo
LEFT JOIN
arWriteOffBill AS writeoff ON arwobd.BillNo = writeoff.BillNo
WHERE 1 = 1
";
$follower = find_follow($user_id);
if ((in_array($user_id, array('M0008', 'M0012'))) || (in_array(accountidToDepartId($user_id), array('220', '210', '501')))) {
} else {
$sql .= " AND (siam.PersonId = '$user_id'";
if (count($follower) > 0) {
$column_str = "('$user_id'" . ",'";
$column_str .= implode("','", $follower);
$column_str .= "')";
$sql .= " OR siam.PersonId IN $column_str OR cd.LeaderId = '$user_id')";
} else {
$sql .= " OR cd.LeaderId = '$user_id')";
};
}
if (!is_null($start_date)) {
$start_date = (int)date('Ymd', strtotime($start_date));
$sql .= " AND siam.CU_ContractStart >= $start_date ";
}
if (!is_null($end_date)) {
$end_date = (int)date('Ymd', strtotime($end_date));
$sql .= " AND siam.CU_ContractStart <= $end_date ";
}
if (!is_null($start_SignDate)) {
$start_SignDate = (int)date('Ymd', strtotime($start_SignDate));
$sql .= " AND siam.BillDate >= $start_SignDate ";
}
if (!is_null($end_SignDate)) {
$end_SignDate = (int)date('Ymd', strtotime($end_SignDate));
$sql .= " AND siam.BillDate <= $end_SignDate ";
}
$sql .= " GROUP BY
siam.PersonId,
cp.PersonName,
cd.DeptId,
cd.DeptName,
cd.LeaderId,
lcp.PersonName,
siam.BizPartnerId,
cbp.BizPartnerName,
siamd.RowCode,
siam.BillNo,
siamd.ProjectId,
siamd.CU_EstPayDate,
siamd.UnTransCheckBLAmtWTax,
siamd.HadTransCheckBLAmtWTax,
siamd.OAmountWithTax,
siamd.CU_MaterialId,
acb_tmp.BillNo2,
acb_tmp.RowCode2,
acb_tmp.checkOAmount,
asim.BillNo,
asim.InvoiceName,
asim.OAmountWithTax,
asi.InvoiceNo,
asi.InvoiceTime,
writeoff.BillDate
ORDER BY
siam.PersonId ASC,
siam.BillNo ASC,
siamd.RowCode ASC";
$query_T8 = $conn->query($sql);
$rows = $query_T8->fetchAll(PDO::FETCH_ASSOC);
$today = strtotime(date('Ymt'));
$table = "";
for ($i = 0; $i < count($rows); $i++) {
$row = $rows[$i];
$tmpname = $row['ProjectId'] . $row['RowCode'];
$data[$tmpname] = $row;
$data[$tmpname]['CU_EstPayDate'] = date('Y-m-d', strtotime($row['CU_EstPayDate']));
$data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V';
$datahavetopay = $row['CU_EstPayDate'] > $today ? 0 : 1;
$data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate']));
$invoicedate = is_null($row['InvoiceTime']) ? null : date('Y-m-d', strtotime($row['InvoiceTime']));
$tableinvoice_state = is_null($invoicedate) ? 0 : 1;
$contract_no = $row['ProjectId'];
$facility_no = $row['CU_MaterialId'];
$RowCode = $row['RowCode'];
$BillNo = $row['BillNo'];
$receivable_date = date('Y-m-d', strtotime($row['CU_EstPayDate']));
$budget = $row['OAmountWithTax'];
$invoiceNo = $row['InvoiceNo'];
$invoice_budget = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount'];
$table_writeoff_date = is_null($row['WriteOffDate']) ? null : date('Y-m-d', strtotime($row['WriteOffDate']));
$table_writeoff_amount = is_null($row['TotalCurrStandOffOAmount']) ? 0 : $row['TotalCurrStandOffOAmount'];
$table1 = "INSERT INTO account_receivable_maintainance(
`contract_no`,
`facility_no`,
`RowCode`,
`BillNo`,
`receivable_date`,
`budget`,
`receivable`,
`invoice_state`,
`invoice_budget`,
`received_budget`
";
$table2 = ") VALUES(
'$contract_no',
'$facility_no',
'$RowCode',
'$BillNo',
'$receivable_date',
$budget,
$datahavetopay,
$tableinvoice_state,
$invoice_budget,
$table_writeoff_amount
";
$table1 .= is_null($invoicedate) ? "" : ",`invoice_date`";
$table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'";
$table1 .= is_null($table_writeoff_date) ? "" : ",`received_date`";
$table2 .= is_null($table_writeoff_date) ? "" : ",'$table_writeoff_date'";
$table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`";
$table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'";
$table .= $table1 . $table2 . "); \n";
}
// $file_path = 'account_receivable_maintainance_sql.sql';
// if (file_put_contents($file_path, $table) !== false) {
// echo "SQL文件已成功生成:{$file_path}";
// } else {
// echo "生成SQL文件时出现错误。";
// }
// foreach ($data as $key => $row) {
// echo $key . "<br>";
// print_r($row);
// echo "<br>------------<br>";
// }
// exit();
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
.hiddenTable {
display: none;
}
.hidden {
display: none;
}
</style>
<div style="width: 98%;margin: 1%;">
<div class="btn-group btn-group-md " style="padding:10 px; width: 100%;">
<button type="button" style="width: 12%;" onclick="downloadData()" class="btn btn-success">下載 <span class="glyphicon glyphicon-download-alt"></span></button>
</div>
</div>
<div class="container">
<div class="text-center" style="margin-bottom: 20px;">
<h3><strong>應收帳款(保養)</strong></h3>
</div>
<hr>
<form class="form-horizontal" id='myForm' method='post' action='account-receivable-new-index.php?<?= $token_link ?>'>
<table class="table table-striped table-bordered" style='width:98%;text-align:center;margin:0 auto'>
<tbody>
<tr>
<th class="text-center" style="vertical-align: middle;">簽約日期</th>
<td colspan="2">
<input type="date" class='form-control' id='date_Signstart' name='date_Signstart' style='width:40%;display:inline;'>
<input type="date" class='form-control' id='date_Signend' name='date_Signend' style='width:40%;display:inline;'>
</td>
<td rowspan="2">
<button type="submit" class="btn btn-primary btn-sm">搜尋</button>
</td>
</tr>
<tr>
<th class="text-center" style="vertical-align: middle;">合約日期</th>
<td colspan="2">
<input type="date" class='form-control' id='date_start' name='date_start' style='width:40%;display:inline;'>
<input type="date" class='form-control' id='date_end' name='date_end' style='width:40%;display:inline;'>
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> -->
</td>
</tr>
<tr>
<th class="text-center" style="vertical-align: middle;">催收次數</th>
<td colspan="3">
<input type="text" class='form-control' id='search_collectstart' name='collect_time_start' style='width:30%;display:inline;' oninput="searchFront('collectstart')">
≤ 催收次數 ≤
<input type="text" class='form-control' id='search_collectend' name='collect_time_end' style='width:30%;display:inline;' oninput="searchFront('collectend')">
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> -->
</td>
</tr>
<tr>
<th class="text-center" style="vertical-align: middle;">催收金額</th>
<td colspan="3">
<input type="text" class='form-control' id='search_CBudgetstart' name='collect_budget_start' style='width:30%;display:inline;' onblur="searchFront('CBudgetstart')">
≤ 催收金額 ≤
<input type="text" class='form-control' id='search_CBudgetend' name='collect_budget_end' style='width:30%;display:inline;' onblur="searchFront('CBudgetend')">
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> -->
</td>
</tr>
</tbody>
</table>
</form>
<hr>
<div class="form-group">
<div class="col-md-4">
<label for="search_contract">查詢合約號</label>
<input type="text" id="search_contract" name="search_contract" class="form-control" placeholder="請輸入合約號" onblur="searchFront('contract')">
</div>
<div class="col-md-4">
<label for="search_dept">查詢部門</label>
<input type="text" id="search_dept" name="search_dept" class="form-control" placeholder="請輸入部門" onblur="searchFront('dept')">
</div>
<div class="col-md-4">
<label for="search_manager">查詢主管</label>
<input type="text" id="search_manager" name="search_manager" class="form-control" placeholder="請輸入主管工號/姓名" onblur="searchFront('manager')">
</div>
</div>
<div class="form-group">
<div class="col-md-4">
<label for="search_personId">查詢契約員</label>
<input type="text" id="search_personId" name="search_personId" class="form-control" placeholder="請輸入契約員工號/姓名" onblur="searchFront('personId')">
</div>
<div class="col-md-4">
<label for="search_customerid">查詢客戶名稱</label>
<input type="text" id="search_customerid" name="search_customerid" class="form-control" placeholder="請輸入客戶名稱" onblur="searchFront('customerid')">
</div>
<div class="col-md-4">
<label for="search_facility">查詢作番號</label>
<input type="text" id="search_facility" name="search_facility" class="form-control" placeholder="請輸入作番號" onblur="searchFront('facility')">
</div>
</div>
</div>
<?php
include "./footer.php";
?>
<div style="width: 20%;float:right;margin-right:5%; ">
<label>查詢條件</label>
<input type="text" id="search" name="search" class="form-control" placeholder="請輸入合約號/作番號/客戶名稱" oninput="searchData()">
</div>
<div style="width: 98%; margin:1%;" style="overflow-x:auto;">
<table class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;width:100px'>合約號</th>
<th style='text-align:center;vertical-align: middle;'>序號</th>
<th style='text-align:center;vertical-align: middle;width:100px'>作番號</th>
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th>
<th style='text-align:center;vertical-align: middle;'>主管</th>
<th style='text-align:center;vertical-align: middle;'>契約員</th>
<th style='text-align:center;vertical-align: middle;width:120px'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;'>應收日期</th>
<th style='text-align:center;vertical-align: middle;'>是否應收</th>
<th style='text-align:center;vertical-align: middle;'>應收金額</th>
<!--
<th style='text-align:end;vertical-align: middle;'>已開金額</th>
<th style='text-align:end;vertical-align: middle;'>未開金額</th> -->
<th style='text-align:center;vertical-align: middle;'>已收金額</th>
<th style='text-align:center;vertical-align: middle;'>催收金額</th>
<th style='text-align:center;vertical-align: middle;'>催收次數</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $key => $row) { ?>
<tr class="data-row" style="display: '';" id="<?= $key; ?>">
<td class="contract"><?= $row['ProjectId']; ?></td>
<td><?= $row['RowCode']; ?></td>
<td class="facility"><?= $row['CU_MaterialId']; ?></td>
<td class="dept"><?= $row['DeptId'] . "<br>" . $row['DeptName']; ?></td>
<td class="manager"><?= $row['LeaderId'] . "<br>" . $row['LeaderName']; ?></td>
<td class="personId"><?= $row['PersonId'] . "<br>" . $row['PersonName']; ?></td>
<td class="customerid"><?= $row['BizPartnerId'] . "<br>" . $row['BizPartnerName']; ?></td>
<td><?= $row['CU_EstPayDate']; ?></td>
<td><?= $row['havetopay']; ?></td>
<td><?= number_format(round($row['OAmountWithTax'])); ?></td>
<td><?= is_null($row['TotalCurrStandOffOAmount']) ? 0 : number_format(round($row['TotalCurrStandOffOAmount'])); ?></td>
<td class="CBudget"><?= ($row['havetopay'] == "V")? (number_format(round($row['OAmountWithTax'] - $row['TotalCurrStandOffOAmount']))) :0; ?></td>
<td class="collect"><?= (($row['havetopay'] == "V") && ($row['OAmountWithTax'] - $row['TotalCurrStandOffOAmount'] >1))? $row['collecttime']:0; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
function searchData() {
var searchTerm = document.getElementById('search').value.toLowerCase();
var rows = document.getElementsByClassName('data-row');
for (var i = 0; i < rows.length; i++) {
var rowText = rows[i].textContent.toLowerCase();
// var rowText = rows[i].id.toLowerCase();
if (rowText.includes(searchTerm)) {
console.log(rowText);
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
}
}
function downloadData() {
var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-renovate-excel.php?type=all&<?= $token_link ?>";
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var file_path = xhr.responseText;
var link = document.createElement('a');
var name = "汰改應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
link.setAttribute('href', window.location.origin + "/wms/account-receivable-renovate.xlsx");
link.setAttribute('download', name);
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
xhr.send(JSON.stringify({
Bill: <?= $total_data ?>
}));
}
function searchFront(area) {
var term = 'search_' + area;
if (area == 'collectstart') {
var searchTerm = parseInt(document.getElementById(term).value);
var searchArea = document.getElementsByClassName('collect');
var rows = document.getElementsByClassName('data-row');
var criterion = parseInt(document.getElementById('search_collectend').value);
for (var i = 0; i < rows.length; i++) {
var rowText = parseInt(searchArea[i].textContent);
if (rowText >= searchTerm) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
if (criterion !== '' && rowText > criterion) {
rows[i].style.display = 'none';
}
}
} else if (area == 'collectend') {
var searchTerm = parseInt(document.getElementById(term).value);
var searchArea = document.getElementsByClassName('collect');
var rows = document.getElementsByClassName('data-row');
var criterion = parseInt(document.getElementById('search_collectstart').value);
for (var i = 0; i < rows.length; i++) {
var rowText = parseInt(searchArea[i].textContent);
if (rowText <= searchTerm) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
if (criterion !== '' && rowText < criterion) {
rows[i].style.display = 'none';
}
}
} else if (area == 'CBudgetstart') {
var searchTerm = parseInt(document.getElementById(term).value);
var searchArea = document.getElementsByClassName('CBudget');
var rows = document.getElementsByClassName('data-row');
var criterion = parseInt(document.getElementById('search_CBudgetend').value);
for (var i = 0; i < rows.length; i++) {
var rowText = parseInt(searchArea[i].textContent.replace(/,/g, ''));
if (isNaN(searchTerm) || searchTerm == 0) {
rows[i].style.display = '';
} else if (rowText >= searchTerm) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
if (criterion !== '' && rowText > criterion) {
rows[i].style.display = 'none';
}
}
} else if (area == 'CBudgetend') {
var searchTerm = parseInt(document.getElementById(term).value);
var searchArea = document.getElementsByClassName('CBudget');
var rows = document.getElementsByClassName('data-row');
var criterion = parseInt(document.getElementById('search_CBudgetstart').value);
for (var i = 0; i < rows.length; i++) {
var rowText = parseInt(searchArea[i].textContent.replace(/,/g, ''));
if (isNaN(searchTerm) || searchTerm == 0) {
rows[i].style.display = '';
} else if (rowText <= searchTerm) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
if (!isNaN(criterion) && rowText < criterion) {
rows[i].style.display = 'none';
}
}
} else {
var searchTerm = document.getElementById(term).value.toLowerCase();
var searchArea = document.getElementsByClassName(area);
var rows = document.getElementsByClassName('data-row');
for (var i = 0; i < rows.length; i++) {
var rowText = searchArea[i].textContent.toLowerCase();
if (rowText.includes(searchTerm)) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
}
}
}
function check(searchname) {
console.log(searchname);
}
</script>

329
wms/cont/css/pricereview.css

@ -0,0 +1,329 @@
@charset "UTF-8";
#pricereviewCreate input[type=text], #pricereviewCreate input[type=number], #pricereviewCreate select {
margin: 1px;
}
#pricereviewCreate textarea {
resize: vertical;
}
#pricereviewCreate select {
-webkit-appearance: none; /* 針對 Chrome, Safari, Opera */
-moz-appearance: none; /* 針對 Firefox */
appearance: none; /* 標準語法 */
}
#pricereviewCreate > .modal {
padding: 20px;
}
#pricereviewCreate > .modal table, #pricereviewCreate > .modal th, #pricereviewCreate > .modal td {
border: 1px #ccc solid;
}
#pricereviewCreate > .modal table > thead tr th {
color: #A52A2A;
}
#pricereviewCreate > .modal table > tbody .selected {
background-color: #E7FEFB;
}
#pricereviewCreate .container table, #pricereviewCreate .container th, #pricereviewCreate .container td {
border: 1px #ccc solid;
padding: 9px;
}
#pricereviewCreate .container table.noborder, #pricereviewCreate .container table .noborder th, #pricereviewCreate .container table .noborder td, #pricereviewCreate .container th.noborder, #pricereviewCreate .container th .noborder th, #pricereviewCreate .container th .noborder td, #pricereviewCreate .container td.noborder, #pricereviewCreate .container td .noborder th, #pricereviewCreate .container td .noborder td {
border: none;
}
#pricereviewCreate .container table thead th {
background-color: #6D9EEB;
}
#pricereviewCreate .container table tbody td input {
font-size: 14px;
}
#pricereviewCreate .container table tbody th {
background-color: #CCE4F8;
font-size: 14px;
padding: 15px 2px;
min-width: 100px;
text-align: center;
}
#pricereviewCreate .container table input {
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain {
background-color: #F2F2F2;
padding: 20px;
border-radius: 6px;
margin: 30px 0;
}
#pricereviewCreate .container .pricreviewmain button {
color: #fff;
width: 55px;
height: 30px;
padding: 0;
margin-left: 6px;
margin-bottom: 2px;
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain button.addbtn {
background-color: #337AB7;
width: 30px;
}
#pricereviewCreate .container .pricreviewmain button.deleteBtn {
background-color: #D9534F;
color: #fff;
font-size: 12px;
width: 30px;
}
#pricereviewCreate .container .pricreviewmain button.selectElevator {
background-color: #D9534F;
color: #fff;
}
#pricereviewCreate .container .pricreviewmain > .divitem {
border: 1px #ccc solid;
padding: 10px;
border-radius: 4px;
}
#pricereviewCreate .container .pricreviewmain > .divitem .title {
display: flex;
align-items: center;
border-bottom: 1px #ccc solid;
padding: 10px 0;
margin-bottom: 10px;
}
#pricereviewCreate .container .pricreviewmain > .divitem .title h6 {
font-weight: 600;
}
#pricereviewCreate .container .pricreviewmain > .divitem table, #pricereviewCreate .container .pricreviewmain > .divitem th, #pricereviewCreate .container .pricreviewmain > .divitem td {
font-size: 14px;
background-color: transparent;
}
#pricereviewCreate .container .pricreviewmain > .divitem table input, #pricereviewCreate .container .pricreviewmain > .divitem table select, #pricereviewCreate .container .pricreviewmain > .divitem th input, #pricereviewCreate .container .pricreviewmain > .divitem th select, #pricereviewCreate .container .pricreviewmain > .divitem td input, #pricereviewCreate .container .pricreviewmain > .divitem td select {
font-size: 13px;
padding: 0 13px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table textarea, #pricereviewCreate .container .pricreviewmain > .divitem th textarea, #pricereviewCreate .container .pricreviewmain > .divitem td textarea {
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
#pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .deleteBtn, #pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .copyBtn {
opacity: 1;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .copyBtn {
width: 30px;
height: 30px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd {
position: relative;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd > .deleteBtn {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 2px;
opacity: 0;
transition: 0.3s;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd > .copyBtn {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 38px;
opacity: 0;
transition: 0.3s;
width: 30px;
height: 30px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table textarea {
height: auto;
min-height: 50px;
}
#pricereviewCreate .container .pricreviewmain > .filediv {
display: flex;
flex-direction: column;
margin-top: 20px;
}
#pricereviewCreate .container .pricreviewmain > .filediv label {
display: flex;
align-items: center;
margin: 10px 0;
}
#pricereviewCreate .container .pricreviewmain > .filediv label p {
width: 100px;
font-size: 15px;
font-weight: 600;
}
#pricereviewCreate .container .pricreviewmain > .filediv label input[type=file] {
width: 400px;
}
#pricereviewCreate .container .pricreviewmain > .filediv label a, #pricereviewCreate .container .pricreviewmain > .filediv label button {
width: 100px;
height: 35px;
margin: 0;
margin-right: 15px;
margin-top: 20px;
}
#pricereviewCreate .dark {
background-color: rgb(225, 225, 225) !important;
font-weight: 600;
}
.container-fluid, .container {
max-width: 1400px !important;
width: 100%;
}
.container-fluid h4, .container h4 {
font-weight: 600;
}
.container-fluid .btn-secondary, .container .btn-secondary {
background-color: #6C757D;
}
[x-cloak][data-type=window-modal],
[x-cloak][data-type=errortext] {
display: none !important;
}
.errortext {
font-size: 12px !important;
color: red !important;
font-weight: 600 !important;
}
.window-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9;
padding: 20px;
}
@keyframes fade-in {
0% {
transform: translate(-50%, -60%);
opacity: 0;
}
100% {
transform: translate(-50%, -55%);
opacity: 1;
}
}
.window-modal table, .window-modal th, .window-modal td {
border: 1px #ccc solid;
}
.window-modal table > thead tr th {
color: #A52A2A;
}
.window-modal table > tbody .selected {
background-color: #E7FEFB;
}
.window-modal#optionModal .window-modal-content {
max-height: 80vh;
}
.window-modal#optionModal .window-modal-content .window-modal-body {
height: 400px;
overflow-y: scroll;
}
.window-modal#toElevatorModal .window-modal-content {
min-height: 270px;
height: auto;
}
.window-modal#toElevatorModal .window-modal-content .window-modal-body {
height: auto;
}
.window-modal .window-modal-content {
z-index: 9;
background-color: #fff;
border-radius: 10px;
position: absolute;
width: 90%;
padding: 30px;
top: 50%;
left: 50%;
transform: translate(-50%, -55%);
box-shadow: 0 5px 5px #222;
animation: fade-in 0.2s linear;
}
.window-modal .window-modal-content.modal-xl {
max-width: 1200px;
}
.window-modal .window-modal-content.modal-lg {
max-width: 800px;
}
.window-modal .window-modal-content.modal-m {
max-width: 450px;
}
.window-modal .window-modal-content .window-modal-header {
display: flex;
flex-direction: column;
}
.window-modal .window-modal-content .window-modal-header button.btn-close {
position: absolute;
top: 10px;
right: 10px;
background-color: transparent;
border: none;
outline: none;
border-radius: 50%;
}
.window-modal .window-modal-content .window-modal-header > div > input {
width: 250px;
}
.window-modal .window-back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: transparent;
}
#pricereviewCheck > .container {
background-color: #F2F2F2;
border-radius: 15px;
padding: 20px;
}
#pricereviewCheck > .container .historytable {
max-height: 0;
overflow: hidden;
}
#pricereviewCheck > .container textarea {
resize: vertical;
}
#pricereviewCheck > .container table, #pricereviewCheck > .container th, #pricereviewCheck > .container td {
border: 1px #ccc solid;
}
#pricereviewCheck > .container table.noborder {
border: none !important;
}
#pricereviewCheck > .container table.noborder th, #pricereviewCheck > .container table.noborder td {
border: none !important;
}
#pricereviewCheck > .container .customerinfo-table input {
background-color: #EEE5E5;
}
#pricereviewCheck > .container .mi-table th {
font-weight: 600;
}
#pricereviewCheck > .container .mi-table input[type=text] {
background-color: #EEEEEE;
cursor: not-allowed;
padding: 6px 12px;
font-size: 14px;
}
#pricereviewCheck > .container .mi-table .mi-info {
font-size: 14px;
}
#pricereviewCheck > .container .mi-table .mi-info span {
font-size: 15px;
font-weight: 600;
}
#pricereviewCheck > .container .mi-table .mi-info .line {
width: 100%;
height: 0.5px;
margin: 30px 0;
background-color: #ccc;
}/*# sourceMappingURL=pricereview.css.map */

1
wms/cont/css/pricereview.css.map

@ -0,0 +1 @@
{"version":3,"sources":["pricereview.css","pricereview.scss"],"names":[],"mappings":"AAAA,gBAAgB;ACEZ;EACI,WAAA;ADAR;ACEI;EACI,gBAAA;ADAR;ACEI;EACI,wBAAA,EAAA,6BAAA;EACA,qBAAA,EAAA,eAAA;EACA,gBAAA,EAAA,SAAA;ADAR;ACEI;EACI,aAAA;ADAR;ACCQ;EACI,sBAAA;ADCZ;ACCQ;EACI,cAAA;ADCZ;ACCQ;EACI,yBAAA;ADCZ;ACKQ;EACI,sBAAA;EACA,YAAA;ADHZ;ACIY;EACI,YAAA;ADFhB;ACOY;EACI,yBAAA;ADLhB;ACQgB;EACI,eAAA;ADNpB;ACQgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ADNpB;ACSY;EACI,eAAA;ADPhB;ACUQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ADRZ;ACSY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;ADPhB;ACQgB;EACI,yBAAA;EACA,WAAA;ADNpB;ACQgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ADNpB;ACQgB;EACI,yBAAA;EACA,WAAA;ADNpB;ACUY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ADRhB;ACSgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ADPpB;ACQoB;EACI,gBAAA;ADNxB;ACUgB;EACI,eAAA;EACA,6BAAA;ADRpB;ACSoB;EACI,eAAA;EACA,eAAA;ADPxB;ACSoB;EACI,eAAA;ADPxB;ACSoB;;;;EAEA,wBAAA;EACA,SAAA;ADLpB;ACSoB;EACI,UAAA;ADPxB;ACSoB;EACI,WAAA;EACA,YAAA;ADPxB;ACSoB;EACI,kBAAA;ADPxB;ACQwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ADN5B;ACQwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ADN5B;ACSoB;EACI,YAAA;EACA,gBAAA;ADPxB;ACWY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ADThB;ACUgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ADRpB;ACSoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ADPxB;ACSoB;EACI,YAAA;ADPxB;ACSoB;EACI,YAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ADPxB;ACaI;EACI,+CAAA;EACA,gBAAA;ADXR;;ACeA;EACI,4BAAA;EACA,WAAA;ADZJ;ACaI;EACI,gBAAA;ADXR;ACaI;EACI,yBAAA;ADXR;;ACcA;;EAGI,wBAAA;ADZJ;;ACcA;EACI,0BAAA;EACA,qBAAA;EACA,2BAAA;ADXJ;;ACaA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;ADVJ;ACYI;EACI;IACI,gCAAA;IACA,UAAA;EDVV;ECYM;IACI,gCAAA;IACA,UAAA;EDVV;AACF;ACYI;EACI,sBAAA;ADVR;ACYI;EACI,cAAA;ADVR;ACYI;EACI,yBAAA;ADVR;ACYI;EACI,gBAAA;ADVR;ACWQ;EACI,aAAA;EACA,kBAAA;ADTZ;ACYI;EACI,iBAAA;EACA,YAAA;ADVR;ACWQ;EACI,YAAA;ADTZ;ACYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,UAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ADVR;ACWQ;EACI,iBAAA;ADTZ;ACWQ;EACI,gBAAA;ADTZ;ACWQ;EACI,gBAAA;ADTZ;ACWQ;EACI,aAAA;EACA,sBAAA;ADTZ;ACUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ADRhB;ACUY;EACI,YAAA;ADRhB;ACYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ADVR;;ACeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ADZR;ACaQ;EACI,aAAA;EACA,gBAAA;ADXZ;ACaQ;EACI,gBAAA;ADXZ;ACaQ;EACI,sBAAA;ADXZ;ACaQ;EACI,uBAAA;ADXZ;ACYY;EACI,uBAAA;ADVhB;ACcY;EACI,yBAAA;ADZhB;ACgBY;EACI,gBAAA;ADdhB;ACgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ADdhB;ACgBY;EACI,eAAA;ADdhB;ACegB;EACI,eAAA;EACA,gBAAA;ADbpB;ACegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ADbpB","file":"pricereview.css"}

348
wms/cont/css/pricereview.scss

@ -0,0 +1,348 @@
#pricereviewCreate{
input[type='text'], input[type='number'], select{
margin: 1px;
}
textarea{
resize: vertical;
}
select{
-webkit-appearance: none; /* 針對 Chrome, Safari, Opera */
-moz-appearance: none; /* 針對 Firefox */
appearance: none; /* 標準語法 */
}
>.modal{
padding: 20px;
table, th, td{
border:1px #ccc solid;
}
table > thead tr th{
color:#A52A2A;
}
table > tbody .selected{
background-color: #E7FEFB;
}
table > tbody .selected td{
}
}
.container{
table, th, td{
border:1px #ccc solid;
padding: 9px;
&.noborder, .noborder th, .noborder td{
border:none;
}
}
table{
thead th{
background-color: #6D9EEB;
}
tbody {
td input{
font-size: 14px;
}
th{
background-color: #CCE4F8;
font-size: 14px;
padding: 15px 2px;
min-width: 100px;
text-align: center;
}
}
input{
font-size: 13px;
}
}
.pricreviewmain{
background-color: #F2F2F2;
padding: 20px;
border-radius: 6px ;
margin:30px 0;
button{
color:#fff;
width: 55px;
height: 30px;
padding: 0;
margin-left: 6px;
margin-bottom: 2px;
font-size: 13px;
&.addbtn{
background-color: #337AB7;
width: 30px;
}
&.deleteBtn{
background-color: #D9534F;
color:#fff;
font-size: 12px;
width: 30px;
}
&.selectElevator{
background-color: #D9534F;
color:#fff;
}
}
>.divitem{
border:1px #ccc solid;
padding: 10px;
border-radius: 4px ;
.title{
display: flex;
align-items: center;
border-bottom: 1px #ccc solid;
padding: 10px 0;
margin-bottom: 10px;
h6{
font-weight: 600;
}
}
table, th, td{
font-size: 14px;
background-color: transparent;
input, select{
font-size: 13px;
padding: 0 13px;
}
textarea{
font-size: 13px;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
table {
tr:hover .deleteBtn ,tr:hover .copyBtn{
opacity: 1;
}
.copyBtn{
width: 30px;
height: 30px;
}
.saletd{
position: relative;
>.deleteBtn{
position: absolute;
top: 50%;
transform: translateY(-50%);
right:2px;
opacity: 0;
transition: .3s;
}
>.copyBtn{
position: absolute;
top: 50%;
transform: translateY(-50%);
right:38px;
opacity: 0;
transition: .3s;
width: 30px;
height: 30px;
}
}
textarea{
height: auto;
min-height: 50px;
}
}
}
>.filediv{
display: flex;
flex-direction: column;
margin-top: 20px;
label{
display: flex;
align-items: center;
margin:10px 0;
p{
width:100px;
font-size: 15px;
font-weight: 600;
}
input[type="file"]{
width:400px
}
a, button{
width:100px;
height: 35px;
margin:0;
margin-right: 15px;
margin-top: 20px;
}
}
}
}
}
.dark{
background-color: rgba(225,225,225,1) !important;
font-weight: 600;
}
}
.container-fluid, .container{
max-width:1400px !important;
width: 100%;
h4{
font-weight: 600;
}
.btn-secondary{
background-color: #6C757D;
}
}
[x-cloak][data-type="window-modal"],
[x-cloak][data-type="errortext"]
{
display: none !important;
}
.errortext{
font-size:12px !important;
color:red !important;
font-weight:600 !important;
}
.window-modal{
position: fixed;
top: 0;
left:0;
width: 100%;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9;
padding: 20px;
// display: none;
@keyframes fade-in {
0%{
transform: translate(-50%, -60%);
opacity: 0;
}
100%{
transform: translate(-50%, -55%);
opacity: 1;
}
}
table, th, td{
border:1px #ccc solid;
}
table > thead tr th{
color:#A52A2A;
}
table > tbody .selected{
background-color: #E7FEFB;
}
&#optionModal .window-modal-content{
max-height: 80vh;
.window-modal-body{
height: 400px;
overflow-y: scroll;
}
}
&#toElevatorModal .window-modal-content{
min-height: 270px;
height: auto;
.window-modal-body{
height: auto;
}
}
.window-modal-content{
z-index: 9;
background-color: #fff;
border-radius: 10px;
position: absolute;
width:90%;
padding: 30px;
top: 50%;
left:50%;
transform: translate(-50%, -55%);
box-shadow: 0 5px 5px #222;
animation: fade-in .2s linear;
&.modal-xl{
max-width:1200px;
}
&.modal-lg{
max-width:800px;
}
&.modal-m{
max-width:450px;
}
.window-modal-header{
display: flex;
flex-direction: column;
button.btn-close{
position: absolute;
top: 10px;
right:10px;
background-color: transparent;
border:none;
outline: none;
border-radius: 50%;
}
>div > input{
width: 250px;
}
}
}
.window-back{
position: absolute;
top: 0;
left:0;
width: 100%;
height: 100%;
background-color: transparent;
}
}
#pricereviewCheck{
>.container{
background-color: #F2F2F2;
border-radius: 15px;
padding: 20px;
.historytable{
max-height: 0;
overflow: hidden;
}
textarea{
resize: vertical;
}
table, th, td{
border:1px #ccc solid;
}
table.noborder{
border:none !important;
th ,td{
border:none !important;
}
}
.customerinfo-table{
input{
background-color: #EEE5E5;
}
}
.mi-table{
th{
font-weight: 600;
}
input[type=text]{
background-color: #EEEEEE;
cursor: not-allowed;
padding: 6px 12px;
font-size: 14px;
}
.mi-info{
font-size: 14px;
span{
font-size: 15px;
font-weight: 600;
}
.line{
width: 100%;
height: .5px;
margin:30px 0;
background-color: #ccc;
}
}
}
}
}

5
wms/cont/js/alpinejs/cdn.min.js

File diff suppressed because one or more lines are too long

118
wms/cont/js/pricereviewAlpine.js

@ -0,0 +1,118 @@
const pricereviewCreate = ()=>{
return {
init(){
console.log(123);
},
modalShow:{
elevator: false,
},
total_spec:0,
elevators:[],
modalElevatorInfo:{
spec:'',
person:'',
weight:'',
stop:'',
speed:'',
permitNumber:'', //許可證號碼
brand:'', //品牌
m1:0, //贈送M1
months:12, //保養月數(月)
cycle:'EM', // 保養週期
checkYear:'', //竣工檢查年度
lastDate:'', // 上次年檢日期
yearCheckFee:'', //年檢費用
price:'', //公司發布價(月)
qty:'', //電梯數量
sale_price:'', //契約報價
},
openCreateElevatorModal(){
this.modalShow.elevator = true;
body.style.overflow = 'hidden';
},
hideCreateElevatorModal(){
this.modalShow.elevator = false;
body.style.overflow = 'auto';
this.modalElevatorInfo = {
spec:'',
person:'',
weight:'',
stop:'',
speed:'',
permitNumber:'',
brand:'',
m1:0,
months:'',
cycle:'',
checkYear:'',
lastDate:'',
yearCheckFee:'',
price:'',
qty:'',
sale_price:'',
};
},
createElevatorFn(){
this.total_spec ++;
this.elevators.push({
id: this.total_spec,
spec: this.modalElevatorInfo.spec,
person: this.modalElevatorInfo.person,
weight: this.modalElevatorInfo.weight,
stop: this.modalElevatorInfo.stop,
speed: this.modalElevatorInfo.speed,
permitNumber: this.modalElevatorInfo.permitNumber,
brand: this.modalElevatorInfo.brand,
m1: this.modalElevatorInfo.m1,
months: this.modalElevatorInfo.months,
cycle: this.modalElevatorInfo.cycle,
checkYear: this.modalElevatorInfo.checkYear,
lastDate: this.modalElevatorInfo.lastDate,
yearCheckFee: this.modalElevatorInfo.yearCheckFee,
price: this.modalElevatorInfo.price,
qty: this.modalElevatorInfo.qty,
sale_price: this.modalElevatorInfo.sale_price
})
this.hideCreateElevatorModal();
},
copyElevator(idx){
const spec = this.elevators[idx].spec;
const person = this.elevators[idx].person;
const stop = this.elevators[idx].stop;
const weight = this.elevators[idx].weight
const speed = this.elevators[idx].speed;
const permitNumber = this.elevators[idx].permitNumber;
const brand = this.elevators[idx].brand;
const m1 = this.elevators[idx].m1;
const months = this.elevators[idx].months;
const cycle = this.elevators[idx].cycle;
const checkYear = this.elevators[idx].checkYear;
const lastDate = this.elevators[idx].lastDate;
const yearCheckFee = this.elevators[idx].yearCheckFee;
const price = this.elevators[idx].price;
const qty = this.elevators[idx].qty;
const sale_price = this.elevators[idx].sale_price;
this.total_spec ++;
this.elevators.push({
id: this.total_spec,
spec: spec,
person: person,
stop: stop,
weight:weight,
speed: speed,
permitNumber: permitNumber,
brand: brand,
m1: m1,
months: months,
cycle: cycle,
checkYear: checkYear,
lastDate: lastDate,
yearCheckFee: yearCheckFee,
price: price,
qty: qty,
sale_price: sale_price
})
},
}
}

4
wms/cont/pricereviewCheck.php

@ -0,0 +1,4 @@
<?php
include_once "../header.php";
require_once('../mkt/conn.php');

519
wms/cont/pricereviewCreate.php

@ -0,0 +1,519 @@
<?php
include_once "../header.php";
require_once "../mkt/conn.php";
?>
<link rel="stylesheet" href="./css/pricereview.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/pricereviewAlpine.js"></script>
<div id="pricereviewCreate" x-data=pricereviewCreate()>
<div class="window-modal" x-cloak data-type="window-modal" x-show="modalShow.elevator" x-ref="createElevatorModal" id="createElevatorModal">
<div class="window-modal-content modal-xl">
<div class="window-modal-header">
<h4>新增電梯規格</h4>
<button class="btn btn-close" @click="hideCreateElevatorModal()">X</button>
</div>
<div class="window-modal-body">
<div>
<table class="table">
<tr class="table-active">
<th>電梯</th>
<th>人乘</th>
<th>載重(KG)</th>
<th>停數</th>
</tr>
<tr>
<td>
<select class="form-control" x-model="modalElevatorInfo.spec">
<option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強趨梯</option>
<option value="MAP100">MAP100平台梯</option>
<option value="M1">M1(系統更新)</option>
<option value="M1+M4(1:1)">M1+M4(1:1)系統+主機</option>
<option value="M1+M4(2:1)">M1+M4(2:1)系統+主機</option>
</select>
</td>
<td>
<select name="" id="" class="form-control" x-model="modalElevatorInfo.person">
<option value="">請選擇</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="15">15</option>
<option value="17">17</option>
<option value="20">20</option>
<option value="24">24</option>
</select>
</td>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.weight" />
</td>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.stop" />
</td>
</tr>
<tr class="table-active">
<th>速度</th>
<th>電梯許可證號</th>
<th>品牌</th>
<th>贈送M1</th>
</tr>
<tr>
<td>
<select name="" id="" class="form-control" style="width:93px" x-model="modalElevatorInfo.speed" @change="getModalElevatorPrice()" >
<option value="">請選擇</option>
<option value="9">9</option>
<option value="24">24</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="60">60</option>
<option value="90">90</option>
<option value="105">105</option>
<option value="120">120</option>
<option value="150">150</option>
</select>
</td>
<td>
<input type="text" class="form-control" x-model="modalElevatorInfo.permitNumber" />
</td>
<td>
<select class="form-control" x-model="modalElevatorInfo.brand">
<option value="請選擇">請選擇</option>
<option value='永大'>永大</option>
<option value='三菱'>三菱</option>
<option value='崇友'>崇友</option>
<option value='Otis'>Otis</option>
<option value='櫻花'>櫻花</option>
<option value='立路'>立路</option>
<option value='富士達'>富士達</option>
<option value='富士'>富士</option>
<option value='測試品牌'>測試品牌</option>
<option value='sanyo'>sanyo</option>
<option value='測試品牌2'>測試品牌2</option>
<option value='測試品牌4'>測試品牌4</option>
<option value='中升'>中升</option>
<option value='長合'>長合</option>
<option value='宏偉電機工業股份有限公司'>宏偉電機工業股份有限公司</option>
<option value='保速達'>保速達</option>
<option value='東棋'>東棋</option>
<option value='安達'>安達</option>
<option value='百朝'>百朝</option>
<option value='太友'>太友</option>
<option value='永佳捷'>永佳捷</option>
<option value='永勝'>永勝</option>
<option value='其他'>其他</option>
</select>
</td>
<td>
<select class="form-control" x-model="modalElevatorInfo.m1">
<option value="0"></option>
<option value="1"></option>
</select>
</td>
</tr>
<tr class="table-active">
<th>保養月數</th>
<th>保養週期</th>
<th>竣工檢查年度</th>
<th>上次年檢日期</th>
</tr>
<tr>
<td>
<input type="number" class="form-control" value="12" x-model="modalElevatorInfo.months" />
</td>
<td>
<select name="" id="" class="form-control" x-model="modalElevatorInfo.cycle">
<option value="">請選擇</option>
<option value="">月保</option>
<option value="">雙週保</option>
</select>
</td>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.checkYear" />
</td>
<td>
<input type="date" class="form-control" x-model="modalElevatorInfo.lastDate" />
</td>
</tr>
<tr class="table-active">
<th>年檢費用(元)</th>
<th>公司發布價(月)</th>
<th>電梯數量</th>
<th>契約報價(月)</th>
</tr>
<tr>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.yearCheckFee" />
</td>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.price" />
</td>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.qty" />
</td>
<td>
<input type="number" class="form-control" x-model="modalElevatorInfo.sale_price" />
</td>
</tr>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" @click="hideCreateElevatorModal()">關閉</button>
<button type="button" class="btn btn-primary" @click="createElevatorFn()">新增</button>
</div>
</div>
<div class="window-back" @click="hideCreateElevatorModal()"></div>
</div>
<div class="container">
<table class="table" border="1">
<thead >
<tr class="" >
<th scope="col" class="text-center " colspan="8">有望客戶(契約)基本資料</th>
</tr>
</thead>
<tbody>
<tr>
<th>評審單號</th>
<td><input class="form-control" type="text" disabled value="" /></td>
<th>卷號</th>
<td><input class="form-control" type="text" disabled value="" /></td>
<th>現場地址</th>
<td><input class="form-control" type="text" disabled value="" /></td>
<th>現場名稱</th>
<td><input class="form-control" type="text" disabled value="" /></td>
</tr>
<tr>
<th>電梯品牌</th>
<td><input class="form-control" type="text" disabled value="" /></td>
<th>數量</th>
<td><input class="form-control" type="number" disabled value="" /></td>
<th>營業員</th>
<td><input class="form-control" type="text" disabled value="" /></td>
<th>保養方式</th>
<td>
<select class="form-control" disabled>
<option value=""></option>
</select>
</td>
</tr>
<tr>
<th>契約期限開始</th>
<td><input class="form-control" type="date" disabled value="" /></td>
<th>契約期限結束</th>
<td><input class="form-control" type="date" disabled value="" /></td>
<th>契約性質</th>
<td>
<select class="form-control" disabled>
<option value=""></option>
<option value="">新簽約</option>
<option value="">免保轉有費</option>
<option value="">續約</option>
</select>
</td>
<th>介紹人</th>
<td><input class="form-control" type="text" disabled value="" /></td>
</tr>
<tr>
<th>付款方式</th>
<td>
<select class="form-control" disabled>
<option value=""></option>
<option value="">月付</option>
<option value="">季付</option>
<option value="">半年付</option>
<option value="">年付</option>
</select>
</td>
<th></th>
<td></td>
<th></th>
<td></td>
<th></th>
<td></td>
</tr>
</tbody>
</table>
<table class="table" border="1">
<thead >
<tr class="" >
<th scope="col" class="text-center " colspan="8">洽商進度</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan=8>
<textarea class="form-control" name="progress" id="progress" cols="20" rows="5" disabled ></textarea>
</td>
</tr>
</tbody>
</table>
<table class="table" border="1">
<thead >
<tr class="" >
<th scope="col" class="text-center " colspan="8">電梯詳細資料</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan=8>
<textarea class="form-control" name="progress" id="progress" cols="20" rows="6" disabled>注意事項:
1.速度單位是 米/分.
2.選擇贈送M1,保養月數需填寫60.
3.標準價格未帶出,請聯係業務部建立該規格報價.
4.無機房速度20~60米 以60米為標準.
</textarea>
</td>
</tr>
</tbody>
</table>
<div class="pricreviewmain container">
<div class="divitem">
<div class="title">
<h4>整機單價</h4>
<button class="addbtn btn" x-ref="addElevatorBtn" @click="openCreateElevatorModal()" >+</button>
</div>
<table class="table" border=1>
<template x-for="(elevator, idx) in elevators" :key="elevator.id">
<tbody>
<tr class="dark" >
<th colspan=1>項次</th>
<th colspan=9 style="text-align: left; padding-left: 15px;" x-text="elevator.id"></th>
<th colspan="2" >
<button class="copyBtn btn btn-secondary" @click="copyElevator(idx)">+</button>
<button class="btn btn-danger" @click="deleteElevator(elevator.id)">刪除</button>
</th>
</tr>
<tr>
<th >電梯</th>
<td>
<select class="form-control" x-model="elevator.spec">
<option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAF100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強趨梯</option>
<option value="MAP100">MAP100平台梯</option>
<option value="M1">M1(系統更新)</option>
<option value="M1+M4(1:1)">M1+M4(1:1)系統+主機</option>
<option value="M1+M4(2:1)">M1+M4(2:1)系統+主機</option>
</select>
</td>
<th>人乘</th>
<td>
<select class="form-control" x-model="elevator.person">
<option value="">請選擇</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="15">15</option>
<option value="17">17</option>
<option value="20">20</option>
<option value="24">24</option>
</select>
</td>
<th>載重(KG)</th>
<td>
<input type="number" class="form-control" x-model="elevator.weight" />
</td>
<th>停數</th>
<td>
<input type="number" class="form-control" x-model="elevator.stop" />
</td>
<th>速度(m/min)</th>
<td>
<select name="" id="" class="form-control" style="width:93px" x-model="elevator.speed" @change="getElevatorPrice()" >
<option value="">請選擇</option>
<option value="9">9</option>
<option value="24">24</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="60">60</option>
<option value="90">90</option>
<option value="105">105</option>
<option value="120">120</option>
<option value="150">150</option>
</select>
</td>
<th>規格</th>
<td colspan=1>
<input type="text" class="form-control" disabled />
</td>
</tr>
<tr>
<th>電梯許可證號碼</th>
<td colspan=3>
<input type="text" class="form-control" x-model="elevator.permitNumber" />
</td>
<th>品牌</th>
<td colspan="1">
<select class="form-control" x-model="modalElevatorInfo.brand">
<option value="請選擇">請選擇</option>
<option value='永大'>永大</option>
<option value='三菱'>三菱</option>
<option value='崇友'>崇友</option>
<option value='Otis'>Otis</option>
<option value='櫻花'>櫻花</option>
<option value='立路'>立路</option>
<option value='富士達'>富士達</option>
<option value='富士'>富士</option>
<option value='測試品牌'>測試品牌</option>
<option value='sanyo'>sanyo</option>
<option value='測試品牌2'>測試品牌2</option>
<option value='測試品牌4'>測試品牌4</option>
<option value='中升'>中升</option>
<option value='長合'>長合</option>
<option value='宏偉電機工業股份有限公司'>宏偉電機工業股份有限公司</option>
<option value='保速達'>保速達</option>
<option value='東棋'>東棋</option>
<option value='安達'>安達</option>
<option value='百朝'>百朝</option>
<option value='太友'>太友</option>
<option value='永佳捷'>永佳捷</option>
<option value='永勝'>永勝</option>
<option value='其他'>其他</option>
</select>
</td>
<th>保養月數</th>
<td>
<input type="number" class="form-control" x-model="elevator.months" />
</td>
<th>保養週期</th>
<td>
<select name="" id="" class="form-control" x-model="elevator.cycle">
<option value="">請選擇</option>
<option value="EM">月保</option>
<option value="BW">雙週保</option>
</select>
</td>
<th>送M1</th>
<td>
<select class="form-control" x-model="elevator.m1">
<option value="0"></option>
<option value="1"></option>
</select>
</td>
</tr>
<tr>
<th>竣工檢查年度</th>
<td>
<input type="number" class="form-control" x-model="elevator.checkYear" />
</td>
<th>上次年檢日期</th>
<td>
<input type="date" class="form-control" x-model="elevator.lastDate" />
</td>
<th>年檢費用(元)</th>
<td>
<input type="number" class="form-control" x-model="elevator.yearCheckFee" />
</td>
<th>公司發布價(月)</th>
<td>
<input type="number" class="form-control" x-model="elevator.price" />
</td>
<th>電梯數量</th>
<td>
<input type="number" class="form-control" x-model="elevator.qty" />
</td>
<th>契約報價(月)</th>
<td>
<input type="number" class="form-control" x-model="elevator.sale_price" />
</td>
</tr>
</tbody>
</template>
</table>
</div>
<div class="divitem" style="margin-top:20px">
<table style="width:800px" class="table noborder" >
<tbody>
<tr>
<th>標準價總額(A)</th>
<th>報價總額(B)</th>
<th>破價總額(B-A)</th>
<th>價率%(B/A)</th>
<th>總台數</th>
<th>服務費(介紹費)</th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="totalPrice().toLocaleString()" disabled style="width:180px" /></td>
<td><input type="text" class="form-control" x-model="totalSalePrice().toLocaleString()" disabled style="width:180px" /></td>
<td><input type="text" class="form-control" x-model="(totalSalePrice() - totalPrice()).toLocaleString()" disabled style="width:180px" /></td>
<td>
<input type="text" class="form-control" x-show="totalPrice()!=0" x-model="Math.round(totalSalePrice() / totalPrice() * 100 * 10) /10" disabled />
<input type="text" class="form-control" x-show="totalPrice()==0" value="0" disabled />
</td>
<td><input type="text" class="form-control" x-model="totalElevatorsNum()" disabled /></td>
<td><input type="text" class="form-control" x-model="serviceFee" style="width:150px" /></td>
</tr>
<tr>
<th>罰則</th>
<th>訂金保證金(函)%</th>
<th>履約保證金(函)%</th>
<th>保固保證金(函)%</th>
<th></th>
<th></th>
</tr>
<tr>
<td><input type="text" class="form-control" x-model="penalty" /></td>
<td><input type="text" class="form-control" x-model="deposit_rate" /></td>
<td><input type="text" class="form-control" x-model="keep_rate" /></td>
<td><input type="text" class="form-control" x-model="warranty_rate" /></td>
<td></td>
<td></td>
</tr>
<tr>
<th colspan="6">特記事項</th>
</tr>
<tr>
<td colspan="6">
<textarea class="form-control" id="" cols="30" rows="5" x-model="remark"></textarea>
</td>
</tr>
</tbody>
</table>
</div>
<div class="filediv">
<label style="font-size:13px">▪️ 營業權限85%以上;85-80%呈至區處長審核;80%以下呈至總經理審核。</label>
<label for="">
<p>報價單</p>
<input type="file" class="form-control" multiple draggable="true" @change="uploadFiles($event, 1)" />
</label>
<label for="">
<p>附表</p>
<input type="file" class="form-control" multiple draggable="true" @change="uploadFiles($event, 2)" />
</label>
<label for="">
<?php if(!empty($main) && $main['attatch1'] != null): ?>
<a class="btn btn-primary" href="<?php echo $main['attatch1']; ?>" download="<?php echo $main['contractno']; ?>報價單">下載報價單</a>
<?php endif; ?>
<?php if(!empty($main) && $main['attatch2'] != null): ?>
<a class="btn btn-primary" href="<?php echo $main['attatch2']; ?>" download="<?php echo $main['contractno']; ?>附表一">下載附表一</a>
<?php endif; ?>
<button class="btn btn-primary" @click="save()">保存</button>
<button class="btn btn-primary" @click="submit()">送審</button>
</label>
</div>
</div>
</div>
</div>
<script>
const body = document.querySelector('body');
</script>

2
wms/contract/api/postContractData.php

@ -220,7 +220,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$ADuseful_date = implode("-", $click);
$sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contractno', $contractno);
$stmt->bindParam(':define', $define);

39
wms/contract/api/postContractNewApplyData.php

@ -4,6 +4,7 @@ use function Symfony\Component\String\s;
require_once("../conn.php");
include_once("./upload_chk.php");
include_once "./postFlow.php";
ini_set('date.timezone', 'Asia/Taipei');
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
exit();
@ -42,6 +43,8 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$status = $_POST['status']; // 0:暫存 1:送審 2:退回 3:完成
$pays = json_decode($pays, true);
$form_key = $_POST['form_key'];
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
@ -160,6 +163,14 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
}
}
// -----處理檔案上傳 END-----
if($status == 1){
$current_assigner = "M0175";
$flow_code = "A";
$ekind = "新梯";
createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key);
}
header("HTTP/1.1 201 success!");
$conn->commit();
} else {
@ -211,7 +222,6 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
}
$deleted_at = date("Y-m-d H:i:s");
$removefiles = isset($_POST['removefiles']) ? json_decode($_POST['removefiles'], true) : [];
print_r($removefiles);
if(count($removefiles) > 0){
foreach($removefiles as $file){
$sql_str = "UPDATE contract_apply_files SET deleted_at = :deleted_at WHERE id = :fileid";
@ -221,9 +231,18 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt ->execute();
}
}
if($status == 1){
$current_assigner = "M0175";
$flow_code = "A";
$ekind = "新梯";
createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key);
}
header("HTTP/1.1 201 success!");
$conn->commit();
}
} catch (PDOException $e) {
$conn->rollback();
header("HTTP/1.1 500 failed!");
@ -268,6 +287,8 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$progress = $_POST['progress'];
$review_comment = $_POST['review_comment'];
$user_id = $_POST['review_person_id'];
$form_key = $_POST['form_key'];
$mid = $contract_new_apply_id;
$review_date = date('Y-m-d H:i:s');
$conn->beginTransaction();
try {
@ -280,6 +301,13 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt->bindParam(':review_person_id', $user_id);
$stmt->bindParam(':review_date', $review_date);
$stmt->execute();
//發送待簽通知
$current_assigner = "00000";
$flow_code = "Z";
$ekind = "新梯";
createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key);
header("HTTP/1.1 200 success!");
$conn->commit();
} catch (PDOException $e) {
@ -297,6 +325,8 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$progress = $_POST['progress'];
$review_comment = $_POST['review_comment'];
$user_id = $_POST['review_person_id'];
$form_key = $_POST['form_key'];
$mid = $contract_new_apply_id;
echo $user_id;
$review_date = date('Y-m-d H:i:s');
$conn->beginTransaction();
@ -310,6 +340,13 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt->bindParam(':review_person_id', $user_id);
$stmt->bindParam(':review_date', $review_date);
$stmt->execute();
//發送待簽通知
$current_assigner = "00000";
$flow_code = "A";
$ekind = "新梯";
createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key);
header("HTTP/1.1 200 success!");
$conn->commit();
} catch (PDOException $e) {

58
wms/contract/api/postFlow.php

@ -0,0 +1,58 @@
<?php
require_once("../conn.php");
function createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key=null){
global $conn;
$form_id = $mid;
$seq = 0;
$system_id = "cta";
if($ekind == "新梯") $flow_id = "cta01";
if($ekind == "汰改") $flow_id = "cta02";
if($ekind == "保養") $flow_id = "cta03";
if($form_key == null){
$sql_str = "SELECT appwms.nextval('form_key') form_key";
$stmt = $conn->prepare($sql_str);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$form_key = $result['form_key'];
$seq = 0;
$sql_str = "INSERT INTO flow (system_id, flow_id, form_id, form_key, flow_code)
VALUES (:system_id, :flow_id, :form_id, :form_key, :flow_code)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':system_id', $system_id);
$stmt->bindParam(':flow_id', $flow_id);
$stmt->bindParam(':form_id', $form_id);
$stmt->bindParam(':form_key', $form_key);
$stmt->bindParam(':flow_code', $flow_code);
$stmt->execute();
}else{
$sql_str = "UPDATE flow SET flow_code = :flow_code WHERE form_key = :form_key";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':form_key', $form_key);
$stmt->bindParam(':flow_code', $flow_code);
$stmt->execute();
$sql_str = "SELECT MAX(seq) AS max_seq FROM subflow WHERE form_key = :form_key";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':form_key', $form_key);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$seq = $result['max_seq'];
$seq ++;
}
$created_at = date("Y-m-d H:i:s");
$sql_str = "INSERT INTO subflow (form_key, seq, current_assigner, update_date,create_date)
VALUES (:form_key, :seq, :current_assigner, :update_date,:create_date)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':form_key', $form_key);
$stmt->bindParam(':seq', $seq);
$stmt->bindParam(':current_assigner', $current_assigner);
$stmt->bindParam(':update_date', $created_at);
$stmt->bindParam(':create_date', $created_at);
$stmt->execute();
return $form_key;
}

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

@ -1,13 +1,45 @@
<?php
include_once("../header.php");
require_once("./conn.php");
if (!(isset($_GET['id']) && !empty($_GET['id']))) {
if (!(isset($_GET['id']) && !empty($_GET['id'])) && !(isset($_GET['form_key']) && !empty($_GET['form_key']))) {
$para = "function_name=pricereview&" . $token_link;
echo "<script>alert('非法訪問!!!');</script>";
echo "<script>window.history.go(-1);</script>";
exit;
}
$id = $_GET["id"];
$id = null;
if(isset($_GET['id'])){
$id = $_GET["id"];
}
$form_key = null;
if(isset($_GET['form_key'])){
$form_key = $_GET['form_key'];
}
if($form_key != null){
$sql_str = "SELECT form_id FROM flow WHERE system_id = 'cta' AND flow_id = 'cta01' AND form_key = :form_key";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':form_key', $form_key);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$id = $result['form_id'];
}
if(!$id){
$para = "function_name=pricereview&" . $token_link;
echo "<script>alert('非法訪問!!!');</script>";
echo "<script>window.history.go(-1);</script>";
exit;
}
$sql_str = "SELECT form_key FROM flow WHERE system_id = 'cta' AND flow_id = 'cta01' AND form_id = :id";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':id', $id);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if($result){
$form_key = $result['form_key'];
}
$sql_str = "SELECT contract_new_apply.*, person_account.name AS review_person_name, person_final_account.name AS review_final_person_name
FROM contract_new_apply
@ -439,7 +471,13 @@ $para = "function_name=pricereview&" . $token_link;
<tr>
<td>第二期款交貨期限(日)</td>
<td>
<input type="number" class="form-control" x-model="data.secondPayDeadline" />
<select class="form-control" x-model="data.secondPayDeadline">
<option value="">請選擇</option>
<option value="30">30天</option>
<option value="60">60天</option>
<option value="90">90天</option>
<option value="120">120天</option>
</select>
<p class="alerttext" x-show="data.secondPayDeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
@ -513,8 +551,8 @@ $para = "function_name=pricereview&" . $token_link;
<?php endif; ?>
</td>
</tr>
<tr>
<td>業務承辦人</td>
<tr x-show="false">
<td>業務部審核</td>
<td><span><?php echo (!isset($contract['review_person_name']) || empty($contract['review_person_name'])) ? "---" : $contract['review_person_name'] . "(" . $contract['review_person_id'] . ")"; ?></span></td>
<td>
<?php if (($status == 1 || $status == 3) && $progress >= 2) : ?><span class="successtext">已同意</span><?php endif; ?>
@ -525,15 +563,15 @@ $para = "function_name=pricereview&" . $token_link;
<td><?php echo $contract['review_date'] ?? "---"; ?></td>
</tr>
<tr>
<td>業務部協理</td>
<td>業務部審核</td>
<td><span><?php echo (!isset($contract['review_final_person_name']) || empty($contract['review_final_person_name'])) ? "---" : $contract['review_final_person_name'] . "(" . $contract['review_final_person_id'] . ")"; ?></span></td>
<td>
<?php if ($status == 3) : ?><span class="successtext">結案同意</span><?php endif; ?>
<?php if ($status == 2) : ?><span class="failtext">結案不同意</span><?php endif; ?>
<?php if ($status < 2) : ?><span>---</span><?php endif; ?>
</td>
<td colspan=2><?php echo $contract['review_final_comment'] ?? "---"; ?></td>
<td><?php echo $contract['review_final_date'] ?? "---"; ?></td>
<td colspan=2><?php echo $contract['review_comment'] ?? "---"; ?></td>
<td><?php echo $contract['review_date'] ?? "---"; ?></td>
</tr>
<!-- <tr>
<td colspan="2" style="font-weight:bold">業務部承辦人</td>
@ -554,10 +592,10 @@ $para = "function_name=pricereview&" . $token_link;
</tbody>
</table>
<button @click="window.history.go(-1)" type="button" class="btn btn-primary btn-lg pull-right savebtn">回前頁</button>
<?php if (($isFirst == 1 && ($person == $user_id || $user_id == "M0174")) || ($isFirst == 0 && $status == 0 && ($person == $user_id || $user_id == "M0174"))) : ?>
<?php if (($isFirst == 1 && ($person == $user_id || $user_id == "M0174")) || ($isFirst == 0 && ($status == 0 || $status == 2) && ($person == $user_id || $user_id == "M0174"))) : ?>
<button x-show="true" x-on:click="submit()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>送審</span>
<span><?php if($status==2) echo "重新"; ?>送審</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
@ -578,7 +616,7 @@ $para = "function_name=pricereview&" . $token_link;
<span>
<?php
if (($user_id === "M0175" || $user_id == "TEST02") && $contract['progress'] <= 1) {
echo "同意(上呈)";
echo "同意(結案)";
} elseif (($user_id === "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) {
echo "同意(結案)";
}
@ -629,7 +667,7 @@ $para = "function_name=pricereview&" . $token_link;
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']; ?>';
const mid = '<?php echo $id; ?>';
const pays = [...<?php echo json_encode($pays) ?? []; ?>];
const secondPayDeadline = '';
const tradeaddress = '<?php echo $contract['address'] ?? ''; ?>';
@ -662,7 +700,7 @@ $para = "function_name=pricereview&" . $token_link;
const price_b = <?php echo $contract['install_fee'] ?? ''; ?>;
const items = [...<?php echo json_encode($items) ?? []; ?>];
const user_id = '<?php echo $user_id ?? ''; ?>';
const mid = '<?php echo $_GET['id']; ?>';
const mid = '<?php echo $id; ?>';
const pays = [...<?php echo json_encode($pays) ?? []; ?>];
const isFirst = <?php echo $isFirst; ?>;
const tradeaddress = '<?php echo $contract['trade_address'] ?? ''; ?>';
@ -682,7 +720,7 @@ $para = "function_name=pricereview&" . $token_link;
</script>
<?php endif; ?>
<?php if ($status > 0 || ($person != $user_id && $user_id != "M0174")) : ?>
<?php if ($status ==1 || $status == 3 || ($person != $user_id && $user_id != "M0174")) : ?>
<script>
window.onload = () => {
const input = document.querySelectorAll('input');
@ -714,4 +752,5 @@ $para = "function_name=pricereview&" . $token_link;
alert("請先暫存或送審文件!")
}
}
const form_key = '<?php echo $form_key; ?>';
</script>

13
wms/contract/js/alpine.js

@ -1480,6 +1480,7 @@ const contractNewApply = () => {
form.append('review_comment', this.data.review_comment);
form.append('description', this.data.description);
form.append('progress', 0);
form.append('form_key', form_key);
for (var i = 0; i < this.data.files.length; i++) {
form.append('files[]', this.data.files[i]);
}
@ -1505,7 +1506,7 @@ const contractNewApply = () => {
let newstatus = 0;
if (this.progress <= 1) {
newprogress = 2;
newprogress = 3;
} else if (this.progress == 2) {
newprogress = 3;
}
@ -1513,7 +1514,7 @@ const contractNewApply = () => {
if (this.status == 1 && this.progress == 2) {
newstatus = 3
} else {
newstatus = 1
newstatus = 3
}
console.log(newstatus);
console.log(newprogress)
@ -1526,6 +1527,7 @@ const contractNewApply = () => {
form.append('review_comment', this.data.review_comment);
form.append('review_person_id', user_id);
form.append('progress', newprogress);
form.append('form_key', form_key);
axios.post('./api/postContractNewApplyData.php', form).then(res => {
if (res.status === 200) {
alert('審核成功');
@ -1533,11 +1535,13 @@ const contractNewApply = () => {
}
this.isLoading = false
}).catch(error => {
alert('審核失敗!可能為以下錯誤:\n' + error.response.data)
console.log('審核失敗!可能為以下錯誤:\n' + error.response.data)
alert('審核失敗!')
this.isLoading = false
})
},
disagree() {
console.log(user_id);
if (!confirm('確定退回嗎?')) return;
this.isLoading = true
const form = new FormData();
@ -1547,11 +1551,12 @@ const contractNewApply = () => {
form.append('review_comment', this.data.review_comment);
form.append('review_person_id', user_id);
form.append('progress', 0);
form.append('form_key', form_key);
axios.post('./api/postContractNewApplyData.php', form).then(res => {
if (res.status === 200) {
alert('退回成功');
console.log(res.data);
// window.location.reload();
window.location.reload();
}
this.isLoading = false
}).catch(error => {

2
wms/crm/crmm02-index.php

@ -170,7 +170,7 @@ if ($data) :
<span class="glyphicon glyphicon-pencil"></span>
</a>
<?php if ($user_name === $row['salesman'] || $user_id = 'M0225') : ?>
<a href="../mkt/pricereviewMaintainCreate.php?function_name=customer&token=<?= $token_link ?>&vol_no=<?= $row['vol_no'] ?>" class="btn btn-info btn-sm">
<a href="../cont/pricereviewCheck.php?function_name=sign_list&<?= $token_link ?>&vol_no=<?= $row['vol_no'] ?>" class="btn btn-info btn-sm">
轉價審
</a>
<?php endif ?>

2
wms/crm/crmm06_submit.php

@ -17,4 +17,4 @@ foreach ($cols as $col) {
$hecm->create($data);
echo "<script>alert('已保存');</script>";
header("Location:" . "localhost/wms/crm/crmm02-index.php?token=" . $request['token']);
header("Location:" . "crmm02-index.php?token=" . $request['token']);

7
wms/fun_global.php

@ -201,12 +201,13 @@ function check_user_permission($user_id, $token)
'/wms/test.php',
'/wms/delivery_kpi.php',
'/wms/contract_m-index.php',
'/wms/contract_b-index.php'
'/wms/contract_b-index.php',
];
if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return;
$do = "";
$sql = "select accounttype from account where accountid = '$user_id'";
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_assoc($res)) {
if ($row["accounttype"] == "E") $do = 3; // 管理員
@ -215,8 +216,8 @@ function check_user_permission($user_id, $token)
$res2 = mysqli_query($link, $sql2);
if ($row2 = mysqli_fetch_assoc($res2)) {
$arr = json_decode(urldecode($row2["permission"]), true);
//print_r($arr);
//echo "#".str_replace("/wms/", "", $_SERVER["SCRIPT_NAME"]);exit;
$do = $arr[str_replace("/wms/", "", $_SERVER["SCRIPT_NAME"])];
}
mysqli_free_result($res2);

3
wms/login.php

@ -89,6 +89,7 @@
</div>
</div>
<span style="color:red">
<?php
if (!empty($_GET['errno'])) {
if ($_GET['errno'] == 1) {
@ -102,7 +103,7 @@
}
}
?>
</span>
</div>

5
wms/mkt/api/postNewElevatorPricereview.php

@ -30,6 +30,8 @@ $attatch2_src = null;
$token = $_POST['token'];
$form_key = $_POST['form_key'];
$updated_at = date("Y-m-d H:i:s");
$updated_by = $_POST['user_id'];
$elevators = json_decode($_POST['elevators'], true);
$options = json_decode($_POST['options'], true);
$otherOptions = json_decode($_POST['otherOptions'], true);
@ -63,8 +65,6 @@ if(!empty($attatch1)){
$path = './pricereview-uploads/';
$attatch1_src = $path.$imgsrc;
if (!file_exists($path)) { mkdir($path); }
if ($error == 0) {
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
if (!in_array($ext, $allow_ext)) {
@ -155,7 +155,6 @@ try{
$stmt->bindParam(':status', $status);
$stmt->bindParam(':attatch1', $attatch1_src);
$stmt->bindParam(':attatch2', $attatch2_src);
$stmt->execute();
//整機單價

20
wms/mkt/api/postPricereviewSign.php

@ -31,11 +31,21 @@ try{
$stmt->bindParam(':sign_id', $sign_id);
$stmt->execute();
$sql_str = "UPDATE pricereview_main SET status=:status WHERE id = :id ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $result);
$stmt->bindParam(':id', $mid);
$stmt->execute();
if($sign == 3){
$sql_str = "UPDATE pricereview_main SET status=:status, updated_at=:updated_at WHERE id = :id ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $result);
$stmt->bindParam(':id', $mid);
$stmt->bindParam(':updated_at', $updated_at);
$stmt->execute();
}else{
$sql_str = "UPDATE pricereview_main SET status=:status WHERE id = :id ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $result);
$stmt->bindParam(':id', $mid);
$stmt->execute();
}
include_once "./postSystemNotice.php";
$sql_str = "SELECT * FROM pricereview_main WHERE id = :id ORDER BY id DESC LIMIT 1";

9
wms/mkt/pricereview-index.php

@ -392,13 +392,15 @@ if ($data) :
<th>總經理</th>
<th>狀態</th>
<th>合約書申請</th>
<?php if($user_id == "M0060"): ?>
<th>送審時間</th>
<?php endif ; ?>
<!--<th>修改</th>-->
</tr>
</thead>
<tbody>
<?php
foreach ($data as $data) :
$sign1 = $sign2 = $sign3 = $sign4 = "";
$oneself = ($data["creater"] == $user_id) ? 1 : 0; // 是否為營業員本人
// 簽核狀況
@ -741,6 +743,11 @@ if ($data) :
<a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載</a>
<?php endif; ?>
</td>
<?php if($user_id == "M0060"): ?>
<td>
<?php echo $data['updated_at']; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>

3
wms/mkt/pricereviewCreate.php

@ -49,12 +49,11 @@ $hope_status = [
$sql_str = "SELECT hope_elevator_customer.*, code.content AS source_content, account.name AS salesman_name FROM hope_elevator_customer
LEFT JOIN code ON code.code_name = hope_elevator_customer.source
LEFT JOIN account ON account.accountid = hope_elevator_customer.salesman
WHERE hope_elevator_customer.vol_no = :vol_no AND code.field_name = 'customer_source'";
WHERE hope_elevator_customer.vol_no = :vol_no ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $vol_no);
$stmt->execute();
$hope_customer = $stmt->fetch(PDO::FETCH_ASSOC);
if($user_id !== $hope_customer['salesman'] && $user_id !== "M0174"){
echo "<script>alert('無權限編輯此紀錄!您不是該單營業員。');window.history.go(-1);</script>";
exit;

Loading…
Cancel
Save