You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
992 lines
48 KiB
992 lines
48 KiB
<?php
|
|
include_once('../header.php');
|
|
require_once('./conn.php');
|
|
if(!isset($_GET['id'])){
|
|
echo "找不到此紀錄!";
|
|
exit;
|
|
}
|
|
$id = $_GET['id'];
|
|
|
|
$sql_str = "SELECT pricereview_main.*, account.name as person_name FROM pricereview_main LEFT JOIN account ON pricereview_main.person = account.accountid WHERE pricereview_main.id = :id AND pricereview_main.status <> 'D'";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':id', $id);
|
|
$stmt->execute();
|
|
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if(!$contract){
|
|
echo "找不到此紀錄!";
|
|
exit;
|
|
}
|
|
|
|
$sql_str = "SELECT * FROM pricereview_pay WHERE mid = :mid ORDER BY pay_kind ASC";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':mid', $id);
|
|
$stmt->execute();
|
|
$pays = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$sql_str = "SELECT pricereview_item.*, option_mi.price AS option_mi, option_price.group_name AS option_name, option_price.memo AS option_memo, option_price.spec AS option_spec
|
|
FROM pricereview_item
|
|
LEFT JOIN option_mi ON option_mi.option_price_id = pricereview_item.price_id
|
|
LEFT JOIN option_price ON option_price.id = pricereview_item.price_id
|
|
WHERE pricereview_item.mid = :mid AND pricereview_item.item_group = 'B' AND option_mi.open_kind = 'CO' ORDER BY pricereview_item.item_group, pricereview_item.item_no ASC";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':mid', $id);
|
|
$stmt->execute();
|
|
$options = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$sql_str = "SELECT pricereview_item.*, fp.price
|
|
FROM pricereview_item
|
|
LEFT JOIN (
|
|
SELECT fp1.*
|
|
FROM facility_price fp1
|
|
LEFT JOIN facility_price fp2
|
|
ON (fp1.model = fp2.model AND fp1.id < fp2.id)
|
|
WHERE fp2.id IS NULL
|
|
) AS fp ON fp.model = pricereview_item.item_spec
|
|
WHERE pricereview_item.mid = :mid AND pricereview_item.item_group = 'A'
|
|
";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':mid', $id);
|
|
$stmt->execute();
|
|
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$sql_str = "SELECT * FROM pricereview_item
|
|
WHERE pricereview_item.mid = :mid ORDER BY pricereview_item.item_group, pricereview_item.item_no ASC";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':mid', $id);
|
|
$stmt->execute();
|
|
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$sql_str = "SELECT * FROM pricereview_sign WHERE mid = :mid ORDER BY id ASC";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':mid', $id);
|
|
$stmt->execute();
|
|
$sign_all = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
$sign = $sign_all[count($sign_all)-1];
|
|
$currentSigner = '';
|
|
$currentSign = 0;
|
|
$currentSignId = $sign['id'];
|
|
$historySign = [];
|
|
|
|
foreach($sign_all as $key=>$sign_item){
|
|
if($key == count($sign_all)-1){
|
|
break;
|
|
}
|
|
$signer1 = getSignerName(explode(",", $sign_item['sign1'])[0]);
|
|
$sign1_result = explode(",", $sign_item['sign1'])[1];
|
|
$sign1_date = explode(",", $sign_item['sign1'])[2];
|
|
$sign1_note = $sign_item['sign1_note'];
|
|
if($sign1_result == "Y"){
|
|
$sign1_result = "同意";
|
|
}elseif($sign1_result == "YY"){
|
|
$sign1_result = "結案同意";
|
|
}elseif($sign1_result == "N"){
|
|
$sign1_result = "不同意";
|
|
}else{
|
|
$sign1_result = "---";
|
|
}
|
|
if(!empty($sign_item['sign2'])){
|
|
$signer2 = getSignerName(explode(",", $sign_item['sign2'])[0]);
|
|
$sign2_result = explode(",", $sign_item['sign2'])[1];
|
|
$sign2_note = $sign_item['sign2_note'];
|
|
$sign2_date = explode(",", $sign_item['sign2'])[2];
|
|
if($sign2_result == "Y"){
|
|
$sign2_result = "同意";
|
|
}elseif($sign2_result == "YY"){
|
|
$sign2_result = "結案同意";
|
|
}elseif($sign2_result == "N"){
|
|
$sign2_result = "不同意";
|
|
}else{
|
|
$sign2_result = "---";
|
|
}
|
|
}else{
|
|
$signer2 = "---";
|
|
$sign2_result = "---";
|
|
$sign2_note = "---";
|
|
$sign2_date = "---";
|
|
$sign2_result = "---";
|
|
}
|
|
|
|
|
|
$signer3 = getSignerName(explode(",", $sign_item['sign3'])[0]);
|
|
$sign3_result = explode(",", $sign_item['sign3'])[1];
|
|
$sign3_note = $sign_item['sign3_note'];
|
|
$sign3_date = explode(",", $sign_item['sign3'])[2];
|
|
if($sign3_result == "Y"){
|
|
$sign3_result = "同意";
|
|
}elseif($sign3_result == "YY"){
|
|
$sign3_result = "結案同意";
|
|
}elseif($sign3_result == "N"){
|
|
$sign3_result = "不同意";
|
|
}else{
|
|
$sign3_result = "---";
|
|
}
|
|
if(!empty($sign_item['sign4'])){
|
|
$signer4 = getSignerName(explode(",", $sign_item['sign4'])[0]);
|
|
$sign4_result = explode(",", $sign_item['sign4'])[1];
|
|
$sign4_note = $sign_item['sign4_note'];
|
|
$sign4_date = explode(",", $sign_item['sign4'])[2];
|
|
if($sign4_result == "Y"){
|
|
$sign4_result = "同意";
|
|
}elseif($sign4_result == "YY"){
|
|
$sign4_result = "結案同意";
|
|
}elseif($sign4_result == "N"){
|
|
$sign4_result = "不同意";
|
|
}else{
|
|
$sign4_result = "---";
|
|
}
|
|
}else{
|
|
$signer4 = "---";
|
|
$sign4_result = "---";
|
|
$sign4_note = "---";
|
|
$sign4_date = "---";
|
|
$sign4_result = "---";
|
|
}
|
|
|
|
$historySign[] = [
|
|
'signer1'=>$signer1,
|
|
'sign1_result'=> $sign1_result,
|
|
'sign1_note'=>$sign1_note,
|
|
'sign1_date'=>$sign1_date,
|
|
'signer2'=>$signer2,
|
|
'sign2_result'=> $sign2_result,
|
|
'sign2_note'=>$sign2_note,
|
|
'sign2_date'=>$sign2_date,
|
|
'signer3'=>$signer3,
|
|
'sign3_result'=> $sign3_result,
|
|
'sign3_note'=>$sign3_note,
|
|
'sign3_date'=>$sign3_date,
|
|
'signer4'=>$signer4,
|
|
'sign4_result'=> $sign4_result,
|
|
'sign4_note'=>$sign4_note,
|
|
'sign4_date'=>$sign4_date,
|
|
];
|
|
}
|
|
|
|
if($sign){
|
|
// Y:已同意 N:不同意 W:待簽
|
|
// sign1 => 處長, sign2 => 業務承辦人, sign3 => 協理, sign4 => 總經理
|
|
if($sign['sign1'] == NULL || $sign['sign1'] ==''){
|
|
$sign1 = NULL;
|
|
}else{
|
|
if( explode(",", $sign['sign1'])[1] != ''){
|
|
$sign1 = explode(",", $sign['sign1'])[1] == 'Y' ? 'Y' : 'N';
|
|
}else{
|
|
$sign1 = 'W';
|
|
}
|
|
}
|
|
|
|
if($sign['sign2'] == NULL || $sign['sign2'] ==''){
|
|
$sign2 = NULL;
|
|
}else{
|
|
if( explode(",", $sign['sign2'])[1] != ''){
|
|
$sign2 = explode(",", $sign['sign2'])[1] == 'Y' ? 'Y' : 'N';
|
|
}else{
|
|
$sign2 = 'W';
|
|
}
|
|
}
|
|
|
|
if($sign['sign3'] == NULL || $sign['sign3'] ==''){
|
|
$sign3 = NULL;
|
|
}else{
|
|
if( explode(",", $sign['sign3'])[1] != ''){
|
|
// $sign3 = explode(",", $sign['sign3'])[1] == 'Y' ? 'Y' : 'N';
|
|
if(explode(",", $sign['sign3'])[1] == 'YY') $sign3 = 'YY';
|
|
if(explode(",", $sign['sign3'])[1] == 'Y') $sign3 = 'Y';
|
|
if(explode(",", $sign['sign3'])[1] == 'N') $sign3 = 'N';
|
|
}else{
|
|
$sign3 = 'W';
|
|
}
|
|
}
|
|
if($sign['sign4'] == NULL || $sign['sign4'] ==''){
|
|
$sign4 = NULL;
|
|
}else{
|
|
if( explode(",", $sign['sign4'])[1] != ''){
|
|
// $sign4 = explode(",", $sign['sign4'])[1] == 'Y' ? 'Y' : 'N';
|
|
if(explode(",", $sign['sign4'])[1] == 'YY') $sign4 = 'YY';
|
|
if(explode(",", $sign['sign4'])[1] == 'Y') $sign4 = 'Y';
|
|
if(explode(",", $sign['sign4'])[1] == 'N') $sign4 = 'N';
|
|
}else{
|
|
$sign4 = 'W';
|
|
}
|
|
}
|
|
|
|
if($sign1 == 'W'){
|
|
$currentSigner = explode(",", $sign['sign1'])[0];
|
|
$currentSign = 1;
|
|
}elseif($sign2 == 'W'){
|
|
$currentSigner = explode(",", $sign['sign2'])[0];
|
|
$currentSign = 2;
|
|
}elseif($sign3 == 'W'){
|
|
$currentSigner = explode(",", $sign['sign3'])[0];
|
|
$currentSign = 3;
|
|
}elseif($sign4 == 'W'){
|
|
$currentSigner = explode(",", $sign['sign4'])[0];
|
|
$currentSign = 4;
|
|
}
|
|
}else{
|
|
$sign1 = NULL;
|
|
$sign2 = NULL;
|
|
$sign3 = NULL;
|
|
$sign4 = NULL;
|
|
}
|
|
|
|
$permissions = false;
|
|
//開啟業務部權限
|
|
if($user_id == "M0174" || $user_id == "M0175" || $user_id == "M0060" || $user_id == "M0008" || $user_id == "M0012"){
|
|
$permissions = true;
|
|
}
|
|
function getSignerName($signer){
|
|
if($signer == null || $signer == '') return "---";
|
|
global $conn;
|
|
$sql_str = "SELECT name FROM account WHERE accountid = :signer";
|
|
$stmt = $conn->prepare($sql_str);
|
|
$stmt->bindParam(':signer', $signer);
|
|
$stmt->execute();
|
|
$signer = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
return $signer['name'];
|
|
}
|
|
?>
|
|
<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="./assets/js/alpinejs/cdn.min.js"></script>
|
|
<script src="./assets/js/pricereviewAlpine.js"></script>
|
|
|
|
<div id="pricereviewCheck" x-data=pricereviewCheck()>
|
|
<div class="window-modal " x-ref="historySign" id="historySign">
|
|
<div class="window-modal-content modal-lg">
|
|
<div class="window-modal-header">
|
|
<h4>歷史簽核紀錄</h4>
|
|
<button class="btn btn-close" @click="hideHistorySignModal()">X</button>
|
|
</div>
|
|
<div class="window-modal-body">
|
|
<div>
|
|
<table class="table historytable" style="width:700px">
|
|
<thead>
|
|
<tr>
|
|
<th>審核</th>
|
|
<th>審核人</th>
|
|
<th>結果</th>
|
|
<th>意見</th>
|
|
<th>時間</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach($historySign as $key=>$history): ?>
|
|
<tr>
|
|
<td colspan="5"></td>
|
|
</tr>
|
|
<tr>
|
|
<td>區經理</td>
|
|
<td><?php echo $history['signer1']; ?></td>
|
|
<td><?php echo $history['sign1_result']; ?></td>
|
|
<td><?php echo $history['sign1_note']; ?></td>
|
|
<td><?php echo $history['sign1_date']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td x-text="is_renovate=='汰改' ? '服務助理' : '業務承辦人'"></td>
|
|
<td><?php echo $history['signer2']; ?></td>
|
|
<td><?php echo $history['sign2_result']; ?></td>
|
|
<td><?php echo $history['sign2_note']; ?></td>
|
|
<td><?php echo $history['sign2_date']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td x-text="is_renovate=='汰改' ? '服務副總' :'業務部協理'"></td>
|
|
<td><?php echo $history['signer3']; ?></td>
|
|
<td><?php echo $history['sign3_result']; ?></td>
|
|
<td><?php echo $history['sign3_note']; ?></td>
|
|
<td><?php echo $history['sign3_date']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>總經理</td>
|
|
<td><?php echo $history['signer4']; ?></td>
|
|
<td><?php echo $history['sign4_result']; ?></td>
|
|
<td><?php echo $history['sign4_note']; ?></td>
|
|
<td><?php echo $history['sign4_date']; ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @click="hideHistorySignModal()">關閉</button>
|
|
</div>
|
|
</div>
|
|
<div class="window-back" @click="hideHistorySignModal()"></div>
|
|
</div>
|
|
<div class="container">
|
|
<table class="table customerinfo-table" >
|
|
<tbody>
|
|
<tr>
|
|
<th>卷號</th>
|
|
<th>營業員</th>
|
|
<th>客戶名稱</th>
|
|
<th>牌價總額(A)</th>
|
|
<th>售價總額(B)</th>
|
|
<th >破價總額(B-A)</th>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="text" class="form-control" x-model="contractno" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="person_name" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="company" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Number(price_lowest).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Number(price_total).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="(price_total - price_lowest).toLocaleString()" disabled /></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="table mi-table" border=1>
|
|
<thead>
|
|
<tr>
|
|
<th colspan=5>整機單價</th>
|
|
<?php if($permissions): ?>
|
|
<th colspan=4>業務部作業區</th>
|
|
<?php endif; ?>
|
|
</tr>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>規格</th>
|
|
<th>單價</th>
|
|
<th>數量</th>
|
|
<th>複價</th>
|
|
<?php if($permissions): ?>
|
|
<th>業務部MI</th>
|
|
<th>售價</th>
|
|
<th>利潤</th>
|
|
<th>利潤率(%)</th>
|
|
<?php endif; ?>
|
|
</tr>
|
|
</thead>
|
|
<template x-for="elevator in elevators">
|
|
<tbody>
|
|
<tr>
|
|
<td x-html="'<b>' + elevator.item_no + '</b>'"></td>
|
|
<td > <a href="javascript:;" x-text="elevator.item_spec"></a></td>
|
|
<td><input type="text" class="form-control" x-model="Number(elevator.price).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="elevator.item_qty" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Number(elevator.price * elevator.item_qty).toLocaleString()" disabled /></td>
|
|
<?php if($permissions): ?>
|
|
<td>
|
|
<input x-show="isNotfoundMi" type="text" class="form-control" value="找不到此規格">
|
|
<input x-show="!isNotfoundMi" type="text" class="form-control" x-model="Math.round(Number(elevator.optionsTotalPrice) + Number(elevator.otherOptionsTotalPrice) + Number(elevator.maintainOptionsTotalPrice) + Number(elevator.totalMi * elevator.item_qty)).toLocaleString() " disabled />
|
|
</td>
|
|
<td><input type="text" class="form-control" x-model="Number(elevator.item_price_ct).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="(elevator.item_price_ct - Math.round(Number(elevator.optionsTotalPrice) + Number(elevator.otherOptionsTotalPrice) + Number(elevator.maintainOptionsTotalPrice) + Number(elevator.totalMi * elevator.item_qty))).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Math.round((elevator.item_price_ct - Math.round(Number(elevator.optionsTotalPrice) + Number(elevator.otherOptionsTotalPrice) + Number(elevator.maintainOptionsTotalPrice) + Number(elevator.totalMi * elevator.item_qty))) / elevator.item_price_ct *1000) /10 + '%'" disabled /></td>
|
|
<?php endif; ?>
|
|
</tr>
|
|
<?php if($permissions): ?>
|
|
<tr>
|
|
<td colspan=5></td>
|
|
<td colspan=4 style="max-width:400px">
|
|
<div class="mi-info">
|
|
<span>電梯設備</span>
|
|
<ul>
|
|
<li x-html="'設備1.0:<b>' + (elevator.mi.equipment_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-html="'報關+運輸費:<b>' + (elevator.mi.customs_shipping_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-html="'工廠卸貨:<b>' + (elevator.mi.unloading_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-html="'運輸至工地:<b>' + (elevator.mi.transport_site_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-html="'安裝成本:<b>' + (elevator.mi.install_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-html="'一年免保:<b>' + (elevator.mi.free1y_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-html="'起吊+木箱+耗材:<b>' + (elevator.mi.other_fee * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
<li x-show="elevator.mi.add_price > 0" x-html="'加價:<b>' + (elevator.mi.add_price * elevator.item_qty).toLocaleString() + '</b>'"></li>
|
|
</ul>
|
|
<p x-html="'以上合計:<b>' + (elevator.totalMi * elevator.item_qty).toLocaleString() + '</b>'"></p>
|
|
<div class="line"></div>
|
|
<span>OPTION</span>
|
|
<ul>
|
|
<template x-for="option in elevator.options">
|
|
<li x-html="option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li>
|
|
</template>
|
|
<template x-for="option in elevator.otherOptions">
|
|
<li x-html="option.item_spec + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li>
|
|
</template>
|
|
<template x-for="option in elevator.maintainOptions">
|
|
<li x-html="option.item_spec + '(' + option.item_qty + '月):<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li>
|
|
</template>
|
|
<template x-for="option in elevator.demolishOptions">
|
|
<li x-html="option.item_spec + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'"></li>
|
|
</template>
|
|
</ul>
|
|
<p x-html="'以上合計:<b>' + (Math.round(Number(elevator.optionsTotalPrice) + Number(elevator.otherOptionsTotalPrice) + Number(elevator.maintainOptionsTotalPrice)) + Number(elevator.demolishOptionsTotalPrice)).toLocaleString() + '</b>'"></p>
|
|
</div>
|
|
|
|
</td>
|
|
</tr>
|
|
<?php endif ;?>
|
|
|
|
</tbody>
|
|
</template>
|
|
<tr>
|
|
<td colspan=4>小計</td>
|
|
<td><input type="text" class="form-control" x-model="elevators_total_price.toLocaleString()" disabled></td>
|
|
</tr>
|
|
</table>
|
|
<table class="table mi-table" border=1>
|
|
<thead>
|
|
<tr>
|
|
<th colspan=8>OPTION 加價</th>
|
|
</tr>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>OPTION ID</th>
|
|
<th>名稱</th>
|
|
<th>單價</th>
|
|
<th>數量</th>
|
|
<th>複價</th>
|
|
<th>備註</th>
|
|
<th>所屬電梯項次</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<template x-for="option in options">
|
|
<tr>
|
|
<td x-html="'<b>' + option.item_no + '</b>'"></td>
|
|
<td x-text="option.price_id"></td>
|
|
<td><input type="text" class="form-control" :value="option.option_name + ((option.option_spec==null || option.option_spec == '') ? '' : '(' + option.option_spec + ')') + ((option.option_memo==null || option.option_memo == '') ? '' : '(' + option.option_memo + ')') " disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Number(option.item_unit_price).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="option.item_qty" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="(option.item_unit_price * option.item_qty).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="option.memo" disabled /></td>
|
|
<td x-text="option.option_relate_spec"></td>
|
|
</tr>
|
|
</template>
|
|
<template x-if="options.length > 0">
|
|
<tr>
|
|
<td colspan=5>小計</td>
|
|
<td >
|
|
<input type="text" x-model="optionsTotalPrice().toLocaleString()" disabled class="form-control">
|
|
</td>
|
|
<td colspan=3></td>
|
|
</tr>
|
|
</template>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<table class="table mi-table" border=1>
|
|
<thead>
|
|
<tr>
|
|
<th colspan=8>除外項目</th>
|
|
</tr>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>詢價單號</th>
|
|
<th>名稱</th>
|
|
<th>單價</th>
|
|
<th>數量</th>
|
|
<th>複價</th>
|
|
<th>所屬電梯項次</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<template x-for="option in otherOptions">
|
|
<tr>
|
|
<td x-html="'<b>' + option.item_no + '</b>'"></td>
|
|
<td x-text="option.price_id"></td>
|
|
<td><input type="text" class="form-control" x-model="option.item_spec" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Number(option.item_unit_price).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="option.item_qty" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="(option.item_unit_price * option.item_qty).toLocaleString()" disabled /></td>
|
|
<td x-text="option.option_relate_spec"></td>
|
|
</tr>
|
|
</template>
|
|
<template x-if="otherOptions.length > 0">
|
|
<tr>
|
|
<td colspan=5>小計</td>
|
|
<td >
|
|
<input type="text" x-model="otherOptionsTotalPrice().toLocaleString()" disabled class="form-control">
|
|
</td>
|
|
<td colspan=3></td>
|
|
</tr>
|
|
</template>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table class="table mi-table" border=1>
|
|
<thead>
|
|
<tr>
|
|
<th colspan=8>保固延長</th>
|
|
</tr>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>規格</th>
|
|
<th>單價</th>
|
|
<th>數量(月)</th>
|
|
<th>複價</th>
|
|
<th>備註</th>
|
|
<th>所屬電梯項次</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<template x-for="option in maintainOptions">
|
|
<tr>
|
|
<td x-text="option.item_no"></td>
|
|
<td x-text="option.item_spec"></td>
|
|
<td x-text="Number(option.item_unit_price).toLocaleString()"></td>
|
|
<td x-text="option.item_qty"></td>
|
|
<td x-text="(option.item_qty * option.item_unit_price).toLocaleString()"></td>
|
|
<td x-text="option.memo"></td>
|
|
<td x-text="option.option_relate_spec"></td>
|
|
</tr>
|
|
</template>
|
|
|
|
<template x-if="maintainOptions.length > 0">
|
|
<tr>
|
|
<td colspan=4>小計</td>
|
|
<td >
|
|
<input type="text" x-model="maintainOptionsTotalPrice().toLocaleString()" disabled class="form-control">
|
|
</td>
|
|
<td colspan=2></td>
|
|
</tr>
|
|
</template>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table class="table mi-table" border=1>
|
|
<thead>
|
|
<tr>
|
|
<th colspan=8>拆梯價格</th>
|
|
</tr>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>人乘/載重</th>
|
|
<th>樓層</th>
|
|
<th>單價</th>
|
|
<th>數量</th>
|
|
<th>複價</th>
|
|
<th>所屬電梯項次</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<template x-for="option in demolishOptions">
|
|
<tr>
|
|
<td x-text="option.item_no"></td>
|
|
<td x-text="option.item_spec"></td>
|
|
<td x-text="option.note"></td>
|
|
<td x-text="Number(option.item_unit_price).toLocaleString()"></td>
|
|
<td x-text="option.item_qty"></td>
|
|
<td x-text="(option.item_qty * option.item_unit_price).toLocaleString()"></td>
|
|
<td x-text="option.option_relate_spec"></td>
|
|
</tr>
|
|
</template>
|
|
|
|
<template x-if="demolishOptions.length > 0">
|
|
<tr>
|
|
<td colspan=4>小計</td>
|
|
<td >
|
|
<input type="text" x-model="demolishOptionsTotalPrice().toLocaleString()" disabled class="form-control">
|
|
</td>
|
|
<td colspan=2></td>
|
|
</tr>
|
|
</template>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table class="table mi-table" border=1 style="width:800px">
|
|
<thead>
|
|
<tr>
|
|
<th>付款辦法</th>
|
|
<th>款別</th>
|
|
<th>比例(%)</th>
|
|
<th>金額</th>
|
|
<th>票期</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td rowspan="4">材料</td>
|
|
<td>1.訂金</td>
|
|
<td><input type="text" class="form-control" x-model="pays[0].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[0].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[0].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60</option>
|
|
<option value="90">90</option>
|
|
<option value="120">120</option>
|
|
<option value="150">150</option>
|
|
<option value="180">180</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>2.二次款</td>
|
|
<td><input type="text" class="form-control" x-model="pays[1].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[1].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[1].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60天</option>
|
|
<option value="90">90天</option>
|
|
<option value="120">120天</option>
|
|
<option value="150">150天</option>
|
|
<option value="180">180天</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>3.貨到工地款</td>
|
|
<td><input type="text" class="form-control" x-model="pays[2].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[2].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[2].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60天</option>
|
|
<option value="90">90天</option>
|
|
<option value="120">120天</option>
|
|
<option value="150">150天</option>
|
|
<option value="180">180天</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>4.其他</td>
|
|
<td><input type="text" class="form-control" x-model="pays[3].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[3].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[3].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60天</option>
|
|
<option value="90">90天</option>
|
|
<option value="120">120天</option>
|
|
<option value="150">150天</option>
|
|
<option value="180">180天</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan=3>材料</td>
|
|
<td>5.安裝完畢款</td>
|
|
<td><input type="text" class="form-control" x-model="pays[4].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[4].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[4].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60天</option>
|
|
<option value="90">90天</option>
|
|
<option value="120">120天</option>
|
|
<option value="150">150天</option>
|
|
<option value="180">180天</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>6.驗收款</td>
|
|
<td><input type="text" class="form-control" x-model="pays[5].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[5].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[5].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60天</option>
|
|
<option value="90">90天</option>
|
|
<option value="120">120天</option>
|
|
<option value="150">150天</option>
|
|
<option value="180">180天</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>7.尾款</td>
|
|
<td><input type="text" class="form-control" x-model="pays[6].pay_scale" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(pays[6].pay_amount).toLocaleString()" disabled /></td>
|
|
<td>
|
|
<select class="form-control" name="" id="" disabled x-model="pays[6].pay_period">
|
|
<option value=""></option>
|
|
<option value="7">7天</option>
|
|
<option value="30" selected>30天</option>
|
|
<option value="60">60天</option>
|
|
<option value="90">90天</option>
|
|
<option value="120">120天</option>
|
|
<option value="150">150天</option>
|
|
<option value="180">180天</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">合計</td>
|
|
<td><input type="text" class="form-control" x-model="totalScale()" disabled /></td>
|
|
<td><input type="text" class="form-control" :value="Number(price_total).toLocaleString()" disabled /></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">備註</td>
|
|
<td colspan="3"><textarea name="" id="" cols="30" rows="5" class="form-control" disabled></textarea></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table class="table customerinfo-table" >
|
|
<tbody>
|
|
<tr>
|
|
<th>卷號</th>
|
|
<th>營業員</th>
|
|
<th>客戶名稱</th>
|
|
<th>案件名稱</th>
|
|
<th colspan="2">地址</th>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="text" class="form-control" x-model="contractno" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="person_name" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="company" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="case_name" disabled /></td>
|
|
<td colspan="2"><input type="text" class="form-control" x-model="address" disabled /></td>
|
|
</tr>
|
|
<tr>
|
|
<th>牌價總額(A)</th>
|
|
<th>售價總額(B)</th>
|
|
<th>破價總額(B-A)</th>
|
|
<th>總台數</th>
|
|
<th>服務費(介紹費)</th>
|
|
<th>價率%(B/A)</th>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="text" class="form-control" x-model="Number(totalStandardPrice()).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Number(price_total).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="(price_total - price_lowest).toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="qty" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="special_fee.toLocaleString()" disabled /></td>
|
|
<td><input type="text" class="form-control" x-model="Math.round(price_total/totalStandardPrice() * 1000)/10" disabled /></td>
|
|
</tr>
|
|
<tr>
|
|
<th>預定成交日</th>
|
|
<th>預訂出貨日</th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="date" disabled class="form-control" x-model="predeal_date" /></td>
|
|
<td><input type="date" disabled class="form-control" x-model="facilitok_date" /></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<th>罰則</th>
|
|
<th>訂金保證金(函)%</th>
|
|
<th>履約保證金(函)%</th>
|
|
<th>保固保證金(函)%</th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="text" disabled class="form-control" x-model="penalty"></td>
|
|
<td><input type="text" disabled class="form-control" x-model="deposit_rate"></td>
|
|
<td><input type="text" disabled class="form-control" x-model="keep_rate"></td>
|
|
<td><input type="text" disabled class="form-control" x-model="warranty_rate"></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<th colspan="6">特記事項</th>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="6">
|
|
<textarea name="" id="" cols="30" rows="5" class="form-control" x-model="memo" disabled></textarea>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<li>營業權限85%以上;85-80%呈至區處長審核;80%以下呈至總經理審核。</li>
|
|
<?php if(count($historySign) > 0): ?>
|
|
<button class="btn btn-primary" style="margin:8px 0 16px;" @click="openHishtorySignModal()">歷史簽核紀錄</button>
|
|
<?php endif; ?>
|
|
<table class="table" style="width:700px">
|
|
<thead>
|
|
<tr>
|
|
<th>審核</th>
|
|
<th>審核人</th>
|
|
<th>結果</th>
|
|
<th>意見</th>
|
|
<th>時間</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>區經理</td>
|
|
<td x-text="sign1"></td>
|
|
<td>
|
|
<?php
|
|
if($sign1 == 'Y'){
|
|
echo "同意";
|
|
}elseif($sign1 == 'N'){
|
|
echo "不同意";
|
|
}elseif($sign1 == 'W'){
|
|
echo "待簽核";
|
|
}else{
|
|
echo "---";
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?php echo isset($sign['sign1_note']) ? $sign['sign1_note'] : "---" ?></td>
|
|
<td><?php echo isset($sign['sign1']) ? explode(',', $sign['sign1'])[2] : "---" ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td x-text="is_renovate=='汰改' ? '服務助理' : '業務承辦人'"></td>
|
|
<td x-text="sign2"></td>
|
|
<td>
|
|
<?php
|
|
if($sign2 == 'Y'){
|
|
echo "同意";
|
|
}elseif($sign2 == 'N'){
|
|
echo "不同意";
|
|
}elseif($sign2 == 'W' && $contract['status'] == 'YS'){
|
|
echo "待簽核";
|
|
}else{
|
|
echo "---";
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?php echo (isset($sign['sign2']) && $sign['sign2']!=NULL) ? $sign['sign2_note'] : '---'?></td>
|
|
<td><?php echo (isset($sign['sign2']) && $sign['sign2']!=NULL) ? explode(',', $sign['sign2'])[2] : '---' ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td x-text="is_renovate=='汰改' ? '服務副總' : '業務部協理'"></td>
|
|
<td x-text="sign3"></td>
|
|
<td>
|
|
<?php
|
|
if($sign3 == 'Y'){
|
|
echo "同意";
|
|
}elseif($sign3 == 'YY'){
|
|
echo "結案同意";
|
|
}elseif($sign3 == 'N'){
|
|
echo "不同意";
|
|
}elseif($sign3 == 'W' && $contract['status'] == 'YS'){
|
|
echo "待簽核";
|
|
}else{
|
|
echo "---";
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?php echo (isset($sign['sign3']) && $sign['sign3']!=NULL) ? $sign['sign3_note'] : '---'?></td>
|
|
<td><?php echo (isset($sign['sign3']) && $sign['sign3']!=NULL) ? explode(',', $sign['sign3'])[2] : '---' ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td>總經理</td>
|
|
<td x-text="sign4"></td>
|
|
<td>
|
|
<?php
|
|
if($contract['status'] == 'YY'){
|
|
if($sign3 == 'YY'){
|
|
echo "---";
|
|
}elseif($sign3 == 'Y' && $sign4 == 'YY'){
|
|
echo "結案同意";
|
|
}
|
|
}else{
|
|
if($sign4 == 'Y' && $contract['status'] == 'YY'){
|
|
echo "同意";
|
|
}elseif($sign4 == 'N' && $contract['status'] == 'YN'){
|
|
echo "不同意";
|
|
}elseif($sign4 == 'W' && $contract['status'] == 'YS' ){
|
|
echo "待簽核";
|
|
}else{
|
|
echo "---";
|
|
}
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?php echo (isset($sign['sign4']) && $sign['sign4']!=NULL) ? $sign['sign4_note'] : '---'?></td>
|
|
<td><?php echo (isset($sign['sign4']) && $sign['sign4']!=NULL) ? explode(',', $sign['sign4'])[2] : '---' ?></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="table" style="width:700px">
|
|
<thead>
|
|
<tr>
|
|
<th>審核意見</th>
|
|
<th>批示售價</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<textarea name="" <?php if($currentSigner != $user_id) echo "disabled" ?> class="form-control" id="" cols="40" rows="5" x-model="reviewcomment"></textarea>
|
|
</td>
|
|
<td>
|
|
<input type="text" class="form-control" disabled />
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div>
|
|
<button class="btn btn-primary" @click="window.history.go(-1)">回上頁</button>
|
|
<?php if($contract['status'] == "YS"){ ?>
|
|
<?php if($currentSigner == $user_id): ?>
|
|
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YN')">不同意(退回)</button>
|
|
<?php if($sign1=='W' || ($sign1=='Y' && $sign2 =='W') || ($sign1 == 'Y' && ($sign2 == 'Y' || $sign2 == NULL) && $sign3 == 'W' && $sign4 == 'W')): ?>
|
|
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YS')">同意(上呈)</button>
|
|
<?php endif ; ?>
|
|
<?php if(($sign3 == 'W' && $sign2 == 'Y') || ($sign3 == 'W' && $sign2 == null && $sign1 == 'Y') || ($sign3 == 'Y' && $sign4 == 'W') ): ?>
|
|
<button class="btn btn-primary" @click="check(<?php echo $currentSign; ?>, 'YY')">同意(結案)</button>
|
|
<?php endif ; ?>
|
|
<?php endif; ?>
|
|
<?php } ?>
|
|
<?php if($contract['attatch1']!=null): ?>
|
|
<a class="btn btn-primary" href="./<?php echo $contract['attatch1']; ?>" download="<?php echo $contract['contractno'] . "報價單"; ?>">下載報價單</a>
|
|
<?php else: ?>
|
|
<a href="javascript:;" class="btn btn-primary" @click="alert('營業員未上傳報價單!')">下載報價單</a>
|
|
<?php endif; ?>
|
|
|
|
<?php if($contract['attatch2']!=null): ?>
|
|
<a class="btn btn-primary" href="./<?php echo $contract['attatch2']; ?>" download="<?php echo $contract['contractno'] . "附表一"; ?>">下載附表一</a>
|
|
<?php else: ?>
|
|
<a href="javascript:;" class="btn btn-primary" @click="alert('營業員未上傳附表一!')">下載附表一</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
const body = document.querySelector('body')
|
|
const mid = <?php echo $contract['id']; ?>;
|
|
const contractno = '<?php echo $contract['contractno']; ?>';
|
|
const person_name = '<?php echo $contract['person_name']; ?>';
|
|
const company = '<?php echo $contract['company']; ?>';
|
|
const case_name = '<?php echo $contract['case_name']; ?>';
|
|
const address = '<?php echo $contract['address']; ?>';
|
|
const price_lowest = '<?php echo $contract['price_lowest']; ?>';
|
|
const price_total = '<?php echo $contract['price_total']; ?>';
|
|
const special_fee = '<?php echo $contract['special_fee']; ?>';
|
|
const predeal_date = '<?php echo $contract['predeal_date']; ?>';
|
|
const facilitok_date = '<?php echo $contract['facilitok_date']; ?>';
|
|
const penalty = '<?php echo $contract['penalty']; ?>';
|
|
const deposit_rate = '<?php echo $contract['deposit_rate']; ?>';
|
|
const keep_rate = '<?php echo $contract['keep_rate']; ?>';
|
|
const warranty_rate = '<?php echo $contract['warranty_rate']; ?>';
|
|
const memo = `<?php echo str_replace('\n', '\\n', $contract['memo']); ?>`;
|
|
|
|
const pays = [...<?php echo json_encode($pays); ?>];
|
|
const items = [...<?php echo json_encode($items); ?>];
|
|
const options = [...<?php echo json_encode($options); ?>];
|
|
const elevators = [...<?php echo json_encode($elevators); ?>];
|
|
|
|
const is_renovate = '<?php echo $contract['ekind']; ?>';
|
|
|
|
const user_id = '<?php echo $user_id; ?>';
|
|
|
|
const sign1 = '<?php echo ($sign) ? explode(',', $sign['sign1'])[0] : "---" ?>';
|
|
const sign2 = '<?php echo ($sign) ? explode(',', $sign['sign2'])[0] : "---" ?>';
|
|
console.log('sign2====>', sign2);
|
|
const sign3 = '<?php echo ($sign) ? explode(',', $sign['sign3'])[0] : "---" ?>';
|
|
const sign4 = '<?php echo ($sign) ? explode(',', $sign['sign4'])[0] : "---" ?>';
|
|
|
|
const currentSignId = '<?php echo $currentSignId; ?>';
|
|
const token = '<?php echo $para = "function_name=pricereview&" . $token_link;; ?>';
|
|
</script>
|