kts-component-invoice-operate 3.2.266 → 3.2.267

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
@@ -11099,12 +11099,16 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11099
11099
  // 含税
11100
11100
  var lineAmountIncludeTax = (form === null || form === void 0 ? void 0 : form.getFieldValue('lineAmountIncludeTax')) || 0; //含税金额
11101
11101
 
11102
+ var deduction = invoiceController.state.goodsListState.deduction || 0;
11102
11103
  var taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11103
11104
 
11104
- var taxAmount = countTaxAmount(lineAmountIncludeTax, 0, taxRate) || 0; //税额
11105
+ var taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
11105
11106
 
11106
11107
  var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11107
11108
 
11109
+ var quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
11110
+ var priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
11111
+
11108
11112
  form === null || form === void 0 ? void 0 : form.setFieldsValue({
11109
11113
  taxAmount: taxAmount,
11110
11114
  lineAmountExcludeTax: lineAmountExcludeTax
@@ -11117,7 +11121,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11117
11121
  case 0:
11118
11122
  s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11119
11123
  taxAmount: taxAmount,
11120
- lineAmountExcludeTax: lineAmountExcludeTax
11124
+ lineAmountExcludeTax: lineAmountExcludeTax,
11125
+ priceExcludeTax: priceExcludeTax || undefined
11121
11126
  });
11122
11127
 
11123
11128
  case 1:
@@ -11136,15 +11141,22 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11136
11141
  // 不含税
11137
11142
  var _lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
11138
11143
 
11144
+ var _deduction = invoiceController.state.goodsListState.deduction || 0;
11145
+
11139
11146
  var _taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11140
11147
 
11141
11148
 
11142
- var _taxAmount = countTaxAmount(_lineAmountIncludeTax, 0, _taxRate) || 0; //税额
11149
+ var _taxAmount = countTaxAmount(_lineAmountIncludeTax, _deduction, _taxRate) || 0; //税额
11143
11150
 
11144
11151
 
11145
11152
  var _lineAmountExcludeTax = countAmountExcludeTax(_lineAmountIncludeTax, _taxAmount) || 0; // 不含税金额
11146
11153
 
11147
11154
 
11155
+ var _quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
11156
+
11157
+ var _priceExcludeTax = _quantity > 0 ? countPrice(_lineAmountExcludeTax, _quantity) : undefined; // 不含税单价
11158
+
11159
+
11148
11160
  form === null || form === void 0 ? void 0 : form.setFieldsValue({
11149
11161
  taxAmount: _taxAmount,
11150
11162
  lineAmountExcludeTax: _lineAmountExcludeTax
@@ -11157,7 +11169,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11157
11169
  case 0:
11158
11170
  s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11159
11171
  taxAmount: _taxAmount,
11160
- lineAmountExcludeTax: _lineAmountExcludeTax
11172
+ lineAmountExcludeTax: _lineAmountExcludeTax,
11173
+ priceExcludeTax: _priceExcludeTax || undefined
11161
11174
  });
11162
11175
 
11163
11176
  case 1:
