PageRenderTime 7ms CodeModel.GetById 19ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/bank/CheqBook.asp

http://github.com/khaneh/Orders
ASP | 988 lines | 789 code | 90 blank | 109 comment | 97 complexity | 3aeecbb7031316b15148d61f40f71e29 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Bank (10 [=A])
  3PageTitle= "���� ��"
  4SubmenuItem=8
  5if not Auth("A" , 8) then NotAllowdToViewThisPage()
  6
  7%>
  8<!--#include file="top.asp" -->
  9<!--#include File="../include_farsiDateHandling.asp"-->
 10<!--#include File="../include_JS_InputMasks.asp"-->
 11<!--#include File="../include_UtilFunctions.asp"-->
 12<STYLE>
 13	.RepTable {font-family:tahoma; font-size:9pt; direction: RTL; }
 14	.RepTable td {vertical-align:top;padding:5;border:1pt solid gray;}
 15	.RepTable a {text-decoration:none; color:#222288;}
 16	.RepTable a:hover {text-decoration:underline;}
 17	.RepTableTitle {background-color: #CCCCEE; text-align: center; font-weight:bold;}
 18	.RepTableHeader {background-color: #BBBBFF; text-align: center; font-weight:bold;}
 19	.RepTableFooter {background-color: #BBBBBB; direction: LTR; }
 20	.RepTR0 {background-color: #DDDDDD;}
 21	.RepTR1 {background-color: #FFFFFF;}
 22	.GenInput {width:70px; font-family:tahoma; font-size: 9pt; border: 1 solid black; text-align:left; direction: LTR;}
 23	.RepTextArea {font-family:tahoma;font-size:8pt;width:300px;height:30px;border:none;backGround:Transparent;}
 24	.RepROInputs {font-family:tahoma;font-size:8pt;width:70px;border:none;backGround:Transparent;}
 25</STYLE>
 26<%
 27'------------------------------------------------------------------------------
 28'------------------------------------------------------------------ Submit Memo
 29'------------------------------------------------------------------------------
 30if request("act")="submitMemo" then
 31	Account=	request.form("Account")
 32	GLAccount=	clng(request.form("GLAccount"))
 33
 34
 35	if GLAccount="" then
 36		response.redirect "?errMsg="&Server.URLEncode("��� �� ����� !")
 37	end if
 38
 39' ---
 40' 	Checking input
 41' ---
 42
 43	GLMemoDate = request.form("GLMemoDate")
 44
 45	'---- Checking wether EffectiveDate is valid in current open GL
 46	if (GLMemoDate < session("OpenGLStartDate")) OR (GLMemoDate > session("OpenGLEndDate")) then
 47		Conn.close
 48		response.redirect "?errMsg=" & Server.URLEncode("���!<br>����� ���� ��� �� ������ ��� ���� ���� ����.")
 49	end if 
 50	'----
 51	'----- Check GL is closed
 52	if (session("IsClosed")="True") then
 53		Conn.close
 54		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
 55	end if 
 56	'----
 57	if Account<>"" then
 58		Account= clng(Account)
 59		bySubSys=1
 60	else
 61		if request.form("CheqNos").count > 0 then
 62			if request.form("Accounts")(1) <> "" then 
 63				SubSystemNeeded=True
 64			else
 65				SubSystemNeeded=False
 66			end if
 67		end if
 68
 69		ContradictionFound=False
 70		for i=2 to request.form("CheqNos").count 
 71			if request.form("Accounts")(i) <> "" then 
 72				thisSubSystemNeeded=True
 73			else
 74				thisSubSystemNeeded=False
 75			end if
 76			if NOT thisSubSystemNeeded = SubSystemNeeded then
 77				ContradictionFound=True
 78				exit for
 79			end if
 80		Next
 81		if ContradictionFound then
 82			response.redirect "?errMsg="&Server.URLEncode("��������� �� �������!<br><br>�ǐ���� �� ���� ��� ����� �� ��� �� ���� ����� ����.")
 83		end if
 84		if SubSystemNeeded then
 85			bySubSys=1
 86		else
 87			bySubSys=0
 88		end if
 89	end if
 90' ---
 91
 92	creationDate=shamsiToday()
 93
 94	mySQL="SELECT ISNULL(MAX(GLDocID),0) AS LastMemo FROM GLDocs WHERE GL='"& OpenGL & "'"
 95	Set RS1=conn.Execute (mySQL)
 96	GLMemoNo = RS1("LastMemo") + 1
 97
 98	'---- Creating a new GLDoc 
 99	mySQL="INSERT INTO GLDocs (GL, GLDocID, GLDocDate, CreatedDate, createdBy, BySubSystem, IsTemporary) VALUES ("& openGL & " , "& GLMemoNo & ", N'"& GLMemoDate & "' , N'"& creationDate & "', "& session("ID") & ", "& bySubSys & ", 1);SELECT @@Identity AS NewGLDoc"
100	set RS1 = Conn.execute(mySQL).NextRecordSet
101	GLDoc = RS1("NewGLDoc")
102	RS1.close
103	'---- 
104
105	if Account="" then
106	'
107	' When the first line doesn't need a SubSystem Memo
108	'
109		for i=1 to request.form("CheqNos").count 
110			thisAccount=	request.form("Accounts")(i)
111			thisGLAccount=	request.form("GLAccounts")(i)
112			thisDescription=sqlSafe(request.form("Descriptions")(i))
113			thisAmount=		request.form("Amounts")(i)
114
115			if request.form("IsCredit")(i) then 
116				thisIsCredit=1 
117				thisIsDebit=0 
118			else 
119				thisIsDebit=1 
120				thisIsCredit=0
121			end if
122
123			thisCheqNo=request.form("CheqNos")(i)
124			thisCheqDate=request.form("CheqDates")(i)
125
126			if thisAccount<>"" then
127			'
128			'	The seccond line needs a SubSystem Memo
129			'	so, we wait for SYS and LINK of the Memo before we insert either of the 2 lines
130			'
131				' --------------------------------------------------
132				' -----------	Creating a Memo and an Item for this
133				' --------------------------------------------------
134				' -----------	Cheque Return (������� ��)
135				' **************************************************
136				mySQL = "SELECT ItemReason FROM AXItemReasonGLAccountRelations WHERE (GL = "& openGL & ") AND (GLAccount = "& thisGLAccount & ")"
137				Set RS1=Conn.execute(mySQL)
138				if RS1.eof then
139					'Using default reason (sys: AO, reason: Misc.)
140					Reason=6
141				else
142					Reason=	cint(RS1("ItemReason"))
143				end if
144				RS1.close
145
146				mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
147				Set RS1=Conn.execute(mySQL)
148				sys=			RS1("Acron")
149				ReasonName =	RS1("Name")
150				RS1.close
151
152				'*** Memo Type=5 means 'Cheque Return'
153				mySQL="INSERT INTO "& sys & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Amount, Description) VALUES (N'"& GLMemoDate & "' , "& session("ID") & ", 5, "& thisAccount & ", "& thisIsCredit & ", "& thisAmount & ", N'"& thisDescription & "');SELECT @@Identity AS NewMemo"
154				set RS1 = Conn.execute(mySQL).NextRecordSet
155				theMemo = RS1("NewMemo")
156				RS1.close
157
158				'*** Type = 3 means Item is a Memo
159				mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, IsCredit, Type, Link, Reason, AmountOriginal, CreatedDate, CreatedBy, RemainedAmount, GL_Update) VALUES ('" &_
160				GLAccount & "', "& OpenGL &", '"& thisGLAccount & "', '"& thisAccount & "', N'"& GLMemoDate & "', "& thisIsCredit & ", 3, "& theMemo & ", "& Reason & ", "& thisAmount & ", N'"& creationDate & "', "& session("ID") & ", "& thisAmount & ", 0);SELECT @@Identity AS NewItem"
161				set RS1 = Conn.execute(mySQL).NextRecordSet
162				theItem = RS1("NewItem")
163				RS1.close
164				
165				if thisIsCredit then
166					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& thisAmount & "' WHERE (ID='"& thisAccount & "')"
167				else
168					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& thisAmount & "' WHERE (ID='"& thisAccount & "')"
169				end if
170				conn.Execute(mySQL)
171
172				' **************************************************
173				' ------ End of Creating a Memo and an Item for this
174				' --------------------------------------------------
175
176				'First Line:
177				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Amount, Description, IsCredit, Ref1, Ref2, SYS, Link) VALUES ( "&	GLDoc & ", "& GLAccount & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsDebit & ", N'"& thisCheqNo &"', N'"& thisCheqDate & "', '"& sys & "', '"& theItem & "')"
178				conn.Execute(mySQL)
179
180				'Seccond Line:
181				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Tafsil, Amount, Description, IsCredit, Ref1, Ref2, SYS, Link) VALUES ( "&	GLDoc & ", "& thisGLAccount & ", "& thisAccount & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsCredit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"', '"& sys & "', '"& theItem & "')"
182				conn.Execute(mySQL)
183			else
184			'
185			'	Both Lines are only at GL Level
186			'
187				'First Line:
188				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Amount, Description, IsCredit, Ref1, Ref2) VALUES ( "&	GLDoc & ", "& GLAccount & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsDebit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"')"
189				conn.Execute(mySQL)
190
191				'Seccond Line:
192				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Amount, Description, IsCredit, Ref1, Ref2) VALUES ( "& GLDoc & ", "& thisGLAccount & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsCredit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"')"
193				conn.Execute(mySQL)
194			end if
195		Next
196	else
197	'
198	' When the first line needs a SubSystem Memo
199	'
200		for i=1 to request.form("CheqNos").count 
201			thisAccount=	request.form("Accounts")(i)
202			thisGLAccount=	request.form("GLAccounts")(i)
203			thisDescription=sqlSafe(request.form("Descriptions")(i))
204			thisAmount=		request.form("Amounts")(i)
205
206			if request.form("IsCredit")(i) then 
207				thisIsCredit=1 
208				thisIsDebit=0 
209			else 
210				thisIsDebit=1 
211				thisIsCredit=0
212			end if
213
214			thisCheqNo=request.form("CheqNos")(i)
215			thisCheqDate=request.form("CheqDates")(i)
216
217			if thisAccount="" then
218			'
219			'	The seccond line doesn't needs a SubSystem Memo
220			'	we insert first line , find SYS and LINK of the Memo and then insert the seccond lines
221			'
222				' --------------------------------------------------
223				' -----------	Creating a Memo and an Item for this
224				' --------------------------------------------------
225				' -----------	Cheque Return (������� ��)
226				' **************************************************
227				mySQL = "SELECT ItemReason FROM AXItemReasonGLAccountRelations WHERE (GL = "& openGL & ") AND (GLAccount = "& GLAccount & ")"
228				Set RS1=Conn.execute(mySQL)
229
230				if RS1.eof then
231					'Using default reason (sys: AO, reason: Misc.)
232					Reason=6
233				else
234					Reason=	cint(RS1("ItemReason"))
235				end if
236				RS1.close
237
238				mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
239				Set RS1=Conn.execute(mySQL)
240				sys=			RS1("Acron")
241				ReasonName =	RS1("Name")
242				RS1.close
243
244				' * Note: This is affecting the first line info (Account) so it must be the opposite of isCredit
245				'*** Memo Type=5 means 'Cheque Return'
246				mySQL="INSERT INTO "& sys & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Amount, Description) VALUES (N'"& GLMemoDate & "' , "& session("ID") & ", 5, "& Account & ", "& thisIsDebit & ", "& thisAmount & ", N'"& thisDescription & "');SELECT @@Identity AS NewMemo"
247				set RS1 = Conn.execute(mySQL).NextRecordSet
248				theMemo = RS1("NewMemo")
249				RS1.close
250
251				'*** Type = 3 means A*Item is a Memo
252				mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, IsCredit, Type, Link, Reason, AmountOriginal, CreatedDate, CreatedBy, RemainedAmount, GL_Update) VALUES ('" &_
253				thisGLAccount & "', "& OpenGL &", '"& GLAccount & "', '"& Account & "', N'"& GLMemoDate & "', "& thisIsDebit & ", 3, "& theMemo & ", "& Reason & ", "& thisAmount & ", N'"& creationDate & "', "& session("ID") & ", "& thisAmount & ", 0);SELECT @@Identity AS NewItem"
254				set RS1 = Conn.execute(mySQL).NextRecordSet
255				theItem = RS1("NewItem")
256				RS1.close
257
258				' * Note: This is affecting the first line info (Account) so it must be the opposite of isCredit
259				if thisIsDebit then
260					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& thisAmount & "' WHERE (ID='"& Account & "')"
261				else
262					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& thisAmount & "' WHERE (ID='"& Account & "')"
263				end if
264				conn.Execute(mySQL)
265
266				' **************************************************
267				' ------ End of Creating a Memo and an Item for this
268				' --------------------------------------------------
269
270				'First Line:
271				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Tafsil, Amount, Description, IsCredit, Ref1, Ref2, SYS, Link) VALUES ( "&	GLDoc & ", "& GLAccount & ", "& Account & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsDebit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"', '"& sys & "', '"& theItem & "')"
272				conn.Execute(mySQL)
273
274
275				'Seccond Line:
276				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Amount, Description, IsCredit, Ref1, Ref2, SYS, Link) VALUES ( "&	GLDoc & ", "& thisGLAccount & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsCredit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"', '"& sys & "', '"& theItem & "')"
277				conn.Execute(mySQL)
278			else
279			'
280			'	Both Lines need a SubSystem Memo
281			'
282				' --------------------------------------------------------------
283				' -----------	Creating a Memo and an Item for the first line
284				' --------------------------------------------------------------
285				' -----------	Transfer Memo (������� ������)
286				' **************************************************
287				mySQL = "SELECT ItemReason FROM AXItemReasonGLAccountRelations WHERE (GL = "& openGL & ") AND (GLAccount = "& GLAccount & ")"
288				Set RS1=Conn.execute(mySQL)
289
290				if RS1.eof then
291					'Using default reason (sys: AO, reason: Misc.)
292					Reason=6
293				else
294					Reason=	cint(RS1("ItemReason"))
295				end if
296				RS1.close
297
298				mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
299				Set RS1=Conn.execute(mySQL)
300				sys=			RS1("Acron")
301				ReasonName =	RS1("Name")
302				RS1.close
303
304				' * Note: This is affecting the first line info (Account) so it must be the opposite of isCredit
305				'*** Memo Type=7 means 'Transfer Memo'
306				mySQL="INSERT INTO "& sys & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Amount, Description) VALUES (N'"& GLMemoDate & "' , "& session("ID") & ", 7, "& Account & ", "& thisIsDebit & ", "& thisAmount & ", N'"& thisDescription & "');SELECT @@Identity AS NewMemo"
307				set RS1 = Conn.execute(mySQL).NextRecordSet
308				theMemo = RS1("NewMemo")
309				RS1.close
310
311				'*** Type = 3 means A*Item is a Memo
312				mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, IsCredit, Type, Link, Reason, AmountOriginal, CreatedDate, CreatedBy, RemainedAmount, GL_Update) VALUES ('" &_
313				thisGLAccount & "', "& OpenGL &", '"& GLAccount & "', '"& Account & "', N'"& GLMemoDate & "', "& thisIsDebit & ", 3, "& theMemo & ", "& Reason & ", "& thisAmount & ", N'"& creationDate & "', "& session("ID") & ", "& thisAmount & ", 0);SELECT @@Identity AS NewItem"
314				set RS1 = Conn.execute(mySQL).NextRecordSet
315				theItem = RS1("NewItem")
316				RS1.close
317
318				' * Note: This is affecting the first line info (Account) so it must be the opposite of isCredit
319				if thisIsDebit then
320					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& thisAmount & "' WHERE (ID='"& Account & "')"
321				else
322					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& thisAmount & "' WHERE (ID='"& Account & "')"
323				end if
324				conn.Execute(mySQL)
325
326				firstItem=theItem
327				firstMemo=theMemo
328				firstSys=sys
329
330				' **************************************************
331				' ------ End of Creating a Memo and an Item for the first line
332				' --------------------------------------------------------------
333
334
335				' --------------------------------------------------------------
336				' -----------	Creating a Memo and an Item for the seccond line
337				' --------------------------------------------------------------
338				' -----------	Transfer Memo (������� ������)
339				' **************************************************
340				mySQL = "SELECT ItemReason FROM AXItemReasonGLAccountRelations WHERE (GL = "& openGL & ") AND (GLAccount = "& thisGLAccount & ")"
341				Set RS1=Conn.execute(mySQL)
342
343				if RS1.eof then
344					'Using default reason (sys: AO, reason: Misc.)
345					Reason=6
346				else
347					Reason=	cint(RS1("ItemReason"))
348				end if
349				RS1.close
350
351				mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
352				Set RS1=Conn.execute(mySQL)
353				sys=			RS1("Acron")
354				ReasonName =	RS1("Name")
355				RS1.close
356
357				'*** Memo Type=7 means 'Transfer Memo'
358				mySQL="INSERT INTO "& sys & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Amount, Description) VALUES (N'"& GLMemoDate & "' , "& session("ID") & ", 7, "& thisAccount & ", "& thisIsCredit & ", "& thisAmount & ", N'"& thisDescription & "');SELECT @@Identity AS NewMemo"
359				set RS1 = Conn.execute(mySQL).NextRecordSet
360				theMemo = RS1("NewMemo")
361				RS1.close
362
363				'*** Type = 3 means A*Item is a Memo
364				mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, IsCredit, Type, Link, Reason, AmountOriginal, CreatedDate, CreatedBy, RemainedAmount, GL_Update) VALUES ('" &_
365				GLAccount & "', "& OpenGL &", '"& thisGLAccount & "', '"& thisAccount & "', N'"& GLMemoDate & "', "& thisIsCredit & ", 3, "& theMemo & ", "& Reason & ", "& thisAmount & ", N'"& creationDate & "', "& session("ID") & ", "& thisAmount & ", 0);SELECT @@Identity AS NewItem"
366				set RS1 = Conn.execute(mySQL).NextRecordSet
367				theItem = RS1("NewItem")
368				RS1.close
369
370				if thisIsCredit then
371					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& thisAmount & "' WHERE (ID='"& thisAccount & "')"
372				else
373					mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& thisAmount & "' WHERE (ID='"& thisAccount & "')"
374				end if
375				conn.Execute(mySQL)
376
377				seccondItem=theItem
378				seccondMemo=theMemo
379				seccondSys=sys
380
381				' **************************************************
382				' ------ End of Creating a Memo and an Item for the first line
383				' --------------------------------------------------------------
384
385				'---------------------------------------------
386				'------------------------------------ Relation
387				if thisIsCredit then
388					mySQL="INSERT INTO InterMemoRelation (FromItemType, FromItemLink, ToItemType, ToItemLink) VALUES ('"& firstSys & "', "& firstMemo & ", '"& seccondSys & "', "& seccondMemo & ")"
389				else
390					mySQL="INSERT INTO InterMemoRelation (FromItemType, FromItemLink, ToItemType, ToItemLink) VALUES ('"& seccondSys & "', "& seccondMemo & ", '"& firstSys & "', "& firstMemo & ")"
391				end if
392				conn.Execute(mySQL)
393				'----------------------------- End of Relation
394				'---------------------------------------------
395
396				'First Line:
397				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Tafsil, Amount, Description, IsCredit, Ref1, Ref2, SYS, Link) VALUES ( "&	GLDoc & ", "& GLAccount & ", "& Account & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsDebit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"', '"& firstSys & "', '"& firstItem & "')"
398				conn.Execute(mySQL)
399
400
401				'Seccond Line:
402				mySQL="INSERT INTO GLRows (GLDoc, GLAccount, Tafsil, Amount, Description, IsCredit, Ref1, Ref2, SYS, Link) VALUES ( "&	GLDoc & ", "& thisGLAccount & ", "& thisAccount & ", "& thisAmount & ", N'"& thisDescription & "', "& thisIsCredit & ", N'"& thisCheqNo &"', N'"& thisCheqDate &"', '"& seccondSys & "', '"& seccondItem & "')"
403				conn.Execute(mySQL)
404
405			end if
406		Next
407		
408	end if
409
410	conn.close
411	response.redirect "../accounting/GLMemoDocShow.asp?id="&GLDoc&"&msg="& Server.URLEncode("��� ��� ��")
412'------------------------------------------------------------------------------
413'-------------------------------------------------------------------- Make Memo
414'------------------------------------------------------------------------------
415elseif request("act")="makeMemo" then
416
417	Account=request.form("Account")
418	GLAccount=request.form("GLAccount")
419
420	if Account="" and GLAccount="" then
421		response.redirect "?errMsg="&Server.URLEncode("��� ���� ���")
422	end if
423
424	GLMemoDate = request.form("GLMemoDate")
425%>
426	<br><br>
427	<FORM METHOD=POST ACTION="?act=submitMemo" onsubmit="if (document.all.GLMemoDate.value==''){document.all.GLMemoDate.focus();return false;}else{return acceptDate(document.all.GLMemoDate)}">
428	<INPUT TYPE="hidden" Name="Account" Value='<%=Account%>'>
429	<INPUT TYPE="hidden" Name="GLAccount" Value='<%=GLAccount%>'>
430	<table class="RepTable" align='center' width='90%'>
431	<tr class="RepTableHeader">
432		<td colspan='3' align='left'>����� ���:</td>
433		<td colspan='2' align='right' ><INPUT class="GenInput" NAME="GLMemoDate" tabIndex="1" TYPE="text" maxlength="10" size="10" value="" onBlur="acceptDate(this)"></td>
434	</tr>
435	<tr class="RepTableTitle">
436		<td>#</td>
437		<td>����</td>
438		<td>���</td>
439		<td>������</td>
440		<td>��������</td>
441	</tr>
442<%
443	tempCounter=0
444	for i=1 to request.form("GLAccounts").count
445	  if request.form("GLAccounts")(i)<>0 then
446		tempCounter=tempCounter+1
447		firstAccount=request.form("FirstAccounts")(i)
448		if firstAccount=0 then firstAccount=""
449		firstGLAccount=request.form("FirstGLAccounts")(i)
450
451		thisAccount=request.form("Accounts")(i)
452		if thisAccount=0 then thisAccount=""
453		thisGLAccount=request.form("GLAccounts")(i)
454		thisDescription=request.form("Descriptions")(i)
455		thisAmount=request.form("Amounts")(i)
456%>
457		<tr class='RepTR<%=tempCounter MOD 2%>'>
458			<td rowspan=2><%=tempCounter%></td>
459			<td><%=firstGLAccount&firstAccount%></td>
460			<td><%=thisDescription%></td>
461			<%if request.form("IsCredit")(i) then%>
462				<td><%=thisAmount%></td>
463				<td>&nbsp;</td>
464			<%else%>
465				<td>&nbsp;</td>
466				<td><%=thisAmount%></td>
467			<%end if%>
468		</tr>
469		<tr class='RepTR<%=tempCounter MOD 2%>'>
470			<td><%=thisGLAccount&thisAccount%>
471				<INPUT TYPE="hidden" Name="FirstAccounts" Value='<%=FirstAccount%>'>
472				<INPUT TYPE="hidden" Name="FirstGLAccounts" Value='<%=FirstGLAccount%>'>
473				<INPUT TYPE="hidden" Name="Accounts" Value='<%=thisAccount%>'>
474				<INPUT TYPE="hidden" Name="GLAccounts" Value='<%=thisGLAccount%>'>
475				<INPUT TYPE="hidden" Name="Descriptions" Value='<%=thisDescription%>'>
476				<INPUT TYPE="hidden" Name="Amounts" Value='<%=text2value(thisAmount)%>'>
477				<INPUT TYPE="hidden" Name="IsCredit" Value='<%=request.form("IsCredit")(i)%>'>
478				<INPUT TYPE="hidden" Name="CheqNos" Value='<%=request.form("CheqNos")(i)%>'>
479				<INPUT TYPE="hidden" Name="CheqDates" Value='<%=request.form("CheqDates")(i)%>'>
480				</td>
481			<td><%=thisDescription%></td>
482			<%if request.form("IsCredit")(i) then%>
483				<td>&nbsp;</td>
484				<td><%=thisAmount%></td>
485			<%else%>
486				<td><%=thisAmount%></td>
487				<td>&nbsp;</td>
488			<%end if%>
489		</tr>
490<%
491	  end if
492	Next
493%>
494	<tr class="RepTableHeader">
495		<td colspan=5><INPUT TYPE="submit" Value="�����"class='GenInput' style='text-align:center;'></td>
496	</tr>
497	</table>
498	</FORM>
499<%
500'------------------------------------------------------------------------------
501'------------------------------------------------------------- Show Cheque Book
502'------------------------------------------------------------------------------
503elseif request("act")="showBook" then
504	Response.CacheControl="no-cache"
505	Response.AddHeader "pragma", "no-cache"
506	glList=""
507	GLAccount=0
508	if inStr(request("GLAccount"),",")>1 then 
509		glList=replace(request("GLAccount"),","," ")
510	else
511		GLAccount=request("GLAccount")
512	end if
513	
514	Account=request("Account")
515	FromDate=	request("FromDate")
516	ToDate=		request("ToDate")
517	displayMode=request("displayMode")
518	
519	if displayMode="" then displayMode=0
520
521	if request("ShowRemained")="on" then
522		ShowRemained=1
523	else
524		ShowRemained=0
525	end if
526
527	if GLAccount="" then
528		response.redirect "?errMsg="&Server.URLEncode("��� ���� ���")
529	end if
530	
531	if Account="" or not isnumeric(Account) then
532		Tafsil = ""
533	else
534		Tafsil = clng(Account)
535	end if
536
537'	Changed By Kid 830812 for using new (partial) stored procedure 
538
539	mySQL="EXEC proc_CheqBook "& GLAccount & ", '"& Tafsil & "', '"& FromDate & "', '"& ToDate & "', "& openGL & ", "& ShowRemained & ", " &  displayMode & ", '" &  glList & "'"
540	 
541	if FromDate="" AND ToDate="" then
542		pageTitle="�� ���� ����"
543	elseif FromDate="" then
544		pageTitle="�� ����� �� ����� " & replace (ToDate,"/",".")
545	elseif ToDate="" then
546		pageTitle="�� ����� "& replace (FromDate,"/",".") & " �� ����� "
547	else
548		pageTitle="�� ����� "& replace (FromDate,"/",".") & " �� ����� " & replace (ToDate,"/",".")
549	end if
550'response.write mySQL
551	
552	Set RS1=Conn.Execute(mySQL).NextRecordset().NextRecordset()
553	if not RS1.eof then
554		tempCounter=0
555		totalCredit=0
556		totalDebit=0
557%>		<br>
558		<input type="hidden" Name='tmpDlgArg' value=''>
559		<FORM METHOD=POST ACTION="?act=makeMemo">
560		<input type="hidden" Name='Account' value='<%=Account%>'>
561		<input type="hidden" Name='GLAccount' value='<%=GLAccount%>'>
562		<table class="RepTable" align='center'>
563		<tbody id='Cheqs'>
564		<tr class="RepTableHeader">
565			<td colspan="6" style="font-size:14pt;" dir="LTR"><%if GLAccount=0 then response.write glList else response.write GLAccount%><%if Account<>"" then response.write " - " & Account%><span style="font-size:9pt;"><br><br><%=pageTitle%></span></td>
566		</tr>
567		<tr>
568			<td colspan="5">����� ���� ��:<INPUT TYPE="text" class="GenInput" NAME="searchChq" Value="<%=request("cheq")%>" onKeyPress="return handleSearch();"></td>
569			<td align=left>
570			<% 	
571			values = GLAccount&"" 
572			if Account="" then values = values & "0" else values = values  & Account
573			values  = values  &"" & FromDate &"" &ToDate&""&openGL&""&ShowRemained
574			ReportLogRow = PrepareReport ("CheqBook.rpt", "GLAccountTafsilFromDateToDateGLShowRemained", values , "/beta/dialog_printManager.asp?act=Fin") %>
575			<INPUT Class="GenButton" style="border:1 solid green;" TYPE="button" TYPE="button" value=" �ǁ " onclick="printThisReport(this,<%=ReportLogRow%>);">
576			</td>
577		</tr>
578		<tr class="RepTableHeader">
579			<td>#</td>
580			<td>����� ���</td>
581			<td>���</td>
582			<td>������</td>
583			<td>��������</td>
584			<td>����� ��</td>
585		</tr>
586<%		Do while not RS1.eof
587			FirstGLAcc=	RS1("GLAccount")
588			FirstAcc=	RS1("Tafsil")
589			if isnull(FirstAcc) then FirstAcc=0
590			Ref1=		RS1("Ref1")
591			Ref2=		RS1("Ref2")
592			IsCredit=	RS1("IsCredit")
593			Description=RS1("Description")
594			GLDocDate=	RS1("GLDocDate")
595			Amount=		RS1("Amount")
596
597			if IsCredit then
598				totalCredit = totalCredit + cdbl(Amount)
599			else
600				totalDebit = totalDebit + cdbl(Amount)
601			end if
602
603			if NOT (Ref1="" AND Ref2="") then tempCounter=tempCounter+1
604
605%>			<tr class='RepTR<%=tempCounter MOD 2%>' onclick="return getData(this);">
606
607				<td><%if tempCounter>0 then response.write tempCounter%>
608					<INPUT TYPE="hidden" Name="FirstGLAccounts" Value="<%=FirstGLAcc%>">
609					<INPUT TYPE="hidden" Name="FirstAccounts" Value="<%=FirstAcc%>">
610					<INPUT TYPE="hidden" Name="GLAccounts" Value="0">
611					<INPUT TYPE="hidden" Name="Accounts" Value="0"></td>
612				<td dir=LTR>
613					<INPUT readonly Name="GLDocDates" class="RepROInputs" Value="<%=GLDocDate%>"></td>
614				<td>
615					<TextArea readonly Name="Descriptions" class="RepTextArea"><%=replace(Description,"/",".")%></TextArea></td>
616<%			if IsCredit then%>
617				<td>
618					<INPUT TYPE="hidden" Name="IsCredit" Value="<%=IsCredit%>">
619				</td>
620				<td>
621					<INPUT readonly Name="Amounts" class="RepROInputs" Value="<%=Separate(Amount)%>">
622				</td>
623<%			else%>			
624				<td>
625					<INPUT readonly Name="Amounts" class="RepROInputs" Value="<%=Separate(Amount)%>">
626				</td>
627				<td>
628					<INPUT TYPE="hidden" Name="IsCredit" Value="<%=IsCredit%>">
629				</td>
630<%			end if%>
631				<td dir=LTR>
632					<INPUT readonly Name="CheqDates" class="RepROInputs" Value="<%=Ref2%>">
633					<INPUT type="hidden" readonly Name="CheqNos" class="RepROInputs" Value="<%=Ref1%>"></td>
634			</tr>
635<%			RS1.MoveNext
636		Loop
637		tempCounter = tempCounter + 1
638%>
639		<tr class='RepTR<%=tempCounter MOD 2%>'>
640			<td>&nbsp;</td>
641			<td>&nbsp;</td>
642			<td><span style="width:300px;text-align:left;overflow:auto;text-overflow:ellipsis;"><B>��� :</B></span></td>
643			<td><INPUT readonly class="RepROInputs" Value="<%=Separate(totalDebit)%>"></td>
644			<td><INPUT readonly class="RepROInputs" Value="<%=Separate(totalCredit)%>"></td>
645			<td>&nbsp;</td>
646		</tr>
647		<tr class="RepTableHeader">
648			<td colspan="6"><INPUT TYPE="Button" Value=" ����� " onclick="submit();"></td>
649		</tr>
650		</tbody>
651		</FORM>
652		</table>
653		<SCRIPT LANGUAGE="JavaScript">
654		<!--
655
656		function documentKeyDown() {
657			var theKey = window.event.keyCode;
658			var obj = window.event.srcElement;
659			if (theKey == 114) { 
660				if (obj.name=="searchChq"){document.all.searchChq.select();};
661				window.event.keyCode=0;
662				document.all.searchChq.focus();
663				return false;
664			}
665		}
666		document.onkeydown = documentKeyDown;
667
668		document.all.searchChq.focus();
669		//handleSearch();
670		//-->
671		</SCRIPT>
672		<br>
673<%	else
674		RS1.Close
675		conn.close
676		response.redirect "?errMsg="&Server.URLEncode("��� ��� ���� ���")
677	end if
678	RS1.Close
679%>
680	<SCRIPT LANGUAGE="JavaScript">
681	<!--
682	function handleSearch(){
683		var theKey=event.keyCode;
684		if (theKey==13){
685			searchNo=document.getElementsByName("searchChq")[0].value
686			theTable=document.getElementById("Cheqs")
687			cheqsVector=document.getElementsByName("CheqNos")
688			for(i=0; i<cheqsVector.length; i++){
689				if (cheqsVector[i].value==searchNo){
690					theTable.getElementsByTagName("TR")[i+2].scrollIntoView();
691					return getData(theTable.getElementsByTagName("TR")[i+3])
692				}
693			}
694			
695		}
696		else if (theKey<48 || theKey>57) // don't accept non-digits
697			return false
698	}
699
700	function getData(src)
701	{
702		myIndex=src.rowIndex-3;
703		if (src.getElementsByTagName("TD")[0].innerText==" ") return false; 
704		for(i=0; i<src.getElementsByTagName("TD").length; i++){
705			src.getElementsByTagName("TD")[i].setAttribute("bgColor","yellow")
706		}
707		document.all.tmpDlgArg.value=document.getElementsByName("Descriptions")[myIndex].value + " (����: " + document.getElementsByName("Amounts")[myIndex].value +")<br><br>"
708		window.showModalDialog('dialog_GetDestination.asp',document.all.tmpDlgArg,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
709		if (document.all.tmpDlgArg.value !="") {
710			Arguments=document.all.tmpDlgArg.value.split("#")
711			document.getElementsByName("GLAccounts")[myIndex].value=Arguments[0]
712			document.getElementsByName("Accounts")[myIndex].value=Arguments[1]
713			if (Arguments[1]==0)
714				src.setAttribute("title","�� ���� " + Arguments[0] +" ������ �� ���.")
715			else
716				src.setAttribute("title","�� ���� "+Arguments[1] + " - " + Arguments[0] +" ������ �� ���.")
717		}
718		else{
719			document.getElementsByName("GLAccounts")[myIndex].value="0"
720			document.getElementsByName("Accounts")[myIndex].value="0"
721			for(i=0; i<src.getElementsByTagName("TD").length; i++){
722				src.getElementsByTagName("TD")[i].setAttribute("bgColor","")
723			}
724			src.setAttribute("title","")
725		}
726		return false;
727	}
728	//-->
729	</SCRIPT>
730<%
731'------------------------------------------------------------------------------
732'------------------------------------------------------------------ Find Cheque
733'------------------------------------------------------------------------------
734elseif request("act")="findCheq" then
735	chqNo = replace(sqlSafe(request("cheque")),".","")
736	amount= replace(sqlSafe(request("amount")),".","")
737	if isnumeric(chqNo) then
738		chqNo=cdbl(chqNo)
739		mySQL="SELECT GLDocs.GLDocDate, GLDocs.GLDocID, GLDocs.ID AS GLDoc, GLRows.* FROM GLRows INNER JOIN GLDocs ON GLRows.GLDoc = GLDocs.ID WHERE (GLRows.deleted = 0) AND (CAST(GLRows.Ref1 AS float) = '"& chqNo & "') AND (GLDocs.IsRemoved = 0) AND (GLDocs.deleted = 0) AND (GLDocs.GL = '"& openGL & "') AND NOT(IsTemporary = 0 AND IsFinalized = 0) ORDER BY GLDocs.GLDocDate, GLRows.ID"
740	elseif isnumeric(amount) then
741		amount=cdbl(amount)
742		mySQL="SELECT GLDocs.GLDocDate, GLDocs.GLDocID, GLDocs.ID AS GLDoc, GLRows.* FROM GLRows INNER JOIN GLDocs ON GLRows.GLDoc = GLDocs.ID WHERE (GLRows.deleted = 0) AND (GLRows.Ref1 <> '') AND (GLRows.Amount = '"& amount & "') AND (GLDocs.IsRemoved = 0) AND (GLDocs.deleted = 0) AND (GLDocs.GL = '"& openGL & "') ORDER BY GLDocs.GLDocDate, GLRows.ID"
743	else
744		conn.close
745		response.redirect "?errMsg="&Server.URLEncode("����� �� ����� ����.")
746	end if
747
748	Set RS1=Conn.execute(mySQL)
749	if RS1.eof then
750		conn.close
751'		response.redirect "?errMsg="&Server.URLEncode("��� ����� �� ���� ���.")
752		response.redirect "?errMsg="&Server.URLEncode("�� �� ��� ������ ���� ���.")
753	else
754%>
755		<br>
756		<table class="RepTable" align='center' width='90%'>
757		<tr class="RepTableTitle">
758			<td>#</td>
759			<td>�����</td>
760			<td>���</td>
761			<td>����</td>
762			<td>���</td>
763			<td>������</td>
764			<td>��������</td>
765		</tr>
766<%
767		tempCounter=0
768		Do While NOT RS1.eof
769			tempCounter=tempCounter+1
770			GLDocDate =		RS1("GLDocDate")
771			GLDoc =			RS1("GLDoc")
772			GLDocNo =		RS1("GLDocID")
773			GLAccount =		RS1("GLAccount")
774			Account =		RS1("Tafsil")
775			Description =	RS1("Description")
776			Ref1 =			RS1("Ref1")
777			Ref2 =			RS1("Ref2")
778			Amount =		RS1("Amount")
779			IsCredit =		RS1("IsCredit")
780
781			credit = ""
782			debit = ""
783			if IsCredit  then 
784				credit = Amount 
785				totalCredit = totalCredit + cdbl(Amount)
786			else
787				debit = Amount 
788				totalDebit = totalDebit + cdbl(Amount)
789			end if
790%>
791			<tr class='RepTR<%=tempCounter MOD 2%>'>
792				<td><%=tempCounter%></td>
793				<td style='width:60;direction:LTR;'><%=GLDocDate%></td>
794
795				<td><A HREF="../accounting/GLMemoDocShow.asp?id=<%=GLDoc%>" Target="_blank"><%=GLDocNo%></A></td>
796				<td style="cursor:hand;" onclick="window.location='?act=showBook&Account=<%=Account%>&GLAccount=<%=GLAccount%>&cheq=<%=Ref1%>';"><B><%=GLAccount&Account%></B></td>
797				<td><%=Description%></td>
798				<%if IsCredit then%>
799					<td>&nbsp;</td>
800					<td><%=Separate(Amount)%></td>
801				<%else%>
802					<td><%=Separate(Amount)%></td>
803					<td>&nbsp;</td>
804				<%end if%>
805			</tr>
806<%
807			RS1.moveNext
808		Loop
809%>
810		<tr class="RepTableTitle">
811			<td colspan=7 height=30>&nbsp;</td>
812		</tr>
813		</table>
814<%
815	end if 
816'------------------------------------------------------------------------------
817'---------------------------------------------------------------------- default
818'------------------------------------------------------------------------------
819else
820%>
821	<BR>
822	<Center>
823	<input type="hidden" Name='tmpDlgArg' value=''>
824	<input type="hidden" Name='tmpDlgTxt' value=''>
825
826	<FORM METHOD=POST ACTION="?act=showBook" onsubmit="return checkValidation();">
827	<TABLE>
828	<TR>
829		<TD colspan=2 align=center>������</TD>
830		<TD align=center>����</TD>
831	</TR>
832	<TR>
833		<TD colspan=2><INPUT dir="LTR"  TYPE="text" NAME="Account" ID="Account" maxlength="6" value="<%=Account%>" onKeyPress='return mask(this);' onBlur='check(this);' style="width:250px;border:solid 1pt black" tabindex=2></TD>
834		<TD><INPUT dir="LTR"  TYPE="text" NAME="GLAccount" id="GLAccount" maxlength="50" value="<%=GLAccount%>" onKeyPress='return mask(this);' onBlur='check(this);' style="width:100px;border:solid 1pt black" tabindex=1></TD>
835	</TR>
836	<TR>
837		<TD colspan=2><TextArea NAME="AccountName" id="AccountName" readonly style="width:250px;height:40px;font-family:tahoma;font-size:9pt;background:transparent; border:solid 1px white"><%=AccountName%></TextArea></TD>
838		<TD><TextArea NAME="GLAccountName" id="GLAccountName" readonly  style="width:100px;height:40px;font-family:tahoma;font-size:9pt;background:transparent; border:solid 1px white;"><%=GLAccountName%></TextArea></TD>
839	</TR>
840	<tr>
841		<td><input type='radio' name='displayMode' value=0 CHECKED><span>����� ����</span></td>
842		<td><input type='radio' name='displayMode' value=1><span>����� ������</span></td>
843		<td><input type='radio' name='displayMode' value=2><span>����� ������</span></td>
844	</tr>
845	<TR>
846		<TD align=left><INPUT TYPE="checkbox" NAME="ShowRemained" tabindex=5> ����� ��� ����� ���� ���.</TD>
847		<TD align=left>�� �����</TD>
848		<TD><INPUT dir="LTR" class="GenInput" NAME="FromDate" id="FromDate" tabIndex="3" TYPE="text" maxlength="10" size="10" value="" onBlur="acceptDate(this);if(this.value!=''){document.all.ShowRemained.checked=true;}else{document.all.ShowRemained.checked=false;}" style="width:100px;"></TD>
849	</TR>
850	<TR>
851		<TD align=center><INPUT TYPE="Submit" Value=" ����� " tabindex=6></TD>
852		<TD align=left>�� �����</TD>
853		<TD><INPUT dir="LTR" class="GenInput" NAME="ToDate" id="ToDate" tabIndex="4" TYPE="text" maxlength="10" size="10" value="" onBlur="acceptDate(this)" style="width:100px;"></TD>
854	</TR>
855	<TR>
856	</TR>
857	</FORM>
858	</TABLE>
859
860	<hr width='80%'>
861	<FORM METHOD=POST ACTION="?act=findCheq">
862	<TABLE>
863	<TR>
864		<TD align=center colspan=2>������ ��</TD>
865	</TR>
866	<TR>
867		<TD align=center>����� ��</TD>
868		<TD><INPUT dir="LTR"  TYPE="text" NAME="cheque" maxlength="10" onKeyPress='return mask(this);' onChange='check(this);' style="width:100px;border:solid 1pt black" tabindex=10></TD>
869	</TR>
870	<TR>
871		<TD align=center>����</TD>
872		<TD><INPUT dir="LTR"  TYPE="text" NAME="amount" maxlength="10" onKeyPress='return mask(this);' onChange='check(this);' style="width:100px;border:solid 1pt black" tabindex=10></TD>
873	</TR>
874	</TABLE>
875	<INPUT TYPE="Submit" Value=" ����� " tabindex=11 onkeyDown='if(event.keyCode==9) {document.all.GLAccount.focus(); return false;}'>
876	</FORM>
877	</Center>
878
879	<SCRIPT LANGUAGE="JavaScript">
880	<!--
881	document.all.GLAccount.focus();
882
883	var dialogActive=false;
884
885
886	function mask(src){ 
887		var theKey=event.keyCode;
888		if (theKey==32){
889			event.keyCode=9
890			document.all.tmpDlgArg.value="#"
891			if (src.name=='GLAccount'){
892				document.all.tmpDlgTxt.value="����� �� ��� ���� ��� ����:"
893				dialogActive=true
894				window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
895				dialogActive=false
896				if (document.all.tmpDlgTxt.value !="") {
897					dialogActive=true
898					window.showModalDialog('../accounting/dialog_selectGL.asp?act=select&name='+escape(document.all.tmpDlgTxt.value),document.all.tmpDlgArg,'dialogHeight:500px; dialogWidth:380px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
899					dialogActive=false
900					if (document.all.tmpDlgArg.value!="#"){
901						Arguments=document.all.tmpDlgArg.value.split("#")
902						src.value=Arguments[0];
903						document.all.GLAccountName.value=Arguments[1];
904					}
905				}
906			}
907			else if (src.name=='Account') {
908				document.all.tmpDlgTxt.value="����� �� ��� ���� ��� ������:"
909				dialogActive=true
910				window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
911				dialogActive=false
912				if (document.all.tmpDlgTxt.value !="") {
913					dialogActive=true
914					window.showModalDialog('../AR/dialog_SelectAccount.asp?act=select&search='+escape(document.all.tmpDlgTxt.value), document.all.tmpDlgArg, 'dialogWidth:780px; dialogHeight:500px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
915					dialogActive=true
916					if (document.all.tmpDlgArg.value!="#"){
917						Arguments=document.all.tmpDlgArg.value.split("#")
918						src.value=Arguments[0];
919						document.all.AccountName.value=Arguments[1];
920					}
921				}
922			}
923		}
924		else if ((theKey >= 48 && theKey <= 57) || theKey==13 || theKey==44 ) // [0]-[9] and [Enter] are acceptible
925			return true;
926		else
927			return false;
928	}
929
930	function check(src){ 
931//--------------------SAM FireFox Compatibility-------------------------------
932		if (!dialogActive){
933			badCode = false;
934			if (window.XMLHttpRequest) {
935				var objHTTP=new XMLHttpRequest();
936			} else if (window.ActiveXObject) {
937				var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
938			}
939			if (src.name=='GLAccount' && src.value.indexOf(",")=='-1') {
940				objHTTP.open('GET','../accounting/xml_GLAccount.asp?id='+src.value,false)
941				objHTTP.send()
942				tmpStr = unescape(objHTTP.responseText)
943				document.all.GLAccountName.value=tmpStr;
944				//if (tmpStr == '���� ����� ���� �����')
945				//	src.value='';
946			}
947			else if (src.name=='Account') {
948				objHTTP.open('GET','../accounting/xml_CustomerAccount.asp?id='+src.value,false)
949				objHTTP.send()
950				tmpStr = unescape(objHTTP.responseText)
951				document.all.AccountName.value=tmpStr;
952			}
953		}
954	}
955	function checkValidation(){
956	  try{
957		box=document.all.GLAccount;
958		check(box);
959		if (box.value==''){
960			box.style.backgroundColor="red";
961			alert("��� ����� ������ ����");
962			box.style.backgroundColor="";
963			box.focus();
964			return false;
965		}
966		box=document.all.FromDate;
967		if (box.value!='' && box.value!=null){
968			if (!acceptDate(box))
969				return false;
970		}
971		box=document.all.ToDate;
972		if (box.value!='' && box.value!=null){
973			if (!acceptDate(box))
974				return false;
975		}
976	  }catch(e){
977			alert("���� ��� ������");
978			return false;
979	  }
980	}
981
982	//-->
983	</SCRIPT>
984<%
985end if
986%>
987
988<!--#include file="tah.asp" -->