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