Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-20772

Price set calculation precision when sales tax enabled

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.7.21, 4.7.20
    • Fix Version/s: None
    • Component/s: CiviContribute
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      No
    • How it works currently:
      Text quantity fields get calculated with additional pence. It's not possible to specify an exact amount as the sales TAX is calculated on top of the amount. Example: 16.67 + 20% tax = 20.004. 2x this = 40.01
    • How it should work:
      Hide
      Text quantity fields get calculated with additional pence. It's not possible to specify an exact amount as the sales TAX is calculated on top of the amount. Example: 16.666666 + 20% tax = 20.004.
      When multiplying together, round to 2 decimal places first: 2x 20.00 = 40.00
      Show
      Text quantity fields get calculated with additional pence. It's not possible to specify an exact amount as the sales TAX is calculated on top of the amount. Example: 16.666666 + 20% tax = 20.004. When multiplying together, round to 2 decimal places first: 2x 20.00 = 40.00

      Description

      When sales tax is enabled price set calculations for text/numeric quantity generate amounts including the odd penny.

      For example (create this as a price set and use the preview form):

      • Text quantity: 16.67.  Inc VAT = 20.00.  When you add two of these the total amount=40.01

      Following discussion on mattermost, the sensible way to fix this is to allow multiple decimals to be entered in the pre-salestax amount.  For the example above:

      Text quantity: 16.6666666. Inc VAT = 20.00.  When you add two of these the total amount=40.00.

       

      This patch additionally replaces the generic "sales tax" text with the actual tax term (eg. VAT) in the UI.

      It also requires a database column change in civicrm_membership_type to avoid a loss of precision - varchar(512) seems like a rather large column but that is what is set in civicrm_contribution.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mattwire Matthew Wire
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: