Page 1 of 1

Editing Order Confirmation to display different tax rules

Posted: Tue Sep 29, 2009 10:19 am
by peashootermedia
Hi everyone,

For accounting purposes we want to split our Order Confirmation to show sets of Tax Rules(GST, PST - all seperate), rather than just TAX all lumped into one section. We need to be able to seperate it. Any idea's?

Thanks.

Re: Editing Order Confirmation to display different tax rules

Posted: Wed Sep 30, 2009 5:23 am
by mazhar
For this you need to itterate over order items, check order item types and for each order item of type tax out put amount etc as you desired like
#foreach($orderItem in $order.Items)

#if($orderItem.OrderItemType="Tax")
$orderItem.Price
#end
#end

Re: Editing Order Confirmation to display different tax rules

Posted: Wed Sep 30, 2009 1:29 pm
by peashootermedia
Thanks Mazhar! Appreciate your help.

Again, sorry I am new to ASP.Net - so if I understand correctly I can use the block of code above and replace "Tax" with such as "GST"
and **IF** the GST exists, it will output the price?

Re: Editing Order Confirmation to display different tax rules

Posted: Thu Oct 01, 2009 4:19 am
by mazhar
No "Tax" represents the type of order item and it would be same for both normal and GST. In order to filter GST only you can put if on $orderItem.Name and check against the name by which you created GST in admin.

Re: Editing Order Confirmation to display different tax rules

Posted: Thu Oct 01, 2009 9:37 am
by peashootermedia
I have this block of code that I modified based on your suggestion. This is the solution that I found...

Thanks Mazhar!

Code: Select all

  #each
  #if (($orderItem.OrderItemType == "Product") || ($orderItem.OrderItemType == "Discount") || ($orderItem.OrderItemType == "GiftWrap") || ($orderItem.OrderItemType == "Coupon") || ($orderItem.OrderItemType == "Tax"))
  <tr class="email">
  <td class="email" style="text-align: center;">
    #if (($orderItem.OrderItemType == "Product"))
      $orderItem.Sku
      #elseif (($orderItem.OrderItemType == "Discount"))
      DISCOUNT
      #elseif (($orderItem.OrderItemType == "GiftWrap"))
      GIFTWRAP
      #elseif (($orderItem.OrderItemType == "Tax"))
      TAX
   #end </td>

Re: Editing Order Confirmation to display different tax rules

Posted: Thu Oct 01, 2009 9:44 am
by mazhar
sounds great

Re: Editing Order Confirmation to display different tax rules

Posted: Thu Oct 01, 2009 2:04 pm
by peashootermedia
Hello again.

Just reviewing the change to our invoice, and we found one more issue. This way works, however when you have multiple shipments in the same order, the tax displays by the shipment not the order.

I figured a could solve this problem by taking the shipments GST and adding each together and display it at the bottom.

I have this code:

Code: Select all

#foreach($orderItem in $order.Items)
    #if($orderItem.OrderItemType=="Tax")
  <tr>
    <td style="background:#cccccc; color:#00000; text-align: right;"><strong>$orderItem.Name:</strong></td>
    <td class="email" style="text-align: right;">
    
		$orderItem.ExtendedPrice.ToString("C")
    </td>
  </tr>
  #end 
    #end
This code outputs like so:

Code: Select all

GST: $1.10  
GST: $1.10  
PST: $1.75  
because on each shipment there are a set of GST - and 2 shipments total(in this order anyways) - and I know it is doing this because of the #foreach.

However, my question now, is how to I add "$orderItem.ExtendedPrice" together to output one number - and then convert it to a string.

Re: Editing Order Confirmation to display different tax rules

Posted: Fri Oct 02, 2009 3:04 am
by mazhar
Read following thread
viewtopic.php?f=42&t=8717

Re: Editing Order Confirmation to display different tax rules

Posted: Mon Oct 05, 2009 10:04 am
by peashootermedia
Hey Mazhar,

Thanks for pointing me to the other forum...

Took a look and tried it out, but it doesn't help me in my case.. I need to take a sum of a stated variable.

Actually, what I almost need, is some way to say "If $orderItem.Name Exists more than twice than take a sum - else just output the same code I have below...

Any more idea's would be appreciated...

Code: Select all

 #foreach($orderItem in $order.Items)
    #if($orderItem.OrderItemType=="Tax")
  <tr>
    <td style="background:#cccccc; color:#00000; text-align: right;"><strong>$orderItem.Name:</strong></td>
    <td class="email" style="text-align: right;">
    
$balance = $orderItem.ExtendedPrice
    </td>
  </tr>
  #end 
    #end