%
' Get Form Variables
showOrders = TRIM( Request( "showOrders" ) )
showPage = TRIM( Request( "showPage" ) )
orderStatus = TRIM( Request( "os" ) )
shipID = TRIM( Request( "oid" ) )
checkOnly = TRIM( Request( "check" ) )
allPages = TRIM( Request( "allpages" ) )
amount = CInt( Request( "amount" ) )
paymentType = TRIM( Request( "paymentType" ) )
alreadypayed = CInt( Request( "alreadypayed" ) )
amount = amount + alreadypayed
' Assign Default Values
IF showOrders = "" THEN
showOrders = 1
END IF
IF showPage = "" THEN
showPage = 1
END IF
' Open Database Connection Server.MapPath(".")
dbPath = "E:/hshome/webcaddy/database/storedbexchange.mdb"
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
%>
Print Invoices
<%
' Update Shipping Date
sqlString = "UPDATE ship SET ship_shipped = NOW() " &_
"WHERE ship_status = 4"
IF session( "iDebugLevel" ) > 0 THEN %>
sqlString: <%=sqlstring%>
<%END IF
Con.Execute sqlString
' Retrieve Orders to be shipped
sqlString = "SELECT * " &_
" FROM (orders INNER JOIN (users INNER JOIN ship ON users.user_id = ship.ship_userID) " &_
" ON orders.order_shipID = ship.ship_shipID) " &_
" INNER JOIN Products ON orders.order_productID = Products.product_id " &_
" WHERE ship_status = 4"
sqlString = sqlString & " ORDER BY ship_created , orders.order_productID DESC"
IF session( "iDebugLevel" ) > 0 THEN %>
Session Debug Level Set to:<%=session( "iDebugLevel" )%>
sqlString: <%=sqlstring%>
<%END IF%>
<%
SET RS = Server.CreateObject( "ADODB.Recordset" )
RS.CursorType = adOpenStatic
IF allPages = "" THEN
RS.PageSize = 50
ELSE
RS.PageSize = 99999
END IF
RS.ActiveConnection = Con
RS.Open sqlString
IF NOT RS.EOF THEN
RS.AbsolutePage = cINT( showPage )
END IF
FUNCTION SELECTED( val1, val2 )
IF cSTR( val1 ) = cSTR( val2 ) THEN
SELECTED = " selected "
END IF
END FUNCTION
%>
<%
WHILE NOT RS.EOF AND rowCount < RS.PageSize
rowCount = rowCount + 1
%>
<%DestinationCountry = RS( "user_country" )
DestinationCountry = UCase(DestinationCountry)%>
Invoice Number: <%=RS( "ship_shipID" )%>
|
Mogg Adapter -
Shipping
Invoice
<%
if DestinationCountry = "AUSTRALIA" THEN %>
Tax Invoice - ABN: 11933592661 |
<% ELSE %>
<%END IF
%>
| Name: |
<%=RS( "user_username" )%> |
Address: |
| Order Date: |
<%=Day(RS("ship_created"))%>-<%=MonthName(Month(RS("ship_created")))%>-<%=Year(RS("ship_created"))%> |
<%=RS( "user_username" )%>
<%=RS( "user_street" )%>
<%=RS( "user_city" )%> , <%=RS( "user_zip" )%>
<%=DestinationCountry%> |
| Pay Date: |
<% IF isDATE( RS( "ship_paydate" ) ) THEN %>
<%=Day(RS("ship_paydate"))%>-<%=MonthName(Month(RS("ship_paydate")))%>-<%=Year(RS("ship_paydate"))%>
<% ELSE %>NOT Payed<% END IF %>
|
| Ship Date: |
<% IF isDATE( RS( "ship_shipped" ) ) THEN %>
<%=Day(RS("ship_shipped"))%>-<%=MonthName(Month(RS("ship_shipped")))%>-<%=Year(RS("ship_shipped"))%>
<% ELSE %>NOT Shipped<% END IF %>
|
| Email: |
?subject=Mogg-Adapter-Order&body=<%=RS( "user_firstname" )%>, "><%=RS( "user_email" )%> |
<%
currentUser=RS( "user_username" )
currentShip=RS( "ship_shipid" )
orderTotal = 0
nextuser = "FALSE"
statusShip = RS( "ship_status")
IDShip = RS( "ship_shipid" )
payment = RS( "ship_payment" )
paymentMethod = RS( "ship_paymethod" )
discount = RS( "user_discount" )%>
| Product: |
Qty |
Price |
Total |
<%
WHILE NOT RS.EOF AND nextuser = "FALSE"
IF currentShip = RS( "ship_shipid" ) THEN %>
| <%=RS( "product_name" )%> |
<%=RS( "order_quantity" )%> |
<%=FormatCurrency( RS( "order_price" ) )%> |
<%=FormatCurrency( RS( "order_quantity" ) * RS( "order_price" ) )%> |
<%orderTotal = orderTotal + ( RS( "order_quantity" ) * RS( "order_price" ) )
shipping = ( RS( "ship_charge" ))
RS.MoveNext
ELSE
nextuser = "TRUE"
IF session( "iDebugLevel" ) > 2 THEN %> Session Debug Level Set to:<%=session( "iDebugLevel" )%>
orderTotal: <%=orderTotal%>
payment: <%=payment%>
balance: <%=balance%>
shipid: <%=currentShip%>
userID: <%=currentUser%>
statusShip: <%=StatusShip%>
<%END IF%>
<%END IF
WEND
orderTotal = orderTotal + shipping
balance = orderTotal - payment
discountAmount = orderTotal * discount / 100
orderTotal = orderTotal + charge - discountAmount
balance = orderTotal - payment
%>
<%If discount > 0 then%>
| |
|
Discount |
<%=FormatCurrency( discountAmount)%> |
<%end if%>
| Payment Method: |
<%=paymentMethod %> |
Shipping: |
<%=FormatCurrency( shipping)%> |
| Total: |
<%=FormatCurrency( orderTotal)%> |
|
|
|
Payment: |
<%=FormatCurrency( payment)%> |
|
|
|
Balance: |
<%=FormatCurrency( balance)%> |
<%If DestinationCountry = "AUSTRALIA" then%>
| |
|
GST Paid |
<%=FormatCurrency( payment - (payment/1.1))%> |
<%end if%>
|
Thanks for your order, I hope it brings you astro-imaging enjoyment :)
If you have any problems or questions please contact.
Email: steven@webcaddy.com.au
Webpage: http://webcaddy.com.au/astro
Mogg Adapter
P.O. Box 219
Jerrabomberra, NSW 2619
AUSTRALIA
Invoice Printed: <%=Day(Now())%>-<%=MonthName(Month(Now()))%>-<%=Year(Now())%>
<%
WEND
%>