kts-component-invoice-operate 3.2.40 → 3.2.42
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 +21 -17
- package/dist/index.js +21 -17
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/fns/mergeDetails.ts +10 -7
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +1 -1
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +1 -1
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
|
-
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
2004
|
+
function checkTaxTate(_x11) {
|
|
2001
2005
|
return _checkTaxTate.apply(this, arguments);
|
|
2002
2006
|
}
|
|
2003
2007
|
/** 显示错误信息 */
|
|
@@ -10631,7 +10635,7 @@ function ItemNameInput(props) {
|
|
|
10631
10635
|
value: e.itemName
|
|
10632
10636
|
};
|
|
10633
10637
|
}),
|
|
10634
|
-
|
|
10638
|
+
onSelect: onChangeAutoComplete
|
|
10635
10639
|
}, React.createElement(Input, {
|
|
10636
10640
|
style: {
|
|
10637
10641
|
height: '100%',
|
|
@@ -16826,7 +16830,7 @@ function ItemNameInput$1(props) {
|
|
|
16826
16830
|
value: e.itemName
|
|
16827
16831
|
};
|
|
16828
16832
|
}),
|
|
16829
|
-
|
|
16833
|
+
onSelect: onChangeAutoComplete
|
|
16830
16834
|
}, React.createElement(Input$1, {
|
|
16831
16835
|
style: {
|
|
16832
16836
|
height: '100%'
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
2014
|
+
function checkTaxTate(_x11) {
|
|
2011
2015
|
return _checkTaxTate.apply(this, arguments);
|
|
2012
2016
|
}
|
|
2013
2017
|
/** 显示错误信息 */
|
|
@@ -10641,7 +10645,7 @@ function ItemNameInput(props) {
|
|
|
10641
10645
|
value: e.itemName
|
|
10642
10646
|
};
|
|
10643
10647
|
}),
|
|
10644
|
-
|
|
10648
|
+
onSelect: onChangeAutoComplete
|
|
10645
10649
|
}, React__default['default'].createElement(ktsComponentsAntdX3.Input, {
|
|
10646
10650
|
style: {
|
|
10647
10651
|
height: '100%',
|
|
@@ -16836,7 +16840,7 @@ function ItemNameInput$1(props) {
|
|
|
16836
16840
|
value: e.itemName
|
|
16837
16841
|
};
|
|
16838
16842
|
}),
|
|
16839
|
-
|
|
16843
|
+
onSelect: onChangeAutoComplete
|
|
16840
16844
|
}, React__default['default'].createElement(ktsXui.Input, {
|
|
16841
16845
|
style: {
|
|
16842
16846
|
height: '100%'
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
/** 合并金额(含税) */
|
|
@@ -99,7 +99,7 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
|
|
|
99
99
|
return (
|
|
100
100
|
<div className='kts-invoice-operate-goods-list-itemName-input'>
|
|
101
101
|
{props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
|
|
102
|
-
<AutoComplete onSearch={onSearch} value={props.value} options={options.map(e => ({ value: e.itemName }))}
|
|
102
|
+
<AutoComplete onSearch={onSearch} value={props.value} options={options.map(e => ({ value: e.itemName }))} onSelect={onChangeAutoComplete} >
|
|
103
103
|
<Input style={{ height: '100%', border: 'none' }} onChange={onChange} />
|
|
104
104
|
</AutoComplete>
|
|
105
105
|
</div>
|
|
@@ -42,7 +42,7 @@ export default function ItemNameInput(props: {
|
|
|
42
42
|
return (
|
|
43
43
|
<div className='kts-invoice-operate-goods-list-itemName-input'>
|
|
44
44
|
{props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
|
|
45
|
-
<AutoComplete onSearch={onSearch} value={props.value} options={options.map(e => ({ value: e.itemName }))}
|
|
45
|
+
<AutoComplete onSearch={onSearch} value={props.value} options={options.map(e => ({ value: e.itemName }))} onSelect={onChangeAutoComplete} >
|
|
46
46
|
<Input style={{ height: '100%' }} onChange={onChange} suffix={props.suffix} />
|
|
47
47
|
</AutoComplete>
|
|
48
48
|
</div>
|