diff --git a/packages/desktop-client/src/components/reports/Custom.js b/packages/desktop-client/src/components/reports/Custom.js index d733c0fa46c..daf2594b43b 100644 --- a/packages/desktop-client/src/components/reports/Custom.js +++ b/packages/desktop-client/src/components/reports/Custom.js @@ -291,6 +291,7 @@ export default function Custom() { interval={mode === 'time' && months} scrollWidth={scrollWidth} split={splitOptions.find(opt => opt.value === split).description} + type={type} /> opt.value === type).format} monthsCount={months.length} + type={type} /> ); @@ -332,6 +334,9 @@ export default function Custom() { if ([5, 6].includes(split)) { setSplit(1); } + if ([3].includes(type)) { + setType(1); + } } else { if (graphType === 'StackedBarGraph') { setGraphType('BarGraph'); @@ -529,7 +534,13 @@ export default function Custom() { option.value, option.description, ])} - disabledKeys={[3]} + disabledKeys={ + mode === 'time' + ? [3] + : graphType === 'BarGraph' && [1, 2, 3, 4].includes(split) + ? [3] + : [0] + } /> {/* @@ -737,6 +748,7 @@ export default function Custom() { onSelect={() => { if (mode === 'total') { onChangeGraph('BarGraph'); + [3].includes(type) && setType(1); } else { onChangeGraph('StackedBarGraph'); } @@ -763,7 +775,7 @@ export default function Custom() { selected={graphType === 'DonutGraph'} onSelect={() => { onChangeGraph('DonutGraph'); - setType(1); + //setType(1); }} style={{ marginLeft: 15 }} disabled={mode === 'total' ? false : true} diff --git a/packages/desktop-client/src/components/reports/ReportTable.tsx b/packages/desktop-client/src/components/reports/ReportTable.tsx index d112fb390ff..40a4281ab51 100644 --- a/packages/desktop-client/src/components/reports/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/ReportTable.tsx @@ -18,6 +18,8 @@ type TableRowProps = { date: string; name: string; monthData: []; + totalAssets: string; + totalDebts: string; }; typeItem?: string | null; splitItem: string; @@ -40,18 +42,23 @@ const TableRow = memo( }} > - {item.monthData && - mode === 'time' && - item.monthData.map(item => { - return ( - - ); - })} + {item.monthData && mode === 'time' + ? item.monthData.map(item => { + return ( + + ); + }) + : typeItem === 'totalTotals' && ( + <> + + + + )} - {interval && - interval.map(header => { - return ( - - ); - })} + {interval + ? interval.map(header => { + return ( + + ); + }) + : type === 3 && ( + <> + + + + )} {scrollWidth > 0 && } @@ -164,17 +177,23 @@ export function TableTotals({ }} > - {mode === 'time' && - data.monthData.map(item => { - return ( - - ); - })} + {mode === 'time' + ? data.monthData.map(item => { + return ( + + ); + }) + : typeItem === 'totalTotals' && ( + <> + + + + )} { if (typeOp === 'totalDebts') { - return -1 * obj[typeOp]; + return -1 * obj.totalDebts; } else { - return obj[typeOp]; + return obj.totalAssets; } }; @@ -168,46 +170,59 @@ function BarGraph({ }} > {(width, height, portalHost) => - data.data && ( + data[splitData] && (
{!compact &&
} - empty ? i[typeOp] !== 0 : true, - ) - : data.data.filter(i => (empty ? i[typeOp] !== 0 : true)) - } + stackOffset="sign" + data={data[splitData].filter(i => + empty ? i[typeOp] !== 0 : true, + )} margin={{ top: 0, right: 0, left: 0, bottom: 0 }} > - {compact ? null : } />} + {!compact && } />} } formatter={numberFormatterTooltip} isAnimationActive={false} /> - {compact ? null : } - {compact ? null : } - {compact ? null : } - getVal(val)}> - {data.data + {!compact && } + {!compact && } + {!compact && } + {!compact && } + getVal(val)} stackId="a"> + {data[splitData] .filter(i => (empty ? i[typeOp] !== 0 : true)) .map((entry, index) => ( ))} + {yAxis === 'date' && typeOp === 'totalTotals' && ( + + {data[splitData] + .filter(i => (empty ? i[typeOp] !== 0 : true)) + .map((entry, index) => ( + + ))} + + )}