Skip to content
4 changes: 4 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.DATE, item.shouldShowYear)]}>
Expand Down Expand Up @@ -145,6 +148,22 @@ function ExpenseReportListItemRow({
)}
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TOTAL)]}>
<TotalCell
total={reimbursableTotal}
currency={currency}
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TOTAL)]}>
<TotalCell
total={nonReimbursableTotal}
currency={currency}
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.TOTAL]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TOTAL)]}>
<TotalCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[]
columnName: CONST.SEARCH.TABLE_COLUMNS.TO,
translationKey: 'common.to',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL,
translationKey: 'common.reimbursableTotal',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL,
translationKey: 'common.nonReimbursableTotal',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.TOTAL,
translationKey: 'common.total',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Aktion erforderlich',
duplicate: 'Duplizieren',
duplicated: 'Dupliziert',
reimbursableTotal: 'Erstattungsfähiger Gesamtbetrag',
nonReimbursableTotal: 'Nicht erstattungsfähiger Gesamtbetrag',
originalAmount: 'Ursprünglicher Betrag',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Acción requerida',
duplicate: 'Duplicar',
duplicated: 'Duplicado',
reimbursableTotal: 'Total reembolsable',
nonReimbursableTotal: 'Total no reembolsable',
},
supportalNoAccess: {
title: 'No tan rápido',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Action requise',
duplicate: 'Dupliquer',
duplicated: 'Dupliqué',
reimbursableTotal: 'Total remboursable',
nonReimbursableTotal: 'Total non remboursable',
originalAmount: 'Montant d’origine',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Azione richiesta',
duplicate: 'Duplica',
duplicated: 'Duplicato',
reimbursableTotal: 'Totale rimborsabile',
nonReimbursableTotal: 'Totale non rimborsabile',
originalAmount: 'Importo originale',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: '対応が必要',
duplicate: '複製',
duplicated: '重複',
reimbursableTotal: '経費精算対象の合計',
nonReimbursableTotal: '非払い戻し合計',
originalAmount: '元の金額',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Actie vereist',
duplicate: 'Dupliceren',
duplicated: 'Gedupliceerd',
reimbursableTotal: 'Totaal te vergoeden',
nonReimbursableTotal: 'Niet-vergoedbaar totaal',
originalAmount: 'Oorspronkelijk bedrag',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Wymagane działanie',
duplicate: 'Duplikat',
duplicated: 'Zduplikowano',
reimbursableTotal: 'Łączna kwota podlegająca zwrotowi',
nonReimbursableTotal: 'Suma niepodlegająca zwrotowi',
originalAmount: 'Kwota pierwotna',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: 'Ação necessária',
duplicate: 'Duplicar',
duplicated: 'Duplicado',
reimbursableTotal: 'Total reembolsável',
nonReimbursableTotal: 'Total não reembolsável',
originalAmount: 'Valor original',
},
supportalNoAccess: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ const translations: TranslationDeepObject<typeof en> = {
actionRequired: '需要操作',
duplicate: '复制',
duplicated: '已重复',
reimbursableTotal: '可报销总额',
nonReimbursableTotal: '不可报销总额',
originalAmount: '原始金额',
},
supportalNoAccess: {
Expand Down
32 changes: 32 additions & 0 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Search/SearchUIUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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,
});
Expand Down
Loading