PageRenderTime 30ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/inventory/invReport.asp

http://github.com/khaneh/Orders
ASP | 560 lines | 519 code | 26 blank | 15 comment | 84 complexity | 69b3f8c9453e363fc3ebc962ed4ff0d4 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Inventory (5)
  3PageTitle= "����� ������ �����"
  4SubmenuItem=8
  5if not Auth(5 , 8) then NotAllowdToViewThisPage()
  6ResultDate = sqlsafe(Request("ResultDate"))
  7
  8%>
  9<!--#include file="top.asp" -->
 10<!--#include File="../include_farsiDateHandling.asp"-->
 11<!--#include File="../include_JS_InputMasks.asp"-->
 12<%
 13'-----------------------------------------------------------------------------------------------------
 14'--------------------------------------------------------------------------------- Report page Hearder
 15'-----------------------------------------------------------------------------------------------------
 16oldItemID = request("oldItemID") & ""
 17itemDetail = request("itemDetail") & ""
 18if itemDetail="" and oldItemID ="" then
 19	catItem1 = request("catItem")
 20	%>
 21	<BR><BR>
 22	<FORM METHOD=POST ACTION="invReport.asp">
 23	<center>
 24	<div style="width:500px;border:1px solid #ffffff;"  align=center>
 25	<br>
 26	<TABLE dir=rtl align=center >
 27	<TR ><!bgcolor="#DDDDDD" >
 28		<TD align=left >���� ���� ���� :</td>
 29		<td>
 30			<SELECT NAME="catItem" size="1" rem_onchange="document.forms[0].submit()" class=inputBut >
 31			<option value="-1">���� ���� ���� </option>
 32			<option value="-1">------------------</option>
 33			<%
 34				set RS4 = conn.Execute ("SELECT * FROM InventoryItemCategories")
 35				while not (RS4.eof) %>
 36					<OPTION value="<%=RS4("ID")%>"<%
 37					if trim(catItem1) = trim(RS4("ID")) then
 38					response.write " selected "
 39					end if
 40					%>>* <%=RS4("Name")%> </option>
 41					<%	
 42					RS4.MoveNext
 43				wend
 44				RS4.close
 45				%>
 46			<option value="-1">------------------</option>
 47			<option value="-2" <%
 48			if catItem1 = "-2" then
 49			response.write " selected "
 50			end if
 51			%>>������� ������ ������</option>
 52			</SELECT>
 53		</TD>
 54	</TR>
 55	<Tr>
 56		<TD align=left >����� :</td>
 57		<Td >
 58			<INPUT TYPE="text" NAME="ResultDate" Value="<%=ResultDate%>" style="width:75px;direction:LTR;" maxlength=10 OnBlur="return acceptDate(this);">
 59		</Td>
 60	</Tr>
 61	<Tr>
 62		<Td colspan=2 align=left >
 63			<INPUT TYPE="submit" Value=" ����� " >
 64		</Td>
 65	</Tr>
 66	</FORM>
 67	</table>
 68	<br>
 69	</div>
 70	</center>
 71	<br>
 72	<%
 73		if request("catItem") = "" then
 74			%>
 75			<FORM METHOD=POST ACTION=""><BR><center>
 76				<INPUT TYPE="hidden" name="radif" value="-1">
 77				<input type="hidden" Name='tmpDlgArg' value=''>
 78				<input type="hidden" Name='tmpDlgTxt' value=''>
 79				�� �� ���� �� ���� ����:   &nbsp;&nbsp;&nbsp;<INPUT  dir="LTR"  TYPE="text" NAME="oldItemID" maxlength="10" size="13"   onKeyPress='return mask(this);' onBlur='check(this);'> &nbsp;&nbsp; <INPUT TYPE="text" NAME="accountName" size=30 readonly  value="<%=accountName%>" style="background-color:transparent">
 80				&nbsp;&nbsp;<INPUT TYPE="submit" Name="Submit" Value="�����"  style="width:80px;" tabIndex="14">
 81				</center>
 82			</FORM>
 83			<SCRIPT LANGUAGE="JavaScript">
 84			<!--
 85			document.all.oldItemID.focus()
 86			var dialogActive=false;
 87
 88			function mask(src){ 
 89				var theKey=event.keyCode;
 90
 91				if (theKey==13){
 92					event.keyCode=9
 93					dialogActive=true
 94					document.all.tmpDlgArg.value="#"
 95					document.all.tmpDlgTxt.value="����� �� ������� �����"
 96					var myTinyWindow = window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
 97					if (document.all.tmpDlgTxt.value != "") {
 98						var myTinyWindow = window.showModalDialog('dialog_selectInvItem.asp?act=select&name='+escape(document.all.tmpDlgTxt.value),document.all.tmpDlgArg,'dialogHeight:500px; dialogWidth:380px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
 99						dialogActive=false
100						if (document.all.tmpDlgArg.value!="#"){
101							Arguments=document.all.tmpDlgArg.value.split("#")
102							src.value=Arguments[0];
103							document.all.accountName.value=Arguments[1];
104						}
105					}
106				}
107			}
108
109			function check(src){ 
110				if (!dialogActive){
111					badCode = false;
112					if (window.XMLHttpRequest) {
113						var objHTTP=new XMLHttpRequest();
114					} else if (window.ActiveXObject) {
115						var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
116					}
117					objHTTP.open('GET','xml_InventoryItem.asp?id='+src.value,false)
118					objHTTP.send()
119					tmpStr = unescape(objHTTP.responseText)
120					document.all.accountName.value=tmpStr;
121					}
122			}
123
124
125			//-->
126			</SCRIPT>
127
128			<%
129		end if
130
131end if
132
133
134'-----------------------------------------------------------------------------------------------------
135'------------------------------------------------------------------------------ Update Item Properties
136'-----------------------------------------------------------------------------------------------------
137
138if request("catItem") ="-2" then
139	set RSS=Conn.Execute ("SELECT SUM(DERIVEDTBL.sumQtty) AS sumQttys, DERIVEDTBL.AccountID, Accounts.AccountTitle, InventoryItems.Name, InventoryItems.OldItemID, InventoryItems.Unit FROM (SELECT SUM((CONVERT(tinyint, dbo.InventoryLog.IsInput) - .5) * 2 * dbo.InventoryLog.Qtty) AS sumQtty, dbo.InventoryLog.owner AS AccountID, InventoryLog.itemid AS invid FROM dbo.InventoryLog where dbo.InventoryLog.voided=0 GROUP BY dbo.InventoryLog.owner, InventoryLog.itemid) DERIVEDTBL INNER JOIN Accounts ON DERIVEDTBL.AccountID = Accounts.ID INNER JOIN InventoryItems ON DERIVEDTBL.invid = InventoryItems.ID GROUP BY DERIVEDTBL.AccountID, Accounts.AccountTitle, InventoryItems.Name, InventoryItems.OldItemID, InventoryItems.Unit having SUM(DERIVEDTBL.sumQtty) <> 0 ")	
140	%><BR>
141	<CENTER><B>������ ������</B></CENTER><BR>
142	<TABLE dir=rtl align=center width=90%>
143	<TR bgcolor="eeeeee">
144		<TD><SMALL>��� ����</SMALL></TD>
145		<TD align=center><SMALL>�� ����</SMALL></TD>
146		<TD align=center><SMALL>����� ����</SMALL></TD>
147		<TD><SMALL>����� ����</SMALL></TD>
148		<TD align=center><SMALL>�����</SMALL></TD>
149		<TD align=center><SMALL>����</SMALL></TD>
150	</TR>
151	<%
152	tmpCounter=0
153	Do while not RSS.eof
154		tmpCounter = tmpCounter + 1
155		if tmpCounter mod 2 = 1 then
156			tmpColor="#FFFFFF"
157			tmpColor2="#FFFFBB"
158		Else
159			tmpColor="#DDDDDD"
160			tmpColor2="#EEEEBB"
161		End if 
162
163	%>
164	<TR bgcolor="<%=tmpColor%>" height=25>
165		<TD><%=RSS("name")%></TD>
166		<TD align=center dir=ltr><%=RSS("OldItemID")%></TD>
167		<TD align=center dir=ltr><%=RSS("AccountID")%></TD>
168		<TD><%=RSS("AccountTitle")%></TD>
169		<TD align=center dir=ltr><%=RSS("sumQttys")%></TD>
170		<TD align=center><%=RSS("Unit")%></TD>
171	</TR>
172		  
173	<% 
174	RSS.moveNext
175	Loop
176	%>
177	</TABLE><br>
178	</FORM>
179	<%
180end if
181'-----------------------------------------------------------------------------------------------------
182'---------------------------------------------------------------------------- List Items of a category
183'-----------------------------------------------------------------------------------------------------
184
185if request("catItem") >0 then
186
187if (len(ResultDate)>0) Then
188	sqlstr = "SELECT ISNULL((SELECT Top 1 sumQtty FROM InventoryLog WHERE (Logdate<='"& ResultDate &"') AND dbo.InventoryLog.ItemId = dbo.InventoryItems.Id ORDER BY Logdate DESC, Id DESC), 0) As Qtty, ISNULL((SELECT Top 1 SumCusQtty FROM InventoryLog WHERE (Logdate<='"& ResultDate &"') AND dbo.InventoryLog.ItemId = dbo.InventoryItems.Id ORDER BY Logdate DESC, Id DESC), 0) As CusQtty, dbo.InventoryItems.ID, dbo.InventoryItems.OldItemID, dbo.InventoryItems.owner, dbo.InventoryItems.Minim, dbo.InventoryItems.Name, dbo.InventoryItems.Unit, dbo.InventoryItems.costingMethod, dbo.InventoryItemCategories.Name AS Expr1 FROM dbo.InventoryItems INNER JOIN dbo.InventoryItemCategoryRelations ON dbo.InventoryItems.ID = dbo.InventoryItemCategoryRelations.Item_ID INNER JOIN dbo.InventoryItemCategories ON dbo.InventoryItemCategoryRelations.Cat_ID = dbo.InventoryItemCategories.ID WHERE (InventoryItemCategories.ID ="& catItem1 & ") and InventoryItems.enabled=1 ORDER BY OldItemID"
189else
190	sqlstr = "SELECT InventoryItems.ID, InventoryItems.OldItemID, InventoryItems.owner, InventoryItems.Minim, InventoryItems.Name, InventoryItems.Qtty, InventoryItems.CusQtty, InventoryItems.Unit, InventoryItems.costingMethod, InventoryItemCategories.Name AS Expr1 FROM InventoryItems INNER JOIN InventoryItemCategoryRelations ON InventoryItems.ID = InventoryItemCategoryRelations.Item_ID INNER JOIN InventoryItemCategories ON InventoryItemCategoryRelations.Cat_ID = InventoryItemCategories.ID WHERE (InventoryItemCategories.ID ="& catItem1 & ") and InventoryItems.enabled=1 ORDER BY OldItemID"
191end if
192set RSS=Conn.Execute (sqlstr)	
193%>
194<TABLE dir=rtl align=center width=600>
195<TR bgcolor="eeeeee">
196	<TD align=center><SMALL>�� ����</SMALL></A></TD>
197	<TD><SMALL>��� ����</SMALL></A></TD>
198	<TD align=center><SMALL>�����</SMALL></A></TD>
199	<TD align=center><SMALL>����� ������</SMALL></A></TD>
200	<TD align=center><SMALL>����� ������</SMALL></A></TD>
201	<TD><SMALL>����</SMALL></A></TD>
202</TR>
203<%
204tmpCounter=0
205Do 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%>
216<TR bgcolor="<%=tmpColor%>" height=25>
217	<TD align=center dir=ltr><%=RSS("OldItemID")%></TD>
218	<TD><A HREF="invReport.asp?itemDetail=<%=RSS("ID")%><% if Len(ResultDate)>0 then %>&dateTo=<%=ResultDate%><% end if %>"><%=RSS("Name")%></A></TD>
219	<TD align=center dir=ltr><%=RSS("Qtty")%></TD>
220	<TD align=center dir=ltr><a style="cursor:hand" onclick="window.open('cusItemDetails.asp?id=<%=RSS("ID")%>&name=<%=RSS("Name")%>','CusItemDetails','width=400,height=300')"><%=RSS("CusQtty")%></a></TD>
221	<TD align=center dir=ltr><%=RSS("Minim")%></TD>
222	<TD><%=RSS("Unit")%></TD>
223</TR>
224	  
225<% 
226RSS.moveNext
227Loop
228%>
229</TABLE><br>
230<%
231end if
232'-----------------------------------------------------------------------------------------------------
233'---------------------------------------------------------------------------------- Details of an item
234'-----------------------------------------------------------------------------------------------------
235if isNumeric(oldItemID) then
236	if CInt(oldItemID)=-1 then 
237		itemDetail = request("itemID")
238		set rs = Conn.Execute("select * from InventoryItems where id=" & itemDetail)
239		oldItemID = rs("oldItemID")
240		rs.close
241	end if
242
243'response.write oldItemID
244	set RS3 = conn.Execute ("SELECT * from InventoryItems WHERE (InventoryItems.OldItemID = "&  Clng(oldItemID) & ")")
245	if not RS3.EOF then
246		itemDetail = RS3("id")
247	end if
248end if 
249if isNumeric(itemDetail) then
250	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) & ")"
251	set RS3 = conn.Execute (sqlstr)
252	if RS3.EOF then
253		response.write "<center><br><br>���!<br><br>���� ���� �� ����� ������</center>"
254		response.end
255	end if
256	%>
257	<BR>
258
259	<TABLE border=0 align=center>
260	<TR>
261		<TD colspan=2 align=center><H3>���� �����</H3></TD>
262	</TR>
263	<TR>
264		<TD align=left>�� ����</TD>
265		<TD align=right><INPUT TYPE="text" NAME="OldItemID" value="<%=RS3("OldItemID")%>" readonly></TD>
266	</TR>
267	<TR>
268		<TD align=left>��� ����</TD>
269		<TD align=right>
270			<%
271				set RS4 = conn.Execute ("SELECT * FROM InventoryItemCategories where id=" & RS3("catID"))
272				if not (RS4.eof) then %>
273					<INPUT TYPE="text" NAME="ItemName" value="<%=RS4("Name")%>" size=64 readonly> 
274					<%	
275				end if
276				RS4.close
277				%>
278			</SELECT>
279		</TD>
280	</TR>
281	<TR>
282		<TD align=left>��� ����</TD>
283		<TD align=right><INPUT TYPE="text" NAME="ItemName" value="<%=RS3("Name")%>" size=64 readonly></TD>
284	</TR>
285	</table>
286	<TABLE border=0 align=center>
287	<TR>
288		<TD>
289			<TABLE> 
290			<TR>
291				<TD align=left>����� ����</TD>
292				<TD align=right><INPUT TYPE="text" NAME="qtty"  value="<%=(clng(RS3("Qtty")*100))/100%>" size=7 readonly></TD>
293			</TR>
294			<TR>
295				<TD align=left>����� ������</TD>
296				<TD align=right><INPUT TYPE="text" NAME="cusQtty"  value="<%=(clng(RS3("cusQtty")*100))/100%>" size=7 readonly> <a style="cursor:hand" onclick="window.open('cusItemDetails.asp?id=<%=RS3("ID")%>&name=<%=RS3("Name")%>','CusItemDetails','width=400,height=300')">...</a> </TD>
297			</TR>
298			<TR>
299				<TD align=left></TD>
300				<TD align=right height=20>
301				<BR>
302				</TD>
303			</TR>
304			</TABLE> 
305		</TD>
306		<TD>
307			<TABLE> 
308			<TR>
309				<TD align=left>����� ������</TD>
310				<TD align=right><INPUT TYPE="text" NAME="Minim" value="<%=RS3("Minim")%>" size=7 readonly></TD>
311			</TR>
312			<TR>
313				<TD align=left>���� ������ ����</TD>
314				<TD align=right><INPUT TYPE="text" NAME="Unit" value="<%=RS3("Unit")%>" size=7 readonly></TD>
315			</TR>
316			<TR>
317				<TD align=left></TD>
318				<TD align=right height=20>
319				<BR>
320				</TD>
321			</TR>
322			<!--TR>
323				<TD align=left>&nbsp;&nbsp;&nbsp;&nbsp;���� �������</TD>
324				<TD align=right><INPUT TYPE="radio" disabled NAME="cost" <%
325				if RS3("costingMethod") = "AVRG" then
326					response.write " checked"
327				end if
328				%> value="AVRG">����� <br>
329				<INPUT TYPE="radio" NAME="cost" disabled <%
330				if RS3("costingMethod")  = "LIFO" then
331					response.write " checked"
332				end if
333				%> value="LIFO">LIFO <br>
334				<INPUT TYPE="radio" NAME="cost" disabled <%
335				if RS3("costingMethod") = "FIFO" then
336					response.write " checked"
337				end if
338				%> value="FIFO">FIFO</TD>
339			</TR-->
340			</TABLE> 
341		</TD>
342	</TR>
343	</TABLE>
344	<CENTER>
345	<INPUT TYPE="checkbox" NAME="outByOrder" <% if RS3("outByOrder") then%> disabled checked <% end if %>>���� �� ���� �����<BR><BR><BR>
346
347	<INPUT TYPE="submit" value="�ѐ�� �� ���� ������" onclick="window.location='?catItem=<%=RS3("catID")%>'">
348	<INPUT TYPE="button" value="�ǁ ��� ����" onclick="window.open('myreport.asp?dateto=<%=request("dateto")%>&datefrom=<%=request("datefrom")%>&itemDetail=<%=itemDetail%>','_blank');"></CENTER>
349	<%
350	dateFrom = request("dateFrom")
351	dateTo = request("dateTo")
352
353	if dateTo="" then dateTo=shamsiToday()
354	if dateFrom="" then  dateFrom = left(shamsiToday(),4) & "/01/01"
355	'if dateFrom="" then dateFrom=session("FiscalYear")&"/01/01"
356	Set HRS = Conn.Execute("SELECT ISNULL(dbo.CalcSumQttyInv("&  itemDetail & ",'"&dateTo&"',0),0) As OurSumQtty,ISNULL(dbo.CalcSumQttyInv("&  itemDetail & ",'"&dateTo&"',1),0) As TheirSumQtty")
357	if Not HRS.EOF Then
358		mysumQtty = cdbl(HRS("OurSumQtty"))
359		ursumQtty = cdbl(HRS("TheirSumQtty"))
360	End if 
361	HRs.Close
362
363	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, InventoryLog.price 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.Logdate DESC,InventoryLog.isInput, InventoryLog.ID DESC"
364	set RSS=Conn.Execute (sqlstr)	
365
366	%><BR><BR>
367	<table align=center width=95%>
368	<TR bgcolor="eeeeee" >
369		<FORM METHOD=POST ACTION="">
370		<TD colspan=10>
371		<INPUT TYPE="hidden" NAME="OldItemID" value="<%=RS3("OldItemID")%>"><H4>
372		����� ���� � ���� ����  (�� ����� <INPUT TYPE="text" NAME="dateFrom" style="border:0pt" size=10 value="<%=dateFrom%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" > �� �����  <INPUT TYPE="text" NAME="dateTo" style="border:0pt" size=10 value="<%=dateTo%>" dir=ltr onKeyPress="return maskDate(this);" onblur="acceptDate(this)" >) <INPUT TYPE="submit" value="�����">
373		</H4></TD>
374		</FORM>
375	</TR>
376	<TR bgcolor="eeeeee" >
377		<td align="center"><small>����</small></td>
378		<TD align="center"><SMALL>����</SMALL></A></TD>
379		<TD align="center"><SMALL>����</SMALL></A></TD>
380		<td align="center"><small>���</small></td>
381		<TD align="center"><SMALL>���� ��</SMALL></A></TD>
382		<TD align="center"><SMALL>���� ��<br>������</SMALL></A></TD>
383		<TD align="center"><SMALL>����</SMALL></A></TD>
384		<TD align=center><SMALL>����� </SMALL></A></TD>
385		<TD align="center"><SMALL>�������</SMALL></A></TD>
386		<TD align="center"><SMALL>����</SMALL></A></TD>
387	</TR>
388	<%
389	tmpCounter=0
390	Do while not RSS.eof
391		tmpCounter = tmpCounter + 1
392		if tmpCounter mod 2 = 1 then
393			tmpColor="#FFFFFF"
394			tmpColor2="#FFFFBB"
395		Else
396			tmpColor="#DDDDDD"
397			tmpColor2="#EEEEBB"
398		End if 
399		if trim(request("logRowID"))=trim(RSS("id")) then
400			tmpColor = "yellow"
401		end if
402	%>
403	<TR bgcolor="<%=tmpColor%>"  style="height:25pt" <% if RSS("voided") then%> disabled title="��� ��� �� ����� <%=RSS("VoidedDate")%>"<% end if %>>
404		<td align=right dir=ltr><span style="font-size:10pt"><%=RSS("id")%></span></td>
405		<TD align=right dir=ltr><span style="font-size:10pt"><% if RSS("IsInput") then %><%=RSS("Qtty")%><% end if %></span></TD>
406		<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>
407		<td align=right dir=ltr title="��: <%if not isNull(rss("price")) and cdbl(rss("qtty"))>0  then response.write cdbl(rss("price"))/cdbl(rss("qtty")) else response.write "---" end if%>"><span style="font-size:10pt"><%=rss("price")%></span></td>
408		<TD align=right dir=ltr><span style="font-size:10pt"><% if mySumQtty<0 then response.write "<span style='color:red;'>" & mySumQtty & "</span>" else response.write mySumQtty end if%></span></TD>
409		<TD align=right dir=ltr><span style="font-size:10pt"><%=urSumQtty%></span></TD>
410		<TD align=right dir=ltr ><%=RSS("Unit")%></TD>
411		<TD dir=ltr align=center><%=RSS("logDate")%></span></TD>
412		<TD><% if RSS("type")= "2" then
413					response.write "<font color=red><b>����� ������</b></font>"
414				elseif RSS("type")= "3" then
415					response.write "<font color=green><b>������</b></font>"
416				elseif RSS("type")= "4" then
417					response.write "<font color=blue><b>����� ����� ���� </b></font>"
418				elseif RSS("type")= "5" then
419					response.write "<font color=orang><b>������</b></font>"
420				elseif RSS("type")= "6" then
421					response.write "<font color=#6699CC><b>���� �� �����</b></font>"
422				elseif RSS("type")= "7" then
423					response.write "<font color=#FF9966><b>���� �� ����� ������</b></font>"
424				elseif RSS("type")="9" then
425					response.write "<font color=#AAAA00><b>���� ������</b></font>"
426				elseif RSS("RelatedID")= "-1" then %> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
427			   <% else 
428					if RSS("IsInput") then 
429						%> ����� ����� ����: <A HREF="../purchase/outServiceTrace.asp?od=<%=RSS("RelatedID")%>"><%=RSS("RelatedID")%></A><%
430					else
431						%>����� ����� ����: <A HREF="default.asp?ed=<%=RSS("RelatedID")%>"><%=RSS("RelatedID")%></A><%
432					end if
433				end if %>
434			<% if RSS("owner")<> "-1" and RSS("owner")<> "-2" then
435				response.write " (������ <a href='../CRM/AccountInfo.asp?act=show&selectedCustomer="& RSS("owner") &"' target='_blank'> " & RSS("owner") & "</a>)"
436			   end if %>
437			<% if trim(RSS("comments"))<> "-" and RSS("comments")<> "" then
438				response.write " <br><br><B>�����:</B>  " & RSS("comments") 
439			   end if 
440			   set rs=Conn.Execute("select logDate,realName,price from InventoryPriceLog inner join users on InventoryPriceLog.userID = users.id where logID=" & rss("id") & " group by logDate,realName,price having count(price)>1")
441			   if not rs.eof then response.write("<br><b>������� ����:</b><br>")
442			   while not rs.eof
443			   	response.write("<small>�� ����� " & rs("logDate") & "� ���� " & rs("realName") & " " & rs("price") & " ����" &"</small>")
444			   	rs.moveNext
445			   wend
446			   rs.close
447			   set rs=nothing
448			   if CDbl(rss("qtty"))>0 and not rss("voided") then 
449				   if rss("isInput") then 
450				   	mySQL = "select * from InventoryFIFORelations where inID=" & rss("id")
451				   	msg1="���� ���̝�� �� ��� ����:"
452				   	msg2="���� �� ��� ���� ���� ����� ����"
453				   else
454				   	mySQL = "select * from InventoryFIFORelations where outID=" & rss("id")
455				 	msg1="���� ���ϝ�� ���� ��� ����:"
456				 	msg2="��� ���� ���� ����� ����! ���� ���ϝ��� ���� �� ���� ����� ����"
457				   end if
458				   set rs = Conn.Execute(mySQL)
459				   if rs.eof then 
460				   	response.write ("<br><b>" & msg2&"</b><br>")
461				   else
462				   	response.write ("<br><b>" & msg1&"</b><br>")
463				   end if
464				   while not rs.eof
465				   	if rss("isInput") then 
466				   		link = rs("outID")
467				   	else
468				   		link = rs("inID")
469				   	end if
470				   	response.write ("<small>" & rs("qtty") & " ��� �� " & link & "</small><br>")
471				   	rs.moveNext
472				   wend
473				   rs.close
474				   set rs=nothing
475			   end if
476			   %>
477		</TD>
478		<TD><%=RSS("RealName")%></TD>
479		<%
480		if Not RSS("Voided") Then
481			if RSS("IsInput") Then
482				if Rss("owner")=-1 then
483					mySumQtty = mySumQtty - cdbl(RSS("Qtty"))
484				else
485					urSumQtty = urSumQtty - cdbl(RSS("Qtty"))
486				end if 
487			else
488				if Rss("owner")=-1 then
489					mySumQtty = mySumQtty + cdbl(RSS("Qtty"))
490				else
491					urSumQtty = urSumQtty + cdbl(RSS("Qtty"))
492				end if 
493			end if 
494		end if
495
496		%>
497	</TR>
498	  
499	<% 
500		if not RSS("voided") then
501
502			if RSS("IsInput") then
503				if Rss("owner")=-1 then
504					inputs = inputs + cdbl(RSS("Qtty"))
505				else
506					urinputs = urinputs + cdbl(RSS("Qtty"))
507				end if 
508			else
509				if Rss("owner")=-1 then
510					outputs = outputs + cdbl(RSS("Qtty"))
511				else
512					uroutputs = uroutputs + cdbl(RSS("Qtty"))
513				end if 
514			end if
515		end if
516	RSS.moveNext
517	Loop
518	%>
519	<TR bgcolor="666666" height=25 style="color:white;">
520		<td></td>
521		<TD align=right dir=ltr><%=inputs+urinputs%></A></TD>
522		<TD align=right dir=ltr><%=outputs+uroutputs%></A></TD>
523		<TD colspan=7>���� ���� � ����  �� ����� <span dir=ltr><%=dateFrom%></span> �� ����� <span dir=ltr><%=dateTo%></span></A></TD>
524	</TR>
525	<TR bgcolor="cccccc" height=25 style="color:black;">
526		<td></td>
527		<TD align=right dir=ltr><%=inputs%></A></TD>
528		<TD align=right dir=ltr><%=outputs%></A></TD>
529		<TD colspan=7>���� ���� � ����  �� ����� <span dir=ltr><%=dateFrom%></span> �� ����� <span dir=ltr><%=dateTo%></span> ������</A></TD>
530	</TR>
531	<TR bgcolor="cccccc" height=25 style="color:black;">
532		<td></td>
533		<TD align=right dir=ltr><%=urinputs%></A></TD>
534		<TD align=right dir=ltr><%=uroutputs%></A></TD>
535		<TD colspan=7>���� ���� � ����  �� ����� <span dir=ltr><%=dateFrom%></span> �� ����� <span dir=ltr><%=dateTo%> </span> ������</A></TD>
536	</TR>
537	<% 
538		sqlstr = "SELECT ROUND(ISNULL((SELECT Sum(Qtty) From InventoryLog Where (Voided=0) And (ItemID = "&  itemDetail & ") And Logdate<'"&dateFrom&"' And isInput=1),0),2) As InputQtty, ROUND(ISNULL((SELECT Sum(Qtty) From InventoryLog Where (Voided=0) And (ItemID = "&  itemDetail & ") And Logdate<'"&dateFrom&"' And isInput=0 ),0), 2) As OutputQtty"
539		set DRS1 = conn.Execute(sqlstr)
540		if (not DRS1.EOF) then
541		%>
542	<Tr><td colspan=11 Height=20 ></td></tr>
543	<TR bgcolor="#FFFFFF"  style="height:25pt;" >
544		<td></td>
545		<TD align=right dir=ltr ><span style="font-size:10pt"><%=DRS1("InputQtty")%></span></TD>
546		<TD align=right dir=ltr ><span style="font-size:10pt"><%=DRS1("OutputQtty")%></span></TD>
547		<TD align=right dir=ltr ><span style="font-size:10pt"><%=cdbl(DRS1("InputQtty")) - cdbl(DRS1("OutputQtty")) %></span></TD>
548		<TD align=right Colspan=6  >
549		����� � ���� �� ��� �� ����� <span dir=ltr><%=dateFrom%></span>
550		</TD>
551	</TR>
552		<%
553		End if
554		DRS1.Close
555		%>
556	</table><BR><BR>
557<%
558end if
559%>
560<!--#include file="tah.asp" -->