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.
 
 
 
 
 
 

261 lines
11 KiB

<?php
include "header.php";
require_once "database.php";
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
if(!empty($id)){
//查詢合同信息
$contract_infosql = "select * from maintance_contract_info where maintance_contract_id='$id'";
$contract_infodata = mysqli_query($link,$contract_infosql);
$data= mysqli_fetch_array($contract_infodata, MYSQLI_ASSOC);
$facitilysql = "SELECT * FROM maintance_contract_detail where maintance_contract_id='$id'";
$facitilydata=mysqli_query($link,$facitilysql);
$sumstandardprice=0;
$sumdiscusspricing=0;
$sumcalibrationfee=0;
$sumyearlyinspectionfee=0;
$sumallfee=0;
foreach ($facitilydata as $fdata){
$sumstandardprice+=intval($fdata['standardprice']);//標準價
$sumdiscusspricing+=intval($fdata['discusspricing']);//議定價
$sumcalibrationfee+=intval($fdata['calibrationfee']);//校驗費
$sumyearlyinspectionfee+=intval($fdata['yearlyinspectionfee']);//年檢費
$sumallfee+=intval($fdata['sumfee']);//小計
}
$servicefee=$data['servicefee'];//服務費
$managefee=$data['managebili'];
// $fdata= mysqli_fetch_array($facitilydata, MYSQLI_ASSOC);
$receivablesql = "SELECT * FROM maintance_contract_receivable where maintance_contract_id='$id'";
$receivabledata=mysqli_query($link,$receivablesql);
$sumreceivableamount=0;
$sumpaidamount=0;
foreach ($receivabledata as $redata){
$sumreceivableamount+=intval($redata['receivableamount']);//應收金額
$sumpaidamount+=intval($redata['paidamount']);//實收金額
}
// $rdata= mysqli_fetch_array($receivabledata, MYSQLI_ASSOC);
$reviewsql = "SELECT * FROM maintance_contract_review where maintance_contract_id='$id'";
$reviewdata=mysqli_query($link,$reviewsql);
}
?>
<div class="container" >
<div class="text-center"> <h2>契約價格審核單</h2> </div>
<div class="text-right"> <h5><?php echo $data['maintance_contract_id']; ?></h5> </div>
<div class="text-left"> <h4>合同信息</h4> </div>
<table class="table table-striped" style="width:100%">
<tbody>
<tr>
<td style="font-weight: bolder" colspan="2">現場名稱</td>
<td><?php echo $data['sitename']; ?></td>
<td style="font-weight: bolder">立約人名稱</td>
<td><?php echo $data['contractor']; ?></td>
<td style="font-weight: bolder;background-color: #eee" rowspan="4"> </td>
<td style="font-weight: bolder;vertical-align: middle!important;" rowspan="3">合約別</td>
<td rowspan="3" style="vertical-align: middle!important;"><?php echo $data['contracttype']; ?></td>
<td style="font-weight: bolder;vertical-align: middle!important;" rowspan="3">保養作業類別</td>
<td rowspan="3" style="vertical-align: middle!important;"><?php echo $data['Maintenanceoperationcategory']; ?></td>
</tr>
<tr>
<td style="font-weight: bolder" colspan="2">合約台數</td>
<td><?php echo $data['contractsnum']; ?></td>
<td style="font-weight: bolder">合約簽訂期限</td>
<td><?php echo $data['contractsigningperiod']; ?></td>
</tr>
<tr>
<td style="font-weight: bolder" colspan="2">現場地址</td>
<td><?php echo $data['siteaddress']; ?></td>
<td style="font-weight: bolder">價審填寫人</td>
<td><?php echo $data['pricereviewer']; ?></td>
</tr>
<tr>
<td colspan="10" style="border: 0"></td>
</tr>
<tr>
<td style="font-weight: bolder" colspan="2">合約簽回性質</td>
<td><?php echo $data['contractsigningnature']; ?></td>
<td><?php echo $data['contractsignname']; ?></td>
</tr>
</tbody>
</table>
<div class="text-left"> <h4>電梯信息</h4> </div>
<table class="table table-striped" >
<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>
<th>小計</th>
<th>合計</th>
</tr>
</thead>
<tbody>
<?php foreach($facitilydata as $fdata) : ?>
<tr>
<td><?php echo $fdata['facilityno']; ?></td>
<td><?php echo $fdata['brand']; ?></td>
<td><?php echo $fdata['type']; ?></td>
<td><?php echo $fdata['speed']; ?></td>
<td><?php echo $fdata['weight']; ?></td>
<td><?php echo $fdata['usednature']; ?></td>
<td><?php echo $fdata['usedage']; ?></td>
<td><?php echo $fdata['tai_count']; ?></td>
<td><?php echo $fdata['yearlyinspectiondate']; ?></td>
<td><?php echo $fdata['standardprice']; ?></td>
<td><?php echo $fdata['discusspricing']; ?></td>
<td><?php echo $fdata['calibrationfee']; ?></td>
<td><?php echo $fdata['yearlyinspectionfee']; ?></td>
<td><?php echo $fdata['sumfee']; ?></td>
<td>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="9" style="text-align: right">合計</td>
<td><?php echo $sumstandardprice; ?></td>
<td><?php echo $sumdiscusspricing; ?></td>
<td><?php echo $sumcalibrationfee; ?></td>
<td><?php echo $sumyearlyinspectionfee; ?></td>
<td><?php echo $sumallfee; ?></td>
<td><?php echo $sumallfee; ?></td>
</tr>
<tr>
<td>G.合同總價(議定價合計)</td>
<td colspan="3"><?php echo $sumdiscusspricing; ?></td>
</tr>
<tr>
<td>H.服務費</td>
<td colspan="3"><?php echo $servicefee; ?></td>
</tr>
<tr>
<td>J.折扣率((G-Sum(C)-Sum(D)-H))/Sum(B))</td>
<td colspan="3">
<?php
$zhe=intval($sumdiscusspricing)-intval($sumcalibrationfee)-intval($sumyearlyinspectionfee)-intval($servicefee);
echo round($zhe/intval($sumdiscusspricing),2);
?>
</td>
</tr>
<tr>
<td>K.合夥人管理費%</td>
<td colspan="3"><?php echo $managefee.'%'; ?></td>
</tr>
<tr>
<td>L.合夥人管理費(G*K)</td>
<td colspan="3"><?php echo intval($sumdiscusspricing)*$managefee/100; ?></td>
</tr>
</tbody>
</table>
<div class="text-left"> <h4>應收款信息</h4> </div>
<table class="table table-striped" style="width:100%">
<thead>
<tr>
<th>編號</th>
<th>付款日期</th>
<th>應收金額</th>
<th>實收金額</th>
</tr>
</thead>
<tbody>
<?php foreach($receivabledata as $k=>$data) : ?>
<tr>
<td><?php echo $k+1; ?></td>
<td><?php echo $data['paymentdate']; ?></td>
<td><?php echo $data['receivableamount']; ?></td>
<td><?php echo $data['paidamount']; ?></td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="2" style="text-align: right">合計</td>
<td><?php echo $sumreceivableamount; ?></td>
<td><?php echo $sumpaidamount; ?></td>
</tr>
</tbody>
</table>
<div class="text-left"> <h4>簽核內容</h4> </div>
<table class="table table-striped" style="width:100%">
<thead>
<tr>
<th>部門</th>
<th>簽核人員</th>
<th>簽核意見(同意,不同意)</th>
<th>意見說明</th>
</tr>
</thead>
<tbody>
<?php foreach($reviewdata as $data) : ?>
<tr>
<td><?php echo $data['signrole']; ?></td>
<td><?php echo $data['signer']; ?></td>
<td><?php echo $data['signresult']; ?></td>
<td><?php echo $data['Contentdescription']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if($_GET['account']!='shenqing'){?>
<div class="text-left"> <h4>簽核意見</h4> </div>
<form class="form-horizontal" method="post" action="review-detail-submit.php" enctype="multipart/form-data">
<table>
<div class="col-md-2">
<select name="signresult" id="signresult" class="signresult" style="margin-top: 10px">
<option value="同意">同意</option>
<option value="不同意">不同意</option>
</select>
</div>
</table>
<div class="text-left"> <h4>內容說明</h4> </div>
<table>
<div class="col-md-12">
<textarea rows="5" cols="5" name="Contentdescription"></textarea>
</div>
</table>
<table>
<div class="col-md-12 text-center">
<button type="submit" name="submit" id="submit" class="btn btn-primary btn-lg" style="margin-top: 20px;">點擊後提交簽核結果</button>
</div>
<input type="hidden" name="signroles" id="signroles">
<input type="hidden" name="signers" id="signers">
<input type="hidden" name="id" id="signer" value="<?php echo $id;?>">
</table>
</form>
<?php }?>
<script>
$(function () {
$('#submit').click(function(){
//處理多組數據
var signrolesArr =window.localStorage.getItem("name");
$('#signroles').val(signrolesArr);
var signer = window.localStorage.getItem("account");
$('#signers').val(signer);
});
})
</script>
</div>
<?php
#代表結束連線
mysqli_close($link);
?>