-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowCart.asp
129 lines (107 loc) · 4.72 KB
/
showCart.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<%@ Language="VBScript" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Homepage</title>
<style>
#wrapper {
position: absolute;
width: 1400px;
height: 750px;
top: 0%;
left: 0%;
background-color: rgba(128, 128, 128, 0.77);
}
#content
{
position: absolute;
width: 800px;
background-color: #ffd800;
top: 10%;
left:5%;
}
</style>
<script>
function genrateBill() {
var dateObj = new Date();
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
var date = year + "-" + month + "-" + day;
document.F3.method = "POST";
document.F3.action = "processBill.asp?date=" + date;
document.F3.submit();
/*var xhttp = new XMLHttpRequest();
var op = "";
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
document.F3.metod = "Post";
document.F3.action = "displayBill.asp";
document.F3.submit();
}
};
xhttp.open("POST", "processBill.asp?date="+date , false);
xhttp.send();*/
}
function redirect() {
document.F3.method = "POST";
document.F3.action = "order.asp";
document.F3.submit();
}
function cancel() {
document.F3.method = "POST";
document.F3.action = "deleteOrder.asp";
document.F3.submit();
}
</script>
</head>
<%
if session("empid") = "" then
response.redirect("sessionTimedOut.asp")
end if
Dim Connection
Dim Recordset
Dim SQL
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")
Connection.Open "DSN=csidsn"
%>
<body>
<div id="wrapper">
<%
SQL = "select count(oid) as c from orders"
Recordset.Open SQL,Connection
count = 0
if Recordset("c") = "0" then
content = content & "<div id = content> <center><h2 style='color:red;'> No Items Ordered </h2></br> <a href=selectCustomer.asp>Order Items First</a></center></div>"
else
Set RecordsetCart = Server.CreateObject("ADODB.Recordset")
SQL1 = "select * from orders"
RecordsetCart.open SQL1,Connection
content = content & "<form name=F3>"
content = content & "<div id = content ><center><H2>Orders</h2><table border=2><tr><th>Serial No</th><th>Item Name</th><th>Quantity</th><th>Sub Total</th></tr>"
do while not RecordsetCart.eof
count = count + 1
Set RecordsetInventory = Server.CreateObject("ADODB.Recordset")
SQL2 = "select * from inventory where itemno = "&RecordsetCart("itemno")&";"
RecordsetInventory.open SQL2,Connection
content = content & "<tr><td>"&count&"</td><td>"&RecordsetInventory("item_name")&"</td><td>"&RecordsetCart("quantity")&"</td><td>"&RecordsetCart("total")&"</td></tr>"
RecordsetInventory.movenext
set RecordsetInventory = nothing
RecordsetCart.movenext
loop
content = content & "</table></br><input type = button style = 'color:red;'value='Order More' onclick = redirect()>         <input type= button value = 'Cancel Order' onclick = 'cancel()'>         <input style = 'background-color:#00ff21;' type=button value='Generate Bill' onclick=genrateBill()></center>"
end if
content = content & "</form></div>"
response.write content
%>
</div>
</body>
</html>
<%
Set Recordset=nothing
Set RecordsetCart = nothing
Set Connection=nothing
%>