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.
 
 
 
 
 
 

245 lines
9.8 KiB

<?php
include "./header.php";
$Bill = $_POST['Bill'];
$Bill = json_decode($Bill, true);
$data = json_encode($Bill);
?>
<style>
th {
text-align: center;
}
td {
text-align: right;
}
</style>
<div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;">
<a href="account-receivable-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-home"></span>
</a>
</div>
</div>
<div class="container">
<div class="text-center" style="margin-bottom: 20px;">
<h3><strong><?= $Bill[5] ?></strong></h3>
</div>
<form class="form-horizontal">
<div class="form-group">
<div class="col-md-3">
<label for="BillNo">合約號</label>
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $Bill[10] ?>" disabled>
</div>
<div class="col-md-3">
<label for="DeptId">部門</label>
<input type="text" class="form-control" id="DeptId" name="DeptId" value="<?= $Bill[1] ?>" disabled>
</div>
<div class="col-md-3">
<label for="Manager">經理</label>
<input type="text" class="form-control" id="Manager" name="Manager" value="<?= $Bill[2] ?>" disabled>
</div>
<div class="col-md-3">
<label for="PersonName">營業員</label>
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $Bill[4] ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="EnterpriseName">抬頭</label>
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $Bill[6] ?>" disabled>
</div>
<div class="col-md-3">
<label for="TaxNo">統一編號</label>
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[7] ?>" disabled>
</div>
<div class="col-md-6">
<label for="ContactAddress">聯絡地址</label>
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[8] ?>" disabled>
</div>
</div>
<div>
<label for="detail">狀態</label>
<textarea class="form-control" style="height: 150px; width: 50%;" name="detail" id="detail" disabled><?= str_replace("<br>", "\n", $Bill['facilities']) ?></textarea>
</div>
</form>
<div style="width: auto; margin-top: 30px;">
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th></th>
<th>簽約款</th>
<th>二次款</th>
<th>貨抵工地款</th>
<th>安裝款</th>
<th>試車款</th>
<th>官檢款</th>
<th>交車款</th>
<th>尾款</th>
</tr>
</thead>
<tbody>
<tr>
<td>合約金額</td>
<td><?= number_format(round($Bill['sign'][1])) ?></td>
<td><?= number_format(round($Bill['second'][1])) ?></td>
<td><?= number_format(round($Bill['arrive'][1])) ?></td>
<td><?= number_format(round($Bill['install'][1])) ?></td>
<td><?= number_format(round($Bill['tryrun'][1])) ?></td>
<td><?= number_format(round($Bill['check'][1])) ?></td>
<td><?= number_format(round($Bill['delivery'][1])) ?></td>
<td><?= number_format(round($Bill['final'][1])) ?></td>
</tr>
<tr>
<td>目前應收</td>
<td><?= number_format(round($Bill['sign'][3])) ?></td>
<td><?= number_format(round($Bill['second'][3])) ?></td>
<td><?= number_format(round($Bill['arrive'][3])) ?></td>
<td><?= number_format(round($Bill['install'][3])) ?></td>
<td><?= number_format(round($Bill['tryrun'][3])) ?></td>
<td><?= number_format(round($Bill['check'][3])) ?></td>
<td><?= number_format(round($Bill['delivery'][3])) ?></td>
<td><?= number_format(round($Bill['final'][3])) ?></td>
</tr>
</tbody>
</table>
<div style="width: auto; margin-top: 30px;">
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>目前應收</th>
<th>已開發票金額</th>
<th>未開發票金額</th>
<th>已收金額</th>
<th>未收金額</th>
</tr>
</thead>
<tbody>
<tr>
<td><?= number_format(round($Bill['receivable_budget'])) ?></td>
<td><?= number_format(round($Bill['invoice_budget'])) ?></td>
<td><?= number_format(round($Bill['receivable_budget'] - $Bill['invoice_budget'])) ?></td>
<td><?= number_format(round($Bill['received_budget'])) ?></td>
<td><?= number_format(round($Bill['invoice_budget'] - $Bill['received_budget'])) ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<?php
include "./footer.php";
?>
<?php
if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) {
?>
<!-- <button type="button" onclick="create('create',0)" class="btn btn-primary btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;">
新增收款紀錄<span class=" glyphicon glyphicon-plus"></span></button> -->
<?php
}
?>
<div style="margin-right: 10%;margin-left: 10%; justify-content: center;">
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>發票號碼</th>
<th>發票日期</th>
<th>發票狀態</th>
<th>發票金額</th>
<th>收款日期</th>
<th>收款金額</th>
<th>內含手續費</th>
<!-- <th>備註</th>
<th>狀態</th> -->
</tr>
</thead>
<tbody>
<?php if ($Bill['invoice'] != Null) {
foreach ($Bill['invoice'] as $key => $invoice) { ?>
<tr>
<td><?= $key ?></td>
<td><?= $invoice[0] ?></td>
<td><?php switch ($invoice[2]) {
case 0:
echo "藍字";
break;
case 1:
echo "紅字";
break;
case 2:
echo "作廢";
break;
} ?></td>
<td><?= isset($invoice[1])? number_format($invoice[1]):0 ?></td>
<td><?= isset($invoice[3])? $invoice[3]:' ' ?></td>
<td><?= isset($invoice[4])? number_format($invoice[4]):0 ?></td>
<td><?= isset($invoice[5])? number_format($invoice[5]):0 ?></td>
<!-- <td><?= $received['remark'] ?></td>
<td style="text-align: center;">
<?php
switch ($received['status']) {
case 0:
echo "<span style='color:blue;'>進行中</span>";
break;
case 1:
echo "<span style='color:brown;'>催收</span>";
break;
case 2:
echo "<span style='color:red;'>法務件 (發函)</span>";
break;
case 3:
echo "<span style='color:red;'>法務件 (訴訟)</span>";
break;
case 4:
echo "折讓";
break;
case 5:
echo "壞帳";
break;
case 99:
echo "完成";
break;
}
?></td> -->
</tr>
<?php }
}
?>
</tbody>
</table>
</div>
<script>
function create(type, pay_id) {
var BillData = <?= $data ?>;
var form = document.createElement("form");
form.method = 'POST';
if (type === 'create') {
form.action = "account-receivable-received-create.php?<?= $token_link ?>";
} else {
form.action = "account-receivable-received-edit.php?pay_id=" + pay_id + "&<?= $token_link ?>";
}
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(BillData);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
</script>