kts-component-invoice-operate 3.0.17 → 3.0.19

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.
@@ -41,6 +41,12 @@ export default class GoodsListState {
41
41
  goodsMap: Map<string, IGood>;
42
42
  /** 货物菜单扩展 */
43
43
  goodsMenuExpand: ((index: string, controller: InvoiceController) => React.ReactNode)[];
44
+ /** 金额含税(受控,输入后不再自动计算) */
45
+ amountIncludeTax?: number;
46
+ /** 金额不含税(受控,输入后不再自动计算) */
47
+ amountExcludeTax?: number;
48
+ /** 税额(受控,输入后不再自动计算) */
49
+ amountTax?: number;
44
50
  /** 列表选中的货物索引列表 */
45
51
  selectedGoodIndex: string[];
46
52
  /** 准备添加折扣的货物索引列表 */
package/dist/index.esm.js CHANGED
@@ -1001,6 +1001,9 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1001
1001
  this.goodsList = [];
1002
1002
  this.goodsMap = new Map();
1003
1003
  this.goodsMenuExpand = [];
1004
+ this.amountIncludeTax = void 0;
1005
+ this.amountExcludeTax = void 0;
1006
+ this.amountTax = void 0;
1004
1007
  this.selectedGoodIndex = [];
1005
1008
  this.discountGoodIndex = [];
1006
1009
  this.endowCode = new EndowCode();
@@ -1948,6 +1951,10 @@ var Statistics = (function () {
1948
1951
  var lineAmountIncludeTax = controller.useMemo(function (s) {
1949
1952
  var _s$goodsListState$for, _s$goodsListState$for2;
1950
1953
 
1954
+ if (typeof s.goodsListState.amountIncludeTax === 'number') {
1955
+ return s.goodsListState.amountIncludeTax;
1956
+ }
1957
+
1951
1958
  var sum = chain$1(bignumber(0));
1952
1959
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1953
1960
 
@@ -1968,6 +1975,10 @@ var Statistics = (function () {
1968
1975
  var lineAmountExcludeTax = controller.useMemo(function (s) {
1969
1976
  var _s$goodsListState$for3, _s$goodsListState$for4;
1970
1977
 
1978
+ if (typeof s.goodsListState.amountExcludeTax === 'number') {
1979
+ return s.goodsListState.amountExcludeTax;
1980
+ }
1981
+
1971
1982
  var sum = chain$1(bignumber(0));
1972
1983
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1973
1984
 
@@ -1986,6 +1997,10 @@ var Statistics = (function () {
1986
1997
  /** 税额 */
1987
1998
 
1988
1999
  var taxAmount = controller.useMemo(function (s) {
2000
+ if (typeof s.goodsListState.taxRateList === 'number') {
2001
+ return s.goodsListState.taxRateList;
2002
+ }
2003
+
1989
2004
  var sum = chain$1(bignumber(0));
1990
2005
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1991
2006
 
@@ -13374,9 +13389,7 @@ var DrawerBody$3 = function DrawerBody(props) {
13374
13389
  endowCodeGood.forEach(function (good) {
13375
13390
  if (!good) return;
13376
13391
  good.itemName = setShorthand(good.itemName, values.shorthand);
13377
- good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand); // const name = getItemName(good.itemName, values.shorthand);
13378
- // good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
13379
-
13392
+ good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
13380
13393
  good.taxClassificationCode = values.taxClassificationCode;
13381
13394
  good.taxRate = values.taxRate;
13382
13395
  good.taxFreeType = values.taxFreeType;
@@ -13387,41 +13400,9 @@ var DrawerBody$3 = function DrawerBody(props) {
13387
13400
  var lineAmountExcludeTax = chain$1(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
13388
13401
  var priceExcludeTax = good.priceIncludeTax ? chain$1(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
13389
13402
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
13390
- good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined; // if (s.goodsListState.isTaxIncluded) {
13391
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
13392
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
13393
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
13394
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
13395
- // } else {
13396
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
13397
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
13398
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
13399
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
13400
- // }
13401
-
13403
+ good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
13402
13404
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
13403
- }); //截取名称
13404
- // if (endowCodeGood.some(e => bytesLnegth(e?.itemName || '') > 92)) {
13405
- // await (() => new Promise<void>(resolve => {
13406
- // confirm({
13407
- // title: '温馨提示',
13408
- // content: '商品名称长度过长,是否截取名称',
13409
- // okText: '确定',
13410
- // cancelText: '取消',
13411
- // onOk() {
13412
- // endowCodeGood.forEach(e => {
13413
- // if (e && e.itemName) { e.itemName = cutStr(e.itemName, 91) }
13414
- // })
13415
- // message.success('商品名称截取成功!')
13416
- // resolve()
13417
- // },
13418
- // onCancel() {
13419
- // resolve()
13420
- // },
13421
- // });
13422
- // }))()
13423
- // }
13424
-
13405
+ });
13425
13406
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
13426
13407
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
13427
13408
 
package/dist/index.js CHANGED
@@ -1011,6 +1011,9 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1011
1011
  this.goodsList = [];
1012
1012
  this.goodsMap = new Map();
1013
1013
  this.goodsMenuExpand = [];
1014
+ this.amountIncludeTax = void 0;
1015
+ this.amountExcludeTax = void 0;
1016
+ this.amountTax = void 0;
1014
1017
  this.selectedGoodIndex = [];
1015
1018
  this.discountGoodIndex = [];
1016
1019
  this.endowCode = new EndowCode();
@@ -1958,6 +1961,10 @@ var Statistics = (function () {
1958
1961
  var lineAmountIncludeTax = controller.useMemo(function (s) {
1959
1962
  var _s$goodsListState$for, _s$goodsListState$for2;
1960
1963
 
1964
+ if (typeof s.goodsListState.amountIncludeTax === 'number') {
1965
+ return s.goodsListState.amountIncludeTax;
1966
+ }
1967
+
1961
1968
  var sum = mathjs.chain(mathjs.bignumber(0));
1962
1969
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1963
1970
 
@@ -1978,6 +1985,10 @@ var Statistics = (function () {
1978
1985
  var lineAmountExcludeTax = controller.useMemo(function (s) {
1979
1986
  var _s$goodsListState$for3, _s$goodsListState$for4;
1980
1987
 
1988
+ if (typeof s.goodsListState.amountExcludeTax === 'number') {
1989
+ return s.goodsListState.amountExcludeTax;
1990
+ }
1991
+
1981
1992
  var sum = mathjs.chain(mathjs.bignumber(0));
1982
1993
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1983
1994
 
@@ -1996,6 +2007,10 @@ var Statistics = (function () {
1996
2007
  /** 税额 */
1997
2008
 
1998
2009
  var taxAmount = controller.useMemo(function (s) {
2010
+ if (typeof s.goodsListState.taxRateList === 'number') {
2011
+ return s.goodsListState.taxRateList;
2012
+ }
2013
+
1999
2014
  var sum = mathjs.chain(mathjs.bignumber(0));
2000
2015
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
2001
2016
 
@@ -13384,9 +13399,7 @@ var DrawerBody$3 = function DrawerBody(props) {
13384
13399
  endowCodeGood.forEach(function (good) {
13385
13400
  if (!good) return;
13386
13401
  good.itemName = setShorthand(good.itemName, values.shorthand);
13387
- good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand); // const name = getItemName(good.itemName, values.shorthand);
13388
- // good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
13389
-
13402
+ good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
13390
13403
  good.taxClassificationCode = values.taxClassificationCode;
13391
13404
  good.taxRate = values.taxRate;
13392
13405
  good.taxFreeType = values.taxFreeType;
@@ -13397,41 +13410,9 @@ var DrawerBody$3 = function DrawerBody(props) {
13397
13410
  var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
13398
13411
  var priceExcludeTax = good.priceIncludeTax ? mathjs.chain(mathjs.bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
13399
13412
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
13400
- good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined; // if (s.goodsListState.isTaxIncluded) {
13401
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
13402
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
13403
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
13404
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
13405
- // } else {
13406
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
13407
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
13408
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
13409
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
13410
- // }
13411
-
13413
+ good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
13412
13414
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
13413
- }); //截取名称
13414
- // if (endowCodeGood.some(e => bytesLnegth(e?.itemName || '') > 92)) {
13415
- // await (() => new Promise<void>(resolve => {
13416
- // confirm({
13417
- // title: '温馨提示',
13418
- // content: '商品名称长度过长,是否截取名称',
13419
- // okText: '确定',
13420
- // cancelText: '取消',
13421
- // onOk() {
13422
- // endowCodeGood.forEach(e => {
13423
- // if (e && e.itemName) { e.itemName = cutStr(e.itemName, 91) }
13424
- // })
13425
- // message.success('商品名称截取成功!')
13426
- // resolve()
13427
- // },
13428
- // onCancel() {
13429
- // resolve()
13430
- // },
13431
- // });
13432
- // }))()
13433
- // }
13434
-
13415
+ });
13435
13416
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
13436
13417
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
13437
13418
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.17",
3
+ "version": "3.0.19",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -56,6 +56,15 @@ export default class GoodsListState {
56
56
  /** 货物菜单扩展 */
57
57
  goodsMenuExpand: ((index: string, controller: InvoiceController) => React.ReactNode)[] = [];
58
58
 
59
+ /** 金额含税(受控,输入后不再自动计算) */
60
+ amountIncludeTax?: number;
61
+
62
+ /** 金额不含税(受控,输入后不再自动计算) */
63
+ amountExcludeTax?: number;
64
+
65
+ /** 税额(受控,输入后不再自动计算) */
66
+ amountTax?: number;
67
+
59
68
  /** 列表选中的货物索引列表 */
60
69
  selectedGoodIndex: string[] = [];
61
70
 
@@ -293,9 +293,6 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
293
293
  good.itemName = setShorthand(good.itemName, values.shorthand);
294
294
  good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
295
295
 
296
- // const name = getItemName(good.itemName, values.shorthand);
297
- // good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
298
-
299
296
  good.taxClassificationCode = values.taxClassificationCode;
300
297
  good.taxRate = values.taxRate;
301
298
  good.taxFreeType = values.taxFreeType;
@@ -311,45 +308,9 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
311
308
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
312
309
  good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
313
310
 
314
- // if (s.goodsListState.isTaxIncluded) {
315
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
316
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
317
-
318
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
319
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
320
- // } else {
321
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
322
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
323
-
324
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
325
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
326
- // }
327
-
328
311
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
329
312
  });
330
313
 
331
- //截取名称
332
- // if (endowCodeGood.some(e => bytesLnegth(e?.itemName || '') > 92)) {
333
- // await (() => new Promise<void>(resolve => {
334
- // confirm({
335
- // title: '温馨提示',
336
- // content: '商品名称长度过长,是否截取名称',
337
- // okText: '确定',
338
- // cancelText: '取消',
339
- // onOk() {
340
- // endowCodeGood.forEach(e => {
341
- // if (e && e.itemName) { e.itemName = cutStr(e.itemName, 91) }
342
- // })
343
- // message.success('商品名称截取成功!')
344
- // resolve()
345
- // },
346
- // onCancel() {
347
- // resolve()
348
- // },
349
- // });
350
- // }))()
351
- // }
352
-
353
314
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
354
315
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
355
316
  })();
@@ -14,6 +14,10 @@ export default () => {
14
14
 
15
15
  /** 金额(含税) */
16
16
  const lineAmountIncludeTax = controller.useMemo((s) => {
17
+ if (typeof s.goodsListState.amountIncludeTax === 'number') {
18
+ return s.goodsListState.amountIncludeTax
19
+ }
20
+
17
21
  let sum = chain(bignumber(0));
18
22
  const editGood = s.goodsListState.editGood; // 正在编辑的货物
19
23
  const err = s.goodsListState.form?.getFieldsError() ?? {};
@@ -32,6 +36,10 @@ export default () => {
32
36
 
33
37
  /** 金额(不含税) */
34
38
  const lineAmountExcludeTax = controller.useMemo((s) => {
39
+ if (typeof s.goodsListState.amountExcludeTax === 'number') {
40
+ return s.goodsListState.amountExcludeTax
41
+ }
42
+
35
43
  let sum = chain(bignumber(0));
36
44
  const editGood = s.goodsListState.editGood; // 正在编辑的货物
37
45
  const err = s.goodsListState.form?.getFieldsError() ?? {};
@@ -50,6 +58,10 @@ export default () => {
50
58
 
51
59
  /** 税额 */
52
60
  const taxAmount = controller.useMemo((s) => {
61
+ if (typeof s.goodsListState.taxRateList === 'number') {
62
+ return s.goodsListState.taxRateList;
63
+ }
64
+
53
65
  let sum = chain(bignumber(0));
54
66
  const editGood = s.goodsListState.editGood; // 正在编辑的货物
55
67
  s.goodsListState.goodsList.forEach((e) => {