/beta/bank/traceCheqPaid.asp

http://github.com/khaneh/Orders · ASP · 294 lines · 242 code · 33 blank · 19 comment · 46 complexity · daeac6c781e25640c34ae0a9521cfee5 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Bank (10 [=A])
  3. PageTitle= " "
  4. SubmenuItem=3
  5. if not Auth("A" , 3) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <!--#include File="../include_farsiDateHandling.asp"-->
  9. <!--#include File="../include_JS_InputMasks.asp"-->
  10. <BR><BR>
  11. <style>
  12. .RcpMainTable { font-family:tahoma; font-size: 9pt; border: 2px solid #000088; padding:0; direction: RTL; width:600px;}
  13. .RcpMainTable Tr {Height:25px; border: 1px solid black;}
  14. .RcpMainTableInput { font-family:tahoma; font-size: 9pt; width:100px; border: 1px solid gray; text-align:center; direction: LTR;}
  15. .RcpMainTable Select { font-family:tahoma; font-size: 9pt; width:120px;}
  16. </style>
  17. <CENTER>
  18. <%
  19. function DecsAsc (x)
  20. if cint(s) = cint(x) then
  21. if DESC=1 then
  22. result = "v"
  23. else
  24. result = "^"
  25. end if
  26. end if
  27. DecsAsc = result
  28. end function
  29. '-----------------------------------------------------------------------------------------------------
  30. '------------------------------------------------------------------------------------------ Submit Pay
  31. '-----------------------------------------------------------------------------------------------------
  32. if request.form("submit") = " " then
  33. x = request.form("pay")
  34. set RSV=Conn.Execute ("SELECT PaidCheques.Amount, PaidCheques.status, PaidCheques.Banker, Bankers.Name FROM PaidCheques INNER JOIN Bankers ON PaidCheques.Banker = Bankers.ID WHERE (PaidCheques.ID = "& x & ")" )
  35. if RSV.EOF then
  36. response.write "<BR><BR> ! <BR> "
  37. response.write "<BR><BR>Ӂ Ȑ"
  38. response.write "<BR><BR><CENTER><A HREF='traceCheqPaid.asp?fromSession=y'>ѐ</A></CENTER>"
  39. response.end
  40. elseif RSV("status")="1" then
  41. response.write "<BR><BR> ! <BR> "
  42. response.write "<BR><BR>Ӂ Ȑ"
  43. response.write "<BR><BR><CENTER><A HREF='traceCheqPaid.asp?fromSession=y'>ѐ</A></CENTER>"
  44. response.end
  45. end if
  46. Conn.Execute ("update PaidCheques set Status=1, StatusSetBy="& session("ID")& ", StatusSetDate=N'"& shamsiToday()& "' where ID="& x )
  47. Conn.Execute ("update Bankers set CurrentBalance=CurrentBalance-"& RSV("amount") & " where ID="& RSV("Banker") )
  48. response.write "<BR><BR> " & x & " "& RSV("Amount") & " "& RSV("Name") & " "
  49. response.write "<BR><BR><CENTER><A HREF='traceCheqPaid.asp?fromSession=y'>ѐ</A></CENTER>"
  50. response.end
  51. end if
  52. '-----------------------------------------------------------------------------------------------------
  53. '--------------------------------------------------------------------------------------- Submit Search
  54. '-----------------------------------------------------------------------------------------------------
  55. if request.form("submit") = "" then
  56. Banks = request.form("Banks")
  57. ChequeDatesFrom = request.form("ChequeDatesFrom")
  58. ChequeDatesTo = request.form("ChequeDatesTo")
  59. status = request.form("status")
  60. response.cookies("OldURL") = Request.ServerVariables("HTTP_REFERER")
  61. 'response.form = "a"
  62. 'response.write Request.ServerVariables("HTTP_REFERER")
  63. myQuery ="SELECT dbo.Payments.Account AS Account, dbo.PaidCheques.*, dbo.Bankers.Name AS BankName, dbo.Bankers.ID AS BankID, dbo.Users.RealName AS CSR, dbo.RcvPayChqStatus.Name AS statusName FROM dbo.PaidCheques INNER JOIN dbo.Bankers ON dbo.PaidCheques.Banker = dbo.Bankers.ID INNER JOIN dbo.Users ON dbo.PaidCheques.CreatedBy = dbo.Users.ID INNER JOIN dbo.Payments ON dbo.PaidCheques.Payment = dbo.Payments.ID INNER JOIN dbo.RcvPayChqStatus ON dbo.PaidCheques.Status = dbo.RcvPayChqStatus.ID WHERE (1 = 1)"
  64. 'myQuery = "SELECT Payments.Account, PaidCheques.*, Bankers.Name AS BankName, Bankers.ID AS BankID, Users.RealName AS CSR FROM PaidCheques INNER JOIN Bankers ON PaidCheques.Banker = Bankers.ID INNER JOIN Users ON PaidCheques.CreatedBy = Users.ID INNER JOIN Payments ON PaidCheques.Payment = Payments.ID WHERE 1=1 "
  65. if not ( ChequeDatesTo = "" ) then
  66. myQuery = myQuery & " AND (PaidCheques.ChequeDate < N'"& ChequeDatesTo & "') "
  67. end if
  68. if not ( ChequeDatesFrom = "" ) then
  69. myQuery = myQuery & " AND (PaidCheques.ChequeDate >= N'"& ChequeDatesFrom & "')"
  70. end if
  71. if not Banks = "-2" then
  72. myQuery = myQuery & " AND (PaidCheques.Banker = "& Banks & ")"
  73. end if
  74. if not (status = "-1" or status = "") then
  75. myQuery = myQuery & " AND (PaidCheques.Status = "& status & ")"
  76. end if
  77. 'response.write myQuery
  78. end if
  79. if myQuery = "" then
  80. myQuery = "SELECT Payments.Account, PaidCheques.*, Bankers.Name AS BankName, Bankers.ID AS BankID, Users.RealName AS CSR FROM PaidCheques INNER JOIN Bankers ON PaidCheques.Banker = Bankers.ID INNER JOIN Users ON PaidCheques.CreatedBy = Users.ID INNER JOIN Payments ON PaidCheques.Payment = Payments.ID WHERE (PaidCheques.Status = 0) "
  81. Banks = -2
  82. ChequeDatesFrom = ""
  83. ChequeDatesTo = ""
  84. status = "0"
  85. end if
  86. if request("fromSession") = "y" then
  87. myQuery = session("myQuery")
  88. Banks = session("Banks")
  89. ChequeDatesFrom = session("ChequeDatesFrom")
  90. ChequeDatesTo = session("ChequeDatesTo")
  91. status = session("status")
  92. end if
  93. s = request("s")
  94. if s="" then s="1"
  95. if s="1" then
  96. orderBy = "PaidCheques.ID"
  97. elseif s="2" then
  98. orderBy = "PaidCheques.ChequeNo"
  99. elseif s="3" then
  100. orderBy = "PaidCheques.ChequeDate"
  101. elseif s="4" then
  102. orderBy = "PaidCheques.amount"
  103. elseif s="5" then
  104. orderBy = "PaidCheques.CreatedBy"
  105. elseif s="6" then
  106. orderBy = "PaidCheques.status"
  107. elseif s="7" then
  108. orderBy = "PaidCheques.Banker"
  109. elseif s="8" then
  110. orderBy = "Payments.Account"
  111. end if
  112. Desc = request("Desc")
  113. if Desc = "" then
  114. Desc = 1
  115. else
  116. Desc = 3 - Desc
  117. end if
  118. myQuery2 = myQuery & " order by " & orderBy
  119. if Desc=2 then
  120. myQuery2 = myQuery2 & " DESC "
  121. end if
  122. session("myQuery") = myQuery
  123. session("Banks") = Banks
  124. session("ChequeDatesFrom") = ChequeDatesFrom
  125. session("ChequeDatesTo") = ChequeDatesTo
  126. session("status") = status
  127. '-----------------------------------------------------------------------------------------------------
  128. '----------------------------------------------------------------------------------------- Search Form
  129. '-----------------------------------------------------------------------------------------------------
  130. %>
  131. <FORM METHOD=POST ACTION="traceCheqPaid.asp?">
  132. <TABLE align=center class="RcpMainTable">
  133. <TR>
  134. <TD align=right> : <INPUT class="RcpMainTableInput" dir="LTR" TYPE="text" NAME="ChequeDatesFrom" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=ChequeDatesFrom%>"></TD>
  135. <TD> :
  136. <select name="Banks" >
  137. <option value="-2"> </option>
  138. <option value="-2">---------------------------------</option>
  139. <% set RSV=Conn.Execute ("SELECT * FROM Bankers where IsBankAccount=1")
  140. Do while not RSV.eof
  141. %>
  142. <option value="<%=RSV("id")%>" <% if cint(RSV("id"))=cint(Banks) then %> selected <% end if %>><%=RSV("Name")%> </option>
  143. <%
  144. RSV.moveNext
  145. Loop
  146. RSV.close
  147. %>
  148. <option value="-2">---------------------------------</option>
  149. <option value="-2" <% if -2=cint(Banks) then %> selected <% end if %>> </option>
  150. </select>
  151. </TD>
  152. <TD align=center width=200><INPUT class="GenButton" TYPE="submit" name="submit" value="" ></TD>
  153. </TR>
  154. <TR>
  155. <TD align=right> : <INPUT class="RcpMainTableInput" dir="LTR" TYPE="text" NAME="ChequeDatesTo" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=ChequeDatesTo%>"></TD>
  156. <TD colspan=2>
  157. :
  158. <select name="status" style="font-size:8pt">
  159. <option value=""> </option>
  160. <option value="">---------------------------------</option>
  161. <% set RSV=Conn.Execute ("SELECT * FROM RcvPayChqStatus where IsRcvdChqStatus = 0 order by id")
  162. Do while not RSV.eof
  163. %>
  164. <option value="<%=RSV("id")%>" <% if cint(RSV("id"))=cint(status) then %> selected <% end if %>><%=RSV("Name")%> </option>
  165. <%
  166. RSV.moveNext
  167. Loop
  168. RSV.close
  169. %>
  170. <option value="">---------------------------------</option>
  171. <option value="-1" <% if -1=cint(status) then %> selected <% end if %>> </option>
  172. </select>
  173. </TD>
  174. </TR>
  175. </TABLE><BR>
  176. </FORM>
  177. <%
  178. '-----------------------------------------------------------------------------------------------------
  179. '----------------------------------------------------------------------------------------- Show Report
  180. '-----------------------------------------------------------------------------------------------------
  181. total = 0
  182. 'response.write "<span dir = ltr>" & myQuery
  183. 'response.end
  184. Set RSS = conn.Execute(myQuery2)
  185. %>
  186. <TABLE dir=rtl align=center width=600>
  187. <TR >
  188. <TD colspan=5>
  189. <BR>
  190. </TD>
  191. </TR>
  192. <TR bgcolor="eeeeee" >
  193. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=1"><SMALL> </SMALL></A> &nbsp;<% response.write DecsAsc(1) %></TD>
  194. <TD align=center><!A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=2"><SMALL></SMALL></A></TD>
  195. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=2"><SMALL> </SMALL></A> &nbsp;<% response.write DecsAsc(2) %></TD>
  196. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=3"><SMALL> </SMALL></A> &nbsp;<% response.write DecsAsc(3) %></TD>
  197. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=8"><SMALL> </SMALL></A> &nbsp;<% response.write DecsAsc(8) %></TD>
  198. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=4"><SMALL> ()</SMALL></A> &nbsp;<% response.write DecsAsc(4) %></TD>
  199. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=5"><SMALL></SMALL></A> &nbsp;<% response.write DecsAsc(5) %></TD>
  200. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=6"><SMALL> </SMALL></A> &nbsp;<% response.write DecsAsc(6) %></TD>
  201. <TD><A HREF="traceCheqPaid.asp?fromSession=y&Desc=<%=Desc%>&s=7"><SMALL> </SMALL></A> &nbsp;<% response.write DecsAsc(7) %></TD>
  202. </TR>
  203. <%
  204. tmpCounter=0
  205. Do while not RSS.eof
  206. tmpCounter = tmpCounter + 1
  207. if tmpCounter mod 2 = 1 then
  208. tmpColor="#FFFFFF"
  209. tmpColor2="#FFFFBB"
  210. Else
  211. tmpColor="#DDDDDD"
  212. tmpColor2="#EEEEBB"
  213. End if
  214. %>
  215. <FORM METHOD=POST ACTION="traceCheqPaid.asp" onsubmit="return isEmpty()">
  216. <TR bgcolor="<%=tmpColor%>" title="<%=RSS("Description")%>">
  217. <TD><% if RSS("Description")<>"" then %><font color=blue><B><% end if %><%=RSS("ID")%></B></font></TD>
  218. <TD align=center><% if RSS("status")=0 then %><INPUT TYPE="radio" NAME="pay" value="<%=RSS("ID")%>"><% end if %></TD>
  219. <TD><!A HREF="traceCheqPaid.asp?act=Detail&ID=<%=RSS("ID")%>"><A HREF="ShowCheqPaid.asp?cheqID=<%=RSS("ID")%>"><%=RSS("ChequeNo")%></A></A></TD>
  220. <TD><span dir=ltr><%=RSS("ChequeDate")%></span></TD>
  221. <TD><span dir=ltr><A HREF="../AO/AccountReport.asp?act=show&selectedCustomer=<%=RSS("Account")%>" target="_blank"><%=RSS("Account")%></A></span></TD>
  222. <TD><span dir=ltr><%=RSS("amount")%></span></TD>
  223. <TD><%=RSS("CSR")%></TD>
  224. <TD><small><% if RSS("status")=0 then %> <% else %> <% end if %></small></TD>
  225. <TD><%=RSS("BankName")%></TD>
  226. </TR>
  227. <%
  228. total = total + RSS("amount")
  229. RSS.moveNext
  230. Loop
  231. %>
  232. <TR bgcolor="eeeeee" >
  233. <TD colspan=5 align=center> </TD>
  234. <TD colspan=4><big><%=total%></big> </TD>
  235. </TR>
  236. </TABLE><br>
  237. <INPUT class="GenButton" TYPE="submit" name="submit" value=" "><br><br>
  238. </FORM>
  239. <SCRIPT LANGUAGE="JavaScript">
  240. <!--
  241. function isEmpty()
  242. {
  243. notFound=true;
  244. for (i=0;i<document.getElementsByName("pay").length;i++){
  245. if(document.getElementsByName("pay")[i].checked){
  246. notFound=false;
  247. x=document.getElementsByName("pay")[i].value;
  248. }
  249. }
  250. if ( notFound )
  251. {
  252. alert(" ")
  253. return false
  254. }
  255. else
  256. return confirm(" "+ x + " ? ")
  257. }
  258. //-->
  259. </SCRIPT>
  260. </CENTER>
  261. <!--#include file="tah.asp" -->