%
Response.Buffer = true
Response.Expires="20"
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Dim seqnum,seq_num,Q1,Qt1,fd1,tp1,Quanty1,fname,ph,addr,cit,st
Dim NQt1Value,Nfd1Value,NTP1Value,NQt2Value,Nfd2Value,NTP2Value,NQt3Value,Nfd3Value,NTP3Value,NQt4Value,Nfd14Value,NTP4Value
Dim NQt15Value,Nfd5Value,NTP5Value
Dim PrEach1,EachP1,PrEach2,EachP2,PrEach3,EachP3,PrEach4,EachP4,PrEach5,EachP5
seq_file = "seqnum"
rootpath = Server.MapPath("/")
path = Server.MapPath("/_private") & "\"
path1 = Server.MapPath("/data") & "\"
seq_num = 0
%>
LUNCH SPECIAL
<%
Call ReadFile
ReqForm = Request.Form("Submit")
Select CASE ReqForm
Case "Submit Luch Order"
Q1 = Request.form("Qty1")
Q2 = Request.form("Qty2")
Q3 = Request.form("Qty3")
Q4 = Request.form("Qty4")
Q5 = Request.form("Qty5")
P1 = Request.form("Price1")
P2 = Request.form("Price2")
P3 = Request.form("Price3")
P4 = Request.form("Price4")
P5 = Request.form("Price5")
fd1 = Request.form("food1")
fd2 = Request.form("food2")
fd3 = Request.form("food3")
fd4 = Request.form("food4")
fd5 = Request.form("food5")
Size1 = Request.Form("Sizes1")
Size2 = Request.Form("Sizes2")
Size3 = Request.Form("Sizes3")
Size4 = Request.Form("Sizes4")
Size5 = Request.Form("Sizes5")
If Q1 <> "" Then
If IsNumeric(Q1) Then
TotP1 = Q1 * P1
'TotP1 = FormatNumber(TotP1,2)
Else
Response.clear
End if
End if
IF Q2 <> "" Then
If IsNumeric(Q2) Then
TotP2 = Q2 * P2
'TotP2 = FormatNumber(TotP2,2)
Else
Response.clear
End if
End if
If Q3 <> "" Then
'If IsNumeric(Q3) Then
TotP3 = Q3 * P3
'TotP3 = FormatNumber(TotP3,2)
'Else
'Response.clear
'End if
End if
If Q4 <> "" Then
If IsNumeric(Q4) Then
TotP4 = Q4 * P4
'TotP4 = FormatNumber(TotP4,2)
Else
Response.clear
End if
End if
If Q5 <> "" Then
If IsNumeric(Q5) Then
TotP5 = Q5 * P5
'TotP5 = FormatNumber(TotP5,2)
Else
Response.clear
End if
End if
OrdTotPri = TotP1 + TotP2 + TotP3 + TotP4 + TotP5
OrdTotPri = FormatCurrency(OrdTotPri)
If TotP1 OR TotP2 OR TotP3 OR TotP3 OR TotP4 OR TotP5 = 0 Then
Response.Clear
End if
If TotP1 OR TotP2 OR TotP3 OR TotP3 OR TotP4 OR TotP5 > 0 Then
If TotP1 = 0 Then
TotP1 = empty
End if
If TotP2 = 0 Then
TotP2 = empty
End if
If TotP3 = 0 Then
TotP3 = empty
End if
If TotP4 = 0 Then
TotP4 = empty
End if
If TotP5 = 0 Then
TotP5 = empty
End if
'Response.write "Totp1=" & TotP1 & " " & "Totp2=" & TotP2 & " " & "Totp3=" & TotP3 & "
"
'Response.write "Totp4=" & TotP4 & " " & "Totp5=" & TotP5 & "
"
TotP1 = FormatCurrency(TotP1)
TotP2 = FormatCurrency(TotP2)
TotP3 = FormatCurrency(TotP3)
TotP4 = FormatCurrency(TotP4)
TotP5 = FormatCurrency(TotP5)
If TotP1 = "$0.00" Then
TotP1 = empty
End if
If TotP2 = "$0.00" Then
TotP2 = empty
End if
If TotP3 = "$0.00" Then
TotP3 = empty
End if
If TotP4 = "$0.00" Then
TotP4 = empty
End if
If TotP5 = "$0.00" Then
TotP5 = empty
End if
Call ConfirmOrder
Response.End
End if
Case "Submit Order"
'Response.Write "You have order" & "
"
Qt1 = Request.Form("Qty1")
Qt2 = Request.Form("Qty2")
Qt3 = Request.Form("Qty3")
Qt4 = Request.Form("Qty4")
Qt5 = Request.Form("Qty5")
TP1 = Request.Form("NTotalP1")
TP2 = Request.Form("NTotalP2")
TP3 = Request.Form("NTotalP3")
TP4 = Request.Form("NTotalP4")
TP5 = Request.Form("NTotalP5")
fd1 = Request.form("food1")
fd2 = Request.form("food2")
fd3 = Request.form("food3")
fd4 = Request.form("food4")
fd5 = Request.form("food5")
CP1 = Request.form("Price1")
CP2 = Request.form("Price2")
CP3 = Request.form("Price3")
CP4 = Request.form("Price4")
CP5 = Request.form("Price5")
NOrdTotPri = Request.Form("NTotOrderPric")
Call DispInfo
Response.End
Case "Send Order"
NQt1Value = Request.Form("NQt1")
NQt2Value = Request.Form("NQt2")
NQt3Value = Request.Form("NQt3")
NQt4Value = Request.Form("NQt4")
NQt5Value = Request.Form("NQt5")
Nfd1Value = Request.Form("Nfd1")
Nfd2Value = Request.Form("Nfd2")
Nfd3Value = Request.Form("Nfd3")
Nfd4Value = Request.Form("Nfd4")
Nfd5Value = Request.Form("Nfd5")
NTP1Value = Request.Form("NTP1")
NTP2Value = Request.Form("NTP2")
NTP3Value = Request.Form("NTP3")
NTP4Value = Request.Form("NTP4")
NTP5Value = Request.Form("NTP5")
PrEach1 = Request.Form("EachP1")
PrEach2 = Request.Form("EachP2")
PrEach3 = Request.Form("EachP3")
PrEach4 = Request.Form("EachP4")
PrEach5 = Request.Form("EachP5")
NewOrdTotPriValue = Request.Form("NewOrdTotPri")
FirstName = Request.Form("FirstName")
LName = Request.Form("LastName")
Ph = Request.Form("PhoneNum")
Addr = Request.Form("CustAddress")
Cit = Request.Form("CustCity")
St = Request.Form("CustState")
PickUP = Request.Form("Option1")
Delivery = Request.Form("Option2")
if Delivery <> "" Then
FoodPref = Delivery
else
FoodPref = PickUP
End if
seq_num = seqnum + 1
'Response.write "Sequence Number = " & seq_num & "
"
Call CreatingFile
Call CreateSeqFile
Server.Execute("deletefile.asp")
'Response.Write "Order Information" & "
"
%>
Order Information
<%
If NQt1Value <> "" Then
Response.write NQt1Value & " " & Nfd1Value & " = " & NTP1Value & "
"
End if
If NQt2Value <> "" Then
Response.write NQt2Value & " " & Nfd2Value & " = " & NTP2Value & "
"
End if
If NQt3Value <> "" Then
Response.write NQt3Value & " " & Nfd3Value & " = " & NTP3Value & "
"
End if
If NQt4Value <> "" Then
Response.write NQt4Value & " " & Nfd4Value & " = " & NTP4Value & "
"
End if
If NQt5Value <> "" Then
Response.write NQt5Value & " " & Nfd5Value & " = " & NTP5Value & "
" & "
"
End if
FinalPrice = NTP1Value + NTP2Value + NTP3Value + NTP4Value + NTP5Value
'Response.Write "Total Order Price = " & "$" & NewOrdTotPriValue & "
"
Response.Write "Total Order Price = " & NewOrdTotPriValue & "
"
'Response.Write "Customer Information" & "
"
%>
Customer Information
<%
Response.write "First Name: " & FirstName & "
"
Response.write "Last Name: " & LName & "
"
Response.write "Phone: " & ph & "
"
Response.write "Address: " & addr & "
"
Response.write "City: " & cit & " " & "State:" & st & "
"
Response.write "Order Type: " & FoodPref & "
"
%>
<%
Response.End
Case "Place Another Order"
Call Get_order
Response.End
End Select
Sub DispInfo
'Response.Redirect(HomeUrl)
%>
Order Summary
<%
'Response.Write "Order Summary" & "
" & "
"
If Qt1 <> "" Then
Response.write Qt1 & " " & fd1 & " = " & TP1 & "
"
End if
If Qt2 <> "" Then
Response.write Qt2 & " " & fd2 & " = " & TP2 & "
"
End if
If Qt3 <> "" Then
Response.write Qt3 & " " & fd3 & " = " & TP3 & "
"
End if
If Qt4 <> "" Then
Response.write Qt4 & " " & fd4 & " = " & TP4 & "
"
End if
If Qt5 <> "" Then
Response.write Qt5 & " " & fd5 & " = " & TP5 & "
" & "
"
End if
'Response.Write "Total Order Price = " & "$" & NOrdTotPri
Response.Write "Total Order Price = " & NOrdTotPri
%>
Customer Information
<%
End sub
Call Get_order
Sub Get_order
%>
LUNCH SPECIAL
(Free Spring Roll or
Soup or Can Soda)
Served
w. Pork or Chicken Fried Rice
11:00AM
- 3:00 PM
<%End sub
Sub ConfirmOrder
%>
Please Confirm your Order
<%
End sub
Sub ReadFile
Set fso = CreateObject("Scripting.FilesystemObject")
If fso.FileExists(path1 & seq_file) then
Set seqfile = fso.OpenTextFile(path1 & seq_file, ForReading)
seqnum = seqfile.ReadLine
seqfile.Close
set seqfile = nothing
Else
set f2 = fso.CreateTextFile(path1 & seq_file,True)
f2.WriteLine(seq_num)
f2.close
set f2 = Nothing
Set seqfile = fso.OpenTextFile(path1 & seq_file, ForReading)
seqnum = seqfile.ReadLine
seqfile.Close
set seqfile = nothing
End if
set fso = Nothing
End sub
Sub CreatingFile
Dim f1,fsofile
Dim Result1,Result2,Result3,Result4,Result5
fname = "LunchOrder"
CustInf = "Customer Information"
CusInfValue = FirstName & " " & LName & "," & ph & "," & addr & "," & cit & " " & st & "," & foodpref
NCusInfValue = Split(CusInfValue,",")
ub = Ubound(NCusInfValue)
lb = Lbound(NCusInfValue)
Result1 = ""
Result2 = ""
Result3 = ""
Result4 = ""
Result5 = ""
'For i = lb to ub
'Response.write NCusInfValue(i) & "
"
'Next
Set fsofile = CreateObject("Scripting.FilesystemObject")
'Response.write ("Creating text file in data directory " & fname & seq_num & ".txt") & "
"
'Response.write (CusInfValue) & "
"
set fl = fsofile.CreateTextFile(path1 & fname & seq_num & ".txt",True)
'fl.Writeline()
'fl.Writeline()
'fl.Writeline()
if NQt1Value <> "" Then
Result1 = NQt1Value & " " & Nfd1Value & " " & PrEach1 & " " & NTP1Value
Result1 = (Result1 & ",")
End if
if NQt2Value <> "" Then
Result2 = NQt2Value & " " & Nfd2Value & " " & PrEach2 & " " & NTP2Value
Result2 = (Result2 & ",")
end if
if NQt3Value <> "" Then
Result3 = NQt3Value & " " & Nfd3Value & " " & PrEach3 & " " & NTP3Value
Result3 = (Result3 & ",")
end if
if NQt4Value <> "" Then
Result4 = NQt4Value & " " & Nfd4Value & " " & PrEach4 & " " & NTP4Value
Result4 = (Result4 & ",")
end if
if NQt5Value <> "" Then
Result5 = NQt5Value & " " & Nfd5Value & " " & PrEach5 & " " & NTP5Value
Result5 = (Result5 & ",")
end if
'fl.Writeline(UCase((Result1) & "," & (Result2) & "," & (Result3) & "," & (Result4) & "," & (Result5)))
fl.Writeline(UCase((Result1) & (Result2) & (Result3) & (Result4) & (Result5)))
fl.Writeline(UCase((" Total Order Price" & " " & NewOrdTotPriValue)))
'For i = lb to ub
'fl.Writeline NCusInfValue(i)
'Response.write NCusInfValue(i) & "
"
'Next
'f1.WriteLine(CusInfValue)
'FirstName & " " & LName & "," & ph & "," & addr & "," & cit & " " & st & "," & foodpref
fl.Writeline(UCase((FirstName) & "," & (LName) & "," & (ph) & "," & (addr) & "," & (cit) & "," & (st)))
'fl.Writeline(LName)
'fl.Writeline(ph)
'fl.Writeline(addr)
'fl.Writeline(cit)
'fl.Writeline(st)
'fl.Writeline(foodpref)
Set f1 = Nothing
Set fsofile = Nothing
End sub
Sub CreateSeqFile
Set fso = CreateObject("Scripting.FilesystemObject")
set f3 = fso.OpenTextFile(path1 & seq_file, ForWriting)
f3.WriteLine(seq_num)
f3.close
Set f3 = Nothing
Set fso = Nothing
End sub
%>