@zeniai/client-epic-state 4.19.96-betaJK21 → 4.19.96-betaJK4

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.
Files changed (123) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/entity/accountRecon/accountReconState.d.ts +1 -1
  3. package/lib/entity/accountRecon/accountReconState.js +0 -1
  4. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  5. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +35 -0
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.js +44 -0
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -1
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  10. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +13 -0
  11. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  12. package/lib/entity/tenant/tenantReducer.js +1 -0
  13. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  14. package/lib/entity/tenant/tenantSelector.js +9 -1
  15. package/lib/entity/tenant/tenantState.d.ts +1 -0
  16. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  17. package/lib/entity/transaction/payloadTypes/transactionPayload.js +11 -0
  18. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
  19. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  20. package/lib/epic.d.ts +3 -1
  21. package/lib/epic.js +3 -1
  22. package/lib/esm/entity/accountRecon/accountReconState.js +0 -1
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +44 -0
  24. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  25. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  26. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  27. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +11 -0
  28. package/lib/esm/epic.js +3 -1
  29. package/lib/esm/index.js +9 -7
  30. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  31. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  32. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  33. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  34. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +15 -5
  35. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  36. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconExcludedAccountsEpic.js +27 -0
  37. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -2
  38. package/lib/esm/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -1
  39. package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +2 -29
  40. package/lib/esm/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +1 -2
  41. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  42. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  43. package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +18 -0
  44. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
  45. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +39 -1
  46. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
  47. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +1 -1
  48. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +152 -0
  49. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +17 -1
  50. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  51. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  52. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  53. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  54. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  55. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  56. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  57. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  58. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  59. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  60. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  61. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  62. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  63. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  64. package/lib/index.d.ts +14 -10
  65. package/lib/index.js +44 -32
  66. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  67. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  68. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  69. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  70. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  71. package/lib/view/aiCfoView/aiCfoViewState.d.ts +18 -1
  72. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  73. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  74. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  75. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  76. package/lib/view/classList/fetchClassListEpic.js +8 -1
  77. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  78. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +15 -5
  79. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  80. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  81. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconExcludedAccountsEpic.d.ts +7 -0
  82. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconExcludedAccountsEpic.js +31 -0
  83. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -2
  84. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -1
  85. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +2 -29
  86. package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.d.ts +1 -1
  87. package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +1 -2
  88. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  89. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  90. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +23 -1
  91. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +20 -0
  92. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  93. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
  94. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +9 -2
  95. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +40 -2
  96. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  97. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +1 -0
  98. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
  99. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +1 -1
  100. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +152 -0
  101. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
  102. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +19 -0
  103. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +20 -4
  104. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  105. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  106. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  107. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  108. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  109. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  110. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  111. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  112. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  113. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  114. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  115. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  116. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  117. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  118. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  119. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  120. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  121. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  122. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  123. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import omit from 'lodash/omit';
2
+ import orderBy from 'lodash/orderBy';
2
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
3
4
  import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
4
5
  import { getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
@@ -10,6 +11,42 @@ import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDet
10
11
  import { getAccountLabelForScheduleType, getAccountsTypesForScheduleList, } from '../../scheduleView/scheduleListView/scheduleListHelper';
11
12
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
12
13
  import { getJEAccountSettingsView } from './jeAccountSettingsViewSelector';
14
+ function getJEScheduleSortAccessor(sortKey) {
15
+ switch (sortKey) {
16
+ case 'vendor':
17
+ return (s) => s.vendor.name?.toLowerCase();
18
+ case 'category':
19
+ return (s) => s.jeDebit.account?.accountName?.toLowerCase();
20
+ case 'class':
21
+ return (s) => s.jeDebit.accountingClass?.className?.toLowerCase();
22
+ case 'scheduleCategory':
23
+ return (s) => s.jeScheduleType;
24
+ case 'startMonth':
25
+ return (s) => s.startDate?.valueOf();
26
+ case 'type':
27
+ return (s) => s.baseTransaction.typeOfTransaction;
28
+ case 'amortizationPeriod':
29
+ return (s) => s.period;
30
+ case 'jePostingDate':
31
+ return (s) => s.dayOfPostingDate;
32
+ case 'remainingMonths':
33
+ return (s) => s.period;
34
+ case 'runningBalance':
35
+ return (s) => s.balanceAsOfToday?.amount;
36
+ case 'totalAmount':
37
+ return (s) => s.baseTransaction.amount.amount;
38
+ case 'transactionDate':
39
+ return (s) => s.baseTransaction.date.valueOf();
40
+ case 'memo':
41
+ return (s) => s.baseTransaction.memo?.toLowerCase();
42
+ default:
43
+ return (s) => s.startDate?.valueOf();
44
+ }
45
+ }
46
+ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
47
+ const accessor = getJEScheduleSortAccessor(sortKey);
48
+ return orderBy(transactions, [accessor], [sortOrder === 'ascending' ? 'asc' : 'desc']);
49
+ }
13
50
  export function getExpenseAutomationJESchedulesView(state) {
14
51
  const jeScheduledTransaction = [];
15
52
  const failedJeScheduledTransaction = [];
@@ -59,13 +96,21 @@ export function getExpenseAutomationJESchedulesView(state) {
59
96
  const jeScheduleDetails = getJEScheduledTransactionByJEScheduleTransactionKey(jeScheduleKey, state);
60
97
  failedJeScheduledTransaction.push(jeScheduleDetails);
61
98
  });
62
- const draftSchedules = jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft');
63
- const resolveSchedules = [];
99
+ const { sortKey, sortOrder } = uiState;
100
+ const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
101
+ const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
102
+ const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
103
+ schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
104
+ const unsortedResolveSchedules = [];
64
105
  failedJeScheduledTransaction.forEach((schedule) => {
65
106
  schedule.scheduledJournalEntry.forEach((journalEntry) => {
66
- resolveSchedules.push({ ...schedule, scheduledJournalEntry: journalEntry });
107
+ unsortedResolveSchedules.push({
108
+ ...schedule,
109
+ scheduledJournalEntry: journalEntry,
110
+ });
67
111
  });
68
112
  });
113
+ const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
69
114
  const allSteps = monthYearPeriodId != null
70
115
  ? getAllSteps(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
71
116
  : [];
@@ -79,7 +124,9 @@ export function getExpenseAutomationJESchedulesView(state) {
79
124
  allAccountList: filteredAccounts,
80
125
  accountListNestedAccountHierarchy,
81
126
  allClassList: allClasses,
127
+ completedSchedules,
82
128
  draftSchedules,
129
+ ongoingSchedules,
83
130
  resolveSchedules: resolveSchedules,
84
131
  accountSettingsView,
85
132
  postStatusById: postStatusById,
@@ -36,7 +36,7 @@ export function getExpenseAutomationMissingReceiptsView(state) {
36
36
  transaction.lines.length > 0 &&
37
37
  transaction.lines[0]
38
38
  ?.class != null
39
- ? transaction.lines[0].class.className.toLowerCase()
39
+ ? transaction.lines[0].class?.className.toLowerCase()
40
40
  : null;
41
41
  case 'vendor':
42
42
  default:
@@ -80,6 +80,26 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
80
80
  totalVariancePercentage: undefined,
81
81
  },
82
82
  },
83
+ excludedAccountReconciliationBySectionID: {
84
+ assets: {
85
+ sectionId: 'assets',
86
+ accountIDs: [],
87
+ totalBankBalance: undefined,
88
+ totalClearedBalance: undefined,
89
+ totalReconciledBalance: undefined,
90
+ totalVariance: undefined,
91
+ totalVariancePercentage: undefined,
92
+ },
93
+ liabilities: {
94
+ sectionId: 'liabilities',
95
+ accountIDs: [],
96
+ totalBankBalance: undefined,
97
+ totalClearedBalance: undefined,
98
+ totalReconciledBalance: undefined,
99
+ totalVariance: undefined,
100
+ totalVariancePercentage: undefined,
101
+ },
102
+ },
83
103
  };
84
104
  }
85
105
  const allAccountIDs = accountReconForMonthYearPeriod.accountIDs;
@@ -239,6 +259,137 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
239
259
  totalVariancePercentage: liabilityTotals.variancePercentage,
240
260
  },
241
261
  };
262
+ const bankAccountIdSet = new Set(uniqueBankAccounts.map((a) => a.accountId));
263
+ const creditCardIdSet = new Set(uniqueCreditCards.map((a) => a.accountId));
264
+ const excludedAssetAccountIDs = [];
265
+ const excludedLiabilityAccountIDs = [];
266
+ const excludedAssetTotals = {};
267
+ const excludedLiabilityTotals = {};
268
+ reconciliationViewState.excludedAccounts
269
+ .filter((ea) => !ea.isDeleted)
270
+ .forEach((excludedAccount) => {
271
+ const accountID = excludedAccount.accountId;
272
+ const accountRecon = getAccountReconByAccountIdAndSelectedPeriod(state, accountID, selectedPeriod);
273
+ const isAsset = bankAccountIdSet.has(accountID);
274
+ const isLiability = creditCardIdSet.has(accountID);
275
+ if (!isAsset && !isLiability) {
276
+ return;
277
+ }
278
+ let balanceTotal = undefined;
279
+ let clearedTotal = undefined;
280
+ let varianceTotal = undefined;
281
+ const total = {};
282
+ if (isAsset) {
283
+ balanceTotal =
284
+ excludedAssetTotals.balanceTotal != null
285
+ ? Big(excludedAssetTotals.balanceTotal.amount)
286
+ : undefined;
287
+ clearedTotal =
288
+ excludedAssetTotals.clearedTotal != null
289
+ ? Big(excludedAssetTotals.clearedTotal.amount)
290
+ : undefined;
291
+ varianceTotal =
292
+ excludedAssetTotals.varianceTotal != null
293
+ ? Big(excludedAssetTotals.varianceTotal.amount)
294
+ : undefined;
295
+ }
296
+ else {
297
+ balanceTotal =
298
+ excludedLiabilityTotals.balanceTotal != null
299
+ ? Big(excludedLiabilityTotals.balanceTotal.amount)
300
+ : undefined;
301
+ clearedTotal =
302
+ excludedLiabilityTotals.clearedTotal != null
303
+ ? Big(excludedLiabilityTotals.clearedTotal.amount)
304
+ : undefined;
305
+ varianceTotal =
306
+ excludedLiabilityTotals.varianceTotal != null
307
+ ? Big(excludedLiabilityTotals.varianceTotal.amount)
308
+ : undefined;
309
+ }
310
+ if (accountRecon?.balance != null && balanceTotal != null) {
311
+ balanceTotal = balanceTotal.plus(accountRecon.balance.amount);
312
+ }
313
+ else if (accountRecon?.balance != null && balanceTotal == null) {
314
+ balanceTotal = Big(accountRecon.balance.amount);
315
+ }
316
+ if (accountRecon?.clearedBalance != null && clearedTotal != null) {
317
+ clearedTotal = clearedTotal.plus(accountRecon.clearedBalance.amount);
318
+ }
319
+ else if (accountRecon?.clearedBalance != null &&
320
+ clearedTotal == null) {
321
+ clearedTotal = Big(accountRecon.clearedBalance.amount);
322
+ }
323
+ const currency = accountRecon?.currency;
324
+ if (balanceTotal != null && currency != null) {
325
+ total.balanceTotal = {
326
+ ...currency,
327
+ amount: parseFloat(balanceTotal.toFixed(2)),
328
+ };
329
+ }
330
+ if (clearedTotal != null && currency != null) {
331
+ total.clearedTotal = {
332
+ ...currency,
333
+ amount: parseFloat(clearedTotal.toFixed(2)),
334
+ };
335
+ }
336
+ if (clearedTotal != null && balanceTotal != null) {
337
+ varianceTotal = clearedTotal.minus(balanceTotal).abs();
338
+ }
339
+ else if (clearedTotal != null) {
340
+ varianceTotal = clearedTotal.abs();
341
+ }
342
+ else if (balanceTotal != null) {
343
+ varianceTotal = Big(0).minus(balanceTotal).abs();
344
+ }
345
+ if (varianceTotal != null && currency != null) {
346
+ total.varianceTotal = {
347
+ ...currency,
348
+ amount: parseFloat(varianceTotal.toFixed(2)),
349
+ };
350
+ }
351
+ total.variancePercentage =
352
+ total.varianceTotal != null &&
353
+ total.balanceTotal != null &&
354
+ total.balanceTotal.amount !== 0
355
+ ? Math.abs((total.varianceTotal.amount / total.balanceTotal.amount) * 100)
356
+ : undefined;
357
+ if (isAsset) {
358
+ excludedAssetAccountIDs.push(accountID);
359
+ excludedAssetTotals.balanceTotal = total.balanceTotal;
360
+ excludedAssetTotals.clearedTotal = total.clearedTotal;
361
+ excludedAssetTotals.varianceTotal = total.varianceTotal;
362
+ excludedAssetTotals.variancePercentage = total.variancePercentage;
363
+ }
364
+ else {
365
+ excludedLiabilityAccountIDs.push(accountID);
366
+ excludedLiabilityTotals.balanceTotal = total.balanceTotal;
367
+ excludedLiabilityTotals.clearedTotal = total.clearedTotal;
368
+ excludedLiabilityTotals.varianceTotal = total.varianceTotal;
369
+ excludedLiabilityTotals.variancePercentage =
370
+ total.variancePercentage;
371
+ }
372
+ });
373
+ const excludedAccountReconciliationBySectionID = {
374
+ assets: {
375
+ sectionId: 'assets',
376
+ accountIDs: excludedAssetAccountIDs,
377
+ totalBankBalance: excludedAssetTotals.balanceTotal,
378
+ totalClearedBalance: excludedAssetTotals.clearedTotal,
379
+ totalReconciledBalance: excludedAssetTotals.varianceTotal,
380
+ totalVariance: excludedAssetTotals.varianceTotal,
381
+ totalVariancePercentage: excludedAssetTotals.variancePercentage,
382
+ },
383
+ liabilities: {
384
+ sectionId: 'liabilities',
385
+ accountIDs: excludedLiabilityAccountIDs,
386
+ totalBankBalance: excludedLiabilityTotals.balanceTotal,
387
+ totalClearedBalance: excludedLiabilityTotals.clearedTotal,
388
+ totalReconciledBalance: excludedLiabilityTotals.varianceTotal,
389
+ totalVariance: excludedLiabilityTotals.varianceTotal,
390
+ totalVariancePercentage: excludedLiabilityTotals.variancePercentage,
391
+ },
392
+ };
242
393
  const accountListNestedAccountHierarchy = getNestedAccountListHierarchy(accountListState, 'accountList');
243
394
  const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
244
395
  const accountsList = getAccountList(accountState, accountListState, 'accountList');
@@ -284,6 +435,7 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
284
435
  statementUploadChosen: reconciliationViewState.statementUploadChosen,
285
436
  monthYearPeriod: selectedPeriod,
286
437
  accountReconciliationBySectionID,
438
+ excludedAccountReconciliationBySectionID,
287
439
  selectedAccountId: reconciliationViewState.selectedAccountId,
288
440
  selectedReconAccount: reconciliationViewState.selectedAccountId != null &&
289
441
  reconList[reconciliationViewState.selectedAccountId] != null
@@ -1 +1,17 @@
1
- export {};
1
+ import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
+ const JE_SCHEDULE_SORT_KEYS = [
3
+ 'vendor',
4
+ 'category',
5
+ 'class',
6
+ 'scheduleCategory',
7
+ 'startMonth',
8
+ 'type',
9
+ 'amortizationPeriod',
10
+ 'jePostingDate',
11
+ 'remainingMonths',
12
+ 'runningBalance',
13
+ 'totalAmount',
14
+ 'transactionDate',
15
+ 'memo',
16
+ ];
17
+ export const toJEScheduleSortKey = (v) => stringToUnion(v, JE_SCHEDULE_SORT_KEYS);
@@ -416,6 +416,14 @@ export const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions)
416
416
  transactionsWithNoSortKeyValue.push(transaction);
