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
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** 格式化 保留2位小数 */
|
|
2
2
|
export declare const format2: (value: number | string) => number | "";
|
|
3
3
|
/** 格式化 保留15位数字 */
|
|
4
|
-
export declare const format15: (value: number | string) => number | "";
|
|
4
|
+
export declare const format15: (value: number | string, defaultFractionDigits?: number) => number | "";
|
|
5
5
|
/**
|
|
6
6
|
* 金额(含税) = 数量 * 单价(含税)
|
|
7
7
|
* @param quantity 数量
|
|
8
8
|
* @param priceIncludeTax 单价(含税)
|
|
9
9
|
* @returns 金额(含税)
|
|
10
10
|
*/
|
|
11
|
-
export declare function countAmountIncludeTax(quantity?: number | string, priceIncludeTax?: number | string): number | undefined;
|
|
11
|
+
export declare function countAmountIncludeTax(quantity?: number | string, priceIncludeTax?: number | string, calculatingDigits?: number): number | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* 不含税金额 = 含税金额-税额
|
|
14
14
|
* @param amountIncludeTax 含税金额
|
|
@@ -30,4 +30,4 @@ export declare function countTaxAmount(amountIncludeTax: string | number, deduct
|
|
|
30
30
|
* @param quantity 数量
|
|
31
31
|
* @returns 单价
|
|
32
32
|
*/
|
|
33
|
-
export declare function countPrice(amount: string | number, quantity: string | number): number | undefined | '';
|
|
33
|
+
export declare function countPrice(amount: string | number, quantity: string | number, calculatingDigits?: number): number | undefined | '';
|
package/dist/index.esm.js
CHANGED
|
@@ -935,6 +935,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
|
|
|
935
935
|
this.buyerState = new BuyerState();
|
|
936
936
|
this.goodsListState = new GoodsListState();
|
|
937
937
|
this.calculating = void 0;
|
|
938
|
+
this.calculatingDigits = void 0;
|
|
938
939
|
this.rootElement = null;
|
|
939
940
|
});
|
|
940
941
|
|
|
@@ -1074,11 +1075,12 @@ var format2 = function format2(value) {
|
|
|
1074
1075
|
};
|
|
1075
1076
|
/** 格式化 保留15位数字 */
|
|
1076
1077
|
var format15 = function format15(value) {
|
|
1078
|
+
var defaultFractionDigits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
|
|
1077
1079
|
if (value === Infinity) return '';
|
|
1078
1080
|
if ("".concat(value) === 'NaN') return '';
|
|
1079
1081
|
if (typeof value === 'string') value = parseFloat(value);
|
|
1080
1082
|
var fractionDigits = 15 - "".concat(value || 0).indexOf('.');
|
|
1081
|
-
return parseFloat(value.toFixed(fractionDigits >
|
|
1083
|
+
return parseFloat(value.toFixed(fractionDigits > defaultFractionDigits ? defaultFractionDigits : fractionDigits));
|
|
1082
1084
|
};
|
|
1083
1085
|
/**
|
|
1084
1086
|
* 金额(含税) = 数量 * 单价(含税)
|
|
@@ -1086,11 +1088,11 @@ var format15 = function format15(value) {
|
|
|
1086
1088
|
* @param priceIncludeTax 单价(含税)
|
|
1087
1089
|
* @returns 金额(含税)
|
|
1088
1090
|
*/
|
|
1089
|
-
function countAmountIncludeTax(quantity, priceIncludeTax) {
|
|
1091
|
+
function countAmountIncludeTax(quantity, priceIncludeTax, calculatingDigits) {
|
|
1090
1092
|
if (!quantity && quantity !== 0) return undefined;
|
|
1091
1093
|
if (!priceIncludeTax && priceIncludeTax !== 0) return undefined;
|
|
1092
|
-
quantity = format15(quantity);
|
|
1093
|
-
priceIncludeTax = format15(priceIncludeTax);
|
|
1094
|
+
quantity = format15(quantity, calculatingDigits);
|
|
1095
|
+
priceIncludeTax = format15(priceIncludeTax, calculatingDigits);
|
|
1094
1096
|
return parseFloat(chain$1(bignumber(priceIncludeTax)).multiply(bignumber(quantity)).done().toNumber().toFixed(2));
|
|
1095
1097
|
// return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
|
|
1096
1098
|
}
|
|
@@ -1125,10 +1127,10 @@ function countTaxAmount(amountIncludeTax, deduction, taxRate) {
|
|
|
1125
1127
|
* @param quantity 数量
|
|
1126
1128
|
* @returns 单价
|
|
1127
1129
|
*/
|
|
1128
|
-
function countPrice(amount, quantity) {
|
|
1130
|
+
function countPrice(amount, quantity, calculatingDigits) {
|
|
1129
1131
|
if (!amount && amount !== 0) return undefined;
|
|
1130
1132
|
if (!quantity && quantity !== 0) return undefined;
|
|
1131
|
-
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber());
|
|
1133
|
+
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1132
1134
|
}
|
|
1133
1135
|
|
|
1134
1136
|
/**
|
|
@@ -8067,7 +8069,7 @@ var promptErr = function promptErr(err) {
|
|
|
8067
8069
|
var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
8068
8070
|
form.validateFields( /*#__PURE__*/function () {
|
|
8069
8071
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(err, values) {
|
|
8070
|
-
var quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
8072
|
+
var calculatingDigits, quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
8071
8073
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8072
8074
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8073
8075
|
case 0:
|
|
@@ -8089,94 +8091,95 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8089
8091
|
}
|
|
8090
8092
|
return _context2.abrupt("return");
|
|
8091
8093
|
case 7:
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8095
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8096
|
+
_context2.next = 11;
|
|
8094
8097
|
return controller.setEditGood({
|
|
8095
8098
|
quantity: quantity
|
|
8096
8099
|
});
|
|
8097
|
-
case
|
|
8100
|
+
case 11:
|
|
8098
8101
|
form.setFieldsValue({
|
|
8099
8102
|
quantity: quantity
|
|
8100
8103
|
});
|
|
8101
8104
|
// 是否含税
|
|
8102
8105
|
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
8103
|
-
_context2.next =
|
|
8106
|
+
_context2.next = 30;
|
|
8104
8107
|
break;
|
|
8105
8108
|
}
|
|
8106
8109
|
if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
|
|
8107
|
-
_context2.next =
|
|
8110
|
+
_context2.next = 21;
|
|
8108
8111
|
break;
|
|
8109
8112
|
}
|
|
8110
8113
|
// 可以找到 单价(含税)
|
|
8111
|
-
priceIncludeTax = format15(values.priceIncludeTax);
|
|
8114
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8112
8115
|
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
8113
8116
|
form.setFieldsValue({
|
|
8114
8117
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8115
8118
|
});
|
|
8116
|
-
_context2.next =
|
|
8119
|
+
_context2.next = 19;
|
|
8117
8120
|
return controller.setEditGood({
|
|
8118
8121
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8119
8122
|
});
|
|
8120
|
-
case
|
|
8121
|
-
_context2.next =
|
|
8123
|
+
case 19:
|
|
8124
|
+
_context2.next = 27;
|
|
8122
8125
|
break;
|
|
8123
|
-
case
|
|
8126
|
+
case 21:
|
|
8124
8127
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8125
|
-
_context2.next =
|
|
8128
|
+
_context2.next = 27;
|
|
8126
8129
|
break;
|
|
8127
8130
|
}
|
|
8128
8131
|
// 可以找到 金额(含税)
|
|
8129
8132
|
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8130
|
-
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)));
|
|
8133
|
+
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8131
8134
|
form.setFieldsValue({
|
|
8132
8135
|
priceIncludeTax: _priceIncludeTax
|
|
8133
8136
|
});
|
|
8134
|
-
_context2.next =
|
|
8137
|
+
_context2.next = 27;
|
|
8135
8138
|
return controller.setEditGood({
|
|
8136
8139
|
priceIncludeTax: _priceIncludeTax
|
|
8137
8140
|
});
|
|
8138
|
-
case
|
|
8141
|
+
case 27:
|
|
8139
8142
|
// 更新不含税
|
|
8140
8143
|
updateUnitPriceExcludingTax(controller, form);
|
|
8141
|
-
_context2.next =
|
|
8144
|
+
_context2.next = 45;
|
|
8142
8145
|
break;
|
|
8143
|
-
case
|
|
8146
|
+
case 30:
|
|
8144
8147
|
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8145
|
-
_context2.next =
|
|
8148
|
+
_context2.next = 38;
|
|
8146
8149
|
break;
|
|
8147
8150
|
}
|
|
8148
|
-
priceExcludeTax = format15(values.priceExcludeTax);
|
|
8151
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8149
8152
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8150
8153
|
form.setFieldsValue({
|
|
8151
8154
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8152
8155
|
});
|
|
8153
|
-
_context2.next =
|
|
8156
|
+
_context2.next = 36;
|
|
8154
8157
|
return controller.setEditGood({
|
|
8155
8158
|
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
8156
8159
|
quantity: quantity
|
|
8157
8160
|
});
|
|
8158
|
-
case
|
|
8159
|
-
_context2.next =
|
|
8161
|
+
case 36:
|
|
8162
|
+
_context2.next = 44;
|
|
8160
8163
|
break;
|
|
8161
|
-
case
|
|
8164
|
+
case 38:
|
|
8162
8165
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8163
|
-
_context2.next =
|
|
8166
|
+
_context2.next = 44;
|
|
8164
8167
|
break;
|
|
8165
8168
|
}
|
|
8166
8169
|
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8167
|
-
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)));
|
|
8170
|
+
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8168
8171
|
form.setFieldsValue({
|
|
8169
8172
|
priceExcludeTax: _priceExcludeTax
|
|
8170
8173
|
});
|
|
8171
|
-
_context2.next =
|
|
8174
|
+
_context2.next = 44;
|
|
8172
8175
|
return controller.setEditGood({
|
|
8173
8176
|
priceExcludeTax: _priceExcludeTax,
|
|
8174
8177
|
quantity: quantity
|
|
8175
8178
|
});
|
|
8176
|
-
case
|
|
8179
|
+
case 44:
|
|
8177
8180
|
// 更新含税
|
|
8178
8181
|
updateUnitPriceTax(controller, form);
|
|
8179
|
-
case
|
|
8182
|
+
case 45:
|
|
8180
8183
|
// 清楚 计算中启动字段
|
|
8181
8184
|
controller.run( /*#__PURE__*/function () {
|
|
8182
8185
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
@@ -8194,7 +8197,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8194
8197
|
return _ref2.apply(this, arguments);
|
|
8195
8198
|
};
|
|
8196
8199
|
}());
|
|
8197
|
-
case
|
|
8200
|
+
case 46:
|
|
8198
8201
|
case "end":
|
|
8199
8202
|
return _context2.stop();
|
|
8200
8203
|
}
|
|
@@ -8209,7 +8212,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
|
|
|
8209
8212
|
var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
8210
8213
|
form.validateFields( /*#__PURE__*/function () {
|
|
8211
8214
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
8212
|
-
var priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
8215
|
+
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
8213
8216
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8214
8217
|
while (1) switch (_context4.prev = _context4.next) {
|
|
8215
8218
|
case 0:
|
|
@@ -8232,47 +8235,48 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8232
8235
|
}
|
|
8233
8236
|
return _context4.abrupt("return");
|
|
8234
8237
|
case 7:
|
|
8235
|
-
|
|
8236
|
-
|
|
8238
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8239
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
8240
|
+
_context4.next = 11;
|
|
8237
8241
|
return controller.setEditGood({
|
|
8238
8242
|
priceIncludeTax: priceIncludeTax
|
|
8239
8243
|
});
|
|
8240
|
-
case
|
|
8244
|
+
case 11:
|
|
8241
8245
|
form.setFieldsValue({
|
|
8242
8246
|
priceIncludeTax: priceIncludeTax
|
|
8243
8247
|
});
|
|
8244
8248
|
// 是否有数量
|
|
8245
8249
|
if (!(!err.quantity && values.quantity)) {
|
|
8246
|
-
_context4.next =
|
|
8250
|
+
_context4.next = 20;
|
|
8247
8251
|
break;
|
|
8248
8252
|
}
|
|
8249
|
-
quantity = format15(values.quantity);
|
|
8253
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8250
8254
|
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
8251
8255
|
form.setFieldsValue({
|
|
8252
8256
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8253
8257
|
});
|
|
8254
|
-
_context4.next =
|
|
8258
|
+
_context4.next = 18;
|
|
8255
8259
|
return controller.setEditGood({
|
|
8256
8260
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8257
8261
|
});
|
|
8258
|
-
case
|
|
8259
|
-
_context4.next =
|
|
8262
|
+
case 18:
|
|
8263
|
+
_context4.next = 26;
|
|
8260
8264
|
break;
|
|
8261
|
-
case
|
|
8265
|
+
case 20:
|
|
8262
8266
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
8263
|
-
_context4.next =
|
|
8267
|
+
_context4.next = 26;
|
|
8264
8268
|
break;
|
|
8265
8269
|
}
|
|
8266
8270
|
_lineAmountIncludeTax2 = format2(values.lineAmountIncludeTax);
|
|
8267
|
-
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)));
|
|
8271
|
+
_quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)), calculatingDigits);
|
|
8268
8272
|
form.setFieldsValue({
|
|
8269
8273
|
quantity: _quantity
|
|
8270
8274
|
});
|
|
8271
|
-
_context4.next =
|
|
8275
|
+
_context4.next = 26;
|
|
8272
8276
|
return controller.setEditGood({
|
|
8273
8277
|
quantity: _quantity
|
|
8274
8278
|
});
|
|
8275
|
-
case
|
|
8279
|
+
case 26:
|
|
8276
8280
|
// 更新不含税
|
|
8277
8281
|
updateUnitPriceExcludingTax(controller, form);
|
|
8278
8282
|
// 清楚 计算中启动字段
|
|
@@ -8292,7 +8296,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8292
8296
|
return _ref4.apply(this, arguments);
|
|
8293
8297
|
};
|
|
8294
8298
|
}());
|
|
8295
|
-
case
|
|
8299
|
+
case 28:
|
|
8296
8300
|
case "end":
|
|
8297
8301
|
return _context4.stop();
|
|
8298
8302
|
}
|
|
@@ -8307,7 +8311,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8307
8311
|
var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
8308
8312
|
form.validateFields( /*#__PURE__*/function () {
|
|
8309
8313
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
|
|
8310
|
-
var priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
8314
|
+
var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
|
|
8311
8315
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8312
8316
|
while (1) switch (_context6.prev = _context6.next) {
|
|
8313
8317
|
case 0:
|
|
@@ -8330,47 +8334,48 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8330
8334
|
}
|
|
8331
8335
|
return _context6.abrupt("return");
|
|
8332
8336
|
case 7:
|
|
8333
|
-
|
|
8334
|
-
|
|
8337
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8338
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
8339
|
+
_context6.next = 11;
|
|
8335
8340
|
return controller.setEditGood({
|
|
8336
8341
|
priceExcludeTax: priceExcludeTax
|
|
8337
8342
|
});
|
|
8338
|
-
case
|
|
8343
|
+
case 11:
|
|
8339
8344
|
form.setFieldsValue({
|
|
8340
8345
|
priceExcludeTax: priceExcludeTax
|
|
8341
8346
|
});
|
|
8342
8347
|
// 是否有数量
|
|
8343
8348
|
if (!(!err.quantity && values.quantity)) {
|
|
8344
|
-
_context6.next =
|
|
8349
|
+
_context6.next = 20;
|
|
8345
8350
|
break;
|
|
8346
8351
|
}
|
|
8347
|
-
quantity = format15(values.quantity);
|
|
8352
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8348
8353
|
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
8349
8354
|
form.setFieldsValue({
|
|
8350
8355
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8351
8356
|
});
|
|
8352
|
-
_context6.next =
|
|
8357
|
+
_context6.next = 18;
|
|
8353
8358
|
return controller.setEditGood({
|
|
8354
8359
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8355
8360
|
});
|
|
8356
|
-
case
|
|
8357
|
-
_context6.next =
|
|
8361
|
+
case 18:
|
|
8362
|
+
_context6.next = 26;
|
|
8358
8363
|
break;
|
|
8359
|
-
case
|
|
8364
|
+
case 20:
|
|
8360
8365
|
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
8361
|
-
_context6.next =
|
|
8366
|
+
_context6.next = 26;
|
|
8362
8367
|
break;
|
|
8363
8368
|
}
|
|
8364
8369
|
_lineAmountExcludeTax2 = format2(values.lineAmountExcludeTax);
|
|
8365
|
-
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)));
|
|
8370
|
+
_quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)), calculatingDigits);
|
|
8366
8371
|
form.setFieldsValue({
|
|
8367
8372
|
quantity: _quantity2
|
|
8368
8373
|
});
|
|
8369
|
-
_context6.next =
|
|
8374
|
+
_context6.next = 26;
|
|
8370
8375
|
return controller.setEditGood({
|
|
8371
8376
|
quantity: _quantity2
|
|
8372
8377
|
});
|
|
8373
|
-
case
|
|
8378
|
+
case 26:
|
|
8374
8379
|
// 更新含税
|
|
8375
8380
|
updateUnitPriceTax(controller, form);
|
|
8376
8381
|
// 清楚 计算中启动字段
|
|
@@ -8390,7 +8395,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8390
8395
|
return _ref6.apply(this, arguments);
|
|
8391
8396
|
};
|
|
8392
8397
|
}());
|
|
8393
|
-
case
|
|
8398
|
+
case 28:
|
|
8394
8399
|
case "end":
|
|
8395
8400
|
return _context6.stop();
|
|
8396
8401
|
}
|
|
@@ -8405,7 +8410,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8405
8410
|
var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
8406
8411
|
form.validateFields( /*#__PURE__*/function () {
|
|
8407
8412
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
|
|
8408
|
-
var lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
8413
|
+
var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
|
|
8409
8414
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
8410
8415
|
while (1) switch (_context8.prev = _context8.next) {
|
|
8411
8416
|
case 0:
|
|
@@ -8423,47 +8428,48 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8423
8428
|
updateUnitPriceExcludingTax(controller, form);
|
|
8424
8429
|
return _context8.abrupt("return");
|
|
8425
8430
|
case 6:
|
|
8431
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8426
8432
|
lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
8427
|
-
_context8.next =
|
|
8433
|
+
_context8.next = 10;
|
|
8428
8434
|
return controller.setEditGood({
|
|
8429
8435
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8430
8436
|
});
|
|
8431
|
-
case
|
|
8437
|
+
case 10:
|
|
8432
8438
|
form.setFieldsValue({
|
|
8433
8439
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8434
8440
|
});
|
|
8435
8441
|
// 是否有数量
|
|
8436
8442
|
if (!(!err.quantity && values.quantity)) {
|
|
8437
|
-
_context8.next =
|
|
8443
|
+
_context8.next = 19;
|
|
8438
8444
|
break;
|
|
8439
8445
|
}
|
|
8440
|
-
quantity = format15(values.quantity);
|
|
8441
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)));
|
|
8446
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8447
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8442
8448
|
form.setFieldsValue({
|
|
8443
8449
|
priceIncludeTax: priceIncludeTax
|
|
8444
8450
|
});
|
|
8445
|
-
_context8.next =
|
|
8451
|
+
_context8.next = 17;
|
|
8446
8452
|
return controller.setEditGood({
|
|
8447
8453
|
priceIncludeTax: priceIncludeTax
|
|
8448
8454
|
});
|
|
8449
|
-
case
|
|
8450
|
-
_context8.next =
|
|
8455
|
+
case 17:
|
|
8456
|
+
_context8.next = 25;
|
|
8451
8457
|
break;
|
|
8452
|
-
case
|
|
8458
|
+
case 19:
|
|
8453
8459
|
if (!(!err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
|
|
8454
|
-
_context8.next =
|
|
8460
|
+
_context8.next = 25;
|
|
8455
8461
|
break;
|
|
8456
8462
|
}
|
|
8457
|
-
_priceIncludeTax2 = format15(values.priceIncludeTax);
|
|
8458
|
-
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)));
|
|
8463
|
+
_priceIncludeTax2 = format15(values.priceIncludeTax, calculatingDigits);
|
|
8464
|
+
_quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)), calculatingDigits);
|
|
8459
8465
|
form.setFieldsValue({
|
|
8460
8466
|
quantity: _quantity3
|
|
8461
8467
|
});
|
|
8462
|
-
_context8.next =
|
|
8468
|
+
_context8.next = 25;
|
|
8463
8469
|
return controller.setEditGood({
|
|
8464
8470
|
quantity: _quantity3
|
|
8465
8471
|
});
|
|
8466
|
-
case
|
|
8472
|
+
case 25:
|
|
8467
8473
|
// 更新不含税
|
|
8468
8474
|
updateUnitPriceExcludingTax(controller, form);
|
|
8469
8475
|
// 清楚 计算中启动字段
|
|
@@ -8483,7 +8489,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8483
8489
|
return _ref8.apply(this, arguments);
|
|
8484
8490
|
};
|
|
8485
8491
|
}());
|
|
8486
|
-
case
|
|
8492
|
+
case 27:
|
|
8487
8493
|
case "end":
|
|
8488
8494
|
return _context8.stop();
|
|
8489
8495
|
}
|
|
@@ -8498,7 +8504,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
|
|
|
8498
8504
|
var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
8499
8505
|
form.validateFields( /*#__PURE__*/function () {
|
|
8500
8506
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(err, values) {
|
|
8501
|
-
var lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
8507
|
+
var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
|
|
8502
8508
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
8503
8509
|
while (1) switch (_context10.prev = _context10.next) {
|
|
8504
8510
|
case 0:
|
|
@@ -8516,47 +8522,48 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8516
8522
|
updateUnitPriceTax(controller, form);
|
|
8517
8523
|
return _context10.abrupt("return");
|
|
8518
8524
|
case 6:
|
|
8525
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
8519
8526
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8520
|
-
_context10.next =
|
|
8527
|
+
_context10.next = 10;
|
|
8521
8528
|
return controller.setEditGood({
|
|
8522
8529
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8523
8530
|
});
|
|
8524
|
-
case
|
|
8531
|
+
case 10:
|
|
8525
8532
|
form.setFieldsValue({
|
|
8526
8533
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
8527
8534
|
});
|
|
8528
8535
|
// 是否有数量
|
|
8529
8536
|
if (!(!err.quantity && values.quantity)) {
|
|
8530
|
-
_context10.next =
|
|
8537
|
+
_context10.next = 19;
|
|
8531
8538
|
break;
|
|
8532
8539
|
}
|
|
8533
|
-
quantity = format15(values.quantity);
|
|
8534
|
-
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)));
|
|
8540
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
8541
|
+
priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
8535
8542
|
form.setFieldsValue({
|
|
8536
8543
|
priceExcludeTax: priceExcludeTax
|
|
8537
8544
|
});
|
|
8538
|
-
_context10.next =
|
|
8545
|
+
_context10.next = 17;
|
|
8539
8546
|
return controller.setEditGood({
|
|
8540
8547
|
priceExcludeTax: priceExcludeTax
|
|
8541
8548
|
});
|
|
8542
|
-
case
|
|
8543
|
-
_context10.next =
|
|
8549
|
+
case 17:
|
|
8550
|
+
_context10.next = 25;
|
|
8544
8551
|
break;
|
|
8545
|
-
case
|
|
8552
|
+
case 19:
|
|
8546
8553
|
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
8547
|
-
_context10.next =
|
|
8554
|
+
_context10.next = 25;
|
|
8548
8555
|
break;
|
|
8549
8556
|
}
|
|
8550
|
-
_priceExcludeTax2 = format15(values.priceExcludeTax);
|
|
8551
|
-
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)));
|
|
8557
|
+
_priceExcludeTax2 = format15(values.priceExcludeTax, calculatingDigits);
|
|
8558
|
+
_quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)), calculatingDigits);
|
|
8552
8559
|
form.setFieldsValue({
|
|
8553
8560
|
quantity: _quantity4
|
|
8554
8561
|
});
|
|
8555
|
-
_context10.next =
|
|
8562
|
+
_context10.next = 25;
|
|
8556
8563
|
return controller.setEditGood({
|
|
8557
8564
|
quantity: _quantity4
|
|
8558
8565
|
});
|
|
8559
|
-
case
|
|
8566
|
+
case 25:
|
|
8560
8567
|
// 更新含税
|
|
8561
8568
|
updateUnitPriceTax(controller, form);
|
|
8562
8569
|
// 清楚 计算中启动字段
|
|
@@ -8576,7 +8583,7 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
|
|
|
8576
8583
|
return _ref10.apply(this, arguments);
|
|
8577
8584
|
};
|
|
8578
8585
|
}());
|
|
8579
|
-
case
|
|
8586
|
+
case 27:
|
|
8580
8587
|
case "end":
|
|
8581
8588
|
return _context10.stop();
|
|
8582
8589
|
}
|
|
@@ -8716,7 +8723,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
|
|
|
8716
8723
|
case 9:
|
|
8717
8724
|
// 单价(不含税)
|
|
8718
8725
|
if (lineAmountExcludeTax && !promptErr(err.quantity)) {
|
|
8719
|
-
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity);
|
|
8726
|
+
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
8720
8727
|
}
|
|
8721
8728
|
form.setFieldsValue({
|
|
8722
8729
|
priceExcludeTax: priceExcludeTax
|
|
@@ -8740,54 +8747,54 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
|
|
|
8740
8747
|
var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
|
|
8741
8748
|
form.validateFields( /*#__PURE__*/function () {
|
|
8742
8749
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(err, values) {
|
|
8743
|
-
var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
|
|
8750
|
+
var calculatingDigits, lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
|
|
8744
8751
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
8745
8752
|
while (1) switch (_context14.prev = _context14.next) {
|
|
8746
8753
|
case 0:
|
|
8747
8754
|
err = err || {};
|
|
8748
8755
|
if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
|
|
8749
|
-
_context14.next =
|
|
8756
|
+
_context14.next = 17;
|
|
8750
8757
|
break;
|
|
8751
8758
|
}
|
|
8752
|
-
// 金额(含税)= 金额(不含税)* (1+ 税率)
|
|
8759
|
+
calculatingDigits = controller.state.calculatingDigits; // 金额(含税)= 金额(不含税)* (1+ 税率)
|
|
8753
8760
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
8754
8761
|
lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
|
|
8755
|
-
_context14.next =
|
|
8762
|
+
_context14.next = 7;
|
|
8756
8763
|
return controller.setEditGood({
|
|
8757
8764
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
8758
8765
|
});
|
|
8759
|
-
case
|
|
8766
|
+
case 7:
|
|
8760
8767
|
if (!(!err.quantity && values.quantity)) {
|
|
8761
|
-
_context14.next =
|
|
8768
|
+
_context14.next = 11;
|
|
8762
8769
|
break;
|
|
8763
8770
|
}
|
|
8764
|
-
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
|
|
8765
|
-
_context14.next =
|
|
8771
|
+
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)), calculatingDigits);
|
|
8772
|
+
_context14.next = 11;
|
|
8766
8773
|
return controller.setEditGood({
|
|
8767
8774
|
priceIncludeTax: priceIncludeTax
|
|
8768
8775
|
});
|
|
8769
|
-
case
|
|
8776
|
+
case 11:
|
|
8770
8777
|
// 税额 = 金额(含税)-金额(不含税)
|
|
8771
8778
|
taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
|
|
8772
8779
|
form.setFieldsValue({
|
|
8773
8780
|
taxAmount: taxAmount
|
|
8774
8781
|
});
|
|
8775
|
-
_context14.next =
|
|
8782
|
+
_context14.next = 15;
|
|
8776
8783
|
return controller.setEditGood({
|
|
8777
8784
|
taxAmount: taxAmount
|
|
8778
8785
|
});
|
|
8779
|
-
case
|
|
8780
|
-
_context14.next =
|
|
8786
|
+
case 15:
|
|
8787
|
+
_context14.next = 20;
|
|
8781
8788
|
break;
|
|
8782
|
-
case
|
|
8789
|
+
case 17:
|
|
8783
8790
|
form.setFieldsValue({
|
|
8784
8791
|
taxAmount: undefined
|
|
8785
8792
|
});
|
|
8786
|
-
_context14.next =
|
|
8793
|
+
_context14.next = 20;
|
|
8787
8794
|
return controller.setEditGood({
|
|
8788
8795
|
taxAmount: undefined
|
|
8789
8796
|
});
|
|
8790
|
-
case
|
|
8797
|
+
case 20:
|
|
8791
8798
|
case "end":
|
|
8792
8799
|
return _context14.stop();
|
|
8793
8800
|
}
|
|
@@ -11901,10 +11908,10 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11901
11908
|
editGood.priceIncludeTax = undefined;
|
|
11902
11909
|
editGood.priceExcludeTax = undefined;
|
|
11903
11910
|
} else {
|
|
11904
|
-
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record);
|
|
11911
|
+
editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits);
|
|
11905
11912
|
}
|
|
11906
11913
|
if (editGood.quantity && editGood.priceIncludeTax) {
|
|
11907
|
-
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax);
|
|
11914
|
+
editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
|
|
11908
11915
|
}
|
|
11909
11916
|
// 导入FORM里
|
|
11910
11917
|
if (s.goodsListState.isMyShow) {
|
|
@@ -11939,10 +11946,10 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11939
11946
|
// : record.itemName;
|
|
11940
11947
|
// };
|
|
11941
11948
|
/** 货物单价,不含税 */
|
|
11942
|
-
var getPriceExcludeTax = function getPriceExcludeTax(s, record) {
|
|
11949
|
+
var getPriceExcludeTax = function getPriceExcludeTax(s, record, calculatingDigits) {
|
|
11943
11950
|
if (!s.taxRate && s.taxRate !== 0 || !record.priceIncludeTax && record.priceIncludeTax !== 0) return;
|
|
11944
11951
|
// 单价(含税)/(1+税率) = 单价(不含税)
|
|
11945
|
-
return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")));
|
|
11952
|
+
return format15(evaluate("".concat(record.priceIncludeTax, " / (1+").concat(s.taxRate, "/100)")), calculatingDigits);
|
|
11946
11953
|
};
|
|
11947
11954
|
// 获取我方名称
|
|
11948
11955
|
var getItemName$1 = function getItemName(record, editGood) {
|
|
@@ -12423,7 +12430,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
12423
12430
|
var lineAmountExcludeTax = chain$1(bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
|
|
12424
12431
|
var priceExcludeTax = good.priceIncludeTax ? chain$1(bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
|
|
12425
12432
|
good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
|
|
12426
|
-
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber()) : undefined) || undefined;
|
|
12433
|
+
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber(), s.calculatingDigits) : undefined) || undefined;
|
|
12427
12434
|
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
12428
12435
|
});
|
|
12429
12436
|
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|