kts-component-invoice-operate 3.0.16 → 3.0.18

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.js CHANGED
@@ -1011,6 +1011,8 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1011
1011
  this.goodsList = [];
1012
1012
  this.goodsMap = new Map();
1013
1013
  this.goodsMenuExpand = [];
1014
+ this.amountIncludeTax = void 0;
1015
+ this.amountExcludeTax = void 0;
1014
1016
  this.selectedGoodIndex = [];
1015
1017
  this.discountGoodIndex = [];
1016
1018
  this.endowCode = new EndowCode();
@@ -1958,6 +1960,10 @@ var Statistics = (function () {
1958
1960
  var lineAmountIncludeTax = controller.useMemo(function (s) {
1959
1961
  var _s$goodsListState$for, _s$goodsListState$for2;
1960
1962
 
1963
+ if (typeof s.goodsListState.amountIncludeTax === 'number') {
1964
+ return s.goodsListState.amountIncludeTax;
1965
+ }
1966
+
1961
1967
  var sum = mathjs.chain(mathjs.bignumber(0));
1962
1968
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1963
1969
 
@@ -1978,6 +1984,10 @@ var Statistics = (function () {
1978
1984
  var lineAmountExcludeTax = controller.useMemo(function (s) {
1979
1985
  var _s$goodsListState$for3, _s$goodsListState$for4;
1980
1986
 
1987
+ if (typeof s.goodsListState.amountExcludeTax === 'number') {
1988
+ return s.goodsListState.amountExcludeTax;
1989
+ }
1990
+
1981
1991
  var sum = mathjs.chain(mathjs.bignumber(0));
1982
1992
  var editGood = s.goodsListState.editGood; // 正在编辑的货物
1983
1993
 
@@ -8967,26 +8977,26 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
8967
8977
  }, 1000);
8968
8978
  /** 税率 */
8969
8979
 
8970
- var onChangeTaxRate = function onChangeTaxRate(controller, form, record) {
8980
+ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8971
8981
  form.validateFields( /*#__PURE__*/function () {
8972
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(err, values) {
8982
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(err, values) {
8973
8983
  var taxRate;
8974
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
8984
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
8975
8985
  while (1) {
8976
- switch (_context11.prev = _context11.next) {
8986
+ switch (_context12.prev = _context12.next) {
8977
8987
  case 0:
8978
8988
  err = err || {};
8979
8989
 
8980
8990
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8981
- _context11.next = 3;
8991
+ _context12.next = 3;
8982
8992
  break;
8983
8993
  }
8984
8994
 
8985
- return _context11.abrupt("return");
8995
+ return _context12.abrupt("return");
8986
8996
 
8987
8997
  case 3:
8988
8998
  taxRate = parseFloat(values.taxRate);
8989
- _context11.next = 6;
8999
+ _context12.next = 6;
8990
9000
  return controller.setEditGood({
8991
9001
  taxRate: taxRate
8992
9002
  });
@@ -9010,21 +9020,43 @@ var onChangeTaxRate = function onChangeTaxRate(controller, form, record) {
9010
9020
  updateUnitPriceExcludingTax(controller, form);
9011
9021
  } else {
9012
9022
  updateUnitPriceTax(controller, form);
9013
- }
9023
+ } // 清楚 计算中启动字段
9024
+
9025
+
9026
+ controller.run( /*#__PURE__*/function () {
9027
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
9028
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
9029
+ while (1) {
9030
+ switch (_context11.prev = _context11.next) {
9031
+ case 0:
9032
+ return _context11.abrupt("return", s.calculating = '');
9033
+
9034
+ case 1:
9035
+ case "end":
9036
+ return _context11.stop();
9037
+ }
9038
+ }
9039
+ }, _callee11);
9040
+ }));
9041
+
9042
+ return function (_x18) {
9043
+ return _ref12.apply(this, arguments);
9044
+ };
9045
+ }());
9014
9046
 
9015
- case 8:
9047
+ case 9:
9016
9048
  case "end":
9017
- return _context11.stop();
9049
+ return _context12.stop();
9018
9050
  }
9019
9051
  }
9020
- }, _callee11);
9052
+ }, _callee12);
9021
9053
  }));
9022
9054
 
9023
9055
  return function (_x16, _x17) {
9024
9056
  return _ref11.apply(this, arguments);
9025
9057
  };
9026
9058
  }());
9027
- };
9059
+ }, 1000);
9028
9060
  /** 小规模纳税人 1% 和 3% 自动赋码免税 */
9029
9061
 
9030
9062
  function dutyFree(controller, taxRate, form, record) {
@@ -9060,11 +9092,11 @@ function dutyFree(controller, taxRate, form, record) {
9060
9092
 
9061
9093
  var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controller, form, record) {
9062
9094
  form.validateFields( /*#__PURE__*/function () {
9063
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(err, values) {
9095
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(err, values) {
9064
9096
  var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
9065
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
9097
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9066
9098
  while (1) {
9067
- switch (_context12.prev = _context12.next) {
9099
+ switch (_context13.prev = _context13.next) {
9068
9100
  case 0:
9069
9101
  err = err || {};
9070
9102
  /** 税额 */
@@ -9076,7 +9108,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9076
9108
  taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
9077
9109
  }
9078
9110
 
9079
- _context12.next = 5;
9111
+ _context13.next = 5;
9080
9112
  return controller.setEditGood({
9081
9113
  taxAmount: taxAmount
9082
9114
  });
@@ -9090,7 +9122,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9090
9122
  form.setFieldsValue({
9091
9123
  lineAmountExcludeTax: lineAmountExcludeTax
9092
9124
  });
9093
- _context12.next = 9;
9125
+ _context13.next = 9;
9094
9126
  return controller.setEditGood({
9095
9127
  lineAmountExcludeTax: lineAmountExcludeTax
9096
9128
  });
@@ -9104,21 +9136,21 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9104
9136
  form.setFieldsValue({
9105
9137
  priceExcludeTax: priceExcludeTax
9106
9138
  });
9107
- _context12.next = 13;
9139
+ _context13.next = 13;
9108
9140
  return controller.setEditGood({
9109
9141
  priceExcludeTax: priceExcludeTax
9110
9142
  });
9111
9143
 
9112
9144
  case 13:
9113
9145
  case "end":
9114
- return _context12.stop();
9146
+ return _context13.stop();
9115
9147
  }
9116
9148
  }
9117
- }, _callee12);
9149
+ }, _callee13);
9118
9150
  }));
9119
9151
 
9120
- return function (_x18, _x19) {
9121
- return _ref12.apply(this, arguments);
9152
+ return function (_x19, _x20) {
9153
+ return _ref13.apply(this, arguments);
9122
9154
  };
9123
9155
  }());
9124
9156
  };
@@ -9126,35 +9158,35 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9126
9158
 
9127
9159
  var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9128
9160
  form.validateFields( /*#__PURE__*/function () {
9129
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(err, values) {
9161
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(err, values) {
9130
9162
  var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
9131
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9163
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
9132
9164
  while (1) {
9133
- switch (_context13.prev = _context13.next) {
9165
+ switch (_context14.prev = _context14.next) {
9134
9166
  case 0:
9135
9167
  err = err || {};
9136
9168
 
9137
9169
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
9138
- _context13.next = 16;
9170
+ _context14.next = 16;
9139
9171
  break;
9140
9172
  }
9141
9173
 
9142
9174
  // 金额(含税)= 金额(不含税)* (1+ 税率)
9143
9175
  lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
9144
9176
  lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
9145
- _context13.next = 6;
9177
+ _context14.next = 6;
9146
9178
  return controller.setEditGood({
9147
9179
  lineAmountIncludeTax: lineAmountIncludeTax
9148
9180
  });
9149
9181
 
9150
9182
  case 6:
9151
9183
  if (!(!err.quantity && values.quantity)) {
9152
- _context13.next = 10;
9184
+ _context14.next = 10;
9153
9185
  break;
9154
9186
  }
9155
9187
 
9156
9188
  priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
9157
- _context13.next = 10;
9189
+ _context14.next = 10;
9158
9190
  return controller.setEditGood({
9159
9191
  priceIncludeTax: priceIncludeTax
9160
9192
  });
@@ -9165,221 +9197,221 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9165
9197
  form.setFieldsValue({
9166
9198
  taxAmount: taxAmount
9167
9199
  });
9168
- _context13.next = 14;
9200
+ _context14.next = 14;
9169
9201
  return controller.setEditGood({
9170
9202
  taxAmount: taxAmount
9171
9203
  });
9172
9204
 
9173
9205
  case 14:
9174
- _context13.next = 19;
9206
+ _context14.next = 19;
9175
9207
  break;
9176
9208
 
9177
9209
  case 16:
9178
9210
  form.setFieldsValue({
9179
9211
  taxAmount: undefined
9180
9212
  });
9181
- _context13.next = 19;
9213
+ _context14.next = 19;
9182
9214
  return controller.setEditGood({
9183
9215
  taxAmount: undefined
9184
9216
  });
9185
9217
 
9186
9218
  case 19:
9187
9219
  case "end":
9188
- return _context13.stop();
9220
+ return _context14.stop();
9189
9221
  }
9190
9222
  }
9191
- }, _callee13);
9223
+ }, _callee14);
9192
9224
  }));
