kts-component-invoice-operate 3.2.266 → 3.2.268
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -10772,6 +10772,18 @@ var onChangeTaxAmount = lazyFn(function (controller, form, record) {
|
|
|
10772
10772
|
return _context23.abrupt("return");
|
|
10773
10773
|
|
|
10774
10774
|
case 6:
|
|
10775
|
+
if (!(err.taxRate && !(record === null || record === void 0 ? void 0 : record.taxRate) && (record === null || record === void 0 ? void 0 : record.taxRate) !== 0)) {
|
|
10776
|
+
_context23.next = 10;
|
|
10777
|
+
break;
|
|
10778
|
+
}
|
|
10779
|
+
|
|
10780
|
+
_context23.next = 9;
|
|
10781
|
+
return clearCalculatingField(controller);
|
|
10782
|
+
|
|
10783
|
+
case 9:
|
|
10784
|
+
return _context23.abrupt("return");
|
|
10785
|
+
|
|
10786
|
+
case 10:
|
|
10775
10787
|
// 计数不含税金额
|
|
10776
10788
|
// lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
|
|
10777
10789
|
// form.setFieldsValue({ lineAmountExcludeTax });
|
|
@@ -10783,17 +10795,17 @@ var onChangeTaxAmount = lazyFn(function (controller, form, record) {
|
|
|
10783
10795
|
form.setFieldsValue({
|
|
10784
10796
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
10785
10797
|
});
|
|
10786
|
-
_context23.next =
|
|
10798
|
+
_context23.next = 14;
|
|
10787
10799
|
return controller.setEditGood({
|
|
10788
10800
|
taxAmount: values.taxAmount,
|
|
10789
10801
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
10790
10802
|
});
|
|
10791
10803
|
|
|
10792
|
-
case
|
|
10793
|
-
_context23.next =
|
|
10804
|
+
case 14:
|
|
10805
|
+
_context23.next = 16;
|
|
10794
10806
|
return clearCalculatingField(controller);
|
|
10795
10807
|
|
|
10796
|
-
case
|
|
10808
|
+
case 16:
|
|
10797
10809
|
case "end":
|
|
10798
10810
|
return _context23.stop();
|
|
10799
10811
|
}
|
|
@@ -11099,12 +11111,16 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11099
11111
|
// 含税
|
|
11100
11112
|
var lineAmountIncludeTax = (form === null || form === void 0 ? void 0 : form.getFieldValue('lineAmountIncludeTax')) || 0; //含税金额
|
|
11101
11113
|
|
|
11114
|
+
var deduction = invoiceController.state.goodsListState.deduction || 0;
|
|
11102
11115
|
var taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
|
|
11103
11116
|
|
|
11104
|
-
var taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
11117
|
+
var taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
11105
11118
|
|
|
11106
11119
|
var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
11107
11120
|
|
|
11121
|
+
var quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
|
|
11122
|
+
var priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
11123
|
+
|
|
11108
11124
|
form === null || form === void 0 ? void 0 : form.setFieldsValue({
|
|
11109
11125
|
taxAmount: taxAmount,
|
|
11110
11126
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
@@ -11117,7 +11133,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11117
11133
|
case 0:
|
|
11118
11134
|
s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
|
|
11119
11135
|
taxAmount: taxAmount,
|
|
11120
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
11136
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
11137
|
+
priceExcludeTax: priceExcludeTax || undefined
|
|
11121
11138
|
});
|
|
11122
11139
|
|
|
11123
11140
|
case 1:
|
|
@@ -11136,15 +11153,22 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11136
11153
|
// 不含税
|
|
11137
11154
|
var _lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
|
|
11138
11155
|
|
|
11156
|
+
var _deduction = invoiceController.state.goodsListState.deduction || 0;
|
|
11157
|
+
|
|
11139
11158
|
var _taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
|
|
11140
11159
|
|
|
11141
11160
|
|
|
11142
|
-
var _taxAmount = countTaxAmount(_lineAmountIncludeTax,
|
|
11161
|
+
var _taxAmount = countTaxAmount(_lineAmountIncludeTax, _deduction, _taxRate) || 0; //税额
|
|
11143
11162
|
|
|
11144
11163
|
|
|
11145
11164
|
var _lineAmountExcludeTax = countAmountExcludeTax(_lineAmountIncludeTax, _taxAmount) || 0; // 不含税金额
|
|
11146
11165
|
|
|
11147
11166
|
|
|
11167
|
+
var _quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
|
|
11168
|
+
|
|
11169
|
+
var _priceExcludeTax = _quantity > 0 ? countPrice(_lineAmountExcludeTax, _quantity) : undefined; // 不含税单价
|
|
11170
|
+
|
|
11171
|
+
|
|
11148
11172
|
form === null || form === void 0 ? void 0 : form.setFieldsValue({
|
|
11149
11173
|
taxAmount: _taxAmount,
|
|
11150
11174
|
lineAmountExcludeTax: _lineAmountExcludeTax
|
|
@@ -11157,7 +11181,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11157
11181
|
case 0:
|
|
11158
11182
|
s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
|
|
11159
11183
|
taxAmount: _taxAmount,
|
|
11160
|
-
lineAmountExcludeTax: _lineAmountExcludeTax
|
|
11184
|
+
lineAmountExcludeTax: _lineAmountExcludeTax,
|
|
11185
|
+
priceExcludeTax: _priceExcludeTax || undefined
|
|
11161
11186
|
});
|
|
11162
11187
|
|
|
11163
11188
|
case 1:
|
|
@@ -11176,7 +11201,7 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11176
11201
|
} else {
|
|
11177
11202
|
invoiceController.run( /*#__PURE__*/function () {
|
|
11178
11203
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
|
|
11179
|
-
var good, lineAmountIncludeTax, taxRate, taxAmount, lineAmountExcludeTax;
|
|
11204
|
+
var good, lineAmountIncludeTax, deduction, taxRate, taxAmount, lineAmountExcludeTax, quantity, priceExcludeTax;
|
|
11180
11205
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
11181
11206
|
while (1) {
|
|
11182
11207
|
switch (_context3.prev = _context3.next) {
|
|
@@ -11192,17 +11217,23 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11192
11217
|
|
|
11193
11218
|
case 3:
|
|
11194
11219
|
lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
|
|
11220
|
+
deduction = invoiceController.state.goodsListState.deduction || 0;
|
|
11195
11221
|
taxRate = good.taxRate || 0;
|
|
11196
|
-
taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
11222
|
+
taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
11197
11223
|
|
|
11198
11224
|
lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
11199
11225
|
|
|
11226
|
+
quantity = good.quantity || 0;
|
|
11227
|
+
priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
11228
|
+
|
|
11200
11229
|
s.goodsListState.goodsList[0] = _objectSpread2(_objectSpread2({}, good), {}, {
|
|
11201
11230
|
taxAmount: taxAmount,
|
|
11202
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
11231
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
11232
|
+
priceExcludeTax: priceExcludeTax || undefined
|
|
11203
11233
|
});
|
|
11234
|
+
s.goodsListState.goodsList = _toConsumableArray(s.goodsListState.goodsList);
|
|
11204
11235
|
|
|
11205
|
-
case
|
|
11236
|
+
case 12:
|
|
11206
11237
|
case "end":
|
|
11207
11238
|
return _context3.stop();
|
|
11208
11239
|
}
|
|
@@ -34006,6 +34037,7 @@ var DrawerBody$4 = function DrawerBody(props) {
|
|
|
34006
34037
|
|
|
34007
34038
|
|
|
34008
34039
|
var onSubmit = React.useCallback(function (values) {
|
|
34040
|
+
console.log('天开组件', '点击了赋码确定按钮 ===>', values);
|
|
34009
34041
|
controller.pipeline( /*#__PURE__*/function () {
|
|
34010
34042
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
|
|
34011
34043
|
var endowCodeGood;
|
|
@@ -34013,8 +34045,11 @@ var DrawerBody$4 = function DrawerBody(props) {
|
|
|
34013
34045
|
while (1) {
|
|
34014
34046
|
switch (_context15.prev = _context15.next) {
|
|
34015
34047
|
case 0:
|
|
34048
|
+
// const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
|
|
34016
34049
|
endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
|
|
34017
|
-
return s.goodsListState.
|
|
34050
|
+
return s.goodsListState.goodsList.find(function (item) {
|
|
34051
|
+
return item.$index === e;
|
|
34052
|
+
});
|
|
34018
34053
|
}); // 赋码
|
|
34019
34054
|
|
|
34020
34055
|
endowCodeGood.forEach(function (good) {
|
|
@@ -34028,7 +34063,7 @@ var DrawerBody$4 = function DrawerBody(props) {
|
|
|
34028
34063
|
good.mtzlDm = undefined; //设置成空
|
|
34029
34064
|
// 无论是否含税,都保持价税合计不变
|
|
34030
34065
|
|
|
34031
|
-
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
34066
|
+
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction || 0, values.taxRate);
|
|
34032
34067
|
|
|
34033
34068
|
if (good.taxAmount || good.taxAmount === 0) {
|
|
34034
34069
|
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
package/dist/index.js
CHANGED
|
@@ -10782,6 +10782,18 @@ var onChangeTaxAmount = lazyFn(function (controller, form, record) {
|
|
|
10782
10782
|
return _context23.abrupt("return");
|
|
10783
10783
|
|
|
10784
10784
|
case 6:
|
|
10785
|
+
if (!(err.taxRate && !(record === null || record === void 0 ? void 0 : record.taxRate) && (record === null || record === void 0 ? void 0 : record.taxRate) !== 0)) {
|
|
10786
|
+
_context23.next = 10;
|
|
10787
|
+
break;
|
|
10788
|
+
}
|
|
10789
|
+
|
|
10790
|
+
_context23.next = 9;
|
|
10791
|
+
return clearCalculatingField(controller);
|
|
10792
|
+
|
|
10793
|
+
case 9:
|
|
10794
|
+
return _context23.abrupt("return");
|
|
10795
|
+
|
|
10796
|
+
case 10:
|
|
10785
10797
|
// 计数不含税金额
|
|
10786
10798
|
// lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
|
|
10787
10799
|
// form.setFieldsValue({ lineAmountExcludeTax });
|
|
@@ -10793,17 +10805,17 @@ var onChangeTaxAmount = lazyFn(function (controller, form, record) {
|
|
|
10793
10805
|
form.setFieldsValue({
|
|
10794
10806
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
10795
10807
|
});
|
|
10796
|
-
_context23.next =
|
|
10808
|
+
_context23.next = 14;
|
|
10797
10809
|
return controller.setEditGood({
|
|
10798
10810
|
taxAmount: values.taxAmount,
|
|
10799
10811
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
10800
10812
|
});
|
|
10801
10813
|
|
|
10802
|
-
case
|
|
10803
|
-
_context23.next =
|
|
10814
|
+
case 14:
|
|
10815
|
+
_context23.next = 16;
|
|
10804
10816
|
return clearCalculatingField(controller);
|
|
10805
10817
|
|
|
10806
|
-
case
|
|
10818
|
+
case 16:
|
|
10807
10819
|
case "end":
|
|
10808
10820
|
return _context23.stop();
|
|
10809
10821
|
}
|
|
@@ -11109,12 +11121,16 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11109
11121
|
// 含税
|
|
11110
11122
|
var lineAmountIncludeTax = (form === null || form === void 0 ? void 0 : form.getFieldValue('lineAmountIncludeTax')) || 0; //含税金额
|
|
11111
11123
|
|
|
11124
|
+
var deduction = invoiceController.state.goodsListState.deduction || 0;
|
|
11112
11125
|
var taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
|
|
11113
11126
|
|
|
11114
|
-
var taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
11127
|
+
var taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
11115
11128
|
|
|
11116
11129
|
var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
11117
11130
|
|
|
11131
|
+
var quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
|
|
11132
|
+
var priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
11133
|
+
|
|
11118
11134
|
form === null || form === void 0 ? void 0 : form.setFieldsValue({
|
|
11119
11135
|
taxAmount: taxAmount,
|
|
11120
11136
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
@@ -11127,7 +11143,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11127
11143
|
case 0:
|
|
11128
11144
|
s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
|
|
11129
11145
|
taxAmount: taxAmount,
|
|
11130
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
11146
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
11147
|
+
priceExcludeTax: priceExcludeTax || undefined
|
|
11131
11148
|
});
|
|
11132
11149
|
|
|
11133
11150
|
case 1:
|
|
@@ -11146,15 +11163,22 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11146
11163
|
// 不含税
|
|
11147
11164
|
var _lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
|
|
11148
11165
|
|
|
11166
|
+
var _deduction = invoiceController.state.goodsListState.deduction || 0;
|
|
11167
|
+
|
|
11149
11168
|
var _taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
|
|
11150
11169
|
|
|
11151
11170
|
|
|
11152
|
-
var _taxAmount = countTaxAmount(_lineAmountIncludeTax,
|
|
11171
|
+
var _taxAmount = countTaxAmount(_lineAmountIncludeTax, _deduction, _taxRate) || 0; //税额
|
|
11153
11172
|
|
|
11154
11173
|
|
|
11155
11174
|
var _lineAmountExcludeTax = countAmountExcludeTax(_lineAmountIncludeTax, _taxAmount) || 0; // 不含税金额
|
|
11156
11175
|
|
|
11157
11176
|
|
|
11177
|
+
var _quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
|
|
11178
|
+
|
|
11179
|
+
var _priceExcludeTax = _quantity > 0 ? countPrice(_lineAmountExcludeTax, _quantity) : undefined; // 不含税单价
|
|
11180
|
+
|
|
11181
|
+
|
|
11158
11182
|
form === null || form === void 0 ? void 0 : form.setFieldsValue({
|
|
11159
11183
|
taxAmount: _taxAmount,
|
|
11160
11184
|
lineAmountExcludeTax: _lineAmountExcludeTax
|
|
@@ -11167,7 +11191,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11167
11191
|
case 0:
|
|
11168
11192
|
s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
|
|
11169
11193
|
taxAmount: _taxAmount,
|
|
11170
|
-
lineAmountExcludeTax: _lineAmountExcludeTax
|
|
11194
|
+
lineAmountExcludeTax: _lineAmountExcludeTax,
|
|
11195
|
+
priceExcludeTax: _priceExcludeTax || undefined
|
|
11171
11196
|
});
|
|
11172
11197
|
|
|
11173
11198
|
case 1:
|
|
@@ -11186,7 +11211,7 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11186
11211
|
} else {
|
|
11187
11212
|
invoiceController.run( /*#__PURE__*/function () {
|
|
11188
11213
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
|
|
11189
|
-
var good, lineAmountIncludeTax, taxRate, taxAmount, lineAmountExcludeTax;
|
|
11214
|
+
var good, lineAmountIncludeTax, deduction, taxRate, taxAmount, lineAmountExcludeTax, quantity, priceExcludeTax;
|
|
11190
11215
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
11191
11216
|
while (1) {
|
|
11192
11217
|
switch (_context3.prev = _context3.next) {
|
|
@@ -11202,17 +11227,23 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
|
|
|
11202
11227
|
|
|
11203
11228
|
case 3:
|
|
11204
11229
|
lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
|
|
11230
|
+
deduction = invoiceController.state.goodsListState.deduction || 0;
|
|
11205
11231
|
taxRate = good.taxRate || 0;
|
|
11206
|
-
taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
11232
|
+
taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
11207
11233
|
|
|
11208
11234
|
lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
11209
11235
|
|
|
11236
|
+
quantity = good.quantity || 0;
|
|
11237
|
+
priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
11238
|
+
|
|
11210
11239
|
s.goodsListState.goodsList[0] = _objectSpread2(_objectSpread2({}, good), {}, {
|
|
11211
11240
|
taxAmount: taxAmount,
|
|
11212
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
11241
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
11242
|
+
priceExcludeTax: priceExcludeTax || undefined
|
|
11213
11243
|
});
|
|
11244
|
+
s.goodsListState.goodsList = _toConsumableArray(s.goodsListState.goodsList);
|
|
11214
11245
|
|
|
11215
|
-
case
|
|
11246
|
+
case 12:
|
|
11216
11247
|
case "end":
|
|
11217
11248
|
return _context3.stop();
|
|
11218
11249
|
}
|
|
@@ -34016,6 +34047,7 @@ var DrawerBody$4 = function DrawerBody(props) {
|
|
|
34016
34047
|
|
|
34017
34048
|
|
|
34018
34049
|
var onSubmit = React__default['default'].useCallback(function (values) {
|
|
34050
|
+
console.log('天开组件', '点击了赋码确定按钮 ===>', values);
|
|
34019
34051
|
controller.pipeline( /*#__PURE__*/function () {
|
|
34020
34052
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
|
|
34021
34053
|
var endowCodeGood;
|
|
@@ -34023,8 +34055,11 @@ var DrawerBody$4 = function DrawerBody(props) {
|
|
|
34023
34055
|
while (1) {
|
|
34024
34056
|
switch (_context15.prev = _context15.next) {
|
|
34025
34057
|
case 0:
|
|
34058
|
+
// const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
|
|
34026
34059
|
endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
|
|
34027
|
-
return s.goodsListState.
|
|
34060
|
+
return s.goodsListState.goodsList.find(function (item) {
|
|
34061
|
+
return item.$index === e;
|
|
34062
|
+
});
|
|
34028
34063
|
}); // 赋码
|
|
34029
34064
|
|
|
34030
34065
|
endowCodeGood.forEach(function (good) {
|
|
@@ -34038,7 +34073,7 @@ var DrawerBody$4 = function DrawerBody(props) {
|
|
|
34038
34073
|
good.mtzlDm = undefined; //设置成空
|
|
34039
34074
|
// 无论是否含税,都保持价税合计不变
|
|
34040
34075
|
|
|
34041
|
-
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
34076
|
+
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction || 0, values.taxRate);
|
|
34042
34077
|
|
|
34043
34078
|
if (good.taxAmount || good.taxAmount === 0) {
|
|
34044
34079
|
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import InvoiceController from "../";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { chain, bignumber } from 'mathjs';
|
|
4
|
-
import { countAmountExcludeTax, countTaxAmount } from "../../tools/calculate";
|
|
4
|
+
import { countAmountExcludeTax, countTaxAmount, countPrice } from "../../tools/calculate";
|
|
5
5
|
|
|
6
6
|
/** 切换是否启用差额开票重新计算税额 */
|
|
7
7
|
export const useRecalculateTax = (invoiceController: InvoiceController) => {
|
|
@@ -15,9 +15,12 @@ export const useRecalculateTax = (invoiceController: InvoiceController) => {
|
|
|
15
15
|
if (isTaxIncluded) {
|
|
16
16
|
// 含税
|
|
17
17
|
const lineAmountIncludeTax = form?.getFieldValue('lineAmountIncludeTax') || 0; //含税金额
|
|
18
|
+
const deduction = invoiceController.state.goodsListState.deduction || 0
|
|
18
19
|
const taxRate = form?.getFieldValue('taxRate') || 0; //税率
|
|
19
|
-
const taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
20
|
+
const taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
20
21
|
const lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
22
|
+
const quantity = form?.getFieldValue('quantity') || 0;
|
|
23
|
+
const priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
21
24
|
|
|
22
25
|
form?.setFieldsValue({ taxAmount, lineAmountExcludeTax });
|
|
23
26
|
invoiceController.run(async s => {
|
|
@@ -25,14 +28,18 @@ export const useRecalculateTax = (invoiceController: InvoiceController) => {
|
|
|
25
28
|
...editGood,
|
|
26
29
|
taxAmount,
|
|
27
30
|
lineAmountExcludeTax,
|
|
31
|
+
priceExcludeTax: priceExcludeTax || undefined,
|
|
28
32
|
};
|
|
29
|
-
})
|
|
33
|
+
})
|
|
30
34
|
} else {
|
|
31
35
|
// 不含税
|
|
32
36
|
const lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
|
|
37
|
+
const deduction = invoiceController.state.goodsListState.deduction || 0
|
|
33
38
|
const taxRate = form?.getFieldValue('taxRate') || 0; //税率
|
|
34
|
-
const taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
39
|
+
const taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
35
40
|
const lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
41
|
+
const quantity = form?.getFieldValue('quantity') || 0;
|
|
42
|
+
const priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
36
43
|
|
|
37
44
|
form?.setFieldsValue({ taxAmount, lineAmountExcludeTax });
|
|
38
45
|
invoiceController.run(async s => {
|
|
@@ -40,6 +47,7 @@ export const useRecalculateTax = (invoiceController: InvoiceController) => {
|
|
|
40
47
|
...editGood,
|
|
41
48
|
taxAmount,
|
|
42
49
|
lineAmountExcludeTax,
|
|
50
|
+
priceExcludeTax: priceExcludeTax || undefined,
|
|
43
51
|
};
|
|
44
52
|
})
|
|
45
53
|
}
|
|
@@ -48,15 +56,20 @@ export const useRecalculateTax = (invoiceController: InvoiceController) => {
|
|
|
48
56
|
const good = s.goodsListState.goodsList[0];
|
|
49
57
|
if (!good) return;
|
|
50
58
|
const lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
|
|
59
|
+
const deduction = invoiceController.state.goodsListState.deduction || 0
|
|
51
60
|
const taxRate = good.taxRate || 0;
|
|
52
|
-
const taxAmount = countTaxAmount(lineAmountIncludeTax,
|
|
61
|
+
const taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
|
|
53
62
|
const lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
|
|
63
|
+
const quantity = good.quantity || 0;
|
|
64
|
+
const priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
|
|
54
65
|
|
|
55
66
|
s.goodsListState.goodsList[0] = {
|
|
56
67
|
...good,
|
|
57
68
|
taxAmount,
|
|
58
69
|
lineAmountExcludeTax,
|
|
70
|
+
priceExcludeTax: priceExcludeTax || undefined,
|
|
59
71
|
};
|
|
72
|
+
s.goodsListState.goodsList = [...s.goodsListState.goodsList]
|
|
60
73
|
})
|
|
61
74
|
}
|
|
62
75
|
}, [differenceInputEnabled]);
|
|
@@ -472,9 +472,11 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
472
472
|
|
|
473
473
|
// 确定
|
|
474
474
|
const onSubmit = React.useCallback(values => {
|
|
475
|
+
console.log('天开组件', '点击了赋码确定按钮 ===>', values)
|
|
475
476
|
controller.pipeline(async s => {
|
|
476
477
|
|
|
477
|
-
const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
|
|
478
|
+
// const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
|
|
479
|
+
const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsList.find(item => item.$index === e));
|
|
478
480
|
|
|
479
481
|
// 赋码
|
|
480
482
|
endowCodeGood.forEach(good => {
|
|
@@ -489,7 +491,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
489
491
|
good.mtzlDm = undefined; //设置成空
|
|
490
492
|
|
|
491
493
|
// 无论是否含税,都保持价税合计不变
|
|
492
|
-
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
494
|
+
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction || 0, values.taxRate);
|
|
493
495
|
if (good.taxAmount || good.taxAmount === 0) {
|
|
494
496
|
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
|
495
497
|
}
|
|
@@ -669,6 +669,12 @@ export const onChangeTaxAmount = lazyFn(
|
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
+
// 校验是否有税率
|
|
673
|
+
if (err.taxRate && (!record?.taxRate && record?.taxRate !== 0)) {
|
|
674
|
+
await clearCalculatingField(controller);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
|
|
672
678
|
// 计数不含税金额
|
|
673
679
|
// lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
|
|
674
680
|
// form.setFieldsValue({ lineAmountExcludeTax });
|