|
|
@ -40,7 +40,9 @@ |
|
|
|
discountAmount1 = 0, |
|
|
|
beforeTaxDiffAmount = 0, |
|
|
|
taxAmountDiff = 0, |
|
|
|
rebateTax=0, |
|
|
|
rebateTax = 0, |
|
|
|
moldUntaxedAmount=0, |
|
|
|
materialsUntaxedAmount=0 |
|
|
|
} = formModel |
|
|
|
// 2、系统税额:每条数据的合同价格X可开票数量,计算结果取两位小数之后*税率的计算结果,再保留2位。所有子表数据再求和 |
|
|
|
if (formType == 'update') { |
|
|
@ -56,11 +58,29 @@ |
|
|
|
} |
|
|
|
// 2.主数据税额 mainTaxAmount = 未税金额*税率/100 保留两位小数 |
|
|
|
let mainTaxAmount = Number(beforeTaxAmount*taxRate*0.01).toFixed(2) |
|
|
|
// 4、主数据模具税额 moldTaxAmount = 累加后的模具未税金额*利率/100保留两位小数 |
|
|
|
let moldTaxAmount = Number(Number(moldUntaxedAmount) * Number(taxRate) * 0.01).toFixed(2) |
|
|
|
// 6、主数据材料税额 materialsTaxAmount = 材料未税金额*税率/100 保留两位小数 |
|
|
|
let materialsTaxAmount = Number(Number(materialsUntaxedAmount) * Number(taxRate) * 0.01).toFixed(2) |
|
|
|
// 所有明细行模具分摊单价*数量保留两位小数之后累加 |
|
|
|
let allAmount = tableData.reduce((prev, item) =>prev + Number((Number(item['allocationPrice'])*Number(item['qty'])).toFixed(2)),0).toFixed(2) |
|
|
|
|
|
|
|
formRef.value.setValues({ |
|
|
|
// 主数据税额 |
|
|
|
taxAmount:mainTaxAmount, |
|
|
|
// 主数据价税合计金额:mainAdTaxAmount =未税金额+税额 |
|
|
|
adTaxAmount:beforeTaxAmount+parseFloat(taxAmount) |
|
|
|
adTaxAmount: (beforeTaxAmount + parseFloat(taxAmount)).toFixed(2), |
|
|
|
// 主数据模具税额 |
|
|
|
moldTaxAmount:moldTaxAmount, |
|
|
|
// 主数据-模具含税金额 = 模具未税金额+模具税额 |
|
|
|
moldTaxTotal: (Number(moldUntaxedAmount) + Number(moldTaxAmount)).toFixed(2), |
|
|
|
// 主数据-材料金额 |
|
|
|
materialsTaxAmount: materialsTaxAmount, |
|
|
|
// 主数据-材料含税金额= 材料未税金额+材料税额 |
|
|
|
materialsTaxTotal: (Number(materialsUntaxedAmount) + Number(materialsTaxAmount)).toFixed(2), |
|
|
|
|
|
|
|
// 主数据模具未税尾差 allocationDifferenceBeforeTax : 模具未税金额 减去 系统明细中品番数量*模具单价 保留两位小数后汇总金额 |
|
|
|
allocationDifferenceBeforeTax: (Number(moldUntaxedAmount) - Number(allAmount)).toFixed(2), |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -72,14 +92,17 @@ |
|
|
|
let mainBeforeTaxAmount = tableData.reduce((prev, item) =>prev + Number(item['beforeTaxAmount'].toFixed(2)),0).toFixed(2) |
|
|
|
// 2、主数据税额 mainTaxAmount = 未税金额*税率/100 保留两位小数 |
|
|
|
let mainTaxAmount = Number(mainBeforeTaxAmount * taxRate * 0.01).toFixed(2) |
|
|
|
// 3、主数据模具未税金额 moldUntaxedAmount : 所有明细行模具分摊单价*数量保留两位小数之后累加 |
|
|
|
let moldUntaxedAmount = tableData.reduce((prev, item) =>prev + Number((Number(item['allocationPrice'])*Number(item['qty'])).toFixed(2)),0).toFixed(2) |
|
|
|
// 3、主数据模具未税金额 moldUntaxedAmount : 取明细行第一条数据moldUntaxedAmount |
|
|
|
let moldUntaxedAmount = tableData[0].moldUntaxedAmount |
|
|
|
// 4、主数据模具税额 moldTaxAmount = 累加后的模具未税金额*利率/100保留两位小数 |
|
|
|
let moldTaxAmount = Number(Number(moldUntaxedAmount) * Number(taxRate) * 0.01).toFixed(2) |
|
|
|
// 5、主数据材料未税金额 materialsUntaxedAmount : 所有明细行销售单价*数量保留两位小数之后累加 |
|
|
|
let materialsUntaxedAmount = tableData.reduce((prev, item) =>prev + Number((Number(item['price'])*Number(item['qty'])).toFixed(2)),0).toFixed(2) |
|
|
|
// 6、主数据材料税额 materialsTaxAmount = 材料未税金额*税率/100 保留两位小数 |
|
|
|
let materialsTaxAmount = Number(Number(materialsUntaxedAmount) * Number(taxRate) * 0.01).toFixed(2) |
|
|
|
// 所有明细行模具分摊单价*数量保留两位小数之后累加 |
|
|
|
let allAmount = tableData.reduce((prev, item) =>prev + Number((Number(item['allocationPrice'])*Number(item['qty'])).toFixed(2)),0).toFixed(2) |
|
|
|
|
|
|
|
const sumObject = { |
|
|
|
// 主数据未税金额 |
|
|
|
beforeTaxAmount:mainBeforeTaxAmount, |
|
|
@ -99,8 +122,8 @@ |
|
|
|
materialsTaxAmount: materialsTaxAmount, |
|
|
|
// 主数据-材料含税金额= 材料未税金额+材料税额 |
|
|
|
materialsTaxTotal: (Number(materialsUntaxedAmount) + Number(materialsTaxAmount)).toFixed(2), |
|
|
|
// 主数据模具未税尾差 allocationDifferenceBeforeTax : 所有明细行未税金额保留两位小数的总和 (mainBeforeTaxAmount) 减去 系统明细中品番数量*模具单价 保留两位小数(moldUntaxedAmount)后汇总金额 |
|
|
|
allocationDifferenceBeforeTax: (Number(mainBeforeTaxAmount) - Number(moldUntaxedAmount)).toFixed(2), |
|
|
|
// 主数据模具未税尾差 allocationDifferenceBeforeTax : 模具未税金额 减去 系统明细中品番数量*模具单价 保留两位小数后汇总金额 |
|
|
|
allocationDifferenceBeforeTax: (Number(moldUntaxedAmount) - Number(allAmount)).toFixed(2), |
|
|
|
} |
|
|
|
formRef.value.setValues(sumObject) |
|
|
|
} |
|
|
|