@zeniai/client-epic-state 4.19.96-beta4ND → 4.19.96-beta5ND
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/coaBalance/coaBalanceType.d.ts +0 -2
- package/lib/commonStateTypes/coaBalance/coaBalanceType.js +0 -6
- package/lib/commonStateTypes/currencyHelper.d.ts +0 -3
- package/lib/commonStateTypes/currencyHelper.js +1 -6
- package/lib/entity/customer/customerState.d.ts +2 -0
- package/lib/entity/customer/customerState.js +5 -0
- package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +0 -5
- package/lib/esm/commonStateTypes/currencyHelper.js +0 -5
- package/lib/esm/entity/customer/customerState.js +4 -1
- package/lib/esm/index.js +4 -5
- package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
- package/lib/esm/view/financeStatement/financeStatementSelector.js +4 -13
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +16 -14
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +1 -9
- package/lib/index.d.ts +5 -6
- package/lib/index.js +34 -38
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
- package/lib/view/financeStatement/financeStatementSelector.js +4 -13
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +16 -14
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +0 -49
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +0 -11
- package/package.json +1 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -200
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +0 -6
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -203
|
@@ -5,5 +5,3 @@ export type COABalanceType = 'default' | 'default_with_percent' | 'default_with_
|
|
|
5
5
|
export declare const toCOABalanceType: (v: string) => COABalanceType;
|
|
6
6
|
export declare const toCOABalanceTypeStrict: (v: string) => COABalanceType | undefined;
|
|
7
7
|
export declare const isCalculatedBalanceType: (id: string) => id is CalculatedBalance;
|
|
8
|
-
/** Removes compare-mode balance types (horizontal P&L-by-class does not use them). */
|
|
9
|
-
export declare function stripCompareAdditionalBalanceTypes(balances: readonly COABalanceType[]): COABalanceType[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isCalculatedBalanceType = exports.toCOABalanceTypeStrict = exports.toCOABalanceType = void 0;
|
|
4
|
-
exports.stripCompareAdditionalBalanceTypes = stripCompareAdditionalBalanceTypes;
|
|
5
4
|
const stringToUnion_1 = require("../stringToUnion");
|
|
6
5
|
const ALL_COA_BALANCE_FIELDS = [
|
|
7
6
|
'default',
|
|
@@ -34,8 +33,3 @@ const toCOABalanceTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v
|
|
|
34
33
|
exports.toCOABalanceTypeStrict = toCOABalanceTypeStrict;
|
|
35
34
|
const isCalculatedBalanceType = (id) => ALL_CALCULATED_BALANCES.find((sectionId) => id === sectionId) != null;
|
|
36
35
|
exports.isCalculatedBalanceType = isCalculatedBalanceType;
|
|
37
|
-
/** Removes compare-mode balance types (horizontal P&L-by-class does not use them). */
|
|
38
|
-
function stripCompareAdditionalBalanceTypes(balances) {
|
|
39
|
-
return balances.filter((balanceType) => balanceType !== 'this_period_vs_last_period' &&
|
|
40
|
-
balanceType !== 'this_period_vs_last_period_percent');
|
|
41
|
-
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isUsdCurrency = void 0;
|
|
4
4
|
const isUsdCurrency = (currencyCode) => {
|
|
5
5
|
return currencyCode === 'USD';
|
|
6
6
|
};
|
|
7
7
|
exports.isUsdCurrency = isUsdCurrency;
|
|
8
|
-
/** Default home-currency fallback when tenant/report currency is unset. */
|
|
9
|
-
exports.defaultCustomerCurrency = {
|
|
10
|
-
currencyCode: 'USD',
|
|
11
|
-
currencySymbol: '$',
|
|
12
|
-
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Currency } from '../../commonStateTypes/amount';
|
|
1
2
|
import { ID } from '../../commonStateTypes/common';
|
|
2
3
|
import { ZeniDate } from '../../zeniDayJS';
|
|
3
4
|
import { ZeniUrl as Url } from '../../zeniUrl';
|
|
@@ -46,3 +47,4 @@ export interface Customer extends CustomerBase {
|
|
|
46
47
|
export interface CustomerState {
|
|
47
48
|
byCustomerId: Record<ID, Customer>;
|
|
48
49
|
}
|
|
50
|
+
export declare const defaultCustomerCurrency: Currency;
|
|
@@ -27,8 +27,3 @@ const ALL_CALCULATED_BALANCES = [
|
|
|
27
27
|
export const toCOABalanceType = (v) => stringToUnion(v, ALL_COA_BALANCE_FIELDS);
|
|
28
28
|
export const toCOABalanceTypeStrict = (v) => stringToUnionStrict(v, ALL_COA_BALANCE_FIELDS);
|
|
29
29
|
export const isCalculatedBalanceType = (id) => ALL_CALCULATED_BALANCES.find((sectionId) => id === sectionId) != null;
|
|
30
|
-
/** Removes compare-mode balance types (horizontal P&L-by-class does not use them). */
|
|
31
|
-
export function stripCompareAdditionalBalanceTypes(balances) {
|
|
32
|
-
return balances.filter((balanceType) => balanceType !== 'this_period_vs_last_period' &&
|
|
33
|
-
balanceType !== 'this_period_vs_last_period_percent');
|
|
34
|
-
}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { isAllowedValueWithCode, isAllowedValueWithID, } from './commonStateTypes/allowedValue';
|
|
2
2
|
import { toAmount } from './commonStateTypes/amount';
|
|
3
|
-
import { defaultCustomerCurrency } from './commonStateTypes/currencyHelper';
|
|
4
3
|
import { getTimeframeTickTag, isIncompleteMonthPresentInTimeframeTick, } from './commonStateTypes/bookCloseDateHelper';
|
|
5
4
|
import { toCOABalanceTimeframe, } from './commonStateTypes/coaBalance/coaBalance';
|
|
6
|
-
import { isCalculatedBalanceType,
|
|
5
|
+
import { isCalculatedBalanceType, toCOABalanceType, toCOABalanceTypeStrict, } from './commonStateTypes/coaBalance/coaBalanceType';
|
|
7
6
|
import { newBalancesFilter, newBalancesFilterForDateRange, toCOABalancesOrderStrict, } from './commonStateTypes/coaBalance/coaBalancesFilter';
|
|
8
7
|
import { newBalancesFilterClassesView, } from './commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
9
8
|
import { getNumberOfPeriods } from './commonStateTypes/dataAvailable';
|
|
@@ -41,6 +40,7 @@ import { getControllersName, getFirstControllerEmail, getFirstControllerId, } fr
|
|
|
41
40
|
import { getCompanyByCompanyId, getCompanyInfoForAllCockpitCompaniesInState, getControllersForCompany, } from './entity/company/companySelector';
|
|
42
41
|
import { ALL_ACCOUNTING_CONNECTION_CREATION_MODES, isCompanyEligibleForTreasury, } from './entity/company/companyStateTypes';
|
|
43
42
|
import { updateCompaniesHealth, updateCompanyHealth, } from './entity/companyHealthMetric/companyHealthMetricReducer';
|
|
43
|
+
import { defaultCustomerCurrency, } from './entity/customer/customerState';
|
|
44
44
|
import { CustomerIncomeTrend } from './entity/customerIncome/customerIncomeTrend';
|
|
45
45
|
import { getDepositAccountLimitForChargeCardByDepositAccountId } from './entity/depositAccount/depositAccountSelector';
|
|
46
46
|
import { mapAttachmentFilePayloadToFile, mapAttachmentFileToAttachmentFilePayload, mapFilePayloadToFile, removeAttachmentFiles, updateAttachmentFiles, updateFiles, } from './entity/file/fileReducer';
|
|
@@ -219,7 +219,6 @@ import { fetchProfitAndLoss, fetchProfitAndLossForTimeframe, resetProfitAndLossN
|
|
|
219
219
|
import { getPandLReportFetchState, getProfitAndLossReport, } from './view/profitAndLoss/profitAndLossSelector';
|
|
220
220
|
import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateClassViewLayout, updateProfitAndLossClassesViewUIState, } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
|
|
221
221
|
import { getProfitAndLossClassesHorizontalView } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
222
|
-
import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, isHorizontalAccountReportData, } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
223
222
|
import { getProfitAndLossClassesView } from './view/profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
224
223
|
import { isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, } from './view/profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
225
224
|
import { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityId, fetchRecommendationByEntityName, } from './view/recommendation/recommendationReducer';
|
|
@@ -415,7 +414,7 @@ export { toReportID, toReportFormatStrict, isCashFlowOrBalanceSheetReport, isDas
|
|
|
415
414
|
export { toCOABalanceTimeframe, };
|
|
416
415
|
export { toCOABalancesOrderStrict, newBalancesFilter, newBalancesFilterForDateRange, };
|
|
417
416
|
export { newBalancesFilterClassesView };
|
|
418
|
-
export { toCOABalanceTypeStrict, toCOABalanceType as toCOABlanaceType, isCalculatedBalanceType,
|
|
417
|
+
export { toCOABalanceTypeStrict, toCOABalanceType as toCOABlanaceType, isCalculatedBalanceType, };
|
|
419
418
|
export { stringToUnion, stringToUnionStrict };
|
|
420
419
|
export { fetchMonthEndCloseChecks, fetchMonthClosePerformanceTrend, getMonthEndCloseChecksViewByTenantId, ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, };
|
|
421
420
|
export {
|
|
@@ -453,7 +452,7 @@ export { fetchDashboard, getDashboard, updateTreasuryVideoClosed, };
|
|
|
453
452
|
export { updateDashboardLayout };
|
|
454
453
|
export { getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
|
|
455
454
|
export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, getProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
|
|
456
|
-
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID,
|
|
455
|
+
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, };
|
|
457
456
|
export { getAccountingProviderAttachment };
|
|
458
457
|
export { fetchUserListByType, getUserList };
|
|
459
458
|
export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, getPeople, getPeopleLocalData, initializeEditPerson, };
|
|
@@ -3,7 +3,7 @@ import { mapReportPayloadV2ToReportV2 } from '../../../commonPayloadTypes/v2/vie
|
|
|
3
3
|
import { getAgingBalancesKey, toAgingPeriod, } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
4
|
import { getNestedCustomerHierarchy } from '../../../commonStateTypes/customerView/getNestedCustomerHierarchy';
|
|
5
5
|
import { toCustomer } from '../../../entity/customer/customerPayload';
|
|
6
|
-
import { defaultCustomerCurrency } from '../../../
|
|
6
|
+
import { defaultCustomerCurrency } from '../../../entity/customer/customerState';
|
|
7
7
|
import { dateNow } from '../../../zeniDayJS';
|
|
8
8
|
import { toArAgingDataByCustomerId, toArAgingTotals, } from './arAgingPayload';
|
|
9
9
|
export const inititalUIState = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import orderBy from 'lodash/orderBy';
|
|
3
3
|
import { getAgingBalancesKey, } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
|
-
import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
|
|
5
4
|
import { getCustomer } from '../../../entity/customer/customerSelector';
|
|
5
|
+
import { defaultCustomerCurrency, } from '../../../entity/customer/customerState';
|
|
6
6
|
export const getArAgingReport = createSelector((state) => state.arAgingState, (state) => state.customerState, (arAgingState, customerState) => {
|
|
7
7
|
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY, agingPeriods, } = arAgingState;
|
|
8
8
|
const { searchString, sortOrder, sortKey, selectedDate } = uiState;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
-
import { stripCompareAdditionalBalanceTypes } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
3
2
|
import { newBalancesFilter, newBalancesFilterForDateRange, } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
4
3
|
import { newBalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
5
4
|
import { getNumberOfPeriods, } from '../../commonStateTypes/dataAvailable';
|
|
@@ -56,15 +55,9 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
56
55
|
if (thisPeriod == null && balancesInTimeframe.length > 0) {
|
|
57
56
|
thisPeriod = toTimeframeTick(balancesInTimeframe[balancesInTimeframe.length - 1]);
|
|
58
57
|
}
|
|
59
|
-
const
|
|
58
|
+
const filter = newBalancesFilter(firstMonthOfFY, financeStatementState.timeframe, Math.min(getNumberOfPeriods(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', financeStatementState.isAdditionalBalancesShown === true
|
|
60
59
|
? financeStatementState.selectedAdditionalBalances
|
|
61
|
-
: [];
|
|
62
|
-
const useHorizontalClassesLayout = profitAndLossClassesViewState.uiState.classViewLayout === 'horizontal' &&
|
|
63
|
-
financeStatementState.selectedReportId === 'profit_and_loss_by_classes';
|
|
64
|
-
const additionalBalancesForFilter = useHorizontalClassesLayout
|
|
65
|
-
? stripCompareAdditionalBalanceTypes(rawAdditionalBalances)
|
|
66
|
-
: rawAdditionalBalances;
|
|
67
|
-
const filter = newBalancesFilter(firstMonthOfFY, financeStatementState.timeframe, Math.min(getNumberOfPeriods(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', additionalBalancesForFilter);
|
|
60
|
+
: []);
|
|
68
61
|
const profitAndLossReport = getProfitAndLossReport(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
|
|
69
62
|
const classFilter = newBalancesFilterClassesView(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
|
|
70
63
|
const profitAndLossByClassReport = getProfitAndLossClassesView(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
|
|
@@ -124,9 +117,7 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
124
117
|
filter,
|
|
125
118
|
selectedReportId: financeStatementState.selectedReportId,
|
|
126
119
|
downloadState: financeStatementState.downloadState,
|
|
127
|
-
isCompareModeOn:
|
|
128
|
-
|
|
129
|
-
: financeStatementState.selectedAdditionalBalances.includes('this_period_vs_last_period') ||
|
|
130
|
-
financeStatementState.selectedAdditionalBalances.includes('this_period_vs_last_period_percent'),
|
|
120
|
+
isCompareModeOn: financeStatementState.selectedAdditionalBalances.includes('this_period_vs_last_period') ||
|
|
121
|
+
financeStatementState.selectedAdditionalBalances.includes('this_period_vs_last_period_percent'),
|
|
131
122
|
};
|
|
132
123
|
});
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { toAmountWC } from '../../commonStateTypes/amount';
|
|
2
|
-
import { getSummationFreeRangeTotalBalance } from '../../commonStateTypes/coaBalance/additionalBalances/getSummationBalance';
|
|
3
2
|
import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
|
|
4
|
-
import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
|
|
5
3
|
import { getSectionClassesViewReport } from '../../entity/sectionClassesViewV2/sectionClassesViewSelector';
|
|
6
|
-
|
|
4
|
+
/** If `ProfitAndLossClassesViewState.currency` is unset (e.g. tests). */
|
|
5
|
+
const FALLBACK_REPORT_CURRENCY = {
|
|
6
|
+
currencyCode: 'USD',
|
|
7
|
+
currencySymbol: '$',
|
|
8
|
+
};
|
|
7
9
|
export const profitAndLossHorizontalIdsInOrder = [
|
|
8
10
|
'income',
|
|
9
11
|
'cogs',
|
|
@@ -47,7 +49,7 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
47
49
|
const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, filter.classesToFilterOut);
|
|
48
50
|
const sections = {};
|
|
49
51
|
const calculatedSections = {};
|
|
50
|
-
let reportCurrency =
|
|
52
|
+
let reportCurrency = FALLBACK_REPORT_CURRENCY;
|
|
51
53
|
if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
|
|
52
54
|
// Get section reports using existing selector infrastructure
|
|
53
55
|
const sectionReports = {};
|
|
@@ -55,7 +57,7 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
55
57
|
sectionReports[sectionId] = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
|
|
56
58
|
});
|
|
57
59
|
reportCurrency =
|
|
58
|
-
profitAndLossClassesViewState.currency ??
|
|
60
|
+
profitAndLossClassesViewState.currency ?? FALLBACK_REPORT_CURRENCY;
|
|
59
61
|
// Pivot each section from class→account to account→class
|
|
60
62
|
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
61
63
|
const sectionReport = sectionReports[sectionId];
|
|
@@ -92,7 +94,7 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
92
94
|
}
|
|
93
95
|
// Build synthetic header COABalances for rendering class names as column headers
|
|
94
96
|
const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod, reportCurrency);
|
|
95
|
-
|
|
97
|
+
return {
|
|
96
98
|
reportId,
|
|
97
99
|
reportTitle: 'Profit and Loss by Class',
|
|
98
100
|
firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
|
|
@@ -107,8 +109,6 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
107
109
|
uiState: profitAndLossClassesViewState.uiState,
|
|
108
110
|
headerBalances,
|
|
109
111
|
};
|
|
110
|
-
enrichProfitAndLossByClassHorizontalReport(report);
|
|
111
|
-
return report;
|
|
112
112
|
};
|
|
113
113
|
/**
|
|
114
114
|
* Build column definitions from class hierarchy (top-level classes only).
|
|
@@ -253,15 +253,17 @@ function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, de
|
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
|
-
* Total
|
|
257
|
-
* `
|
|
256
|
+
* Total amount for the current report slice. `balances` is already narrowed by
|
|
257
|
+
* `getCOABalances` / `sliceCOABalances` to the selected range; summing matches
|
|
258
|
+
* multi-period selections and avoids mismatches when `thisPeriod` does not
|
|
259
|
+
* align with a row (e.g. slice fallback) or when several period rows are shown.
|
|
258
260
|
*/
|
|
259
261
|
function sumBalancesInSlice(balances) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
let sum = 0;
|
|
263
|
+
for (const bal of balances) {
|
|
264
|
+
sum += bal.balance?.amount ?? 0;
|
|
262
265
|
}
|
|
263
|
-
|
|
264
|
-
return summed?.balance.amount ?? 0;
|
|
266
|
+
return sum;
|
|
265
267
|
}
|
|
266
268
|
/**
|
|
267
269
|
* Compute a calculated section by adding or subtracting two sets of class totals.
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const HORIZONTAL_CLASS_TOTAL_BALANCE_ID = '__horizontal_total__';
|
|
3
|
-
export function isHorizontalAccountReportData(data) {
|
|
4
|
-
return (typeof data === 'object' &&
|
|
5
|
-
data !== null &&
|
|
6
|
-
'depth' in data &&
|
|
7
|
-
typeof data.depth === 'number' &&
|
|
8
|
-
!('filter' in data));
|
|
9
|
-
}
|
|
1
|
+
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { NestedAccountHierarchyForReport, NestedAccountID, NestedAccountIDHierar
|
|
|
2
2
|
import { AgingBalance, AgingPeriod } from './commonStateTypes/agingBalance/agingBalance';
|
|
3
3
|
import { AllowedValue, AllowedValueWithCode, AllowedValueWithID, isAllowedValueWithCode, isAllowedValueWithID } from './commonStateTypes/allowedValue';
|
|
4
4
|
import { Amount, Currency, toAmount } from './commonStateTypes/amount';
|
|
5
|
-
import { defaultCustomerCurrency } from './commonStateTypes/currencyHelper';
|
|
6
5
|
import { AnimationFileName } from './commonStateTypes/animations';
|
|
7
6
|
import { Balance, BalanceChange } from './commonStateTypes/balance';
|
|
8
7
|
import { BalanceKind, BalancesTimeseries, TrendTimeseries } from './commonStateTypes/balanceTimeseries';
|
|
@@ -10,7 +9,7 @@ import { TimeFrameTickTag, getTimeframeTickTag, isIncompleteMonthPresentInTimefr
|
|
|
10
9
|
import { NestedClassHierarchyForReport, NestedClassID, NestedClassIDHierarchy } from './commonStateTypes/classesView/nestedClassID';
|
|
11
10
|
import { COABalance, COABalanceGrouped, COABalanceGroupedByPeriod, COABalanceMonthQuarterTimeframe, COABalanceTimeFrame, COABalanceWithPercent, toCOABalanceTimeframe } from './commonStateTypes/coaBalance/coaBalance';
|
|
12
11
|
import { COABalanceByAdditionalPeriodGrouped } from './commonStateTypes/coaBalance/coaBalanceByAdditionalPeriod';
|
|
13
|
-
import { COABalanceType, CalculatedBalance, CalculatedCompareBalance, CalculatedTotalBalance, isCalculatedBalanceType,
|
|
12
|
+
import { COABalanceType, CalculatedBalance, CalculatedCompareBalance, CalculatedTotalBalance, isCalculatedBalanceType, toCOABalanceType, toCOABalanceTypeStrict } from './commonStateTypes/coaBalance/coaBalanceType';
|
|
14
13
|
import { COABalancesFilter, COABalancesOrder, COABalancesRange, COABalancesRangeWithThisPeriod, COABalancesSlice, newBalancesFilter, newBalancesFilterForDateRange, toCOABalancesOrderStrict } from './commonStateTypes/coaBalance/coaBalancesFilter';
|
|
15
14
|
import { COABalancesFilterClassesView, newBalancesFilterClassesView } from './commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
16
15
|
import { AccountViewMode, CompletionStatusType, FetchState, FetchStateAndError, FetchedState, ID, Mode, UpdateType } from './commonStateTypes/common';
|
|
@@ -71,7 +70,7 @@ import { AdditionalChurnFactor, AdditionalChurnFactors, CompanyHealthMetric, Com
|
|
|
71
70
|
import { ConnectedAccount } from './entity/connectedAccount/connectedAccount';
|
|
72
71
|
import { Country } from './entity/countryList/countryListState';
|
|
73
72
|
import { CountryWithCurrency } from './entity/currency/currency';
|
|
74
|
-
import { Customer, CustomerBase } from './entity/customer/customerState';
|
|
73
|
+
import { Customer, CustomerBase, defaultCustomerCurrency } from './entity/customer/customerState';
|
|
75
74
|
import { CustomerIncomeTrend } from './entity/customerIncome/customerIncomeTrend';
|
|
76
75
|
import { CustomerSatisfactionInfo } from './entity/customerSatisfaction/customerSatisfactionSelectorReducerTypes';
|
|
77
76
|
import { CustomerRatingCodeType, TeamRatingCodeType } from './entity/customerSatisfaction/customerSatisfactionState';
|
|
@@ -349,7 +348,7 @@ import { ProfitAndLossReport, getPandLReportFetchState, getProfitAndLossReport }
|
|
|
349
348
|
import { ProfitAndLossState, ProfitAndLossUIState } from './view/profitAndLoss/profitAndLossState';
|
|
350
349
|
import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateClassViewLayout, updateProfitAndLossClassesViewUIState } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
|
|
351
350
|
import { getProfitAndLossClassesHorizontalView } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
352
|
-
import { ClassColumnDefinition,
|
|
351
|
+
import { ClassColumnDefinition, HorizontalAccountRow, HorizontalCalculatedSection, HorizontalClassBalance, HorizontalSectionReport, ProfitAndLossByClassHorizontalReport } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
353
352
|
import { getProfitAndLossClassesView } from './view/profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
354
353
|
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID, ProfitAndLossClassesViewReport, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID } from './view/profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
355
354
|
import { ClassViewLayout, ProfitAndLossClassesViewUIState } from './view/profitAndLossClassesView/profitAndLossClassesViewState';
|
|
@@ -620,7 +619,7 @@ export { COABalance, COABalanceWithPercent, COABalanceTimeFrame, COABalanceGroup
|
|
|
620
619
|
export { COABalanceByAdditionalPeriodGrouped };
|
|
621
620
|
export { COABalancesOrder, toCOABalancesOrderStrict, COABalancesRange, COABalancesRangeWithThisPeriod, COABalancesFilter, newBalancesFilter, newBalancesFilterForDateRange, COABalancesSlice, };
|
|
622
621
|
export { newBalancesFilterClassesView, COABalancesFilterClassesView };
|
|
623
|
-
export { CalculatedCompareBalance, CalculatedTotalBalance, CalculatedBalance, COABalanceType, toCOABalanceTypeStrict, toCOABalanceType as toCOABlanaceType, isCalculatedBalanceType,
|
|
622
|
+
export { CalculatedCompareBalance, CalculatedTotalBalance, CalculatedBalance, COABalanceType, toCOABalanceTypeStrict, toCOABalanceType as toCOABlanaceType, isCalculatedBalanceType, };
|
|
624
623
|
export { stringToUnion, stringToUnionStrict };
|
|
625
624
|
export { TransactionsOrder, COABalancesSliceOrder, EntityOrder, Section, SectionWithAccountOnly, CalculatedSection, };
|
|
626
625
|
export { ClassesViewSelectorReportV2 };
|
|
@@ -667,7 +666,7 @@ export { fetchDashboard, getDashboard, DashboardReport, updateTreasuryVideoClose
|
|
|
667
666
|
export { updateDashboardLayout };
|
|
668
667
|
export { PandLWithForecastView, getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
|
|
669
668
|
export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, ProfitAndLossState, ProfitAndLossUIState, getProfitAndLossReport, ProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
|
|
670
|
-
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, ProfitAndLossClassesViewUIState, ProfitAndLossClassesViewReport, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, PandLReportViewSectionID, PandLReportViewCalculatedSectionID, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, ClassViewLayout, ProfitAndLossByClassHorizontalReport, ClassColumnDefinition,
|
|
669
|
+
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, ProfitAndLossClassesViewUIState, ProfitAndLossClassesViewReport, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, PandLReportViewSectionID, PandLReportViewCalculatedSectionID, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, ClassViewLayout, ProfitAndLossByClassHorizontalReport, ClassColumnDefinition, HorizontalAccountRow, HorizontalClassBalance, HorizontalSectionReport, HorizontalCalculatedSection, };
|
|
671
670
|
export { AccountingProviderAttachmentSelector, getAccountingProviderAttachment };
|
|
672
671
|
export { fetchUserListByType, getUserList, UserListSelectorView };
|
|
673
672
|
export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, PeopleSelectorView, PeopleLocalDataView, Person, getPeople, getPeopleLocalData, PeopleState, PersonUpdateType, PeoplePageMode, ZeniPersonUserRoleType, PeopleUIState, PeopleLocalData, initializeEditPerson, };
|