417
417
  }
418
418
  break;
419
+ case 'invoiceNumber':
420
+ if (transaction.documentId != null) {
421
+ transactionsWithSortKeyValue.push(transaction);
422
+ }
423
+ else {
424
+ transactionsWithNoSortKeyValue.push(transaction);
425
+ }
426
+ break;
419
427
  case 'dueDate':
420
428
  if (currentTab === 'draft') {
421
429
  if (Boolean(transaction.dueDate) === true) {
@@ -518,6 +526,8 @@ export const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions)
518
526
  return transaction.totalAmountInUSD?.amount ?? 0;
519
527
  case 'paymentMethod':
520
528
  return transaction.billPayInfo.billPaymentMethodType.name;
529
+ case 'invoiceNumber':
530
+ return transaction.documentId;
521
531
  }
522
532
  }, getColumnWiseSortOrder(sortOrder));
523
533
  return [
@@ -43,6 +43,7 @@ const ALL_BILL_PAY_SORT_KEYS = [
43
43
  'invoiceDate',
44
44
  'name',
45
45
  'paymentMethod',
46
+ 'invoiceNumber',
46
47
  ];
47
48
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
48
49
  const toBillPaySortKeyType = (v) => stringToUnion(v, ALL_BILL_PAY_SORT_KEYS);
@@ -3,6 +3,7 @@ import { reduceFetchState } from '../../../../commonStateTypes/reduceFetchState'
3
3
  import { getContactsByIds } from '../../../../entity/billPay/contact/contactSelector';
4
4
  import { getPaymentAccountsByPaymentAccountIds } from '../../../../entity/paymentAccount/paymentAccountSelector';
5
5
  import { getVendorByVendorId } from '../../../../entity/vendor/vendorSelector';
6
+ import { getIsAccountingClassesEnabled } from '../../../../entity/tenant/tenantSelector';
6
7
  import { getAccountList } from '../../../accountList/accountListSelector';
7
8
  import { getAllFundingAccounts, } from '../../commonSetup/setupViewSelector';
8
9
  import { getAllDepositAccounts } from '../../zeniAccounts/depositAccountList/depositAccountListSelector';
@@ -73,11 +74,14 @@ export const getReviewPageBillDetail = (state, billId) => {
73
74
  }
74
75
  }
75
76
  if (sourceBillDetail != null) {
76
- sourceBillDetailFetchState = reduceFetchState([
77
+ const fetchStateList = [
77
78
  sourceBillDetail.fetchStatus,
78
79
  accountListState.byReportId['billPayAccountList'],
79
- classListState,
80
- ]).fetchState;
80
+ ];
81
+ if (getIsAccountingClassesEnabled(state)) {
82
+ fetchStateList.push(classListState);
83
+ }
84
+ sourceBillDetailFetchState = reduceFetchState(fetchStateList).fetchState;
81
85
  }
82
86
  }
83
87
  else {
@@ -3,6 +3,7 @@ import cloneDeep from 'lodash/cloneDeep';
3
3
  import { reduceAllFetchState, reduceAnyFetchState, } from '../../../../commonStateTypes/reduceFetchState';
4
4
  import { getApprovalRulesByIds } from '../../../../entity/approvalRule/approvalRuleSelector';
5
5
  import { getClassesByIds } from '../../../../entity/class/classSelector';
6
+ import { getIsAccountingClassesEnabled } from '../../../../entity/tenant/tenantSelector';
6
7
  import { getUserByUserId } from '../../../../entity/user/userSelector';
7
8
  import { getUserRoleByUserId } from '../../../../entity/userRole/userRoleSelector';
8
9
  export const getBillPaySetupApproverView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
@@ -44,7 +45,7 @@ export const getBillPaySetupApproverView = createSelector((state) => state.billP
44
45
  newApprovalRuleId,
45
46
  };
46
47
  });
