Skip to content

[NO QA] Add Amount debited and Amount reimbursed filters, columns and sorting - #97708

Draft
ishpaul777 wants to merge 29 commits into
Expensify:mainfrom
ishpaul777:ishpaul/655933-fx-filters-and-columns
Draft

[NO QA] Add Amount debited and Amount reimbursed filters, columns and sorting#97708
ishpaul777 wants to merge 29 commits into
Expensify:mainfrom
ishpaul777:ishpaul/655933-fx-filters-and-columns

Conversation

@ishpaul777

@ishpaul777 ishpaul777 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

A cross-border reimbursement moves two amounts: the company is debited in the currency it settles in, and the employee is credited in the currency of their deposit account. #97167 shows those on withdrawal groups in the reconciliation dashboard. This adds them as filters and as columns on expense reports.

  • Two new numeric filters, Amount debited and Amount reimbursed, sitting next to Total and behaving like it: equal to, greater than, less than, and a range. Query syntax is amountDebited / amountReimbursed, with amount-debited / amount-reimbursed as the readable form used in saved searches and URLs.
  • Two new optional columns of the same names in the expense report view, each rendered in the currency stored alongside its amount rather than the report's own currency, and each sortable by clicking its header or picking it from Sort by.

Decisions worth a look:

  • A column is hidden unless a loaded row carries both the amount and its currency, so a workspace that never pays across borders does not gain two permanently empty columns. Amounts are never displayed without their currency, since the two sides are denominated differently and neither matches the row's own currency.
  • Sorting ranks the amounts as recorded, without converting between currencies, which is what the backend does and what Total already does. So a report settled in one currency can rank above a report worth more in another, and reports with no conversion sort first ascending and last descending.
  • A column that is being sorted by stays visible even when nothing on the page fills it. Ascending puts the reports without that amount first, so a first page of domestic reports would otherwise drop the column and take both its header and its Sort by entry with it, leaving the sort applied with no way to change it.
  • The new keys are placed ahead of amount in the parser grammar, otherwise amount matches first and swallows amountDebited as amount followed by stray text.
  • Neither the filters nor the columns are offered on an expense search. A payment pays a whole report, so an expense has no amount of its own on either side, and a per-expense column would repeat its report's conversion on every row next to that expense's own amount, reading as though the expense itself had been converted. This matches total, which is also absent from the expense filter menu.

Needs Expensify/Auth#23431, which accepts the two filter keys and the two sort keys. Stacked on #97167, so only eleven commits belong to this PR, and one of those - "Restore the currency formatter the cross-border payment messages use" - is the same fix as #97723, carried here only so this branch can typecheck until that lands on main.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/655933
PROPOSAL: N/A, internal

Tests

Requires a workspace whose reports were paid with a currency conversion, since Auth records these amounts on the payment. Locally that means a workspace on a Corpay withdrawal account paying a member whose deposit account is in another currency, with at least one report left unconverted for comparison.

  1. Open Search and switch the type to Expense reports.
  2. Open the filters, confirm Amount debited and Amount reimbursed appear next to Total, and set Amount debited to equal to the debited amount of one of the converted reports.
  3. Verify only that report is returned, and that the readable query in the search bar reads amount-debited:<value>.
  4. Change the filter to greater than a value between the two converted reports. Verify only the larger one is returned, and that the report which was never paid across borders is returned by neither.
  5. Repeat steps 2 to 4 with Amount reimbursed. Verify it ranks the reports independently of Amount debited, since the two sides are in different currencies.
  6. Open the column picker and enable Amount debited and Amount reimbursed. Verify each converted report shows its amount in its own currency, and that the report that was never converted shows blank cells rather than a zero.
  7. Click the Amount debited header. Verify the reports reorder by that amount, that clicking again reverses them, and that the report which was never converted sits at the top ascending and the bottom descending. Repeat on Amount reimbursed and verify it produces a different order, since the two sides are in different currencies.
  8. With Amount debited as the active sort, narrow the search so the page holds only reports that were never converted. Verify the column and its header stay put rather than disappearing, and that Sort by still lists it so the sort can be changed.
  9. Switch the type to Expenses. Verify neither filter is offered in the filter menu and neither column is offered in the column picker, and that switching type with either filter applied drops it from the query rather than sending it to the server.
  10. Open a workspace that has never paid across borders. Verify neither column appears in the picker, so no empty columns are added.
  11. Type amountDebited:100 directly into the search bar and verify it parses as a filter chip rather than as free text, then reload the page and verify the filter survives in the URL.
  • Verify that no errors appear in the JS console

