diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 71ab52c96754..eb408a6b85e3 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6722,6 +6722,8 @@ const CONST = { TITLE: this.TABLE_COLUMNS.TITLE, FROM: this.TABLE_COLUMNS.FROM, TO: this.TABLE_COLUMNS.TO, + REIMBURSABLE_TOTAL: this.TABLE_COLUMNS.REIMBURSABLE_TOTAL, + NON_REIMBURSABLE_TOTAL: this.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL, REPORT_ID: this.TABLE_COLUMNS.REPORT_ID, BASE_62_REPORT_ID: this.TABLE_COLUMNS.BASE_62_REPORT_ID, ACTION: this.TABLE_COLUMNS.ACTION, @@ -6826,6 +6828,8 @@ const CONST = { REPORT_ID: 'reportID', BASE_62_REPORT_ID: 'base62ReportID', TAX: 'tax', + REIMBURSABLE_TOTAL: 'reimbursableTotal', + NON_REIMBURSABLE_TOTAL: 'nonReimbursableTotal', }, SYNTAX_OPERATORS: { AND: 'and', diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index 28faa0dc1e88..9e4c1fe29e45 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -79,6 +79,9 @@ function ExpenseReportListItemRow({ return {total: reportTotal, currency: reportCurrency}; }, [item.type, item.total, item.currency]); + const nonReimbursableTotal = item.nonReimbursableTotal ?? 0; + const reimbursableTotal = total - nonReimbursableTotal; + const columnComponents = { [CONST.SEARCH.TABLE_COLUMNS.DATE]: ( @@ -145,6 +148,22 @@ function ExpenseReportListItemRow({ )} ), + [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL]: ( + + + + ), + [CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL]: ( + + + + ), [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: ( = { actionRequired: 'Aktion erforderlich', duplicate: 'Duplizieren', duplicated: 'Dupliziert', + reimbursableTotal: 'Erstattungsfähiger Gesamtbetrag', + nonReimbursableTotal: 'Nicht erstattungsfähiger Gesamtbetrag', originalAmount: 'Ursprünglicher Betrag', }, supportalNoAccess: { diff --git a/src/languages/en.ts b/src/languages/en.ts index 0f05cca2e333..2a3786d2416a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -682,6 +682,8 @@ const translations = { actionRequired: 'Action required', duplicate: 'Duplicate', duplicated: 'Duplicated', + reimbursableTotal: 'Reimbursable total', + nonReimbursableTotal: 'Non-reimbursable total', }, supportalNoAccess: { title: 'Not so fast', diff --git a/src/languages/es.ts b/src/languages/es.ts index 20dc1789211d..0a8bceea1c94 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -378,6 +378,8 @@ const translations: TranslationDeepObject = { actionRequired: 'Acción requerida', duplicate: 'Duplicar', duplicated: 'Duplicado', + reimbursableTotal: 'Total reembolsable', + nonReimbursableTotal: 'Total no reembolsable', }, supportalNoAccess: { title: 'No tan rápido', diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 52aa9a1d5ddb..47cfe5f4831d 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -693,6 +693,8 @@ const translations: TranslationDeepObject = { actionRequired: 'Action requise', duplicate: 'Dupliquer', duplicated: 'Dupliqué', + reimbursableTotal: 'Total remboursable', + nonReimbursableTotal: 'Total non remboursable', originalAmount: 'Montant d’origine', }, supportalNoAccess: { diff --git a/src/languages/it.ts b/src/languages/it.ts index 6e2b708b9ae8..1e8e6e7d683d 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -692,6 +692,8 @@ const translations: TranslationDeepObject = { actionRequired: 'Azione richiesta', duplicate: 'Duplica', duplicated: 'Duplicato', + reimbursableTotal: 'Totale rimborsabile', + nonReimbursableTotal: 'Totale non rimborsabile', originalAmount: 'Importo originale', }, supportalNoAccess: { diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 6d87a9b32138..c9e2b130f585 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -691,6 +691,8 @@ const translations: TranslationDeepObject = { actionRequired: '対応が必要', duplicate: '複製', duplicated: '重複', + reimbursableTotal: '経費精算対象の合計', + nonReimbursableTotal: '非払い戻し合計', originalAmount: '元の金額', }, supportalNoAccess: { diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 67e2b07614b8..df2eed9a2b28 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -692,6 +692,8 @@ const translations: TranslationDeepObject = { actionRequired: 'Actie vereist', duplicate: 'Dupliceren', duplicated: 'Gedupliceerd', + reimbursableTotal: 'Totaal te vergoeden', + nonReimbursableTotal: 'Niet-vergoedbaar totaal', originalAmount: 'Oorspronkelijk bedrag', }, supportalNoAccess: { diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 4af2d97ee64e..933523a02dc0 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -692,6 +692,8 @@ const translations: TranslationDeepObject = { actionRequired: 'Wymagane działanie', duplicate: 'Duplikat', duplicated: 'Zduplikowano', + reimbursableTotal: 'Łączna kwota podlegająca zwrotowi', + nonReimbursableTotal: 'Suma niepodlegająca zwrotowi', originalAmount: 'Kwota pierwotna', }, supportalNoAccess: { diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index 736818b814d3..aca1af131760 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -691,6 +691,8 @@ const translations: TranslationDeepObject = { actionRequired: 'Ação necessária', duplicate: 'Duplicar', duplicated: 'Duplicado', + reimbursableTotal: 'Total reembolsável', + nonReimbursableTotal: 'Total não reembolsável', originalAmount: 'Valor original', }, supportalNoAccess: { diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index cd907d2e1454..8d8abe17ffcd 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -688,6 +688,8 @@ const translations: TranslationDeepObject = { actionRequired: '需要操作', duplicate: '复制', duplicated: '已重复', + reimbursableTotal: '可报销总额', + nonReimbursableTotal: '不可报销总额', originalAmount: '原始金额', }, supportalNoAccess: { diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index e515e2d7da95..6d98cbc4a13c 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2153,6 +2153,32 @@ function getSortedReportData( }); } + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL) { + return data.sort((a, b) => { + const aTotal = a.total; + const bTotal = b.total; + + const aNonReimbursableTotal = a.nonReimbursableTotal; + const bNonReimbursableTotal = b.nonReimbursableTotal; + + if (aTotal == null || bTotal == null || aNonReimbursableTotal == null || bNonReimbursableTotal == null) { + return 0; + } + + const aValue = aTotal - aNonReimbursableTotal; + const bValue = bTotal - bNonReimbursableTotal; + return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); + }); + } + + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL) { + return data.sort((a, b) => { + const aNonReimbursableTotal = a.nonReimbursableTotal; + const bNonReimbursableTotal = b.nonReimbursableTotal; + return compareValues(aNonReimbursableTotal, bNonReimbursableTotal, sortOrder, sortBy, localeCompare); + }); + } + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.REPORT_ID || sortBy === CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID) { return data.sort((a, b) => { const aValue = a.reportID; @@ -2326,6 +2352,10 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla return 'common.title'; case CONST.SEARCH.TABLE_COLUMNS.STATUS: return 'common.status'; + case CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL: + return 'common.reimbursableTotal'; + case CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL: + return 'common.nonReimbursableTotal'; case CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT: return 'common.tax'; case CONST.SEARCH.TABLE_COLUMNS.TAX_RATE: @@ -2720,6 +2750,8 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, [CONST.SEARCH.TABLE_COLUMNS.TO]: true, + [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL]: false, + [CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL]: false, [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: 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 11b5cd7891ee..f26e89452ffb 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1764,6 +1764,8 @@ 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.REIMBURSABLE_TOTAL: + case CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL: case CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT: case CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT: case CONST.SEARCH.TABLE_COLUMNS.TOTAL: diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index a4338dceae28..c5844610fce9 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -2770,6 +2770,8 @@ describe('SearchUIUtils', () => { [CONST.SEARCH.TABLE_COLUMNS.TO]: true, [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, [CONST.SEARCH.TABLE_COLUMNS.ACTION]: true, + [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL]: false, + [CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL]: false, [CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID]: false, [CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: false, }); @@ -2791,6 +2793,8 @@ describe('SearchUIUtils', () => { // Total should always be visible [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, [CONST.SEARCH.TABLE_COLUMNS.ACTION]: false, + [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL]: false, + [CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL]: false, [CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID]: false, [CONST.SEARCH.TABLE_COLUMNS.REPORT_ID]: false, });