/beta/bank/cheq.asp

http://github.com/khaneh/Orders · ASP · 701 lines · 597 code · 66 blank · 38 comment · 81 complexity · 61989798c9f88001aaec63023af00b75 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Bank (10 [=A])
  3. PageTitle= " "
  4. SubmenuItem=1
  5. if not Auth("A" , 1) then NotAllowdToViewThisPage()
  6. sendTo = session("id")
  7. editFlag = 0
  8. %>
  9. <!--#include file="top.asp" -->
  10. <!--#include File="../include_farsiDateHandling.asp"-->
  11. <!--#include File="../include_JS_InputMasks.asp"-->
  12. <style>
  13. .RcpTable { font-family:tahoma; font-size: 9pt; border:0; padding:0; }
  14. .RcpMainTable { font-family:tahoma; font-size: 9pt; border:0; padding:0; background-color: #558855; text-align:right; direction: RTL;}
  15. .RcpMainTableTH { background-color: #C3C300;}
  16. .RcpMainTableTR { background-color: #CCCC88; border: 0; }
  17. .RcpRowInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right;}
  18. .RcpRowInput2 { font-family:tahoma; font-size: 9pt; border: 1px solid black; background-color: #F0F0F0; text-align:right;}
  19. .RcpHeadInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #CCCC88; text-align:center;}
  20. .RcpHeadInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #AACC77; text-align:center;}
  21. .RcpHeadInput3 { font-family:tahoma; font-size: 9pt; border: 1px solid black; background-color: #D0E0FF; text-align:right; direction: right-to-left;}
  22. .RcpGenInput { font-family:tahoma; font-size: 9pt; border: none; text-align:right; direction: LTR;}
  23. .GenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; }
  24. .CustGenTable { font-family:tahoma; font-size: 9pt;}
  25. .CustGenInput { font-family:tahoma; font-size: 9pt;}
  26. </STYLE>
  27. <SCRIPT LANGUAGE="JavaScript">
  28. <!--
  29. var okToProceed=false;
  30. var currentRow=null;
  31. var tempKeyBuffer;
  32. function myKeyDownHandler(){
  33. tempKeyBuffer=window.event.keyCode;
  34. }
  35. function myKeyPressHandler(){
  36. // alert (tempKeyBuffer)
  37. if (tempKeyBuffer>=65 && tempKeyBuffer<=90){
  38. window.event.keyCode=tempKeyBuffer+32;
  39. }
  40. else if(tempKeyBuffer==186){
  41. window.event.keyCode=59;
  42. }
  43. else if(tempKeyBuffer==188){
  44. window.event.keyCode=44;
  45. }
  46. else if(tempKeyBuffer==190){
  47. window.event.keyCode=46;
  48. }
  49. else if(tempKeyBuffer==191){
  50. window.event.keyCode=47;
  51. }
  52. else if(tempKeyBuffer==192){
  53. window.event.keyCode=96;
  54. }
  55. else if(tempKeyBuffer>=219 && tempKeyBuffer<=221){
  56. window.event.keyCode=tempKeyBuffer-128;
  57. }
  58. else if(tempKeyBuffer==222){
  59. window.event.keyCode=39;
  60. }
  61. }
  62. //-->
  63. </SCRIPT>
  64. <font face="tahoma">
  65. <!-- <div dir='rtl'><B> </B>
  66. </div> -->
  67. <%
  68. '-----------------------------------------------------------------------------------------------------
  69. '--------------------------------------------------------------------------------------- Submit Search
  70. '-----------------------------------------------------------------------------------------------------
  71. if request("act")="submit search" then
  72. if request("CustomerNameSearchBox") <> "" then
  73. SA_TitleOrName=sqlSafe(request("CustomerNameSearchBox"))
  74. mySQL="SELECT * FROM Accounts WHERE (REPLACE(AccountTitle, ' ', '') LIKE REPLACE(N'%"& SA_TitleOrName & "%', ' ', '') ) ORDER BY AccountTitle"
  75. Set RS1 = conn.Execute(mySQL)
  76. if (RS1.eof) then
  77. response.redirect "?errmsg=" & Server.URLEncode(" .<br><a href='../CRM/AccountEdit.asp?act=getAccount'> Ͽ</a>")
  78. ' Not Found %>
  79. <div dir='rtl'><B> </B> &nbsp; <A HREF="cheq.asp" style='font-size:7pt;'> </A>
  80. </div><br>
  81. <% else
  82. SA_TitleOrName=request("CustomerNameSearchBox")
  83. SA_Action="return true;"
  84. SA_SearchAgainURL="cheq.asp"
  85. SA_StepText=" : "
  86. %>
  87. <FORM METHOD=POST ACTION="cheq.asp?act=enterCheque">
  88. <!--#include File="../AR/include_SelectAccount.asp"-->
  89. </FORM>
  90. <%
  91. end if
  92. end if
  93. '-----------------------------------------------------------------------------------------------------
  94. '-------------------------------------------------------------------------------------- Submit Payment
  95. '-----------------------------------------------------------------------------------------------------
  96. elseif request("act")="submitPayment" or editFlag = 1 then
  97. ON ERROR RESUME NEXT
  98. errorFound=false
  99. CustomerID= clng(request.form("CustomerID"))
  100. accountID= clng(request.form("accountID"))
  101. TotalAmount= cdbl(text2value(request.form("TotalAmount")))
  102. VouchIDS= request.form("VouchID")
  103. VoucherTotalPrices= request.form("VoucherTotalPrice")
  104. SumVoucherTotalPrice= cdbl(request.form("SumVoucherTotalPrice"))
  105. Reason= cint(request.form("Reason"))
  106. if Err.Number<>0 then
  107. 'Err.clear
  108. errorFound= true
  109. 'errorMsg= Server.URLEncode("!")
  110. errorMsg= Err.Description
  111. response.write errorMsg
  112. response.end
  113. end if
  114. if NOT errorFound then
  115. effectiveDate= sqlSafe(request.form("PaymentDate"))
  116. '---- Checking wether EffectiveDate is valid in current open GL
  117. if (effectiveDate < session("OpenGLStartDate")) OR (effectiveDate > session("OpenGLEndDate")) then
  118. errorFound= true
  119. errorMsg= Server.URLEncode("!<br> .")
  120. end if
  121. '----
  122. '----- Check GL is closed
  123. if (session("IsClosed")="True") then
  124. 'Conn.close
  125. errorFound=true
  126. errorMsg= Server.URLEncode("! .")
  127. end if
  128. '----
  129. if TotalAmount=0 then
  130. errorFound= true
  131. errorMsg= Server.URLEncode("<B>! </B><BR> <BR>")
  132. end if
  133. CheqsCount=request.form("ChequeNos").count
  134. for i = 1 to CheqsCount
  135. ChequeNo = clng(request.form("ChequeNos")(i))
  136. ChequeDate = sqlSafe(request.form("ChequeDates")(i))
  137. Banker = cint(request.form("Banks")(i))
  138. Description = sqlSafe(request.form("Description")(i))
  139. Amount = cdbl(text2value(request.form("Amounts")(i)))
  140. if ChequeNo=0 or Banker=-1 or Amount=0 then ' -- or ChequeDate=""
  141. errorFound= true
  142. errorMsg= Server.URLEncode("<B>! </B><BR> <BR>")
  143. end if
  144. '---------------------SAM---------------------------------------------------------------
  145. set che = conn.execute("Select COUNT(*) AS cheque From PaidCheques inner join Payments on PaidCheques.payment = Payments.ID Where PaidCheques.ChequeNo = " & ChequeNo & " AND PaidCheques.ChequeDate = N'" & ChequeDate & "' AND Payments.Voided = 0")
  146. if cdbl(che("cheque")) > 0 then
  147. errorFound = true
  148. errorMsg = Server.URLEncode("<B>! </B><br> <br>")
  149. call showAlert ("<B>! </B><br> <b>",CONST_MSG_ERROR)
  150. end if
  151. che.close
  152. next
  153. end if
  154. if Err.Number<>0 then
  155. 'Err.clear
  156. errorFound= true
  157. 'errorMsg= Server.URLEncode("!")
  158. errorMsg= Err.Description
  159. end if
  160. ON ERROR GOTO 0
  161. if errorFound then
  162. conn.close
  163. response.redirect "?act=getPayment&selectedCustomer="& CustomerID & "&Reason="& Reason & "&errMsg=" & errorMsg
  164. end if
  165. mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
  166. Set RS1=Conn.execute(mySQL)
  167. if RS1.eof then
  168. conn.close
  169. response.redirect "top.asp?errMsg=" & Server.URLEncode("!")
  170. else
  171. Sys= RS1("Acron")
  172. firstGLAccount = accountID
  173. end if
  174. RS1.close
  175. RemainedTotalAmount = TotalAmount
  176. creationDate= shamsiToday()
  177. creationTime= currentTime10()
  178. GLAccount= "NULL"
  179. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  180. dim APRemainedAmount(10)
  181. dim APCreditID(10)
  182. dim relationAmount(10)
  183. dim n
  184. if SumVoucherTotalPrice <> 0 and VouchIDS<>"" then 'Balance this payment with a previous APItem.
  185. VouchID = split(VouchIDS, ",")
  186. VoucherTotalPrice = split(VoucherTotalPrices, ",")
  187. n = ubound(VouchID)
  188. for vch = 0 to n
  189. set RSB=Conn.Execute ("SELECT * FROM APItems WHERE (Type=6 and Link="& VouchID(vch) & ")" )
  190. if RSB.EOF then
  191. response.write "<br><BR>"
  192. call showAlert ("<B>! </B><BR> . <br> .<BR>",CONST_MSG_ERROR)
  193. response.end
  194. end if
  195. if not trim(VoucherTotalPrice(vch)) = trim(RSB("AmountOriginal")) then
  196. response.write "<br><BR>"
  197. call showAlert ("<B>! </B><BR> . <br> .<BR>",CONST_MSG_ERROR)
  198. response.end
  199. end if
  200. APRemainedAmount(vch) = cdbl(RSB("RemainedAmount"))
  201. APCreditID(vch) = RSB("ID")
  202. next
  203. for vch = 0 to n
  204. if RemainedTotalAmount = 0 then
  205. relationAmount(vch) = 0
  206. else
  207. if APRemainedAmount(vch) > RemainedTotalAmount then
  208. mySQL="UPDATE "& sys & "Items SET RemainedAmount='"& APRemainedAmount(vch) - RemainedTotalAmount & "' WHERE (ID='"& APCreditID(vch) & "')"
  209. conn.Execute(mySQL)
  210. relationAmount(vch) = RemainedTotalAmount
  211. RemainedTotalAmount = 0
  212. else
  213. mySQL="UPDATE "& sys & "Items SET RemainedAmount='"& 0 & "' WHERE (ID='"& APCreditID(vch) & "')"
  214. conn.Execute(mySQL)
  215. RemainedTotalAmount = RemainedTotalAmount - APRemainedAmount(vch)
  216. Conn.Execute ("UPDATE Vouchers SET paid = 1 WHERE (id = "& VouchID(vch) & ")")
  217. relationAmount(vch) = APRemainedAmount(vch)
  218. end if
  219. end if
  220. next
  221. end if
  222. '************* Inserting the Payment
  223. mySQL="INSERT INTO Payments (SYS, Account, CashAmount, ChequeAmount, CreatedBy, CreationDate, CreationTime, EffectiveDate) VALUES ('"& sys & "', "& customerID & ", 0, " & TotalAmount & ","& session("id") & ", N'"& creationDate & "', N'"& creationTime & "', N'"& effectiveDate & "');SELECT @@Identity AS NewPayment"
  224. set RSE = Conn.execute(mySQL).NextRecordSet
  225. paymentID = RSE ("NewPayment")
  226. RSE.close
  227. set RSE = Nothing
  228. '************* Inserting Cheques
  229. for i = 1 to CheqsCount
  230. ChequeNo = clng(request.form("ChequeNos")(i))
  231. ChequeDate = sqlSafe(request.form("ChequeDates")(i))
  232. Banker = cint(request.form("Banks")(i))
  233. Description = sqlSafe(request.form("Description")(i))
  234. Amount = cdbl(text2value(request.form("Amounts")(i)))
  235. conn.Execute("INSERT INTO PaidCheques (Payment, CreatedDate, CreatedBy, ChequeNo, ChequeDate, Amount, Banker, Status, StatusSetBy, StatusSetDate, Description) VALUES ("& paymentID & ",N'"& creationDate & "','"& session("ID") & "',"& ChequeNo& ",N'"& ChequeDate& "',"& Amount& ","& Banker& ", 0, "& session("ID")& ", N'"& creationDate & "', N'"& Description & "')")
  236. next
  237. '************* Creating an Item for the Payment
  238. '*** Type = 5 means Item is a Payment
  239. '*** GLAccount = NULL because it can't be identified right now, it depends on where the cheques are
  240. mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, Reason, IsCredit, Type, Link, AmountOriginal, CreatedDate, CreatedBy, RemainedAmount) VALUES ("&_
  241. GLAccount & ", '"& OpenGL & "', '"& firstGLAccount & "', '"& customerID & "', N'"& effectiveDate & "', '"& reason & "', 0, 5, '"& paymentID & "', '"& TotalAmount & "', N'"& creationDate & "', '"& session("ID") & "', '"& RemainedTotalAmount & "');SELECT @@Identity AS NewItem"
  242. set RSF = Conn.execute(mySQL).NextRecordSet
  243. APDebitID = RSF ("NewItem")
  244. RSF.close
  245. Set RSF = Nothing
  246. mySQL="UPDATE Accounts SET "& sys & "Balance="& sys & "Balance-"& TotalAmount & " WHERE (ID = "& customerID & ")"
  247. conn.Execute(mySQL)
  248. '************* Create the relations between
  249. ' the Payment and Selected Vouvhers
  250. if SumVoucherTotalPrice<> 0 and VouchIDS<>"" then
  251. for vch = 0 to n
  252. if relationAmount(vch) = 0 then exit for
  253. mySQL="INSERT INTO "& sys & "ItemsRelations (CreatedDate, CreatedBy, Credit"& sys & "Item, Debit"& sys & "Item, Amount) VALUES (N'"& creationDate & "', '"& session("ID") & "', '"& APCreditID(vch) &"', '"& APDebitID &"', '"& relationAmount(vch) &"')"
  254. conn.Execute(mySQL)
  255. next
  256. end if
  257. ''''------------------------------------------------
  258. Conn.close
  259. response.redirect "../"& sys & "/AccountReport.asp?act=showPayment&payment="& paymentID & "&msg=" & Server.URLEncode(" .")
  260. '-----------------------------------------------------------------------------------------------------
  261. '--------------------------------------------------------------------------------------- Input cheques
  262. '-----------------------------------------------------------------------------------------------------
  263. elseif request("act")="enterCheque" then
  264. customerID=request("selectedCustomer")
  265. VouchIDS = request("VouchID")
  266. lastCustomerID = -1
  267. SumAPAmountOriginal=0
  268. SumAPRemainedAmount=0
  269. SumVoucherTotalPrice=0
  270. VoucherTotalPrice = -1
  271. Reason = 0 ' Old Code: Reason = 2 ' Sys: AP
  272. if request("Reason")<>"" then Reason=request("Reason")
  273. if VouchIDS<>"" then
  274. VouchIDarray = split(VouchIDS,",")
  275. for i=0 to ubound(VouchIDarray)
  276. VouchID = VouchIDarray(i)
  277. set RSV=Conn.Execute ("SELECT * FROM Vouchers WHERE (id="& VouchID & ")" )
  278. if not RSV.eof then
  279. set RSB=Conn.Execute ("SELECT * FROM APItems WHERE (Type=6 and Link="& VouchID & ")" )
  280. if RSB.EOF then
  281. response.write "<br><BR>"
  282. call showAlert ("<B>! </B><BR> ",CONST_MSG_ERROR)
  283. response.end
  284. end if
  285. customerID = RSV("VendorID")
  286. if lastCustomerID <> -1 and customerID<>lastCustomerID then
  287. response.write "<br><BR>"
  288. call showAlert ("<B>! </B><BR> <BR><BR><A HREF='payment.asp'>ѐ</A>",CONST_MSG_ERROR)
  289. response.end
  290. end if
  291. LastCustomerID = customerID
  292. else
  293. response.write "<br><BR>"
  294. call showAlert ("<B>! </B><BR> ",CONST_MSG_ERROR)
  295. response.end
  296. end if
  297. next
  298. else
  299. if customerID = "" then
  300. response.redirect "cheq.asp"
  301. end if
  302. end if
  303. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  304. mySQL="SELECT * FROM Accounts WHERE (ID='"& CustomerID & "')"
  305. Set RS1 = conn.Execute(mySQL)
  306. customerName=RS1("AccountTitle")
  307. creationDate= shamsiToday()
  308. creationTime= currentTime10()
  309. %>
  310. <br>
  311. <div dir='rtl'>&nbsp;&nbsp;<B> : </B>
  312. </div>
  313. <!--#include File="../include_JS_InputMasks.asp"-->
  314. <!-- -->
  315. <hr>
  316. <SCRIPT LANGUAGE="JavaScript">
  317. <!--
  318. function checkValidation(){
  319. try{
  320. tmpBox=document.getElementsByName('PaymentDate')[0];
  321. if (tmpBox.value!='' && tmpBox.value!=null){
  322. if (!acceptDate(tmpBox))
  323. return false;
  324. }
  325. else{
  326. tmpBox.focus();
  327. alert(" ")
  328. return false;
  329. }
  330. tmpBox=document.getElementsByName('TotalAmount')[0];
  331. if (txt2val(tmpBox.value)==0){
  332. alert(" ")
  333. return false;
  334. }
  335. }catch(e){
  336. alert(" ");
  337. return false;
  338. }
  339. }
  340. //-->
  341. var dialogActive=false;
  342. function maskReason(src){
  343. var theKey=event.keyCode;
  344. if (theKey==13){
  345. event.keyCode=9
  346. dialogActive=true
  347. document.all.tmpDlgArg.value="#"
  348. document.all.tmpDlgTxt.value=" :"
  349. 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;');
  350. dialogActive=false
  351. if (document.all.tmpDlgTxt.value !="") {
  352. var myTinyWindow = 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;');
  353. // dialogActive=false
  354. if (document.all.tmpDlgArg.value!="#"){
  355. Arguments=document.all.tmpDlgArg.value.split("#")
  356. src.value=Arguments[0];
  357. document.all.accountName.value=Arguments[1];
  358. }
  359. }
  360. }
  361. }
  362. //-->
  363. </SCRIPT>
  364. <input type="hidden" Name='tmpDlgArg' value=''>
  365. <input type="hidden" Name='tmpDlgTxt' value=''>
  366. <FORM METHOD=POST ACTION="?act=submitPayment" onsubmit="return checkValidation();">
  367. <input type="hidden" Name='tmpDlgArg' value=''>
  368. <table class="RcpMainTable" Cellspacing="1" Cellpadding="0" Width="500" align="center">
  369. <tr class="RcpMainTableTH">
  370. <td colspan="10"><TABLE width='550' align='center' cellpadding='5'>
  371. <TR>
  372. <TD bgcolor=white>: </TD>
  373. <%
  374. mySQL="SELECT * FROM AXItemReasons WHERE Display=1 ORDER BY ID"
  375. set RS1=conn.execute(mySQL)
  376. while not RS1.eof
  377. %> <TD bgcolor=white>
  378. <INPUT TYPE="radio" NAME="Reason" value="<%=RS1("ID")%>" <% if reason=RS1("ID") then response.write "checked "%>><%=RS1("Name")%>
  379. </TD>
  380. <% RS1.movenext
  381. wend
  382. %>
  383. </TR></TABLE></td>
  384. </tr>
  385. <tr class="RcpMainTableTH">
  386. <td colspan="10"><TABLE class="RcpTable" Width="100%" Cellspacing="1" Cellpadding="0" Dir="RTL"><TR>
  387. <TD align="left">:</TD>
  388. <TD align="right" width="5">
  389. <INPUT class="RcpGenInput" disabled TYPE="text" value="<%=customerID%>" maxlength="5" size="5" tabIndex="1" dir="LTR">
  390. </TD>
  391. <TD align="right" width="200">
  392. <INPUT TYPE="hidden" NAME="customerID" value="<%=customerID%>"><%=CustomerName%>.
  393. </TD>
  394. <TD align="left">:</TD>
  395. <TD>
  396. <table class="RcpTable">
  397. <tr>
  398. <td dir="LTR">
  399. <input class="RcpGenInput" style="text-align:left;direction:LTR;" NAME="PaymentDate" TYPE="text" maxlength="10" size="10" value="" onblur="acceptDate(this)">
  400. </td>
  401. <td dir="RTL">: <font color=white><%=weekdayname(weekday(date))%> <span dir=rtl><%=shamsiToday()%></span></font></TD>
  402. </tr>
  403. </table></TD>
  404. </TR></TABLE></td>
  405. </tr>
  406. <tr class="RcpMainTableTR">
  407. <td colspan="10"><div>
  408. <TABLE class="RcpTable" Cellspacing="1" Cellpadding="0" Dir="RTL">
  409. <TR height="20">
  410. <TD colspan="15">
  411. <%
  412. if VouchIDS<>"" then
  413. response.write " :"
  414. VouchIDarray = split(VouchIDS,",")
  415. for i=o to ubound(VouchIDarray)
  416. VouchID = VouchIDarray(i)
  417. set RSV=Conn.Execute ("SELECT * FROM Vouchers WHERE (id="& VouchID & ")" )
  418. set RSB=Conn.Execute ("SELECT * FROM APItems WHERE (Type=6 and Link="& VouchID & ")" )
  419. APAmountOriginal = RSB("AmountOriginal")
  420. APRemainedAmount = RSB("RemainedAmount")
  421. VoucherTotalPrice = RSV("TotalPrice")
  422. SumAPAmountOriginal = cdbl(SumAPAmountOriginal) + cdbl(APAmountOriginal)
  423. SumAPRemainedAmount = cdbl(SumAPRemainedAmount) + cdbl(APRemainedAmount)
  424. SumVoucherTotalPrice = cdbl(SumVoucherTotalPrice) + cdbl(VoucherTotalPrice)
  425. customerID = RSV("VendorID")
  426. VoucherTitle = RSV("Title")
  427. %>
  428. <INPUT TYPE="hidden" name="VouchID" value="<%=VouchID%>">
  429. <INPUT TYPE="hidden" name="VoucherTotalPrice" value="<%=VoucherTotalPrice%>">
  430. <INPUT TYPE="hidden" name="APRemainedAmount" value="<%=APRemainedAmount%>">
  431. <li><B><%=VoucherTitle%></B> <A HREF="../AP/payment.asp?VouchID=<%=VouchID%>"><%=VouchID%></A> ( : <%=Separate(VoucherTotalPrice)%> - : <%=Separate(APRemainedAmount)%> )
  432. <%
  433. next
  434. end if
  435. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  436. %>
  437. <INPUT TYPE="hidden" name="SumAPAmountOriginal" value="<%=SumAPAmountOriginal%>">
  438. <INPUT TYPE="hidden" name="SumVoucherTotalPrice" value="<%=SumVoucherTotalPrice%>">
  439. </TD>
  440. </TR>
  441. </TABLE></div></td>
  442. </tr>
  443. <tr class="RcpMainTableTR">
  444. <td colspan="10"><div style="width:540;">
  445. <TABLE class="RcpTable" Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855">
  446. <TR height=20px>
  447. <TD class="RcpHeadInput" style="width:25;"> # </td>
  448. <TD class="RcpHeadInput" style="width:70;"> </td>
  449. <TD class="RcpHeadInput" style="width:70;"></td>
  450. <TD class="RcpHeadInput" style="width:150;"></td>
  451. <TD class="RcpHeadInput" style="width:95;"></td>
  452. <TD class="RcpHeadInput" style="width:110;"></td>
  453. </TR>
  454. </TABLE></div></td>
  455. </tr>
  456. <tr class="RcpMainTableTR">
  457. <td colspan="10" dir="RTL"><div style="overflow:auto; height:150px;width:100%;">
  458. <TABLE class="RcpTable" Border="0" Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855">
  459. <Tbody id="ChequeLines">
  460. <TR bgcolor='#F0F0F0' onclick="currentRow=this.rowIndex;" >
  461. <TD align='center' width="25px">1</td>
  462. <TD dir="LTR"><INPUT class="RcpRowInput" TYPE="text" NAME="ChequeNos" size="10" maxLength="6" onKeyPress="return mask(this);" onblur="check(this);"></td>
  463. <TD dir="LTR" ><INPUT class="RcpRowInput" TYPE="text" NAME="ChequeDates" maxlength="10" size="10" onKeyPress="return maskDate(this);" onblur="acceptDate(this);"></td>
  464. <TD dir="RTL">
  465. <select name="Banks" class=inputBut style="width:150;">
  466. <option value="-1"> </option>
  467. <option value="-1">---------------------------------</option>
  468. <% set RSV=Conn.Execute ("SELECT * FROM Bankers WHERE (IsBankAccount = 1)")
  469. Do while not RSV.eof
  470. %>
  471. <option value="<%=RSV("id")%>"><%=RSV("Name")%> </option>
  472. <%
  473. RSV.moveNext
  474. Loop
  475. RSV.close
  476. %>
  477. </select>
  478. </TD>
  479. <TD dir="LTR"><INPUT class="RcpRowInput" TYPE="text" NAME="Amounts" size="15" onKeyPress="return mask(this);" onBlur="setPrice(this);" ></td>
  480. <TD dir="RTL"><INPUT class="RcpRowInput" TYPE="text" NAME="Description" size="18" ></td>
  481. </TR>
  482. <TR bgcolor='#F0F0F0' onclick="currentRow=this.rowIndex;" >
  483. <TD colspan="15">
  484. <INPUT class="RcpGenInput" TYPE="button" value="" onkeyDown="if(event.keyCode==9) return false;" onClick="addRow(this.parentNode.parentNode.rowIndex);">
  485. </TD>
  486. </TR>
  487. </Tbody></TABLE></div></td>
  488. </tr>
  489. <tr class="RcpMainTableTR">
  490. <td colspan="10"><div>
  491. <TABLE Border="0" Cellspacing="1" Cellpadding="0" Dir="RTL">
  492. <TR>
  493. <TD class="RcpHeadInput" align='center' >
  494. <% if CDbl(VoucherTotalPrice) <> -1 then %> :
  495. <%=Separate(SumAPRemainedAmount)%>
  496. <% end if %></td>
  497. <TD class="RcpHeadInput" align='center' width="25px"> </td>
  498. <TD class="RcpHeadInput"><INPUT class="RcpHeadInput" readonly TYPE="text" Value=":" size="10" tabindex="9999"></td>
  499. <TD class="RcpHeadInput"><INPUT class="RcpHeadInput3" readonly dir="LTR" TYPE="text" Name="TotalAmount" size="15" tabindex="9999"></td>
  500. </TR>
  501. </TABLE></div></td>
  502. </tr>
  503. </table>
  504. <br>
  505. <TABLE class="RcpTable" Border="0" Cellspacing="5" Cellpadding="1" Dir="RTL">
  506. <TR>
  507. <TD align='center' bgcolor="#000000"><INPUT class="RcpGenInput" style="text-align:center" TYPE="submit" value=""></td>
  508. <TD align='center' bgcolor="#000000"><INPUT class="RcpGenInput" style="text-align:center" TYPE="button" value="" onclick="window.location='?';"></td>
  509. </TR>
  510. </TABLE>
  511. </FORM>
  512. <SCRIPT LANGUAGE="JavaScript">
  513. <!--
  514. document.all.ChequeNos.focus();
  515. //-->
  516. </SCRIPT>
  517. <SCRIPT language="JavaScript">
  518. <!--
  519. //===================================================
  520. function delRow(rowNo){
  521. rowsCount=document.getElementsByName("ChequeNos").length
  522. if (rowsCount==1){
  523. alert(" ");
  524. return false;
  525. }
  526. chqTable=document.getElementById("ChequeLines");
  527. theRow=chqTable.getElementsByTagName("tr")[rowNo];
  528. chqTable.removeChild(theRow);
  529. rowsCount--;
  530. for (rowNo=0; rowNo < rowsCount; rowNo++){
  531. chqTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0].innerText= rowNo+1;
  532. }
  533. }
  534. //===================================================
  535. function addRow(rowNo){
  536. chqTable=document.getElementById("ChequeLines");
  537. theRow=chqTable.getElementsByTagName("tr")[rowNo];
  538. newRow=document.createElement("tr");
  539. newRow.setAttribute("bgColor", '#f0f0f0');
  540. tempTD=document.createElement("td");
  541. tempTD.innerHTML=rowNo+1
  542. tempTD.setAttribute("align", 'center');
  543. tempTD.setAttribute("width", '25');
  544. newRow.appendChild(tempTD);
  545. tempTD=document.createElement("td");
  546. tempTD.setAttribute("dir", 'LTR');
  547. tempTD.innerHTML='<INPUT class="RcpRowInput" TYPE="text" NAME="ChequeNos" size="10" maxLength="6" onKeyPress="return mask(this);" onblur="check(this);">'
  548. // tempTD.innerHTML=chqTable.getElementsByTagName("tr")[0].getElementsByTagName("td")[1].innerHTML
  549. newRow.appendChild(tempTD);
  550. tempTD=document.createElement("td");
  551. tempTD.setAttribute("dir", 'LTR');
  552. tempTD.innerHTML='<INPUT class="RcpRowInput" TYPE="text" NAME="ChequeDates" maxlength="10" size="10" onKeyPress="return maskDate(this);" onblur="acceptDate(this);">'
  553. // tempTD.innerHTML=chqTable.getElementsByTagName("tr")[0].getElementsByTagName("td")[2].innerHTML
  554. newRow.appendChild(tempTD);
  555. tempTD=document.createElement("td");
  556. tempTD.innerHTML=chqTable.getElementsByTagName("tr")[0].getElementsByTagName("td")[3].innerHTML
  557. newRow.appendChild(tempTD);
  558. tempTD=document.createElement("td");
  559. tempTD.setAttribute("dir", 'LTR');
  560. tempTD.innerHTML='<INPUT class="RcpRowInput" TYPE="text" NAME="Amounts" size="15" onKeyPress="return mask(this);" onBlur="setPrice(this);">'
  561. newRow.appendChild(tempTD);
  562. tempTD=document.createElement("td");
  563. tempTD.setAttribute("dir", 'RTL');
  564. tempTD.innerHTML='<INPUT class="RcpRowInput" TYPE="text" NAME="Description" size="18" >'
  565. newRow.appendChild(tempTD);
  566. chqTable.insertBefore(newRow,theRow);
  567. chqTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
  568. }
  569. //===================================================
  570. function setPrice(src){
  571. myRow=src.parentNode.parentNode.rowIndex
  572. if (src.name=="Amounts" && document.getElementsByName("ChequeNos")[myRow].value==''){
  573. src.value=0;
  574. }
  575. else{
  576. src.value=val2txt(txt2val(src.value));
  577. }
  578. //cashAmount=parseInt(txt2val(document.getElementsByName("CashAmount")[0].value));
  579. //totalAmount = cashAmount;
  580. totalAmount = 0;
  581. for (rowNo=0; rowNo < document.getElementsByName("Amounts").length; rowNo++){
  582. totalAmount += parseInt(txt2val(document.getElementsByName("Amounts")[rowNo].value));
  583. }
  584. document.all.TotalAmount.value = val2txt(totalAmount);
  585. }
  586. var dialogActive=false;
  587. //===================================================
  588. function check(src){
  589. if (src.name=='ChequeNos'){
  590. if (src.value=='0'){
  591. if (confirm(" Ͽ\n\n"))
  592. delRow(src.parentNode.parentNode.rowIndex);
  593. }
  594. }
  595. }
  596. //===================================================
  597. function mask(src){
  598. var theKey=event.keyCode;
  599. if (theKey==13){
  600. return true;
  601. }
  602. else if (theKey < 48 || theKey > 57) { // 0-9 are acceptable
  603. return false;
  604. }
  605. }
  606. //-->
  607. </SCRIPT>
  608. <%
  609. '-----------------------------------------------------------------------------------------------------
  610. '--------------------------------------------------------------------------------------------- Default
  611. '-----------------------------------------------------------------------------------------------------
  612. elseif request("act")="" then %>
  613. <!-- -->
  614. <BR><BR>
  615. <FORM METHOD=POST ACTION="cheq.asp?act=submitsearch" onsubmit="if (document.all.CustomerNameSearchBox.value=='') return false;">
  616. <div dir='rtl'>&nbsp;&nbsp;<B> : </B>
  617. <INPUT TYPE="text" NAME="CustomerNameSearchBox">&nbsp;
  618. <INPUT TYPE="submit" value=""><br>
  619. </div>
  620. </FORM>
  621. <BR>
  622. <SCRIPT LANGUAGE="JavaScript">
  623. <!--
  624. document.all.CustomerNameSearchBox.focus();
  625. //-->
  626. </SCRIPT>
  627. <%
  628. end if
  629. conn.Close
  630. '-----------------------------------------------------------------------------------------------------
  631. '-----------------------------------------------------------------------------------------------------
  632. '-----------------------------------------------------------------------------------------------------
  633. %>
  634. </font>
  635. <!--#include file="tah.asp" -->