kts-component-invoice-operate 3.2.197 → 3.2.199
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/Invoice/tools/calculate/index.d.ts +7 -0
- package/dist/index.esm.js +33 -14
- package/dist/index.js +33 -14
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +3 -1
- package/src/Invoice/index.tsx +8 -1
- package/src/Invoice/tools/calculate/index.ts +13 -0
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +2 -2
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +16 -16
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +3 -2
|
@@ -31,6 +31,13 @@ export declare function countTaxAmount(amountIncludeTax: string | number, deduct
|
|
|
31
31
|
* @returns 单价
|
|
32
32
|
*/
|
|
33
33
|
export declare function countPrice(amount: string | number, quantity: string | number, calculatingDigits?: number): number | undefined | '';
|
|
34
|
+
/**
|
|
35
|
+
* 单价 = 金额/数量 不做小数限制
|
|
36
|
+
* @param amount 金额
|
|
37
|
+
* @param quantity 数量
|
|
38
|
+
* @returns 单价
|
|
39
|
+
*/
|
|
40
|
+
export declare function countPriceNoLimit(amount: string | number, quantity: string | number, calculatingDigits?: number): number | undefined | '';
|
|
34
41
|
/**
|
|
35
42
|
* 数量 = 金额/单价
|
|
36
43
|
* @param amount 金额
|
package/dist/index.esm.js
CHANGED
|
@@ -1651,6 +1651,18 @@ function countPrice(amount, quantity, calculatingDigits) {
|
|
|
1651
1651
|
if (!quantity && quantity !== 0) return undefined;
|
|
1652
1652
|
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1653
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* 单价 = 金额/数量 不做小数限制
|
|
1656
|
+
* @param amount 金额
|
|
1657
|
+
* @param quantity 数量
|
|
1658
|
+
* @returns 单价
|
|
1659
|
+
*/
|
|
1660
|
+
|
|
1661
|
+
function countPriceNoLimit(amount, quantity, calculatingDigits) {
|
|
1662
|
+
if (!amount && amount !== 0) return undefined;
|
|
1663
|
+
if (!quantity && quantity !== 0) return undefined;
|
|
1664
|
+
return chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber();
|
|
1665
|
+
}
|
|
1654
1666
|
/**
|
|
1655
1667
|
* 数量 = 金额/单价
|
|
1656
1668
|
* @param amount 金额
|
|
@@ -1703,6 +1715,7 @@ var calculator = /*#__PURE__*/Object.freeze({
|
|
|
1703
1715
|
countAmountExcludeTax: countAmountExcludeTax,
|
|
1704
1716
|
countTaxAmount: countTaxAmount,
|
|
1705
1717
|
countPrice: countPrice,
|
|
1718
|
+
countPriceNoLimit: countPriceNoLimit,
|
|
1706
1719
|
countQuantity: countQuantity,
|
|
1707
1720
|
nonScientificNotation: nonScientificNotation
|
|
1708
1721
|
});
|
|
@@ -19388,7 +19401,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19388
19401
|
|
|
19389
19402
|
case 11:
|
|
19390
19403
|
calculatingDigits = controller.state.calculatingDigits;
|
|
19391
|
-
quantity =
|
|
19404
|
+
quantity = values.quantity;
|
|
19392
19405
|
_context3.next = 16;
|
|
19393
19406
|
return controller.setEditGood({
|
|
19394
19407
|
quantity: quantity
|
|
@@ -19410,7 +19423,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19410
19423
|
}
|
|
19411
19424
|
|
|
19412
19425
|
// 可以找到 单价(含税)
|
|
19413
|
-
priceIncludeTax =
|
|
19426
|
+
priceIncludeTax = values.priceIncludeTax;
|
|
19414
19427
|
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
19415
19428
|
form.setFieldsValue({
|
|
19416
19429
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
@@ -19432,7 +19445,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19432
19445
|
|
|
19433
19446
|
// 可以找到 金额(含税)
|
|
19434
19447
|
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
19435
|
-
_priceIncludeTax =
|
|
19448
|
+
_priceIncludeTax = evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity));
|
|
19436
19449
|
form.setFieldsValue({
|
|
19437
19450
|
priceIncludeTax: _priceIncludeTax
|
|
19438
19451
|
});
|
|
@@ -19456,7 +19469,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19456
19469
|
}
|
|
19457
19470
|
|
|
19458
19471
|
// 可以找到 单价(不含税)
|
|
19459
|
-
priceExcludeTax =
|
|
19472
|
+
priceExcludeTax = values.priceExcludeTax;
|
|
19460
19473
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
19461
19474
|
form.setFieldsValue({
|
|
19462
19475
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
@@ -19479,7 +19492,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19479
19492
|
|
|
19480
19493
|
// 可以找到 金额(不含税)
|
|
19481
19494
|
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
19482
|
-
_priceExcludeTax =
|
|
19495
|
+
_priceExcludeTax = evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity));
|
|
19483
19496
|
form.setFieldsValue({
|
|
19484
19497
|
priceExcludeTax: _priceExcludeTax
|
|
19485
19498
|
});
|
|
@@ -19555,7 +19568,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19555
19568
|
|
|
19556
19569
|
case 11:
|
|
19557
19570
|
calculatingDigits = controller.state.calculatingDigits;
|
|
19558
|
-
priceIncludeTax =
|
|
19571
|
+
priceIncludeTax = values.priceIncludeTax;
|
|
19559
19572
|
_context4.next = 15;
|
|
19560
19573
|
return controller.setEditGood({
|
|
19561
19574
|
priceIncludeTax: priceIncludeTax
|
|
@@ -19571,7 +19584,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19571
19584
|
break;
|
|
19572
19585
|
}
|
|
19573
19586
|
|
|
19574
|
-
quantity =
|
|
19587
|
+
quantity = values.quantity;
|
|
19575
19588
|
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
19576
19589
|
form.setFieldsValue({
|
|
19577
19590
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
@@ -19592,7 +19605,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19592
19605
|
}
|
|
19593
19606
|
|
|
19594
19607
|
_lineAmountIncludeTax2 = format2(values.lineAmountIncludeTax);
|
|
19595
|
-
_quantity =
|
|
19608
|
+
_quantity = evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax));
|
|
19596
19609
|
form.setFieldsValue({
|
|
19597
19610
|
quantity: _quantity
|
|
19598
19611
|
});
|
|
@@ -19667,7 +19680,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19667
19680
|
|
|
19668
19681
|
case 11:
|
|
19669
19682
|
calculatingDigits = controller.state.calculatingDigits;
|
|
19670
|
-
priceExcludeTax =
|
|
19683
|
+
priceExcludeTax = values.priceExcludeTax;
|
|
19671
19684
|
_context5.next = 15;
|
|
19672
19685
|
return controller.setEditGood({
|
|
19673
19686
|
priceExcludeTax: priceExcludeTax
|
|
@@ -19683,7 +19696,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19683
19696
|
break;
|
|
19684
19697
|
}
|
|
19685
19698
|
|
|
19686
|
-
quantity =
|
|
19699
|
+
quantity = values.quantity;
|
|
19687
19700
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
19688
19701
|
form.setFieldsValue({
|
|
19689
19702
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
@@ -19704,7 +19717,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19704
19717
|
}
|
|
19705
19718
|
|
|
19706
19719
|
_lineAmountExcludeTax2 = format2(values.lineAmountExcludeTax);
|
|
19707
|
-
_quantity2 =
|
|
19720
|
+
_quantity2 = evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax));
|
|
19708
19721
|
form.setFieldsValue({
|
|
19709
19722
|
quantity: _quantity2
|
|
19710
19723
|
});
|
|
@@ -22062,7 +22075,7 @@ var useColumns$1 = (function (form) {
|
|
|
22062
22075
|
message: '金额不能为空'
|
|
22063
22076
|
}, {
|
|
22064
22077
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
22065
|
-
message: '
|
|
22078
|
+
message: '金额错误,请重新输入'
|
|
22066
22079
|
}, {
|
|
22067
22080
|
validator: function () {
|
|
22068
22081
|
var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
|
|
@@ -22118,6 +22131,7 @@ var useColumns$1 = (function (form) {
|
|
|
22118
22131
|
style: {
|
|
22119
22132
|
textAlign: 'right'
|
|
22120
22133
|
},
|
|
22134
|
+
max: 99999999999999999999,
|
|
22121
22135
|
loading: isCipher$1(changeField, 'lineAmountIncludeTax'),
|
|
22122
22136
|
onChange: function onChange() {
|
|
22123
22137
|
setChangeField('lineAmountIncludeTax');
|
|
@@ -22150,7 +22164,7 @@ var useColumns$1 = (function (form) {
|
|
|
22150
22164
|
message: '金额不能为空'
|
|
22151
22165
|
}, {
|
|
22152
22166
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
22153
|
-
message: '
|
|
22167
|
+
message: '金额错误,请重新输入'
|
|
22154
22168
|
}, {
|
|
22155
22169
|
validator: function () {
|
|
22156
22170
|
var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
|
|
@@ -27375,7 +27389,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
27375
27389
|
}
|
|
27376
27390
|
|
|
27377
27391
|
if (good.lineAmountExcludeTax && good.quantity) {
|
|
27378
|
-
good.priceExcludeTax =
|
|
27392
|
+
good.priceExcludeTax = countPriceNoLimit(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits);
|
|
27379
27393
|
} //赋值商品的可用税率
|
|
27380
27394
|
|
|
27381
27395
|
|
|
@@ -27754,6 +27768,11 @@ function AddComparisonDrawer() {
|
|
|
27754
27768
|
// })
|
|
27755
27769
|
// }
|
|
27756
27770
|
|
|
27771
|
+
var config = {
|
|
27772
|
+
number: 'BigNumber',
|
|
27773
|
+
precision: 64
|
|
27774
|
+
};
|
|
27775
|
+
create(all, config);
|
|
27757
27776
|
/** 发票组件的上下文 */
|
|
27758
27777
|
|
|
27759
27778
|
var InvoiceContext = /*#__PURE__*/React.createContext(undefined);
|
package/dist/index.js
CHANGED
|
@@ -1661,6 +1661,18 @@ function countPrice(amount, quantity, calculatingDigits) {
|
|
|
1661
1661
|
if (!quantity && quantity !== 0) return undefined;
|
|
1662
1662
|
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1663
1663
|
}
|
|
1664
|
+
/**
|
|
1665
|
+
* 单价 = 金额/数量 不做小数限制
|
|
1666
|
+
* @param amount 金额
|
|
1667
|
+
* @param quantity 数量
|
|
1668
|
+
* @returns 单价
|
|
1669
|
+
*/
|
|
1670
|
+
|
|
1671
|
+
function countPriceNoLimit(amount, quantity, calculatingDigits) {
|
|
1672
|
+
if (!amount && amount !== 0) return undefined;
|
|
1673
|
+
if (!quantity && quantity !== 0) return undefined;
|
|
1674
|
+
return mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(quantity)).done().toNumber();
|
|
1675
|
+
}
|
|
1664
1676
|
/**
|
|
1665
1677
|
* 数量 = 金额/单价
|
|
1666
1678
|
* @param amount 金额
|
|
@@ -1713,6 +1725,7 @@ var calculator = /*#__PURE__*/Object.freeze({
|
|
|
1713
1725
|
countAmountExcludeTax: countAmountExcludeTax,
|
|
1714
1726
|
countTaxAmount: countTaxAmount,
|
|
1715
1727
|
countPrice: countPrice,
|
|
1728
|
+
countPriceNoLimit: countPriceNoLimit,
|
|
1716
1729
|
countQuantity: countQuantity,
|
|
1717
1730
|
nonScientificNotation: nonScientificNotation
|
|
1718
1731
|
});
|
|
@@ -19398,7 +19411,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19398
19411
|
|
|
19399
19412
|
case 11:
|
|
19400
19413
|
calculatingDigits = controller.state.calculatingDigits;
|
|
19401
|
-
quantity =
|
|
19414
|
+
quantity = values.quantity;
|
|
19402
19415
|
_context3.next = 16;
|
|
19403
19416
|
return controller.setEditGood({
|
|
19404
19417
|
quantity: quantity
|
|
@@ -19420,7 +19433,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19420
19433
|
}
|
|
19421
19434
|
|
|
19422
19435
|
// 可以找到 单价(含税)
|
|
19423
|
-
priceIncludeTax =
|
|
19436
|
+
priceIncludeTax = values.priceIncludeTax;
|
|
19424
19437
|
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
19425
19438
|
form.setFieldsValue({
|
|
19426
19439
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
@@ -19442,7 +19455,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19442
19455
|
|
|
19443
19456
|
// 可以找到 金额(含税)
|
|
19444
19457
|
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
19445
|
-
_priceIncludeTax =
|
|
19458
|
+
_priceIncludeTax = evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity));
|
|
19446
19459
|
form.setFieldsValue({
|
|
19447
19460
|
priceIncludeTax: _priceIncludeTax
|
|
19448
19461
|
});
|
|
@@ -19466,7 +19479,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19466
19479
|
}
|
|
19467
19480
|
|
|
19468
19481
|
// 可以找到 单价(不含税)
|
|
19469
|
-
priceExcludeTax =
|
|
19482
|
+
priceExcludeTax = values.priceExcludeTax;
|
|
19470
19483
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
19471
19484
|
form.setFieldsValue({
|
|
19472
19485
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
@@ -19489,7 +19502,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19489
19502
|
|
|
19490
19503
|
// 可以找到 金额(不含税)
|
|
19491
19504
|
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
19492
|
-
_priceExcludeTax =
|
|
19505
|
+
_priceExcludeTax = evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity));
|
|
19493
19506
|
form.setFieldsValue({
|
|
19494
19507
|
priceExcludeTax: _priceExcludeTax
|
|
19495
19508
|
});
|
|
@@ -19565,7 +19578,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19565
19578
|
|
|
19566
19579
|
case 11:
|
|
19567
19580
|
calculatingDigits = controller.state.calculatingDigits;
|
|
19568
|
-
priceIncludeTax =
|
|
19581
|
+
priceIncludeTax = values.priceIncludeTax;
|
|
19569
19582
|
_context4.next = 15;
|
|
19570
19583
|
return controller.setEditGood({
|
|
19571
19584
|
priceIncludeTax: priceIncludeTax
|
|
@@ -19581,7 +19594,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19581
19594
|
break;
|
|
19582
19595
|
}
|
|
19583
19596
|
|
|
19584
|
-
quantity =
|
|
19597
|
+
quantity = values.quantity;
|
|
19585
19598
|
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
19586
19599
|
form.setFieldsValue({
|
|
19587
19600
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
@@ -19602,7 +19615,7 @@ var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19602
19615
|
}
|
|
19603
19616
|
|
|
19604
19617
|
_lineAmountIncludeTax2 = format2(values.lineAmountIncludeTax);
|
|
19605
|
-
_quantity =
|
|
19618
|
+
_quantity = evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax));
|
|
19606
19619
|
form.setFieldsValue({
|
|
19607
19620
|
quantity: _quantity
|
|
19608
19621
|
});
|
|
@@ -19677,7 +19690,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19677
19690
|
|
|
19678
19691
|
case 11:
|
|
19679
19692
|
calculatingDigits = controller.state.calculatingDigits;
|
|
19680
|
-
priceExcludeTax =
|
|
19693
|
+
priceExcludeTax = values.priceExcludeTax;
|
|
19681
19694
|
_context5.next = 15;
|
|
19682
19695
|
return controller.setEditGood({
|
|
19683
19696
|
priceExcludeTax: priceExcludeTax
|
|
@@ -19693,7 +19706,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19693
19706
|
break;
|
|
19694
19707
|
}
|
|
19695
19708
|
|
|
19696
|
-
quantity =
|
|
19709
|
+
quantity = values.quantity;
|
|
19697
19710
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
19698
19711
|
form.setFieldsValue({
|
|
19699
19712
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
@@ -19714,7 +19727,7 @@ var onChangePriceExcludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
|
19714
19727
|
}
|
|
19715
19728
|
|
|
19716
19729
|
_lineAmountExcludeTax2 = format2(values.lineAmountExcludeTax);
|
|
19717
|
-
_quantity2 =
|
|
19730
|
+
_quantity2 = evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax));
|
|
19718
19731
|
form.setFieldsValue({
|
|
19719
19732
|
quantity: _quantity2
|
|
19720
19733
|
});
|
|
@@ -22072,7 +22085,7 @@ var useColumns$1 = (function (form) {
|
|
|
22072
22085
|
message: '金额不能为空'
|
|
22073
22086
|
}, {
|
|
22074
22087
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
22075
|
-
message: '
|
|
22088
|
+
message: '金额错误,请重新输入'
|
|
22076
22089
|
}, {
|
|
22077
22090
|
validator: function () {
|
|
22078
22091
|
var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
|
|
@@ -22128,6 +22141,7 @@ var useColumns$1 = (function (form) {
|
|
|
22128
22141
|
style: {
|
|
22129
22142
|
textAlign: 'right'
|
|
22130
22143
|
},
|
|
22144
|
+
max: 99999999999999999999,
|
|
22131
22145
|
loading: isCipher$1(changeField, 'lineAmountIncludeTax'),
|
|
22132
22146
|
onChange: function onChange() {
|
|
22133
22147
|
setChangeField('lineAmountIncludeTax');
|
|
@@ -22160,7 +22174,7 @@ var useColumns$1 = (function (form) {
|
|
|
22160
22174
|
message: '金额不能为空'
|
|
22161
22175
|
}, {
|
|
22162
22176
|
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
22163
|
-
message: '
|
|
22177
|
+
message: '金额错误,请重新输入'
|
|
22164
22178
|
}, {
|
|
22165
22179
|
validator: function () {
|
|
22166
22180
|
var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
|
|
@@ -27385,7 +27399,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
27385
27399
|
}
|
|
27386
27400
|
|
|
27387
27401
|
if (good.lineAmountExcludeTax && good.quantity) {
|
|
27388
|
-
good.priceExcludeTax =
|
|
27402
|
+
good.priceExcludeTax = countPriceNoLimit(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits);
|
|
27389
27403
|
} //赋值商品的可用税率
|
|
27390
27404
|
|
|
27391
27405
|
|
|
@@ -27764,6 +27778,11 @@ function AddComparisonDrawer() {
|
|
|
27764
27778
|
// })
|
|
27765
27779
|
// }
|
|
27766
27780
|
|
|
27781
|
+
var config = {
|
|
27782
|
+
number: 'BigNumber',
|
|
27783
|
+
precision: 64
|
|
27784
|
+
};
|
|
27785
|
+
mathjs.create(mathjs.all, config);
|
|
27767
27786
|
/** 发票组件的上下文 */
|
|
27768
27787
|
|
|
27769
27788
|
var InvoiceContext = /*#__PURE__*/React__default['default'].createContext(undefined);
|
package/package.json
CHANGED
|
@@ -11,7 +11,9 @@ export default () => {
|
|
|
11
11
|
|
|
12
12
|
React.useEffect(() => {
|
|
13
13
|
controller.run(async s=>{
|
|
14
|
-
s.stakeholder.enables = ['taxAmount']
|
|
14
|
+
s.stakeholder.enables = ['taxAmount'];
|
|
15
|
+
s.priceIntegerDigit = 25;
|
|
16
|
+
s.calculatingDigits=25;
|
|
15
17
|
})
|
|
16
18
|
}, [controller])
|
|
17
19
|
return (
|
package/src/Invoice/index.tsx
CHANGED
|
@@ -26,6 +26,13 @@ import ImportBuyerDrawer from './ui/default/ImportBuyerDrawer';
|
|
|
26
26
|
import ImportGoodsDrawer from './ui/default/ImportGoodsDrawer';
|
|
27
27
|
import EndowCodeDrawer from './ui/default/EndowCodeDrawer';
|
|
28
28
|
import AddComparisonDrawer from './ui/default/AddComparisonDrawer';
|
|
29
|
+
import { create, all } from 'mathjs';
|
|
30
|
+
const config = {
|
|
31
|
+
number: 'BigNumber',
|
|
32
|
+
precision: 64,
|
|
33
|
+
}
|
|
34
|
+
create(all, config);
|
|
35
|
+
|
|
29
36
|
|
|
30
37
|
/** 发票组件的上下文 */
|
|
31
38
|
export const InvoiceContext = React.createContext<InvoiceController>(
|
|
@@ -97,7 +104,7 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
|
|
|
97
104
|
|
|
98
105
|
/** 特殊信息-不动产经营租赁服务(数电) */
|
|
99
106
|
static readonly RealEstateInfo = RealEstateInfo;
|
|
100
|
-
|
|
107
|
+
|
|
101
108
|
/** 特殊信息-建筑服务(数电) */
|
|
102
109
|
static readonly Architecture = Architecture;
|
|
103
110
|
|
|
@@ -90,7 +90,20 @@ export function countPrice(amount: string | number, quantity: string | number, c
|
|
|
90
90
|
.done()
|
|
91
91
|
.toNumber(), calculatingDigits)
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* 单价 = 金额/数量 不做小数限制
|
|
95
|
+
* @param amount 金额
|
|
96
|
+
* @param quantity 数量
|
|
97
|
+
* @returns 单价
|
|
98
|
+
*/
|
|
99
|
+
export function countPriceNoLimit(amount: string | number, quantity: string | number, calculatingDigits?: number): number | undefined | '' {
|
|
100
|
+
if (!amount && amount !== 0) return undefined;
|
|
101
|
+
if (!quantity && quantity !== 0) return undefined;
|
|
93
102
|
|
|
103
|
+
return chain(bignumber(amount)).divide(bignumber(quantity))
|
|
104
|
+
.done()
|
|
105
|
+
.toNumber()
|
|
106
|
+
}
|
|
94
107
|
|
|
95
108
|
/**
|
|
96
109
|
* 数量 = 金额/单价
|
|
@@ -6,7 +6,7 @@ import { Input, NumberPicker } from '@formily/antd-components';
|
|
|
6
6
|
import { format15 } from '../GoodsList/hook/useColumns/autoFillFn';
|
|
7
7
|
import { LineAttributeType } from '../../../InvoiceController';
|
|
8
8
|
import IGood from '../../../InvoiceController/InvoiceControllerState/GoodsListState/IGood';
|
|
9
|
-
import { countTaxAmount, countAmountExcludeTax, countPrice } from '../../../tools/calculate';
|
|
9
|
+
import { countTaxAmount, countAmountExcludeTax, countPrice,countPriceNoLimit } from '../../../tools/calculate';
|
|
10
10
|
import { bytesLnegth, cutStr } from '../../../tools/strringFn';
|
|
11
11
|
import {
|
|
12
12
|
SchemaForm,
|
|
@@ -488,7 +488,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
488
488
|
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
|
489
489
|
}
|
|
490
490
|
if (good.lineAmountExcludeTax && good.quantity) {
|
|
491
|
-
good.priceExcludeTax =
|
|
491
|
+
good.priceExcludeTax = countPriceNoLimit(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits) as any;
|
|
492
492
|
}
|
|
493
493
|
|
|
494
494
|
//赋值商品的可用税率
|
|
@@ -67,7 +67,7 @@ export const onChangeQuantity = lazyFn(
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
70
|
-
const quantity =
|
|
70
|
+
const quantity = values.quantity;
|
|
71
71
|
await controller.setEditGood({ quantity });
|
|
72
72
|
form.setFieldsValue({ quantity });
|
|
73
73
|
|
|
@@ -76,16 +76,16 @@ export const onChangeQuantity = lazyFn(
|
|
|
76
76
|
// 含税
|
|
77
77
|
if (!err.priceIncludeTax && values.priceIncludeTax) {
|
|
78
78
|
// 可以找到 单价(含税)
|
|
79
|
-
const priceIncludeTax =
|
|
79
|
+
const priceIncludeTax = values.priceIncludeTax;
|
|
80
80
|
const lineAmountIncludeTax = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
|
|
81
81
|
form.setFieldsValue({ lineAmountIncludeTax });
|
|
82
82
|
await controller.setEditGood({ lineAmountIncludeTax });
|
|
83
83
|
} else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
84
84
|
// 可以找到 金额(含税)
|
|
85
85
|
const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
86
|
-
const priceIncludeTax =
|
|
87
|
-
evaluate(`${lineAmountIncludeTax} / ${quantity}`)
|
|
88
|
-
|
|
86
|
+
const priceIncludeTax =
|
|
87
|
+
evaluate(`${lineAmountIncludeTax} / ${quantity}`)
|
|
88
|
+
;
|
|
89
89
|
form.setFieldsValue({ priceIncludeTax });
|
|
90
90
|
await controller.setEditGood({ priceIncludeTax });
|
|
91
91
|
}
|
|
@@ -96,14 +96,14 @@ export const onChangeQuantity = lazyFn(
|
|
|
96
96
|
// 不含税
|
|
97
97
|
if (!err.priceExcludeTax && values.priceExcludeTax) {
|
|
98
98
|
// 可以找到 单价(不含税)
|
|
99
|
-
const priceExcludeTax =
|
|
99
|
+
const priceExcludeTax = values.priceExcludeTax;
|
|
100
100
|
const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
101
101
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
102
102
|
await controller.setEditGood({ lineAmountExcludeTax, quantity });
|
|
103
103
|
} else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
104
104
|
// 可以找到 金额(不含税)
|
|
105
105
|
const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
106
|
-
const priceExcludeTax =
|
|
106
|
+
const priceExcludeTax = evaluate(`${lineAmountExcludeTax} / ${quantity}`);
|
|
107
107
|
form.setFieldsValue({ priceExcludeTax });
|
|
108
108
|
await controller.setEditGood({ priceExcludeTax, quantity });
|
|
109
109
|
}
|
|
@@ -136,19 +136,19 @@ export const onChangePriceIncludeTax = lazyFn(
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
139
|
-
const priceIncludeTax =
|
|
139
|
+
const priceIncludeTax = values.priceIncludeTax;
|
|
140
140
|
await controller.setEditGood({ priceIncludeTax });
|
|
141
141
|
form.setFieldsValue({ priceIncludeTax });
|
|
142
142
|
|
|
143
143
|
// 是否有数量
|
|
144
144
|
if (!err.quantity && values.quantity) {
|
|
145
|
-
const quantity =
|
|
145
|
+
const quantity = values.quantity;
|
|
146
146
|
const lineAmountIncludeTax = format2(evaluate(`${quantity} * ${priceIncludeTax}`));
|
|
147
147
|
form.setFieldsValue({ lineAmountIncludeTax });
|
|
148
148
|
await controller.setEditGood({ lineAmountIncludeTax });
|
|
149
149
|
} else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
|
|
150
150
|
const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
151
|
-
const quantity =
|
|
151
|
+
const quantity = evaluate(`${lineAmountIncludeTax} / ${priceIncludeTax}`);
|
|
152
152
|
form.setFieldsValue({ quantity });
|
|
153
153
|
await controller.setEditGood({ quantity });
|
|
154
154
|
}
|
|
@@ -180,22 +180,22 @@ export const onChangePriceExcludeTax = lazyFn(
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
const calculatingDigits = controller.state.calculatingDigits;
|
|
183
|
-
const priceExcludeTax =
|
|
183
|
+
const priceExcludeTax = values.priceExcludeTax;
|
|
184
184
|
await controller.setEditGood({ priceExcludeTax });
|
|
185
185
|
form.setFieldsValue({ priceExcludeTax });
|
|
186
186
|
|
|
187
187
|
// 是否有数量
|
|
188
188
|
if (!err.quantity && values.quantity) {
|
|
189
|
-
const quantity =
|
|
189
|
+
const quantity = values.quantity;
|
|
190
190
|
const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
|
|
191
191
|
form.setFieldsValue({ lineAmountExcludeTax });
|
|
192
192
|
await controller.setEditGood({ lineAmountExcludeTax });
|
|
193
193
|
} else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
|
|
194
194
|
const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
195
|
-
const quantity =
|
|
196
|
-
evaluate(`${lineAmountExcludeTax} / ${priceExcludeTax}`)
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
const quantity =
|
|
196
|
+
evaluate(`${lineAmountExcludeTax} / ${priceExcludeTax}`)
|
|
197
|
+
|
|
198
|
+
;
|
|
199
199
|
form.setFieldsValue({ quantity });
|
|
200
200
|
await controller.setEditGood({ quantity });
|
|
201
201
|
}
|
|
@@ -381,7 +381,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
381
381
|
rules: [
|
|
382
382
|
...getReplenishRules('lineAmountIncludeTax'),
|
|
383
383
|
{ required: true, message: '金额不能为空' },
|
|
384
|
-
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '
|
|
384
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
|
|
385
385
|
{
|
|
386
386
|
validator: async (_, value, callback) => {
|
|
387
387
|
if (`${value}`.split('.')[0].length > priceIntegerDigit) {
|
|
@@ -400,6 +400,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
400
400
|
})(
|
|
401
401
|
<MyInput
|
|
402
402
|
style={{ textAlign: 'right' }}
|
|
403
|
+
max={99999999999999999999}
|
|
403
404
|
loading={isCipher(changeField, 'lineAmountIncludeTax')}
|
|
404
405
|
onChange={() => {
|
|
405
406
|
setChangeField('lineAmountIncludeTax');
|
|
@@ -430,7 +431,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
430
431
|
rules: [
|
|
431
432
|
...getReplenishRules('lineAmountExcludeTax'),
|
|
432
433
|
{ required: true, message: '金额不能为空' },
|
|
433
|
-
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '
|
|
434
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额错误,请重新输入' },
|
|
434
435
|
{
|
|
435
436
|
validator: async (_, value: string, callback) => {
|
|
436
437
|
if (`${value}`.split('.')[0].length > priceIntegerDigit) {
|