A local-first personal finance app
Add Budgeted type to custom report widgets (#6903)
Diego Palaciosf88009a16661
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.pngindex 47a63459f6..03ec0633a3 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.pngindex 522f0554ff..3573fd030c 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.pngindex 93dbed3504..ea7791ed19 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.pngindex f73251d4bf..6d75ef6e4b 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png differdiff --git a/packages/desktop-client/src/components/filters/FiltersMenu.tsx b/packages/desktop-client/src/components/filters/FiltersMenu.tsxindex 4efa243db8..a43fbc9f68 100644--- a/packages/desktop-client/src/components/filters/FiltersMenu.tsx+++ b/packages/desktop-client/src/components/filters/FiltersMenu.tsx@@ -1,4 +1,5 @@import React, { useEffect, useMemo, useReducer, useRef, useState } from 'react';+import type { ComponentProps } from 'react';import { FocusScope } from 'react-aria';import { Form } from 'react-aria-components';import { useHotkeys } from 'react-hotkeys-hook';@@ -475,6 +476,23 @@ export function FilterButton<T extends RuleConditionEntity>({scopes: ['app'],});+ const filterMenuItems: ComponentProps<typeof Menu>['items'] =+ translatedFilterFields+ .filter(f => (exclude ? !exclude.includes(f[0]) : true))+ .sort((a, b) => a[0].localeCompare(b[0]))+ .map(([name, text]) => ({+ name,+ text: titleFirst(text),+ }));++ if (!exclude?.includes('saved')) {+ filterMenuItems.push(Menu.line);+ filterMenuItems.push({+ name: 'saved',+ text: titleFirst(mapField('saved')),+ });+ }+return (<View><View ref={triggerRef}>@@ -513,24 +531,9 @@ export function FilterButton<T extends RuleConditionEntity>({><MenuonMenuSelect={name => {- dispatch({ type: 'configure', field: name });+ dispatch({ type: 'configure', field: name as string });}}- items={[- ...translatedFilterFields- .filter(f => (exclude ? !exclude.includes(f[0]) : true))- .sort((a, b) => a[0].localeCompare(b[0]))- .map(([name, text]) => ({- name,- text: titleFirst(text),- })),-- Menu.line,-- {- name: 'saved',- text: titleFirst(mapField('saved')),- },- ]}+ items={filterMenuItems}/></Popover>diff --git a/packages/desktop-client/src/components/reports/ReportOptions.ts b/packages/desktop-client/src/components/reports/ReportOptions.tsindex ae4e828b14..acf0694297 100644--- a/packages/desktop-client/src/components/reports/ReportOptions.ts+++ b/packages/desktop-client/src/components/reports/ReportOptions.ts@@ -48,6 +48,11 @@ const balanceTypeOptions = [key: 'Net Deposit',format: 'netAssets' as const,},+ {+ description: t('Budgeted'),+ key: 'Budgeted',+ format: 'totalBudgeted' as const,+ },];const groupByOptions = [diff --git a/packages/desktop-client/src/components/reports/ReportSidebar.tsx b/packages/desktop-client/src/components/reports/ReportSidebar.tsxindex 424addc13e..495ac2e83f 100644--- a/packages/desktop-client/src/components/reports/ReportSidebar.tsx+++ b/packages/desktop-client/src/components/reports/ReportSidebar.tsx@@ -182,6 +182,34 @@ export function ReportSidebar({setSessionReport('balanceType', cond);onReportChange({ type: 'modify' });setBalanceType(cond);++ if (cond === 'Budgeted') {+ // Budgeted does not support Payee and Account splits+ if (+ customReportItems.groupBy === 'Payee' ||+ customReportItems.groupBy === 'Account'+ ) {+ setSessionReport('groupBy', 'Category');+ setGroupBy('Category');+ defaultItems('Category');+ }+ // Budgeted only supports Monthly and Yearly intervals+ if (+ customReportItems.interval === 'Daily' ||+ customReportItems.interval === 'Weekly'+ ) {+ setSessionReport('interval', 'Monthly');+ setInterval('Monthly');+ if (+ ReportOptions.dateRange+ .filter(d => !d['Monthly' as keyof dateRangeProps])+ .map(int => int.key)+ .includes(customReportItems.dateRange)+ ) {+ onSelectRange(defaultsList.intervalRange.get('Monthly') || '');+ }+ }+ }};const onChangeSortBy = (cond?: sortByOpType) => {@@ -277,7 +305,11 @@ export function ReportSidebar({option.key,option.description,])}- disabledKeys={disabledItems('split')}+ disabledKeys={+ customReportItems.balanceType === 'Budgeted'+ ? [...new Set([...disabledItems('split'), 'Payee', 'Account'])]+ : disabledItems('split')+ }/></View>@@ -330,7 +362,11 @@ export function ReportSidebar({option.key,option.description,])}- disabledKeys={[]}+ disabledKeys={+ customReportItems.balanceType === 'Budgeted'+ ? ['Daily', 'Weekly']+ : []+ }/></View>diff --git a/packages/desktop-client/src/components/reports/ReportSummary.tsx b/packages/desktop-client/src/components/reports/ReportSummary.tsxindex 73fdc9387d..0b3b3c3a0d 100644--- a/packages/desktop-client/src/components/reports/ReportSummary.tsx+++ b/packages/desktop-client/src/components/reports/ReportSummary.tsx@@ -113,7 +113,9 @@ export function ReportSummary({? t('TOTAL SPENDING'): balanceTypeOp === 'totalAssets'? t('TOTAL DEPOSITS')- : t('NET {{net}}', { net })}+ : balanceTypeOp === 'totalBudgeted'+ ? t('TOTAL BUDGETED')+ : t('NET {{net}}', { net })}</Text><FinancialTextstyle={{@@ -152,7 +154,9 @@ export function ReportSummary({? t('AVERAGE SPENDING'): balanceTypeOp === 'totalAssets'? t('AVERAGE DEPOSIT')- : t('AVERAGE NET')}+ : balanceTypeOp === 'totalBudgeted'+ ? t('AVERAGE BUDGETED')+ : t('AVERAGE NET')}</Text><FinancialTextstyle={{diff --git a/packages/desktop-client/src/components/reports/ReportTopbar.tsx b/packages/desktop-client/src/components/reports/ReportTopbar.tsxindex 0f376f23af..00fe1d017a 100644--- a/packages/desktop-client/src/components/reports/ReportTopbar.tsx+++ b/packages/desktop-client/src/components/reports/ReportTopbar.tsx@@ -243,7 +243,21 @@ export function ReportTopbar({onApplyFilter(e);onReportChange({ type: 'modify' });}}- exclude={[]}+ exclude={+ customReportItems.balanceType === 'Budgeted'+ ? [+ 'date',+ 'account',+ 'payee',+ 'notes',+ 'amount',+ 'cleared',+ 'reconciled',+ 'transfer',+ 'saved',+ ]+ : []+ }/><SaveReportWrappercustomReportItems={customReportItems}diff --git a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsxindex 6e9f9e8148..e218bdb12d 100644--- a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx+++ b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx@@ -36,6 +36,7 @@ type PayloadItem = {netAssets: number;netDebts: number;totalTotals: number;+ totalBudgeted: number;};};@@ -72,7 +73,9 @@ const CustomTooltip = ({<strong>{payload[0].payload.date}</strong></div><div style={{ lineHeight: 1.5 }}>- {['totalAssets', 'totalTotals'].includes(balanceTypeOp) && (+ {['totalAssets', 'totalTotals', 'totalBudgeted'].includes(+ balanceTypeOp,+ ) && (<AlignedTextleft={t('Assets:')}right={@@ -82,7 +85,9 @@ const CustomTooltip = ({}/>)}- {['totalDebts', 'totalTotals'].includes(balanceTypeOp) && (+ {['totalDebts', 'totalTotals', 'totalBudgeted'].includes(+ balanceTypeOp,+ ) && (<AlignedTextleft={t('Debts:')}right={@@ -112,12 +117,19 @@ const CustomTooltip = ({}/>)}- {['totalTotals'].includes(balanceTypeOp) && (+ {['totalTotals', 'totalBudgeted'].includes(balanceTypeOp) && (<AlignedText- left={t('Net:')}+ left={+ balanceTypeOp === 'totalBudgeted' ? t('Budgeted:') : t('Net:')+ }right={<FinancialText as="strong">- {format(payload[0].payload.totalTotals, 'financial')}+ {format(+ balanceTypeOp === 'totalBudgeted'+ ? payload[0].payload.totalBudgeted+ : payload[0].payload.totalTotals,+ 'financial',+ )}</FinancialText>}/>diff --git a/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx b/packages/desktop-client/src/components/reports/graphs/BarGraph.tsxindex 922bd0516c..58ae6ecffc 100644--- a/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx+++ b/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx@@ -56,6 +56,7 @@ type PayloadItem = {netAssets: number;netDebts: number;totalTotals: number;+ totalBudgeted: number;networth: number;totalChange: number;children: [PayloadChild];@@ -97,7 +98,9 @@ const CustomTooltip = ({<strong>{payload[0].payload[yAxis]}</strong></div><div style={{ lineHeight: 1.5 }}>- {['totalAssets', 'totalTotals'].includes(balanceTypeOp) && (+ {['totalAssets', 'totalTotals', 'totalBudgeted'].includes(+ balanceTypeOp,+ ) && (<AlignedTextleft={t('Assets:')}right={@@ -107,7 +110,9 @@ const CustomTooltip = ({}/>)}- {['totalDebts', 'totalTotals'].includes(balanceTypeOp) && (+ {['totalDebts', 'totalTotals', 'totalBudgeted'].includes(+ balanceTypeOp,+ ) && (<AlignedTextleft={t('Debts:')}right={@@ -137,12 +142,19 @@ const CustomTooltip = ({}/>)}- {['totalTotals'].includes(balanceTypeOp) && (+ {['totalTotals', 'totalBudgeted'].includes(balanceTypeOp) && (<AlignedText- left={t('Net:')}+ left={+ balanceTypeOp === 'totalBudgeted' ? t('Budgeted:') : t('Net:')+ }right={<FinancialText as="strong">- {format(payload[0].payload.totalTotals, 'financial')}+ {format(+ balanceTypeOp === 'totalBudgeted'+ ? payload[0].payload.totalBudgeted+ : payload[0].payload.totalTotals,+ 'financial',+ )}</FinancialText>}/>@@ -162,7 +174,10 @@ const customLabel = (props, typeOp, format) => {props.value !== 0 && `${format(props.value, 'financial-no-decimals')}`;const textSize = adjustTextSize({sized: props.width,- type: typeOp === 'totalTotals' ? 'default' : 'variable',+ type:+ typeOp === 'totalTotals' || typeOp === 'totalBudgeted'+ ? 'default'+ : 'variable',values: props.value,});diff --git a/packages/desktop-client/src/components/reports/graphs/showActivity.ts b/packages/desktop-client/src/components/reports/graphs/showActivity.tsindex 39996f3a61..f47535be53 100644--- a/packages/desktop-client/src/components/reports/graphs/showActivity.ts+++ b/packages/desktop-client/src/components/reports/graphs/showActivity.ts@@ -76,7 +76,7 @@ export function showActivity({},!(['netAssets', 'netDebts'].includes(balanceTypeOp) ||- (balanceTypeOp === 'totalTotals' &&+ (['totalTotals', 'totalBudgeted'].includes(balanceTypeOp) &&(type === 'totals' || type === 'time'))) && {field: 'amount',@@ -104,10 +104,10 @@ export function showActivity({},].filter(f => f);- void navigate('/accounts', {- state: {- goBack: true,- filterConditions,- },+ void navigate(balanceTypeOp === 'totalBudgeted' ? '/budget' : '/accounts', {+ state:+ balanceTypeOp === 'totalBudgeted'+ ? { goBack: true }+ : { goBack: true, filterConditions },});}diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsxindex 54854747ed..aaa6690cff 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx@@ -89,7 +89,7 @@ export function ReportTableHeader({/>);})- : balanceTypeOp === 'totalTotals' && (+ : ['totalTotals', 'totalBudgeted'].includes(balanceTypeOp) && (<><Cellstyle={{diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsxindex 4cc6ff2f08..08fde8720d 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx@@ -40,6 +40,7 @@ export function ReportTableList({netAssets: interval.netAssets,netDebts: interval.netDebts,totalTotals: interval.totalTotals,+ totalBudgeted: interval.totalBudgeted,intervalData: [],categories: [],};diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsxindex 1b8b7d4f26..3af8b7931c 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx@@ -187,7 +187,7 @@ export const ReportTableRow = memo(/>);})- : balanceTypeOp === 'totalTotals' && (+ : ['totalTotals', 'totalBudgeted'].includes(balanceTypeOp) && (<><Cellvalue={format(item.totalAssets, 'financial')}diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsxindex f6174d1928..0cb1a52418 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx@@ -82,6 +82,7 @@ export function ReportTableTotals({netAssets: data.netAssets,netDebts: data.netDebts,totalTotals: data.totalTotals,+ totalBudgeted: data.totalBudgeted,};const totalsStyle: CSSProperties = {diff --git a/packages/desktop-client/src/components/reports/reports/CustomReport.tsx b/packages/desktop-client/src/components/reports/reports/CustomReport.tsxindex a1191e6fe3..8550947257 100644--- a/packages/desktop-client/src/components/reports/reports/CustomReport.tsx+++ b/packages/desktop-client/src/components/reports/reports/CustomReport.tsx@@ -22,6 +22,7 @@ import type {sortByOpType,TransactionEntity,} from 'loot-core/types/models';+import type { SyncedPrefs } from 'loot-core/types/prefs';import type { TransObjectLiteral } from 'loot-core/types/util';import { Warning } from '@desktop-client/components/alerts';@@ -119,22 +120,37 @@ function useSelectedCategories(}, [existingCategoryCondition, categories]);}+const BUDGETED_SUPPORTED_CONDITION_FIELDS = new Set<+ RuleConditionEntity['field']+>(['category']);+export function CustomReport() {const params = useParams();const { data: report, isPending } = useCustomReport(params.id);+ const [budgetType = 'envelope'] = useSyncedPref('budgetType');if (isPending) {return <LoadingIndicator />;}- return <CustomReportInner key={report?.id} report={report} />;+ return (+ <CustomReportInner+ key={report?.id}+ report={report}+ budgetType={budgetType}+ />+ );}type CustomReportInnerProps = {report?: CustomReportEntity;+ budgetType: SyncedPrefs['budgetType'];};-function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {+function CustomReportInner({+ report: initialReport,+ budgetType,+}: CustomReportInnerProps) {const locale = useLocale();const { t } = useTranslation();const format = useFormat();@@ -174,7 +190,11 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {? JSON.parse(reportFromSessionStorage): {};const combine = initialReport ?? defaultReport;- const loadReport: CustomReportEntity = { ...combine, ...session };++ const loadReport: CustomReportEntity = {+ ...combine,+ ...session,+ };const [allIntervals, setAllIntervals] = useState<Array<{@@ -269,7 +289,6 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {const [graphType, setGraphType] = useState(loadReport.graphType);const [dateRange, setDateRange] = useState(loadReport.dateRange);- const [dataCheck, setDataCheck] = useState(false);const dateRangeLine =interval === 'Daily'? 0@@ -482,12 +501,33 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {accounts,});+ useEffect(() => {+ if (balanceTypeOp !== 'totalBudgeted') {+ return;+ }++ const supportedConditions = conditions.filter(cond =>+ BUDGETED_SUPPORTED_CONDITION_FIELDS.has(cond.field),+ );++ if (supportedConditions.length === conditions.length) {+ return;+ }++ setSessionReport('conditions', supportedConditions);+ onApplyFilter(null);+ supportedConditions.forEach(condition => {+ onApplyFilter(condition);+ });+ }, [balanceTypeOp, conditions, onApplyFilter]);+const getGroupData = useMemo(() => {return createGroupedSpreadsheet({startDate,endDate,interval,categories,+ budgetType,conditions,conditionsOp,showEmpty,@@ -503,6 +543,7 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {startDate,endDate,interval,+ budgetType,balanceTypeOp,categories,conditions,@@ -517,13 +558,12 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {]);const getGraphData = useMemo(() => {- // TODO: fix me - state mutations should not happen inside `useMemo`- setDataCheck(false);return createCustomSpreadsheet({startDate,endDate,interval,categories,+ budgetType,conditions,conditionsOp,showEmpty,@@ -538,13 +578,13 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {accounts,graphType,firstDayOfWeekIdx,- setDataCheck,});}, [startDate,endDate,interval,groupBy,+ budgetType,balanceTypeOp,categories,payees,@@ -563,7 +603,9 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {const graphData = useReport('default', getGraphData);const groupedData = useReport('grouped', getGroupData);- const data: DataEntity = { ...graphData, groupedData } as DataEntity;+ const data: DataEntity | null = graphData+ ? { ...graphData, groupedData }+ : null;const customReportItems: CustomReportEntity = {id: '',@@ -601,7 +643,7 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {}}, [setViewLegendPref, setViewLabelsPref, mode, graphType]);- if (!allIntervals || !data) {+ if (allIntervals.length === 0) {return null;}@@ -731,7 +773,9 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {setTrimIntervals(input.trimIntervals);setGraphType(input.graphType);onApplyFilter(null);- (input.conditions || []).forEach(condition => onApplyFilter(condition));+ (input.conditions || []).forEach(condition => {+ onApplyFilter(condition);+ });onConditionsOpChange(input.conditionsOp);};@@ -791,7 +835,7 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {setReport(defaultReport);setReportData(defaultReport);break;- case 'choose':+ case 'choose': {sessionStorage.clear();const newReport = params.savedReport || report;setSessionReport('savedStatus', 'saved');@@ -800,6 +844,7 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {setReportData(newReport);void navigate(`/reports/custom/${newReport.id}`);break;+ }default:}};@@ -970,7 +1015,7 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {padding: 10,}}>- {graphType !== 'TableGraph' && (+ {graphType !== 'TableGraph' && data && (<Viewstyle={{alignItems: 'flex-end',@@ -998,7 +1043,7 @@ function CustomReportInner({ report: initialReport }: CustomReportInnerProps) {</View>)}<View style={{ flex: 1, overflow: 'auto' }}>- {dataCheck ? (+ {data ? (<ChooseGraphdata={data}filters={conditions}diff --git a/packages/desktop-client/src/components/reports/reports/GetCardData.tsx b/packages/desktop-client/src/components/reports/reports/GetCardData.tsxindex 23c48f5a81..676cbd098e 100644--- a/packages/desktop-client/src/components/reports/reports/GetCardData.tsx+++ b/packages/desktop-client/src/components/reports/reports/GetCardData.tsx@@ -24,6 +24,7 @@ import { ReportOptions } from '@desktop-client/components/reports/ReportOptions'import { createCustomSpreadsheet } from '@desktop-client/components/reports/spreadsheets/custom-spreadsheet';import { createGroupedSpreadsheet } from '@desktop-client/components/reports/spreadsheets/grouped-spreadsheet';import { useReport } from '@desktop-client/components/reports/useReport';+import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';function ErrorFallback() {return (@@ -84,6 +85,7 @@ export function GetCardData({showTooltip?: boolean;}) {const { isNarrowWidth } = useResponsive();+ const [budgetType = 'envelope'] = useSyncedPref('budgetType');let startDate = report.startDate;let endDate = report.endDate;@@ -126,6 +128,7 @@ export function GetCardData({endDate,interval: report.interval,categories,+ budgetType,conditions: report.conditions ?? [],conditionsOp: report.conditionsOp,showEmpty: report.showEmpty,@@ -137,13 +140,14 @@ export function GetCardData({firstDayOfWeekIdx,sortByOp: report.sortBy,});- }, [report, categories, startDate, endDate, firstDayOfWeekIdx]);+ }, [report, categories, startDate, endDate, firstDayOfWeekIdx, budgetType]);const getGraphData = useMemo(() => {return createCustomSpreadsheet({startDate,endDate,interval: report.interval,categories,+ budgetType,conditions: report.conditions ?? [],conditionsOp: report.conditionsOp,showEmpty: report.showEmpty,@@ -167,6 +171,7 @@ export function GetCardData({startDate,endDate,firstDayOfWeekIdx,+ budgetType,]);const graphData = useReport('default' + report.name, getGraphData);const groupedData = useReport('grouped' + report.name, getGroupData);diff --git a/packages/desktop-client/src/components/reports/spreadsheets/budget-analysis-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/budget-analysis-spreadsheet.tsindex c253c02f81..d7b722f424 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/budget-analysis-spreadsheet.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/budget-analysis-spreadsheet.ts@@ -6,6 +6,8 @@ import type {RuleConditionEntity,} from 'loot-core/types/models';+import type { BudgetMonthCell } from './budgetMonthCell';+import type { useSpreadsheet } from '@desktop-client/hooks/useSpreadsheet';type BudgetAnalysisIntervalData = {@@ -127,10 +129,10 @@ export function createBudgetAnalysisSpreadsheet({// Calculate the carryover from the previous monthfor (const cat of categoriesToInclude) {- const balanceCell = prevMonthData.find((cell: { name: string }) =>+ const balanceCell = prevMonthData.find((cell: BudgetMonthCell) =>cell.name.endsWith(`leftover-${cat.id}`),);- const carryoverCell = prevMonthData.find((cell: { name: string }) =>+ const carryoverCell = prevMonthData.find((cell: BudgetMonthCell) =>cell.name.endsWith(`carryover-${cat.id}`),);@@ -167,16 +169,16 @@ export function createBudgetAnalysisSpreadsheet({// Sum up values for categories we're interested infor (const cat of categoriesToInclude) {// Find the budget, spent, balance, and carryover flag for this category- const budgetCell = monthData.find((cell: { name: string }) =>+ const budgetCell = monthData.find((cell: BudgetMonthCell) =>cell.name.endsWith(`budget-${cat.id}`),);- const spentCell = monthData.find((cell: { name: string }) =>+ const spentCell = monthData.find((cell: BudgetMonthCell) =>cell.name.endsWith(`sum-amount-${cat.id}`),);- const balanceCell = monthData.find((cell: { name: string }) =>+ const balanceCell = monthData.find((cell: BudgetMonthCell) =>cell.name.endsWith(`leftover-${cat.id}`),);- const carryoverCell = monthData.find((cell: { name: string }) =>+ const carryoverCell = monthData.find((cell: BudgetMonthCell) =>cell.name.endsWith(`carryover-${cat.id}`),);diff --git a/packages/desktop-client/src/components/reports/spreadsheets/budgetDataQuery.ts b/packages/desktop-client/src/components/reports/spreadsheets/budgetDataQuery.tsnew file mode 100644index 0000000000..90a151ec5c--- /dev/null+++ b/packages/desktop-client/src/components/reports/spreadsheets/budgetDataQuery.ts@@ -0,0 +1,209 @@+import { send } from 'loot-core/platform/client/connection';+import * as monthUtils from 'loot-core/shared/months';+import type { Handlers } from 'loot-core/types/handlers';+import type {+ CategoryEntity,+ CategoryGroupEntity,+ RuleConditionEntity,+} from 'loot-core/types/models';+import type { SyncedPrefs } from 'loot-core/types/prefs';++import type { BudgetMonthCell } from './budgetMonthCell';++import type { QueryDataEntity } from '@desktop-client/components/reports/ReportOptions';++type BudgetDataConditionsOp = 'and' | 'or';++async function mapWithConcurrency<TItem, TResult>(+ items: TItem[],+ concurrency: number,+ mapper: (item: TItem, index: number) => Promise<TResult>,+): Promise<TResult[]> {+ if (items.length === 0) {+ return [];+ }++ const results: TResult[] = new Array(items.length);+ const safeConcurrency = Math.max(1, Math.min(concurrency, items.length));+ let nextIndex = 0;++ const workers = Array.from({ length: safeConcurrency }, async () => {+ while (true) {+ const currentIndex = nextIndex;+ nextIndex += 1;+ if (currentIndex >= items.length) {+ return;+ }++ results[currentIndex] = await mapper(items[currentIndex], currentIndex);+ }+ });++ await Promise.all(workers);+ return results;+}++function filterCategoriesByConditions(+ categories: CategoryEntity[],+ conditions: RuleConditionEntity[] | undefined,+ conditionsOp: BudgetDataConditionsOp | undefined,+) {+ if (!conditions || conditions.length === 0) {+ return categories;+ }++ const categoryConditions = conditions.filter(+ (cond): cond is Extract<RuleConditionEntity, { field: 'category' }> =>+ !cond.customName && cond.field === 'category',+ );++ if (categoryConditions.length === 0) {+ return categories;+ }++ const isSupportedCondition = (+ condition: Extract<RuleConditionEntity, { field: 'category' }>,+ ) => {+ if (condition.op === 'is' || condition.op === 'isNot') {+ return typeof condition.value === 'string';+ }++ if (condition.op === 'oneOf' || condition.op === 'notOneOf') {+ return (+ Array.isArray(condition.value) &&+ condition.value.every(id => typeof id === 'string')+ );+ }++ return false;+ };++ // If we can't safely interpret any category condition, do not attempt to+ // filter categories (better to be broad than silently exclude data).+ if (!categoryConditions.every(isSupportedCondition)) {+ return categories;+ }++ const evaluateCondition = (+ category: CategoryEntity,+ condition: Extract<RuleConditionEntity, { field: 'category' }>,+ ): boolean => {+ if (condition.op === 'is') {+ return category.id === condition.value;+ }++ if (condition.op === 'isNot') {+ return category.id !== condition.value;+ }++ if (condition.op === 'oneOf') {+ return condition.value.includes(category.id);+ }++ if (condition.op === 'notOneOf') {+ return !condition.value.includes(category.id);+ }++ return true;+ };++ const op: BudgetDataConditionsOp = conditionsOp === 'or' ? 'or' : 'and';++ return categories.filter(cat =>+ op === 'or'+ ? categoryConditions.some(cond => evaluateCondition(cat, cond))+ : categoryConditions.every(cond => evaluateCondition(cat, cond)),+ );+}++export async function fetchBudgetData({+ startDate,+ endDate,+ interval,+ categories,+ categoryGroups,+ conditions,+ conditionsOp,+ budgetType = 'envelope',+}: {+ startDate: string;+ endDate: string;+ interval: string;+ categories: CategoryEntity[];+ categoryGroups: CategoryGroupEntity[];+ conditions?: RuleConditionEntity[];+ conditionsOp?: BudgetDataConditionsOp;+ budgetType?: SyncedPrefs['budgetType'];+}): Promise<{ assets: QueryDataEntity[]; debts: QueryDataEntity[] }> {+ const groupById = new Map(categoryGroups.map(g => [g.id, g] as const));+ const assets: QueryDataEntity[] = [];+ const debts: QueryDataEntity[] = [];++ const filteredCategories = filterCategoriesByConditions(+ categories,+ conditions,+ conditionsOp,+ );++ const months = monthUtils.rangeInclusive(+ monthUtils.getMonth(startDate),+ monthUtils.getMonth(endDate),+ );++ const monthFetchConcurrency = 8;+ const endpointName: keyof Handlers =+ budgetType === 'tracking'+ ? 'tracking-budget-month'+ : 'envelope-budget-month';++ const monthDataList = await mapWithConcurrency(+ months,+ monthFetchConcurrency,+ async month => ({+ month,+ monthData: await send(endpointName, { month }),+ }),+ );++ for (const { month, monthData } of monthDataList) {+ const dateKey = interval === 'Yearly' ? month.slice(0, 4) : month;++ for (const cat of filteredCategories) {+ if (cat.is_income) {+ continue;+ }++ const budgetCell = monthData.find((cell: BudgetMonthCell) =>+ cell.name.endsWith(`budget-${cat.id}`),+ );++ const amount = Number(budgetCell?.value) || 0;+ if (amount === 0) {+ continue;+ }++ const group = cat.group ? groupById.get(cat.group) : undefined;++ const entry: QueryDataEntity = {+ date: dateKey,+ category: cat.id,+ categoryHidden: cat.hidden ?? false,+ categoryGroup: cat.group ?? '',+ categoryGroupHidden: group?.hidden ?? false,+ account: '',+ accountOffBudget: false,+ payee: '',+ transferAccount: '',+ amount,+ };++ if (amount > 0) {+ assets.push(entry);+ } else {+ debts.push(entry);+ }+ }+ }++ return { assets, debts };+}diff --git a/packages/desktop-client/src/components/reports/spreadsheets/budgetMonthCell.ts b/packages/desktop-client/src/components/reports/spreadsheets/budgetMonthCell.tsnew file mode 100644index 0000000000..fbe0187d60--- /dev/null+++ b/packages/desktop-client/src/components/reports/spreadsheets/budgetMonthCell.ts@@ -0,0 +1,6 @@+import type { Handlers } from 'loot-core/types/handlers';++export type BudgetMonthCell = Awaited<+ | ReturnType<Handlers['envelope-budget-month']>+ | ReturnType<Handlers['tracking-budget-month']>+>[number];diff --git a/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts b/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.tsindex cfae8a9a9c..3508e37cd8 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/calculateLegend.ts@@ -40,8 +40,16 @@ export function calculateLegend(return theme.reportsNumberNegative;}- if (balanceTypeOp === 'totalTotals') {- if (data.totalTotals < 0) {+ if (+ balanceTypeOp === 'totalTotals' ||+ balanceTypeOp === 'totalBudgeted'+ ) {+ const total =+ balanceTypeOp === 'totalBudgeted'+ ? data.totalBudgeted+ : data.totalTotals;++ if (total < 0) {return theme.reportsNumberNegative;}diff --git a/packages/desktop-client/src/components/reports/spreadsheets/custom-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/custom-spreadsheet.tsindex e12711e73f..1d18959e10 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/custom-spreadsheet.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/custom-spreadsheet.ts@@ -17,9 +17,9 @@ import type {import type { SyncedPrefs } from 'loot-core/types/prefs';import { calculateLegend } from './calculateLegend';+import { fetchSpreadsheetQueryData } from './fetchSpreadsheetQueryData';import { filterEmptyRows } from './filterEmptyRows';import { filterHiddenItems } from './filterHiddenItems';-import { makeQuery } from './makeQuery';import { recalculate } from './recalculate';import { sortData } from './sortData';import {@@ -38,13 +38,13 @@ import type {UncategorizedEntity,} from '@desktop-client/components/reports/ReportOptions';import type { useSpreadsheet } from '@desktop-client/hooks/useSpreadsheet';-import { aqlQuery } from '@desktop-client/queries/aqlQuery';export type createCustomSpreadsheetProps = {startDate: string;endDate: string;interval: string;categories: { list: CategoryEntity[]; grouped: CategoryGroupEntity[] };+ budgetType?: SyncedPrefs['budgetType'];conditions: RuleConditionEntity[];conditionsOp: string;showEmpty: boolean;@@ -59,7 +59,6 @@ export type createCustomSpreadsheetProps = {accounts?: AccountEntity[];graphType?: string;firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx'];- setDataCheck?: (value: boolean) => void;};export function createCustomSpreadsheet({@@ -67,6 +66,7 @@ export function createCustomSpreadsheet({endDate,interval,categories,+ budgetType = 'envelope',conditions = [],conditionsOp,showEmpty,@@ -81,7 +81,6 @@ export function createCustomSpreadsheet({accounts = [],graphType,firstDayOfWeekIdx,- setDataCheck,}: createCustomSpreadsheetProps) {const [categoryList, categoryGroup] = categoryLists(categories);@@ -95,6 +94,19 @@ export function createCustomSpreadsheet({setData: (data: DataEntity) => void,) => {if (groupByList.length === 0) {+ setData({+ data: [],+ intervalData: [],+ legend: [],+ startDate,+ endDate,+ totalAssets: 0,+ totalDebts: 0,+ netAssets: 0,+ netDebts: 0,+ totalTotals: 0,+ totalBudgeted: 0,+ });return;}@@ -105,30 +117,22 @@ export function createCustomSpreadsheet({let assets: QueryDataEntity[];let debts: QueryDataEntity[];- [assets, debts] = await Promise.all([- aqlQuery(- makeQuery(- 'assets',- startDate,- endDate,- interval,- conditionsOpKey,- filters,- ),- ).then(({ data }) => data),- aqlQuery(- makeQuery(- 'debts',- startDate,- endDate,- interval,- conditionsOpKey,- filters,- ),- ).then(({ data }) => data),- ]);-- if (interval === 'Weekly') {++ ({ assets, debts } = await fetchSpreadsheetQueryData({+ balanceTypeOp,+ startDate,+ endDate,+ interval,+ categories: categories.list,+ categoryGroups: categories.grouped,+ conditions,+ conditionsOp,+ conditionsOpKey,+ filters,+ budgetType,+ }));++ if (interval === 'Weekly' && balanceTypeOp !== 'totalBudgeted') {debts = debts.map(d => {return {...d,@@ -218,7 +222,10 @@ export function createCustomSpreadsheet({if (balanceTypeOp === 'netDebts') {stackAmounts = netAmounts < 0 ? Math.abs(netAmounts) : 0;}- if (balanceTypeOp === 'totalTotals') {+ if (+ balanceTypeOp === 'totalTotals' ||+ balanceTypeOp === 'totalBudgeted'+ ) {stackAmounts += netAmounts;}@@ -251,7 +258,10 @@ export function createCustomSpreadsheet({totalDebts: perIntervalDebts,netAssets: perIntervalNetAssets,netDebts: perIntervalNetDebts,+ // `totalBudgeted` intentionally mirrors `totalTotals`; the difference is+ // the underlying dataset when `balanceTypeOp === 'totalBudgeted'`.totalTotals: perIntervalTotals,+ totalBudgeted: perIntervalTotals,});return arr;@@ -320,8 +330,10 @@ export function createCustomSpreadsheet({totalDebts,netAssets,netDebts,+ // `totalBudgeted` intentionally mirrors `totalTotals`; the difference is+ // the underlying dataset when `balanceTypeOp === 'totalBudgeted'`.totalTotals: totalAssets + totalDebts,+ totalBudgeted: totalAssets + totalDebts,});- setDataCheck?.(true);};}diff --git a/packages/desktop-client/src/components/reports/spreadsheets/fetchSpreadsheetQueryData.ts b/packages/desktop-client/src/components/reports/spreadsheets/fetchSpreadsheetQueryData.tsnew file mode 100644index 0000000000..26d1650d6a--- /dev/null+++ b/packages/desktop-client/src/components/reports/spreadsheets/fetchSpreadsheetQueryData.ts@@ -0,0 +1,77 @@+import type {+ balanceTypeOpType,+ CategoryEntity,+ CategoryGroupEntity,+ RuleConditionEntity,+} from 'loot-core/types/models';+import type { SyncedPrefs } from 'loot-core/types/prefs';++import { fetchBudgetData } from './budgetDataQuery';+import { makeQuery } from './makeQuery';++import type { QueryDataEntity } from '@desktop-client/components/reports/ReportOptions';+import { aqlQuery } from '@desktop-client/queries/aqlQuery';++export async function fetchSpreadsheetQueryData({+ balanceTypeOp,+ startDate,+ endDate,+ interval,+ categories,+ categoryGroups,+ conditions,+ conditionsOp,+ conditionsOpKey,+ filters,+ budgetType,+}: {+ balanceTypeOp: balanceTypeOpType | undefined;+ startDate: string;+ endDate: string;+ interval: string;+ categories: CategoryEntity[];+ categoryGroups: CategoryGroupEntity[];+ conditions: RuleConditionEntity[];+ conditionsOp: string;+ conditionsOpKey: string;+ filters: unknown[];+ budgetType?: SyncedPrefs['budgetType'];+}): Promise<{ assets: QueryDataEntity[]; debts: QueryDataEntity[] }> {+ if (balanceTypeOp === 'totalBudgeted') {+ return fetchBudgetData({+ startDate,+ endDate,+ interval,+ categories,+ categoryGroups,+ conditions,+ conditionsOp: conditionsOp === 'or' ? 'or' : 'and',+ budgetType,+ });+ }++ const [assets, debts] = await Promise.all([+ aqlQuery(+ makeQuery(+ 'assets',+ startDate,+ endDate,+ interval,+ conditionsOpKey,+ filters,+ ),+ ).then(({ data }) => data),+ aqlQuery(+ makeQuery(+ 'debts',+ startDate,+ endDate,+ interval,+ conditionsOpKey,+ filters,+ ),+ ).then(({ data }) => data),+ ]);++ return { assets, debts };+}diff --git a/packages/desktop-client/src/components/reports/spreadsheets/filterEmptyRows.ts b/packages/desktop-client/src/components/reports/spreadsheets/filterEmptyRows.tsindex 6846d7a7be..1d4d79acf2 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/filterEmptyRows.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/filterEmptyRows.ts@@ -10,11 +10,11 @@ export function filterEmptyRows({balanceTypeOp?: balanceTypeOpType;}): boolean {let showHide: boolean;- if (balanceTypeOp === 'totalTotals') {+ if (balanceTypeOp === 'totalTotals' || balanceTypeOp === 'totalBudgeted') {showHide =data['totalDebts'] !== 0 ||data['totalAssets'] !== 0 ||- data['totalTotals'] !== 0;+ data[balanceTypeOp] !== 0;} else {showHide = data[balanceTypeOp] !== 0;}diff --git a/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.tsindex 051c07d811..6d3d211afe 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts@@ -3,8 +3,8 @@ import * as monthUtils from 'loot-core/shared/months';import type { GroupedEntity } from 'loot-core/types/models';import type { createCustomSpreadsheetProps } from './custom-spreadsheet';+import { fetchSpreadsheetQueryData } from './fetchSpreadsheetQueryData';import { filterEmptyRows } from './filterEmptyRows';-import { makeQuery } from './makeQuery';import { recalculate } from './recalculate';import { sortData } from './sortData';import {@@ -18,13 +18,13 @@ import {} from '@desktop-client/components/reports/ReportOptions';import type { QueryDataEntity } from '@desktop-client/components/reports/ReportOptions';import type { useSpreadsheet } from '@desktop-client/hooks/useSpreadsheet';-import { aqlQuery } from '@desktop-client/queries/aqlQuery';export function createGroupedSpreadsheet({startDate,endDate,interval,categories,+ budgetType = 'envelope',conditions = [],conditionsOp,showEmpty,@@ -43,6 +43,7 @@ export function createGroupedSpreadsheet({setData: (data: GroupedEntity[]) => void,) => {if (categoryList.length === 0) {+ setData([]);return;}@@ -53,30 +54,22 @@ export function createGroupedSpreadsheet({let assets: QueryDataEntity[];let debts: QueryDataEntity[];- [assets, debts] = await Promise.all([- aqlQuery(- makeQuery(- 'assets',- startDate,- endDate,- interval,- conditionsOpKey,- filters,- ),- ).then(({ data }) => data),- aqlQuery(- makeQuery(- 'debts',- startDate,- endDate,- interval,- conditionsOpKey,- filters,- ),- ).then(({ data }) => data),- ]);-- if (interval === 'Weekly') {++ ({ assets, debts } = await fetchSpreadsheetQueryData({+ balanceTypeOp,+ startDate,+ endDate,+ interval,+ categories: categories.list,+ categoryGroups: categories.grouped,+ conditions,+ conditionsOp,+ conditionsOpKey,+ filters,+ budgetType,+ }));++ if (interval === 'Weekly' && balanceTypeOp !== 'totalBudgeted') {debts = debts.map(d => {return {...d,diff --git a/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts b/packages/desktop-client/src/components/reports/spreadsheets/recalculate.tsindex 0be73a5d52..6859caab94 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts@@ -85,6 +85,7 @@ export function recalculate({netAssets: intervalTotals > 0 ? intervalTotals : 0,netDebts: intervalTotals < 0 ? intervalTotals : 0,totalTotals: intervalTotals,+ totalBudgeted: intervalTotals,change,intervalStartDate: index === 0 ? startDate : intervalItem,intervalEndDate:@@ -108,6 +109,7 @@ export function recalculate({netAssets: totalTotals > 0 ? totalTotals : 0,netDebts: totalTotals < 0 ? totalTotals : 0,totalTotals,+ totalBudgeted: totalTotals,intervalData,};}diff --git a/packages/desktop-client/src/components/reports/spreadsheets/trimIntervals.ts b/packages/desktop-client/src/components/reports/spreadsheets/trimIntervals.tsindex 9191b58ee8..4fad86ef16 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/trimIntervals.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/trimIntervals.ts@@ -18,6 +18,9 @@ function isEmptyForMetric(case 'netDebts':return interval.netDebts === 0;case 'totalTotals':+ return interval.totalTotals === 0;+ case 'totalBudgeted':+ return interval.totalBudgeted === 0;default:return interval.totalTotals === 0;}diff --git a/packages/desktop-client/src/components/reports/useReport.ts b/packages/desktop-client/src/components/reports/useReport.tsindex 6e78f0fda7..e585615e75 100644--- a/packages/desktop-client/src/components/reports/useReport.ts+++ b/packages/desktop-client/src/components/reports/useReport.ts@@ -13,7 +13,21 @@ export function useReport<T>(const [results, setResults] = useState<T | null>(null);useEffect(() => {- void getData(spreadsheet, results => setResults(results));+ let didCancel = false;++ // Reset results whenever a new data function is provided so callers+ // can reliably show a loading state instead of stale/partial data.+ setResults(null);++ void getData(spreadsheet, results => {+ if (!didCancel) {+ setResults(results);+ }+ });++ return () => {+ didCancel = true;+ };}, [getData, spreadsheet]);return results;}diff --git a/packages/loot-core/src/types/models/reports.ts b/packages/loot-core/src/types/models/reports.tsindex 99ce421914..acac9b99c4 100644--- a/packages/loot-core/src/types/models/reports.ts+++ b/packages/loot-core/src/types/models/reports.ts@@ -30,7 +30,8 @@ export type balanceTypeOpType =| 'totalDebts'| 'totalTotals'| 'netAssets'- | 'netDebts';+ | 'netDebts'+ | 'totalBudgeted';export type sortByOpType = 'asc' | 'desc' | 'name' | 'budget';@@ -80,6 +81,7 @@ export type DataEntity = {netAssets: number;netDebts: number;totalTotals: number;+ totalBudgeted: number;};export type LegendEntity = {@@ -99,6 +101,7 @@ export type IntervalEntity = {netAssets: number;netDebts: number;totalTotals: number;+ totalBudgeted: number;};export type GroupedEntity = {@@ -111,6 +114,7 @@ export type GroupedEntity = {totalTotals: number;netAssets: number;netDebts: number;+ totalBudgeted: number;categories?: GroupedEntity[];};diff --git a/upcoming-release-notes/6903.md b/upcoming-release-notes/6903.mdnew file mode 100644index 0000000000..a7f7d5c73f--- /dev/null+++ b/upcoming-release-notes/6903.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [diepala]+---++Add a new budgeted type to the custom report widget.