@zeniai/client-epic-state 4.10.7 → 4.10.8
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/lib/commonPayloadTypes/agingReportPayloadTypes.d.ts +1 -0
- package/lib/commonPayloadTypes/subAccountView/subAccountPayloadHelper.js +2 -2
- package/lib/commonStateTypes/accountView/{getNestedAccountIDHeirarchyForReport.d.ts → getNestedAccountIDHierarchyForReport.d.ts} +2 -2
- package/lib/commonStateTypes/accountView/nestedAccountID.d.ts +2 -2
- package/lib/commonStateTypes/agingBalance/agingBalance.d.ts +4 -0
- package/lib/commonStateTypes/agingBalance/agingBalance.js +4 -1
- package/lib/commonStateTypes/classesView/getNestedClassIDHierarchyForReport.d.ts +2 -2
- package/lib/commonStateTypes/classesView/nestedClassID.d.ts +2 -2
- package/lib/commonStateTypes/customerView/getNestedCustomerHierarchy.d.ts +9 -0
- package/lib/commonStateTypes/customerView/getNestedCustomerHierarchy.js +46 -0
- package/lib/commonStateTypes/customerView/nestedCustomerID.d.ts +42 -0
- package/lib/commonStateTypes/customerView/nestedCustomerID.js +9 -0
- package/lib/commonStateTypes/selectorTypes/classesViewSelectorReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +4 -7
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/account/subAccountSelector.js +7 -7
- package/lib/entity/accountGroup/accountGroupV2Selector.js +3 -3
- package/lib/entity/class/classSelectorV2.d.ts +1 -1
- package/lib/entity/class/classSelectorV2.js +10 -10
- package/lib/entity/customer/customerPayload.d.ts +1 -1
- package/lib/entity/customer/customerPayload.js +1 -1
- package/lib/entity/customer/customerReducer.d.ts +1 -1
- package/lib/entity/customer/customerSelector.d.ts +1 -1
- package/lib/entity/customerIncome/customerIncomeTrend.d.ts +1 -1
- package/lib/entity/customerIncome/customerIncomeTrendReducer.d.ts +1 -1
- package/lib/entity/sectionAccountsView/getNestedAccountIDHierarchyForSection.js +9 -9
- package/lib/entity/sectionAccountsView/sectionAccountsViewEpic.js +2 -2
- package/lib/entity/sectionAccountsView/sectionAccountsViewSelector.js +3 -3
- package/lib/entity/sectionClassesViewV2/sectionClassesViewEpic.js +2 -2
- package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.js +7 -7
- package/lib/entity/sectionClassesViewV2/selectorHelpers/getNestedClassIDHierarchyForSection.js +7 -7
- package/lib/entity/transaction/stateTypes/customerTransaction.d.ts +1 -1
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
- package/lib/index.d.ts +14 -12
- package/lib/index.js +7 -6
- package/lib/reducer.d.ts +1 -1
- package/lib/view/accountList/accountListReducer.js +2 -2
- package/lib/view/accountList/accountListSelector.d.ts +3 -3
- package/lib/view/accountList/accountListSelector.js +3 -3
- package/lib/view/accountList/accountListState.d.ts +2 -2
- package/lib/view/accountMappingView/accountMappingReducer.js +19 -19
- package/lib/view/accountMappingView/accountMappingState.d.ts +8 -8
- package/lib/view/accountMappingView/accountMappingViewSelector.d.ts +8 -8
- package/lib/view/accountMappingView/accountMappingViewSelector.js +7 -7
- package/lib/view/apAgingView/apAgingReport/apAgingReducer.d.ts +7 -5
- package/lib/view/apAgingView/apAgingReport/apAgingReducer.js +34 -15
- package/lib/view/apAgingView/apAgingReport/apAgingSelector.d.ts +1 -1
- package/lib/view/apAgingView/apAgingReport/apAgingSelector.js +29 -16
- package/lib/view/apAgingView/apAgingReport/apAgingState.d.ts +6 -3
- package/lib/view/apAgingView/apAgingReport/fetchApAgingEpic.js +11 -7
- package/lib/view/arAgingView/arAgingDetail/arAgingDetailSelector.d.ts +1 -1
- package/lib/view/arAgingView/arAgingReport/arAgingPayload.js +8 -1
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.d.ts +13 -7
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +49 -15
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.d.ts +12 -6
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +68 -35
- package/lib/view/arAgingView/arAgingReport/arAgingState.d.ts +12 -4
- package/lib/view/arAgingView/arAgingReport/fetchArAgingEpic.js +10 -7
- package/lib/view/classList/classListSelector.d.ts +3 -3
- package/lib/view/classList/classListSelector.js +3 -3
- package/lib/view/classList/classListState.d.ts +2 -2
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewSelector.d.ts +4 -4
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewSelector.js +4 -4
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +4 -4
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +4 -4
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +4 -4
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +4 -4
- package/lib/view/dashboard/dashboardEpic.js +6 -4
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +3 -3
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewSelector.js +3 -3
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewState.d.ts +2 -2
- package/lib/view/opExClassesView/opExClassesViewReducer.js +3 -3
- package/lib/view/opExClassesView/opExClassesViewSelector.js +3 -3
- package/lib/view/opExClassesView/opExClassesViewState.d.ts +2 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +3 -3
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +2 -2
- package/lib/view/revenueClassesView/revenueClassesViewReducer.js +3 -3
- package/lib/view/revenueClassesView/revenueClassesViewSelector.js +3 -3
- package/lib/view/revenueClassesView/revenueClassesViewState.d.ts +2 -2
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.d.ts +5 -5
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +5 -5
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +2 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.d.ts +2 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +4 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -4
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +4 -4
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +4 -4
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +4 -4
- package/lib/view/transactionDetail/transactionDetailSelector.js +4 -4
- package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +1 -1
- package/package.json +1 -1
- package/lib/commonStateTypes/accountView/{getNestedAccountIDHeirarchyForReport.js → getNestedAccountIDHierarchyForReport.js} +0 -0
- package/lib/entity/customer/{customer.d.ts → customerState.d.ts} +4 -4
- /package/lib/entity/customer/{customer.js → customerState.js} +0 -0
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearApAging = exports.updateApAgingOnSuccess = exports.updateApAgingOnFailure = exports.updateApAgingUIState = exports.fetchApAging = exports.initialState = exports.inititalUIState = void 0;
|
|
4
|
+
exports.clearApAging = exports.updateApAgingOnSuccess = exports.updateApAgingOnFailure = exports.updateApAgingUIState = exports.fetchApAging = exports.initialStateAgingBalances = exports.initialState = exports.inititalUIState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const apAgingPayload_1 = require("./apAgingPayload");
|
|
7
7
|
const agingBalance_1 = require("../../../commonStateTypes/agingBalance/agingBalance");
|
|
8
8
|
const viewAndReportPayloadv2_1 = require("../../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
9
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
9
10
|
const vendorState_1 = require("../../../entity/vendor/vendorState");
|
|
10
11
|
exports.inititalUIState = {
|
|
11
12
|
searchString: '',
|
|
12
13
|
sortKey: 'vendor',
|
|
13
14
|
sortOrder: 'ascending',
|
|
14
15
|
downloadState: 'Not-Started',
|
|
15
|
-
selectedDate:
|
|
16
|
+
selectedDate: (0, zeniDayJS_1.dateNow)(),
|
|
17
|
+
agingDateSelectionType: 'custom_date',
|
|
16
18
|
};
|
|
17
19
|
exports.initialState = {
|
|
18
20
|
reportId: 'accounts_payable_aging',
|
|
19
21
|
reportTitle: 'AP Aging',
|
|
20
22
|
firstMonthOfFY: 1,
|
|
21
|
-
apAgingBalancesByVendorId: {},
|
|
22
23
|
fetchState: 'Not-Started',
|
|
23
24
|
error: undefined,
|
|
24
25
|
uiState: exports.inititalUIState,
|
|
25
|
-
|
|
26
|
+
apAgingBalancesByDate: {},
|
|
26
27
|
agingPeriods: [],
|
|
27
28
|
bookCloseDate: undefined,
|
|
28
29
|
dataAvailable: undefined,
|
|
29
30
|
currency: vendorState_1.defaultVendorCurrency,
|
|
30
31
|
};
|
|
32
|
+
exports.initialStateAgingBalances = {
|
|
33
|
+
apAgingBalancesByVendorId: {},
|
|
34
|
+
apAgingTotals: [],
|
|
35
|
+
};
|
|
31
36
|
const apAging = (0, toolkit_1.createSlice)({
|
|
32
37
|
name: 'apAging',
|
|
33
38
|
initialState: exports.initialState,
|
|
34
39
|
reducers: {
|
|
35
40
|
fetchApAging: {
|
|
36
41
|
reducer(draft, action) {
|
|
37
|
-
const { cacheOverride } = action.payload;
|
|
38
|
-
|
|
42
|
+
const { cacheOverride, reportDate } = action.payload;
|
|
43
|
+
const key = (0, agingBalance_1.getAgingBalancesKey)(reportDate);
|
|
44
|
+
const record = draft.apAgingBalancesByDate[key];
|
|
45
|
+
draft.uiState.selectedDate = reportDate;
|
|
46
|
+
if (cacheOverride || record == null) {
|
|
39
47
|
draft.fetchState = 'In-Progress';
|
|
40
48
|
draft.error = undefined;
|
|
41
49
|
}
|
|
42
50
|
},
|
|
43
|
-
prepare(cacheOverride = false
|
|
44
|
-
reportDate) {
|
|
51
|
+
prepare(reportDate, cacheOverride = false) {
|
|
45
52
|
return {
|
|
46
53
|
payload: {
|
|
47
54
|
cacheOverride,
|
|
@@ -51,25 +58,25 @@ const apAging = (0, toolkit_1.createSlice)({
|
|
|
51
58
|
},
|
|
52
59
|
},
|
|
53
60
|
updateApAgingOnSuccess: {
|
|
54
|
-
prepare(data) {
|
|
61
|
+
prepare(reportDate, data) {
|
|
55
62
|
return {
|
|
56
63
|
payload: {
|
|
64
|
+
reportDate,
|
|
57
65
|
data,
|
|
58
66
|
},
|
|
59
67
|
};
|
|
60
68
|
},
|
|
61
69
|
reducer(draft, action) {
|
|
62
|
-
const { data } = action.payload;
|
|
63
|
-
draft.fetchState = 'Completed';
|
|
64
|
-
draft.error = undefined;
|
|
70
|
+
const { data, reportDate } = action.payload;
|
|
65
71
|
const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(data);
|
|
66
72
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
67
|
-
draft.currency = report.currency;
|
|
68
73
|
draft.bookCloseDate = report.bookCloseDate;
|
|
69
74
|
draft.dataAvailable = report.dataAvailable;
|
|
70
|
-
draft.
|
|
71
|
-
draft.apAgingTotals = (0, apAgingPayload_1.toApAgingTotals)(data);
|
|
75
|
+
doUpdateApAgingBalancesByDate(draft.apAgingBalancesByDate, reportDate, data);
|
|
72
76
|
draft.agingPeriods = data.aging_periods.map((elem) => (0, agingBalance_1.toAgingPeriod)(elem));
|
|
77
|
+
draft.uiState.selectedDate = reportDate;
|
|
78
|
+
draft.fetchState = 'Completed';
|
|
79
|
+
draft.error = undefined;
|
|
73
80
|
},
|
|
74
81
|
},
|
|
75
82
|
updateApAgingUIState(draft, action) {
|
|
@@ -88,6 +95,10 @@ const apAging = (0, toolkit_1.createSlice)({
|
|
|
88
95
|
if (action.payload.selectedDate != null) {
|
|
89
96
|
draft.uiState.selectedDate = action.payload.selectedDate;
|
|
90
97
|
}
|
|
98
|
+
if (action.payload.agingDateSelectionType != null) {
|
|
99
|
+
draft.uiState.agingDateSelectionType =
|
|
100
|
+
action.payload.agingDateSelectionType;
|
|
101
|
+
}
|
|
91
102
|
},
|
|
92
103
|
updateApAgingOnFailure: {
|
|
93
104
|
reducer(draft, action) {
|
|
@@ -105,3 +116,11 @@ const apAging = (0, toolkit_1.createSlice)({
|
|
|
105
116
|
});
|
|
106
117
|
_a = apAging.actions, exports.fetchApAging = _a.fetchApAging, exports.updateApAgingUIState = _a.updateApAgingUIState, exports.updateApAgingOnFailure = _a.updateApAgingOnFailure, exports.updateApAgingOnSuccess = _a.updateApAgingOnSuccess, exports.clearApAging = _a.clearApAging;
|
|
107
118
|
exports.default = apAging.reducer;
|
|
119
|
+
const doUpdateApAgingBalancesByDate = (draft, reportDate, data) => {
|
|
120
|
+
const key = (0, agingBalance_1.getAgingBalancesKey)(reportDate);
|
|
121
|
+
const agingBalances = {
|
|
122
|
+
apAgingBalancesByVendorId: (0, apAgingPayload_1.toApAgingDataByVendorId)(data),
|
|
123
|
+
apAgingTotals: (0, apAgingPayload_1.toApAgingTotals)(data),
|
|
124
|
+
};
|
|
125
|
+
draft[key] = agingBalances;
|
|
126
|
+
};
|
|
@@ -10,7 +10,7 @@ export interface AgingBalancesByVendor {
|
|
|
10
10
|
apAgingBalances: AgingBalance[];
|
|
11
11
|
}
|
|
12
12
|
export interface ApAgingReport extends SelectorReport {
|
|
13
|
-
|
|
13
|
+
agingBalances: AgingBalancesByVendor[];
|
|
14
14
|
totalBalances: AgingBalance[];
|
|
15
15
|
apAgingUIState: AgingReportUIState;
|
|
16
16
|
agingPeriods: AgingPeriod[];
|
|
@@ -5,18 +5,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getApAgingReport = void 0;
|
|
7
7
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
|
-
const keys_1 = __importDefault(require("lodash/keys"));
|
|
9
8
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
|
+
const keys_1 = __importDefault(require("lodash/keys"));
|
|
10
|
+
const agingBalance_1 = require("../../../commonStateTypes/agingBalance/agingBalance");
|
|
10
11
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
11
12
|
exports.getApAgingReport = (0, toolkit_1.createSelector)((state) => state.apAgingState, (state) => state.vendorState, (apAgingState, vendorState) => {
|
|
12
|
-
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY,
|
|
13
|
-
const { searchString, sortOrder, sortKey } = uiState;
|
|
14
|
-
const
|
|
13
|
+
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY, agingPeriods, currency, } = apAgingState;
|
|
14
|
+
const { searchString, sortOrder, sortKey, selectedDate } = uiState;
|
|
15
|
+
const balancesKey = (0, agingBalance_1.getAgingBalancesKey)(selectedDate);
|
|
16
|
+
const apAgingBalancesByDate = apAgingState.apAgingBalancesByDate[balancesKey];
|
|
17
|
+
const apAgingBalancesByVendorId = apAgingBalancesByDate != null
|
|
18
|
+
? apAgingBalancesByDate.apAgingBalancesByVendorId
|
|
19
|
+
: {};
|
|
20
|
+
const apAgingTotals = apAgingBalancesByDate != null
|
|
21
|
+
? apAgingBalancesByDate.apAgingTotals
|
|
22
|
+
: [];
|
|
23
|
+
const agingBalances = getAgingBalancesByVendor(vendorState, apAgingBalancesByVendorId, currency, searchString, sortKey, sortOrder);
|
|
24
|
+
return {
|
|
25
|
+
agingBalances,
|
|
26
|
+
reportId,
|
|
27
|
+
reportTitle,
|
|
28
|
+
fetchState,
|
|
29
|
+
firstMonthOfFY,
|
|
30
|
+
agingPeriods,
|
|
31
|
+
apAgingUIState: uiState,
|
|
32
|
+
totalBalances: apAgingTotals,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const getAgingBalancesByVendor = (vendorState, agingBalancesByVendorId, currency, searchString, sortKey, sortOrder) => {
|
|
36
|
+
const agingBalancesByVendor = (0, keys_1.default)(agingBalancesByVendorId).map((vendorId) => {
|
|
15
37
|
const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
|
|
16
38
|
if (vendor == null) {
|
|
17
39
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
18
40
|
}
|
|
19
|
-
const apAgingBalances =
|
|
41
|
+
const apAgingBalances = agingBalancesByVendorId[vendorId];
|
|
20
42
|
const { currencyCode, currencySymbol } = currency;
|
|
21
43
|
const vendorTotal = apAgingBalances.reduce((prev, curr) => {
|
|
22
44
|
return prev + curr.balance.amount;
|
|
@@ -45,14 +67,5 @@ exports.getApAgingReport = (0, toolkit_1.createSelector)((state) => state.apAgin
|
|
|
45
67
|
}
|
|
46
68
|
}
|
|
47
69
|
}, sortOrder === 'ascending' ? 'asc' : 'desc');
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
reportId,
|
|
51
|
-
reportTitle,
|
|
52
|
-
fetchState,
|
|
53
|
-
firstMonthOfFY,
|
|
54
|
-
agingPeriods,
|
|
55
|
-
apAgingUIState: uiState,
|
|
56
|
-
totalBalances: apAgingTotals,
|
|
57
|
-
};
|
|
58
|
-
});
|
|
70
|
+
return sortedAgingBalancesByVendor;
|
|
71
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ReportV2 } from '../../../commonStateTypes/v2/viewAndReport';
|
|
2
2
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
3
|
-
import { AgingBalance, AgingPeriod } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
3
|
+
import { AgingBalance, AgingBalancesKey, AgingPeriod } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
4
|
import { AgingReportUIState } from '../../../commonStateTypes/viewAndReport/agingReportStateTypes';
|
|
5
|
-
export interface
|
|
5
|
+
export interface APAgingBalancesByAgingBalancesKey {
|
|
6
6
|
apAgingBalancesByVendorId: Record<ID, AgingBalance[]>;
|
|
7
|
-
uiState: AgingReportUIState;
|
|
8
7
|
apAgingTotals: AgingBalance[];
|
|
8
|
+
}
|
|
9
|
+
export interface ApAgingState extends ReportV2, FetchStateAndError {
|
|
10
|
+
apAgingBalancesByDate: Record<AgingBalancesKey, APAgingBalancesByAgingBalancesKey>;
|
|
11
|
+
uiState: AgingReportUIState;
|
|
9
12
|
agingPeriods: AgingPeriod[];
|
|
10
13
|
}
|
|
@@ -6,23 +6,27 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const vendorReducer_1 = require("../../../entity/vendor/vendorReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
8
|
const apAgingReducer_1 = require("./apAgingReducer");
|
|
9
|
+
const agingBalance_1 = require("../../../commonStateTypes/agingBalance/agingBalance");
|
|
10
|
+
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
9
11
|
const fetchApAgingEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(apAgingReducer_1.fetchApAging.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
-
|
|
11
|
-
const state = state$.value;
|
|
12
|
-
const { reportDate } = action.payload;
|
|
12
|
+
const { reportDate, cacheOverride } = action.payload;
|
|
13
13
|
const queryParam = {
|
|
14
14
|
is_employee_allowed: true,
|
|
15
|
-
report_date: reportDate
|
|
16
|
-
? reportDate.format('YYYY-MM-DD')
|
|
17
|
-
: (_a = state.apAgingState.uiState.selectedDate) === null || _a === void 0 ? void 0 : _a.date.format('YYYY-MM-DD'),
|
|
15
|
+
report_date: reportDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
18
16
|
};
|
|
17
|
+
const apAgingState = state$.value.apAgingState;
|
|
18
|
+
const key = (0, agingBalance_1.getAgingBalancesKey)(reportDate);
|
|
19
|
+
if (apAgingState.apAgingBalancesByDate[key] != null &&
|
|
20
|
+
cacheOverride === false) {
|
|
21
|
+
return (0, rxjs_1.from)([]);
|
|
22
|
+
}
|
|
19
23
|
return zeniAPI
|
|
20
24
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/accounts_payable_aging?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
21
25
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
26
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
23
27
|
const actions = [
|
|
24
28
|
(0, vendorReducer_1.updateVendors)(response.data.report.vendors, 'merge'),
|
|
25
|
-
(0, apAgingReducer_1.updateApAgingOnSuccess)(response.data.report),
|
|
29
|
+
(0, apAgingReducer_1.updateApAgingOnSuccess)(reportDate, response.data.report),
|
|
26
30
|
];
|
|
27
31
|
return (0, rxjs_1.from)(actions);
|
|
28
32
|
}
|
|
@@ -2,7 +2,7 @@ import { RootState } from '../../../reducer';
|
|
|
2
2
|
import { AgingBalance, AgingPeriod } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
3
3
|
import { ID } from '../../../commonStateTypes/common';
|
|
4
4
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
|
-
import { Customer } from '../../../entity/customer/
|
|
5
|
+
import { Customer } from '../../../entity/customer/customerState';
|
|
6
6
|
import { AgingDetailReportUIState, AgingDetailReportInvoice } from '../../../commonStateTypes/viewAndReport/agingReportStateTypes';
|
|
7
7
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
8
8
|
export interface ArAgingDetail extends SelectorView {
|
|
@@ -12,13 +12,20 @@ const toArAgingDataByCustomerId = (data) => {
|
|
|
12
12
|
const agingPeriod = (0, agingBalance_1.toAgingPeriod)(period);
|
|
13
13
|
const customerIds = (0, keys_1.default)(data[agingPeriod].customers);
|
|
14
14
|
customerIds.forEach((id) => {
|
|
15
|
-
var _a, _b;
|
|
15
|
+
var _a, _b, _c, _d, _e;
|
|
16
16
|
const agingBalance = {
|
|
17
17
|
balance: {
|
|
18
18
|
amount: (_b = (_a = data[agingPeriod].customers[id].amount) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0,
|
|
19
19
|
currencyCode: data.currency.currency_code,
|
|
20
20
|
currencySymbol: data.currency.currency_symbol,
|
|
21
21
|
},
|
|
22
|
+
totalBalance: ((_c = data[agingPeriod].customers[id].amount) === null || _c === void 0 ? void 0 : _c.total_value) != null
|
|
23
|
+
? {
|
|
24
|
+
amount: (_e = (_d = data[agingPeriod].customers[id].amount) === null || _d === void 0 ? void 0 : _d.total_value) !== null && _e !== void 0 ? _e : 0,
|
|
25
|
+
currencyCode: data.currency.currency_code,
|
|
26
|
+
currencySymbol: data.currency.currency_symbol,
|
|
27
|
+
}
|
|
28
|
+
: undefined,
|
|
22
29
|
period: agingPeriod,
|
|
23
30
|
};
|
|
24
31
|
if (result[id] != null) {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { ArAgingState } from './arAgingState';
|
|
1
|
+
import { ARAgingBalancesByAgingBalancesKey, ArAgingState, ArAgingUIState } from './arAgingState';
|
|
2
2
|
import { ArAgingPayload } from './arAgingPayload';
|
|
3
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
4
|
import { AgingReportUIState } from '../../../commonStateTypes/viewAndReport/agingReportStateTypes';
|
|
5
|
-
|
|
5
|
+
import { ID } from '../../../commonStateTypes/common';
|
|
6
|
+
export declare const inititalUIState: ArAgingUIState;
|
|
6
7
|
export declare const initialState: ArAgingState;
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export declare const initialStateAgingBalances: ARAgingBalancesByAgingBalancesKey;
|
|
9
|
+
export declare const fetchArAging: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reportDate: import("dayjs").Dayjs, cacheOverride?: any], {
|
|
10
|
+
cacheOverride: any;
|
|
11
|
+
reportDate: import("dayjs").Dayjs;
|
|
10
12
|
}, string, never, never>, updateArAgingUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<AgingReportUIState>, string>, updateArAgingOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
11
13
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
12
|
-
}, string, never, never>, updateArAgingOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[data: ArAgingPayload], {
|
|
14
|
+
}, string, never, never>, updateArAgingOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reportDate: import("dayjs").Dayjs, data: ArAgingPayload], {
|
|
15
|
+
reportDate: import("dayjs").Dayjs;
|
|
13
16
|
data: ArAgingPayload;
|
|
14
|
-
}, string, never, never>,
|
|
17
|
+
}, string, never, never>, updateArAgingNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
18
|
+
nodeId: ID;
|
|
19
|
+
isCollapsed: boolean;
|
|
20
|
+
}, string>, clearArAging: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
15
21
|
declare const _default: import("@reduxjs/toolkit").Reducer<ArAgingState, import("@reduxjs/toolkit").AnyAction>;
|
|
16
22
|
export default _default;
|
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearArAging = exports.updateArAgingOnSuccess = exports.updateArAgingOnFailure = exports.updateArAgingUIState = exports.fetchArAging = exports.initialState = exports.inititalUIState = void 0;
|
|
4
|
+
exports.clearArAging = exports.updateArAgingNodeCollapseState = exports.updateArAgingOnSuccess = exports.updateArAgingOnFailure = exports.updateArAgingUIState = exports.fetchArAging = exports.initialStateAgingBalances = exports.initialState = exports.inititalUIState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const arAgingPayload_1 = require("./arAgingPayload");
|
|
7
7
|
const agingBalance_1 = require("../../../commonStateTypes/agingBalance/agingBalance");
|
|
8
8
|
const viewAndReportPayloadv2_1 = require("../../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
9
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
10
|
+
const customerPayload_1 = require("../../../entity/customer/customerPayload");
|
|
11
|
+
const customerState_1 = require("../../../entity/customer/customerState");
|
|
12
|
+
const getNestedCustomerHierarchy_1 = require("../../../commonStateTypes/customerView/getNestedCustomerHierarchy");
|
|
9
13
|
exports.inititalUIState = {
|
|
10
14
|
searchString: '',
|
|
11
15
|
sortKey: 'customer',
|
|
12
16
|
sortOrder: 'ascending',
|
|
13
17
|
downloadState: 'Not-Started',
|
|
14
|
-
selectedDate:
|
|
18
|
+
selectedDate: (0, zeniDayJS_1.dateNow)(),
|
|
19
|
+
agingDateSelectionType: 'custom_date',
|
|
20
|
+
nodeCollapseState: {},
|
|
15
21
|
};
|
|
16
22
|
exports.initialState = {
|
|
17
23
|
reportId: 'accounts_receivable_aging',
|
|
18
24
|
reportTitle: 'AR Aging',
|
|
19
25
|
firstMonthOfFY: 1,
|
|
20
|
-
|
|
26
|
+
arAgingBalancesByDate: {},
|
|
21
27
|
fetchState: 'Not-Started',
|
|
22
28
|
error: undefined,
|
|
23
29
|
uiState: exports.inititalUIState,
|
|
24
|
-
arAgingTotals: [],
|
|
25
30
|
agingPeriods: [],
|
|
26
31
|
bookCloseDate: undefined,
|
|
27
32
|
dataAvailable: undefined,
|
|
33
|
+
currency: customerState_1.defaultCustomerCurrency,
|
|
34
|
+
};
|
|
35
|
+
exports.initialStateAgingBalances = {
|
|
36
|
+
arAgingBalancesByCustomerId: {},
|
|
37
|
+
arAgingTotals: [],
|
|
38
|
+
nestedCustomerHierarchy: [],
|
|
28
39
|
};
|
|
29
40
|
const arAging = (0, toolkit_1.createSlice)({
|
|
30
41
|
name: 'arAging',
|
|
@@ -32,14 +43,16 @@ const arAging = (0, toolkit_1.createSlice)({
|
|
|
32
43
|
reducers: {
|
|
33
44
|
fetchArAging: {
|
|
34
45
|
reducer(draft, action) {
|
|
35
|
-
const { cacheOverride } = action.payload;
|
|
36
|
-
|
|
46
|
+
const { cacheOverride, reportDate } = action.payload;
|
|
47
|
+
const key = (0, agingBalance_1.getAgingBalancesKey)(reportDate);
|
|
48
|
+
const record = draft.arAgingBalancesByDate[key];
|
|
49
|
+
draft.uiState.selectedDate = reportDate;
|
|
50
|
+
if (cacheOverride || record == null) {
|
|
37
51
|
draft.fetchState = 'In-Progress';
|
|
38
52
|
draft.error = undefined;
|
|
39
53
|
}
|
|
40
54
|
},
|
|
41
|
-
prepare(cacheOverride = false
|
|
42
|
-
reportDate) {
|
|
55
|
+
prepare(reportDate, cacheOverride = false) {
|
|
43
56
|
return {
|
|
44
57
|
payload: {
|
|
45
58
|
cacheOverride,
|
|
@@ -49,24 +62,25 @@ const arAging = (0, toolkit_1.createSlice)({
|
|
|
49
62
|
},
|
|
50
63
|
},
|
|
51
64
|
updateArAgingOnSuccess: {
|
|
52
|
-
prepare(data) {
|
|
65
|
+
prepare(reportDate, data) {
|
|
53
66
|
return {
|
|
54
67
|
payload: {
|
|
68
|
+
reportDate,
|
|
55
69
|
data,
|
|
56
70
|
},
|
|
57
71
|
};
|
|
58
72
|
},
|
|
59
73
|
reducer(draft, action) {
|
|
60
|
-
const { data } = action.payload;
|
|
61
|
-
draft.fetchState = 'Completed';
|
|
62
|
-
draft.error = undefined;
|
|
74
|
+
const { data, reportDate } = action.payload;
|
|
63
75
|
const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(data);
|
|
64
76
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
65
77
|
draft.bookCloseDate = report.bookCloseDate;
|
|
66
78
|
draft.dataAvailable = report.dataAvailable;
|
|
67
|
-
draft.
|
|
68
|
-
draft.arAgingTotals = (0, arAgingPayload_1.toArAgingTotals)(data);
|
|
79
|
+
doUpdateArAgingBalancesByDate(draft.arAgingBalancesByDate, reportDate, data);
|
|
69
80
|
draft.agingPeriods = data.aging_periods.map((elem) => (0, agingBalance_1.toAgingPeriod)(elem));
|
|
81
|
+
draft.uiState.selectedDate = reportDate;
|
|
82
|
+
draft.fetchState = 'Completed';
|
|
83
|
+
draft.error = undefined;
|
|
70
84
|
},
|
|
71
85
|
},
|
|
72
86
|
updateArAgingUIState(draft, action) {
|
|
@@ -85,6 +99,16 @@ const arAging = (0, toolkit_1.createSlice)({
|
|
|
85
99
|
if (action.payload.selectedDate != null) {
|
|
86
100
|
draft.uiState.selectedDate = action.payload.selectedDate;
|
|
87
101
|
}
|
|
102
|
+
if (action.payload.agingDateSelectionType != null) {
|
|
103
|
+
draft.uiState.agingDateSelectionType =
|
|
104
|
+
action.payload.agingDateSelectionType;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
updateArAgingNodeCollapseState(draft, action) {
|
|
108
|
+
const nodeCollapseState = action.payload;
|
|
109
|
+
draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
|
|
110
|
+
[nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
|
|
111
|
+
});
|
|
88
112
|
},
|
|
89
113
|
updateArAgingOnFailure: {
|
|
90
114
|
reducer(draft, action) {
|
|
@@ -100,5 +124,15 @@ const arAging = (0, toolkit_1.createSlice)({
|
|
|
100
124
|
},
|
|
101
125
|
},
|
|
102
126
|
});
|
|
103
|
-
_a = arAging.actions, exports.fetchArAging = _a.fetchArAging, exports.updateArAgingUIState = _a.updateArAgingUIState, exports.updateArAgingOnFailure = _a.updateArAgingOnFailure, exports.updateArAgingOnSuccess = _a.updateArAgingOnSuccess, exports.clearArAging = _a.clearArAging;
|
|
127
|
+
_a = arAging.actions, exports.fetchArAging = _a.fetchArAging, exports.updateArAgingUIState = _a.updateArAgingUIState, exports.updateArAgingOnFailure = _a.updateArAgingOnFailure, exports.updateArAgingOnSuccess = _a.updateArAgingOnSuccess, exports.updateArAgingNodeCollapseState = _a.updateArAgingNodeCollapseState, exports.clearArAging = _a.clearArAging;
|
|
104
128
|
exports.default = arAging.reducer;
|
|
129
|
+
const doUpdateArAgingBalancesByDate = (draft, reportDate, data) => {
|
|
130
|
+
const key = (0, agingBalance_1.getAgingBalancesKey)(reportDate);
|
|
131
|
+
const allCustomers = data.customers.map((customer) => (0, customerPayload_1.toCustomer)(customer));
|
|
132
|
+
const agingBalances = {
|
|
133
|
+
arAgingBalancesByCustomerId: (0, arAgingPayload_1.toArAgingDataByCustomerId)(data),
|
|
134
|
+
arAgingTotals: (0, arAgingPayload_1.toArAgingTotals)(data),
|
|
135
|
+
nestedCustomerHierarchy: (0, getNestedCustomerHierarchy_1.getNestedCustomerHierarchy)(allCustomers),
|
|
136
|
+
};
|
|
137
|
+
draft[key] = agingBalances;
|
|
138
|
+
};
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { RootState } from '../../../reducer';
|
|
2
2
|
import { SelectorReport } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { Customer } from '../../../entity/customer/
|
|
3
|
+
import { Customer } from '../../../entity/customer/customerState';
|
|
4
4
|
import { AgingBalance, AgingPeriod } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
5
5
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { NestedCustomerID } from '../../../commonStateTypes/customerView/nestedCustomerID';
|
|
7
|
+
import { ArAgingUIState } from './arAgingState';
|
|
8
|
+
export interface NestedAgingBalancesByCustomer {
|
|
9
|
+
id: NestedCustomerID;
|
|
10
|
+
isLeafCustomer: boolean;
|
|
11
|
+
hasSiblings: boolean;
|
|
8
12
|
customer: Customer;
|
|
9
|
-
total: Amount;
|
|
10
13
|
arAgingBalances: AgingBalance[];
|
|
14
|
+
children: NestedAgingBalancesByCustomer[];
|
|
15
|
+
total: Amount;
|
|
16
|
+
totalWithChildren: Amount;
|
|
11
17
|
}
|
|
12
18
|
export interface ArAgingReport extends SelectorReport {
|
|
13
|
-
|
|
19
|
+
agingBalances: NestedAgingBalancesByCustomer[];
|
|
14
20
|
totalBalances: AgingBalance[];
|
|
15
|
-
arAgingUIState:
|
|
21
|
+
arAgingUIState: ArAgingUIState;
|
|
16
22
|
agingPeriods: AgingPeriod[];
|
|
17
23
|
}
|
|
18
24
|
export declare const getArAgingReport: (state: RootState) => ArAgingReport;
|
|
@@ -5,36 +5,44 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getArAgingReport = void 0;
|
|
7
7
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
|
-
const keys_1 = __importDefault(require("lodash/keys"));
|
|
9
8
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
10
|
-
const
|
|
9
|
+
const customerState_1 = require("../../../entity/customer/customerState");
|
|
10
|
+
const agingBalance_1 = require("../../../commonStateTypes/agingBalance/agingBalance");
|
|
11
11
|
const customerSelector_1 = require("../../../entity/customer/customerSelector");
|
|
12
12
|
exports.getArAgingReport = (0, toolkit_1.createSelector)((state) => state.arAgingState, (state) => state.customerState, (arAgingState, customerState) => {
|
|
13
|
-
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY,
|
|
14
|
-
const { searchString, sortOrder, sortKey } = uiState;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY, agingPeriods, } = arAgingState;
|
|
14
|
+
const { searchString, sortOrder, sortKey, selectedDate } = uiState;
|
|
15
|
+
const balancesKey = (0, agingBalance_1.getAgingBalancesKey)(selectedDate);
|
|
16
|
+
const arAgingBalancesByDate = arAgingState.arAgingBalancesByDate[balancesKey];
|
|
17
|
+
const arAgingBalancesByCustomerId = arAgingBalancesByDate != null
|
|
18
|
+
? arAgingBalancesByDate.arAgingBalancesByCustomerId
|
|
19
|
+
: {};
|
|
20
|
+
const arAgingTotals = arAgingBalancesByDate != null
|
|
21
|
+
? arAgingBalancesByDate.arAgingTotals
|
|
22
|
+
: [];
|
|
23
|
+
const nestedHierarchy = arAgingBalancesByDate != null
|
|
24
|
+
? arAgingBalancesByDate.nestedCustomerHierarchy
|
|
25
|
+
: [];
|
|
26
|
+
const agingBalances = getNestedAgingBalancesByCustomer(customerState, arAgingBalancesByCustomerId, nestedHierarchy, searchString, sortKey, sortOrder);
|
|
27
|
+
return {
|
|
28
|
+
agingBalances,
|
|
29
|
+
reportId,
|
|
30
|
+
reportTitle,
|
|
31
|
+
fetchState,
|
|
32
|
+
firstMonthOfFY,
|
|
33
|
+
agingPeriods,
|
|
34
|
+
arAgingUIState: uiState,
|
|
35
|
+
totalBalances: arAgingTotals,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const getNestedAgingBalancesByCustomer = (customerState, agingBalancesByCustomerId, nestedCustomerHierarchy, searchString, sortKey, sortOrder) => {
|
|
39
|
+
if (nestedCustomerHierarchy.length === 0) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const agingBalancesByCustomer = nestedCustomerHierarchy.map((parentCustomer) => {
|
|
43
|
+
return getCustomerAgingReport(customerState, parentCustomer, agingBalancesByCustomerId, searchString, sortKey, sortOrder, parentCustomer.children.length === 0);
|
|
34
44
|
});
|
|
35
|
-
const filteredAgingBalancesByCustomer = agingBalancesByCustomer.filter((balance) => balance.customer.name
|
|
36
|
-
.toLowerCase()
|
|
37
|
-
.includes(searchString.toLowerCase()));
|
|
45
|
+
const filteredAgingBalancesByCustomer = agingBalancesByCustomer.filter((balance) => balance.customer.name.toLowerCase().includes(searchString.toLowerCase()));
|
|
38
46
|
const sortedAgingBalancesByCustomer = (0, orderBy_1.default)(filteredAgingBalancesByCustomer, (balance) => {
|
|
39
47
|
var _a;
|
|
40
48
|
switch (sortKey) {
|
|
@@ -48,14 +56,39 @@ exports.getArAgingReport = (0, toolkit_1.createSelector)((state) => state.arAgin
|
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
}, sortOrder === 'ascending' ? 'asc' : 'desc');
|
|
59
|
+
return sortedAgingBalancesByCustomer;
|
|
60
|
+
};
|
|
61
|
+
const getCustomerAgingReport = (customerState, nestedCustomer, arAgingBalancesByCustomerId, searchString, sortKey, sortOrder, isLeafCustomer) => {
|
|
62
|
+
const customerId = nestedCustomer.customerId[0];
|
|
63
|
+
const customer = (0, customerSelector_1.getCustomer)(customerState, customerId);
|
|
64
|
+
if (customer == null) {
|
|
65
|
+
throw new Error(`Customer with ${customerId} doesn't exist`);
|
|
66
|
+
}
|
|
67
|
+
const arAgingBalances = arAgingBalancesByCustomerId[customerId];
|
|
68
|
+
const { currencyCode, currencySymbol } = customer;
|
|
69
|
+
const customerTotal = arAgingBalances.reduce((prev, curr) => {
|
|
70
|
+
return prev + curr.balance.amount;
|
|
71
|
+
}, 0);
|
|
72
|
+
const customerTotalWithChildren = arAgingBalances.reduce((prev, curr) => {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
return prev + ((_b = (_a = curr.totalBalance) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
|
|
75
|
+
}, 0);
|
|
51
76
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
77
|
+
id: nestedCustomer.customerId,
|
|
78
|
+
isLeafCustomer,
|
|
79
|
+
hasSiblings: nestedCustomer.hasSiblings,
|
|
80
|
+
customer,
|
|
81
|
+
arAgingBalances,
|
|
82
|
+
children: getNestedAgingBalancesByCustomer(customerState, arAgingBalancesByCustomerId, nestedCustomer.children, searchString, sortKey, sortOrder),
|
|
83
|
+
total: {
|
|
84
|
+
amount: customerTotal,
|
|
85
|
+
currencyCode: currencyCode !== null && currencyCode !== void 0 ? currencyCode : customerState_1.defaultCustomerCurrency.currencyCode,
|
|
86
|
+
currencySymbol: currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : customerState_1.defaultCustomerCurrency.currencySymbol,
|
|
87
|
+
},
|
|
88
|
+
totalWithChildren: {
|
|
89
|
+
amount: customerTotalWithChildren,
|
|
90
|
+
currencyCode: currencyCode !== null && currencyCode !== void 0 ? currencyCode : customerState_1.defaultCustomerCurrency.currencyCode,
|
|
91
|
+
currencySymbol: currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : customerState_1.defaultCustomerCurrency.currencySymbol,
|
|
92
|
+
},
|
|
60
93
|
};
|
|
61
|
-
}
|
|
94
|
+
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
3
|
-
import { AgingBalance, AgingPeriod } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
2
|
+
import { AgingBalance, AgingBalancesKey, AgingPeriod } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
3
|
import { AgingReportUIState } from '../../../commonStateTypes/viewAndReport/agingReportStateTypes';
|
|
5
|
-
|
|
4
|
+
import { NestedCustomerHierarchy } from '../../../commonStateTypes/customerView/nestedCustomerID';
|
|
5
|
+
import { ReportV2 } from '../../../commonStateTypes/v2/viewAndReport';
|
|
6
|
+
export interface ARAgingBalancesByAgingBalancesKey {
|
|
6
7
|
arAgingBalancesByCustomerId: Record<ID, AgingBalance[]>;
|
|
7
|
-
|
|
8
|
+
nestedCustomerHierarchy: NestedCustomerHierarchy[];
|
|
8
9
|
arAgingTotals: AgingBalance[];
|
|
10
|
+
}
|
|
11
|
+
export interface ArAgingUIState extends AgingReportUIState {
|
|
12
|
+
nodeCollapseState: Record<ID, boolean>;
|
|
13
|
+
}
|
|
14
|
+
export interface ArAgingState extends ReportV2, FetchStateAndError {
|
|
15
|
+
arAgingBalancesByDate: Record<AgingBalancesKey, ARAgingBalancesByAgingBalancesKey>;
|
|
16
|
+
uiState: ArAgingUIState;
|
|
9
17
|
agingPeriods: AgingPeriod[];
|
|
10
18
|
}
|