close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Tax After Discount

Thread began 9/05/2012 11:17 pm by Lee Firth | Last modified 9/11/2012 2:16 pm by Lee Firth | 1729 views | 8 replies |

Lee Firth

Tax After Discount

I want to add 10% GST tax to the sub total of the cart after discount. I used the charges tab of the eCart object and set it up to the cart subtotal * 0.1 and checked the "apply after Discounts" checkbox (see gst_1.gif). The calculations are all wrong on the confirm.php page (see gst_2.jpg). The GST charge in this example should be $72.73 - $18.18 * 0.1 which should equal $5.45. I thought that it may have been including the shipping in the calculation (that would have been $6.82 if it was) but I have the checkbox "Include in cart subtotal when calculating sales tax" deselected.

One thing I did notice is that the "apply after Discounts" checkbox on the eCart objects Charges tab doesn't save, that is if you go back into that tab again, you have to select the checkbox again.

Sign in to reply to this post

Jason ByrnesWebAssist

It looks like you have edited the cart display for the subtatol line.

the actual subtotal in the cart is $80.00, not the $72.73 that is shown

so the charge is being done as:
80 - 18.18 * 0.1 = 6.18

Sign in to reply to this post

Lee Firth

OK, had to manually edit the tax rule (couldn't use the GUI) and now the GST displays the correct amount. But now the Grand Total doesn't calculate correctly (see cart_3.jpg attached). I can't find where this is calculated.

Sign in to reply to this post

Jason ByrnesWebAssist

the grand total is calculated in the cart.

instead of hand coding things to remove the VAT from the cart display, you should create a discount that will do that inside the cart that way the cart will handle the total correctly and you wont need to do any hand coding of the cart display.

Sign in to reply to this post

Lee Firth

I don't understand what you mean. The discount is calculated inside the cart.

Sign in to reply to this post

Jason ByrnesWebAssist

in your screen shoot, the subtotal shows $72.73 but the item costs $80


what ever hand coding you doing to cause that is what i am referring to.

you should not be hand coding the sub total to change it.

Sign in to reply to this post

Lee Firth

Both of these figures are calculations within the cart itself. The $80 value is a calculation including GST (TotalPrice). The client wanted all prices on their website to be displayed including %10 GST, as GST is only applicable to Australian residents I have to remove it in the subtotal (SubTotal)and then add it at the end for Australian residents only. See calculations.jpg attached.

Sign in to reply to this post

Jason ByrnesWebAssist

that info would have helped a lot up front.

I have a feeling the issue is in naming the calculation SubTotal, but i'll need to do some testing.

can you send a copy of the cart display page and the eCart object file from the WA_eCart folder please.

Sign in to reply to this post

Lee Firth

Sorry about that Jason. The files are attached. I have managed to get it to calculate correctly but this involved changing the GetTaxableTotal() function in WA_eCart_Definition_PHP.php from:

php:
function GetTaxableTotal() {
    $taxTotal  = 0;
    $taxTotal  = $this->TotalColumn("TotalPrice");
    $taxTotal -= $this->GetDiscounts();
    $taxTotal += $this->GetCharges();
    if ($this->ShippingIsTaxed) {
      $taxTotal += $this->GetShipping();
    }
    return $taxTotal;
  }

To:

php:
function GetTaxableTotal() {
    $taxTotal  = 0;
    $taxTotal  = $this->TotalColumn("SubTotal");
    $taxTotal -= $this->GetDiscounts();
    $taxTotal += $this->GetCharges();
    if ($this->ShippingIsTaxed) {
      $taxTotal += $this->GetShipping();
    }
    return $taxTotal;
  }

I don't think it is advisable to do it this way so I would really appreciate you looking at the attached files and letting me know the correct way I should be using.

Attached Files
eCart.zip
Sign in to reply to this post

Jason ByrnesWebAssist

Use the Same calculation for TotalPrice that you are using for SubTotal, right now, they are a little different.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...