Here is the code I use for 5.5 which is placed on invoice.aspx
Code: Select all
<!-- commission junction tracking pixel -->
<%
dim ShipmentCollection as cbShipmentCollection
ShipmentCollection = objOrder.Shipments()
dim arrShipments() as Decimal
'determine if any unshippable items exist
dim blnNoShip as boolean
'only products count toward the noship items
blnNoShip = FCast.FBool(objToken.StoreGroupDB.QueryValue("SELECT COUNT(*) AS NOSHIP FROM ORDERITEMS WHERE Order_ID=" & objBasket.Order_ID & " AND Product_ID>0 AND Shipment_ID=0"))
if blnNoShip then
redim arrShipments(ShipmentCollection.Count)
else
redim arrShipments(ShipmentCollection.Count - 1)
end if
dim orderTotal as decimal = 0.00
dim shipTotal as decimal = 0.00
for i = 0 to ShipmentCollection.Count - 1
arrShipments(i) = 0
objShipment = ShipmentCollection.Item(i)
Dim arrShipCosts() as Decimal = {0,0,0,0,0,0,0,0}
'arrShipCosts(0) = total of products
'arrShipCosts(1) = total of giftwrap
'arrShipCosts(2) = total of S&H
'arrShipCosts(3) = total of tax
'arrShipCosts(4) = total of coupons
'arrShipCosts(5) = total of discounts
'arrShipCosts(6) = total of other fee items
'arrShipCosts(7) = total of shipment
arrShipCosts(0) = objShipment.TotalCost(1)
arrShipCosts(7) = objShipment.TotalCost()
Dim arrFeeTotals(,) As String = objToken.StoreGroupDB.QueryArray("SELECT Product_ID, SUM(Quantity * ExtPrice) as TotalPrice FROM ORDERITEMS WHERE Order_ID=" & intOrderID & " AND Shipment_ID=" & objShipment.Shipment_ID & " AND Product_ID<0 GROUP BY Product_ID")
if isarray(arrFeeTotals) then
for j = 0 to ubound(arrFeeTotals, 2)
select case FCast.FInt(arrFeeTotals(0,j))
case -1
'tax item
arrShipCosts(3) += FCast.FDec(arrFeeTotals(1,j))
case -2
'shipping item
arrShipCosts(2) += FCast.FDec(arrFeeTotals(1,j))
case -3
'coupon
arrShipCosts(4) += FCast.FDec(arrFeeTotals(1,j))
case -4
'discount
arrShipCosts(5) += FCast.FDec(arrFeeTotals(1,j))
case -5
'gift wrap
arrShipCosts(1) += FCast.FDec(arrFeeTotals(1,j))
case -6
'giftcert, don't include
case else
'some other fee
arrShipCosts(6) += FCast.FDec(arrFeeTotals(1,j))
end select
next j
end if
orderTotal += cbLocale.FormatCurrency(objStore, arrShipCosts(7))
shipTotal += cbLocale.FormatCurrency(objStore, arrShipCosts(2))
next i
''
'' Update. October 2, 2006
''
'' The IP address range that I need to block out is 24.16.89.00 to 255
''
Dim isSalesman as Boolean = False
Dim strUserIP AS String = Request.ServerVariables("REMOTE_ADDR")
' Test:
'
' strUserIP = "24.x.x.x"
' strUserIP = "24.16.87.33"
' strUserIP = "24.16.89.00"
If Len(strUserIP) > 0 Then
Dim MyArray = Split(strUserIP, ".")
If UBound(MyArray) > 2 Then
''
'' His IP address loooks like 24.x.x.x
''
'' Comcast Changed IP to 71.231.42.167 on 10/28/06
'' Verizon DSL IP Added 71.112.111.42
'' Verizon DSL Static IP 71.123.166.27 on 1/29/08
If MyArray(0) = "71" AND MyArray(1) = "123" AND MyArray(2) = "166" Then
isSalesman = True
End If
End If
End If
If Not isSalesman Then
if curBalance = 0 then
%>
<img src="https://www.emjcd.com/u?AMOUNT=<%=orderTotal-shipTotal%>&CID=79366&OID=<%=objOrder.OrderNumber%>&TYPE=234&CURRENCY=USD&METHOD=IMG" height="1" width="20">
<%
end if
Else
%>
<!-- You are salesman with IP <%=strUserIP%> -->
<%
End If
%>
<!-- end commission junction tracking pixel -->