| | |
| | | }); |
| | | return sums; |
| | | }; |
| | | // 不含税总价计算 |
| | | const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => { |
| | | // 不含税总价计算,decimals 为保留小数位数(销售/采购相关页面传 6) |
| | | const calculateTaxExclusiveTotalPrice = ( |
| | | taxInclusiveTotalPrice, |
| | | taxRate, |
| | | decimals = 2 |
| | | ) => { |
| | | const taxRateDecimal = taxRate / 100; |
| | | return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2); |
| | | return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(decimals); |
| | | }; |
| | | // 含税总价计算 |
| | | const calculateTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => { |
| | | return (taxInclusiveUnitPrice * quantity).toFixed(2); |
| | | // 含税总价计算,decimals 为保留小数位数(销售/采购相关页面传 6) |
| | | const calculateTaxIncludeTotalPrice = ( |
| | | taxInclusiveUnitPrice, |
| | | quantity, |
| | | decimals = 2 |
| | | ) => { |
| | | return (taxInclusiveUnitPrice * quantity).toFixed(decimals); |
| | | }; |
| | | // 导出函数供其他文件使用 |
| | | export { |