@@ -11176,7 +11189,7 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11176
11189
  } else {
11177
11190
  invoiceController.run( /*#__PURE__*/function () {
11178
11191
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
11179
- var good, lineAmountIncludeTax, taxRate, taxAmount, lineAmountExcludeTax;
11192
+ var good, lineAmountIncludeTax, deduction, taxRate, taxAmount, lineAmountExcludeTax, quantity, priceExcludeTax;
11180
11193
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11181
11194
  while (1) {
11182
11195
  switch (_context3.prev = _context3.next) {
@@ -11192,17 +11205,23 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11192
11205
 
11193
11206
  case 3:
11194
11207
  lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
11208
+ deduction = invoiceController.state.goodsListState.deduction || 0;
11195
11209
  taxRate = good.taxRate || 0;
11196
- taxAmount = countTaxAmount(lineAmountIncludeTax, 0, taxRate) || 0; //税额
11210
+ taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
11197
11211
 
11198
11212
  lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11199
11213
 
11214
+ quantity = good.quantity || 0;
11215
+ priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
11216
+
11200
11217
  s.goodsListState.goodsList[0] = _objectSpread2(_objectSpread2({}, good), {}, {
11201
11218
  taxAmount: taxAmount,
11202
- lineAmountExcludeTax: lineAmountExcludeTax
11219
+ lineAmountExcludeTax: lineAmountExcludeTax,
11220
+ priceExcludeTax: priceExcludeTax || undefined
11203
11221
  });
11222
+ s.goodsListState.goodsList = _toConsumableArray(s.goodsListState.goodsList);
11204
11223
 
11205
- case 8:
11224
+ case 12:
11206
11225
  case "end":
11207
11226
  return _context3.stop();
11208
11227
  }
@@ -34006,6 +34025,7 @@ var DrawerBody$4 = function DrawerBody(props) {
34006
34025
 
34007
34026
 
34008
34027
  var onSubmit = React.useCallback(function (values) {
34028
+ console.log('天开组件', '点击了赋码确定按钮 ===>', values);
34009
34029
  controller.pipeline( /*#__PURE__*/function () {
34010
34030
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
34011
34031
  var endowCodeGood;
@@ -34013,8 +34033,11 @@ var DrawerBody$4 = function DrawerBody(props) {
34013
34033
  while (1) {
34014
34034
  switch (_context15.prev = _context15.next) {
34015
34035
  case 0:
34036
+ // const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
34016
34037
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
34017
- return s.goodsListState.goodsMap.get(e);
34038
+ return s.goodsListState.goodsList.find(function (item) {
34039
+ return item.$index === e;
34040
+ });
34018
34041
  }); // 赋码
34019
34042
 
34020
34043
  endowCodeGood.forEach(function (good) {
@@ -34028,7 +34051,7 @@ var DrawerBody$4 = function DrawerBody(props) {
34028
34051
  good.mtzlDm = undefined; //设置成空
34029
34052
  // 无论是否含税,都保持价税合计不变
34030
34053
 
34031
- good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
34054
+ good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction || 0, values.taxRate);
34032
34055
 
34033
34056
  if (good.taxAmount || good.taxAmount === 0) {
34034
34057
  good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
package/dist/index.js CHANGED
@@ -11109,12 +11109,16 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11109
11109
  // 含税
11110
11110
  var lineAmountIncludeTax = (form === null || form === void 0 ? void 0 : form.getFieldValue('lineAmountIncludeTax')) || 0; //含税金额
11111
11111
 
11112
+ var deduction = invoiceController.state.goodsListState.deduction || 0;
11112
11113
  var taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11113
11114
 
11114
- var taxAmount = countTaxAmount(lineAmountIncludeTax, 0, taxRate) || 0; //税额
11115
+ var taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
11115
11116
 
11116
11117
  var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11117
11118
 
11119
+ var quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
11120
+ var priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
11121
+
11118
11122
  form === null || form === void 0 ? void 0 : form.setFieldsValue({
11119
11123
  taxAmount: taxAmount,
11120
11124
  lineAmountExcludeTax: lineAmountExcludeTax
@@ -11127,7 +11131,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11127
11131
  case 0:
11128
11132
  s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11129
11133
  taxAmount: taxAmount,
11130
- lineAmountExcludeTax: lineAmountExcludeTax
11134
+ lineAmountExcludeTax: lineAmountExcludeTax,
11135
+ priceExcludeTax: priceExcludeTax || undefined
11131
11136
  });
11132
11137
 
11133
11138
  case 1:
@@ -11146,15 +11151,22 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11146
11151
  // 不含税
11147
11152
  var _lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
11148
11153
 
11154
+ var _deduction = invoiceController.state.goodsListState.deduction || 0;
11155
+
11149
11156
  var _taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11150
11157
 
11151
11158
 
11152
- var _taxAmount = countTaxAmount(_lineAmountIncludeTax, 0, _taxRate) || 0; //税额
11159
+ var _taxAmount = countTaxAmount(_lineAmountIncludeTax, _deduction, _taxRate) || 0; //税额
11153
11160
 
11154
11161
 
11155
11162
  var _lineAmountExcludeTax = countAmountExcludeTax(_lineAmountIncludeTax, _taxAmount) || 0; // 不含税金额
11156
11163
 
11157
11164
 
11165
+ var _quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
11166
+
11167
+ var _priceExcludeTax = _quantity > 0 ? countPrice(_lineAmountExcludeTax, _quantity) : undefined; // 不含税单价
11168
+
11169
+
11158
11170
  form === null || form === void 0 ? void 0 : form.setFieldsValue({
11159
11171
  taxAmount: _taxAmount,
11160
11172
  lineAmountExcludeTax: _lineAmountExcludeTax
@@ -11167,7 +11179,8 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11167
11179
  case 0:
11168
11180
  s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11169
11181
  taxAmount: _taxAmount,
11170
- lineAmountExcludeTax: _lineAmountExcludeTax
11182
+ lineAmountExcludeTax: _lineAmountExcludeTax,
11183
+ priceExcludeTax: _priceExcludeTax || undefined
11171
11184
  });
11172
11185
 
11173
11186
  case 1:
@@ -11186,7 +11199,7 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11186
11199
  } else {
11187
11200
  invoiceController.run( /*#__PURE__*/function () {
11188
11201
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
11189
- var good, lineAmountIncludeTax, taxRate, taxAmount, lineAmountExcludeTax;
11202
+ var good, lineAmountIncludeTax, deduction, taxRate, taxAmount, lineAmountExcludeTax, quantity, priceExcludeTax;
11190
11203
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11191
11204
  while (1) {
11192
11205
  switch (_context3.prev = _context3.next) {
@@ -11202,17 +11215,23 @@ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11202
11215
 
11203
11216
  case 3:
11204
11217
  lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
11218
+ deduction = invoiceController.state.goodsListState.deduction || 0;
11205
11219
  taxRate = good.taxRate || 0;
11206
- taxAmount = countTaxAmount(lineAmountIncludeTax, 0, taxRate) || 0; //税额
11220
+ taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
11207
11221
 
11208
11222
  lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11209
11223
 
11224
+ quantity = good.quantity || 0;
11225
+ priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
11226
+
11210
11227
  s.goodsListState.goodsList[0] = _objectSpread2(_objectSpread2({}, good), {}, {
11211
11228
  taxAmount: taxAmount,
11212
- lineAmountExcludeTax: lineAmountExcludeTax
11229
+ lineAmountExcludeTax: lineAmountExcludeTax,
11230
+ priceExcludeTax: priceExcludeTax || undefined
11213
11231
  });
11232
+ s.goodsListState.goodsList = _toConsumableArray(s.goodsListState.goodsList);
11214
11233
 
11215
- case 8:
11234
+ case 12:
11216
11235
  case "end":
11217
11236
  return _context3.stop();
11218
11237
  }
@@ -34016,6 +34035,7 @@ var DrawerBody$4 = function DrawerBody(props) {
34016
34035
 
34017
34036
 
34018
34037
  var onSubmit = React__default['default'].useCallback(function (values) {
34038
+ console.log('天开组件', '点击了赋码确定按钮 ===>', values);
34019
34039
  controller.pipeline( /*#__PURE__*/function () {
34020
34040
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
34021
34041
  var endowCodeGood;
@@ -34023,8 +34043,11 @@ var DrawerBody$4 = function DrawerBody(props) {
34023
34043
  while (1) {
34024
34044
  switch (_context15.prev = _context15.next) {
34025
34045
  case 0:
34046
+ // const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
34026
34047
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
34027
- return s.goodsListState.goodsMap.get(e);
34048
+ return s.goodsListState.goodsList.find(function (item) {
34049
+ return item.$index === e;
34050
+ });
34028
34051
  }); // 赋码
34029
34052
 
34030
34053
  endowCodeGood.forEach(function (good) {
@@ -34038,7 +34061,7 @@ var DrawerBody$4 = function DrawerBody(props) {
34038
34061
  good.mtzlDm = undefined; //设置成空
34039
34062
  // 无论是否含税,都保持价税合计不变
34040
34063
 
34041
- good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
34064
+ good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction || 0, values.taxRate);
34042
34065
 
34043
34066
  if (good.taxAmount || good.taxAmount === 0) {
34044
34067
  good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.266",
3
+ "version": "3.2.267",
4
4
  "scripts": {
5
5
  "dev": "dumi dev --max-old-space-size=6096",
6
6
  "start": "dumi dev",
@@ -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, 0, taxRate) || 0; //税额
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, 0, taxRate) || 0; //税额
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, 0, taxRate) || 0; //税额
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
  }