Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Display correct total #30858

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1492,15 +1492,16 @@ function getMoneyRequestSpendBreakdown(report, allReportsDict = null) {
}
if (moneyRequestReport) {
let nonReimbursableSpend = lodashGet(moneyRequestReport, 'nonReimbursableTotal', 0);
let reimbursableSpend = lodashGet(moneyRequestReport, 'total', 0);
let totalDisplaySpend = lodashGet(moneyRequestReport, 'total', 0);
let reimbursableSpend = totalDisplaySpend - nonReimbursableSpend;

if (nonReimbursableSpend + reimbursableSpend !== 0) {
if (totalDisplaySpend !== 0) {
// There is a possibility that if the Expense report has a negative total.
// This is because there are instances where you can get a credit back on your card,
// or you enter a negative expense to “offset” future expenses
nonReimbursableSpend = isExpenseReport(moneyRequestReport) ? nonReimbursableSpend * -1 : Math.abs(nonReimbursableSpend);
reimbursableSpend = isExpenseReport(moneyRequestReport) ? reimbursableSpend * -1 : Math.abs(reimbursableSpend);
const totalDisplaySpend = nonReimbursableSpend + reimbursableSpend;
totalDisplaySpend = nonReimbursableSpend + reimbursableSpend;
return {
nonReimbursableSpend,
reimbursableSpend,
Expand Down
Loading