From d60af224715b716adde8a5020a2c57faedc6ca47 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 14:27:54 -0700 Subject: [PATCH 01/11] fix 78021 --- src/pages/iou/MoneyRequestAmountForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/MoneyRequestAmountForm.tsx b/src/pages/iou/MoneyRequestAmountForm.tsx index 50c2cfd7e6571..9bb0f505b92ee 100644 --- a/src/pages/iou/MoneyRequestAmountForm.tsx +++ b/src/pages/iou/MoneyRequestAmountForm.tsx @@ -139,7 +139,7 @@ function MoneyRequestAmountForm({ */ const submitAndNavigateToNextPage = useCallback( (iouPaymentType?: PaymentMethodType | undefined) => { - const isTaxAmountForm = Navigation.getActiveRoute().includes('taxAmount'); + const isTaxAmountForm = Navigation.getActiveRouteWithoutParams().includes('taxAmount'); // Skip the check for tax amount form as 0 is a valid input const currentAmount = moneyRequestAmountInputRef.current?.getNumber() ?? ''; From 4397c69c1c54162500cfa961148d055651e771e1 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 15:25:21 -0700 Subject: [PATCH 02/11] fix 78026 --- src/components/TransactionItemRow/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index a495ee95300b6..9ac56748e6918 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -504,7 +504,8 @@ function TransactionItemRow({ style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT, undefined, isAmountColumnWide)]} > From 0527da2162d5dbf0a94e13ad8e08c6d453f425ee Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 15:34:47 -0700 Subject: [PATCH 03/11] add computed name --- src/components/TransactionItemRow/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 9ac56748e6918..86d11387756e7 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -18,6 +18,7 @@ import Text from '@components/Text'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import {computeReportName} from '@libs/ReportNameUtils'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -550,7 +551,7 @@ function TransactionItemRow({ [CONST.SEARCH.TABLE_COLUMNS.TITLE]: ( From dcc449587a53440a7f3a48f46bfd4766ca3e8b44 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 15:39:20 -0700 Subject: [PATCH 04/11] fix prettier --- src/components/TransactionItemRow/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 86d11387756e7..e12dc3e741194 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -18,12 +18,12 @@ import Text from '@components/Text'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import {computeReportName} from '@libs/ReportNameUtils'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {isCategoryMissing} from '@libs/CategoryUtils'; import getBase62ReportID from '@libs/getBase62ReportID'; +import {computeReportName} from '@libs/ReportNameUtils'; import {isExpenseReport, isSettled} from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; import { @@ -506,7 +506,11 @@ function TransactionItemRow({ > From 1a5fd299c6918636ce2d05dc73e8612ce7ef531f Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 16:04:42 -0700 Subject: [PATCH 05/11] fix 78042 --- src/components/TransactionItemRow/index.tsx | 19 ++----------------- src/libs/SearchUIUtils.ts | 5 +++-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index e12dc3e741194..e9268c4f657a5 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -38,6 +38,7 @@ import { isMerchantMissing, isScanning, isUnreportedAndHasInvalidDistanceRateTransaction, + getTaxName, } from '@libs/TransactionUtils'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; @@ -202,21 +203,6 @@ function TransactionItemRow({ const merchant = useMemo(() => getMerchantName(transactionItem, translate), [transactionItem, translate]); const description = getDescription(transactionItem); - const formattedTaxRate = useMemo(() => { - const taxRateName = transactionItem?.policy?.taxRates?.taxes?.[transactionItem.taxCode ?? '']?.name ?? ''; - const taxRateValue = transactionItem?.policy?.taxRates?.taxes?.[transactionItem.taxCode ?? '']?.value ?? ''; - - if (!taxRateName && !taxRateValue) { - return ''; - } - - if (!taxRateValue) { - return taxRateName; - } - - return `${taxRateName} (${taxRateValue})`; - }, [transactionItem?.policy?.taxRates?.taxes, transactionItem.taxCode]); - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const merchantOrDescription = merchant || description; @@ -530,7 +516,7 @@ function TransactionItemRow({ key={CONST.SEARCH.TABLE_COLUMNS.TAX_RATE} style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TAX_RATE)]} > - + ), [CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: ( @@ -595,7 +581,6 @@ function TransactionItemRow({ isInSingleTransactionReport, exchangeRateMessage, isAmountColumnWide, - formattedTaxRate, isTaxAmountColumnWide, isLargeScreenWidth, ], diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 38d07b3e3a9ea..3fb767113222f 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -127,6 +127,7 @@ import { isPending, isScanning, isViolationDismissed, + getTaxName, } from './TransactionUtils'; import ViolationsUtils from './Violations/ViolationsUtils'; @@ -2232,8 +2233,8 @@ function getSortedTransactionData( if (sortBy === CONST.SEARCH.TABLE_COLUMNS.TAX_RATE) { return data.sort((a, b) => { - const aValue = `${a.policy?.taxRates?.taxes?.[a.taxCode ?? '']?.name ?? ''} (${a.policy?.taxRates?.taxes?.[a.taxCode ?? '']?.value ?? ''})`; - const bValue = `${b.policy?.taxRates?.taxes?.[b.taxCode ?? '']?.name ?? ''} (${b.policy?.taxRates?.taxes?.[b.taxCode ?? '']?.value ?? ''})`; + const aValue = getTaxName(a.policy, a); + const bValue = getTaxName(b.policy, b); return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); }); } From 572a5e1d06c477e0192045e7ab1ec0f347a25164 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 17:00:04 -0700 Subject: [PATCH 06/11] fix scan amounts; --- src/components/TransactionItemRow/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index e9268c4f657a5..cc86e3c05b032 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -491,11 +491,11 @@ function TransactionItemRow({ style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT, undefined, isAmountColumnWide)]} > From 20bd36b49b470ce0f53ada737a5a9e3e7c77af4a Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 18:19:53 -0700 Subject: [PATCH 07/11] fix 78072 --- src/CONST/index.ts | 1 + .../Search/TransactionGroupListExpanded.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index de9d7aca301aa..bb5afb7bc227b 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6843,6 +6843,7 @@ const CONST = { COMPLETED: 'completed', }, }, + GROUP_COLUMN_PREFIX: 'group', TABLE_COLUMNS: { RECEIPT: 'receipt', DATE: 'date', diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx index 7bd6344f44387..8c0dd8800be09 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx @@ -174,7 +174,7 @@ function TransactionGroupListExpanded({ openReportInRHP(transaction); }; - const minTableWidth = getTableMinWidth(columns ?? []); + const minTableWidth = getTableMinWidth(currentColumns.filter((column) => !column.startsWith(CONST.SEARCH.GROUP_COLUMN_PREFIX)) ?? []); const shouldScrollHorizontally = isLargeScreenWidth && minTableWidth > windowWidth; const content = ( From 6c3a1749754c8fe6f5460900fa267fa31d8caf97 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 18:27:31 -0700 Subject: [PATCH 08/11] update sorting function --- src/libs/SearchUIUtils.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 056754677e4c5..33b152b6bc109 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -119,6 +119,7 @@ import { getCategory, getDescription, getExchangeRate, + getOriginalAmount, getTag, getTaxAmount, getAmount as getTransactionAmount, @@ -2247,6 +2248,22 @@ function getSortedTransactionData( }); } + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT) { + return data.sort((a, b) => { + const aIsExpenseReport = a.report?.type === CONST.REPORT.TYPE.EXPENSE; + const bIsExpenseReport = b.report?.type === CONST.REPORT.TYPE.EXPENSE; + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ + const aValue = aIsExpenseReport + ? -((a.originalAmount || a.amount || a.modifiedAmount) ?? 0) + : getOriginalAmount(a) || Math.abs(a.amount ?? 0) || Math.abs(a.modifiedAmount ?? 0); + const bValue = bIsExpenseReport + ? -((b.originalAmount || b.amount || b.modifiedAmount) ?? 0) + : getOriginalAmount(b) || Math.abs(b.amount ?? 0) || Math.abs(b.modifiedAmount ?? 0); + /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */ + return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare, true); + }); + } + if (!sortingProperty) { return data; } From 555908c263209adbd00b3e3f4990fd2486dbc728 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 18:30:55 -0700 Subject: [PATCH 09/11] dry code --- src/components/TransactionItemRow/index.tsx | 9 ++------- src/libs/SearchUIUtils.ts | 14 +++----------- src/libs/TransactionUtils/index.ts | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index a522558693799..33b9c420b0c1f 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -31,7 +31,7 @@ import { getDescription, getExchangeRate, getMerchant, - getOriginalAmount, + getOriginalAmountForDisplay, getOriginalCurrency, getCreated as getTransactionCreated, hasMissingSmartscanFields, @@ -492,12 +492,7 @@ function TransactionItemRow({ style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT, undefined, isAmountColumnWide)]} > diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 33b152b6bc109..9468fed36e3a3 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -119,7 +119,7 @@ import { getCategory, getDescription, getExchangeRate, - getOriginalAmount, + getOriginalAmountForDisplay, getTag, getTaxAmount, getAmount as getTransactionAmount, @@ -2250,16 +2250,8 @@ function getSortedTransactionData( if (sortBy === CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT) { return data.sort((a, b) => { - const aIsExpenseReport = a.report?.type === CONST.REPORT.TYPE.EXPENSE; - const bIsExpenseReport = b.report?.type === CONST.REPORT.TYPE.EXPENSE; - /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ - const aValue = aIsExpenseReport - ? -((a.originalAmount || a.amount || a.modifiedAmount) ?? 0) - : getOriginalAmount(a) || Math.abs(a.amount ?? 0) || Math.abs(a.modifiedAmount ?? 0); - const bValue = bIsExpenseReport - ? -((b.originalAmount || b.amount || b.modifiedAmount) ?? 0) - : getOriginalAmount(b) || Math.abs(b.amount ?? 0) || Math.abs(b.modifiedAmount ?? 0); - /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */ + const aValue = getOriginalAmountForDisplay(a, a.report?.type === CONST.REPORT.TYPE.EXPENSE); + const bValue = getOriginalAmountForDisplay(b, b.report?.type === CONST.REPORT.TYPE.EXPENSE); return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare, true); }); } diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts index b52233516379b..4d54712cfc44e 100644 --- a/src/libs/TransactionUtils/index.ts +++ b/src/libs/TransactionUtils/index.ts @@ -843,6 +843,20 @@ function getOriginalAmount(transaction: Transaction): number { return Math.abs(amount); } +/** + * Return the original amount for display/sorting purposes. + * For expense reports, returns the negated value of (originalAmount || amount || modifiedAmount). + * For non-expense reports, returns getOriginalAmount() or Math.abs(amount) or Math.abs(modifiedAmount). + */ +function getOriginalAmountForDisplay(transaction: Pick, isExpenseReport: boolean): number { + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ + if (isExpenseReport) { + return -((transaction.originalAmount || transaction.amount || transaction.modifiedAmount) ?? 0); + } + return getOriginalAmount(transaction as Transaction) || Math.abs(transaction.amount ?? 0) || Math.abs(transaction.modifiedAmount ?? 0); + /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */ +} + /** * Verify if the transaction is expecting the distance to be calculated on the server */ @@ -2428,6 +2442,7 @@ export { getReportOwnerAsAttendee, getExchangeRate, shouldReuseInitialTransaction, + getOriginalAmountForDisplay, }; export type {TransactionChanges}; From db51500c71eb8445c5120319a848329be8d0307b Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 18 Dec 2025 19:03:41 -0700 Subject: [PATCH 10/11] fix prettier --- src/components/TransactionItemRow/index.tsx | 2 +- src/libs/SearchUIUtils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 33b9c420b0c1f..bbb4bdd90a9d6 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -33,13 +33,13 @@ import { getMerchant, getOriginalAmountForDisplay, getOriginalCurrency, + getTaxName, getCreated as getTransactionCreated, hasMissingSmartscanFields, isAmountMissing, isMerchantMissing, isScanning, isUnreportedAndHasInvalidDistanceRateTransaction, - getTaxName, } from '@libs/TransactionUtils'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 9468fed36e3a3..ada5a6dfa22bc 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -122,13 +122,13 @@ import { getOriginalAmountForDisplay, getTag, getTaxAmount, + getTaxName, getAmount as getTransactionAmount, getCreated as getTransactionCreatedDate, getMerchant as getTransactionMerchant, isPending, isScanning, isViolationDismissed, - getTaxName, } from './TransactionUtils'; import ViolationsUtils from './Violations/ViolationsUtils'; From c05b8057acd145da6b0d9fd6a5dc5cc2a0b78305 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 19 Dec 2025 08:20:35 -0700 Subject: [PATCH 11/11] fix originalAmount currency --- src/components/TransactionItemRow/index.tsx | 4 ++-- src/libs/TransactionUtils/index.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index bbb4bdd90a9d6..26d47a3a5fa51 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -32,7 +32,7 @@ import { getExchangeRate, getMerchant, getOriginalAmountForDisplay, - getOriginalCurrency, + getOriginalCurrencyForDisplay, getTaxName, getCreated as getTransactionCreated, hasMissingSmartscanFields, @@ -493,7 +493,7 @@ function TransactionItemRow({ > ), diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts index 4d54712cfc44e..67dee434e129a 100644 --- a/src/libs/TransactionUtils/index.ts +++ b/src/libs/TransactionUtils/index.ts @@ -857,6 +857,15 @@ function getOriginalAmountForDisplay(transaction: Pick): string { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + return transaction.originalCurrency || (transaction.amount === 0 ? transaction.modifiedCurrency : transaction.currency) || CONST.CURRENCY.USD; +} + /** * Verify if the transaction is expecting the distance to be calculated on the server */ @@ -2443,6 +2452,7 @@ export { getExchangeRate, shouldReuseInitialTransaction, getOriginalAmountForDisplay, + getOriginalCurrencyForDisplay, }; export type {TransactionChanges};