Skip to content

[HOLD for payment 2024-07-24] [$250] Split tax - Tax amount is negative when manually entering tax amount when splitting expense #44632

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0-3.2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4678911
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • Taxes feature is enabled.
  • Workspace has at least one non-zero tax rate
  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Go to + > Split expense > Manual
  4. Enter amount > Next
  5. Click Show more > Tax rate
  6. Select a non-zero tax rate
  7. Click Tax amount
  8. Manually enter the tax amount
  9. Split the expense
  10. Click on the split preview

Expected Result:

The tax amount will not be negative

Actual Result:

The tax amount is negative when manually entering tax amount when splitting expense

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6527444_1719582486649.20240628_214259.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f472383a767ded73
  • Upwork Job ID: 1808173052119824825
  • Last Price Increase: 2024-07-02
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 28, 2024
  2. melvin-bot commented on Jun 28, 2024

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. lanitochka17 commented on Jun 28, 2024

    @lanitochka17
    Author

    @CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. lanitochka17 commented on Jun 28, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave-collect - Release 1

  5. etCoderDysto commented on Jun 28, 2024

    @etCoderDysto
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    What is the root cause of that problem?

    BE returns negative tax amount when editing tax amount manually. And we convert the negative tax amount to formatted tax amount here in MoneyRequestConfimationListFooter without first converting the tax amount into positive value as we do in MoneyRequestView.

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(transaction?.taxAmount, iouCurrencyCode);

    And display the formatted value here

    <MenuItemWithTopDescription
    key={`${taxRates?.name}${formattedTaxAmount}`}
    shouldShowRightIcon={canModifyTaxFields}
    title={formattedTaxAmount}

    What changes do you think we should make in order to solve the problem?

    As we do in MoneyRequestView, we should first convert the taxAmount to positive following the same method used in Money RequestVeiw

    const taxAmount = TransactionUtils.getTaxAmount(transaction, false);

    getTaxAmount() returns the absolute value of transaction.taxAmount

    Then we format it

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(taxAmount, iouCurrencyCode);

    here

    https://github.com/Expensify/App/blob/937c4186409725b57fdaae6ae8e1d8c85a9d52a0/src/components/MoneyRequestConfirmationListFooter.tsx#L254C11-L254C29

    Note: Instead of passing false as isExpenseReport param to 'getTaxAmount', we can calculate isExpenseReport using TransactionUtils.isExpenseReport(report)).

    What alternative solutions did you explore? (Optional)

  6. nkdengineer commented on Jul 1, 2024

    @nkdengineer
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The tax amount is negative when manually entering tax amount when splitting expense

    What is the root cause of that problem?

    If we create a split bill with entering the tax amount manually, BE returns the tax amount as negative amount for expense report.

    And in here, we doesn't convert the tax mount to positive value before getting the formatted string.

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(transaction?.taxAmount, iouCurrencyCode);

    What changes do you think we should make in order to solve the problem?

    If we create a split bill with entering the tax amount manually, BE returns the tax amount as negative amount for expense report.

    With this case BE returns the tax amount as negative amount for expense report. But if we don't enter the tax amount manually, BE returns it as positive amount. So here we should use getTaxAmountAbsValue to make sure that the displayed tax amount is always positive value

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(ModifiedExpenseMessage.getTaxAmountAbsValue(transaction?.taxAmount ?? 0), iouCurrencyCode);
    
    

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(transaction?.taxAmount, iouCurrencyCode);

    What alternative solutions did you explore? (Optional)

    We can fix from BE side to always return the tax amount of split bill transaction in expense report as negative amount
    And then here, we can use getTaxAmount function that had already covered the negative amount case for expense chat.

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(TransactionUtils.getTaxAmount(transaction, isPolicyExpenseChat), iouCurrencyCode);
    
    

    const formattedTaxAmount = CurrencyUtils.convertToDisplayString(transaction?.taxAmount, iouCurrencyCode);

  7. melvin-bot commented on Jul 1, 2024

    @melvin-bot

    @CortneyOfstad Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  8. CortneyOfstad commented on Jul 2, 2024

    @CortneyOfstad
    Contributor

    I was able to recreate so going to get eyes on this!

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 2, 2024
  10. changed the title [-]Split tax - Tax amount is negative when manually entering tax amount when splitting expense[/-] [+][$250] Split tax - Tax amount is negative when manually entering tax amount when splitting expense[/+] on Jul 2, 2024
  11. melvin-bot commented on Jul 2, 2024

    @melvin-bot
  12. 32 remaining items

  13. melvin-bot commented on Jul 24, 2024

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@CortneyOfstad)

    • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1808173052119824825/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  14. CortneyOfstad commented on Jul 24, 2024

    @CortneyOfstad
    Contributor

    @aimane-chnaif — please complete the check ASAP so there is no further delay in payment. Thanks!

    @etCoderDysto — I sent you an offer in Upwork, please let me know once you accept and I will get that paid ASAP. Thanks!

  15. etCoderDysto commented on Jul 24, 2024

    @etCoderDysto
    Contributor

    @CortneyOfstad I have accepted the offer.
    Thank you!

  16. aimane-chnaif commented on Jul 24, 2024

    @aimane-chnaif
    Contributor

    Offending PR with comment: #32550 (comment)

    We already have regression test as stated in OP

  17. CortneyOfstad commented on Jul 25, 2024

    @CortneyOfstad
    Contributor

    Payment Summary

    @etCoderDysto — paid $250 via Upwork
    @aimane-chnaif — to be paid $250 via NewDot

    Thanks all!

  18. moved this from Release 2: Summer 2024 (Aug) to Done in [#whatsnext] #wave-collecton Jul 25, 2024
  19. aimane-chnaif commented on Oct 3, 2024

    @aimane-chnaif
    Contributor

    @CortneyOfstad I am still using upwork. Can you please reopen and sort payment? Thanks

  20. mallenexpensify commented on Nov 11, 2025

    @mallenexpensify
    Contributor

    @aimane-chnaif can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~021988042361978261809

  21. mallenexpensify commented on Nov 11, 2025

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @aimane-chnaif paid $250 via Upwork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions