diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 643d2a341ec2..0974a9b1df66 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6696,6 +6696,7 @@ const CONST = { TO: this.TABLE_COLUMNS.TO, CATEGORY: this.TABLE_COLUMNS.CATEGORY, TAG: this.TABLE_COLUMNS.TAG, + ORIGINAL_AMOUNT: this.TABLE_COLUMNS.ORIGINAL_AMOUNT, REPORT_ID: this.TABLE_COLUMNS.REPORT_ID, BASE_62_REPORT_ID: this.TABLE_COLUMNS.BASE_62_REPORT_ID, REIMBURSABLE: this.TABLE_COLUMNS.REIMBURSABLE, @@ -6796,6 +6797,7 @@ const CONST = { TO: 'to', CATEGORY: 'category', TAG: 'tag', + ORIGINAL_AMOUNT: 'originalamount', REIMBURSABLE: 'reimbursable', BILLABLE: 'billable', TOTAL_AMOUNT: 'amount', diff --git a/src/components/SelectionListWithSections/SearchTableHeader.tsx b/src/components/SelectionListWithSections/SearchTableHeader.tsx index 460b78723457..969777397f3e 100644 --- a/src/components/SelectionListWithSections/SearchTableHeader.tsx +++ b/src/components/SelectionListWithSections/SearchTableHeader.tsx @@ -80,6 +80,10 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [ translationKey: 'common.tag', canBeMissing: true, }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT, + translationKey: 'common.originalAmount', + }, { columnName: CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE, translationKey: 'common.reimbursable', diff --git a/src/components/SelectionListWithSections/types.ts b/src/components/SelectionListWithSections/types.ts index 6f9e89a728ec..c8d81ace7663 100644 --- a/src/components/SelectionListWithSections/types.ts +++ b/src/components/SelectionListWithSections/types.ts @@ -279,6 +279,12 @@ type TransactionListItemType = ListItem & /** final and formatted "merchant" value used for displaying and sorting */ formattedMerchant: string; + /** The original amount of the transaction */ + originalAmount?: number; + + /** The original currency of the transaction */ + originalCurrency?: string; + /** final "date" value used for sorting */ date: string; diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 79bfe14aeecd..0b7cd7a70acd 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -11,6 +11,7 @@ import ActionCell from '@components/SelectionListWithSections/Search/ActionCell' import DateCell from '@components/SelectionListWithSections/Search/DateCell'; import StatusCell from '@components/SelectionListWithSections/Search/StatusCell'; import TextCell from '@components/SelectionListWithSections/Search/TextCell'; +import AmountCell from '@components/SelectionListWithSections/Search/TotalCell'; import UserInfoCell from '@components/SelectionListWithSections/Search/UserInfoCell'; import Text from '@components/Text'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; @@ -21,11 +22,13 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {isCategoryMissing} from '@libs/CategoryUtils'; import getBase62ReportID from '@libs/getBase62ReportID'; -import {isSettled} from '@libs/ReportUtils'; +import {isExpenseReport, isSettled} from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; import { getDescription, getMerchant, + getOriginalAmount, + getOriginalCurrency, getCreated as getTransactionCreated, hasMissingSmartscanFields, isAmountMissing, @@ -430,6 +433,17 @@ function TransactionItemRow({ /> ), + [CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: ( + + + + ), [CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: ( diff --git a/src/languages/de.ts b/src/languages/de.ts index 094779da5c67..11ea557cc4b1 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -691,6 +691,7 @@ const translations: TranslationDeepObject = { actionRequired: 'Aktion erforderlich', duplicate: 'Duplizieren', duplicated: 'Dupliziert', + originalAmount: 'Ursprünglicher Betrag', }, supportalNoAccess: { title: 'Nicht so schnell', diff --git a/src/languages/en.ts b/src/languages/en.ts index 03fe8b9c961a..4e066996ef40 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -671,6 +671,7 @@ const translations = { unstableInternetConnection: 'Unstable internet connection. Please check your network and try again.', enableGlobalReimbursements: 'Enable Global Reimbursements', purchaseAmount: 'Purchase amount', + originalAmount: 'Original amount', frequency: 'Frequency', link: 'Link', pinned: 'Pinned', diff --git a/src/languages/es.ts b/src/languages/es.ts index 52c73efba25e..db394e8c1d6c 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -367,6 +367,7 @@ const translations: TranslationDeepObject = { unstableInternetConnection: 'Conexión a internet inestable. Por favor, revisa tu red e inténtalo de nuevo.', enableGlobalReimbursements: 'Habilitar Reembolsos Globales', purchaseAmount: 'Importe de compra', + originalAmount: 'Importe original', frequency: 'Frecuencia', link: 'Enlace', pinned: 'Fijado', diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 96296b391b80..228cc1d77df9 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -693,6 +693,7 @@ const translations: TranslationDeepObject = { actionRequired: 'Action requise', duplicate: 'Dupliquer', duplicated: 'Dupliqué', + originalAmount: 'Montant d’origine', }, supportalNoAccess: { title: 'Pas si vite', diff --git a/src/languages/it.ts b/src/languages/it.ts index 477a80f18091..08e81c60b83c 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -692,6 +692,7 @@ const translations: TranslationDeepObject = { actionRequired: 'Azione richiesta', duplicate: 'Duplica', duplicated: 'Duplicato', + originalAmount: 'Importo originale', }, supportalNoAccess: { title: 'Non così in fretta', diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 629c5c140935..cee72afb1a1f 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -691,6 +691,7 @@ const translations: TranslationDeepObject = { actionRequired: '対応が必要', duplicate: '複製', duplicated: '重複', + originalAmount: '元の金額', }, supportalNoAccess: { title: 'ちょっと待ってください', diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 9d421cb3df38..5a2fdd37da77 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -692,6 +692,7 @@ const translations: TranslationDeepObject = { actionRequired: 'Actie vereist', duplicate: 'Dupliceren', duplicated: 'Gedupliceerd', + originalAmount: 'Oorspronkelijk bedrag', }, supportalNoAccess: { title: 'Niet zo snel', diff --git a/src/languages/pl.ts b/src/languages/pl.ts index b96a188529bb..2096d6b67a07 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -692,6 +692,7 @@ const translations: TranslationDeepObject = { actionRequired: 'Wymagane działanie', duplicate: 'Duplikat', duplicated: 'Zduplikowano', + originalAmount: 'Kwota pierwotna', }, supportalNoAccess: { title: 'Nie tak szybko', diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index 278569275647..ac5c33c748b3 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -691,6 +691,7 @@ const translations: TranslationDeepObject = { actionRequired: 'Ação necessária', duplicate: 'Duplicar', duplicated: 'Duplicado', + originalAmount: 'Valor original', }, supportalNoAccess: { title: 'Não tão rápido', diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index cde1f8c2f80e..2e968ee08663 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -688,6 +688,7 @@ const translations: TranslationDeepObject = { actionRequired: '需要操作', duplicate: '复制', duplicated: '已重复', + originalAmount: '原始金额', }, supportalNoAccess: { title: '先别急', diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index ddaf1598d739..ef8d7e439db6 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -145,6 +145,7 @@ const transactionColumnNamesToSortingProperty: TransactionSorting = { [CONST.SEARCH.TABLE_COLUMNS.MERCHANT]: 'formattedMerchant' as const, [CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT]: 'formattedTotal' as const, [CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: 'category' as const, + [CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: 'originalAmount' as const, [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: 'reimbursable' as const, [CONST.SEARCH.TABLE_COLUMNS.BILLABLE]: 'billable' as const, [CONST.SEARCH.TABLE_COLUMNS.TYPE]: null, @@ -1999,8 +2000,10 @@ function compareValues(a: unknown, b: unknown, sortOrder: SortOrder, sortBy: str } if (typeof a === 'number' && typeof b === 'number') { - const aValue = sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT && !shouldCompareOriginalValue ? Math.abs(a) : a; - const bValue = sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT && !shouldCompareOriginalValue ? Math.abs(b) : b; + const aValue = + (sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT || sortBy.toLowerCase() === CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT) && !shouldCompareOriginalValue ? Math.abs(a) : a; + const bValue = + (sortBy === CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT || sortBy.toLowerCase() === CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT) && !shouldCompareOriginalValue ? Math.abs(b) : b; return isAsc ? aValue - bValue : bValue - aValue; } @@ -2303,6 +2306,8 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla return 'common.receipt'; case CONST.SEARCH.TABLE_COLUMNS.TAG: return 'common.tag'; + case CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT: + return 'common.originalAmount'; case CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE: return 'common.reimbursable'; case CONST.SEARCH.TABLE_COLUMNS.BILLABLE: @@ -2781,6 +2786,7 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: false, [CONST.SEARCH.TABLE_COLUMNS.BILLABLE]: false, [CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: false, + [CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: false, [CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT]: true, [CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID]: false, [CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: false, diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index cf2c98c9f2ee..1cf3a8a0d344 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1764,6 +1764,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ case CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT: columnWidth = {...getWidthStyle(isTaxAmountColumnWide ? variables.w130 : variables.w96), ...styles.alignItemsEnd}; break; + case CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT: case CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT: case CONST.SEARCH.TABLE_COLUMNS.TOTAL: columnWidth = {...getWidthStyle(isAmountColumnWide ? variables.w130 : variables.w96), ...styles.flex1, ...styles.alignItemsEnd};