Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-861

Add option to calculate coupon discount with tax

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: Short Term
    • Component/s: None
    • Labels:
      None

      Description

      A coupon line item from Services::buildServiceCouponLineItems() does not take into consideration whether or not tax should be applied to the discount. This results in line items having being taxed and the discount not removing any of the tax amount from the original line item. For example

      Service - $100
      Discount - 50%
      Tax - 10%

      Total should be $55, but is currently $60 because $100 + $100*0.1 - ($100*0.5) = $60

      Instead it should be $100 + $100*.01 - ($100*0.5 + ($100*0.5*0.1)) = $55

      The question is, how should taxes be handled in coupon line items? Should the line item be marked as taxable? If so, what about when there are multiple services, some taxable some not? Should we instead create a separate line item for each service? Should we calculate the tax and embed it into the line item (don't like that idea)?

      UPDATE
      Moved to feature request as some jurisdictions require tax on the full price before discounts.

      This task must therefore also include a setting to discount tax with coupons (disabled by default to preserve current behavior of not discounting tax).

        Activity

        cody Cody Phillips (Inactive) created issue -
        cody Cody Phillips (Inactive) made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Critical [ 2 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.0.7 [ 10302 ]
        Fix Version/s 3.0.6 [ 10301 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.0.8 [ 10304 ]
        Fix Version/s 3.0.7 [ 10302 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.1.1 [ 10306 ]
        Fix Version/s 3.0.8 [ 10304 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.1.2 [ 10403 ]
        Fix Version/s 3.1.1 [ 10306 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.1.3 [ 10405 ]
        Fix Version/s 3.1.2 [ 10403 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.1.4 [ 10500 ]
        Fix Version/s 3.1.3 [ 10405 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.2.1 [ 10504 ]
        Fix Version/s 3.1.4 [ 10500 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.2.2 [ 10505 ]
        Fix Version/s 3.2.1 [ 10504 ]
        Hide
        cody Cody Phillips (Inactive) added a comment -

        Tyson Phillips, any idea on how best to resolve this issue?

        Could we simply add a line item for each service that the coupon applies to?

        Obviously if the coupon is for a fixed amount, we'd need only a single line item for that fixed amount, but that becomes problematic when some of the services include tax and others do not.

        Should we just maintain a separate calculation of the taxes applied to discounted services, then add that rate to the coupon total instead?

        Show
        cody Cody Phillips (Inactive) added a comment - Tyson Phillips , any idea on how best to resolve this issue? Could we simply add a line item for each service that the coupon applies to? Obviously if the coupon is for a fixed amount, we'd need only a single line item for that fixed amount, but that becomes problematic when some of the services include tax and others do not. Should we just maintain a separate calculation of the taxes applied to discounted services, then add that rate to the coupon total instead?
        cody Cody Phillips (Inactive) made changes -
        Description A coupon line item from Services::buildServiceCouponLineItems() does not take into consideration whether or not tax should be applied to the discount. This results in line items having being taxed and the discount not removing any of the tax amount from the original line item. For example

        Service - $100
        Discount - 50%
        Tax - 10%

        Total should be $55, but is currently $60 because $100 + $100*0.1 - ($100*0.5) = $60

        Instead it should be $100 + $100*.01 - ($100*0.5 + ($100*0.5*0.1)) = $55

        The question is, how should taxes be handled in coupon line items? Should the line item be marked as taxable? If so, what about when there are multiple services, some taxable some not? Should we instead create a separate line item for each service? Should we calculate the tax and embed it into the line item (don't like that idea)?
        A coupon line item from Services::buildServiceCouponLineItems() does not take into consideration whether or not tax should be applied to the discount. This results in line items having being taxed and the discount not removing any of the tax amount from the original line item. For example

        Service - $100
        Discount - 50%
        Tax - 10%

        Total should be $55, but is currently $60 because $100 + $100*0.1 - ($100*0.5) = $60

        Instead it should be $100 + $100*.01 - ($100*0.5 + ($100*0.5*0.1)) = $55

        The question is, how should taxes be handled in coupon line items? Should the line item be marked as taxable? If so, what about when there are multiple services, some taxable some not? Should we instead create a separate line item for each service? Should we calculate the tax and embed it into the line item (don't like that idea)?

        *UPDATE*
        Moved to feature request as some jurisdictions *require* tax on the full price before discounts.

        This task must therefore also include an option to enable coupon tax (disabled by default to preserve current behavior).
        cody Cody Phillips (Inactive) made changes -
        Issue Type Bug [ 1 ] New Feature [ 2 ]
        cody Cody Phillips (Inactive) made changes -
        Fix Version/s 3.3.0 [ 10100 ]
        Fix Version/s 3.2.2 [ 10505 ]
        cody Cody Phillips (Inactive) made changes -
        Security Private [ 10000 ]
        cody Cody Phillips (Inactive) made changes -
        Summary Coupon line items do not consider tax Add option to calculate coupon discount with tax
        cody Cody Phillips (Inactive) made changes -
        Description A coupon line item from Services::buildServiceCouponLineItems() does not take into consideration whether or not tax should be applied to the discount. This results in line items having being taxed and the discount not removing any of the tax amount from the original line item. For example

        Service - $100
        Discount - 50%
        Tax - 10%

        Total should be $55, but is currently $60 because $100 + $100*0.1 - ($100*0.5) = $60

        Instead it should be $100 + $100*.01 - ($100*0.5 + ($100*0.5*0.1)) = $55

        The question is, how should taxes be handled in coupon line items? Should the line item be marked as taxable? If so, what about when there are multiple services, some taxable some not? Should we instead create a separate line item for each service? Should we calculate the tax and embed it into the line item (don't like that idea)?

        *UPDATE*
        Moved to feature request as some jurisdictions *require* tax on the full price before discounts.

        This task must therefore also include an option to enable coupon tax (disabled by default to preserve current behavior).
        A coupon line item from Services::buildServiceCouponLineItems() does not take into consideration whether or not tax should be applied to the discount. This results in line items having being taxed and the discount not removing any of the tax amount from the original line item. For example

        Service - $100
        Discount - 50%
        Tax - 10%

        Total should be $55, but is currently $60 because $100 + $100*0.1 - ($100*0.5) = $60

        Instead it should be $100 + $100*.01 - ($100*0.5 + ($100*0.5*0.1)) = $55

        The question is, how should taxes be handled in coupon line items? Should the line item be marked as taxable? If so, what about when there are multiple services, some taxable some not? Should we instead create a separate line item for each service? Should we calculate the tax and embed it into the line item (don't like that idea)?

        *UPDATE*
        Moved to feature request as some jurisdictions *require* tax on the full price before discounts.

        This task must therefore also include a setting to discount tax with coupons (disabled by default to preserve current behavior of not discounting tax).
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        I'm thinking any tax discounted should be included in the coupon line item amount, i.e.:
        "Should we just maintain a separate calculation of the taxes applied to discounted services, then add that rate to the coupon total instead?"

        Show
        tyson Tyson Phillips (Inactive) added a comment - I'm thinking any tax discounted should be included in the coupon line item amount, i.e.: "Should we just maintain a separate calculation of the taxes applied to discounted services, then add that rate to the coupon total instead?"
        admin Paul Phillips made changes -
        Fix Version/s 3.3.0-b2 [ 10507 ]
        Fix Version/s 3.3.0-b1 [ 10100 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.3.0 [ 10508 ]
        Fix Version/s 3.3.0-b2 [ 10507 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.4.0 [ 10400 ]
        Fix Version/s 3.3.0 [ 10508 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.5.0 [ 10401 ]
        Fix Version/s 3.4.0-b1 [ 10400 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.5.0-b2 [ 10701 ]
        Fix Version/s 3.5.0-b1 [ 10401 ]
        admin Paul Phillips made changes -
        Fix Version/s 3.5.0-b2 [ 10701 ]
        cody Cody Phillips (Inactive) made changes -
        Fix Version/s 4.0.0 [ 10603 ]
        cody Cody Phillips (Inactive) made changes -
        Assignee Cody Phillips [ cody ] Tyson Phillips [ tyson ]
        Hide
        cody Cody Phillips (Inactive) added a comment - - edited

        Tyson Phillips, I think our pricing library will let us handle this in an elegant way, right?

        Show
        cody Cody Phillips (Inactive) added a comment - - edited Tyson Phillips , I think our pricing library will let us handle this in an elegant way, right?
        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        Yeah, should be fine

        Show
        tyson Tyson Phillips (Inactive) added a comment - Yeah, should be fine
        cody Cody Phillips (Inactive) made changes -
        Story Points 5
        admin Paul Phillips made changes -
        Fix Version/s 4.0.0-b2 [ 11001 ]
        Fix Version/s 4.0.0-b1 [ 10603 ]
        admin Paul Phillips made changes -
        Fix Version/s 4.0.0-b3 [ 11002 ]
        Fix Version/s 4.0.0-b2 [ 11001 ]
        admin Paul Phillips made changes -
        Fix Version/s 4.0.0-b4 [ 11003 ]
        Fix Version/s 4.0.0-b3 [ 11002 ]
        admin Paul Phillips made changes -
        Fix Version/s 4.0.0-b5 [ 11004 ]
        Fix Version/s 4.0.0-b4 [ 11003 ]
        admin Paul Phillips made changes -
        Fix Version/s 4.0.0-b6 [ 11005 ]
        Fix Version/s 4.0.0-b5 [ 11004 ]
        admin Paul Phillips made changes -
        Fix Version/s 4.0.0-b7 [ 11009 ]
        Fix Version/s 4.0.0-b6 [ 11005 ]
        admin Paul Phillips made changes -
        Fix Version/s 4.1.0 [ 11007 ]
        Fix Version/s 4.0.0 [ 11009 ]
        admin Paul Phillips made changes -
        Fix Version/s Short Term [ 10800 ]
        Fix Version/s 4.1.0 [ 11007 ]
        admin Paul Phillips made changes -
        Rank Ranked higher
        tyson Tyson Phillips (Inactive) made changes -
        Rank Ranked higher
        Hide
        admin Paul Phillips added a comment -

        The Setting should be on the Package. Currently we have

        [x] Taxable

        If this is checked, then we can display a radio option below that says something like:

        Apply Taxes after Discounts ( ) Apply Taxes before Discounts

        By default, we should apply the taxes after discounts.

        Show
        admin Paul Phillips added a comment - The Setting should be on the Package. Currently we have [x] Taxable If this is checked, then we can display a radio option below that says something like: Apply Taxes after Discounts ( ) Apply Taxes before Discounts By default, we should apply the taxes after discounts.
        Hide
        jonathan Jonathan Reissmueller added a comment -

        In order to apply taxes to line items you can start by changing:

        'tax' => false
        

        to:

        'tax' => true
        

        In

        • app/models/invoices.php
        • app/controllers/admin_clients.php
        • app/controllers/client_services.php

        Also to have the pricing presenter work this way add a company setting 'discount_taxes' to your database using a query like this:
        INSERT INTO `company_settings` (`key`, `company_id`, `value`, `encrypted`, `inherit`) VALUES ('discount_taxes', '1', 'true', '0', '1');

        Show
        jonathan Jonathan Reissmueller added a comment - In order to apply taxes to line items you can start by changing: 'tax' => false to: 'tax' => true In app/models/invoices.php app/controllers/admin_clients.php app/controllers/client_services.php Also to have the pricing presenter work this way add a company setting 'discount_taxes' to your database using a query like this: INSERT INTO `company_settings` (`key`, `company_id`, `value`, `encrypted`, `inherit`) VALUES ('discount_taxes', '1', 'true', '0', '1');
        admin Paul Phillips made changes -
        Rank Ranked higher

          People

          • Assignee:
            tyson Tyson Phillips (Inactive)
            Reporter:
            cody Cody Phillips (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: