Skip to content

Commit edb021d

Browse files
authored
Merge pull request #77814 from Expensify/cmartins-addoriginalAmount
Add original amount
2 parents 9677483 + 871d2f0 commit edb021d

16 files changed

Lines changed: 46 additions & 3 deletions

File tree

src/CONST/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6696,6 +6696,7 @@ const CONST = {
66966696
TO: this.TABLE_COLUMNS.TO,
66976697
CATEGORY: this.TABLE_COLUMNS.CATEGORY,
66986698
TAG: this.TABLE_COLUMNS.TAG,
6699+
ORIGINAL_AMOUNT: this.TABLE_COLUMNS.ORIGINAL_AMOUNT,
66996700
REPORT_ID: this.TABLE_COLUMNS.REPORT_ID,
67006701
BASE_62_REPORT_ID: this.TABLE_COLUMNS.BASE_62_REPORT_ID,
67016702
REIMBURSABLE: this.TABLE_COLUMNS.REIMBURSABLE,
@@ -6796,6 +6797,7 @@ const CONST = {
67966797
TO: 'to',
67976798
CATEGORY: 'category',
67986799
TAG: 'tag',
6800+
ORIGINAL_AMOUNT: 'originalamount',
67996801
REIMBURSABLE: 'reimbursable',
68006802
BILLABLE: 'billable',
68016803
TOTAL_AMOUNT: 'amount',

src/components/SelectionListWithSections/SearchTableHeader.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [
8080
translationKey: 'common.tag',
8181
canBeMissing: true,
8282
},
83+
{
84+
columnName: CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT,
85+
translationKey: 'common.originalAmount',
86+
},
8387
{
8488
columnName: CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE,
8589
translationKey: 'common.reimbursable',

src/components/SelectionListWithSections/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ type TransactionListItemType = ListItem &
279279
/** final and formatted "merchant" value used for displaying and sorting */
280280
formattedMerchant: string;
281281

282+
/** The original amount of the transaction */
283+
originalAmount?: number;
284+
285+
/** The original currency of the transaction */
286+
originalCurrency?: string;
287+
282288
/** final "date" value used for sorting */
283289
date: string;
284290

src/components/TransactionItemRow/index.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import ActionCell from '@components/SelectionListWithSections/Search/ActionCell'
1111
import DateCell from '@components/SelectionListWithSections/Search/DateCell';
1212
import StatusCell from '@components/SelectionListWithSections/Search/StatusCell';
1313
import TextCell from '@components/SelectionListWithSections/Search/TextCell';
14+
import AmountCell from '@components/SelectionListWithSections/Search/TotalCell';
1415
import UserInfoCell from '@components/SelectionListWithSections/Search/UserInfoCell';
1516
import Text from '@components/Text';
1617
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
@@ -21,11 +22,13 @@ import useTheme from '@hooks/useTheme';
2122
import useThemeStyles from '@hooks/useThemeStyles';
2223
import {isCategoryMissing} from '@libs/CategoryUtils';
2324
import getBase62ReportID from '@libs/getBase62ReportID';
24-
import {isSettled} from '@libs/ReportUtils';
25+
import {isExpenseReport, isSettled} from '@libs/ReportUtils';
2526
import StringUtils from '@libs/StringUtils';
2627
import {
2728
getDescription,
2829
getMerchant,
30+
getOriginalAmount,
31+
getOriginalCurrency,
2932
getCreated as getTransactionCreated,
3033
hasMissingSmartscanFields,
3134
isAmountMissing,
@@ -430,6 +433,17 @@ function TransactionItemRow({
430433
/>
431434
</View>
432435
),
436+
[CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT]: (
437+
<View
438+
key={CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT}
439+
style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT, undefined, isAmountColumnWide)]}
440+
>
441+
<AmountCell
442+
total={isExpenseReport(transactionItem.report) ? -(transactionItem.originalAmount ?? 0) : getOriginalAmount(transactionItem)}
443+
currency={getOriginalCurrency(transactionItem)}
444+
/>
445+
</View>
446+
),
433447
[CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: (
434448
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.REPORT_ID)]}>
435449
<TextCell text={transactionItem.reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? '' : transactionItem.reportID} />

src/languages/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ const translations: TranslationDeepObject<typeof en> = {
691691
actionRequired: 'Aktion erforderlich',
692692
duplicate: 'Duplizieren',
693693
duplicated: 'Dupliziert',
694+
originalAmount: 'Ursprünglicher Betrag',
694695
},
695696
supportalNoAccess: {
696697
title: 'Nicht so schnell',

src/languages/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ const translations = {
671671
unstableInternetConnection: 'Unstable internet connection. Please check your network and try again.',
672672
enableGlobalReimbursements: 'Enable Global Reimbursements',
673673
purchaseAmount: 'Purchase amount',
674+
originalAmount: 'Original amount',
674675
frequency: 'Frequency',
675676
link: 'Link',
676677
pinned: 'Pinned',

src/languages/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ const translations: TranslationDeepObject<typeof en> = {
367367
unstableInternetConnection: 'Conexión a internet inestable. Por favor, revisa tu red e inténtalo de nuevo.',
368368
enableGlobalReimbursements: 'Habilitar Reembolsos Globales',
369369
purchaseAmount: 'Importe de compra',
370+
originalAmount: 'Importe original',
370371
frequency: 'Frecuencia',
371372
link: 'Enlace',
372373
pinned: 'Fijado',

src/languages/fr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ const translations: TranslationDeepObject<typeof en> = {
693693
actionRequired: 'Action requise',
694694
duplicate: 'Dupliquer',
695695
duplicated: 'Dupliqué',
696+
originalAmount: 'Montant d’origine',
696697
},
697698
supportalNoAccess: {
698699
title: 'Pas si vite',

src/languages/it.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ const translations: TranslationDeepObject<typeof en> = {
692692
actionRequired: 'Azione richiesta',
693693
duplicate: 'Duplica',
694694
duplicated: 'Duplicato',
695+
originalAmount: 'Importo originale',
695696
},
696697
supportalNoAccess: {
697698
title: 'Non così in fretta',

src/languages/ja.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ const translations: TranslationDeepObject<typeof en> = {
691691
actionRequired: '対応が必要',
692692
duplicate: '複製',
693693
duplicated: '重複',
694+
originalAmount: '元の金額',
694695
},
695696
supportalNoAccess: {
696697
title: 'ちょっと待ってください',

0 commit comments

Comments
 (0)