@zeniai/client-epic-state 4.19.90 → 4.19.91-beta1ND

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 (54) hide show
  1. package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
  2. package/lib/commonStateTypes/reduceFetchState.js +26 -0
  3. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -1
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.js +10 -5
  6. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -2
  8. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -2
  9. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +7 -3
  10. package/lib/entity/jeSchedules/jeSchedulesTypes.js +3 -1
  11. package/lib/entity/reimbursement/reimbursementPayload.d.ts +1 -1
  12. package/lib/entity/reimbursement/reimbursementPayload.js +1 -1
  13. package/lib/entity/transaction/transactionReducer.js +3 -2
  14. package/lib/entity/transaction/transactionSelector.d.ts +2 -2
  15. package/lib/entity/transaction/transactionState.d.ts +3 -2
  16. package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
  17. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +10 -5
  18. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +3 -3
  19. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +1 -0
  20. package/lib/esm/entity/reimbursement/reimbursementPayload.js +1 -1
  21. package/lib/esm/entity/transaction/transactionReducer.js +3 -2
  22. package/lib/esm/index.js +7 -6
  23. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +4 -12
  24. package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
  25. package/lib/esm/view/financeStatement/financeStatementSelector.js +10 -5
  26. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +276 -0
  27. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +1 -0
  28. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  29. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  30. package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  31. package/lib/esm/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
  32. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +2 -7
  33. package/lib/index.d.ts +9 -7
  34. package/lib/index.js +30 -25
  35. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  36. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +11 -11
  37. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +3 -11
  38. package/lib/view/financeStatement/financeStatementReducer.js +11 -8
  39. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  40. package/lib/view/financeStatement/financeStatementSelector.js +10 -5
  41. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
  42. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +280 -0
  43. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +57 -0
  44. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +2 -0
  45. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
  46. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
  47. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  48. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
  49. package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  50. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
  51. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
  52. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +1 -6
  53. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  54. package/package.json +2 -2
@@ -22,23 +22,23 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
22
22
  jeSchedules: JEScheduledTransactionPayload[];
23
23
  refreshViewInBackground: boolean;
24
24
  selectedPeriod: MonthYearPeriod;
25
- }, "expenseAutomationJESchedulesView/fetchJeSchedulesSuccess">, fetchRecommendationForAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchRecommendationForAccountSettings">, ignoreRecommendedJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue"], {
26
- jeScheduleTransactionKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
25
+ }, "expenseAutomationJESchedulesView/fetchJeSchedulesSuccess">, fetchRecommendationForAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchRecommendationForAccountSettings">, ignoreRecommendedJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`, scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue"], {
26
+ jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
27
27
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
28
28
  }, "expenseAutomationJESchedulesView/ignoreRecommendedJeSchedule", never, never>, ignoreRecommendedJeScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
29
29
  jeScheduleTransactionKey: JEScheduleTransactionKey;
30
30
  status: ZeniAPIStatus;
31
- }, "expenseAutomationJESchedulesView/ignoreRecommendedJeScheduleFailure">, ignoreRecommendedJeScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`], {
32
- jeScheduleTransactionKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
31
+ }, "expenseAutomationJESchedulesView/ignoreRecommendedJeScheduleFailure">, ignoreRecommendedJeScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`], {
32
+ jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
33
33
  }, "expenseAutomationJESchedulesView/ignoreRecommendedJeScheduleSuccess", never, never>, initializeAccountSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/initializeAccountSettingsView">, initializeJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedules: JEScheduledTransactionPayload[]], {
