/beta/AR/rep_dailySale.asp

http://github.com/khaneh/Orders · ASP · 254 lines · 236 code · 15 blank · 3 comment · 26 complexity · 2573de91d63202477208af8267a05de7 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Order (2)
  3. PageTitle=" "
  4. SubmenuItem=11
  5. if not Auth("C" , 1) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <STYLE>
  9. .GetCustTbl {font-family:tahoma; background-color: #DDDDDD; width:630; direction: RTL; }
  10. .GetCustTbl td {padding:2; font-size: 9pt; height:25;}
  11. .GetCustInp { font-family:tahoma; font-size: 9pt;}
  12. .CusTableHeader {background-color: #33AACC; text-align: center; font-weight:bold;}
  13. .CustContactTable {font-family:tahoma; width:100%; border:1 solid black; direction: RTL; background-color:#CCCCCC;}
  14. .CustContactTable td {padding:5;}
  15. .CustTable {font-family:tahoma; width:80%; border:1 solid black; direction: RTL; background-color:black;}
  16. .CustTable td {padding:5;}
  17. .CustTable a {text-decoration:none;color:#000088}
  18. .CustTable a:hover {text-decoration:underline;}
  19. .CusTD1 {background-color: #CCCC66; text-align: left; font-weight:bold;}
  20. .CusTD2 {background-color: #DDDDDD; direction: LTR; text-align: right; font-size:9pt;}
  21. .CusTD3 {background-color: #DDDDDD; direction: LTR; text-align: center; font-size:9pt;}
  22. .CusTD4 {background-color: #CCCC66; direction: LTR; text-align: center; font-size:9pt;}
  23. .CustTable4 {font-family:tahoma; direction: RTL; width:100%; height:100%; background-color:#C3DBEB;}
  24. .Inp1 {font-size: 9pt;background-color: #CCE;border: none;direction: LTR;}
  25. </STYLE>
  26. <%
  27. if Auth("C" , 2) then
  28. input_date_start= sqlSafe(request("input_date_start"))
  29. input_date_end= sqlSafe(request("input_date_end"))
  30. else
  31. input_date_start= sqlSafe(request("input_date"))
  32. input_date_end= sqlSafe(request("input_date"))
  33. end if
  34. if request("fullyApplied")="on" then
  35. fullyApplied=1
  36. else
  37. fullyApplied=0
  38. end if
  39. 'ON ERROR RESUME Next
  40. Ord = request("Ord")
  41. page= request("page")
  42. select case Ord
  43. case "1":
  44. order="EffectiveDate"
  45. case "-1":
  46. order="EffectiveDate DESC"
  47. case "2":
  48. order="AccountTitle"
  49. case "-2":
  50. order="AccountTitle DESC"
  51. case "3":
  52. order="AmountOriginal"
  53. case "-3":
  54. order="AmountOriginal DESC"
  55. case "4":
  56. order="RemainedAmount"
  57. case "-4":
  58. order="RemainedAmount DESC"
  59. Case "5":
  60. order = "arBalance"
  61. Case "-5":
  62. order = "arBalance DESC"
  63. case "6":
  64. order="FullyApplied"
  65. case "-6":
  66. order="FullyApplied DESC"
  67. case else:
  68. order="EffectiveDate"
  69. Ord=1
  70. end select
  71. mySQL="select SUM(AmountOriginal) as AmountOriginal,SUM(RemainedAmount) as RemainedAmount, MAX(arBalance) as arBalance, count(ARItems.ID) AS totalItems from ARItems inner join Accounts on ARItems.Account=Accounts.ID where (ARItems.EffectiveDate between '" & input_date_start & "' and '" & input_date_end & "') and ARItems.Type=1 and ARItems.voided=0"
  72. if fullyApplied=1 then mySQL=mySQL&" AND FullyApplied=0"
  73. %>
  74. <TABLE dir=rtl align=center width=640 cellspacing=2 cellpadding=2 style="border:2 solid #330066;">
  75. <%
  76. set rs=Conn.Execute (mySQL)
  77. if rs.eof then
  78. %> <tr>
  79. <td bgcolor="#BBBBBB" height="30" colspan="7" align=center><b> .</b></td>
  80. </tr>
  81. <% Else %>
  82. <TR bgcolor="#CCCCEE" >
  83. <TD colspan=2 rowspan=2 title=" <%=rs("totalItems")%> ">
  84. <form method=post>
  85. &nbsp; <input class=Inp1 type=text name='input_date_start' size=10 value='<%=input_date_start%>' style="width:55px;">
  86. &nbsp; <input class=Inp1 type=text name='input_date_end' size=10 value='<%=input_date_end%>' style="width:55px;">
  87. &nbsp; <input type=CHECKBOX name='fullyApplied' <% if fullyApplied=1 then response.write("checked") %>>
  88. <input type=submit value='Ȑ'>
  89. <input type=hidden name="Ord" value='<%=Ord%>'>
  90. <input type=hidden name="Page" value='<%=page%>'>
  91. </form>
  92. </TD>
  93. <TD width=70 > </TD>
  94. <TD width=70 > </TD>
  95. <TD width=70 > ȝ</TD>
  96. <TD width=70 ></TD>
  97. </TR>
  98. <TR bgcolor="#CCCCEE" >
  99. <TD width=70 dir=ltr align=right><b><%=Separate(rs("AmountOriginal"))%></b></TD>
  100. <TD width=70 dir=ltr align=right><b><%=Separate(rs("RemainedAmount"))%></b></TD>
  101. <TD width=70 dir=ltr align=right><b><%=Separate(rs("arBalance"))%></b></TD>
  102. <TD></TD>
  103. </TR>
  104. <TR bgcolor="black" height="2">
  105. <TD colspan="6" style="padding:0;"></TD>
  106. </TR>
  107. <%
  108. rs.close
  109. if ord<0 then
  110. style="background-color: #33CC99;"
  111. arrow="<br><span style='font-family:webdings'>6 6 6</span>"
  112. else
  113. style="background-color: #33CC99;"
  114. arrow="<br><span style='font-family:webdings'>5 5 5</span>"
  115. end if
  116. %>
  117. <TR bgcolor="eeeeee" style="cursor:hand;" title=" ">
  118. <TD width=50 onclick='go2Page(1,-1);' style="<%if abs(ord)=1 then response.write style%>"><%if abs(ord)=1 then response.write arrow%></TD>
  119. <TD width='*' onclick='go2Page(1,-2);' style="<%if abs(ord)=2 then response.write style%>"> <%if abs(ord)=2 then response.write arrow%></TD>
  120. <TD width=70 onclick='go2Page(1,-3);' style="<%if abs(ord)=3 then response.write style%>"><%if abs(ord)=3 then response.write arrow%></TD>
  121. <TD width=70 onclick='go2Page(1,-4);' style="<%if abs(ord)=4 then response.write style%>"><%if abs(ord)=4 then response.write arrow%></TD>
  122. <TD width=70 onclick='go2Page(1,-5);' style="<%if abs(ord)=5 then response.write style%>"> <%if abs(ord)=5 then response.write arrow%></TD>
  123. <TD width=70 onclick='go2Page(1,-6);' style="<%if abs(ord)=6 then response.write style%>"><%if abs(ord)=6 then response.write arrow%></TD>
  124. </TR>
  125. <TR bgcolor="eeeeee" >
  126. <TD colspan=6 height=2 bgcolor=0></TD>
  127. </TR>
  128. <%
  129. SumAmount=0
  130. SumRemain=0
  131. tmpCounter=0
  132. mySQL="select Accounts.arBalance,Accounts.AccountTitle, ARItems.* from ARItems inner join Accounts on ARItems.Account=Accounts.ID where (ARItems.EffectiveDate between '" & input_date_start & "' and '" & input_date_end & "') and ARItems.Type=1 and ARItems.voided=0"
  133. if fullyApplied=1 then mySQL=mySQL&" AND ARItems.FullyApplied=0"
  134. mySQL= mySQL & " ORDER BY " & order
  135. Set rs=Server.CreateObject("ADODB.Recordset")'Conn.Execute(mySQL)
  136. PageSize = 50
  137. rs.PageSize = PageSize
  138. 'response.write mySql
  139. rs.CursorLocation=3 'in ADOVBS_INC adUseClient=3
  140. rs.Open mySQL ,Conn,3
  141. TotalPages = rs.PageCount
  142. CurrentPage=1
  143. if isnumeric(Page) then
  144. pp=clng(Page)
  145. if pp <= TotalPages AND pp > 0 then
  146. CurrentPage = pp
  147. end if
  148. end if
  149. if not rs.eof then
  150. rs.AbsolutePage=CurrentPage
  151. end if
  152. if rs.eof then
  153. %> <tr>
  154. <td bgcolor="#BBBBBB" height="30" colspan="7" align=center><b> .</b></td>
  155. </tr>
  156. <% else
  157. Do While NOT rs.eof AND (rs.AbsolutePage = CurrentPage)
  158. tmpCounter = tmpCounter + 1
  159. if tmpCounter mod 2 = 1 then
  160. tmpColor="#FFFFFF"
  161. tmpColor2="#FFFFBB"
  162. Else
  163. tmpColor="#DDDDDD"
  164. tmpColor2="#EEEEBB"
  165. End if
  166. %>
  167. <TR <%
  168. if rs("voided")="False" then
  169. response.write "bgcolor='" & tmpColor & "'"
  170. else
  171. response.write "bgcolor='#FFEEEE' title=' '"
  172. end if
  173. %>" >
  174. <TD><%=Separate(rs("EffectiveDate"))%></TD>
  175. <TD title=" "><A href='../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=rs("Account")%>'><%=rs("AccountTitle")%></A></TD>
  176. <TD dir=ltr align=right title=" "><a href='AccountReport.asp?act=showInvoice&invoice=<%=rs("Link")%>'><%=Separate(rs("AmountOriginal"))%></a></TD>
  177. <TD dir=ltr align=right><%=Separate(rs("RemainedAmount"))%></TD>
  178. <TD dir=ltr align=right title=" " <% if cdbl(rs("arBalance"))<0 then response.write("style='background-color:#F55;'") %>><a href='AccountReport.asp?sys=AR&act=show&selectedCustomer=<%=rs("Account")%>'><%=Separate(rs("arBalance"))%></a></TD>
  179. <TD ><%
  180. if rs("FullyApplied")="True" then
  181. response.write(" ")
  182. else
  183. response.write("<b style='color:red;'> </b>")
  184. end if
  185. %>
  186. </TD>
  187. </TR>
  188. <%
  189. rs.moveNext
  190. Loop
  191. if TotalPages > 1 then
  192. pageCols=20
  193. %>
  194. <TR bgcolor="eeeeee" >
  195. <TD colspan=6 height=2 bgcolor=0></TD>
  196. </TR>
  197. <TR class="RepTableTitle">
  198. <TD bgcolor="#CCCCEE" height="30" colspan="6">
  199. <table width=100% cellspacing=0 style="cursor:hand;color:gray;">
  200. <tr>
  201. <td style="height:25;border-bottom:1 solid black;" colspan=<%=pagecols%>>
  202. <b> <%=CurrentPage%> <%=TotalPages%></b>
  203. &nbsp;&nbsp;<a href="javascript:go2Page(<%=CurrentPage+1%>,0);"> &gt;</a>
  204. </td>
  205. </tr>
  206. <tr>
  207. <% for i=1 to TotalPages
  208. if i = CurrentPage then
  209. %> <td style="color:black;"><b>[<%=i%>]</b></td>
  210. <% else
  211. %> <td onclick="go2Page(<%=i%>,0);"><%=i%></td>
  212. <% end if
  213. if i mod pageCols = 0 then response.write "</tr><tr>"
  214. next
  215. %> </tr>
  216. </table>
  217. </TD>
  218. </TR>
  219. <% end if
  220. end if
  221. end if
  222. %>
  223. </TABLE>
  224. <SCRIPT LANGUAGE="JavaScript">
  225. function go2Page(p,ord) {
  226. if(ord==0){
  227. ord=<%=Ord%>;
  228. }
  229. else if(ord==<%=Ord%>){
  230. ord= 0-ord;
  231. }
  232. document.getElementsByName('Page')[0].value=p;
  233. document.getElementsByName('Ord')[0].value=ord;
  234. document.forms[0].submit();
  235. //str = '?act=show&FromDate=' + escape('<%=FromDate%>') + '&ToDate=' + escape('<%=ToDate%>') + '&Ord=' + escape(ord) + '&p=' + escape(p);
  236. //window.location = str;
  237. }
  238. </SCRIPT>
  239. <!--#include file="tah.asp" -->