kts-component-invoice-operate 3.2.40 → 3.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1776,12 +1776,12 @@ function _mergeDetails() {
1776
1776
  case 20:
1777
1777
  sum.lineAmountIncludeTax = _context.sent;
1778
1778
  _context.next = 23;
1779
- return calculatePriceExcludeTax(sum);
1779
+ return calculatePriceExcludeTax(sum, state.calculatingDigits);
1780
1780
 
1781
1781
  case 23:
1782
1782
  sum.priceExcludeTax = _context.sent;
1783
1783
  _context.next = 26;
1784
- return calculatePriceIncludeTax(sum);
1784
+ return calculatePriceIncludeTax(sum, state.calculatingDigits);
1785
1785
 
1786
1786
  case 26:
1787
1787
  sum.priceIncludeTax = _context.sent;
@@ -1815,14 +1815,15 @@ function _mergeDetails() {
1815
1815
  return _mergeDetails.apply(this, arguments);
1816
1816
  }
1817
1817
 
1818
- function calculatePriceIncludeTax(_x2) {
1818
+ function calculatePriceIncludeTax(_x2, _x3) {
1819
1819
  return _calculatePriceIncludeTax.apply(this, arguments);
1820
1820
  }
1821
1821
  /** 计算单价(不含税) */
1822
1822
 
1823
1823
 
1824
1824
  function _calculatePriceIncludeTax() {
1825
- _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum) {
1825
+ _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum, calculatingDigits) {
1826
+ var value;
1826
1827
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1827
1828
  while (1) {
1828
1829
  switch (_context2.prev = _context2.next) {
@@ -1835,9 +1836,10 @@ function _calculatePriceIncludeTax() {
1835
1836
  return _context2.abrupt("return", undefined);
1836
1837
 
1837
1838
  case 2:
1838
- return _context2.abrupt("return", chain$1(bignumber(sum.lineAmountIncludeTax)).divide(bignumber(sum.quantity)).done().toNumber());
1839
+ value = chain$1(bignumber(sum.lineAmountIncludeTax)).divide(bignumber(sum.quantity)).done().toNumber();
1840
+ return _context2.abrupt("return", format15(value, calculatingDigits) || undefined);
1839
1841
 
1840
- case 3:
1842
+ case 4:
1841
1843
  case "end":
1842
1844
  return _context2.stop();
1843
1845
  }
@@ -1847,14 +1849,15 @@ function _calculatePriceIncludeTax() {
1847
1849
  return _calculatePriceIncludeTax.apply(this, arguments);
1848
1850
  }
1849
1851
 
1850
- function calculatePriceExcludeTax(_x3) {
1852
+ function calculatePriceExcludeTax(_x4, _x5) {
1851
1853
  return _calculatePriceExcludeTax.apply(this, arguments);
1852
1854
  }
1853
1855
  /** 合并金额(含税) */
1854
1856
 
1855
1857
 
1856
1858
  function _calculatePriceExcludeTax() {
1857
- _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum) {
1859
+ _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum, calculatingDigits) {
1860
+ var value;
1858
1861
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1859
1862
  while (1) {
1860
1863
  switch (_context3.prev = _context3.next) {
@@ -1867,9 +1870,10 @@ function _calculatePriceExcludeTax() {
1867
1870
  return _context3.abrupt("return", undefined);
1868
1871
 
1869
1872
  case 2:
1870
- return _context3.abrupt("return", chain$1(bignumber(sum.lineAmountExcludeTax)).divide(bignumber(sum.quantity)).done().toNumber());
1873
+ value = format15(chain$1(bignumber(sum.lineAmountExcludeTax)).divide(bignumber(sum.quantity)).done().toNumber());
1874
+ return _context3.abrupt("return", format15(value, calculatingDigits) || undefined);
1871
1875
 
1872
- case 3:
1876
+ case 5:
1873
1877
  case "end":
1874
1878
  return _context3.stop();
1875
1879
  }
@@ -1879,7 +1883,7 @@ function _calculatePriceExcludeTax() {
1879
1883
  return _calculatePriceExcludeTax.apply(this, arguments);
1880
1884
  }
1881
1885
 
1882
- function mergeLineAmountIncludeTax(_x4) {
1886
+ function mergeLineAmountIncludeTax(_x6) {
1883
1887
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1884
1888
  }
1885
1889
  /** 合并金额(不含税) */
@@ -1908,7 +1912,7 @@ function _mergeLineAmountIncludeTax() {
1908
1912
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1909
1913
  }
1910
1914
 
1911
- function mergeLineAmountExcludeTax(_x5) {
1915
+ function mergeLineAmountExcludeTax(_x7) {
1912
1916
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1913
1917
  }
1914
1918
  /** 合并数量 */
@@ -1937,7 +1941,7 @@ function _mergeLineAmountExcludeTax() {
1937
1941
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1938
1942
  }
1939
1943
 
1940
- function mergeQuantity(_x6) {
1944
+ function mergeQuantity(_x8) {
1941
1945
  return _mergeQuantity.apply(this, arguments);
1942
1946
  }
1943
1947
  /** 填充行明细信息 */
@@ -1966,7 +1970,7 @@ function _mergeQuantity() {
1966
1970
  return _mergeQuantity.apply(this, arguments);
1967
1971
  }
1968
1972
 
1969
- function fillingInformationGood(_x7, _x8) {
1973
+ function fillingInformationGood(_x9, _x10) {
1970
1974
  return _fillingInformationGood.apply(this, arguments);
1971
1975
  }
1972
1976
  /** 存在税率不一样的明细,不能合并 */
@@ -1997,7 +2001,7 @@ function _fillingInformationGood() {
1997
2001
  return _fillingInformationGood.apply(this, arguments);
1998
2002
  }
1999
2003
 
2000
- function checkTaxTate(_x9) {
2004
+ function checkTaxTate(_x11) {
2001
2005
  return _checkTaxTate.apply(this, arguments);
2002
2006
  }
2003
2007
  /** 显示错误信息 */
package/dist/index.js CHANGED
@@ -1786,12 +1786,12 @@ function _mergeDetails() {
1786
1786
  case 20:
1787
1787
  sum.lineAmountIncludeTax = _context.sent;
1788
1788
  _context.next = 23;
1789
- return calculatePriceExcludeTax(sum);
1789
+ return calculatePriceExcludeTax(sum, state.calculatingDigits);
1790
1790
 
1791
1791
  case 23:
1792
1792
  sum.priceExcludeTax = _context.sent;
1793
1793
  _context.next = 26;
1794
- return calculatePriceIncludeTax(sum);
1794
+ return calculatePriceIncludeTax(sum, state.calculatingDigits);
1795
1795
 
1796
1796
  case 26:
1797
1797
  sum.priceIncludeTax = _context.sent;
@@ -1825,14 +1825,15 @@ function _mergeDetails() {
1825
1825
  return _mergeDetails.apply(this, arguments);
1826
1826
  }
1827
1827
 
1828
- function calculatePriceIncludeTax(_x2) {
1828
+ function calculatePriceIncludeTax(_x2, _x3) {
1829
1829
  return _calculatePriceIncludeTax.apply(this, arguments);
1830
1830
  }
1831
1831
  /** 计算单价(不含税) */
1832
1832
 
1833
1833
 
1834
1834
  function _calculatePriceIncludeTax() {
1835
- _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum) {
1835
+ _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum, calculatingDigits) {
1836
+ var value;
1836
1837
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1837
1838
  while (1) {
1838
1839
  switch (_context2.prev = _context2.next) {
@@ -1845,9 +1846,10 @@ function _calculatePriceIncludeTax() {
1845
1846
  return _context2.abrupt("return", undefined);
1846
1847
 
1847
1848
  case 2:
1848
- return _context2.abrupt("return", mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).divide(mathjs.bignumber(sum.quantity)).done().toNumber());
1849
+ value = mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).divide(mathjs.bignumber(sum.quantity)).done().toNumber();
1850
+ return _context2.abrupt("return", format15(value, calculatingDigits) || undefined);
1849
1851
 
1850
- case 3:
1852
+ case 4:
1851
1853
  case "end":
1852
1854
  return _context2.stop();
1853
1855
  }
@@ -1857,14 +1859,15 @@ function _calculatePriceIncludeTax() {
1857
1859
  return _calculatePriceIncludeTax.apply(this, arguments);
1858
1860
  }
1859
1861
 
1860
- function calculatePriceExcludeTax(_x3) {
1862
+ function calculatePriceExcludeTax(_x4, _x5) {
1861
1863
  return _calculatePriceExcludeTax.apply(this, arguments);
1862
1864
  }
1863
1865
  /** 合并金额(含税) */
1864
1866
 
1865
1867
 
1866
1868
  function _calculatePriceExcludeTax() {
1867
- _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum) {
1869
+ _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum, calculatingDigits) {
1870
+ var value;
1868
1871
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1869
1872
  while (1) {
1870
1873
  switch (_context3.prev = _context3.next) {
@@ -1877,9 +1880,10 @@ function _calculatePriceExcludeTax() {
1877
1880
  return _context3.abrupt("return", undefined);
1878
1881
 
1879
1882
  case 2:
1880
- return _context3.abrupt("return", mathjs.chain(mathjs.bignumber(sum.lineAmountExcludeTax)).divide(mathjs.bignumber(sum.quantity)).done().toNumber());
1883
+ value = format15(mathjs.chain(mathjs.bignumber(sum.lineAmountExcludeTax)).divide(mathjs.bignumber(sum.quantity)).done().toNumber());
1884
+ return _context3.abrupt("return", format15(value, calculatingDigits) || undefined);
1881
1885
 
1882
- case 3:
1886
+ case 5:
1883
1887
  case "end":
1884
1888
  return _context3.stop();
1885
1889
  }
@@ -1889,7 +1893,7 @@ function _calculatePriceExcludeTax() {
1889
1893
  return _calculatePriceExcludeTax.apply(this, arguments);
1890
1894
  }
1891
1895
 
1892
- function mergeLineAmountIncludeTax(_x4) {
1896
+ function mergeLineAmountIncludeTax(_x6) {
1893
1897
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1894
1898
  }
1895
1899
  /** 合并金额(不含税) */
@@ -1918,7 +1922,7 @@ function _mergeLineAmountIncludeTax() {
1918
1922
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1919
1923
  }
1920
1924
 
1921
- function mergeLineAmountExcludeTax(_x5) {
1925
+ function mergeLineAmountExcludeTax(_x7) {
1922
1926
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1923
1927
  }
1924
1928
  /** 合并数量 */
@@ -1947,7 +1951,7 @@ function _mergeLineAmountExcludeTax() {
1947
1951
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1948
1952
  }
1949
1953
 
1950
- function mergeQuantity(_x6) {
1954
+ function mergeQuantity(_x8) {
1951
1955
  return _mergeQuantity.apply(this, arguments);
1952
1956
  }
1953
1957
  /** 填充行明细信息 */
@@ -1976,7 +1980,7 @@ function _mergeQuantity() {
1976
1980
  return _mergeQuantity.apply(this, arguments);
1977
1981
  }
1978
1982
 
1979
- function fillingInformationGood(_x7, _x8) {
1983
+ function fillingInformationGood(_x9, _x10) {
1980
1984
  return _fillingInformationGood.apply(this, arguments);
1981
1985
  }
1982
1986
  /** 存在税率不一样的明细,不能合并 */
@@ -2007,7 +2011,7 @@ function _fillingInformationGood() {
2007
2011
  return _fillingInformationGood.apply(this, arguments);
2008
2012
  }
2009
2013
 
2010
- function checkTaxTate(_x9) {
2014
+ function checkTaxTate(_x11) {
2011
2015
  return _checkTaxTate.apply(this, arguments);
2012
2016
  }
2013
2017
  /** 显示错误信息 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.40",
3
+ "version": "3.2.41",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -3,6 +3,7 @@ import { message } from 'kts-xui';
3
3
  import { chain, bignumber } from 'mathjs';
4
4
  import idGenerator from '../../tools/idGenerator';
5
5
  import { IGood, InvoiceControllerState, LineAttributeType } from '..';
6
+ import { format15 } from '../../tools/calculate';
6
7
 
7
8
  export default async function mergeDetails(state: InvoiceControllerState) {
8
9
  if (state.goodsListState.editGood) return;
@@ -31,14 +32,14 @@ export default async function mergeDetails(state: InvoiceControllerState) {
31
32
  sum.lineAmountIncludeTax = await mergeLineAmountIncludeTax(goodsList);
32
33
 
33
34
  // 计算单价(不含税)
34
- sum.priceExcludeTax = await calculatePriceExcludeTax(sum);
35
+ sum.priceExcludeTax = await calculatePriceExcludeTax(sum, state.calculatingDigits);
35
36
 
36
37
  // 计算单价(含税)
37
- sum.priceIncludeTax = await calculatePriceIncludeTax(sum);
38
+ sum.priceIncludeTax = await calculatePriceIncludeTax(sum, state.calculatingDigits);
38
39
 
39
40
  // 计算税额
40
41
  sum.taxAmount = chain(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber()
41
-
42
+
42
43
  const p = state.goodsListState.goodsList.indexOf(goodsList[0]);
43
44
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(e => state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0);
44
45
  state.goodsListState.goodsList.splice(p, 0, sum);
@@ -51,15 +52,17 @@ export default async function mergeDetails(state: InvoiceControllerState) {
51
52
  }
52
53
 
53
54
  /** 计算单价(含税) */
54
- async function calculatePriceIncludeTax(sum: IGood) {
55
+ async function calculatePriceIncludeTax(sum: IGood, calculatingDigits?: number) {
55
56
  if (!sum.quantity) return undefined;
56
- return chain(bignumber(sum.lineAmountIncludeTax)).divide(bignumber(sum.quantity)).done().toNumber();
57
+ const value = chain(bignumber(sum.lineAmountIncludeTax)).divide(bignumber(sum.quantity)).done().toNumber()
58
+ return format15(value, calculatingDigits) || undefined;
57
59
  }
58
60
 
59
61
  /** 计算单价(不含税) */
60
- async function calculatePriceExcludeTax(sum: IGood) {
62
+ async function calculatePriceExcludeTax(sum: IGood, calculatingDigits?: number) {
61
63
  if (!sum.quantity) return undefined;
62
- return chain(bignumber(sum.lineAmountExcludeTax)).divide(bignumber(sum.quantity)).done().toNumber();
64
+ const value = format15(chain(bignumber(sum.lineAmountExcludeTax)).divide(bignumber(sum.quantity)).done().toNumber());
65
+ return format15(value, calculatingDigits) || undefined;;
63
66
  }
64
67
 
65
68
  /** 合并金额(含税) */