You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Invoice - 0.00 displayed on Pay button for invoice receiver #51312
Version Number: 9.0.52-5 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail:https://expensify.testrail.io/index.php?/tests/view/5113365 Issue reported by: Applause Internal Team
@MitchExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
But for a invoice report nonReimbursableSpend is going to be equal to the totalDisplaySpend as for invoices we request the amount from the user and not ask for reimbursement. So the value goes to zero and that is what is displayed on the FE.
This causes the 0 amount error
What changes do you think we should make in order to solve the problem?
We should check if the current report is an invoice report and for that case should directly pass the totalDisplaySpend as that would be the requested invoice amount:
And then in MoneyReportView we calculate the formattedOutOfPocketAmount in the wrong way, it should be totalDisplaySpend - nonReimbursableSpend as that is what is owed for reimbursement.
Edited by proposal-police: This proposal was edited at 2024-11-04 16:27:36 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
0.00 displayed on Pay button for invoice receiver
What is the root cause of that problem?
Since the nonReimbursableTotal for invoice reports is the same as it's total, the reimbursableSpend, which is calculated from the ReportPreview.getMoneyRequestSpendBreakdown function, will be 0.
What changes do you think we should make in order to solve the problem?
Let's create a condition in the ReportPreview and MoneyReportHeader components to display the total instead of the reimbursableSpend if the report is an invoice report.
Finally, let's change how we calculate total in the getPayMoneyRequestParams function, like below, to only use the value of iouReport?.total by excluding the value of iouReport?.nonReimbursableTotal in the calculation only when if the report is an invoice report.
changed the title [-]Invoice - 0.00 displayed on Pay button for invoice receiver[/-][+][$250] Invoice - 0.00 displayed on Pay button for invoice receiver[/+]on Oct 25, 2024
Activity
melvin-bot commentedon Oct 23, 2024
Triggered auto assignment to @MitchExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.IuliiaHerets commentedon Oct 23, 2024
We think that this bug might be related to #vip-bills
IuliiaHerets commentedon Oct 23, 2024
@MitchExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
twilight2294 commentedon Oct 23, 2024
Edited by proposal-police: This proposal was edited at 2024-11-05 08:36:07 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
0.00 displayed on Pay button for invoice receiver
What is the root cause of that problem?
We get the settlement amount using
getSettlementAmount:App/src/components/ReportActionItem/ReportPreview.tsx
Line 237 in f251dbc
We get the total
reimbursableSpendto be displayed in the pay button formgetMoneyRequestSpendBreakdown:App/src/components/ReportActionItem/ReportPreview.tsx
Line 133 in f251dbc
We calculate
reimbursableSpendusing the formula:App/src/libs/ReportUtils.ts
Line 2761 in f251dbc
But for a invoice report

nonReimbursableSpendis going to be equal to thetotalDisplaySpendas for invoices we request the amount from the user and not ask for reimbursement. So the value goes to zero and that is what is displayed on theFE.This causes the 0 amount error
What changes do you think we should make in order to solve the problem?
We should check if the current report is an invoice report and for that case should directly pass the totalDisplaySpend as that would be the requested invoice amount:
We also need to update the below:
App/src/libs/actions/IOU.ts
Line 6798 in b87ec1f
To:
And then in
MoneyReportViewwe calculate theformattedOutOfPocketAmountin the wrong way, it should betotalDisplaySpend - nonReimbursableSpendas that is what is owed for reimbursement.App/src/components/ReportActionItem/MoneyReportView.tsx
Line 62 in cd3f30f
What alternative solutions did you explore? (Optional)
Or when we get settlement amount below:
App/src/components/ReportActionItem/ReportPreview.tsx
Line 535 in f251dbc
We can check if the current report is invoice and if so then call
getDisplayAmount()for that caseTony-MK commentedon Oct 23, 2024
Edited by proposal-police: This proposal was edited at 2024-11-04 16:27:36 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
0.00 displayed on Pay button for invoice receiver
What is the root cause of that problem?
Since the
nonReimbursableTotalfor invoice reports is the same as it'stotal, thereimbursableSpend, which is calculated from theReportPreview.getMoneyRequestSpendBreakdownfunction, will be0.App/src/libs/ReportUtils.ts
Lines 2760 to 2761 in 5e975f5
What changes do you think we should make in order to solve the problem?
Let's create a condition in the
ReportPreviewandMoneyReportHeadercomponents to display thetotalinstead of thereimbursableSpendif the report is an invoice report.App/src/components/ReportActionItem/ReportPreview.tsx
Line 246 in 5e975f5
App/src/components/MoneyReportHeader.tsx
Line 171 in aedbbde
Finally, let's change how we calculate
totalin thegetPayMoneyRequestParamsfunction, like below, to only use the value ofiouReport?.totalby excluding the value ofiouReport?.nonReimbursableTotalin the calculation only when if the report is an invoice report.App/src/libs/actions/IOU.ts
Line 6798 in b87ec1f
[-]Invoice - 0.00 displayed on Pay button for invoice receiver[/-][+][$250] Invoice - 0.00 displayed on Pay button for invoice receiver[/+]melvin-bot commentedon Oct 25, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021849917912281837951
MitchExpensify commentedon Oct 25, 2024
Lets fix!
80 remaining items
melvin-bot commentedon Dec 3, 2024
@NikkiWines, @MitchExpensify, @dukenv0307 Eep! 4 days overdue now. Issues have feelings too...
MitchExpensify commentedon Dec 3, 2024
@FitseTLT - Paid
@dukenv0307 - Waiting on acceptance
melvin-bot commentedon Dec 5, 2024
@NikkiWines, @MitchExpensify, @dukenv0307 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
MitchExpensify commentedon Dec 5, 2024
Still waiting for you to accept the offer here @dukenv0307 https://www.upwork.com/nx/wm/offer/105160257
dukenv0307 commentedon Dec 6, 2024
@MitchExpensify Accepted thanks!
MitchExpensify commentedon Dec 11, 2024
Paid thanks!