9193
9225
 
9194
- return function (_x20, _x21) {
9195
- return _ref13.apply(this, arguments);
9226
+ return function (_x21, _x22) {
9227
+ return _ref14.apply(this, arguments);
9196
9228
  };
9197
9229
  }());
9198
9230
  };
9199
9231
  /** 单调赋码 */
9200
9232
 
9201
9233
  var endowCode = /*#__PURE__*/function () {
9202
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(controller, goods) {
9203
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9234
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(controller, goods) {
9235
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9204
9236
  while (1) {
9205
- switch (_context16.prev = _context16.next) {
9237
+ switch (_context17.prev = _context17.next) {
9206
9238
  case 0:
9207
- _context16.next = 2;
9239
+ _context17.next = 2;
9208
9240
  return controller.wait();
9209
9241
 
9210
9242
  case 2:
9211
- _context16.next = 4;
9243
+ _context17.next = 4;
9212
9244
  return controller.saveEditGood();
9213
9245
 
9214
9246
  case 4:
9215
- _context16.next = 6;
9247
+ _context17.next = 6;
9216
9248
  return controller.pipeline( /*#__PURE__*/function () {
9217
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
9249
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
9218
9250
  var err, key, g, i;
9219
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
9251
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9220
9252
  while (1) {
9221
- switch (_context15.prev = _context15.next) {
9253
+ switch (_context16.prev = _context16.next) {
9222
9254
  case 0:
9223
9255
  if (!s.goodsListState.form) {
9224
- _context15.next = 11;
9256
+ _context16.next = 11;
9225
9257
  break;
9226
9258
  }
9227
9259
 
9228
9260
  err = s.goodsListState.form.getFieldsError();
9229
- _context15.t0 = _regeneratorRuntime().keys(err);
9261
+ _context16.t0 = _regeneratorRuntime().keys(err);
9230
9262
 
9231
9263
  case 3:
9232
- if ((_context15.t1 = _context15.t0()).done) {
9233
- _context15.next = 11;
9264
+ if ((_context16.t1 = _context16.t0()).done) {
9265
+ _context16.next = 11;
9234
9266
  break;
9235
9267
  }
9236
9268
 
9237
- key = _context15.t1.value;
9269
+ key = _context16.t1.value;
9238
9270
 
9239
9271
  if (err[key]) {
9240
- _context15.next = 7;
9272
+ _context16.next = 7;
9241
9273
  break;
9242
9274
  }
9243
9275
 
9244
- return _context15.abrupt("continue", 3);
9276
+ return _context16.abrupt("continue", 3);
9245
9277
 
9246
9278
  case 7:
9247
9279
  ktsComponentsAntdX3.message.error(err[key][0]);
9248
- return _context15.abrupt("return");
9280
+ return _context16.abrupt("return");
9249
9281
 
9250
9282
  case 11:
9251
9283
  g = s.goodsListState.goodsMap.get(goods.$index);
9252
9284
  i = s.goodsListState.goodsList.indexOf(g);
9253
- _context15.t2 = goods.lineAttribute;
9254
- _context15.next = _context15.t2 === LineAttributeType$1.正常 ? 16 : _context15.t2 === LineAttributeType$1.折扣行 ? 18 : _context15.t2 === LineAttributeType$1.被折扣行 ? 20 : 22;
9285
+ _context16.t2 = goods.lineAttribute;
9286
+ _context16.next = _context16.t2 === LineAttributeType$1.正常 ? 16 : _context16.t2 === LineAttributeType$1.折扣行 ? 18 : _context16.t2 === LineAttributeType$1.被折扣行 ? 20 : 22;
9255
9287
  break;
9256
9288
 
9257
9289
  case 16:
9258
9290
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index];
9259
- return _context15.abrupt("break", 22);
9291
+ return _context16.abrupt("break", 22);
9260
9292
 
9261
9293
  case 18:
9262
9294
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index, s.goodsListState.goodsList[i - 1].$index];
9263
- return _context15.abrupt("break", 22);
9295
+ return _context16.abrupt("break", 22);
9264
9296
 
9265
9297
  case 20:
9266
9298
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index, s.goodsListState.goodsList[i + 1].$index];
9267
- return _context15.abrupt("break", 22);
9299
+ return _context16.abrupt("break", 22);
9268
9300
 
9269
9301
  case 22:
9270
9302
  case "end":
9271
- return _context15.stop();
9303
+ return _context16.stop();
9272
9304
  }
9273
9305
  }
9274
- }, _callee15);
9306
+ }, _callee16);
9275
9307
  }));
