Skip to content

Commit

Permalink
Use the total from the report instead of report action
Browse files Browse the repository at this point in the history
  • Loading branch information
youssef-lr committed Mar 8, 2025
1 parent 2d92a2d commit f05bbd1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5292,7 +5292,10 @@ function getFormattedAmount(reportAction: ReportAction, report?: Report | null)
return '';
}
const originalMessage = getOriginalMessage(reportAction);
const amount = report && isExpenseReport(report) ? (originalMessage?.amount ?? 0) * -1 : Math.abs(originalMessage?.amount ?? 0);

// Expense reports can have a negative amount and we need to display it as negative in the UI
// the amount found in originalMessage does not accurately track this so we need to use the total from the report instead
const amount = report && isExpenseReport(report) ? (report?.total ?? 0) * -1 : Math.abs(originalMessage?.amount ?? 0);
const formattedAmount = convertToDisplayString(amount, originalMessage?.currency);
return formattedAmount;
}
Expand Down

0 comments on commit f05bbd1

Please sign in to comment.