kts-component-invoice-operate 3.0.13 → 3.0.15

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.
@@ -46,6 +46,4 @@ export default interface IGood {
46
46
  favouredPolicyMark?: number;
47
47
  /** 优惠政策类型 */
48
48
  favouredPolicyName?: string;
49
- /** 零税率标识 */
50
- zeroTaxRateFlag?: string;
51
49
  }
package/dist/index.esm.js CHANGED
@@ -1375,7 +1375,7 @@ var addGoodDiscount = /*#__PURE__*/(function () {
1375
1375
  itemNameSelf: good.itemNameSelf,
1376
1376
  favouredPolicyMark: good.favouredPolicyMark,
1377
1377
  favouredPolicyName: good.favouredPolicyName,
1378
- zeroTaxRateFlag: good.zeroTaxRateFlag,
1378
+ taxFreeType: good.taxFreeType,
1379
1379
  discountGroup: discountGroup,
1380
1380
  lineAmountIncludeTax: lineAmountIncludeTax,
1381
1381
  lineAmountExcludeTax: lineAmountExcludeTax,
@@ -8858,23 +8858,22 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8858
8858
  switch (_context6.prev = _context6.next) {
8859
8859
  case 0:
8860
8860
  err = err || {};
8861
- debugger;
8862
8861
 
8863
8862
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8864
- _context6.next = 4;
8863
+ _context6.next = 3;
8865
8864
  break;
8866
8865
  }
8867
8866
 
8868
8867
  return _context6.abrupt("return");
8869
8868
 
8870
- case 4:
8869
+ case 3:
8871
8870
  taxRate = parseFloat(values.taxRate);
8872
- _context6.next = 7;
8871
+ _context6.next = 6;
8873
8872
  return controller.setEditGood({
8874
8873
  taxRate: taxRate
8875
8874
  });
8876
8875
 
8877
- case 7:
8876
+ case 6:
8878
8877
  // 去掉赋码
8879
8878
  (function () {
8880
8879
  var cache = controller.state.goodsListState.endowCode.cache;
@@ -8895,7 +8894,7 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8895
8894
  updateUnitPriceTax(controller, form);
8896
8895
  }
8897
8896
 
8898
- case 9:
8897
+ case 8:
8899
8898
  case "end":
8900
8899
  return _context6.stop();
8901
8900
  }
@@ -9010,7 +9009,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9010
9009
  var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9011
9010
  form.validateFields( /*#__PURE__*/function () {
9012
9011
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
9013
- var lineAmountExcludeTax, lineAmountIncludeTax, taxAmount, priceExcludeTax, priceIncludeTax;
9012
+ var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
9014
9013
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
9015
9014
  while (1) {
9016
9015
  switch (_context8.prev = _context8.next) {
@@ -9018,7 +9017,7 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9018
9017
  err = err || {};
9019
9018
 
9020
9019
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
9021
- _context8.next = 12;
9020
+ _context8.next = 16;
9022
9021
  break;
9023
9022
  }
9024
9023
 
@@ -9031,43 +9030,42 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9031
9030
  });
9032
9031
 
9033
9032
  case 6:
9033
+ if (!(!err.quantity && values.quantity)) {
9034
+ _context8.next = 10;
9035
+ break;
9036
+ }
9037
+
9038
+ priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
9039
+ _context8.next = 10;
9040
+ return controller.setEditGood({
9041
+ priceIncludeTax: priceIncludeTax
9042
+ });
9043
+
9044
+ case 10:
9034
9045
  // 税额 = 金额(含税)-金额(不含税)
9035
9046
  taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
9036
9047
  form.setFieldsValue({
9037
9048
  taxAmount: taxAmount
9038
9049
  });
9039
- _context8.next = 10;
9050
+ _context8.next = 14;
9040
9051
  return controller.setEditGood({
9041
9052
  taxAmount: taxAmount
9042
9053
  });
9043
9054
 
9044
- case 10:
9045
- _context8.next = 15;
9055
+ case 14:
9056
+ _context8.next = 19;
9046
9057
  break;
9047
9058
 
9048
- case 12:
9059
+ case 16:
9049
9060
  form.setFieldsValue({
9050
9061
  taxAmount: undefined
9051
9062
  });
9052
- _context8.next = 15;
9063
+ _context8.next = 19;
9053
9064
  return controller.setEditGood({
9054
9065
  taxAmount: undefined
9055
9066
  });
9056
9067
 
9057
- case 15:
9058
- if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.priceExcludeTax) && (values.priceExcludeTax || values.priceExcludeTax === 0))) {
9059
- _context8.next = 20;
9060
- break;
9061
- }
9062
-
9063
- priceExcludeTax = format15(values.priceExcludeTax);
9064
- priceIncludeTax = format15(evaluate("".concat(priceExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
9065
- _context8.next = 20;
9066
- return controller.setEditGood({
9067
- priceIncludeTax: priceIncludeTax
9068
- });
9069
-
9070
- case 20:
9068
+ case 19:
9071
9069
  case "end":
9072
9070
  return _context8.stop();
9073
9071
  }
package/dist/index.js CHANGED
@@ -1385,7 +1385,7 @@ var addGoodDiscount = /*#__PURE__*/(function () {
1385
1385
  itemNameSelf: good.itemNameSelf,
1386
1386
  favouredPolicyMark: good.favouredPolicyMark,
1387
1387
  favouredPolicyName: good.favouredPolicyName,
1388
- zeroTaxRateFlag: good.zeroTaxRateFlag,
1388
+ taxFreeType: good.taxFreeType,
1389
1389
  discountGroup: discountGroup,
1390
1390
  lineAmountIncludeTax: lineAmountIncludeTax,
1391
1391
  lineAmountExcludeTax: lineAmountExcludeTax,
@@ -8868,23 +8868,22 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8868
8868
  switch (_context6.prev = _context6.next) {
8869
8869
  case 0:
8870
8870
  err = err || {};
8871
- debugger;
8872
8871
 
8873
8872
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8874
- _context6.next = 4;
8873
+ _context6.next = 3;
8875
8874
  break;
8876
8875
  }
8877
8876
 
8878
8877
  return _context6.abrupt("return");
8879
8878
 
8880
- case 4:
8879
+ case 3:
8881
8880
  taxRate = parseFloat(values.taxRate);
8882
- _context6.next = 7;
8881
+ _context6.next = 6;
8883
8882
  return controller.setEditGood({
8884
8883
  taxRate: taxRate
8885
8884
  });
8886
8885
 
8887
- case 7:
8886
+ case 6:
8888
8887
  // 去掉赋码
8889
8888
  (function () {
8890
8889
  var cache = controller.state.goodsListState.endowCode.cache;
@@ -8905,7 +8904,7 @@ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8905
8904
  updateUnitPriceTax(controller, form);
8906
8905
  }
8907
8906
 
8908
- case 9:
8907
+ case 8:
8909
8908
  case "end":
8910
8909
  return _context6.stop();
8911
8910
  }
@@ -9020,7 +9019,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9020
9019
  var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9021
9020
  form.validateFields( /*#__PURE__*/function () {
9022
9021
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
9023
- var lineAmountExcludeTax, lineAmountIncludeTax, taxAmount, priceExcludeTax, priceIncludeTax;
9022
+ var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
9024
9023
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
9025
9024
  while (1) {
9026
9025
  switch (_context8.prev = _context8.next) {
@@ -9028,7 +9027,7 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9028
9027
  err = err || {};
9029
9028
 
9030
9029
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
9031
- _context8.next = 12;
9030
+ _context8.next = 16;
9032
9031
  break;
9033
9032
  }
9034
9033
 
@@ -9041,43 +9040,42 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9041
9040
  });
9042
9041
 
9043
9042
  case 6:
9043
+ if (!(!err.quantity && values.quantity)) {
9044
+ _context8.next = 10;
9045
+ break;
9046
+ }
9047
+
9048
+ priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
9049
+ _context8.next = 10;
9050
+ return controller.setEditGood({
9051
+ priceIncludeTax: priceIncludeTax
9052
+ });
9053
+
9054
+ case 10:
9044
9055
  // 税额 = 金额(含税)-金额(不含税)
9045
9056
  taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
9046
9057
  form.setFieldsValue({
9047
9058
  taxAmount: taxAmount
9048
9059
  });
9049
- _context8.next = 10;
9060
+ _context8.next = 14;
9050
9061
  return controller.setEditGood({
9051
9062
  taxAmount: taxAmount
9052
9063
  });
9053
9064
 
9054
- case 10:
9055
- _context8.next = 15;
9065
+ case 14:
9066
+ _context8.next = 19;
9056
9067
  break;
9057
9068
 
9058
- case 12:
9069
+ case 16:
9059
9070
  form.setFieldsValue({
9060
9071
  taxAmount: undefined
9061
9072
  });
9062
- _context8.next = 15;
9073
+ _context8.next = 19;
9063
9074
  return controller.setEditGood({
9064
9075
  taxAmount: undefined
9065
9076
  });
9066
9077
 
9067
- case 15:
9068
- if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.priceExcludeTax) && (values.priceExcludeTax || values.priceExcludeTax === 0))) {
9069
- _context8.next = 20;
9070
- break;
9071
- }
9072
-
9073
- priceExcludeTax = format15(values.priceExcludeTax);
9074
- priceIncludeTax = format15(evaluate("".concat(priceExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
9075
- _context8.next = 20;
9076
- return controller.setEditGood({
9077
- priceIncludeTax: priceIncludeTax
9078
- });
9079
-
9080
- case 20:
9078
+ case 19:
9081
9079
  case "end":
9082
9080
  return _context8.stop();
9083
9081
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.13",
3
+ "version": "3.0.15",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -69,7 +69,4 @@ export default interface IGood {
69
69
 
70
70
  /** 优惠政策类型 */
71
71
  favouredPolicyName?: string;
72
-
73
- /** 零税率标识 */
74
- zeroTaxRateFlag?: string;
75
72
  }
@@ -101,6 +101,7 @@ export default async (state: InvoiceControllerState, options?: IOptions) => {
101
101
  .done()
102
102
  .toNumber();
103
103
 
104
+
104
105
  good.discountGroup = discountGroup;
105
106
  good.lineAttribute = LineAttributeType.被折扣行;
106
107
  goodsList.splice(i + 1, 0, {
@@ -112,7 +113,7 @@ export default async (state: InvoiceControllerState, options?: IOptions) => {
112
113
  itemNameSelf: good.itemNameSelf,
113
114
  favouredPolicyMark: good.favouredPolicyMark,
114
115
  favouredPolicyName: good.favouredPolicyName,
115
- zeroTaxRateFlag: good.zeroTaxRateFlag,
116
+ taxFreeType: good.taxFreeType,
116
117
  discountGroup,
117
118
  lineAmountIncludeTax,
118
119
  lineAmountExcludeTax,
@@ -176,7 +176,7 @@ const lines: any[] = [
176
176
  "taxDiscount": 576.38,
177
177
  "taxRate": 13,
178
178
  "unit": "件",
179
- "zeroTaxRateFlag": null
179
+ "zeroTaxRateFlag": 'dddddd'
180
180
  },
181
181
  {
182
182
  "buyersItemCode": null,
@@ -1093,4 +1093,4 @@ const moke = [
1093
1093
  "zzstsgl": "",
1094
1094
  "zzszcyj": ""
1095
1095
  }
1096
- ]
1096
+ ].map(e => ({ ...e, "zeroTaxRateFlag": 'dddddd' }))
@@ -257,7 +257,6 @@ export const onChangeTaxRate = lazyFn(
257
257
 
258
258
  form.validateFields(async (err, values) => {
259
259
  err = err || {};
260
- debugger;
261
260
  if (promptErr(err.taxRate) || (!values.taxRate && values.taxRate !== 0)) return;
262
261
 
263
262
  let taxRate = parseFloat(values.taxRate);
@@ -339,7 +338,7 @@ export const updateUnitPriceExcludingTax = (controller: InvoiceController, form:
339
338
  await controller.setEditGood({ taxAmount });
340
339
 
341
340
  // 计算 金额(不含税)
342
- if ((taxAmount || taxAmount===0) && !promptErr(err.lineAmountIncludeTax)) {
341
+ if ((taxAmount || taxAmount === 0) && !promptErr(err.lineAmountIncludeTax)) {
343
342
  lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
344
343
  }
345
344
  form.setFieldsValue({ lineAmountExcludeTax });
@@ -371,6 +370,13 @@ export const updateUnitPriceTax = (controller: InvoiceController, form: WrappedF
371
370
  const lineAmountIncludeTax = format2(evaluate(`${lineAmountExcludeTax} * (1+(${values.taxRate}/100))`));
372
371
  await controller.setEditGood({ lineAmountIncludeTax });
373
372
 
373
+ // 单价(含税) = 金额(含税) / (數量)
374
+ // 是否有数量
375
+ if (!err.quantity && values.quantity) {
376
+ const priceIncludeTax = format15(evaluate(`${lineAmountIncludeTax} / ${values.quantity}`));
377
+ await controller.setEditGood({ priceIncludeTax });
378
+ }
379
+
374
380
  // 税额 = 金额(含税)-金额(不含税)
375
381
  const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
376
382
  form.setFieldsValue({ taxAmount });
@@ -379,18 +385,18 @@ export const updateUnitPriceTax = (controller: InvoiceController, form: WrappedF
379
385
  form.setFieldsValue({ taxAmount: undefined });
380
386
  await controller.setEditGood({ taxAmount: undefined });
381
387
  }
382
-
388
+
383
389
  // 单价(含税) = 单价(不含税) * (1+税率)
384
- if (
385
- !err.taxRat &&
386
- (values.taxRate || values.taxRate === 0) &&
387
- !promptErr(err.priceExcludeTax) &&
388
- (values.priceExcludeTax || values.priceExcludeTax === 0)
389
- ) {
390
- const priceExcludeTax = format15(values.priceExcludeTax);
391
- const priceIncludeTax = format15(evaluate(`${priceExcludeTax} * (1+(${values.taxRate}/100))`));
392
- await controller.setEditGood({ priceIncludeTax });
393
- }
390
+ // if (
391
+ // !err.taxRat &&
392
+ // (values.taxRate || values.taxRate === 0) &&
393
+ // !promptErr(err.priceExcludeTax) &&
394
+ // (values.priceExcludeTax || values.priceExcludeTax === 0)
395
+ // ) {
396
+ // const priceExcludeTax = format15(values.priceExcludeTax);
397
+ // const priceIncludeTax = format15(evaluate(`${priceExcludeTax} * (1+(${values.taxRate}/100))`));
398
+ // await controller.setEditGood({ priceIncludeTax });
399
+ // }
394
400
  });
395
401
  };
396
402