kts-component-invoice-operate 3.2.245 → 3.2.246
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/ui/default/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/index.esm.js +122 -5
- package/dist/index.js +122 -5
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/pay/index.tsx +1 -1
- package/src/Invoice/_test/deduction/index.tsx +1 -2
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +34 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +52 -2
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +0 -1
|
@@ -37,3 +37,5 @@ export declare const onChangeItemName: (controller: InvoiceController, form: Wra
|
|
|
37
37
|
export declare const onChangeItemCode: (controller: InvoiceController, form: WrappedFormUtils<any>, record: IGood) => Promise<void>;
|
|
38
38
|
/** 修改了含税开关 重新计算 */
|
|
39
39
|
export declare const onChangeSwitchTax: (controller: InvoiceController, isTaxIncluded: boolean) => Promise<void>;
|
|
40
|
+
/** 税额 */
|
|
41
|
+
export declare const onChangeTaxAmount: (...par: any[]) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -10156,6 +10156,67 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
|
|
|
10156
10156
|
return _ref20.apply(this, arguments);
|
|
10157
10157
|
};
|
|
10158
10158
|
}();
|
|
10159
|
+
/** 税额 */
|
|
10160
|
+
|
|
10161
|
+
var onChangeTaxAmount = lazyFn(function (controller, form, record) {
|
|
10162
|
+
/** 金额(不含税) */
|
|
10163
|
+
var lineAmountExcludeTax;
|
|
10164
|
+
form.validateFields( /*#__PURE__*/function () {
|
|
10165
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(err, values) {
|
|
10166
|
+
var record, priceExcludeTax;
|
|
10167
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
10168
|
+
while (1) {
|
|
10169
|
+
switch (_context23.prev = _context23.next) {
|
|
10170
|
+
case 0:
|
|
10171
|
+
err = err || {};
|
|
10172
|
+
record = controller.state.goodsListState.editGood; // 校验是否有含税金额
|
|
10173
|
+
|
|
10174
|
+
if (!(err.lineAmountIncludeTax && !(record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) && (record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) !== 0)) {
|
|
10175
|
+
_context23.next = 6;
|
|
10176
|
+
break;
|
|
10177
|
+
}
|
|
10178
|
+
|
|
10179
|
+
_context23.next = 5;
|
|
10180
|
+
return clearCalculatingField(controller);
|
|
10181
|
+
|
|
10182
|
+
case 5:
|
|
10183
|
+
return _context23.abrupt("return");
|
|
10184
|
+
|
|
10185
|
+
case 6:
|
|
10186
|
+
// 计数不含税金额
|
|
10187
|
+
lineAmountExcludeTax = countAmountExcludeTax((record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) || 0, values.taxAmount);
|
|
10188
|
+
form.setFieldsValue({
|
|
10189
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
10190
|
+
});
|
|
10191
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax || '', (record === null || record === void 0 ? void 0 : record.quantity) || '', controller.state.calculatingDigits);
|
|
10192
|
+
_context23.next = 11;
|
|
10193
|
+
return controller.setEditGood({
|
|
10194
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
10195
|
+
taxAmount: values.taxAmount,
|
|
10196
|
+
priceExcludeTax: priceExcludeTax
|
|
10197
|
+
});
|
|
10198
|
+
|
|
10199
|
+
case 11:
|
|
10200
|
+
form.setFieldsValue({
|
|
10201
|
+
priceExcludeTax: priceExcludeTax
|
|
10202
|
+
}); // 清楚 计算中启动字段
|
|
10203
|
+
|
|
10204
|
+
_context23.next = 14;
|
|
10205
|
+
return clearCalculatingField(controller);
|
|
10206
|
+
|
|
10207
|
+
case 14:
|
|
10208
|
+
case "end":
|
|
10209
|
+
return _context23.stop();
|
|
10210
|
+
}
|
|
10211
|
+
}
|
|
10212
|
+
}, _callee23);
|
|
10213
|
+
}));
|
|
10214
|
+
|
|
10215
|
+
return function (_x42, _x43) {
|
|
10216
|
+
return _ref23.apply(this, arguments);
|
|
10217
|
+
};
|
|
10218
|
+
}());
|
|
10219
|
+
}, 1000);
|
|
10159
10220
|
|
|
10160
10221
|
/**
|
|
10161
10222
|
* 删除一个货物
|
|
@@ -13883,6 +13944,11 @@ var useColumns = (function (form) {
|
|
|
13883
13944
|
var taxRateList = controller.useMemo(function (e) {
|
|
13884
13945
|
return e.goodsListState.taxRateList;
|
|
13885
13946
|
}, []);
|
|
13947
|
+
/** 启用字段 */
|
|
13948
|
+
|
|
13949
|
+
var enables = controller.useMemo(function (s) {
|
|
13950
|
+
return s.stakeholder.enables || [];
|
|
13951
|
+
}, []);
|
|
13886
13952
|
/** 单位列表 */
|
|
13887
13953
|
|
|
13888
13954
|
var unitList = controller.useMemo(function (e) {
|
|
@@ -13893,6 +13959,16 @@ var useColumns = (function (form) {
|
|
|
13893
13959
|
var columnsReplenish = controller.useMemo(function (e) {
|
|
13894
13960
|
return e.goodsListState.columnsReplenish;
|
|
13895
13961
|
}, []);
|
|
13962
|
+
/** 是否校验商品 */
|
|
13963
|
+
|
|
13964
|
+
var isValidateGood = controller.useMemo(function (s) {
|
|
13965
|
+
return s.goodsListState.isValidateGood;
|
|
13966
|
+
}, []);
|
|
13967
|
+
/** 是否启用 */
|
|
13968
|
+
|
|
13969
|
+
var isEnables = React.useCallback(function (field) {
|
|
13970
|
+
return enables.indexOf(field) >= 0;
|
|
13971
|
+
}, [enables]);
|
|
13896
13972
|
/** 扣除额 */
|
|
13897
13973
|
|
|
13898
13974
|
var deduction = controller.useMemo(function (e) {
|
|
@@ -13949,7 +14025,7 @@ var useColumns = (function (form) {
|
|
|
13949
14025
|
/** 表头 */
|
|
13950
14026
|
|
|
13951
14027
|
var columns = React.useMemo(function () {
|
|
13952
|
-
var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2
|
|
14028
|
+
var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2;
|
|
13953
14029
|
|
|
13954
14030
|
return [{
|
|
13955
14031
|
title: ' ',
|
|
@@ -14310,6 +14386,9 @@ var useColumns = (function (form) {
|
|
|
14310
14386
|
return onChangeQuantity(controller, form, record);
|
|
14311
14387
|
|
|
14312
14388
|
case 3:
|
|
14389
|
+
onChangeTaxAmount(controller, form, record);
|
|
14390
|
+
|
|
14391
|
+
case 4:
|
|
14313
14392
|
case "end":
|
|
14314
14393
|
return _context8.stop();
|
|
14315
14394
|
}
|
|
@@ -14684,18 +14763,56 @@ var useColumns = (function (form) {
|
|
|
14684
14763
|
}
|
|
14685
14764
|
}, {
|
|
14686
14765
|
title: /*#__PURE__*/React.createElement(TitleText, {
|
|
14687
|
-
|
|
14766
|
+
required: isEnables('taxAmount')
|
|
14688
14767
|
}, "\u7A0E\u989D"),
|
|
14689
14768
|
dataIndex: 'taxAmount',
|
|
14690
14769
|
key: 'taxAmount',
|
|
14691
14770
|
align: 'right',
|
|
14692
14771
|
width: 119,
|
|
14772
|
+
rules: [].concat(_toConsumableArray(getReplenishRules('taxAmount')), [{
|
|
14773
|
+
required: isEnables('taxAmount'),
|
|
14774
|
+
message: '税额不能为空'
|
|
14775
|
+
}, {
|
|
14776
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
14777
|
+
message: '税额必须为数字'
|
|
14778
|
+
}, {
|
|
14779
|
+
validator: function validator(rule, value, callback) {
|
|
14780
|
+
//含税金额
|
|
14781
|
+
var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
|
|
14782
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
14783
|
+
|
|
14784
|
+
var lineAmountExcludeTax = chain$1(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
|
|
14785
|
+
var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
|
|
14786
|
+
|
|
14787
|
+
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
14788
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
14789
|
+
var total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
14790
|
+
|
|
14791
|
+
if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
14792
|
+
callback();
|
|
14793
|
+
} else {
|
|
14794
|
+
callback('税额填写错误,请重新输入');
|
|
14795
|
+
}
|
|
14796
|
+
} else {
|
|
14797
|
+
callback();
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
}]),
|
|
14693
14801
|
render: function render(value, record) {
|
|
14694
14802
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
14695
14803
|
return getFieldDecorator('taxAmount', {
|
|
14696
14804
|
initialValue: editGood.taxAmount,
|
|
14697
14805
|
rules: getReplenishRules('taxAmount')
|
|
14698
|
-
})( /*#__PURE__*/React.createElement(
|
|
14806
|
+
})(isEnables('taxAmount') ? /*#__PURE__*/React.createElement(MyInput, {
|
|
14807
|
+
style: {
|
|
14808
|
+
textAlign: 'right'
|
|
14809
|
+
},
|
|
14810
|
+
loading: isCipher(changeField, 'taxAmount'),
|
|
14811
|
+
onChange: function onChange() {
|
|
14812
|
+
setChangeField('taxAmount');
|
|
14813
|
+
onChangeTaxAmount(controller, form, record);
|
|
14814
|
+
}
|
|
14815
|
+
}) : /*#__PURE__*/React.createElement(MyDiv, {
|
|
14699
14816
|
loading: isCipher(changeField, 'taxAmount')
|
|
14700
14817
|
}));
|
|
14701
14818
|
} else {
|
|
@@ -21725,7 +21842,7 @@ var onChangeTaxRate$1 = lazyFn$2(function (controller, form, record) {
|
|
|
21725
21842
|
}, 1000);
|
|
21726
21843
|
/** 税额 */
|
|
21727
21844
|
|
|
21728
|
-
var onChangeTaxAmount = lazyFn$2(function (controller, form, record) {
|
|
21845
|
+
var onChangeTaxAmount$1 = lazyFn$2(function (controller, form, record) {
|
|
21729
21846
|
/** 金额(不含税) */
|
|
21730
21847
|
var lineAmountExcludeTax;
|
|
21731
21848
|
form.validateFields( /*#__PURE__*/function () {
|
|
@@ -24006,7 +24123,7 @@ var useColumns$1 = (function (form) {
|
|
|
24006
24123
|
loading: isCipher$1(changeField, 'taxAmount'),
|
|
24007
24124
|
onChange: function onChange() {
|
|
24008
24125
|
setChangeField('taxAmount');
|
|
24009
|
-
onChangeTaxAmount(controller, form, record);
|
|
24126
|
+
onChangeTaxAmount$1(controller, form, record);
|
|
24010
24127
|
}
|
|
24011
24128
|
}) : /*#__PURE__*/React.createElement(MyDiv$2, {
|
|
24012
24129
|
loading: isCipher$1(changeField, 'taxAmount')
|
package/dist/index.js
CHANGED
|
@@ -10166,6 +10166,67 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
|
|
|
10166
10166
|
return _ref20.apply(this, arguments);
|
|
10167
10167
|
};
|
|
10168
10168
|
}();
|
|
10169
|
+
/** 税额 */
|
|
10170
|
+
|
|
10171
|
+
var onChangeTaxAmount = lazyFn(function (controller, form, record) {
|
|
10172
|
+
/** 金额(不含税) */
|
|
10173
|
+
var lineAmountExcludeTax;
|
|
10174
|
+
form.validateFields( /*#__PURE__*/function () {
|
|
10175
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(err, values) {
|
|
10176
|
+
var record, priceExcludeTax;
|
|
10177
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
10178
|
+
while (1) {
|
|
10179
|
+
switch (_context23.prev = _context23.next) {
|
|
10180
|
+
case 0:
|
|
10181
|
+
err = err || {};
|
|
10182
|
+
record = controller.state.goodsListState.editGood; // 校验是否有含税金额
|
|
10183
|
+
|
|
10184
|
+
if (!(err.lineAmountIncludeTax && !(record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) && (record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) !== 0)) {
|
|
10185
|
+
_context23.next = 6;
|
|
10186
|
+
break;
|
|
10187
|
+
}
|
|
10188
|
+
|
|
10189
|
+
_context23.next = 5;
|
|
10190
|
+
return clearCalculatingField(controller);
|
|
10191
|
+
|
|
10192
|
+
case 5:
|
|
10193
|
+
return _context23.abrupt("return");
|
|
10194
|
+
|
|
10195
|
+
case 6:
|
|
10196
|
+
// 计数不含税金额
|
|
10197
|
+
lineAmountExcludeTax = countAmountExcludeTax((record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) || 0, values.taxAmount);
|
|
10198
|
+
form.setFieldsValue({
|
|
10199
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
10200
|
+
});
|
|
10201
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax || '', (record === null || record === void 0 ? void 0 : record.quantity) || '', controller.state.calculatingDigits);
|
|
10202
|
+
_context23.next = 11;
|
|
10203
|
+
return controller.setEditGood({
|
|
10204
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
10205
|
+
taxAmount: values.taxAmount,
|
|
10206
|
+
priceExcludeTax: priceExcludeTax
|
|
10207
|
+
});
|
|
10208
|
+
|
|
10209
|
+
case 11:
|
|
10210
|
+
form.setFieldsValue({
|
|
10211
|
+
priceExcludeTax: priceExcludeTax
|
|
10212
|
+
}); // 清楚 计算中启动字段
|
|
10213
|
+
|
|
10214
|
+
_context23.next = 14;
|
|
10215
|
+
return clearCalculatingField(controller);
|
|
10216
|
+
|
|
10217
|
+
case 14:
|
|
10218
|
+
case "end":
|
|
10219
|
+
return _context23.stop();
|
|
10220
|
+
}
|
|
10221
|
+
}
|
|
10222
|
+
}, _callee23);
|
|
10223
|
+
}));
|
|
10224
|
+
|
|
10225
|
+
return function (_x42, _x43) {
|
|
10226
|
+
return _ref23.apply(this, arguments);
|
|
10227
|
+
};
|
|
10228
|
+
}());
|
|
10229
|
+
}, 1000);
|
|
10169
10230
|
|
|
10170
10231
|
/**
|
|
10171
10232
|
* 删除一个货物
|
|
@@ -13893,6 +13954,11 @@ var useColumns = (function (form) {
|
|
|
13893
13954
|
var taxRateList = controller.useMemo(function (e) {
|
|
13894
13955
|
return e.goodsListState.taxRateList;
|
|
13895
13956
|
}, []);
|
|
13957
|
+
/** 启用字段 */
|
|
13958
|
+
|
|
13959
|
+
var enables = controller.useMemo(function (s) {
|
|
13960
|
+
return s.stakeholder.enables || [];
|
|
13961
|
+
}, []);
|
|
13896
13962
|
/** 单位列表 */
|
|
13897
13963
|
|
|
13898
13964
|
var unitList = controller.useMemo(function (e) {
|
|
@@ -13903,6 +13969,16 @@ var useColumns = (function (form) {
|
|
|
13903
13969
|
var columnsReplenish = controller.useMemo(function (e) {
|
|
13904
13970
|
return e.goodsListState.columnsReplenish;
|
|
13905
13971
|
}, []);
|
|
13972
|
+
/** 是否校验商品 */
|
|
13973
|
+
|
|
13974
|
+
var isValidateGood = controller.useMemo(function (s) {
|
|
13975
|
+
return s.goodsListState.isValidateGood;
|
|
13976
|
+
}, []);
|
|
13977
|
+
/** 是否启用 */
|
|
13978
|
+
|
|
13979
|
+
var isEnables = React__default['default'].useCallback(function (field) {
|
|
13980
|
+
return enables.indexOf(field) >= 0;
|
|
13981
|
+
}, [enables]);
|
|
13906
13982
|
/** 扣除额 */
|
|
13907
13983
|
|
|
13908
13984
|
var deduction = controller.useMemo(function (e) {
|
|
@@ -13959,7 +14035,7 @@ var useColumns = (function (form) {
|
|
|
13959
14035
|
/** 表头 */
|
|
13960
14036
|
|
|
13961
14037
|
var columns = React__default['default'].useMemo(function () {
|
|
13962
|
-
var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2
|
|
14038
|
+
var _columnsReplenish$ite, _columnsReplenish$uni, _columnsReplenish$qua, _columnsReplenish$pri, _columnsReplenish$pri2;
|
|
13963
14039
|
|
|
13964
14040
|
return [{
|
|
13965
14041
|
title: ' ',
|
|
@@ -14320,6 +14396,9 @@ var useColumns = (function (form) {
|
|
|
14320
14396
|
return onChangeQuantity(controller, form, record);
|
|
14321
14397
|
|
|
14322
14398
|
case 3:
|
|
14399
|
+
onChangeTaxAmount(controller, form, record);
|
|
14400
|
+
|
|
14401
|
+
case 4:
|
|
14323
14402
|
case "end":
|
|
14324
14403
|
return _context8.stop();
|
|
14325
14404
|
}
|
|
@@ -14694,18 +14773,56 @@ var useColumns = (function (form) {
|
|
|
14694
14773
|
}
|
|
14695
14774
|
}, {
|
|
14696
14775
|
title: /*#__PURE__*/React__default['default'].createElement(TitleText, {
|
|
14697
|
-
|
|
14776
|
+
required: isEnables('taxAmount')
|
|
14698
14777
|
}, "\u7A0E\u989D"),
|
|
14699
14778
|
dataIndex: 'taxAmount',
|
|
14700
14779
|
key: 'taxAmount',
|
|
14701
14780
|
align: 'right',
|
|
14702
14781
|
width: 119,
|
|
14782
|
+
rules: [].concat(_toConsumableArray(getReplenishRules('taxAmount')), [{
|
|
14783
|
+
required: isEnables('taxAmount'),
|
|
14784
|
+
message: '税额不能为空'
|
|
14785
|
+
}, {
|
|
14786
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
14787
|
+
message: '税额必须为数字'
|
|
14788
|
+
}, {
|
|
14789
|
+
validator: function validator(rule, value, callback) {
|
|
14790
|
+
//含税金额
|
|
14791
|
+
var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
|
|
14792
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
14793
|
+
|
|
14794
|
+
var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(lineAmountIncludeTax || 0)).subtract(mathjs.bignumber(value || 0));
|
|
14795
|
+
var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
|
|
14796
|
+
|
|
14797
|
+
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
14798
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
14799
|
+
var total = lineAmountExcludeTax.multiply(mathjs.bignumber(taxRate || 0)).divide(mathjs.bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
14800
|
+
|
|
14801
|
+
if (Math.abs(total.subtract(mathjs.bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
14802
|
+
callback();
|
|
14803
|
+
} else {
|
|
14804
|
+
callback('税额填写错误,请重新输入');
|
|
14805
|
+
}
|
|
14806
|
+
} else {
|
|
14807
|
+
callback();
|
|
14808
|
+
}
|
|
14809
|
+
}
|
|
14810
|
+
}]),
|
|
14703
14811
|
render: function render(value, record) {
|
|
14704
14812
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
14705
14813
|
return getFieldDecorator('taxAmount', {
|
|
14706
14814
|
initialValue: editGood.taxAmount,
|
|
14707
14815
|
rules: getReplenishRules('taxAmount')
|
|
14708
|
-
})( /*#__PURE__*/React__default['default'].createElement(
|
|
14816
|
+
})(isEnables('taxAmount') ? /*#__PURE__*/React__default['default'].createElement(MyInput, {
|
|
14817
|
+
style: {
|
|
14818
|
+
textAlign: 'right'
|
|
14819
|
+
},
|
|
14820
|
+
loading: isCipher(changeField, 'taxAmount'),
|
|
14821
|
+
onChange: function onChange() {
|
|
14822
|
+
setChangeField('taxAmount');
|
|
14823
|
+
onChangeTaxAmount(controller, form, record);
|
|
14824
|
+
}
|
|
14825
|
+
}) : /*#__PURE__*/React__default['default'].createElement(MyDiv, {
|
|
14709
14826
|
loading: isCipher(changeField, 'taxAmount')
|
|
14710
14827
|
}));
|
|
14711
14828
|
} else {
|
|
@@ -21735,7 +21852,7 @@ var onChangeTaxRate$1 = lazyFn$2(function (controller, form, record) {
|
|
|
21735
21852
|
}, 1000);
|
|
21736
21853
|
/** 税额 */
|
|
21737
21854
|
|
|
21738
|
-
var onChangeTaxAmount = lazyFn$2(function (controller, form, record) {
|
|
21855
|
+
var onChangeTaxAmount$1 = lazyFn$2(function (controller, form, record) {
|
|
21739
21856
|
/** 金额(不含税) */
|
|
21740
21857
|
var lineAmountExcludeTax;
|
|
21741
21858
|
form.validateFields( /*#__PURE__*/function () {
|
|
@@ -24016,7 +24133,7 @@ var useColumns$1 = (function (form) {
|
|
|
24016
24133
|
loading: isCipher$1(changeField, 'taxAmount'),
|
|
24017
24134
|
onChange: function onChange() {
|
|
24018
24135
|
setChangeField('taxAmount');
|
|
24019
|
-
onChangeTaxAmount(controller, form, record);
|
|
24136
|
+
onChangeTaxAmount$1(controller, form, record);
|
|
24020
24137
|
}
|
|
24021
24138
|
}) : /*#__PURE__*/React__default['default'].createElement(MyDiv$2, {
|
|
24022
24139
|
loading: isCipher$1(changeField, 'taxAmount')
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ export default () => {
|
|
|
24
24
|
// 'naturalPersonFlag'
|
|
25
25
|
// ]));
|
|
26
26
|
controller.state.payListState.goodsList = [{ $index: '222', channel: '001',number: '渝bkb190', }]
|
|
27
|
-
|
|
27
|
+
controller.state.stakeholder.enables = ['taxAmount']
|
|
28
28
|
})
|
|
29
29
|
}, [controller])
|
|
30
30
|
const onSave = async () => {
|
|
@@ -645,3 +645,37 @@ export const onChangeSwitchTax = async (controller: InvoiceController, isTaxIncl
|
|
|
645
645
|
}
|
|
646
646
|
})
|
|
647
647
|
}
|
|
648
|
+
|
|
649
|
+
/** 税额 */
|
|
650
|
+
export const onChangeTaxAmount = lazyFn(
|
|
651
|
+
(controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
|
|
652
|
+
|
|
653
|
+
/** 金额(不含税) */
|
|
654
|
+
let lineAmountExcludeTax;
|
|
655
|
+
|
|
656
|
+
form.validateFields(async (err, values) => {
|
|
657
|
+
err = err || {};
|
|
658
|
+
|
|
659
|
+
const record = controller.state.goodsListState.editGood;
|
|
660
|
+
|
|
661
|
+
// 校验是否有含税金额
|
|
662
|
+
if (err.lineAmountIncludeTax && (!record?.lineAmountIncludeTax && record?.lineAmountIncludeTax !== 0)) {
|
|
663
|
+
await clearCalculatingField(controller);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// 计数不含税金额
|
|
668
|
+
lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
|
|
669
|
+
form.setFieldsValue({ lineAmountExcludeTax });
|
|
670
|
+
|
|
671
|
+
const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
|
|
672
|
+
|
|
673
|
+
await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
|
|
674
|
+
form.setFieldsValue({ priceExcludeTax });
|
|
675
|
+
|
|
676
|
+
// 清楚 计算中启动字段
|
|
677
|
+
await clearCalculatingField(controller);
|
|
678
|
+
})
|
|
679
|
+
},
|
|
680
|
+
1000,
|
|
681
|
+
)
|
|
@@ -3,6 +3,7 @@ import { Form, AutoComplete, Select, Button, Input, Spin, Tooltip } from 'kts-co
|
|
|
3
3
|
import { InputProps } from 'kts-components-antd-x3/lib/input';
|
|
4
4
|
import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
|
|
5
5
|
import { IGood, LineAttributeType } from '../../../../../InvoiceController';
|
|
6
|
+
import { chain, bignumber } from 'mathjs';
|
|
6
7
|
import Invoice from '../../../../..';
|
|
7
8
|
import RowMenu from './ui/RowMenu';
|
|
8
9
|
import TitleText from './ui/TitleText';
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
onChangeTaxRate,
|
|
18
19
|
onChangeItemName,
|
|
19
20
|
onChangeItemCode,
|
|
21
|
+
onChangeTaxAmount,
|
|
20
22
|
} from './autoFillFn';
|
|
21
23
|
import { getItemNameWithShorthand } from '../../../../../tools/itemName';
|
|
22
24
|
import Drag from './ui/Drag';
|
|
@@ -60,12 +62,21 @@ export default (form: WrappedFormUtils) => {
|
|
|
60
62
|
/** 税率列表 */
|
|
61
63
|
const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
|
|
62
64
|
|
|
65
|
+
/** 启用字段 */
|
|
66
|
+
const enables = controller.useMemo(s => s.stakeholder.enables || [], []);
|
|
67
|
+
|
|
63
68
|
/** 单位列表 */
|
|
64
69
|
const unitList = controller.useMemo((e) => e.goodsListState.unitList, []);
|
|
65
70
|
|
|
66
71
|
/** 商品表格补充配置 */
|
|
67
72
|
const columnsReplenish = controller.useMemo((e) => e.goodsListState.columnsReplenish, []);
|
|
68
73
|
|
|
74
|
+
/** 是否校验商品 */
|
|
75
|
+
const isValidateGood = controller.useMemo(s => s.goodsListState.isValidateGood, [])
|
|
76
|
+
|
|
77
|
+
/** 是否启用 */
|
|
78
|
+
const isEnables = React.useCallback(field => enables.indexOf(field) >= 0, [enables])
|
|
79
|
+
|
|
69
80
|
/** 扣除额 */
|
|
70
81
|
const deduction = controller.useMemo((e) => e.goodsListState.deduction, []);
|
|
71
82
|
|
|
@@ -299,6 +310,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
299
310
|
onChange={async () => {
|
|
300
311
|
setChangeField('quantity');
|
|
301
312
|
await onChangeQuantity(controller, form, record);
|
|
313
|
+
onChangeTaxAmount(controller, form, record);
|
|
302
314
|
}}
|
|
303
315
|
/>,
|
|
304
316
|
)}
|
|
@@ -535,17 +547,55 @@ export default (form: WrappedFormUtils) => {
|
|
|
535
547
|
},
|
|
536
548
|
},
|
|
537
549
|
{
|
|
538
|
-
title: <TitleText
|
|
550
|
+
title: <TitleText required={isEnables('taxAmount')} >税额</TitleText>,
|
|
539
551
|
dataIndex: 'taxAmount',
|
|
540
552
|
key: 'taxAmount',
|
|
541
553
|
align: 'right',
|
|
542
554
|
width: 119,
|
|
555
|
+
rules: [
|
|
556
|
+
...getReplenishRules('taxAmount'),
|
|
557
|
+
{ required: isEnables('taxAmount'), message: '税额不能为空' },
|
|
558
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '税额必须为数字' },
|
|
559
|
+
{
|
|
560
|
+
validator: (rule: any, value: any, callback: any) => {
|
|
561
|
+
//含税金额
|
|
562
|
+
const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
|
|
563
|
+
//不含税金额
|
|
564
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
565
|
+
const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
|
|
566
|
+
const taxRate = editGood?.taxRate;
|
|
567
|
+
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
568
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
569
|
+
const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
|
|
570
|
+
// if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
571
|
+
if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
572
|
+
callback();
|
|
573
|
+
} else {
|
|
574
|
+
callback('税额填写错误,请重新输入')
|
|
575
|
+
}
|
|
576
|
+
} else {
|
|
577
|
+
callback();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
],
|
|
543
582
|
render: (value: string, record: IGood) => {
|
|
544
583
|
if (editGood?.$index === record.$index) {
|
|
545
584
|
return getFieldDecorator('taxAmount', {
|
|
546
585
|
initialValue: editGood.taxAmount,
|
|
547
586
|
rules: getReplenishRules('taxAmount'),
|
|
548
|
-
})(
|
|
587
|
+
})(
|
|
588
|
+
isEnables('taxAmount')
|
|
589
|
+
? <MyInput
|
|
590
|
+
style={{ textAlign: 'right' }}
|
|
591
|
+
loading={isCipher(changeField, 'taxAmount')}
|
|
592
|
+
onChange={() => {
|
|
593
|
+
setChangeField('taxAmount');
|
|
594
|
+
onChangeTaxAmount(controller, form, record);
|
|
595
|
+
}}
|
|
596
|
+
/>
|
|
597
|
+
: <MyDiv loading={isCipher(changeField, 'taxAmount')} />
|
|
598
|
+
);
|
|
549
599
|
} else {
|
|
550
600
|
return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : value === '' ? '' : parseFloat(value).toFixed(2)}</span>;
|
|
551
601
|
}
|