Skip to content

Commit e4d34fb

Browse files
MelvinBotrojiphil
andcommitted
Use absolute value for taxable amount when calculating tax on negative expenses
Tax amount was calculated using the raw (negative) transaction amount, producing a negative tax value that the backend treated as zero. Wrapping in Math.abs ensures the tax calculation always receives a positive amount. Co-authored-by: Roji Philip <rojiphil@users.noreply.github.com>
1 parent 0ce2161 commit e4d34fb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/MoneyRequestConfirmationList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ function MoneyRequestConfirmationList({
547547
}, [shouldCalculateDistanceAmount, isReadOnly, distanceRequestAmount, transactionID, currency, isTypeSplit, isPolicyExpenseChat, selectedParticipantsProp, transaction]);
548548

549549
// Calculate and set tax amount in transaction draft
550-
const taxableAmount = isDistanceRequest ? DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, distance) : (transaction?.amount ?? 0);
550+
const taxableAmount = isDistanceRequest ? DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, distance) : Math.abs(transaction?.amount ?? 0);
551551
// First we'll try to get the tax value from the chosen policy and if not found, we'll try to get it from the policy for moving expenses (only if the transaction is moving from track expense)
552552
const taxPercentage =
553553
getTaxValue(policy, transaction, transaction?.taxCode ?? defaultTaxCode) ??

0 commit comments

Comments
 (0)