kts-component-invoice-operate 3.2.39 → 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;
@@ -1797,16 +1797,15 @@ function _mergeDetails() {
1797
1797
  state.goodsListState.goodsMap.set(e.$index, e);
1798
1798
  });
1799
1799
  state.goodsListState.selectedGoodIndex = [];
1800
- _context.next = 40;
1800
+ _context.next = 39;
1801
1801
  break;
1802
1802
 
1803
1803
  case 36:
1804
1804
  _context.prev = 36;
1805
1805
  _context.t0 = _context["catch"](5);
1806
- debugger;
1807
1806
  showError(_context.t0);
1808
1807
 
1809
- case 40:
1808
+ case 39:
1810
1809
  case "end":
1811
1810
  return _context.stop();
1812
1811
  }
@@ -1816,14 +1815,15 @@ function _mergeDetails() {
1816
1815
  return _mergeDetails.apply(this, arguments);
1817
1816
  }
1818
1817
 
1819
- function calculatePriceIncludeTax(_x2) {
1818
+ function calculatePriceIncludeTax(_x2, _x3) {
1820
1819
  return _calculatePriceIncludeTax.apply(this, arguments);
1821
1820
  }
1822
1821
  /** 计算单价(不含税) */
1823
1822
 
1824
1823
 
1825
1824
  function _calculatePriceIncludeTax() {
1826
- _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum) {
1825
+ _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum, calculatingDigits) {
1826
+ var value;
1827
1827
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1828
1828
  while (1) {
1829
1829
  switch (_context2.prev = _context2.next) {
@@ -1836,9 +1836,10 @@ function _calculatePriceIncludeTax() {
1836
1836
  return _context2.abrupt("return", undefined);
1837
1837
 
1838
1838
  case 2:
1839
- 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);
1840
1841
 
1841
- case 3:
1842
+ case 4:
1842
1843
  case "end":
1843
1844
  return _context2.stop();
1844
1845
  }
@@ -1848,14 +1849,15 @@ function _calculatePriceIncludeTax() {
1848
1849
  return _calculatePriceIncludeTax.apply(this, arguments);
1849
1850
  }
1850
1851
 
1851
- function calculatePriceExcludeTax(_x3) {
1852
+ function calculatePriceExcludeTax(_x4, _x5) {
1852
1853
  return _calculatePriceExcludeTax.apply(this, arguments);
1853
1854
  }
1854
1855
  /** 合并金额(含税) */
1855
1856
 
1856
1857
 
1857
1858
  function _calculatePriceExcludeTax() {
1858
- _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum) {
1859
+ _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum, calculatingDigits) {
1860
+ var value;
1859
1861
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1860
1862
  while (1) {
1861
1863
  switch (_context3.prev = _context3.next) {
@@ -1868,9 +1870,10 @@ function _calculatePriceExcludeTax() {
1868
1870
  return _context3.abrupt("return", undefined);
1869
1871
 
1870
1872
  case 2:
1871
- 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);
1872
1875
 
1873
- case 3:
1876
+ case 5:
1874
1877
  case "end":
1875
1878
  return _context3.stop();
1876
1879
  }
@@ -1880,7 +1883,7 @@ function _calculatePriceExcludeTax() {
1880
1883
  return _calculatePriceExcludeTax.apply(this, arguments);
1881
1884
  }
1882
1885
 
1883
- function mergeLineAmountIncludeTax(_x4) {
1886
+ function mergeLineAmountIncludeTax(_x6) {
1884
1887
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1885
1888
  }
1886
1889
  /** 合并金额(不含税) */
@@ -1909,7 +1912,7 @@ function _mergeLineAmountIncludeTax() {
1909
1912
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1910
1913
  }
1911
1914
 
1912
- function mergeLineAmountExcludeTax(_x5) {
1915
+ function mergeLineAmountExcludeTax(_x7) {
1913
1916
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1914
1917
  }
1915
1918
  /** 合并数量 */
@@ -1938,7 +1941,7 @@ function _mergeLineAmountExcludeTax() {
1938
1941
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1939
1942
  }
1940
1943
 
1941
- function mergeQuantity(_x6) {
1944
+ function mergeQuantity(_x8) {
1942
1945
  return _mergeQuantity.apply(this, arguments);
1943
1946
  }
1944
1947
  /** 填充行明细信息 */
@@ -1967,7 +1970,7 @@ function _mergeQuantity() {
1967
1970
  return _mergeQuantity.apply(this, arguments);
1968
1971
  }
1969
1972
 
1970
- function fillingInformationGood(_x7, _x8) {
1973
+ function fillingInformationGood(_x9, _x10) {
1971
1974
  return _fillingInformationGood.apply(this, arguments);
1972
1975
  }
1973
1976
  /** 存在税率不一样的明细,不能合并 */
@@ -1998,7 +2001,7 @@ function _fillingInformationGood() {
1998
2001
  return _fillingInformationGood.apply(this, arguments);
1999
2002
  }
2000
2003
 
2001
- function checkTaxTate(_x9) {
2004
+ function checkTaxTate(_x11) {
2002
2005
  return _checkTaxTate.apply(this, arguments);
2003
2006
  }
2004
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;
@@ -1807,16 +1807,15 @@ function _mergeDetails() {
1807
1807
  state.goodsListState.goodsMap.set(e.$index, e);
1808
1808
  });
1809
1809
  state.goodsListState.selectedGoodIndex = [];
1810
- _context.next = 40;
1810
+ _context.next = 39;
1811
1811
  break;
1812
1812
 
1813
1813
  case 36:
1814
1814
  _context.prev = 36;
1815
1815
  _context.t0 = _context["catch"](5);
1816
- debugger;
1817
1816
  showError(_context.t0);
1818
1817
 
1819
- case 40:
1818
+ case 39:
1820
1819
  case "end":
1821
1820
  return _context.stop();
1822
1821
  }
@@ -1826,14 +1825,15 @@ function _mergeDetails() {
1826
1825
  return _mergeDetails.apply(this, arguments);
1827
1826
  }
1828
1827
 
1829
- function calculatePriceIncludeTax(_x2) {
1828
+ function calculatePriceIncludeTax(_x2, _x3) {
1830
1829
  return _calculatePriceIncludeTax.apply(this, arguments);
1831
1830
  }
1832
1831
  /** 计算单价(不含税) */
1833
1832
 
1834
1833
 
1835
1834
  function _calculatePriceIncludeTax() {
1836
- _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum) {
1835
+ _calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sum, calculatingDigits) {
1836
+ var value;
1837
1837
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1838
1838
  while (1) {
1839
1839
  switch (_context2.prev = _context2.next) {
@@ -1846,9 +1846,10 @@ function _calculatePriceIncludeTax() {
1846
1846
  return _context2.abrupt("return", undefined);
1847
1847
 
1848
1848
  case 2:
1849
- 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);
1850
1851
 
1851
- case 3:
1852
+ case 4:
1852
1853
  case "end":
1853
1854
  return _context2.stop();
1854
1855
  }
@@ -1858,14 +1859,15 @@ function _calculatePriceIncludeTax() {
1858
1859
  return _calculatePriceIncludeTax.apply(this, arguments);
1859
1860
  }
1860
1861
 
1861
- function calculatePriceExcludeTax(_x3) {
1862
+ function calculatePriceExcludeTax(_x4, _x5) {
1862
1863
  return _calculatePriceExcludeTax.apply(this, arguments);
1863
1864
  }
1864
1865
  /** 合并金额(含税) */
1865
1866
 
1866
1867
 
1867
1868
  function _calculatePriceExcludeTax() {
1868
- _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum) {
1869
+ _calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum, calculatingDigits) {
1870
+ var value;
1869
1871
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1870
1872
  while (1) {
1871
1873
  switch (_context3.prev = _context3.next) {
@@ -1878,9 +1880,10 @@ function _calculatePriceExcludeTax() {
1878
1880
  return _context3.abrupt("return", undefined);
1879
1881
 
1880
1882
  case 2:
1881
- 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);
1882
1885
 
1883
- case 3:
1886
+ case 5:
1884
1887
  case "end":
1885
1888
  return _context3.stop();
1886
1889
  }
@@ -1890,7 +1893,7 @@ function _calculatePriceExcludeTax() {
1890
1893
  return _calculatePriceExcludeTax.apply(this, arguments);
1891
1894
  }
1892
1895
 
1893
- function mergeLineAmountIncludeTax(_x4) {
1896
+ function mergeLineAmountIncludeTax(_x6) {
1894
1897
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1895
1898
  }
1896
1899
  /** 合并金额(不含税) */
@@ -1919,7 +1922,7 @@ function _mergeLineAmountIncludeTax() {
1919
1922
  return _mergeLineAmountIncludeTax.apply(this, arguments);
1920
1923
  }
1921
1924
 
1922
- function mergeLineAmountExcludeTax(_x5) {
1925
+ function mergeLineAmountExcludeTax(_x7) {
1923
1926
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1924
1927
  }
1925
1928
  /** 合并数量 */
@@ -1948,7 +1951,7 @@ function _mergeLineAmountExcludeTax() {
1948
1951
  return _mergeLineAmountExcludeTax.apply(this, arguments);
1949
1952
  }
1950
1953
 
1951
- function mergeQuantity(_x6) {
1954
+ function mergeQuantity(_x8) {
1952
1955
  return _mergeQuantity.apply(this, arguments);
1953
1956
  }
1954
1957
  /** 填充行明细信息 */
@@ -1977,7 +1980,7 @@ function _mergeQuantity() {
1977
1980
  return _mergeQuantity.apply(this, arguments);
1978
1981
  }
1979
1982
 
1980
- function fillingInformationGood(_x7, _x8) {
1983
+ function fillingInformationGood(_x9, _x10) {
1981
1984
  return _fillingInformationGood.apply(this, arguments);
1982
1985
  }
1983
1986
  /** 存在税率不一样的明细,不能合并 */
@@ -2008,7 +2011,7 @@ function _fillingInformationGood() {
2008
2011
  return _fillingInformationGood.apply(this, arguments);
2009
2012
  }
2010
2013
 
2011
- function checkTaxTate(_x9) {
2014
+ function checkTaxTate(_x11) {
2012
2015
  return _checkTaxTate.apply(this, arguments);
2013
2016
  }
2014
2017
  /** 显示错误信息 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.39",
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);
@@ -46,21 +47,22 @@ export default async function mergeDetails(state: InvoiceControllerState) {
46
47
  state.goodsListState.goodsList.forEach(e => { state.goodsListState.goodsMap.set(e.$index, e) });
47
48
  state.goodsListState.selectedGoodIndex = [];
48
49
  } catch (error: any) {
49
- debugger;
50
50
  showError(error)
51
51
  }
52
52
  }
53
53
 
54
54
  /** 计算单价(含税) */
55
- async function calculatePriceIncludeTax(sum: IGood) {
55
+ async function calculatePriceIncludeTax(sum: IGood, calculatingDigits?: number) {
56
56
  if (!sum.quantity) return undefined;
57
- 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;
58
59
  }
59
60
 
60
61
  /** 计算单价(不含税) */
61
- async function calculatePriceExcludeTax(sum: IGood) {
62
+ async function calculatePriceExcludeTax(sum: IGood, calculatingDigits?: number) {
62
63
  if (!sum.quantity) return undefined;
63
- 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;;
64
66
  }
65
67
 
66
68
  /** 合并金额(含税) */