93 changed files with 12717 additions and 5718 deletions
Binary file not shown.
Binary file not shown.
@ -1,201 +0,0 @@ |
|||||
<?php |
|
||||
include "./header.php"; |
|
||||
$BillNo = $_GET['BillNo']; |
|
||||
echo $BillNo; |
|
||||
//企業名稱 統一編號 聯絡地址 |
|
||||
// $Bill = $_POST['Bill']; |
|
||||
// $Bill = json_decode($Bill, true); |
|
||||
// $sql_received = "SELECT * from account_received where BillNo = '$Bill[0]' ORDER BY `pay_id` ASC"; |
|
||||
// $pay_received = mysqli_query($link, $sql_received); |
|
||||
// $had_received = 0; |
|
||||
// if (mysqli_num_rows($pay_received) == 0) { |
|
||||
// foreach ($pay_received as $received) { |
|
||||
// $had_received += $received['received_amount']; |
|
||||
// } |
|
||||
// } |
|
||||
// $unreceived = $Bill[12] - $had_received; |
|
||||
// $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[4] ?></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[0] ?>" 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[3] ?>" 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[14] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="TaxNo">統一編號</label> |
|
||||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[15] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-6"> |
|
||||
<label for="ContactAddress">聯絡地址</label> |
|
||||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[16] ?>" 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[13]) ?></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> |
|
||||
|
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<tr> |
|
||||
<td><?= number_format(round($Bill[12])) ?></td> |
|
||||
<td><?= number_format(round($Bill[19])) ?></td> |
|
||||
<td><?= number_format(round($Bill[21])) ?></td> |
|
||||
<td><?= number_format(round($Bill[20])) ?></td> |
|
||||
<td><?= number_format(round($Bill[22])) ?></td> |
|
||||
|
|
||||
</tr> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
<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> |
|
||||
|
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<tr> |
|
||||
<td><?= number_format(round($Bill[5])) ?></td> |
|
||||
<td><?= number_format(round($Bill[6])) ?></td> |
|
||||
<td><?= number_format(round($Bill[7])) ?></td> |
|
||||
<td><?= number_format(round($Bill[8])) ?></td> |
|
||||
<td><?= number_format(round($Bill[9])) ?></td> |
|
||||
<td><?= number_format(round($Bill[10])) ?></td> |
|
||||
<td><?= number_format(round($Bill[11])) ?></td> |
|
||||
|
|
||||
</tr> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
</div> |
|
||||
<?php |
|
||||
include "./footer.php"; |
|
||||
|
|
||||
?> |
|
||||
<?php |
|
||||
if ($user_id == "M0122") { |
|
||||
?> |
|
||||
<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 style="width: 10%;">功能</th> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<?php if ($pay_received) { |
|
||||
foreach ($pay_received as $received) { ?> |
|
||||
<tr> |
|
||||
<td><?= $received['invoice_date'] ?></td> |
|
||||
<td><?= number_format($received['invoice_amount']) ?></td> |
|
||||
<td><?= $received['received_date'] ?></td> |
|
||||
<td><?= number_format($received['received_amount']) ?></td> |
|
||||
<td><?= $received['remark'] ?></td> |
|
||||
<td><?php if (in_array(accountidToDepartId($user_id), array('220', '210'))) { ?> |
|
||||
<button type="button" onclick="create('edit',<?= $received['pay_id'] ?>)" class="btn btn-warning btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;"> |
|
||||
<span class="glyphicon glyphicon-pencil"></span></button> |
|
||||
<a href="account-receivable-received-delete.php?id=<?php echo $received['pay_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm"> |
|
||||
<span class=" glyphicon glyphicon-trash"></span> |
|
||||
</a> |
|
||||
<?php } ?> |
|
||||
</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> |
|
File diff suppressed because it is too large
@ -1 +0,0 @@ |
|||||
<?php |
|
@ -1,124 +0,0 @@ |
|||||
<?php |
|
||||
include "./header.php"; |
|
||||
$Bill = $_POST['Bill']; |
|
||||
$BillData = json_decode($Bill, true); |
|
||||
?> |
|
||||
<div style="width: 90%;"> |
|
||||
|
|
||||
<div style="padding-left: 2rem; padding-bottom: 1rem;"> |
|
||||
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="container"> |
|
||||
<div class="text-center"> |
|
||||
<h3><strong><?= $BillData[4] ?></strong></h3> |
|
||||
<h4>新增收款資訊</h4> |
|
||||
</div> |
|
||||
<form class="form-horizontal" id="pay_received" method="POST" action="account-receivable-received-submit.php?type=create&<?= $token_link ?>" enctype="multipart/form-data"> |
|
||||
<div class="form-group" style="margin-left: 1%;margin-right: 1%;"> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="BillNo">合約號</label> |
|
||||
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $BillData[0] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="DeptName">部門</label> |
|
||||
<input type="text" class="form-control" id="DeptName" name="DeptName" value="<?= $BillData[1] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="ManagerName">經理</label> |
|
||||
<input type="text" class="form-control" id="ManagerName" name="ManagerName" value="<?= $BillData[2] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="PersonName">營業員</label> |
|
||||
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $BillData[3] ?>" 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="<?= $BillData[14] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="TaxNo">統一編號</label> |
|
||||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $BillData[15] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-6"> |
|
||||
<label for="ContactAddress">聯絡地址</label> |
|
||||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $BillData[16] ?>" disabled> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="InvoiceDate">發票開立日期</label> |
|
||||
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="InvoiceAmount">發票金額</label> |
|
||||
<input type="number" class="form-control" id="InvoiceAmount" name="InvoiceAmount"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="InvoiceNo">發票號碼</label> |
|
||||
<input type="text" class="form-control" id="InvoiceNo" name="InvoiceNo"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="ReceivedDate">收款日期</label> |
|
||||
<input type="date" class="form-control" id="ReceivedDate" name="ReceivedDate"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="ReceivedAmount">收款金額</label> |
|
||||
<input type="number" class="form-control" id="ReceivedAmount" name="ReceivedAmount"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="remark">備註</label> |
|
||||
<input type="text" class="form-control" id="remark" name="remark"> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
<input type="hidden" name="DeptId" value="<?= $BillData[17] ?>"> |
|
||||
<input type="hidden" name="PersonId" value="<?= $BillData[18] ?>"> |
|
||||
<input type="hidden" name="CustName" value="<?= $BillData[4] ?>"> |
|
||||
<input type="hidden" name="Bill" id="Bill" value=""> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
</div> |
|
||||
<div class="col-md-9"> |
|
||||
<button type="button" onclick="send()" class="btn btn-primary btn-lg pull-right">送出</button> |
|
||||
</div> |
|
||||
</div> |
|
||||
</form> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<script> |
|
||||
function backToIndex() { |
|
||||
var Bill = <?= $Bill ?>; |
|
||||
var form = document.createElement("form"); |
|
||||
form.method = 'POST'; |
|
||||
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|
||||
var input = document.createElement("input"); |
|
||||
input.type = "hidden"; |
|
||||
input.name = "Bill"; |
|
||||
input.value = JSON.stringify(Bill); |
|
||||
form.appendChild(input); |
|
||||
document.body.appendChild(form); |
|
||||
form.submit(); |
|
||||
} |
|
||||
|
|
||||
function send() { |
|
||||
event.preventDefault(); |
|
||||
$("#BillNo").prop("disabled", false); |
|
||||
$("#DeptName").prop("disabled", false); |
|
||||
$("#ManagerName").prop("disabled", false); |
|
||||
$("#PersonName").prop("disabled", false); |
|
||||
var Bill = <?= $Bill ?>; |
|
||||
Bill = JSON.stringify(Bill); |
|
||||
$("#Bill").val(Bill); |
|
||||
$("#pay_received").submit(); |
|
||||
} |
|
||||
</script> |
|
@ -1,142 +0,0 @@ |
|||||
<?php |
|
||||
include "./header.php"; |
|
||||
$Bill = $_POST['Bill']; |
|
||||
$BillData = json_decode($Bill, true); |
|
||||
$pay_id = $_GET['pay_id']; |
|
||||
// echo $pay_id."<br>"; |
|
||||
// print_r($BillData); |
|
||||
$sql_pay = "SELECT * from account_received where pay_id = '$pay_id'"; |
|
||||
$pay = mysqli_query($link, $sql_pay); |
|
||||
$pay = mysqli_fetch_assoc($pay); |
|
||||
|
|
||||
?> |
|
||||
<div style="width: 90%;"> |
|
||||
|
|
||||
<div style="padding-left: 2rem; padding-bottom: 1rem;"> |
|
||||
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
<div class="container"> |
|
||||
<div class="text-center"> |
|
||||
<h3><strong><?= $BillData[4] ?></strong></h3> |
|
||||
<h4>編輯收款資訊</h4> |
|
||||
</div> |
|
||||
<form class="form-horizontal" id="pay_received" method="POST" action="account-receivable-received-submit.php?type=edit&<?= $token_link ?>" enctype="multipart/form-data"> |
|
||||
<div class="form-group" style="margin-left: 1%;margin-right: 1%;"> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="BillNo">合約號</label> |
|
||||
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $BillData[0] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="DeptName">部門</label> |
|
||||
<input type="text" class="form-control" id="DeptName" name="DeptName" value="<?= $BillData[1] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="ManagerName">經理</label> |
|
||||
<input type="text" class="form-control" id="ManagerName" name="ManagerName" value="<?= $BillData[2] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="PersonName">營業員</label> |
|
||||
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $BillData[3] ?>" 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="<?= $BillData[14] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="TaxNo">統一編號</label> |
|
||||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $BillData[15] ?>" disabled> |
|
||||
</div> |
|
||||
<div class="col-md-6"> |
|
||||
<label for="ContactAddress">聯絡地址</label> |
|
||||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $BillData[16] ?>" disabled> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="InvoiceDate">發票開立日期</label> |
|
||||
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate" value="<?= $pay['invoice_date'] ?>"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="InvoiceAmount">發票金額</label> |
|
||||
<input type="number" class="form-control" id="InvoiceAmount" name="InvoiceAmount" value="<?= $pay['invoice_amount'] ?>"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="InvoiceNo">發票號碼</label> |
|
||||
<input type="text" class="form-control" id="InvoiceNo" name="InvoiceNo" value="<?= $pay['invoice_no'] ?>"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="ReceivedDate">收款日期</label> |
|
||||
<input type="date" class="form-control" id="ReceivedDate" name="ReceivedDate" value="<?= $pay['received_date'] ?>"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="ReceivedAmount">收款金額</label> |
|
||||
<input type="number" class="form-control" id="ReceivedAmount" name="ReceivedAmount" value="<?= $pay['received_amount'] ?>"> |
|
||||
</div> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="remark">備註</label> |
|
||||
<input type="text" class="form-control" id="remark" name="remark" value="<?= $pay['remark'] ?>"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
<label for="status" style="color: red;">狀態</label> |
|
||||
<select id="status" name="status"> |
|
||||
<option value=0 <?php if ($pay['status'] == 0) echo "selected" ?>>進行中</option> |
|
||||
<option value=1 <?php if ($pay['status'] == 1) echo "selected" ?>>催收</option> |
|
||||
<option value=2 <?php if ($pay['status'] == 2) echo "selected" ?>>法務件 (發函)</option> |
|
||||
<option value=3 <?php if ($pay['status'] == 3) echo "selected" ?>>法務件 (訴訟)</option> |
|
||||
<option value=4 <?php if ($pay['status'] == 4) echo "selected" ?>>折讓</option> |
|
||||
<option value=5 <?php if ($pay['status'] == 5) echo "selected" ?>>壞帳</option> |
|
||||
<option value=99 <?php if ($pay['status'] == 99) echo "selected" ?>>完成</option> |
|
||||
</select> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
<input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>"> |
|
||||
<input type="hidden" name="Bill" id="Bill" value=""> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<div class="col-md-3"> |
|
||||
</div> |
|
||||
<div class="col-md-9"> |
|
||||
<button type="button" onclick="send()" class="btn btn-primary btn-lg pull-right">送出</button> |
|
||||
</div> |
|
||||
</div> |
|
||||
</form> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
<script> |
|
||||
function backToIndex() { |
|
||||
var Bill = <?= $Bill ?>; |
|
||||
var form = document.createElement("form"); |
|
||||
form.method = 'POST'; |
|
||||
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|
||||
var input = document.createElement("input"); |
|
||||
input.type = "hidden"; |
|
||||
input.name = "Bill"; |
|
||||
input.value = JSON.stringify(Bill); |
|
||||
form.appendChild(input); |
|
||||
document.body.appendChild(form); |
|
||||
form.submit(); |
|
||||
} |
|
||||
|
|
||||
function send() { |
|
||||
event.preventDefault(); |
|
||||
var Bill = <?= $Bill ?>; |
|
||||
Bill = JSON.stringify(Bill); |
|
||||
$("#Bill").val(Bill); |
|
||||
$("#pay_received").submit(); |
|
||||
} |
|
||||
</script> |
|
@ -1,96 +0,0 @@ |
|||||
<?php |
|
||||
include "./header.php"; |
|
||||
$type = $_GET['type']; |
|
||||
$InvoiceNo = empty($_POST['InvoiceNo']) ? '' : str_replace('-', '', trim($_POST['InvoiceNo'])); |
|
||||
$InvoiceDate = isset($_POST['InvoiceDate']) ? $_POST['InvoiceDate'] : ''; |
|
||||
$Bill = $_POST['Bill']; |
|
||||
|
|
||||
$invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount']; |
|
||||
$received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount']; |
|
||||
$received_date = isset($_POST['ReceivedDate']) ? $_POST['ReceivedDate'] : ''; |
|
||||
$remark = isset($_POST['remark']) ? $_POST['remark'] : ''; |
|
||||
|
|
||||
if ($type == 'edit') { |
|
||||
$pay_id = $_POST['pay_id']; |
|
||||
$status = $_POST['status']; |
|
||||
$sql_query_pay = "SELECT * from account_received where pay_id = $pay_id"; |
|
||||
$pay = mysqli_query($link, $sql_query_pay); |
|
||||
$pay = mysqli_fetch_assoc($pay); |
|
||||
|
|
||||
$sql1 = "UPDATE account_received SET "; |
|
||||
if ($InvoiceNo !== $pay['invoice_no']) { |
|
||||
$sql1 .= "invoice_no = '$InvoiceNo',"; |
|
||||
} |
|
||||
if ($InvoiceDate != $pay['invoice_date']) { |
|
||||
|
|
||||
$sql1 .= "invoice_date = '$InvoiceDate',"; |
|
||||
} |
|
||||
if ($invoice_amount != $pay['invoice_amount']) { |
|
||||
$sql1 .= "invoice_amount = $invoice_amount,"; |
|
||||
} |
|
||||
if ($received_amount != $pay['received_amount']) { |
|
||||
$sql1 .= "received_amount = $received_amount,"; |
|
||||
} |
|
||||
if ($received_date != $pay['received_date']) { |
|
||||
$sql1 .= "received_date = '$received_date',"; |
|
||||
} |
|
||||
if ($remark != $pay['remark']) { |
|
||||
$sql1 .= "remark = '$remark',"; |
|
||||
} |
|
||||
if ($status != $pay['status']) { |
|
||||
$sql1 .= "status = $status,"; |
|
||||
} |
|
||||
// $sql1 = substr($sql1, 0, -1); |
|
||||
$sql = $sql1 . "LastOperatorId = '$user_id' WHERE pay_id = $pay_id"; |
|
||||
} else { |
|
||||
$BillNo = $_POST['BillNo']; |
|
||||
$dept_id = $_POST['DeptId']; |
|
||||
$dept_name = $_POST['DeptName']; |
|
||||
$manager_name = $_POST['ManagerName']; |
|
||||
$person_id = $_POST['PersonId']; |
|
||||
$person_name = $_POST['PersonName']; |
|
||||
$cust_name = $_POST['CustName']; |
|
||||
$sql1 = "INSERT INTO account_received ( |
|
||||
BillNo,dept_id,dept_name,manager_name,person_id,person_name,cust_name"; |
|
||||
$sql2 = ",CreatorId) VALUES ('$BillNo','$dept_id','$dept_name','$manager_name','$person_id','$person_name','$cust_name'"; |
|
||||
if (isset($InvoiceNo)) { |
|
||||
$sql1 .= ",invoice_no"; |
|
||||
$sql2 .= ",'$InvoiceNo'"; |
|
||||
} |
|
||||
if ((!empty($InvoiceDate))) { |
|
||||
$sql1 .= ",invoice_date"; |
|
||||
$sql2 .= ",'$InvoiceDate'"; |
|
||||
} |
|
||||
if (isset($invoice_amount)) { |
|
||||
$sql1 .= ",invoice_amount"; |
|
||||
$sql2 .= ",$invoice_amount"; |
|
||||
} |
|
||||
if (isset($received_amount)) { |
|
||||
$sql1 .= ",received_amount"; |
|
||||
$sql2 .= ",$received_amount"; |
|
||||
} |
|
||||
if (!(empty($received_date))) { |
|
||||
$sql1 .= ",received_date"; |
|
||||
$sql2 .= ",'$received_date'"; |
|
||||
} |
|
||||
if (!(empty($remark))) { |
|
||||
$sql1 .= ",remark"; |
|
||||
$sql2 .= ",'$remark'"; |
|
||||
} |
|
||||
$sql = $sql1 . $sql2 . ",'$user_id')"; |
|
||||
} |
|
||||
mysqli_query($link, $sql); |
|
||||
?> |
|
||||
<script> |
|
||||
var Bill = <?= $Bill ?>; |
|
||||
var form = document.createElement("form"); |
|
||||
form.method = 'POST'; |
|
||||
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|
||||
var input = document.createElement("input"); |
|
||||
input.type = "hidden"; |
|
||||
input.name = "Bill"; |
|
||||
input.value = JSON.stringify(Bill); |
|
||||
form.appendChild(input); |
|
||||
document.body.appendChild(form); |
|
||||
form.submit(); |
|
||||
</script> |
|
@ -0,0 +1,773 @@ |
|||||
|
<?php |
||||
|
|
||||
|
include "header.php"; |
||||
|
|
||||
|
$sum_facility = 0; |
||||
|
// M1 |
||||
|
$sum_A40002 = 0; |
||||
|
// 設備 |
||||
|
$sum_A40009 = 0; |
||||
|
// 安裝 |
||||
|
$sum_A40010 = 0; |
||||
|
$sum_total_budget = 0; |
||||
|
$average_budget = 0; |
||||
|
$average_A40002 = 0; |
||||
|
$average_A40009 = 0; |
||||
|
$average_A40010 = 0; |
||||
|
|
||||
|
|
||||
|
$follower = find_follow($user_id); |
||||
|
$arrayData = []; |
||||
|
$receivable_array = []; |
||||
|
// T8所有合約號 |
||||
|
$sql_contractNumber = "SELECT Distinct BillNo FROM salSalesOrder WHERE ModeId = 'T' AND (CurrentState=2 OR CurrentState=4) "; |
||||
|
|
||||
|
// T8發票 (有專案的發票) |
||||
|
$sql_invoice = "SELECT DISTINCT |
||||
|
a.InvoiceNo, a.InvoiceTime,a.OAmountWithTax,a.InvoiceState, |
||||
|
b.FromSalSalesOrder |
||||
|
FROM arSellInvoice as a |
||||
|
LEFT JOIN (SELECT CH.FromSalSalesOrder, SE.* FROM arSellInvoiceMaterial AS SE |
||||
|
LEFT JOIN arCheckBillDetail AS CH ON SE.FromBillNo=CH.BillNo) as b |
||||
|
ON a.BillNo=b.BillNo |
||||
|
WHERE DATALENGTH(b.FromSalSalesOrder)>0 |
||||
|
ORDER BY InvoiceTime ASC"; |
||||
|
|
||||
|
// T8核銷 |
||||
|
$sql_received = "SELECT |
||||
|
a.BillNo, a.WriteOffBizPartnerId,a.PayWriteOffOAmount, |
||||
|
b.FromBillDate AS ReceivedDate,b.CurrWOFeeOAmt AS Fee, |
||||
|
c.OrderBillNo, c.checkBillNo, c.InvoiceNo, c.BillDate AS CheckBillDate |
||||
|
FROM arWriteOffBill AS a |
||||
|
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
||||
|
LEFT JOIN |
||||
|
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
||||
|
FROM arCheckBill |
||||
|
LEFT JOIN arCheckBillInvInfo |
||||
|
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
||||
|
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
||||
|
ON a.BillNo=c.BillNo |
||||
|
WHERE DATALENGTH(c.OrderBillNo) >0"; |
||||
|
|
||||
|
|
||||
|
// 期初收款資訊 |
||||
|
$sql_opening = " |
||||
|
SELECT * FROM account_received "; |
||||
|
// 設定權限:看到自己的/下屬的,資訊處跟財會處可以看全部的 |
||||
|
if ((in_array($user_id, array('M0060', 'M0175'))) || (in_array(accountidToDepartId($user_id), array('220', '210')))) { |
||||
|
} else { |
||||
|
$sql_opening .= " OR person_id = '$user_id'"; |
||||
|
$sql_contractNumber .= " AND (PersonId = '$user_id'"; |
||||
|
if (count($follower) > 0) { |
||||
|
$column_str = "('$user_id'" . ",'"; |
||||
|
$column_str .= implode("','", $follower); |
||||
|
$column_str .= "')"; |
||||
|
$sql_contractNumber .= " OR PersonId IN $column_str)"; |
||||
|
$sql_opening .= " OR person_id IN $column_str)"; |
||||
|
} else { |
||||
|
$sql_opening .= ")"; |
||||
|
$sql_contractNumber .= ")"; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
$contractNumbers = array(); |
||||
|
$query_contract_number = $conn->query($sql_contractNumber); |
||||
|
foreach ($query_contract_number as $contract_numbers) { |
||||
|
array_push($contractNumbers, $contract_numbers['BillNo']); |
||||
|
$str_numbers = "('" . implode("','", $contractNumbers) . "')"; |
||||
|
} |
||||
|
//作番大日程 |
||||
|
$sql = "SELECT |
||||
|
tmp2.*, |
||||
|
d.name AS depart_name |
||||
|
FROM( |
||||
|
SELECT |
||||
|
a.manager, |
||||
|
a2.name as manager_name, |
||||
|
a.name, |
||||
|
a.department_id, |
||||
|
w.salesid, |
||||
|
w.contractno, |
||||
|
w.facilityno, |
||||
|
w.estimated_shipping_date, |
||||
|
w.real_contract_arrival_date, |
||||
|
w.actual_tofactory_date, |
||||
|
w.real_arrival_date, |
||||
|
w.install_end_date, |
||||
|
w.tryrun_end_date, |
||||
|
w.official_check_date, |
||||
|
w.delivery_date |
||||
|
from wipwholestatus AS w |
||||
|
left join account AS a |
||||
|
ON w.salesid = a.accountid |
||||
|
left join account AS a2 |
||||
|
ON a2.accountid = a.manager |
||||
|
where w.status = '1' AND w.contract_type='B' |
||||
|
)AS tmp2 |
||||
|
left join ( |
||||
|
SELECT DISTINCT |
||||
|
department_id, |
||||
|
name |
||||
|
FROM department |
||||
|
|
||||
|
) AS d |
||||
|
ON d.department_id = tmp2.department_id"; |
||||
|
|
||||
|
//T8 銷售訂單 階段收款計畫 |
||||
|
$sql_contract = "SELECT a.BillNo,s.BillDate, a.RowNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, s.DeptId, s.DeptName, |
||||
|
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a |
||||
|
LEFT JOIN (SELECT O.*, DE.DeptName FROM salSalesOrder AS O LEFT JOIN comDepartment AS DE ON O.DeptId=DE.DeptId) AS s on a.BillNo = s.BillNo |
||||
|
LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId "; |
||||
|
if (isset($str_numbers)) { |
||||
|
$sql_contract .= "WHERE s.BillNo IN $str_numbers "; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// T8 銷售訂單 作番金額 |
||||
|
$sql_contract_budget = "SELECT A.BillNo,A.MaterialId, A.OAmountWithTax,A.CU_MaterialId FROM salSalesOrderDetail AS A |
||||
|
LEFT JOIN salSalesOrder AS B ON A.BillNo=B.BillNo |
||||
|
WHERE B.ModeId='T' AND A.ItemType=1 "; |
||||
|
if (isset($str_numbers)) { |
||||
|
$sql_contract_budget .= "AND A.BillNo IN $str_numbers "; |
||||
|
} |
||||
|
$contract = $conn->query($sql_contract); |
||||
|
$contract_data = array(); |
||||
|
// 將T8合約收款階段資料依據款別分類放進arraData裡 |
||||
|
foreach ($contract as $cont) { |
||||
|
$BillNo = $cont['BillNo']; |
||||
|
$BillDate = $cont['BillDate']; |
||||
|
$PayStage = $cont['PayStage']; |
||||
|
$PlanPayDate = $cont['PlanPayDate']; |
||||
|
$PayAmount = $cont['PlanPayAmt']; |
||||
|
$partnerName = $cont['BizPartnerName']; |
||||
|
$EnterpriseName = $cont['EnterpriseName']; |
||||
|
$TaxNo = $cont['TaxNo']; |
||||
|
$ContactAddress = $cont['ContactAddress']; |
||||
|
$RowNo = $cont['RowNo']; |
||||
|
$salesId = $cont['PersonId']; |
||||
|
|
||||
|
//['type'] A:比照新梯、B:純分期、C:其他 |
||||
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 |
||||
|
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 |
||||
|
//['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
||||
|
if (!(isset($arrayData[$BillNo]))) { |
||||
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 9 T8單據日期 10 合約號 |
||||
|
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
||||
|
$arrayData[$BillNo][0] = $cont['DeptId']; |
||||
|
$arrayData[$BillNo][1] = $cont['DeptName']; |
||||
|
$arrayData[$BillNo][3] = $salesId; |
||||
|
$arrayData[$BillNo][5] = $partnerName; |
||||
|
$arrayData[$BillNo][6] = $EnterpriseName; |
||||
|
$arrayData[$BillNo][7] = $TaxNo; |
||||
|
$arrayData[$BillNo][8] = $ContactAddress; |
||||
|
$arrayData[$BillNo][9] = $BillDate; |
||||
|
$arrayData[$BillNo][10] = $BillNo; |
||||
|
$arrayData[$BillNo]['total_budget'] = 0; |
||||
|
$arrayData[$BillNo]['invoice'] = array(); |
||||
|
$arrayData[$BillNo]['received_budget'] = 0; |
||||
|
$arrayData[$BillNo]['invoice_budget'] = 0; |
||||
|
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = 0; |
||||
|
$arrayData[$BillNo]['total_facility_num'] = 0; |
||||
|
} |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0; |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['name'] = $PayStage; |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['PlanPayDate'] = $PlanPayDate; |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['PayAmount'] = $PayAmount; |
||||
|
// 判斷type |
||||
|
$wipStage = ['簽約', '訂金', '貨抵工地', '完工', '試車', '安裝', '驗收', '完工', '交車', '尾款', '合約']; |
||||
|
foreach ($wipStage as $wipstage) { |
||||
|
if (strpos($PayStage, $wipstage) !== false) { |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = "A"; |
||||
|
} |
||||
|
} |
||||
|
$haveNumber = (int) filter_var(str_replace('-', '', $PayStage), FILTER_SANITIZE_NUMBER_INT); |
||||
|
if ($haveNumber > 0 && $arrayData[$BillNo]['PayStage'][$RowNo]['type'] === 0) { |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = "B"; |
||||
|
} elseif ($haveNumber > 0 && $arrayData[$BillNo]['PayStage'][$RowNo]['type'] == 'A') { |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = "C"; |
||||
|
} |
||||
|
} |
||||
|
$received_array = $conn->query($sql_received); |
||||
|
$opening_data = mysqli_query($link, $sql_opening); |
||||
|
$invoice_data = $conn->query($sql_invoice); |
||||
|
$contract_budget_data = $conn->query($sql_contract_budget); |
||||
|
|
||||
|
// 查WMS 契約員主管 |
||||
|
$sql_manager = "SELECT A.accountid, A.name, A.manager, B.name AS manager_name FROM account AS A |
||||
|
LEFT JOIN account AS B ON A.manager = B.accountid "; |
||||
|
$managers = mysqli_query($link, $sql_manager); |
||||
|
|
||||
|
$find_manager = array(); |
||||
|
foreach ($managers as $manager) { |
||||
|
$find_manager[$manager['accountid']] = $manager; |
||||
|
} |
||||
|
// 將T8銷售訂單明細 每個作番金額存入arrayData |
||||
|
$contract_budget = array(); |
||||
|
foreach ($contract_budget_data as $cont) { |
||||
|
$BillNo = $cont['BillNo']; |
||||
|
if (isset($arrayData[$BillNo])) { |
||||
|
$salesid = $arrayData[$BillNo][3]; |
||||
|
if (isset($find_manager[$salesid])) { |
||||
|
$arrayData[$BillNo][2] = $find_manager[$salesid]['manager_name']; |
||||
|
$arrayData[$BillNo][4] = $find_manager[$salesid]['name']; |
||||
|
$arrayData[$BillNo][11] = $find_manager[$salesid]['manager']; |
||||
|
} |
||||
|
$arrayData[$BillNo]['total_budget'] += $cont['OAmountWithTax']; |
||||
|
$sum_total_budget += $cont['OAmountWithTax']; |
||||
|
$arrayData[$BillNo][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
switch ($cont['MaterialId']) { |
||||
|
case "A40002": |
||||
|
$sum_A40002 += $cont['OAmountWithTax']; |
||||
|
break; |
||||
|
case "A40009": |
||||
|
$sum_A40009 += $cont['OAmountWithTax']; |
||||
|
break; |
||||
|
case "A40010": |
||||
|
$sum_A40010 += $cont['OAmountWithTax']; |
||||
|
break; |
||||
|
} |
||||
|
if (isset($arrayData[$BillNo]['facility'][$cont['CU_MaterialId']])) { |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] += $cont['OAmountWithTax']; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$sum_facility += 1; |
||||
|
$arrayData[$BillNo]['total_facility_num'] += 1; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] = $cont['OAmountWithTax']; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = 0; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
||||
|
} |
||||
|
} |
||||
|
if (isset($contract_budget[$cont['BillNo']])) { |
||||
|
$contract_budget[$cont['BillNo']]['total'] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$contract_budget[$cont['BillNo']]['total'] = $cont['OAmountWithTax']; |
||||
|
} |
||||
|
if (isset($contract_budget[$cont['BillNo']][$cont['MaterialId']])) { |
||||
|
$contract_budget[$cont['BillNo']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$contract_budget[$cont['BillNo']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
||||
|
} |
||||
|
|
||||
|
if (isset($contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']])) { |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['total'] += $cont['OAmountWithTax']; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['total'] = $cont['OAmountWithTax']; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40002'] = 0; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40009'] = 0; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40010'] = 0; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/*計算作番佔合約的金額比例 |
||||
|
@param $facility_no string => 作番號 |
||||
|
@param $contract_budget_billno array => $contract_budget[合約號] |
||||
|
return float */ |
||||
|
function get_contract_ratio($facility_no, $contract_budget_billno) |
||||
|
{ |
||||
|
$ratio = 0; |
||||
|
if (isset($contract_budget_billno['facility'][$facility_no])) { |
||||
|
if (empty($contract_budget_billno['total'])) { |
||||
|
} else { |
||||
|
|
||||
|
$ratio += $contract_budget_billno['facility'][$facility_no]['total'] / $contract_budget_billno['total']; |
||||
|
} |
||||
|
} |
||||
|
return $ratio; |
||||
|
} |
||||
|
|
||||
|
/* 比較應收日期 |
||||
|
@param $a array |
||||
|
@param $b array |
||||
|
return int */ |
||||
|
function comparePlanPayDate($a, $b) |
||||
|
{ |
||||
|
return strtotime($a['PlanPayDate']) - strtotime($b['PlanPayDate']); |
||||
|
} |
||||
|
|
||||
|
//取作番大日程作番與時程 進arrayData |
||||
|
// real_contract_arrival_date 預計出貨日 |
||||
|
// real_arrival_date 實際出貨日 |
||||
|
$today = strtotime(date('Ymd')); |
||||
|
$wipwhole_array = mysqli_query($link, $sql); |
||||
|
$wipwhole_status = array(); |
||||
|
foreach ($wipwhole_array as $wip) { |
||||
|
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
||||
|
if (isset($arrayData[$wip['contractno']])) { |
||||
|
// 整理合約資料 |
||||
|
// $arrayData[$wip['contractno']][0] = $wip['department_id'];; |
||||
|
// $arrayData[$wip['contractno']][1] = $wip['depart_name']; |
||||
|
// $arrayData[$wip['contractno']][2] = $wip['manager_name']; |
||||
|
// $arrayData[$wip['contractno']][3] = $wip['salesid']; |
||||
|
// $arrayData[$wip['contractno']][4] = $wip['name']; |
||||
|
$arrayData[$wip['contractno']][10] = $wip['contractno']; |
||||
|
$arrayData[$wip['contractno']]['A40002'] = (isset($contract_budget[$wip['contractno']]['A40002']) && !is_null($contract_budget[$wip['contractno']]['A40002'])) ? $contract_budget[$wip['contractno']]['A40002'] : 0; |
||||
|
$arrayData[$wip['contractno']]['A40009'] = (isset($contract_budget[$wip['contractno']]['A40009']) && !is_null($contract_budget[$wip['contractno']]['A40009'])) ? $contract_budget[$wip['contractno']]['A40009'] : 0; |
||||
|
|
||||
|
// [合約號]['facility'][作番號]['no'] |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno']; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = ""; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['receivable_budget'] = 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['collect_budget'] = 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40002'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40002']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40002'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40002'] : 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40009'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40009']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40009'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40009'] : 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40010'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40010']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40010'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40010'] : 0; |
||||
|
} |
||||
|
$wipwhole_status[$wip['facilityno']] = $wip; |
||||
|
} |
||||
|
|
||||
|
// 整理arrayData[合約]['PayStage']進 (新增) arrayData[合約]['facility'][作番號][PayStage] |
||||
|
$sign_array = ['訂金', '簽約', '合約']; |
||||
|
// 將所有facility的paystage放入一個array以便計算順序 |
||||
|
$allPayStages = []; |
||||
|
foreach ($arrayData as &$value) { |
||||
|
if (isset($value['facility']) && is_iterable($value['facility'])) { |
||||
|
foreach ($value['facility'] as $fakey => &$facility) { |
||||
|
if (isset($contract_budget[$value[10]])) { |
||||
|
$ratio = get_contract_ratio($fakey, $contract_budget[$value[10]]); |
||||
|
for ($stage = 1; $stage < (count($value['PayStage']) + 1); $stage++) { |
||||
|
$facility['PayStage'][$stage] = $value['PayStage'][$stage]; |
||||
|
$facility['PayStage'][$stage]['facilityno'] = $fakey; |
||||
|
//算每個作番的金額 |
||||
|
$facility['PayStage'][$stage]['PayAmount'] = $value['PayStage'][$stage]['PayAmount'] * $ratio; |
||||
|
//算每個作番每個收款階段的收款時間 |
||||
|
switch ($facility['PayStage'][$stage]['type']) { |
||||
|
case "A": |
||||
|
switch ($facility['PayStage'][$stage]['name']) { |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '試車')): |
||||
|
if (isset($wipwhole_status[$fakey]['tryrun_end_date']) && $wipwhole_status[$fakey]['tryrun_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['tryrun_end_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['tryrun_end_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '完工')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '尾款')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '交車')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '驗收')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '安裝')): |
||||
|
if (isset($wipwhole_status[$fakey]['install_end_date']) && $wipwhole_status[$fakey]['install_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['install_end_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['install_end_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '貨抵工地')): |
||||
|
if (isset($wipwhole_status[$fakey]['real_arrival_date']) && $wipwhole_status[$fakey]['real_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_arrival_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['real_arrival_date'])); |
||||
|
} elseif (isset($wipwhole_status[$fakey]['real_contract_arrival_date']) && $wipwhole_status[$fakey]['real_contract_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_contract_arrival_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['real_contract_arrival_date'])); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
case "B": |
||||
|
|
||||
|
break; |
||||
|
case "C": |
||||
|
switch ($facility['PayStage'][$stage]['name']) { |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '試車')): |
||||
|
if (isset($wipwhole_status[$fakey]['tryrun_end_date']) && $wipwhole_status[$fakey]['tryrun_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['tryrun_end_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['tryrun_end_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '完工')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '尾款')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '交車')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '驗收')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '安裝')): |
||||
|
if (isset($wipwhole_status[$fakey]['install_end_date']) && $wipwhole_status[$fakey]['install_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['install_end_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['install_end_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '貨抵工地')): |
||||
|
if (isset($wipwhole_status[$fakey]['real_arrival_date']) && $wipwhole_status[$fakey]['real_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_arrival_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['real_arrival_date']))); |
||||
|
} elseif (isset($wipwhole_status[$fakey]['real_contract_arrival_date']) && $wipwhole_status[$fakey]['real_contract_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_contract_arrival_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['real_contract_arrival_date']))); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
}; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (isset($allPayStages[$value[10]])) { |
||||
|
$allPayStages[$value[10]] = array_merge($allPayStages[$value[10]], $facility['PayStage']); |
||||
|
} else { |
||||
|
$allPayStages[$value[10]] = $facility['PayStage']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
foreach ($allPayStages as $paykey => $pay) { |
||||
|
uasort($allPayStages[$paykey], 'comparePlanPayDate'); |
||||
|
} |
||||
|
|
||||
|
foreach ($allPayStages as &$payStage) { |
||||
|
$sequenceNumber = 1; |
||||
|
foreach ($payStage as $tk => &$pstage) { |
||||
|
$pstage['sequenceNumber'] = $sequenceNumber; |
||||
|
$sequenceNumber += 1; |
||||
|
} |
||||
|
} |
||||
|
// 整理好的收款階段 |
||||
|
$final_paystage = array(); |
||||
|
foreach ($allPayStages as $key => &$payStage) { |
||||
|
if (is_iterable($payStage)) { |
||||
|
foreach ($payStage as $key2 => $pstage) { |
||||
|
$final_paystage[$key][$pstage['sequenceNumber']] = $pstage; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// [invoice][發票號碼][0 發票日期, 1 發票金額, 2 發票狀態, 3 收款日期, 4 收款金額, 5 手續費, 6 核銷單號] |
||||
|
foreach ($invoice_data as $invoice) { |
||||
|
if (isset($arrayData[$invoice['FromSalSalesOrder']])) { |
||||
|
$arrayData[$invoice['FromSalSalesOrder']]['invoice_budget'] += intval($invoice['OAmountWithTax']); |
||||
|
$arrayData[$invoice['FromSalSalesOrder']]['invoice'][$invoice['InvoiceNo']] = [date("Ymd", strtotime($invoice['InvoiceTime'])), $invoice['OAmountWithTax'], $invoice['InvoiceState']]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 把核銷單的內容補到發票資料中 |
||||
|
foreach ($received_array as $received) { |
||||
|
$BillNo = $received['OrderBillNo']; |
||||
|
if (isset($arrayData[$BillNo])) { |
||||
|
if (isset($arrayData[$BillNo]['invoice'][$received['InvoiceNo']])) { |
||||
|
$arrayData[$BillNo]['received_budget'] += $received['PayWriteOffOAmount']; |
||||
|
array_push($arrayData[$BillNo]['invoice'][$received['InvoiceNo']], date($received['ReceivedDate']), $received['PayWriteOffOAmount'], $received['Fee'], $received['BillNo']); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// $final_paystage ['type'] ['PlanPayDate'] ['PayAmount'] ['facilityno'] ['sequenceNumber'] ['name'] ['InvoiceAmount'] ['receivedAmount'] |
||||
|
foreach ($final_paystage as $key => &$payStage) { |
||||
|
if (isset($arrayData[$key]['invoice_budget']) && isset($arrayData[$key]['received_budget'])) { |
||||
|
$tmpInvoice = $arrayData[$key]['invoice_budget']; |
||||
|
$tmpReceived = $arrayData[$key]['received_budget']; |
||||
|
for ($sequence = 1; $sequence <= count($payStage); $sequence++) { |
||||
|
$collect_month = collect_month(strtotime($payStage[$sequence]['PlanPayDate'])); |
||||
|
if ($tmpInvoice > $payStage[$sequence]['PayAmount']) { |
||||
|
$payStage[$sequence]['InvoiceAmount'] = $payStage[$sequence]['PayAmount']; |
||||
|
$tmpInvoice -= $payStage[$sequence]['PayAmount']; |
||||
|
} else { |
||||
|
$payStage[$sequence]['InvoiceAmount'] = $tmpInvoice; |
||||
|
$tmpInvoice = 0; |
||||
|
} |
||||
|
|
||||
|
if ($tmpReceived > $payStage[$sequence]['PayAmount']) { |
||||
|
|
||||
|
$payStage[$sequence]['receivedAmount'] = $payStage[$sequence]['PayAmount']; |
||||
|
$tmpReceived -= $payStage[$sequence]['PayAmount']; |
||||
|
} else { |
||||
|
$payStage[$sequence]['receivedAmount'] = $tmpReceived; |
||||
|
$tmpReceived = 0; |
||||
|
} |
||||
|
if ($collect_month > 0) { |
||||
|
// $arrayData[$key]['facility'][$payStage[$sequence]['facilityno']]['receivable_budget']+=$payStage[$sequence]['PayAmount']; |
||||
|
} |
||||
|
if ($collect_month > 0 && $payStage[$sequence]['PayAmount'] > $payStage[$sequence]['receivedAmount']) { |
||||
|
$payStage[$sequence]['collect_month'] = $collect_month; |
||||
|
} else { |
||||
|
$payStage[$sequence]['collect_month'] = 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 9 T8單據日期 10 合約號 |
||||
|
// 0 合約號 1 作番號 2 部門id 3 部門名稱 4 經理名稱 5 營業員id 6 營業員名稱 7 客戶名稱 8 抬頭 9 統編 10 通訊地址 |
||||
|
// 11 收款階段名稱 12 應收日期 13 收款金額 14 已開金額 15 已收金額 16 催收次數 |
||||
|
$excel_aray = array(); |
||||
|
$today = strtotime(date('Ymt')); |
||||
|
foreach ($arrayData as $key => $value) { |
||||
|
if (isset($final_paystage[$key])) { |
||||
|
for ($sequence = 1; $sequence <= count($final_paystage[$key]); $sequence++) { |
||||
|
$value[4] = (isset($value[4]) && !empty($value[4])) ? $value[4] : '--'; |
||||
|
$value[5] = (isset($value[5]) && !empty($value[5])) ? $value[5] : '--'; |
||||
|
$value[6] = (isset($value[6]) && !empty($value[6])) ? $value[6] : '--'; |
||||
|
$value[7] = (isset($value[7]) && !empty($value[7])) ? $value[7] : '--'; |
||||
|
$value[8] = (isset($value[8]) && !empty($value[8])) ? $value[8] : '--'; |
||||
|
$value[11] = (isset($value[11]) && !empty($value[11])) ? $value[11] : '--'; |
||||
|
$value[12] = (isset($value[12]) && !empty($value[12])) ? date('Y/m/d', strtotime($value[12])) : '--'; |
||||
|
$thisPayStage = $final_paystage[$key][$sequence]; |
||||
|
$keyname = $key . "/" . $final_paystage[$key][$sequence]['facilityno'] . "/" . $value[5]; |
||||
|
$havetopay = ($today >= strtotime($thisPayStage['PlanPayDate'])) ? "V" : "--"; |
||||
|
switch ($havetopay) { |
||||
|
case "V": |
||||
|
$unInvoiceAmount = $thisPayStage['PayAmount'] - $thisPayStage['InvoiceAmount']; |
||||
|
$unReceivedAmount = $thisPayStage['PayAmount'] - $thisPayStage['receivedAmount']; |
||||
|
break; |
||||
|
default: |
||||
|
$unInvoiceAmount = 0; |
||||
|
$unReceivedAmount = 0; |
||||
|
break; |
||||
|
} |
||||
|
$excel_aray[$keyname] = [ |
||||
|
$value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], |
||||
|
$thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay, |
||||
|
number_format(round($thisPayStage['PayAmount'])), |
||||
|
number_format(round($thisPayStage['InvoiceAmount'])), number_format(round($unInvoiceAmount)), |
||||
|
number_format(round($thisPayStage['receivedAmount'])), number_format(round($unReceivedAmount)), |
||||
|
number_format(round($thisPayStage['collect_month'])) |
||||
|
|
||||
|
]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
$total_data = json_encode($excel_aray); |
||||
|
//計算總作番數、金額、A40002、A40009、A40010金額與平均 |
||||
|
$average_budget = round($sum_total_budget / $sum_facility); |
||||
|
$average_A40002 = round($sum_A40002 / $sum_facility); |
||||
|
$average_A40009 = round($sum_A40009 / $sum_facility); |
||||
|
$average_A40010 = round($sum_A40010 / $sum_facility); |
||||
|
|
||||
|
foreach($arrayData as $key=> $data){ |
||||
|
echo $key."<br>"; |
||||
|
print_r($data); |
||||
|
echo "<br>-----------------------------<br>"; |
||||
|
} |
||||
|
exit(); |
||||
|
?> |
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
img { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
.width_style_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.hiddenTable { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
.hidden { |
||||
|
display: none; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div style="width: 98%;margin: 1%;"> |
||||
|
<div class="btn-group btn-group-md " style="padding:10 px; width: 100%;"> |
||||
|
<button type="button" style="width: 12%;" onclick="downloadData()" class="btn btn-success">下載 <span class="glyphicon glyphicon-download-alt"></span></button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="container"> |
||||
|
<div class="text-center" style="margin-bottom: 20px;"> |
||||
|
<h3><strong>合約 (汰改)統整資訊</strong></h3> |
||||
|
</div> |
||||
|
<form class="form-horizontal"> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_total_budget">合約總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_total_budget" name="sum_total_budget" value="<?= number_format($sum_total_budget) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_A40002">M1總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_A40002" name="sum_A40002" value="<?= number_format($sum_A40002) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_A40009">設備總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_A40009" name="sum_A40009" value="<?= number_format($sum_A40009) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_A40010">安裝總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_A40010" name="sum_A40010" value="<?= number_format($sum_A40010) ?>" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-6"> |
||||
|
<label for="sum_facility">總台數</label> |
||||
|
<input type="text" class="form-control" id="sum_facility" name="sum_facility" value="<?= number_format($sum_facility) ?>" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_budget">平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_budget" name="average_budget" value="<?= number_format($average_budget) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_A40002">M1平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_A40002" name="average_A40002" value="<?= number_format($average_A40002) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_A40009">設備平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_A40009" name="average_A40009" value="<?= number_format($average_A40009) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_A40010">安裝平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_A40010" name="average_A40010" value="<?= number_format($average_A40010) ?>" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<?php |
||||
|
include "./footer.php"; |
||||
|
?> |
||||
|
<div style="width: 20%;float:right;margin-right:5%; "> |
||||
|
<label>查詢條件</label> |
||||
|
<input type="text" id="search" name="search" class="form-control" placeholder="請輸入合約號/作番號/客戶名稱" oninput="searchData()"> |
||||
|
</div> |
||||
|
<div style="width: 98%; margin:1%;" style="overflow-x:auto;"> |
||||
|
<table class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style='text-align:center;vertical-align: middle;width:120px'>合約號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:120px'>作番號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>主管</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>契約員</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:130px'>客戶名稱</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>收款階段</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>應收日期</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>是否應收</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>應收金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>已開金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>未開金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>已收金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>催收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>催收次數</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php foreach ($excel_aray as $key => $row) { ?> |
||||
|
<tr class="data-row" style="display: '';" id="<?= $key; ?>"> |
||||
|
<td><?= $row[0]; ?></td> |
||||
|
<td><?= $row[1]; ?></td> |
||||
|
<td><?= $row[2] . "<br>" . $row[3]; ?></td> |
||||
|
<td><?= $row[4] . "<br>" . $row[5]; ?></td> |
||||
|
<td><?= $row[6] . "<br>" . $row[7]; ?></td> |
||||
|
<td><?= $row[8]; ?></td> |
||||
|
<td><?= $row[12]; ?></td> |
||||
|
<td><?= $row[13]; ?></td> |
||||
|
<td><?= $row[14]; ?></td> |
||||
|
<td><?= $row[15]; ?></td> |
||||
|
<td><?= $row[16]; ?></td> |
||||
|
<td><?= $row[17]; ?></td> |
||||
|
<td><?= $row[18]; ?></td> |
||||
|
<td><?= $row[19]; ?></td> |
||||
|
<td><?= $row[20]; ?></td> |
||||
|
</tr> |
||||
|
<?php } ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
function searchData() { |
||||
|
var searchTerm = document.getElementById('search').value.toLowerCase(); |
||||
|
var rows = document.getElementsByClassName('data-row'); |
||||
|
for (var i = 0; i < rows.length; i++) { |
||||
|
var rowText = rows[i].textContent.toLowerCase(); |
||||
|
// var rowText = rows[i].id.toLowerCase(); |
||||
|
if (rowText.includes(searchTerm)) { |
||||
|
console.log(rowText); |
||||
|
rows[i].style.display = ''; |
||||
|
} else { |
||||
|
rows[i].style.display = 'none'; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function downloadData() { |
||||
|
var xhr = new XMLHttpRequest(); |
||||
|
var url = window.location.origin + "/wms/account-receivable-renovate-excel.php?type=all&<?= $token_link ?>"; |
||||
|
xhr.open('POST', url, true); |
||||
|
xhr.setRequestHeader('Content-Type', 'application/json'); |
||||
|
xhr.onreadystatechange = function() { |
||||
|
if (xhr.readyState === 4 && xhr.status === 200) { |
||||
|
var file_path = xhr.responseText; |
||||
|
var link = document.createElement('a'); |
||||
|
var name = "汰改應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
||||
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable-renovate.xlsx"); |
||||
|
link.setAttribute('download', name); |
||||
|
link.style.display = 'none'; |
||||
|
document.body.appendChild(link); |
||||
|
link.click(); |
||||
|
document.body.removeChild(link); |
||||
|
} |
||||
|
} |
||||
|
xhr.send(JSON.stringify({ |
||||
|
Bill: <?= $total_data ?> |
||||
|
})); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
function check(searchname) { |
||||
|
console.log(searchname); |
||||
|
|
||||
|
} |
||||
|
</script> |
Binary file not shown.
@ -0,0 +1,485 @@ |
|||||
|
<?php |
||||
|
|
||||
|
include "header.php"; |
||||
|
|
||||
|
|
||||
|
$sum_total_budget = 0; |
||||
|
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start']; |
||||
|
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end']; |
||||
|
|
||||
|
|
||||
|
/* 比較應收日期 |
||||
|
@param $a array |
||||
|
@param $b array |
||||
|
return int */ |
||||
|
function comparePlanPayDate($a, $b) |
||||
|
{ |
||||
|
return strtotime($a['PlanPayDate']) - strtotime($b['PlanPayDate']); |
||||
|
} |
||||
|
|
||||
|
// 查WMS 契約員主管 |
||||
|
$sql_manager = "SELECT A.accountid, A.name, A.manager, B.name AS manager_name FROM account AS A |
||||
|
LEFT JOIN account AS B ON A.manager = B.accountid "; |
||||
|
$managers = mysqli_query($link, $sql_manager); |
||||
|
|
||||
|
$find_manager = array(); |
||||
|
if (is_iterable($managers)) { |
||||
|
foreach ($managers as $manager) { |
||||
|
$find_manager[$manager['accountid']] = $manager; |
||||
|
} |
||||
|
} |
||||
|
$follower = find_follow($user_id); |
||||
|
$arrayData = array(); |
||||
|
$receivable_array = []; |
||||
|
// T8所有合約號 |
||||
|
$sql_contractNumber = "SELECT MainAll.* , |
||||
|
Person.PersonName, |
||||
|
Dept.DeptName FROM |
||||
|
(SELECT |
||||
|
Main.BillNo, |
||||
|
Main.BillDate, |
||||
|
Main.BizPartnerId, |
||||
|
Biz.ShortName, |
||||
|
Biz.BizPartnerName, |
||||
|
Biz.ContactAddress, |
||||
|
Main.OAmountWithTax, |
||||
|
Main.PersonId, |
||||
|
Main.DeptId, |
||||
|
Main.TypeId, |
||||
|
Main.CurrentState |
||||
|
FROM salSalesOrder AS Main |
||||
|
LEFT JOIN comBusinessPartner AS Biz ON Biz.BizPartnerId = Main.BizPartnerId) AS MainAll |
||||
|
LEFT JOIN comGroupPerson AS Person ON MainAll.PersonId= Person.PersonId |
||||
|
LEFT JOIN comDepartment AS Dept ON MainAll.DeptId= Dept.DeptId |
||||
|
WHERE MainAll.TypeId = 'SP' AND (MainAll.CurrentState=2 OR MainAll.CurrentState=4) "; |
||||
|
if (!is_null($start_date)) { |
||||
|
$start_date = (int)date('Ymd', strtotime($start_date)); |
||||
|
$sql_contractNumber .= " AND MainAll.BillDate >= $start_date "; |
||||
|
} |
||||
|
if (!is_null($end_date)) { |
||||
|
$end_date = (int)date('Ymd', strtotime($end_date)); |
||||
|
$sql_contractNumber .= " AND MainAll.BillDate <= $end_date "; |
||||
|
} |
||||
|
if ((in_array($user_id, array('M0008', 'M0012'))) || (in_array(accountidToDepartId($user_id), array('220', '210', '501')))) { |
||||
|
} else { |
||||
|
$sql_contractNumber .= " AND (MainAll.PersonId = '$user_id'"; |
||||
|
if (count($follower) > 0) { |
||||
|
$column_str = "('$user_id'" . ",'"; |
||||
|
$column_str .= implode("','", $follower); |
||||
|
$column_str .= "')"; |
||||
|
$sql_contractNumber .= " OR MainAll.PersonId IN $column_str)"; |
||||
|
} else { |
||||
|
$sql_contractNumber .= ")"; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
$contractNumbers = array(); |
||||
|
$query_contract_number = $conn->query($sql_contractNumber); |
||||
|
if (is_iterable($query_contract_number)) { |
||||
|
foreach ($query_contract_number as $contract_numbers) { |
||||
|
array_push($contractNumbers, $contract_numbers['BillNo']); |
||||
|
$arrayData[$contract_numbers['BillNo']]['BillNo'] = isset($contract_numbers['BillNo']) ? $contract_numbers['BillNo'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['BillDate'] = isset($contract_numbers['BillDate']) ? $contract_numbers['BillDate'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['CustomerId'] = isset($contract_numbers['BizPartnerId']) ? $contract_numbers['BizPartnerId'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['CustomerName'] = isset($contract_numbers['BizPartnerName']) ? $contract_numbers['BizPartnerName'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['CustomerAddress'] = isset($contract_numbers['ContactAddress']) ? $contract_numbers['ContactAddress'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['OAmountWithTax'] = isset($contract_numbers['OAmountWithTax']) ? $contract_numbers['OAmountWithTax'] : 0; |
||||
|
$arrayData[$contract_numbers['BillNo']]['PersonId'] = isset($contract_numbers['PersonId']) ? $contract_numbers['PersonId'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['DeptId'] = isset($contract_numbers['DeptId']) ? $contract_numbers['DeptId'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['PersonName'] = isset($contract_numbers['PersonName']) ? $contract_numbers['PersonName'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['DeptName'] = isset($contract_numbers['DeptName']) ? $contract_numbers['DeptName'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['ShortName'] = isset($contract_numbers['ShortName']) ? $contract_numbers['ShortName'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['ManagerId'] = !empty($find_manager[$contract_numbers['PersonId']]['manager']) ? $find_manager[$contract_numbers['PersonId']]['manager'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['ManagerName'] = !empty($find_manager[$contract_numbers['PersonId']]['manager_name']) ? $find_manager[$contract_numbers['PersonId']]['manager_name'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['invoice_budget'] = 0; |
||||
|
$arrayData[$contract_numbers['BillNo']]['received_budget'] = 0; |
||||
|
$arrayData[$contract_numbers['BillNo']]['receivable_budget'] = 0; |
||||
|
$sum_total_budget += $contract_numbers['OAmountWithTax']; |
||||
|
} |
||||
|
$str_numbers = "('" . implode("','", $contractNumbers) . "')"; |
||||
|
} |
||||
|
|
||||
|
// T8發票 |
||||
|
$sql_invoice = "SELECT |
||||
|
Detail.BillNo AS InvoiceBillNo, |
||||
|
Detail.MaterialId, |
||||
|
Detail.LAmountWithTax, |
||||
|
Main.InvoiceNo, |
||||
|
CheckAll.FromSalSalesOrder AS BillNo |
||||
|
FROM arSellInvoiceMaterial AS Detail |
||||
|
LEFT JOIN arSellInvoice AS Main ON Detail.BillNo=Main.BillNo |
||||
|
LEFT JOIN ( |
||||
|
SELECT CheckDetail.BillNo, CheckDetail.FromSalSalesOrder, CheckDetail.RowNo |
||||
|
FROM arCheckBillDetail AS CheckDetail ) |
||||
|
AS CheckAll ON CheckAll.BillNo= Detail.FromBillNo AND Detail.FromRowCode = CheckAll.RowNo |
||||
|
WHERE Detail.ItemType=0 AND Main.InvoiceState!=2"; |
||||
|
|
||||
|
// T8核銷 |
||||
|
$sql_received = "SELECT |
||||
|
CheckDetail.OrderBillNo, |
||||
|
arWriteOffBillDetail.FromBillNo AS CheckBillNo, |
||||
|
arWriteOffBillDetail.FromRowCode AS CheckRowCode, |
||||
|
arWriteOffBillDetail.CurrStandOffOAmount |
||||
|
FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBillDetail.BillNo, |
||||
|
arCheckBillDetail.RowCode, |
||||
|
arCheckBillDetail.FromSalSalesOrder AS OrderBillNo, |
||||
|
salSalesOrder.TypeId |
||||
|
FROM arCheckBillDetail |
||||
|
LEFT JOIN salSalesOrder |
||||
|
ON salSalesOrder.BillNo =arCheckBillDetail.FromSalSalesOrder ) |
||||
|
AS CheckDetail |
||||
|
ON CheckDetail.BillNo=arWriteOffBillDetail.FromBillNo AND arWriteOffBillDetail.FromRowCode = CheckDetail.RowCode |
||||
|
WHERE CheckDetail.TypeId = 'SP'"; |
||||
|
|
||||
|
|
||||
|
//T8 銷售訂單 階段收款計畫 |
||||
|
$sql_paystage = "SELECT * from salOrderStagePay"; |
||||
|
if (isset($str_numbers)) { |
||||
|
$sql_paystage .= " WHERE BillNo IN $str_numbers "; |
||||
|
$sql_invoice .= " AND CheckAll.FromSalSalesOrder IN $str_numbers "; |
||||
|
} |
||||
|
|
||||
|
$PayStage = $conn->query($sql_paystage); |
||||
|
$received_array = $conn->query($sql_received); |
||||
|
$invoice_data = $conn->query($sql_invoice); |
||||
|
|
||||
|
$allPayStages = array(); |
||||
|
foreach ($PayStage as $stage) { |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['PlanPayAmt'] = $stage['PlanPayAmt']; |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['PlanPayDate'] = $stage['PlanPayDate']; |
||||
|
$month = collect_month(strtotime($stage['PlanPayDate'])); |
||||
|
if (strtotime($stage['PlanPayDate']) > strtotime(date('Y-m-t', strtotime('now')))) { |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['receivable_ornot'] = '--'; |
||||
|
} else { |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['receivable_ornot'] = 'Y'; |
||||
|
} |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['month'] = $month; |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['received'] = 0; |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['invoice'] = 0; |
||||
|
} |
||||
|
foreach ($allPayStages as $paykey => $pay) { |
||||
|
uasort($allPayStages[$paykey], 'comparePlanPayDate'); |
||||
|
} |
||||
|
|
||||
|
foreach ($allPayStages as &$payStage) { |
||||
|
$sequenceNumber = 1; |
||||
|
foreach ($payStage as $tk => &$pstage) { |
||||
|
$pstage['sequenceNumber'] = $sequenceNumber; |
||||
|
$sequenceNumber += 1; |
||||
|
} |
||||
|
} |
||||
|
// 整理好的收款階段 |
||||
|
$final_paystage = array(); |
||||
|
foreach ($allPayStages as $key => &$payStage) { |
||||
|
if (is_iterable($payStage)) { |
||||
|
foreach ($payStage as $key2 => $pstage) { |
||||
|
if (isset($arrayData[$key])) { |
||||
|
$arrayData[$key]['PayStage'][$pstage['sequenceNumber']] = $pstage; |
||||
|
if (isset($pstage['receivable_ornot']) && $pstage['receivable_ornot'] == 'Y') { |
||||
|
$arrayData[$key]['receivable_budget'] += $pstage['PlanPayAmt']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
foreach ($invoice_data as $inv) { |
||||
|
if (isset($arrayData[$inv['BillNo']])) { |
||||
|
|
||||
|
$arrayData[$inv['BillNo']]['invoice_budget'] += $inv['LAmountWithTax']; |
||||
|
|
||||
|
if (isset($arrayData[$inv['BillNo']]['invoice'][$inv['InvoiceNo']])) { |
||||
|
$arrayData[$inv['BillNo']]['invoice'][$inv['InvoiceNo']] += $inv['LAmountWithTax']; |
||||
|
} else { |
||||
|
$arrayData[$inv['BillNo']]['invoice'][$inv['InvoiceNo']] = $inv['LAmountWithTax']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
foreach ($received_array as $received) { |
||||
|
if (isset($arrayData[$received['OrderBillNo']]) && isset($received['CurrStandOffOAmount']) && $received['CurrStandOffOAmount'] > 0) { |
||||
|
$arrayData[$received['OrderBillNo']]['received_budget'] += $received['CurrStandOffOAmount']; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
foreach ($arrayData as $key => &$value) { |
||||
|
if (!isset($value['PayStage'])) { |
||||
|
$value['receivable_budget'] = $value['OAmountWithTax']; |
||||
|
} else { |
||||
|
$tmpReceived = $value['received_budget']; |
||||
|
$tmpInvoice = $value['invoice_budget']; |
||||
|
if (is_iterable($value['PayStage'])) { |
||||
|
for ($sequence = 1; $sequence <= count($value['PayStage']); $sequence++) { |
||||
|
if ($value['PayStage'][$sequence]['PlanPayAmt'] > $tmpInvoice) { |
||||
|
$value['PayStage'][$sequence]['invoice'] = $tmpInvoice; |
||||
|
$tmpInvoice = 0; |
||||
|
} else { |
||||
|
$value['PayStage'][$sequence]['invoice'] = $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
$tmpInvoice -= $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
} |
||||
|
if ($value['PayStage'][$sequence]['PlanPayAmt'] > $tmpReceived) { |
||||
|
$value['PayStage'][$sequence]['received'] = $tmpReceived; |
||||
|
$tmpReceived = 0; |
||||
|
} else { |
||||
|
$value['PayStage'][$sequence]['received'] = $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
$tmpReceived -= $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
$value['received_budget'] = $tmpReceived; |
||||
|
} |
||||
|
if ($value['receivable_budget'] > 0 && $value['received_budget'] < $value['receivable_budget']) { |
||||
|
$value['month'] = collect_month(strtotime($value['BillDate'])); |
||||
|
} else { |
||||
|
$value['month'] = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$excel_aray = array(); |
||||
|
|
||||
|
foreach ($arrayData as $key => $value) { |
||||
|
$uninvoice_budget = $value['OAmountWithTax'] - $value['invoice_budget']; |
||||
|
$unreceive_budget = $value['receivable_budget'] - $value['received_budget']; |
||||
|
|
||||
|
$excel_aray[$key] = [ |
||||
|
$value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'], |
||||
|
$value['DeptName'], $value['PersonId'], $value['PersonName'], |
||||
|
$value['ManagerId'], $value['ManagerName'], |
||||
|
number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])), |
||||
|
number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)), |
||||
|
number_format(round($value['received_budget'])), $unreceive_budget, $value['month'] |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
$total_data = json_encode($excel_aray); |
||||
|
|
||||
|
?> |
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
img { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
.width_style_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.hiddenTable { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
.hidden { |
||||
|
display: none; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div style="width: 98%;margin: 1%;"> |
||||
|
<div class="btn-group btn-group-md " style="padding:10 px; width: 100%;"> |
||||
|
<button type="button" style="width: 12%;" onclick="downloadData()" class="btn btn-success">下載 <span class="glyphicon glyphicon-download-alt"></span></button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="container"> |
||||
|
<div class="text-center" style="margin-bottom: 20px;"> |
||||
|
<h3><strong> 零件 & 維修 應收帳款</strong></h3> |
||||
|
</div> |
||||
|
<form class="form-horizontal" id='myForm' method='post' action='account-receivable-repair-index.php?<?= $token_link ?>'> |
||||
|
<table class="table table-striped table-bordered" style='width:98%;text-align:center;margin:0 auto'> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<th class="text-center" style="vertical-align: middle;">合約日期</th> |
||||
|
<td colspan="2"> |
||||
|
<input type="date" class='form-control' id='date_start' name='date_start' style='width:40%;display:inline;'> |
||||
|
~ |
||||
|
<input type="date" class='form-control' id='date_end' name='date_end' style='width:40%;display:inline;'> |
||||
|
<button type="submit" class="btn btn-primary btn-sm">搜尋</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th class="text-center" style="vertical-align: middle;">合約總金額</th> |
||||
|
<td colspan="2"> |
||||
|
<input type="text" class="form-control" id="sum_total_budget" name="sum_total_budget" value="<?= number_format($sum_total_budget) ?> 元" disabled> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</form> |
||||
|
<hr> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_contract">查詢合約號</label> |
||||
|
<input type="text" id="search_contract" name="search_contract" class="form-control" placeholder="請輸入合約號" oninput="searchFront('contract')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_customerid">查詢客戶編號</label> |
||||
|
<input type="text" id="search_customerid" name="search_customerid" class="form-control" placeholder="請輸入客戶編號" oninput="searchFront('customerid')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_customername">查詢客戶名稱</label> |
||||
|
<input type="text" id="search_customername" name="search_customername" class="form-control" placeholder="請輸入客戶名稱" oninput="searchFront('customername')"> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_department">查詢部門</label> |
||||
|
<input type="text" id="search_department" name="search_department" class="form-control" placeholder="請輸入部門" oninput="searchFront('department')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_personId">查詢契約員</label> |
||||
|
<input type="text" id="search_personId" name="search_personId" class="form-control" placeholder="請輸入契約員工號/姓名" oninput="searchFront('personId')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_manager">查詢主管</label> |
||||
|
<input type="text" id="search_manager" name="search_manager" class="form-control" placeholder="請輸入主管工號/姓名" oninput="searchFront('manager')"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-2"> |
||||
|
<input type="text" id="search_manager" name="search_manager" class="form-control" placeholder="請輸入主管工號/姓名" oninput="searchFront('manager')"> |
||||
|
</div> |
||||
|
<div class="col-md-2"> |
||||
|
<input class="form-control" value="催收次數" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<?php |
||||
|
include "./footer.php"; |
||||
|
?> |
||||
|
<div style="width: 20%;float:right;margin-right:5%; "> |
||||
|
<label>查詢條件</label> |
||||
|
<input type="text" id="search" name="search" class="form-control" placeholder="請輸入合約號/客戶名稱" oninput="searchData()"> |
||||
|
</div> |
||||
|
<div style="width: 98%; margin:1%;" style="overflow-x:auto;"> |
||||
|
<table class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style='text-align:center;vertical-align: middle;width:140px'>合約號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:100px'>合約日期</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>客戶編號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:140px'>客戶名稱</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>主管</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>契約員</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>合約總金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>應收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>已開金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>未開金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>已收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>催收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>催收次數</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php foreach ($excel_aray as $key => $row) { ?> |
||||
|
|
||||
|
<tr class="data-row" style="display: '';" id="<?= $key; ?>"> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="contract"><?= $row[0]; ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="contractdate"><?= $row[1]; ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="customerid"><?= $row[2] ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="customername"><?= $row[3] ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="department"><?= $row[4] ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="manager"><?= $row[7] . "<br>" . $row[8]; ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="personId"><?= $row[5] . "<br>" . $row[6]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="total_budget"><?= $row[9]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="receivable_budget"><?= $row[10]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="invoice_budget"><?= $row[11]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="un_invoice_budget"><?= $row[12]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="received_budget"><?= $row[13]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="un_received_budget"><?= $row[14]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="collect_month"><?= $row[15]; ?></td> |
||||
|
</tr> |
||||
|
<?php } |
||||
|
?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
function searchData() { |
||||
|
var searchTerm = document.getElementById('search').value.toLowerCase(); |
||||
|
var rows = document.getElementsByClassName('data-row'); |
||||
|
for (var i = 0; i < rows.length; i++) { |
||||
|
var rowText = rows[i].textContent.toLowerCase(); |
||||
|
if (rowText.includes(searchTerm)) { |
||||
|
console.log(rowText); |
||||
|
rows[i].style.display = ''; |
||||
|
} else { |
||||
|
rows[i].style.display = 'none'; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function searchFront(area) { |
||||
|
var term = 'search_' + area; |
||||
|
var searchTerm = document.getElementById(term).value.toLowerCase(); |
||||
|
var searchArea = document.getElementsByClassName(area); |
||||
|
var rows = document.getElementsByClassName('data-row'); |
||||
|
for (var i = 0; i < rows.length; i++) { |
||||
|
var rowText = searchArea[i].textContent.toLowerCase(); |
||||
|
if (rowText.includes(searchTerm)) { |
||||
|
rows[i].style.display = ''; |
||||
|
} else { |
||||
|
rows[i].style.display = 'none'; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function downloadData() { |
||||
|
var xhr = new XMLHttpRequest(); |
||||
|
var url = window.location.origin + "/wms/account-receivable-renovate-excel.php?type=repair&<?= $token_link ?>"; |
||||
|
xhr.open('POST', url, true); |
||||
|
xhr.setRequestHeader('Content-Type', 'application/json'); |
||||
|
xhr.onreadystatechange = function() { |
||||
|
if (xhr.readyState === 4 && xhr.status === 200) { |
||||
|
var file_path = xhr.responseText; |
||||
|
var link = document.createElement('a'); |
||||
|
var name = "零件&修理應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
||||
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable-repair.xlsx"); |
||||
|
link.setAttribute('download', name); |
||||
|
link.style.display = 'none'; |
||||
|
document.body.appendChild(link); |
||||
|
link.click(); |
||||
|
document.body.removeChild(link); |
||||
|
} |
||||
|
} |
||||
|
xhr.send(JSON.stringify({ |
||||
|
Bill: <?= $total_data ?> |
||||
|
})); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
function check(searchname) { |
||||
|
console.log(searchname); |
||||
|
|
||||
|
} |
||||
|
</script> |
Binary file not shown.
@ -1,75 +0,0 @@ |
|||||
<?php |
|
||||
require_once('../../contract/connt8.php'); |
|
||||
|
|
||||
// if (!empty($_GET['contract_no'])) { |
|
||||
// $contract_no = $_GET['contract_no']; |
|
||||
$contract_no = 'Q23080067'; |
|
||||
|
|
||||
$sql = "SELECT |
|
||||
a.BillNo, |
|
||||
b.OTaxAmt as amount, |
|
||||
a.CU_EstPayDate as createDate, |
|
||||
b.PersonId as personId, |
|
||||
c.BillNo as CBno, |
|
||||
c.CU_MaterialId as facility |
|
||||
FROM salIncomeApplyDetail as a |
|
||||
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
|
||||
LEFT JOIN ( |
|
||||
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
|
||||
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
|
||||
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS' |
|
||||
) AS c ON a.BillNo = c.BizPartnerId |
|
||||
WHERE a.BillNo = 'Q23080067' |
|
||||
AND a.RowNo = '1' |
|
||||
"; |
|
||||
$stmt = $connT8->prepare($sql); |
|
||||
$stmt->execute(); |
|
||||
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
|
||||
$data['amount'] = intval($data['amount']); |
|
||||
$checkBillNo = $data['CBno']; |
|
||||
|
|
||||
|
|
||||
$sql = "SELECT |
|
||||
c.BillDate AS CheckBillDate |
|
||||
FROM arWriteOffBill AS a |
|
||||
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
|
||||
LEFT JOIN |
|
||||
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
|
||||
LEFT JOIN |
|
||||
(SELECT |
|
||||
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
|
||||
FROM arCheckBill |
|
||||
LEFT JOIN arCheckBillInvInfo |
|
||||
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
|
||||
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
|
||||
ON a.BillNo=c.BillNo |
|
||||
WHERE c.checkBillNo = '$checkBillNo' |
|
||||
"; |
|
||||
|
|
||||
$stmt = $connT8->prepare($sql); |
|
||||
$stmt->execute(); |
|
||||
$check = $stmt->fetch(PDO::FETCH_ASSOC); |
|
||||
|
|
||||
|
|
||||
|
|
||||
$CU_MaterialId = $data['facility']; |
|
||||
$sql = "SELECT SQuantity FROM salIncomeApplyDetail WHERE BillNo = :contract_no AND CU_MaterialId = :CU_MaterialId"; |
|
||||
$stmt = $connT8->prepare($sql); |
|
||||
$stmt->bindParam(':contract_no', $contract_no); |
|
||||
$stmt->bindParam(':CU_MaterialId', $CU_MaterialId); |
|
||||
$stmt->execute(); |
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|
||||
$count = COUNT($result); |
|
||||
$data['maintain_month'] = intval($count * $result[0]['SQuantity']); |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
if (!empty($check['CheckBillDate'])) { |
|
||||
header('Content-Type: application/json'); |
|
||||
echo json_encode($data); |
|
||||
} else { |
|
||||
echo false; |
|
||||
exit; |
|
||||
} |
|
||||
// } |
|
@ -1,399 +0,0 @@ |
|||||
<?php |
|
||||
include "header.php"; |
|
||||
include "css/view/wipwhole-index.php"; |
|
||||
|
|
||||
// 設置一個空陣列來放資料 |
|
||||
$data = array(); |
|
||||
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; |
|
||||
$contractno = getContractnoDetails($link, $user_id, $contractno); |
|
||||
|
|
||||
$sql = " |
|
||||
SELECT |
|
||||
siamd.RowNo, |
|
||||
siamd.RowCode, |
|
||||
siam.BillNo, |
|
||||
siamd.CU_EstPayDate, |
|
||||
siamd.UnTransCheckBLAmtWTax , |
|
||||
siamd.HadTransCheckBLAmtWTax, |
|
||||
siamd.CU_MaterialId, |
|
||||
acb_tmp.BillNo2, |
|
||||
acb_tmp.RowCode2, |
|
||||
asim.BillNo AS BillNo3, |
|
||||
asim.InvoiceName, |
|
||||
asim.OAmountWithTax, |
|
||||
asi.InvoiceNo |
|
||||
FROM salIncomeApplyMaster AS siam -- 收入申請單 |
|
||||
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細 |
|
||||
ON siam.BillNo = siamd.BillNo |
|
||||
LEFT JOIN ( |
|
||||
SELECT |
|
||||
acbd.FromRowCode, |
|
||||
acb.FromBillNo, |
|
||||
acbd.BillNo AS BillNo2, |
|
||||
acbd.RowCode AS RowCode2 |
|
||||
FROM arCheckBill AS acb -- 應收確認單 |
|
||||
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細 |
|
||||
ON acb.BillNo = acbd.BillNo |
|
||||
WHERE 1 = 1 |
|
||||
AND acb.TypeId = 'RVS' |
|
||||
"; |
|
||||
$sql .= !empty($contractno) ? " AND acb.FromBillNo IN ($contractno) " : ""; |
|
||||
$sql .= " |
|
||||
) AS acb_tmp |
|
||||
ON siamd.RowNo = acb_tmp.FromRowCode |
|
||||
AND siamd.BillNo = acb_tmp.FromBillNo |
|
||||
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細 |
|
||||
ON asim.FromBillNo = acb_tmp.BillNo2 |
|
||||
AND asim.RowCode = acb_tmp.RowCode2 |
|
||||
LEFT JOIN arSellInvoice AS asi |
|
||||
ON asim.BillNo = asi.BillNo |
|
||||
WHERE 1 = 1 |
|
||||
"; |
|
||||
$sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : ""; |
|
||||
$data = $conn->query($sql); |
|
||||
|
|
||||
function getContractnoDetails($link, $user_id, $contractno = null) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
c.contractno |
|
||||
FROM contract AS c |
|
||||
LEFT JOIN con_maintance_examine_apply AS cmea |
|
||||
ON c.contractno = cmea.vol_no |
|
||||
WHERE 1 = 1 |
|
||||
AND cmea.salesman IN (" . getAccountids($link, $user_id) . ") |
|
||||
"; |
|
||||
if (!empty($contractno)) { |
|
||||
$sql .= " |
|
||||
AND c.contractno = '$contractno' |
|
||||
"; |
|
||||
} |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) { |
|
||||
array_push($data, $row['contractno']); |
|
||||
} |
|
||||
return "'" . implode("','", $data) . "'"; |
|
||||
} |
|
||||
|
|
||||
function getSalesmanNo($link, $contractno) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
cmea.salesman |
|
||||
FROM contract AS c |
|
||||
LEFT JOIN con_maintance_examine_apply AS cmea |
|
||||
ON c.contractno = cmea.vol_no |
|
||||
WHERE 1 = 1 |
|
||||
AND c.contractno IN ('$contractno') |
|
||||
"; |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) |
|
||||
return $row['salesman']; |
|
||||
return ""; |
|
||||
} |
|
||||
function getSalesmanName($link, $contractno) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
a.name |
|
||||
FROM contract AS c |
|
||||
LEFT JOIN con_maintance_examine_apply AS cmea |
|
||||
ON c.contractno = cmea.vol_no |
|
||||
LEFT JOIN account AS a |
|
||||
ON cmea.salesman = a.accountid |
|
||||
WHERE 1 = 1 |
|
||||
AND c.contractno IN ('$contractno') |
|
||||
"; |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) |
|
||||
return $row['name']; |
|
||||
return ""; |
|
||||
} |
|
||||
|
|
||||
function getAccountids($link, $user_id) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
accountid |
|
||||
FROM account |
|
||||
WHERE 1 = 1 |
|
||||
AND (accountid = '$user_id' |
|
||||
OR accountid IN ( |
|
||||
SELECT |
|
||||
accountid |
|
||||
FROM account |
|
||||
WHERE 1 = 1 |
|
||||
AND manager = '$user_id' |
|
||||
AND accounttype IN ('B','E','M','W') |
|
||||
) |
|
||||
) |
|
||||
"; |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) { |
|
||||
array_push($data, $row['accountid']); |
|
||||
} |
|
||||
return "'" . implode("','", $data) . "'"; |
|
||||
} |
|
||||
|
|
||||
function checkArCheckBillStatus($row) |
|
||||
{ |
|
||||
$CU_EstPayDate = $row['CU_EstPayDate']; |
|
||||
$BillNo2 = $row['BillNo2']; |
|
||||
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) { |
|
||||
if (empty($BillNo2)) { |
|
||||
return "<span class='text-danger'>未轉應收確認單</span>"; |
|
||||
} else { |
|
||||
return "<span class='text-primary'>已轉應收確認單</span>"; |
|
||||
} |
|
||||
} else { |
|
||||
return "時間未到"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
function arSellInvoiceMaterial($row) |
|
||||
{ |
|
||||
|
|
||||
$CU_EstPayDate = $row['CU_EstPayDate']; |
|
||||
$InvoiceName = $row['InvoiceName']; |
|
||||
|
|
||||
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) { |
|
||||
if (empty($InvoiceName)) { |
|
||||
return "<span class='text-danger'>未開發票</span>"; |
|
||||
} else { |
|
||||
return "<span class='text-primary'>已開發票</span>"; |
|
||||
} |
|
||||
} else { |
|
||||
return "時間未到"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
function checkArWriteOffBill($conn, $row) |
|
||||
{ |
|
||||
$BillNo = $row['BillNo2']; |
|
||||
|
|
||||
$sql = " |
|
||||
SELECT |
|
||||
* |
|
||||
-- a.BillNo, |
|
||||
-- a.WriteOffBizPartnerId, |
|
||||
-- a.PayWriteOffOAmount, |
|
||||
-- b.FromBillDate AS ReceivedDate, |
|
||||
-- b.CurrWOFeeOAmt AS Fee, |
|
||||
-- c.OrderBillNo, |
|
||||
-- c.checkBillNo, |
|
||||
-- c.InvoiceNo, |
|
||||
-- c.BillDate AS CheckBillDate |
|
||||
FROM arWriteOffBill AS a |
|
||||
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
|
||||
LEFT JOIN |
|
||||
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
|
||||
LEFT JOIN |
|
||||
(SELECT |
|
||||
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
|
||||
FROM arCheckBill |
|
||||
LEFT JOIN arCheckBillInvInfo |
|
||||
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
|
||||
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
|
||||
ON a.BillNo=c.BillNo |
|
||||
WHERE c.checkBillNo = '$BillNo' |
|
||||
"; |
|
||||
|
|
||||
$del = $conn->query($sql); |
|
||||
$i = 0; |
|
||||
foreach ($del as $row) |
|
||||
$i++; |
|
||||
if (empty($i)) { |
|
||||
return "<span class='text-danger'>未收款</span>"; |
|
||||
} else { |
|
||||
return "<span class='text-primary'>已收款</span>"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
|
|
||||
<?php if ($user_auth & 2) { ?> |
|
||||
<!-- <p> |
|
||||
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|
||||
<span class="glyphicon glyphicon-plus"></span> |
|
||||
</a> |
|
||||
</p> --> |
|
||||
<?php |
|
||||
} |
|
||||
if ($data) : |
|
||||
?> |
|
||||
|
|
||||
<style> |
|
||||
table { |
|
||||
table-layout: fixed; |
|
||||
width: 100%; |
|
||||
} |
|
||||
|
|
||||
td { |
|
||||
word-wrap: break-word; |
|
||||
} |
|
||||
|
|
||||
img { |
|
||||
width: 125px; |
|
||||
} |
|
||||
|
|
||||
.width_style_1 { |
|
||||
width: 125px; |
|
||||
} |
|
||||
|
|
||||
table { |
|
||||
width: 100%; |
|
||||
} |
|
||||
|
|
||||
#table_index_filter { |
|
||||
float: right; |
|
||||
} |
|
||||
|
|
||||
#table_index_paginate { |
|
||||
float: right; |
|
||||
} |
|
||||
|
|
||||
label { |
|
||||
display: inline-flex; |
|
||||
margin-bottom: .5rem; |
|
||||
margin-top: .5rem; |
|
||||
|
|
||||
} |
|
||||
</style> |
|
||||
|
|
||||
<div style="overflow-x:auto;"> |
|
||||
<form id='myForm' method='post' action='maintainance_contract_payment_status.php?<?= $token_link ?>'> |
|
||||
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan="5"> |
|
||||
<h3 style='text-align:center'>保養合約-應收款項明細</h3> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<tr> |
|
||||
<th style='text-align:center;vertical-align: middle;'>合約號</th> |
|
||||
<td style='text-align:center;vertical-align: middle;'> |
|
||||
<input type="text" class='form-control' id='contractno' name='contractno' value=""> |
|
||||
</td> |
|
||||
<td style='text-align:left;vertical-align: middle;'> |
|
||||
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</form> |
|
||||
</div> |
|
||||
|
|
||||
<div style="overflow-x:auto;"> |
|
||||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>合約號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>電梯編號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>預計請款日</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>請款金額(未轉應收)</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>請款金額(已轉應收)</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>應收申請單號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>發票狀態</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:50px;'>發票單標示號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>發票單號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>發票明細</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>核銷</th> |
|
||||
<!-- <th style='text-align:center;vertical-align: middle;'>核銷日期</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>未核銷金額</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>已核銷金額</th> --> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<?php foreach ($data as $row) { ?> |
|
||||
<tr> |
|
||||
<td> |
|
||||
<?php |
|
||||
echo getSalesmanNo($link, $row['BillNo']); |
|
||||
echo "<br/>"; |
|
||||
echo getSalesmanName($link, $row['BillNo']); |
|
||||
?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['BillNo']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['RowNo']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['CU_MaterialId']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo date('Y/m/d', strtotime($row['CU_EstPayDate'])); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo collect_month(strtotime($row['CU_EstPayDate'])); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo checkArCheckBillStatus($row); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo number_format(intval($row['UnTransCheckBLAmtWTax']), 0, '', ','); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo number_format(intval($row['HadTransCheckBLAmtWTax']), 0, '', ','); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['BillNo2']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo arSellInvoiceMaterial($row); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['RowCode2']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['BillNo3']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['InvoiceName']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo number_format(intval($row['OAmountWithTax']), 0, '', ','); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['InvoiceNo']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php |
|
||||
echo checkArWriteOffBill($conn, $row) |
|
||||
?> |
|
||||
</td> |
|
||||
</tr> |
|
||||
<?php } ?> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
<script> |
|
||||
$(function() { |
|
||||
document.getElementById('loadingOverlay').classList.add('hidden'); |
|
||||
}) |
|
||||
</script> |
|
||||
<?php |
|
||||
|
|
||||
else : |
|
||||
echo "<h2>There is no record!</h2>"; |
|
||||
endif; |
|
||||
|
|
||||
#代表結束連線 |
|
||||
mysqli_close($link); |
|
||||
|
|
||||
include "footer.php"; |
|
||||
?> |
|
@ -0,0 +1,87 @@ |
|||||
|
|
||||
|
<?php |
||||
|
require_once('../../contract/connt8.php'); |
||||
|
if (!empty($_GET['contract_no'])) { |
||||
|
try { |
||||
|
$contract_no = $_GET['contract_no']; |
||||
|
// $contract_no = 'Q23080067'; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
a.BillNo, |
||||
|
b.OTaxAmt as amount, |
||||
|
a.CU_EstPayDate as createDate, |
||||
|
b.PersonId as personId, |
||||
|
c.BillNo as CBno, |
||||
|
c.CU_MaterialId as facility |
||||
|
FROM salIncomeApplyDetail as a |
||||
|
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
||||
|
LEFT JOIN ( |
||||
|
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
||||
|
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
||||
|
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS' |
||||
|
) AS c ON a.BillNo = c.BizPartnerId |
||||
|
WHERE a.BillNo = '$contract_no' |
||||
|
AND a.RowNo = '1' |
||||
|
"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// $data['amount'] = intval($data['amount']); |
||||
|
if (!empty($data['CBno']) && $data['CBno'] != '') { |
||||
|
$checkBillNo = $data['CBno']; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
c.BillDate AS CheckBillDate |
||||
|
FROM arWriteOffBill AS a |
||||
|
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
||||
|
LEFT JOIN |
||||
|
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
||||
|
FROM arCheckBill |
||||
|
LEFT JOIN arCheckBillInvInfo |
||||
|
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
||||
|
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
||||
|
ON a.BillNo=c.BillNo |
||||
|
WHERE c.checkBillNo = '$checkBillNo' |
||||
|
"; |
||||
|
|
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$check = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
|
||||
|
|
||||
|
// $CU_MaterialId = $data['facility']; |
||||
|
// $sql = "SELECT SQuantity FROM salIncomeApplyDetail WHERE BillNo = :contract_no AND CU_MaterialId = :CU_MaterialId"; |
||||
|
// $stmt = $connT8->prepare($sql); |
||||
|
// $stmt->bindParam(':contract_no', $contract_no); |
||||
|
// $stmt->bindParam(':CU_MaterialId', $CU_MaterialId); |
||||
|
// $stmt->execute(); |
||||
|
// $result = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
// $count = COUNT($result); |
||||
|
// $data['maintain_month'] = intval($count * $result[0]['SQuantity']); |
||||
|
$reult = true; |
||||
|
echo '1'; |
||||
|
// return true; |
||||
|
} else { |
||||
|
$result = false; |
||||
|
echo '2'; |
||||
|
// return false; |
||||
|
} |
||||
|
} catch (PDOException $e) { |
||||
|
echo '111'; |
||||
|
return false; |
||||
|
// exit; |
||||
|
} |
||||
|
// if (($check['CheckBillDate']) !== '') { |
||||
|
// header('Content-Type: application/json'); |
||||
|
// echo $check['CheckBillDate']; |
||||
|
// } else { |
||||
|
// echo false; |
||||
|
// exit; |
||||
|
// } |
||||
|
} else { |
||||
|
exit(); |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
<?php |
||||
|
require('../../contract-repair/conn.php'); |
||||
|
$accountid = empty($_GET['accountid']) ? '' : $_GET['accountid']; |
||||
|
$sql = "SELECT name,manager FROM account WHERE accountid = :accountid"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->bindParam(':accountid', $accountid); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
header('Content-Type: application/json'); |
||||
|
echo json_encode($result); |
@ -0,0 +1,111 @@ |
|||||
|
<?php |
||||
|
require_once("../../contract/conn.php"); |
||||
|
require_once("../other/maintenance_contract_bonus_v2_1.php"); |
||||
|
if (!empty($_POST)) { |
||||
|
$contract_no = empty($_POST['contract_no']) ? '' : $_POST['contract_no']; |
||||
|
$bonuns_verson = empty($_POST['bonuns_verson']) ? '' : $_POST['bonuns_verson']; |
||||
|
$client_type = empty($_POST['client_type']) ? '' : $_POST['client_type']; |
||||
|
$maintain_month = empty($_POST['maintain_month']) ? '' : $_POST['maintain_month']; |
||||
|
$maintain_price_total = empty($_POST['maintain_price_total']) ? '' : $_POST['maintain_price_total']; |
||||
|
$payDay = empty($_POST['payDay']) ? '' : $_POST['payDay']; |
||||
|
$receiver = empty($_POST['receiver']) ? '' : $_POST['receiver']; |
||||
|
$manager = empty($_POST['manager']) ? '' : $_POST['manager']; |
||||
|
$contract_manger = empty($_POST['contract_manger']) ? '' : $_POST['contract_manger']; |
||||
|
$pay_kind = empty($_POST['paykind']) ? '' : $_POST['paykind']; |
||||
|
$maintain_price_month = empty($_POST['maintain_price_month']) ? '' : $_POST['maintain_price_month']; |
||||
|
$commission_fee = empty($_POST['commission_fee']) ? '0' : $_POST['commission_fee']; |
||||
|
$checkbox = empty($_POST['checkbox']) ? '' : $_POST['checkbox']; |
||||
|
$fail_arr = []; |
||||
|
// if ($client_type == '') $fail_arr[] = '合約類行為必填'; |
||||
|
if (count($fail_arr) > 0) { |
||||
|
header("HTTP/1.1 422 Unprocessable Entity"); |
||||
|
echo json_encode($fail_arr); |
||||
|
exit(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 合約類型 |
||||
|
$clientType = [ |
||||
|
'1' => 'new', |
||||
|
'2' => 'free_to_charge', |
||||
|
'3' => 'renew_priceissue' |
||||
|
]; |
||||
|
|
||||
|
// 分期方式 |
||||
|
$paykind = [ |
||||
|
'1' => 'monthly', |
||||
|
'2' => 'bimonthly', |
||||
|
'3' => 'quarterly', |
||||
|
'6' => 'semiannually', |
||||
|
'12' => 'annually' |
||||
|
]; |
||||
|
|
||||
|
// 應付日期 |
||||
|
$day = DateTime::createFromFormat('Ymd', $payDay); |
||||
|
$pay_day = $day->format('Y-m-d'); |
||||
|
|
||||
|
$years = $maintain_month / 12; |
||||
|
$contract_years = ($years >= 2) ? 'above_two' : 'one'; |
||||
|
|
||||
|
|
||||
|
if ($checkbox == 13) { |
||||
|
// 保養獎金計算 |
||||
|
$results = maintenance_contract_bonus_v2_1( |
||||
|
$bonuns_verson, |
||||
|
$clientType[$client_type], |
||||
|
$paykind[$pay_kind], |
||||
|
$maintain_price_month, |
||||
|
$maintain_price_total, |
||||
|
$commission_fee, |
||||
|
$pay_day, |
||||
|
$receiver, |
||||
|
$manager, |
||||
|
$contract_manger |
||||
|
); |
||||
|
if ($results['result_status'] != 'error') { |
||||
|
array_push($bonus_json, [ |
||||
|
'maintain_type' => $maintain_type, |
||||
|
'total' => $maintain_price_month, |
||||
|
'fee_per_st' => $maintain_price_total, |
||||
|
'commission_fee' => $commission_fee, |
||||
|
'paykind' => $paykind[$pay_kind], |
||||
|
'receivable_date_due' => $pay_day, |
||||
|
]); |
||||
|
} |
||||
|
if (!empty($_POST['status']) && $_POST['status'] == 'save') { |
||||
|
foreach ($results['bonus_array'] as $i => $result) { |
||||
|
// echo '<pre>'; |
||||
|
// print_r($result); |
||||
|
// echo '</pre>'; |
||||
|
$bonus_type = $result['bonus_type']; |
||||
|
$pay_day = $result['pay_day_due']; |
||||
|
$amount = $result['bonus_amount']; |
||||
|
$receiver = $result['bonus_receiver']; |
||||
|
$discount = $result['discount']; |
||||
|
foreach ($bonus_json as $json) { |
||||
|
$json['discount'] = "$discount"; |
||||
|
$a = json_encode($json); |
||||
|
} |
||||
|
echo '<pre>'; |
||||
|
print_r($a); |
||||
|
echo '</pre>'; |
||||
|
// exit(); |
||||
|
// $sql = "INSERT INTO bonus |
||||
|
// (bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day,status,bonus_json,create_id,create_at) VALUES |
||||
|
// ($bonus_type,'$bonus_verson','$contract_no',$contract_type,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')"; |
||||
|
// $stmt = $conn->prepare($sql); |
||||
|
// $stmt->execute(); |
||||
|
// $count++; |
||||
|
// echo '<pre>'; |
||||
|
// print_r($count . '-- > Success'); |
||||
|
// echo '</pre>'; |
||||
|
|
||||
|
// exit; |
||||
|
} |
||||
|
} else { |
||||
|
header('Content-Type: application/json'); |
||||
|
echo json_encode($results); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
;<?php |
||||
|
require('../../contract-repair/conn.php'); |
||||
|
if (!empty($_POST)) { |
||||
|
$contract_no = empty($_POST['contract_no']) ? '' : $_POST['contract_no']; |
||||
|
$facility_no = empty($_POST['facility_no']) ? '' : $_POST['facility_no']; |
||||
|
$bonuns_verson = empty($_POST['bonuns_verson']) ? '' : $_POST['bonuns_verson']; |
||||
|
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; |
||||
|
$bonusArr = empty($_POST['bonusArr']) ? '' : json_decode($_POST['bonusArr'], true); |
||||
|
$contract_type = 3; |
||||
|
$date = date('Y-m-d'); |
||||
|
$sql = "INSERT INTO bonus |
||||
|
(bonus_type,bonus_verson,conreact_no,contract_type,facility_no,amount,receiver,pay_day,review_hr,review_at,create_id,create_at) VALUES |
||||
|
(:bonus_type,:bonus_verson,:conreact_no,:facility_no,:contract_type,:amount,:receiver,:pay_day,:review_hr,:review_at,:create_id,:create_at) |
||||
|
"; |
||||
|
foreach ($bonusArr as $data) { |
||||
|
$bonus_type = $data['bonus_type']; |
||||
|
$bonus_receiver = $data['bonus_receiver']; |
||||
|
$bonus_amount = $data['bonus_amount']; |
||||
|
$pay_day_due = $data['pay_day_due']; |
||||
|
$bonus_regulation = $data['bonus_regulation']; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->bindParam(':bonus_type', $bonus_type); |
||||
|
$stmt->bindParam(':bonus_verson', $bonus_verson); |
||||
|
$stmt->bindParam('conreact_no', $contract_no); |
||||
|
$stmt->bindParam(':contract_type', $contract_type); |
||||
|
} |
||||
|
} |
@ -0,0 +1,301 @@ |
|||||
|
<?php |
||||
|
include_once("../header.php"); |
||||
|
// require_once('./connT8.php'); |
||||
|
require("../contract/conn.php"); |
||||
|
|
||||
|
|
||||
|
$contract_type = [ |
||||
|
'1' => '新梯', |
||||
|
'2' => '汰改', |
||||
|
'3' => '保養' |
||||
|
]; |
||||
|
|
||||
|
$bonus_type = [ |
||||
|
'1' => '契約人獎金', |
||||
|
'2' => '區經理獎金', |
||||
|
'3' => '專任契約經理獎金' |
||||
|
]; |
||||
|
$clause = ''; |
||||
|
if (!empty($_GET['check'])) { |
||||
|
if ($_GET['check'] == 1) { |
||||
|
$clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; |
||||
|
} else if ($_GET['check'] == 2) { |
||||
|
$clause .= "AND status = 1"; |
||||
|
} else if ($_GET['check'] == 3) { |
||||
|
$clause .= "AND status = 2"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$sql = "SELECT * FROM bonus WHERE 1=1 $clause LIMIT 50"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
|
||||
|
$now = new DateTime(); |
||||
|
$oneMonthAgo = $now->modify('+1 month'); |
||||
|
|
||||
|
// 查看 T8 是否有收款明細 |
||||
|
// require("./api/get.php"); |
||||
|
function isPay($contract_no, $connT8) |
||||
|
{ |
||||
|
// echo $contract_no; |
||||
|
$sql = "SELECT |
||||
|
a.BillNo, |
||||
|
b.OTaxAmt as amount, |
||||
|
a.CU_EstPayDate as createDate, |
||||
|
b.PersonId as personId, |
||||
|
c.BillNo as CBno, |
||||
|
c.CU_MaterialId as facility |
||||
|
FROM salIncomeApplyDetail as a |
||||
|
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
||||
|
LEFT JOIN ( |
||||
|
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
||||
|
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
||||
|
WHERE aMaster.BizPartnerId = '$contract_no' AND aMaster.TypeId = 'RVS' |
||||
|
) AS c ON a.BillNo = c.BizPartnerId |
||||
|
WHERE a.BillNo = '$contract_no' |
||||
|
AND a.RowNo = '1' |
||||
|
"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// $data['amount'] = intval($data['amount']); |
||||
|
if (!empty($data['CBno']) && $data['CBno'] != '') { |
||||
|
$checkBillNo = $data['CBno']; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
c.BillDate AS CheckBillDate |
||||
|
FROM arWriteOffBill AS a |
||||
|
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
||||
|
LEFT JOIN |
||||
|
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
||||
|
FROM arCheckBill |
||||
|
LEFT JOIN arCheckBillInvInfo |
||||
|
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
||||
|
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
||||
|
ON a.BillNo=c.BillNo |
||||
|
WHERE c.checkBillNo = '$checkBillNo' |
||||
|
"; |
||||
|
|
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
|
||||
|
return '1'; |
||||
|
} else { |
||||
|
return '2'; |
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<!-- <script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> --> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
<div class="bonus_index"> |
||||
|
<!-- <input type="button" hidden x-ref="initbtn" @click="isPay()" /> --> |
||||
|
|
||||
|
<div style="overflow-x:auto;margin-top:12px"> |
||||
|
<a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm"> |
||||
|
<span class="glyphicon glyphicon-plus"></span> |
||||
|
</a> |
||||
|
<a href="/wms/bonus/bonus.php?function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=1&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 應發獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=2&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 未發獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=3&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 已發獎金</a> |
||||
|
|
||||
|
<table id="table_index" 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> |
||||
|
<th>應發人員</th> |
||||
|
<th>預計發放時間</th> |
||||
|
<th>獎金水庫</th> |
||||
|
<!-- <th>是否發放</th> --> |
||||
|
<th>狀態</th> |
||||
|
<th>檢視/發放</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php if (!empty($datas)) { |
||||
|
foreach ($datas as $key => $data) : |
||||
|
|
||||
|
$contract_no = $data['contract_no']; |
||||
|
$json = json_decode($data['bonus_json']); |
||||
|
|
||||
|
$total = empty($json->total) ? 0 : $json->total; |
||||
|
$fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; |
||||
|
$commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; |
||||
|
$isPay = isPay($data['contract_no'], $connT8); |
||||
|
|
||||
|
?> |
||||
|
<tr> |
||||
|
<td><?= $data['id'] ?></td> |
||||
|
<td><?= $contract_type[$data['contract_type']] ?></td> |
||||
|
<td><?= $data['contract_no'] ?></td> |
||||
|
<td><?= $data['facility_no'] ?></td> |
||||
|
<td><?= $bonus_type[$data['bonus_type']] ?></td> |
||||
|
<td><?= $data['bonus_verson'] ?></td> |
||||
|
<td><?= $total ?></td> |
||||
|
<td><?= $fee_per_st ?></td> |
||||
|
<td><?= $commission_fee ?></td> |
||||
|
<td><?= $data['receiver'] ?></td> |
||||
|
<td><?= $data['pay_day'] ?></td> |
||||
|
<td><?= $data['amount'] ?></td> |
||||
|
<!-- <td><?= ($data['status'] == 1) ? '未發放' : '已發放' ?></td> --> |
||||
|
<td> |
||||
|
<!-- <input type="text" x-model="isPays[<?php echo $key; ?>]" /> --> |
||||
|
<span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span> |
||||
|
</td> |
||||
|
<td> |
||||
|
<?php |
||||
|
// 判斷時間是否為一個月內 |
||||
|
$payday = new DateTime($data['pay_day']); |
||||
|
if ($isPay == 1) { |
||||
|
?> |
||||
|
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtn" style="">發放獎金</a> |
||||
|
<?php |
||||
|
} else if ($payday < $oneMonthAgo) { |
||||
|
?> |
||||
|
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
</td> |
||||
|
|
||||
|
</tr> |
||||
|
<?php |
||||
|
endforeach; |
||||
|
} ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
.width_style_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.btn-secondary { |
||||
|
color: #fff; |
||||
|
background-color: #6c757d; |
||||
|
border-color: #6c757d; |
||||
|
} |
||||
|
|
||||
|
.btn-secondary:hover { |
||||
|
color: #fff; |
||||
|
background-color: #5a6268; |
||||
|
border-color: #545b62; |
||||
|
} |
||||
|
|
||||
|
.applybtn { |
||||
|
color: #fff; |
||||
|
background-color: #1484c4; |
||||
|
/* display: block; */ |
||||
|
border-radius: 5px; |
||||
|
padding: 5px 2px; |
||||
|
font-size: 13px; |
||||
|
line-height: 1; |
||||
|
display: grid; |
||||
|
place-items: center; |
||||
|
/* 水平和垂直居中 */ |
||||
|
height: 2%vh; |
||||
|
/* 100%视窗高度,可根据需要调整 */ |
||||
|
} |
||||
|
|
||||
|
.applybtncheck { |
||||
|
color: #fff; |
||||
|
background-color: #eea236; |
||||
|
/* display: block; */ |
||||
|
border-radius: 4px; |
||||
|
padding: 4px 2px; |
||||
|
font-size: 13px; |
||||
|
line-height: 1; |
||||
|
display: grid; |
||||
|
place-items: center; |
||||
|
/* 水平和垂直居中 */ |
||||
|
height: 2%vh; |
||||
|
/* 100%视窗高度,可根据需要调整 */ |
||||
|
} |
||||
|
|
||||
|
.applybtncheck:hover { |
||||
|
background-color: #f0ad4e; |
||||
|
color: #fff; |
||||
|
} |
||||
|
|
||||
|
.applybtn:hover { |
||||
|
background-color: #1494f9; |
||||
|
color: #fff; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<script> |
||||
|
const datas = <?php echo json_encode($datas); ?>; |
||||
|
|
||||
|
// function init() { |
||||
|
// this.isPay(); |
||||
|
|
||||
|
// } |
||||
|
// const bonusIndex = () => { |
||||
|
// return { |
||||
|
// async isPay() { |
||||
|
// // console.log(123) |
||||
|
// for (let i = 0; i < datas.length; i++) { |
||||
|
// await axios.get('./api/get.php?contract_no=' + datas[i].contract_no).then(res => { |
||||
|
// let isPay = res.data; |
||||
|
// // this.data.isPay.push(isPay); // 更新 x-data 中的数据 |
||||
|
// this.isPays.push(isPay); |
||||
|
// }).catch(err => { |
||||
|
|
||||
|
// }) |
||||
|
// } |
||||
|
|
||||
|
// console.log(this.isPays); |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
</script> |
@ -0,0 +1,378 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('../contract-repair/conn.php'); |
||||
|
?> |
||||
|
|
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
|
||||
|
<div class="bonuns_index" x-data="bonunsIndexTest"> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data"> |
||||
|
<input type="hidden" name="form_name" value="main_form"> |
||||
|
<div> |
||||
|
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style='text-align:center'>獎金計算</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight: bolder;margin: botton 20px;"> |
||||
|
<tr> |
||||
|
<td style="vertical-align: middle;">獎金類型</td> |
||||
|
<td colspan="7"> |
||||
|
<div> |
||||
|
<input type="radio" name="contact" x-model="data.checkbox" value=11> |
||||
|
<label for="new_v1">新梯_V1</label><br> |
||||
|
<input type="radio" name="contact" x-model="data.checkbox" value=12> |
||||
|
<label for="new_v2">新梯_V2</label><br> |
||||
|
<input type="radio" name="contact" x-model="data.checkbox" value=13> |
||||
|
<label for="maintain">保養</label> |
||||
|
</div> |
||||
|
</td> |
||||
|
<!-- <td colspan="2" style="vertical-align:middle"></td> --> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算 新梯V1 --> |
||||
|
<template x-if="checkbox==11"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==11"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項(新梯V1)</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
|
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="client_type" x-model="data.client_type"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續簽約</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> --> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">契約人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">付款方式(月/次)</td> |
||||
|
<td> |
||||
|
<select x-model="data.paykind"> |
||||
|
<template x-for="paykind in data.paykindArr" :key="paykind"> |
||||
|
<option x-text="paykind"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">應收款日期(月/次)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay"> |
||||
|
<p>(Ex:20240101)</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養金額(月)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">牌價</td> |
||||
|
<td colspan='3'> |
||||
|
<input type="text" x-model="data.maintain_price_total"> |
||||
|
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle" @click="test()">服務費</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.commission_fee"> |
||||
|
</td> |
||||
|
<!-- <td></td> |
||||
|
<td></td> --> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算,新梯V2 --> |
||||
|
<template x-if="step==12"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==12"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項(新梯V2)</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
|
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="client_type" x-model="data.client_type"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續簽約</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> --> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">契約人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">付款方式(月/次)</td> |
||||
|
<td> |
||||
|
<select x-model="data.paykind"> |
||||
|
<template x-for="paykind in data.paykindArr" :key="paykind"> |
||||
|
<option x-text="paykind"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">應收款日期(月/次)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay"> |
||||
|
<p>(Ex:20240101)</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養金額(月)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">牌價</td> |
||||
|
<td colspan='3'> |
||||
|
<input type="text" x-model="data.maintain_price_total"> |
||||
|
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle" @click="test()">服務費</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.commission_fee"> |
||||
|
</td> |
||||
|
<!-- <td></td> |
||||
|
<td></td> --> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
|
||||
|
<template x-if=" (checkbox==13&&step==2); "> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="(checkbox==13&&step==2)"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項(保養)</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
|
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="client_type" x-model="data.client_type"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續簽約</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> --> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">契約人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">付款方式(月/次)</td> |
||||
|
<td> |
||||
|
<select x-model="data.paykind"> |
||||
|
<template x-for="paykind in data.paykindArr" :key="paykind"> |
||||
|
<option x-text="paykind"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">應收款日期(月/次)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay"> |
||||
|
<p>(Ex:20240101)</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養金額(月)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">牌價</td> |
||||
|
<td colspan='3'> |
||||
|
<input type="text" x-model="data.maintain_price_total"> |
||||
|
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle" @click="test()">服務費</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.commission_fee"> |
||||
|
</td> |
||||
|
<!-- <td></td> |
||||
|
<td></td> --> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算頁面 --> |
||||
|
<template x-if="step == 3"> |
||||
|
<template x-for="(bonusArr,index) in data.bonusArr" :key=""> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==3"> |
||||
|
<!-- <tr x-if="index % 3 == 0 || index == 0"> |
||||
|
<td colspan=8> |
||||
|
<p x-text="'獎金' + Number(index+1)"></p> |
||||
|
</td> |
||||
|
</tr> --> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">獎金類型</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_type"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">發放人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle;">發放金額</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_amount"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">預計發放時間</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].pay_day_due"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">發放規定</td> |
||||
|
<td colspan="5"> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_regulation"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
</template> |
||||
|
</table> |
||||
|
|
||||
|
<button x-show="step == 3" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>存檔</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>下一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>上一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
const user_id = '<?= $user_id ?>'; |
||||
|
</script> |
@ -0,0 +1,15 @@ |
|||||
|
<?php |
||||
|
require_once dirname(__FILE__) . "/../../mkt/database.php"; |
||||
|
include_once '../fun_global.php'; |
||||
|
// phpinfo(); |
||||
|
// exit(); |
||||
|
try { |
||||
|
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E="); |
||||
|
if ($connT8) { |
||||
|
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
||||
|
} |
||||
|
} catch (PDOException $e) { |
||||
|
// echo "fail"; |
||||
|
// echo $e->getMessage(); |
||||
|
die("ERROR!!!: " . $e->getMessage()); |
||||
|
} |
@ -0,0 +1,307 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('../contract-repair/conn.php'); |
||||
|
require_once("./other/maintenance_contract_bonus_v2_1.php"); |
||||
|
$create_id = $user_id; |
||||
|
$create_at = date('Y-m-d H:i:s'); |
||||
|
// echo $create_id; |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0", "new", "one", 0.8, 4000, 333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#新簽約 |
||||
|
#月繳(monthly) |
||||
|
["2.1", "new", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1", "new", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1", "new", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1", "new", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1", "new", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#免保轉有費(free_to_charge) |
||||
|
#月繳(monthly) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
|
||||
|
#續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
#月繳(monthly) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
]; |
||||
|
|
||||
|
$bonus_json = []; |
||||
|
$count = 0; |
||||
|
foreach ($examination_array as $key => $value) { |
||||
|
$bonus_verson = $value[0]; |
||||
|
$maintain_type = $value[1]; |
||||
|
$paykind = $value[2]; |
||||
|
$elevator_list_price = $value[3]; //標準價格 / 月 |
||||
|
$fee_per_st = $value[4]; //牌價 / 月 |
||||
|
$commission_fee = $value[5]; //服務費 / 年 |
||||
|
$receivable_date_due = $value[6]; // 應收時間 |
||||
|
$sal = $value[7]; // 銷售人員 |
||||
|
$mang = $value[8]; //經理 |
||||
|
$controct_mang = $value[9]; |
||||
|
$contract_no = 'TEST0' . $key; |
||||
|
$contract_type = 3; |
||||
|
$facility_no = 'TEST' . $key; |
||||
|
$status = 1; |
||||
|
|
||||
|
$results = maintenance_contract_bonus_v2_1( |
||||
|
$bonus_verson, |
||||
|
$maintain_type, |
||||
|
$paykind, |
||||
|
$elevator_list_price, |
||||
|
$fee_per_st, |
||||
|
$commission_fee, |
||||
|
$receivable_date_due, |
||||
|
$sal, |
||||
|
$mang, |
||||
|
$controct_mang |
||||
|
); |
||||
|
|
||||
|
|
||||
|
if ($results['result_status'] == 'error') { |
||||
|
} else { |
||||
|
array_push($bonus_json, [ |
||||
|
'maintain_type' => $maintain_type, |
||||
|
'total' => $elevator_list_price, |
||||
|
'fee_per_st' => $fee_per_st, |
||||
|
'commission_fee' => $commission_fee, |
||||
|
'paykind' => $paykind, |
||||
|
'receivable_date_due' => $receivable_date_due, |
||||
|
]); |
||||
|
// foreach ($bonus_json as $json) { |
||||
|
// $a = json_encode($json); |
||||
|
// } |
||||
|
foreach ($results['bonus_array'] as $i => $result) { |
||||
|
// echo '<pre>'; |
||||
|
// print_r($result); |
||||
|
// echo '</pre>'; |
||||
|
$bonus_type = $result['bonus_type']; |
||||
|
$pay_day = $result['pay_day_due']; |
||||
|
$amount = $result['bonus_amount']; |
||||
|
$receiver = $result['bonus_receiver']; |
||||
|
$discount = $result['discount']; |
||||
|
foreach ($bonus_json as $json) { |
||||
|
$json['discount'] = "$discount"; |
||||
|
$a = json_encode($json); |
||||
|
} |
||||
|
// echo '<pre>'; |
||||
|
// print_r($a); |
||||
|
// echo '</pre>'; |
||||
|
// exit(); |
||||
|
$sql = "INSERT INTO bonus |
||||
|
(bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day,status,bonus_json,create_id,create_at) VALUES |
||||
|
($bonus_type,'$bonus_verson','$contract_no',$contract_type,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$count++; |
||||
|
echo '<pre>'; |
||||
|
print_r($count . '-- > Success'); |
||||
|
echo '</pre>'; |
||||
|
|
||||
|
// exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// $sql = "INSERT INTO bonus |
||||
|
// (bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day,status,bonus_json,create_id,create_at) VALUES |
||||
|
// ($bonus_type,'$bonus_verson','$contract_no',$contract_type,'$facility_no',$amount,'$receiver','$pay_day',$status,'$bonus_json','$create_id','$create_at')"; |
||||
|
// echo '<pre>'; |
||||
|
// print_r($sql); |
||||
|
// echo '</pre>'; |
||||
|
// if ($key == 2) { |
||||
|
// exit; |
||||
|
// } |
||||
|
} |
@ -0,0 +1,159 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function elevator_renew_noninstallment_bonus_v2_1($ver, $contract_type, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $sales_id, $region_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1"){ |
||||
|
$discount = round(($elevator_knockdown_price - $commission_fee) / $elevator_list_price, 2); #銷售點數,取到小數點第2位。 |
||||
|
|
||||
|
#折扣率 |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.018; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 600; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount >= 0.60 and $discount < 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.0144; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 300; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount < 0.60): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 200; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----訂金已收款100%,發放總獎金30% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.3), #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金30%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款100%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "shipping", #出貨前期所有款項已收齊,且出貨款已收款100% |
||||
|
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款100%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款100%,發放總獎金30% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus) - round($sales_bonus * 0.3) - round($sales_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "acceptance", #驗收前期所有款項已收齊,且驗收款已收款100% |
||||
|
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款100%,發放總獎金20%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金100% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => $region_manager_bonus, #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}else{ |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"payment_schedul_due" => "9999-1-1", #預計發放時間 |
||||
|
"payment_schedul_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"error", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}; |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
||||
|
|
||||
|
?> |
@ -0,0 +1,83 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("elevator_renew_noninstallment_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $sales_id, $region_manger_id |
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","strategy_customer",1000000,1000000,100000,"M0001", "M0003"], |
||||
|
#戰略客戶(strategy_customer) |
||||
|
["2.1","strategy_customer",1000000,900000,100000,"M0001", "M0003"], #戰略客戶、折扣率80% |
||||
|
["2.1","strategy_customer",1000000,700000,100000,"M0001", "M0003"], #戰略客戶、折扣率60% |
||||
|
["2.1","strategy_customer",1000000,690000,100000,"M0001", "M0003"], #戰略客戶、折扣率59% |
||||
|
|
||||
|
#一般客戶(general_customer) |
||||
|
["2.1","general_customer",1000000,900000,100000,"M0001", "M0003"], #一般客戶、折扣率80% |
||||
|
["2.1","general_customer",1000000,700000,100000,"M0001", "M0003"], #一般客戶、折扣率60% |
||||
|
["2.1","general_customer",1000000,690000,100000,"M0001", "M0003"] #一般客戶、折扣率59% |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = elevator_renew_noninstallment_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " " |
||||
|
. $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,160 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
總支付期數$payment_period_amount: 總支付期數,依規定至少13期, |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function elevator_renew_withinstallment_bonus_v2_1($ver, $contract_type, $payment_period_amount, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $receivable_date_due, $sales_id, $region_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1"){ |
||||
|
$discount = round(($elevator_knockdown_price - $commission_fee) / $elevator_list_price, 2); #銷售點數,取到小數點第2位。 |
||||
|
|
||||
|
#折扣率 |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.018; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 600; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount >= 0.60 and $discount < 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.0144; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 300; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount < 0.60): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 200; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#產生契約員每個月的獎金應發比例 |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1/$payment_period_amount); |
||||
|
}; |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payday_due_array, $i+1 ); |
||||
|
}; |
||||
|
|
||||
|
for($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if($i < count($payment_ratio_due_array) - 1){ |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
}else{ |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"payment_schedul_due" => date("Y-m-d",strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"payment_schedul_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
}; |
||||
|
|
||||
|
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金100% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => $region_manager_bonus, #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}else{ |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"payment_schedul_due" => "9999-1-1", #預計發放時間 |
||||
|
"payment_schedul_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"error", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}; |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
||||
|
|
||||
|
?> |
@ -0,0 +1,85 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("elevator_renew_withinstallment_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $payment_period_amount, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $receivable_date_due, $sales_id, $region_manger_id |
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","strategy_customer",13,1000000,1000000,100000,"2014-07-01","M0001", "M0003"], |
||||
|
#戰略客戶(strategy_customer) |
||||
|
["2.1","strategy_customer",13,1000000,900000,100000,"2014-07-01","M0001", "M0003"], #戰略客戶、折扣率80% |
||||
|
["2.1","strategy_customer",13,1000000,700000,100000,"2014-07-01","M0001", "M0003"], #戰略客戶、折扣率60% |
||||
|
["2.1","strategy_customer",13,1000000,690000,100000,"2014-07-01","M0001", "M0003"], #戰略客戶、折扣率59% |
||||
|
|
||||
|
#一般客戶(general_customer) |
||||
|
["2.1","general_customer",13,1000000,900000,100000,"2014-07-01","M0001", "M0003"], #一般客戶、折扣率80% |
||||
|
["2.1","general_customer",13,1000000,700000,100000,"2014-07-01","M0001", "M0003"], #一般客戶、折扣率60% |
||||
|
["2.1","general_customer",13,1000000,690000,100000,"2014-07-01","M0001", "M0003"] #一般客戶、折扣率59% |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = elevator_renew_withinstallment_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6], |
||||
|
$examination_array[$i][7], |
||||
|
$examination_array[$i][8] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7] . " " . $examination_array[$i][8] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " " |
||||
|
. $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,299 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id) |
||||
|
{ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1") { |
||||
|
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2); |
||||
|
#契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
switch ($contract_type) { |
||||
|
case "new": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st < 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3000 and $fee_per_st < 3500): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st < 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.8; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.9; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount >= 0.6 and $discount < 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.48; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.64; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.72; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount < 0.6): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.42; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.49; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.63; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
|
||||
|
case "free_to_charge": |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.4; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.45; |
||||
|
break; |
||||
|
}; |
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
|
||||
|
case "renew_priceissue": |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.25; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.4; |
||||
|
break; |
||||
|
}; |
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金 |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "2", #獎金名稱 |
||||
|
"bonus_receiver" => $region_director_id, #發放人員 |
||||
|
"bonus_amount" => round($region_director_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
]); |
||||
|
|
||||
|
#專任契約經理獎金 |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "3", #獎金名稱 |
||||
|
"bonus_receiver" => $regular_contract_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($regular_contract_manger_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
]); |
||||
|
|
||||
|
#契約員獎金 |
||||
|
switch ($payment_period) { |
||||
|
#年付 |
||||
|
case "annually": |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
break; |
||||
|
|
||||
|
#半年付 |
||||
|
case "semiannually": |
||||
|
$payment_ratio_due_array = array(0.5, 0.5); |
||||
|
$payday_due_array = array(1, 7); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
#季付 |
||||
|
case "quarterly": |
||||
|
$payment_ratio_due_array = array(0.25, 0.25, 0.25, 0.25); |
||||
|
$payday_due_array = array(1, 4, 7, 10); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
#2月1次 |
||||
|
case "bimonthly": |
||||
|
$payment_ratio_due_array = array(0.166, 0.166, 0.166, 0.166, 0.166, 0.166); |
||||
|
$payday_due_array = array(1, 3, 5, 7, 9, 11); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
#月付 |
||||
|
case "monthly": |
||||
|
$payment_ratio_due_array = array(0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083); |
||||
|
$payday_due_array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver" => $ver, #獎金版本 |
||||
|
"result_status" => "success", #計算結果 |
||||
|
"bonus_array" => $bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} else { |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"pay_day_due" => "9999-1-1", #預計發放時間 |
||||
|
"bonus_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
$result_array = [ |
||||
|
"ver" => $ver, #獎金版本 |
||||
|
"result_status" => "error", #計算結果 |
||||
|
"bonus_array" => $bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
@ -0,0 +1,291 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("maintenance_contract_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $payment_period, $discount, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id |
||||
|
|
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","new","one",0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#新簽約 |
||||
|
#月繳(monthly) |
||||
|
["2.1","new","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1","new","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1","new","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1","new","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1","new","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#免保轉有費(free_to_charge) |
||||
|
#月繳(monthly) |
||||
|
["2.1","free_to_charge","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1","free_to_charge","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1","free_to_charge","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1","free_to_charge","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
|
||||
|
#續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
#月繳(monthly) |
||||
|
["2.1","renew_priceissue","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1","renew_priceissue","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = maintenance_contract_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6], |
||||
|
$examination_array[$i][7], |
||||
|
$examination_array[$i][8], |
||||
|
$examination_array[$i][9] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7]. " " . $examination_array[$i][8] . " " |
||||
|
. $examination_array[$i][9] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,196 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期, |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function maintenance_longterm_contract_m1_free_charge_bonus_v2_1($ver, $contract_type, $payment_period_amount, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1"){ |
||||
|
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2); |
||||
|
#契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge) |
||||
|
switch ($contract_type){ |
||||
|
case "longcontract_m1_free_charge": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6; |
||||
|
break; |
||||
|
case ($fee_per_st > 300 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
case ($fee_per_st > 4000 and $fee_per_st <= 5000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.8; |
||||
|
break; |
||||
|
case ($fee_per_st > 5000 and $fee_per_st <= 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.9; |
||||
|
break; |
||||
|
case ($fee_per_st > 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 1.0; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount >= 0.6 and $discount < 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.42; |
||||
|
break; |
||||
|
case ($fee_per_st > 300 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.49; |
||||
|
break; |
||||
|
case ($fee_per_st > 4000 and $fee_per_st <= 5000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st > 5000 and $fee_per_st <= 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.63; |
||||
|
break; |
||||
|
case ($fee_per_st > 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount < 0.6): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st > 300 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st > 4000 and $fee_per_st <= 5000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.4; |
||||
|
break; |
||||
|
case ($fee_per_st > 5000 and $fee_per_st <= 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.45; |
||||
|
break; |
||||
|
case ($fee_per_st > 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.5; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金、專任契約經理、契約員獎金 |
||||
|
switch ($payment_period_amount){ |
||||
|
#簽長約免費贈送控制系統,因屬於公司特殊政策,所以無汰改獎金,合約期內每月領取契約獎金 |
||||
|
#總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期, |
||||
|
case $payment_period_amount >= 60: |
||||
|
#地區處長獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "地區處長獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $region_director_id, #發放人員 |
||||
|
"bonus_amount" => round($region_director_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "訂金收回後次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#專任契約經理獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "專任契約經理獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $regular_contract_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($regular_contract_manger_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "訂金收回後次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#產生契約員每個月的獎金應發比例 |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1/$payment_period_amount); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payday_due_array, $i+1 ); |
||||
|
} |
||||
|
|
||||
|
for($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if($i < count($payment_ratio_due_array) - 1){ |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
}else{ |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
}else{ |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"pay_day_due" => "9999-1-1", #預計發放時間 |
||||
|
"bonus_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"error", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,101 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("maintenance_longterm_contract_m1_free_charge_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $payment_period_amount, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id |
||||
|
|
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","longcontract_m1_free_charge",60,0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#60期 |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,5000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價5000元、服務費2600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,6000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價6000元、服務費3600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,7000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價7000元、服務費4600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,5000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價5000元、服務費3200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,6000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價6000元、服務費4200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,7000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價7000元、服務費5200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,5000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價5000元、服務費3230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,6000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價6000元、服務費4230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,7000,1600,"2014-07-01", "M0001", "M0002", "M0003"] #牌價3000、簽約價7000元、服務費5230元(折扣率0.59) |
||||
|
|
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = maintenance_longterm_contract_m1_free_charge_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6], |
||||
|
$examination_array[$i][7], |
||||
|
$examination_array[$i][8], |
||||
|
$examination_array[$i][9] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7]. " " . $examination_array[$i][8] . " " |
||||
|
. $examination_array[$i][9] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -1,62 +0,0 @@ |
|||||
<?php |
|
||||
use PHPMailer\PHPMailer\PHPMailer; |
|
||||
use PHPMailer\PHPMailer\SMTP; |
|
||||
use PHPMailer\PHPMailer\Exception; |
|
||||
|
|
||||
class Cmail |
|
||||
{ |
|
||||
public $charset = ""; |
|
||||
public $host = ""; |
|
||||
public $port = ""; |
|
||||
public $smtp_user = ""; |
|
||||
public $smtp_pwd = ""; |
|
||||
|
|
||||
function __construct($charset='', $fromemail='') |
|
||||
{ |
|
||||
include dirname(__DIR__)."/PHPMailer/Exception.php"; |
|
||||
include dirname(__DIR__)."/PHPMailer/PHPMailer.php"; |
|
||||
include dirname(__DIR__)."/PHPMailer/SMTP.php"; |
|
||||
|
|
||||
$this->charset = "UTF-8"; |
|
||||
$this->host = "mail.masada.com.tw"; |
|
||||
$this->port = 25; |
|
||||
$this->smtp_user = "notice"; // 這裡填寫SMTP登入帳號, 例如 your.gmail.name@gmail.com 則填寫your.gmail.name |
|
||||
$this->smtp_pwd = "90493119"; // 這裡填寫SMTP登入密碼 |
|
||||
} |
|
||||
|
|
||||
function sendx($subject="", $em_body="", $sendlist=array(), $from="永佳捷科技", $bcc="", $files=array()) |
|
||||
{ |
|
||||
if (!$sendlist) return; |
|
||||
$em_body = nl2br($em_body); |
|
||||
$em_body .= "<p>※此信件為系統發出信件,請勿直接回覆。</p>"; |
|
||||
|
|
||||
$mail = new PHPMailer(true); |
|
||||
$mail->IsHTML(true); //設定是否使用HTML格式 |
|
||||
$mail->CharSet = $this->charset; |
|
||||
$mail->isSMTP(); |
|
||||
$mail->SMTPAuth = true; |
|
||||
$mail->Host = $this->host; |
|
||||
$mail->Port = $this->port; |
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //使用SSL, 如果是TLS 請改為 PHPMailer::ENCRYPTION_STARTTLS |
|
||||
$mail->Username = $this->smtp_user; |
|
||||
$mail->Password = $this->smtp_pwd; |
|
||||
$mail->SMTPSecure = ""; |
|
||||
$mail->From = "notice@masada.com.tw"; |
|
||||
$mail->FromName = $from; |
|
||||
$mail->Subject = $subject; |
|
||||
$mail->Body = $em_body; |
|
||||
foreach ($sendlist as $v) { // $sendlist[0]=['M0044', 'jrbin@masada.com.tw'] |
|
||||
list($name, $email) = $v; |
|
||||
if ($email) $mail->addAddress($email, $name); |
|
||||
} |
|
||||
//$mail->addCC("personC@gmail.com", "person C"); |
|
||||
//$mail->addBCC("personD@gmail.com", "person D"); |
|
||||
//$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg |
|
||||
//print_r($mail);exit; |
|
||||
if (!$mail->Send()){ |
|
||||
// echo "Mailer error: " . $mail->ErrorInfo; |
|
||||
} else { |
|
||||
//echo "Email sent"; |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,109 +0,0 @@ |
|||||
<?php |
|
||||
//ini_set('display_errors', 'on'); |
|
||||
|
|
||||
class Cnotice |
|
||||
{ |
|
||||
|
|
||||
function __construct() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
function connectionDB() |
|
||||
{ |
|
||||
$envFile = __DIR__ . '/../../.env'; |
|
||||
if (file_exists($envFile)) { |
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
||||
if ($lines !== false) { |
|
||||
foreach ($lines as $line) { |
|
||||
list($key, $value) = explode('=', $line, 2); |
|
||||
$key = trim($key); |
|
||||
$value = trim($value); |
|
||||
putenv("$key=$value"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
date_default_timezone_set("Asia/Taipei"); |
|
||||
$host = getenv('DB_HOST'); |
|
||||
$dbport = getenv('DB_PORT'); |
|
||||
$dbuser = getenv('DB_USERNAME'); |
|
||||
$dbpassword = getenv('DB_PASSWORD'); |
|
||||
$dbname = getenv('DB_DATABASE'); |
|
||||
|
|
||||
try { |
|
||||
$options = [ |
|
||||
PDO::ATTR_PERSISTENT => false, |
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
|
||||
PDO::ATTR_EMULATE_PREPARES => false, |
|
||||
PDO::ATTR_STRINGIFY_FETCHES => false, |
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', |
|
||||
]; |
|
||||
$pdo = new PDO('mysql:host=' . $host . ';port=' . $dbport . ';dbname=' . $dbname . '', $dbuser, $dbpassword, $options); |
|
||||
$pdo->exec('SET CHARACTER SET utf8mb4'); |
|
||||
return $pdo; |
|
||||
} catch (PDOException $e) { |
|
||||
die("Something wrong: {$e->getMessage()}"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 結束資料庫連線 |
|
||||
*/ |
|
||||
function endConnectionDB($pdo) |
|
||||
{ |
|
||||
unset($pdo); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 提交消息 notice |
|
||||
* @param string $kind : 類別 1=系統 2=會議 |
|
||||
* @param int $related_id : 關聯序號 |
|
||||
* @param string $title : 標題 |
|
||||
* @param string $title : 內容 |
|
||||
* @param string $permission : 瀏覽權限 員編/ALL=全體 |
|
||||
* @param string $creater : 建立者 |
|
||||
* @param string $create_at : 建立時間 |
|
||||
*/ |
|
||||
function sendx($data) |
|
||||
{ |
|
||||
|
|
||||
$kind = $data['kind']; |
|
||||
$related_id = $data['related_id']; |
|
||||
$title = $data['title']; |
|
||||
$content = $data['content']; |
|
||||
$permission = $data['permission']; |
|
||||
$creater = $data['creater']; |
|
||||
$create_at = $data['create_at']; |
|
||||
|
|
||||
$pdo = $this->connectionDB(); |
|
||||
$pdo->exec('SET CHARACTER SET utf8mb4'); |
|
||||
$str = " |
|
||||
INSERT INTO `notice` (`kind`, `related_id`, `title`, `content`, `permission`, `creater`, `create_at`) |
|
||||
VALUES (?,?,?,?,?,?,?) |
|
||||
"; |
|
||||
|
|
||||
$sth = $pdo->prepare($str); |
|
||||
$sth->bindValue(1, $kind); |
|
||||
$sth->bindValue(2, $related_id); |
|
||||
$sth->bindValue(3, $title); |
|
||||
$sth->bindValue(4, $content); |
|
||||
$sth->bindValue(5, $permission); |
|
||||
$sth->bindValue(6, $creater); |
|
||||
$sth->bindValue(7, $create_at); |
|
||||
|
|
||||
$sth->execute(); |
|
||||
|
|
||||
$this->endConnectionDB($pdo); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// $cn = new Cnotice(); |
|
||||
// $data = array( |
|
||||
// 'kind' => 1, |
|
||||
// 'related_id' => 1, |
|
||||
// 'title' => "標題", |
|
||||
// 'content' => "內容", |
|
||||
// 'permission' => "M0117", |
|
||||
// 'creater' => "M0117", |
|
||||
// 'create_at' => date("Y-m-d H:i:s") |
|
||||
// ); |
|
||||
// $cn->sendx($data); |
|
Binary file not shown.
@ -1,42 +0,0 @@ |
|||||
<?php |
|
||||
$envFile = __DIR__ . '/.env'; // .env 文件的路径 |
|
||||
|
|
||||
if (file_exists($envFile)) { |
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
||||
if ($lines !== false) { |
|
||||
foreach ($lines as $line) { |
|
||||
list($key, $value) = explode('=', $line, 2); |
|
||||
$key = trim($key); |
|
||||
$value = trim($value); |
|
||||
// 设置环境变量 |
|
||||
putenv("$key=$value"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
$db_hostname = getenv('DB_HOST'); //資料庫主機名稱 |
|
||||
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號 |
|
||||
$db_password = getenv('DB_PASSWORD'); //登入密碼 |
|
||||
$db_name = getenv('DB_DATABASE'); //使用的資料庫 |
|
||||
$db_charset = 'utf8'; //設定字元編碼 |
|
||||
|
|
||||
//建立PDO的指定工作 |
|
||||
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset"; |
|
||||
|
|
||||
try { |
|
||||
//使用PDO連接到MySQL資料庫,建立PDO物件 |
|
||||
$conn = new PDO($dsn, $db_username, $db_password); |
|
||||
|
|
||||
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException) |
|
||||
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定 |
|
||||
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊 |
|
||||
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 |
|
||||
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 |
|
||||
//設定主動以警告的形式報錯 |
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
||||
//如果連接錯誤,將抛出一個PDOException異常對象 |
|
||||
} catch (PDOException $e) { |
|
||||
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 |
|
||||
die("ERROR!!!: " . $e->getMessage()); |
|
||||
} |
|
||||
|
|
||||
//$conn = null; //關閉資料庫的連線 |
|
@ -0,0 +1,263 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('./conn.php'); |
||||
|
$sql = "SELECT * FROM employee WHERE depart_no IN ('320','311','312','313','314','315','511','512','513','514','515') "; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
// $stmt->bindParam(':depart_no', $depart_no); |
||||
|
$stmt->execute(); |
||||
|
$contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
// echo '<pre>'; |
||||
|
// print_r($contractSalesman); |
||||
|
// echo '</pre>'; |
||||
|
?> |
||||
|
|
||||
|
<link rel="stylesheet" href="./styles/style.css"> |
||||
|
<link rel="stylesheet" href="./semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script src="./js/alpine.js"></script> |
||||
|
<script defer src="./js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="./js/axios/axios.min.js"></script> |
||||
|
<script src="./js/jquery/jquery-3.1.1.min.js"></script> |
||||
|
<script src="./semantic/dist/semantic.min.js"></script> |
||||
|
|
||||
|
<div class="renovate_input" x-data="renovateInput"> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data"> |
||||
|
<input type="hidden" name="form_name" value="main_form"> |
||||
|
<div> |
||||
|
<table class="table table-borderd query-table table-striped table-bordered display compact" style="width:99%; margin-left:.5%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style="text-align:center">汰改合約入力</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight:bolder; margin:botton 20px"> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle;">合約號</td> |
||||
|
<td colspan="6"> |
||||
|
<input type="text" class="form-control" @keyup="nextStepKeyupFn($event)" name="contract_no" x-model="data.contract_no"> |
||||
|
</td> |
||||
|
<td colspan="1" style="vertical-align:middle"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight:bolder; margin:botton 20px" x-show="step==1"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px;"> |
||||
|
<h4>業務確認項</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border-left:0px"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="location.reload()">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">立約人</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.customer"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">營業員</td> |
||||
|
<td> |
||||
|
<!-- <input x-show="data.salesman" type="text" x-model="data.salesman" name="promiser"> --> |
||||
|
<select x-model="data.salesman" class="ui fluid search dropdown" name="salesman"> |
||||
|
<option value="">------</option> |
||||
|
<?php foreach ($contractSalesman as $salesman) : ?> |
||||
|
<option value="<?= $salesman['employee_no'] ?>"><?= $salesman['name'] ?></option> |
||||
|
<?php endforeach; ?> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地址</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.address"> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<!-- 客戶款別分別如何分期 --> |
||||
|
<div> |
||||
|
<tr> |
||||
|
<td colspan='8' style="vertical-align:middle ">款別分期</td> |
||||
|
</tr> |
||||
|
|
||||
|
|
||||
|
<tr> |
||||
|
<td colspan='1'>付款辦法</td> |
||||
|
<td colspan='1'>款別</td> |
||||
|
<td colspan='1'>比例%</td> |
||||
|
<td colspan='2'>金額</td> |
||||
|
<td colspan='1'>繳款方式(月)</td> |
||||
|
</tr> |
||||
|
|
||||
|
|
||||
|
<tr> |
||||
|
<td rowspan="4">材料</td> |
||||
|
<td>1、訂金</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[0] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>2、二次款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[1] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>3、貨到工地款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[2] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<!-- <tr> |
||||
|
<td>4、其他</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[3] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> --> |
||||
|
|
||||
|
<tr> |
||||
|
<td rowspan="3">安裝</td> |
||||
|
<td>5、安裝完畢款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[4] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>6、驗收款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[5] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>7、其他</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[6] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option :value="pay" x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
|
||||
|
<tr> |
||||
|
<td colspan="2">合計</td> |
||||
|
<td> |
||||
|
<input type="text" disabled> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text" disabled> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.total" disabled> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</div> |
||||
|
</tbody> |
||||
|
|
||||
|
</template> |
||||
|
</table> |
||||
|
|
||||
|
<button x-show="step==3" @click="save()" type="button" class="btn btn-primary btn-lg pull-right savebutton" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>存檔</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<span class="loader"></span> |
||||
|
</template> |
||||
|
</button> |
||||
|
|
||||
|
<button x-show="step<2" @click="nextStepFn()" class="btn btn-primary btn-lg pull-right savebutton" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>下一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<span class="loader"></span> |
||||
|
</template> |
||||
|
</button> |
||||
|
|
||||
|
<button x-show="step>1" @click="preStepFn()" class="btn btn-primary btn-lg pull-right savebutton" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>上一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<span class="loaders"></span> |
||||
|
</template> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
@ -1,19 +1,21 @@ |
|||||
<?php |
<?php |
||||
$date = Date('Y-m-d'); |
$date = Date('Y-m-d'); |
||||
$date1 = Date('Y-m-d', strtotime("$date +1 months")); |
$date1 = Date('Y-m-d', strtotime("$date +1 months")); |
||||
|
// $paymonth = $i * $SQuantity; |
||||
|
// $countDay = date('Y-m-d', strtotime("$date + $paymonth months")); |
||||
|
// $payDay = str_replace('-', '', $countDay); |
||||
// $countDay = date('Ymd', strtotime("$date1 + 1 months")); |
// $countDay = date('Ymd', strtotime("$date1 + 1 months")); |
||||
// echo '<pre>'; |
// echo '<pre>'; |
||||
// print_r($countDay); |
// print_r($countDay); |
||||
// echo '</pre>'; |
// echo '</pre>'; |
||||
// exit(); |
// exit(); |
||||
$a = 0; |
$SQuantity = 2; |
||||
// $b = 24 / $a; |
// $b = 24 / $a; |
||||
for ($i = 0; $i < 2; $i++) { |
for ($i = 0; $i < 12; $i++) { |
||||
for ($j = 0; $j < 12; $j++) { |
$paymonth = $i * $SQuantity; |
||||
$a++; |
$countDay = date('Y-m-d', strtotime("$date + $paymonth months")); |
||||
echo '<pre>'; |
$payDay = str_replace('-', '', $countDay); |
||||
print_r($a); |
echo '<pre>'; |
||||
echo '</pre>'; |
print_r($payDay); |
||||
} |
echo '</pre>'; |
||||
} |
} |
||||
|
Binary file not shown.
@ -0,0 +1,46 @@ |
|||||
|
<?php |
||||
|
|
||||
|
require_once('../conn.php'); |
||||
|
$spec = $_GET['spec']; |
||||
|
$person = $_GET['person']; |
||||
|
$stop = $_GET['stop']; |
||||
|
$open = $_GET['open']; |
||||
|
$speed = $_GET['speed']; |
||||
|
$weight = $_GET['weight']; |
||||
|
|
||||
|
|
||||
|
$sql_str = "SELECT * FROM elevator_mi_option WHERE elevator_type = :elevator_type AND max_weight = :max_weight AND max_speed = :max_speed ORDER BY id DESC LIMIT 1"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':elevator_type', $spec); |
||||
|
$stmt->bindParam(':max_weight', $weight); |
||||
|
$stmt->bindParam(':max_speed', $speed); |
||||
|
$stmt->execute(); |
||||
|
$mi = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
|
||||
|
if(!$mi){ |
||||
|
echo false; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
$stop = $stop > $mi['max_floors'] ? $mi['max_floors'] : $stop; |
||||
|
$stop = $stop < 2 ? 2 : $stop; |
||||
|
$equipment_fee = round($mi['purchase_cost'] + ($stop - $mi['base_floor']) * $mi['material_plus']); |
||||
|
$customs_shipping_fee = round($equipment_fee * 0.09); |
||||
|
$unloading_fee = round($mi['unloading']); |
||||
|
$transport_site_fee = round($mi['transport_site']); |
||||
|
$install_fee = round(($mi['install_price'] + ($stop - $mi['base_floor']) * $mi['install_plus']) + $mi['trial_price'] + ($stop - $mi['base_floor']) * $mi['trial_plus']); |
||||
|
$free1y_fee = round($mi['free1y']); |
||||
|
$other_fee = round($mi['crane'] + $mi['wooden_box'] + $mi['consumables']); |
||||
|
|
||||
|
|
||||
|
$newMI = [ |
||||
|
'equipment_fee'=>$equipment_fee, |
||||
|
'customs_shipping_fee'=>$customs_shipping_fee, |
||||
|
'unloading_fee'=>$unloading_fee, |
||||
|
'transport_site_fee'=>$transport_site_fee, |
||||
|
'install_fee'=>$install_fee, |
||||
|
'free1y_fee'=>$free1y_fee, |
||||
|
'other_fee'=>$other_fee |
||||
|
]; |
||||
|
echo json_encode($newMI); |
@ -0,0 +1,38 @@ |
|||||
|
<?php |
||||
|
|
||||
|
require_once('../conn.php'); |
||||
|
date_default_timezone_set("Asia/Taipei"); |
||||
|
|
||||
|
$sign = $_POST['sign']; |
||||
|
$mid = $_POST['mid']; |
||||
|
$result = $_POST['result']; |
||||
|
$signOff = ''; |
||||
|
if($result == 'YY' ){ |
||||
|
$signOff = 'YY'; |
||||
|
}elseif($result == 'YN'){ |
||||
|
$signOff = 'N'; |
||||
|
}elseif($result == 'YS'){ |
||||
|
$signOff = 'Y'; |
||||
|
} |
||||
|
try{ |
||||
|
|
||||
|
$user_id = $_POST['user_id']; |
||||
|
|
||||
|
$sign_result = $user_id . "," . $signOff . "," . date("Y-m-d H:i:s"); |
||||
|
|
||||
|
$sql_str = "UPDATE pricereview_sign SET sign" . $sign . "=:sign WHERE mid = :mid "; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':sign', $sign_result); |
||||
|
$stmt->bindParam(':mid', $mid); |
||||
|
$stmt->execute(); |
||||
|
|
||||
|
$sql_str = "UPDATE pricereview_main SET status=:status WHERE id = :id "; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':status', $result); |
||||
|
$stmt->bindParam(':id', $mid); |
||||
|
$stmt->execute(); |
||||
|
|
||||
|
echo 1; |
||||
|
}catch(PDOException $e){ |
||||
|
echo $e->getMessage(); |
||||
|
} |
@ -1 +1 @@ |
|||||
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,gBAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADWQ;EACI,kBAAA;EACA,aAAA;ACTZ","file":"pricereview.css"} |
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,gBAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADWQ;EACI,kBAAA;EACA,aAAA;ACTZ;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB","file":"pricereview.css"} |
Loading…
Reference in new issue