%
function yesno(what)
if what then yesno="YES" else yesno="NO"
end function
if session("order_id") <> "" then
cnn.execute "UPDATE tbl_order SET confirm_date=CURRENT_TIMESTAMP " & _
"WHERE id=" & session("order_id")
body = "Customer: " & session("cust_name") & vbcrlf & _
" Phone: " & session("cust_phone") & vbcrlf & _
" Store: " & replace(session("store_name"),"Freebirds @ ","") & vbcrlf & _
" Order #: " & session("order_id") & "w3" & vbcrlf & vbcrlf
body = body & "QTY" & space(7) & "DESCRIPTION" & space(29) & " PRICE" & vbcrlf
body = body & string(60, "-") & vbcrlf
total = 0
set rs = server.createobject("adodb.recordset")
sql = "SELECT tbl_oline.*, tbl_product.name AS prod_name, tbl_product.label AS prod_label, " & _
"tbl_product.type, tbl_product.meat AS prod_meat " & _
"FROM tbl_oline " & _
"LEFT JOIN tbl_product ON tbl_oline.product_id=tbl_product.id " & _
"WHERE order_id=" & session("order_id") & " " & _
"ORDER BY tbl_oline.id"
rs.open sql, cnn, 1, 3
do until rs.eof
total = total + (rs("qty") * rs("price"))
temp = formatcurrency(rs("qty") * rs("price"),2)
prod_name = replace(rs("prod_name"),chr(189),"1/2")
if rs("type") = "little" then prod_name = "LITTLE MONSTER " & prod_name
if rs("type") = "taco" then
if rs("seq_id") = -1 then
prod_name = prod_name & " (first taco)"
else
prod_name = prod_name & " (second taco)"
end if
end if
body = body & rs("qty") & space(10 - len(rs("qty"))) & _
ucase(prod_name) & space(40 - len(prod_name)) & _
space(10 - len(temp)) & temp & vbcrlf
if rs("type") = "taco" then
if rs("cook_type") = "G" then
body = body & space(10) & "- GRILLED" & vbcrlf
elseif rs("cook_type") = "S" then
body = body & space(10) & "- STEAMED" & vbcrlf
end if
end if
if rs("notes_basic") <> "" then
body = body & space(10) & "- [NOTES] " & rs("notes_basic") & vbcrlf
end if
if rs("prod_label") = "AT" then
if rs("avocado") = "G" then
body = body & space(10) & "- Guacamole" & vbcrlf
else
body = body & space(10) & "- Avocado" & vbcrlf
end if
end if
if rs("scream") then body = body & space(10) & "- Sour Cream" & vbcrlf
tort = ""
select case rs("tortilla")
case "F"
tort = "FLOUR"
case "W"
tort = "WHEAT"
case "C"
tort = "CAYENNE"
case "S"
tort = "SPINACH"
case "O"
tort = "CORN"
case "N"
tort = "NONE"
end select
select case rs("tortilla2")
case "F"
tort = tort & "/FLOUR"
case "W"
tort = tort & "/WHEAT"
case "C"
tort = tort & "/CAYENNE"
case "S"
tort = tort & "/SPINACH"
end select
if (tort <> "" and left(rs("prod_label"),1)<>"N") then body = body & space(10) & "- " & tort & " Tortilla" & vbcrlf
if rs("type") <> "quesadilla" then
if rs("rice") then body = body & space(10) & "- Rice" & vbcrlf
end if
if left(lcase(prod_name),5)="nacho" then
if rs("cheese") = 1 then body = body & space(10) & "- Queso" & vbcrlf
else
select case rs("cheese")
case 0
' nothing
case 1
body = body & space(10) & "- Monterrey Jack" & vbcrlf
case 2
body = body & space(10) & "- Cheddar/Jack Mix" & vbcrlf
end select
end if
if rs("type") <> "quesadilla" and rs("type") <> "sides" then
if rs("beans_black") then
body = body & space(10) & "- Black Beans" & vbcrlf
elseif rs("beans_refried") then
body = body & space(10) & "- Refried Beans" & vbcrlf
elseif rs("beans_whole") then
body = body & space(10) & "- Whole Beans" & vbcrlf
else
body = body & space(10) & "- NO Beans" & vbcrlf
end if
end if
select case rs("prod_meat")
case "C"
body = body & space(10) & "- CHICKEN"
select case rs("chicken")
case "D"
body = body & " (Dark Meat)" & vbcrlf
case "W"
body = body & " (White Meat)" & vbcrlf
case "B"
body = body & " (Dark & White Meat)" & vbcrlf
end select
case "S"
body = body & space(10) & "- STEAK" & vbcrlf
case "V"
body = body & space(10) & "- VEGGIE" & vbcrlf
case "B"
select case rs("chicken")
case "D"
body = body & space(10) & "- DARK CHICKEN & STEAK" & vbcrlf
case "W"
body = body & space(10) & "- WHITE CHICKEN & STEAK" & vbcrlf
case "B"
body = body & space(10) & "- DARK/WHITE CHICKEN & STEAK" & vbcrlf
end select
end select
if rs("notes_sauce") <> "" then
body = body & space(10) & "- [NOTES] " & rs("notes_sauce") & vbcrlf
end if
' sauces
if rs("sauce_bbq") then body = body & space(10) & "- BBQ Sauce" & vbcrlf
if rs("sauce_mild") then body = body & space(10) & "- Mild Sauce" & vbcrlf
if rs("sauce_hot") then body = body & space(10) & "- Hot Sauce" & vbcrlf
if rs("sauce_death") then body = body & space(10) & "- Death Sauce" & vbcrlf
if rs("sauce_habenero") then body = body & space(10) & "- Habanero Sauce" & vbcrlf
if rs("sauce_lime") then body = body & space(10) & "- Fresh Lime Juice" & vbcrlf
if rs("notes_free") <> "" then
body = body & space(10) & "- [NOTES] " & rs("notes_free") & vbcrlf
end if
' freebies
if rs("white_onions") then body = body & space(10) & "- White Onions" & vbcrlf
if rs("purple_onions") then body = body & space(10) & "- Purple Onions" & vbcrlf
if rs("tomatoes") then body = body & space(10) & "- Tomatoes" & vbcrlf
if rs("pico") then body = body & space(10) & "- Pico De Gallo" & vbcrlf
if rs("jalapenos") then body = body & space(10) & "- Jalapenos" & vbcrlf
if rs("cilantro") then body = body & space(10) & "- Cilantro" & vbcrlf
if rs("salsa") then body = body & space(10) & "- Salsa" & vbcrlf
if rs("e_po") then body = body & space(10) & "- Roasted Peppers and Onions" & vbcrlf
if rs("rgarlic") then body = body & space(10) & "- Roasted Garlic" & vbcrlf
if rs("notes_extra") <> "" then
body = body & space(10) & "- [NOTES] " & rs("notes_extra") & vbcrlf
end if
' extras
if rs("prod_label") <> "XX" then
if rs("e_scream") then body = body & space(10) & "- EXTRA Sour Cream" & vbcrlf
if rs("e_guac") then body = body & space(10) & "- EXTRA Guacamole" & vbcrlf
if rs("e_avo") then body = body & space(10) & "- EXTRA Sliced Avocado" & vbcrlf
if rs("e_cheese") then body = body & space(10) & "- EXTRA Cheese" & vbcrlf
if rs("e_rice") then body = body & space(10) & "- EXTRA Rice" & vbcrlf
if rs("e_beans_black") then body = body & space(10) & "- EXTRA Black Beans" & vbcrlf
if rs("e_beans_refried") then body = body & space(10) & "- EXTRA Refried Beans" & vbcrlf
if rs("e_beans_whole") then body = body & space(10) & "- EXTRA Whole Beans" & vbcrlf
if rs("e_queso") then body = body & space(10) & "- EXTRA 2 oz Queso" & vbcrlf
else
if rs("e_scream") then body = body & space(10) & "- Sour Cream" & vbcrlf
if rs("e_guac") then body = body & space(10) & "- Guacamole" & vbcrlf
if rs("e_avo") then body = body & space(10) & "- Sliced Avocado" & vbcrlf
if rs("e_cheese") then body = body & space(10) & "- Cheese" & vbcrlf
if rs("e_rice") then body = body & space(10) & "- Rice" & vbcrlf
if rs("e_beans_black") then body = body & space(10) & "- Black Beans" & vbcrlf
if rs("e_beans_refried") then body = body & space(10) & "- Refried Beans" & vbcrlf
if rs("e_beans_whole") then body = body & space(10) & "- Whole Beans" & vbcrlf
if rs("e_queso") then body = body & space(10) & "- 2 oz Queso" & vbcrlf
end if
temp = ""
if rs("e_steak") then
if temp <> "" then temp = temp & "/"
temp = temp & "Steak"
end if
if rs("e_wchick") then
if temp <> "" then temp = temp & "/"
temp = temp & "White Chicken"
end if
if rs("e_dchick") then
if temp <> "" then temp = temp & "/"
temp = temp & "Dark Chicken"
end if
if temp <> "" then
body = body & space(10) & "- EXTRA " & temp & vbcrlf
end if
' lettuce
if rs("lettuce") then body = body & space(10) & "- Lettuce" & vbcrlf
' extra tortilla
tort = ""
select case rs("e_tortilla") & ""
case "F"
tort = "FLOUR"
case "W"
tort = "WHEAT"
case "C"
tort = "CAYENNE"
case "S"
tort = "SPINACH"
end select
if rs("e_tortilla") <> "" then body = body & space(10) & "- EXTRA " & tort & " Tortilla" & vbcrlf
' name
if rs("prod_label") <> "XX" then
body = body & space(10) & "- Name: " & rs("label") & vbcrlf
end if
' figure out how to label it
lbl = ""
credit = 0
label = rs("prod_label")
' on burritos give them credit for rice, beans and cheese
if rs("type") = "burrito" then
if rs("rice") = 0 then credit = credit + 1
if rs("cheese") = 0 then credit = credit + 1
if rs("beans_black") = 0 and rs("beans_refried") = 0 and rs("beans_whole") = 0 then credit = credit + 1
end if
' on meat tacos give them credit for cheese and beans
if rs("prod_label") = "CT" or rs("prod_label") = "ST" then
if rs("cheese") = 0 then credit = credit + 1
if rs("beans_black") = 0 and rs("beans_refried") = 0 and rs("beans_whole") = 0 then credit = credit + 1
end if
if rs("e_scream") then
if credit = 0 then label = label & "1" else credit = credit - 1
end if
if rs("e_guac") then label = label & "2"
if rs("e_avo") then label = label & "3"
if rs("e_queso") then label = label & "4"
'if rs("e_po") then
' if credit = 0 then label = label & "4" else credit = credit - 1
'end if
if rs("e_rice") then
if credit = 0 then label = label & "6" else credit = credit - 1
end if
if rs("e_cheese") then
if credit = 0 then label = label & "7" else credit = credit - 1
end if
if rs("e_beans_black") or rs("e_beans_refried") or rs("e_beans_whole") then
if credit = 0 then label = label & "8" else credit = credit - 1
end if
if rs("e_steak") or rs("e_wchick") or rs("e_dchick") then label = label & "9"
if rs("prod_label") <> "XX" then
if label <> "" then body = body & space(10) & "- Label: " & label & vbcrlf
end if
if rs("qty") > 1 then
body = body & space(10) & "NOTE: QUANTITY OF " & rs("qty") & vbcrlf
end if
body = body & vbcrlf
rs.movenext
loop
rs.close
set rs = nothing
body = body & vbcrlf & space(50) & string(10, "-") & vbcrlf
temp = formatcurrency(total,2)
body = body & vbcrlf & _
space(38) & "Order Total:" & _
space(10 - len(temp)) & temp & vbcrlf
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Freebirds Web Ordering"
Mailer.FromAddress = "shepherd@freebirds.com"
Mailer.RemoteHost = "smtp.1and1.com"
Mailer.AddRecipient replace(session("store_name"),",","-"), session("store_email")
Mailer.AddBCC session("cust_name"), session("cust_email")
'Mailer.AddBCC "Chris Taylor", "chris@ctay.net"
'Mailer.AddBCC "Chris Test", "taylor.chris@verizon.net"
Mailer.AddBCC "Chris Youmans", "chris@freebirds.com"
Mailer.AddBCC "Celina", "celina@freebirds.com"
'Mailer.AddBCC "Eat at Freebirds", "eat@freebirds.com"
if session("test") then
Mailer.Subject = "(TEST) Freebirds Web Order"
else
Mailer.Subject = "Freebirds Web Order"
end if
Mailer.BodyText = body
Mailer.DateTime = WeekDayName(WeekDay(Date), true) & ", " & Day(Date) & " " & MonthName(Month(Date), true) & " " & Year(Date) & " " & FormatDateTime(Now, 4) & " -0500"
Mailer.SendMail
Set Mailer = nothing
cnn.execute "UPDATE tbl_order SET sent_date=CURRENT_TIMESTAMP " & _
"WHERE id=" & session("order_id")
cnn.close
set cnn = nothing
session.abandon
response.redirect "thanks.asp"
end if
%>