9276
9308
 
9277
- return function (_x26) {
9278
- return _ref16.apply(this, arguments);
9309
+ return function (_x27) {
9310
+ return _ref17.apply(this, arguments);
9279
9311
  };
9280
9312
  }())();
9281
9313
 
9282
9314
  case 6:
9283
9315
  case "end":
9284
- return _context16.stop();
9316
+ return _context17.stop();
9285
9317
  }
9286
9318
  }
9287
- }, _callee16);
9319
+ }, _callee17);
9288
9320
  }));
9289
9321
 
9290
- return function endowCode(_x24, _x25) {
9291
- return _ref15.apply(this, arguments);
9322
+ return function endowCode(_x25, _x26) {
9323
+ return _ref16.apply(this, arguments);
9292
9324
  };
9293
9325
  }();
9294
9326
  /** 修改了 货物名称 */
9295
9327
 
9296
9328
  var onChangeItemName = /*#__PURE__*/function () {
9297
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(controller, form, record) {
9298
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9329
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(controller, form, record) {
9330
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
9299
9331
  while (1) {
9300
- switch (_context18.prev = _context18.next) {
9332
+ switch (_context19.prev = _context19.next) {
9301
9333
  case 0:
9302
9334
  controller.run( /*#__PURE__*/function () {
9303
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
9335
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(s) {
9304
9336
  var _getSN$shorthand, _getSN;
9305
9337
 
9306
9338
  var value, shorthand;
9307
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9339
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9308
9340
  while (1) {
9309
- switch (_context17.prev = _context17.next) {
9341
+ switch (_context18.prev = _context18.next) {
9310
9342
  case 0:
9311
9343
  value = form.getFieldsValue().itemName;
9312
9344
  shorthand = (_getSN$shorthand = (_getSN = getSN(value)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand) !== null && _getSN$shorthand !== void 0 ? _getSN$shorthand : '';
9313
9345
 
9314
9346
  if (!s.goodsListState.isMyShow) {
9315
- _context17.next = 11;
9347
+ _context18.next = 11;
9316
9348
  break;
9317
9349
  }
9318
9350
 
9319
- _context17.next = 5;
9351
+ _context18.next = 5;
9320
9352
  return controller.setEditGood({
9321
9353
  itemNameSelf: value
9322
9354
  });
9323
9355
 
9324
9356
  case 5:
9325
- _context17.t0 = record.itemName;
9357
+ _context18.t0 = record.itemName;
9326
9358
 
9327
- if (!_context17.t0) {
9328
- _context17.next = 9;
9359
+ if (!_context18.t0) {
9360
+ _context18.next = 9;
9329
9361
  break;
9330
9362
  }
9331
9363
 
9332
- _context17.next = 9;
9364
+ _context18.next = 9;
9333
9365
  return controller.setEditGood({
9334
9366
  itemName: setShorthand(record.itemName, shorthand)
9335
9367
  });
9336
9368
 
9337
9369
  case 9:
9338
- _context17.next = 17;
9370
+ _context18.next = 17;
9339
9371
  break;
9340
9372
 
9341
9373
  case 11:
9342
- _context17.next = 13;
9374
+ _context18.next = 13;
9343
9375
  return controller.setEditGood({
9344
9376
  itemName: value
9345
9377
  });
9346
9378
 
9347
9379
  case 13:
9348
- _context17.t1 = record.itemNameSelf;
9380
+ _context18.t1 = record.itemNameSelf;
9349
9381
 
9350
- if (!_context17.t1) {
9351
- _context17.next = 17;
9382
+ if (!_context18.t1) {
9383
+ _context18.next = 17;
9352
9384
  break;
9353
9385
  }
9354
9386
 
9355
- _context17.next = 17;
9387
+ _context18.next = 17;
9356
9388
  return controller.setEditGood({
9357
9389
  itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
9358
9390
  });
9359
9391
 
9360
9392
  case 17:
9361
9393
  case "end":
9362
- return _context17.stop();
9394
+ return _context18.stop();
9363
9395
  }
9364
9396
  }
9365
- }, _callee17);
9397
+ }, _callee18);
9366
9398
  }));
9367
9399
 
9368
- return function (_x30) {
9369
- return _ref18.apply(this, arguments);
9400
+ return function (_x31) {
9401
+ return _ref19.apply(this, arguments);
9370
9402
  };
9371
9403
  }());
9372
9404
 
9373
9405
  case 1:
9374
9406
  case "end":
9375
- return _context18.stop();
9407
+ return _context19.stop();
9376
9408
  }
9377
9409
  }
9378
- }, _callee18);
9410
+ }, _callee19);
9379
9411
  }));
