/beta/AP/report.asp

http://github.com/khaneh/Orders · ASP · 249 lines · 217 code · 23 blank · 9 comment · 28 complexity · fa9a8516b2e1651c9243971c57d9a38b MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'AP (7)
  3. PageTitle= " "
  4. SubmenuItem=3
  5. if not Auth(7 , 3) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <!--#include File="../include_farsiDateHandling.asp"-->
  9. <!--#include File="../include_JS_InputMasks.asp"-->
  10. <%
  11. fromDate = request("fromDate")
  12. toDate = request("toDate")
  13. vouchers = request("vouchers")
  14. payments = request("payments")
  15. if request("Effective")="on" then
  16. effective=1
  17. else
  18. effective=0
  19. end if
  20. if payments="" then
  21. paymentsSt = " "
  22. else
  23. paymentsSt = "checked"
  24. end if
  25. if vouchers="" then
  26. vouchersSt = " "
  27. else
  28. vouchersSt = "checked"
  29. end if
  30. if toDate="" or fromDate="" then
  31. toDate = shamsiToday()
  32. fromDate = shamsiDate(Date()-7)
  33. paymentsSt = "checked"
  34. vouchersSt = "checked"
  35. flag = "first"
  36. end if
  37. '-----------------------------------------------------------------------------------------------------
  38. '-------------------------------------------------------------------------------------------- Log FORM
  39. '-----------------------------------------------------------------------------------------------------
  40. %>
  41. <BR><BR>
  42. <FORM METHOD=POST ACTION="report.asp">
  43. <TABLE border=0 align=center>
  44. <TR>
  45. <TD colspan=5 align=center><H3> </H3></TD>
  46. </TR>
  47. <TR>
  48. <TD align=left> </TD>
  49. <TD align=right><INPUT TYPE="text" NAME="fromDate" value="<%=fromDate%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"></TD>
  50. <TD align=left width=20></TD>
  51. <TD align=left> </TD>
  52. <TD align=right><INPUT TYPE="text" NAME="toDate" value="<%=toDate%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"></TD>
  53. <td>
  54. <INPUT TYPE="submit" NAME="submit" class=inputBut value="">
  55. </td>
  56. </TR>
  57. <!--
  58. <TR height=10>
  59. <TD colspan=4 align=center> </TD>
  60. <td><input type="checkbox" name="Effective" <%if effective then response.write " checked='checked' " %>></td>
  61. </TR>
  62. <TR>
  63. <TD align=left></TD>
  64. <TD align=right><INPUT TYPE="checkbox" NAME="vouchers" <%=vouchersSt%>> </TD>
  65. <TD align=left width=20><INPUT TYPE="checkbox" NAME="payments" <%=paymentsSt%>></TD>
  66. <TD align=left></TD>
  67. <TD align=left></TD>
  68. </TR>
  69. -->
  70. </TABLE>
  71. </FORM>
  72. <%
  73. if flag = "first" then
  74. response.end
  75. end if
  76. '-----------------------------------------------------------------------------------------------------
  77. '-------------------------------------------------------------------------------------------- Log Rows
  78. '-----------------------------------------------------------------------------------------------------
  79. if request("submit")=""then
  80. %>
  81. <TABLE dir=rtl align=center width=640 cellspacing=2 cellpadding=2 style="border:2 solid #330066;">
  82. <%
  83. mySQL="SELECT Accounts.AccountTitle,Accounts.id as accountID, Vouchers.id, Vouchers.Title, Vouchers.TotalPrice, Vouchers.CreationTime, Vouchers.CreationDate, Vouchers.CreatedBy, Vouchers.verified, Vouchers.comment, Vouchers.ImageFileName, Vouchers.VendorID, Users.RealName, apItems.FullyApplied,apItems.RemainedAmount,EffectiveGLRows.GLDoc,Vouchers.effectiveDate,apItems.createdDate FROM Vouchers INNER JOIN Accounts ON Vouchers.VendorID = Accounts.ID INNER JOIN Users ON Vouchers.CreatedBy = Users.ID left outer join APItems on APItems.Type=6 and APItems.Link=Vouchers.id left outer join EffectiveGLRows on EffectiveGLRows.SYS='AP' and EffectiveGLRows.Link=apItems.ID WHERE (Vouchers.EffectiveDate >= N'"& fromDate & "' and Vouchers.EffectiveDate <= N'"& toDate & "') order by Vouchers.EffectiveDate"
  84. 'mySQL="SELECT Accounts.AccountTitle, Vouchers.id, Vouchers.Title, Vouchers.TotalPrice, Vouchers.CreationTime, Vouchers.CreationDate, Vouchers.CreatedBy, Vouchers.verified, Vouchers.comment, Vouchers.ImageFileName, Vouchers.VendorID, Users.RealName, apItems.FullyApplied,apItems.RemainedAmount,EffectiveGLRows.GLDoc FROM Vouchers INNER JOIN Accounts ON Vouchers.VendorID = Accounts.ID INNER JOIN Users ON Vouchers.CreatedBy = Users.ID left outer join APItems on APItems.Type=6 and APItems.Link=Vouchers.id left outer join EffectiveGLRows on EffectiveGLRows.SYS='AP' and EffectiveGLRows.Link=apItems.ID WHERE (Vouchers.CreationDate >= N'"& fromDate & "' and Vouchers.CreationDate <= N'"& toDate & "')"
  85. set RSS=Conn.Execute (mySQL)
  86. %>
  87. <TR bgcolor="eeeeee" >
  88. <TD colspan=6><H4></H4></TD>
  89. </TR>
  90. <TR bgcolor="eeeeee" style="cursor:hand;" title=" ">
  91. <TD></TD>
  92. <TD> </TD>
  93. <TD> </TD>
  94. <TD></TD>
  95. <TD></TD>
  96. <TD></TD>
  97. </TR>
  98. <TR bgcolor="eeeeee" >
  99. <TD colspan=6 height=2 bgcolor=0></TD>
  100. </TR>
  101. <%
  102. SumRemain=0
  103. tmpCounter=0
  104. total=0
  105. Do while not RSS.eof
  106. tmpCounter = tmpCounter + 1
  107. if tmpCounter mod 2 = 1 then
  108. tmpColor="#FFFFFF"
  109. tmpColor2="#FFFFBB"
  110. Else
  111. tmpColor="#DDDDDD"
  112. tmpColor2="#EEEEBB"
  113. End if
  114. total = total + CDbl(RSS("TotalPrice"))
  115. if not IsNull(RSS("remainedAmount")) then
  116. SumRemain = SumRemain + CDbl(RSS("remainedAmount"))
  117. end if
  118. %>
  119. <TR bgcolor="<%=tmpColor%>" title="<%
  120. Comment = RSS("Comment")
  121. if Comment<>"-" then
  122. response.write ": " & Comment
  123. else
  124. response.write " "
  125. end if
  126. %>">
  127. <td title=" :<%=RSS("CreationDate")%>&#13; :<%=RSS("createdDate")%>"><%=RSS("effectiveDate")%></td>
  128. <TD><a href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rss("accountID")%>"><%=RSS("AccountTitle")%></A></TD>
  129. <TD><A HREF="AccountReport.asp?act=showVoucher&voucher=<%=RSS("ID")%>"><%=RSS("ID")%> &nbsp;-&nbsp; <%=RSS("Title")%></TD>
  130. <TD><%=Separate(RSS("TotalPrice"))%></A></TD>
  131. <td>
  132. <%
  133. if IsNull(RSS("remainedAmount")) then
  134. response.write(" ")
  135. else
  136. response.write RSS("remainedAmount")
  137. end if
  138. %>
  139. </td>
  140. <TD><% if RSS("verified") then %> <% else %> <% end if %>/
  141. <% if not IsNull(RSS("fullyApplied")) and RSS("fullyApplied") then %> <% else %> <% end if %>
  142. </TD>
  143. </TR>
  144. <%
  145. RSS.moveNext
  146. Loop
  147. tmpCounter = tmpCounter + 1
  148. if tmpCounter mod 2 = 1 then
  149. tmpColor="#FFFFFF"
  150. tmpColor2="#FFFFBB"
  151. Else
  152. tmpColor="#DDDDDD"
  153. tmpColor2="#EEEEBB"
  154. End if
  155. %>
  156. <tr bgcolor="<%=tmpColor%>">
  157. <td colspan=3></td>
  158. <td><%=Separate(total)%></td>
  159. <td><%=Separate(SumRemain)%></td>
  160. <td></td>
  161. </tr>
  162. <%
  163. mySQL="SELECT Payments.id, Payments.CashAmount, Payments.ChequeAmount, APItems.RemainedAmount, Accounts.AccountTitle,Accounts.id as accountID, Payments.CreatedBy, Payments.CreationDate, Payments.CreationTime, Users.RealName,apItems.EffectiveDate FROM APItems INNER JOIN Payments ON APItems.Link = Payments.id INNER JOIN Accounts ON APItems.Account = Accounts.ID INNER JOIN Users ON Payments.CreatedBy = Users.ID WHERE (Payments.EffectiveDate >= N'"& fromDate & "' and Payments.EffectiveDate <= N'"& toDate & "' and Payments.SYS = 'AP') ORDER BY Payments.EffectiveDate"
  164. 'mySQL="SELECT Payments.CashAmount, Payments.ChequeAmount, APItems.RemainedAmount, Accounts.AccountTitle, Payments.CreatedBy, Payments.CreationDate, Payments.CreationTime, Users.RealName FROM APItems INNER JOIN Payments ON APItems.Link = Payments.id INNER JOIN Accounts ON APItems.Account = Accounts.ID INNER JOIN Users ON Payments.CreatedBy = Users.ID WHERE (Payments.CreationDate >= N'"& fromDate & "' and Payments.CreationDate <= N'"& toDate & "' and Payments.SYS = 'AP') ORDER BY Payments.ID"
  165. set RSS=Conn.Execute (mySQL)
  166. %>
  167. <TR bgcolor="eeeeee" >
  168. <TD colspan=6><H4></H4></TD>
  169. </TR>
  170. <TR bgcolor="eeeeee" >
  171. <TD colspan=6 height=2 bgcolor=0></TD>
  172. </TR>
  173. <%
  174. tmpCounter=0
  175. total=0
  176. totalRemain=0
  177. Do while not RSS.eof
  178. tmpCounter = tmpCounter + 1
  179. if tmpCounter mod 2 = 1 then
  180. tmpColor="#FFFFFF"
  181. tmpColor2="#FFFFBB"
  182. Else
  183. tmpColor="#DDDDDD"
  184. tmpColor2="#EEEEBB"
  185. End if
  186. total= total + cdbl(RSS("CashAmount")) + cdbl(RSS("ChequeAmount"))
  187. totalRemain = totalRemain + CDbl(RSS("RemainedAmount"))
  188. %>
  189. <TR bgcolor="<%=tmpColor%>" >
  190. <td title=" :<%=RSS("CreationDate")%>"><%=RSS("effectiveDate")%></td>
  191. <TD><a href="../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rss("accountID")%>"><%=RSS("AccountTitle")%></A></TD>
  192. <TD title=":<%=RSS("RealName")%>">
  193. <a href="../AP/AccountReport.asp?act=showPayment&payment=<%=rss("id")%>">
  194. <%
  195. if cdbl(RSS("CashAmount"))>0 then response.write ": " & Separate(cdbl(RSS("CashAmount"))) & " "
  196. if cdbl(RSS("ChequeAmount"))>0 then response.write ": " & Separate(cdbl(RSS("ChequeAmount")))
  197. %>
  198. </a>
  199. </TD>
  200. <TD><%=Separate(cdbl(RSS("CashAmount")) + cdbl(RSS("ChequeAmount")))%> </TD>
  201. <TD><%=Separate(RSS("RemainedAmount"))%></A></TD>
  202. <TD></TD>
  203. </TR>
  204. <%
  205. RSS.moveNext
  206. Loop
  207. tmpCounter = tmpCounter + 1
  208. if tmpCounter mod 2 = 1 then
  209. tmpColor="#FFFFFF"
  210. tmpColor2="#FFFFBB"
  211. Else
  212. tmpColor="#DDDDDD"
  213. tmpColor2="#EEEEBB"
  214. End if
  215. %>
  216. <tr bgcolor="<%=tmpColor%>">
  217. <td colspan=3></td>
  218. <td><%=Separate(total)%></td>
  219. <td><%=Separate(totalRemain)%></td>
  220. <td></td>
  221. </tr>
  222. </TABLE><br>
  223. <%
  224. end if
  225. %>
  226. <!--#include file="tah.asp" -->