11 changed files with 2878 additions and 815 deletions
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> |
|
Loading…
Reference in new issue