5 changed files with 137 additions and 4 deletions
@ -1,4 +1,126 @@ |
|||||
<?php |
<?php |
||||
|
|
||||
include_once "../header.php"; |
include_once "../header.php"; |
||||
require_once('../mkt/conn.php'); |
require_once('../mkt/conn.php'); |
||||
|
|
||||
|
$apply_key = null; |
||||
|
$form_key = null; |
||||
|
if(isset($_GET['apply_key']) && $_GET['apply_key'] != ""){ |
||||
|
$apply_key = $_GET['apply_key']; |
||||
|
}elseif(isset($_GET['form_key']) && $_GET['form_key'] != ""){ |
||||
|
$form_key = $_GET['form_key']; |
||||
|
$sql_str = "SELECT form_id FROM flow WHERE form_key = :form_key"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':form_key', $form_key); |
||||
|
$stmt->execute(); |
||||
|
$flow = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
$apply_key = $flow['form_id']; |
||||
|
|
||||
|
} |
||||
|
if(!isset($_GET['apply_key']) && !isset($_GET['form_key'])){ |
||||
|
echo "找不到此紀錄。"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
$sql_str = "SELECT * FROM con_maintance_examine_apply WHERE apply_key = :apply_key ORDER BY create_at DESC LIMIT 1"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':apply_key', $apply_key); |
||||
|
$stmt->execute(); |
||||
|
$contract = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
if(!$contract){ |
||||
|
echo "找不到此紀錄!"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
$sql_str = "SELECT * FROM con_maintance_examine_clear WHERE (apply_key, cmstatus) = (:apply_key, 'Y') ORDER BY created_at ASC"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':apply_key', $apply_key); |
||||
|
$stmt->execute(); |
||||
|
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
$permissions = false; |
||||
|
//開啟工務權限 |
||||
|
if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){ |
||||
|
$permissions = true; |
||||
|
} |
||||
|
|
||||
|
?> |
||||
|
|
||||
|
<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="pricereviewCheck" x-data=pricereviewCheck> |
||||
|
<div class="container"> |
||||
|
<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.spec"></a></td> |
||||
|
<td><input type="text" class="form-control" x-model="Number(elevator.stand_price).toLocaleString()" disabled /></td> |
||||
|
<td><input type="text" class="form-control" x-model="elevator.maintain_months" disabled /></td> |
||||
|
<td><input type="text" class="form-control" x-model="Number(elevator.stand_price * elevator.maintain_months).toLocaleString()" disabled /></td> |
||||
|
<?php if($permissions): ?> |
||||
|
<td> |
||||
|
<input x-show="true" type="text" class="form-control" value="找不到此規格"> |
||||
|
</td> |
||||
|
<td><input type="text" class="form-control" x-model="(Number(elevator.contract_price)).toLocaleString()" disabled /></td> |
||||
|
<td><input type="text" class="form-control" x-model="(Number(elevator.contract_price) - Number(elevator.stand_price)).toLocaleString()" disabled /></td> |
||||
|
<td><input type="text" class="form-control" x-model="Math.round((Number(elevator.contract_price) - Number(elevator.stand_price) ) / Number(elevator.stand_price)) *100 + '%'" 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> |
||||
|
<span>除外項目</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> |
||||
|
</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> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
const elevators = [...<?php echo json_encode($elevators) ?>]; |
||||
|
</script> |
Loading…
Reference in new issue