PageRenderTime 20ms CodeModel.GetById 8ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/bank/traceCheqPaid.asp

http://github.com/khaneh/Orders
ASP | 294 lines | 242 code | 33 blank | 19 comment | 46 complexity | daeac6c781e25640c34ae0a9521cfee5 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Bank (10 [=A])
  3PageTitle= "������ ����� �������"
  4SubmenuItem=3
  5if not Auth("A" , 3) then NotAllowdToViewThisPage()
  6
  7%>
  8<!--#include file="top.asp" -->
  9<!--#include File="../include_farsiDateHandling.asp"-->
 10<!--#include File="../include_JS_InputMasks.asp"-->
 11<BR><BR>
 12<style>
 13	.RcpMainTable { font-family:tahoma; font-size: 9pt; border: 2px solid #000088; padding:0; direction: RTL; width:600px;}
 14	.RcpMainTable Tr {Height:25px; border: 1px solid black;}
 15	.RcpMainTableInput { font-family:tahoma; font-size: 9pt; width:100px; border: 1px solid gray; text-align:center; direction: LTR;}
 16	.RcpMainTable Select { font-family:tahoma; font-size: 9pt; width:120px;}
 17</style>
 18
 19<CENTER>
 20<%
 21
 22function DecsAsc (x)
 23  if cint(s) = cint(x) then
 24	if DESC=1 then
 25		result = "v"
 26	else
 27		result = "^"
 28	end if
 29  end if 
 30  DecsAsc = result
 31end function
 32
 33'-----------------------------------------------------------------------------------------------------
 34'------------------------------------------------------------------------------------------ Submit Pay
 35'-----------------------------------------------------------------------------------------------------
 36if request.form("submit") = "��� ��" then
 37	x = request.form("pay")
 38	
 39	set RSV=Conn.Execute ("SELECT PaidCheques.Amount, PaidCheques.status, PaidCheques.Banker, Bankers.Name FROM PaidCheques INNER JOIN Bankers ON PaidCheques.Banker = Bankers.ID WHERE (PaidCheques.ID = "& x & ")" ) 
 40
 41	if RSV.EOF then
 42		response.write "<BR><BR>���� ����� ����! <BR>�� ������ ��� ���� ����"
 43		response.write "<BR><BR>Ӂ� �� ���� ����� ���� Ȑ����"
 44	response.write "<BR><BR><CENTER><A HREF='traceCheqPaid.asp?fromSession=y'>�ѐ��</A></CENTER>"
 45		response.end
 46	elseif RSV("status")="1" then 
 47		response.write "<BR><BR>���� ����� ����! <BR>�� ������ ��� ���� ����"
 48		response.write "<BR><BR>Ӂ� �� ���� ����� ���� Ȑ����"
 49	response.write "<BR><BR><CENTER><A HREF='traceCheqPaid.asp?fromSession=y'>�ѐ��</A></CENTER>"
 50		response.end
 51	end if
 52
 53	Conn.Execute ("update PaidCheques set Status=1, StatusSetBy="& session("ID")& ", StatusSetDate=N'"& shamsiToday()& "' where ID="& x ) 
 54
 55	Conn.Execute ("update Bankers set CurrentBalance=CurrentBalance-"& RSV("amount") & " where ID="& RSV("Banker") ) 
 56	
 57	response.write "<BR><BR>�� ����� " & x & "�� ���� "& RSV("Amount") & "����   �� ���  "& RSV("Name") & " ��� ��"
 58	response.write "<BR><BR><CENTER><A HREF='traceCheqPaid.asp?fromSession=y'>�ѐ��</A></CENTER>"
 59	response.end
 60end if 
 61'-----------------------------------------------------------------------------------------------------
 62'--------------------------------------------------------------------------------------- Submit Search
 63'-----------------------------------------------------------------------------------------------------
 64if request.form("submit") = "�����" then
 65	Banks = request.form("Banks")
 66	ChequeDatesFrom = request.form("ChequeDatesFrom")
 67	ChequeDatesTo = request.form("ChequeDatesTo")
 68	status = request.form("status")
 69	response.cookies("OldURL") = Request.ServerVariables("HTTP_REFERER")
 70	'response.form = "a"
 71	'response.write Request.ServerVariables("HTTP_REFERER")
 72
 73
 74	myQuery ="SELECT dbo.Payments.Account AS Account, dbo.PaidCheques.*, dbo.Bankers.Name AS BankName, dbo.Bankers.ID AS BankID, dbo.Users.RealName AS CSR, dbo.RcvPayChqStatus.Name AS statusName FROM dbo.PaidCheques INNER JOIN dbo.Bankers ON dbo.PaidCheques.Banker = dbo.Bankers.ID INNER JOIN dbo.Users ON dbo.PaidCheques.CreatedBy = dbo.Users.ID INNER JOIN dbo.Payments ON dbo.PaidCheques.Payment = dbo.Payments.ID INNER JOIN dbo.RcvPayChqStatus ON dbo.PaidCheques.Status = dbo.RcvPayChqStatus.ID WHERE (1 = 1)"
 75
 76
 77	'myQuery = "SELECT Payments.Account, PaidCheques.*, Bankers.Name AS BankName, Bankers.ID AS BankID, Users.RealName AS CSR FROM PaidCheques INNER JOIN Bankers ON PaidCheques.Banker = Bankers.ID INNER JOIN Users ON PaidCheques.CreatedBy = Users.ID INNER JOIN Payments ON PaidCheques.Payment = Payments.ID WHERE 1=1 "
 78	
 79	if not ( ChequeDatesTo = "" ) then 
 80		myQuery  = myQuery  &  " AND (PaidCheques.ChequeDate < N'"& ChequeDatesTo & "') "
 81	end if 
 82	
 83	if not ( ChequeDatesFrom = "" ) then 
 84		myQuery  = myQuery  &  " AND (PaidCheques.ChequeDate >= N'"& ChequeDatesFrom & "')"
 85	end if 
 86	
 87	if not Banks = "-2" then 
 88		myQuery  = myQuery  & " AND (PaidCheques.Banker = "& Banks & ")"
 89	end if 
 90
 91	if not (status = "-1" or status = "") then 
 92		myQuery  = myQuery  & " AND (PaidCheques.Status = "& status & ")"
 93	end if 
 94	'response.write myQuery
 95end if 
 96
 97if myQuery = "" then 
 98	myQuery = "SELECT Payments.Account, PaidCheques.*, Bankers.Name AS BankName, Bankers.ID AS BankID, Users.RealName AS CSR FROM PaidCheques INNER JOIN Bankers ON PaidCheques.Banker = Bankers.ID INNER JOIN Users ON PaidCheques.CreatedBy = Users.ID INNER JOIN Payments ON PaidCheques.Payment = Payments.ID  WHERE (PaidCheques.Status = 0) "
 99	Banks = -2
100	ChequeDatesFrom = ""
101	ChequeDatesTo = ""
102	status = "0"
103end if
104
105if request("fromSession") = "y" then
106	myQuery = session("myQuery")
107	Banks = session("Banks")
108	ChequeDatesFrom = session("ChequeDatesFrom") 
109	ChequeDatesTo = session("ChequeDatesTo") 
110	status = session("status") 
111end if
112
113s = request("s")
114if s="" then s="1"
115
116if s="1" then
117	orderBy = "PaidCheques.ID"
118elseif s="2" then
119	orderBy = "PaidCheques.ChequeNo"
120elseif s="3" then
121	orderBy = "PaidCheques.ChequeDate"
122elseif s="4" then
123	orderBy = "PaidCheques.amount"
124elseif s="5" then
125	orderBy = "PaidCheques.CreatedBy"
126elseif s="6" then
127	orderBy = "PaidCheques.status"
128elseif s="7" then
129	orderBy = "PaidCheques.Banker"
130elseif s="8" then
131	orderBy = "Payments.Account"
132end if
133
134Desc = request("Desc")
135if Desc = "" then 
136	Desc = 1
137else
138	Desc = 3 - Desc
139end if
140
141myQuery2  = myQuery  & " order by " & orderBy
142if Desc=2 then 
143	myQuery2  = myQuery2  & " DESC " 
144end if
145
146session("myQuery") = myQuery 
147session("Banks") = Banks
148session("ChequeDatesFrom") = ChequeDatesFrom
149session("ChequeDatesTo") = ChequeDatesTo
150session("status") = status
151
152
153'-----------------------------------------------------------------------------------------------------
154'----------------------------------------------------------------------------------------- Search Form
155'-----------------------------------------------------------------------------------------------------
156%>
157<FORM METHOD=POST ACTION="traceCheqPaid.asp?">
158<TABLE align=center class="RcpMainTable">
159<TR>
160	<TD align=right>  �� ����� : <INPUT  class="RcpMainTableInput" dir="LTR"  TYPE="text" NAME="ChequeDatesFrom" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=ChequeDatesFrom%>"></TD>
161	<TD>����� �� ����: 
162		<select name="Banks" >
163		<option value="-2">������ ����</option>
164		<option value="-2">---------------------------------</option>
165		<% set RSV=Conn.Execute ("SELECT * FROM Bankers where IsBankAccount=1") 
166		Do while not RSV.eof
167		%>
168			<option value="<%=RSV("id")%>" <% if cint(RSV("id"))=cint(Banks) then %> selected <% end if %>><%=RSV("Name")%> </option>
169		<%
170		RSV.moveNext
171		Loop
172		RSV.close
173		%>
174		<option value="-2">---------------------------------</option>
175		<option value="-2"   <% if -2=cint(Banks) then %> selected <% end if %>>��� ������</option>
176		</select>
177	</TD>
178	<TD  align=center width=200><INPUT class="GenButton" TYPE="submit" name="submit" value="�����" ></TD>
179</TR>
180<TR>
181	<TD align=right>�� ����� :� <INPUT  class="RcpMainTableInput" dir="LTR"  TYPE="text" NAME="ChequeDatesTo" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);"  value="<%=ChequeDatesTo%>"></TD>
182	<TD colspan=2>
183		����� :
184		<select name="status"  style="font-size:8pt">
185		<option value="">������ ����</option>
186		<option value="">---------------------------------</option>
187		<% set RSV=Conn.Execute ("SELECT * FROM RcvPayChqStatus where IsRcvdChqStatus = 0 order by id") 
188		Do while not RSV.eof
189		%>
190			<option value="<%=RSV("id")%>"  <% if cint(RSV("id"))=cint(status) then %> selected <% end if %>><%=RSV("Name")%> </option>
191		<%
192		RSV.moveNext
193		Loop
194		RSV.close
195		%>
196		<option value="">---------------------------------</option>
197		<option value="-1"   <% if -1=cint(status) then %> selected <% end if %>>�� ���� �� ����</option>
198		</select>
199	</TD>
200</TR>
201</TABLE><BR>
202</FORM>
203
204<%
205'-----------------------------------------------------------------------------------------------------
206'----------------------------------------------------------------------------------------- Show Report
207'-----------------------------------------------------------------------------------------------------
208
209total = 0 
210
211'response.write "<span dir = ltr>" & myQuery
212'response.end
213
214Set RSS = conn.Execute(myQuery2)
215%>
216<TABLE dir=rtl align=center width=600>
217<TR >
218	<TD colspan=5>
219		
220		<BR>
221	</TD>
222</TR>
223<TR bgcolor="eeeeee" >
224	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=1"><SMALL>��  </SMALL></A> &nbsp;<% response.write DecsAsc(1) %></TD>
225	<TD align=center><!A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=2"><SMALL></SMALL></A></TD>
226	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=2"><SMALL>����� ��</SMALL></A> &nbsp;<% response.write DecsAsc(2) %></TD>
227	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=3"><SMALL>����� �� </SMALL></A> &nbsp;<% response.write DecsAsc(3) %></TD>
228	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=8"><SMALL> ������ </SMALL></A> &nbsp;<% response.write DecsAsc(8) %></TD>
229	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=4"><SMALL>���� (����)</SMALL></A> &nbsp;<% response.write DecsAsc(4) %></TD>
230	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=5"><SMALL>����</SMALL></A> &nbsp;<% response.write DecsAsc(5) %></TD>
231	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=6"><SMALL>����� </SMALL></A> &nbsp;<% response.write DecsAsc(6) %></TD>
232	<TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=7"><SMALL> ���� </SMALL></A> &nbsp;<% response.write DecsAsc(7) %></TD>
233</TR>
234<%
235tmpCounter=0
236Do while not RSS.eof
237	tmpCounter = tmpCounter + 1
238	if tmpCounter mod 2 = 1 then
239		tmpColor="#FFFFFF"
240		tmpColor2="#FFFFBB"
241	Else
242		tmpColor="#DDDDDD"
243		tmpColor2="#EEEEBB"
244	End if 
245
246%>
247<FORM METHOD=POST ACTION="traceCheqPaid.asp" onsubmit="return isEmpty()">
248<TR bgcolor="<%=tmpColor%>" title="<%=RSS("Description")%>">
249	<TD><% if RSS("Description")<>"" then %><font color=blue><B><% end if %><%=RSS("ID")%></B></font></TD>
250	<TD align=center><% if RSS("status")=0 then %><INPUT TYPE="radio" NAME="pay" value="<%=RSS("ID")%>"><% end if %></TD>
251	<TD><!A HREF="traceCheqPaid.asp?act=Detail&ID=<%=RSS("ID")%>"><A HREF="ShowCheqPaid.asp?cheqID=<%=RSS("ID")%>"><%=RSS("ChequeNo")%></A></A></TD>
252	<TD><span dir=ltr><%=RSS("ChequeDate")%></span></TD>
253	<TD><span dir=ltr><A HREF="../AO/AccountReport.asp?act=show&selectedCustomer=<%=RSS("Account")%>" target="_blank"><%=RSS("Account")%></A></span></TD>
254	<TD><span dir=ltr><%=RSS("amount")%></span></TD>
255	<TD><%=RSS("CSR")%></TD>
256	<TD><small><% if RSS("status")=0 then %> ���  ���� <% else %> ���  ��� <% end if %></small></TD>
257	<TD><%=RSS("BankName")%></TD>
258</TR>
259	  
260<% 
261total = total + RSS("amount")
262RSS.moveNext
263Loop
264%>
265<TR bgcolor="eeeeee" >
266	<TD colspan=5 align=center> ��� </TD>
267	<TD colspan=4><big><%=total%></big> ����</TD>
268</TR>
269</TABLE><br>
270<INPUT class="GenButton" TYPE="submit" name="submit" value="��� ��"><br><br>
271</FORM>
272<SCRIPT LANGUAGE="JavaScript">
273<!--
274function isEmpty()
275{
276	notFound=true;
277	for (i=0;i<document.getElementsByName("pay").length;i++){
278		if(document.getElementsByName("pay")[i].checked){
279			notFound=false;
280			x=document.getElementsByName("pay")[i].value;
281		}
282	}
283	if ( notFound )
284	{
285		alert("��� ��� ���� ��� ��� ������ ���� ���")
286		return false
287	}
288	else
289		return confirm("�� ����� "+ x + " ��� �� ���? ")
290}
291//-->
292</SCRIPT>
293</CENTER>
294<!--#include file="tah.asp" -->