9380
9412
 
9381
- return function onChangeItemName(_x27, _x28, _x29) {
9382
- return _ref17.apply(this, arguments);
9413
+ return function onChangeItemName(_x28, _x29, _x30) {
9414
+ return _ref18.apply(this, arguments);
9383
9415
  };
9384
9416
  }();
9385
9417
 
@@ -10289,7 +10321,8 @@ var useColumns = (function (form) {
10289
10321
  width: '100%'
10290
10322
  },
10291
10323
  onChange: function onChange() {
10292
- onChangeTaxRate(controller, form);
10324
+ setChangeField('taxRate');
10325
+ onChangeTaxRate(controller, form, record);
10293
10326
  }
10294
10327
  }, taxRateList.map(function (e, i) {
10295
10328
  return React__default['default'].createElement(ktsComponentsAntdX3.Select.Option, {
@@ -13361,9 +13394,7 @@ var DrawerBody$3 = function DrawerBody(props) {
13361
13394
  endowCodeGood.forEach(function (good) {
13362
13395
  if (!good) return;
13363
13396
  good.itemName = setShorthand(good.itemName, values.shorthand);
13364
- good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand); // const name = getItemName(good.itemName, values.shorthand);
13365
- // good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
13366
-
13397
+ good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
13367
13398
  good.taxClassificationCode = values.taxClassificationCode;
13368
13399
  good.taxRate = values.taxRate;
13369
13400
  good.taxFreeType = values.taxFreeType;
@@ -13374,41 +13405,9 @@ var DrawerBody$3 = function DrawerBody(props) {
13374
13405
  var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
13375
13406
  var priceExcludeTax = good.priceIncludeTax ? mathjs.chain(mathjs.bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
13376
13407
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
13377
- good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined; // if (s.goodsListState.isTaxIncluded) {
13378
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
13379
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
13380
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
13381
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
13382
- // } else {
13383
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
13384
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
13385
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
13386
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
13387
- // }
13388
-
13408
+ good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
13389
13409
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
13390
- }); //截取名称
13391
- // if (endowCodeGood.some(e => bytesLnegth(e?.itemName || '') > 92)) {
13392
- // await (() => new Promise<void>(resolve => {
13393
- // confirm({
13394
- // title: '温馨提示',
13395
- // content: '商品名称长度过长,是否截取名称',
13396
- // okText: '确定',
13397
- // cancelText: '取消',
13398
- // onOk() {
13399
- // endowCodeGood.forEach(e => {
13400
- // if (e && e.itemName) { e.itemName = cutStr(e.itemName, 91) }
13401
- // })
13402
- // message.success('商品名称截取成功!')
13403
- // resolve()
13404
- // },
13405
- // onCancel() {
13406
- // resolve()
13407
- // },
13408
- // });
13409
- // }))()
13410
- // }
13411
-
13410
+ });
13412
13411
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
13413
13412
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
13414
13413
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.16",
3
+ "version": "3.0.18",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -56,6 +56,12 @@ export default class GoodsListState {
56
56
  /** 货物菜单扩展 */
57
57
  goodsMenuExpand: ((index: string, controller: InvoiceController) => React.ReactNode)[] = [];
58
58
 
59
+ /** 金额含税(受控,输入后不再自动计算) */
60
+ amountIncludeTax?: number;
61
+
62
+ /** 金额不含税(受控,输入后不再自动计算) */
63
+ amountExcludeTax?: number;
64
+
59
65
  /** 列表选中的货物索引列表 */
60
66
  selectedGoodIndex: string[] = [];
61
67
 
@@ -293,9 +293,6 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
293
293
  good.itemName = setShorthand(good.itemName, values.shorthand);
294
294
  good.itemNameSelf = setShorthand(good.itemNameSelf, values.shorthand);
295
295
 
296
- // const name = getItemName(good.itemName, values.shorthand);
297
- // good.itemName = getItemName(good.itemName, values.shorthand); // `*${values.shorthand}*${name}`;
298
-
299
296
  good.taxClassificationCode = values.taxClassificationCode;
300
297
  good.taxRate = values.taxRate;
301
298
  good.taxFreeType = values.taxFreeType;
@@ -311,45 +308,9 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
311
308
  good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
312
309
  good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
313
310
 
314
- // if (s.goodsListState.isTaxIncluded) {
315
- // const lineAmountExcludeTax = chain(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
316
- // const priceExcludeTax = good.priceIncludeTax ? chain(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined
317
-
318
- // good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
319
- // good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
320
- // } else {
321
- // const lineAmountIncludeTax = chain(bignumber(good.lineAmountExcludeTax)).multiply(taxRate).done();
322
- // const priceIncludeTax = good.priceExcludeTax ? chain(bignumber(good.priceExcludeTax)).multiply(taxRate).done() : undefined
323
-
324
- // good.lineAmountIncludeTax = lineAmountIncludeTax.toNumber().toFixed(2);
325
- // good.priceIncludeTax = (priceIncludeTax ? format15(priceIncludeTax.toNumber()) : undefined) || undefined;
326
- // }
327
-
328
311
  good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
329
312
  });
330
313
 
331
- //截取名称
332
- // if (endowCodeGood.some(e => bytesLnegth(e?.itemName || '') > 92)) {
333
- // await (() => new Promise<void>(resolve => {
334
- // confirm({
335
- // title: '温馨提示',
336
- // content: '商品名称长度过长,是否截取名称',
337
- // okText: '确定',
338
- // cancelText: '取消',
339
- // onOk() {
340
- // endowCodeGood.forEach(e => {
341
- // if (e && e.itemName) { e.itemName = cutStr(e.itemName, 91) }
342
- // })
343
- // message.success('商品名称截取成功!')
344
- // resolve()
345
- // },
346
- // onCancel() {
347
- // resolve()
348
- // },
349
- // });
350
- // }))()
351
- // }
352
-
353
314
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
354
315
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
355
316
  })();