/beta/accounting/GLMemoDocShow.asp

http://github.com/khaneh/Orders · ASP · 696 lines · 603 code · 75 blank · 18 comment · 94 complexity · 5870afb038154247ec7453055f622fa8 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Accounting (8)
  3. PageTitle= " "
  4. SubmenuItem=3
  5. if not Auth(8 , 3) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <!--#include File="../include_farsiDateHandling.asp"-->
  9. <!--#include File="../include_JS_InputMasks.asp"-->
  10. <!--#include File="../include_UtilFunctions.asp"-->
  11. <style>
  12. a {color:black;}
  13. .GLTable0 { font-family:tahoma; font-size: 9pt; background-color: #006666; border:2 solid #003333; padding:0; }
  14. .GLTable0 TH { background-color: #006666; border: 0; font-size:16pt;border-bottom: 2 solid #003333;}
  15. .GLTable0 TD { background-color: #DDDDDD; border: 0; font-size:10pt;}
  16. .GLTable0TR1 td{ background-color: #008888; border: 0; }
  17. .GLTable0TR2 td{ background-color: #006666; border: 0; }
  18. .GLTable1 { font-family:tahoma; font-size: 9pt; background-color: #3399CC; border:2 solid #330099; padding:0; }
  19. .GLTable1 TH { background-color: #3399CC; border: 0; font-size:16pt;border-bottom: 2 solid #330099;}
  20. .GLTable1 TD { background-color: #EEEEEE; border: 0; font-size:10pt;}
  21. .GLTable1TR1 td{ background-color: #88BBDD; border: 0; }
  22. .GLTable1TR2 td{ background-color: #3399CC; border: 0; }
  23. .GLTable2 { font-family:tahoma; font-size: 9pt; background-color: #CC3399; border:2 solid #993300; padding:0; }
  24. .GLTable2 TH { background-color: #CC3399; border: 0; font-size:16pt;border-bottom: 2 solid #993300;}
  25. .GLTable2 TD { background-color: #EEEEEE; border: 0; font-size:10pt;}
  26. .GLTable2TR1 td{ background-color: #DD88BB; border: 0; }
  27. .GLTable2TR2 td{ background-color: #CC3399; border: 0; }
  28. .GLTable3 { font-family:tahoma; font-size: 9pt; background-color: #AAAA33; border:2 solid #CCCC00; padding:0; }
  29. .GLTable3 TH { background-color: #AAAA33; border: 0; font-size:16pt;border-bottom: 2 solid #BBBB00;}
  30. .GLTable3 TD { background-color: #EEEEEE; border: 0; font-size:10pt;}
  31. .GLTable3TR1 td{ background-color: #CCCC11; border: 0; }
  32. .GLTable3TR2 td{ background-color: #AAAA33; border: 0; }
  33. .GLTable4 { font-family:tahoma; font-size: 9pt; background-color: #33AA99; border:2 solid #005533; padding:0; }
  34. .GLTable4 TH { background-color: #33AA99; border: 0; font-size:16pt;border-bottom: 2 solid #005533;}
  35. .GLTable4 TD { background-color: #EEEEEE; border: 0; font-size:10pt;}
  36. .GLTable4TR1 td{ background-color: #77BBAA; border: 0; }
  37. .GLTable4TR2 td{ background-color: #33AA99; border: 0; }
  38. .GLTable5 { font-family:tahoma; font-size: 9pt; background-color: #66CCCC; border:2 solid #225555; padding:0; }
  39. .GLTable5 TH { background-color: #66BBCC; border: 0; font-size:16pt;border-bottom: 2 solid #225555;}
  40. .GLTable5 TD { background-color: #EEEEEE; border: 0; font-size:10pt;}
  41. .GLTable5TR1 td{ background-color: #99DDDD; border: 0; }
  42. .GLTable5TR2 td{ background-color: #66CCCC; border: 0; }
  43. .GenRow1 TD { background-color: #EEEEEE; border: 0; font-size:10pt;}
  44. .GenRow2 TD { background-color: #DDDDDD; border: 0; font-size:10pt;}
  45. </style>
  46. <%
  47. function ShowErrorMessage(theText)
  48. %>
  49. <br>
  50. <TABLE width=70% align='center'>
  51. <TR>
  52. <TD align=center bgcolor=#FFBBBB style='border: dashed 2pt Red'><BR><b><%=theText%></b><BR><BR></TD>
  53. </TR>
  54. </TABLE>
  55. <%
  56. end function
  57. ON ERROR RESUME NEXT
  58. DocID= clng(request("DocID"))
  59. if Err.Number<>0 then Err.clear:DocID=0
  60. id= clng(request("id"))
  61. if Err.Number<>0 then Err.clear:id=0
  62. ON ERROR GOTO 0
  63. '-----------------------------------------------------------------------------------------------------
  64. '------------------------------------------------------------------------- Changing status of a GL DOC
  65. '-----------------------------------------------------------------------------------------------------
  66. if request("act")="changeStatus" then
  67. '----- Check GL is closed
  68. if (session("IsClosed")="True") then
  69. Conn.close
  70. response.redirect "AccountInfo.asp?errMsg=" & Server.URLEncode("! .")
  71. end if
  72. '----
  73. submit=request("submit")
  74. if DocID=0 or id=0 then
  75. %>
  76. <BR><BR><CENTER>
  77. !
  78. </CENTER>
  79. <%
  80. response.end
  81. end if
  82. if submit="" then
  83. mySQL="SELECT min(GLDocID) as MinGLDocID FROM GLDocs where (GL = "& OpenGL & ")"
  84. set RS1=conn.execute(mySQL)
  85. if RS1.eof then
  86. response.write "<BR><BR><BR><CENTER> .</CENTER>"
  87. response.end
  88. else
  89. RemovedGLDocID = RS1("MinGLDocID") - 1
  90. if RemovedGLDocID=0 then RemovedGLDocID=-1
  91. end if
  92. Conn.Execute ("UPDATE GLDocs SET IsRemoved=1,RemovedDate=N'"& shamsiToday() & "',RemovedBy='"& session("ID") & "' WHERE (ID = "& id & ") AND (GL = "& OpenGL & ")")
  93. Conn.Execute ("UPDATE GLRows SET deleted=1 WHERE (GLDoc = "& id & ")")
  94. Conn.Execute ("UPDATE GLDocs SET GLDocID="& RemovedGLDocID & ", OldGLDocID="& DocID & " WHERE (GLDocID = "& DocID & ") AND (GL = "& OpenGL & ")")
  95. DocID = RemovedGLDocID
  96. elseif submit=" " then
  97. conn.close
  98. response.redirect "SubsysDocsEdit.asp?act=show&id=" & id
  99. elseif submit=" " then
  100. response.redirect "CompMemoInput.asp?act=editDoc&id="& DocID
  101. elseif submit="" then
  102. response.redirect "GLMemoInput.asp?act=editDoc&id="& DocID
  103. elseif submit=" " then ' ------------------ADD BY SAM
  104. mySQL="SELECT min(GLDocID) as MinGLDocID FROM GLDocs where (GL = "& OpenGL & ")"
  105. set RS1=conn.execute(mySQL)
  106. if RS1.eof then
  107. response.write "<BR><BR><BR><CENTER> .</CENTER>"
  108. response.end
  109. else
  110. RemovedGLDocID = RS1("MinGLDocID") - 1
  111. if RemovedGLDocID=0 then RemovedGLDocID=-1
  112. end if
  113. set myRSS=Conn.Execute("SELECT * FROM EffectiveGLRows WHERE GLDoc="&id &" AND SYS>''")
  114. do while not myRSS.eof
  115. link = myRSS("Link")
  116. sys = myRSS("SYS")
  117. isCredit= myRSS("isCredit")
  118. Amount = myRSS("Amount")
  119. Account = myRSS("Tafsil")
  120. Conn.Execute ("UPDATE " & sys & "Items SET RemainedAmount=0, FullyApplied=0,Voided=1,GL_Update=1 WHERE ID="& link)
  121. conn.Execute ("UPDATE " & sys & "Memo SET Voided=1 WHERE ID in (SELECT Link FROM "&sys&"Items WHERE Type=3 AND ID="&link&")")
  122. if isCredit then
  123. mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& Amount & "' WHERE (ID='"& Account & "')"
  124. else
  125. mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& Amount & "' WHERE (ID='"& Account & "')"
  126. end if
  127. myRSS.moveNext
  128. loop
  129. myRSS.close
  130. Conn.Execute ("UPDATE GLDocs SET IsRemoved=1,RemovedDate=N'"& shamsiToday() & "',RemovedBy='"& session("ID") & "' WHERE (ID = "& id & ") AND (GL = "& OpenGL & ")")
  131. Conn.Execute ("UPDATE GLRows SET deleted=1 WHERE (GLDoc = "& id & ")")
  132. Conn.Execute ("UPDATE GLDocs SET GLDocID="& RemovedGLDocID & ", OldGLDocID="& DocID & " WHERE (GLDocID = "& DocID & ") AND (GL = "& OpenGL & ")")
  133. DocID = RemovedGLDocID
  134. '---------------------------------------------------------
  135. else
  136. select case submit
  137. case " "
  138. fieldUpdate = " IsTemporary=0 , IsChecked=0, IsFinalized=0"
  139. case " "
  140. fieldUpdate = " IsTemporary=1 , IsChecked=0, IsFinalized=0, CreatedDate=N'" & shamsiToday() & "'"
  141. case " "
  142. fieldUpdate = " IsTemporary=0 , IsChecked=1, IsFinalized=0, CheckedDate=N'" & shamsiToday() & "', CheckedBy="& session("id")
  143. case " "
  144. fieldUpdate = " IsTemporary=0 , IsChecked=0, IsFinalized=1, FinalizedDate=N'" & shamsiToday() & "', FinalizedBy="& session("id")
  145. case else
  146. response.write "<BR><BR><H1>Very Bad Error!</H1><BR>System Has Been Colapsed!@"
  147. response.end
  148. end select
  149. Conn.Execute ("UPDATE GLDocs SET "& fieldUpdate & " WHERE (ID = "& id & ") AND (GL = "& OpenGL & ")")
  150. end if
  151. end if
  152. itemAmount=""
  153. if DocID <> 0 then
  154. mySQL="SELECT * FROM GLDocs WHERE GLDocID="& DocID & " and (GL = "& OpenGL & ") order by id DESC"
  155. set RS1=conn.execute(mySQL)
  156. if RS1.eof then
  157. response.write "<BR><BR><BR><CENTER>! </CENTER>"
  158. response.end
  159. else
  160. id = clng(RS1("id"))
  161. end if
  162. end if
  163. '-----------------------------------------------------------------------------------------------------
  164. '---------------------------------------------------------------------------------- GL Doc Search Form
  165. '-----------------------------------------------------------------------------------------------------
  166. if id=0 then
  167. showDescription=false
  168. itemDesc=sqlSafe(replace(request("itemDesc")," ",""))
  169. if request("act")="search" and itemDesc<>"" then
  170. SQL_ST = "SELECT TOP 20 GLDocs.ID, GLDocs.GLDocID, GLDocs.GLDocDate, GLDocs.IsTemporary, GLDocs.IsChecked, GLDocs.IsFinalized, GLDocs.IsRemoved, GLDocs.BySubSystem, GLDocs.IsCompound, GLRows.Description FROM GLDocs INNER JOIN GLRows ON GLDocs.ID = GLRows.GLDoc WHERE (GL = "& OpenGL & ") AND (REPLACE(GLRows.Description,' ','') LIKE N'%" & itemDesc & "%') ORDER BY GLDocDate DESC"
  171. showDescription=true
  172. else
  173. fromDate = request("fromDate")
  174. toDate = request("toDate")
  175. Draft = request("Draft")
  176. Temporary= request("Temporary")
  177. Checked= request("Checked")
  178. Finalized= request("Finalized")
  179. Removed = request("Removed")
  180. Order1= request("Order1")
  181. itemAmount= request("itemAmount")
  182. if request("fromSession") = "y" then
  183. toDate = session("toDate")
  184. fromDate = session("fromDate")
  185. Draft = session("Draft")
  186. Temporary= session("Temporary")
  187. Checked = session("Checked")
  188. Finalized= session("Finalized")
  189. Removed = session("Removed")
  190. Order1 = session("Order1")
  191. end if
  192. if not Draft="" then DraftSt = "checked"
  193. if not Temporary="" then TemporarySt = "checked"
  194. if not Checked="" then CheckedSt = "checked"
  195. if not Finalized="" then FinalizedSt = "checked"
  196. if not Removed="" then RemovedSt = "checked"
  197. if ""&Order1="" then Order1 = "GLDocs.ID DESC"
  198. if toDate="" or fromDate="" then
  199. toDate = shamsiToday()
  200. fromDate = shamsiDate(Date()-7)
  201. DraftSt = "checked"
  202. TemporarySt = "checked"
  203. CheckedSt = "checked"
  204. end if
  205. session("fromDate") = fromDate
  206. session("toDate") = toDate
  207. session("Draft") = Draft
  208. session("Temporary") = Temporary
  209. session("Checked") = Checked
  210. session("Finalized") = Finalized
  211. session("Removed") = Removed
  212. session("Order1") = Order1
  213. '--
  214. if itemAmount<>"" and isnumeric(itemAmount) then
  215. itemAmount = cdbl(itemAmount)
  216. SQL_ST = "SELECT TOP 50 GLDocs.ID, GLDocs.GLDocID, GLDocs.GLDocDate, GLDocs.IsTemporary, GLDocs.IsChecked, GLDocs.IsFinalized, GLDocs.IsRemoved, GLDocs.BySubSystem, GLDocs.IsCompound, GLRows.Description FROM GLDocs INNER JOIN GLRows ON GLDocs.ID = GLRows.GLDoc WHERE (GL = "& OpenGL & ") AND (GLRows.Amount = '" & itemAmount & "') "
  217. showDescription=true
  218. else
  219. itemAmount = ""
  220. SQL_ST = "SELECT * FROM GLDocs WHERE (GL = "& OpenGL & ") and (GLDocDate >= N'"& fromDate & "') and (GLDocDate <= N'"& toDate & "')"
  221. end if
  222. SQL_ST = SQL_ST & " and ( 1=0 "
  223. if RemovedSt = "checked" then SQL_ST = SQL_ST & " or (IsRemoved=1) "
  224. if FinalizedSt = "checked" then SQL_ST = SQL_ST & " or ( (IsFinalized=1) and (GLDocs.deleted=0) and (IsRemoved=0) )"
  225. if CheckedSt = "checked" then SQL_ST = SQL_ST & " or ( (IsChecked=1) and (GLDocs.deleted=0) and (IsRemoved=0) )"
  226. if TemporarySt = "checked" then SQL_ST = SQL_ST & " or ( (IsTemporary=1) and (GLDocs.deleted=0) and (IsRemoved=0) )"
  227. if DraftSt = "checked" then SQL_ST = SQL_ST & " or ( (IsTemporary=0) and (IsChecked=0) and (IsFinalized=0) and (GLDocs.deleted=0) and (IsRemoved=0) )"
  228. ' SQL_ST = SQL_ST & " ) order by GLDocDate, GLDocID, id"
  229. SQL_ST = SQL_ST & " ) ORDER BY "& order1 '& ", id"
  230. end if
  231. %>
  232. <BR><BR><CENTER>
  233. <FORM METHOD=POST ACTION="GLMemoDocShow.asp?act=">
  234. : <INPUT TYPE="text" NAME="DocID"> &nbsp;&nbsp;<INPUT TYPE="submit" value="">
  235. </FORM>
  236. <hr>
  237. <FORM METHOD=POST ACTION="GLMemoDocShow.asp?act=search">
  238. : <INPUT TYPE="text" NAME="itemDesc" value="<%=itemDesc%>" > &nbsp;&nbsp;<INPUT TYPE="submit" value="">
  239. </FORM>
  240. <hr>
  241. <FORM METHOD=POST ACTION="GLMemoDocShow.asp">
  242. <TABLE border=0 align=center>
  243. <TR>
  244. <TD align=left> </TD>
  245. <TD align=right><INPUT TYPE="text" NAME="fromDate" value="<%=fromDate%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"></TD>
  246. <TD align=left width=20></TD>
  247. <TD align=left> </TD>
  248. <TD align=right><INPUT TYPE="text" NAME="toDate" value="<%=toDate%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"></TD>
  249. </TR>
  250. <TR height=10>
  251. <TD colspan=5 align=center><hr></TD>
  252. </TR>
  253. <TR>
  254. <TD colspan=5>
  255. <INPUT TYPE="checkbox" NAME="Draft" <%=DraftSt%>>
  256. <INPUT TYPE="checkbox" NAME="Temporary" <%=TemporarySt%>>
  257. <% if Auth( 8 , 6 ) then%>
  258. <INPUT TYPE="checkbox" NAME="Checked" <%=CheckedSt%>>
  259. <% end if
  260. if Auth( 8 , 5 ) then%>
  261. <INPUT TYPE="checkbox" NAME="Finalized" <%=FinalizedSt%>>
  262. <% end if
  263. if Auth( 8 , 2 ) then%>
  264. <INPUT TYPE="checkbox" NAME="Removed" <%=RemovedSt%>>
  265. <% end if%>
  266. </TR>
  267. <TR height=10>
  268. <TD colspan=5 align=center><hr></TD>
  269. </TR>
  270. <TR>
  271. <TD align=left>:</TD>
  272. <TD align=right colspan=4>
  273. <INPUT TYPE="text" NAME="itemAmount" value="<%=itemAmount%>" >
  274. </TD>
  275. </TR>
  276. <TR height=10>
  277. <TD colspan=5 align=center><hr></TD>
  278. </TR>
  279. <TR>
  280. <TD colspan=4 align=center> :
  281. <SELECT NAME="Order1" style="font-family:tahoma;font-size:9pt;width:120px;" onchange="document.all.submit.click();">
  282. <OPTION Value="GLDocDate" <%if Order1="GLDocDate" then response.write "selected"%>> </OPTION>
  283. <OPTION Value="GLDocID" <%if Order1="GLDocID" then response.write "selected"%>> </OPTION>
  284. <OPTION Value="GLDocs.ID" <%if Order1="GLDocs.ID" then response.write "selected"%>> </OPTION>
  285. <OPTION Value="GLDocs.ID DESC" <%if Order1="GLDocs.ID DESC" then response.write "selected"%>> </OPTION>
  286. </SELECT>
  287. </TD>
  288. <TD align=center>
  289. <INPUT TYPE="submit" NAME="submit" class=inputBut value="">
  290. </TD>
  291. </TR>
  292. </TABLE>
  293. </FORM>
  294. </CENTER>
  295. <BR><BR>
  296. <div style='padding:10px;'>
  297. <%
  298. '--
  299. set rsNote=Conn.Execute("select * from GLDocs where IsTemporary=0 and IsChecked=0 and IsFinalized=0 and IsRemoved=0 and deleted=0 and gl="&OpenGL)
  300. if not rsNote.eof then response.write ("<center><h2 style='color:yellow;'> ! . э </h2></center>")
  301. do while not rsNote.eof
  302. statusString = " "
  303. status =""
  304. if rsNote("BySubSystem") then
  305. statusString = statusString & " - "
  306. status = "BySubSystem"
  307. elseif rsNote("IsCompound") then
  308. statusString = statusString & " - "
  309. end if
  310. response.write("<li class=alak2> <A style='font-size:8pt; color:red;' HREF='GLMemoDocShow.asp?id=" & rsNote("ID") & "' target='_blank'>")
  311. if status = "BySubSystem" then response.write("<b>")
  312. response.write(" "& rsNote("GLDocID")& " <span dir=ltr>" & rsNote("GLDocDate") & "</span> &nbsp;&nbsp;" & statusString)
  313. if status = "BySubSystem" then response.write("</b>")
  314. response.write ("</a></li>")
  315. rsNote.moveNext
  316. loop
  317. response.write "<hr>"
  318. set RSS=Conn.Execute (SQL_ST)
  319. status =""
  320. Do while not RSS.eof
  321. memoNumberString=" " & RSS("GLDocID")
  322. if RSS("IsRemoved") then
  323. statusString = " "
  324. memoNumberString= " <U> </U>"
  325. elseif RSS("IsFinalized") then
  326. statusString = " "
  327. elseif RSS("IsChecked") then
  328. statusString = " "
  329. elseif RSS("IsTemporary") then
  330. statusString = " "
  331. else
  332. statusString = " "
  333. end if
  334. if RSS("BySubSystem") then
  335. statusString = statusString & " - "
  336. status = "BySubSystem"
  337. elseif RSS("IsCompound") then
  338. statusString = statusString & " - "
  339. end if
  340. %>
  341. <li class=alak2> <A style='font-size:8pt;' HREF='GLMemoDocShow.asp?id=<%=RSS("ID")%>' target='_blank'>
  342. <%=memoNumberString%> <span dir=ltr><%=RSS("GLDocDate")%></span> &nbsp;&nbsp;(<%=statusString%>)
  343. <%
  344. if showDescription then
  345. %> <span style='font-size:7pt;color:gray;'>[<%=RSS("Description")%>]</span>
  346. <% end if
  347. %> </A>
  348. <%
  349. RSS.moveNext
  350. Loop
  351. %>
  352. </div>
  353. <%
  354. else
  355. '-----------------------------------------------------------------------------------------------------
  356. '--------------------------------------------------------------------------------------- Show a GL Doc
  357. '-----------------------------------------------------------------------------------------------------
  358. 'mySQL="SELECT GLDocs.*, GLRows.GLAccount, GLRows.Tafsil, GLRows.Amount, GLRows.Description, GLRows.SYS, GLRows.Link, GLRows.IsCredit, GLAccounts.Name FROM GLDocs INNER JOIN GLRows ON GLDocs.ID = GLRows.GLDoc INNER JOIN GLAccounts ON GLRows.GLAccount = GLAccounts.ID WHERE (GLDocs.id="& id & ") AND (GLDocs.GL = "& OpenGL & ") AND (GLAccounts.GL = "& OpenGL & ") ORDER BY GLRows.ID"
  359. ' Changed By kid 860728 Adding Accounts.AccountTitle
  360. mySQL="SELECT GLDocs.*, GLRows.GLAccount, GLRows.Tafsil, GLRows.Amount, GLRows.Description, GLRows.SYS, GLRows.Link, GLRows.IsCredit, GLAccounts.Name, Accounts.AccountTitle FROM GLDocs INNER JOIN GLRows ON GLDocs.ID = GLRows.GLDoc INNER JOIN GLAccounts ON GLRows.GLAccount = GLAccounts.ID LEFT OUTER JOIN Accounts ON GLRows.Tafsil = Accounts.ID WHERE (GLDocs.id="& id & ") AND (GLDocs.GL = "& OpenGL & ") AND (GLAccounts.GL = "& OpenGL & ") ORDER BY GLRows.ID"
  361. set RS1=conn.execute(mySQL)
  362. if RS1.eof then
  363. response.write "<BR><BR><BR><CENTER>! </CENTER>"
  364. response.end
  365. end if
  366. GLDocID = RS1("GLDocID")
  367. Creator = RS1("CreatedBy")
  368. classType=1
  369. if RS1("IsRemoved") then
  370. if Not Auth( 8 , 2 ) then
  371. ShowErrorMessage(" .")
  372. conn.close
  373. response.end
  374. end if
  375. statusString = " "
  376. status = "Removed"
  377. classType=2
  378. elseif RS1("IsFinalized") then
  379. if Not Auth( 8 , 5 ) then
  380. ShowErrorMessage(" .")
  381. conn.close
  382. response.end
  383. end if
  384. statusString = " "
  385. status = "Finalized"
  386. elseif RS1("IsChecked") then
  387. if Not Auth( 8 , 6 ) then
  388. ShowErrorMessage(" .")
  389. conn.close
  390. response.end
  391. end if
  392. statusString = " "
  393. status = "Checked"
  394. elseif RS1("IsTemporary") then
  395. if Not (session("ID") = Creator OR Auth( 8 , 7 ) )then
  396. ShowErrorMessage(" .")
  397. conn.close
  398. response.end
  399. end if
  400. statusString = " "
  401. status = "Temporary"
  402. classType=1
  403. else
  404. if Not (session("ID") = Creator OR Auth( 8 , 9 ) )then
  405. ShowErrorMessage(" .")
  406. conn.close
  407. response.end
  408. end if
  409. statusString = " "
  410. status = "Draft"
  411. classType=3
  412. end if
  413. isBySubSystem = false
  414. if RS1("BySubSystem") then
  415. isBySubSystem = true
  416. if RS1("IsRemoved") then
  417. classType=2
  418. else
  419. classType=4
  420. end if
  421. end if
  422. isCompound = false
  423. if RS1("IsCompound") then
  424. isCompound = true
  425. if RS1("IsRemoved") then
  426. classType=2
  427. else
  428. classType=5
  429. end if
  430. end if
  431. if isBySubSystem then
  432. stamp="<div style='width:220px; text-align:center; border:2 dashed green;padding:10px;font-size:12pt;font-weight:bold;'> <br>("&statusString&")</div>"
  433. elseif isCompound then
  434. stamp="<div style='width:220px; text-align:center; border:2 dashed #9966CC;padding:10px;font-size:12pt;font-weight:bold;'> <br>("&statusString&")</div>"
  435. else
  436. stamp="<div style='width:120px; text-align:center; border:2 dashed red;padding: 10px;color:red;font-size:14pt;font-weight:bold;'>"&statusString&"</div>"
  437. end if
  438. if RS1("deleted") then
  439. statusString = statusString & " () "
  440. stamp="<div style='border:2 dashed red;padding: 10px;color:red;font-size:14pt;font-weight:bold;'></div>"
  441. status = "deleted"
  442. classType=0
  443. end if
  444. %>
  445. <SCRIPT LANGUAGE="JavaScript">
  446. <!--
  447. function showAcc(acc,moeen){
  448. window.open('tafsili.asp?accountID='+acc+'&FromDate=<%=RS1("GLDocDate")%>&ToDate=<%=RS1("GLDocDate")%>&moeenFrom='+moeen+'&moeenTo='+moeen+'&act=Show');
  449. }
  450. function showGLAcc(num){
  451. window.open('moeen.asp?accountID='+num+'&FromDate=<%=RS1("GLDocDate")%>&ToDate=<%=RS1("GLDocDate")%>&act=Show');
  452. }
  453. //-->
  454. </SCRIPT>
  455. <table border="0" cellpadding="0" cellspacing="0" align="center">
  456. <tr height="20">
  457. <td colspan=2></td>
  458. </tr>
  459. <tr height="10">
  460. <td width="250"></td>
  461. <td valign="top"><div style='position:absolute;'><%=stamp%></div></td>
  462. </tr>
  463. <tr height="20">
  464. <td colspan=2></td>
  465. </tr>
  466. </table>
  467. <table Border="0" align=center Cellspacing="1" Cellpadding="5" Dir="RTL" class="GLTable<%=classType%>">
  468. <tr>
  469. <th colspan=6>
  470. <% if RS1("GLDocID")>0 then
  471. response.write " " & RS1("GLDocID")
  472. else
  473. response.write " ( : "& RS1("OldGLDocID") & ")"
  474. end if
  475. %>
  476. </th>
  477. </tr>
  478. <tr>
  479. <th colspan=7 style="padding:0">
  480. <TABLE width="100%" border=0 Cellspacing="1" Cellpadding="10" Dir="RTL">
  481. <TR class="GLTable<%=classType%>TR2">
  482. <TD> : <%= RS1("id")%></TD>
  483. <TD align=center>: <%=statusString%></TD>
  484. <TD align=left> : <span dir=ltr><%= RS1("GLDocDate")%></span></TD>
  485. </TR>
  486. </TABLE>
  487. </th>
  488. </tr>
  489. <tr class="GLTable<%=classType%>TR1">
  490. <td style="width:20;"> # </td>
  491. <td style="width:40;"></td>
  492. <td style="width:30;"></td>
  493. <td style="width:300;"></td>
  494. <td style="width:70;"></td>
  495. <td style="width:70;"></td>
  496. </tr>
  497. <%
  498. i=0
  499. Do while not RS1.eof
  500. i = i + 1
  501. GLAccount = RS1("GLAccount")
  502. AccTitle = RS1("AccountTitle")
  503. GLAccTitle = RS1("name")
  504. theDescription = RS1("Description")
  505. Amount = Separate(RS1("Amount"))
  506. IsCredit = RS1("IsCredit")
  507. Tafsil = RS1("Tafsil")
  508. Sys = RS1("Sys")
  509. ItemLink = RS1("Link")
  510. if len(sys)>1 then 'if isBySubSystem then
  511. theLink = "ShowItem.asp?sys=" & sys & "&Item=" & ItemLink
  512. else
  513. theLink = "about:blank"
  514. end if
  515. credit = ""
  516. debit = ""
  517. if IsCredit then
  518. credit = Amount
  519. totalCredit = totalCredit + cdbl(Amount)
  520. else
  521. debit = Amount
  522. totalDebit = totalDebit + cdbl(Amount)
  523. end if
  524. %>
  525. <tr <%if i mod 2 = 1 then%>class="GenRow1"<%else%>class="GenRow2"<%end if%>>
  526. <td style="width:20;"> <%=i%> </td>
  527. <td style="width:40;" title="<%=AccTitle%>"><A HREF="javascript:showAcc(<%=Tafsil%>,<%=GLAccount%>);" style="color:black;"><%=Tafsil%></A></td>
  528. <td style="width:30;" title="<%=GLAccTitle%>"><A HREF="javascript:showGLAcc(<%=GLAccount%>);"><%=GLAccount%></A></td>
  529. <td style="width:300; cursor:hand;" title=" ." onclick="window.open('<%=theLink%>');"><%=theDescription%></td>
  530. <td style="width:80;"><%=debit%></td>
  531. <td style="width:80;"><%=credit%></td>
  532. </tr>
  533. <%
  534. RS1.movenext
  535. loop
  536. %>
  537. <tr class="GLTable<%=classType%>TR1">
  538. <td></td>
  539. <td></td>
  540. <td></td>
  541. <td></td>
  542. <td><%=Separate(totalDebit)%></td>
  543. <td><%=Separate(totalCredit)%></td>
  544. </tr>
  545. </TABLE>
  546. <BR><BR>
  547. <CENTER>
  548. <FORM METHOD=POST ACTION="?act=changeStatus&msg= ">
  549. <INPUT TYPE="hidden" name="DocID" value="<%=GLDocID%>">
  550. <INPUT TYPE="hidden" name="id" value="<%=id%>">
  551. <% if status <> "deleted" then
  552. if status = "Draft" then
  553. if (((session("ID") = Creator) OR ( Auth( 8 , "H" ))) AND totalDebit=totalCredit) OR isBySubSystem then%>
  554. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" onclick="return confirm(' Ͽ')"><%
  555. end if
  556. if isBySubSystem AND Auth( 8 , 8 ) then %>
  557. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" style="border-color:red;">
  558. <% elseif isCompound then
  559. if Auth( 8 , "F" ) then %>
  560. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" style="border-color:red;">
  561. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" style="border-color:red;" onclick="return confirm(' Ͽ')">
  562. <% end if
  563. else %>
  564. <INPUT TYPE="submit" name="submit" value="" class="GenButton" style="border-color:red;">
  565. <INPUT TYPE="submit" name="submit" value="" class="GenButton" style="border-color:red;" onclick="return confirm(' Ͽ')"><%
  566. end if
  567. elseif status = "Temporary" then
  568. if session("ID") = Creator OR Auth( 8 , 8 ) then%>
  569. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" onclick="return confirm(' Ͽ')"><%
  570. end if
  571. if Auth( 8 , 8 ) then%>
  572. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" onclick="return confirm(' Ͽ')"><%
  573. if isBySubSystem AND Auth( 8 , 8 ) then %>
  574. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" style="border-color:red;">
  575. <% elseif isCompound then
  576. if Auth( 8 , "F" ) then %>
  577. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" style="border-color:red;">
  578. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" style="border-color:red;" onclick="return confirm(' Ͽ')">
  579. <% end if
  580. else %>
  581. <INPUT TYPE="submit" name="submit" value="" class="GenButton" style="border-color:red;">
  582. <INPUT TYPE="submit" name="submit" value="" class="GenButton" style="border-color:red;" onclick="return confirm(' Ͽ')"><%
  583. end if
  584. end if
  585. elseif status = "Checked" then %>
  586. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" onclick="return confirm(' Ͽ')">
  587. <INPUT TYPE="submit" name="submit" value=" " class="GenButton" onclick="return confirm(' Ͽ')">
  588. <% end if
  589. %>
  590. <br><br>
  591. <% if status <> "Draft" then %>
  592. <% ReportLogRow = PrepareReport ("GLDoc.rpt", "GLDoc_ID", id, "/beta/dialog_printManager.asp?act=Fin") %>
  593. <INPUT TYPE="button" value=" ǁ " Class="GenButton" style="border:1 solid blue;" onclick="printThisReport(this,<%=ReportLogRow%>);">
  594. <!--BR><iframe name=f1 id=f1 src="/CRReports/?Id=<%=ReportLogRow%>" align=center style="width:750; height:210; border-style: none" border=0 FRAMEBORDER=0 scrollbars=no ></iframe-->
  595. <% end if %>
  596. <INPUT TYPE="button" name="submit" value="" class="GenButton" onclick="window.location='GLMemoDocShow.asp?fromSession=y'">
  597. <%
  598. end if %>
  599. </FORM>
  600. <br>
  601. <hr noshade color=white>
  602. <%
  603. mySQL="SELECT GLDocs.*, Users.RealName FROM GLDocs INNER JOIN Users ON GLDocs.createdBy = Users.ID where GLDocID="& GLDocID & " and GL = "& OpenGL & " ORDER BY GLDocs.ID"
  604. set RS1=conn.execute(mySQL)
  605. if not RS1.eof then
  606. response.write " : <br><br>"
  607. do while not RS1.EOF
  608. response.write "<li class=alak2 "
  609. if trim(id) = trim(RS1("id")) then
  610. response.write " disabled "
  611. end if
  612. response.write "><A HREF='GLMemoDocShow.asp?id="& RS1("id") & "'> <span dir=ltr>"& RS1("CreatedDate") & "</span> "& RS1("RealName") & " </a> <br>"
  613. RS1.movenext
  614. loop
  615. end if
  616. end if
  617. %>
  618. <hr noshade color=white>
  619. <BR>
  620. </center>
  621. <!--#include file="tah.asp" -->