-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewTransaction.asp
171 lines (139 loc) · 6.88 KB
/
NewTransaction.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<%
Session("STimeoutError")=""
if Session("STxtUserEmail")="" then
Session("STimeoutError")="Your Session has been Timed Out! Please Login to continue"
response.Redirect("Login.asp")
end if
%>
<!--#include file="ValidateLogin.asp"-->
<%
'Dim Conn
'Dim CS
Set Conn = Server.CreateObject("ADODB.Connection")
CS = "Driver={SQL Server};Server=NABEELS-WORK;Database=HomeExpenseTracker;User Id=homeexpense;Password=Nabeel30;"
Conn.Open CS
Dim TableName
TableName = Request.QueryString("AccTableName")
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Home Expense Tracker - New Transaction</title>
<link rel="stylesheet" href="CSS/bootstrap.css">
<link rel="stylesheet" href="CSS/StyleNewTrans.css">
</head>
<body>
<!--- #include file="Header.asp" -->
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="wrapper">
<header>
<h1>New Transaction</h1>
</header>
<hr>
<form action="SaveTransaction.asp" method="POST" class="combo-account">
<div>
<label for="AccTableName">Select Account</label>
<select name="AccTableName" class="select-account form-control">
<%
Dim RSAccounts
Set RSAccounts = Server.CreateObject("ADODB.RecordSet")
RSAccounts.Open "SELECT TableName, TableDescription FROM AccountsTable",Conn
do while Not RSAccounts.EOF
if RSAccounts("TableName") = TableName then
%>
<option value="<% response.write(RSAccounts("TableName")) %>" selected>
<% response.write(RSAccounts("TableDescription")) %></option>
<%
else
%>
<option value="<% response.write(RSAccounts("TableName")) %>">
<% response.write(RSAccounts("TableDescription")) %></option>
<%
end if
RSAccounts.MoveNext
Loop
RSAccounts.Close
Set RSAccounts = Nothing
%>
</select>
</div>
<hr>
<div class="form-group">
<label for="">Transaction Date</label>
<input type="date" class="form-control" name="TrDate">
<span
style="color: red; font-size:medium;"><% response.Write(Session("DateError")) %></span>
</div>
<div class="form-group">
<label for="">Category</label>
<select name="SelectCategory" class="select-account form-control">
<%
Dim RSCatg
Set RSCatg = Server.CreateObject("ADODB.RecordSet")
RSCatg.Open "SELECT CategoryID, Category FROM Categories",Conn
do while Not RSCatg.EOF
%>
<option value="<% response.write(RSCatg("CategoryID")) %>">
<% response.write(RSCatg("Category")) %></option>
<%
RSCatg.MoveNext
Loop
RSCatg.Close
Set RSCatg = Nothing
%>
</select>
</div>
<div class="form-group">
<label for="">Person</label>
<select name="SelectPerson" class="select-account form-control">
<%
Dim RSPerson
Set RSPerson = Server.CreateObject("ADODB.RecordSet")
RSPerson.Open "SELECT PersonID, PersonName FROM Persons",Conn
do while Not RSPerson.EOF
%>
<option value="<% response.write(RSPerson("PersonID")) %>">
<% response.write(RSPerson("PersonName")) %></option>
<%
RSPerson.MoveNext
Loop
RSPerson.Close
Set RSPerson = Nothing
%>
</select>
</div>
<div class="form-group">
<label for="">Transaction Description</label>
<textarea cols="30" rows="3" class="form-control" name="TrDesc"></textarea>
</div>
<div class="form-group">
<label for="">Credit Amount</label>
<input type="text" class="form-control" name="CreditAmount">
<span
style="color: red; font-size:medium;"><% response.Write(Session("CreditError")) %></span>
</div>
<div class="form-group">
<label for="">Debit Amount</label>
<input type="text" class="form-control" name="DebitAmount">
<span
style="color: red; font-size:medium;"><% response.Write(Session("DebitError")) %></span>
</div>
<div>
<input type="submit" value="Save Record" class="btn-select">
</div>
<div>
<span
style="color: red; font-size:medium;"><% response.Write(Session("ErrorFound")) %></span>
</div>
</form>
</div>
</div>
</div>
</div>
<!--- #include file="Footer.asp" -->
</body>
</html>