@zeniai/client-epic-state 4.20.3-betaRD21 → 4.20.3-betaRD3
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 +2 -0
- package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.d.ts +13 -0
- package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +9 -0
- package/lib/commonStateTypes/common.d.ts +1 -1
- package/lib/commonStateTypes/projectView/projectViewParentID.d.ts +5 -0
- package/lib/commonStateTypes/projectView/projectViewParentID.js +2 -0
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +1 -0
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +3 -1
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -1
- package/lib/entity/account/accountPayload.d.ts +0 -2
- package/lib/entity/account/accountReducer.d.ts +2 -5
- package/lib/entity/account/accountReducer.js +7 -10
- package/lib/entity/account/accountSelector.d.ts +7 -0
- package/lib/entity/account/accountSelector.js +4 -2
- package/lib/entity/account/accountState.d.ts +3 -1
- package/lib/entity/account/accountState.js +4 -1
- package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -0
- package/lib/entity/account/subAccountSelector.d.ts +2 -0
- package/lib/entity/account/subAccountSelector.js +2 -0
- package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -0
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- 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/project/projectPayload.d.ts +13 -0
- package/lib/entity/project/projectPayload.js +30 -0
- package/lib/entity/project/projectReducer.d.ts +10 -0
- package/lib/entity/project/projectReducer.js +31 -0
- package/lib/entity/project/projectSelector.d.ts +5 -0
- package/lib/entity/project/projectSelector.js +12 -0
- package/lib/entity/project/projectState.d.ts +13 -0
- package/lib/entity/project/projectState.js +2 -0
- 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/sectionProjectView/sectionProjectView.d.ts +10 -0
- package/lib/entity/sectionProjectView/sectionProjectView.js +6 -0
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.d.ts +6 -0
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +56 -0
- package/lib/entity/sectionProjectView/sectionProjectViewHelper.d.ts +9 -0
- package/lib/entity/sectionProjectView/sectionProjectViewHelper.js +13 -0
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +15 -0
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +50 -0
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +11 -0
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +103 -0
- package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.d.ts +16 -0
- package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +2 -0
- package/lib/entity/sectionProjectView/sectionProjectViewState.d.ts +4 -0
- package/lib/entity/sectionProjectView/sectionProjectViewState.js +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +5 -4
- package/lib/entity/tenant/clearAllEpic.js +6 -4
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +1 -0
- package/lib/entity/tenant/tenantSelector.d.ts +1 -0
- package/lib/entity/tenant/tenantSelector.js +9 -1
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -1
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/epic.d.ts +4 -3
- package/lib/epic.js +4 -3
- package/lib/esm/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +5 -0
- package/lib/esm/commonStateTypes/projectView/projectViewParentID.js +1 -0
- package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +1 -0
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -1
- package/lib/esm/entity/account/accountReducer.js +6 -9
- package/lib/esm/entity/account/accountSelector.js +4 -2
- package/lib/esm/entity/account/accountState.js +4 -1
- package/lib/esm/entity/account/subAccountSelector.js +2 -0
- package/lib/esm/entity/project/projectPayload.js +26 -0
- package/lib/esm/entity/project/projectReducer.js +27 -0
- package/lib/esm/entity/project/projectSelector.js +8 -0
- package/lib/esm/entity/project/projectState.js +1 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectView.js +3 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +52 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewHelper.js +9 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +46 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +96 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +1 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewState.js +1 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +6 -4
- package/lib/esm/entity/tenant/tenantReducer.js +1 -0
- package/lib/esm/entity/tenant/tenantSelector.js +7 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -1
- package/lib/esm/epic.js +4 -3
- package/lib/esm/index.js +11 -15
- package/lib/esm/reducer.js +9 -6
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +9 -4
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -5
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +3 -163
- package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -1
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -112
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -10
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -6
- package/lib/esm/view/financeStatement/financeStatementSelector.js +12 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +2 -4
- package/lib/esm/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +45 -0
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +30 -0
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +1 -0
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +113 -0
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +66 -0
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +1 -0
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewState.js +1 -0
- package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
- package/lib/index.d.ts +14 -16
- package/lib/index.js +45 -65
- package/lib/reducer.d.ts +9 -6
- package/lib/reducer.js +9 -6
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- 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 +2 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -1
- 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 +5 -6
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +9 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -33
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -5
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +4 -18
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +4 -164
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +2 -6
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -112
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -9
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -3
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -8
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -13
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
- package/lib/view/financeStatement/financeStatementSelector.js +12 -1
- 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 +2 -4
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +8 -0
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +49 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.d.ts +6 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +34 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +33 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +2 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +33 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +117 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.d.ts +9 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +70 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +18 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +2 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.d.ts +22 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.js +2 -0
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +2 -1
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
- 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/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +0 -44
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -55
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +0 -10
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -51
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +0 -48
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -66
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +0 -52
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -37
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -49
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -47
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -62
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -31
- package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +0 -2
- package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +0 -149
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +0 -72
- package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +0 -11
- package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -46
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -27
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -47
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -52
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +0 -44
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +0 -44
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +0 -31
- package/lib/view/aiAccountantView/aiAccountantViewPayload.js +0 -8
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +0 -29
- package/lib/view/aiAccountantView/aiAccountantViewReducer.js +0 -153
- package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +0 -14
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +0 -78
- package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +0 -27
- package/lib/view/aiAccountantView/aiAccountantViewState.js +0 -13
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +0 -33
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -50
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +0 -23
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -31
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +0 -33
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -51
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +0 -28
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -56
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +0 -48
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +0 -48
|
@@ -9,7 +9,6 @@ import { getAccountsByType } from '../../../entity/account/accountSelector';
|
|
|
9
9
|
import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../entity/accountRecon/accountReconSelector';
|
|
10
10
|
import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
|
|
11
11
|
import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
|
|
12
|
-
import { date } from '../../../zeniDayJS';
|
|
13
12
|
import { getAccountList, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
|
|
14
13
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
15
14
|
import { initialActionFetchState, initialReconciliationTabsState, initialState, } from '../reducers/reconciliationViewReducer';
|
|
@@ -91,30 +90,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
91
90
|
totalVariancePercentage: undefined,
|
|
92
91
|
},
|
|
93
92
|
},
|
|
94
|
-
excludedAccountReconciliationByAccountID: {},
|
|
95
|
-
excludedAccountReconciliationBySectionID: {
|
|
96
|
-
assets: {
|
|
97
|
-
sectionId: 'assets',
|
|
98
|
-
accountIDs: [],
|
|
99
|
-
totalBankBalance: undefined,
|
|
100
|
-
totalClearedBalance: undefined,
|
|
101
|
-
totalReconciledBalance: undefined,
|
|
102
|
-
totalVariance: undefined,
|
|
103
|
-
totalVariancePercentage: undefined,
|
|
104
|
-
},
|
|
105
|
-
liabilities: {
|
|
106
|
-
sectionId: 'liabilities',
|
|
107
|
-
accountIDs: [],
|
|
108
|
-
totalBankBalance: undefined,
|
|
109
|
-
totalClearedBalance: undefined,
|
|
110
|
-
totalReconciledBalance: undefined,
|
|
111
|
-
totalVariance: undefined,
|
|
112
|
-
totalVariancePercentage: undefined,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
excludeAccountFetchState: reconciliationViewState.actionFetchState.excludeAccountFetch,
|
|
116
|
-
includeAccountFetchState: reconciliationViewState.actionFetchState.includeAccountFetch,
|
|
117
|
-
excludedAccountIDs: reconciliationViewState.excludedAccountIDs,
|
|
118
93
|
};
|
|
119
94
|
}
|
|
120
95
|
const allAccountIDs = accountReconForMonthYearPeriod.accountIDs;
|
|
@@ -274,88 +249,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
274
249
|
totalVariancePercentage: liabilityTotals.variancePercentage,
|
|
275
250
|
},
|
|
276
251
|
};
|
|
277
|
-
const bankAccountIdSet = new Set(uniqueBankAccounts.map((a) => a.accountId));
|
|
278
|
-
const creditCardIdSet = new Set(uniqueCreditCards.map((a) => a.accountId));
|
|
279
|
-
const excludedAssetAccountIDs = [];
|
|
280
|
-
const excludedLiabilityAccountIDs = [];
|
|
281
|
-
reconciliationViewState.excludedAccountIDs.forEach((accountID) => {
|
|
282
|
-
const isAsset = bankAccountIdSet.has(accountID);
|
|
283
|
-
const isLiability = creditCardIdSet.has(accountID);
|
|
284
|
-
if (!isAsset && !isLiability) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (isAsset) {
|
|
288
|
-
excludedAssetAccountIDs.push(accountID);
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
excludedLiabilityAccountIDs.push(accountID);
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
const excludedAccountReconciliationBySectionID = {
|
|
295
|
-
assets: {
|
|
296
|
-
sectionId: 'assets',
|
|
297
|
-
accountIDs: excludedAssetAccountIDs,
|
|
298
|
-
},
|
|
299
|
-
liabilities: {
|
|
300
|
-
sectionId: 'liabilities',
|
|
301
|
-
accountIDs: excludedLiabilityAccountIDs,
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
const excludedAccountReconciliationByAccountID = {};
|
|
305
|
-
const accountsInState = Object.values(accountState.accountsByKey);
|
|
306
|
-
const accountsInStateMap = new Map(accountsInState.map((a) => [a.accountId, a]));
|
|
307
|
-
reconciliationViewState.excludedAccountIDs.forEach((excludedAccountID) => {
|
|
308
|
-
const account = accountsInStateMap.get(excludedAccountID);
|
|
309
|
-
const exclusionInfo = reconciliationViewState.excludedAccountExclusionInfo[excludedAccountID];
|
|
310
|
-
if (account != null) {
|
|
311
|
-
excludedAccountReconciliationByAccountID[excludedAccountID] = {
|
|
312
|
-
refreshStatus: { fetchState: 'Not-Started' },
|
|
313
|
-
statementUpdateStatus: { fetchState: 'Not-Started' },
|
|
314
|
-
statementUploadStatus: { fetchState: 'Not-Started' },
|
|
315
|
-
statementDeleteStatus: { fetchState: 'Not-Started' },
|
|
316
|
-
localData: {},
|
|
317
|
-
connectionInProgress: false,
|
|
318
|
-
statementParseInProgress: false,
|
|
319
|
-
accountConnectionStatus: 'not_connected',
|
|
320
|
-
transactionFetchState: { fetchState: 'Not-Started' },
|
|
321
|
-
accountReconEntity: {
|
|
322
|
-
account: {
|
|
323
|
-
accountId: account.accountId,
|
|
324
|
-
accountName: account.accountName,
|
|
325
|
-
accountType: account.accountType,
|
|
326
|
-
accountSubType: account.accountSubType,
|
|
327
|
-
accountDescription: account.accountDescription,
|
|
328
|
-
qboId: account.qboId,
|
|
329
|
-
coaId: account.coaId,
|
|
330
|
-
labels: account.labels,
|
|
331
|
-
},
|
|
332
|
-
currency: {
|
|
333
|
-
currencyCode: exclusionInfo?.bankBalance?.currencyCode ??
|
|
334
|
-
exclusionInfo?.clearedBalance?.currencyCode ??
|
|
335
|
-
'USD',
|
|
336
|
-
currencySymbol: exclusionInfo?.bankBalance?.currencySymbol ??
|
|
337
|
-
exclusionInfo?.clearedBalance?.currencySymbol ??
|
|
338
|
-
'$',
|
|
339
|
-
},
|
|
340
|
-
startDate: date(new Date().toDateString()),
|
|
341
|
-
endDate: date(new Date().toDateString()),
|
|
342
|
-
statementStatus: { code: 'not_found', label: 'Not Found' },
|
|
343
|
-
transactionsToReconcile: [],
|
|
344
|
-
transactionsToReview: [],
|
|
345
|
-
balance: exclusionInfo?.bankBalance,
|
|
346
|
-
clearedBalance: exclusionInfo?.clearedBalance,
|
|
347
|
-
variance: exclusionInfo?.variance,
|
|
348
|
-
variancePercentage: exclusionInfo?.variance != null &&
|
|
349
|
-
exclusionInfo?.bankBalance != null &&
|
|
350
|
-
exclusionInfo?.bankBalance.amount !== 0
|
|
351
|
-
? Math.abs((exclusionInfo.variance.amount /
|
|
352
|
-
exclusionInfo.bankBalance.amount) *
|
|
353
|
-
100)
|
|
354
|
-
: undefined,
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
252
|
const accountListNestedAccountHierarchy = getNestedAccountListHierarchy(accountListState, 'accountList');
|
|
360
253
|
const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
|
|
361
254
|
const accountsList = getAccountList(accountState, accountListState, 'accountList');
|
|
@@ -416,11 +309,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
416
309
|
allClassList: allClasses,
|
|
417
310
|
reviewTabSelectedVendorByTransactionId,
|
|
418
311
|
reconListUIState: reconciliationViewState.reconListUIState,
|
|
419
|
-
excludedAccountReconciliationBySectionID,
|
|
420
|
-
excludedAccountReconciliationByAccountID,
|
|
421
|
-
excludeAccountFetchState: reconciliationViewState.actionFetchState.excludeAccountFetch,
|
|
422
|
-
includeAccountFetchState: reconciliationViewState.actionFetchState.includeAccountFetch,
|
|
423
|
-
excludedAccountIDs: reconciliationViewState.excludedAccountIDs,
|
|
424
312
|
};
|
|
425
313
|
});
|
|
426
314
|
export const isAccountReconReport = (reportId) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
|
|
3
3
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
-
import {
|
|
4
|
+
import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
|
|
6
6
|
import { getSupportedTransactionsByIds } from '../../../entity/transaction/transactionSelector';
|
|
7
7
|
import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
|
|
@@ -44,16 +44,12 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
44
44
|
const monthEndFetchState = monthYearPeriodId != null
|
|
45
45
|
? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
|
|
46
46
|
: { fetchState: 'Not-Started', error: undefined };
|
|
47
|
-
const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
|
|
48
|
-
const allFetchStateList = [
|
|
49
|
-
accountList,
|
|
50
|
-
expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
|
|
51
|
-
];
|
|
52
|
-
if (isAccountingClassesEnabled) {
|
|
53
|
-
allFetchStateList.push(classList);
|
|
54
|
-
}
|
|
55
47
|
const fetchStatus = reduceAnyFetchState([
|
|
56
|
-
reduceAllFetchState(
|
|
48
|
+
reduceAllFetchState([
|
|
49
|
+
accountList,
|
|
50
|
+
classList,
|
|
51
|
+
expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
|
|
52
|
+
]),
|
|
57
53
|
monthEndFetchState,
|
|
58
54
|
]);
|
|
59
55
|
const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
|
|
@@ -16,9 +16,3 @@ const JE_SCHEDULE_SORT_KEYS = [
|
|
|
16
16
|
'memo',
|
|
17
17
|
];
|
|
18
18
|
export const toJEScheduleSortKey = (v) => stringToUnion(v, JE_SCHEDULE_SORT_KEYS);
|
|
19
|
-
const JE_SCHEDULE_MAIN_TABS = [
|
|
20
|
-
'pending_review',
|
|
21
|
-
'ongoing',
|
|
22
|
-
'completed',
|
|
23
|
-
];
|
|
24
|
-
export const toJEScheduleMainTab = (v) => stringToUnion(v, JE_SCHEDULE_MAIN_TABS);
|
|
@@ -9,8 +9,10 @@ import { extractThisPeriod } from '../../commonStateTypes/viewAndReport/thisPeri
|
|
|
9
9
|
import { getBalanceSheet } from '../balanceSheet/balanceSheetSelector';
|
|
10
10
|
import { getCashFlow } from '../cashFlow/cashFlowSelector';
|
|
11
11
|
import { getProfitAndLossReport, } from '../profitAndLoss/profitAndLossSelector';
|
|
12
|
+
import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
12
13
|
import { getProfitAndLossClassesHorizontalView } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
13
14
|
import { getProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
15
|
+
import { getProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewSelector';
|
|
14
16
|
function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
|
|
15
17
|
const datesSorted = [
|
|
16
18
|
profitAndLossState.dataAvailable?.startDate,
|
|
@@ -35,7 +37,7 @@ function getFirstMonthOfFY(profitAndLossState, balanceSheetState, cashFlowState)
|
|
|
35
37
|
cashFlowState.firstMonthOfFY ??
|
|
36
38
|
1);
|
|
37
39
|
}
|
|
38
|
-
export const getFinanceStatement = createSelector((state) => state.accountState, (state) => state.accountGroupState, (state) => state.classState, (state) => state.sectionClassesViewStateV2, (state) => state.profitAndLossState, (state) => state.profitAndLossClassesViewState, (state) => state.balanceSheetState, (state) => state.cashFlowState, (state) => state.financeStatementState, (state) => state.sectionAccountsViewState, (state) => state.forecastState, (accountState, accountGroupState, classState, sectionsState, profitAndLossState, profitAndLossClassesViewState, balanceSheetState, cashFlowState, financeStatementState, sectionAccountsViewState, forecastState) => {
|
|
40
|
+
export const getFinanceStatement = createSelector((state) => state.accountState, (state) => state.accountGroupState, (state) => state.classState, (state) => state.sectionClassesViewStateV2, (state) => state.profitAndLossState, (state) => state.profitAndLossClassesViewState, (state) => state.projectState, (state) => state.sectionProjectViewState, (state) => state.profitAndLossProjectViewState, (state) => state.balanceSheetState, (state) => state.cashFlowState, (state) => state.financeStatementState, (state) => state.sectionAccountsViewState, (state) => state.forecastState, (accountState, accountGroupState, classState, sectionsState, profitAndLossState, profitAndLossClassesViewState, projectState, sectionProjectViewState, profitAndLossProjectViewState, balanceSheetState, cashFlowState, financeStatementState, sectionAccountsViewState, forecastState) => {
|
|
39
41
|
// to get min and max dates across three reports
|
|
40
42
|
let allTimeframeTicks = [];
|
|
41
43
|
let balancesInTimeframe = [];
|
|
@@ -69,6 +71,8 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
69
71
|
const profitAndLossReport = getProfitAndLossReport(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
|
|
70
72
|
const classFilter = newBalancesFilterClassesView(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
|
|
71
73
|
const profitAndLossByClassReport = getProfitAndLossClassesView(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
|
|
74
|
+
const projectFilter = newBalancesFilterProjectView(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossProjectViewState.uiState.projectsToFilterOut);
|
|
75
|
+
const profitAndLossByProjectReport = getProfitAndLossProjectView(projectFilter, accountState, projectState, sectionProjectViewState, profitAndLossProjectViewState);
|
|
72
76
|
const profitAndLossByClassHorizontalReport = getProfitAndLossClassesHorizontalView(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState, profitAndLossClassesViewState.uiState.classViewLayout === 'horizontal'
|
|
73
77
|
? thisPeriod
|
|
74
78
|
: undefined);
|
|
@@ -89,6 +93,12 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
89
93
|
error: profitAndLossReport.error,
|
|
90
94
|
};
|
|
91
95
|
break;
|
|
96
|
+
case 'profit_and_loss_by_projects':
|
|
97
|
+
selectedReportAndTimeframeFetchState = {
|
|
98
|
+
fetchState: profitAndLossByProjectReport.fetchState,
|
|
99
|
+
error: profitAndLossByProjectReport.error,
|
|
100
|
+
};
|
|
101
|
+
break;
|
|
92
102
|
case 'balance_sheet':
|
|
93
103
|
selectedReportAndTimeframeFetchState = {
|
|
94
104
|
fetchState: balanceSheetReport.fetchState,
|
|
@@ -119,6 +129,7 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
119
129
|
dataAvailable,
|
|
120
130
|
profitAndLossReport,
|
|
121
131
|
profitAndLossByClassReport,
|
|
132
|
+
profitAndLossByProjectReport,
|
|
122
133
|
profitAndLossByClassHorizontalReport,
|
|
123
134
|
balanceSheetReport,
|
|
124
135
|
cashFlowReport,
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js
CHANGED
|
@@ -122,12 +122,10 @@ function buildClassColumns(classHierarchy, classesToFilterOut) {
|
|
|
122
122
|
qboId: c.qboId,
|
|
123
123
|
}))
|
|
124
124
|
.sort((a, b) => {
|
|
125
|
-
|
|
126
|
-
const bIsNotSpecified = b.classId === NOT_SPECIFIED_CLASS_ID;
|
|
127
|
-
if (aIsNotSpecified && !bIsNotSpecified) {
|
|
125
|
+
if (a.classId === NOT_SPECIFIED_CLASS_ID) {
|
|
128
126
|
return 1;
|
|
129
127
|
}
|
|
130
|
-
if (
|
|
128
|
+
if (b.classId === NOT_SPECIFIED_CLASS_ID) {
|
|
131
129
|
return -1;
|
|
132
130
|
}
|
|
133
131
|
return a.className.localeCompare(b.className, [], {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { from, of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { updateSectionProjectView } from '../../entity/sectionProjectView/sectionProjectViewReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
5
|
+
import { fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure, } from './profitAndLossProjectViewReducer';
|
|
6
|
+
export const fetchProfitAndLossForTimeframeProjectViewEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchProfitAndLossForTimeframeProjectView.match), mergeMap((action) => {
|
|
7
|
+
const getTimeSeriesGroup = (timeframe) => {
|
|
8
|
+
switch (timeframe) {
|
|
9
|
+
case 'month':
|
|
10
|
+
return 'months';
|
|
11
|
+
case 'quarter':
|
|
12
|
+
return 'quarters';
|
|
13
|
+
case 'year':
|
|
14
|
+
return 'years';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const queryValue = {
|
|
18
|
+
is_full_response: action.payload.fetchFullReport,
|
|
19
|
+
time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
|
|
20
|
+
is_group_by_project: true,
|
|
21
|
+
};
|
|
22
|
+
return zeniAPI
|
|
23
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/profit_and_loss?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
24
|
+
.pipe(mergeMap((response) => {
|
|
25
|
+
if (response.data != null && isSuccessResponse(response)) {
|
|
26
|
+
const actions = [];
|
|
27
|
+
const report = response.data.report;
|
|
28
|
+
const currency = report.currency;
|
|
29
|
+
actions.push(updateSectionProjectView(action.payload.timeframe, 'cogs', 'profit_and_loss_by_projects', report.cogs, report.accounts, currency));
|
|
30
|
+
actions.push(updateSectionProjectView(action.payload.timeframe, 'expenses', 'profit_and_loss_by_projects', report.expenses, report.accounts, currency));
|
|
31
|
+
actions.push(updateSectionProjectView(action.payload.timeframe, 'income', 'profit_and_loss_by_projects', report.income, report.accounts, currency));
|
|
32
|
+
actions.push(updateSectionProjectView(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_projects', report.other_expenses, report.accounts, currency));
|
|
33
|
+
actions.push(updateSectionProjectView(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_projects', report.other_income, report.accounts, currency));
|
|
34
|
+
actions.push(updateProfitAndLossForTimeframeProjectView({
|
|
35
|
+
timeframe: action.payload.timeframe,
|
|
36
|
+
report: response.data,
|
|
37
|
+
}));
|
|
38
|
+
return from(actions);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return of(updateProfitAndLossForTimeframeProjectViewFailure(response.status, action.payload.timeframe));
|
|
42
|
+
}
|
|
43
|
+
}), catchError((error) => of(updateProfitAndLossForTimeframeProjectViewFailure(createZeniAPIStatus('Unexpected Error', 'P&L by Projects REST API call errored out' +
|
|
44
|
+
JSON.stringify(error)), action.payload.timeframe))));
|
|
45
|
+
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { filter, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, } from './profitAndLossProjectViewReducer';
|
|
4
|
+
export const fetchProfitAndLossProjectViewEpic = (actions$, state) => actions$.pipe(filter(fetchProfitAndLossProjectView.match), switchMap((action) => {
|
|
5
|
+
const { cacheOverride } = action.payload;
|
|
6
|
+
if (cacheOverride === true) {
|
|
7
|
+
return from([
|
|
8
|
+
fetchProfitAndLossForTimeframeProjectView('month'),
|
|
9
|
+
fetchProfitAndLossForTimeframeProjectView('quarter'),
|
|
10
|
+
fetchProfitAndLossForTimeframeProjectView('year'),
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const fetchActions = [];
|
|
15
|
+
const projectFetchState = state.value.profitAndLossProjectViewState.fetchState;
|
|
16
|
+
if (projectFetchState['month'].fetchState !== 'In-Progress' &&
|
|
17
|
+
projectFetchState['month'].fetchState !== 'Completed') {
|
|
18
|
+
fetchActions.push(fetchProfitAndLossForTimeframeProjectView('month'));
|
|
19
|
+
}
|
|
20
|
+
if (projectFetchState['quarter'].fetchState !== 'In-Progress' &&
|
|
21
|
+
projectFetchState['quarter'].fetchState !== 'Completed') {
|
|
22
|
+
fetchActions.push(fetchProfitAndLossForTimeframeProjectView('quarter'));
|
|
23
|
+
}
|
|
24
|
+
if (projectFetchState['year'].fetchState !== 'In-Progress' &&
|
|
25
|
+
projectFetchState['year'].fetchState !== 'Completed') {
|
|
26
|
+
fetchActions.push(fetchProfitAndLossForTimeframeProjectView('year'));
|
|
27
|
+
}
|
|
28
|
+
return from(fetchActions);
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { mapReportPayloadV2ToReportV2 } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
3
|
+
export const initialState = {
|
|
4
|
+
bookCloseDate: undefined,
|
|
5
|
+
fetchState: {
|
|
6
|
+
month: {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
},
|
|
10
|
+
quarter: {
|
|
11
|
+
fetchState: 'Not-Started',
|
|
12
|
+
error: undefined,
|
|
13
|
+
},
|
|
14
|
+
year: {
|
|
15
|
+
fetchState: 'Not-Started',
|
|
16
|
+
error: undefined,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
firstMonthOfFY: 1,
|
|
20
|
+
projectIds: [],
|
|
21
|
+
reportId: 'profit_and_loss_by_projects',
|
|
22
|
+
reportTitle: 'profit_and_loss_by_projects',
|
|
23
|
+
uiState: {
|
|
24
|
+
accountViewMode: 'project',
|
|
25
|
+
nodeCollapseState: {},
|
|
26
|
+
projectsToFilterOut: [],
|
|
27
|
+
scrollPosition: undefined,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const profitAndLossProjectView = createSlice({
|
|
31
|
+
name: 'profitAndLossProjectView',
|
|
32
|
+
initialState,
|
|
33
|
+
reducers: {
|
|
34
|
+
fetchProfitAndLossProjectView: {
|
|
35
|
+
prepare(cacheOverride = false) {
|
|
36
|
+
return { payload: { cacheOverride } };
|
|
37
|
+
},
|
|
38
|
+
reducer(
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
+
_draft,
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
+
_action) {
|
|
43
|
+
// nothing to do here
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
fetchProfitAndLossForTimeframeProjectView: {
|
|
47
|
+
prepare(timeframe, fetchFullReport = true, cacheOverride = false) {
|
|
48
|
+
return { payload: { timeframe, fetchFullReport, cacheOverride } };
|
|
49
|
+
},
|
|
50
|
+
reducer(draft, action) {
|
|
51
|
+
const timeframe = action.payload.timeframe;
|
|
52
|
+
draft.fetchState[timeframe].fetchState = 'In-Progress';
|
|
53
|
+
draft.fetchState[timeframe].error = undefined;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
updateProfitAndLossForTimeframeProjectView(draft, action) {
|
|
57
|
+
doUpdateProfitAndLossProjectView(draft, action.payload.timeframe, action.payload.report);
|
|
58
|
+
},
|
|
59
|
+
updateProfitAndLossForTimeframeProjectViewFailure: {
|
|
60
|
+
prepare(error, timeframe) {
|
|
61
|
+
return {
|
|
62
|
+
payload: {
|
|
63
|
+
error,
|
|
64
|
+
timeframe,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
reducer(draft, action) {
|
|
69
|
+
draft.fetchState[action.payload.timeframe] = {
|
|
70
|
+
fetchState: 'Error',
|
|
71
|
+
error: action.payload.error,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
updateProjectsToFilterOut(draft, action) {
|
|
76
|
+
draft.uiState.projectsToFilterOut = action.payload.projectsToFilterOut;
|
|
77
|
+
},
|
|
78
|
+
updateProfitAndLossProjectViewUIState(draft, action) {
|
|
79
|
+
const { nodeCollapseState, scrollPosition } = action.payload;
|
|
80
|
+
if (nodeCollapseState != null) {
|
|
81
|
+
draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
|
|
82
|
+
[nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (scrollPosition != null) {
|
|
86
|
+
draft.uiState.scrollPosition = scrollPosition;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
updateProjectViewAccountViewMode(draft, action) {
|
|
90
|
+
draft.uiState.accountViewMode = action.payload.viewMode;
|
|
91
|
+
},
|
|
92
|
+
resetProfitAndLossProjectNodeCollapseState(draft) {
|
|
93
|
+
draft.uiState.nodeCollapseState = {};
|
|
94
|
+
},
|
|
95
|
+
clearProfitAndLossProjectView(draft) {
|
|
96
|
+
Object.assign(draft, initialState);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
export const { fetchProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState, updateProjectViewAccountViewMode, resetProfitAndLossProjectNodeCollapseState, clearProfitAndLossProjectView, } = profitAndLossProjectView.actions;
|
|
101
|
+
export default profitAndLossProjectView.reducer;
|
|
102
|
+
const doUpdateProfitAndLossProjectView = (draft, timeframe, pandLReport) => {
|
|
103
|
+
const report = mapReportPayloadV2ToReportV2(pandLReport.report);
|
|
104
|
+
draft.currency = report.currency;
|
|
105
|
+
draft.dataAvailable = report.dataAvailable;
|
|
106
|
+
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
107
|
+
draft.bookCloseDate = report.bookCloseDate;
|
|
108
|
+
draft.status = report.status;
|
|
109
|
+
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
110
|
+
if (draft.projectIds.length <= 0) {
|
|
111
|
+
draft.projectIds = pandLReport.report.projects.map((project) => project.zeni_project_id);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { filter, switchMap } from 'rxjs/operators';
|
|
|
3
3
|
import { fetchNetBurnOrIncomeClassesView } from '../netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer';
|
|
4
4
|
import { fetchOpExClassesView } from '../opExClassesView/opExClassesViewReducer';
|
|
5
5
|
import { fetchProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewReducer';
|
|
6
|
+
import { fetchProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewReducer';
|
|
6
7
|
import { fetchRevenueClassesView } from '../revenueClassesView/revenueClassesViewReducer';
|
|
7
8
|
import { initiateReportsClassViewRefetching } from './reportsResyncReducer';
|
|
8
9
|
export const initiateReportsClassViewRefetchingEpic = (actions$,
|
|
@@ -23,6 +24,9 @@ _) => actions$.pipe(filter(initiateReportsClassViewRefetching.match), switchMap(
|
|
|
23
24
|
case 'net_burn_or_income_by_classes':
|
|
24
25
|
actions.push(fetchNetBurnOrIncomeClassesView(true));
|
|
25
26
|
break;
|
|
27
|
+
case 'profit_and_loss_by_projects':
|
|
28
|
+
actions.push(fetchProfitAndLossProjectView(true));
|
|
29
|
+
break;
|
|
26
30
|
default:
|
|
27
31
|
break;
|
|
28
32
|
}
|