/beta/accounting/GLMemoInput.asp

http://github.com/khaneh/Orders · ASP · 1167 lines · 998 code · 125 blank · 44 comment · 180 complexity · 01168f8a66007a62a0be6cf559f95eae MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Accounting (8)
  3. PageTitle= " "
  4. SubmenuItem=1
  5. if not Auth(8 , 1) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <!--#include File="../include_farsiDateHandling.asp"-->
  9. <!--#include File="../include_JS_InputMasks.asp"-->
  10. <%
  11. '---------------------------------------------
  12. '---------------------------- ShowErrorMessage
  13. '---------------------------------------------
  14. function ShowErrorMessage(msg)
  15. response.write "<table align='center' cellpadding='5'><tr><td bgcolor='#FFCCCC' dir='rtl' align='center'> ! <br>"& msg & "<br></td></tr></table><br>"
  16. end function
  17. %>
  18. <style>
  19. Table { font-size: 9pt;}
  20. .InvRowInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; direction:LTR; width:100%;}
  21. .InvHeadInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #CCCC88; text-align:center;}
  22. .InvRowInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right; width:100%;}
  23. .InvHeadInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #AACC77; text-align:center;}
  24. .InvHeadInput3 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right; direction: right-to-left;}
  25. .InvGenInput { font-family:tahoma; font-size: 9pt; border: none; }
  26. .InvGenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; }
  27. .GLInput1 { font-family:tahoma; font-size: 9pt; border: 1px solid black; direction:RTL;}
  28. .GLInput2 { font-family:tahoma; font-size: 9pt; border: 1px solid black; direction:LTR; text-align:right; }
  29. .GLTable1 { border: none; direction:RTL; border:1px dashed red ; width:685;}
  30. .GLTable1 tr {height:20; background-color: #CCCC88; }
  31. .GLTable2 { border: none; direction:RTL;}
  32. .GLTable2 tr {height:20; text-align:center; background-color: #F0F0F0; }
  33. .GLTable2 td {border-bottom: 1px solid black; border-right: 1px solid black;}
  34. .GLTable3 tr {background-color: #F0F0F0}
  35. .GLTR1 { font-family:tahoma; font-size: 9pt; height:30; text-align:center; vertical-align:top; background-color: #C3C300; }
  36. .GLTR2 { height:20; text-align:center; background-color: #C3C300; }
  37. .GLTD1 { font-family:tahoma; font-size: 9pt; height:20; text-align:center; }
  38. </style>
  39. <SCRIPT LANGUAGE="JavaScript">
  40. <!--
  41. var okToProceed=false;
  42. var currentRow=0;
  43. var IsTaraz = false
  44. //-->
  45. </SCRIPT>
  46. <%
  47. '-----------------------------------------------------------------------------------------------------
  48. '----------------------------------------------------------------------------- Input a new GL Memo Doc
  49. '-----------------------------------------------------------------------------------------------------
  50. 'xml_GLAccount.asp
  51. if request("act")="" then
  52. if session("IsClosed")="True" then
  53. response.redirect "AccountInfo.asp?errMsg=" & Server.URLEncode("! .")
  54. end if
  55. %>
  56. <!-- -->
  57. <br>
  58. <input type="hidden" Name='tmpDlgArg' value=''>
  59. <input type="hidden" Name='tmpDlgTxt' value=''>
  60. <BR>
  61. <table class="GLTable1" align="center" Cellspacing="0" Cellpadding="0">
  62. <tr class="GLTR1" align="center" Cellspacing="1" Cellpadding="0">
  63. <TD colspan="10"><TABLE Border="0" Width="100%" Cellspacing="1" Cellpadding="2" Dir="RTL">
  64. <TR>
  65. <TD align="left"> :</TD>
  66. <TD> <%=OpenGLName%>
  67. </TD>
  68. <FORM METHOD=POST ACTION="GLMemoInput.asp?act=submitMemo" onsubmit="return checkValidation()">
  69. <TD align="left"> :</TD>
  70. <TD>
  71. <INPUT class="GLInput2" NAME="GLMemoDate" TYPE="text" maxlength="10" size="10" value="<%=shamsiToday()%>" onblur="acceptDate(this)" >
  72. </TD>
  73. <TD align="left"> :</TD>
  74. <TD>
  75. <% mySQL="SELECT ISNULL(MAX(GLDocID),100) AS LastMemo FROM GLDocs WHERE GL='"& OpenGL & "'"
  76. Set RS1=conn.Execute (mySQL)
  77. LastMemo = RS1("LastMemo")
  78. %>
  79. <INPUT class="GLInput2" NAME="GLMemoNo" TYPE="text" maxlength="10" size="10" value="<%=LastMemo+1%>">
  80. </TD>
  81. </TR></TABLE></TD>
  82. </tr>
  83. <tr class="GLTR2">
  84. <TD colspan="10" align=right><div>
  85. <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" >
  86. <tr>
  87. <td style="width:26; border-right:none;"> # </td>
  88. <td style="width:50;"></td>
  89. <td style="width:170;"> </td>
  90. <td style="width:300;"></td>
  91. <td style="width:80;"></td>
  92. <td style="width:80;"></td>
  93. </tr>
  94. </TABLE></div></TD>
  95. </tr>
  96. <tr>
  97. <td colspan="10">
  98. <div style="overflow:auto; height:250px; width:*;">
  99. <TABLE Border="0" Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855" class="GLTable3">
  100. <Tbody id="GLrows">
  101. <tr bgcolor='#F0F0F0' onclick="setCurrentRow(this.rowIndex);" >
  102. <td colspan="6">
  103. <INPUT class="InvGenButton" TYPE="button" value="" onkeyDown="if(event.keyCode==9) {setCurrentRow(this.parentNode.parentNode.rowIndex); return false;};" onClick="addRow();">
  104. </td>
  105. </tr>
  106. </Tbody></TABLE>
  107. </div>
  108. </td>
  109. </tr>
  110. <tr bgcolor='#CCCC88'>
  111. <td align=left>
  112. <B><span id="tarazDiv"> </span></B>
  113. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  114. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  115. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  116. : <input type=text name="totalDebit" style="border:none; background:none;" value=0>
  117. &nbsp;&nbsp;&nbsp;
  118. : <input type=text name="totalCredit" style="border:none; background:none;" value=0>
  119. </td>
  120. </tr>
  121. </table>
  122. <br>
  123. <TABLE Border="0" Cellspacing="5" Cellpadding="0" Dir="RTL" align='left'>
  124. <tr>
  125. <td align='center'><INPUT class="InvGenButton" TYPE="submit" name="submit" value=""></td>
  126. <td align='center'><INPUT class="InvGenButton" style="background-color: red;" TYPE="submit" name="submit" value=" " onclick="saveDraft()"> </td>
  127. </tr>
  128. </TABLE>
  129. </FORM>
  130. <%
  131. '-----------------------------------------------------------------------------------------------------
  132. '---------------------------------------------------------------------------------- Edit a GL Memo Doc
  133. '-----------------------------------------------------------------------------------------------------
  134. elseif request("act")="editDoc" then
  135. id=request("id")
  136. if id="" or not(isnumeric(id)) then
  137. response.write "<br>"
  138. call showAlert ("! ", CONST_MSG_ERROR)
  139. response.end
  140. end if
  141. id=clng(id)
  142. mySQL="SELECT * FROM GLDocs WHERE (deleted = 0) and (isRemoved=0) and (GLDocID = "& id & ") AND (GL = "& OpenGL & ")"
  143. set RS1=conn.execute(mySQL)
  144. if RS1.eof then
  145. response.write "<br>"
  146. call showAlert ("! ", CONST_MSG_ERROR)
  147. response.end
  148. end if
  149. GLDoc = RS1("ID")
  150. GLDocDate = RS1("GLDocDate")
  151. GLDocID = RS1("GLDocID")
  152. DID = RS1("id")
  153. RS1.close
  154. mySQL="SELECT GLRows.*, Accounts.AccountTitle, GLAccounts.Name AS GLAccountTitle, glDocs.isCompound FROM GLRows INNER JOIN GLAccounts ON GLRows.GLAccount = GLAccounts.ID LEFT OUTER JOIN Accounts ON GLRows.Tafsil = Accounts.ID INNER JOIN glDocs on glRows.glDoc = glDocs.id WHERE (GLRows.deleted = 0) AND (GLRows.GLDoc = "& GLDoc & ") AND (GLAccounts.GL = "& OpenGL & ") ORDER BY GLRows.ID"
  155. set RS2=conn.execute(mySQL)
  156. 'response.write rs2("isCompound")
  157. %>
  158. <!-- -->
  159. <br>
  160. <input type="hidden" Name='tmpDlgArg' value=''>
  161. <input type="hidden" Name='tmpDlgTxt' value=''>
  162. <FORM METHOD=POST ACTION="GLMemoInput.asp?act=submitEditMemo" onsubmit="return checkValidation()">
  163. <table class="GLTable1" align="center" Cellspacing="0" Cellpadding="0">
  164. <tr class="GLTR1" align="center" Cellspacing="1" Cellpadding="0">
  165. <TD colspan="10"><TABLE Border="0" Width="100%" Cellspacing="1" Cellpadding="2" Dir="RTL">
  166. <TR>
  167. <TD align="left" > :</TD>
  168. <TD> <%=OpenGLName%>
  169. </TD>
  170. <TD align="left"> :</TD>
  171. <TD>
  172. <INPUT class="GLInput2" style="text-align:left;" NAME="GLMemoDate" TYPE="text" maxlength="10" size="10" value="<%=GLDocDate%>" onblur="acceptDate(this)">
  173. </TD>
  174. <TD align="left"> :</TD>
  175. <TD>
  176. <INPUT class="GLInput2" NAME="GLMemoNo" TYPE="text" maxlength="10" size="10" value="<%=id%>" readonly>
  177. </TD>
  178. </TR></TABLE></TD>
  179. </tr>
  180. <tr class="GLTR2">
  181. <TD colspan="10"><div>
  182. <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" >
  183. <tbody id="GLcols">
  184. <tr>
  185. <td style="width:26; border-right:none;"> # </td>
  186. <td style="width:60;"></td>
  187. <td style="width:40;"></td>
  188. <td style="width:250;"></td>
  189. <td style="width:85;"></td>
  190. <td style="width:85;"></td>
  191. <td style="width:50;"> </td>
  192. <td style="width:70;"> </td>
  193. </tr>
  194. </tbody>
  195. </TABLE></div></TD>
  196. </tr>
  197. <tr>
  198. <TD colspan="10"><div style="overflow:auto; height:250px; width:695;">
  199. <TABLE Border="0" Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855" class="GLTable3" onclick='setCurrentCell()'>
  200. <Tbody id="GLrows">
  201. <%
  202. Do while not RS2.eof
  203. i = i + 1
  204. GLAccount = RS2("GLAccount")
  205. GLAccTitle = RS2("GLAccountTitle")
  206. Tafsil = RS2("Tafsil")
  207. AccTitle = RS2("AccountTitle")
  208. Description = RS2("Description")
  209. Ref1 = RS2("Ref1")
  210. Ref2 = RS2("Ref2")
  211. Amount = RS2("Amount")
  212. IsCredit = RS2("IsCredit")
  213. credit = ""
  214. debit = ""
  215. if IsCredit then
  216. credit = Amount
  217. totalCredit = totalCredit + cdbl(Amount)
  218. else
  219. debit = Amount
  220. totalDebit = totalDebit + cdbl(Amount)
  221. end if
  222. %>
  223. <tr bgcolor='#F0F0F0'>
  224. <td style="width:25; border-right:none;" align=center> <%=i%> </td>
  225. <td width="60">
  226. <INPUT class='InvRowInput' <%if not rs2("isCompound") then response.write "readonly"%> TYPE='text' NAME='Accounts' maxlength=6 value="<%=Tafsil%>" title="<%=AccTitle%>" onKeyPress='return mask(this);' onBlur='check(this);'>
  227. </td>
  228. <td width="40">
  229. <INPUT class='InvRowInput2' TYPE='text' NAME='GLAccounts' maxlength=5 value="<%=GLAccount%>" title="<%=GLAccTitle%>" onKeyPress='return mask(this);' onBlur='check(this);'>
  230. </td>
  231. <td width="250">
  232. <INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' value="<%=Description%>" onKeyPress='return mask(this);'>
  233. </td>
  234. <td width="85">
  235. <INPUT class='InvRowInput2' TYPE='text' NAME='debits' value="<%=Separate(debit)%>" onKeyPress='return mask(this);' onBlur='check(this);'>
  236. </td>
  237. <td width="85">
  238. <INPUT class='InvRowInput2' TYPE='text' NAME='credits' value="<%=Separate(credit)%>" onKeyPress='return mask(this);' onBlur='check(this);'>
  239. </td>
  240. <td width="50">
  241. <INPUT class='InvRowInput2' TYPE='text' NAME='Refs1' maxlength=20 value="<%=Ref1%>" onKeyPress='return mask(this);'>
  242. </td>
  243. <td width="70">
  244. <INPUT class='InvRowInput' TYPE='text' NAME='Refs2' maxlength=20 value="<%=Ref2%>" onKeyPress='return mask(this);' onBlur='acceptDate(this);'>
  245. </td>
  246. </tr>
  247. <%
  248. RS2.movenext
  249. Loop
  250. %>
  251. <tr bgcolor='#F0F0F0'>
  252. <td colspan="15">
  253. <INPUT class="InvGenButton" TYPE="button" value="" onClick="addRow();">
  254. </td>
  255. </tr>
  256. </Tbody>
  257. </TABLE></div>
  258. </TD>
  259. </tr>
  260. <tr class="GLTR2">
  261. <TD colspan="10"><div>
  262. <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" style="border-top:1 solid red;">
  263. <tr>
  264. <td colspan=3 style="width:256;">
  265. <span id="tarazDiv" style="font-weight:bold;"><%if totalCredit=totalDebit then response.write "<FONT COLOR='#008833'> </FONT>" else response.write "<FONT COLOR='#FF3300'> </FONT>" end if%></span>&nbsp;</td>
  266. <td style="width:122; text-align:left;"> :</td>
  267. <td style="width:85;"><input type=text name="totalDebit" id="totalDebit" style="width:85;border:none; background:none;" value=<%=Separate(totalCredit)%>></td>
  268. <td style="width:85;"><input type=text name="totalCredit" id="totalCredit" style="width:85;border:none; background:none;" value=<%=Separate(totalDebit)%>></td>
  269. <td colspan=2 style="width:122; text-align:right;">: </td>
  270. </tr>
  271. </TABLE></div></TD>
  272. </tr>
  273. </table><br>
  274. <TABLE Border="0" Cellspacing="5" Cellpadding="0" Dir="RTL" align='left'>
  275. <tr>
  276. <td align='center'>
  277. <INPUT TYPE="hidden" name="GLDoc" value="<%=GLDoc%>">
  278. <INPUT class="InvGenButton" style="background-color: red;" TYPE="submit" name="submit" value=" " onclick="saveDraft()">
  279. <INPUT class="InvGenButton" TYPE="submit" value=" "></td>
  280. <td align='center'><INPUT class="InvGenButton" TYPE="button" value="" onclick="history.back()"></td>
  281. </tr>
  282. </TABLE>
  283. </FORM>
  284. <script language="JavaScript">
  285. <!--
  286. var dialogActive=false;
  287. function mask(src){
  288. var theKey=event.keyCode;
  289. if (src.name=="Accounts"){
  290. if (theKey==32){
  291. event.keyCode=0;
  292. dialogActive=true;
  293. document.all.tmpDlgArg.value="#"
  294. document.all.tmpDlgTxt.value=" :"
  295. var myTinyWindow = window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
  296. dialogActive=false;
  297. if (document.all.tmpDlgTxt.value !="") {
  298. var myTinyWindow = window.showModalDialog('../ar/dialog_selectAccount.asp?act=select&search='+escape(document.all.tmpDlgTxt.value),document.all.tmpDlgArg,'dialogHeight:300px; dialogWidth:600px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
  299. if (document.all.tmpDlgArg.value!="#"){
  300. Arguments=document.all.tmpDlgArg.value.split("#")
  301. src.value=Arguments[0];
  302. src.title=Arguments[1];
  303. }
  304. }
  305. // src.parentNode.nextSibling.getElementsByTagName("INPUT")[0].focus();
  306. }
  307. else if (theKey >= 48 && theKey <= 57 )
  308. return true;
  309. else
  310. return false;
  311. }
  312. else if (src.name=="GLAccounts"){
  313. if (theKey==32){
  314. event.keyCode=0;
  315. dialogActive=true;
  316. document.all.tmpDlgArg.value="#"
  317. document.all.tmpDlgTxt.value=" :"
  318. var myTinyWindow = window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
  319. dialogActive=false;
  320. if (document.all.tmpDlgTxt.value !="") {
  321. var myTinyWindow = window.showModalDialog('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;');
  322. if (document.all.tmpDlgArg.value!="#"){
  323. Arguments=document.all.tmpDlgArg.value.split("#")
  324. src.value=Arguments[0];
  325. src.title=Arguments[1];
  326. }
  327. }
  328. // src.parentNode.nextSibling.getElementsByTagName("INPUT")[0].focus();
  329. }
  330. else if (theKey >= 48 && theKey <= 57 ) // [0]-[9] are acceptible
  331. return true;
  332. else
  333. return false;
  334. }
  335. else if (src.name=="debits" || src.name=="credits" || src.name=="Refs1"){
  336. if (theKey < 48 || theKey > 57) { // [0]-[9] are acceptible
  337. return false;
  338. }
  339. return true;
  340. }
  341. else if (src.name=="Descriptions" || src.name=="Refs2"){
  342. if (theKey==13){ // [Enter]
  343. return false;
  344. }
  345. return true;
  346. }
  347. }
  348. function check(src){
  349. if (src.name=="Accounts"){
  350. if (!dialogActive){
  351. if (window.XMLHttpRequest) {
  352. var objHTTP=new XMLHttpRequest();
  353. } else if (window.ActiveXObject) {
  354. var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
  355. }
  356. objHTTP.open('GET','xml_CustomerAccount.asp?id='+src.value,false)
  357. objHTTP.send()
  358. tmpStr = unescape( objHTTP.responseText)
  359. src.title=tmpStr;
  360. if (tmpStr==" "){
  361. src.value="";
  362. }
  363. }
  364. }
  365. else if(src.name=="GLAccounts"){
  366. if (!dialogActive){
  367. if (window.XMLHttpRequest) {
  368. var objHTTP=new XMLHttpRequest();
  369. } else if (window.ActiveXObject) {
  370. var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
  371. }
  372. objHTTP.open('GET','xml_GLAccount.asp?id='+src.value,false)
  373. objHTTP.send()
  374. tmpStr = unescape( objHTTP.responseText)
  375. src.title=tmpStr;
  376. if (tmpStr==" "){
  377. src.value="";
  378. }
  379. }
  380. }
  381. else if(src.name=="debits" || src.name=="credits"){
  382. src.value=val2txt(txt2val(src.value));
  383. if (''+src.value=="NaN" || src.value=="0") src.value = ""
  384. rowNo=src.parentNode.parentNode.rowIndex;
  385. if (src.value!=""){
  386. if (src.name=="credits")
  387. document.getElementsByName("debits")[rowNo].value = "";
  388. else
  389. document.getElementsByName("credits")[rowNo].value = "";
  390. }
  391. memoIsTaraz();
  392. }
  393. }
  394. function checkValidation(){
  395. emptySlot=-1;
  396. for (rowNo=0; rowNo < lastRow; rowNo++){
  397. if(document.getElementsByName("GLAccounts")[rowNo].value==''){
  398. emptySlot=rowNo;
  399. }
  400. }
  401. if (emptySlot != -1){
  402. errObj=document.getElementsByName("GLAccounts")[emptySlot];
  403. errObj.style.backgroundColor="red";
  404. document.getElementsByName("GLAccounts")[emptySlot].focus();
  405. alert(' \n\nǐ \n[Ctrl]+[Del]\n.');
  406. errObj.style.backgroundColor="";
  407. return false;
  408. }
  409. if (IsTaraz==true)
  410. return true
  411. else{
  412. alert("! ")
  413. return false
  414. }
  415. }
  416. function saveDraft(){
  417. if (document.all.totalDebit.value != 0 || document.all.totalCredit.value != 0)
  418. IsTaraz = true
  419. }
  420. function memoIsTaraz(){
  421. var totalCredit = 0;
  422. var totalDebit = 0;
  423. for (rowNo=0; rowNo < lastRow; rowNo++){
  424. totalCredit += parseInt(txt2val(document.getElementsByName("credits")[rowNo].value));
  425. totalDebit += parseInt(txt2val(document.getElementsByName("debits")[rowNo].value));
  426. }
  427. document.all.totalCredit.value = val2txt(totalCredit);
  428. document.all.totalDebit.value = val2txt(totalDebit);
  429. if (totalDebit == totalCredit && totalCredit != 0){
  430. IsTaraz = true
  431. document.all.tarazDiv.innerHTML = "<FONT COLOR='#008833'> </FONT>"
  432. }
  433. else{
  434. IsTaraz = false
  435. document.all.tarazDiv.innerHTML = "<FONT COLOR='#FF3300'> </FONT>"
  436. }
  437. }
  438. var currentRow=0;
  439. var lastRow=<%=i%>;
  440. var currentCol=1;
  441. var lastCol=7;
  442. function documentKeyDown() {
  443. var theKey = event.keyCode;
  444. /*
  445. Arrow Keys' Codes:
  446. < 37 (Left)
  447. ^ 38 (Up)
  448. > 39 (Right)
  449. v 40 (Down)
  450. */
  451. if (event.ctrlKey && !event.shiftKey)
  452. Ctrl=true;
  453. else
  454. Ctrl=false;
  455. if (theKey==9){
  456. Ctrl=true;
  457. if (event.shiftKey){
  458. theKey = 39;
  459. }
  460. else
  461. theKey = 37;
  462. }
  463. else if ((theKey == 45) && Ctrl){ // [Ins] Key + [ctrl]
  464. event.keyCode=36; // [Home] Key
  465. addRow();
  466. }
  467. else if ((theKey == 46) && Ctrl){ // [Del] Key + [ctrl]
  468. event.keyCode=36; // [Home] Key
  469. delRow()
  470. }
  471. if (((theKey == 37 || theKey == 39) && Ctrl) || theKey == 38 || theKey == 40){
  472. deactivateCurrentCell();
  473. switch (theKey){
  474. case 37:
  475. if (currentCol < lastCol)
  476. currentCol++;
  477. else{
  478. currentCol=1;
  479. if(currentRow<lastRow)
  480. currentRow++;
  481. }
  482. break;
  483. case 38:
  484. if (currentRow > 0)
  485. currentRow--;
  486. else
  487. currentRow=lastRow;
  488. break;
  489. case 39:
  490. if (currentCol > 1)
  491. currentCol--;
  492. else{
  493. currentCol=lastCol;
  494. if(currentRow>0)
  495. currentRow--;
  496. }
  497. break;
  498. case 40:
  499. if (currentRow < lastRow)
  500. currentRow++;
  501. else
  502. currentRow=0;
  503. break;
  504. default:
  505. break;
  506. }
  507. activateCurrentCell();
  508. event.keyCode=36; // [Home] Key
  509. }
  510. }
  511. function deactivateCurrentCell(){
  512. Rtable=document.getElementById("GLrows");
  513. Ctable=document.getElementById("GLcols");
  514. Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0].setAttribute("bgColor", '#F0F0F0');
  515. Ctable.getElementsByTagName("tr")[0].getElementsByTagName("td")[currentCol].setAttribute("bgColor", '#F0F0F0');
  516. tmpCell=Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[currentCol];
  517. if (tmpCell){
  518. tmpCell.setAttribute("bgColor", '');
  519. }
  520. }
  521. function activateCurrentCell(){
  522. Rtable=document.getElementById("GLrows");
  523. Ctable=document.getElementById("GLcols");
  524. Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0].setAttribute("bgColor", '#FFB0B0');
  525. Ctable.getElementsByTagName("tr")[0].getElementsByTagName("td")[currentCol].setAttribute("bgColor", '#FFB0B0');
  526. tmpCell=Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[currentCol];
  527. if (tmpCell){
  528. tmpCell.setAttribute("bgColor", '#FF0000');
  529. tmpCell.getElementsByTagName("input")[0].focus();
  530. }
  531. if(currentRow==lastRow){
  532. document.getElementById("GLrows").getElementsByTagName("tr")[currentRow].getElementsByTagName("INPUT")[0].focus();
  533. }
  534. }
  535. function setCurrentCell(){
  536. tmpRow=event.srcElement.parentNode.parentNode.rowIndex;
  537. tmpCol=event.srcElement.parentNode.cellIndex;
  538. if(tmpCol>0 && tmpRow>=0){
  539. deactivateCurrentCell();
  540. currentRow =tmpRow;
  541. currentCol=tmpCol;
  542. activateCurrentCell();
  543. }
  544. else if(event.srcElement.parentNode.rowIndex){
  545. deactivateCurrentCell();
  546. currentRow =event.srcElement.parentNode.rowIndex;
  547. currentCol=1;
  548. activateCurrentCell();
  549. }
  550. }
  551. function delRow(){
  552. if (currentRow==lastRow)
  553. return;
  554. deactivateCurrentCell();
  555. rowNo = currentRow
  556. Rtable=document.getElementById("GLrows");
  557. theRow=Rtable.getElementsByTagName("tr")[rowNo];
  558. Rtable.removeChild(theRow);
  559. lastRow--;
  560. for (rowNo=0; rowNo < lastRow ; rowNo++){
  561. tempTD=Rtable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
  562. tempTD.bgColor= '#F0F0F0';
  563. tempTD.innerText= rowNo+1;
  564. }
  565. activateCurrentCell();
  566. }
  567. function addRow(){
  568. deactivateCurrentCell();
  569. rowNo = currentRow
  570. Rtable=document.getElementById("GLrows");
  571. theRow=Rtable.getElementsByTagName("tr")[rowNo];
  572. newRow=document.createElement("tr");
  573. newRow.setAttribute("bgColor", '#f0f0f0');
  574. tempTD=document.createElement("td");
  575. tempTD.innerHTML=rowNo+1
  576. tempTD.setAttribute("align", 'center');
  577. tempTD.setAttribute("width", '25');
  578. newRow.appendChild(tempTD);
  579. tempTD=document.createElement("td");
  580. tempTD.setAttribute("width", '60');
  581. tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Accounts' maxlength=6 onKeyPress='return mask(this);' onBlur='check(this);'>"
  582. newRow.appendChild(tempTD);
  583. tempTD=document.createElement("td");
  584. tempTD.setAttribute("width", '40');
  585. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='GLAccounts' maxlength=5 onKeyPress='return mask(this);' onBlur='check(this);'>"
  586. newRow.appendChild(tempTD);
  587. tempTD=document.createElement("td");
  588. tempTD.setAttribute("width", '250');
  589. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' onKeyPress='return mask(this);'>"
  590. newRow.appendChild(tempTD);
  591. tempTD=document.createElement("td");
  592. tempTD.setAttribute("width", '80');
  593. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='debits' onKeyPress='return mask(this);' onBlur='check(this);'>"
  594. newRow.appendChild(tempTD);
  595. tempTD=document.createElement("td");
  596. tempTD.setAttribute("width", '80');
  597. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='credits' onKeyPress='return mask(this);' onBlur='check(this);'>"
  598. newRow.appendChild(tempTD);
  599. tempTD=document.createElement("td");
  600. tempTD.setAttribute("width", '50');
  601. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Refs1' maxlength=20 onKeyPress='return mask(this);'>"
  602. newRow.appendChild(tempTD);
  603. tempTD=document.createElement("td");
  604. tempTD.setAttribute("width", '70');
  605. tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Refs2' maxlength=20 onKeyPress='return mask(this);' onBlur='acceptDate(this);'>"
  606. newRow.appendChild(tempTD);
  607. Rtable.insertBefore(newRow,theRow);
  608. lastRow++;
  609. for (rowNo=0; rowNo < lastRow ; rowNo++){
  610. tempTD=Rtable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
  611. tempTD.bgColor= '#F0F0F0';
  612. tempTD.innerText= rowNo+1;
  613. }
  614. activateCurrentCell();
  615. }
  616. document.onkeydown = documentKeyDown;
  617. activateCurrentCell();
  618. memoIsTaraz();
  619. //-->
  620. </script>
  621. <%
  622. '-----------------------------------------------------------------------------------------------------
  623. '----------------------------------------------------------------------------- Submit Edit GL Memo Doc
  624. '-----------------------------------------------------------------------------------------------------
  625. elseif request("act")="submitEditMemo" then
  626. ON ERROR RESUME NEXT
  627. if request.form("submit")=" " then
  628. IsTemporary = 0
  629. else
  630. IsTemporary = 1
  631. end if
  632. GLMemoDate= sqlSafe(request.form("GLMemoDate"))
  633. GLMemoNo= clng(request.form("GLMemoNo"))
  634. totalDebit = cdbl(text2value(request.form("totalDebit")))
  635. totalCredit= cdbl(text2value(request.form("totalCredit")))
  636. GLDoc = clng(request.form("GLDoc"))
  637. TotalItemCount = request.form("GLAccounts").count
  638. ReDim Accounts(TotalItemCount)
  639. ReDim GLAccounts(TotalItemCount)
  640. ReDim Descriptions(TotalItemCount)
  641. ReDim Amounts(TotalItemCount)
  642. ReDim IsCredit(TotalItemCount)
  643. ReDim Refs1(TotalItemCount)
  644. ReDim Refs2(TotalItemCount)
  645. for i=1 to TotalItemCount
  646. Accounts(i) = clng(text2value(request.form("Accounts")(i)))
  647. GLAccounts(i) = clng(text2value(request.form("GLAccounts")(i)))
  648. Descriptions(i) = sqlSafe(request.form("Descriptions")(i))
  649. Refs1(i) = sqlSafe(request.form("Refs1")(i))
  650. Refs2(i) = sqlSafe(request.form("Refs2")(i))
  651. credit = cdbl(text2value(request.form("credits")(i)))
  652. debit = cdbl(text2value(request.form("debits")(i)))
  653. if credit <> "" and credit <> "0" then
  654. Amounts(i) = credit
  655. IsCredit(i)= 1
  656. else
  657. Amounts(i) = debit
  658. IsCredit(i)= 0
  659. end if
  660. if Accounts(i) = 0 then Accounts(i) = "NULL"
  661. next
  662. if Err.Number<>0 then
  663. Err.clear
  664. conn.close
  665. response.redirect "top.asp?errMsg=" & Server.URLEncode("!")
  666. end if
  667. ON ERROR GOTO 0
  668. creationDate = shamsiToday()
  669. '---- Checking wether EffectiveDate is valid in current open GL
  670. if (GLMemoDate < session("OpenGLStartDate")) OR (GLMemoDate > session("OpenGLEndDate")) then
  671. Conn.close
  672. response.redirect "?act=editDoc&id="& GLMemoNo & "&errMsg=" & Server.URLEncode("! .")
  673. end if
  674. '----
  675. '----- Check GL is closed
  676. if (session("IsClosed")="True") then
  677. Conn.close
  678. response.redirect "AccountInfo.asp?errMsg=" & Server.URLEncode("! .")
  679. end if
  680. '----
  681. 'response.write "<br>I am going to submit!"
  682. 'response.end
  683. '---- Marking old GLDoc and its GLRows as DELETED
  684. conn.Execute("UPDATE GLRows SET deleted = 1 WHERE (GLDoc = "& GLDoc & ")")
  685. conn.Execute("UPDATE GLDocs SET deleted = 1 WHERE (ID = "& GLDoc & ")")
  686. '----
  687. '---- Creating a new GLDoc
  688. mySQL="INSERT INTO GLDocs (GL, GLDocID, GLDocDate, CreatedDate, createdBy, IsTemporary) VALUES ("& openGL & " , "& GLMemoNo & ", N'"& GLMemoDate & "' , N'"& creationDate & "', "& session("ID") & ", "& IsTemporary & ");SELECT @@Identity AS NewGLDoc"
  689. set RS1 = Conn.execute(mySQL).NextRecordSet
  690. GLDoc = RS1 ("NewGLDoc")
  691. RS1.close
  692. '----
  693. '---- Inserting new GLRows
  694. for i=1 to TotalItemCount
  695. mySQL="INSERT INTO GLRows ( GLDoc, GLAccount, Tafsil, Amount, Description, Ref1, Ref2, IsCredit) VALUES ( "& GLDoc & ", "& GLAccounts(i) & ", "& Accounts(i) & ", "& Amounts(i) & ", N'"& Descriptions(i) & "', N'"& Refs1(i) & "', N'"& Refs2(i) & "', "& IsCredit(i) & ")"
  696. conn.Execute(mySQL)
  697. next
  698. '----
  699. response.redirect "GLMemoDocShow.asp?id="& GLDoc & "&msg=" & Server.URLEncode(" .")
  700. '-----------------------------------------------------------------------------------------------------
  701. '------------------------------------------------------------------------------ Submit new GL Memo Doc
  702. '-----------------------------------------------------------------------------------------------------
  703. elseif request("act")="submitMemo" then
  704. GLMemoDate=request.form("GLMemoDate")
  705. GLMemoNo=request.form("GLMemoNo")
  706. totalDebit = text2value(request.form("totalDebit"))
  707. totalCredit = text2value(request.form("totalCredit"))
  708. creationDate = shamsiToday()
  709. if request.form("submit")=" " then
  710. IsTemporary = 0
  711. else
  712. IsTemporary = 1
  713. end if
  714. if GLMemoNo="" or not(isnumeric(GLMemoNo)) then
  715. ShowErrorMessage("! ")
  716. response.end
  717. end if
  718. '---- Checking wether EffectiveDate is valid in current open GL
  719. if (GLMemoDate < session("OpenGLStartDate")) OR (GLMemoDate > session("OpenGLEndDate")) then
  720. Conn.close
  721. response.write "<BR><BR><BR><CENTER>! .</CENTER>"
  722. response.end
  723. end if
  724. '----
  725. ' Set RS3 = conn.Execute("SELECT * FROM GLDocs WHERE (GLDocID = "& GLMemoNo & ") AND (GL = "& OpenGL & ")")
  726. ' if not RS3.EOF then
  727. ' OldGLMemoDate = RS3("GLDocDate")
  728. ' response.write "<BR><BR><BR><CENTER>! <span dir=ltr> "& OldGLMemoDate & " </span> . </CENTER>"
  729. ' response.end
  730. ' end if
  731. WarningMsg=""
  732. Set RS3=Conn.Execute ("SELECT GLDocID FROM GLDocs WHERE (GLDocID='"& GLMemoNo & "') AND (GL='"& OpenGL & "')")
  733. if not RS3.eof then
  734. Set RS3= Conn.Execute("SELECT Max(GLDocID) AS MaxGLDocID FROM GLDocs WHERE (GL='"& OpenGL & "')")
  735. GLMemoNo=RS3("MaxGLDocID")+1
  736. WarningMsg=" .<br> <B>"& GLMemoNo & "</B> ."
  737. end if
  738. RS3.Close
  739. '----- Check GL is closed
  740. if (session("IsClosed")="True") then
  741. Conn.close
  742. response.redirect "AccountInfo.asp?errMsg=" & Server.URLEncode("! .")
  743. end if
  744. '----
  745. %>
  746. <br><br><br>
  747. <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" width=90% align=center>
  748. <tr>
  749. <td style="width:26; border-right:none;"> # </td>
  750. <td style="width:50; "></td>
  751. <td style="width:170;"> </td>
  752. <td style="width:300;"></td>
  753. <td style="width:80;"></td>
  754. <td style="width:80;"></td>
  755. </tr>
  756. </table>
  757. <TABLE Border="0" width=90% align=center Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855" class="GLTable3">
  758. <Tbody id="GLrows">
  759. <%
  760. mySQL="INSERT INTO GLDocs (GL, GLDocID, GLDocDate, CreatedDate, createdBy, IsTemporary) VALUES ("& OpenGL & " , "& GLMemoNo & ", N'"& GLMemoDate & "' , N'"& creationDate & "', "& session("id") & ", "& IsTemporary & ")"
  761. conn.Execute(mySQL)
  762. mySQL="SELECT max(ID) as GLDoc FROM GLDocs where GLDocID="& GLMemoNo
  763. set RS1=conn.execute(mySQL)
  764. GLDoc=RS1("GLDoc")
  765. for i=1 to request.form("Items").count
  766. GLAccount = text2value(request.form("Items")(i))
  767. accTitle = request.form("accTitles")(i)
  768. theDescription = request.form("Descriptions")(i)
  769. debit = text2value(request.form("debits")(i))
  770. credit = text2value(request.form("credits")(i))
  771. if credit <> "" and credit <> "0" then
  772. Amount = credit
  773. IsCredit = 1
  774. else
  775. Amount = debit
  776. IsCredit = 0
  777. end if
  778. if amount = "" then amount = 0
  779. mySQL="INSERT INTO GLRows ( GLDoc, GLAccount, Amount, Description, IsCredit) VALUES ( "& GLDoc & ", "& GLAccount & ", "& Amount & ", N'"& theDescription & "', "& IsCredit & ")"
  780. conn.Execute(mySQL)
  781. %>
  782. <tr bgcolor='#F0F0F0' >
  783. <td style="width:25; border-right:none;"> <%=i%> </td>
  784. <td style="width:50;"><%=theItem%></td>
  785. <td style="width:170;"><%=accTitle%></td>
  786. <td style="width:300;"><%=theDescription%></td>
  787. <td style="width:80;"><%=debit%></td>
  788. <td style="width:80;"><%=credit%></td>
  789. </tr>
  790. <%
  791. next
  792. %>
  793. </Tbody></TABLE>
  794. <table width="90%" align="center" Cellspacing="0" Cellpadding="0" align=center>
  795. <tr style="border:none;">
  796. <td style="width:26;"></td>
  797. <td style="width:50;"></td>
  798. <td style="width:170;"></td>
  799. <td style="width:300;"></td>
  800. <td style="width:80;"><%=totalDebit%></td>
  801. <td style="width:80;"><%=totalCredit%></td>
  802. </tr>
  803. </TABLE>
  804. <CENTER>
  805. <BR><BR>
  806. ( : <A target=_blank HREF="GLMemoDocShow.asp?id=<%=GLDoc%>"><%=GLMemoNo%></A>)
  807. </CENTER>
  808. <%
  809. 'response.redirect "GLMemoDocShow.asp?id="& GLDoc &"&msg="& Server.URLEncode(" .") &"&errmsg="& Server.URLEncode(WarningMsg)
  810. '-----------------------------------------------------------------------------------------------------
  811. '-----------------------------------------------------------------------------------------------------
  812. '-----------------------------------------------------------------------------------------------------
  813. end if
  814. conn.Close
  815. %>
  816. </font>
  817. <!-- <textarea id="TTT" rows="10" cols="50"></textarea> -->
  818. <% if request("act")="" then%>
  819. <script language="JavaScript">
  820. <!--
  821. function setCurrentRow(rowNo){
  822. if (rowNo == -1) rowNo=0;
  823. invTable=document.getElementById("GLrows");
  824. theTD=invTable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0];
  825. theTD.setAttribute("bgColor", '#F0F0F0');
  826. currentRow=rowNo;
  827. invTable=document.getElementById("GLrows");
  828. theTD=invTable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0];
  829. theTD.setAttribute("bgColor", '#FFB0B0');
  830. }
  831. function delRow(rowNo){
  832. invTable=document.getElementById("GLrows");
  833. theRow=invTable.getElementsByTagName("tr")[rowNo];
  834. invTable.removeChild(theRow);
  835. rowsCount=document.getElementsByName("Items").length;
  836. for (rowNo=0; rowNo < rowsCount ; rowNo++){
  837. tempTD=invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
  838. tempTD.bgColor= '#F0F0F0';
  839. tempTD.innerText= rowNo+1;
  840. }
  841. }
  842. function addRow(){
  843. rowNo = currentRow
  844. invTable=document.getElementById("GLrows");
  845. theRow=invTable.getElementsByTagName("tr")[rowNo];
  846. newRow=document.createElement("tr");
  847. newRow.setAttribute("bgColor", '#f0f0f0');
  848. newRow.setAttribute("onclick", theRow.getAttribute("onclick"));
  849. tempTD=document.createElement("td");
  850. tempTD.innerHTML=rowNo+1
  851. tempTD.setAttribute("align", 'center');
  852. tempTD.setAttribute("width", '26');
  853. newRow.appendChild(tempTD);
  854. tempTD=document.createElement("td");
  855. tempTD.setAttribute("dir", 'LTR');
  856. tempTD.setAttribute("width", '50');
  857. tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Items' onKeyPress='return mask(this);' onBlur='check(this);' onfocus='setCurrentRow(this.parentNode.parentNode.rowIndex);' style='width:100%;' MAXLENGTH=5> "
  858. newRow.appendChild(tempTD);
  859. tempTD=document.createElement("td");
  860. tempTD.setAttribute("width", '170');
  861. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='accTitles' readonly tabIndex=99999999 style='width:100%;' onfocus='this.parentNode.parentNode.getElementsByTagName(\"td\")[3].getElementsByTagName(\"Input\")[0].focus()'>"
  862. newRow.appendChild(tempTD);
  863. tempTD=document.createElement("td");
  864. tempTD.setAttribute("width", '300');
  865. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' style='width:100%;'>"
  866. newRow.appendChild(tempTD);
  867. tempTD=document.createElement("td");
  868. tempTD.setAttribute("dir", 'LTR');
  869. tempTD.setAttribute("width", '80');
  870. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='debits' style='width:100%;' onblur='setPrice(this)' onKeyPress='return onlyNumber(this);' onfocus='this.value=txt2val(this.value);this.select()'>"
  871. newRow.appendChild(tempTD);
  872. tempTD=document.createElement("td");
  873. tempTD.setAttribute("dir", 'LTR');
  874. tempTD.setAttribute("width", '80');
  875. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='credits' style='width:100%;' onblur='setPrice(this)' onKeyPress='return onlyNumber(this);' onfocus='setCurrentRow(this.parentNode.parentNode.rowIndex);this.value=txt2val(this.value);this.select()'>"
  876. newRow.appendChild(tempTD);
  877. invTable.insertBefore(newRow,theRow);
  878. rowsCount=document.getElementsByName("Items").length;
  879. for (rowNo=0; rowNo < rowsCount ; rowNo++){
  880. tempTD=invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
  881. tempTD.bgColor= '#F0F0F0';
  882. tempTD.innerText= rowNo+1;
  883. }
  884. invTable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
  885. // document.all.dddd2.innerText=invTable.innerHTML
  886. }
  887. function setPrice(src){
  888. src.value=val2txt(txt2val(src.value));
  889. rowNo=src.parentNode.parentNode.rowIndex;
  890. if (src.name=="credits" && src.value!=0)
  891. document.getElementsByName("debits")[rowNo].value = ""
  892. if (src.name=="debits" && src.value!=0)
  893. document.getElementsByName("credits")[rowNo].value = ""
  894. if (src.value ==0) src.value=""
  895. if (src.value ==" ") src.value=""
  896. memoIsTaraz();
  897. }
  898. function saveDraft(){
  899. if (document.all.totalDebit.value != 0 || document.all.totalCredit.value != 0)
  900. IsTaraz = true
  901. }
  902. function checkValidation(){
  903. if (IsTaraz==true)
  904. return true
  905. else{
  906. alert("! ")
  907. return false
  908. }
  909. }
  910. function memoIsTaraz(){
  911. var totalCredit = 0;
  912. var totalDebit = 0;
  913. for (rowNo=0; rowNo < document.getElementsByName("debits").length; rowNo++){
  914. totalCredit += parseInt(txt2val(document.getElementsByName("credits")[rowNo].value));
  915. totalDebit += parseInt(txt2val(document.getElementsByName("debits")[rowNo].value));
  916. }
  917. document.all.totalCredit.value = val2txt(totalCredit);
  918. document.all.totalDebit.value = val2txt(totalDebit);
  919. if (totalDebit == totalCredit && totalCredit != 0){
  920. IsTaraz = true
  921. document.all.tarazDiv.innerHTML = "<FONT COLOR='#008833'> </FONT>"
  922. }
  923. else{
  924. IsTaraz = false
  925. document.all.tarazDiv.innerHTML = "<FONT COLOR='#FF3300'> </FONT>"
  926. }
  927. }
  928. var dialogActive=false;
  929. function mask(src){
  930. var theKey=event.keyCode;
  931. rowNo=src.parentNode.parentNode.rowIndex;
  932. invTable=document.getElementById("GLrows");
  933. theRow=invTable.getElementsByTagName("tr")[rowNo];
  934. if (src.name=="Items"){
  935. if (theKey==32){
  936. event.keyCode=9
  937. dialogActive=true
  938. document.all.tmpDlgArg.value="#"
  939. document.all.tmpDlgTxt.value=" :"
  940. var myTinyWindow = window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
  941. if (document.all.tmpDlgTxt.value !="") {
  942. var myTinyWindow = window.showModalDialog('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;');
  943. dialogActive=false
  944. if (document.all.tmpDlgArg.value!="#"){
  945. Arguments=document.all.tmpDlgArg.value.split("#")
  946. src.value=Arguments[0];
  947. invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0].value=Arguments[1];
  948. }
  949. invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[3].getElementsByTagName("Input")[0].focus();
  950. }
  951. }
  952. else if (theKey >= 48 && theKey <= 57 ) {
  953. //alert(theKey)
  954. //src.value=''
  955. return true;
  956. }
  957. else {
  958. return false;
  959. }
  960. }
  961. }
  962. function check(src){
  963. if (src.name=="Items"){
  964. rowNo=src.parentNode.parentNode.rowIndex;
  965. rowsCount=document.getElementsByName("Items").length;
  966. if (!dialogActive){
  967. if (src.value=='0' || src.value==''){
  968. if (rowNo == 0 && rowsCount == 1) {
  969. src.focus();
  970. }
  971. else{
  972. if (confirm(" Ͽ")){
  973. delRow(rowNo);
  974. if (rowNo != rowsCount ){
  975. invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
  976. }else{
  977. invTable.getElementsByTagName("tr")[rowNo-1].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
  978. }
  979. return false;
  980. }
  981. else{
  982. src.focus();
  983. }
  984. }
  985. }
  986. else {
  987. if (window.XMLHttpRequest) {
  988. var objHTTP=new XMLHttpRequest();
  989. } else if (window.ActiveXObject) {
  990. var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
  991. }
  992. objHTTP.open('GET','xml_GLAccount.asp?id='+src.value,false)
  993. objHTTP.send()
  994. tmpStr = unescape( objHTTP.responseText)
  995. invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0].value= tmpStr
  996. if (tmpStr==" ")
  997. {
  998. if (rowNo == 0 && rowsCount == 1) {
  999. src.focus();
  1000. }
  1001. else{
  1002. if (confirm(" Ͽ")){
  1003. delRow(rowNo);
  1004. if (rowNo != rowsCount ){
  1005. invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
  1006. }else{
  1007. invTable.getElementsByTagName("tr")[rowNo-1].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
  1008. }
  1009. return false;
  1010. }
  1011. else{
  1012. src.focus();
  1013. src.select()
  1014. }
  1015. }
  1016. }
  1017. }
  1018. }
  1019. }
  1020. }
  1021. function onlyNumber(src){
  1022. var theKey=event.keyCode;
  1023. if (theKey==13){ // [Enter]
  1024. return true;
  1025. }
  1026. else if (theKey < 48 || theKey > 57) { // 0-9 are acceptible
  1027. return false;
  1028. }
  1029. }
  1030. function areYouSureToExit()
  1031. {
  1032. a= confirm("are you sure?")
  1033. return a
  1034. }
  1035. setPrice(document.all.totalDebit)
  1036. setPrice(document.all.totalCredit)
  1037. if (parseInt(document.all.totalDebit.value)==0) IsTaraz=false;
  1038. //-->
  1039. </SCRIPT>
  1040. <%end if%>
  1041. <!--#include file="tah.asp" -->