34
- jeScheduleTransactionKeys: (`${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[];
35
- }, "expenseAutomationJESchedulesView/initializeJeScheduleLocalData", never, never>, removeFailedJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedJeScheduleKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, selectedPeriod: MonthYearPeriod], {
36
- failedJeScheduleKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
34
+ jeScheduleTransactionKeys: (`${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[];
35
+ }, "expenseAutomationJESchedulesView/initializeJeScheduleLocalData", never, never>, removeFailedJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedJeScheduleKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`, selectedPeriod: MonthYearPeriod], {
36
+ failedJeScheduleKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
37
37
  selectedPeriod: MonthYearPeriod;
38
38
  }, "expenseAutomationJESchedulesView/removeFailedJeScheduleTransactionKey", never, never>, removeJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
39
39
  scheduledJournalEntryID: ID;
40
- }, "expenseAutomationJESchedulesView/removeJeScheduleLocalDataById">, removeJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, selectedPeriod: MonthYearPeriod], {
41
- jeScheduleKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
40
+ }, "expenseAutomationJESchedulesView/removeJeScheduleLocalDataById">, removeJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`, selectedPeriod: MonthYearPeriod], {
41
+ jeScheduleKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
42
42
  selectedPeriod: MonthYearPeriod;
43
43
  }, "expenseAutomationJESchedulesView/removeJeScheduleTransactionKey", never, never>, retryJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
44
44
  jeScheduleTransactionKey: JEScheduleTransactionKey;
@@ -59,8 +59,8 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
59
59
  }, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypesFailure">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
60
60
  localData: Partial<JEScheduleLocalData>;
61
61
  scheduledJournalEntryID: ID;
