|
|
@ -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"> |
|
|
@ -185,6 +202,7 @@ |
|
|
|
@tableFormButton="tableFormButton" |
|
|
|
:mainSubmitCreateApi="true" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
@handleMainFefresh="handleMainFefresh" |
|
|
|
> |
|
|
|
<template #differencePrice="{row}"> |
|
|
|
<span :class="{'red-text':row.differencePrice!=0}">{{ row.differencePrice }}</span> |
|
|
@ -204,6 +222,7 @@ |
|
|
|
|
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import dayjs from 'dayjs' |
|
|
|
// 供应商发票申请 |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
@ -267,6 +286,9 @@ const getSelectionRows = (currentPage,currentPageSelectionRows) => { |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
const handleMainFefresh = ()=>{ |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
const searchTableSuccessDetail = async (formField, searchField, val, formRef,searchTableFormModel)=>{ |
|
|
|
console.log('详情',formField, searchField, val, formRef,searchTableFormModel) |
|
|
@ -279,6 +301,7 @@ const searchTableSuccessDetail = async (formField, searchField, val, formRef,sea |
|
|
|
subList:val |
|
|
|
}) |
|
|
|
detailRef.value.updateList() |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
// const basicFormFooter = computed(()=>{ |
|
|
@ -754,6 +777,7 @@ const handleImport = () => { |
|
|
|
/** 审批通过按钮操作 finance_mainPlanSub */ |
|
|
|
const formFinanceRef = ref() |
|
|
|
const handleFinanceApp = async (row) => { |
|
|
|
row.postingDate = dayjs().valueOf() |
|
|
|
formFinanceRef.value.open('update', row,null,'财务通过','财务通过') |
|
|
|
} |
|
|
|
|
|
|
@ -941,6 +965,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} |
|
|
|