|
|
@ -53,26 +53,42 @@ |
|
|
|
:tableAllSchemas="SupplierinvoiceRequestDetail.allSchemas" |
|
|
|
:tableFormRules="SupplierinvoiceRequestDetailRules" |
|
|
|
:tableData="tableData" |
|
|
|
:sumFormDataByForm ="(formRef,formModel,tableData,formType,originFormModel,updateOriginFormModel)=>{ |
|
|
|
const {taxRate=0,amount=0,taxAmount=0,beforeTaxAmount=0,totalTaxAmount=0,discountAmount1=0,beforeTaxDiffAmount=0,taxAmountDiff=0} = formModel |
|
|
|
:sumFormDataByForm ="(formRef,formModel,tableData,formType,originFormModel,updateOriginFormModel,sumFormDataHandle1)=>{ |
|
|
|
const {taxRate=0,amount=0,taxAmount=0,beforeTaxAmount=0,totalTaxAmount=0,discountAmount1=0,beforeTaxDiffAmount=0,taxAmountDiff=0} = formModel |
|
|
|
// 2、系统税额:每条数据的合同价格X可开票数量,计算结果取两位小数之后*税率的计算结果,再保留2位。所有子表数据再求和 |
|
|
|
let taxAmount_ = 0.00 |
|
|
|
if(formType=='update'){ // 编辑 |
|
|
|
taxAmount_ = taxAmount |
|
|
|
console.log('taxRate',taxRate) |
|
|
|
console.log('originFormModel',originFormModel.taxRate) |
|
|
|
console.log('taxAmount',taxAmount) |
|
|
|
if(taxRate!=originFormModel.taxRate){ |
|
|
|
if(originFormModel){ |
|
|
|
sumFormDataHandle1() |
|
|
|
} |
|
|
|
updateOriginFormModel(formModel) |
|
|
|
} |
|
|
|
formRef.value.setValues({ |
|
|
|
afterTaxAmount:amount+taxAmount, // 3、系统价税合计:系统未税金额+系统税额 |
|
|
|
adTaxAmount:beforeTaxAmount+totalTaxAmount, //6、价税合计金额:未税金额+税额 |
|
|
|
beforeTaxDiffAmount:beforeTaxAmount-amount-discountAmount1,//未税差额:未税金额-系统未税金额-折扣金额 |
|
|
|
taxAmountDiff:totalTaxAmount-taxAmount,// 税额差异:税额-系统税额 |
|
|
|
totalTaxDiffAmount:beforeTaxDiffAmount+taxAmountDiff // 价税合计差额=未税差额+税额差异 |
|
|
|
}) |
|
|
|
}else if(formType=='create'){ // 新增 |
|
|
|
let taxAmount_ = taxAmount |
|
|
|
if(taxRate!=originFormModel.taxRate){ |
|
|
|
taxAmount_ = tableData.reduce((prev, item) => prev + Number(Number(taxRate*0.01*Number(Number(item['singlePrice']*item['invoicableQuantity']).toFixed(2))).toFixed(2)),0) |
|
|
|
updateOriginFormModel(formModel) |
|
|
|
} |
|
|
|
formRef.value.setValues({ |
|
|
|
taxAmount:taxAmount_, |
|
|
|
afterTaxAmount:amount+taxAmount, // 3、系统价税合计:系统未税金额+系统税额 |
|
|
|
adTaxAmount:beforeTaxAmount+totalTaxAmount, //6、价税合计金额:未税金额+税额 |
|
|
|
beforeTaxDiffAmount:beforeTaxAmount-amount-discountAmount1,//未税差额:未税金额-系统未税金额-折扣金额 |
|
|
|
taxAmountDiff:totalTaxAmount-taxAmount,// 税额差异:税额-系统税额 |
|
|
|
totalTaxDiffAmount:beforeTaxDiffAmount+taxAmountDiff // 价税合计差额=未税差额+税额差异 |
|
|
|
}) |
|
|
|
} |
|
|
|
formRef.value.setValues({ |
|
|
|
taxAmount:taxAmount_, |
|
|
|
afterTaxAmount:amount+taxAmount, // 3、系统价税合计:系统未税金额+系统税额 |
|
|
|
adTaxAmount:beforeTaxAmount+totalTaxAmount, //6、价税合计金额:未税金额+税额 |
|
|
|
beforeTaxDiffAmount:beforeTaxAmount-amount-discountAmount1,//未税差额:未税金额-系统未税金额-折扣金额 |
|
|
|
taxAmountDiff:totalTaxAmount-taxAmount,// 税额差异:税额-系统税额 |
|
|
|
totalTaxDiffAmount:beforeTaxDiffAmount+taxAmountDiff // 价税合计差额=未税差额+税额差异 |
|
|
|
}) |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
:sumFormDataByTableCustom ="(formRef,formModel,tableData)=>{ |
|
|
@ -92,6 +108,7 @@ |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
|
@sumFormDataHandle="sumFormDataHandle" |
|
|
|
> |
|
|
|
<!-- <template #foorter> |
|
|
|
<div style="text-align: left"> |
|
|
@ -279,6 +296,7 @@ const searchTableSuccessDetail = async (formField, searchField, val, formRef,sea |
|
|
|
subList:val |
|
|
|
}) |
|
|
|
detailRef.value.updateList() |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
// const basicFormFooter = computed(()=>{ |
|
|
@ -941,6 +959,17 @@ const handleImport = () => { |
|
|
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
|
|
|
} |
|
|
|
|
|
|
|
const sumFormDataHandle = async (formRef1,formModel,tableData,formType,originFormModel,updateOriginFormModel)=>{ |
|
|
|
if(formType=='update'){ |
|
|
|
if(formModel&&formModel.id&&formModel.taxRate&&originFormModel){ |
|
|
|
let res = await SupplierinvoiceRequestMainApi.getTaxAmount({id:formModel.id,taxRate:formModel.taxRate}) |
|
|
|
console.log('更新taxAmount',res) |
|
|
|
formRef1.value.setValues({ |
|
|
|
taxAmount:res |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
let data = {...submitData} |
|
|
|