Skip to content

Commit

Permalink
Merge pull request #44227 from nkdengineer/fix/43990
Browse files Browse the repository at this point in the history
fix: Total amount for the report in Shared is -0.00
  • Loading branch information
arosiclair authored Jun 25, 2024
2 parents d055598 + fe3bb0b commit 8243931
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/SelectionList/Search/ReportListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ type ReportCellProps = {
function TotalCell({showTooltip, isLargeScreenWidth, reportItem}: ReportCellProps) {
const styles = useThemeStyles();

let total = reportItem?.total ?? 0;

// Only invert non-zero values otherwise we'll end up with -0.00
if (total) {
total *= reportItem?.type === CONST.REPORT.TYPE.EXPENSE ? -1 : 1;
}

return (
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={CurrencyUtils.convertToDisplayString((reportItem?.type === CONST.REPORT.TYPE.EXPENSE ? -1 : 1) * (reportItem?.total ?? 0), reportItem?.currency)}
text={CurrencyUtils.convertToDisplayString(total, reportItem?.currency)}
style={[styles.optionDisplayName, styles.textNormal, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : styles.textAlignRight]}
/>
);
Expand Down

0 comments on commit 8243931

Please sign in to comment.