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.
268 lines
10 KiB
268 lines
10 KiB
<?php
|
|
include "../header.php";
|
|
require_once '../cont/wf_common.php';
|
|
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : "";
|
|
if ($form_key == "") $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
|
|
|
|
if (!empty($form_key)) {
|
|
$sql = "select form_id from flow where form_key = '$form_key'";
|
|
$res = mysqli_query($link, $sql);
|
|
if ($row = mysqli_fetch_row($res)) {
|
|
$id = $row[0];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
// 目前簽核進度
|
|
$pstatus = "";
|
|
$db_query = "select pstatus from pricereview_repair_main where id = '$id'";
|
|
$res_r = mysqli_query($link ,$db_query);
|
|
if ($row_r = mysqli_fetch_row($res_r)) {
|
|
$pstatus = $row_r[0];
|
|
}
|
|
mysqli_free_result($res_r);
|
|
if ($pstatus != "A") {
|
|
echo "<script>";
|
|
echo "alert('請勿重覆簽核!!');";
|
|
echo "window.close();";
|
|
echo "</script>";
|
|
exit;
|
|
}
|
|
}
|
|
|
|
$assign_status = '<option>請選擇</option><option value="F6">呈核</option><option value="Y1">不同意</option>';
|
|
|
|
$data = [];
|
|
$db_query = "select * from pricereview_repair_main where id = '$id'";
|
|
$data = mysqli_query($link, $db_query);
|
|
|
|
foreach($data as $data) :
|
|
// 公司站點
|
|
$sql = "select content from code where field_name = 'masada_addr' and code_name = '".$data["masada_addr"]."'";
|
|
$res = mysqli_query($link, $sql);
|
|
if ($row = mysqli_fetch_row($res)) {
|
|
$data["maddr"] = $row[0];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
// 保養人員
|
|
$repairer_arr = [];
|
|
$sql = "select name from account where accounttype = 'B' and accountid = '".$data["repairerid"]."'";
|
|
$res = mysqli_query($link, $sql);
|
|
if ($row = mysqli_fetch_row($res)) {
|
|
$data["repair"] = $row[0];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
// 價審明細
|
|
$item_arr = [];
|
|
$sql = "select * from pricereview_repair_item where rid = '$id' order by item_no";
|
|
$res = mysqli_query($link, $sql);
|
|
while ($row = mysqli_fetch_assoc($res)) {
|
|
$item_arr[$row["item_no"]]["title"] = $row["title"];
|
|
$item_arr[$row["item_no"]]["item_unit_price"] = $row["item_unit_price"];
|
|
$item_arr[$row["item_no"]]["item_qty"] = $row["item_qty"];
|
|
$item_arr[$row["item_no"]]["item_price_bp"] = $row["item_price_bp"];
|
|
$item_arr[$row["item_no"]]["memo"] = $row["memo"];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
// get form_key
|
|
$sql = "select max(form_key) from assign where assign_opinion = '".$data["repair_no"]."'";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$form_key = $row[0];
|
|
mysqli_free_result($res);
|
|
?>
|
|
<style>
|
|
.nextline {
|
|
width: 100%;
|
|
height: 0;
|
|
}
|
|
input[type=submit], input[type=button] {
|
|
width: 100%;
|
|
background-color: #1E74FD;
|
|
color: white;
|
|
padding: 14px 20px;
|
|
margin: 8px 0;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
}
|
|
.dollar-right {
|
|
text-align: right;
|
|
}
|
|
</style>
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
<script>
|
|
$(function(){
|
|
$(":input").prop("disabled", true);
|
|
$("#assign_status").prop("disabled", false);
|
|
$("#next_users").prop("disabled", false);
|
|
$("#submit").prop("disabled", false);
|
|
$("#assign_status").change(function(){
|
|
if ($(this).val() == "F6") $("#next_users").html('<option value="00000">00000</option>');
|
|
else if ($(this).val() == "Y1") $("#next_users").html('<option value="X">退回</option>');
|
|
else $("#next_users").html('');
|
|
});
|
|
|
|
$('input[name=submit]').click(function(){
|
|
$("#id").prop("disabled", false);
|
|
$("#form_key").prop("disabled", false);
|
|
$("#token").prop("disabled", false);
|
|
});
|
|
});
|
|
</script>
|
|
<div class="container">
|
|
<form class="form-inline" method="post" action="pricereview_repair-record-check.php" enctype="multipart/form-data">
|
|
<div>
|
|
<label for="contractno">客戶合約號</label>
|
|
<input type="text" name="contractno" id="contractno" value="<?php echo $data["contractno"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="repair_no">報價單編號</label>
|
|
<input type="text" name="repair_no" id="repair_no" value="<?php echo $data["repair_no"]; ?>">
|
|
</div>
|
|
<div class="nextline"></div>
|
|
<div>
|
|
<label for="sign_date">簽訂日期</label><br>
|
|
<input type="text" name="sign_date" id="sign_date" value="<?php echo $data["sign_date"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="company">公司地址</label>
|
|
<input type="text" name="masada_addr" id="masada_addr" size="46" value="<?php echo $data["maddr"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="company">客戶名稱</label>
|
|
<input type="text" name="company" id="company" size="30" value="<?php echo $data["company"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="facilityno">電梯編號</label>
|
|
<input type="text" name="facilityno" value="<?php echo $data["facilityno"]; ?>">
|
|
</div>
|
|
<div class="nextline"></div>
|
|
<div>
|
|
<label for="address">工程地址</label>
|
|
<input type="text" name="address" id="address" size="46" value="<?php echo $data["address"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="taxid">客戶統一編號</label>
|
|
<input type="text" name="taxid" id="taxid" value="<?php echo $data["taxid"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="invoice">客戶發票抬頭</label>
|
|
<input type="text" name="invoice" id="invoice" size="30" value="<?php echo $data["invoice"]; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="repairerid">申請人</label>
|
|
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data["repair"]; ?>">
|
|
</div>
|
|
<div class="nextline"></div>
|
|
<div>
|
|
<label for="memo">備註</label><br>
|
|
<textarea name="memo" id="memo" cols="60" rows="4"><?php echo $data["memo"]; ?></textarea>
|
|
</div>
|
|
|
|
<div class="nextline"></div>
|
|
<br>
|
|
|
|
<div class="table-responsive">
|
|
<table id="tb1" class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>名稱</th>
|
|
<th>數量</th>
|
|
<th>單價</th>
|
|
<th>合計</th>
|
|
<th>備註</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach ($item_arr as $k => $v) {
|
|
?>
|
|
<tr name="main_templ">
|
|
<td>
|
|
<input type="text" name="item_no" class="form-control" size="3" value="<?php echo $k; ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" name="item_title" class="form-control" size="40" value="<?php echo $v["title"]; ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" name="item_qty" class="form-control dollar-right" size="3" value="<?php echo number_format($v["item_qty"]); ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" name="item_unit_price" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_unit_price"]); ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" name="item_price_bp" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_price_bp"]); ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" name="item_memo" class="form-control" value="<?php echo $v["memo"]; ?>">
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
<tr>
|
|
<td colspan="3"><h5>營業稅</h5></td>
|
|
<td>
|
|
<input type="text" name="sales_tax" class="dollar-right" size="10" value="<?php echo number_format($data["sales_tax"]); ?>">
|
|
</td>
|
|
<td colspan="2"></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3"><h5>總價</h5></td>
|
|
<td>
|
|
<input type="text" name="total_price" class="dollar-right" size="10" value="<?php echo number_format($data["total_price"]); ?>">
|
|
</td>
|
|
<td colspan="2"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="nextline"></div>
|
|
<?php
|
|
if (($data["checker"] == $user_id) && ($data["pstatus"] == "A")) {
|
|
?>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="10">簽核操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><b style='float:right'>簽核狀態</b></td>
|
|
<td>
|
|
<select name="assign_status" id="assign_status" required class="form-control form-control form-control-sm">
|
|
<?php echo $assign_status; ?>
|
|
</select>
|
|
</td>
|
|
<td><b>下位簽核者</b></td>
|
|
<td>
|
|
<select name="next_users" id="next_users" class="form-control form-control-sm" required></select>
|
|
</td>
|
|
<td>
|
|
<input type="submit" name="submit" id="submit" value="提交">
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>">
|
|
<input type="hidden" name="form_key" id="form_key" value="<?php echo $form_key; ?>">
|
|
<input type="hidden" name="token" id="token" value="<?php echo $token; ?>">
|
|
<?php
|
|
}
|
|
?>
|
|
</form>
|
|
</div>
|
|
<?php
|
|
endforeach;
|
|
?>
|
|
<?php
|
|
include "../footer.php";
|
|
?>
|