Offline tests

Search results come from the server, so with no connection the list keeps showing the last loaded results. Applying either filter offline shows the offline indicator and no results change until the connection returns, the same as every other search filter. Column selection is local, so enabling or disabling the two columns works offline against already-loaded rows.

QA Steps

Same as Tests, on a workspace configured for global reimbursement whose reports have been paid across borders.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

ishpaul777 and others added 21 commits July 28, 2026 04:44
SortableTableHeader only makes a header pressable when isColumnSortable
is set, so without it the columns rendered as plain labels and the sort
Auth supports could not be reached.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
getSortedData re-sorts the page by the mapped property, which for these
two columns is a raw amount in whichever currency that settlement used.
Ranking GBP 10250 against USD 12000 that way puts them in the wrong
order. Unmapped columns fall through with the data untouched, which is
the order Auth already computed from a common-currency sort key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
typecheck and TranslateTest both fail on a key that only exists in
en.ts. The generateTranslations bot skips pull requests from forks, so
these are written by hand.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The list is built at module scope, so the name resolves the moment the
file loads and grouping by category throws instead of rendering.
The helper answered "does this column have data" for every column,
which read as a double negative for the ones it knows nothing about.
Bail out on a transaction array first, then ask the question only of
the two conversion columns, matching the expense report branch above.
The server communicates its order through orderedKeys, which the client
never reads, so a column with no sorting property leaves the rows in the
order the response object happened to be keyed in and clicking the
header does nothing. Point both columns at their amount, the way the
total column already works.
Sorting ascending puts the groups without that amount first, so an all-domestic
first page would drop the column, taking the header and the Sort by option with it.
The new keys precede amount in the grammar so it cannot match them first.
@melvin-bot

melvin-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
.../components/Search/FilterDropdowns/SortByPopup.tsx 3.03% <ø> (ø)
src/components/Search/hooks/useSearchSnapshot.ts 87.64% <ø> (ø)
src/hooks/useAdvancedSearchFilters.ts 97.50% <ø> (ø)
src/hooks/useSearchOverlay.tsx 55.88% <ø> (ø)
src/libs/DebugUtils.ts 69.07% <100.00%> (+0.25%) ⬆️
src/libs/ReportActionsUtils.ts 78.60% <ø> (ø)
src/libs/ReportUtils.ts 86.70% <100.00%> (ø)
src/libs/SearchAutocompleteUtils.ts 62.08% <100.00%> (+0.42%) ⬆️
src/libs/SearchQueryUtils.ts 87.35% <100.00%> (+0.05%) ⬆️
... and 11 more
... and 10 files with indirect coverage changes

@ishpaul777 ishpaul777 changed the title Add Amount debited and Amount reimbursed filters and columns [NO QA]Add Amount debited and Amount reimbursed filters and columns Aug 3, 2026
Sorting ascending puts the reports without that amount first, so an all-domestic
first page would drop the column, taking the header and the Sort by option with it.
The currency list refactor removed the bare convertToDisplayString these three
call sites relied on, leaving main unable to typecheck.
@ishpaul777 ishpaul777 changed the title [NO QA]Add Amount debited and Amount reimbursed filters and columns [NO QA] Add Amount debited and Amount reimbursed filters, columns and sorting Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant