Browse Source

修改費用報銷單BUG(增加財會人員審核階段新增刪除權限)

gary
Ellin 1 year ago
parent
commit
59379de7a7
  1. 3
      wms/rib01-check.php
  2. 7
      wms/rib02-create.php
  3. 82
      wms/rib02-submit.php
  4. 6
      wms/rib03-submit.php

3
wms/rib01-check.php

@ -383,6 +383,9 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
<td><a href="rib02-edit.php?id=<?php echo $pay['ribsub_id'] ?>&state=1&<?= $token_link ?>" class="btn btn-warning btn-sm">
<span class=" glyphicon glyphicon-pencil"></span>
</a>
<a href="rib02-delete.php?ribsub_id=<?php echo $pay['ribsub_id'] ?>&rib_id=<?php echo $pay['rib_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm">
<span class=" glyphicon glyphicon-trash"></span>
</a>
</td>
<?php } else { ?>

7
wms/rib02-create.php

@ -258,7 +258,7 @@ $materials = $conn->query($sql_Material);
<div class="form-group">
<div class="col-md-3">
<label for="TaxId">稅碼</label>
<select name="TaxId" class="form-control">
<select name="TaxId" id="TaxId" class="form-control">
<option value="ST005" selected>營業稅5%</option>
<option value="ST101">零稅</option>
<option value="ST102">免稅</option>
@ -266,7 +266,7 @@ $materials = $conn->query($sql_Material);
</div>
<div class="col-md-3">
<label for="IsCounteract">抵扣</label>
<select name="IsCounteract" class="form-control">
<select name="IsCounteract" id="IsCounteract" class="form-control">
<option value=1 selected>可抵扣</option>
<option value=0>不可抵扣</option>
</select>
@ -276,7 +276,7 @@ $materials = $conn->query($sql_Material);
<div class="form-group">
<div class="col-md-3">
<label for="UnitId" style="color: red;">計量單位</label>
<select name="UnitId" class="form-control" required>
<select name="UnitId" id="UnitId" class="form-control" required>
<?php
foreach ($unit as $key => $value) { ?>
<option value="<?php echo $value['UnitId']; ?>"><?php echo $value['UnitName']; ?></option>
@ -636,6 +636,7 @@ $materials = $conn->query($sql_Material);
if ($user_id == "M0056" || $user_id == "M0209") { ?>
$("#OTax").prop("disabled", false);
$("#LTax").prop("disabled", false);
$("#CurrLAmount").prop("disabled", false);
$("#OAmountUnWithTax").prop("disabled", false);
$("#LAmountUnWithTax").prop("disabled", false);
$("#LAmount").prop("disabled", false);

82
wms/rib02-submit.php

@ -12,7 +12,7 @@ $BizPartner = $conn->query($sql_Biz);
foreach ($BizPartner as $biz) {
$bizKey = $biz['BizPartnerId'];
$bizValue = $biz['BizPartnerName'];
$BusinessPartner[$bizKey]=$bizValue;
$BusinessPartner[$bizKey] = $bizValue;
}
$RowCode = $_POST['RowCode'];
@ -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;
@ -44,12 +45,12 @@ $OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? $_POST['OAmountUnWithTax
$LAmountUnWithTax = isset($_POST['LAmountUnWithTax']) ? $_POST['LAmountUnWithTax'] : null;
$LAmount = isset($_POST['LAmount']) ? $_POST['LAmount'] : null;
$TaxNo = empty($_POST['TaxNo']) ? '' : $_POST['TaxNo'];
if (empty($TaxNo)){
if (empty($TaxNo)) {
$comSupplierName = "雜項請款用";
}else{
if (isset($BusinessPartner[$TaxNo])){
$comSupplierName= $BusinessPartner[$TaxNo];
}else{
} else {
if (isset($BusinessPartner[$TaxNo])) {
$comSupplierName = $BusinessPartner[$TaxNo];
} else {
$comSupplierName = "雜項請款用";
}
}
@ -70,31 +71,59 @@ if (isset($comSupplierName) && ($comSupplierName != "雜項請款用")) {
$SQL1 = "";
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`,
`Price`,`OAmount`,`FeeNoteShow`,`CurrId`,`SupplyOrgId`,`CurrOAmount`,`FromSourceTag`,`TaxId`,`IsCounteract`,`InvoiceId`,`TaxRate`,`CreatorId`,`TaxNo`";
$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`";
$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,
$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'";
$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 .= ")";
$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 .= ")";
}
$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 ?>";

6
wms/rib03-submit.php

@ -125,7 +125,7 @@ if ($state == 1) {
// 更新表頭資料
$BillDate = intval(date('Ymd'));
$sql_rib = "UPDATE rib SET BillDate=$BillDate,CurrentState=1,PermitState=1, OAmountWithTax=$OAmountWithTax, LAmountWithTax= $LAmountWithTax, LAmount=$LAmount,
$sql_rib = "UPDATE rib SET BillDate=$BillDate,CurrentState=1,PermitState=0, OAmountWithTax=$OAmountWithTax, LAmountWithTax= $LAmountWithTax, LAmount=$LAmount,
OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalance= $UnPayLAmount ,UnPaymentLAmt=$UnPayLAmount,
UnPayLAmount=$UnPayLAmount, OTax=$OTax, LTax=$LTax, WriteOffAmount=$WriteOffAmount, CreatorId='$user_id' WHERE rib_id = $rib_id";
@ -269,7 +269,7 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$HadPayOAmount,$HadPayLAmount,$UnPayOAmount,$UnPayLAmount,$PaymentState,$Balance,$LBalance,
0,'1000','$GatheringPersonId',$IsTaxBill,$OAmount,$LAmount,$OTax,$LTax,$LAmountWithTax,$OAmountWithTax,
$IsContainTax,$AdvanceOAmount,$AdvanceLAmount,$PrePayWriteOffAmount,$WriteOffAmount,
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,2";
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,0";
$sql .= empty($CostCenterId) ? "" : ",CostCenterId";
$sql2 .= empty($CostCenterId) ? "" : ",'" . $CostCenterId . "'";
@ -290,7 +290,7 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$sql .= ")";
$result = $conn->query($sql);
// 更改WMS RIB狀態
$rib_sql = "UPDATE rib SET BillNo='$BillNo',CurrentState=2, PermitState=2 WHERE rib_id =$rib_id";
$rib_sql = "UPDATE rib SET BillNo='$BillNo',CurrentState=2, PermitState=0 WHERE rib_id =$rib_id";
mysqli_query($link, $rib_sql);
//取得表身資料

Loading…
Cancel
Save