/beta/AO/Payroll.asp.tmp

http://github.com/khaneh/Orders · Unknown · 677 lines · 610 code · 67 blank · 0 comment · 0 complexity · bb2067b1e6c37528b696d9255336528f MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'A0 (11 [=B])
  3. PageTitle= "ÍŢćŢ - ćÇă ć ŰíŃĺ"
  4. SubmenuItem=6
  5. if not Auth("B" , 8) 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. .InvHeadInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #CCCC88; text-align:center;}
  21. .InvRowInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right; width:100%;}
  22. .InvRowInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; direction:RTL; 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;}
  29. .GLTable1 { border: none; direction:RTL; border:1px dashed red ;}
  30. .GLTable1 tr {height:20; background-color: #CCCC88; }
  31. .GLTable2 { border: none; direction:RTL;}
  32. .GLTable2 tr {height:20; text-align:center; background-color: #C3C300; }
  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 AO MEMO
  49. '-----------------------------------------------------------------------------------------------------
  50. if request("act")="" then
  51. mySQL="SELECT GLRows.*, Accounts.AccountTitle, GLAccounts.Name AS GLAccountTitle FROM GLRows INNER JOIN GLAccounts ON GLRows.GLAccount = GLAccounts.ID LEFT OUTER JOIN Accounts ON GLRows.Tafsil = Accounts.ID WHERE (GLRows.deleted = 0) AND (GLRows.GLDoc = 30 ) AND (GLAccounts.GL = 84 )"
  52. set RS2=conn.execute(mySQL)
  53. %>
  54. <!-- ćŃćĎ ÇŘáÇÚÇĘ ÓäĎ -->
  55. <br>
  56. <input type="hidden" Name='tmpDlgArg' value=''>
  57. <input type="hidden" Name='tmpDlgTxt' value=''>
  58. <FORM METHOD=POST ACTION="GLMemoInput.asp?act=submitEditMemo" onsubmit="return checkValidation()">
  59. <table class="GLTable1" align="center" Cellspacing="0" Cellpadding="0">
  60. <tr class="GLTR1" align="center" Cellspacing="1" Cellpadding="0">
  61. <TD colspan="10"><TABLE Border="0" Width="100%" Cellspacing="1" Cellpadding="2" Dir="RTL">
  62. <TR>
  63. <TD align="left" >ĎÝĘŃ :</TD>
  64. <TD> <%=OpenGLName%>
  65. </TD>
  66. <TD align="left">ĘÇŃíÎ ÓäĎ :</TD>
  67. <TD>
  68. <INPUT class="GLInput2" style="text-align:left;" NAME="GLMemoDate" TYPE="text" maxlength="10" size="10" value="<%=GLDocDate%>" onblur="acceptDate(this)">
  69. </TD>
  70. <TD align="left">ÔăÇŃĺ ÓäĎ :</TD>
  71. <TD>
  72. <INPUT class="GLInput2" NAME="GLMemoNo" TYPE="text" maxlength="10" size="10" value="<%=id%>" readonly>
  73. </TD>
  74. </TR></TABLE></TD>
  75. </tr>
  76. <tr class="GLTR2">
  77. <TD colspan="10"><div>
  78. <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" >
  79. <tbody id="GLcols">
  80. <tr>
  81. <td style="width:26; border-right:none;"> # </td>
  82. <td style="width:60;">ĘÝŐíáí</td>
  83. <td style="width:40;">ăÚíä</td>
  84. <td style="width:250;">ÔŃÍ</td>
  85. <td style="width:80;">ČĎĺßÇŃ</td>
  86. <td style="width:80;">ČÓĘÇäßÇŃ</td>
  87. <td style="width:50;">ÔăÇŃĺ ß</td>
  88. <td style="width:70;">ĘÇŃíÎ ß</td>
  89. </tr>
  90. </tbody>
  91. </TABLE></div></TD>
  92. </tr>
  93. <tr>
  94. <TD colspan="10"><div style="overflow:auto; height:250px; width:*;">
  95. <TABLE Border="0" Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855" class="GLTable3" onclick='setCurrentCell()'>
  96. <Tbody id="GLrows">
  97. <%
  98. i = 0
  99. Do while not RS2.eof
  100. i = i + 1
  101. GLAccount = RS2("GLAccount")
  102. GLAccTitle = RS2("GLAccountTitle")
  103. Tafsil = RS2("Tafsil")
  104. AccTitle = RS2("AccountTitle")
  105. Description = RS2("Description")
  106. Ref1 = RS2("Ref1")
  107. Ref2 = RS2("Ref2")
  108. Amount = RS2("Amount")
  109. IsCredit = RS2("IsCredit")
  110. credit = ""
  111. debit = ""
  112. if IsCredit then
  113. credit = Amount
  114. totalCredit = totalCredit + cdbl(Amount)
  115. else
  116. debit = Amount
  117. totalDebit = totalDebit + cdbl(Amount)
  118. end if
  119. %>
  120. <tr bgcolor='#F0F0F0'>
  121. <td style="width:25; border-right:none;" align=center> <%=i%> </td>
  122. <td width="60">
  123. <INPUT class='InvRowInput' TYPE='text' NAME='Accounts' maxlength=6 value="<%=Tafsil%>" title="<%=AccTitle%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
  124. <td width="40">
  125. <INPUT class='InvRowInput2' TYPE='text' NAME='GLAccounts' maxlength=5 value="<%=GLAccount%>" title="<%=GLAccTitle%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
  126. <td width="250">
  127. <INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' value="<%=Description%>" onKeyPress='return mask(this);'></td>
  128. <td width="80">
  129. <INPUT class='InvRowInput2' TYPE='text' NAME='debits' value="<%=Separate(debit)%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
  130. <td width="80">
  131. <INPUT class='InvRowInput2' TYPE='text' NAME='credits' value="<%=Separate(credit)%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
  132. <td width="50">
  133. <INPUT class='InvRowInput2' TYPE='text' NAME='Refs1' maxlength=20 value="<%=Ref1%>" onKeyPress='return mask(this);'> </td>
  134. <td width="70">
  135. <INPUT class='InvRowInput' TYPE='text' NAME='Refs2' maxlength=20 value="<%=Ref2%>" onKeyPress='return mask(this);' onBlur='acceptDate(this);'> </td>
  136. </tr>
  137. <%
  138. RS2.movenext
  139. Loop
  140. %>
  141. <tr bgcolor='#F0F0F0'>
  142. <td colspan="15">
  143. <INPUT class="InvGenButton" TYPE="button" value="ÇÖÇÝĺ" onClick="addRow();">
  144. </td>
  145. </tr>
  146. </Tbody>
  147. </TABLE></div>
  148. </TD>
  149. </tr>
  150. <tr class="GLTR2">
  151. <TD colspan="10"><div>
  152. <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" style="border-top:1 solid red;">
  153. <tr>
  154. <td colspan=3 style="width:256;">
  155. <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>
  156. <td style="width:122; text-align:left;">ĚăÚ ČĎĺßÇŃ:</td>
  157. <td style="width:80;"><input type=text name="totalDebit" id="totalDebit" style="width:80;border:none; background:none;" value=<%=Separate(totalCredit)%>></td>
  158. <td style="width:80;"><input type=text name="totalCredit" id="totalCredit" style="width:80;border:none; background:none;" value=<%=Separate(totalDebit)%>></td>
  159. <td colspan=2 style="width:122; text-align:right;">:ĚăÚ ČÓĘÇäßÇŃ</td>
  160. </tr>
  161. </TABLE></div></TD>
  162. </tr>
  163. </table><br>
  164. <TABLE Border="0" Cellspacing="5" Cellpadding="0" Dir="RTL" align='left'>
  165. <tr>
  166. <td align='center'>
  167. <INPUT TYPE="hidden" name="GLDoc" value="<%=GLDoc%>">
  168. <INPUT class="InvGenButton" TYPE="submit" name="submit" value="ĐÎíŃĺ Čĺ ŐćŃĘ íÇĎĎÇÔĘ" onclick="saveDraft()">
  169. <INPUT class="InvGenButton" TYPE="submit" value="ĐÎíŃĺ "></td>
  170. <td align='center'><INPUT class="InvGenButton" TYPE="button" value="ÇäŐŃÇÝ" onclick="history.back()"></td>
  171. </tr>
  172. </TABLE>
  173. </FORM>
  174. <script language="JavaScript">
  175. <!--
  176. var dialogActive=false;
  177. function mask(src){
  178. var theKey=event.keyCode;
  179. /*
  180. rowNo=src.parentNode.parentNode.rowIndex;
  181. RTable=document.getElementById("GLrows");
  182. theRow=RTable.getElementsByTagName("tr")[rowNo];
  183. */
  184. if (src.name=="Accounts"){
  185. if (theKey==13){
  186. event.keyCode=0;
  187. dialogActive=true;
  188. document.all.tmpDlgArg.value="#"
  189. document.all.tmpDlgTxt.value="ĚÓĘĚć ĎŃ äÇă ÍÓÇČ ĺÇí ĘÝŐíáí:"
  190. 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;');
  191. dialogActive=false;
  192. if (document.all.tmpDlgTxt.value !="") {
  193. 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;');
  194. if (document.all.tmpDlgArg.value!="#"){
  195. Arguments=document.all.tmpDlgArg.value.split("#")
  196. src.value=Arguments[0];
  197. src.title=Arguments[1];
  198. }
  199. }
  200. // src.parentNode.nextSibling.getElementsByTagName("INPUT")[0].focus();
  201. }
  202. else if (theKey >= 48 && theKey <= 57 )
  203. return true;
  204. else
  205. return false;
  206. }
  207. else if (src.name=="GLAccounts"){
  208. if (theKey==13){
  209. event.keyCode=0;
  210. dialogActive=true;
  211. document.all.tmpDlgArg.value="#"
  212. document.all.tmpDlgTxt.value="ĚÓĘĚć ĎŃ äÇă ÍÓÇČ ĺÇí ĎÝĘŃ ßá:"
  213. 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;');
  214. dialogActive=false;
  215. if (document.all.tmpDlgTxt.value !="") {
  216. 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;');
  217. if (document.all.tmpDlgArg.value!="#"){
  218. Arguments=document.all.tmpDlgArg.value.split("#")
  219. src.value=Arguments[0];
  220. src.title=Arguments[1];
  221. }
  222. }
  223. // src.parentNode.nextSibling.getElementsByTagName("INPUT")[0].focus();
  224. }
  225. else if (theKey >= 48 && theKey <= 57 ) // [0]-[9] are acceptible
  226. return true;
  227. else
  228. return false;
  229. }
  230. else if (src.name=="debits" || src.name=="credits" || src.name=="Refs1"){
  231. if (theKey < 48 || theKey > 57) { // [0]-[9] are acceptible
  232. return false;
  233. }
  234. return true;
  235. }
  236. else if (src.name=="Descriptions" || src.name=="Refs2"){
  237. if (theKey==13){ // [Enter]
  238. return false;
  239. }
  240. return true;
  241. }
  242. }
  243. function check(src){
  244. if (src.name=="Accounts"){
  245. if (!dialogActive){
  246. var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
  247. objHTTP.Open('GET','xml_CustomerAccount.asp?id='+src.value,false)
  248. objHTTP.Send()
  249. tmpStr = unescape( objHTTP.responseText)
  250. src.title=tmpStr;
  251. if (tmpStr=="äíä ÍÓÇČí ćĚćĎ äĎÇŃĎ"){
  252. src.value="";
  253. }
  254. }
  255. }
  256. else if(src.name=="GLAccounts"){
  257. if (!dialogActive){
  258. var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
  259. objHTTP.Open('GET','xml_GLAccount.asp?id='+src.value,false)
  260. objHTTP.Send()
  261. tmpStr = unescape( objHTTP.responseText)
  262. src.title=tmpStr;
  263. if (tmpStr=="äíä ÍÓÇČí ćĚćĎ äĎÇŃĎ"){
  264. src.value="";
  265. }
  266. }
  267. }
  268. else if(src.name=="debits" || src.name=="credits"){
  269. src.value=val2txt(txt2val(src.value));
  270. if (''+src.value=="NaN" || src.value=="0") src.value = ""
  271. rowNo=src.parentNode.parentNode.rowIndex;
  272. if (src.value!=""){
  273. if (src.name=="credits")
  274. document.getElementsByName("debits")[rowNo].value = "";
  275. else
  276. document.getElementsByName("credits")[rowNo].value = "";
  277. }
  278. memoIsTaraz();
  279. }
  280. }
  281. function checkValidation(){
  282. emptySlot=-1;
  283. for (rowNo=0; rowNo < lastRow; rowNo++){
  284. if(document.getElementsByName("GLAccounts")[rowNo].value==''){
  285. emptySlot=rowNo;
  286. }
  287. }
  288. if (emptySlot != -1){
  289. errObj=document.getElementsByName("GLAccounts")[emptySlot];
  290. errObj.style.backgroundColor="red";
  291. document.getElementsByName("GLAccounts")[emptySlot].focus();
  292. alert('Çíä ÓŘŃ Čí ăÚäí ÇÓĘ\n\nÇŃ ăí ÎćÇĺíĎ Âä ŃÇ ÍĐÝ ßäíĎ\n[Ctrl]+[Del]\nČŇäíĎ.');
  293. errObj.style.backgroundColor="";
  294. return false;
  295. }
  296. if (IsTaraz==true)
  297. return true
  298. else{
  299. alert("ÎŘÇ! ÓäĎ ĘŃÇŇ äíÓĘ")
  300. return false
  301. }
  302. }
  303. function saveDraft(){
  304. if (document.all.totalDebit.value != 0 || document.all.totalCredit.value != 0)
  305. IsTaraz = true
  306. }
  307. function memoIsTaraz(){
  308. var totalCredit = 0;
  309. var totalDebit = 0;
  310. for (rowNo=0; rowNo < lastRow; rowNo++){
  311. totalCredit += parseInt(txt2val(document.getElementsByName("credits")[rowNo].value));
  312. totalDebit += parseInt(txt2val(document.getElementsByName("debits")[rowNo].value));
  313. }
  314. document.all.totalCredit.value = val2txt(totalCredit);
  315. document.all.totalDebit.value = val2txt(totalDebit);
  316. if (totalDebit == totalCredit && totalCredit != 0){
  317. IsTaraz = true
  318. document.all.tarazDiv.innerHTML = "<FONT COLOR='#008833'>ÓäĎ ĘŃÇŇ ÇÓĘ</FONT>"
  319. }
  320. else{
  321. IsTaraz = false
  322. document.all.tarazDiv.innerHTML = "<FONT COLOR='#FF3300'>ÓäĎ ĘŃÇŇ äíÓĘ</FONT>"
  323. }
  324. }
  325. var currentRow=0;
  326. var lastRow=<%=i%>;
  327. var currentCol=1;
  328. var lastCol=7;
  329. function documentKeyDown() {
  330. var theKey = event.keyCode;
  331. /*
  332. Arrow Keys' Codes:
  333. < 37 (Left)
  334. ^ 38 (Up)
  335. > 39 (Right)
  336. v 40 (Down)
  337. */
  338. if (event.ctrlKey && !event.shiftKey)
  339. Ctrl=true;
  340. else
  341. Ctrl=false;
  342. if (theKey==9){
  343. Ctrl=true;
  344. if (event.shiftKey){
  345. theKey = 39;
  346. }
  347. else
  348. theKey = 37;
  349. }
  350. else if ((theKey == 45) && Ctrl){ // [Ins] Key + [ctrl]
  351. event.keyCode=36; // [Home] Key
  352. addRow();
  353. }
  354. else if ((theKey == 46) && Ctrl){ // [Del] Key + [ctrl]
  355. event.keyCode=36; // [Home] Key
  356. delRow()
  357. }
  358. if (((theKey == 37 || theKey == 39) && Ctrl) || theKey == 38 || theKey == 40){
  359. deactivateCurrentCell();
  360. switch (theKey){
  361. case 37:
  362. if (currentCol < lastCol)
  363. currentCol++;
  364. else{
  365. currentCol=1;
  366. if(currentRow<lastRow)
  367. currentRow++;
  368. }
  369. break;
  370. case 38:
  371. if (currentRow > 0)
  372. currentRow--;
  373. else
  374. currentRow=lastRow;
  375. break;
  376. case 39:
  377. if (currentCol > 1)
  378. currentCol--;
  379. else{
  380. currentCol=lastCol;
  381. if(currentRow>0)
  382. currentRow--;
  383. }
  384. break;
  385. case 40:
  386. if (currentRow < lastRow)
  387. currentRow++;
  388. else
  389. currentRow=0;
  390. break;
  391. default:
  392. break;
  393. }
  394. activateCurrentCell();
  395. event.keyCode=36; // [Home] Key
  396. }
  397. }
  398. function deactivateCurrentCell(){
  399. Rtable=document.getElementById("GLrows");
  400. Ctable=document.getElementById("GLcols");
  401. Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0].setAttribute("bgColor", '#F0F0F0');
  402. Ctable.getElementsByTagName("tr")[0].getElementsByTagName("td")[currentCol].setAttribute("bgColor", '#F0F0F0');
  403. tmpCell=Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[currentCol];
  404. if (tmpCell){
  405. tmpCell.setAttribute("bgColor", '');
  406. }
  407. }
  408. function activateCurrentCell(){
  409. Rtable=document.getElementById("GLrows");
  410. Ctable=document.getElementById("GLcols");
  411. Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0].setAttribute("bgColor", '#FFB0B0');
  412. Ctable.getElementsByTagName("tr")[0].getElementsByTagName("td")[currentCol].setAttribute("bgColor", '#FFB0B0');
  413. tmpCell=Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[currentCol];
  414. if (tmpCell){
  415. tmpCell.setAttribute("bgColor", '#FF0000');
  416. tmpCell.getElementsByTagName("input")[0].focus();
  417. }
  418. if(currentRow==lastRow){
  419. document.getElementById("GLrows").getElementsByTagName("tr")[currentRow].getElementsByTagName("INPUT")[0].focus();
  420. }
  421. }
  422. function setCurrentCell(){
  423. tmpRow=event.srcElement.parentNode.parentNode.rowIndex;
  424. tmpCol=event.srcElement.parentNode.cellIndex;
  425. if(tmpCol>0 && tmpRow>=0){
  426. deactivateCurrentCell();
  427. currentRow =tmpRow;
  428. currentCol=tmpCol;
  429. activateCurrentCell();
  430. }
  431. else if(event.srcElement.parentNode.rowIndex){
  432. deactivateCurrentCell();
  433. currentRow =event.srcElement.parentNode.rowIndex;
  434. currentCol=1;
  435. activateCurrentCell();
  436. }
  437. }
  438. function delRow(){
  439. if (currentRow==lastRow)
  440. return;
  441. deactivateCurrentCell();
  442. rowNo = currentRow
  443. Rtable=document.getElementById("GLrows");
  444. theRow=Rtable.getElementsByTagName("tr")[rowNo];
  445. Rtable.removeChild(theRow);
  446. lastRow--;
  447. for (rowNo=0; rowNo < lastRow ; rowNo++){
  448. tempTD=Rtable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
  449. tempTD.bgColor= '#F0F0F0';
  450. tempTD.innerText= rowNo+1;
  451. }
  452. activateCurrentCell();
  453. }
  454. function addRow(){
  455. deactivateCurrentCell();
  456. rowNo = currentRow
  457. Rtable=document.getElementById("GLrows");
  458. theRow=Rtable.getElementsByTagName("tr")[rowNo];
  459. newRow=document.createElement("tr");
  460. newRow.setAttribute("bgColor", '#f0f0f0');
  461. tempTD=document.createElement("td");
  462. tempTD.innerHTML=rowNo+1
  463. tempTD.setAttribute("align", 'center');
  464. tempTD.setAttribute("width", '25');
  465. newRow.appendChild(tempTD);
  466. tempTD=document.createElement("td");
  467. tempTD.setAttribute("width", '60');
  468. tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Accounts' maxlength=6 onKeyPress='return mask(this);' onBlur='check(this);'>"
  469. newRow.appendChild(tempTD);
  470. tempTD=document.createElement("td");
  471. tempTD.setAttribute("width", '40');
  472. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='GLAccounts' maxlength=5 onKeyPress='return mask(this);' onBlur='check(this);'>"
  473. newRow.appendChild(tempTD);
  474. tempTD=document.createElement("td");
  475. tempTD.setAttribute("width", '250');
  476. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' onKeyPress='return mask(this);'>"
  477. newRow.appendChild(tempTD);
  478. tempTD=document.createElement("td");
  479. tempTD.setAttribute("width", '80');
  480. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='debits' onKeyPress='return mask(this);' onBlur='check(this);'>"
  481. newRow.appendChild(tempTD);
  482. tempTD=document.createElement("td");
  483. tempTD.setAttribute("width", '80');
  484. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='credits' onKeyPress='return mask(this);' onBlur='check(this);'>"
  485. newRow.appendChild(tempTD);
  486. tempTD=document.createElement("td");
  487. tempTD.setAttribute("width", '50');
  488. tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Refs1' maxlength=20 onKeyPress='return mask(this);'>"
  489. newRow.appendChild(tempTD);
  490. tempTD=document.createElement("td");
  491. tempTD.setAttribute("width", '70');
  492. tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Refs2' maxlength=20 onKeyPress='return mask(this);' onBlur='acceptDate(this);'>"
  493. newRow.appendChild(tempTD);
  494. Rtable.insertBefore(newRow,theRow);
  495. lastRow++;
  496. for (rowNo=0; rowNo < lastRow ; rowNo++){
  497. tempTD=Rtable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
  498. tempTD.bgColor= '#F0F0F0';
  499. tempTD.innerText= rowNo+1;
  500. }
  501. activateCurrentCell();
  502. }
  503. document.onkeydown = documentKeyDown;
  504. activateCurrentCell();
  505. memoIsTaraz();
  506. //-->
  507. </script>
  508. <%
  509. '-----------------------------------------------------------------------------------------------------
  510. '---------------------------------------------------------------------------------- Submit new AO MEMO
  511. '-----------------------------------------------------------------------------------------------------
  512. elseif request("act")="submit" then
  513. response.write "ok"
  514. response.end
  515. creationDate=shamsiToday()
  516. successCount=0
  517. for i=1 to request.form("Accounts").count
  518. errorFound=false
  519. ON ERROR RESUME NEXT
  520. Account = clng(text2value(request.form("Accounts")(i)))
  521. firstGLAccount= clng(text2value(request.form("firstGLAccounts")(i)))
  522. GLAccount = clng(text2value(request.form("GLAccounts")(i)))
  523. Amount = cdbl(text2value(request.form("Amounts")(i)))
  524. Description= sqlSafe(request.form("Descriptions")(i))
  525. EffectiveDate = sqlSafe(request.form("EffectiveDates")(i))
  526. if request.form("isCredits")(i) then
  527. isCredit = 1
  528. else
  529. isCredit = 0
  530. end if
  531. if Err.Number<>0 then
  532. Err.clear
  533. errorFound=True
  534. end if
  535. if NOT errorFound then
  536. ' checking firstGLAccount is valid
  537. mySQL = "SELECT ID FROM GLAccounts WHERE (HasAppendix = 1) AND (GL = "& openGL & ") AND (ID = "& firstGLAccount & ")"
  538. Set RS1=Conn.execute(mySQL)
  539. if RS1.eof then
  540. errorFound=True
  541. end if
  542. RS1.close
  543. mySQL = "SELECT ItemReason FROM AXItemReasonGLAccountRelations WHERE (GL = "& openGL & ") AND (GLAccount = "& firstGLAccount & ")"
  544. Set RS1=Conn.execute(mySQL)
  545. if RS1.eof then
  546. 'Using default reason (sys: AO, reason: Misc.)
  547. Reason=6
  548. else
  549. Reason= cint(RS1("ItemReason"))
  550. end if
  551. RS1.close
  552. mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
  553. Set RS1=Conn.execute(mySQL)
  554. sys= RS1("Acron")
  555. ReasonName = RS1("Name")
  556. RS1.close
  557. ' ---------
  558. '---- Checking wether EffectiveDate is valid in current open GL
  559. if (effectiveDate < session("OpenGLStartDate")) OR (effectiveDate > session("OpenGLEndDate")) then
  560. errorFound=True
  561. end if
  562. '----
  563. end if
  564. ON ERROR GOTO 0
  565. if errorFound then
  566. response.write "<br>"
  567. errMsg="ÎŘÇ!<br>ÎŘ ČÇ ăÔÎŐÇĘ ŃíŇ ÇÖÇÝĺ äÔĎ:<br>"
  568. errMsg=errMsg& "ÍÓÇČ:" & firstGLAccount & "-" & Account & "<br>"
  569. errMsg=errMsg& "ăČáŰ:" & Amount & "<br>"
  570. errMsg=errMsg& "ÔŃÍ:" & Description & "<br>"
  571. errMsg=errMsg& "ŘŃÝ ăÚíä:" & GLAccount & "<br>"
  572. errMsg=errMsg& "ĘÇŃíÎ :" & effectiveDate & "<br>"
  573. call showAlert (errMsg,CONST_MSG_ERROR)
  574. else
  575. '**************************** Creating Memo ****************
  576. 'MemoType = 1 means Misc. Memo
  577. mySQL="INSERT INTO "& sys & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Amount, Description) VALUES (N'"& effectiveDate & "' , "& session("id") & ", 1, "& Account & ", "& IsCredit & ", "& Amount & ", N'"& Description & "');SELECT @@Identity AS NewMemo"
  578. Set RS1 = conn.Execute(mySQL).NextRecordSet
  579. MemoID=RS1("NewMemo")
  580. RS1.close
  581. '**************************** Creating an Item for Memo ****************
  582. '*** Type = 3 means Item is a Memo
  583. mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, Link, Reason, CreatedDate, CreatedBy, Type, IsCredit, AmountOriginal, RemainedAmount) VALUES ("&_
  584. GLAccount & ", "& OpenGL & ", "& firstGLAccount & ", "& Account & ", N'"& effectiveDate & "', "& MemoID & ", "& Reason & ", N'"& creationDate & "' , "& session("id") & ", 3, "& IsCredit & ", "& Amount & ","& Amount & ")"
  585. conn.Execute(mySQL)
  586. if IsCredit then
  587. mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& Amount & "' WHERE (ID='"& Account & "')"
  588. else
  589. mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& Amount & "' WHERE (ID='"& Account & "')"
  590. end if
  591. conn.Execute(mySQL)
  592. '***------------------------- Creating an Item for Memo ----------------
  593. successCount = successCount + 1
  594. msg="ÇÚáÇăíĺ <A Href='../"& sys & "/AccountReport.asp?act=showMemo&sys="& sys & "&memo=" & MemoID &"' target='_blank'>"& MemoID & "</a> ËČĘ ÔĎ."
  595. response.write "<br>"
  596. call showAlert (msg,CONST_MSG_INFORM)
  597. end if
  598. next
  599. response.write "<br>"
  600. response.write "<hr width='70%'>"
  601. response.write "<br>"
  602. call showAlert (successCount & " ÇÚáÇăíĺ ČÇ ăćÝŢíĘ ÇíĚÇĎ ÔĎ.",CONST_MSG_INFORM)
  603. '-----------------------------------------------------------------------------------------------------
  604. '-----------------------------------------------------------------------------------------------------
  605. '-----------------------------------------------------------------------------------------------------
  606. end if
  607. conn.Close
  608. %>
  609. </font>
  610. <!--#include file="tah.asp" -->