47
- export const getBillPaySetupApproverUpdateDataView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState) => {
48
+ export const getBillPaySetupApproverUpdateDataView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (state) => getIsAccountingClassesEnabled(state), (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState, isAccountingClassesEnabled) => {
48
49
  const { affectedEntityIds, approvalRuleIds, approverListState, billPaySetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
49
50
  const { approverIds, attributes } = approverListState;
50
51
  const allApprovalRules = getApprovalRulesByIds(approvalRuleState, approvalRuleIds);
@@ -92,10 +93,9 @@ export const getBillPaySetupApproverUpdateDataView = createSelector((state) => s
92
93
  allAttributes,
93
94
  filteredAttributes,
94
95
  billPaySetupApproverViewUpdateData,
95
- approverListFetchStatus: reduceAllFetchState([
96
- approverListState.fetchStatus,
97
- classListState,
98
- ]),
96
+ approverListFetchStatus: isAccountingClassesEnabled
97
+ ? reduceAllFetchState([approverListState.fetchStatus, classListState])
98
+ : approverListState.fetchStatus,
99
99
  fetchState,
100
100
  allAccountingClasses,
101
101
  error,
@@ -1,22 +1,27 @@
1
1
  import { concat, from } from 'rxjs';
2
2
  import { filter, mergeMap } from 'rxjs/operators';
3
+ import { getIsAccountingClassesEnabled } from '../../../../../entity/tenant/tenantSelector';
3
4
  import { fetchClassList } from '../../../../classList/classListReducer';
4
5
  import { fetchBillPayApproversDetails, fetchBillPayApproversList, } from '../billPaySetupApproverViewReducer';
5
6
  export const fetchBillPayApproversDetailsEpic = (actions$, state$) => actions$.pipe(filter(fetchBillPayApproversDetails.match), mergeMap((action) => {
6
7
  const { cacheOverride, includeUserRoles } = action.payload;
7
8
  const { billPaySetupApproverViewState, classListState } = state$.value;
8
9
  const { approverListState } = billPaySetupApproverViewState;
10
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state$.value);
9
11
  const actions = [];
10
12
  if (cacheOverride === true) {
11
13
  actions.push(fetchBillPayApproversList(cacheOverride, includeUserRoles));
12
- actions.push(fetchClassList());
14
+ if (isAccountingClassesEnabled) {
15
+ actions.push(fetchClassList());
16
+ }
13
17
  }
14
18
  else {
15
19
  if (billPaySetupApproverViewState.hasValidState() === false &&
16
20
  approverListState.fetchStatus.fetchState !== 'In-Progress') {
17
21
  actions.push(fetchBillPayApproversList(true, includeUserRoles));
18
22
  }
19
- if (classListState.hasValidState() === false &&
23
+ if (isAccountingClassesEnabled &&
24
+ classListState.hasValidState() === false &&
20
25
  classListState.fetchState !== 'In-Progress') {
21
26
  actions.push(fetchClassList());
22
27
  }
@@ -24,6 +24,7 @@ import { getAccountTypeSubConfigCodeKey, getBillPaymentSubConfigCodeKey, getBill
24
24
  import { getBillPayConfigByKey, getBillPayConfigByKeys, getInternationalMethodCode, } from '../billPayConfig/billPayConfigSelector';
25
25
  import { ACCOUNT_TYPE_CODES, BILL_PAYMENT_METHOD_CODE, BILL_PAYMENT_OUTSIDE_ZENI_SUB_CODES, BILL_PAYMENT_WIRE_SUB_CODES, INTERNATIONAL_CODES, INTERNATIONAL_SUB_CODES, PAYMENT_ACH_SUB_CODES, getBillPayConfigMethodKey, toBillPaymentSubConfigCodeKeyType, } from '../billPayConfig/billPayConfigState';
26
26
  import { getDuplicateBills, } from '../billPayReview/billPayReviewSelector';
27
+ import { getIsAccountingClassesEnabled } from '../../../../entity/tenant/tenantSelector';
27
28
  import { getBillPaySetupApproverView } from '../billPaySetupApproverView/billPaySetupApproverViewSelector';
28
29
  import { getPreviousBills, } from '../previousBills/previousBillsSelector';
29
30
  export const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
@@ -172,12 +173,15 @@ export const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, i
172
173
  isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
173
174
  billStage = billPayInfo?.stage.code ?? 'draft';
174
175
  if (billViewState != null) {
175
- fetchState = reduceFetchState([
176
+ const fetchStateList = [
176
177
  sourceBillDetail.fetchStatus,
177
178
  accountListState.byReportId.billPayAccountList,
178
- classListState,
179
179
  billPaySetupApproverViewState,
180
- ]).fetchState;
180
+ ];
181
+ if (getIsAccountingClassesEnabled(state)) {
182
+ fetchStateList.push(classListState);
183
+ }
184
+ fetchState = reduceFetchState(fetchStateList).fetchState;
181
185
  deleteStatus = billViewState.deleteStatus;
182
186
  billActivities = getBillActivities(state, billId, billPayInfo?.stage.code);
183
187
  }
@@ -191,11 +195,14 @@ export const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, i
191
195
  }
192
196
  }
193
197
  else {
194
- fetchState = reduceFetchState([
198
+ const newBillFetchStateList = [
195
199
  accountListState.byReportId.billPayAccountList,
196
- classListState,
197
200
  billPaySetupApproverViewState,
198
- ]).fetchState;
201
+ ];
202
+ if (getIsAccountingClassesEnabled(state)) {
203
+ newBillFetchStateList.push(classListState);
204
+ }
205
+ fetchState = reduceFetchState(newBillFetchStateList).fetchState;
199
206
  }
200
207
  if (sourceBillDetail != null && fetchState == 'Completed') {
201
208
  const updatedRecord = sourceBillDetail.billDetailLocalData;
@@ -75,6 +75,7 @@ const ALL_CHARGE_CARD_SORT_KEYS = [
75
75
  'cardName',
76
76
  'department',
77
77
  'cardType',
78
+ 'accountType',
78
79
  'status',
79
80
  'utilisation',
80
81
  'limit',
@@ -219,6 +219,8 @@ const getCardsBySortKey = (card, sortKey) => {
219
219
  return card.cardName.toLowerCase();
220
220
  case 'cardType':
221
221
  return card.type.code;
222
+ case 'accountType':
223
+ return card.type.code.includes('credit') ? 'credit' : 'debit';
222
224
  case 'status':
223
225
  return card.status.code;
224
226
  case 'utilisation':
@@ -2,7 +2,7 @@ import recordGet from 'lodash/get';
2
2
  import { reduceFetchState } from '../../../../commonStateTypes/reduceFetchState';
3
3
  import { getBankAccountByBankAccountId } from '../../../../entity/bankAccount/bankAccountSelector';
4
4
  import { getAllCurrencies } from '../../../../entity/currency/currencySelector';
5
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
+ import { getCurrentTenant, getIsAccountingClassesEnabled, } from '../../../../entity/tenant/tenantSelector';
6
6
  import { getUserByUserId } from '../../../../entity/user/userSelector';
7
7
  import { getAccountList, getNestedAccountListHierarchy, } from '../../../accountList/accountListSelector';
8
8
  import { getBankAccount, } from '../../../bankAccountView/bankAccountViewSelector';
@@ -63,13 +63,16 @@ export const getEditRemiDetail = (state, reimbursementId) => {
63
63
  paymentTo: reimbursementInfo?.toAccount.billAccountId,
64
64
  };
65
65
  if (sourceRemiDetail != null) {
66
- fetchState = reduceFetchState([
66
+ const fetchStateList = [
67
67
  sourceRemiDetail.fetchStatus,
68
68
  accountListState.byReportId.reimbursementAccountList,
69
- classListState,
70
69
  merchantListState,
71
70
  reimbursementConfigState,
72
- ]).fetchState;
71
+ ];
72
+ if (getIsAccountingClassesEnabled(state)) {
73
+ fetchStateList.push(classListState);
74
+ }
75
+ fetchState = reduceFetchState(fetchStateList).fetchState;
73
76
  remiStage = reimbursementInfo?.stage.code ?? 'draft';
74
77
  createdBy = getUserByUserId(userState, reimbursement?.createdBy ?? '');
75
78
  createTime = reimbursement?.createTime;
@@ -45,6 +45,7 @@ export const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled
45
45
  return {
46
46
  ...reimbursement,
47
47
  submittedBy: getUserByUserId(userState, reimbursement.reimburseeUserId),
48
+ createdByUser: getUserByUserId(userState, reimbursement.createdBy),
48
49
  approvers: approvers,
49
50
  };
50
51
  });
@@ -415,6 +416,14 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
415
416
  reimbursementsWithNoSortKeyValue.push(reimbursement);
416
417
  }
417
418
  break;
419
+ case 'createdBy':
420
+ if (reimbursement.createdByUser != null) {
421
+ reimbursementsWithSortKeyValue.push(reimbursement);
422
+ }
423
+ else {
424
+ reimbursementsWithNoSortKeyValue.push(reimbursement);
425
+ }
426
+ break;
418
427
  }
419
428
  });
420
429
  const getColumnWiseSortOrder = (sortOrder) => {
@@ -422,6 +431,7 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
422
431
  case 'reportName':
423
432
  case 'type':
424
433
  case 'status':
434
+ case 'createdBy':
425
435
  return sortOrder === 'ascending' ? 'asc' : 'desc';
426
436
  default:
427
437
  return sortOrder === 'ascending' ? 'desc' : 'asc';
@@ -441,6 +451,8 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
441
451
  return getStatusPerTab(reimbursement);
442
452
  case 'amount':
443
453
  return reimbursement.amount.amount ?? 0;
454
+ case 'createdBy':
455
+ return `${reimbursement.createdByUser?.firstName ?? ''} ${reimbursement.createdByUser?.lastName ?? ''}`.toLowerCase();
444
456
  }
445
457
  }, getColumnWiseSortOrder(sortOrder));
446
458
  return [
@@ -55,6 +55,7 @@ export const toRemiSubTabUnderScoreType = (v) => stringToUnion(v, REMI_SUB_TAB_U
55
55
  const ALL_REIMBURSEMENT_SORT_KEYS = [
56
56
  'reportName',
57
57
  'submittedOn',
58
+ 'createdBy',
58
59
  'type',
59
60
  'status',
60
61
  'amount',
@@ -91,11 +91,11 @@ export const allTaskStatus = [
91
91
  },
92
92
  {
93
93
  code: 'done',
94
- name: 'Done',
94
+ name: 'In Review',
95
95
  },
96
96
  {
97
97
  code: 'resolved',
98
- name: 'Resolved',
98
+ name: 'Complete',
99
99
  },
100
100
  ];
101
101
  export const allTaskPriority = [
@@ -75,8 +75,8 @@ export const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDe
75
75
  lineItem.account?.qboId !== accountLine.account.qboId &&
76
76
  Boolean(lineItem.account?.qboId);
77
77
  hasClassChanged =
78
- Boolean(lineItem.class?.qboId) &&
79
- lineItem.class?.qboId !== accountLine.class.qboId;
78
+ (lineItem.class?.qboId != null || accountLine.class?.qboId != null) &&
79
+ lineItem.class?.qboId !== accountLine.class?.qboId;
80
80
  const recommendedAccountBase = toRecommendedAccountBase(lineItem.amount.amount, lineItem.account);
81
81
  const recommendedClassBase = toRecommendedClassBase(lineItem.amount.amount, lineItem.class);
82
82
  const latestRecommendedCategory = lineItem.recommendedAccount;