Browse Source

會計審核時修改金額與稅率

gary
Ellin 2 years ago
parent
commit
4ec14a027c
  1. 11
      wms/rib02-edit.php
  2. 27
      wms/rib02-submit.php

11
wms/rib02-edit.php

@ -605,7 +605,7 @@ try {
$("#OAmount").val($("#Quantity").val() * $("#Price").val());
$("#LAmount").val($("#OAmount").val() * $("#CurrLAmount").val());
if ($("#TaxId").val() === "ST005") {
$("#OTax").val($("#OAmount").val()-$("#OAmount").val() /1.05);
$("#OTax").val($("#OAmount").val()-($("#OAmount").val() /1.05));
$("#LTax").val($("#OTax").val() * $("#CurrLAmount").val());
$("#OAmountUnWithTax").val($("#OAmount").val() / 1.05);
$("#LAmountUnWithTax").val($("#OAmountUnWithTax").val() * $("#CurrLAmount").val());
@ -620,8 +620,8 @@ try {
$("#Quantity").change(function() {
$("#OAmount").val($("#Quantity").val() * $("#Price").val());
$("#LAmount").val($("#OAmount").val() * $("#CurrLAmount").val());
if ($("#TaxId") === "ST005") {
$("#OTax").val($("#OAmount").val()-$("#OAmount").val() * 0.05);
if ($("#TaxId").val() === "ST005") {
$("#OTax").val($("#OAmount").val()-($("#OAmount").val()/ 1.05));
$("#LTax").val($("#OTax").val() * $("#CurrLAmount").val());
$("#OAmountUnWithTax").val($("#OAmount").val() / 1.05);
$("#LAmountUnWithTax").val($("#OAmountUnWithTax").val() * $("#CurrLAmount").val());
@ -636,8 +636,8 @@ try {
$("#TaxId").change(function() {
$("#OAmount").val($("#Quantity").val() * $("#Price").val());
$("#LAmount").val($("#OAmount").val() * $("#CurrLAmount").val());
if ($("#TaxId") === "ST005") {
$("#OTax").val($("#OAmount").val()-$("#OAmount").val() * 0.05);
if ($("#TaxId").val() === "ST005") {
$("#OTax").val($("#OAmount").val()-($("#OAmount").val()/ 1.05));
$("#LTax").val($("#OTax").val() * $("#CurrLAmount").val());
$("#OAmountUnWithTax").val($("#OAmount").val() / 1.05);
$("#LAmountUnWithTax").val($("#OAmountUnWithTax").val() * $("#CurrLAmount").val());
@ -722,6 +722,7 @@ try {
$("#OAmountUnWithTax").prop("disabled", false);
$("#LAmountUnWithTax").prop("disabled", false);
$("#LAmount").prop("disabled", false);
$("#OAmount").prop("disabled", false);
<?php } ?>
$('#ribsubeditform').submit();
}

27
wms/rib02-submit.php

@ -29,11 +29,11 @@ $CurrId = empty($_POST['CurrId']) ? null : $_POST['CurrId'];
$comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName'];
$FromSourceTag = 0;
$TaxRate = ($TaxId == "ST005") ? 0.05 : 0;
$OTax = empty($_POST['OTax']) ? null : $_POST['OTax'];
$LTax = empty($_POST['LTax']) ? null : $_POST['LTax'];
$OAmountUnWithTax = empty($_POST['OAmountUnWithTax']) ? null : $_POST['OAmountUnWithTax'];
$LAmountUnWithTax = empty($_POST['LAmountUnWithTax']) ? null : $_POST['LAmountUnWithTax'];
$LAmount = empty($_POST['LAmount']) ? null : $_POST['LAmount'];
$OTax = isset($_POST['OTax']) ? $_POST['OTax']:NULL;
$LTax = isset($_POST['LTax']) ? $_POST['LTax']:NULL;
$OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? $_POST['OAmountUnWithTax']:null;
$LAmountUnWithTax = isset($_POST['LAmountUnWithTax']) ? $_POST['LAmountUnWithTax']:null;
$LAmount = isset($_POST['LAmount']) ? $_POST['LAmount']:null;
$TaxNo = empty($_POST['TaxNo']) ? '' : $_POST['TaxNo'];
if (isset($comSupplierName) && ($comSupplierName != "雜項請款用")) {
@ -113,16 +113,17 @@ if ($submit == "add") {
$SQL1 .= empty($InvoiceNo) ? "" : ",InvoiceNo='$InvoiceNo'";
$SQL1 .= empty($comSupplierName) ? ",comSupplierName=' '" : ",comSupplierName='$comSupplierName'";
$SQL1 .= empty($comSupplierId) ? ",comSupplierId=' '" : ",comSupplierId='$comSupplierId'";
$SQL1 .= empty($OTax) ? "" : ",OTax=$OTax";
$SQL1 .= empty($LTax) ? "" : ",LTax=$LTax";
$SQL1 .= empty($OAmountUnWithTax) ? "" : ",OAmountUnWithTax=$OAmountUnWithTax";
$SQL1 .= empty($LAmountUnWithTax) ? "" : ",LAmountUnWithTax=$LAmountUnWithTax";
$SQL1 .= empty($LAmount) ? "" : ",LAmount=$LAmount";
$SQL1 .= isset($OTax) ? ",OTax=$OTax":"";
$SQL1 .= isset($LTax) ? ",LTax=$LTax":"";
$SQL1 .= isset($OAmountUnWithTax) ? ",OAmountUnWithTax=$OAmountUnWithTax":"";
$SQL1 .= isset($LAmountUnWithTax) ? ",LAmountUnWithTax=$LAmountUnWithTax":"";
$SQL1 .= isset($LAmount) ? ",LAmount=$LAmount":"";
if ($user_id == "M0056" && $state == 1) {
$SQL1 .= ",FeeBalance=$LAmountUnWithTax";
$SQL1 .= ",WriteOffAmount=$OAmount";
}
$SQL1 .= " WHERE ribsub_id = $ribsub_id";
echo $SQL1;
//上傳資料庫--表身
mysqli_query($link, $SQL1);
if (mysqli_affected_rows($link)) {
@ -159,11 +160,7 @@ if ($submit == "add") {
$sql_rib = "UPDATE rib SET OAmountWithTax=$OAmountWithTax, LAmountWithTax= $LAmountWithTax, LAmount=$LAmount,OAmount =$OAmount, UnPayOAmount=$OAmountWithTax, Balance = $OAmountWithTax, LBalance= $UnPayLAmount ,UnPaymentLAmt=$UnPayLAmount, UnPayLAmount=$UnPayLAmount,OTax=$OTax, LTax=$LTax, WriteOffAmount=$WriteOffAmount, LastOperatorId='$user_id' WHERE rib_id = $rib_id";
mysqli_query($link, $sql_rib);
?>
<script>
window.location.href = "rib01-check.php?id=<?php echo $rib_id ?>&state=1&<?= $token_link ?>";
</script>
<?php
} else {
$SQL1 = str_replace("'", '', $SQL1);
$sql_rib = "UPDATE rib SET LastOperatorId = '$user_id', LastOperation='$SQL1' WHERE rib_id=$rib_id";

Loading…
Cancel
Save