<!--#include file="../includes/dbFunctions.asp"-->
<!--#include file="../includes/Variables.asp"-->
<!--#include file="../includes/CartFunctions.asp"-->

<%
Dim tmpArray, SQLTrans, HTML, Plain

tmpArray = OpenSavedItinerary(Request("Itinerary_ID"), Request("UserID"))
OpenSavedItineraryItemArray(Request("Itinerary_ID"))

Set RSTrans = Server.CreateObject("ADODB.Recordset")
SQLTrans = "Select T.Transaction_ID, T.Itinerary_ID, T.CreateDate, CD.Name_First, CD.Name_Last, CD.Address_1, CD.City, CD.State, CD.Country, CD.Zip, U.User_Name "
SQLTrans = SQLTrans & "from Transactions T Inner Join (Users U Inner Join Contact_Detail CD On U.Contact_ID = CD.Contact_ID) on T.Contact_ID = U.User_ID "
SQLTrans = SQLTrans & "Where T.Transaction_ID = '" & Request("Transaction_ID") & "' And T.Contact_ID = '" & Request("UserID") & "'"
RSTrans.Open SQLTrans, Conn


HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Untitled Document</title>"
HTML = HTML & "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<link rel=""stylesheet"" href=""http:/www.vacationinflorida.com/Style-sheets/attraction-set.css"" type=""text/css"">"
HTML = HTML & "<link rel=""stylesheet"" href=""http:/www.vacationinflorida.com/Style-sheets/atrraction-set.css"" type=""text/css"">"
HTML = HTML & "<link rel=""stylesheet"" href=""http:/www.vacationinflorida.com/Style-sheets/headline.css"" type=""text/css"">"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"" text=""#000000"">"
HTML = HTML & "<table width=""500"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
HTML = HTML & "<tr> "
HTML = HTML & "<td colspan=""3"" class=""headline-prnt"" align=""center"">Purchase Receipt</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td colspan=""3"" class=""headline-prnt"" align=""left"">Vacation In Florida</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td class=""headline-prnt"" bgcolor=""#FFFFFF"" colspan=""2"">5770 W. Irlo Bronson "
HTML = HTML & "Memorial Highway<br>"
HTML = HTML & "Suite 129<br>"
HTML = HTML & "Kissimmee, Florida 34746<br>"
HTML = HTML & "1-866-YOU-BOOK<br>"
HTML = HTML & "1-866-968-2665 <br>"
HTML = HTML & "</td>"
HTML = HTML & "<td class=""statement-subhds-prnt"" bgcolor=""#FFFFFF"" width=""20%"">&nbsp;</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td class=""statement-subhds-prnt"" bgcolor=""#FFFFFF"" width=""37%"">&nbsp;</td>"
HTML = HTML & "<td class=""statement-subhds-prnt"" bgcolor=""#FFFFFF"" width=""43%"">&nbsp;</td>"
HTML = HTML & "<td class=""statement-subhds-prnt"" bgcolor=""#FFFFFF"" width=""20%"">&nbsp;</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td colspan=""3"" bgcolor=""#FFFFFF""> "
HTML = HTML & "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">Transaction #:</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("Transaction_ID") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">Itinerary #:</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("Itinerary_ID") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">Purchase Date:</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("CreateDate") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">&nbsp;</td>"
HTML = HTML & "<td width=""74%"" class=""statement-subhds-prnt"">&nbsp;</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">Customer:</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("Name_First") & " " & RSTrans("Name_Last") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">&nbsp;</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("Address_1") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">&nbsp;</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("City") & ", " & RSTrans("State") & ", "
HTML = HTML & RSTrans("Country") & " " & RSTrans("Zip") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">Username:</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">" & RSTrans("User_Name") & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">Payment Type:</td>"
HTML = HTML & "<td width=""74%"" class=""statement-detail-prnt"">&nbsp;</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td width=""26%"" class=""statement-subhds-prnt"">&nbsp;</td>"
HTML = HTML & "<td width=""74%"" class=""statement-subhds-prnt"">&nbsp;</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr> "
HTML = HTML & "<td colspan=""3"" class=""headline-prnt"" bgcolor=""#FFFFFF"">Hotel:</td>"
HTML = HTML & "</tr>"                                                                  

For j = tmpArray(10, LBound(tmpArray, 2)) to tmpArray(10, UBound(tmpArray, 2))
                                
Dim FirstDate, LastDate, transArray, rollaway
If Not GetFirstDateByID(tmpArray, j) = "Merc" Then
FirstDate = CDate(GetFirstDateByID(tmpArray, j))
LastDate = CDate(GetLastDateByID(tmpArray, j))
transArray = GetRooms(tmpArray, j)
rollaway = CCur(GetRollaway(transArray(1, LBound(transArray, 2))) * transArray(2, LBound(transArray, 2)))							
                               

HTML = HTML & "<tr><td class=""statement-detail-prnt"" colspan=""2"">" & GetEntityNameFromID(tmpArray, j) & "</td></tr>"
HTML = HTML & "<tr><td colspan=""2"" class=""headline-prnt"">Lodging "
HTML = HTML & "Reservation:</td></tr>"                                
HTML = HTML & "<tr bgcolor=""#FFFFFF"">"
For q = 1 to transArray(2, 0)

HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"">" & WeekDayName(WeekDay(FirstDate), True, 1) & " " & FormatDateTime(FirstDate, 2)& " - "
HTML = HTML & WeekDayName(WeekDay(LastDate), True, 1) & " " & FormatDateTime(LastDate, 2) & "</td>"
HTML = HTML & "<td width=""20%"" class=""statement-detail-prnt"">" & FormatCurrency(GetCostByTrans(tmpArray, j)) & "</td>"
HTML = HTML & "</tr>"
Next                              
If Not transArray(5, 0) = "0" Then
HTML = HTML & "<tr bgcolor=""#FFFFFF""> "
HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"">" & transArray(5, 0) & " Rollaway(s) "
HTML = HTML & "- " & NightCount(tmpArray, j) & " night(s)</td>"
HTML = HTML & "<td width=""20%"" class=""statement-detail-prnt"">" & FormatCurrency(CCur(GetRollaway(transArray(1, LBound(transArray, 2))) * transArray(5, LBound(transArray, 2)) * NightCount(tmpArray, j))) & "</td>"                                  
HTML = HTML & "</tr>"
End If
If tmpArray(6, j) > 0 Then
HTML = HTML & "<tr align=""left"">" 
HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"">" 
HTML = HTML & tmpArray(6, j) & "&nbsp;Extra Adult(s)</td>"
HTML = HTML & "<td width=""20%"" class=""statement-detail-prnt"">" & FormatCurrency(CCur(GetAdultCost(tmpArray, j)), 2)
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
End If
End If                              
Next
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"" height=""9"">Sales" 
HTML = HTML & "&amp; Room Tax</td>"
HTML = HTML & "<td width=""20%"" class=""statement-detail-prnt"" height=""9"">" & FormatCurrency(CCur(LodgingTax(tmpArray))) & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td width=""35%"" class=""statement-detail-prnt"">&nbsp;</td>"
HTML = HTML & "<td width=""45%"" class=""statement-subhds-prnt"">Lodging" 
HTML = HTML & "Total: </td>"
HTML = HTML & "<td width=""20%"" class=""statement-subhds-prntTTL"">" & FormatCurrency(CCur(LodgingTotalwTax(tmpArray))) & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td width=""35%"">&nbsp;</td>"
HTML = HTML & "<td width=""45%"">&nbsp;</td>"
HTML = HTML & "<td width=""20%"">&nbsp;</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td colspan=""3"" class=""headline-prnt"" bgcolor=""#FFFFFF"">Additional" 
HTML = HTML & "Items:</td>"
HTML = HTML & "</tr>"

Set RSItem = Server.CreateObject("ADODB.Recordset")
For i = LBound(tmpArray, 2) to UBound(tmpArray, 2)
If tmpArray(4, i) = "2" Then
SQLItem = "[Avante].[dbo].[Get_Merc_Detail_Single] '" & tmpArray(1, i) & "'"
RSItem.Open SQLItem, Conn
 
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"" height=""10"">" & tmpArray(2, i) 
HTML = HTML & "- " & RSItem("Name") & " @ " & FormatCurrency(CCur(tmpArray(3, i))) & "</td>"
HTML = HTML & "<td width=""20%"" height=""10"" class=""statement-detail-prnt"">" & FormatCurrency(CCur(tmpArray(2, i) * tmpArray(3, i))) & "</td>"
HTML = HTML & "</tr>"
RSItem.Close()
End If                                
Next
If Not MercExists(tmpArray) = True Then
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"">Sales" 
HTML = HTML & "tax </td>"
HTML = HTML & "<td width=""20%"" class=""statement-detail-prnt"">" & FormatCurrency(CCur(MerchandiseTax(tmpArray))) & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td class=""statement-detail-prnt"">&nbsp;</td>"
HTML = HTML & "<td class=""statement-subhds-prnt"" height=""12"" width=""43%"">Item Total:</td>"
HTML = HTML & "<td width=""20%"" width=""20%"" class=""statement-subhds-prntTTL"" height=""12"">" & FormatCurrency(CCur(MerchandiseTotalwTax(tmpArray))) & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td colspan=""2"" class=""statement-detail-prnt"">&nbsp;</td>"
HTML = HTML & "<td width=""20%"" class=""statement-detail-prnt"">&nbsp;</td>"
HTML = HTML & "</tr>"
End If
HTML = HTML & "<tr bgcolor=""#FFFFFF"">" 
HTML = HTML & "<td class=""statement-subhds"" bgcolor=""#FFFFFF"" height=""17"" width=""37%"">&nbsp;</td>"
HTML = HTML & "<td class=""statement-subhds-prnt"" bgcolor=""#FFFFFF"" height=""17"" width=""43%"">Total" 
HTML = HTML & "Charged to your Account:</td>"
HTML = HTML & "<td width=""20%"" class=""statement-subhds-prntTTL"" bgcolor=""#FFFFFF"" height=""17"">" & FormatCurrency(CCur(CartTotalwTax(tmpArray, itemArray))) & "</td>"
HTML = HTML & "</tr>"                                 
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"

set RSUser = Server.CreateObject("ADODB.Recordset")
sqlUser = "Select * From Contact_Detail CD Inner Join Users U on CD.Contact_ID = U.Contact_ID Where U.User_ID = '" & Request("UserID") & "'"
RSUser.Open sqlUser, Conn

    Dim myMail
    Set myMail = Server.CreateObject("CDONTS.NewMail")

    myMail.Subject="Vacation In Florida Reservation Receipt"

      myMail.From="reservations@vacationinflorida.com"
      myMail.Body=HTML
      myMail.BodyFormat=0
      myMail.MailFormat=0
      myMail.To = RSUser("Email_Home")

    myMail.Send
    set mymail=nothing

Response.Write "Sent" & "<br>"
Response.Write HTML


%>