/beta/inventory/myreport.asp

http://github.com/khaneh/Orders · ASP · 264 lines · 253 code · 10 blank · 1 comment · 40 complexity · 8e91dc3cabd8a7a088f6031fbdb56ef4 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%>
  2. <!--#include file="../config.asp" -->
  3. <!--#include File="../include_farsiDateHandling.asp"-->
  4. <!--#include File="../include_JS_InputMasks.asp"-->
  5. <HTML>
  6. <HEAD>
  7. <meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
  8. <meta http-equiv="Content-Language" content="fa">
  9. <TITLE> </TITLE>
  10. <style>
  11. body { font-family: tahoma; font-size: 8pt;}
  12. body A { Text-Decoration : none ;}
  13. Input { font-family: tahoma; font-size: 9pt;}
  14. td { font-family: tahoma; font-size: 8pt;}
  15. .tt { font-family: tahoma; font-size: 10pt; color:yellow;}
  16. .tt2 { font-family: tahoma; font-size: 8pt; color:yellow;}
  17. .inputBut { font-family: tahoma; font-size: 8pt; richness: 10}
  18. .t7pt { font-size: 8pt;}
  19. .t8pt { font-size: 10pt;}
  20. .GenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; }
  21. </style>
  22. </HEAD>
  23. <BODY topmargin=0 leftmargin=0 align=center dir=rtl >
  24. <%
  25. dateFrom = request("dateFrom")
  26. dateTo = request("dateTo")
  27. itemDetail = request("itemDetail") & ""
  28. sqlstr = "SELECT InventoryItemCategories.id as catID, InventoryItems.ID, InventoryItems.outByOrder, InventoryItems.OldItemID, InventoryItems.owner, InventoryItems.Name, InventoryItems.Minim, InventoryItems.Qtty, InventoryItems.CusQtty, InventoryItems.Unit, InventoryItems.costingMethod FROM InventoryItems INNER JOIN InventoryItemCategoryRelations ON InventoryItems.ID = InventoryItemCategoryRelations.Item_ID INNER JOIN InventoryItemCategories ON InventoryItemCategoryRelations.Cat_ID = InventoryItemCategories.ID WHERE (InventoryItems.ID = "& Clng(itemDetail) & ")"
  29. set RS3 = conn.Execute (sqlstr)
  30. if RS3.EOF then
  31. response.write "<center><br><br>!<br><br> </center>"
  32. response.end
  33. end if
  34. %>
  35. <BR>
  36. <center><H3> </H3></center>
  37. <TABLE border=0 align=center style="border:2px dotted #000000;" >
  38. <TR>
  39. <TD align=left><B> :</b></TD>
  40. <TD align=right><%=RS3("OldItemID")%></TD>
  41. </TR>
  42. <TR>
  43. <TD align=left width=100 ><B> :</B></TD>
  44. <TD align=right>
  45. <%
  46. set RS4 = conn.Execute ("SELECT * FROM InventoryItemCategories where id=" & RS3("catID"))
  47. if not (RS4.eof) then %>
  48. <%=RS4("Name")%>
  49. <%
  50. end if
  51. RS4.close
  52. %>
  53. </TD>
  54. </TR>
  55. <TR>
  56. <TD align=left width=100 ><B> :</B></TD>
  57. <TD align=right width=400 ><%=RS3("Name")%></TD>
  58. </TR>
  59. </table>
  60. <br>
  61. <TABLE border=0 align=center style="border:2px dotted #000000;" >
  62. <TR>
  63. <TD>
  64. <TABLE>
  65. <TR>
  66. <TD align=left width=100 ><B> : </B></TD>
  67. <TD align=right width=100 ><%=RS3("Qtty")%></TD>
  68. </TR>
  69. <TR>
  70. <TD align=left><B> :</B></TD>
  71. <TD align=right><%=RS3("cusQtty")%></TD>
  72. </TR>
  73. <TR>
  74. <TD align=left></TD>
  75. <TD align=right height=20>
  76. <BR>
  77. </TD>
  78. </TR>
  79. </TABLE>
  80. </TD>
  81. <TD>
  82. <TABLE>
  83. <TR>
  84. <TD align=left width=100 ><B> :</B></TD>
  85. <TD align=right width=100 ><%=RS3("Minim")%></TD>
  86. </TR>
  87. <TR>
  88. <TD align=left><B> : </B></TD>
  89. <TD align=right><%=RS3("Unit")%></TD>
  90. </TR>
  91. <TR>
  92. <TD align=left></TD>
  93. <TD align=right height=20>
  94. <BR>
  95. </TD>
  96. </TR>
  97. </TABLE>
  98. </TD>
  99. </TR>
  100. </TABLE>
  101. <CENTER>
  102. <%
  103. if dateTo="" then dateTo=shamsiToday()
  104. if dateFrom="" then dateFrom = left(shamsiToday(),4) & "/01/01"
  105. 'if dateFrom="" then dateFrom=session("FiscalYear")&"/01/01"
  106. Set HRS = Conn.Execute("SELECT ISNULL(dbo.CalcSumQttyInv("& itemDetail & ",'"&dateTo&"',0),0) As OurSumQtty,ISNULL(dbo.CalcSumQttyInv("& itemDetail & ",'"&dateTo&"',1),0) As TheirSumQtty")
  107. if Not HRS.EOF Then
  108. mysumQtty = clng(HRS("OurSumQtty"))
  109. ursumQtty = clng(HRS("TheirSumQtty"))
  110. End if
  111. HRs.Close
  112. sqlstr = "SELECT InventoryLog.type, InventoryLog.Voided, InventoryLog.VoidedBy, InventoryLog.comments, InventoryLog.VoidedDate, InventoryLog.IsInput, InventoryItems.Unit, InventoryItems.Name, InventoryItems.OldItemID, InventoryLog.logDate, InventoryLog.Qtty, InventoryLog.RelatedID, InventoryLog.ItemID, InventoryLog.ID, InventoryLog.CreatedBy, InventoryLog.owner, Users.RealName FROM InventoryLog INNER JOIN InventoryItems ON InventoryLog.ItemID = InventoryItems.ID INNER JOIN Users ON InventoryLog.CreatedBy = Users.ID WHERE (InventoryItems.ID = "& itemDetail & ") and InventoryLog.logDate>= N'"&dateFrom&"' and InventoryLog.logDate<= N'"&dateTo&"' ORDER BY InventoryLog.ID DESC"
  113. set RSS=Conn.Execute (sqlstr)
  114. %><BR><BR>
  115. <table align=center width=90% border=1 bordercolor=black cellspacing=1 cellpadding=1>
  116. <TR >
  117. <FORM METHOD=POST ACTION="">
  118. <TD colspan=9>
  119. <H4>
  120. ( <%=dateFrom%> <%=dateTo%>)
  121. </H4></TD>
  122. </FORM>
  123. </TR>
  124. <TR >
  125. <TD><SMALL></SMALL></A></TD>
  126. <TD><SMALL></SMALL></A></TD>
  127. <TD><SMALL> </SMALL></A></TD>
  128. <TD><SMALL> </SMALL></A></TD>
  129. <TD><SMALL></SMALL></A></TD>
  130. <TD align=center><SMALL> </SMALL></A></TD>
  131. <TD><SMALL></SMALL></A></TD>
  132. <TD><SMALL></SMALL></A></TD>
  133. </TR>
  134. <%
  135. tmpCounter=0
  136. Do while not RSS.eof
  137. tmpCounter = tmpCounter + 1
  138. if tmpCounter mod 2 = 1 then
  139. tmpColor="#FFFFFF"
  140. tmpColor2="#FFFFBB"
  141. Else
  142. tmpColor="#DDDDDD"
  143. tmpColor2="#EEEEBB"
  144. End if
  145. if trim(request("logRowID"))=trim(RSS("id")) then
  146. tmpColor = "yellow"
  147. end if
  148. %>
  149. <TR style="height:25pt" <% if RSS("voided") then%> disabled title=" <%=RSS("VoidedDate")%>"<% end if %>>
  150. <TD align=right dir=ltr><span style="font-size:10pt"><% if RSS("IsInput") then %><%=RSS("Qtty")%><% end if %></span></TD>
  151. <TD align=right dir=ltr style="position:relative;"><% if RSS("voided") then%><div style="right:0px;position:absolute;width:520;"><hr style="color:red;"></div><% end if %><span style="font-size:10pt"><% if not RSS("IsInput") then %><%=RSS("Qtty")%><% end if %></span></TD>
  152. <TD align=right dir=ltr><span style="font-size:10pt"><%=mySumQtty%></span></TD>
  153. <TD align=right dir=ltr><span style="font-size:10pt"><%=urSumQtty%></span></TD>
  154. <TD align=right dir=ltr ><%=RSS("Unit")%></TD>
  155. <TD dir=ltr align=center><%=RSS("logDate")%></span></TD>
  156. <TD><% if RSS("type")= "2" then
  157. response.write "<font color=red><b> </b></font>"
  158. elseif RSS("type")= "3" then
  159. response.write "<font color=green><b></b></font>"
  160. elseif RSS("type")= "4" then
  161. response.write "<font color=blue><b> </b></font>"
  162. elseif RSS("type")= "5" then
  163. response.write "<font color=orang><b></b></font>"
  164. elseif RSS("type")= "6" then
  165. response.write "<font color=#6699CC><b> </b></font>"
  166. elseif RSS("type")= "7" then
  167. response.write "<font color=#FF9966><b> </b></font>"
  168. elseif RSS("RelatedID")= "-1" then %> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  169. <% else
  170. if RSS("IsInput") then
  171. %> : <A HREF="../purchase/outServiceTrace.asp?od=<%=RSS("RelatedID")%>"><%=RSS("RelatedID")%></A><%
  172. else
  173. %> : <A HREF="default.asp?ed=<%=RSS("RelatedID")%>"><%=RSS("RelatedID")%></A><%
  174. end if
  175. end if %>
  176. <% if RSS("owner")<> "-1" and RSS("owner")<> "-2" then
  177. response.write " ( <a href='../CRM/AccountInfo.asp?act=show&selectedCustomer="& RSS("owner") &"' target='_blank'> " & RSS("owner") & "</a>)"
  178. end if %>
  179. <% if trim(RSS("comments"))<> "-" and RSS("comments")<> "" then
  180. response.write " <br><br><B>:</B> " & RSS("comments")
  181. end if %>
  182. </TD>
  183. <TD><%=RSS("RealName")%></TD>
  184. </TR>
  185. <%
  186. if Not RSS("Voided") Then
  187. if RSS("IsInput") Then
  188. if Rss("owner")=-1 then
  189. mySumQtty = mySumQtty - clng(RSS("Qtty"))
  190. else
  191. urSumQtty = urSumQtty - clng(RSS("Qtty"))
  192. end if
  193. else
  194. if Rss("owner")=-1 then
  195. mySumQtty = mySumQtty + clng(RSS("Qtty"))
  196. else
  197. urSumQtty = urSumQtty + clng(RSS("Qtty"))
  198. end if
  199. end if
  200. end if
  201. if not RSS("voided") then
  202. if RSS("IsInput") then
  203. if Rss("owner")=-1 then
  204. inputs = inputs + clng(RSS("Qtty"))
  205. else
  206. urinputs = urinputs + clng(RSS("Qtty"))
  207. end if
  208. else
  209. if Rss("owner")=-1 then
  210. outputs = outputs + clng(RSS("Qtty"))
  211. else
  212. uroutputs = uroutputs + clng(RSS("Qtty"))
  213. end if
  214. end if
  215. end if
  216. RSS.moveNext
  217. Loop
  218. %>
  219. <TR height=25 style="color:black;">
  220. <TD align=right dir=ltr><%=inputs+urinputs%></A></TD>
  221. <TD align=right dir=ltr><%=outputs+uroutputs%></A></TD>
  222. <TD colspan=6> <span dir=ltr><%=dateFrom%></span> <span dir=ltr><%=dateTo%></span></A></TD>
  223. </TR>
  224. <TR height=25 style="color:black;">
  225. <TD align=right dir=ltr><%=inputs%></A></TD>
  226. <TD align=right dir=ltr><%=outputs%></A></TD>
  227. <TD colspan=6> <span dir=ltr><%=dateFrom%></span> <span dir=ltr><%=dateTo%></span> </A></TD>
  228. </TR>
  229. <TR height=25 style="color:black;">
  230. <TD align=right dir=ltr><%=urinputs%></A></TD>
  231. <TD align=right dir=ltr><%=uroutputs%></A></TD>
  232. <TD colspan=6> <span dir=ltr><%=dateFrom%></span> <span dir=ltr><%=dateTo%> </span> </A></TD>
  233. </TR>
  234. <%
  235. sqlstr = "SELECT ISNULL((SELECT Sum(Qtty) From InventoryLog Where (Voided=0) And (ItemID = "& itemDetail & ") And Logdate<'"&dateFrom&"' And isInput=1),0) As InputQtty,ISNULL((SELECT Sum(Qtty) From InventoryLog Where (Voided=0) And (ItemID = "& itemDetail & ") And Logdate<'"&dateFrom&"' And isInput=0 ),0) As OutputQtty"
  236. set DRS1 = conn.Execute(sqlstr)
  237. if (not DRS1.EOF) then
  238. %>
  239. <Tr><td colspan=7 Height=20 ></td></tr>
  240. <TR style="height:25pt;" >
  241. <TD align=right dir=ltr ><span style="font-size:10pt"><%=DRS1("InputQtty")%></span></TD>
  242. <TD align=right dir=ltr ><span style="font-size:10pt"><%=DRS1("OutputQtty")%></span></TD>
  243. <TD align=right dir=ltr ><span style="font-size:10pt"><%=cdbl(DRS1("InputQtty")) - cdbl(DRS1("OutputQtty")) %></span></TD>
  244. <TD align=right Colspan=5 >
  245. <span dir=ltr><%=dateFrom%></span>
  246. </TD>
  247. </TR>
  248. <%
  249. End if
  250. DRS1.Close
  251. %>
  252. </table><BR><BR>
  253. </BODY>
  254. </HTML>