kts-component-invoice-operate 3.1.4 → 3.1.5
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/InvoiceController/InvoiceControllerState/index.d.ts +2 -0
- package/dist/Invoice/tools/calculate/index.d.ts +3 -3
- package/dist/index.esm.js +125 -118
- package/dist/index.js +125 -118
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +3 -0
- package/src/Invoice/tools/calculate/index.ts +7 -7
- package/src/Invoice/ui/EndowCodeDrawer/index.tsx +1 -1
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +27 -21
- package/src/Invoice/ui/ImportGoodsDrawer/index.tsx +4 -4
package/dist/index.js
CHANGED
|
@@ -945,6 +945,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
945
945
|
this.buyerState = new BuyerState();
|
|
946
946
|
this.goodsListState = new GoodsListState();
|
|
947
947
|
this.calculating = void 0;
|
|
948
|
+
this.calculatingDigits = void 0;
|
|
948
949
|
this.rootElement = null;
|
|
949
950
|
});
|
|
950
951
|
|
|
@@ -1084,11 +1085,12 @@ var format2 = function format2(value) {
|
|
|
1084
1085
|
};
|
|
1085
1086
|
/** 格式化 保留15位数字 */
|
|
1086
1087
|
var format15 = function format15(value) {
|
|
1088
|
+
var defaultFractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
|
|
1087
1089
|
if (value === Infinity) return '';
|
|
1088
1090
|
if ("".concat(value) === 'NaN') return '';
|
|
1089
1091
|
if (typeof value === 'string') value = parseFloat(value);
|
|
1090
1092
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
1091
|
-
return parseFloat(value.toFixed(fractionDigits >
|
|
1093
|
+
return parseFloat(value.toFixed(fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits));
|
|
1092
1094
|
};
|
|
1093
1095
|
/**
|
|
1094
1096
|
* 金额(含税) = 数量 * 单价(含税)
|
|
@@ -1096,11 +1098,11 @@ var format15 = function format15(value) {
|
|
|
1096
1098
|
* @param priceIncludeTax 单价(含税)
|
|
1097
1099
|
* @returns 金额(含税)
|
|
1098
1100
|
*/
|
|
1099
|
-
function countAmountIncludeTax(quantity, priceIncludeTax) {
|
|
1101
|
+
function countAmountIncludeTax(quantity, priceIncludeTax, calculatingDigits) {
|
|
1100
1102
|
if (!quantity && quantity !== 0) return undefined;
|
|
1101
1103
|
if (!priceIncludeTax && priceIncludeTax !== 0) return undefined;
|
|
1102
|
-
quantity = format15(quantity);
|
|
1103
|
-
priceIncludeTax = format15(priceIncludeTax);
|
|
1104
|
+
quantity = format15(quantity, calculatingDigits);
|
|
1105
|
+
priceIncludeTax = format15(priceIncludeTax, calculatingDigits);
|
|
1104
1106
|
return parseFloat(mathjs.chain(mathjs.bignumber(priceIncludeTax)).multiply(mathjs.bignumber(quantity)).done().toNumber().toFixed(2));
|
|
1105
1107
|
// return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
|
|
1106
1108
|
}
|
|
@@ -1135,10 +1137,10 @@ function countTaxAmount(amountIncludeTax, deduction, taxRate) {
|
|
|
1135
1137
|
* @param quantity 数量
|
|
1136
1138
|
* @returns 单价
|
|
1137
1139
|
*/
|
|
1138
|
-
function countPrice(amount, quantity) {
|
|
1140
|
+
function countPrice(amount, quantity, calculatingDigits) {
|
|
1139
1141
|
if (!amount && amount !== 0) return undefined;
|
|
1140
1142
|
if (!quantity && quantity !== 0) return undefined;
|
|
1141
|
-
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(quantity)).done().toNumber());
|
|
1143
|
+
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1142
1144
|
}
|
|
1143
1145
|
|
|
1144
1146
|
/**
|
|
@@ -8077,7 +8079,7 @@ var promptErr = function promptErr(err) {
|
|
|
8077
8079
|
var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
8078
8080
|
form.validateFields( /*#__PURE__*/function () {
|
|
8079
8081
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(err, values) {
|
|
8080
|
-
var quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
8082
|
+
var calculatingDigits, quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
8081
8083
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8082
8084
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8083
8085
|
case 0:
|
|
@@ -8099,94 +8101,95 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8099
8101
|
}
|
|
8100
8102
|
return _context2.abrupt("return");
|
|
8101
8103
|
case 7:
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8105
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8106
|
+
_context2.next = 11;
|
|
8104
8107
|
return controller.setEditGood({
|
|
8105
8108
|
quantity: quantity
|
|
8106
8109
|
});
|
|
8107
|
-
case
|
|
8110
|
+
case 11:
|
|
8108
8111
|
form.setFieldsValue({
|
|
8109
8112
|
quantity: quantity
|
|
8110
8113
|
});
|
|
8111
8114
|
// 是否含税
|
|
8112
8115
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
8113
|
-
_context2.next =
|
|
8116
|
+
_context2.next = 30;
|
|
8114
8117
|
break;
|
|
8115
8118
|
}
|
|
8116
8119
|
if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
|
|
8117
|
-
_context2.next =
|
|
8120
|
+
_context2.next = 21;
|
|
8118
8121
|
break;
|
|
8119
8122
|
}
|
|
8120
8123
|
// 可以找到 单价(含税)
|
|
8121
|
-
priceIncludeTax = format15(values.priceIncludeTax);
|
|
8124
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8122
8125
|
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
8123
8126
|
form.setFieldsValue({
|
|
8124
8127
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8125
8128
|
});
|
|
8126
|
-
_context2.next =
|
|
8129
|
+
_context2.next = 19;
|
|
8127
8130
|
return controller.setEditGood({
|
|
8128
8131
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8129
8132
|
});
|
|
8130
|
-
case
|
|
8131
|
-
_context2.next =
|
|
8133
|
+
case 19:
|
|
8134
|
+
_context2.next = 27;
|
|
8132
8135
|
break;
|
|
8133
|
-
case
|
|
8136
|
+
case 21:
|
|
8134
8137
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8135
|
-
_context2.next =
|
|
8138
|
+
_context2.next = 27;
|
|
8136
8139
|
break;
|
|
8137
8140
|
}
|
|
8138
8141
|
// 可以找到 金额(含税)
|
|
8139
8142
|
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8140
|
-
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)));
|
|
8143
|
+
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8141
8144
|
form.setFieldsValue({
|
|
8142
8145
|
priceIncludeTax: _priceIncludeTax
|
|
8143
8146
|
});
|
|
8144
|
-
_context2.next =
|
|
8147
|
+
_context2.next = 27;
|
|
8145
8148
|
return controller.setEditGood({
|
|
8146
8149
|
priceIncludeTax: _priceIncludeTax
|
|
8147
8150
|
});
|
|
8148
|
-
case
|
|
8151
|
+
case 27:
|
|
8149
8152
|
// 更新不含税
|
|
8150
8153
|
updateUnitPriceExcludingTax(controller, form);
|
|
8151
|
-
_context2.next =
|
|
8154
|
+
_context2.next = 45;
|
|
8152
8155
|
break;
|
|
8153
|
-
case
|
|
8156
|
+
case 30:
|
|
8154
8157
|
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8155
|
-
_context2.next =
|
|
8158
|
+
_context2.next = 38;
|
|
8156
8159
|
break;
|
|
8157
8160
|
}
|
|
8158
|
-
priceExcludeTax = format15(values.priceExcludeTax);
|
|
8161
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8159
8162
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8160
8163
|
form.setFieldsValue({
|
|
8161
8164
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8162
8165
|
});
|
|
8163
|
-
_context2.next =
|
|
8166
|
+
_context2.next = 36;
|
|
8164
8167
|
return controller.setEditGood({
|
|
8165
8168
|
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
8166
8169
|
quantity: quantity
|
|
8167
8170
|
});
|
|
8168
|
-
case
|
|
8169
|
-
_context2.next =
|
|
8171
|
+
case 36:
|
|
8172
|
+
_context2.next = 44;
|
|
8170
8173
|
break;
|
|
8171
|
-
case
|
|
8174
|
+
case 38:
|
|
8172
8175
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8173
|
-
_context2.next =
|
|
8176
|
+
_context2.next = 44;
|
|
8174
8177
|
break;
|
|
8175
8178
|
}
|
|
8176
8179
|
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8177
|
-
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)));
|
|
8180
|
+
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8178
8181
|
form.setFieldsValue({
|
|
8179
8182
|
priceExcludeTax: _priceExcludeTax
|
|
8180
8183
|
});
|
|
8181
|
-
_context2.next =
|
|
8184
|
+
_context2.next = 44;
|
|
8182
8185
|
return controller.setEditGood({
|
|
8183
8186
|
priceExcludeTax: _priceExcludeTax,
|
|
8184
8187
|
quantity: quantity
|
|
8185
8188
|
});
|
|
8186
|
-
case
|
|
8189
|
+
case 44:
|
|
8187
8190
|
// 更新含税
|
|
8188
8191
|
updateUnitPriceTax(controller, form);
|
|
8189
|
-
case
|
|
8192
|
+
case 45:
|
|
8190
8193
|
// 清楚 计算中启动字段
|
|
8191
8194
|
controller.run( /*#__PURE__*/function () {
|
|
8192
8195
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
@@ -8204,7 +8207,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8204
8207
|
return _ref2.apply(this, arguments);
|
|
8205
8208
|
};
|
|
8206
8209
|
}());
|
|
8207
|
-
case
|
|
8210
|
+
case 46:
|
|
8208
8211
|
case "end":
|
|
8209
8212
|
return _context2.stop();
|
|
8210
8213
|
}
|
|
@@ -8219,7 +8222,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8219
8222
|
var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
8220
8223
|
form.validateFields( /*#__PURE__*/function () {
|
|
8221
8224
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
8222
|
-
var priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
8225
|
+
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
8223
8226
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8224
8227
|
while (1) switch (_context4.prev = _context4.next) {
|
|
8225
8228
|
case 0:
|
|
@@ -8242,47 +8245,48 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8242
8245
|
}
|
|
8243
8246
|
return _context4.abrupt("return");
|
|
8244
8247
|
case 7:
|
|
8245
|
-
|
|
8246
|
-
|
|
8248
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8249
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8250
|
+
_context4.next = 11;
|
|
8247
8251
|
return controller.setEditGood({
|
|
8248
8252
|
priceIncludeTax: priceIncludeTax
|
|
8249
8253
|
});
|
|
8250
|
-
case
|
|
8254
|
+
case 11:
|
|
8251
8255
|
form.setFieldsValue({
|
|
8252
8256
|
priceIncludeTax: priceIncludeTax
|
|
8253
8257
|
});
|
|
8254
8258
|
// 是否有数量
|
|
8255
8259
|
if (!(!err.quantity && values.quantity)) {
|
|
8256
|
-
_context4.next =
|
|
8260
|
+
_context4.next = 20;
|
|
8257
8261
|
break;
|
|
8258
8262
|
}
|
|
8259
|
-
quantity = format15(values.quantity);
|
|
8263
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8260
8264
|
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
8261
8265
|
form.setFieldsValue({
|
|
8262
8266
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8263
8267
|
});
|
|
8264
|
-
_context4.next =
|
|
8268
|
+
_context4.next = 18;
|
|
8265
8269
|
return controller.setEditGood({
|
|
8266
8270
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8267
8271
|
});
|
|
8268
|
-
case
|
|
8269
|
-
_context4.next =
|
|
8272
|
+
case 18:
|
|
8273
|
+
_context4.next = 26;
|
|
8270
8274
|
break;
|
|
8271
|
-
case
|
|
8275
|
+
case 20:
|
|
8272
8276
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8273
|
-
_context4.next =
|
|
8277
|
+
_context4.next = 26;
|
|
8274
8278
|
break;
|
|
8275
8279
|
}
|
|
8276
8280
|
_lineAmountIncludeTax2 = format2(values.lineAmountIncludeTax);
|
|
8277
|
-
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)));
|
|
8281
|
+
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)), calculatingDigits);
|
|
8278
8282
|
form.setFieldsValue({
|
|
8279
8283
|
quantity: _quantity
|
|
8280
8284
|
});
|
|
8281
|
-
_context4.next =
|
|
8285
|
+
_context4.next = 26;
|
|
8282
8286
|
return controller.setEditGood({
|
|
8283
8287
|
quantity: _quantity
|
|
8284
8288
|
});
|
|
8285
|
-
case
|
|
8289
|
+
case 26:
|
|
8286
8290
|
// 更新不含税
|
|
8287
8291
|
updateUnitPriceExcludingTax(controller, form);
|
|
8288
8292
|
// 清楚 计算中启动字段
|
|
@@ -8302,7 +8306,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8302
8306
|
return _ref4.apply(this, arguments);
|
|
8303
8307
|
};
|
|
8304
8308
|
}());
|
|
8305
|
-
case
|
|
8309
|
+
case 28:
|
|
8306
8310
|
case "end":
|
|
8307
8311
|
return _context4.stop();
|
|
8308
8312
|
}
|
|
@@ -8317,7 +8321,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8317
8321
|
var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
8318
8322
|
form.validateFields( /*#__PURE__*/function () {
|
|
8319
8323
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
|
|
8320
|
-
var priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
8324
|
+
var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
8321
8325
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8322
8326
|
while (1) switch (_context6.prev = _context6.next) {
|
|
8323
8327
|
case 0:
|
|
@@ -8340,47 +8344,48 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8340
8344
|
}
|
|
8341
8345
|
return _context6.abrupt("return");
|
|
8342
8346
|
case 7:
|
|
8343
|
-
|
|
8344
|
-
|
|
8347
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8348
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8349
|
+
_context6.next = 11;
|
|
8345
8350
|
return controller.setEditGood({
|
|
8346
8351
|
priceExcludeTax: priceExcludeTax
|
|
8347
8352
|
});
|
|
8348
|
-
case
|
|
8353
|
+
case 11:
|
|
8349
8354
|
form.setFieldsValue({
|
|
8350
8355
|
priceExcludeTax: priceExcludeTax
|
|
8351
8356
|
});
|
|
8352
8357
|
// 是否有数量
|
|
8353
8358
|
if (!(!err.quantity && values.quantity)) {
|
|
8354
|
-
_context6.next =
|
|
8359
|
+
_context6.next = 20;
|
|
8355
8360
|
break;
|
|
8356
8361
|
}
|
|
8357
|
-
quantity = format15(values.quantity);
|
|
8362
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8358
8363
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8359
8364
|
form.setFieldsValue({
|
|
8360
8365
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8361
8366
|
});
|
|
8362
|
-
_context6.next =
|
|
8367
|
+
_context6.next = 18;
|
|
8363
8368
|
return controller.setEditGood({
|
|
8364
8369
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8365
8370
|
});
|
|
8366
|
-
case
|
|
8367
|
-
_context6.next =
|
|
8371
|
+
case 18:
|
|
8372
|
+
_context6.next = 26;
|
|
8368
8373
|
break;
|
|
8369
|
-
case
|
|
8374
|
+
case 20:
|
|
8370
8375
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8371
|
-
_context6.next =
|
|
8376
|
+
_context6.next = 26;
|
|
8372
8377
|
break;
|
|
8373
8378
|
}
|
|
8374
8379
|
_lineAmountExcludeTax2 = format2(values.lineAmountExcludeTax);
|
|
8375
|
-
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)));
|
|
8380
|
+
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)), calculatingDigits);
|
|
8376
8381
|
form.setFieldsValue({
|
|
8377
8382
|
quantity: _quantity2
|
|
8378
8383
|
});
|
|
8379
|
-
_context6.next =
|
|
8384
|
+
_context6.next = 26;
|
|
8380
8385
|
return controller.setEditGood({
|
|
8381
8386
|
quantity: _quantity2
|
|
8382
8387
|
});
|
|
8383
|
-
case
|
|
8388
|
+
case 26:
|
|
8384
8389
|
// 更新含税
|
|
8385
8390
|
updateUnitPriceTax(controller, form);
|
|
8386
8391
|
// 清楚 计算中启动字段
|
|
@@ -8400,7 +8405,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8400
8405
|
return _ref6.apply(this, arguments);
|
|
8401
8406
|
};
|
|
8402
8407
|
}());
|
|
8403
|
-
case
|
|
8408
|
+
case 28:
|
|
8404
8409
|
case "end":
|
|
8405
8410
|
return _context6.stop();
|
|
8406
8411
|
}
|
|
@@ -8415,7 +8420,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8415
8420
|
var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
8416
8421
|
form.validateFields( /*#__PURE__*/function () {
|
|
8417
8422
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
|
|
8418
|
-
var lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
8423
|
+
var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
8419
8424
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
8420
8425
|
while (1) switch (_context8.prev = _context8.next) {
|
|
8421
8426
|
case 0:
|
|
@@ -8433,47 +8438,48 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8433
8438
|
updateUnitPriceExcludingTax(controller, form);
|
|
8434
8439
|
return _context8.abrupt("return");
|
|
8435
8440
|
case 6:
|
|
8441
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8436
8442
|
lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8437
|
-
_context8.next =
|
|
8443
|
+
_context8.next = 10;
|
|
8438
8444
|
return controller.setEditGood({
|
|
8439
8445
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8440
8446
|
});
|
|
8441
|
-
case
|
|
8447
|
+
case 10:
|
|
8442
8448
|
form.setFieldsValue({
|
|
8443
8449
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8444
8450
|
});
|
|
8445
8451
|
// 是否有数量
|
|
8446
8452
|
if (!(!err.quantity && values.quantity)) {
|
|
8447
|
-
_context8.next =
|
|
8453
|
+
_context8.next = 19;
|
|
8448
8454
|
break;
|
|
8449
8455
|
}
|
|
8450
|
-
quantity = format15(values.quantity);
|
|
8451
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)));
|
|
8456
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8457
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8452
8458
|
form.setFieldsValue({
|
|
8453
8459
|
priceIncludeTax: priceIncludeTax
|
|
8454
8460
|
});
|
|
8455
|
-
_context8.next =
|
|
8461
|
+
_context8.next = 17;
|
|
8456
8462
|
return controller.setEditGood({
|
|
8457
8463
|
priceIncludeTax: priceIncludeTax
|
|
8458
8464
|
});
|
|
8459
|
-
case
|
|
8460
|
-
_context8.next =
|
|
8465
|
+
case 17:
|
|
8466
|
+
_context8.next = 25;
|
|
8461
8467
|
break;
|
|
8462
|
-
case
|
|
8468
|
+
case 19:
|
|
8463
8469
|
if (!(!err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
|
|
8464
|
-
_context8.next =
|
|
8470
|
+
_context8.next = 25;
|
|
8465
8471
|
break;
|
|
8466
8472
|
}
|
|
8467
|
-
_priceIncludeTax2 = format15(values.priceIncludeTax);
|
|
8468
|
-
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)));
|
|
8473
|
+
_priceIncludeTax2 = format15(values.priceIncludeTax, calculatingDigits);
|
|
8474
|
+
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)), calculatingDigits);
|
|
8469
8475
|
form.setFieldsValue({
|
|
8470
8476
|
quantity: _quantity3
|
|
8471
8477
|
});
|
|
8472
|
-
_context8.next =
|
|
8478
|
+
_context8.next = 25;
|
|
8473
8479
|
return controller.setEditGood({
|
|
8474
8480
|
quantity: _quantity3
|
|
8475
8481
|
});
|
|
8476
|
-
case
|
|
8482
|
+
case 25:
|
|
8477
8483
|
// 更新不含税
|
|
8478
8484
|
updateUnitPriceExcludingTax(controller, form);
|
|
8479
8485
|
// 清楚 计算中启动字段
|
|
@@ -8493,7 +8499,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8493
8499
|
return _ref8.apply(this, arguments);
|
|
8494
8500
|
};
|
|
8495
8501
|
}());
|
|
8496
|
-
case
|
|
8502
|
+
case 27:
|
|
8497
8503
|
case "end":
|
|
8498
8504
|
return _context8.stop();
|
|
8499
8505
|
}
|
|
@@ -8508,7 +8514,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8508
8514
|
var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
8509
8515
|
form.validateFields( /*#__PURE__*/function () {
|
|
8510
8516
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(err, values) {
|
|
8511
|
-
var lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
8517
|
+
var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
8512
8518
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
8513
8519
|
while (1) switch (_context10.prev = _context10.next) {
|
|
8514
8520
|
case 0:
|
|
@@ -8526,47 +8532,48 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8526
8532
|
updateUnitPriceTax(controller, form);
|
|
8527
8533
|
return _context10.abrupt("return");
|
|
8528
8534
|
case 6:
|
|
8535
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8529
8536
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8530
|
-
_context10.next =
|
|
8537
|
+
_context10.next = 10;
|
|
8531
8538
|
return controller.setEditGood({
|
|
8532
8539
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8533
8540
|
});
|
|
8534
|
-
case
|
|
8541
|
+
case 10:
|
|
8535
8542
|
form.setFieldsValue({
|
|
8536
8543
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8537
8544
|
});
|
|
8538
8545
|
// 是否有数量
|
|
8539
8546
|
if (!(!err.quantity && values.quantity)) {
|
|
8540
|
-
_context10.next =
|
|
8547
|
+
_context10.next = 19;
|
|
8541
8548
|
break;
|
|
8542
8549
|
}
|
|
8543
|
-
quantity = format15(values.quantity);
|
|
8544
|
-
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)));
|
|
8550
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8551
|
+
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8545
8552
|
form.setFieldsValue({
|
|
8546
8553
|
priceExcludeTax: priceExcludeTax
|
|
8547
8554
|
});
|
|
8548
|
-
_context10.next =
|
|
8555
|
+
_context10.next = 17;
|
|
8549
8556
|
return controller.setEditGood({
|
|
8550
8557
|
priceExcludeTax: priceExcludeTax
|
|
8551
8558
|
});
|
|
8552
|
-
case
|
|
8553
|
-
_context10.next =
|
|
8559
|
+
case 17:
|
|
8560
|
+
_context10.next = 25;
|
|
8554
8561
|
break;
|
|
8555
|
-
case
|
|
8562
|
+
case 19:
|
|
8556
8563
|
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8557
|
-
_context10.next =
|
|
8564
|
+
_context10.next = 25;
|
|
8558
8565
|
break;
|
|
8559
8566
|
}
|
|
8560
|
-
_priceExcludeTax2 = format15(values.priceExcludeTax);
|
|
8561
|
-
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)));
|
|
8567
|
+
_priceExcludeTax2 = format15(values.priceExcludeTax, calculatingDigits);
|
|
8568
|
+
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)), calculatingDigits);
|
|
8562
8569
|
form.setFieldsValue({
|
|
8563
8570
|
quantity: _quantity4
|
|
8564
8571
|
});
|
|
8565
|
-
_context10.next =
|
|
8572
|
+
_context10.next = 25;
|
|
8566
8573
|
return controller.setEditGood({
|
|
8567
8574
|
quantity: _quantity4
|
|
8568
8575
|
});
|
|
8569
|
-
case
|
|
8576
|
+
case 25:
|
|
8570
8577
|
// 更新含税
|
|
8571
8578
|
updateUnitPriceTax(controller, form);
|
|
8572
8579
|
// 清楚 计算中启动字段
|
|
@@ -8586,7 +8593,7 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8586
8593
|
return _ref10.apply(this, arguments);
|
|
8587
8594
|
};
|
|
8588
8595
|
}());
|
|
8589
|
-
case
|
|
8596
|
+
case 27:
|
|
8590
8597
|
case "end":
|
|
8591
8598
|
return _context10.stop();
|
|
8592
8599
|
}
|
|
@@ -8726,7 +8733,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
|
|
|
8726
8733
|
case 9:
|
|
8727
8734
|
// 单价(不含税)
|
|
8728
8735
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
8729
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity);
|
|
8736
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
8730
8737
|
}
|
|
8731
8738
|
form.setFieldsValue({
|
|
8732
8739
|
priceExcludeTax: priceExcludeTax
|
|
@@ -8750,54 +8757,54 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
|
|
|
8750
8757
|
var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
|
|
8751
8758
|
form.validateFields( /*#__PURE__*/function () {
|
|
8752
8759
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(err, values) {
|
|
8753
|
-
var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
|
|
8760
|
+
var calculatingDigits, lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
|
|
8754
8761
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
8755
8762
|
while (1) switch (_context14.prev = _context14.next) {
|
|
8756
8763
|
case 0:
|
|
8757
8764
|
err = err || {};
|
|
8758
8765
|
if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
|
|
8759
|
-
_context14.next =
|
|
8766
|
+
_context14.next = 17;
|
|
8760
8767
|
break;
|
|
8761
8768
|
}
|
|
8762
|
-
// 金额(含税)= 金额(不含税)* (1+ 税率)
|
|
8769
|
+
calculatingDigits = controller.state.calculatingDigits; // 金额(含税)= 金额(不含税)* (1+ 税率)
|
|
8763
8770
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8764
8771
|
lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
|
|
8765
|
-
_context14.next =
|
|
8772
|
+
_context14.next = 7;
|
|
8766
8773
|
return controller.setEditGood({
|
|
8767
8774
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8768
8775
|
});
|
|
8769
|
-
case
|
|
8776
|
+
case 7:
|
|
8770
8777
|
if (!(!err.quantity && values.quantity)) {
|
|
8771
|
-
_context14.next =
|
|
8778
|
+
_context14.next = 11;
|
|
8772
8779
|
break;
|
|
8773
8780
|
}
|
|
8774
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
|
|
8775
|
-
_context14.next =
|
|
8781
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)), calculatingDigits);
|
|
8782
|
+
_context14.next = 11;
|
|
8776
8783
|
return controller.setEditGood({
|
|
8777
8784
|
priceIncludeTax: priceIncludeTax
|
|
8778
8785
|
});
|
|
8779
|
-
case
|
|
8786
|
+
case 11:
|
|
8780
8787
|
// 税额 = 金额(含税)-金额(不含税)
|
|
8781
8788
|
taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
|
|
8782
8789
|
form.setFieldsValue({
|
|
8783
8790
|
taxAmount: taxAmount
|
|
8784
8791
|
});
|
|
8785
|
-
_context14.next =
|
|
8792
|
+
_context14.next = 15;
|
|
8786
8793
|
return controller.setEditGood({
|
|
8787
8794
|
taxAmount: taxAmount
|
|
8788
8795
|
});
|
|
8789
|
-
case
|
|
8790
|
-
_context14.next =
|
|
8796
|
+
case 15:
|
|
8797
|
+
_context14.next = 20;
|
|
8791
8798
|
break;
|
|
8792
|
-
case
|
|
8799
|
+
case 17:
|
|
8793
8800
|
form.setFieldsValue({
|
|
8794
8801
|
taxAmount: undefined
|
|
8795
8802
|
});
|
|
8796
|
-
_context14.next =
|
|
8803
|
+
_context14.next = 20;
|
|
8797
8804
|
return controller.setEditGood({
|
|
8798
8805
|
taxAmount: undefined
|
|
8799
8806
|
});
|
|
8800
|
-
case
|
|
8807
|
+
case 20:
|
|
8801
8808
|
case "end":
|
|
8802
8809
|
return _context14.stop();
|
|
8803
8810
|
}
|
|
@@ -11911,10 +11918,10 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11911
11918
|
editGood.priceIncludeTax = undefined;
|
|
11912
11919
|
editGood.priceExcludeTax = undefined;
|
|
11913
11920
|
} else {
|
|
11914
|
-
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record);
|
|
11921
|
+
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits);
|
|
11915
11922
|
}
|
|
11916
11923
|
if (editGood.quantity && editGood.priceIncludeTax) {
|
|
11917
|
-
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
|
|
11924
|
+
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
|
|
11918
11925
|
}
|
|
11919
11926
|
// 导入FORM里
|
|
11920
11927
|
if (s.goodsListState.isMyShow) {
|
|
@@ -11949,10 +11956,10 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11949
11956
|
// : record.itemName;
|
|
11950
11957
|
// };
|
|
11951
11958
|
/** 货物单价,不含税 */
|
|
11952
|
-
var getPriceExcludeTax = function getPriceExcludeTax(s, record) {
|
|
11959
|
+
var getPriceExcludeTax = function getPriceExcludeTax(s, record, calculatingDigits) {
|
|
11953
11960
|
if (!s.taxRate && s.taxRate !== 0 || !record.priceIncludeTax && record.priceIncludeTax !== 0) return;
|
|
11954
11961
|
// 单价(含税)/(1+税率) = 单价(不含税)
|
|
11955
|
-
return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")));
|
|
11962
|
+
return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")), calculatingDigits);
|
|
11956
11963
|
};
|
|
11957
11964
|
// 获取我方名称
|
|
11958
11965
|
var getItemName$1 = function getItemName(record, editGood) {
|
|
@@ -12433,7 +12440,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
12433
12440
|
var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
|
|
12434
12441
|
var priceExcludeTax = good.priceIncludeTax ? mathjs.chain(mathjs.bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
|
|
12435
12442
|
good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
|
|
12436
|
-
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
|
|
12443
|
+
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber(), s.calculatingDigits) : undefined) || undefined;
|
|
12437
12444
|
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
12438
12445
|
});
|
|
12439
12446
|
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|
package/package.json
CHANGED