PageRenderTime 29ms CodeModel.GetById 12ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/bank/Contra.asp

http://github.com/khaneh/Orders
ASP | 1008 lines | 813 code | 129 blank | 66 comment | 53 complexity | 53498b599f7085ea8cc08b9d61f9c59f MD5 | raw file
   1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
   2'Bank (10 [=A])
   3PageTitle= "������"
   4SubmenuItem=9
   5if not Auth("A" , 9) then NotAllowdToViewThisPage()
   6
   7%>
   8<!--#include file="top.asp" -->
   9<!--#include File="../include_farsiDateHandling.asp"-->
  10<!--#include File="../include_JS_InputMasks.asp"-->
  11<style>
  12	.GenInput { font-family:tahoma; font-size: 9pt; border: 1px solid black; text-align:right; }
  13	.GenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; }
  14	.dateLine {background-Color:#003399;color:#FFFF00;}
  15	.row {}
  16	.row1 {background-Color:#99FFCC;}
  17	.row2 {background-Color:#66CC99;}
  18	.row3 {background-Color:#AADDFF;}
  19	.row9 {background-Color:#FFCC00;t:#66CC00;}
  20</style>
  21
  22<BR><BR>
  23<%
  24Function showDate(inpStr)
  25'	if len(inpStr)=6 then
  26'		showDate = left(inpStr,2) & "." & mid(inpStr,3,2) & "." & right(inpStr,2)
  27'	else
  28'		showDate = "Error"
  29'	end if
  30	showDate = replace(inpStr,"/",".")
  31End Function
  32
  33Function WriteBlankRows (inpRemainedRows) 
  34
  35	For tmpCnt = 1 to inpRemainedRows
  36%>		<TR height=20>
  37			<TD colspan=5>&nbsp;</TD>
  38		</TR>
  39<%	Next
  40
  41End Function
  42
  43Function convertDate(inpStr)
  44	if len(inpStr)=10 then
  45		convertDate = mid(inpStr,3,2) & mid(inpStr,6,2) & right(inpStr,2)
  46	else
  47		convertDate = "Error"
  48	end if
  49End Function
  50
  51Function lookupDescCode(inpBank, inpCode)
  52	result = inpBank & "," & inpCode ' = "&nbsp;"
  53	Select Case result
  54		' Tejarat
  55		Case "1,6":
  56			result = "������ ���� ��"
  57		Case "1,7":
  58			result = "������ ����"
  59		Case "1,8":
  60			result = "������ ����"
  61		Case "1,11":
  62			result = "���� ��"
  63		Case "1,13":
  64			result = "���������"
  65		Case "1,22":
  66			result = "������ ���� (���)"
  67		Case "1,28":
  68			result = "�� �����"
  69		Case "1,33":
  70			result = "����� �����"
  71		Case "1,38":
  72			result = "��� ����� �����"
  73		Case "1,42":
  74			result = "���� ����"
  75		Case "1,43":
  76			result = "��� � ������ ����"
  77		Case "1,125":
  78			result = "������ ����"
  79		Case "1,251":
  80			result = "������ ������� ��"
  81		Case "1,122":
  82			result = "������ ���� (��� ���)"
  83		Case "1,291":
  84			result = "�ѐ�� ��� ������"
  85		Case "1,162":
  86			result = "������ ���� �� ���"
  87		Case "1,262":
  88			result = "������ �� ����(���� ����)"
  89		Case "1,223":
  90			result = "����� ���� �������� ��"
  91		Case "1,253":
  92			result = "������ ������� ��� ���"
  93		Case "1,222":
  94			result = "������ �� ����(���� ����)"
  95		Case "1,273":
  96			result = "������ �� �������"
  97		Case "1,211":
  98			result = "���� ��"
  99		Case "1,261":
 100			result = "������ �� ����"
 101		Case "1,161":
 102			result = "������ ���� ��"
 103		Case "1,254":
 104			result = "������ ������� ����� �����"
 105		Case "1,":
 106			result = ""
 107		Case "1,":
 108			result = ""
 109		' Sepah
 110		Case "2,1":
 111			result = "�� �������"
 112		Case "2,2":
 113			result = "��� ����"
 114		Case "2,3":
 115			result = "�����"
 116		Case "2,4":
 117			result = "�����"
 118		Case "2,5":
 119			result = "������"
 120		Case "2,9":
 121			result = "�������"
 122		Case "2,11":
 123			result = "��������"
 124		Case "2,12":
 125			result = "�� ������"
 126		Case "2,15":
 127			result = "�� ������"
 128	End Select
 129	lookupDescCode = result
 130End Function
 131Function lookupBankType(inpGLAccount)
 132	Select Case inpGLAccount
 133		Case "12001":
 134			result = "1" ' Tejarat
 135		Case "12004":
 136			result = "1" ' Tejarat
 137		Case "12002":
 138			result = "2" ' Sepah
 139		Case else:
 140			result = "Error"
 141	End Select
 142	lookupBankType = result
 143End Function
 144Function lookupBankAccountNo(inpGLAccount)
 145	Select Case inpGLAccount
 146		Case "12001":
 147			result = "0033624050"
 148		Case "12004":
 149			result = "0033624816"
 150		Case "12002":
 151			result = "000434419"
 152		Case else:
 153			result = "Error"
 154	End Select
 155	lookupBankAccountNo = result
 156End Function
 157
 158'-----------------------------------------------------------------------------------------------------
 159'---------------------------------------------------------------------------- Show Remained Un Related
 160'-----------------------------------------------------------------------------------------------------
 161if request("act")="showAll" then
 162	'----- Check GL is closed
 163	if (session("IsClosed")="True") then
 164		Conn.close
 165		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
 166	end if 
 167	'----
 168	StartDate =		request.QueryString("StartDate")
 169	EndDate =		request.QueryString("EndDate")
 170	BankGLAccount = cint(request.QueryString("BankGLAccount"))
 171	BankAccountNo = lookupBankAccountNo(BankGLAccount)
 172	BankType =		lookupBankType(BankGLAccount)
 173
 174	GLRowsViewName = "VIEW_Contra_Remained_GLRows_" & openGL & "_" & BankGLAccount
 175	BankRowsViewName = "VIEW_Contra_Remained_BankRows_" & BankAccountNo
 176
 177	'Creating Temporary Table
 178	mySQL="DELETE FROM BankContradiction_TempDates"
 179	Conn.Execute(mySQL)
 180
 181'	mySQL="INSERT INTO BankContradiction_TempDates ([Date], MaxRows) SELECT LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) AS [date], CASE WHEN ISNULL(GLRowDates.CntGLRow, 0) > ISNULL(BankLogDates.CntBankLog, 0) THEN GLRowDates.CntGLRow ELSE BankLogDates.CntBankLog END AS MaxRows FROM (SELECT GLDocDate AS [Date], COUNT(*) AS CntGLRow FROM " & GLRowsViewName & " GROUP BY GLDocDate) GLRowDates FULL OUTER JOIN (SELECT [Date], COUNT(*) AS CntBankLog FROM " & BankRowsViewName & " GROUP BY [Date]) BankLogDates ON GLRowDates.[Date] = BankLogDates.[Date] WHERE (LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) >= '" & StartDate & "') AND (LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) <= '" & EndDate & "') ORDER BY GLRowDates.[Date]"
 182	mySQL="INSERT INTO BankContradiction_TempDates ([Date], MaxRows) SELECT LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) AS [date], CASE WHEN ISNULL(GLRowDates.CntGLRow, 0) > ISNULL(BankLogDates.CntBankLog, 0) THEN GLRowDates.CntGLRow ELSE BankLogDates.CntBankLog END AS MaxRows FROM (SELECT GLDocDate AS [Date], COUNT(*) AS CntGLRow FROM EffectiveGLRows WHERE (GL = " & openGL & ") AND (GLAccount = " & BankGLAccount & ") GROUP BY GLDocDate) GLRowDates FULL OUTER JOIN (SELECT [Date], COUNT(*) AS CntBankLog FROM BankLog WHERE (AccountNo = " & BankAccountNo & ") GROUP BY [Date]) BankLogDates ON GLRowDates.[Date] = BankLogDates.[Date] WHERE (LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) >= '" & StartDate & "') AND (LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) <= '" & EndDate & "') ORDER BY GLRowDates.[Date]"
 183	Conn.Execute(mySQL)
 184%>
 185
 186	<table align=center>
 187	<tr>
 188		<td valign=top>
 189<!-- GL Rows -->
 190		<TABLE cellpadding=2 cellspacing=1 border=1 width=370>
 191		<TR>
 192			<TD colspan=5><B>���� <%=BankGLAccount%></B></TD>
 193		</TR>
 194<%
 195
 196'		mySQL="SELECT BankContradiction_TempDates.[Date] AS BaseDate, BankContradiction_TempDates.MaxRows, BankingGLRows.*, ISNULL(BankContradictionRelations.Type,0) AS Type, BankContradictionRelations.Description AS RelationDesc, Users.RealName AS Creator, BankContradictionRelations.CreatedDate, BankContradictionRelations.CreatedTime FROM BankContradictionRelations INNER JOIN Users ON BankContradictionRelations.CreatedBy = Users.ID RIGHT OUTER JOIN (SELECT ID, isCredit, Amount, Description, GLDoc, GLDocID, GLDocDate FROM EffectiveGLRows WHERE (GL = " & openGL & ") AND (GLAccount = " & BankGLAccount & ")) BankingGLRows ON BankContradictionRelations.GLRowID = BankingGLRows.ID RIGHT OUTER JOIN BankContradiction_TempDates ON BankingGLRows.GLDocDate = BankContradiction_TempDates.[Date] ORDER BY BankContradiction_TempDates.[Date]"
 197
 198		mySQL="SELECT BankContradiction_TempDates.[Date] AS BaseDate, BankContradiction_TempDates.MaxRows, ISNULL(BankContradictionRelations.Type, 0) AS Type, BankingGLRows.ID, BankingGLRows.isCredit, BankingGLRows.Amount, BankingGLRows.Description, BankingGLRows.GLDoc, BankingGLRows.GLDocID, BankingGLRows.GLDocDate FROM BankContradictionRelations RIGHT OUTER JOIN (SELECT ID, isCredit, Amount, Description, GLDoc, GLDocID, GLDocDate FROM EffectiveGLRows WHERE (GL = " & openGL & ") AND (GLAccount = " & BankGLAccount & ")) BankingGLRows ON BankContradictionRelations.GLRowID = BankingGLRows.ID RIGHT OUTER JOIN BankContradiction_TempDates ON BankingGLRows.GLDocDate = BankContradiction_TempDates.[Date] GROUP BY BankContradiction_TempDates.[Date], BankContradiction_TempDates.MaxRows, ISNULL(BankContradictionRelations.Type, 0), BankingGLRows.ID, BankingGLRows.Amount, BankingGLRows.Description, BankingGLRows.GLDoc, BankingGLRows.GLDocID, BankingGLRows.GLDocDate, BankingGLRows.isCredit ORDER BY BankContradiction_TempDates.[Date], BankingGLRows.isCredit DESC, BankingGLRows.Amount"
 199
 200		Set RSDates = Conn.Execute(mySQL)
 201		if NOT RSDates.eof then
 202			RemainedRows = 0
 203			BaseDate = ""
 204			TempCount = 1
 205			Do While NOT RSDates.eof 
 206				RowsCount = clng(RSDates("MaxRows"))
 207				if BaseDate = RSDates("BaseDate") then
 208					RemainedRows = RemainedRows - 1
 209					TempCount = TempCount + 1
 210				else
 211
 212					Call WriteBlankRows (RemainedRows)
 213
 214%>
 215					<TR class="dateLine">
 216						<TD colspan=5><%=showDate(RSDates("BaseDate"))%></TD>
 217					</TR>
 218<%
 219					RemainedRows = RowsCount - 1 
 220					TempCount = 1
 221				end if
 222
 223				if not isnull(RSDates("ID")) then
 224					if RSDates("isCredit") then
 225						Debit="&nbsp;"
 226						Credit=Separate(RSDates("Amount"))
 227					else
 228						Debit=Separate(RSDates("Amount"))
 229						Credit="&nbsp;"
 230					end if
 231					rowType = cint(RSDates("Type"))
 232					if rowType = 1 then
 233						RowTitle="�������� ��� 1:" & vbCrLf & "���ۡ ����Ρ ����� ��"
 234					elseif rowType = 2 then
 235						RowTitle="�������� ��� 2:" & vbCrLf & "���� � ����� ��"
 236					elseif rowType = 3 then 
 237						RowTitle="�������� ��� 3:" & vbCrLf & "���� � �����"
 238					elseif rowType = 9 then 
 239						RowTitle="����" 
 240						'RowTitle="����" & vbCrLf & "���� " & RSDates("Creator") & " " & RSDates("CreatedDate")
 241						'if RSDates("RelationDesc") <> "" then RowTitle = RowTitle & vbCrLf & "�����: " & RSDates("RelationDesc")
 242					else
 243						RowTitle="�� ����"
 244					end if
 245%>
 246
 247					<TR class="row<%=rowType%>" title="<%=RowTitle%>" height=20>
 248						<TD width=30><%=RSDates("GLDocID")%></TD>
 249						<TD title="<%=RSDates("Description")%>" style="cursor:col-resize;"><%=Left(RSDates("Description"),20) & ".."%></TD>
 250						<TD width=70><%=Debit%></TD>
 251						<TD width=70><%=Credit%></TD>
 252						<TD width=20 style="cursor:crosshair;" onclick="slctGLRow(this)">
 253							<input type="hidden" Value="<%=RSDates("ID")%>">
 254						</TD>
 255					</TR>
 256<%
 257				else
 258
 259					Call WriteBlankRows (1)
 260
 261				End if
 262				BaseDate = RSDates("BaseDate")
 263				
 264				RSDates.moveNext
 265			Loop
 266		end if
 267		RSDates.close
 268
 269		Call WriteBlankRows (RemainedRows) 
 270%>
 271		</TABLE>
 272		</td>
 273		<td></td>
 274		<td valign=top>
 275<!-- Bank Rows -->
 276		<TABLE cellpadding=2 cellspacing=1 border=1 width=350>
 277		<TR>
 278			<TD colspan=5><B>����� ����</B></TD>
 279		</TR>
 280<%
 281
 282'		mySQL = "SELECT BankContradiction_TempDates.[Date] AS BaseDate, BankContradiction_TempDates.MaxRows, allBankRows.*, BankContradictionRelations.Description, ISNULL(BankContradictionRelations.Type,0) AS Type, BankContradictionRelations.Description AS RelationDesc, Users.RealName AS Creator, BankContradictionRelations.CreatedDate, BankContradictionRelations.CreatedTime FROM BankContradiction_TempDates LEFT OUTER JOIN Users INNER JOIN BankContradictionRelations ON Users.ID = BankContradictionRelations.CreatedBy RIGHT OUTER JOIN (SELECT * FROM BankLog WHERE AccountNo = " & BankAccountNo & ") allBankRows ON BankContradictionRelations.BankLogID = allBankRows.autoKey ON BankContradiction_TempDates.[Date] = allBankRows.[Date] ORDER BY BankContradiction_TempDates.[Date]"
 283
 284		mySQL = "SELECT BankContradiction_TempDates.[Date] AS BaseDate, BankContradiction_TempDates.MaxRows, ISNULL(BankContradictionRelations.Type, 0) AS Type, allBankRows.AccountNo, allBankRows.CheqNo, allBankRows.[Date], allBankRows.isDebit, allBankRows.Amount, allBankRows.DescCode, allBankRows.BankType, allBankRows.autoKey FROM BankContradiction_TempDates LEFT OUTER JOIN BankContradictionRelations RIGHT OUTER JOIN (SELECT * FROM BankLog WHERE AccountNo = " & BankAccountNo & ") allBankRows ON BankContradictionRelations.BankLogID = allBankRows.autoKey ON BankContradiction_TempDates.[Date] = allBankRows.[Date] GROUP BY BankContradiction_TempDates.[Date], BankContradiction_TempDates.MaxRows, ISNULL(BankContradictionRelations.Type, 0), allBankRows.AccountNo, allBankRows.CheqNo, allBankRows.[Date], allBankRows.Amount, allBankRows.DescCode, allBankRows.BankType, allBankRows.autoKey, allBankRows.isDebit ORDER BY BankContradiction_TempDates.[Date], allBankRows.isDebit, allBankRows.Amount"
 285
 286		Set RSDates = Conn.Execute(mySQL)
 287		if NOT RSDates.eof then
 288			RemainedRows = 0
 289			BaseDate = ""
 290			TempCount = 1
 291			Do While NOT RSDates.eof 
 292				RowsCount = clng(RSDates("MaxRows"))
 293				if BaseDate = RSDates("BaseDate") then
 294					RemainedRows = RemainedRows - 1
 295					TempCount = TempCount + 1
 296				else
 297
 298					Call WriteBlankRows (RemainedRows)
 299%>
 300					<TR class="dateLine">
 301						<TD colspan=5><%=showDate(RSDates("BaseDate"))%></TD>
 302					</TR>
 303<%
 304					RemainedRows = RowsCount - 1 
 305					TempCount = 1
 306				end if
 307
 308				if not isnull(RSDates("AutoKey")) then
 309				'crosshair
 310					if RSDates("isDebit") then
 311						Debit=Separate(cdbl(RSDates("Amount")))
 312						Credit="&nbsp;"
 313					else
 314						Debit="&nbsp;"
 315						Credit=Separate(cdbl(RSDates("Amount")))
 316					end if
 317					rowType = cint(RSDates("Type"))
 318					if rowType = 1 then
 319						RowTitle="�������� ��� 1:" & vbCrLf & "���ۡ ����Ρ ����� ��"
 320					elseif rowType = 2 then
 321						RowTitle="�������� ��� 2:" & vbCrLf & "���� � ����� ��"
 322					elseif rowType = 3 then 
 323						RowTitle="�������� ��� 3:" & vbCrLf & "���� � �����"
 324					elseif rowType = 9 then 
 325						RowTitle="����" 
 326						'RowTitle="����" & vbCrLf & "���� " & RSDates("Creator") & " " & RSDates("CreatedDate")
 327						'if RSDates("RelationDesc") <> "" then RowTitle = RowTitle & vbCrLf & "�����: " & RSDates("RelationDesc")
 328					else
 329						RowTitle="�� ����"
 330					end if
 331%>
 332
 333					<TR class="row<%=rowType%>" title="<%=RowTitle%>" height=20>
 334						<TD width=20 style="cursor:crosshair;" onclick="slctBnkRow(this)">
 335							<input type="hidden" Value="<%=RSDates("AutoKey")%>">
 336						</TD>
 337						<TD width=80 style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:col-resize;"><NoBr><%=lookupDescCode(BankType,RSDates("DescCode"))%></NoBr></TD>
 338						<TD width=70><%=Debit%></TD>
 339						<TD width=70><%=Credit%></TD>
 340						<TD width=30><%=RSDates("CheqNo")%></TD>
 341					</TR>
 342<%
 343				else
 344
 345					Call WriteBlankRows (1)
 346
 347				End if
 348				BaseDate = RSDates("BaseDate")
 349				
 350				RSDates.moveNext
 351			Loop
 352		end if
 353		RSDates.close
 354
 355		Call WriteBlankRows (RemainedRows)
 356%>
 357		</TABLE>
 358		</td>
 359	</tr>
 360	<tr height="5">
 361		<td align='center' colspan="3">
 362		<table>
 363		<tr>
 364			<td>
 365				<FORM METHOD=POST ACTION="?act=delRelations&StartDate=<%=Server.URLEncode(StartDate)%>&EndDate=<%=Server.URLEncode(EndDate)%>&BankGLAccount=<%=Server.URLEncode(BankGLAccount)%>&NextAct=showAll">
 366					<span id="Relations"></span>
 367					<INPUT TYPE="submit" value="��� ����� ��" class="GenButton" onclick="this.disabled=true;submit();">
 368				</FORM>
 369			</td>
 370			<td>
 371				<FORM METHOD=POST ACTION="?act=autoRelate&StartDate=<%=Server.URLEncode(StartDate)%>&EndDate=<%=Server.URLEncode(EndDate)%>&BankGLAccount=<%=Server.URLEncode(BankGLAccount)%>&NextAct=showAll">
 372					<INPUT TYPE="submit" value="����� ��������" class="GenButton" onclick="this.disabled=true;submit();">
 373				</FORM>
 374			</td>
 375			<td>
 376				<FORM METHOD=POST ACTION="?act=showRemained&StartDate=<%=Server.URLEncode(StartDate)%>&EndDate=<%=Server.URLEncode(EndDate)%>&BankGLAccount=<%=Server.URLEncode(BankGLAccount)%>&NextAct=showAll">
 377					<INPUT TYPE="submit" value="����� ����� ��" class="GenButton" onclick="this.disabled=true;submit();">
 378				</FORM>
 379			</td>
 380		</tr>
 381		</table>
 382		</td>
 383	</tr>
 384	</table>
 385
 386	<script language="JavaScript">
 387	<!--
 388	//---------------------------------------------
 389	var slctRowClr='#FFFF00'
 390	var rltdRowClr='#99FF88'
 391	var sRltdRowClr='#9988FF'
 392	var delRowClr='#FF0055'
 393	
 394	function slctGLRow(src){
 395		
 396		if (confirm("��� �� ������ ��� ��� �� ��� ���Ͽ\n")){
 397			src.onclick="";
 398			src.setAttribute("bgColor",delRowClr);
 399			src.title="��� ���"
 400			document.getElementById("Relations").innerHTML+="<input type='hidden' name='GLRow' value='"+src.getElementsByTagName("input")[0].value+"'>"
 401		}
 402	}
 403	function slctBnkRow(src){
 404		
 405		if (confirm("��� �� ������ ��� ��� �� ��� ���Ͽ\n")){
 406			src.onclick="";
 407			src.setAttribute("bgColor",delRowClr);
 408			src.title="��� ���"
 409			document.getElementById("Relations").innerHTML+="<input type='hidden' name='BnkRow' value='"+src.getElementsByTagName("input")[0].value+"'>"
 410		}
 411	}
 412
 413	//-->
 414	</script>
 415
 416<%
 417'-----------------------------------------------------------------------------------------------------
 418'---------------------------------------------------------------------------- Show Remained Un Related
 419'-----------------------------------------------------------------------------------------------------
 420elseif request("act")="showRemained" then
 421	'----- Check GL is closed
 422	if (session("IsClosed")="True") then
 423		Conn.close
 424		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
 425	end if 
 426	'----
 427	if request.QueryString("StartDate")<>"" then
 428	' Use QueryString Data
 429		StartDate =		request.QueryString("StartDate")
 430		EndDate =		request.QueryString("EndDate")
 431		BankGLAccount = cint(request.QueryString("BankGLAccount"))
 432		BankAccountNo = lookupBankAccountNo(BankGLAccount)
 433		BankType =		lookupBankType(BankGLAccount)
 434
 435	else
 436	' Use Form Data
 437		set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
 438		mySmartUpload.Upload
 439
 440		StartDate =		mySmartUpload.Form("StartDate") '"840101"
 441		EndDate =		mySmartUpload.Form("EndDate") '"841019"
 442		BankGLAccount = cint(mySmartUpload.Form("BankGLAccount")) '"841019"
 443		BankAccountNo = lookupBankAccountNo(BankGLAccount)
 444		BankType =		lookupBankType(BankGLAccount)
 445
 446		If not mySmartUpload.Files(1).IsMissing Then
 447		' We have a FILE uploaded
 448
 449			' Save The File
 450			SavedFileName = "./LogFiles/" & lookupBankAccountNo(BankGLAccount) & ".TXT"
 451			mySmartUpload.Files(1).SaveAs(SavedFileName)
 452
 453			' Read and Insert
 454			Dim oFS 
 455			Dim oFile 
 456			Dim oStream 
 457
 458			If BankGLAccount = 12001 OR BankGLAccount = 12004 then
 459			'Tejarat
 460				Set oFS = Server.CreateObject("Scripting.FileSystemObject") 
 461				Set oFile = oFS.GetFile(Server.MapPath(SavedFileName))
 462				Set oStream = oFile.OpenAsTextStream(1, -2) '1:ForReading , -2:TristateUseDefault
 463
 464				Do While Not oStream.AtEndOfStream 
 465
 466					theLine=oStream.ReadLine 
 467
 468					if len(theLine) > 39 then
 469						BankAccountNo = mid(theLine,2,10) 'left(theLine,10)
 470						CheckNo = mid(theLine,12,6)
 471						mmoDate = "13" & mid(theLine,18,2) & "/" & mid(theLine,20,2) & "/" & mid(theLine,22,2)
 472						isDebit = mid(theLine,24,1)
 473						amount = mid(theLine,25,13)
 474						DescCode = mid(theLine,38,3)
 475
 476						mySQL="INSERT INTO BankLog (AccountNo, CheqNo, [Date], isDebit, Amount, DescCode, BankType)" &_
 477						"VALUES ('" & BankAccountNo & "','" & CheckNo & "','" & mmoDate & "','" & isDebit & "','" & amount & "','" & DescCode & "','1')"
 478						Conn.Execute(mySQL)
 479
 480					else
 481						exit do
 482					end if
 483
 484				Loop 
 485
 486				oStream.Close 
 487
 488				Set oFS = Nothing
 489				Set oFile = Nothing
 490				Set oStream = Nothing
 491
 492				'Removing Duplicate Rows
 493				mySQL="DELETE FROM BankLog WHERE (autoKey IN (SELECT MAX(autoKey) AS RepeatedLine FROM BankLog GROUP BY AccountNo, CheqNo, [Date], Amount, DescCode, BankType, isDebit HAVING (COUNT(*) > 1)))"
 494				Conn.Execute(mySQL)
 495
 496			elseif BankGLAccount = 12002 then
 497			'Sepah
 498
 499				Set oFS = Server.CreateObject("Scripting.FileSystemObject") 
 500				Set oFile = oFS.GetFile(Server.MapPath(SavedFileName))
 501				Set oStream = oFile.OpenAsTextStream(1, -2) '1:ForReading , -2:TristateUseDefault
 502				Do While Not oStream.AtEndOfStream 
 503					theLine=oStream.ReadLine 
 504
 505					if theLine <> "" then
 506						BankAccNo = left(theLine,9)
 507						mmoDate = "13" & mid(theLine,10,2) & "/" & mid(theLine,12,2) & "/" & mid(theLine,14,2)
 508						CheckNo = mid(theLine,19,6)
 509						amount = mid(theLine,39,14)
 510						StupidMinusSign = mid(theLine,52,1)
 511						if not isnumeric(StupidMinusSign) then 
 512							amount = "-" & left(amount,13) & (asc(StupidMinusSign) - 112)
 513						end if
 514
 515						isDebit = 2 - cint(mid(theLine,53,1))
 516
 517						DescCode = mid(theLine,54,2)
 518
 519						if isDebit <> 2 then
 520							mySQL="INSERT INTO BankLog (AccountNo, CheqNo, [Date], isDebit, Amount, DescCode, BankType)" &_
 521							"VALUES ('" & BankAccNo & "','" & CheckNo & "','" & mmoDate & "','" & isDebit & "','" & amount & "','" & DescCode & "','2')"
 522							Conn.Execute(mySQL)
 523						end if
 524
 525					else
 526						exit do
 527					end if
 528
 529				Loop 
 530
 531				oStream.Close 
 532
 533				Set oFS = Nothing
 534				Set oFile = Nothing
 535				Set oStream = Nothing
 536
 537				'Removing Duplicate Rows
 538				mySQL="DELETE FROM BankLog WHERE (autoKey IN (SELECT MAX(autoKey) AS RepeatedLine FROM BankLog GROUP BY AccountNo, CheqNo, [Date], Amount, DescCode, BankType, isDebit HAVING (COUNT(*) > 1)))"
 539				Conn.Execute(mySQL)
 540
 541			else
 542			'Error
 543			End If
 544
 545		End If
 546
 547	end if
 548
 549'	CREATE VIEW VIEW_Contra_Remained_GLRows_84_12001
 550'	AS
 551'	SELECT     ID, GLDocID, GLDocDate COLLATE SQL_Latin1_General_CP1_CI_AS AS [Date], IsCredit, Amount, Description
 552'	FROM         EffectiveGLRows
 553'	WHERE     (GL = 84) AND (GLAccount = 12001) AND (ID NOT IN
 554'							  (SELECT     GLRowID
 555'								 FROM         BankContradictionRelations))
 556'
 557'	-	-	-	-	-	-	-	-	
 558'
 559'	CREATE VIEW dbo.VIEW_Contra_Remained_BankRows_0033624050
 560'	AS
 561'	SELECT     autoKey, CheqNo, [Date] COLLATE SQL_Latin1_General_CP1_CI_AS AS [Date], isDebit, Amount, DescCode, AccountNo
 562'	FROM         dbo.BankLog
 563'	WHERE     (AccountNo = 0033624050) AND (autoKey NOT IN
 564'							  (SELECT     BankLogID
 565'								 FROM         BankContradictionRelations))
 566'
 567
 568
 569	GLRowsViewName = "VIEW_Contra_Remained_GLRows_" & openGL & "_" & BankGLAccount
 570	BankRowsViewName = "VIEW_Contra_Remained_BankRows_" & BankAccountNo
 571
 572	'Creating Temporary Table
 573	mySQL="DELETE FROM BankContradiction_TempDates"
 574	Conn.Execute(mySQL)
 575
 576	mySQL="INSERT INTO BankContradiction_TempDates ([Date], MaxRows) SELECT LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) AS [date], CASE WHEN ISNULL(GLRowDates.CntGLRow, 0) > ISNULL(BankLogDates.CntBankLog, 0) THEN GLRowDates.CntGLRow ELSE BankLogDates.CntBankLog END AS MaxRows FROM (SELECT [Date], COUNT(*) AS CntGLRow FROM " & GLRowsViewName & " GROUP BY [Date]) GLRowDates FULL OUTER JOIN (SELECT [Date], COUNT(*) AS CntBankLog FROM " & BankRowsViewName & " GROUP BY [Date]) BankLogDates ON GLRowDates.[Date] = BankLogDates.[Date] WHERE (LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) >= '" & StartDate & "') AND (LEFT(ISNULL(GLRowDates.[Date], '') + ISNULL(BankLogDates.[Date], ''), 10) <= '" & EndDate & "') ORDER BY GLRowDates.[Date]"
 577
 578	Conn.Execute(mySQL)
 579
 580%>
 581
 582	<table align=center>
 583	<tr>
 584		<td valign=top>
 585<!-- GL Rows -->
 586		<TABLE cellpadding=2 cellspacing=1 border=1 width=350>
 587		<TR>
 588			<TD colspan=5><B>���� <%=BankGLAccount%></B></TD>
 589		</TR>
 590<%
 591
 592		mySQL="SELECT BankContradiction_TempDates.[Date] AS BaseDate, BankContradiction_TempDates.MaxRows, " & GLRowsViewName & ".* FROM BankContradiction_TempDates LEFT OUTER JOIN " & GLRowsViewName & " ON BankContradiction_TempDates.[Date] = " & GLRowsViewName & ".[Date] ORDER BY BankContradiction_TempDates.[Date], " & GLRowsViewName & ".IsCredit DESC, " & GLRowsViewName & ".Amount"
 593
 594		Set RSDates = Conn.Execute(mySQL)
 595		if NOT RSDates.eof then
 596			RemainedRows = 0
 597			BaseDate = ""
 598			TempCount = 1
 599			Do While NOT RSDates.eof 
 600				RowsCount = clng(RSDates("MaxRows"))
 601				if BaseDate = RSDates("BaseDate") then
 602					RemainedRows = RemainedRows - 1
 603					TempCount = TempCount + 1
 604				else
 605					
 606					Call WriteBlankRows (RemainedRows)
 607%>
 608					<TR class="dateLine">
 609						<TD colspan=5><%=showDate(RSDates("BaseDate"))%></TD>
 610					</TR>
 611<%
 612					RemainedRows = RowsCount - 1 
 613					TempCount = 1
 614				end if
 615
 616				if not isnull(RSDates("ID")) then
 617					if RSDates("isCredit") then
 618						Debit="&nbsp;"
 619						Credit=Separate(RSDates("Amount"))
 620					else
 621						Debit=Separate(RSDates("Amount"))
 622						Credit="&nbsp;"
 623					end if
 624%>
 625
 626					<TR height="20">
 627						<TD width=30><%=RSDates("GLDocID")%></TD>
 628						<TD title="<%=RSDates("Description")%>" style="cursor:col-resize;"><%=Left(RSDates("Description"),20) & ".."%></TD>
 629						<TD width=70><%=Debit%></TD>
 630						<TD width=70><%=Credit%></TD>
 631						<TD width=20 style="cursor:crosshair;" onclick="slctGLRow(this)">
 632							<input type="hidden" Value="<%=RSDates("ID")%>">
 633						</TD>
 634					</TR>
 635<%
 636
 637				else
 638
 639					Call WriteBlankRows (1)
 640
 641				End if
 642				BaseDate = RSDates("BaseDate")
 643				
 644				RSDates.moveNext
 645			Loop
 646		end if
 647		RSDates.close
 648
 649		Call WriteBlankRows (RemainedRows)
 650%>
 651		</TABLE>
 652		</td>
 653		<td></td>
 654		<td valign=top>
 655<!-- Bank Rows -->
 656		<TABLE cellpadding=2 cellspacing=1 border=1 width=350>
 657		<TR>
 658			<TD colspan=5><B>����� ����</B></TD>
 659		</TR>
 660<%
 661		mySQL = "SELECT BankContradiction_TempDates.[Date] AS BaseDate, BankContradiction_TempDates.MaxRows, " & BankRowsViewName & ".* FROM BankContradiction_TempDates LEFT OUTER JOIN " & BankRowsViewName & " ON BankContradiction_TempDates.[Date] = " & BankRowsViewName & ".[Date] ORDER BY BankContradiction_TempDates.[Date], " & BankRowsViewName & ".isDebit, " & BankRowsViewName & ".Amount"
 662
 663		Set RSDates = Conn.Execute(mySQL)
 664		if NOT RSDates.eof then
 665			RemainedRows = 0
 666			BaseDate = ""
 667			TempCount = 1
 668			Do While NOT RSDates.eof 
 669				RowsCount = clng(RSDates("MaxRows"))
 670				if BaseDate = RSDates("BaseDate") then
 671					RemainedRows = RemainedRows - 1
 672					TempCount = TempCount + 1
 673				else
 674
 675					Call WriteBlankRows (RemainedRows)
 676%>
 677					<TR class="dateLine">
 678						<TD colspan=5><%=showDate(RSDates("BaseDate"))%></TD>
 679					</TR>
 680<%
 681					RemainedRows = RowsCount - 1 
 682					TempCount = 1
 683				end if
 684
 685				if not isnull(RSDates("AutoKey")) then
 686				'crosshair
 687					if RSDates("isDebit") then
 688						Debit=Separate(cdbl(RSDates("Amount")))
 689						Credit="&nbsp;"
 690					else
 691						Debit="&nbsp;"
 692						Credit=Separate(cdbl(RSDates("Amount")))
 693					end if
 694%>
 695
 696					<TR height="20">
 697						<TD width=20 style="cursor:crosshair;" onclick="slctBnkRow(this)">
 698							<input type="hidden" Value="<%=RSDates("AutoKey")%>">
 699						</TD>
 700						<TD width=80 style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:col-resize;"><NoBr><%=lookupDescCode(BankType,RSDates("DescCode"))%></NoBr></TD>
 701						<TD width=70><%=Debit%></TD>
 702						<TD width=70><%=Credit%></TD>
 703						<TD width=30><%=RSDates("CheqNo")%></TD>
 704					</TR>
 705<%
 706				else
 707
 708					Call WriteBlankRows (1)
 709
 710				End if
 711				BaseDate = RSDates("BaseDate")
 712				
 713				RSDates.moveNext
 714			Loop
 715		end if
 716		RSDates.close
 717
 718		Call WriteBlankRows (RemainedRows)
 719%>
 720		</TABLE>
 721		</td>
 722	</tr>
 723	<tr height="5">
 724		<td align='center' colspan="3">
 725		<table>
 726		<tr>
 727			<td>
 728				<FORM METHOD=POST ACTION="?act=submitRelations&StartDate=<%=Server.URLEncode(StartDate)%>&EndDate=<%=Server.URLEncode(EndDate)%>&BankGLAccount=<%=Server.URLEncode(BankGLAccount)%>&NextAct=showRemained">
 729					<span id="Relations"></span>
 730					<INPUT TYPE="submit" value="��� ����� ��" class="GenButton" onclick="this.disabled=true;submit();">
 731				</FORM>
 732			</td>
 733			<td>
 734				<FORM METHOD=POST ACTION="?act=autoRelate&StartDate=<%=Server.URLEncode(StartDate)%>&EndDate=<%=Server.URLEncode(EndDate)%>&BankGLAccount=<%=Server.URLEncode(BankGLAccount)%>&NextAct=showRemained">
 735					<INPUT TYPE="submit" value="����� ��������" class="GenButton" onclick="this.disabled=true;submit();">
 736				</FORM>
 737			</td>
 738			<td>
 739				<FORM METHOD=POST ACTION="?act=showAll&StartDate=<%=Server.URLEncode(StartDate)%>&EndDate=<%=Server.URLEncode(EndDate)%>&BankGLAccount=<%=Server.URLEncode(BankGLAccount)%>&NextAct=showRemained">
 740					<INPUT TYPE="submit" value="����� ���" class="GenButton" onclick="this.disabled=true;submit();">
 741				</FORM>
 742			</td>
 743		</tr>
 744		</table>
 745		</td>
 746	</tr>
 747	</table>
 748
 749	<script language="JavaScript">
 750	<!--
 751	//---------------------------------------------
 752	var slctRowClr='#FFFF00'
 753	var rltdRowClr='#99FF88'
 754	var sRltdRowClr='#9988FF'
 755	var slctdGLRow = null
 756	var slctdBnkRow = null
 757	var numRelations=1;
 758
 759	//---------------------------------------------
 760	function DslctGLRow(src){
 761		if (src){
 762			src.parentNode.setAttribute("bgColor","");
 763		}
 764	}
 765	function slctGLRow(src){
 766		
 767		DslctGLRow(slctdGLRow)
 768		if (slctdGLRow == src){
 769			if (confirm("��� �� ������ ��� ��� �� ������ ��� ���Ͽ\n")){
 770				relate(true);
 771				return;
 772			}
 773			slctdGLRow = null
 774		}
 775		else{
 776			slctdGLRow = src
 777			src.parentNode.setAttribute("bgColor",slctRowClr)
 778			relate(false);
 779		}
 780	}
 781	//---------------------------------------------
 782	function DslctBnkRow(src){
 783		if (src){
 784			src.parentNode.setAttribute("bgColor","");
 785		}
 786	}
 787	function slctBnkRow(src){
 788		
 789		DslctBnkRow(slctdBnkRow)
 790		if (slctdBnkRow == src){
 791			if (confirm("��� �� ������ ��� ��� �� ������ ��� ���Ͽ\n")){
 792				relate(true);
 793				return;
 794			}
 795			slctdBnkRow = null
 796		}
 797		else{
 798			slctdBnkRow = src
 799			src.parentNode.setAttribute("bgColor",slctRowClr)
 800			relate(false);
 801		}
 802	}
 803	//---------------------------------------------
 804	function relate(singleRow){
 805
 806		var BnkRow=0;
 807		var GLRow=0;
 808		var desc='';
 809		var tmpDlgTxt= new Object();
 810		tmpDlgTxt.value = '������ �� ��� �����: ';
 811
 812		if (singleRow)
 813		{
 814			if (slctdBnkRow){
 815				BnkRow = slctdBnkRow.getElementsByTagName("input")[0].value
 816				slctdBnkRow.setAttribute("bgColor",sRltdRowClr)
 817				slctdBnkRow.innerHTML+=numRelations
 818			}
 819			else if (slctdGLRow){
 820				GLRow = slctdGLRow.getElementsByTagName("input")[0].value
 821				slctdGLRow.setAttribute("bgColor",sRltdRowClr)
 822				slctdGLRow.innerHTML+=numRelations
 823			}
 824		}
 825		else if (slctdBnkRow && slctdGLRow){
 826
 827			BnkRow = slctdBnkRow.getElementsByTagName("input")[0].value
 828			GLRow = slctdGLRow.getElementsByTagName("input")[0].value
 829
 830			slctdBnkRow.setAttribute("bgColor",rltdRowClr)
 831			slctdBnkRow.innerHTML+=numRelations
 832			slctdGLRow.setAttribute("bgColor",rltdRowClr)
 833			slctdGLRow.innerHTML+=numRelations
 834		}
 835		else{
 836			return;
 837		}
 838
 839		dialogActive=true
 840		window.showModalDialog('../dialog_GenInput.asp',tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
 841		dialogActive=false
 842		desc=tmpDlgTxt.value
 843
 844		numRelations++;
 845
 846
 847		document.getElementById("Relations").innerHTML+="<input type='hidden' name='BnkRow' value='"+BnkRow+"'>"
 848		document.getElementById("Relations").innerHTML+="<input type='hidden' name='GLRow' value='"+GLRow+"'>"
 849		document.getElementById("Relations").innerHTML+="<input type='hidden' name='Desc' value='"+escape(desc.replace("'","`"))+"'>"
 850
 851		DslctBnkRow(slctdBnkRow)
 852		DslctBnkRow(slctdGLRow)
 853
 854		slctdBnkRow = null
 855		slctdGLRow = null
 856	}
 857
 858	//-->
 859	</script>
 860
 861<%
 862elseif request("act")="autoRelate" then
 863	'----- Check GL is closed
 864	if (session("IsClosed")="True") then
 865		Conn.close
 866		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
 867	end if 
 868	'----
 869	StartDate =		request.QueryString("StartDate")
 870	EndDate =		request.QueryString("EndDate")
 871	BankGLAccount = cint(request.QueryString("BankGLAccount"))
 872	BankAccountNo = clng(lookupBankAccountNo(BankGLAccount))
 873
 874	' Type 1:		Amount + Date + CheqNo
 875	mySQL="INSERT INTO BankContradictionRelations (BankLogID, GLRowID, Description, Type, CreatedBy, CreatedDate, CreatedTime) SELECT BankLog.autoKey AS BankLogID, RemainedGLRows.GLRowID, '' AS Description, 1 AS Type, '" & session ("ID") & "' AS CreatedBy, '" & shamsiToday() & "' AS CreatedDate, '" & currentTime10() & "' AS CreatedTime FROM BankLog INNER JOIN (SELECT ID AS GLRowID, CONVERT(bigint, Ref1) AS CheqNo, GLDocDate AS [Date], 1 - IsCredit AS IsDebit, Amount FROM dbo.EffectiveGLRows WHERE (GL = " & openGL & ") AND (GLAccount = " & BankGLAccount & ") AND (ID NOT IN (SELECT GLRowID FROM BankContradictionRelations))) RemainedGLRows ON BankLog.[Date] = RemainedGLRows.[Date] COLLATE Arabic_CI_AS AND BankLog.Amount = RemainedGLRows.Amount AND BankLog.isDebit = RemainedGLRows.IsDebit AND BankLog.CheqNo = RemainedGLRows.CheqNo WHERE (BankLog.AccountNo = " & BankAccountNo & ")"
 876	Conn.Execute(mySQL)
 877	response.write "Type 1: OK<BR><BR>"
 878
 879	' Type 2:		Amount + Date + CheqNo
 880	mySQL="INSERT INTO BankContradictionRelations (BankLogID, GLRowID, Description, Type, CreatedBy, CreatedDate, CreatedTime) SELECT BankLog.autoKey AS BankLogID, RemainedGLRows.GLRowID, '' AS Description, 2 AS Type, '" & session ("ID") & "' AS CreatedBy, '" & shamsiToday() & "' AS CreatedDate, '" & currentTime10() & "' AS CreatedTime FROM BankLog INNER JOIN (SELECT ID AS GLRowID, CONVERT(bigint, Ref1) AS CheqNo, 1 - IsCredit AS IsDebit, Amount FROM dbo.EffectiveGLRows WHERE (GL = " & openGL & ") AND (GLAccount = " & BankGLAccount & ") AND (ID NOT IN (SELECT GLRowID FROM BankContradictionRelations))) RemainedGLRows ON BankLog.Amount = RemainedGLRows.Amount AND BankLog.isDebit = RemainedGLRows.IsDebit AND BankLog.CheqNo = RemainedGLRows.CheqNo WHERE (BankLog.AccountNo = " & BankAccountNo & ")"
 881	Conn.Execute(mySQL)
 882	response.write "Type 2: OK<BR><BR>"
 883
 884	' Type 3:		Amount + Date 
 885	mySQL="INSERT INTO BankContradictionRelations (BankLogID, GLRowID, Description, Type, CreatedBy, CreatedDate, CreatedTime) SELECT BankLog.autoKey AS BankLogID, RemainedGLRows.GLRowID, '' AS Description, 3 AS Type, '" & session ("ID") & "' AS CreatedBy, '" & shamsiToday() & "' AS CreatedDate, '" & currentTime10() & "' AS CreatedTime FROM BankLog INNER JOIN (SELECT ID AS GLRowID, GLDocDate AS [Date], 1 - IsCredit AS IsDebit, Amount FROM dbo.EffectiveGLRows WHERE (GL = " & openGL & ") AND (GLAccount = " & BankGLAccount & ") AND (ID NOT IN (SELECT GLRowID FROM BankContradictionRelations))) RemainedGLRows ON BankLog.[Date] = RemainedGLRows.[Date] COLLATE Arabic_CI_AS AND BankLog.Amount = RemainedGLRows.Amount AND BankLog.isDebit = RemainedGLRows.IsDebit WHERE (BankLog.AccountNo = " & BankAccountNo & ")"
 886	Conn.Execute(mySQL)
 887	response.write "Type 3: OK<BR><BR>"
 888
 889	response.redirect "?act=" & request("NextAct") & "&StartDate=" & Server.URLEncode(StartDate) & "&EndDate=" & Server.URLEncode(EndDate) & "&BankGLAccount=" & Server.URLEncode(BankGLAccount) & "&msg=" & Server.URLEncode("����� �������� ����� ��.")
 890
 891elseif request("act")="submitRelations" then
 892
 893	StartDate =		request.QueryString("StartDate")
 894	EndDate =		request.QueryString("EndDate")
 895	BankGLAccount = cint(request.QueryString("BankGLAccount"))
 896
 897	for i=1 to request.form("BnkRow").count 
 898		BankRow = cdbl(request.form("BnkRow")(i))
 899		GLRow	= cdbl(request.form("GLRow")(i))
 900		Desc	= unescape(request.form("Desc")(i))
 901
 902		' Type = 9 Means Manual
 903		mySQL="INSERT INTO BankContradictionRelations (BankLogID, GLRowID, Description, Type, CreatedBy, CreatedDate, CreatedTime) VALUES " &_ 
 904			 "('"& BankRow & "', '"& GLRow & "', N'"& sqlSafe(Desc) & "', '9', '"& session("ID") & "', '"& ShamsiToday() & "', '"& currentTime10() & "')"
 905		conn.Execute(mySQL)
 906	next
 907
 908	response.redirect "?act=" & request("NextAct") & "&StartDate=" & Server.URLEncode(StartDate) & "&EndDate=" & Server.URLEncode(EndDate) & "&BankGLAccount=" & Server.URLEncode(BankGLAccount) & "&msg=" & Server.URLEncode("����� ���� ��� ����� ��.")
 909
 910elseif request("act")="delRelations" then
 911
 912	StartDate =		request.QueryString("StartDate")
 913	EndDate =		request.QueryString("EndDate")
 914	BankGLAccount = cint(request.QueryString("BankGLAccount"))
 915
 916	for i=1 to request.form("BnkRow").count 
 917		BankRow = cdbl(request.form("BnkRow")(i))
 918		mySQL="DELETE FROM BankContradictionRelations WHERE (BankLogID='" & BankRow & "')"
 919		conn.Execute(mySQL)
 920	next
 921
 922	for i=1 to request.form("GLRow").count 
 923		GLRow	= cdbl(request.form("GLRow")(i))
 924		mySQL="DELETE FROM BankContradictionRelations WHERE (GLRowID='" & GLRow & "')"
 925		conn.Execute(mySQL)
 926	next
 927
 928	response.redirect "?act=" & request("NextAct") & "&StartDate=" & Server.URLEncode(StartDate) & "&EndDate=" & Server.URLEncode(EndDate) & "&BankGLAccount=" & Server.URLEncode(BankGLAccount) & "&msg=" & Server.URLEncode("����� ��� ��� ���� ��� ��� ��.")
 929
 930'-----------------------------------------------------------------------------------------------------
 931'----------------------------------------------------------------------------- Get parameters and file
 932'-----------------------------------------------------------------------------------------------------
 933elseif request("act")="" then
 934
 935%>
 936	<input type="hidden" Name='tmpDlgArg' value=''>
 937	<input type="hidden" Name='tmpDlgTxt' value=''>
 938	<FORM METHOD=POST ACTION="?act=showRemained" onsubmit="return isEmpty()" ENCTYPE="multipart/form-data">
 939	<TABLE align=center style="border:1pt solid white">
 940	<TR>
 941		<TD>
 942			�� �����: 
 943		</TD>
 944		<TD>
 945			<INPUT class="GenInput" style='direction:LTR;text-align:left;' NAME="StartDate" TYPE="text" maxlength="10" size="10" value="<%=Session("OpenGLStartDate")%>" onblur="acceptDate(this)">
 946		</TD>
 947	</TR>
 948	<TR>
 949		<TD>
 950			�� �����: 
 951		</TD>
 952		<TD>
 953			<INPUT class="GenInput" style='direction:LTR;text-align:left;' NAME="EndDate" TYPE="text" maxlength="10" size="10" value="<%=shamsiToday()%>" onblur="acceptDate(this)">
 954		</TD>
 955	</TR>
 956	<TR>
 957		<TD>
 958			���� ���� :
 959		</TD>
 960		<TD>
 961			<select name="BankGLAccount" class=inputBut style="width:200; ">
 962				<option value="-1">������ ����</option>
 963				<option value="12001">12001 - ���� ����� ���� 24050 (�)</option>
 964				<option value="12004">12004 - ���� ����� ���� 24816 (���)</option>
 965				<option value="12002">12002 - ���� Ӂ� ���� 4344/19 (���)</option>
 966			</select>
 967		</TD>
 968	</TR>
 969	<TR>
 970		<TD>���� ����</TD>
 971		<TD>
 972			<INPUT TYPE="FILE" NAME="LogFile" class=inputBut style="width:200; ">
 973		</TD>
 974	</TR>
 975	<TR>
 976		<TD colspan='2' height='2' ><hr></TD>
 977	</TR>
 978	<TR>
 979		<TD colspan='2' align='center'>
 980			<INPUT TYPE="submit" value=" ����� " class='GenButton' onclick="this.disabled=true;submit();"><br><br>
 981		</TD>
 982	</TR>
 983	</TABLE>
 984	</FORM>
 985	<BR><BR>
 986
 987	<SCRIPT LANGUAGE="JavaScript">
 988	<!--
 989
 990	var dialogActive=false;
 991
 992	function isEmpty()
 993	{
 994		Bank = document.all.BankGLAccount.value
 995		if(Bank==-1){
 996			alert("���! ��� ���� �� ���� ���")
 997			return false
 998		}
 999		else{
1000			return true;
1001		}
1002	}
1003	//-->
1004	</SCRIPT>
1005<% 
1006end if
1007%>
1008<!--#include file="tah.asp" -->