7 changed files with 495 additions and 37 deletions
@ -0,0 +1,48 @@ |
|||
{ |
|||
// Use IntelliSense to learn about possible attributes. |
|||
// Hover to view descriptions of existing attributes. |
|||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
|||
"version": "0.2.0", |
|||
"configurations": [ |
|||
{ |
|||
"name": "Listen for Xdebug", |
|||
"type": "php", |
|||
"request": "launch", |
|||
"port": 9003 |
|||
}, |
|||
{ |
|||
"name": "Launch currently open script", |
|||
"type": "php", |
|||
"request": "launch", |
|||
"program": "${file}", |
|||
"cwd": "${fileDirname}", |
|||
"port": 0, |
|||
"runtimeArgs": [ |
|||
"-dxdebug.start_with_request=yes" |
|||
], |
|||
"env": { |
|||
"XDEBUG_MODE": "debug,develop", |
|||
"XDEBUG_CONFIG": "client_port=${port}" |
|||
} |
|||
}, |
|||
{ |
|||
"name": "Launch Built-in web server", |
|||
"type": "php", |
|||
"request": "launch", |
|||
"runtimeArgs": [ |
|||
"-dxdebug.mode=debug", |
|||
"-dxdebug.start_with_request=yes", |
|||
"-S", |
|||
"localhost:0" |
|||
], |
|||
"program": "", |
|||
"cwd": "${workspaceRoot}", |
|||
"port": 9003, |
|||
"serverReadyAction": { |
|||
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started", |
|||
"uriFormat": "http://localhost:%s", |
|||
"action": "openExternally" |
|||
} |
|||
} |
|||
] |
|||
} |
@ -1,4 +1,121 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$BillNo = $_GET['BillNo']; |
|||
echo $BillNo; |
|||
$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] ?>"> |
|||
</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); |
|||
|
|||
$("#pay_received").submit(); |
|||
} |
|||
</script> |
@ -0,0 +1,121 @@ |
|||
<?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> |
|||
|
|||
|
|||
<input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>"> |
|||
</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(); |
|||
$("#pay_received").submit(); |
|||
} |
|||
</script> |
@ -0,0 +1,84 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$type = $_GET['type']; |
|||
$InvoiceNo = empty($_POST['InvoiceNo']) ? NULL : str_replace('-', '', trim($_POST['InvoiceNo'])); |
|||
$InvoiceDate = empty($_POST['InvoiceDate']) ? NULL: $_POST['InvoiceDate']; |
|||
|
|||
$invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount']; |
|||
$received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount']; |
|||
$received_date = empty($_POST['ReceivedDate']) ? NULL : $_POST['ReceivedDate']; |
|||
$remark = empty($_POST['remark']) ? '' : $_POST['remark']; |
|||
|
|||
if ($type == 'edit') { |
|||
$pay_id = $_POST['pay_id']; |
|||
$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',"; |
|||
} |
|||
$sql1=substr($sql1,0,-1); |
|||
$sql = $sql1 . " WHERE pay_id = $pay_id"; |
|||
echo $sql; |
|||
exit(); |
|||
} 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 (!empty($InvoiceNo)) { |
|||
$sql1 .= ",invoice_no"; |
|||
$sql2 .= ",'$InvoiceNo'"; |
|||
} |
|||
if (isset($InvoiceDate)) { |
|||
$sql1 .= ",invoice_date"; |
|||
$sql2 .= ",'$InvoiceDate'"; |
|||
} |
|||
if (!empty($invoice_amount)) { |
|||
$sql1 .= ",invoice_amount"; |
|||
$sql2 .= ",$invoice_amount"; |
|||
} |
|||
if (!empty($received_amount)) { |
|||
$sql1 .= ",received_amount"; |
|||
$sql2 .= ",$received_amount"; |
|||
} |
|||
if (isset($received_date)) { |
|||
$sql1 .= ",received_date"; |
|||
$sql2 .= ",'$received_date'"; |
|||
} |
|||
if (!empty($remark)) { |
|||
$sql1 .= ",remark"; |
|||
$sql2 .= ",'$remark'"; |
|||
} |
|||
$sql = $sql1 . $sql2 . ",'$user_id')"; |
|||
} |
|||
mysqli_query($link, $sql); |
|||
if (mysqli_affected_rows($link)) { |
|||
echo '<script>alert("新增/更新 成功")</script>'; |
|||
echo $sql; |
|||
} else { |
|||
echo '<script>alert("新增/更新 失敗")</script>'; |
|||
} |
Loading…
Reference in new issue