@@ -5041,6 +5041,7 @@ function getColumnsToShow({
50415041 isExpenseReportViewFromIOUReport = false ,
50425042 shouldShowBillableColumn = false ,
50435043 shouldShowReimbursableColumn = false ,
5044+ shouldShowCommentsColumn = false ,
50445045 reportCurrency,
50455046 shouldUseStrictDefaultExpenseColumns = false ,
50465047} : {
@@ -5053,8 +5054,10 @@ function getColumnsToShow({
50535054 isExpenseReportViewFromIOUReport ?: boolean ;
50545055 shouldShowBillableColumn ?: boolean ;
50555056 shouldShowReimbursableColumn ?: boolean ;
5056- shouldUseStrictDefaultExpenseColumns ?: boolean ;
5057+ shouldShowCommentsColumn ?: boolean ;
50575058 reportCurrency ?: string ;
5059+ shouldUseStrictDefaultExpenseColumns ?: boolean ;
5060+ policy ?: OnyxTypes . Policy ;
50585061} ) : SearchColumnType [ ] {
50595062 if ( type === CONST . SEARCH . DATA_TYPES . EXPENSE_REPORT ) {
50605063 const defaultReportColumns : SearchColumnType [ ] = [
@@ -5168,11 +5171,11 @@ function getColumnsToShow({
51685171 [ CONST . SEARCH . TABLE_COLUMNS . TAX_RATE ] : false ,
51695172 [ CONST . SEARCH . TABLE_COLUMNS . TAX_AMOUNT ] : false ,
51705173 [ CONST . SEARCH . TABLE_COLUMNS . EXCHANGE_RATE ] : false ,
5171- [ CONST . SEARCH . TABLE_COLUMNS . ORIGINAL_AMOUNT ] : false ,
51725174 [ CONST . SEARCH . TABLE_COLUMNS . REIMBURSABLE ] : shouldShowReimbursableColumn ,
51735175 [ CONST . SEARCH . TABLE_COLUMNS . BILLABLE ] : shouldShowBillableColumn ,
5174- [ CONST . SEARCH . TABLE_COLUMNS . COMMENTS ] : true ,
5175- [ CONST . SEARCH . TABLE_COLUMNS . TOTAL_AMOUNT ] : true ,
5176+ [ CONST . SEARCH . TABLE_COLUMNS . TOTAL_AMOUNT ] : false ,
5177+ [ CONST . SEARCH . TABLE_COLUMNS . TOTAL ] : true ,
5178+ [ CONST . SEARCH . TABLE_COLUMNS . COMMENTS ] : shouldShowCommentsColumn ,
51765179 }
51775180 : {
51785181 [ CONST . SEARCH . TABLE_COLUMNS . AVATAR ] : true ,
@@ -5233,7 +5236,7 @@ function getColumnsToShow({
52335236 }
52345237 }
52355238
5236- if ( ! addedColumns . has ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) {
5239+ if ( shouldShowCommentsColumn && ! addedColumns . has ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) {
52375240 result . push ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ;
52385241 }
52395242
@@ -5296,19 +5299,28 @@ function getColumnsToShow({
52965299 columns [ CONST . SEARCH . TABLE_COLUMNS . CARD ] = true ;
52975300 }
52985301
5299- if ( transaction . taxCode ) {
5302+ // If the transaction has any tax info (code, value, or amount),
5303+ // show both TAX_RATE and TAX_AMOUNT columns. Zero is valid tax data.
5304+ const hasTaxInfo = ! ! transaction . taxCode || transaction . taxAmount != null || ( transaction . taxValue !== undefined && transaction . taxValue !== '' ) ;
5305+ if ( hasTaxInfo ) {
53005306 columns [ CONST . SEARCH . TABLE_COLUMNS . TAX_RATE ] = true ;
5301- }
5302-
5303- if ( transaction . taxAmount ) {
53045307 columns [ CONST . SEARCH . TABLE_COLUMNS . TAX_AMOUNT ] = true ;
53055308 }
53065309
53075310 const hasExchangeRate = getExchangeRate ( transaction , reportCurrency ) !== '' ;
5308- if ( hasExchangeRate || transaction . originalAmount ) {
5309- columns [ CONST . SEARCH . TABLE_COLUMNS . ORIGINAL_AMOUNT ] = true ;
5311+ if ( hasExchangeRate ) {
53105312 columns [ CONST . SEARCH . TABLE_COLUMNS . EXCHANGE_RATE ] = true ;
53115313 }
5314+ // Expense report view: TOTAL (workspace currency) is always shown; add AMOUNT
5315+ // (transaction's own currency) when a conversion exists so both are visible.
5316+ // Search page: show ORIGINAL_AMOUNT column (transaction's original amount).
5317+ if ( hasExchangeRate ) {
5318+ if ( isExpenseReportView ) {
5319+ columns [ CONST . SEARCH . TABLE_COLUMNS . TOTAL_AMOUNT ] = true ;
5320+ } else {
5321+ columns [ CONST . SEARCH . TABLE_COLUMNS . ORIGINAL_AMOUNT ] = true ;
5322+ }
5323+ }
53125324
53135325 if ( ! Array . isArray ( data ) ) {
53145326 const report = data [ `${ ONYXKEYS . COLLECTION . REPORT } ${ transaction . reportID } ` ] ;
@@ -5390,8 +5402,11 @@ function getColumnsToShow({
53905402 CONST . SEARCH . TABLE_COLUMNS . TYPE ,
53915403 CONST . SEARCH . TABLE_COLUMNS . DATE ,
53925404 CONST . SEARCH . TABLE_COLUMNS . STATUS ,
5405+ // TOTAL_AMOUNT (Amount) is data-driven in expense report view: shown only when a
5406+ // conversion exists. In search view, TOTAL_AMOUNT is always-true via the default
5407+ // columns map, so we don't need to list it here as non-data for either surface.
5408+ CONST . SEARCH . TABLE_COLUMNS . TOTAL ,
53935409 CONST . SEARCH . TABLE_COLUMNS . COMMENTS ,
5394- CONST . SEARCH . TABLE_COLUMNS . TOTAL_AMOUNT ,
53955410 CONST . SEARCH . TABLE_COLUMNS . REIMBURSABLE ,
53965411 CONST . SEARCH . TABLE_COLUMNS . BILLABLE ,
53975412 CONST . SEARCH . TABLE_COLUMNS . BASE_62_REPORT_ID ,
0 commit comments