64 changed files with 5777 additions and 1044 deletions
Binary file not shown.
@ -0,0 +1,516 @@ |
|||||
|
<?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 AS checkBillNo, |
||||
|
acb_tmp.RowCode2, |
||||
|
acb_tmp.checkOAmount, |
||||
|
asim.BillNo AS BillNo3, |
||||
|
asim.InvoiceName, |
||||
|
asim.OAmountWithTax AS InvoiceOAmount, |
||||
|
asi.InvoiceNo, |
||||
|
asi.InvoiceTime |
||||
|
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 |
||||
|
WHERE 1 = 1 |
||||
|
"; |
||||
|
|
||||
|
//核銷單 SQL |
||||
|
$sql_writeOff = "SELECT |
||||
|
wod.FromBillNo AS checkBillNo, |
||||
|
arCheckBill.LAmountWithTax, |
||||
|
SUM(wod.CurrWriteOffLAmount) AS TotalWriteOffAmount |
||||
|
FROM arWriteOffBillDetail AS wod |
||||
|
LEFT JOIN arCheckBill |
||||
|
ON arCheckBill.BillNo = wod.FromBillNo |
||||
|
LEFT JOIN comDepartment AS cd |
||||
|
ON cd.DeptId = arCheckBill.DeptId |
||||
|
WHERE arCheckBill.TypeId = 'RVS'"; |
||||
|
|
||||
|
$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'"; |
||||
|
$sql_writeOff .= " AND (arCheckBill.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')"; |
||||
|
$sql_writeOff .= " OR arCheckBill.PersonId IN $column_str OR cd.LeaderId = '$user_id')"; |
||||
|
} else { |
||||
|
$sql .= " OR cd.LeaderId = '$user_id')"; |
||||
|
$sql_writeOff .= " 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 .= " |
||||
|
ORDER BY |
||||
|
siam.PersonId ASC, |
||||
|
siam.BillNo ASC, |
||||
|
siamd.RowCode ASC"; |
||||
|
$sql_writeOff.=" GROUP BY |
||||
|
wod.FromBillNo |
||||
|
,arCheckBill.LAmountWithTax"; |
||||
|
|
||||
|
$writeoff = array(); |
||||
|
$query_T8 = $conn->query($sql); |
||||
|
$rows = $query_T8->fetchAll(PDO::FETCH_ASSOC); |
||||
|
$query_writeoff = $conn->query($sql_writeOff); |
||||
|
foreach($query_writeoff->fetchAll(PDO::FETCH_ASSOC) as $row){ |
||||
|
$writeoff[$row['checkBillNo']]= ($row['TotalWriteOffAmount']==$row['LAmountWithTax'])?'V':'X'; |
||||
|
} |
||||
|
|
||||
|
$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'])); |
||||
|
$receivable_date = $data[$tmpname]['CU_EstPayDate']; |
||||
|
$data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V'; |
||||
|
$datahavetopay = strtotime($row['CU_EstPayDate']) > $today ? 0 : 1; |
||||
|
$data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate'])); |
||||
|
$data[$tmpname]['invoicedate'] = is_null($row['InvoiceTime']) ? null : date('Y-m-d', strtotime($row['InvoiceTime'])); |
||||
|
$invoicedate = $data[$tmpname]['invoicedate']; |
||||
|
$data[$tmpname]['invoice'] = is_null($data[$tmpname]['invoicedate']) ? 0 : 1; |
||||
|
if(!is_null($data[$tmpname]['checkBillNo']) && isset($writeoff[$data[$tmpname]['checkBillNo']])){ |
||||
|
$data[$tmpname]['WriteOff'] = $writeoff[$data[$tmpname]['checkBillNo']]; |
||||
|
}else{ |
||||
|
$data[$tmpname]['WriteOff'] = '--'; |
||||
|
} |
||||
|
$contract_no = $row['ProjectId']; |
||||
|
$facility_no = $row['CU_MaterialId']; |
||||
|
$RowCode = $row['RowCode']; |
||||
|
$BillNo = $row['BillNo']; |
||||
|
$data[$tmpname]['receivable_date'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); |
||||
|
$budget = $row['OAmountWithTax']; |
||||
|
$invoiceNo = $row['InvoiceNo']; |
||||
|
$tableinvoice_state = is_null($invoiceNo) ? 0 : 1; |
||||
|
$data[$tmpname]['invoice_budget'] = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount']; |
||||
|
$invoice_budget = $data[$tmpname]['invoice_budget']; |
||||
|
$table_writeoff = ($data[$tmpname]['WriteOff'] =='V') ? 1 : 0; |
||||
|
$table1 = "INSERT INTO account_receivable_maintainance( |
||||
|
`contract_no`, |
||||
|
`facility_no`, |
||||
|
`RowCode`, |
||||
|
`BillNo`, |
||||
|
`receivable_date`, |
||||
|
`budget`, |
||||
|
`receivable`, |
||||
|
`invoice_state`, |
||||
|
`invoice_budget`, |
||||
|
`received` |
||||
|
"; |
||||
|
$table2 = ") VALUES( |
||||
|
'$contract_no', |
||||
|
'$facility_no', |
||||
|
'$RowCode', |
||||
|
'$BillNo', |
||||
|
'$receivable_date', |
||||
|
$budget, |
||||
|
$datahavetopay, |
||||
|
$tableinvoice_state, |
||||
|
$invoice_budget, |
||||
|
$table_writeoff |
||||
|
"; |
||||
|
$table1 .= is_null($invoicedate) ? "" : ",`invoice_date`"; |
||||
|
$table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'"; |
||||
|
$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-maintainance-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-md">搜尋</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="number" class='form-control' id='search_collectstart' name='search_collectstart' style='width:30%;display:inline;' onblur="searchFront('collectstart')"> |
||||
|
≤ 催收次數 ≤ |
||||
|
<input type="number" class='form-control' id='search_collectend' name='search_collectend' style='width:30%;display:inline;' onblur="searchFront('collectend')"> |
||||
|
</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')"> |
||||
|
</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: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 class="CBudget"><?= number_format(round($row['OAmountWithTax'])); ?></td> |
||||
|
<td><?= $row['WriteOff']; ?></td> |
||||
|
|
||||
|
<td class="collect"><?= (($row['havetopay'] == "V") && ($row['WriteOff'] !== 'V'))? $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: |
||||
|
// })); |
||||
|
|
||||
|
// } |
||||
|
|
||||
|
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> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,146 @@ |
|||||
|
<?php |
||||
|
include_once("../header.php"); |
||||
|
// require_once('./connT8.php'); |
||||
|
require("../contract/conn.php"); |
||||
|
$now = date("Y-m-d"); |
||||
|
$oneMonthAgo = date("Y-m-d", strtotime("$now +1 months")); |
||||
|
$oneMonthAgo1 = date("m", strtotime($oneMonthAgo)); |
||||
|
$clause = ""; |
||||
|
if ($_GET['check'] == 'maintainance') { |
||||
|
if (!empty($_GET)) { |
||||
|
$month = $_GET['months_select']; |
||||
|
$years = $_GET['years']; // 當前年份 |
||||
|
$days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $years); |
||||
|
$select_date = date("$years-$month-01"); |
||||
|
$select_date1 = date("$years-$month-$days_in_month"); |
||||
|
echo $select_date1; |
||||
|
$clause .= "AND pay_day_due >='$select_date' AND pay_day_due <= '$select_date1' "; |
||||
|
} else { |
||||
|
$clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo' "; |
||||
|
} |
||||
|
|
||||
|
// $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo' "; |
||||
|
$sql = "SELECT a.receiver,a.amount,b.name FROM bonus AS a |
||||
|
LEFT JOIN account AS b ON a.receiver = b.accountid |
||||
|
WHERE 1=1 AND contract_type = 3 $clause ORDER BY a.receiver ASC"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$results = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
$person_arr = []; |
||||
|
$bonus_arr = []; |
||||
|
$count = 0; |
||||
|
|
||||
|
$a = 0; |
||||
|
$j = 0; |
||||
|
} |
||||
|
|
||||
|
for ($i = 0; $i < COUNT($results); $i++) { |
||||
|
$a++; |
||||
|
if ($i + 1 < COUNT($results)) { |
||||
|
if ($results[$i]['receiver'] != $results[$i + 1]['receiver']) { |
||||
|
$amount = 0; |
||||
|
if ($i != $j) { |
||||
|
for ($j; $j <= $i; $j++) { |
||||
|
$amount += $results[$j]['amount']; |
||||
|
} |
||||
|
$person_arr['person_id'] = $results[$i]['receiver']; |
||||
|
$person_arr['person'] = $results[$i]['name']; |
||||
|
$person_arr['bonus'] = $amount; |
||||
|
array_push($bonus_arr, $person_arr); |
||||
|
} else { |
||||
|
$amount += $results[$j]['amount']; |
||||
|
$person_arr['person_id'] = $results[$i]['receiver']; |
||||
|
$person_arr['person'] = $results[$i]['name']; |
||||
|
$person_arr['bonus'] = $amount; |
||||
|
array_push($bonus_arr, $person_arr); |
||||
|
} |
||||
|
|
||||
|
$j = $i + 1; |
||||
|
} |
||||
|
} else { |
||||
|
$amount = 0; |
||||
|
for ($j; $j <= $i; $j++) { |
||||
|
$amount += $results[$j]['amount']; |
||||
|
} |
||||
|
$amount += $results[$i]['amount']; |
||||
|
$person_arr['person_id'] = $results[$i]['receiver']; |
||||
|
$person_arr['bonus'] = $amount; |
||||
|
$person_arr['person'] = $results[$i]['name']; |
||||
|
array_push($bonus_arr, $person_arr); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
?> |
||||
|
<div style="overflow-x:auto;margin-top:12px"> |
||||
|
<!-- <a href="contract-newelevator-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
||||
|
<span class="glyphicon glyphicon-plus"></span> |
||||
|
</a> --> |
||||
|
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style='text-align:center'><?= !empty($years) ? $years : date('Y') ?>年<?= !empty($month) ? $month : $oneMonthAgo1 ?>月份、個人獎金計算</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
|
||||
|
</thead> |
||||
|
</table> |
||||
|
<form method='get' action=''> |
||||
|
<table class='table table-striped table-bordered' style='width:70%;text-align:center;margin:0 auto'> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<th style="text-align:center;vertical-align:middle;">年份</th> |
||||
|
<td> |
||||
|
<select name="years" id=""> |
||||
|
<?php for ($i = 2020; $i <= 2030; $i++) { ?> |
||||
|
<option value="<?= $i ?>" <?php echo isset($_GET["years"]) && $_GET["years"] == $i ? 'selected' : ''; ?>> |
||||
|
<?= $i ?> |
||||
|
</option> <?php } ?> |
||||
|
</select> |
||||
|
</td> |
||||
|
<th style="text-align:center;vertical-align:middle;">月份</th> |
||||
|
<td> |
||||
|
<select name="months_select" id=""> |
||||
|
<?php for ($i = 1; $i <= 12; $i++) { ?> |
||||
|
<option value="<?= $i ?>" <?php echo isset($_GET["months_select"]) && $_GET["months_select"] == $i ? 'selected' : ''; ?>> |
||||
|
<?= $i ?> |
||||
|
</option> <?php } ?> |
||||
|
</select> |
||||
|
</td> |
||||
|
<!-- <td><input type="text" class="form-control" name="months_select" value="<?php if (isset($_GET["facilityno"])) echo $_GET["facilityno"]; ?>"></td> --> |
||||
|
<!--<th>保養員姓名</th> --> |
||||
|
<td style="text-align:center;vertical-align:middle;width:80px"><button type="submit" style='text-align:center; margin:0 auto' class="btn btn-info btn-sm">查詢</button></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<input type="hidden" name="function_name" value="schedule_index"> |
||||
|
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
||||
|
</form> |
||||
|
|
||||
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<!-- <th>項次</th> --> |
||||
|
<th>工號</th> |
||||
|
<th>姓名</th> |
||||
|
<th>總獎金水庫(實發總價)</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
<?php |
||||
|
if (!empty($bonus_arr)) { |
||||
|
foreach ($bonus_arr as $key => $bonus) { |
||||
|
?> |
||||
|
<tr> |
||||
|
<!-- <td><?php echo $key ?></td> --> |
||||
|
<td><?php echo $bonus['person_id'] ?></td> |
||||
|
<td><?php echo $bonus['person'] ?></td> |
||||
|
<td><?php echo $bonus['bonus'] ?></td> |
||||
|
</tr> |
||||
|
<?php } |
||||
|
} ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
@ -0,0 +1,400 @@ |
|||||
|
<?php |
||||
|
include_once("../header.php"); |
||||
|
// require_once('./connT8.php'); |
||||
|
require("../contract/conn.php"); |
||||
|
$now = date("Y-m-d"); |
||||
|
|
||||
|
$contract_type = [ |
||||
|
'1' => '新梯', |
||||
|
'2' => '汰改', |
||||
|
'3' => '保養' |
||||
|
]; |
||||
|
|
||||
|
$bonus_type = [ |
||||
|
'1' => '契約人獎金', |
||||
|
'2' => '區經理獎金', |
||||
|
'3' => '專任契約經理獎金' |
||||
|
]; |
||||
|
|
||||
|
$bonus_status = [ |
||||
|
'1' => '未確認', |
||||
|
'2' => '應發已確認', |
||||
|
'3' => '應發未確認', |
||||
|
'4' => '暫不發放', |
||||
|
'5' => '人事審核確認' |
||||
|
]; |
||||
|
$clause = ''; |
||||
|
if ($user_id != 'M0225') { |
||||
|
$clause .= "AND receiver == '$user_id'"; |
||||
|
} |
||||
|
if (!empty($_GET['check'])) { |
||||
|
// 人事發放作業,應為一個月內 |
||||
|
if ($_GET['check'] == 4) { |
||||
|
$oneMonthAgo = date("Y-m-d", strtotime("$now +1 months")); |
||||
|
// $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo' AND status IN (1,2,5)"; |
||||
|
$clause .= "AND a.status IN (1,2,5)"; |
||||
|
} else if ($_GET['check'] == 2) { |
||||
|
$clause .= "AND a.status = 1"; |
||||
|
} else if ($_GET['check'] == 3) { |
||||
|
$clause .= "AND a.status IN (2,5)"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$sql = "SELECT a.*,b.customer FROM bonus AS a |
||||
|
LEFT JOIN con_maintance_examine_apply AS b ON a.contract_no = b.vol_no |
||||
|
WHERE 1=1 $clause AND a.contract_type = 1 ORDER BY a.id DESC"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
|
||||
|
$now = new DateTime(); |
||||
|
$oneMonthAgo = $now->modify('+1 month'); |
||||
|
|
||||
|
|
||||
|
$id = []; |
||||
|
foreach ($datas as $data) { |
||||
|
$id[] = $data['id']; |
||||
|
} |
||||
|
$id_str = implode(',', $id); |
||||
|
|
||||
|
// 查看 T8 是否有收款明細 |
||||
|
// require("./api/get.php"); |
||||
|
function isPay($contract_no, $connT8) |
||||
|
{ |
||||
|
// echo $contract_no; |
||||
|
$sql = "SELECT |
||||
|
a.BillNo, |
||||
|
b.OTaxAmt as amount, |
||||
|
a.CU_EstPayDate as createDate, |
||||
|
b.PersonId as personId, |
||||
|
c.BillNo as CBno, |
||||
|
c.CU_MaterialId as facility |
||||
|
FROM salIncomeApplyDetail as a |
||||
|
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
||||
|
LEFT JOIN ( |
||||
|
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
||||
|
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
||||
|
WHERE aMaster.BizPartnerId = '$contract_no' AND aMaster.TypeId = 'RVS' |
||||
|
) AS c ON a.BillNo = c.BizPartnerId |
||||
|
WHERE a.BillNo = '$contract_no' |
||||
|
AND a.RowNo = '1' |
||||
|
"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// $data['amount'] = intval($data['amount']); |
||||
|
if (!empty($data['CBno']) && $data['CBno'] != '') { |
||||
|
$checkBillNo = $data['CBno']; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
c.BillDate AS CheckBillDate |
||||
|
FROM arWriteOffBill AS a |
||||
|
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
||||
|
LEFT JOIN |
||||
|
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
||||
|
FROM arCheckBill |
||||
|
LEFT JOIN arCheckBillInvInfo |
||||
|
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
||||
|
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
||||
|
ON a.BillNo=c.BillNo |
||||
|
WHERE c.checkBillNo = '$checkBillNo' |
||||
|
"; |
||||
|
|
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
|
||||
|
return '1'; |
||||
|
} else { |
||||
|
return '2'; |
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.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" /> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<!-- <script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> --> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
<div class="bonus_index" x-data="bonusIndexTest"> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data"> |
||||
|
<div style="overflow-x:auto;margin-top:12px"> |
||||
|
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style='text-align:center'>(契約)獎金計算</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
|
||||
|
</thead> |
||||
|
</table> |
||||
|
<!-- <a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm">
|
||||
|
<span class="glyphicon glyphicon-plus"></span> |
||||
|
</a> --> |
||||
|
<a href="/wms/bonus/new_bonus.php?function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有獎金</a> |
||||
|
<!-- <a href="/wms/bonus/bonus.php?check=1&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 應發獎金</a> --> |
||||
|
<a href="/wms/bonus/new_bonus.php?check=2&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 未發獎金</a> |
||||
|
<a href="/wms/bonus/new_bonus.php?check=3&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 已發獎金</a> |
||||
|
<a href="/wms/bonus/new_bonus.php?check=4&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 4) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 人事發放作業</a> |
||||
|
<a href="/wms/bonus/bonus_person.php?check=new&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 5) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 獎金總計(人)</a> |
||||
|
|
||||
|
|
||||
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
||||
|
<?php if (!empty($_GET['check']) && $_GET['check'] == '4') { ?> |
||||
|
<button class="btn btn-primary float-end" style="float: right;" onclick="All('<?= $id_str ?>')">鎖定並發放</button> |
||||
|
<?php } ?> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>項次</th> |
||||
|
<th>合約號</th> |
||||
|
<th>合約名稱</th> |
||||
|
<th>作番號</th> |
||||
|
<th>獎金類別</th> |
||||
|
<th>獎金版本</th> |
||||
|
<th>作番金額(月)</th> |
||||
|
<th>牌價</th> |
||||
|
<th>服務費</th> |
||||
|
<th>應發人員</th> |
||||
|
<th>應發獎金水庫</th> |
||||
|
<th>實發金額</th> |
||||
|
<th>狀態</th> |
||||
|
<?php |
||||
|
if (!empty($_GET['check']) && $_GET['check'] == '4') { |
||||
|
?> |
||||
|
<th>實際發放時間</th> |
||||
|
<th>發放 / 詳情</th> |
||||
|
|
||||
|
<?php } else { ?> |
||||
|
<!-- <th>詳情</th> --> |
||||
|
<?php |
||||
|
} ?> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php if (!empty($datas)) { |
||||
|
foreach ($datas as $key => $data) : |
||||
|
$bonus_json = json_decode($data['bonus_json']); |
||||
|
$bonus_kind = !empty($bonus_json->bonus_kind) ? $bonus_json->bonus_kind : ''; |
||||
|
$contract_no = $data['contract_no']; |
||||
|
$json = json_decode($data['bonus_json']); |
||||
|
$total = empty($json->total) ? 0 : $json->total; |
||||
|
$fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; |
||||
|
$commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; |
||||
|
// $isPay = isPay($data['contract_no'], $connT8); |
||||
|
|
||||
|
?> |
||||
|
<tr> |
||||
|
<td><?= $data['id'] ?></td> |
||||
|
<td><?= $data['contract_no'] ?></td> |
||||
|
<td><?= $data['customer'] ?></td> |
||||
|
<td><?= $data['facility_no'] ?></td> |
||||
|
<td><?php echo $bonus_type[$data['bonus_type']] . '-' . $bonus_kind ?></td> |
||||
|
<td><?= $data['bonus_verson'] ?></td> |
||||
|
<td><?= $fee_per_st ?></td> |
||||
|
<td><?= $total ?></td> |
||||
|
<td><?= $commission_fee ?></td> |
||||
|
<td><?= $data['receiver'] ?></td> |
||||
|
<td><?= $data['amount'] ?></td> |
||||
|
<td><?= $data['bonus_actual'] ?></td> |
||||
|
<td> |
||||
|
<?= $bonus_status[$data['status']] ?> |
||||
|
<!-- <span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span> --> |
||||
|
</td> |
||||
|
<?php if (!empty($_GET['check']) && $_GET['check'] == '4') { |
||||
|
if ($data['status'] == '3' || $data['status'] == '1') { ?> |
||||
|
<td> -- </td> |
||||
|
<td> |
||||
|
<?php |
||||
|
// if ($isPay == 1) { |
||||
|
?> |
||||
|
<button onclick="issue(<?= $data['id'] ?>,'<?= $user_id ?>','<?= $data['pay_day_due'] ?>','<?= $data['amount'] ?>')" type="button" class="btn applybtn" name='issuePay'>發放獎金</button> |
||||
|
<?php |
||||
|
|
||||
|
// } else if ($payday < $oneMonthAgo) { |
||||
|
?> |
||||
|
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a> |
||||
|
<?php |
||||
|
// } |
||||
|
?> |
||||
|
</td> |
||||
|
<!-- <td><input type="date" value="<?= $data['pay_day'] ?>"></td> --> |
||||
|
|
||||
|
<?php } else { ?> |
||||
|
<td><?= $data['pay_day'] ?></td> |
||||
|
<td><a href="bonus_check.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a></td> |
||||
|
|
||||
|
<?php } |
||||
|
} else { ?> |
||||
|
<!-- <td><a href="bonus_check.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a></td> --> |
||||
|
|
||||
|
<?php } ?> |
||||
|
</tr> |
||||
|
<?php |
||||
|
endforeach; |
||||
|
} ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- </div> --> |
||||
|
|
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
.width_st yle_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.btn-secondary { |
||||
|
color: #fff; |
||||
|
background-color: #6c757d; |
||||
|
border-color: #6c757d; |
||||
|
} |
||||
|
|
||||
|
.btn-secondary:hover { |
||||
|
color: #fff; |
||||
|
background-color: #5a6268; |
||||
|
border-color: #545b62; |
||||
|
} |
||||
|
|
||||
|
.applybtn { |
||||
|
color: #fff; |
||||
|
background-color: #1484c4; |
||||
|
/* display: block; */ |
||||
|
border-radius: 5px; |
||||
|
/* padding: 5px 2px; */ |
||||
|
font-size: 13px; |
||||
|
line-height: 1; |
||||
|
display: grid; |
||||
|
place-items: center; |
||||
|
/* 水平和垂直居中 */ |
||||
|
/* height: 2%vh; */ |
||||
|
/* 100%视窗高度,可根据需要调整 */ |
||||
|
} |
||||
|
|
||||
|
.applybtncheck { |
||||
|
color: #fff; |
||||
|
background-color: #eea236; |
||||
|
/* display: block; */ |
||||
|
border-radius: 4px; |
||||
|
padding: 4px 2px; |
||||
|
font-size: 13px; |
||||
|
line-height: 1; |
||||
|
display: grid; |
||||
|
place-items: center; |
||||
|
/* 水平和垂直居中 */ |
||||
|
height: 2%vh; |
||||
|
/* 100%视窗高度,可根据需要调整 */ |
||||
|
} |
||||
|
|
||||
|
.applybtncheck:hover { |
||||
|
background-color: #f0ad4e; |
||||
|
color: #fff; |
||||
|
} |
||||
|
|
||||
|
.applybtn:hover { |
||||
|
background-color: #1494f9; |
||||
|
color: #fff; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<script> |
||||
|
const datas = <?php echo json_encode($datas); ?>; |
||||
|
|
||||
|
function issue(id, user_id, pay_day, amount) { |
||||
|
// console.log(id); |
||||
|
const form = new FormData(); |
||||
|
form.append('id', id) |
||||
|
form.append('user_id', user_id); |
||||
|
form.append('pay_day', pay_day) |
||||
|
form.append('amount', amount); |
||||
|
form.append('postType', 'a'); |
||||
|
form.append('contract_type', 'new'); |
||||
|
axios.post('./api/postStatus.php', form).then((res) => { |
||||
|
if (res.data == 'Success') { |
||||
|
alert('更新成功'); |
||||
|
location.reload(); |
||||
|
} |
||||
|
}).catch((err) => { |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
function All(data) { |
||||
|
let arr = data.split(","); |
||||
|
const form = new FormData(); |
||||
|
form.append('id', arr); |
||||
|
form.append('user_id', '<?= $user_id ?>') |
||||
|
form.append('postType', 'd'); |
||||
|
if (confirm('是否發放全部獎金')) { |
||||
|
axios.post('./api/postStatus.php', form).then((res) => { |
||||
|
if (res.status == 200) { |
||||
|
alert('更新成功'); |
||||
|
location.reload(); |
||||
|
} |
||||
|
}).catch((err) => { |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
// $(function() { |
||||
|
// $("button[name=issuePay]").click(function() { |
||||
|
// console.log(123); |
||||
|
// }) |
||||
|
// }) |
||||
|
// function init() { |
||||
|
// this.isPay(); |
||||
|
|
||||
|
// } |
||||
|
// const bonusIndex = () => { |
||||
|
// return { |
||||
|
// async isPay() { |
||||
|
// // console.log(123) |
||||
|
// for (let i = 0; i < datas.length; i++) { |
||||
|
// await axios.get('./api/get.php?contract_no=' + datas[i].contract_no).then(res => { |
||||
|
// let isPay = res.data; |
||||
|
// // this.data.isPay.push(isPay); // 更新 x-data 中的数据 |
||||
|
// this.isPays.push(isPay); |
||||
|
// }).catch(err => { |
||||
|
|
||||
|
// }) |
||||
|
// } |
||||
|
|
||||
|
// console.log(this.isPays); |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
</script> |
@ -0,0 +1,311 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期, |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function maintenance_longterm_contract_m1_free_charge_bonus_v2_1($ver, $contract_type, $payment_period, $payment_period_amount, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id = '') |
||||
|
{ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1") { |
||||
|
$discount = ($fee_per_st - $commission_fee) / $elevator_list_price; |
||||
|
#契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge) |
||||
|
switch ($contract_type) { |
||||
|
case "longcontract_m1_free_charge": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st < 3000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.6; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3000 and $fee_per_st < 4000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.7; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000 and $fee_per_st < 5000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.8; |
||||
|
break; |
||||
|
case ($fee_per_st >= 5000 and $fee_per_st < 6000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.9; |
||||
|
break; |
||||
|
case ($fee_per_st >= 6000): |
||||
|
$sales_bonus = ($fee_per_st) * 1.0; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount >= 0.6 and $discount < 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st < 3000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.42; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3000 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.49; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000 and $fee_per_st < 5000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st >= 5000 and $fee_per_st < 6000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.63; |
||||
|
break; |
||||
|
case ($fee_per_st >= 6000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.7; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount < 0.6): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st < 3000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3000 and $fee_per_st < 4000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000 and $fee_per_st < 5000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.4; |
||||
|
break; |
||||
|
case ($fee_per_st >= 5000 and $fee_per_st < 6000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.45; |
||||
|
break; |
||||
|
case ($fee_per_st >= 6000): |
||||
|
$sales_bonus = ($fee_per_st) * 0.5; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
}; |
||||
|
#付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "2", #獎金名稱 |
||||
|
"bonus_receiver" => $region_director_id, #發放人員 |
||||
|
"bonus_amount" => round($region_director_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +12 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "訂金收回後次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#專任契約經理獎金 |
||||
|
if ($regular_contract_manger_id != '') { |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "3", #獎金名稱 |
||||
|
"bonus_receiver" => $regular_contract_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($regular_contract_manger_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +12 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "訂金收回後次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
#地區處長獎金、專任契約經理、契約員獎金 |
||||
|
switch ($payment_period) { |
||||
|
#簽長約免費贈送控制系統,因屬於公司特殊政策,所以無汰改獎金,合約期內每月領取契約獎金 |
||||
|
#總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期, |
||||
|
#年繳 |
||||
|
case 'annually': |
||||
|
$payment_ratio_due_array = array(); |
||||
|
$a = $payment_period_amount / 12; |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1 / $a); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payday_due_array, $i + 1); |
||||
|
} |
||||
|
|
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] year")), #預計發放時間 |
||||
|
"bonus_regulation" => "每次收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
break; |
||||
|
#半年繳 |
||||
|
case 'semiannually': |
||||
|
$payment_ratio_due_array = array(); |
||||
|
$a = $payment_period_amount / 6; |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1 / $a); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payday_due_array, ($i + 1) * 6); |
||||
|
} |
||||
|
|
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每次收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
#季繳 |
||||
|
case 'quarterly': |
||||
|
$a = $payment_period_amount / 3; |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1 / $a); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payday_due_array, ($i + 1) * 4); |
||||
|
} |
||||
|
|
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
#雙月繳 |
||||
|
case 'bimonthly': |
||||
|
$a = $payment_period_amount / 2; |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1 / $a); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $a; $i++) { |
||||
|
array_push($payday_due_array, ($i + 1) * 2); |
||||
|
} |
||||
|
|
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
break; |
||||
|
#月繳 |
||||
|
case 'monthly': |
||||
|
|
||||
|
#產生契約員每個月的獎金應發比例 |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1 / $payment_period_amount); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payday_due_array, $i + 1); |
||||
|
} |
||||
|
|
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver" => $ver, #獎金版本 |
||||
|
"result_status" => "success", #計算結果 |
||||
|
"bonus_array" => $bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} else { |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"pay_day_due" => "9999-1-1", #預計發放時間 |
||||
|
"bonus_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
$result_array = [ |
||||
|
"ver" => $ver, #獎金版本 |
||||
|
"result_status" => "error", #計算結果 |
||||
|
"bonus_array" => $bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
@ -0,0 +1,44 @@ |
|||||
|
<?php |
||||
|
|
||||
|
require_once "../../mkt/conn.php"; |
||||
|
|
||||
|
$spec = $_GET['spec']; |
||||
|
$person = $_GET['person']; |
||||
|
$stop = $_GET['stop']; |
||||
|
$weight = $_GET['weight']; |
||||
|
$speed = $_GET['speed']; |
||||
|
$m1 = $_GET['m1']; |
||||
|
$method = $_GET['method']; |
||||
|
$cycle = $_GET['cycle']; |
||||
|
if($spec == "MAE100"){ |
||||
|
$elevator_type = "A"; |
||||
|
}elseif($spec == "MAF100"){ |
||||
|
$elevator_type = "B"; |
||||
|
}elseif($spec == "MAM200"){ |
||||
|
$elevator_type = "D"; |
||||
|
}elseif($spec == "MAH100"){ |
||||
|
$elevator_type = "E"; |
||||
|
} |
||||
|
|
||||
|
$sql_str = "SELECT * FROM maintain_standard_option WHERE elevator_type=:elevator_type AND min_speed = :min_speed AND min_persons <= :person AND max_persons >= :person AND is_m1_bundle=:m1 ORDER bY id DESC"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':elevator_type', $elevator_type); |
||||
|
$stmt->bindParam(':min_speed', $speed); |
||||
|
$stmt->bindParam(':person', $person); |
||||
|
$stmt->bindParam(':m1', $m1); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
if(!$result){ |
||||
|
echo 0; |
||||
|
exit; |
||||
|
} |
||||
|
$differ = $stop > $result['max_floors'] ? $result['max_floors'] - $result['min_floors'] : ($stop - $result['min_floors']); |
||||
|
$price = $result['base_price'] + $differ * $result['floors_price'] +$result['m1_bundle_fee']; |
||||
|
if($cycle == 2){ |
||||
|
$price += $price * $result['maintenance_fee_coefficient']; |
||||
|
} |
||||
|
if($method == "A"){ |
||||
|
$price += $result['all_inclusive_fee']; |
||||
|
} |
||||
|
|
||||
|
echo $price; |
@ -0,0 +1,333 @@ |
|||||
|
@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 { |
||||
|
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-modal-content input[type=number]::-webkit-outer-spin-button, |
||||
|
.window-modal .window-modal-content input[type=number]::-webkit-inner-spin-button { |
||||
|
-webkit-appearance: none; |
||||
|
margin: 0; |
||||
|
} |
||||
|
.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 */ |
@ -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,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;ACWQ;;EAEI,wBAAA;EACA,SAAA;ADTZ;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"} |
@ -0,0 +1,352 @@ |
|||||
|
#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{ |
||||
|
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; |
||||
|
} |
||||
|
} |
||||
|
input[type=number]::-webkit-outer-spin-button, |
||||
|
input[type=number]::-webkit-inner-spin-button { |
||||
|
-webkit-appearance: none; |
||||
|
margin: 0; |
||||
|
} |
||||
|
} |
||||
|
.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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,338 @@ |
|||||
|
const pricereviewCreate = ()=>{ |
||||
|
return { |
||||
|
init(){ |
||||
|
console.log(123); |
||||
|
}, |
||||
|
modalShow:{ |
||||
|
elevator: false, |
||||
|
other:false, |
||||
|
otherToElevator:false, |
||||
|
}, |
||||
|
vol_no: vol_no, |
||||
|
apply_key: apply_key, |
||||
|
customer:customer, |
||||
|
manager:manager, |
||||
|
salesman:salesman, |
||||
|
salesman_name:salesman_name, |
||||
|
pre_order_date:pre_order_date, |
||||
|
address:address, |
||||
|
progress_status:progress_status, |
||||
|
total_spec:0, |
||||
|
elevators:[], |
||||
|
case_name:'', //案件名稱
|
||||
|
contract_status:'', // 契約性質
|
||||
|
pay_method:'', // 付款方式
|
||||
|
startDate:'', //合約開始日期
|
||||
|
endDate:'', // 合約結束日期
|
||||
|
modalElevatorInfo:{ |
||||
|
spec:'', |
||||
|
person:'', |
||||
|
weight:'', |
||||
|
stop:'', |
||||
|
speed:'', |
||||
|
permitNumber:'', //許可證號碼
|
||||
|
brand:'', //品牌
|
||||
|
m1:'N', //贈送M1
|
||||
|
months:'', // 保養月數
|
||||
|
cycle:'', // 保養週期
|
||||
|
method:'', //保養方式
|
||||
|
checkYear:'', //竣工檢查年度
|
||||
|
lastDate:'', // 上次年檢日期
|
||||
|
yearCheckFee:'', //年檢費用
|
||||
|
price:'', //公司發布價(月)
|
||||
|
qty:1, //電梯數量
|
||||
|
sale_price:'', //契約報價
|
||||
|
}, |
||||
|
otherOptions: [], |
||||
|
modalOtherOptionInfo:{ |
||||
|
pr_no:"", |
||||
|
name:"", |
||||
|
price: 0, |
||||
|
num:"", |
||||
|
}, |
||||
|
otherOptionKey:0, |
||||
|
currentOtherOptionKey:'', |
||||
|
toElevators:[], |
||||
|
toElevatorNo:'', |
||||
|
serviceFee:0, |
||||
|
remark:'', |
||||
|
penalty:'', |
||||
|
deposit_rate:'', |
||||
|
keep_rate:'', |
||||
|
warranty_rate:'', |
||||
|
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:'N', //贈送M1
|
||||
|
months:'', // 保養月數
|
||||
|
cycle:'', // 保養週期
|
||||
|
method:'', //保養方式
|
||||
|
checkYear:'', //竣工檢查年度
|
||||
|
lastDate:'', // 上次年檢日期
|
||||
|
yearCheckFee:'', //年檢費用
|
||||
|
price:'', //公司發布價(月)
|
||||
|
qty:1, //電梯數量
|
||||
|
sale_price:'', //契約報價
|
||||
|
}; |
||||
|
}, |
||||
|
createElevatorFn(){ |
||||
|
// if(this.modalElevatorInfo.spec == '') return alert("請選擇電梯規格");
|
||||
|
// if(this.modalElevatorInfo.person == '') return alert("請選擇人乘");
|
||||
|
// if(this.modalElevatorInfo.weight == '') return alert("請輸入載重");
|
||||
|
// if(this.modalElevatorInfo.stop == '') return alert("請輸入停數");
|
||||
|
// if(this.modalElevatorInfo.speed == '') return alert("請選擇速度");
|
||||
|
// if(this.modalElevatorInfo.brand == '') return alert("請選擇品牌");
|
||||
|
// if(this.modalElevatorInfo.months == '') return alert("請輸入保養月數");
|
||||
|
// if(this.modalElevatorInfo.method == '') return alert("請選擇保養方式");
|
||||
|
// if(this.modalElevatorInfo.cycle == '') return alert("請選擇保養週期");
|
||||
|
// if(this.modalElevatorInfo.checkYear == '') return alert("請輸入竣工檢查年度");
|
||||
|
// if(this.modalElevatorInfo.price == '') return alert("請選擇正確規格");
|
||||
|
// if(this.modalElevatorInfo.sale_price == '') return alert("請輸入契約報價");
|
||||
|
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, |
||||
|
method:this.modalElevatorInfo.method, // 保養方法
|
||||
|
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 brand = this.elevators[idx].brand; |
||||
|
const m1 = this.elevators[idx].m1; |
||||
|
const months = this.elevators[idx].months; |
||||
|
const method = this.elevators[idx].method; |
||||
|
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: '', |
||||
|
brand: brand, |
||||
|
m1: m1, |
||||
|
months: months, |
||||
|
method: method, |
||||
|
cycle: cycle, |
||||
|
checkYear: checkYear, |
||||
|
lastDate: lastDate, |
||||
|
yearCheckFee: yearCheckFee, |
||||
|
price: price, |
||||
|
qty: qty, |
||||
|
sale_price: sale_price |
||||
|
}) |
||||
|
}, |
||||
|
removeElevator(id){ |
||||
|
if(!confirm('確定刪除該電梯?')) return; |
||||
|
this.elevators = this.elevators.filter(elevator=> elevator.id != id) |
||||
|
}, |
||||
|
openCreateOtherOptionFn(){ |
||||
|
this.modalShow.other = true |
||||
|
body.style.overflow = 'hidden' |
||||
|
}, |
||||
|
createOtherOptionFn(){ |
||||
|
this.otherOptionKey ++; |
||||
|
this.otherOptions.push({ |
||||
|
id: this.otherOptionKey, |
||||
|
pr_no: this.modalOtherOptionInfo.pr_no, |
||||
|
name: this.modalOtherOptionInfo.name, |
||||
|
price: this.modalOtherOptionInfo.price, |
||||
|
num: this.modalOtherOptionInfo.num, |
||||
|
toElevator:[], |
||||
|
}) |
||||
|
this.modalOtherOptionInfo = { |
||||
|
pr_no: '', |
||||
|
name: '', |
||||
|
price: 0, |
||||
|
num: '', |
||||
|
} |
||||
|
this.hideCreateOtherOptionModal(); |
||||
|
}, |
||||
|
hideCreateOtherOptionModal(){ |
||||
|
this.modalShow.other = false |
||||
|
// this.$refs.createOtherOptionModal.style.display = 'none';
|
||||
|
body.style.overflow = 'auto' |
||||
|
}, |
||||
|
addOtherOptionToElevator(id){ |
||||
|
this.currentOtherOptionKey = id; |
||||
|
this.toElevators = []; |
||||
|
this.toElevatorNo = ""; |
||||
|
const matchElevators = this.otherOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id) |
||||
|
this.toElevatorNo = matchElevators[0] |
||||
|
console.log(this.elevators); |
||||
|
this.elevators.forEach(elevator=>{ |
||||
|
if(elevator.price > 0){ |
||||
|
let model = '' |
||||
|
model = elevator.spec |
||||
|
this.toElevators.push({ |
||||
|
id: elevator.id, |
||||
|
model: model, |
||||
|
checked: matchElevators.includes(elevator.id) ? 1: 0, |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
this.modalShow.otherToElevator = true |
||||
|
body.style.overflow = 'hidden' |
||||
|
}, |
||||
|
hideToOtherOptionElevatorModal(){ |
||||
|
this.modalShow.otherToElevator = false |
||||
|
body.style.overflow = 'auto' |
||||
|
}, |
||||
|
copyOtherOption(id){ |
||||
|
this.otherOptionKey++; |
||||
|
const copyOption = this.otherOptions.filter(option=> option.id === id)[0] |
||||
|
console.log(copyOption); |
||||
|
this.otherOptions.push({ |
||||
|
id: this.otherOptionKey, |
||||
|
name: copyOption.name, |
||||
|
price: copyOption.price, |
||||
|
num: copyOption.num, |
||||
|
toElevator: [], |
||||
|
pr_no: copyOption.pr_no |
||||
|
}) |
||||
|
console.log(this.otherOptions); |
||||
|
}, |
||||
|
chkOtherOptionToElevators(){ |
||||
|
const checkedOptions = []; |
||||
|
|
||||
|
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] |
||||
|
console.log(matchElevators); |
||||
|
checkedOptions.push({ |
||||
|
id: this.toElevatorNo, |
||||
|
model: matchElevators['spec'], |
||||
|
}) |
||||
|
this.otherOptions.forEach(option=>{ |
||||
|
if(option.id == this.currentOtherOptionKey){ |
||||
|
option.toElevator = []; |
||||
|
option.toElevator.push(...checkedOptions) |
||||
|
} |
||||
|
}) |
||||
|
console.log(this.otherOptions); |
||||
|
this.currentOtherOptionKey = '' |
||||
|
|
||||
|
this.hideToOtherOptionElevatorModal(); |
||||
|
}, |
||||
|
removeOtherOption(id){ |
||||
|
this.otherOptions = this.otherOptions.filter(option=> option.id != id) |
||||
|
}, |
||||
|
get totalPrice(){ |
||||
|
let total_price = this.elevators.reduce((accumulator, el) => accumulator + Number(el.price*el.months), 0); |
||||
|
let total_other_price = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.price*option.num), 0); |
||||
|
return total_price + total_other_price; |
||||
|
}, |
||||
|
get totalSalePrice(){ |
||||
|
let total_sale_price = this.elevators.reduce((accumulator, el) => accumulator + Number(el.sale_price*el.months), 0); |
||||
|
return total_sale_price + Number(this.serviceFee); |
||||
|
}, |
||||
|
get totalElevatorsNum(){ |
||||
|
let total_num = this.elevators.reduce((accumulator, el) => accumulator + Number(el.qty), 0); |
||||
|
return total_num; |
||||
|
}, |
||||
|
get totalOtherOptionsNum(){ |
||||
|
let total_other_num = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.num), 0); |
||||
|
return total_other_num; |
||||
|
}, |
||||
|
get totalOtherOptionsPrice(){ |
||||
|
let total_other_price = this.otherOptions.reduce((accumulator, option) => accumulator + Number(option.price*option.num), 0); |
||||
|
return total_other_price; |
||||
|
}, |
||||
|
async getModalElevatorPrice(){ |
||||
|
const spec = this.modalElevatorInfo.spec |
||||
|
const person = this.modalElevatorInfo.person |
||||
|
const stop = this.modalElevatorInfo.stop |
||||
|
const weight = this.modalElevatorInfo.weight |
||||
|
const speed = this.modalElevatorInfo.speed |
||||
|
const m1 = this.modalElevatorInfo.m1 |
||||
|
const method = this.modalElevatorInfo.method |
||||
|
const cycle = this.modalElevatorInfo.cycle |
||||
|
try{ |
||||
|
const res = await axios.get('./api/getElevatorPrice.php', {params: {spec: spec, person:person, weight: weight, stop: stop, speed: speed, m1: m1, method: method, cycle:cycle}}) |
||||
|
this.modalElevatorInfo.price = res.data; |
||||
|
console.log(res.data); |
||||
|
}catch (error) { |
||||
|
console.error("Error message:", error); |
||||
|
} |
||||
|
}, |
||||
|
save(){ |
||||
|
const form = new FormData(); |
||||
|
form.append('vol_no', this.vol_no); |
||||
|
form.append('apply_key', this.apply_key); |
||||
|
form.append('customer', this.customer); |
||||
|
form.append('address', this.address); |
||||
|
form.append('case_name', this.case_name); |
||||
|
form.append('brand', this.brand); |
||||
|
form.append('num', this.totalElevatorsNum); |
||||
|
form.append('salesman', this.salesman); |
||||
|
form.append('contract_begin_date', this.startDate); |
||||
|
form.append('contract_end_date', this.endDate); |
||||
|
form.append('contract_kind', this.contract_status); |
||||
|
form.append('progress_status', this.progress_status); |
||||
|
form.append('serviceFee', this.serviceFee); |
||||
|
form.append('penalty', this.penalty); |
||||
|
form.append('deposit_rate', this.deposit_rate); |
||||
|
form.append('keep_rate', this.keep_rate); |
||||
|
form.append('warranty_rate', this.warranty_rate); |
||||
|
form.append('remark', this.remark); |
||||
|
form.append('creater', this.user_id); |
||||
|
|
||||
|
form.append('pay_method', this.pay_method); |
||||
|
form.append('status', 'Y1'); |
||||
|
|
||||
|
form.append('elevators', JSON.stringify(this.elevators)); |
||||
|
form.append('otherOptions', JSON.stringify(this.otherOptions)); |
||||
|
|
||||
|
axios.post('./api/postElevatorPricereview.php', form).then(res=>{ |
||||
|
console.log(res.data); |
||||
|
if(res.data == 'success'){ |
||||
|
alert("保存成功!"); |
||||
|
window.location.reload(); |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
submit(){ |
||||
|
|
||||
|
}, |
||||
|
} |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
<?php |
||||
|
|
||||
|
include_once "../header.php"; |
||||
|
require_once('../mkt/conn.php'); |
@ -0,0 +1,485 @@ |
|||||
|
<?php |
||||
|
|
||||
|
include_once "../header.php"; |
||||
|
require_once "../mkt/conn.php"; |
||||
|
|
||||
|
if(!(isset($_GET['vol_no']) && $_GET['vol_no'] != "")){ |
||||
|
echo "<script>alert('非法訪問!');window.history.go(-1);</script>"; |
||||
|
} |
||||
|
$vol_no = $_GET['vol_no']; |
||||
|
$sql_str = "SELECT * FROM hope_contract_customer WHERE vol_no = :vol_no"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':vol_no', $vol_no); |
||||
|
$stmt->execute(); |
||||
|
$hope_customer = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
$apply_key = getApplyKey(date('ym'), 'cmea_apply_key'); |
||||
|
echo $apply_key; |
||||
|
function getApplyKey($p_yyyymm, $seq_name){ |
||||
|
if (empty($p_yyyymm) || empty($seq_name)) return null; |
||||
|
global $conn; |
||||
|
$sql_str = "SELECT yyyymm, prefix FROM sequence WHERE seq_name = :seq_name"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':seq_name', $seq_name); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
$yyyymm = $result['yyyymm']; |
||||
|
$prefix = $result['prefix']; |
||||
|
|
||||
|
if ($p_yyyymm != $yyyymm) { |
||||
|
$sql_str = "UPDATE sequence SET yyyymm = :p_yyyymm, current_val = '10000' WHERE seq_name = :seq_name"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':p_yyyymm', $p_yyyymm); |
||||
|
$stmt->bindParam(':seq_name', $seq_name); |
||||
|
$stmt->execute(); |
||||
|
} |
||||
|
|
||||
|
$sql_str = "SELECT CONCAT(:prefix, :p_yyyymm, SUBSTRING(appwms.nextval(:seq_name), 2)) AS seq_no"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':prefix', $prefix); |
||||
|
$stmt->bindParam(':p_yyyymm', $p_yyyymm); |
||||
|
$stmt->bindParam(':seq_name', $seq_name); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
$seq_no = $result['seq_no']; |
||||
|
|
||||
|
return $seq_no; |
||||
|
} |
||||
|
?> |
||||
|
<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()> |
||||
|
<?php |
||||
|
include_once "./window-modal/modalElevaotr.php"; |
||||
|
include_once "./window-modal/otherOptionModal.php"; |
||||
|
include_once "./window-modal/otherToElevatorModal.php"; |
||||
|
?> |
||||
|
<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 x-model="apply_key" /></td> |
||||
|
<th>卷號</th> |
||||
|
<td><input class="form-control" type="text" disabled value="<?php echo $hope_customer['vol_no']; ?>" /></td> |
||||
|
<th>現場名稱</th> |
||||
|
<td><input class="form-control" type="text" disabled value="<?php echo $hope_customer['customer']; ?>" /></td> |
||||
|
<th>現場地址</th> |
||||
|
<td><input class="form-control" type="text" disabled value="<?php echo $hope_customer['address']; ?>" /></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>電梯品牌</th> |
||||
|
<td><input class="form-control" type="text" disabled value="<?php echo $hope_customer['brand']; ?>" /></td> |
||||
|
<th>電梯數量</th> |
||||
|
<td><input class="form-control" type="number" disabled value="<?php echo $hope_customer['num']; ?>" /></td> |
||||
|
<th>營業員</th> |
||||
|
<td><input class="form-control" type="text" disabled value="<?php echo $hope_customer['salesman_name']; ?>" /></td> |
||||
|
<th>當前契約期限結束</th> |
||||
|
<td><input class="form-control" type="date" disabled value="" /></td> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<table class="table" border="1"> |
||||
|
<thead > |
||||
|
<tr class="" > |
||||
|
<th scope="col" class="text-center " colspan="10">價格審查(契約)基本資料</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
|
||||
|
<th>契約性質</th> |
||||
|
<td> |
||||
|
<select class="form-control" x-model="contract_status"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續約</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<th>付款方式</th> |
||||
|
<td> |
||||
|
<select class="form-control" x-model="pay_method" > |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="A40003">月繳</option> |
||||
|
<option value="A40004">雙月繳</option> |
||||
|
<option value="A40007">季繳</option> |
||||
|
<option value="A40005">半年繳</option> |
||||
|
<option value="A40006">年繳</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<th>案件名稱</th> |
||||
|
<td><input class="form-control" type="text" x-model="case_name" /></td> |
||||
|
<th>合約開始日期</th> |
||||
|
<td><input type="date" class="form-control" x-model="startDate" /></td> |
||||
|
<th>合約結束日期</th> |
||||
|
<td><input type="date" class="form-control" x-model="endDate" /></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 ><?php echo nl2br($hope_customer['progress_status']); ?></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.標準價格未帶出,請聯係業務部建立該規格報價. |
||||
|
3.無機房速度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=7 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="removeElevator(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> |
||||
|
</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> |
||||
|
<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> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>電梯許可證號碼</th> |
||||
|
<td colspan=3> |
||||
|
<input type="text" class="form-control" x-model="elevator.permitNumber" /> |
||||
|
</td> |
||||
|
<th>品牌</th> |
||||
|
<td> |
||||
|
<select class="form-control" x-model="elevator.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.checkYear" /> |
||||
|
</td> |
||||
|
<th>上次年檢日期</th> |
||||
|
<td> |
||||
|
<input type="date" class="form-control" x-model="elevator.lastDate" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<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.qty" disabled /> |
||||
|
</td> |
||||
|
|
||||
|
<th>保養週期</th> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" x-model="elevator.cycle"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="1">月保</option> |
||||
|
<option value="2">月保兩次</option> |
||||
|
<option value="3">雙月保</option> |
||||
|
<option value="4">季保</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<th>保養方式</th> |
||||
|
<td> |
||||
|
<select class="form-control" x-model="elevator.method"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="A">全包</option> |
||||
|
<option value="B">半包</option> |
||||
|
<option value="C">清包</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<th>贈送M1</th> |
||||
|
<td> |
||||
|
<select class="form-control" x-model="elevator.m1"> |
||||
|
<option value="N">否</option> |
||||
|
<option value="Y">是</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>公司發布價(月)</th> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" disabled x-model="elevator.price.toLocaleString()" /> |
||||
|
</td> |
||||
|
<th>保養月數</th> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="elevator.months" /> |
||||
|
</td> |
||||
|
<th>公司發布價(總價)</th> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" disabled x-model="(elevator.price * elevator.months).toLocaleString()" /> |
||||
|
</td> |
||||
|
<th>契約報價(月)</th> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="elevator.sale_price" /> |
||||
|
</td> |
||||
|
<th>契約報價(總價)</th> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" disabled x-model="(elevator.sale_price * elevator.months).toLocaleString()" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
</table> |
||||
|
</div> |
||||
|
<div class="divitem"> |
||||
|
<div class="title"> |
||||
|
<h4>除外項目</h4> |
||||
|
<button class="addbtn btn" @click="openCreateOtherOptionFn()" >+</button> |
||||
|
</div> |
||||
|
<table class="table" border=1> |
||||
|
<thead x-show="otherOptions.length > 0"> |
||||
|
<tr> |
||||
|
<td>詢價單號</td> |
||||
|
<td>名稱</td> |
||||
|
<td>單價</td> |
||||
|
<td>數量</td> |
||||
|
<td>複價</td> |
||||
|
<td style="width:160px">所屬電梯</td> |
||||
|
<td style="width:220px">功能</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<template x-for="option in otherOptions"> |
||||
|
<tr> |
||||
|
<td><input type="text" class="form-control" x-model="option.pr_no"></td> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" x-model="option.name"> |
||||
|
<span x-show="option.name==''" class="errortext" x-cloak data-type="errortext">請輸入除外項目名稱</span> |
||||
|
</td> |
||||
|
<td><input type="text" class="form-control" x-model="option.price"></td> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="option.num"> |
||||
|
<span x-show="!option.num || option.num <= 0 || !Number.isInteger(Number(option.num))" class="errortext" x-cloak data-type="errortext">請輸入正整數</span> |
||||
|
</td> |
||||
|
<td><input type="text" class="form-control" x-model="(option.price * option.num).toLocaleString()" disabled></td> |
||||
|
<td> |
||||
|
<template x-for="el in option.toElevator"> |
||||
|
<p x-html="'<b>' + el.id + '</b>、' + el.model"></p> |
||||
|
</template> |
||||
|
<span x-show="option.toElevator.length <=0" class="errortext" x-cloak data-type="errortext">尚未選擇電梯</span> |
||||
|
</td> |
||||
|
<td> |
||||
|
<div class="d-flex"> |
||||
|
<button class="copyBtn btn btn-secondary" @click="copyOtherOption(option.id)">複製</button> |
||||
|
<button class="selectElevator btn btn-danger" @click="addOtherOptionToElevator(option.id)">電梯</button> |
||||
|
<button class="deleteBtn btn btn-danger" @click="removeOtherOption(option.id)">X</button> |
||||
|
</div> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</template> |
||||
|
<tr x-show="otherOptions.length > 0"> |
||||
|
<td colspan=3>小計</td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled :value="totalOtherOptionsNum.toLocaleString()" ></td> |
||||
|
<td colspan=1 ><input type="text" class="form-control" disabled :value="totalOtherOptionsPrice.toLocaleString()" ></td> |
||||
|
<td colspan=3 ></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</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 style="width:120px">報價單</p> |
||||
|
<input type="file" class="form-control" multiple draggable="true" @change="uploadFiles($event, 1)" /> |
||||
|
</label> |
||||
|
<label for=""> |
||||
|
<p style="width:120px">合約用印申請表</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'); |
||||
|
const vol_no = '<?php echo $hope_customer['vol_no']; ?>'; |
||||
|
const apply_key = '<?php echo $apply_key; ?>'; |
||||
|
const customer = '<?php echo $hope_customer['customer']; ?>'; |
||||
|
const manager = '<?php echo $hope_customer['manager']; ?>'; |
||||
|
const salesman = '<?php echo $hope_customer['salesman'] ?>'; |
||||
|
const salesman_name = '<?php echo $hope_customer['salesman_name'] ?>'; |
||||
|
const pre_order_date = '<?php echo $hope_customer['pre_order_date']; ?>'; |
||||
|
const address = '<?php echo $hope_customer['address']; ?>'; |
||||
|
const brand = '<?php echo $hope_customer['brand']; ?>'; |
||||
|
const progress_status = '<?php echo $hope_customer['progress_status']; ?>'; |
||||
|
const user_id = '<?php echo $user_id ?>'; |
||||
|
const user_name = '<?php echo $user_name ?>'; |
||||
|
|
||||
|
</script> |
@ -0,0 +1,179 @@ |
|||||
|
<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" @change="getModalElevatorPrice()"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="MAE100">MAE100有機房</option> |
||||
|
<option value="MAM200">MAM200無機房</option> |
||||
|
<option value="MAH100">MAH100小電梯</option> |
||||
|
<option value="MAF100">MAF100貨梯(有機房)</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" x-model="modalElevatorInfo.person" @change="getModalElevatorPrice()"> |
||||
|
<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" @change="getModalElevatorPrice()" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="modalElevatorInfo.stop" @change="getModalElevatorPrice()" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr class="table-active"> |
||||
|
<th>速度</th> |
||||
|
<th>電梯數量</th> |
||||
|
<th>品牌</th> |
||||
|
<th>贈送M1</th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" x-model="modalElevatorInfo.speed" @change="getModalElevatorPrice()" @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="number" class="form-control" x-model="modalElevatorInfo.qty" disabled /> |
||||
|
</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" @change="getModalElevatorPrice()"> |
||||
|
<option value="N">否</option> |
||||
|
<option value="Y">是</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr class="table-active"> |
||||
|
<th colspan=2>電梯許可證號</th> |
||||
|
<th colspan=2>保養方式</th> |
||||
|
</tr> |
||||
|
<tr class="table-active"> |
||||
|
<td colspan=2><input type="number" class="form-control" x-model="modalElevatorInfo.permitNumber" /></td> |
||||
|
<td colspan=2> |
||||
|
<select class="form-control" x-model="modalElevatorInfo.method" @change="getModalElevatorPrice()"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="A">全包</option> |
||||
|
<option value="B">半包</option> |
||||
|
<option value="C">清包</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr class="table-active"> |
||||
|
<th>保養週期</th> |
||||
|
<th>竣工檢查年度</th> |
||||
|
<th>上次年檢日期</th> |
||||
|
<th>年檢費用(元)</th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" x-model="modalElevatorInfo.cycle" @change="getModalElevatorPrice()"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="1">月保</option> |
||||
|
<option value="2">月保兩次</option> |
||||
|
<option value="3">雙月保</option> |
||||
|
<option value="4">季保</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> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="modalElevatorInfo.yearCheckFee" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr class="table-active"> |
||||
|
|
||||
|
<th>公司發布價(月)</th> |
||||
|
<th>保養月數</th> |
||||
|
<th>契約報價(月)</th> |
||||
|
<th>契約報價總額</th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" disabled x-model="modalElevatorInfo.price.toLocaleString()" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="modalElevatorInfo.months" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="number" class="form-control" x-model="modalElevatorInfo.sale_price" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" disabled x-model="(modalElevatorInfo.sale_price * modalElevatorInfo.months).toLocaleString()" /> |
||||
|
</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> |
@ -0,0 +1,33 @@ |
|||||
|
<div class="window-modal" x-cloak data-type="window-modal" x-show="modalShow.other" x-ref="createOtherOptionModal" id="createOtherOptionModal"> |
||||
|
<div class="window-modal-content modal-xl"> |
||||
|
<div class="window-modal-header"> |
||||
|
<h4>新增除外項目</h4> |
||||
|
<button class="btn btn-close" @click="hideCreateOtherOptionModal()">X</button> |
||||
|
</div> |
||||
|
<div class="window-modal-body"> |
||||
|
<div> |
||||
|
<table class="table"> |
||||
|
<tr class="table-active"> |
||||
|
<th>詢價單號</th> |
||||
|
<th>項目名稱</th> |
||||
|
<th>單價</th> |
||||
|
<th>數量</th> |
||||
|
<th>複價</th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td><input type="text" class="form-control" x-model="modalOtherOptionInfo.pr_no"></td> |
||||
|
<td><input type="text" class="form-control" x-model="modalOtherOptionInfo.name"></td> |
||||
|
<td><input type="number" class="form-control" x-model="modalOtherOptionInfo.price"></td> |
||||
|
<td><input type="number" class="form-control" x-model="modalOtherOptionInfo.num"></td> |
||||
|
<td><input type="text" disabled class="form-control" x-model="(modalOtherOptionInfo.price * modalOtherOptionInfo.num).toLocaleString()"></td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" class="btn btn-secondary" @click="hideCreateOtherOptionModal()">關閉</button> |
||||
|
<button type="button" class="btn btn-primary" @click="createOtherOptionFn()">新增</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="window-back" @click="hideCreateOtherOptionModal()"></div> |
||||
|
</div> |
@ -0,0 +1,36 @@ |
|||||
|
<div class="window-modal" x-cloak data-type="window-modal" x-show="modalShow.otherToElevator" x-ref="toOtherOptionElevatorModal" id="toOtherOptionElevatorModal"> |
||||
|
<div class="window-modal-content modal-m"> |
||||
|
<div class="window-modal-header"> |
||||
|
<h4>配對電梯</h4> |
||||
|
<button class="btn btn-close" @click="hideToOtherOptionElevatorModal()">X</button> |
||||
|
</div> |
||||
|
<div class="window-modal-body"> |
||||
|
<div> |
||||
|
<table class="table"> |
||||
|
<tr> |
||||
|
<th>項次</th> |
||||
|
<th>規格</th> |
||||
|
<th>選擇</th> |
||||
|
</tr> |
||||
|
<template x-for="elevator in toElevators" :key="elevator.id"> |
||||
|
<tr> |
||||
|
<td x-text="elevator.id"></td> |
||||
|
<td x-text="elevator.model"></td> |
||||
|
<td><input type="radio" name="otherOptionToElevator" :value="elevator.id" class="form-check-input" x-model="toElevatorNo" /></td> |
||||
|
</tr> |
||||
|
</template> |
||||
|
<tr x-show="toElevators.length == 0"> |
||||
|
<td colspan="3"> |
||||
|
<small class="text-danger" style="font-size:13px;font-weight:600">暫無可選電梯,請先新增電梯規格!</small> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" class="btn btn-secondary" @click="hideToOtherOptionElevatorModal()">關閉</button> |
||||
|
<button type="button" x-show="toElevators.length > 0" class="btn btn-primary" @click="chkOtherOptionToElevators()">確認</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="window-back" @click="hideToOtherOptionElevatorModal()"></div> |
||||
|
</div> |
@ -0,0 +1,62 @@ |
|||||
|
<?php |
||||
|
require_once('../conn.php'); |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
BillNo, -- 合約號 |
||||
|
OAmount -- 合約未稅金額 |
||||
|
FROM salSalesOrder WHERE 1=1"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
// echo "<pre>"; |
||||
|
// print_r($result); |
||||
|
// echo "</pre>"; |
||||
|
// exit(); |
||||
|
$result_detail = []; |
||||
|
$result_master = []; |
||||
|
$result_arr = []; |
||||
|
foreach ($result as $key => $result) { |
||||
|
$no = $result['BillNo']; |
||||
|
$result_master['BillNo'] = $no; |
||||
|
$firstChar = substr($no, 0, 1); |
||||
|
if ($firstChar == 'M' && $key <= 100) { |
||||
|
$sql = "SELECT BizPartnerName FROM comBusinessPartner WHERE BizPartnerId = '$no' "; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$customer_name = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// $result_master[] = $result; |
||||
|
$sql = "SELECT |
||||
|
BillNo, -- 合約號 |
||||
|
PayStage, -- 收款階段 |
||||
|
PlanPercentage, -- 收款比例 |
||||
|
PlanPayAmt -- 收款金額 |
||||
|
FROM salOrderStagePay WHERE BillNo = '$no'"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$Detail = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
if (!empty($Detail)) { |
||||
|
foreach ($Detail as $key => $detail) { |
||||
|
$detail['PlanPercentage'] = (float)$detail['PlanPercentage']; |
||||
|
$Detail[$key]['PlanPercentage'] = $detail['PlanPercentage']; // 比例轉小數第二位 |
||||
|
$Detail[$key]['PlanPayAmt'] = intval($detail['PlanPayAmt']); // 比例金額轉整數 |
||||
|
|
||||
|
} |
||||
|
|
||||
|
if (mb_substr($Detail[0]['PayStage'], 0, 2) == '寶佳') { |
||||
|
$result_master['customer_status'] = 'strategy_customer'; |
||||
|
} else if (!empty($customer_name) && mb_substr($customer_name['BizPartnerName'], 0, 1) == '【') { |
||||
|
$result_master['customer_status'] = 'strategy_customer'; |
||||
|
} else { |
||||
|
$result_master['customer_status'] = 'general_customer'; |
||||
|
} |
||||
|
|
||||
|
$result_master['total_price'] = intval($result['OAmount']); |
||||
|
$result_master['detail'] = $Detail; |
||||
|
$result_arr[] = $result_master; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
echo "<pre>"; |
||||
|
print_r($result_arr); |
||||
|
echo "</pre>"; |
@ -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; |
||||
|
} |
@ -0,0 +1,115 @@ |
|||||
|
[ |
||||
|
{ |
||||
|
"name": "MainSalesOrder", |
||||
|
"rows": [ |
||||
|
{ |
||||
|
"BillNo": "M24020076", |
||||
|
"BillDate": 20240320, |
||||
|
"TypeId": "SO", |
||||
|
"FOrgId": "1000", |
||||
|
"OrgId": "1000", |
||||
|
"ModeId": "M", |
||||
|
"BizPartnerId": "M24020076", |
||||
|
"CurrId": "TWD", |
||||
|
"CurrOAmount": 1, |
||||
|
"CurrLAmount": 1, |
||||
|
"PersonId": "M0073", |
||||
|
"DueToId": "M24020076", |
||||
|
"TradeConditionId": "", |
||||
|
"TaxId": "ST005", |
||||
|
"CreditorCompId": "1001", |
||||
|
"CreditorOrgId": "1000", |
||||
|
"CreatorId": "M0225" |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "SubOrder", |
||||
|
"rows": [ |
||||
|
{ |
||||
|
"TaxId": "ST005", |
||||
|
"RequirementDate": 20240320, |
||||
|
"ConsignmentDate": 20240320, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 1, |
||||
|
"ItemType": 1, |
||||
|
"MaterialId": "A40001", |
||||
|
"SUnitId": "SET", |
||||
|
"SQuantity": 1, |
||||
|
"SPrice": 910000, |
||||
|
"CU_MaterialId": "4MW00001" |
||||
|
}, |
||||
|
{ |
||||
|
"TaxId": "ST005", |
||||
|
"RequirementDate": 20240320, |
||||
|
"ConsignmentDate": 20240320, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 2, |
||||
|
"ItemType": 1, |
||||
|
"MaterialId": "A40008", |
||||
|
"SUnitId": "SET", |
||||
|
"SQuantity": 1, |
||||
|
"SPrice": 390000, |
||||
|
"CU_MaterialId": "4MW00001" |
||||
|
}, |
||||
|
{ |
||||
|
"TaxId": "ST005", |
||||
|
"RequirementDate": 20240320, |
||||
|
"ConsignmentDate": 20240320, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 3, |
||||
|
"ItemType": 0, |
||||
|
"MaterialId": "4MW00001", |
||||
|
"SUnitId": "SET", |
||||
|
"SQuantity": 1, |
||||
|
"SPrice": 0, |
||||
|
"CU_MaterialId": "4MW00001" |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "salOrderStagePay", |
||||
|
"rows": [ |
||||
|
{ |
||||
|
"PayStage": "簽約", |
||||
|
"PlanPercentage": 0.2, |
||||
|
"PlanPayAmt": 260000, |
||||
|
"PlanPayDate": 20240420, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 1, |
||||
|
"RowNo": 1, |
||||
|
"UnWriteOffOAmount": 260000 |
||||
|
}, |
||||
|
{ |
||||
|
"PayStage": "貨抵工地", |
||||
|
"PlanPercentage": 0.5, |
||||
|
"PlanPayAmt": 650000, |
||||
|
"PlanPayDate": 20241220, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 2, |
||||
|
"RowNo": 2, |
||||
|
"UnWriteOffOAmount": 650000 |
||||
|
}, |
||||
|
{ |
||||
|
"PayStage": "試車完工", |
||||
|
"PlanPercentage": 0.2, |
||||
|
"PlanPayAmt": 260000, |
||||
|
"PlanPayDate": 20250120, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 3, |
||||
|
"RowNo": 3, |
||||
|
"UnWriteOffOAmount": 260000 |
||||
|
}, |
||||
|
{ |
||||
|
"PayStage": "交車", |
||||
|
"PlanPercentage": 0.1, |
||||
|
"PlanPayAmt": 130000, |
||||
|
"PlanPayDate": 20250220, |
||||
|
"BillNo": "M24020076", |
||||
|
"RowCode": 4, |
||||
|
"RowNo": 4, |
||||
|
"UnWriteOffOAmount": 130000 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
] |
@ -1,185 +1,66 @@ |
|||||
[ |
[ |
||||
{ |
{ |
||||
"name": "salIncomeApplyMaster", |
//salSalesOrder |
||||
|
"name": "MainSalesOrder", |
||||
"rows": [ |
"rows": [ |
||||
{ |
{ |
||||
"BillNo": "B23100060", |
"BillNo": "Z001", //合約單號 |
||||
"BillDate": "20240122", |
"BillDate": 20210420, //簽約日期 |
||||
"OrgId": "1000", |
"TypeId": "SO", // |
||||
"FOrgId": "1000", |
"FOrgId": "1000", |
||||
"TypeId": "RAS", |
"OrgId": "1000", |
||||
"BpOrgId": "1000", |
"ModeId": "T", // T汰改 M新梯 |
||||
"BizPartnerId": "B23100060", |
"BizPartnerId": "M0225", //創建人ID |
||||
"CurrId": "TWD", |
"CurrId": "TWD", |
||||
"CurrOAmount": 1, |
"CurrOAmount": 1, |
||||
"CurrLAmount": 1, |
"CurrLAmount": 1, |
||||
"PersonId": "M0065", |
"PersonId": "M0225", //業務人員 |
||||
"DtOrgId": "1000", |
"DueToId": "512", //業務部門 |
||||
"DueToId": "B23100060", |
"TradeConditionId": "", |
||||
"TaxId": "ST005", |
"TaxId": "ST005", |
||||
"CompId": "1001", |
"CreditorCompId": "1000", |
||||
"CreatorId": "M0225" |
"CreditorOrgId": "1000", |
||||
|
"CreditorCurrOAmount": 1, |
||||
|
"CreditorCurrLAmount": 1, |
||||
|
"CompId": "1000" |
||||
} |
} |
||||
] |
] |
||||
}, |
}, |
||||
{ |
{ |
||||
"name": "salIncomeApplyDetail", |
// salSalesOrderDetail |
||||
|
"name": "SubOrder", |
||||
"rows": [ |
"rows": [ |
||||
{ |
{ |
||||
"BillNo": "B23100060", |
"SupplyCompId": "1001", |
||||
"IncomeId": "A40003", |
"SupplyOrgId": "1000", |
||||
"TaxId": "ST005", |
|
||||
"RowCode": 1, |
|
||||
"RowNo": 1, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 2, |
|
||||
"RowNo": 2, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 3, |
|
||||
"RowNo": 3, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 4, |
|
||||
"RowNo": 4, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 5, |
|
||||
"RowNo": 5, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 6, |
|
||||
"RowNo": 6, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
"TaxId": "ST005", |
||||
"RowCode": 7, |
"RequirementDate": 20210420, //出貨日期 |
||||
"RowNo": 7, |
"ConsignmentDate": 20210420, //發貨日期 |
||||
"ItemType": 1, |
"DispatchCompId": "1001", |
||||
"SPrice": 1250, |
"DispatchOrgId": "1000", |
||||
"SQuantity": 1, |
"BillNo": "Z001", //合約號 |
||||
"ProjectId": "B23100060", |
"RowCode": 1, //全部筆數排列 |
||||
"FromSourceTag": 0, |
"ItemType": 0, |
||||
"CU_MaterialId": "4TH53801" |
"MaterialId": "Z001", //作番號 |
||||
}, |
"SUnitId": "SET", |
||||
{ |
"SQuantity": 1, //交易數量 |
||||
"BillNo": "B23100060", |
"SPrice": 1 //交易價格 |
||||
"IncomeId": "A40003", |
} |
||||
"TaxId": "ST005", |
] |
||||
"RowCode": 8, |
}, |
||||
"RowNo": 8, |
{ |
||||
"ItemType": 1, |
//salOrderStagePay |
||||
"SPrice": 1250, |
"name": "salOrderStagePay", |
||||
"SQuantity": 1, |
"rows": [ |
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 9, |
|
||||
"RowNo": 9, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 10, |
|
||||
"RowNo": 10, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
|
||||
"BillNo": "B23100060", |
|
||||
"IncomeId": "A40003", |
|
||||
"TaxId": "ST005", |
|
||||
"RowCode": 11, |
|
||||
"RowNo": 11, |
|
||||
"ItemType": 1, |
|
||||
"SPrice": 1250, |
|
||||
"SQuantity": 1, |
|
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
}, |
|
||||
{ |
{ |
||||
"BillNo": "B23100060", |
"BillNo": "", |
||||
"IncomeId": "A40003", |
"RowCode": "", |
||||
"TaxId": "ST005", |
"RowNo": "", |
||||
"RowCode": 12, |
"PayStage": "ST003", //收款階段 |
||||
"RowNo": 12, |
"PlanPercentage": "Z001", //計劃收款比例(%) |
||||
"ItemType": 1, |
"PlanPayAmt": 1, //計劃收款金額 |
||||
"SPrice": 1250, |
"PlanPayDate": 1, //計劃收款日期 1.第一筆都是簽約日 |
||||
"SQuantity": 1, |
"UnWriteOffOAmount": 1 //未核銷金額 |
||||
"ProjectId": "B23100060", |
|
||||
"FromSourceTag": 0, |
|
||||
"CU_MaterialId": "4TH53801" |
|
||||
} |
} |
||||
] |
] |
||||
} |
} |
||||
|
@ -1,36 +1,258 @@ |
|||||
<?php |
<?php |
||||
?> |
|
||||
|
// { |
||||
<head> |
// "BillNo": "Z001", //合約單號 |
||||
<title>地址轉經緯度</title> |
// "BillDate": 20210420, //簽約日期 |
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> |
// "TypeId": "SO", // |
||||
</head> |
// "FOrgId": "1000", |
||||
|
// "OrgId": "1000", |
||||
<body> |
// "ModeId": "T", // T汰改 M新梯 |
||||
<h1>輸入地址以獲取經緯度</h1> |
// "BizPartnerId": "M0225", //創建人ID |
||||
<form id="addressForm" method="post"> |
// "CurrId": "TWD", |
||||
<input type="text" id="addressInput" name="address" placeholder="輸入地址"> |
// "CurrOAmount": 1, |
||||
<button type="submit">查詢</button> |
// "CurrLAmount": 1, |
||||
</form> |
// "PersonId": "M0225", //業務人員 |
||||
<div id="map"></div> |
// "DueToId": "512", //業務部門 |
||||
|
// "TradeConditionId": "", |
||||
<script> |
// "TaxId": "ST005", |
||||
// 使用AJAX提交表單 |
// "CreditorCompId": "1000", |
||||
$(document).ready(function() { |
// "CreditorOrgId": "1000", |
||||
$("#addressForm").submit(function(event) { |
// "CreditorCurrOAmount": 1, |
||||
event.preventDefault(); |
// "CreditorCurrLAmount": 1, |
||||
var address = $("#addressInput").val(); |
// "CompId": "1000" |
||||
$.ajax({ |
// } |
||||
url: "get_lat_lng.php", |
// ] |
||||
type: "POST", |
// }, |
||||
data: { |
// { |
||||
address: address |
// //salSalesOrderDetail |
||||
}, |
// "name": "SubOrder", |
||||
success: function(data) { |
// "rows": [ |
||||
$("#map").html(data); |
// { |
||||
} |
// "SupplyCompId": "1001", |
||||
}); |
// "SupplyOrgId": "1000", |
||||
}); |
// "TaxId": "ST005", |
||||
}); |
// "RequirementDate": 20210420, //出貨日期 |
||||
</script> |
// "ConsignmentDate": 20210420, //發貨日期 |
||||
</body> |
// "DispatchCompId": "1001", |
||||
|
// "DispatchOrgId": "1000", |
||||
|
// "BillNo": "Z001", //合約號 |
||||
|
// "RowCode": 1, //全部筆數排列 |
||||
|
// "ItemType": 0, |
||||
|
// "MaterialId": "Z001", //作番號 |
||||
|
// "SUnitId": "SET", |
||||
|
// "SQuantity": 1, //交易數量 |
||||
|
// "SPrice": 1 //交易價格 |
||||
|
// } |
||||
|
// ] |
||||
|
// }, |
||||
|
// { |
||||
|
// "name": "salOrderStagePay", |
||||
|
// "rows": [ |
||||
|
// { |
||||
|
// "BillNo": "", |
||||
|
// "RowCode": "", |
||||
|
// "RowNo": "", |
||||
|
// "PayStage": "ST003", //收款階段 |
||||
|
// "PlanPercentage": "Z001", //計劃收款比例(%) |
||||
|
// "PlanPayAmt": 1, //計劃收款金額 |
||||
|
// "PlanPayDate": 1, //計劃收款日期 1.第一筆都是簽約日 |
||||
|
// "UnWriteOffOAmount": 1 //未核銷金額 |
||||
|
// } |
||||
|
// ] |
||||
|
// } |
||||
|
// ] |
||||
|
require_once("../../T8_Authorization_from_bpm.php"); |
||||
|
|
||||
|
$api_url = "https://erp.masada.com.tw:780/twWebAPI/V1/SALSALESORDER/PostERPData"; |
||||
|
|
||||
|
$validation = get_Auth(); |
||||
|
$header = [ |
||||
|
"CHI_Authorization :" . $validation, |
||||
|
"GroupId:MASADA" |
||||
|
]; |
||||
|
$url = "https://erp.masada.com.tw:780/twWebAPI/V1/GLFEEWRITEOFF/DeleteERPData?pkValue=1000,M24020076"; |
||||
|
|
||||
|
$ch = curl_init(); |
||||
|
curl_setopt($ch, CURLOPT_URL, $url); |
||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); |
||||
|
|
||||
|
$response = curl_exec($ch); |
||||
|
if ($response === false) { |
||||
|
echo 'Curl error: ' . curl_error($ch); |
||||
|
} else { |
||||
|
$result = json_decode($response, true); |
||||
|
// 若 API 傳入失敗。 |
||||
|
if ($result['Status'] == 'Erroe') { |
||||
|
echo 'API傳入失敗,' . $result['ErrorMsg']; |
||||
|
print_r($result); |
||||
|
} else { |
||||
|
// print_r($result); |
||||
|
print_r($result); |
||||
|
} |
||||
|
print_r($result); |
||||
|
} |
||||
|
|
||||
|
curl_close($ch); |
||||
|
exit(); |
||||
|
$contract_no = "M24020003"; |
||||
|
// $contract_no = "M24010109"; |
||||
|
$MainSalesOrder_row = [ |
||||
|
"BillNo" => "$contract_no", //合約單號 |
||||
|
"BillDate" => 20210420, //簽約日期 |
||||
|
"TypeId" => "SO", // |
||||
|
"FOrgId" => "1000", |
||||
|
"OrgId" => "1000", |
||||
|
"ModeId" => "M", // T汰改 M新梯 |
||||
|
"BizPartnerId" => "$contract_no", //客戶代碼 |
||||
|
"CurrId" => "TWD", |
||||
|
"CurrOAmount" => 1, |
||||
|
"CurrLAmount" => 1, |
||||
|
"PersonId" => "M0177", //業務人員 |
||||
|
"DueToId" => "$contract_no", //債務方 |
||||
|
"TradeConditionId" => "", |
||||
|
"TaxId" => "ST005", |
||||
|
"CreditorCompId" => "1001", |
||||
|
"CreditorOrgId" => "1000", |
||||
|
"CreatorId" => "M0225" |
||||
|
|
||||
|
]; |
||||
|
// //salSalesOrderDetail |
||||
|
// $SubOrder_row = []; |
||||
|
for ($i = 0; $i < 3; $i++) { |
||||
|
if ($i == 0) { |
||||
|
$row = [ |
||||
|
// "SupplyCompId" => "1001", |
||||
|
// "SupplyOrgId" => "1000", |
||||
|
"TaxId" => "ST005", |
||||
|
"RequirementDate" => 20210420, //出貨日期 |
||||
|
"ConsignmentDate" => 20210420, //發貨日期 |
||||
|
// "DispatchCompId" => "1001", |
||||
|
// "DispatchOrgId" => "1000", |
||||
|
"BillNo" => "$contract_no", //合約號 |
||||
|
"RowCode" => $i, //全部筆數排列 |
||||
|
"ItemType" => 1, |
||||
|
"MaterialId" => "A40001", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) |
||||
|
"SUnitId" => "SET", |
||||
|
"SQuantity" => 1, //交易數量 |
||||
|
"SPrice" => 100000 //交易價格 |
||||
|
]; |
||||
|
} |
||||
|
if ($i == 1) { |
||||
|
$row = [ |
||||
|
// "SupplyCompId" => "1001", |
||||
|
// "SupplyOrgId" => "1000", |
||||
|
"TaxId" => "ST005", |
||||
|
"RequirementDate" => 20210420, //出貨日期 |
||||
|
"ConsignmentDate" => 20210420, //發貨日期 |
||||
|
// "DispatchCompId" => "1001", |
||||
|
// "DispatchOrgId" => "1000", |
||||
|
"BillNo" => "$contract_no", //合約號 |
||||
|
"RowCode" => $i, //全部筆數排列 |
||||
|
"ItemType" => 1, |
||||
|
"MaterialId" => "A40008", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) |
||||
|
"SUnitId" => "SET", |
||||
|
"SQuantity" => 1, //交易數量 |
||||
|
"SPrice" => 650000 //交易價格 |
||||
|
]; |
||||
|
} |
||||
|
if ($i == 2) { |
||||
|
$row = [ |
||||
|
"TaxId" => "ST005", |
||||
|
"RequirementDate" => 20210420, //出貨日期 |
||||
|
"ConsignmentDate" => 20210420, //發貨日期 |
||||
|
"BillNo" => "$contract_no", //合約號 |
||||
|
"RowCode" => $i, //全部筆數排列 |
||||
|
"ItemType" => 0, |
||||
|
"MaterialId" => "4MH00669", //1.設備(A40001)、2.安裝(A4008)、3.作番號(作番) |
||||
|
"SUnitId" => "SET", |
||||
|
"SQuantity" => 1, //交易數量 |
||||
|
"SPrice" => 0 //交易價格 |
||||
|
]; |
||||
|
} |
||||
|
$SubOrder_row[] = $row; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$salOrderStagePay_row = []; |
||||
|
$roww = [ |
||||
|
"PayStage" => "簽約", //收款階段 |
||||
|
"PlanPercentage" => 0.5, //計劃收款比例(%) |
||||
|
"PlanPayAmt" => 375000, //計劃收款金額 |
||||
|
"PlanPayDate" => 20240101, //計劃收款日期 1.第一筆都是簽約日 |
||||
|
"BillNo" => "$contract_no", |
||||
|
"RowCode" => 1, |
||||
|
"RowNo" => 1, |
||||
|
"UnWriteOffOAmount" => 375000 //未核銷金額 |
||||
|
]; |
||||
|
$roww2 = [ |
||||
|
"PayStage" => "貨抵工地", |
||||
|
"PlanPercentage" => 0.5, |
||||
|
"PlanPayAmt" => 375000, |
||||
|
"PlanPayDate" => 20240101, |
||||
|
"BillNo" => "$contract_no", |
||||
|
"RowCode" => 2, |
||||
|
"RowNo" => 2, |
||||
|
"UnWriteOffOAmount" => 375000 |
||||
|
]; |
||||
|
$salOrderStagePay_row[] = $roww; |
||||
|
$salOrderStagePay_row[] = $roww2; |
||||
|
|
||||
|
|
||||
|
$MainSalesOrder = [ |
||||
|
"name" => "MainSalesOrder", |
||||
|
'rows' => [$MainSalesOrder_row] |
||||
|
]; |
||||
|
$SubOrder = [ |
||||
|
"name" => "SubOrder", |
||||
|
"rows" => $SubOrder_row |
||||
|
]; |
||||
|
$salOrderStagePay = [ |
||||
|
"name" => "salOrderStagePay", |
||||
|
"rows" => $salOrderStagePay_row |
||||
|
]; |
||||
|
|
||||
|
$APIbody = []; |
||||
|
$APIbody[] = $MainSalesOrder; |
||||
|
$APIbody[] = $SubOrder; |
||||
|
$APIbody[] = $salOrderStagePay; |
||||
|
// $data = file_get_contents('test copy.json'); |
||||
|
// $arr = json_decode($data, true); |
||||
|
// echo "<pre>"; |
||||
|
// print_r($data); |
||||
|
// echo "</pre>"; |
||||
|
|
||||
|
echo "<pre>"; |
||||
|
print_r(json_encode($APIbody, JSON_UNESCAPED_UNICODE)); |
||||
|
echo "</pre>"; |
||||
|
// exit(); |
||||
|
|
||||
|
$header = [ |
||||
|
"CHI_Authorization :" . $validation, |
||||
|
"GroupId:TEST" |
||||
|
]; |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL |
||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); |
||||
|
curl_setopt($ch, CURLOPT_POST, 1); // 使用 POST |
||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($APIbody, JSON_UNESCAPED_UNICODE)); |
||||
|
$response = curl_exec($ch); |
||||
|
|
||||
|
if ($response === false) { |
||||
|
echo 'Curl error: ' . curl_error($ch); |
||||
|
} else { |
||||
|
$result = json_decode($response, true); |
||||
|
// 若 API 傳入失敗。 |
||||
|
if ($result['Status'] == 'Erroe') { |
||||
|
echo 'API傳入失敗,' . $result['ErrorMsg']; |
||||
|
print_r($result); |
||||
|
} else { |
||||
|
// print_r($result); |
||||
|
print_r($result); |
||||
|
} |
||||
|
print_r($result); |
||||
|
} |
||||
|
|
||||
|
curl_close($ch); |
||||
|
Loading…
Reference in new issue