PageRenderTime 17ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

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