|
|
@ -35,6 +35,7 @@ $VoucherCount = empty($_POST['VoucherCount']) ? 1 : $_POST['VoucherCount']; |
|
|
|
$VoucherType = isset($_POST['VoucherType']) ? $_POST['VoucherType'] : 0; |
|
|
|
$InvoiceNo = empty($_POST['InvoiceNo']) ? NULL : $_POST['InvoiceNo']; |
|
|
|
$CurrId = empty($_POST['CurrId']) ? null : $_POST['CurrId']; |
|
|
|
$CurrLAmount = empty($_POST['CurrLAmount']) ? null : $_POST['CurrLAmount']; |
|
|
|
// $comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName']; |
|
|
|
$FromSourceTag = 0; |
|
|
|
$TaxRate = ($TaxId == "ST005") ? 0.05 : 0; |
|
|
@ -70,6 +71,34 @@ if (isset($comSupplierName) && ($comSupplierName != "雜項請款用")) { |
|
|
|
|
|
|
|
$SQL1 = ""; |
|
|
|
if ($submit == "add") { |
|
|
|
if (($user_id == "M0056" )|| ($user_id == "M0209")) { |
|
|
|
$SQL1 = "INSERT INTO rib_sub (`RowCode`,`rib_id`,`RowNo`,`FeeDate`,`FeeTypeId`,`WriteOffType`, |
|
|
|
`BizOrgId`,`WriteOffId`,`FeeOrgId`,`FeeDeptId`,`FeeCompanyId`,`UnitId`,`Quantity`, |
|
|
|
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`,`CurrentLAmount`,`OTax`,`LTax`, |
|
|
|
`OAmountUnWithTax`,`LAmountUnWithTax`,`LAmount`"; |
|
|
|
$SQL1 .= empty($ProjectId) ? "" : ",`ProjectId`"; |
|
|
|
$SQL1 .= isset($FeeTypeGen) ? ",`FeeTypeGen`" : ""; |
|
|
|
$SQL1 .= empty($CU_MaterialId) ? "" : ",`CU_MaterialId`"; |
|
|
|
$SQL1 .= empty($VoucherCount) ? "" : ",`VoucherCount`"; |
|
|
|
$SQL1 .= isset($VoucherType) ? ",`VoucherType`" : ""; |
|
|
|
$SQL1 .= empty($InvoiceNo) ? "" : ",`InvoiceNo`"; |
|
|
|
$SQL1 .= empty($comSupplierName) ? "" : ",`comSupplierName`"; |
|
|
|
$SQL1 .= empty($comSupplierId) ? ",`comSupplierId`" : ",`comSupplierId`"; |
|
|
|
|
|
|
|
$SQL2 = ") VALUES ($RowCode, $rib_id, $RowCode,$FeeDate,'$FeeTypeId',2, |
|
|
|
'1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId',$Quantity, |
|
|
|
$Price,$OAmount,'$FeeNoteShow','$CurrId','1000',1,0,'$TaxId',$IsCounteract,'$InvoiceId',$TaxRate,'$user_id','$TaxNo',$CurrLAmount,$OTax,$LTax, |
|
|
|
$OAmountUnWithTax,$LAmountUnWithTax,$LAmount"; |
|
|
|
$SQL2 .= empty($ProjectId) ? "" : ",'" . $ProjectId . "'"; |
|
|
|
$SQL2 .= isset($FeeTypeGen) ? "," . $FeeTypeGen : ""; |
|
|
|
$SQL2 .= empty($CU_MaterialId) ? "" : ",'" . $CU_MaterialId . "'"; |
|
|
|
$SQL2 .= empty($VoucherCount) ? "" : "," . $VoucherCount; |
|
|
|
$SQL2 .= isset($VoucherType) ? "," . $VoucherType : ""; |
|
|
|
$SQL2 .= empty($InvoiceNo) ? "" : ",'" . $InvoiceNo . "'"; |
|
|
|
$SQL2 .= empty($comSupplierName) ? "" : ",'" . $comSupplierName . "'"; |
|
|
|
$SQL2 .= empty($comSupplierId) ? ",' '" : ",'" . $comSupplierId . "'"; |
|
|
|
$SQL2 .= ")"; |
|
|
|
} else { |
|
|
|
$SQL1 = "INSERT INTO rib_sub (`RowCode`,`rib_id`,`RowNo`,`FeeDate`,`FeeTypeId`,`WriteOffType`, |
|
|
|
`BizOrgId`,`WriteOffId`,`FeeOrgId`,`FeeDeptId`,`FeeCompanyId`,`UnitId`,`Quantity`, |
|
|
|
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`"; |
|
|
@ -94,7 +123,7 @@ if ($submit == "add") { |
|
|
|
$SQL2 .= empty($comSupplierName) ? "" : ",'" . $comSupplierName . "'"; |
|
|
|
$SQL2 .= empty($comSupplierId) ? ",' '" : ",'" . $comSupplierId . "'"; |
|
|
|
$SQL2 .= ")"; |
|
|
|
|
|
|
|
} |
|
|
|
$SQL1 .= $SQL2; |
|
|
|
//上傳資料庫 |
|
|
|
mysqli_query($link, $SQL1); |
|
|
@ -107,6 +136,7 @@ if ($submit == "add") { |
|
|
|
$SQL1 = str_replace("'", '', $SQL1); |
|
|
|
$sql_rib = "UPDATE rib SET LastOperatorId = '$user_id', LastOperation='$SQL1' WHERE rib_id=$rib_id"; |
|
|
|
mysqli_query($link, $sql_rib); |
|
|
|
|
|
|
|
?> |
|
|
|
<script> |
|
|
|
window.location.href = "rib01-check.php?id=<?php echo $rib_id ?>&state=0&<?= $token_link ?>"; |
|
|
|