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