62
- }, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[], selectedPeriod: MonthYearPeriod], {
63
- jeScheduleKeys: (`${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[];
62
+ }, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[], selectedPeriod: MonthYearPeriod], {
63
+ jeScheduleKeys: (`${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[];
64
64
  selectedPeriod: MonthYearPeriod;
65
65
  }, "expenseAutomationJESchedulesView/updateJeScheduleTransactionKeys", never, never>, updateRecommendationForAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<AccountTypeRecommendationPayload, "expenseAutomationJESchedulesView/updateRecommendationForAccountSettings">, updateRecommendationForAccountSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
66
66
  status: ZeniAPIStatus;
@@ -7,9 +7,7 @@ const getNestedAccountIDHierarchyForReport_1 = require("../../../commonStateType
7
7
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
8
8
  const accountPayload_1 = require("../../../entity/account/accountPayload");
9
9
  const jeSchedulesPayload_1 = require("../../../entity/jeSchedules/jeSchedulesPayload");
10
- const transactionIDPayload_1 = require("../../../entity/transaction/payloadTypes/transactionIDPayload");
11
10
  const accountTypeRecommendationPayload_1 = require("../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload");
12
- const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
13
11
  exports.accountSettingsInitialState = {
14
12
  localData: {
15
13
  selectedPrepaidExpensesAccountIds: [],
@@ -103,14 +101,8 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
103
101
  },
104
102
  fetchJeSchedulesSuccess(draft, action) {
105
103
  const { jeSchedules, selectedPeriod, failedJeSchedules, refreshViewInBackground, } = action.payload;
106
- const jeScheduleTransactionKeys = jeSchedules.map((schedules) => {
107
- const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
108
- return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
109
- });
110
- const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => {
111
- const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
112
- return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
113
- });
104
+ const jeScheduleTransactionKeys = jeSchedules.map((schedules) => (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(schedules.base_transaction));
105
+ const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(schedules.base_transaction));
114
106
  if (refreshViewInBackground === true &&
115
107
  draft.refreshStatus.fetchState === 'In-Progress') {
116
108
  draft.refreshStatus = { fetchState: 'Completed', error: undefined };
@@ -276,7 +268,7 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
276
268
  return {
277
269
  payload: {
278
270
  jeScheduleTransactionKeys: [
279
- ...jeSchedules.map((jeSchedule) => (0, jeSchedulesPayload_1.getTransactionDetailKeyPayload)(jeSchedule.base_transaction)),
271
+ ...jeSchedules.map((jeSchedule) => (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(jeSchedule.base_transaction)),
280
272
  ],
281
273
  },
282
274
  };
@@ -48,19 +48,20 @@ const financeStatement = (0, toolkit_1.createSlice)({
48
48
  updateFinanceStatementThisPeriod(draft, action) {
49
49
  const { firstMonthOfFY, coaBalances, maxNumOfPeriodsToHighlight } = action.payload;
50
50
  const { timeframe, selectedCOABalancesRange } = draft;
51
- if (coaBalances.length > 0) {
52
- const prevThisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, coaBalances);
51
+ const safeCoaBalances = coaBalances != null ? coaBalances : [];
52
+ if (safeCoaBalances.length > 0) {
53
+ const prevThisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
53
54
  if (prevThisPeriod != null) {
54
55
  const selectedCoaBalancesRangeWithThisPeriod = {
55
56
  ...selectedCOABalancesRange,
56
57
  thisPeriod: prevThisPeriod,
57
58
  };
58
- const newThisPeriod = (0, thisPeriodHelpers_1.getMatchingThisPeriod)(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, coaBalances);
59
+ const newThisPeriod = (0, thisPeriodHelpers_1.getMatchingThisPeriod)(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, safeCoaBalances);
59
60
  if (newThisPeriod != null) {
60
61
  const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
61
62
  firstMonthOfFY,
62
63
  thisPeriod: newThisPeriod,
63
- coaBalances,
64
+ coaBalances: safeCoaBalances,
64
65
  timeframe,
65
66
  maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
66
67
  currentSelection: {
@@ -79,7 +80,9 @@ const financeStatement = (0, toolkit_1.createSlice)({
79
80
  draft.selectedReportId = action.payload;
80
81
  },
81
82
  updateFinanceStatementAdditionalBalancesSelection(draft, action) {
82
- const { firstMonthOfFY, additionalBalances, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
83
+ const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
84
+ const safeCoaBalances = coaBalances != null ? coaBalances : [];
85
+ const additionalBalances = additionalBalancesPayload ?? [];
83
86
  let tempAdditionalBalances = [...additionalBalances];
84
87
  if (additionalBalances.includes('this_period_vs_last_period') ||
85
88
  additionalBalances.includes('this_period_vs_last_period_percent')) {
@@ -95,8 +98,8 @@ const financeStatement = (0, toolkit_1.createSlice)({
95
98
  draft.isAdditionalBalancesShown =
96
99
  additionalBalances.length != 0 ? true : false;
97
100
  const { timeframe, selectedCOABalancesRange } = draft;
98
- if (coaBalances.length > 0) {
99
- const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, coaBalances);
101
+ if (safeCoaBalances.length > 0) {
102
+ const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
100
103
  if (thisPeriod != null) {
101
104
  const selectedCoaBalancesRangeWithThisPeriod = {
102
105
  ...selectedCOABalancesRange,
@@ -105,7 +108,7 @@ const financeStatement = (0, toolkit_1.createSlice)({
105
108
  const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
106
109
  firstMonthOfFY,
107
110
  thisPeriod: thisPeriod,
108
- coaBalances,
111
+ coaBalances: safeCoaBalances,
109
112
  timeframe,
110
113
  maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
111
114
  currentSelection: {
@@ -8,6 +8,7 @@ import { RootState } from '../../reducer';
8
8
  import { BalanceSheetReport } from '../balanceSheet/balanceSheetSelectorTypes';
9
9
  import { CashFlowReport } from '../cashFlow/cashFlowSelectorTypes';
10
10
  import { ProfitAndLossReport } from '../profitAndLoss/profitAndLossSelector';
11
+ import { ProfitAndLossByClassHorizontalReport } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
11
12
  import { ProfitAndLossClassesViewReport } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
12
13
  export interface FinanceStatementReport extends SelectorReport {
13
14
  allTimeframeTicks: TimeframeTickWithMetaData[];
@@ -18,6 +19,7 @@ export interface FinanceStatementReport extends SelectorReport {
18
19
  downloadState: FetchState;
19
20
  filter: COABalancesFilter;
20
21
  isCompareModeOn: boolean;
22
+ profitAndLossByClassHorizontalReport: ProfitAndLossByClassHorizontalReport;
21
23
  profitAndLossByClassReport: ProfitAndLossClassesViewReport;
22
24
  profitAndLossReport: ProfitAndLossReport;
23
25
  reportFormat: ReportFormat;
@@ -11,6 +11,7 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
11
11
  const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
12
12
  const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
13
13
  const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector");
14
+ const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
14
15
  const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
15
16
  function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
16
17
  const datesSorted = [
@@ -45,11 +46,11 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
45
46
  if (dataAvailable != null) {
46
47
  const noFilter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(firstMonthOfFY, financeStatementState.timeframe, dataAvailable, 'ascending_date', []);
47
48
  const profitAndLossForTimeframeTicks = (0, profitAndLossSelector_1.getProfitAndLossReport)(noFilter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
48
- if (profitAndLossForTimeframeTicks.sections.expenses != null) {
49
- balancesInTimeframe =
50
- profitAndLossForTimeframeTicks.sections.expenses.balances.length > 0
51
- ? profitAndLossForTimeframeTicks.sections['expenses'].balances
52
- : profitAndLossForTimeframeTicks.sections['income'].balances;
49
+ const expensesBalances = profitAndLossForTimeframeTicks.sections.expenses?.balances ?? [];
50
+ const incomeBalances = profitAndLossForTimeframeTicks.sections.income?.balances ?? [];
51
+ balancesInTimeframe =
52
+ expensesBalances.length > 0 ? expensesBalances : incomeBalances;
53
+ if (balancesInTimeframe.length > 0) {
53
54
  allTimeframeTicks = balancesInTimeframe.map((balance) => (0, timeframeTick_1.toTimeframeTick)(balance));
54
55
  }
55
56
  }
@@ -63,6 +64,9 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
63
64
  const profitAndLossReport = (0, profitAndLossSelector_1.getProfitAndLossReport)(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
64
65
  const classFilter = (0, coaBalancesFilterClassesView_1.newBalancesFilterClassesView)(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
65
66
  const profitAndLossByClassReport = (0, profitAndLossClassesViewSelector_1.getProfitAndLossClassesView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
67
+ const profitAndLossByClassHorizontalReport = (0, profitAndLossClassesByClassHorizontalSelector_1.getProfitAndLossClassesHorizontalView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState, profitAndLossClassesViewState.uiState.classViewLayout === 'horizontal'
68
+ ? thisPeriod
69
+ : undefined);
66
70
  const balanceSheetReport = (0, balanceSheetSelector_1.getBalanceSheet)(filter, accountState, accountGroupState, sectionAccountsViewState, balanceSheetState);
67
71
  const cashFlowReport = (0, cashFlowSelector_1.getCashFlow)(filter, accountState, accountGroupState, sectionAccountsViewState, cashFlowState);
68
72
  const allReports = [
@@ -110,6 +114,7 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
110
114
  dataAvailable,
111
115
  profitAndLossReport,
112
116
  profitAndLossByClassReport,
117
+ profitAndLossByClassHorizontalReport,
113
118
  balanceSheetReport,
114
119
  cashFlowReport,
115
120
  filter,
@@ -0,0 +1,13 @@
1
+ import { COABalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
2
+ import { AccountState } from '../../entity/account/accountState';
3
+ import { ClassState } from '../../entity/class/classState';
4
+ import { SectionClassesViewStateV2 } from '../../entity/sectionClassesViewV2/sectionClassesViewState';
5
+ import { ZeniDate } from '../../zeniDayJS';
6
+ import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
7
+ import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
8
+ import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
9
+ export declare const profitAndLossHorizontalIdsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
10
+ export declare const getProfitAndLossClassesHorizontalView: (filter: COABalancesFilterClassesView, accountState: AccountState, classState: ClassState, sectionsState: SectionClassesViewStateV2, profitAndLossClassesViewState: ProfitAndLossClassesViewState, selectedPeriod: {
11
+ endDate: ZeniDate;
12
+ startDate: ZeniDate;
13
+ } | undefined) => ProfitAndLossByClassHorizontalReport;
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProfitAndLossClassesHorizontalView = exports.profitAndLossHorizontalIdsInOrder = void 0;
4
+ const amount_1 = require("../../commonStateTypes/amount");
5
+ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
6
+ const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
7
+ /** If `ProfitAndLossClassesViewState.currency` is unset (e.g. tests). */
8
+ const FALLBACK_REPORT_CURRENCY = {
9
+ currencyCode: 'USD',
10
+ currencySymbol: '$',
11
+ };
12
+ exports.profitAndLossHorizontalIdsInOrder = [
13
+ 'income',
14
+ 'cogs',
15
+ 'grossProfit',
16
+ 'expenses',
17
+ 'earningsBeforeInterestAndTax',
18
+ 'otherIncome',
19
+ 'otherExpenses',
20
+ 'netOtherIncome',
21
+ 'netIncome',
22
+ ];
23
+ const SECTION_TITLES = {
24
+ income: 'Income',
25
+ cogs: 'Cost of Goods Sold',
26
+ grossProfit: 'Gross Profit',
27
+ expenses: 'Expenses',
28
+ earningsBeforeInterestAndTax: 'Net Operating Income',
29
+ otherIncome: 'Other Income',
30
+ otherExpenses: 'Other Expenses',
31
+ netOtherIncome: 'Net Other Income',
32
+ netIncome: 'Net Income',
33
+ };
34
+ /** Sections fetched and pivoted for horizontal layout (excludes e.g. `netOperatingIncome`). */
35
+ const HORIZONTAL_PANDL_SECTION_IDS = [
36
+ 'income',
37
+ 'cogs',
38
+ 'expenses',
39
+ 'otherIncome',
40
+ 'otherExpenses',
41
+ ];
42
+ const getProfitAndLossClassesHorizontalView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState, selectedPeriod) => {
43
+ const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
44
+ profitAndLossClassesViewState.fetchState.month,
45
+ profitAndLossClassesViewState.fetchState.quarter,
46
+ profitAndLossClassesViewState.fetchState.year,
47
+ ]);
48
+ const reportId = 'profit_and_loss_by_classes';
49
+ // Build class columns from the class hierarchy (top-level only)
50
+ const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, profitAndLossClassesViewState.uiState.classesToFilterOut);
51
+ const sections = {};
52
+ const calculatedSections = {};
53
+ let reportCurrency = FALLBACK_REPORT_CURRENCY;
54
+ if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
55
+ // Get section reports using existing selector infrastructure
56
+ const sectionReports = {};
57
+ HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
58
+ sectionReports[sectionId] = (0, sectionClassesViewSelector_1.getSectionClassesViewReport)(accountState, classState, sectionsState, { reportId, sectionId }, filter);
59
+ });
60
+ reportCurrency =
61
+ profitAndLossClassesViewState.currency ?? FALLBACK_REPORT_CURRENCY;
62
+ // Pivot each section from class→account to account→class
63
+ HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
64
+ const sectionReport = sectionReports[sectionId];
65
+ if (sectionReport != null) {
66
+ sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
67
+ }
68
+ });
69
+ // Calculate derived sections
70
+ const incomeSection = sections['income'];
71
+ const cogsSection = sections['cogs'];
72
+ const expensesSection = sections['expenses'];
73
+ const otherIncomeSection = sections['otherIncome'];
74
+ const otherExpensesSection = sections['otherExpenses'];
75
+ // Gross Profit = Income - COGS
76
+ if (incomeSection != null && cogsSection != null) {
77
+ calculatedSections['grossProfit'] = computeCalculatedSection(incomeSection.classTotals, cogsSection.classTotals, incomeSection.sectionTotal, cogsSection.sectionTotal, 'subtract', SECTION_TITLES['grossProfit']);
78
+ }
79
+ // EBIT = Gross Profit - Expenses
80
+ const grossProfit = calculatedSections['grossProfit'];
81
+ if (grossProfit != null && expensesSection != null) {
82
+ calculatedSections['earningsBeforeInterestAndTax'] =
83
+ computeCalculatedSection(grossProfit.classTotals, expensesSection.classTotals, grossProfit.sectionTotal, expensesSection.sectionTotal, 'subtract', SECTION_TITLES['earningsBeforeInterestAndTax']);
84
+ }
85
+ // Net Other Income = Other Income - Other Expenses
86
+ if (otherIncomeSection != null && otherExpensesSection != null) {
87
+ calculatedSections['netOtherIncome'] = computeCalculatedSection(otherIncomeSection.classTotals, otherExpensesSection.classTotals, otherIncomeSection.sectionTotal, otherExpensesSection.sectionTotal, 'subtract', SECTION_TITLES['netOtherIncome']);
88
+ }
89
+ // Net Income = EBIT + Net Other Income
90
+ const ebit = calculatedSections['earningsBeforeInterestAndTax'];
91
+ const netOtherIncome = calculatedSections['netOtherIncome'];
92
+ if (ebit != null && netOtherIncome != null) {
93
+ calculatedSections['netIncome'] = computeCalculatedSection(ebit.classTotals, netOtherIncome.classTotals, ebit.sectionTotal, netOtherIncome.sectionTotal, 'add', SECTION_TITLES['netIncome']);
94
+ }
95
+ }
96
+ // Build synthetic header COABalances for rendering class names as column headers
97
+ const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod, reportCurrency);
98
+ return {
99
+ reportId,
100
+ reportTitle: 'Profit and Loss by Class',
101
+ firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
102
+ fetchState: fetchState.fetchState,
103
+ bookCloseDate: profitAndLossClassesViewState.bookCloseDate,
104
+ dataAvailable: profitAndLossClassesViewState.dataAvailable,
105
+ selectedPeriod,
106
+ classColumns,
107
+ sections,
108
+ calculatedSections,
109
+ idsInOrder: exports.profitAndLossHorizontalIdsInOrder,
110
+ uiState: profitAndLossClassesViewState.uiState,
111
+ headerBalances,
112
+ };
113
+ };
114
+ exports.getProfitAndLossClassesHorizontalView = getProfitAndLossClassesHorizontalView;
115
+ /**
116
+ * Build column definitions from class hierarchy (top-level classes only).
117
+ */
118
+ function buildClassColumns(classHierarchy, classesToFilterOut) {
119
+ const filteredIds = new Set(classesToFilterOut.map((id) => id[0]));
120
+ return classHierarchy
121
+ .filter((c) => !filteredIds.has(c.classId[0]))
122
+ .map((c) => ({
123
+ classId: c.classId[0],
124
+ className: c.className,
125
+ nestedClassId: c.classId,
126
+ qboId: c.qboId,
127
+ }));
128
+ }
129
+ /**
130
+ * Pivot a section from class→account→balances to account→class→balance (single period).
131
+ */
132
+ function pivotSectionToHorizontal(section, classColumns, title, currency) {
133
+ // Map: accountId -> { accountName, classId -> balance }
134
+ const accountMap = new Map();
135
+ // Also track class totals
136
+ const classTotalMap = new Map();
137
+ classColumns.forEach((col) => classTotalMap.set(col.classId, 0));
138
+ // Iterate over each class in the section
139
+ section.classes.forEach((classReport) => {
140
+ const classId = classReport.id[0];
141
+ // Only process classes that are in our columns
142
+ if (!classTotalMap.has(classId)) {
143
+ return;
144
+ }
145
+ // Sum all sliced period balances (same slice as vertical columns; multi-period = range total)
146
+ const classBalance = sumBalancesInSlice(classReport.childrenBalancesTotal.balances);
147
+ classTotalMap.set(classId, classBalance);
148
+ // Iterate through accounts in this class
149
+ collectAccountsFromClass(classReport, classId, accountMap);
150
+ });
151
+ // Build account rows
152
+ const accounts = [];
153
+ accountMap.forEach((accountData, accountId) => {
154
+ const classBalances = classColumns.map((col) => ({
155
+ classId: col.classId,
156
+ balance: (0, amount_1.toAmountWC)(accountData.classBalances.get(col.classId) ?? 0, currency),
157
+ }));
158
+ const rowTotal = classBalances.reduce((sum, cb) => sum + cb.balance.amount, 0);
159
+ accounts.push({
160
+ accountId,
161
+ accountName: accountData.accountName,
162
+ classBalances,
163
+ rowTotal: (0, amount_1.toAmountWC)(rowTotal, currency),
164
+ });
165
+ });
166
+ // Build class totals
167
+ const classTotals = classColumns.map((col) => ({
168
+ classId: col.classId,
169
+ balance: (0, amount_1.toAmountWC)(classTotalMap.get(col.classId) ?? 0, currency),
170
+ }));
171
+ const sectionTotal = classTotals.reduce((sum, ct) => sum + ct.balance.amount, 0);
172
+ return {
173
+ title,
174
+ accounts,
175
+ classTotals,
176
+ sectionTotal: (0, amount_1.toAmountWC)(sectionTotal, currency),
177
+ };
178
+ }
179
+ /**
180
+ * Recursively collect account balances from a NestedClassReportV2 into accountMap.
181
+ */
182
+ function collectAccountsFromClass(classReport, classId, accountMap) {
183
+ // Process accounts directly on this class
184
+ classReport.class.accounts.forEach((nestedAccount) => {
185
+ collectAccountsFromNestedAccount(nestedAccount, classId, accountMap);
186
+ });
187
+ }
188
+ /**
189
+ * Recursively collect accounts from NestedAccountReport (handles sub-accounts).
190
+ */
191
+ function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap) {
192
+ const accountId = nestedAccount.account.accountId;
193
+ const accountName = nestedAccount.account.accountName;
194
+ const balance = sumBalancesInSlice(nestedAccount.account.balancesInTimeframe.balances);
195
+ if (!accountMap.has(accountId)) {
196
+ accountMap.set(accountId, {
197
+ accountName,
198
+ classBalances: new Map(),
199
+ });
200
+ }
201
+ const accountData = accountMap.get(accountId);
202
+ if (accountData == null) {
203
+ return;
204
+ }
205
+ const existing = accountData.classBalances.get(classId) ?? 0;
206
+ accountData.classBalances.set(classId, existing + balance);
207
+ // Process sub-accounts
208
+ nestedAccount.children.forEach((child) => {
209
+ collectAccountsFromNestedAccount(child, classId, accountMap);
210
+ });
211
+ }
212
+ /**
213
+ * Total amount for the current report slice. `balances` is already narrowed by
214
+ * `getCOABalances` / `sliceCOABalances` to the selected range; summing matches
215
+ * multi-period selections and avoids mismatches when `thisPeriod` does not
216
+ * align with a row (e.g. slice fallback) or when several period rows are shown.
217
+ */
218
+ function sumBalancesInSlice(balances) {
219
+ let sum = 0;
220
+ for (const bal of balances) {
221
+ sum += bal.balance?.amount ?? 0;
222
+ }
223
+ return sum;
224
+ }
225
+ /**
226
+ * Compute a calculated section by adding or subtracting two sets of class totals.
227
+ */
228
+ function computeCalculatedSection(aTotals, bTotals, aTotal, bTotal, operation, title) {
229
+ const currency = {
230
+ currencyCode: aTotal.currencyCode,
231
+ currencySymbol: aTotal.currencySymbol,
232
+ };
233
+ const bTotalsMap = new Map(bTotals.map((b) => [b.classId, b.balance.amount]));
234
+ const classTotals = aTotals.map((a) => {
235
+ const bAmount = bTotalsMap.get(a.classId) ?? 0;
236
+ const resultAmount = operation === 'add'
237
+ ? a.balance.amount + bAmount
238
+ : a.balance.amount - bAmount;
239
+ return {
240
+ classId: a.classId,
241
+ balance: (0, amount_1.toAmountWC)(resultAmount, currency),
242
+ };
243
+ });
244
+ const sectionTotalAmount = operation === 'add'
245
+ ? aTotal.amount + bTotal.amount
246
+ : aTotal.amount - bTotal.amount;
247
+ return {
248
+ title,
249
+ classTotals,
250
+ sectionTotal: (0, amount_1.toAmountWC)(sectionTotalAmount, currency),
251
+ };
252
+ }
253
+ /**
254
+ * Build synthetic COABalance array for header rendering.
255
+ * One entry per class column + one for "Total".
256
+ */
257
+ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency) {
258
+ if (selectedPeriod == null) {
259
+ return [];
260
+ }
261
+ const { endDate, startDate } = selectedPeriod;
262
+ const balances = classColumns.map((col) => ({
263
+ balance: (0, amount_1.toAmountWC)(0, currency),
264
+ balanceTimeFrame: timeframe,
265
+ endDate,
266
+ startDate,
267
+ type: 'default',
268
+ label: col.className,
269
+ }));
270
+ // Add a "Total" column
271
+ balances.push({
272
+ balance: (0, amount_1.toAmountWC)(0, currency),
273
+ balanceTimeFrame: timeframe,
274
+ endDate,
275
+ startDate,
276
+ type: 'default',
277
+ label: 'Total',
278
+ });
279
+ return balances;
280
+ }
@@ -0,0 +1,57 @@
1
+ import { Amount } from '../../commonStateTypes/amount';
2
+ import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
3
+ import { COABalance } from '../../commonStateTypes/coaBalance/coaBalance';
4
+ import { FetchState, ID } from '../../commonStateTypes/common';
5
+ import { DataAvailable } from '../../commonStateTypes/dataAvailable';
6
+ import { Month } from '../../commonStateTypes/timePeriod';
7
+ import { ReportID } from '../../commonStateTypes/viewAndReport/viewAndReport';
8
+ import { ZeniDate } from '../../zeniDayJS';
9
+ import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
10
+ import { ProfitAndLossClassesViewUIState } from './profitAndLossClassesViewState';
11
+ export interface ClassColumnDefinition {
12
+ classId: string;
13
+ className: string;
14
+ nestedClassId: NestedClassID;
15
+ qboId?: ID;
16
+ }
17
+ export interface HorizontalClassBalance {
18
+ balance: Amount;
19
+ classId: string;
20
+ }
21
+ export interface HorizontalAccountRow {
22
+ accountId: string;
23
+ accountName: string;
24
+ classBalances: HorizontalClassBalance[];
25
+ rowTotal: Amount;
26
+ }
27
+ export interface HorizontalSectionReport {
28
+ accounts: HorizontalAccountRow[];
29
+ classTotals: HorizontalClassBalance[];
30
+ sectionTotal: Amount;
31
+ title: string;
32
+ }
33
+ export interface HorizontalCalculatedSection {
34
+ classTotals: HorizontalClassBalance[];
35
+ sectionTotal: Amount;
36
+ title: string;
37
+ }
38
+ export interface ProfitAndLossByClassHorizontalReport {
39
+ calculatedSections: Partial<Record<PandLReportViewCalculatedSectionID, HorizontalCalculatedSection>>;
40
+ classColumns: ClassColumnDefinition[];
41
+ fetchState: FetchState;
42
+ firstMonthOfFY: Month;
43
+ /** Synthetic COABalance array for header rendering — one per class column + total */
44
+ headerBalances: COABalance[];
45
+ idsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
46
+ reportId: ReportID;
47
+ reportTitle: string;
48
+ sections: Partial<Record<PandLReportViewSectionID, HorizontalSectionReport>>;
49
+ selectedPeriod: {
50
+ endDate: ZeniDate;
51
+ startDate: ZeniDate;
52
+ label?: string;
53
+ } | undefined;
54
+ uiState: ProfitAndLossClassesViewUIState;
55
+ bookCloseDate?: ZeniDate;
56
+ dataAvailable?: DataAvailable;
57
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID'
2
2
  import { AccountViewMode, ID } from '../../commonStateTypes/common';
3
3
  import { ZeniAPIStatus, ZeniReportData } from '../../responsePayload';
4
4
  import { ProfitAndLossClassesViewPayload } from './profitAndLossClassesViewPayload';
5
- import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
5
+ import { ClassViewLayout, ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
6
6
  export declare const initialState: ProfitAndLossClassesViewState;
7
7
  export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
8
8
  cacheOverride: boolean;
@@ -30,6 +30,8 @@ export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").A
30
30
  };
31
31
  }, "profitAndLossClassesView/updateProfitAndLossClassesViewUIState">, updateAccountViewMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
32
32
  viewMode: AccountViewMode;
33
- }, "profitAndLossClassesView/updateAccountViewMode">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
33
+ }, "profitAndLossClassesView/updateAccountViewMode">, updateClassViewLayout: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
34
+ classViewLayout: ClassViewLayout;
35
+ }, "profitAndLossClassesView/updateClassViewLayout">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
34
36
  declare const _default: import("redux").Reducer<ProfitAndLossClassesViewState>;
35
37
  export default _default;