Skip to content

Commit 7c8b328

Browse files
authored
Merge pull request #97167 from ishpaul777/ishpaul/655931-reconciliation-fx-columns
[Payment due @huult][NO QA] Show the debited and reimbursed amounts on the reconciliation dashboard
2 parents ee4863b + baf9b30 commit 7c8b328

26 files changed

Lines changed: 785 additions & 355 deletions

‎src/CONST/index.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7077,6 +7077,8 @@ const CONST = {
70777077
BANK_ACCOUNT: this.TABLE_COLUMNS.GROUP_BANK_ACCOUNT,
70787078
WITHDRAWAL_ID: this.TABLE_COLUMNS.GROUP_WITHDRAWAL_ID,
70797079
EXPENSES: this.TABLE_COLUMNS.GROUP_EXPENSES,
7080+
AMOUNT_DEBITED: this.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED,
7081+
AMOUNT_REIMBURSED: this.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED,
70807082
TOTAL: this.TABLE_COLUMNS.GROUP_TOTAL,
70817083
},
70827084
CATEGORY: {
@@ -7155,6 +7157,8 @@ const CONST = {
71557157
this.TABLE_COLUMNS.GROUP_BANK_ACCOUNT,
71567158
this.TABLE_COLUMNS.GROUP_WITHDRAWAL_ID,
71577159
this.TABLE_COLUMNS.GROUP_EXPENSES,
7160+
this.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED,
7161+
this.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED,
71587162
this.TABLE_COLUMNS.GROUP_TOTAL,
71597163
],
71607164
CATEGORY: [this.TABLE_COLUMNS.GROUP_CATEGORY, this.TABLE_COLUMNS.GROUP_EXPENSES, this.TABLE_COLUMNS.GROUP_TOTAL],
@@ -7275,6 +7279,8 @@ const CONST = {
72757279
GROUP_YEAR: 'groupyear',
72767280
GROUP_QUARTER: 'groupquarter',
72777281
GROUP_WITHDRAWAL_STATUS: 'groupWithdrawalStatus',
7282+
GROUP_AMOUNT_DEBITED: 'groupAmountDebited',
7283+
GROUP_AMOUNT_REIMBURSED: 'groupAmountReimbursed',
72787284
},
72797285
SYNTAX_OPERATORS: {
72807286
AND: 'and',
@@ -7500,6 +7506,8 @@ const CONST = {
75007506
[this.TABLE_COLUMNS.GROUP_YEAR]: 'group-year',
75017507
[this.TABLE_COLUMNS.GROUP_QUARTER]: 'group-quarter',
75027508
[this.TABLE_COLUMNS.GROUP_WITHDRAWAL_STATUS]: 'group-withdrawal-status',
7509+
[this.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED]: 'group-amount-debited',
7510+
[this.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED]: 'group-amount-reimbursed',
75037511
};
75047512
},
75057513
NOT_PREFIX: '-',

‎src/components/Search/FilterDropdowns/SortByPopup.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function SortByPopup({searchResults, queryJSON, groupBy, onSort, onSortOrderPres
5555
const searchDataType = shouldUseLiveData ? CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT : searchResults?.search?.type;
5656
const currentColumns = !searchResults?.data
5757
? []
58-
: getColumnsToShow({currentAccountID: accountID, data: searchResults.data, visibleColumns, type: searchDataType, groupBy: groupBy?.value});
58+
: getColumnsToShow({currentAccountID: accountID, data: searchResults.data, visibleColumns, type: searchDataType, groupBy: groupBy?.value, sortBy: queryJSON.sortBy});
5959
const sortableColumns = getSortByOptions(currentColumns, translate);
6060
const sortOrder = queryJSON.sortOrder;
6161

‎src/components/Search/SearchList/ListItem/WithdrawalIDListItemHeader.tsx‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ function WithdrawalIDListItemHeaderImpl({
9393
withdrawalIDItem.debitPosted,
9494
DateUtils.doesDateBelongToAPastYear(withdrawalIDItem.debitPosted) ? CONST.DATE.MONTH_DAY_YEAR_ABBR_FORMAT : CONST.DATE.MONTH_DAY_ABBR_FORMAT,
9595
);
96+
const {debitedAmount, debitedCurrency, creditedAmount, creditedCurrency} = withdrawalIDItem;
97+
9698
const badgeProps = getSettlementStatusBadgeProps(withdrawalIDItem.state, translate, theme);
9799
const settlementStatus = getSettlementStatus(withdrawalIDItem.state);
98100
const statusBadge = !!badgeProps && (
@@ -177,6 +179,33 @@ function WithdrawalIDListItemHeaderImpl({
177179
<TextCell text={String(withdrawalIDItem.count)} />
178180
</View>
179181
),
182+
// A settlement that did not convert currencies reports neither amount, and an amount says nothing without the currency it moved in.
183+
[CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED]: (
184+
<View
185+
key={CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED}
186+
style={StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED)}
187+
>
188+
{!!debitedAmount && !!debitedCurrency && (
189+
<TotalCell
190+
total={debitedAmount}
191+
currency={debitedCurrency}
192+
/>
193+
)}
194+
</View>
195+
),
196+
[CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED]: (
197+
<View
198+
key={CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED}
199+
style={StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED)}
200+
>
201+
{!!creditedAmount && !!creditedCurrency && (
202+
<TotalCell
203+
total={creditedAmount}
204+
currency={creditedCurrency}
205+
/>
206+
)}
207+
</View>
208+
),
180209
[CONST.SEARCH.TABLE_COLUMNS.GROUP_TOTAL]: (
181210
<View
182211
key={CONST.SEARCH.TABLE_COLUMNS.TOTAL}

‎src/components/Search/SearchTableHeader.tsx‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,17 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[]
336336
];
337337

338338
const getTransactionGroupHeaders = (groupBy: SearchGroupBy, icons: SearchHeaderIcons): SearchColumnConfig[] => {
339-
const commonGroupHeaders: SearchColumnConfig[] = [
340-
{
341-
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_EXPENSES,
342-
translationKey: 'common.expenses' as TranslationPaths,
343-
isColumnSortable: true,
344-
},
345-
{
346-
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_TOTAL,
347-
translationKey: 'common.total' as TranslationPaths,
348-
isColumnSortable: true,
349-
},
350-
];
339+
const groupExpensesHeader: SearchColumnConfig = {
340+
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_EXPENSES,
341+
translationKey: 'common.expenses' as TranslationPaths,
342+
isColumnSortable: true,
343+
};
344+
const groupTotalHeader: SearchColumnConfig = {
345+
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_TOTAL,
346+
translationKey: 'common.total' as TranslationPaths,
347+
isColumnSortable: true,
348+
};
349+
const commonGroupHeaders: SearchColumnConfig[] = [groupExpensesHeader, groupTotalHeader];
351350
switch (groupBy) {
352351
case CONST.SEARCH.GROUP_BY.FROM:
353352
return [
@@ -405,7 +404,18 @@ const getTransactionGroupHeaders = (groupBy: SearchGroupBy, icons: SearchHeaderI
405404
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_WITHDRAWAL_ID,
406405
translationKey: 'common.withdrawalID',
407406
},
408-
...commonGroupHeaders,
407+
groupExpensesHeader,
408+
{
409+
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED,
410+
translationKey: 'common.amountDebited',
411+
isColumnSortable: true,
412+
},
413+
{
414+
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED,
415+
translationKey: 'common.amountReimbursed',
416+
isColumnSortable: true,
417+
},
418+
groupTotalHeader,
409419
];
410420
case CONST.SEARCH.GROUP_BY.CATEGORY:
411421
return [

‎src/components/Search/SortableTableHeader.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ function SortableTableHeader({
8080
const sortByColumnName = sortColumnName ?? columnName;
8181
const isActive = sortBy === sortByColumnName;
8282
const isReimbursableOrBillableColumn = columnName === CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE || columnName === CONST.SEARCH.TABLE_COLUMNS.BILLABLE;
83+
const isConversionAmountColumn = columnName === CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_DEBITED || columnName === CONST.SEARCH.TABLE_COLUMNS.GROUP_AMOUNT_REIMBURSED;
8384
const textStyle = [
8485
columnName === CONST.SEARCH.TABLE_COLUMNS.RECEIPT ? StyleUtils.getTextOverflowStyle('clip') : null,
85-
isReimbursableOrBillableColumn ? styles.flexShrink1 : null,
86+
isReimbursableOrBillableColumn || isConversionAmountColumn ? styles.flexShrink1 : null,
8687
];
8788

8889
return (

‎src/components/Search/hooks/useSearchSnapshot.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ function useSearchSnapshot({queryJSON, searchResults, newSearchResultKeys, trans
377377
groupBy: validGroupBy,
378378
shouldUseStrictDefaultExpenseColumns: currentSearchKey === CONST.SEARCH.SEARCH_KEYS.EXPENSES && isDefaultExpensesQuery(queryJSON),
379379
fallbackPolicyID: policyForMovingExpensesID,
380+
sortBy: queryJSON.sortBy,
380381
});
381382
})();
382383

‎src/hooks/useSearchOverlay.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function useSearchOverlay({
122122
groupBy: validGroupBy,
123123
shouldUseStrictDefaultExpenseColumns,
124124
fallbackPolicyID: policyForMovingExpensesID,
125+
sortBy: queryJSON.sortBy,
125126
});
126127
})();
127128

‎src/languages/de.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ const translations: TranslationDeepObject<typeof en> = {
405405
longReportID: 'Langer Bericht-ID',
406406
withdrawalID: 'Auszahlungs-ID',
407407
internationalReimbursementIDs: 'Internationale Erstattungs-IDs',
408+
amountDebited: 'Belasteter Betrag',
409+
amountReimbursed: 'Erstatteter Betrag',
408410
withdrawalStatus: 'Auszahlungsstatus',
409411
paidStatus: 'Status: Bezahlt',
410412
bankAccounts: 'Bankkonten',

‎src/languages/el.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ const translations: TranslationDeepObject<typeof en> = {
411411
longReportID: 'Μακρύ αναγνωριστικό αναφοράς',
412412
withdrawalID: 'Αναγνωριστικό ανάληψης',
413413
internationalReimbursementIDs: 'Διεθνή αναγνωριστικά αποζημιώσεων',
414+
amountDebited: 'Ποσό χρέωσης',
415+
amountReimbursed: 'Ποσό που αποζημιώθηκε',
414416
withdrawalStatus: 'Κατάσταση ανάληψης',
415417
paidStatus: 'Κατάσταση πληρωμής',
416418
bankAccounts: 'Τραπεζικοί λογαριασμοί',

‎src/languages/en.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@ const translations = {
434434
longReportID: 'Long Report ID',
435435
withdrawalID: 'Withdrawal ID',
436436
internationalReimbursementIDs: 'International reimbursement IDs',
437+
amountDebited: 'Amount debited',
438+
amountReimbursed: 'Amount reimbursed',
437439
withdrawalStatus: 'Withdrawal status',
438440
paidStatus: 'Paid status',
439441
bankAccounts: 'Bank accounts',

0 commit comments

Comments
 (0)