@@ -15,7 +15,7 @@ import {convertToBackendAmount, convertToFrontendAmountAsString, getLocalizedCur
1515import { calculateAmount , isMovingTransactionFromTrackExpense } from '@libs/IOUUtils' ;
1616import Navigation from '@libs/Navigation/Navigation' ;
1717import { shouldEnableNegative } from '@libs/ReportUtils' ;
18- import { calculateTaxAmount , getTaxValue } from '@libs/TransactionUtils' ;
18+ import { calculateTaxAmount , getTaxCode , getTaxValue } from '@libs/TransactionUtils' ;
1919import { isParticipantP2P } from '@pages/iou/request/step/IOURequestStepAmount' ;
2020import IOURequestStepCurrencyModal from '@pages/iou/request/step/IOURequestStepCurrencyModal' ;
2121import { resetSplitShares , setDraftSplitTransaction , setSplitShares } from '@userActions/IOU/Split' ;
@@ -240,6 +240,15 @@ function AmountField({
240240
241241 buildAndSaveSplitShares ( updatedAmount , value ) ;
242242 persistMainDraftTotal ( updatedAmount , value ) ;
243+
244+ if ( isMovingTransactionFromTrackExpense ( action ) ) {
245+ const taxCode = getTaxCode ( transactionForHandlers ) ;
246+ if ( taxCode ) {
247+ const taxPercentage = getTaxValue ( policy , transactionForHandlers , taxCode ) ?? '' ;
248+ const taxAmount = convertToBackendAmount ( calculateTaxAmount ( taxPercentage , updatedAmount , getCurrencyDecimals ( value ) ) ) ;
249+ setMoneyRequestTaxAmount ( transactionID , taxAmount ) ;
250+ }
251+ }
243252 } ;
244253
245254 const handleAmountChange = ( newAmount : string ) => {
@@ -268,7 +277,8 @@ function AmountField({
268277
269278 if ( isMovingTransactionFromTrackExpense ( action ) ) {
270279 const amountInSmallestCurrencyUnits = convertToBackendAmount ( Number . parseFloat ( newAmount ) ) ;
271- const taxCode = effectiveCurrency !== policy ?. outputCurrency ? policy ?. taxRates ?. foreignTaxDefault : policy ?. taxRates ?. defaultExternalID ;
280+ const defaultTaxCode = effectiveCurrency !== policy ?. outputCurrency ? policy ?. taxRates ?. foreignTaxDefault : policy ?. taxRates ?. defaultExternalID ;
281+ const taxCode = getTaxCode ( transactionForHandlers ) || defaultTaxCode ;
272282 if ( taxCode ) {
273283 setMoneyRequestTaxRate ( transactionID , taxCode ) ;
274284 const taxPercentage = getTaxValue ( policy , transactionForHandlers , taxCode ) ?? '' ;
0 commit comments