PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/bank/traceCheqRcv.asp

http://github.com/khaneh/Orders
ASP | 708 lines | 570 code | 82 blank | 56 comment | 127 complexity | 6a9d6f5627b82f400f2aab3b7696c432 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Bank (10 [=A])
  3PageTitle= "������ ����� �������"
  4SubmenuItem=2
  5if not Auth("A" , 2) 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	.RcpMainTable Input { font-family:tahoma; font-size: 9pt; width:120px; 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'-------------------------------------------------------------------------------------- change  Status
 35'-----------------------------------------------------------------------------------------------------
 36if request("act") = "changeStatus" then
 37
 38	id		= request.form("id")
 39	Status	= request.form("Status")
 40	Banker = request.form("Banks")
 41	'----- Check GL is closed
 42	if (session("IsClosed")="True") then
 43		Conn.close
 44		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
 45	end if 
 46	'----
 47	response.redirect "?act=detail&ID=" & ID
 48
 49	myQuery = "UPDATE ReceivedCheques SET LastStatus = "& Status & ", LastBanker = "& Banker & ", LastUpdatedDate=N'"& shamsiToday() & "', LastUpdatedBy="& session("ID")& " WHERE  (ID = "& ID & ")"
 50
 51	Set RSS = conn.Execute(myQuery)
 52	response.redirect "?act=detail&ID=" & ID
 53
 54
 55'-----------------------------------------------------------------------------------------------------
 56'----------------------------------------------------------------------------------------- Form �Action
 57'-----------------------------------------------------------------------------------------------------
 58elseif request("act") = "actionButton" then
 59	'----- Check GL is closed
 60	if (session("IsClosed")="True") then
 61		Conn.close
 62		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
 63	end if 
 64	'----
 65	response.write "������ " & request.form("submit") &  " ���� ����� ��� ����� ��:<BR><BR>"
 66	if request.form("submit")="�ǐ���� �� ����"  then
 67		if request.form("longDistance")="on" then
 68			status = 7
 69		else
 70			status = 5
 71		end if
 72		NewBanker= request.form("NewBanker")
 73	elseif request.form("submit")="�������"  then
 74		status = 4
 75		NewBanker= "-"
 76	elseif request.form("submit")="����"  then
 77		status = 2
 78		NewBanker= "-"
 79	elseif request.form("submit")="�ѐ��"  then
 80		status = 3
 81		NewBanker= request.form("NewBanker")
 82
 83		mySQL="SELECT Users.Password, Users.Account  FROM Bankers INNER JOIN Users ON Bankers.Responsible = Users.ID WHERE (Bankers.ID = '"& NewBanker & "') AND (Users.Password = N'"& sqlSafe(request.form("ChequesNewBankerPass")) & "')"
 84		Set RS1=conn.execute(mySQL)
 85		If RS1.EOF Then
 86			conn.close
 87			response.redirect "?fromSession=y&errmsg=" & Server.URLEncode("���� ���� ������ �� �� ������ ���")
 88			response.end
 89		elseif RS1("Password")<>request.form("ChequesNewBankerPass") then
 90			conn.close
 91			response.redirect "?fromSession=y&errmsg=" & Server.URLEncode("���� ���� ������ �� �� ������ ���")
 92			response.end
 93		end if
 94
 95	else
 96		response.write "<BR><BR><CENTER>���� ��� ������!</CENTER>"
 97		response.end
 98	end if 
 99
100	for cheques = 1 to request.form("CHID").count 
101		myQuery = "UPDATE ReceivedCheques SET LastStatus = "& Status 
102		if not NewBanker= "-" then myQuery =  myQuery & ", LastBanker = " & NewBanker 
103		myQuery =  myQuery & ", LastUpdatedDate=N'"& shamsiToday() & "', LastUpdatedBy="& session("ID")& " WHERE  (ID = "& request.form("CHID")(cheques) & ")"
104		conn.Execute(myQuery)
105		response.write "<li> <A HREF='?act=detail&ID="& request.form("CHID")(cheques)  & "'>����� "&  request.form("CHID")(cheques) & "</a>"
106
107		if status = 4 then   'ESTERDAD 
108
109			MYSQL1 = "SELECT Receipts.SYS , Receipts.Customer AS Account , ReceivedCheques.Amount , Receipts.ID FROM ReceivedCheques INNER JOIN  Receipts ON ReceivedCheques.Receipt = Receipts.ID WHERE (ReceivedCheques.ID = "& request.form("CHID")(cheques) & ")"
110			set RS1 = conn.Execute(mySQL1)
111			SYS=RS1("SYS")
112			Account=RS1("Account")
113			Amount=RS1("Amount")
114			ReceiptID=RS1("ID")
115			Description = "���� ���� ������� �� �� ����� "& request.form("CHID")(cheques)
116			creationDate = shamsiToday()
117
118			MYSQL1 = "INSERT INTO "& SYS & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Description, Amount) VALUES (N'"& creationDate & "',"& session("ID") & ", 5,"& Account & ",0 ,N'"& Description & "',"& Amount & ")"
119			conn.Execute(mySQL1)
120			MySQL1="select ID from "& SYS & "Memo where Account="& Account & " and Amount="& Amount & " and CreatedDate=N'"& creationDate & "' order by ID DESC"
121			RS1 = conn.Execute(mySQL1)
122			MemoID=RS1("ID")
123
124			GLAccount="17011"	'This must be changed...
125
126			mySQL1="INSERT INTO "& SYS & "Items (GLAccount, GL, IsCredit, Type, Link, AmountOriginal, CreatedDate, CreatedBy, Account, RemainedAmount) VALUES ('" &_
127			GLAccount & "', '"& OpenGL & "', 0, 3, '"& MemoID & "', '"& Amount & "', N'"& creationDate & "', '"& session("ID") & "', '"& Account & "', '"& Amount & "')"	
128			conn.Execute(mySQL1)
129
130			mySQL1="UPDATE Accounts SET "& SYS & "Balance = "& SYS & "Balance - "& Amount & " WHERE (ID='"& Account & "')"
131
132			conn.Execute(mySQL1)
133
134			'RS1.close
135			Set RS1 = nothing
136
137		end if
138	next
139
140	'  ============================================================================ 
141	'  There is a Trigger in DB which sets Banker.Balance if the action is VOSOOL : 
142	'	
143	'	CREATE TRIGGER Trig_VosooleChq ON [dbo].[ReceivedCheques] 
144	'	FOR UPDATE
145	'	AS 
146	'	DECLARE 
147	' 		@status tinyint,
148	'		@banker int,
149	'		@chequeAmount int
150	'		SELECT 
151	'			@status = LastStatus, 
152	'			@banker = LastBanker, 
153	'			@chequeAmount=Amount 
154	'		FROM inserted 
155	'	if @status =2 
156	'	UPDATE Bankers SET 
157	'		CurrentBalance = CurrentBalance + @chequeAmount
158	'	WHERE ID = @banker
159	'  ============================================================================ 
160
161	response.write "<BR><BR><CENTER><A HREF='?fromSession=y'>��Ґ�� �� ����� �����  </A></CENTER><br>"
162
163	response.end
164
165
166'-----------------------------------------------------------------------------------------------------
167'-------------------------------------------------------------------------------------- �cheque Details
168'-----------------------------------------------------------------------------------------------------
169elseif request("act") = "detail" then
170	id = request("id")
171
172	myQuery = "SELECT ReceivedCheques.*, RcvPayChqStatus.Name AS statusName, ReceivedCheques.ID AS CHID, Bankers.IsBankAccount AS IsBankAccount, Bankers.Name AS BankName, Accounts.AccountTitle AS AccountTitle, Accounts.ID AS AccountID, Receipts.ID AS RcptID FROM ReceivedCheques INNER JOIN RcvPayChqStatus ON ReceivedCheques.LastStatus = RcvPayChqStatus.ID INNER JOIN Bankers ON ReceivedCheques.LastBanker = Bankers.ID INNER JOIN Receipts ON ReceivedCheques.Receipt = Receipts.ID INNER JOIN Accounts ON Receipts.Customer = Accounts.ID WHERE (ReceivedCheques.ID = "& ID & ")"
173
174	Set RSS = conn.Execute(myQuery)
175
176	if RSS.EOF then
177		response.write "<CENTER><BR><BR>���! ���� ��� ���� �����</CENTER>"
178	end if
179
180	%>
181	<BR><BR>
182	<TABLE>
183	<TR>
184		<TD valign=top>
185			<TABLE style="border:2pt solid white;">
186			<TR bgcolor=white>
187				<TD colspan=2 align=center> ������ �� </TD>
188			</TR>
189			<TR>
190				<TD align=left>�� :</TD>
191				<TD><b><%=RSS("CHID")%></b></TD>
192			</TR>
193			<TR>
194				<TD  align=left> ����� �� :</TD>
195				<TD><b><%=RSS("ChequeNo")%></b></TD>
196			</TR>
197			<TR>
198				<TD align=left>���� ����� :</TD>
199				<TD ><A target=_blank  HREF="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=RSS("AccountID")%>"><b><%=RSS("AccountTitle")%></b></A></TD>
200			</TR>
201			<TR>
202				<TD align=left>����� ��  :</TD>
203				<TD> <span dir=ltr><b><%=RSS("ChequeDate")%></b></span></TD>
204			</TR>
205			<TR>
206				<TD align=left>���� (����) :</TD>
207				<TD><span dir=ltr><b><%=RSS("amount")%></b></span></TD>
208			</TR>
209			<TR>
210				<TD align=left>������� :</TD>
211				<TD><b><%=RSS("Description")%></b></TD>
212			</TR>
213			<TR>
214				<TD align=left>���� :</TD>
215				<TD><b><%=RSS("BankOfOrigin")%></b></TD>
216			</TR>
217			<TR>
218				<TD align=left> ����� :</TD>
219				<TD> <b><%=RSS("statusName")%></b></TD>
220			</TR>
221			<TR>
222				<TD align=left>���  :</TD>
223				<TD> <b><%=RSS("BankName")%></b></TD>
224			</TR>
225			<TR bgcolor=white>
226				<TD colspan=2 align=center height=2> </TD>
227			</TR>
228			<TR >
229				<TD colspan=2 align=center ><A target=_blank HREF="../AO/AccountReport.asp?act=showReceipt&receipt=<%=RSS("RcptID")%>">����� �� ������ ����� <%=RSS("RcptID")%></A></TD>
230			</TR>
231			<!--TR bgcolor=white>
232				<TD colspan=2 align=center height=2> </TD>
233			</TR>
234			<FORM METHOD=POST ACTION="?act=changeStatus">
235			<INPUT TYPE="hidden" name="id" value="<%=RSS("CHID")%>">
236			<TR>
237				<TD align=left>����� �����</TD>
238				<TD><%
239					status = RSS("LastStatus")
240					%>
241					<select name="status" <% if not RSS("IsBankAccount") then%> disabled <% end if %> >
242					<% set RSV=Conn.Execute ("SELECT * FROM RcvPayChqStatus") 
243					Do while not RSV.eof
244					%>
245						<option value="<%=RSV("id")%>"  <% if cint(RSV("id"))=cint(status) then %> selected <% end if %>><%=RSV("Name")%> </option>
246					<%
247					RSV.moveNext
248					Loop
249					RSV.close
250					%>
251					</select>
252					<% if not RSS("IsBankAccount") then%> <INPUT TYPE="hidden" name="status" value="<%=status%>"> <% end if %>
253				</TD>
254			</TR>
255			<TR>
256				<TD align=left>����� ���</TD>
257				<TD><% 
258					Banks = RSS("LastBanker")
259					%>
260					<select name="Banks" <% if status<>3  and RSS("IsBankAccount") then%> disabled <% end if %>>
261					<% set RSV=Conn.Execute ("SELECT * FROM Bankers ") 
262					Do while not RSV.eof
263					%>
264						<option value="<%=RSV("id")%>" <% if RSV("id")=Banks then %> selected <% end if %>><%=RSV("Name")%> </option>
265					<%
266					RSV.moveNext
267					Loop
268					RSV.close
269					%>
270					</select>
271					<% if status<>3 and RSS("IsBankAccount") then%> <INPUT TYPE="hidden" name="Banks" value="<%=Banks%>"> <% end if %>
272				</TD>
273			</TR>
274			<TR>
275				<TD colspan=2>
276					
277					<br>
278					<CENTER><INPUT TYPE="submit" value="���"></CENTER>
279
280				</TD>
281			</TR-->
282			</FORM>
283			</TABLE>
284		</TD>
285		
286		<TD valign=top>
287			<table style="border:2pt solid white;" dir=ltr >
288			<tr bgcolor=white>
289				<td colspan=3 align=center> ����� ����� �� </td>
290			</tr>
291			<% set RSV=Conn.Execute ("SELECT RcvChqTrace.Cheque, RcvPayChqStatus.Name AS StatusName, Bankers.Name AS BankerName, RcvChqTrace.SetDate FROM RcvChqTrace INNER JOIN  RcvPayChqStatus ON RcvChqTrace.Status = RcvPayChqStatus.ID INNER JOIN  Bankers ON RcvChqTrace.Banker = Bankers.ID WHERE (RcvChqTrace.Cheque = "& ID & ") ORDER BY RcvChqTrace.SetDate") 
292			Do while not RSV.eof
293			%>
294			<tr>
295				<td align=right><%=RSV("BankerName")%></td>
296				<td align=right bgcolor="f1f1f1"><%=RSV("StatusName")%></td>
297				<td align=right><%=RSV("SetDate")%></td>
298			</tr>
299				
300			<%
301			RSV.moveNext
302			Loop
303			RSV.close
304			%>
305			</table>
306		</TD>
307	</TR>
308	</TABLE>
309
310	<%
311	response.write "<BR><BR><CENTER><A HREF='?fromSession=y'>��Ґ�� �� ����� �����  </A></CENTER><br>"
312	response.end
313end if
314'-----------------------------------------------------------------------------------------------------
315'--------------------------------------------------------------------------------------- Submit Search
316'-----------------------------------------------------------------------------------------------------
317
318'beginOfQuery = "SELECT  ReceivedCheques.*, RcvPayChqStatus.Name AS statusName, ReceivedCheques.ID AS CHID, ReceivedCheques.Receipt AS ReceiptID, Bankers.IsBankAccount AS Expr1, Bankers.Name AS BankName, Receipts.SYS AS SYS FROM ReceivedCheques INNER JOIN RcvPayChqStatus ON ReceivedCheques.LastStatus = RcvPayChqStatus.ID INNER JOIN Bankers ON ReceivedCheques.LastBanker = Bankers.ID INNER JOIN Receipts ON ReceivedCheques.Receipt = Receipts.ID"
319
320
321beginOfQuery = "SELECT ReceivedCheques.*, Invoices.IsA, Invoices.Number, RcvPayChqStatus.Name AS statusName, ReceivedCheques.ID AS CHID, ReceivedCheques.Receipt AS ReceiptID, Bankers.IsBankAccount AS Expr1, Bankers.Name AS BankName, Receipts.SYS AS SYS FROM ReceivedCheques INNER JOIN RcvPayChqStatus ON ReceivedCheques.LastStatus = RcvPayChqStatus.ID INNER JOIN Bankers ON ReceivedCheques.LastBanker = Bankers.ID INNER JOIN Receipts ON ReceivedCheques.Receipt = Receipts.ID LEFT OUTER JOIN ARItems ON Receipts.ID = ARItems.Link FULL OUTER JOIN Invoices FULL OUTER JOIN ARItems ARItems_1 ON Invoices.ID = ARItems_1.Link FULL OUTER JOIN ARItemsRelations ON ARItems_1.ID = ARItemsRelations.DebitARItem ON ARItems.ID = ARItemsRelations.CreditARItem WHERE (ARItems.Type = 2) AND (Receipts.ID = Receipts.ID)"
322
323if request.form("submit") = "�ǐ����" then
324	Banks = request.form("Banks")
325	ChequeDatesFrom = request.form("ChequeDatesFrom")
326	ChequeDatesTo = request.form("ChequeDatesTo")
327
328	myQuery = beginOfQuery & " and (LastStatus=6 or LastStatus=3) "
329	status = -4
330
331	if not ( ChequeDatesTo = "" ) then 
332		myQuery  = myQuery  &  " AND (ReceivedCheques.ChequeDate < N'"& ChequeDatesTo & "') "
333	end if 
334	
335	if not ( ChequeDatesFrom = "" ) then 
336		myQuery  = myQuery  &  " AND (ReceivedCheques.ChequeDate >= N'"& ChequeDatesFrom & "')"
337	end if 
338	
339	if not Banks = "-2" then 
340		myQuery  = myQuery  & " AND (ReceivedCheques.LastBanker = "& Banks & ")"
341	end if 
342
343end if 
344
345if request.form("submit") = "����" then
346	Banks = request.form("Banks")
347	ChequeDatesFrom = request.form("ChequeDatesFrom")
348	ChequeDatesTo = request.form("ChequeDatesTo")
349
350	myQuery = beginOfQuery & " and (LastStatus=5 or LastStatus=7) "
351	status = -5
352
353	if not ( ChequeDatesTo = "" ) then 
354		myQuery  = myQuery  &  " AND (ReceivedCheques.ChequeDate < N'"& ChequeDatesTo & "') "
355	end if 
356	
357	if not ( ChequeDatesFrom = "" ) then 
358		myQuery  = myQuery  &  " AND (ReceivedCheques.ChequeDate >= N'"& ChequeDatesFrom & "')"
359	end if 
360	
361	if not Banks = "-2" then 
362		myQuery  = myQuery  & " AND (ReceivedCheques.LastBanker = "& Banks & ")"
363	end if 
364
365end if 
366
367
368if request.form("submit") = "�����" then
369	status = request.form("status")
370	Banks = request.form("Banks")
371	ChequeDatesFrom = request.form("ChequeDatesFrom")
372	ChequeDatesTo = request.form("ChequeDatesTo")
373
374	myQuery = beginOfQuery '& " and 1=1 "
375	
376	if not ( ChequeDatesTo = "" ) then 
377		myQuery  = myQuery  &  " AND (ReceivedCheques.ChequeDate < N'"& ChequeDatesTo & "') "
378	end if 
379	
380	if not ( ChequeDatesFrom = "" ) then 
381		myQuery  = myQuery  &  " AND (ReceivedCheques.ChequeDate >= N'"& ChequeDatesFrom & "')"
382	end if 
383	
384	if not Banks = "-2" then 
385		myQuery  = myQuery  & " AND (ReceivedCheques.LastBanker = "& Banks & ")"
386	end if 
387
388	if status = "-3" then 
389		myQuery  = myQuery  & " and not (LastStatus=4 or LastStatus=2) "
390	elseif status = "-4" then 
391		myQuery  = myQuery  & " and (LastStatus=3 or LastStatus=6) "
392	else	
393		if not status = "-2" then 
394			myQuery  = myQuery  & " AND (ReceivedCheques.LastStatus = "& status & ")"
395		end if 
396	end if
397
398	'response.write myQuery
399end if 
400
401'if myQuery = "" then 
402'	myQuery = beginOfQuery & " where not (LastStatus=-4)"
403'	Banks = -2
404'	ChequeDatesFrom = ""
405'	ChequeDatesTo = ""
406'	status = "-4"
407'end if
408
409if request("fromSession") = "y" then
410	myQuery = session("myQuery")
411	Banks = session("Banks")
412	ChequeDatesFrom = session("ChequeDatesFrom") 
413	ChequeDatesTo = session("ChequeDatesTo") 
414	status = session("status") 
415end if
416
417s = request("s")
418if s="" then s="1"
419
420if s="1" then
421	orderBy = "ReceivedCheques.ID"
422elseif s="2" then
423	orderBy = "ReceivedCheques.ChequeNo"
424elseif s="3" then
425	orderBy = "ReceivedCheques.ChequeDate"
426elseif s="4" then
427	orderBy = "ReceivedCheques.amount"
428elseif s="5" then
429	orderBy = "ReceivedCheques.LastStatus"
430elseif s="6" then
431	orderBy = "ReceivedCheques.LastBanker"
432elseif s="7" then
433	orderBy = "ReceivedCheques.BankOfOrigin"
434end if
435
436Desc = request("Desc")
437if Desc = "" then 
438	Desc = 1
439else
440	Desc = 3 - Desc
441end if
442
443myQuery2  = myQuery  & " order by " & orderBy
444if Desc=2 then 
445	myQuery2  = myQuery2  & " DESC " 
446end if
447
448session("myQuery") = myQuery 
449session("Banks") = Banks
450session("ChequeDatesFrom") = ChequeDatesFrom
451session("ChequeDatesTo") = ChequeDatesTo
452session("status") = status
453
454'-----------------------------------------------------------------------------------------------------
455'----------------------------------------------------------------------------------------- Search Form
456'-----------------------------------------------------------------------------------------------------
457%>
458
459<FORM METHOD=POST ACTION="?">
460<INPUT class="GenButton" TYPE="submit" name="submit" value="�ǐ����" <% if cint(status)=-4 or cint(status)=3 or cint(status)=6 then %> style="background-color:#FFFFBB"<% else %> style="background-color:white"<% end if %>> 
461<INPUT class="GenButton" TYPE="submit" name="submit" value="����"  <% if cint(status)=5 or cint(status)=7 or cint(status)=-5 then %> style="background-color:#FFFFBB"<% else %> style="background-color:white"<% end if %>> 
462<BR><BR>
463<TABLE align=center class="RcpMainTable">
464<TR>
465	<TD align=right>  �� ����� : <INPUT  dir="LTR"  TYPE="text" NAME="ChequeDatesFrom" maxlength="10" size="10"onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=ChequeDatesFrom%>"></TD>
466	<TD>��� ��:
467		<select name="Banks" onchange="" style="font-size:8pt">
468		<option value="-2">������ ����</option>
469		<option value="-2">---------------------------------</option>
470		<% set RSV=Conn.Execute ("SELECT * FROM Bankers ") 
471		Do while not RSV.eof
472		%>
473			<option value="<%=RSV("id")%>" <% if cint(RSV("id"))=cint(Banks) then %> selected <% end if %>><%=RSV("Name")%> </option>
474		<%
475		RSV.moveNext
476		Loop
477		RSV.close
478		%>
479		<option value="-2">---------------------------------</option>
480		<option value="-2"   <% if -2=cint(Banks) then %> selected <% end if %>>�� �� ��� </option>
481		</select>
482	</TD>
483	<TD  align=center><INPUT class="GenButton" TYPE="submit" name="submit" value="�����" ></TD>
484</TR>
485<TR>
486	<TD align=right>�� ����� :� <INPUT  dir="LTR"  TYPE="text" NAME="ChequeDatesTo" maxlength="10" size="10"  onKeyPress="return maskDate(this);" onblur="acceptDate(this)"  value="<%=ChequeDatesTo%>"></TD>
487	<TD colspan=2>
488		����� :� 
489		<select name="status"  style="font-size:8pt">
490		<option value="-2">������ ����</option>
491		<option value="-2">---------------------------------</option>
492		<% set RSV=Conn.Execute ("SELECT * FROM RcvPayChqStatus where IsRcvdChqStatus = 1 order by Name") 
493		Do while not RSV.eof
494		%>
495			<option value="<%=RSV("id")%>"  <% if cint(RSV("id"))=cint(status) then %> selected <% end if %>><%=RSV("Name")%> </option>
496		<%
497		RSV.moveNext
498		Loop
499		RSV.close
500		%>
501		<option value="-2">---------------------------------</option>
502		<option value="-2"   <% if -2=cint(status) then %> selected <% end if %>>�� ���� �� ����</option>
503		<option value="-3"   <% if -3=cint(status) then %> selected <% end if %>>�� �����</option>
504		<option value="-4"   <% if -4=cint(status) then %> selected <% end if %>>����� �ǐ����</option>
505		<option value="-5"   <% if -5=cint(status) then %> selected <% end if %>>����� ����</option>
506		</select>
507	</TD>
508</TR>
509</TABLE><BR>
510</FORM>
511<%
512'-----------------------------------------------------------------------------------------------------
513'----------------------------------------------------------------------------------------- Show Report
514'-----------------------------------------------------------------------------------------------------
515
516if not myQuery = "" then 
517
518	total = 0 
519
520	Set RSS = conn.Execute(myQuery2)
521	%>
522	<FORM METHOD=POST ACTION="?act=actionButton">
523	<TABLE dir=rtl align=center width=600>
524	<TR >
525		<TD colspan=5>
526			
527			<BR>
528		</TD>
529	</TR>
530	<TR bgcolor="eeeeee" >
531		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=1"><% if cint(status)=-4 or cint(status)=3 or cint(status)=6 or cint(status)=5  or cint(status)=7 or cint(status)=-5  then  %><INPUT TYPE="checkbox" NAME="" disabled><% end if %><SMALL>��</SMALL></A> &nbsp;<% response.write DecsAsc(1) %></TD>
532		<TD><!A HREF="?fromSession=y&Desc=<%=Desc%>&s=0"><SMALL>���</SMALL></A> &nbsp;<% response.write DecsAsc(0) %></TD>
533		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=2"><SMALL>����� ��</SMALL></A> &nbsp;<% response.write DecsAsc(2) %></TD>
534		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=3"><SMALL>����� �� </SMALL></A> &nbsp;<% response.write DecsAsc(3) %></TD>
535		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=4"><SMALL>���� (����)</SMALL></A> &nbsp;<% response.write DecsAsc(4) %></TD>
536		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=5"><SMALL>����� </SMALL></A> &nbsp;<% response.write DecsAsc(5) %></TD>
537		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=6"><SMALL> ��� </SMALL></A> &nbsp;<% response.write DecsAsc(6) %></TD>
538		<TD><A HREF="?fromSession=y&Desc=<%=Desc%>&s=7"><SMALL> ���� </SMALL></A> &nbsp;<% response.write DecsAsc(7) %></TD>
539	</TR>
540	<%
541	tmpCounter=0
542	Do while not RSS.eof
543		tmpCounter = tmpCounter + 1
544		if tmpCounter mod 2 = 1 then
545			tmpColor="#FFFFFF"
546			tmpColor2="#FFFFBB"
547		Else
548			tmpColor="#FFFFFF"
549			tmpColor2="#FFFFBB"
550			'tmpColor="#DDDDDD"
551			'tmpColor2="#EEEEBB"
552		End if 
553
554	'Set RSS2 = conn.Execute("SELECT Invoices.IsA, Invoices.Number FROM Receipts INNER JOIN ARItems ON Receipts.ID = ARItems.Link INNER JOIN ARItemsRelations ON ARItems.ID = ARItemsRelations.CreditARItem INNER JOIN ARItems ARItems_1 ON ARItemsRelations.DebitARItem = ARItems_1.ID INNER JOIN Invoices ON ARItems_1.Link = Invoices.ID WHERE (ARItems.Type = 2) and Receipts.id ="& RSS("ReceiptID"))
555
556	%>
557	<TR bgcolor="<%=tmpColor%>" title="<%=RSS("Description")%>">
558		<TD><% if cint(status)=-4 or cint(status)=3 or cint(status)=6 or cint(status)=5 or cint(status)=7 or cint(status)=-5 then  %><INPUT TYPE="checkbox" NAME="CHID" VALUE="<%=RSS("CHID")%>"  onclick="setColor(this)"><% end if %><A HREF="?act=detail&ID=<%=RSS("CHID")%>"><%=RSS("CHID")%></A></TD>
559		
560		<% if not isnull(RSS("IsA")) then 
561			if RSS("IsA") then 	%>
562				<TD align=center style="border:1pt solid red"><span dir=ltr>���</span></TD>
563			<% else %>
564				<TD align=center style="border:1pt solid blue"><span dir=ltr>�</span></TD>
565			<% end if %>
566		<% else %>
567			<TD><span dir=ltr>	</span></TD>
568		<% end if %>
569		<TD align=center><A HREF="?act=detail&ID=<%=RSS("CHID")%>"><%=RSS("ChequeNo")%></A></TD>
570		<TD><span dir=ltr><%=RSS("ChequeDate")%></span></TD>
571		<TD><span dir=ltr><%=RSS("amount")%></span></TD>
572		<TD><%=RSS("statusName")%></TD>
573		<TD><%=RSS("BankName")%></TD>
574		<TD><%=RSS("BankOfOrigin")%></TD>
575	</TR>
576		  
577	<% 
578	total = total + RSS("amount")
579	RSS.moveNext
580	Loop
581	%>
582	<TR bgcolor="eeeeee" >
583		<TD colspan=4 align=center> ��� </TD>
584		<TD colspan=4><big><%=total%></big> ����</TD>
585	</TR>
586	<TR >
587		<TD colspan=8 align=center><BR>
588			<% if cint(status)=-4 or cint(status)=3 or cint(status)=6 then %>
589			 <INPUT class="GenButton" TYPE="submit" name="submit" value="�ǐ���� �� ����" >
590				<select class="GenButton"  name="NewBanker" onchange="">
591				<% set RSV=Conn.Execute ("SELECT * FROM Bankers where isBankAccount=1 ") 
592				Do while not RSV.eof
593				%>
594					<option value="<%=RSV("id")%>"><%=RSV("Name")%> </option>
595				<%
596				RSV.moveNext
597				Loop
598				RSV.close
599				%>
600				</select>
601				<INPUT TYPE="checkbox" NAME="longDistance"> �������
602				<BR><BR>
603		
604			<INPUT class="GenButton" TYPE="submit" name="submit" value="�������"  onclick="return confirm('����! ��� ������ �ѐ�� �� ����� ���� ��� ����. ��� �� ��� �� ������� ��')">  
605			<!--INPUT class="GenButton" TYPE="submit" name="submit" value="�ǐ���� �� �����" > 
606				<select name="Banks" onchange="" class="GenButton" >
607				<% set RSV=Conn.Execute ("SELECT CashRegisters.ID, CashRegisters.NameDate, Users.RealName FROM CashRegisters INNER JOIN Users ON CashRegisters.Cashier = Users.ID WHERE (CashRegisters.IsOpen = 1)") 
608				Do while not RSV.eof
609				%>
610					<option value="<%=RSV("id")%>"><%=RSV("NameDate")%> (<%=RSV("RealName")%>)</option>
611				<%
612				RSV.moveNext
613				Loop
614				RSV.close
615				%>
616				</select-->
617			<% elseif cint(status)=5 or cint(status)=7 or cint(status)=-5 then %>
618			<INPUT class="GenButton" TYPE="submit" name="submit" value="�ѐ��"  onclick="return formValidation();"> 
619				<select class="GenButton"  name="NewBanker" onchange="">
620				<% set RSV=Conn.Execute ("SELECT Users.RealName, Bankers.ID , Bankers.Name FROM Bankers INNER JOIN Users ON Bankers.Responsible = Users.ID WHERE (Bankers.IsBankAccount = 0) ") 
621				Do while not RSV.eof
622				%>
623					<option value="<%=RSV("id")%>"> �� <%=RSV("Name")%> (<%=RSV("RealName")%>)</option>
624				<%
625				RSV.moveNext
626				Loop
627				RSV.close
628				%>
629				<!--option value="-2">---------------------------------</option>
630				<option value="-2"   <% if -2=cint(Banks) then %> selected <% end if %>>�� �� ��� </option-->
631				</select>
632				<INPUT TYPE="password" NAME="ChequesNewBankerPass" onkeyDown="return myKeyDownHandler();" onKeyPress="return myKeyPressHandler();">
633
634				<BR><BR>
635			<INPUT class="GenButton" TYPE="submit" name="submit" value="����" onclick="return confirm('����! ��� ������ �ѐ�� �� ����� ���� ��� ����. ��� �� ��� �� ������� ��')"> 
636			<% end if  %>
637		</TD>
638	</TR>
639	</TABLE><br>
640	</FORM>
641<% end if %>
642</CENTER>
643<SCRIPT LANGUAGE="JavaScript">
644<!--
645tmpColor="#FFFFFF"
646tmpColor2="#FFFFBB"
647
648function setColor(obj)
649{
650ii=parseInt(obj.id) 
651if(obj.checked)
652	{
653	theTR = obj.parentNode.parentNode
654	theTR.setAttribute("bgColor",tmpColor2)
655	}
656else
657	{
658	theTR = obj.parentNode.parentNode
659	theTR.setAttribute("bgColor",tmpColor)
660	}
661}
662
663var tempKeyBuffer;
664function myKeyDownHandler(){
665	tempKeyBuffer=window.event.keyCode;
666}
667function myKeyPressHandler(){
668//	alert (tempKeyBuffer)
669	if (tempKeyBuffer>=65 && tempKeyBuffer<=90){
670		window.event.keyCode=tempKeyBuffer+32;
671	}
672	else if(tempKeyBuffer==186){
673		window.event.keyCode=59;
674	}
675	else if(tempKeyBuffer==188){
676		window.event.keyCode=44;
677	}
678	else if(tempKeyBuffer==190){
679		window.event.keyCode=46;
680	}
681	else if(tempKeyBuffer==191){
682		window.event.keyCode=47;
683	}
684	else if(tempKeyBuffer==192){
685		window.event.keyCode=96;
686	}
687	else if(tempKeyBuffer>=219 && tempKeyBuffer<=221){
688		window.event.keyCode=tempKeyBuffer-128;
689	}
690	else if(tempKeyBuffer==222){
691		window.event.keyCode=39;
692	}
693}
694
695function formValidation(){
696
697	if (document.all.ChequesNewBankerPass)
698	if (!document.all.ChequesNewBankerPass.value){
699		alert("���� ���� �� ���� ����");
700		document.all.ChequesNewBankerPass.focus();
701		return false;
702	}
703	return true;
704}
705//-->
706</SCRIPT>
707
708<!--#include file="tah.asp" -->