how do I show the shipping rate with tax included?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
ozlighting
Lieutenant (LT)
Lieutenant (LT)
Posts: 53
Joined: Tue Mar 24, 2009 9:49 pm
Contact:

how do I show the shipping rate with tax included?

Post by ozlighting » Sun May 10, 2009 7:41 am

Hi,

I need to show the shipping rate (fixed rate of $15) with the tax included (gst requirements in Australia). Because this is a taxable item the rate is set to $13.64 in the Admin->Configure->Shipping Methods screen. This ensures that at checkout, the total tax amount displayed includes the tax for the shipping.

However, during the checkout process, on ~/Checkout/ShipMethod.aspx the shipping rate is displayed as "Fixed rate ($13.64)". I need to show this as "Fixed rate ($15.00)".

I have had a look in the ShipMethodPage.ascx and ShipMethodPage.ascx.cs files and found the bit of code that displays the shipping rate but I don't know how to change it to show the tax inclusive amount. The piece of code is:

Code: Select all

<asp:Label ID="ShipMethodRate" runat="server" Text='<%#Eval("TotalRate"," ({0:ulc})") %>' Visible='<%#((LSDecimal)Eval("TotalRate") > 0)%>' />
I can't figure out where "TotalRate" is derived from - is it a fixed variable in the CommerceBuilder.Shipping api? is there any documentation that can help with the other available fields. I'm new to .Net and not a full time programmer, so any help would be greatly appreciated.

Cheers,

Lance
Australian Online Lighting Store

log on and light up...

ozlighting
Lieutenant (LT)
Lieutenant (LT)
Posts: 53
Joined: Tue Mar 24, 2009 9:49 pm
Contact:

Re: how do I show the shipping rate with tax included?

Post by ozlighting » Sun May 10, 2009 8:11 pm

ok, I downloaded the free version of Visual Web Developer Express and opened the file CommerceBuilder.dll from the bin directory. I found a class called ShipRateQuote in the CommerceBuilder.Shipping namespace (not sure if the terminology is correct). there is a variable called "TotalRate" and one called "Name" which is obviously where the values are coming from in the code snippet posted above.

So my question is, what is the correct syntax to take this value and multiply it by 1.1 (our GST tax rate is fixed at 10%). If I can do this then I can get the result I'm looking for.

Cheers,

Lance
Australian Online Lighting Store

log on and light up...

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: how do I show the shipping rate with tax included?

Post by mazhar » Mon May 11, 2009 3:47 am

Add following method to ShipMethodPage.ascx.cs file

Code: Select all

protected string GetGSTIncluded(Object dataItem) 
    {
        LSDecimal result;
        ShipRateQuote shipRateQuote = (ShipRateQuote)dataItem;
        result = shipRateQuote.TotalRate * 1.1;
        return result.ToString("ulc");
    }
and now update

Code: Select all

<asp:Label ID="ShipMethodRate" runat="server" Text='<%#Eval("TotalRate"," ({0:ulc})") %>' Visible='<%#((LSDecimal)Eval("TotalRate") > 0)%>' />
to look like

Code: Select all

<asp:Label ID="ShipMethodRate" runat="server" Text='<%#GetGSTIncluded(Container.DataItem) %>' Visible='<%#((LSDecimal)Eval("TotalRate") > 0)%>' />

ozlighting
Lieutenant (LT)
Lieutenant (LT)
Posts: 53
Joined: Tue Mar 24, 2009 9:49 pm
Contact:

Re: how do I show the shipping rate with tax included?

Post by ozlighting » Tue May 12, 2009 7:15 pm

Hi Mazhar,

thanks for that, however I'm getting this error msg
Operator '*' cannot be applied to operands of type 'CommerceBuilder.Common.LSDecimal' and 'double'
Australian Online Lighting Store

log on and light up...

ozlighting
Lieutenant (LT)
Lieutenant (LT)
Posts: 53
Joined: Tue Mar 24, 2009 9:49 pm
Contact:

Re: how do I show the shipping rate with tax included?

Post by ozlighting » Tue May 12, 2009 7:54 pm

Hi Mazhar,

I figured it out - just needed to explicitly convert the number 1.1 to a decimal:
protected string GetGSTIncluded(Object dataItem)
{
LSDecimal result;
LSDecimal shippingtaxrate = (decimal)1.1;
ShipRateQuote shipRateQuote = (ShipRateQuote)dataItem;
result = shipRateQuote.TotalRate * shippingtaxrate;
return result.ToString("ulc");
}

Thanks so much for your help - I really appreciate it.
Australian Online Lighting Store

log on and light up...

Post Reply