Browse Source

修改發票日期判斷與依據幣別作整數或取小數點後兩位

gary
Ellin 1 year ago
parent
commit
8f80993f79
  1. BIN
      wms/WriteOff.xlsx
  2. 16
      wms/rib02-create.php
  3. 11
      wms/rib02-edit.php
  4. 62
      wms/rib03-submit.php

BIN
wms/WriteOff.xlsx

Binary file not shown.

16
wms/rib02-create.php

@ -636,11 +636,13 @@ $materials = $conn->query($sql_Material);
$("#FeeDate").val(''); $("#FeeDate").val('');
} else { } else {
let year = $("#FeeDate").val().substr(0, 4); let year = $("#FeeDate").val().substr(0, 4);
let month = $("#FeeDate").val().substr(4, 2); let month = parseInt($("#FeeDate").val().substr(4, 2)) - 1;
let day = $("#FeeDate").val().substr(6, 2); let day = $("#FeeDate").val().substr(6, 2);
let feedate = new Date(year, month, day); let feedate = new Date(year, month, day);
feedate.setMonth(feedate.getMonth() - 1);
let now = new Date(); let now = new Date();
if (feedate.getMonth() != month) {
alert("請輸入正確格式的日期");
} else {
if (feedate > now) { if (feedate > now) {
alert("費用日期不可大於今天"); alert("費用日期不可大於今天");
$("#FeeDate").val(''); $("#FeeDate").val('');
@ -648,19 +650,13 @@ $materials = $conn->query($sql_Material);
now.setMonth(now.getMonth() - 2); now.setMonth(now.getMonth() - 2);
now.setDate(1); now.setDate(1);
now.setDate(now.getDate() - 1); now.setDate(now.getDate() - 1);
console.log(now.getFullYear());
console.log(now.getMonth());
console.log(now.getDate());
console.log(feedate.getFullYear());
console.log(feedate.getMonth());
console.log(feedate.getDate());
if (feedate <= now) { if (feedate <= now) {
alert("超過兩個月的費用無法進行報銷"); alert("超過兩個月的費用無法進行報銷");
$("#FeeDate").val(''); $("#FeeDate").val('');
} }
} }
} }
}
}) })
}) })
@ -685,7 +681,7 @@ $materials = $conn->query($sql_Material);
}; };
function senddata() { function senddata() {
if ($("#FeeDate").val() == "" || $("#FeeNoteShow").val() == "" || $("#Price").val() == "" || $("#Quantity").val() == "") { if ($("#FeeDate").val() == "" || $("#FeeNoteShow").val() == "" || $("#Price").val() == "" || $("#Quantity").val() == "" || $("#WriteOffId").val() == "") {
alert("請確認紅字部分皆有填寫"); alert("請確認紅字部分皆有填寫");
} else if ($("#OAmount").val() <= 0) { } else if ($("#OAmount").val() <= 0) {
alert("金額必須大於零"); alert("金額必須大於零");

11
wms/rib02-edit.php

@ -550,24 +550,27 @@ $materials = $conn->query($sql_Material);
$("#FeeDate").val(''); $("#FeeDate").val('');
} else { } else {
let year = $("#FeeDate").val().substr(0, 4); let year = $("#FeeDate").val().substr(0, 4);
let month = $("#FeeDate").val().substr(4, 2); let month = parseInt($("#FeeDate").val().substr(4, 2)) - 1;
let day = $("#FeeDate").val().substr(6, 2); let day = $("#FeeDate").val().substr(6, 2);
let feedate = new Date(year, month, day); let feedate = new Date(year, month, day);
feedate.setMonth(feedate.getMonth() - 1);
let now = new Date(); let now = new Date();
if (feedate.getMonth() != month) {
alert("請輸入正確格式的日期");
} else {
if (feedate > now) { if (feedate > now) {
alert("費用日期不可大於今天"); alert("費用日期不可大於今天");
$("#FeeDate").val(''); $("#FeeDate").val('');
} else { } else {
now.setMonth(now.getMonth() - 2); now.setMonth(now.getMonth() - 2);
now.setDate(1); now.setDate(1);
now.setDate(now.getDate() - 1) now.setDate(now.getDate() - 1);
if (feedate < now) { if (feedate <= now) {
alert("超過兩個月的費用無法進行報銷"); alert("超過兩個月的費用無法進行報銷");
$("#FeeDate").val(''); $("#FeeDate").val('');
} }
} }
} }
}
}) })
$("#Price").change(function() { $("#Price").change(function() {

62
wms/rib03-submit.php

@ -224,13 +224,13 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$WriteOffDescribe = empty($rib['WriteOffDescribe']) ? null : $rib['WriteOffDescribe']; $WriteOffDescribe = empty($rib['WriteOffDescribe']) ? null : $rib['WriteOffDescribe'];
$DeptId = $rib['DeptId']; $DeptId = $rib['DeptId'];
$CostCenterId = empty($rib['CostCenterId']) ? Null : $rib['CostCenterId']; $CostCenterId = empty($rib['CostCenterId']) ? Null : $rib['CostCenterId'];
$HadPayOAmount = $rib['HadPayOAmount']; $HadPayOAmount = $CurrId=="TWD"? round($rib['HadPayOAmount']):round($rib['HadPayOAmount'],2);
$HadPayLAmount = $rib['HadPayLAmount']; $HadPayLAmount = $CurrId=="TWD"? round($rib['HadPayLAmount']):round($rib['HadPayLAmount'],2);
$UnPayOAmount = $rib['UnPayOAmount']; $UnPayOAmount = $CurrId=="TWD"? round($rib['UnPayOAmount']):round($rib['UnPayOAmount'],2);
$UnPayLAmount = $rib['UnPayLAmount']; $UnPayLAmount = $CurrId=="TWD"? round($rib['UnPayLAmount']):round($rib['UnPayLAmount'],2);
$PaymentState = $rib['PaymentState']; $PaymentState = $rib['PaymentState'];
$Balance = $rib['Balance']; $Balance = $CurrId=="TWD"? round($rib['Balance']):round($rib['Balance'],2);
$LBalance = $rib['LBalance']; $LBalance = $CurrId=="TWD"? round($rib['LBalance']):round($rib['LBalance'],2);
$GatheringPersonId = $rib['GatheringPersonId']; $GatheringPersonId = $rib['GatheringPersonId'];
$GatheringPersonDescribe = empty($rib['GatheringPersonDescribe']) ? Null : $rib['GatheringPersonDescribe']; $GatheringPersonDescribe = empty($rib['GatheringPersonDescribe']) ? Null : $rib['GatheringPersonDescribe'];
$BankId = empty($rib['BankId']) ? Null : $rib['BankId']; $BankId = empty($rib['BankId']) ? Null : $rib['BankId'];
@ -241,19 +241,20 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$BankAccount = empty($rib['BankAccount']) ? Null : $rib['BankAccount']; $BankAccount = empty($rib['BankAccount']) ? Null : $rib['BankAccount'];
$BankAccountName = empty($rib['BankAccountName']) ? Null : $rib['BankAccountName']; $BankAccountName = empty($rib['BankAccountName']) ? Null : $rib['BankAccountName'];
$IsTaxBill = $rib['IsTaxBill']; $IsTaxBill = $rib['IsTaxBill'];
$OAmount = $rib['OAmount']; $OAmount = $CurrId=="TWD"? round($rib['OAmount']):round($rib['OAmount'],2);
$LAmount = $rib['LAmount']; $LAmount = $CurrId=="TWD"? round($rib['LAmount']):round($rib['LAmount'],2);
$OTax = $rib['OTax']; $OTax = $CurrId=="TWD"? round($rib['OTax']):round($rib['OTax'],2);
$LTax = $rib['LTax']; $LTax = $CurrId=="TWD"? round($rib['LTax']):round($rib['LTax'],2);
$LAmountWithTax = $rib['LAmountWithTax']; $LAmountWithTax = $CurrId=="TWD"? round($rib['LAmountWithTax']):round($rib['LAmountWithTax'],2);
$OAmountWithTax = $rib['OAmountWithTax']; $OAmountWithTax = $CurrId=="TWD"? round($rib['OAmountWithTax']):round($rib['OAmountWithTax'],2);
$IsContainTax = $rib['IsContainTax']; $IsContainTax = $rib['IsContainTax'];
$AdvanceOAmount = $rib['AdvanceOAmount']; $AdvanceOAmount = $CurrId=="TWD"? round($rib['AdvanceOAmount']):round($rib['AdvanceOAmount'],2);
$AdvanceLAmount = $rib['AdvanceLAmount']; $AdvanceLAmount = $CurrId=="TWD"? round($rib['AdvanceLAmount']):round($rib['AdvanceLAmount'],2);
$PrePayWriteOffAmount = $rib['PrePayWriteOffAmount']; $PrePayWriteOffAmount = $rib['PrePayWriteOffAmount'];
$WriteOffAmount = $rib['WriteOffAmount']; $WriteOffAmount = $CurrId=="TWD"? round($rib['WriteOffAmount']):round($rib['WriteOffAmount'],2);
$TelNo = empty($rib['TelNo']) ? Null : $rib['TelNo']; $TelNo = empty($rib['TelNo']) ? Null : $rib['TelNo'];
$UnPaymentLAmt = empty($rib['UnPaymentLAmt']) ? null : $rib['UnPaymentLAmt']; $UnPaymentLAmt = empty($rib['UnPaymentLAmt']) ? null : ($CurrId=="TWD"? round($rib['UnPaymentLAmt']):round($rib['UnPaymentLAmt'],2));
$CreatorId = $rib['CreatorId'];
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -262,14 +263,14 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
HadPayOAmount,HadPayLAmount,UnPayOAmount,UnPayLAmount,PaymentState,Balance,LBalance, HadPayOAmount,HadPayLAmount,UnPayOAmount,UnPayLAmount,PaymentState,Balance,LBalance,
FillUp,GatheringBizOrgId, GatheringPersonId, IsTaxBill, OAmount,LAmount,OTax,LTax,LAmountWithTax,OAmountWithTax, FillUp,GatheringBizOrgId, GatheringPersonId, IsTaxBill, OAmount,LAmount,OTax,LTax,LAmountWithTax,OAmountWithTax,
IsContainTax,AdvanceOAmount,AdvanceLAmount,PrePayWriteOffAmount,WriteOffAmount, IsContainTax,AdvanceOAmount,AdvanceLAmount,PrePayWriteOffAmount,WriteOffAmount,
CompId,UnPaymentOAmt,UnPaymentLAmt,IsPayment, CurrentState,PermitState"; CompId,UnPaymentOAmt,UnPaymentLAmt,IsPayment, CurrentState,PermitState,CreatorId";
$sql2 = ") VALUES ('$BillNo',$BillDate,'1000','1000','$TypeId','1000', $sql2 = ") VALUES ('$BillNo',$BillDate,'1000','1000','$TypeId','1000',
'$CurrId','$TransactId',$WriteOffType,'1000','$WriteOffId','$DeptId', '$CurrId','$TransactId',$WriteOffType,'1000','$WriteOffId','$DeptId',
$HadPayOAmount,$HadPayLAmount,$UnPayOAmount,$UnPayLAmount,$PaymentState,$Balance,$LBalance, $HadPayOAmount,$HadPayLAmount,$UnPayOAmount,$UnPayLAmount,$PaymentState,$Balance,$LBalance,
0,'1000','$GatheringPersonId',$IsTaxBill,$OAmount,$LAmount,$OTax,$LTax,$LAmountWithTax,$OAmountWithTax, 0,'1000','$GatheringPersonId',$IsTaxBill,$OAmount,$LAmount,$OTax,$LTax,$LAmountWithTax,$OAmountWithTax,
$IsContainTax,$AdvanceOAmount,$AdvanceLAmount,$PrePayWriteOffAmount,$WriteOffAmount, $IsContainTax,$AdvanceOAmount,$AdvanceLAmount,$PrePayWriteOffAmount,$WriteOffAmount,
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,0"; '1001',$WriteOffAmount,$UnPaymentLAmt,0,2,0,'$CreatorId'";
$sql .= empty($CostCenterId) ? "" : ",CostCenterId"; $sql .= empty($CostCenterId) ? "" : ",CostCenterId";
$sql2 .= empty($CostCenterId) ? "" : ",'" . $CostCenterId . "'"; $sql2 .= empty($CostCenterId) ? "" : ",'" . $CostCenterId . "'";
@ -309,18 +310,18 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$CostCenterId = empty($ribsub['CostCenterId']) ? Null : $ribsub['CostCenterId']; $CostCenterId = empty($ribsub['CostCenterId']) ? Null : $ribsub['CostCenterId'];
$UnitId = $ribsub['UnitId']; $UnitId = $ribsub['UnitId'];
$Quantity = $ribsub['Quantity']; $Quantity = $ribsub['Quantity'];
$Price = $ribsub['Price']; $Price = $CurrId=="TWD"? round($ribsub['Price']) : round($ribsub['Price'],2);
$CurrOAmount = $ribsub['CurrOAmount']; $CurrOAmount = $CurrId=="TWD"? round($ribsub['CurrOAmount']) : round($ribsub['CurrOAmount'],2);
$CurrLAmount = $ribsub['CurrentLAmount']; $CurrLAmount = $CurrId=="TWD"? round($ribsub['CurrentLAmount']): round($ribsub['CurrentLAmount'],2);
$TaxId = $ribsub['TaxId']; $TaxId = $ribsub['TaxId'];
$TaxRate = $ribsub['TaxRate']; $TaxRate = $ribsub['TaxRate'];
$OTax = $ribsub['OTax']; $OTax = $CurrId=="TWD"? round($ribsub['OTax']): round($ribsub['OTax'],2);
$LTax = $ribsub['LTax']; $LTax = $CurrId=="TWD"? round($ribsub['LTax']): round($ribsub['LTax'],2);
$LAmountUnWithTax = $ribsub['LAmountUnWithTax']; $LAmountUnWithTax = $CurrId=="TWD"? round($ribsub['LAmountUnWithTax']): round($ribsub['LAmountUnWithTax'],2);
$OAmountUnWithTax = $ribsub['OAmountUnWithTax']; $OAmountUnWithTax = $CurrId=="TWD"? round($ribsub['OAmountUnWithTax']): round($ribsub['OAmountUnWithTax'],2);
$OAmount = $ribsub['OAmount']; $OAmount = $CurrId=="TWD"? round($ribsub['OAmount']): round($ribsub['OAmount'],2);
$LAmount = $ribsub['LAmount']; $LAmount = $CurrId=="TWD"? round($ribsub['LAmount']): round($ribsub['LAmount'],2);
$FeeBalance = $ribsub['FeeBalance']; $FeeBalance = $CurrId=="TWD"? round($ribsub['FeeBalance']): round($ribsub['FeeBalance'],2);
$VoucherCount = $ribsub['VoucherCount']; $VoucherCount = $ribsub['VoucherCount'];
$FeeNoteShow = empty($ribsub['FeeNoteShow']) ? Null : $ribsub['FeeNoteShow']; $FeeNoteShow = empty($ribsub['FeeNoteShow']) ? Null : $ribsub['FeeNoteShow'];
@ -341,13 +342,13 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$sqlsub = "INSERT INTO glFeeWriteOffSub (BillNo, RowCode,RowNo,FeeDate,FeeTypeId, WriteOffType, $sqlsub = "INSERT INTO glFeeWriteOffSub (BillNo, RowCode,RowNo,FeeDate,FeeTypeId, WriteOffType,
BizOrgId, WriteOffId, FeeOrgId, FeeDeptId, FeeCompanyId, UnitId , BizOrgId, WriteOffId, FeeOrgId, FeeDeptId, FeeCompanyId, UnitId ,
Quantity, Price, CurrOAmount,CurrLAmount,TaxId,TaxRate,OTax,LTax,LAmountUnWithTax Quantity, Price, CurrOAmount,CurrLAmount,TaxId,TaxRate,OTax,LTax,LAmountUnWithTax
,OAmountUnWithTax,OAmount,LAmount,FeeBalance,VoucherCount,CurrId,WriteOffAmount,SupplyOrgId,IsCounteract,IsKeyByFeeInfo,CreatorId ,OAmountUnWithTax,OAmount,LAmount,FeeBalance,VoucherCount,CurrId,WriteOffAmount,SupplyOrgId,IsCounteract,IsKeyByFeeInfo
"; ";
$sqlsub2 = ") VALUES ('$BillNo',$RowCode, $RowNo,$FeeDate,'$FeeTypeId',$WriteOffType, $sqlsub2 = ") VALUES ('$BillNo',$RowCode, $RowNo,$FeeDate,'$FeeTypeId',$WriteOffType,
'1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId', '1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId',
$Quantity, $Price, $CurrOAmount, $CurrLAmount,'$TaxId',$TaxRate,$OTax,$LTax,$LAmountUnWithTax $Quantity, $Price, $CurrOAmount, $CurrLAmount,'$TaxId',$TaxRate,$OTax,$LTax,$LAmountUnWithTax
,$OAmountUnWithTax,$OAmount,$LAmount,$FeeBalance,$VoucherCount,'$CurrId',$WriteOffAmount,'1000',$IsCounteract,0,$CreatorId ,$OAmountUnWithTax,$OAmount,$LAmount,$FeeBalance,$VoucherCount,'$CurrId',$WriteOffAmount,'1000',$IsCounteract,0
"; ";
$sqlsub .= empty($WriteOffDescribe) ? "" : ",WriteOffDescribe"; $sqlsub .= empty($WriteOffDescribe) ? "" : ",WriteOffDescribe";
@ -374,7 +375,6 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$sqlsub .= $sqlsub2; $sqlsub .= $sqlsub2;
$sqlsub .= ")"; $sqlsub .= ")";
$result2 = $conn->query($sqlsub); $result2 = $conn->query($sqlsub);
} }

Loading…
Cancel
Save