@zeniai/client-epic-state 4.20.3-betaRD2 → 4.20.3-betaRD21
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/subAccountView/reportBySubAccountPayload.d.ts +0 -2
- package/lib/commonStateTypes/common.d.ts +1 -1
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +0 -1
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +1 -3
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -1
- package/lib/entity/account/accountPayload.d.ts +2 -0
- package/lib/entity/account/accountReducer.d.ts +5 -2
- package/lib/entity/account/accountReducer.js +10 -7
- package/lib/entity/account/accountSelector.d.ts +0 -7
- package/lib/entity/account/accountSelector.js +2 -4
- package/lib/entity/account/accountState.d.ts +1 -3
- package/lib/entity/account/accountState.js +1 -4
- package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +0 -1
- package/lib/entity/accountGroup/accountGroupSelector.d.ts +0 -22
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +44 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +55 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +10 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +51 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +48 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +66 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +52 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +37 -0
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -5
- package/lib/entity/tenant/clearAllEpic.js +4 -6
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.js +0 -1
- package/lib/entity/tenant/tenantSelector.d.ts +0 -1
- package/lib/entity/tenant/tenantSelector.js +1 -9
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/epic.d.ts +3 -4
- package/lib/epic.js +3 -4
- package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +0 -1
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -1
- package/lib/esm/entity/account/accountReducer.js +9 -6
- package/lib/esm/entity/account/accountSelector.js +2 -4
- package/lib/esm/entity/account/accountState.js +1 -4
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +49 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +47 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +62 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +31 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +4 -6
- package/lib/esm/entity/tenant/tenantReducer.js +0 -1
- package/lib/esm/entity/tenant/tenantSelector.js +0 -7
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +1 -0
- package/lib/esm/epic.js +3 -4
- package/lib/esm/index.js +15 -11
- package/lib/esm/reducer.js +6 -9
- package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +2 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +149 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +72 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +11 -0
- package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +46 -0
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +27 -0
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +47 -0
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +52 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -1
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +163 -3
- package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +1 -2
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +112 -0
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +10 -6
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -12
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +4 -2
- package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +0 -4
- package/lib/index.d.ts +16 -14
- package/lib/index.js +65 -45
- package/lib/reducer.d.ts +6 -9
- package/lib/reducer.js +6 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +31 -0
- package/lib/view/aiAccountantView/aiAccountantViewPayload.js +8 -0
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +29 -0
- package/lib/view/aiAccountantView/aiAccountantViewReducer.js +153 -0
- package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +14 -0
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +78 -0
- package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +27 -0
- package/lib/view/aiAccountantView/aiAccountantViewState.js +13 -0
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +33 -0
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +50 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +23 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +31 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +33 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +51 -0
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +28 -0
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +56 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -2
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -2
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +6 -5
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +48 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +33 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +18 -4
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +164 -4
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +6 -2
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +3 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +13 -0
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementSelector.d.ts +0 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -12
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +4 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +1 -2
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +0 -4
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
- package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/package.json +1 -1
- package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.d.ts +0 -13
- package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +0 -9
- package/lib/commonStateTypes/projectView/projectViewParentID.d.ts +0 -5
- package/lib/commonStateTypes/projectView/projectViewParentID.js +0 -2
- package/lib/entity/project/projectPayload.d.ts +0 -13
- package/lib/entity/project/projectPayload.js +0 -30
- package/lib/entity/project/projectReducer.d.ts +0 -10
- package/lib/entity/project/projectReducer.js +0 -31
- package/lib/entity/project/projectSelector.d.ts +0 -5
- package/lib/entity/project/projectSelector.js +0 -12
- package/lib/entity/project/projectState.d.ts +0 -13
- package/lib/entity/project/projectState.js +0 -2
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +0 -10
- package/lib/entity/sectionProjectView/sectionProjectView.js +0 -6
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.d.ts +0 -6
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +0 -51
- package/lib/entity/sectionProjectView/sectionProjectViewHelper.d.ts +0 -9
- package/lib/entity/sectionProjectView/sectionProjectViewHelper.js +0 -13
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +0 -15
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +0 -50
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +0 -11
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +0 -77
- package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.d.ts +0 -16
- package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +0 -2
- package/lib/entity/sectionProjectView/sectionProjectViewState.d.ts +0 -4
- package/lib/entity/sectionProjectView/sectionProjectViewState.js +0 -2
- package/lib/esm/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +0 -5
- package/lib/esm/commonStateTypes/projectView/projectViewParentID.js +0 -1
- package/lib/esm/entity/project/projectPayload.js +0 -26
- package/lib/esm/entity/project/projectReducer.js +0 -27
- package/lib/esm/entity/project/projectSelector.js +0 -8
- package/lib/esm/entity/project/projectState.js +0 -1
- package/lib/esm/entity/sectionProjectView/sectionProjectView.js +0 -3
- package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +0 -47
- package/lib/esm/entity/sectionProjectView/sectionProjectViewHelper.js +0 -9
- package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +0 -46
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +0 -70
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +0 -1
- package/lib/esm/entity/sectionProjectView/sectionProjectViewState.js +0 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +0 -45
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +0 -30
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +0 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +0 -113
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +0 -66
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +0 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewState.js +0 -1
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +0 -8
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +0 -49
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.d.ts +0 -6
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +0 -34
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +0 -33
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +0 -2
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +0 -33
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +0 -117
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.d.ts +0 -9
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +0 -70
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +0 -18
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +0 -2
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.d.ts +0 -22
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.js +0 -2
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { getDifferenceOfBalancesGroupedByPeriod } from '../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod';
|
|
2
|
-
import { getSumOfBalancesByGroupedByPeriod } from '../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod';
|
|
3
|
-
import { getCOABalances } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
4
|
-
import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
|
|
5
|
-
import { getSectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelector';
|
|
6
|
-
import { ALL_PANDL_REPORT_VIEW_SECTION_IDS, } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
7
|
-
export const profitAndLossProjectIdsInOrder = [
|
|
8
|
-
'income',
|
|
9
|
-
'cogs',
|
|
10
|
-
'grossProfit',
|
|
11
|
-
'expenses',
|
|
12
|
-
'earningsBeforeInterestAndTax',
|
|
13
|
-
'otherIncome',
|
|
14
|
-
'otherExpenses',
|
|
15
|
-
'netOtherIncome',
|
|
16
|
-
'netIncome',
|
|
17
|
-
];
|
|
18
|
-
export const getProfitAndLossProjectView = (filter, accountState, projectState, sectionsState, profitAndLossProjectViewState) => {
|
|
19
|
-
const fetchState = reduceFetchStateParallelTimeframes([
|
|
20
|
-
profitAndLossProjectViewState.fetchState.month,
|
|
21
|
-
profitAndLossProjectViewState.fetchState.quarter,
|
|
22
|
-
profitAndLossProjectViewState.fetchState.year,
|
|
23
|
-
]);
|
|
24
|
-
const reportId = 'profit_and_loss_by_projects';
|
|
25
|
-
const sections = {};
|
|
26
|
-
const calculatedSections = {};
|
|
27
|
-
if (fetchState.fetchState === 'Completed') {
|
|
28
|
-
ALL_PANDL_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
|
|
29
|
-
sections[`${sectionId}`] = getSectionProjectViewReport(accountState, projectState, sectionsState, profitAndLossProjectViewState.projectIds, {
|
|
30
|
-
reportId,
|
|
31
|
-
sectionId,
|
|
32
|
-
}, filter);
|
|
33
|
-
});
|
|
34
|
-
const grossProfitBalancesByPeriod = getDifferenceOfBalancesGroupedByPeriod(sections['income'].sectionBalancesTotalByPeriod, sections['cogs'].sectionBalancesTotalByPeriod);
|
|
35
|
-
calculatedSections['grossProfit'] = getCOABalances(grossProfitBalancesByPeriod, filter);
|
|
36
|
-
const ebitBalancesByPeriod = getDifferenceOfBalancesGroupedByPeriod(grossProfitBalancesByPeriod, sections['expenses'].sectionBalancesTotalByPeriod);
|
|
37
|
-
calculatedSections['earningsBeforeInterestAndTax'] = getCOABalances(ebitBalancesByPeriod, filter);
|
|
38
|
-
const netOtherIncomeBalances = getDifferenceOfBalancesGroupedByPeriod(sections['otherIncome'].sectionBalancesTotalByPeriod, sections['otherExpenses'].sectionBalancesTotalByPeriod);
|
|
39
|
-
calculatedSections['netOtherIncome'] = getCOABalances(netOtherIncomeBalances, filter);
|
|
40
|
-
const netIncomeBalances = netOtherIncomeBalances != null
|
|
41
|
-
? getSumOfBalancesByGroupedByPeriod([
|
|
42
|
-
ebitBalancesByPeriod,
|
|
43
|
-
netOtherIncomeBalances,
|
|
44
|
-
])
|
|
45
|
-
: ebitBalancesByPeriod;
|
|
46
|
-
calculatedSections['netIncome'] = getCOABalances(netIncomeBalances, filter);
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
sections,
|
|
50
|
-
calculatedSections,
|
|
51
|
-
reportId: profitAndLossProjectViewState.reportId,
|
|
52
|
-
reportTitle: profitAndLossProjectViewState.reportTitle,
|
|
53
|
-
firstMonthOfFY: profitAndLossProjectViewState.firstMonthOfFY,
|
|
54
|
-
dataAvailable: profitAndLossProjectViewState.dataAvailable,
|
|
55
|
-
bookCloseDate: profitAndLossProjectViewState.bookCloseDate,
|
|
56
|
-
version: profitAndLossProjectViewState.version,
|
|
57
|
-
status: profitAndLossProjectViewState.status,
|
|
58
|
-
fetchState: fetchState.fetchState,
|
|
59
|
-
error: fetchState.error,
|
|
60
|
-
filter,
|
|
61
|
-
uiState: profitAndLossProjectViewState.uiState,
|
|
62
|
-
projectIds: profitAndLossProjectViewState.projectIds,
|
|
63
|
-
projectsToFilterOut: profitAndLossProjectViewState.uiState.projectsToFilterOut,
|
|
64
|
-
idsInOrder: profitAndLossProjectIdsInOrder,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateSectionProjectView } from '../../entity/sectionProjectView/sectionProjectViewReducer';
|
|
4
|
-
import { RootState } from '../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../zeniAPI';
|
|
6
|
-
import { fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure } from './profitAndLossProjectViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchProfitAndLossForTimeframeProjectView> | ReturnType<typeof updateProfitAndLossForTimeframeProjectView> | ReturnType<typeof updateProfitAndLossForTimeframeProjectViewFailure> | ReturnType<typeof updateSectionProjectView>;
|
|
8
|
-
export declare const fetchProfitAndLossForTimeframeProjectViewEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchProfitAndLossForTimeframeProjectViewEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const sectionProjectViewReducer_1 = require("../../entity/sectionProjectView/sectionProjectViewReducer");
|
|
7
|
-
const responsePayload_1 = require("../../responsePayload");
|
|
8
|
-
const profitAndLossProjectViewReducer_1 = require("./profitAndLossProjectViewReducer");
|
|
9
|
-
const fetchProfitAndLossForTimeframeProjectViewEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
-
const getTimeSeriesGroup = (timeframe) => {
|
|
11
|
-
switch (timeframe) {
|
|
12
|
-
case 'month':
|
|
13
|
-
return 'months';
|
|
14
|
-
case 'quarter':
|
|
15
|
-
return 'quarters';
|
|
16
|
-
case 'year':
|
|
17
|
-
return 'years';
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const queryValue = {
|
|
21
|
-
is_full_response: action.payload.fetchFullReport,
|
|
22
|
-
time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
|
|
23
|
-
is_group_by_project: true,
|
|
24
|
-
};
|
|
25
|
-
return zeniAPI
|
|
26
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/profit_and_loss?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
27
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
28
|
-
if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
|
|
29
|
-
const actions = [];
|
|
30
|
-
const report = response.data.report;
|
|
31
|
-
const currency = report.currency;
|
|
32
|
-
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, 'cogs', 'profit_and_loss_by_projects', report.cogs, report.accounts, currency));
|
|
33
|
-
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, 'expenses', 'profit_and_loss_by_projects', report.expenses, report.accounts, currency));
|
|
34
|
-
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, 'income', 'profit_and_loss_by_projects', report.income, report.accounts, currency));
|
|
35
|
-
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_projects', report.other_expenses, report.accounts, currency));
|
|
36
|
-
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_projects', report.other_income, report.accounts, currency));
|
|
37
|
-
actions.push((0, profitAndLossProjectViewReducer_1.updateProfitAndLossForTimeframeProjectView)({
|
|
38
|
-
timeframe: action.payload.timeframe,
|
|
39
|
-
report: response.data,
|
|
40
|
-
}));
|
|
41
|
-
return (0, rxjs_1.from)(actions);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return (0, rxjs_1.of)((0, profitAndLossProjectViewReducer_1.updateProfitAndLossForTimeframeProjectViewFailure)(response.status, action.payload.timeframe));
|
|
45
|
-
}
|
|
46
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, profitAndLossProjectViewReducer_1.updateProfitAndLossForTimeframeProjectViewFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'P&L by Projects REST API call errored out' +
|
|
47
|
-
JSON.stringify(error)), action.payload.timeframe))));
|
|
48
|
-
}));
|
|
49
|
-
exports.fetchProfitAndLossForTimeframeProjectViewEpic = fetchProfitAndLossForTimeframeProjectViewEpic;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../reducer';
|
|
4
|
-
import { fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView } from './profitAndLossProjectViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchProfitAndLossProjectView> | ReturnType<typeof fetchProfitAndLossForTimeframeProjectView>;
|
|
6
|
-
export declare const fetchProfitAndLossProjectViewEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchProfitAndLossProjectViewEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const profitAndLossProjectViewReducer_1 = require("./profitAndLossProjectViewReducer");
|
|
7
|
-
const fetchProfitAndLossProjectViewEpic = (actions$, state) => actions$.pipe((0, operators_1.filter)(profitAndLossProjectViewReducer_1.fetchProfitAndLossProjectView.match), (0, operators_1.switchMap)((action) => {
|
|
8
|
-
const { cacheOverride } = action.payload;
|
|
9
|
-
if (cacheOverride === true) {
|
|
10
|
-
return (0, rxjs_1.from)([
|
|
11
|
-
(0, profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView)('month'),
|
|
12
|
-
(0, profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView)('quarter'),
|
|
13
|
-
(0, profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView)('year'),
|
|
14
|
-
]);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
const fetchActions = [];
|
|
18
|
-
const projectFetchState = state.value.profitAndLossProjectViewState.fetchState;
|
|
19
|
-
if (projectFetchState['month'].fetchState !== 'In-Progress' &&
|
|
20
|
-
projectFetchState['month'].fetchState !== 'Completed') {
|
|
21
|
-
fetchActions.push((0, profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView)('month'));
|
|
22
|
-
}
|
|
23
|
-
if (projectFetchState['quarter'].fetchState !== 'In-Progress' &&
|
|
24
|
-
projectFetchState['quarter'].fetchState !== 'Completed') {
|
|
25
|
-
fetchActions.push((0, profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView)('quarter'));
|
|
26
|
-
}
|
|
27
|
-
if (projectFetchState['year'].fetchState !== 'In-Progress' &&
|
|
28
|
-
projectFetchState['year'].fetchState !== 'Completed') {
|
|
29
|
-
fetchActions.push((0, profitAndLossProjectViewReducer_1.fetchProfitAndLossForTimeframeProjectView)('year'));
|
|
30
|
-
}
|
|
31
|
-
return (0, rxjs_1.from)(fetchActions);
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
exports.fetchProfitAndLossProjectViewEpic = fetchProfitAndLossProjectViewEpic;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AccountCOABalanceGroupedPayloadByAccountId } from '../../commonPayloadTypes/subAccountView/reportBySubAccountPayload';
|
|
2
|
-
import { COABalanceGroupedPayloadV2 } from '../../commonPayloadTypes/v2/coaBalancePayload';
|
|
3
|
-
import { ReportPayloadV2 } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
4
|
-
import { AccountMetadataPayload } from '../../entity/account/accountPayload';
|
|
5
|
-
import { ProjectMetadataPayload } from '../../entity/project/projectPayload';
|
|
6
|
-
import { ZeniReportResponse } from '../../responsePayload';
|
|
7
|
-
export interface ReportByProjectMetadataPayloadV2 extends ReportPayloadV2 {
|
|
8
|
-
accounts: AccountMetadataPayload[];
|
|
9
|
-
projects: ProjectMetadataPayload[];
|
|
10
|
-
}
|
|
11
|
-
export interface ProjectCOABalanceGroupedPayloadV2 extends COABalanceGroupedPayloadV2 {
|
|
12
|
-
accounts: AccountCOABalanceGroupedPayloadByAccountId;
|
|
13
|
-
}
|
|
14
|
-
interface ProjectCOABalanceGroupedPayloadByProjectIdV2 {
|
|
15
|
-
[project_Id: string]: ProjectCOABalanceGroupedPayloadV2;
|
|
16
|
-
}
|
|
17
|
-
export interface SectionByProjectCOABalanceGroupedPayloadV2 extends COABalanceGroupedPayloadV2 {
|
|
18
|
-
projects: ProjectCOABalanceGroupedPayloadByProjectIdV2;
|
|
19
|
-
}
|
|
20
|
-
export interface ProfitAndLossProjectViewPayload extends ReportByProjectMetadataPayloadV2 {
|
|
21
|
-
cogs: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
22
|
-
earnings_before_interest_and_tax: COABalanceGroupedPayloadV2;
|
|
23
|
-
expenses: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
24
|
-
gross_profit: COABalanceGroupedPayloadV2;
|
|
25
|
-
income: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
26
|
-
net_income: COABalanceGroupedPayloadV2;
|
|
27
|
-
net_operating_income: COABalanceGroupedPayloadV2;
|
|
28
|
-
net_other_income: COABalanceGroupedPayloadV2;
|
|
29
|
-
other_expenses: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
30
|
-
other_income: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
31
|
-
}
|
|
32
|
-
export type ProfitAndLossReportProjectViewResponse = ZeniReportResponse<ProfitAndLossProjectViewPayload>;
|
|
33
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AccountViewMode, ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniAPIStatus, ZeniReportData } from '../../responsePayload';
|
|
3
|
-
import { ProfitAndLossProjectViewPayload } from './profitAndLossProjectViewPayload';
|
|
4
|
-
import { ProfitAndLossProjectViewState } from './profitAndLossProjectViewState';
|
|
5
|
-
export declare const initialState: ProfitAndLossProjectViewState;
|
|
6
|
-
export declare const fetchProfitAndLossProjectView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
7
|
-
cacheOverride: boolean;
|
|
8
|
-
}, "profitAndLossProjectView/fetchProfitAndLossProjectView", never, never>, fetchProfitAndLossForTimeframeProjectView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[timeframe: "month" | "year" | "quarter", fetchFullReport?: boolean | undefined, cacheOverride?: boolean | undefined], {
|
|
9
|
-
timeframe: "month" | "year" | "quarter";
|
|
10
|
-
fetchFullReport: boolean;
|
|
11
|
-
cacheOverride: boolean;
|
|
12
|
-
}, "profitAndLossProjectView/fetchProfitAndLossForTimeframeProjectView", never, never>, updateProfitAndLossForTimeframeProjectView: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
|
-
report: ZeniReportData<ProfitAndLossProjectViewPayload>;
|
|
14
|
-
timeframe: "month" | "quarter" | "year";
|
|
15
|
-
}, "profitAndLossProjectView/updateProfitAndLossForTimeframeProjectView">, updateProfitAndLossForTimeframeProjectViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, timeframe: "month" | "year" | "quarter"], {
|
|
16
|
-
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
-
timeframe: "month" | "year" | "quarter";
|
|
18
|
-
}, "profitAndLossProjectView/updateProfitAndLossForTimeframeProjectViewFailure", never, never>, updateProjectsToFilterOut: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
-
projectsToFilterOut: ID[];
|
|
20
|
-
}, "profitAndLossProjectView/updateProjectsToFilterOut">, updateProfitAndLossProjectViewUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
21
|
-
nodeCollapseState?: {
|
|
22
|
-
isCollapsed: boolean;
|
|
23
|
-
nodeId: ID;
|
|
24
|
-
};
|
|
25
|
-
scrollPosition?: {
|
|
26
|
-
scrollTop: number;
|
|
27
|
-
scrollLeft?: number;
|
|
28
|
-
};
|
|
29
|
-
}, "profitAndLossProjectView/updateProfitAndLossProjectViewUIState">, updateProjectViewAccountViewMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
-
viewMode: AccountViewMode;
|
|
31
|
-
}, "profitAndLossProjectView/updateProjectViewAccountViewMode">, resetProfitAndLossProjectNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossProjectView/resetProfitAndLossProjectNodeCollapseState">, clearProfitAndLossProjectView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossProjectView/clearProfitAndLossProjectView">;
|
|
32
|
-
declare const _default: import("redux").Reducer<ProfitAndLossProjectViewState>;
|
|
33
|
-
export default _default;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearProfitAndLossProjectView = exports.resetProfitAndLossProjectNodeCollapseState = exports.updateProjectViewAccountViewMode = exports.updateProfitAndLossProjectViewUIState = exports.updateProjectsToFilterOut = exports.updateProfitAndLossForTimeframeProjectViewFailure = exports.updateProfitAndLossForTimeframeProjectView = exports.fetchProfitAndLossForTimeframeProjectView = exports.fetchProfitAndLossProjectView = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
7
|
-
exports.initialState = {
|
|
8
|
-
bookCloseDate: undefined,
|
|
9
|
-
fetchState: {
|
|
10
|
-
month: {
|
|
11
|
-
fetchState: 'Not-Started',
|
|
12
|
-
error: undefined,
|
|
13
|
-
},
|
|
14
|
-
quarter: {
|
|
15
|
-
fetchState: 'Not-Started',
|
|
16
|
-
error: undefined,
|
|
17
|
-
},
|
|
18
|
-
year: {
|
|
19
|
-
fetchState: 'Not-Started',
|
|
20
|
-
error: undefined,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
firstMonthOfFY: 1,
|
|
24
|
-
projectIds: [],
|
|
25
|
-
reportId: 'profit_and_loss_by_projects',
|
|
26
|
-
reportTitle: 'profit_and_loss_by_projects',
|
|
27
|
-
uiState: {
|
|
28
|
-
accountViewMode: 'project',
|
|
29
|
-
nodeCollapseState: {},
|
|
30
|
-
projectsToFilterOut: [],
|
|
31
|
-
scrollPosition: undefined,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
const profitAndLossProjectView = (0, toolkit_1.createSlice)({
|
|
35
|
-
name: 'profitAndLossProjectView',
|
|
36
|
-
initialState: exports.initialState,
|
|
37
|
-
reducers: {
|
|
38
|
-
fetchProfitAndLossProjectView: {
|
|
39
|
-
prepare(cacheOverride = false) {
|
|
40
|
-
return { payload: { cacheOverride } };
|
|
41
|
-
},
|
|
42
|
-
reducer(
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
-
_draft,
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
|
-
_action) {
|
|
47
|
-
// nothing to do here
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
fetchProfitAndLossForTimeframeProjectView: {
|
|
51
|
-
prepare(timeframe, fetchFullReport = true, cacheOverride = false) {
|
|
52
|
-
return { payload: { timeframe, fetchFullReport, cacheOverride } };
|
|
53
|
-
},
|
|
54
|
-
reducer(draft, action) {
|
|
55
|
-
const timeframe = action.payload.timeframe;
|
|
56
|
-
draft.fetchState[timeframe].fetchState = 'In-Progress';
|
|
57
|
-
draft.fetchState[timeframe].error = undefined;
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
updateProfitAndLossForTimeframeProjectView(draft, action) {
|
|
61
|
-
doUpdateProfitAndLossProjectView(draft, action.payload.timeframe, action.payload.report);
|
|
62
|
-
},
|
|
63
|
-
updateProfitAndLossForTimeframeProjectViewFailure: {
|
|
64
|
-
prepare(error, timeframe) {
|
|
65
|
-
return {
|
|
66
|
-
payload: {
|
|
67
|
-
error,
|
|
68
|
-
timeframe,
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
reducer(draft, action) {
|
|
73
|
-
draft.fetchState[action.payload.timeframe] = {
|
|
74
|
-
fetchState: 'Error',
|
|
75
|
-
error: action.payload.error,
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
updateProjectsToFilterOut(draft, action) {
|
|
80
|
-
draft.uiState.projectsToFilterOut = action.payload.projectsToFilterOut;
|
|
81
|
-
},
|
|
82
|
-
updateProfitAndLossProjectViewUIState(draft, action) {
|
|
83
|
-
const { nodeCollapseState, scrollPosition } = action.payload;
|
|
84
|
-
if (nodeCollapseState != null) {
|
|
85
|
-
draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
|
|
86
|
-
[nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (scrollPosition != null) {
|
|
90
|
-
draft.uiState.scrollPosition = scrollPosition;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
updateProjectViewAccountViewMode(draft, action) {
|
|
94
|
-
draft.uiState.accountViewMode = action.payload.viewMode;
|
|
95
|
-
},
|
|
96
|
-
resetProfitAndLossProjectNodeCollapseState(draft) {
|
|
97
|
-
draft.uiState.nodeCollapseState = {};
|
|
98
|
-
},
|
|
99
|
-
clearProfitAndLossProjectView(draft) {
|
|
100
|
-
Object.assign(draft, exports.initialState);
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
_a = profitAndLossProjectView.actions, exports.fetchProfitAndLossProjectView = _a.fetchProfitAndLossProjectView, exports.fetchProfitAndLossForTimeframeProjectView = _a.fetchProfitAndLossForTimeframeProjectView, exports.updateProfitAndLossForTimeframeProjectView = _a.updateProfitAndLossForTimeframeProjectView, exports.updateProfitAndLossForTimeframeProjectViewFailure = _a.updateProfitAndLossForTimeframeProjectViewFailure, exports.updateProjectsToFilterOut = _a.updateProjectsToFilterOut, exports.updateProfitAndLossProjectViewUIState = _a.updateProfitAndLossProjectViewUIState, exports.updateProjectViewAccountViewMode = _a.updateProjectViewAccountViewMode, exports.resetProfitAndLossProjectNodeCollapseState = _a.resetProfitAndLossProjectNodeCollapseState, exports.clearProfitAndLossProjectView = _a.clearProfitAndLossProjectView;
|
|
105
|
-
exports.default = profitAndLossProjectView.reducer;
|
|
106
|
-
const doUpdateProfitAndLossProjectView = (draft, timeframe, pandLReport) => {
|
|
107
|
-
const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(pandLReport.report);
|
|
108
|
-
draft.currency = report.currency;
|
|
109
|
-
draft.dataAvailable = report.dataAvailable;
|
|
110
|
-
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
111
|
-
draft.bookCloseDate = report.bookCloseDate;
|
|
112
|
-
draft.status = report.status;
|
|
113
|
-
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
114
|
-
if (draft.projectIds.length <= 0) {
|
|
115
|
-
draft.projectIds = pandLReport.report.projects.map((project) => project.zeni_project_id);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
2
|
-
import { AccountState } from '../../entity/account/accountState';
|
|
3
|
-
import { ProjectState } from '../../entity/project/projectReducer';
|
|
4
|
-
import { SectionProjectViewState } from '../../entity/sectionProjectView/sectionProjectViewState';
|
|
5
|
-
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
6
|
-
import { ProfitAndLossProjectViewReport } from './profitAndLossProjectViewSelectorTypes';
|
|
7
|
-
import { ProfitAndLossProjectViewState } from './profitAndLossProjectViewState';
|
|
8
|
-
export declare const profitAndLossProjectIdsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
|
|
9
|
-
export declare const getProfitAndLossProjectView: (filter: COABalancesFilterProjectView, accountState: AccountState, projectState: ProjectState, sectionsState: SectionProjectViewState, profitAndLossProjectViewState: ProfitAndLossProjectViewState) => ProfitAndLossProjectViewReport;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProfitAndLossProjectView = exports.profitAndLossProjectIdsInOrder = void 0;
|
|
4
|
-
const getDifferenceOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod");
|
|
5
|
-
const getSumOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod");
|
|
6
|
-
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
7
|
-
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
8
|
-
const sectionProjectViewSelector_1 = require("../../entity/sectionProjectView/sectionProjectViewSelector");
|
|
9
|
-
const profitAndLossClassesViewSelectorTypes_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes");
|
|
10
|
-
exports.profitAndLossProjectIdsInOrder = [
|
|
11
|
-
'income',
|
|
12
|
-
'cogs',
|
|
13
|
-
'grossProfit',
|
|
14
|
-
'expenses',
|
|
15
|
-
'earningsBeforeInterestAndTax',
|
|
16
|
-
'otherIncome',
|
|
17
|
-
'otherExpenses',
|
|
18
|
-
'netOtherIncome',
|
|
19
|
-
'netIncome',
|
|
20
|
-
];
|
|
21
|
-
const getProfitAndLossProjectView = (filter, accountState, projectState, sectionsState, profitAndLossProjectViewState) => {
|
|
22
|
-
const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
|
|
23
|
-
profitAndLossProjectViewState.fetchState.month,
|
|
24
|
-
profitAndLossProjectViewState.fetchState.quarter,
|
|
25
|
-
profitAndLossProjectViewState.fetchState.year,
|
|
26
|
-
]);
|
|
27
|
-
const reportId = 'profit_and_loss_by_projects';
|
|
28
|
-
const sections = {};
|
|
29
|
-
const calculatedSections = {};
|
|
30
|
-
if (fetchState.fetchState === 'Completed') {
|
|
31
|
-
profitAndLossClassesViewSelectorTypes_1.ALL_PANDL_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
|
|
32
|
-
sections[`${sectionId}`] = (0, sectionProjectViewSelector_1.getSectionProjectViewReport)(accountState, projectState, sectionsState, profitAndLossProjectViewState.projectIds, {
|
|
33
|
-
reportId,
|
|
34
|
-
sectionId,
|
|
35
|
-
}, filter);
|
|
36
|
-
});
|
|
37
|
-
const grossProfitBalancesByPeriod = (0, getDifferenceOfBalancesGroupedByPeriod_1.getDifferenceOfBalancesGroupedByPeriod)(sections['income'].sectionBalancesTotalByPeriod, sections['cogs'].sectionBalancesTotalByPeriod);
|
|
38
|
-
calculatedSections['grossProfit'] = (0, coaBalance_1.getCOABalances)(grossProfitBalancesByPeriod, filter);
|
|
39
|
-
const ebitBalancesByPeriod = (0, getDifferenceOfBalancesGroupedByPeriod_1.getDifferenceOfBalancesGroupedByPeriod)(grossProfitBalancesByPeriod, sections['expenses'].sectionBalancesTotalByPeriod);
|
|
40
|
-
calculatedSections['earningsBeforeInterestAndTax'] = (0, coaBalance_1.getCOABalances)(ebitBalancesByPeriod, filter);
|
|
41
|
-
const netOtherIncomeBalances = (0, getDifferenceOfBalancesGroupedByPeriod_1.getDifferenceOfBalancesGroupedByPeriod)(sections['otherIncome'].sectionBalancesTotalByPeriod, sections['otherExpenses'].sectionBalancesTotalByPeriod);
|
|
42
|
-
calculatedSections['netOtherIncome'] = (0, coaBalance_1.getCOABalances)(netOtherIncomeBalances, filter);
|
|
43
|
-
const netIncomeBalances = netOtherIncomeBalances != null
|
|
44
|
-
? (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
|
|
45
|
-
ebitBalancesByPeriod,
|
|
46
|
-
netOtherIncomeBalances,
|
|
47
|
-
])
|
|
48
|
-
: ebitBalancesByPeriod;
|
|
49
|
-
calculatedSections['netIncome'] = (0, coaBalance_1.getCOABalances)(netIncomeBalances, filter);
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
sections,
|
|
53
|
-
calculatedSections,
|
|
54
|
-
reportId: profitAndLossProjectViewState.reportId,
|
|
55
|
-
reportTitle: profitAndLossProjectViewState.reportTitle,
|
|
56
|
-
firstMonthOfFY: profitAndLossProjectViewState.firstMonthOfFY,
|
|
57
|
-
dataAvailable: profitAndLossProjectViewState.dataAvailable,
|
|
58
|
-
bookCloseDate: profitAndLossProjectViewState.bookCloseDate,
|
|
59
|
-
version: profitAndLossProjectViewState.version,
|
|
60
|
-
status: profitAndLossProjectViewState.status,
|
|
61
|
-
fetchState: fetchState.fetchState,
|
|
62
|
-
error: fetchState.error,
|
|
63
|
-
filter,
|
|
64
|
-
uiState: profitAndLossProjectViewState.uiState,
|
|
65
|
-
projectIds: profitAndLossProjectViewState.projectIds,
|
|
66
|
-
projectsToFilterOut: profitAndLossProjectViewState.uiState.projectsToFilterOut,
|
|
67
|
-
idsInOrder: exports.profitAndLossProjectIdsInOrder,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
exports.getProfitAndLossProjectView = getProfitAndLossProjectView;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
2
|
-
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
3
|
-
import { ID } from '../../commonStateTypes/common';
|
|
4
|
-
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
5
|
-
import { CalculatedSection } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
6
|
-
import { SelectorReport } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
7
|
-
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
8
|
-
import { ProfitAndLossProjectViewUIState } from './profitAndLossProjectViewState';
|
|
9
|
-
export interface ProfitAndLossProjectViewReport extends SelectorReport {
|
|
10
|
-
calculatedSections: Record<PandLReportViewCalculatedSectionID, CalculatedSection>;
|
|
11
|
-
filter: COABalancesFilterProjectView;
|
|
12
|
-
idsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
|
|
13
|
-
projectIds: ID[];
|
|
14
|
-
projectsToFilterOut: ID[];
|
|
15
|
-
sections: Record<PandLReportViewSectionID, SectionProjectViewReport>;
|
|
16
|
-
uiState: ProfitAndLossProjectViewUIState;
|
|
17
|
-
dataAvailable?: DataAvailable;
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Currency } from '../../commonStateTypes/amount';
|
|
2
|
-
import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
3
|
-
import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
|
-
export interface ProfitAndLossProjectViewUIState {
|
|
5
|
-
accountViewMode: AccountViewMode;
|
|
6
|
-
nodeCollapseState: Record<ID, boolean>;
|
|
7
|
-
projectsToFilterOut: ID[];
|
|
8
|
-
scrollPosition: {
|
|
9
|
-
scrollTop: number;
|
|
10
|
-
scrollLeft?: number;
|
|
11
|
-
} | undefined;
|
|
12
|
-
}
|
|
13
|
-
export interface ProfitAndLossProjectViewState extends Report {
|
|
14
|
-
fetchState: {
|
|
15
|
-
month: FetchStateAndError;
|
|
16
|
-
quarter: FetchStateAndError;
|
|
17
|
-
year: FetchStateAndError;
|
|
18
|
-
};
|
|
19
|
-
projectIds: ID[];
|
|
20
|
-
uiState: ProfitAndLossProjectViewUIState;
|
|
21
|
-
currency?: Currency;
|
|
22
|
-
}
|