@zeniai/client-epic-state 4.19.95 → 4.19.96-beta0ND
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/commonStateTypes/reduceFetchState.d.ts +9 -0
- package/lib/commonStateTypes/reduceFetchState.js +26 -0
- package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
- package/lib/esm/index.js +5 -4
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
- package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/esm/view/financeStatement/financeStatementSelector.js +10 -5
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +318 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +1 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
- package/lib/index.d.ts +7 -5
- package/lib/index.js +29 -25
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
- package/lib/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
- package/lib/view/financeStatement/financeStatementSelector.js +10 -5
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +322 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +59 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +2 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
- package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ const formatZeniDateFY_1 = require("../../../../commonStateTypes/fiscalYearHelpe
|
|
|
7
7
|
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
8
8
|
const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
|
|
9
9
|
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
10
|
+
const entitySelector_1 = require("../../../../entity/genericEntity/entitySelector");
|
|
10
11
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
11
12
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
12
13
|
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
@@ -15,6 +16,7 @@ const responsePayload_1 = require("../../../../responsePayload");
|
|
|
15
16
|
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
16
17
|
const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.saveReconciliationReview.match), (0, operators_1.mergeMap)((action) => {
|
|
17
18
|
const state = state$.value;
|
|
19
|
+
const entityState = state.entityState;
|
|
18
20
|
const { transactionId } = action.payload;
|
|
19
21
|
const localData = state.expenseAutomationReconciliationViewState.reconTabsState.review
|
|
20
22
|
.localData[transactionId];
|
|
@@ -62,7 +64,7 @@ const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
62
64
|
payload = getPayloadForCCPayment(updatedTransaction, localData, reconciliationData?.account.accountType);
|
|
63
65
|
break;
|
|
64
66
|
case 'record_deposit':
|
|
65
|
-
payload = getPayloadForDeposit(updatedTransaction, localData);
|
|
67
|
+
payload = getPayloadForDeposit(updatedTransaction, localData, entityState);
|
|
66
68
|
break;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -163,7 +165,10 @@ function getPayloadForExpenseRecord(updatedTransaction, localData) {
|
|
|
163
165
|
currency_code: updatedTransaction.amount.currencyCode,
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
|
-
function getPayloadForDeposit(updatedTransaction, localData) {
|
|
168
|
+
function getPayloadForDeposit(updatedTransaction, localData, entityState) {
|
|
169
|
+
const customerZeniId = localData.customer?.id != null
|
|
170
|
+
? (0, entitySelector_1.getEntityByEntityIDs)(entityState, [localData.customer?.id])[0]?.zeniId
|
|
171
|
+
: undefined;
|
|
167
172
|
return {
|
|
168
173
|
amount: updatedTransaction.amount.amount,
|
|
169
174
|
transaction_memo: updatedTransaction.memo,
|
|
@@ -171,7 +176,7 @@ function getPayloadForDeposit(updatedTransaction, localData) {
|
|
|
171
176
|
transaction_date: updatedTransaction.transactionDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
172
177
|
transaction_direction: updatedTransaction.transactionDirection,
|
|
173
178
|
transaction_id: updatedTransaction.transactionId,
|
|
174
|
-
customer_id:
|
|
179
|
+
customer_id: customerZeniId,
|
|
175
180
|
customer_name: localData.customer?.name,
|
|
176
181
|
account_id: localData.categoryId,
|
|
177
182
|
accounting_class_id: localData.classId,
|
|
@@ -48,19 +48,20 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
48
48
|
updateFinanceStatementThisPeriod(draft, action) {
|
|
49
49
|
const { firstMonthOfFY, coaBalances, maxNumOfPeriodsToHighlight } = action.payload;
|
|
50
50
|
const { timeframe, selectedCOABalancesRange } = draft;
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const safeCoaBalances = coaBalances != null ? coaBalances : [];
|
|
52
|
+
if (safeCoaBalances.length > 0) {
|
|
53
|
+
const prevThisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
|
|
53
54
|
if (prevThisPeriod != null) {
|
|
54
55
|
const selectedCoaBalancesRangeWithThisPeriod = {
|
|
55
56
|
...selectedCOABalancesRange,
|
|
56
57
|
thisPeriod: prevThisPeriod,
|
|
57
58
|
};
|
|
58
|
-
const newThisPeriod = (0, thisPeriodHelpers_1.getMatchingThisPeriod)(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod,
|
|
59
|
+
const newThisPeriod = (0, thisPeriodHelpers_1.getMatchingThisPeriod)(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, safeCoaBalances);
|
|
59
60
|
if (newThisPeriod != null) {
|
|
60
61
|
const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
|
|
61
62
|
firstMonthOfFY,
|
|
62
63
|
thisPeriod: newThisPeriod,
|
|
63
|
-
coaBalances,
|
|
64
|
+
coaBalances: safeCoaBalances,
|
|
64
65
|
timeframe,
|
|
65
66
|
maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
|
|
66
67
|
currentSelection: {
|
|
@@ -79,7 +80,9 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
79
80
|
draft.selectedReportId = action.payload;
|
|
80
81
|
},
|
|
81
82
|
updateFinanceStatementAdditionalBalancesSelection(draft, action) {
|
|
82
|
-
const { firstMonthOfFY, additionalBalances, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
83
|
+
const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
84
|
+
const safeCoaBalances = coaBalances != null ? coaBalances : [];
|
|
85
|
+
const additionalBalances = additionalBalancesPayload ?? [];
|
|
83
86
|
let tempAdditionalBalances = [...additionalBalances];
|
|
84
87
|
if (additionalBalances.includes('this_period_vs_last_period') ||
|
|
85
88
|
additionalBalances.includes('this_period_vs_last_period_percent')) {
|
|
@@ -95,8 +98,8 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
95
98
|
draft.isAdditionalBalancesShown =
|
|
96
99
|
additionalBalances.length != 0 ? true : false;
|
|
97
100
|
const { timeframe, selectedCOABalancesRange } = draft;
|
|
98
|
-
if (
|
|
99
|
-
const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange,
|
|
101
|
+
if (safeCoaBalances.length > 0) {
|
|
102
|
+
const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
|
|
100
103
|
if (thisPeriod != null) {
|
|
101
104
|
const selectedCoaBalancesRangeWithThisPeriod = {
|
|
102
105
|
...selectedCOABalancesRange,
|
|
@@ -105,7 +108,7 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
105
108
|
const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
|
|
106
109
|
firstMonthOfFY,
|
|
107
110
|
thisPeriod: thisPeriod,
|
|
108
|
-
coaBalances,
|
|
111
|
+
coaBalances: safeCoaBalances,
|
|
109
112
|
timeframe,
|
|
110
113
|
maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
|
|
111
114
|
currentSelection: {
|
|
@@ -8,6 +8,7 @@ import { RootState } from '../../reducer';
|
|
|
8
8
|
import { BalanceSheetReport } from '../balanceSheet/balanceSheetSelectorTypes';
|
|
9
9
|
import { CashFlowReport } from '../cashFlow/cashFlowSelectorTypes';
|
|
10
10
|
import { ProfitAndLossReport } from '../profitAndLoss/profitAndLossSelector';
|
|
11
|
+
import { ProfitAndLossByClassHorizontalReport } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
11
12
|
import { ProfitAndLossClassesViewReport } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
12
13
|
export interface FinanceStatementReport extends SelectorReport {
|
|
13
14
|
allTimeframeTicks: TimeframeTickWithMetaData[];
|
|
@@ -18,6 +19,7 @@ export interface FinanceStatementReport extends SelectorReport {
|
|
|
18
19
|
downloadState: FetchState;
|
|
19
20
|
filter: COABalancesFilter;
|
|
20
21
|
isCompareModeOn: boolean;
|
|
22
|
+
profitAndLossByClassHorizontalReport: ProfitAndLossByClassHorizontalReport;
|
|
21
23
|
profitAndLossByClassReport: ProfitAndLossClassesViewReport;
|
|
22
24
|
profitAndLossReport: ProfitAndLossReport;
|
|
23
25
|
reportFormat: ReportFormat;
|
|
@@ -11,6 +11,7 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
|
|
|
11
11
|
const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
|
|
12
12
|
const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
|
|
13
13
|
const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector");
|
|
14
|
+
const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
|
|
14
15
|
const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
|
|
15
16
|
function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
|
|
16
17
|
const datesSorted = [
|
|
@@ -45,11 +46,11 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
|
|
|
45
46
|
if (dataAvailable != null) {
|
|
46
47
|
const noFilter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(firstMonthOfFY, financeStatementState.timeframe, dataAvailable, 'ascending_date', []);
|
|
47
48
|
const profitAndLossForTimeframeTicks = (0, profitAndLossSelector_1.getProfitAndLossReport)(noFilter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const expensesBalances = profitAndLossForTimeframeTicks.sections.expenses?.balances ?? [];
|
|
50
|
+
const incomeBalances = profitAndLossForTimeframeTicks.sections.income?.balances ?? [];
|
|
51
|
+
balancesInTimeframe =
|
|
52
|
+
expensesBalances.length > 0 ? expensesBalances : incomeBalances;
|
|
53
|
+
if (balancesInTimeframe.length > 0) {
|
|
53
54
|
allTimeframeTicks = balancesInTimeframe.map((balance) => (0, timeframeTick_1.toTimeframeTick)(balance));
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -63,6 +64,9 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
|
|
|
63
64
|
const profitAndLossReport = (0, profitAndLossSelector_1.getProfitAndLossReport)(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
|
|
64
65
|
const classFilter = (0, coaBalancesFilterClassesView_1.newBalancesFilterClassesView)(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
|
|
65
66
|
const profitAndLossByClassReport = (0, profitAndLossClassesViewSelector_1.getProfitAndLossClassesView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
|
|
67
|
+
const profitAndLossByClassHorizontalReport = (0, profitAndLossClassesByClassHorizontalSelector_1.getProfitAndLossClassesHorizontalView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState, profitAndLossClassesViewState.uiState.classViewLayout === 'horizontal'
|
|
68
|
+
? thisPeriod
|
|
69
|
+
: undefined);
|
|
66
70
|
const balanceSheetReport = (0, balanceSheetSelector_1.getBalanceSheet)(filter, accountState, accountGroupState, sectionAccountsViewState, balanceSheetState);
|
|
67
71
|
const cashFlowReport = (0, cashFlowSelector_1.getCashFlow)(filter, accountState, accountGroupState, sectionAccountsViewState, cashFlowState);
|
|
68
72
|
const allReports = [
|
|
@@ -110,6 +114,7 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
|
|
|
110
114
|
dataAvailable,
|
|
111
115
|
profitAndLossReport,
|
|
112
116
|
profitAndLossByClassReport,
|
|
117
|
+
profitAndLossByClassHorizontalReport,
|
|
113
118
|
balanceSheetReport,
|
|
114
119
|
cashFlowReport,
|
|
115
120
|
filter,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { COABalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
2
|
+
import { AccountState } from '../../entity/account/accountState';
|
|
3
|
+
import { ClassState } from '../../entity/class/classState';
|
|
4
|
+
import { SectionClassesViewStateV2 } from '../../entity/sectionClassesViewV2/sectionClassesViewState';
|
|
5
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
6
|
+
import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
7
|
+
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
|
|
8
|
+
import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
|
|
9
|
+
export declare const profitAndLossHorizontalIdsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
|
|
10
|
+
export declare const getProfitAndLossClassesHorizontalView: (filter: COABalancesFilterClassesView, accountState: AccountState, classState: ClassState, sectionsState: SectionClassesViewStateV2, profitAndLossClassesViewState: ProfitAndLossClassesViewState, selectedPeriod: {
|
|
11
|
+
endDate: ZeniDate;
|
|
12
|
+
startDate: ZeniDate;
|
|
13
|
+
} | undefined) => ProfitAndLossByClassHorizontalReport;
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProfitAndLossClassesHorizontalView = exports.profitAndLossHorizontalIdsInOrder = void 0;
|
|
4
|
+
const amount_1 = require("../../commonStateTypes/amount");
|
|
5
|
+
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
6
|
+
const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
|
|
7
|
+
/** If `ProfitAndLossClassesViewState.currency` is unset (e.g. tests). */
|
|
8
|
+
const FALLBACK_REPORT_CURRENCY = {
|
|
9
|
+
currencyCode: 'USD',
|
|
10
|
+
currencySymbol: '$',
|
|
11
|
+
};
|
|
12
|
+
exports.profitAndLossHorizontalIdsInOrder = [
|
|
13
|
+
'income',
|
|
14
|
+
'cogs',
|
|
15
|
+
'grossProfit',
|
|
16
|
+
'expenses',
|
|
17
|
+
'earningsBeforeInterestAndTax',
|
|
18
|
+
'otherIncome',
|
|
19
|
+
'otherExpenses',
|
|
20
|
+
'netOtherIncome',
|
|
21
|
+
'netIncome',
|
|
22
|
+
];
|
|
23
|
+
const SECTION_TITLES = {
|
|
24
|
+
income: 'Income',
|
|
25
|
+
cogs: 'Cost of Goods Sold',
|
|
26
|
+
grossProfit: 'Gross Profit',
|
|
27
|
+
expenses: 'Expenses',
|
|
28
|
+
earningsBeforeInterestAndTax: 'Net Operating Income',
|
|
29
|
+
otherIncome: 'Other Income',
|
|
30
|
+
otherExpenses: 'Other Expenses',
|
|
31
|
+
netOtherIncome: 'Net Other Income',
|
|
32
|
+
netIncome: 'Net Income',
|
|
33
|
+
};
|
|
34
|
+
/** Sections fetched and pivoted for horizontal layout (excludes e.g. `netOperatingIncome`). */
|
|
35
|
+
const HORIZONTAL_PANDL_SECTION_IDS = [
|
|
36
|
+
'income',
|
|
37
|
+
'cogs',
|
|
38
|
+
'expenses',
|
|
39
|
+
'otherIncome',
|
|
40
|
+
'otherExpenses',
|
|
41
|
+
];
|
|
42
|
+
const getProfitAndLossClassesHorizontalView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState, selectedPeriod) => {
|
|
43
|
+
const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
|
|
44
|
+
profitAndLossClassesViewState.fetchState.month,
|
|
45
|
+
profitAndLossClassesViewState.fetchState.quarter,
|
|
46
|
+
profitAndLossClassesViewState.fetchState.year,
|
|
47
|
+
]);
|
|
48
|
+
const reportId = 'profit_and_loss_by_classes';
|
|
49
|
+
// Build class columns from the class hierarchy (top-level only).
|
|
50
|
+
// Use `filter.classesToFilterOut` so PDF/Excel downloads (fresh store, empty UI state)
|
|
51
|
+
// respect `classes_to_filter_out` from the request; in-app `classFilter` mirrors uiState.
|
|
52
|
+
const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, filter.classesToFilterOut);
|
|
53
|
+
const sections = {};
|
|
54
|
+
const calculatedSections = {};
|
|
55
|
+
let reportCurrency = FALLBACK_REPORT_CURRENCY;
|
|
56
|
+
if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
|
|
57
|
+
// Get section reports using existing selector infrastructure
|
|
58
|
+
const sectionReports = {};
|
|
59
|
+
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
60
|
+
sectionReports[sectionId] = (0, sectionClassesViewSelector_1.getSectionClassesViewReport)(accountState, classState, sectionsState, { reportId, sectionId }, filter);
|
|
61
|
+
});
|
|
62
|
+
reportCurrency =
|
|
63
|
+
profitAndLossClassesViewState.currency ?? FALLBACK_REPORT_CURRENCY;
|
|
64
|
+
// Pivot each section from class→account to account→class
|
|
65
|
+
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
66
|
+
const sectionReport = sectionReports[sectionId];
|
|
67
|
+
if (sectionReport != null) {
|
|
68
|
+
sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// Calculate derived sections
|
|
72
|
+
const incomeSection = sections['income'];
|
|
73
|
+
const cogsSection = sections['cogs'];
|
|
74
|
+
const expensesSection = sections['expenses'];
|
|
75
|
+
const otherIncomeSection = sections['otherIncome'];
|
|
76
|
+
const otherExpensesSection = sections['otherExpenses'];
|
|
77
|
+
// Gross Profit = Income - COGS
|
|
78
|
+
if (incomeSection != null && cogsSection != null) {
|
|
79
|
+
calculatedSections['grossProfit'] = computeCalculatedSection(incomeSection.classTotals, cogsSection.classTotals, incomeSection.sectionTotal, cogsSection.sectionTotal, 'subtract', SECTION_TITLES['grossProfit']);
|
|
80
|
+
}
|
|
81
|
+
// EBIT = Gross Profit - Expenses
|
|
82
|
+
const grossProfit = calculatedSections['grossProfit'];
|
|
83
|
+
if (grossProfit != null && expensesSection != null) {
|
|
84
|
+
calculatedSections['earningsBeforeInterestAndTax'] =
|
|
85
|
+
computeCalculatedSection(grossProfit.classTotals, expensesSection.classTotals, grossProfit.sectionTotal, expensesSection.sectionTotal, 'subtract', SECTION_TITLES['earningsBeforeInterestAndTax']);
|
|
86
|
+
}
|
|
87
|
+
// Net Other Income = Other Income - Other Expenses
|
|
88
|
+
if (otherIncomeSection != null && otherExpensesSection != null) {
|
|
89
|
+
calculatedSections['netOtherIncome'] = computeCalculatedSection(otherIncomeSection.classTotals, otherExpensesSection.classTotals, otherIncomeSection.sectionTotal, otherExpensesSection.sectionTotal, 'subtract', SECTION_TITLES['netOtherIncome']);
|
|
90
|
+
}
|
|
91
|
+
// Net Income = EBIT + Net Other Income
|
|
92
|
+
const ebit = calculatedSections['earningsBeforeInterestAndTax'];
|
|
93
|
+
const netOtherIncome = calculatedSections['netOtherIncome'];
|
|
94
|
+
if (ebit != null && netOtherIncome != null) {
|
|
95
|
+
calculatedSections['netIncome'] = computeCalculatedSection(ebit.classTotals, netOtherIncome.classTotals, ebit.sectionTotal, netOtherIncome.sectionTotal, 'add', SECTION_TITLES['netIncome']);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Build synthetic header COABalances for rendering class names as column headers
|
|
99
|
+
const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod, reportCurrency);
|
|
100
|
+
return {
|
|
101
|
+
reportId,
|
|
102
|
+
reportTitle: 'Profit and Loss by Class',
|
|
103
|
+
firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
|
|
104
|
+
fetchState: fetchState.fetchState,
|
|
105
|
+
bookCloseDate: profitAndLossClassesViewState.bookCloseDate,
|
|
106
|
+
dataAvailable: profitAndLossClassesViewState.dataAvailable,
|
|
107
|
+
selectedPeriod,
|
|
108
|
+
classColumns,
|
|
109
|
+
sections,
|
|
110
|
+
calculatedSections,
|
|
111
|
+
idsInOrder: exports.profitAndLossHorizontalIdsInOrder,
|
|
112
|
+
uiState: profitAndLossClassesViewState.uiState,
|
|
113
|
+
headerBalances,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
exports.getProfitAndLossClassesHorizontalView = getProfitAndLossClassesHorizontalView;
|
|
117
|
+
/**
|
|
118
|
+
* Build column definitions from class hierarchy (top-level classes only).
|
|
119
|
+
*/
|
|
120
|
+
function buildClassColumns(classHierarchy, classesToFilterOut) {
|
|
121
|
+
const filteredIds = new Set(classesToFilterOut.map((id) => id[0]));
|
|
122
|
+
return classHierarchy
|
|
123
|
+
.filter((c) => !filteredIds.has(c.classId[0]))
|
|
124
|
+
.map((c) => ({
|
|
125
|
+
classId: c.classId[0],
|
|
126
|
+
className: c.className,
|
|
127
|
+
nestedClassId: c.classId,
|
|
128
|
+
qboId: c.qboId,
|
|
129
|
+
}))
|
|
130
|
+
.sort((a, b) => a.className.localeCompare(b.className, [], { sensitivity: 'base' }));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Pivot a section from class→account→balances to account→class→balance (single period).
|
|
134
|
+
*/
|
|
135
|
+
function pivotSectionToHorizontal(section, classColumns, title, currency) {
|
|
136
|
+
// Map: accountId -> { accountName, classId -> balance }
|
|
137
|
+
const accountMap = new Map();
|
|
138
|
+
// Also track class totals
|
|
139
|
+
const classTotalMap = new Map();
|
|
140
|
+
classColumns.forEach((col) => classTotalMap.set(col.classId, 0));
|
|
141
|
+
// Iterate over each class in the section
|
|
142
|
+
section.classes.forEach((classReport) => {
|
|
143
|
+
const classId = classReport.id[0];
|
|
144
|
+
// Only process classes that are in our columns
|
|
145
|
+
if (!classTotalMap.has(classId)) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Sum all sliced period balances (same slice as vertical columns; multi-period = range total)
|
|
149
|
+
const classBalance = sumBalancesInSlice(classReport.childrenBalancesTotal.balances);
|
|
150
|
+
classTotalMap.set(classId, classBalance);
|
|
151
|
+
// Iterate through accounts in this class
|
|
152
|
+
collectAccountsFromClass(classReport, classId, accountMap);
|
|
153
|
+
});
|
|
154
|
+
// Build account rows in COA tree order (same parent/child ordering as vertical P&L by class).
|
|
155
|
+
// Sorting by depth + name flattened the hierarchy and broke sub-account grouping.
|
|
156
|
+
const orderedIds = collectAccountIdsInTreeOrder(section, classColumns);
|
|
157
|
+
const usedIds = new Set();
|
|
158
|
+
const accounts = [];
|
|
159
|
+
const pushAccountRow = (accountId) => {
|
|
160
|
+
const accountData = accountMap.get(accountId);
|
|
161
|
+
if (accountData == null) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
usedIds.add(accountId);
|
|
165
|
+
const classBalances = classColumns.map((col) => ({
|
|
166
|
+
classId: col.classId,
|
|
167
|
+
balance: (0, amount_1.toAmountWC)(accountData.classBalances.get(col.classId) ?? 0, currency),
|
|
168
|
+
}));
|
|
169
|
+
const rowTotal = classBalances.reduce((sum, cb) => sum + cb.balance.amount, 0);
|
|
170
|
+
accounts.push({
|
|
171
|
+
accountId,
|
|
172
|
+
accountName: accountData.accountName,
|
|
173
|
+
depth: accountData.depth,
|
|
174
|
+
classBalances,
|
|
175
|
+
rowTotal: (0, amount_1.toAmountWC)(rowTotal, currency),
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
for (const id of orderedIds) {
|
|
179
|
+
pushAccountRow(id);
|
|
180
|
+
}
|
|
181
|
+
for (const accountId of accountMap.keys()) {
|
|
182
|
+
if (!usedIds.has(accountId)) {
|
|
183
|
+
pushAccountRow(accountId);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Build class totals
|
|
187
|
+
const classTotals = classColumns.map((col) => ({
|
|
188
|
+
classId: col.classId,
|
|
189
|
+
balance: (0, amount_1.toAmountWC)(classTotalMap.get(col.classId) ?? 0, currency),
|
|
190
|
+
}));
|
|
191
|
+
const sectionTotal = classTotals.reduce((sum, ct) => sum + ct.balance.amount, 0);
|
|
192
|
+
return {
|
|
193
|
+
title,
|
|
194
|
+
accounts,
|
|
195
|
+
classTotals,
|
|
196
|
+
sectionTotal: (0, amount_1.toAmountWC)(sectionTotal, currency),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* DFS account ids in the same order as vertical P&L by class, using the first class
|
|
201
|
+
* column that appears in this section as the canonical tree (structure is identical per class).
|
|
202
|
+
*/
|
|
203
|
+
function collectAccountIdsInTreeOrder(section, classColumns) {
|
|
204
|
+
const ids = [];
|
|
205
|
+
const visitNested = (nested) => {
|
|
206
|
+
ids.push(nested.account.accountId);
|
|
207
|
+
nested.children.forEach(visitNested);
|
|
208
|
+
};
|
|
209
|
+
for (const col of classColumns) {
|
|
210
|
+
const classReport = section.classes.find((c) => c.id[0] === col.classId);
|
|
211
|
+
if (classReport == null) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
classReport.class.accounts.forEach(visitNested);
|
|
215
|
+
return ids;
|
|
216
|
+
}
|
|
217
|
+
return ids;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Recursively collect account balances from a NestedClassReportV2 into accountMap.
|
|
221
|
+
*/
|
|
222
|
+
function collectAccountsFromClass(classReport, classId, accountMap) {
|
|
223
|
+
// Process accounts directly on this class (depth 2 matches vertical `AccountsSection` first level)
|
|
224
|
+
classReport.class.accounts.forEach((nestedAccount) => {
|
|
225
|
+
collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, 2);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Recursively collect accounts from NestedAccountReport (handles sub-accounts).
|
|
230
|
+
*/
|
|
231
|
+
function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, depth) {
|
|
232
|
+
const accountId = nestedAccount.account.accountId;
|
|
233
|
+
const accountName = nestedAccount.account.accountName;
|
|
234
|
+
const balance = sumBalancesInSlice(nestedAccount.account.balancesInTimeframe.balances);
|
|
235
|
+
if (!accountMap.has(accountId)) {
|
|
236
|
+
accountMap.set(accountId, {
|
|
237
|
+
accountName,
|
|
238
|
+
depth,
|
|
239
|
+
classBalances: new Map(),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
const accountData = accountMap.get(accountId);
|
|
243
|
+
if (accountData == null) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
accountData.depth = Math.max(accountData.depth, depth);
|
|
247
|
+
const existing = accountData.classBalances.get(classId) ?? 0;
|
|
248
|
+
accountData.classBalances.set(classId, existing + balance);
|
|
249
|
+
// Process sub-accounts
|
|
250
|
+
nestedAccount.children.forEach((child) => {
|
|
251
|
+
collectAccountsFromNestedAccount(child, classId, accountMap, depth + 1);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Total amount for the current report slice. `balances` is already narrowed by
|
|
256
|
+
* `getCOABalances` / `sliceCOABalances` to the selected range; summing matches
|
|
257
|
+
* multi-period selections and avoids mismatches when `thisPeriod` does not
|
|
258
|
+
* align with a row (e.g. slice fallback) or when several period rows are shown.
|
|
259
|
+
*/
|
|
260
|
+
function sumBalancesInSlice(balances) {
|
|
261
|
+
let sum = 0;
|
|
262
|
+
for (const bal of balances) {
|
|
263
|
+
sum += bal.balance?.amount ?? 0;
|
|
264
|
+
}
|
|
265
|
+
return sum;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Compute a calculated section by adding or subtracting two sets of class totals.
|
|
269
|
+
*/
|
|
270
|
+
function computeCalculatedSection(aTotals, bTotals, aTotal, bTotal, operation, title) {
|
|
271
|
+
const currency = {
|
|
272
|
+
currencyCode: aTotal.currencyCode,
|
|
273
|
+
currencySymbol: aTotal.currencySymbol,
|
|
274
|
+
};
|
|
275
|
+
const bTotalsMap = new Map(bTotals.map((b) => [b.classId, b.balance.amount]));
|
|
276
|
+
const classTotals = aTotals.map((a) => {
|
|
277
|
+
const bAmount = bTotalsMap.get(a.classId) ?? 0;
|
|
278
|
+
const resultAmount = operation === 'add'
|
|
279
|
+
? a.balance.amount + bAmount
|
|
280
|
+
: a.balance.amount - bAmount;
|
|
281
|
+
return {
|
|
282
|
+
classId: a.classId,
|
|
283
|
+
balance: (0, amount_1.toAmountWC)(resultAmount, currency),
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
const sectionTotalAmount = operation === 'add'
|
|
287
|
+
? aTotal.amount + bTotal.amount
|
|
288
|
+
: aTotal.amount - bTotal.amount;
|
|
289
|
+
return {
|
|
290
|
+
title,
|
|
291
|
+
classTotals,
|
|
292
|
+
sectionTotal: (0, amount_1.toAmountWC)(sectionTotalAmount, currency),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Build synthetic COABalance array for header rendering.
|
|
297
|
+
* One entry per class column + one for "Total".
|
|
298
|
+
*/
|
|
299
|
+
function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency) {
|
|
300
|
+
if (selectedPeriod == null) {
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
const { endDate, startDate } = selectedPeriod;
|
|
304
|
+
const balances = classColumns.map((col) => ({
|
|
305
|
+
balance: (0, amount_1.toAmountWC)(0, currency),
|
|
306
|
+
balanceTimeFrame: timeframe,
|
|
307
|
+
endDate,
|
|
308
|
+
startDate,
|
|
309
|
+
type: 'default',
|
|
310
|
+
label: col.className,
|
|
311
|
+
}));
|
|
312
|
+
// Add a "Total" column
|
|
313
|
+
balances.push({
|
|
314
|
+
balance: (0, amount_1.toAmountWC)(0, currency),
|
|
315
|
+
balanceTimeFrame: timeframe,
|
|
316
|
+
endDate,
|
|
317
|
+
startDate,
|
|
318
|
+
type: 'default',
|
|
319
|
+
label: 'Total',
|
|
320
|
+
});
|
|
321
|
+
return balances;
|
|
322
|
+
}
|
package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Amount } from '../../commonStateTypes/amount';
|
|
2
|
+
import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
+
import { COABalance } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
4
|
+
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
5
|
+
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
6
|
+
import { Month } from '../../commonStateTypes/timePeriod';
|
|
7
|
+
import { ReportID } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
8
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
9
|
+
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
|
|
10
|
+
import { ProfitAndLossClassesViewUIState } from './profitAndLossClassesViewState';
|
|
11
|
+
export interface ClassColumnDefinition {
|
|
12
|
+
classId: string;
|
|
13
|
+
className: string;
|
|
14
|
+
nestedClassId: NestedClassID;
|
|
15
|
+
qboId?: ID;
|
|
16
|
+
}
|
|
17
|
+
export interface HorizontalClassBalance {
|
|
18
|
+
balance: Amount;
|
|
19
|
+
classId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface HorizontalAccountRow {
|
|
22
|
+
accountId: string;
|
|
23
|
+
accountName: string;
|
|
24
|
+
classBalances: HorizontalClassBalance[];
|
|
25
|
+
/** Matches vertical classes PDF account indentation (`depth * 6` pt); top-level rows use 2. */
|
|
26
|
+
depth: number;
|
|
27
|
+
rowTotal: Amount;
|
|
28
|
+
}
|
|
29
|
+
export interface HorizontalSectionReport {
|
|
30
|
+
accounts: HorizontalAccountRow[];
|
|
31
|
+
classTotals: HorizontalClassBalance[];
|
|
32
|
+
sectionTotal: Amount;
|
|
33
|
+
title: string;
|
|
34
|
+
}
|
|
35
|
+
export interface HorizontalCalculatedSection {
|
|
36
|
+
classTotals: HorizontalClassBalance[];
|
|
37
|
+
sectionTotal: Amount;
|
|
38
|
+
title: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ProfitAndLossByClassHorizontalReport {
|
|
41
|
+
calculatedSections: Partial<Record<PandLReportViewCalculatedSectionID, HorizontalCalculatedSection>>;
|
|
42
|
+
classColumns: ClassColumnDefinition[];
|
|
43
|
+
fetchState: FetchState;
|
|
44
|
+
firstMonthOfFY: Month;
|
|
45
|
+
/** Synthetic COABalance array for header rendering — one per class column + total */
|
|
46
|
+
headerBalances: COABalance[];
|
|
47
|
+
idsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
|
|
48
|
+
reportId: ReportID;
|
|
49
|
+
reportTitle: string;
|
|
50
|
+
sections: Partial<Record<PandLReportViewSectionID, HorizontalSectionReport>>;
|
|
51
|
+
selectedPeriod: {
|
|
52
|
+
endDate: ZeniDate;
|
|
53
|
+
startDate: ZeniDate;
|
|
54
|
+
label?: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
uiState: ProfitAndLossClassesViewUIState;
|
|
57
|
+
bookCloseDate?: ZeniDate;
|
|
58
|
+
dataAvailable?: DataAvailable;
|
|
59
|
+
}
|
|
@@ -2,7 +2,7 @@ import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID'
|
|
|
2
2
|
import { AccountViewMode, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { ZeniAPIStatus, ZeniReportData } from '../../responsePayload';
|
|
4
4
|
import { ProfitAndLossClassesViewPayload } from './profitAndLossClassesViewPayload';
|
|
5
|
-
import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
|
|
5
|
+
import { ClassViewLayout, ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
|
|
6
6
|
export declare const initialState: ProfitAndLossClassesViewState;
|
|
7
7
|
export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
8
8
|
cacheOverride: boolean;
|
|
@@ -30,6 +30,8 @@ export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").A
|
|
|
30
30
|
};
|
|
31
31
|
}, "profitAndLossClassesView/updateProfitAndLossClassesViewUIState">, updateAccountViewMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
32
32
|
viewMode: AccountViewMode;
|
|
33
|
-
}, "profitAndLossClassesView/updateAccountViewMode">,
|
|
33
|
+
}, "profitAndLossClassesView/updateAccountViewMode">, updateClassViewLayout: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
34
|
+
classViewLayout: ClassViewLayout;
|
|
35
|
+
}, "profitAndLossClassesView/updateClassViewLayout">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
|
|
34
36
|
declare const _default: import("redux").Reducer<ProfitAndLossClassesViewState>;
|
|
35
37
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearProfitAndLossClassesView = exports.resetProfitAndLossClassesNodeCollapseState = exports.updateAccountViewMode = exports.updateProfitAndLossClassesViewUIState = exports.updateClassesToFilterOut = exports.updateProfitAndLossForTimeframeClassesViewFailure = exports.updateProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossClassesView = exports.initialState = void 0;
|
|
4
|
+
exports.clearProfitAndLossClassesView = exports.resetProfitAndLossClassesNodeCollapseState = exports.updateClassViewLayout = exports.updateAccountViewMode = exports.updateProfitAndLossClassesViewUIState = exports.updateClassesToFilterOut = exports.updateProfitAndLossForTimeframeClassesViewFailure = exports.updateProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossClassesView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
7
7
|
const getNestedClassIDHierarchyForReport_1 = require("../../commonStateTypes/classesView/getNestedClassIDHierarchyForReport");
|
|
@@ -27,6 +27,7 @@ exports.initialState = {
|
|
|
27
27
|
nodeCollapseState: {},
|
|
28
28
|
scrollPosition: undefined,
|
|
29
29
|
accountViewMode: 'account_group',
|
|
30
|
+
classViewLayout: 'vertical',
|
|
30
31
|
classesToFilterOut: [],
|
|
31
32
|
},
|
|
32
33
|
firstMonthOfFY: 1,
|
|
@@ -98,6 +99,9 @@ const profitAndLossClassesView = (0, toolkit_1.createSlice)({
|
|
|
98
99
|
updateAccountViewMode(draft, action) {
|
|
99
100
|
draft.uiState.accountViewMode = action.payload.viewMode;
|
|
100
101
|
},
|
|
102
|
+
updateClassViewLayout(draft, action) {
|
|
103
|
+
draft.uiState.classViewLayout = action.payload.classViewLayout;
|
|
104
|
+
},
|
|
101
105
|
resetProfitAndLossClassesNodeCollapseState(draft) {
|
|
102
106
|
draft.uiState.nodeCollapseState = {};
|
|
103
107
|
},
|
|
@@ -106,10 +110,11 @@ const profitAndLossClassesView = (0, toolkit_1.createSlice)({
|
|
|
106
110
|
},
|
|
107
111
|
},
|
|
108
112
|
});
|
|
109
|
-
_a = profitAndLossClassesView.actions, exports.fetchProfitAndLossClassesView = _a.fetchProfitAndLossClassesView, exports.fetchProfitAndLossForTimeframeClassesView = _a.fetchProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesView = _a.updateProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesViewFailure = _a.updateProfitAndLossForTimeframeClassesViewFailure, exports.updateClassesToFilterOut = _a.updateClassesToFilterOut, exports.updateProfitAndLossClassesViewUIState = _a.updateProfitAndLossClassesViewUIState, exports.updateAccountViewMode = _a.updateAccountViewMode, exports.resetProfitAndLossClassesNodeCollapseState = _a.resetProfitAndLossClassesNodeCollapseState, exports.clearProfitAndLossClassesView = _a.clearProfitAndLossClassesView;
|
|
113
|
+
_a = profitAndLossClassesView.actions, exports.fetchProfitAndLossClassesView = _a.fetchProfitAndLossClassesView, exports.fetchProfitAndLossForTimeframeClassesView = _a.fetchProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesView = _a.updateProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesViewFailure = _a.updateProfitAndLossForTimeframeClassesViewFailure, exports.updateClassesToFilterOut = _a.updateClassesToFilterOut, exports.updateProfitAndLossClassesViewUIState = _a.updateProfitAndLossClassesViewUIState, exports.updateAccountViewMode = _a.updateAccountViewMode, exports.updateClassViewLayout = _a.updateClassViewLayout, exports.resetProfitAndLossClassesNodeCollapseState = _a.resetProfitAndLossClassesNodeCollapseState, exports.clearProfitAndLossClassesView = _a.clearProfitAndLossClassesView;
|
|
110
114
|
exports.default = profitAndLossClassesView.reducer;
|
|
111
115
|
const doUpdatedProfitAndLossClassesView = (draft, timeframe, pandLReport) => {
|
|
112
116
|
const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(pandLReport.report);
|
|
117
|
+
draft.currency = report.currency;
|
|
113
118
|
draft.dataAvailable = report.dataAvailable;
|
|
114
119
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
115
120
|
draft.bookCloseDate = report.bookCloseDate;
|