kts-component-invoice-operate 3.2.76 → 3.2.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -1514,6 +1514,7 @@ var addGoodDiscount = /*#__PURE__*/(function () {
|
|
|
1514
1514
|
taxClassificationCode: good.taxClassificationCode,
|
|
1515
1515
|
taxRate: good.taxRate,
|
|
1516
1516
|
itemName: good.itemName,
|
|
1517
|
+
shorthand: good.shorthand,
|
|
1517
1518
|
itemNameSelf: good.itemNameSelf,
|
|
1518
1519
|
favouredPolicyMark: good.favouredPolicyMark,
|
|
1519
1520
|
favouredPolicyName: good.favouredPolicyName,
|
|
@@ -14577,7 +14578,7 @@ function useMergeDetails() {
|
|
|
14577
14578
|
}, _callee);
|
|
14578
14579
|
})), [controller]);
|
|
14579
14580
|
var onClickAuto = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
14580
|
-
var group, i, _selectedGoodIndex;
|
|
14581
|
+
var goodsList, isTaxIncluded, group, i, _selectedGoodIndex;
|
|
14581
14582
|
|
|
14582
14583
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14583
14584
|
while (1) {
|
|
@@ -14591,27 +14592,29 @@ function useMergeDetails() {
|
|
|
14591
14592
|
return controller.wait();
|
|
14592
14593
|
|
|
14593
14594
|
case 4:
|
|
14594
|
-
|
|
14595
|
+
goodsList = controller.state.goodsListState.goodsList;
|
|
14596
|
+
isTaxIncluded = controller.state.goodsListState.isTaxIncluded;
|
|
14597
|
+
group = groupBy(goodsList, isTaxIncluded);
|
|
14595
14598
|
i = 0;
|
|
14596
14599
|
|
|
14597
|
-
case
|
|
14600
|
+
case 8:
|
|
14598
14601
|
if (!(i < group.length)) {
|
|
14599
|
-
_context2.next =
|
|
14602
|
+
_context2.next = 15;
|
|
14600
14603
|
break;
|
|
14601
14604
|
}
|
|
14602
14605
|
|
|
14603
14606
|
_selectedGoodIndex = group[i].map(function (e) {
|
|
14604
14607
|
return e.$index;
|
|
14605
14608
|
});
|
|
14606
|
-
_context2.next =
|
|
14609
|
+
_context2.next = 12;
|
|
14607
14610
|
return controller.mergeDetails(_selectedGoodIndex);
|
|
14608
14611
|
|
|
14609
|
-
case
|
|
14612
|
+
case 12:
|
|
14610
14613
|
i++;
|
|
14611
|
-
_context2.next =
|
|
14614
|
+
_context2.next = 8;
|
|
14612
14615
|
break;
|
|
14613
14616
|
|
|
14614
|
-
case
|
|
14617
|
+
case 15:
|
|
14615
14618
|
case "end":
|
|
14616
14619
|
return _context2.stop();
|
|
14617
14620
|
}
|
|
@@ -14645,20 +14648,26 @@ function useMergeDetails() {
|
|
|
14645
14648
|
};
|
|
14646
14649
|
} // 根据"商品编码"" 和 "单价" 分组
|
|
14647
14650
|
|
|
14648
|
-
function groupBy(arr) {
|
|
14649
|
-
var grouped = {};
|
|
14650
|
-
// if (!item.itemCode) continue;
|
|
14651
|
-
// const key = `${item.itemCode}${item.priceIncludeTax}${item.priceExcludeTax}`;
|
|
14652
|
-
// if (!grouped[key]) {
|
|
14653
|
-
// grouped[key] = [];
|
|
14654
|
-
// }
|
|
14655
|
-
// grouped[key].push(item);
|
|
14656
|
-
// }
|
|
14651
|
+
function groupBy(arr, isTaxIncluded) {
|
|
14652
|
+
var grouped = {};
|
|
14657
14653
|
|
|
14658
|
-
|
|
14659
|
-
var item = arr[
|
|
14660
|
-
|
|
14661
|
-
|
|
14654
|
+
var _loop = function _loop(_i) {
|
|
14655
|
+
var item = arr[_i];
|
|
14656
|
+
|
|
14657
|
+
if (!item.itemCode) {
|
|
14658
|
+
i = _i;
|
|
14659
|
+
return "continue";
|
|
14660
|
+
}
|
|
14661
|
+
|
|
14662
|
+
var key = function () {
|
|
14663
|
+
if (isTaxIncluded) {
|
|
14664
|
+
i = _i;
|
|
14665
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceIncludeTax || 0) * 100) / 100);
|
|
14666
|
+
} else {
|
|
14667
|
+
i = _i;
|
|
14668
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceExcludeTax || 0) * 100) / 100);
|
|
14669
|
+
}
|
|
14670
|
+
}();
|
|
14662
14671
|
|
|
14663
14672
|
if (!grouped[key]) {
|
|
14664
14673
|
grouped[key] = [];
|
|
@@ -14667,9 +14676,17 @@ function groupBy(arr) {
|
|
|
14667
14676
|
grouped[key].push(item);
|
|
14668
14677
|
|
|
14669
14678
|
if (item.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
14670
|
-
grouped[key].push(arr[
|
|
14671
|
-
|
|
14679
|
+
grouped[key].push(arr[_i + 1]);
|
|
14680
|
+
_i++;
|
|
14672
14681
|
}
|
|
14682
|
+
|
|
14683
|
+
i = _i;
|
|
14684
|
+
};
|
|
14685
|
+
|
|
14686
|
+
for (var i = 0; i < arr.length; i++) {
|
|
14687
|
+
var _ret = _loop(i);
|
|
14688
|
+
|
|
14689
|
+
if (_ret === "continue") continue;
|
|
14673
14690
|
}
|
|
14674
14691
|
|
|
14675
14692
|
return Object.values(grouped);
|
package/dist/index.js
CHANGED
|
@@ -1524,6 +1524,7 @@ var addGoodDiscount = /*#__PURE__*/(function () {
|
|
|
1524
1524
|
taxClassificationCode: good.taxClassificationCode,
|
|
1525
1525
|
taxRate: good.taxRate,
|
|
1526
1526
|
itemName: good.itemName,
|
|
1527
|
+
shorthand: good.shorthand,
|
|
1527
1528
|
itemNameSelf: good.itemNameSelf,
|
|
1528
1529
|
favouredPolicyMark: good.favouredPolicyMark,
|
|
1529
1530
|
favouredPolicyName: good.favouredPolicyName,
|
|
@@ -14587,7 +14588,7 @@ function useMergeDetails() {
|
|
|
14587
14588
|
}, _callee);
|
|
14588
14589
|
})), [controller]);
|
|
14589
14590
|
var onClickAuto = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
14590
|
-
var group, i, _selectedGoodIndex;
|
|
14591
|
+
var goodsList, isTaxIncluded, group, i, _selectedGoodIndex;
|
|
14591
14592
|
|
|
14592
14593
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14593
14594
|
while (1) {
|
|
@@ -14601,27 +14602,29 @@ function useMergeDetails() {
|
|
|
14601
14602
|
return controller.wait();
|
|
14602
14603
|
|
|
14603
14604
|
case 4:
|
|
14604
|
-
|
|
14605
|
+
goodsList = controller.state.goodsListState.goodsList;
|
|
14606
|
+
isTaxIncluded = controller.state.goodsListState.isTaxIncluded;
|
|
14607
|
+
group = groupBy(goodsList, isTaxIncluded);
|
|
14605
14608
|
i = 0;
|
|
14606
14609
|
|
|
14607
|
-
case
|
|
14610
|
+
case 8:
|
|
14608
14611
|
if (!(i < group.length)) {
|
|
14609
|
-
_context2.next =
|
|
14612
|
+
_context2.next = 15;
|
|
14610
14613
|
break;
|
|
14611
14614
|
}
|
|
14612
14615
|
|
|
14613
14616
|
_selectedGoodIndex = group[i].map(function (e) {
|
|
14614
14617
|
return e.$index;
|
|
14615
14618
|
});
|
|
14616
|
-
_context2.next =
|
|
14619
|
+
_context2.next = 12;
|
|
14617
14620
|
return controller.mergeDetails(_selectedGoodIndex);
|
|
14618
14621
|
|
|
14619
|
-
case
|
|
14622
|
+
case 12:
|
|
14620
14623
|
i++;
|
|
14621
|
-
_context2.next =
|
|
14624
|
+
_context2.next = 8;
|
|
14622
14625
|
break;
|
|
14623
14626
|
|
|
14624
|
-
case
|
|
14627
|
+
case 15:
|
|
14625
14628
|
case "end":
|
|
14626
14629
|
return _context2.stop();
|
|
14627
14630
|
}
|
|
@@ -14655,20 +14658,26 @@ function useMergeDetails() {
|
|
|
14655
14658
|
};
|
|
14656
14659
|
} // 根据"商品编码"" 和 "单价" 分组
|
|
14657
14660
|
|
|
14658
|
-
function groupBy(arr) {
|
|
14659
|
-
var grouped = {};
|
|
14660
|
-
// if (!item.itemCode) continue;
|
|
14661
|
-
// const key = `${item.itemCode}${item.priceIncludeTax}${item.priceExcludeTax}`;
|
|
14662
|
-
// if (!grouped[key]) {
|
|
14663
|
-
// grouped[key] = [];
|
|
14664
|
-
// }
|
|
14665
|
-
// grouped[key].push(item);
|
|
14666
|
-
// }
|
|
14661
|
+
function groupBy(arr, isTaxIncluded) {
|
|
14662
|
+
var grouped = {};
|
|
14667
14663
|
|
|
14668
|
-
|
|
14669
|
-
var item = arr[
|
|
14670
|
-
|
|
14671
|
-
|
|
14664
|
+
var _loop = function _loop(_i) {
|
|
14665
|
+
var item = arr[_i];
|
|
14666
|
+
|
|
14667
|
+
if (!item.itemCode) {
|
|
14668
|
+
i = _i;
|
|
14669
|
+
return "continue";
|
|
14670
|
+
}
|
|
14671
|
+
|
|
14672
|
+
var key = function () {
|
|
14673
|
+
if (isTaxIncluded) {
|
|
14674
|
+
i = _i;
|
|
14675
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceIncludeTax || 0) * 100) / 100);
|
|
14676
|
+
} else {
|
|
14677
|
+
i = _i;
|
|
14678
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceExcludeTax || 0) * 100) / 100);
|
|
14679
|
+
}
|
|
14680
|
+
}();
|
|
14672
14681
|
|
|
14673
14682
|
if (!grouped[key]) {
|
|
14674
14683
|
grouped[key] = [];
|
|
@@ -14677,9 +14686,17 @@ function groupBy(arr) {
|
|
|
14677
14686
|
grouped[key].push(item);
|
|
14678
14687
|
|
|
14679
14688
|
if (item.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
14680
|
-
grouped[key].push(arr[
|
|
14681
|
-
|
|
14689
|
+
grouped[key].push(arr[_i + 1]);
|
|
14690
|
+
_i++;
|
|
14682
14691
|
}
|
|
14692
|
+
|
|
14693
|
+
i = _i;
|
|
14694
|
+
};
|
|
14695
|
+
|
|
14696
|
+
for (var i = 0; i < arr.length; i++) {
|
|
14697
|
+
var _ret = _loop(i);
|
|
14698
|
+
|
|
14699
|
+
if (_ret === "continue") continue;
|
|
14683
14700
|
}
|
|
14684
14701
|
|
|
14685
14702
|
return Object.values(grouped);
|
package/package.json
CHANGED
|
@@ -101,7 +101,7 @@ export default async (state: InvoiceControllerState, options?: IOptions) => {
|
|
|
101
101
|
.done()
|
|
102
102
|
.toNumber();
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
good.discountGroup = discountGroup;
|
|
106
106
|
good.lineAttribute = LineAttributeType.被折扣行;
|
|
107
107
|
goodsList.splice(i + 1, 0, {
|
|
@@ -110,6 +110,7 @@ export default async (state: InvoiceControllerState, options?: IOptions) => {
|
|
|
110
110
|
taxClassificationCode: good.taxClassificationCode,
|
|
111
111
|
taxRate: good.taxRate,
|
|
112
112
|
itemName: good.itemName,
|
|
113
|
+
shorthand: good.shorthand,
|
|
113
114
|
itemNameSelf: good.itemNameSelf,
|
|
114
115
|
favouredPolicyMark: good.favouredPolicyMark,
|
|
115
116
|
favouredPolicyName: good.favouredPolicyName,
|
|
@@ -23,7 +23,9 @@ export default function useMergeDetails() {
|
|
|
23
23
|
const onClickAuto = React.useCallback(async () => {
|
|
24
24
|
await controller.saveEditGood();
|
|
25
25
|
await controller.wait();
|
|
26
|
-
const
|
|
26
|
+
const goodsList = controller.state.goodsListState.goodsList;
|
|
27
|
+
const isTaxIncluded = controller.state.goodsListState.isTaxIncluded;
|
|
28
|
+
const group = groupBy(goodsList, isTaxIncluded);
|
|
27
29
|
for (let i = 0; i < group.length; i++) {
|
|
28
30
|
const selectedGoodIndex = group[i].map(e => e.$index);
|
|
29
31
|
await controller.mergeDetails(selectedGoodIndex);
|
|
@@ -63,23 +65,24 @@ export default function useMergeDetails() {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
// 根据"商品编码"" 和 "单价" 分组
|
|
66
|
-
function groupBy(arr: IGood[]): IGood[][] {
|
|
68
|
+
function groupBy(arr: IGood[], isTaxIncluded: boolean): IGood[][] {
|
|
67
69
|
const grouped: any = {};
|
|
68
|
-
// for (const item of arr) {
|
|
69
|
-
// if (!item.itemCode) continue;
|
|
70
|
-
// const key = `${item.itemCode}${item.priceIncludeTax}${item.priceExcludeTax}`;
|
|
71
|
-
// if (!grouped[key]) {
|
|
72
|
-
// grouped[key] = [];
|
|
73
|
-
// }
|
|
74
|
-
// grouped[key].push(item);
|
|
75
|
-
// }
|
|
76
70
|
for (let i = 0; i < arr.length; i++) {
|
|
77
71
|
const item = arr[i];
|
|
78
72
|
if (!item.itemCode) continue;
|
|
79
|
-
|
|
73
|
+
|
|
74
|
+
const key = (() => {
|
|
75
|
+
if (isTaxIncluded) {
|
|
76
|
+
return `${item.itemCode}${Math.floor((item.priceIncludeTax || 0) * 100) / 100}`;
|
|
77
|
+
} else {
|
|
78
|
+
return `${item.itemCode}${Math.floor((item.priceExcludeTax || 0) * 100) / 100}`;
|
|
79
|
+
}
|
|
80
|
+
})()
|
|
81
|
+
|
|
80
82
|
if (!grouped[key]) {
|
|
81
83
|
grouped[key] = [];
|
|
82
84
|
}
|
|
85
|
+
|
|
83
86
|
grouped[key].push(item);
|
|
84
87
|
if (item.lineAttribute === LineAttributeType.被折扣行) {
|
|
85
88
|
grouped[key].push(arr[i + 1]); i++;
|