kts-component-invoice-operate 3.2.245 → 3.2.247
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 +125 -8
- package/dist/index.js +125 -8
- 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 +59 -6
- 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,7 +14763,7 @@ 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',
|
|
@@ -14692,12 +14771,50 @@ var useColumns = (function (form) {
|
|
|
14692
14771
|
width: 119,
|
|
14693
14772
|
render: function render(value, record) {
|
|
14694
14773
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
14695
|
-
return getFieldDecorator('taxAmount', {
|
|
14774
|
+
return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('taxAmount', {
|
|
14696
14775
|
initialValue: editGood.taxAmount,
|
|
14697
|
-
rules: getReplenishRules('taxAmount')
|
|
14698
|
-
|
|
14776
|
+
// rules: getReplenishRules('taxAmount'),
|
|
14777
|
+
rules: [].concat(_toConsumableArray(getReplenishRules('taxAmount')), [{
|
|
14778
|
+
required: isEnables('taxAmount'),
|
|
14779
|
+
message: '税额不能为空'
|
|
14780
|
+
}, {
|
|
14781
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
14782
|
+
message: '税额必须为数字'
|
|
14783
|
+
}, {
|
|
14784
|
+
validator: function validator(rule, value, callback) {
|
|
14785
|
+
//含税金额
|
|
14786
|
+
var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
|
|
14787
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
14788
|
+
|
|
14789
|
+
var lineAmountExcludeTax = chain$1(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
|
|
14790
|
+
var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
|
|
14791
|
+
|
|
14792
|
+
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
14793
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
14794
|
+
var total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
14795
|
+
|
|
14796
|
+
if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
14797
|
+
callback();
|
|
14798
|
+
} else {
|
|
14799
|
+
callback('税额填写错误,请重新输入');
|
|
14800
|
+
}
|
|
14801
|
+
} else {
|
|
14802
|
+
callback();
|
|
14803
|
+
}
|
|
14804
|
+
}
|
|
14805
|
+
}])
|
|
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 {
|
|
14702
14819
|
return /*#__PURE__*/React.createElement("span", {
|
|
14703
14820
|
style: {
|
|
@@ -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,7 +14773,7 @@ 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',
|
|
@@ -14702,12 +14781,50 @@ var useColumns = (function (form) {
|
|
|
14702
14781
|
width: 119,
|
|
14703
14782
|
render: function render(value, record) {
|
|
14704
14783
|
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
14705
|
-
return getFieldDecorator('taxAmount', {
|
|
14784
|
+
return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('taxAmount', {
|
|
14706
14785
|
initialValue: editGood.taxAmount,
|
|
14707
|
-
rules: getReplenishRules('taxAmount')
|
|
14708
|
-
|
|
14786
|
+
// rules: getReplenishRules('taxAmount'),
|
|
14787
|
+
rules: [].concat(_toConsumableArray(getReplenishRules('taxAmount')), [{
|
|
14788
|
+
required: isEnables('taxAmount'),
|
|
14789
|
+
message: '税额不能为空'
|
|
14790
|
+
}, {
|
|
14791
|
+
pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
|
|
14792
|
+
message: '税额必须为数字'
|
|
14793
|
+
}, {
|
|
14794
|
+
validator: function validator(rule, value, callback) {
|
|
14795
|
+
//含税金额
|
|
14796
|
+
var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
|
|
14797
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
14798
|
+
|
|
14799
|
+
var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(lineAmountIncludeTax || 0)).subtract(mathjs.bignumber(value || 0));
|
|
14800
|
+
var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
|
|
14801
|
+
|
|
14802
|
+
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
14803
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
14804
|
+
var total = lineAmountExcludeTax.multiply(mathjs.bignumber(taxRate || 0)).divide(mathjs.bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
14805
|
+
|
|
14806
|
+
if (Math.abs(total.subtract(mathjs.bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
14807
|
+
callback();
|
|
14808
|
+
} else {
|
|
14809
|
+
callback('税额填写错误,请重新输入');
|
|
14810
|
+
}
|
|
14811
|
+
} else {
|
|
14812
|
+
callback();
|
|
14813
|
+
}
|
|
14814
|
+
}
|
|
14815
|
+
}])
|
|
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 {
|
|
14712
14829
|
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
14713
14830
|
style: {
|
|
@@ -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,11 +18,13 @@ 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';
|
|
23
25
|
import { nonScientificNotation } from '../../../../../tools/calculate';
|
|
24
26
|
import Expand from './ui/Expand';
|
|
27
|
+
import { render } from 'react-dom';
|
|
25
28
|
|
|
26
29
|
export default (form: WrappedFormUtils) => {
|
|
27
30
|
const { getFieldDecorator, getFieldValue } = form;
|
|
@@ -60,12 +63,21 @@ export default (form: WrappedFormUtils) => {
|
|
|
60
63
|
/** 税率列表 */
|
|
61
64
|
const taxRateList = controller.useMemo((e) => e.goodsListState.taxRateList, []);
|
|
62
65
|
|
|
66
|
+
/** 启用字段 */
|
|
67
|
+
const enables = controller.useMemo(s => s.stakeholder.enables || [], []);
|
|
68
|
+
|
|
63
69
|
/** 单位列表 */
|
|
64
70
|
const unitList = controller.useMemo((e) => e.goodsListState.unitList, []);
|
|
65
71
|
|
|
66
72
|
/** 商品表格补充配置 */
|
|
67
73
|
const columnsReplenish = controller.useMemo((e) => e.goodsListState.columnsReplenish, []);
|
|
68
74
|
|
|
75
|
+
/** 是否校验商品 */
|
|
76
|
+
const isValidateGood = controller.useMemo(s => s.goodsListState.isValidateGood, [])
|
|
77
|
+
|
|
78
|
+
/** 是否启用 */
|
|
79
|
+
const isEnables = React.useCallback(field => enables.indexOf(field) >= 0, [enables])
|
|
80
|
+
|
|
69
81
|
/** 扣除额 */
|
|
70
82
|
const deduction = controller.useMemo((e) => e.goodsListState.deduction, []);
|
|
71
83
|
|
|
@@ -299,6 +311,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
299
311
|
onChange={async () => {
|
|
300
312
|
setChangeField('quantity');
|
|
301
313
|
await onChangeQuantity(controller, form, record);
|
|
314
|
+
onChangeTaxAmount(controller, form, record);
|
|
302
315
|
}}
|
|
303
316
|
/>,
|
|
304
317
|
)}
|
|
@@ -535,17 +548,58 @@ export default (form: WrappedFormUtils) => {
|
|
|
535
548
|
},
|
|
536
549
|
},
|
|
537
550
|
{
|
|
538
|
-
title: <TitleText
|
|
551
|
+
title: <TitleText required={isEnables('taxAmount')} >税额</TitleText>,
|
|
539
552
|
dataIndex: 'taxAmount',
|
|
540
553
|
key: 'taxAmount',
|
|
541
554
|
align: 'right',
|
|
542
555
|
width: 119,
|
|
556
|
+
|
|
543
557
|
render: (value: string, record: IGood) => {
|
|
544
558
|
if (editGood?.$index === record.$index) {
|
|
545
|
-
return
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
559
|
+
return <Form.Item>
|
|
560
|
+
{getFieldDecorator('taxAmount', {
|
|
561
|
+
initialValue: editGood.taxAmount,
|
|
562
|
+
// rules: getReplenishRules('taxAmount'),
|
|
563
|
+
rules: [
|
|
564
|
+
...getReplenishRules('taxAmount'),
|
|
565
|
+
{ required: isEnables('taxAmount'), message: '税额不能为空' },
|
|
566
|
+
{ pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '税额必须为数字' },
|
|
567
|
+
{
|
|
568
|
+
validator: (rule: any, value: any, callback: any) => {
|
|
569
|
+
//含税金额
|
|
570
|
+
const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
|
|
571
|
+
//不含税金额
|
|
572
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
573
|
+
const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
|
|
574
|
+
const taxRate = editGood?.taxRate;
|
|
575
|
+
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
576
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
577
|
+
const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
|
|
578
|
+
// if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
579
|
+
if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
580
|
+
callback();
|
|
581
|
+
} else {
|
|
582
|
+
callback('税额填写错误,请重新输入')
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
callback();
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
})(
|
|
591
|
+
isEnables('taxAmount')
|
|
592
|
+
? <MyInput
|
|
593
|
+
style={{ textAlign: 'right' }}
|
|
594
|
+
loading={isCipher(changeField, 'taxAmount')}
|
|
595
|
+
onChange={() => {
|
|
596
|
+
setChangeField('taxAmount');
|
|
597
|
+
onChangeTaxAmount(controller, form, record);
|
|
598
|
+
}}
|
|
599
|
+
/>
|
|
600
|
+
: <MyDiv loading={isCipher(changeField, 'taxAmount')} />
|
|
601
|
+
)}
|
|
602
|
+
</Form.Item>
|
|
549
603
|
} else {
|
|
550
604
|
return <span style={{ padding: '0 10px' }}>{isDutyFree(record) ? '***' : value === '' ? '' : parseFloat(value).toFixed(2)}</span>;
|
|
551
605
|
}
|
|
@@ -578,7 +632,6 @@ export default (form: WrappedFormUtils) => {
|
|
|
578
632
|
dataIndex: 'remarks',
|
|
579
633
|
key: 'remarks',
|
|
580
634
|
width: 150,
|
|
581
|
-
|
|
582
635
|
},
|
|
583
636
|
{
|
|
584
637
|
title: '操作',
|