PageRenderTime 27ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/inventory/default.asp

http://github.com/khaneh/Orders
ASP | 1041 lines | 908 code | 84 blank | 49 comment | 127 complexity | 60c7015833632af9d217a657780ea504 MD5 | raw file
   1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
   2'Inventory (5)
   3PageTitle= " ���� ����� �����"
   4SubmenuItem=1
   5if not (Auth(5 , 1) or Auth(5 , 9)) then NotAllowdToViewThisPage()
   6
   7%>
   8<!--#include file="top.asp" -->
   9<!--#include File="../include_farsiDateHandling.asp"-->
  10<!--#include File="../include_JS_InputMasks.asp"-->
  11<!--#include File="../include_UtilFunctions.asp"-->
  12		<SCRIPT LANGUAGE="JavaScript">
  13		<!--
  14		function boxChecked(obj)
  15		{
  16		theTR = obj.parentNode.parentNode
  17		rowNo = theTR.rowIndex - 2
  18
  19		if(obj.checked)
  20			{
  21			document.getElementsByName("box")[rowNo].value = 1;
  22			}
  23		else
  24			{
  25			document.getElementsByName("box")[rowNo].value = 0;
  26			}
  27		}
  28
  29
  30		function conf()
  31		{
  32			var CusHavItemIDs=new Array(100);
  33			var CusHavItemNames=new Array(100);
  34			var CusHavQttys=new Array(100);
  35			var CusHavMax=new Array(100);
  36			var CusHavCount = 0;
  37			var CusHavFlag = true;
  38			var retValue = true;
  39
  40			if (document.all.CustomerHaveInvItem[0]) {
  41				for(n=0;n<document.all.CustomerHaveInvItem.length;n++) {
  42					if(document.all.CustomerHaveInvItem[n].checked)
  43					{
  44						CusHavFlag = true;
  45						for(m=0; m<CusHavCount; m++) {
  46							if (CusHavItemIDs[m] == document.all.itemID[n].value) {
  47								CusHavQttys[m] += parseInt(document.all.qtty[n].value);
  48								CusHavFlag = false;
  49							}
  50						}
  51						if (CusHavFlag) {
  52								CusHavItemIDs[CusHavCount]=document.all.itemID[n].value;
  53								CusHavItemNames[CusHavCount]=document.all.itemName[n].value;
  54								CusHavQttys[CusHavCount] = parseInt(document.all.qtty[n].value);
  55								CusHavMax[CusHavCount] = parseInt(document.all.maxQtty[n].value);
  56								CusHavCount++;
  57							}
  58					}
  59				}
  60				for(m=0;m<CusHavCount;m++) 
  61					if (CusHavQttys[m]>CusHavMax[m]) {
  62					alert("���! ������ " + CusHavItemNames[m]+" ������ ���� ����")
  63					retValue = false
  64					}
  65			}
  66			else if (document.all.CustomerHaveInvItem) {
  67					if(document.all.CustomerHaveInvItem.checked)
  68					if (parseInt(document.all.qtty.value) > parseInt(document.all.maxQtty.value)) {
  69					alert("���! ������ " + document.all.itemName.value+" ������ ���� ����")
  70					retValue = false
  71					}
  72			}
  73		return retValue;
  74		}
  75		//-->
  76		</SCRIPT>
  77
  78<%
  79'-----------------------------------------------------------------------------------------------------
  80'-------------------------------------------------------------------------- PIRAMOON Pickuplist Submit
  81'-----------------------------------------------------------------------------------------------------
  82if request.form("Submit")="����� ����� �������" then
  83	invoice_id = trim(request.form("invoice_id"))
  84	if not isnumeric(invoice_id) then 
  85		response.write "<br><br>"
  86		call showAlert( "����� ������ ���� ��� ������ ���." , CONST_MSG_ERROR)
  87		response.end
  88	end if 
  89
  90
  91	'vvvvvvv ------------------------------------------ start of check for current ItemOUT
  92	set RSS=Conn.Execute ("SELECT InventoryLog.ID, InventoryLog.comments, InventoryLog.Voided, InventoryLog.VoidedBy, InventoryLog.VoidedDate, InventoryItems.Unit, InventoryItems.Name, InventoryItems.OldItemID, InventoryLog.logDate, InventoryLog.Qtty, InventoryLog.RelatedID, InventoryLog.ItemID, InventoryLog.type, InventoryLog.ID AS Expr1, 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 (InventoryLog.RelatedInvoiceID = "& invoice_id & ") AND (InventoryLog.IsInput = 0) AND (InventoryLog.Voided = 0)")
  93
  94	if not RSS.EOF then
  95		%>
  96		<br><br>
  97		<%
  98		call showAlert("���� ����� ��� ��� ���� �� ����� ���� ��� ���", CONST_MSG_ALERT)
  99		response.write "<br><br>" 
 100		%>
 101		<TABLE dir=rtl align=center width=600>
 102			<TR bgcolor="eeeeee" >
 103				<TD><SMALL>�� ����</SMALL></TD>
 104				<TD width=200><SMALL>��� ����</SMALL></TD>
 105				<TD><SMALL>����� </SMALL></TD>
 106				<TD><SMALL>����</SMALL></TD>
 107				<TD><SMALL>����� ����</SMALL></TD>
 108				<TD align=center><SMALL>����� �����</SMALL></TD>
 109				<TD><SMALL>����</SMALL></TD>
 110			</TR>
 111		<%
 112		tmpCounter=0
 113		do while not RSS.EOF
 114			tmpCounter = tmpCounter + 1
 115			if tmpCounter mod 2 = 1 then
 116				tmpColor="#FFFFFF"
 117				tmpColor2="#FFFFBB"
 118			Else
 119				tmpColor="#DDDDDD"
 120				tmpColor2="#EEEEBB"
 121			End if 
 122
 123			%>
 124			<TR bgcolor="<%=tmpColor%>"  style="height:25pt" <% if RSS("voided") then%> disabled title="��� ��� �� ����� <%=RSS("VoidedDate")%>"<% end if %>>
 125				<TD  align=right dir=ltr><INPUT TYPE="hidden" name="id" value="<%=RSS("ID")%>"><A HREF="invReport.asp?oldItemID=<%=RSS("oldItemID")%>&logRowID=<%=RSS("ID")%>" target="_blank"><%=RSS("OldItemID")%></A></TD>
 126				<TD><% if RSS("voided") then%><div style="position:absolute;width:520;"><hr style="color:red;"></div><% end if %><!A HREF="default.asp?itemDetail=<%=RSS("ID")%>"><span style="font-size:10pt"><%=RSS("Name")%></A></TD>
 127				<TD align=right dir=ltr><span style="font-size:10pt"><%=RSS("Qtty")%></span></TD>
 128				<TD align=right dir=ltr><%=RSS("Unit")%></TD>
 129				<TD dir=ltr><%=RSS("logDate")%></span></TD>
 130				<TD  align=center><% 
 131						if RSS("type")= "2" then
 132						response.write "<font color=red><b>����� ������</b></font>"
 133						elseif RSS("type")= "5" then
 134						response.write "<font color=orang><b>������</b></font>"
 135					   else %>
 136				<A HREF="default.asp?ed=<%=RSS("RelatedID")%>"><%=RSS("RelatedID")%></A>
 137					<% end if %>
 138					<% if RSS("owner")<> "-1" and RSS("owner")<> "-2" then
 139						response.write " (������ <a href='../CRM/AccountInfo.asp?act=show&selectedCustomer="& RSS("owner") &"' target='_blank'> " & RSS("owner") & "</a>)"
 140					   end if %>
 141					<% if RSS("comments")<> "-" and RSS("comments")<> "" then
 142						response.write " <br><br><B>�����:</B>  " & RSS("comments") 
 143					   end if %>
 144
 145				</TD>
 146				<TD><%=RSS("RealName")%></TD>
 147			</TR>
 148				  
 149			<% 
 150			RSS.movenext
 151		loop
 152		response.write "</table><br><br>" 
 153		response.end
 154
 155	end if
 156	RSS.close
 157	set RSS = nothing
 158	'^^^^^^^ ------------------------------------------ end of check for current ItemOUT
 159
 160	'vvvvvvv ------------------------------------------ start of check for current Inv PickupList
 161	set RSS=Conn.Execute ("SELECT InventoryPickuplistItems.pickupListID FROM InventoryPickuplistItems INNER JOIN InventoryItemRequests ON InventoryPickuplistItems.RequestID = InventoryItemRequests.ID INNER JOIN InventoryPickuplists ON InventoryPickuplistItems.pickupListID = InventoryPickuplists.id LEFT OUTER JOIN Orders ON InventoryPickuplistItems.Order_ID = Orders.ID WHERE (InventoryItemRequests.RelatedInvoiceID = "& invoice_id & ") GROUP BY InventoryPickuplistItems.pickupListID, InventoryPickuplists.Status HAVING (InventoryPickuplists.Status <> N'del')"	)
 162	if not RSS.EOF then
 163		str = "���� ��� ��� ���� ���� ����� ����� ���� ��� ���. <BR>�� ��� <B>����</B> ����� <BR><BR>"
 164		do while not RSS.EOF
 165			str = str & "&nbsp; <A target=_blank HREF='?show="& RSS("pickupListID") & "'>"& RSS("pickupListID") & "</A>"
 166			RSS.movenext
 167		loop
 168		%>
 169		<br><br>
 170		<%
 171		call showAlert(str, CONST_MSG_ALERT)
 172		response.write "<br><br>" 
 173		response.end
 174	end if
 175	'^^^^^^^ ------------------------------------------ end of check for current Inv PickupList
 176
 177	
 178	set RSS=Conn.Execute ("SELECT dbo.InventoryItems.Name, dbo.InvoiceLines.AppQtty, dbo.InventoryItems.ID as itemID, dbo.InvoiceItems.RelatedInventoryItemID, dbo.InventoryItems.Unit FROM dbo.InvoiceLines INNER JOIN dbo.InvoiceItems ON dbo.InvoiceLines.Item = dbo.InvoiceItems.ID INNER JOIN dbo.InventoryItems ON dbo.InvoiceItems.RelatedInventoryItemID = dbo.InventoryItems.OldItemID WHERE (dbo.InvoiceLines.Invoice = " & invoice_id & ")")
 179	st = ""
 180	do while not RSS.EOF
 181		mysql = "INSERT INTO dbo.InventoryItemRequests (Order_ID, ItemName, Comment, ReqDate, Status, ItemID, unit, CreatedBy, CustomerHaveInvItem, Qtty, RelatedInvoiceID) VALUES (-1,N'" & RSS("name") & "', N'����� �� ������ ����� "& invoice_id & "', N'" & shamsiToday() & "', 'new', " & RSS("itemID") & ", N'" & RSS("unit") & "', " & session("id") & ", 0 , " & RSS("AppQtty") & ", "& invoice_id & ")"
 182		Conn.Execute (mysql)
 183		'response.write "<br>" & mysql 
 184		set RSS2=Conn.Execute ("SELECT max(id) as itemReq from InventoryItemRequests")
 185		st = st & "&itemReq=" & RSS2("itemReq")
 186		RSS.movenext
 187	loop
 188
 189	RSS.close
 190	set RSS = nothing
 191	response.redirect "?Submit=sodoor" & st
 192	response.end
 193
 194
 195'-----------------------------------------------------------------------------------------------------
 196'--------------------------------------------------------------- EDIT Inventory Item Pickuplist Submit
 197'-----------------------------------------------------------------------------------------------------
 198elseif request.form("Submit")="����� �����" then
 199	GiveTo = request.form("GiveTo") 
 200	PickupListID = request.form("PickupListID") 
 201
 202	set RST=Conn.Execute ("SELECT RealName FROM Users WHERE (ID = "& GiveTo & ")" )
 203	GiveToRealName = RST("RealName")
 204
 205	set RSY=Conn.Execute ("UPDATE InventoryPickuplists SET  GiveTo ="& GiveTo & ", LastEditTime =N'"& currentTime10() & "', LastEditDate =N'"& shamsitoday() & "', LastEditedBy ="& session("id") & "  where id= "& PickupListID )
 206
 207	response.write "<BR><BR><TABLE align=center style='border: solid 2pt black'><TR><TD>"
 208	response.write "<li> �����  �����: " &  CreationDate & "  " & CreationTime
 209	response.write "<li> ������ �����: " & GiveToRealName
 210	response.write "<hr>"
 211
 212	for i=1 to request.form("ItemID").count
 213		ItemID		=	Clng(request.form("ItemID")(i))
 214		ID			=	Clng(request.form("ID")(i))
 215		ItemName	=	sqlSafe(request.form("ItemName")(i))
 216		unit		=	sqlSafe(request.form("unit")(i))
 217		qtty		=	cdbl(request.form("qtty")(i))
 218		box			=	sqlSafe(request.form("box")(i))
 219
 220		mysql = "UPDATE InventoryPickuplistItems SET ItemName = N'"& ItemName & "', Qtty = '"& Qtty & "', CustomerHaveInvItem='" & box & "' WHERE (id = "& ID & ")"
 221		Conn.Execute (mysql)
 222		response.write "<li> " & ItemName & " (" & Qtty & " " &  unit & ")"
 223		if box="1" then
 224			response.write "<b> ������ </b>" 
 225		end if
 226	next
 227
 228
 229	response.write "</TD></TR></TABLE><center>"
 230
 231	response.write "<BR><BR>����� ����� ��.</center>"
 232	response.redirect "default.asp?show=" & PickupListID
 233	response.end
 234
 235end if
 236
 237'-----------------------------------------------------------------------------------------------------
 238'------------------------------------------------------------- Print or Show Inventory Item Pickuplist 
 239'-----------------------------------------------------------------------------------------------------
 240if request("show")<>"" then
 241	PickupListID = request("show")
 242
 243	%>
 244	<BR><BR><BR>	
 245	<CENTER>
 246	<% 	ReportLogRow = PrepareReport ("InvPickupList.rpt", "InvItem_ID", PickupListID, "/beta/dialog_printManager.asp?act=Fin") %>
 247	<INPUT TYPE="button" value=" �ǁ " Class="GenButton" style="border:1 solid blue;" onclick="printThisReport(this,<%=ReportLogRow%>);">
 248
 249	<input type="button" value="�����" Class="GenButton" onclick="window.location='default.asp?ed=<%=PickupListID%>'">
 250
 251	</CENTER>
 252
 253	<BR>
 254	<iframe name=f1 id=f1 src="/CRReports/?Id=<%=ReportLogRow%>" align=center style="width:700; height:410; border-style: none" border=0 FRAMEBORDER=0 scrollbars=no></iframe>
 255	<%
 256
 257	response.end
 258end if
 259
 260
 261
 262
 263'-----------------------------------------------------------------------------------------------------
 264'---------------------------------------------------------------------- EDIT Inventory Item Pickuplist
 265'-----------------------------------------------------------------------------------------------------
 266if request("ed")<>"" then
 267	PickupListID = request("ed")
 268	set RSY=Conn.Execute ("SELECT * FROM InventoryPickuplists WHERE id = "& PickupListID )
 269	set RSW=Conn.Execute ("SELECT InventoryItemRequests.comment,InventoryItemRequests.ReqDate, dbo.InventoryItems.OldItemID AS OldItemID, dbo.InventoryPickuplistItems.*, dbo.Users.RealName AS RealName FROM dbo.InventoryItems INNER JOIN dbo.InventoryItemRequests INNER JOIN dbo.InventoryPickuplistItems ON dbo.InventoryItemRequests.ID = dbo.InventoryPickuplistItems.RequestID ON dbo.InventoryItems.ID = dbo.InventoryPickuplistItems.ItemID INNER JOIN dbo.Users ON dbo.InventoryItemRequests.CreatedBy = dbo.Users.ID WHERE (dbo.InventoryPickuplistItems.pickupListID = " & PickupListID & ")")
 270
 271	if RSY.EOF or RSW.EOF then%>
 272		<div align=center dir=rtl><br><br><br><br><br><br><b>���!!<br><h3>��� ����� ���� �����</h3></b><br></div>
 273		</body>
 274		</html>
 275	<%	
 276	else
 277		%><br>
 278		<form method=post action="default.asp" <% if RSY("Status")="done" then %> disabled <% end if %>  onsubmit="return confirm('������ ����� ����� ��Ͽ')"><br>
 279		<INPUT TYPE="hidden" name=PickupListID value="<%=PickupListID%>">
 280		<TABLE dir=rtl align=center width=600>
 281		<TR bgcolor="eeeeee" >
 282			<TD align=center colspan=7><B>����� ����� ����� </B></TD>
 283		</TR>
 284		<TR bgcolor="eeeeee" >
 285				<TD style="width:160;">��� ����</TD>
 286				<TD style="width:70;">����� �������</TD>
 287				<TD style="width:70;">�����</TD>
 288				<TD style="width:60;">������</TD>
 289				<TD>����� �����</TD>
 290				<TD  style="width:160;">����� ������ </TD>
 291		</TR>
 292		<%
 293		tmpCounter=0
 294		totalQtty=0
 295		Do while not RSW.eof
 296			tmpCounter = tmpCounter + 1
 297			if tmpCounter mod 2 = 1 then
 298				tmpColor="#FFFFFF"
 299				tmpColor2="#FFFFBB"
 300			Else
 301				tmpColor="#FFFFFF"
 302				tmpColor2="#FFFFBB"
 303			End if 
 304			%>
 305			<TR bgcolor="<%=tmpColor%>"  title="<% 
 306				response.write " �� ���� : " & RSW("OldItemID") & " - "
 307				Comment = RSW("Comment")
 308				if Comment<>"-" then
 309					response.write "�����: " & Comment
 310				else
 311					response.write "����� �����"
 312				end if
 313			%>">
 314				<%
 315				myRequestID=RSW("RequestID")
 316				totalQtty = totalQtty + RSW("qtty")
 317				%>
 318				<TD><INPUT TYPE="hidden" name=ID  value="<%=RSW("id")%>"><INPUT TYPE="hidden" name=itemID  value="<%=RSW("itemid")%>"><INPUT TYPE="hidden" name=unit  value="<%=RSW("unit")%>"><INPUT TYPE="text" NAME="itemName" readonly value="<%=RSW("ItemName")%>"  style="width:160; border:0"></TD>
 319				<TD><%=RSW("ReqDate")%></TD>
 320				<TD><INPUT TYPE="text" NAME="qtty" value="<%=RSW("qtty")%>"  size=7 style="width:45; border:0">  <%=RSW("unit")%></TD>
 321				<TD><%=RSW("RealName")%></TD>
 322				<TD>
 323				<% if RSW("order_ID")<>-1 then %>
 324				<a href="../order/order.asp?act=show&id=<%=RSW("order_ID")%>">
 325				<%=RSW("order_ID")%></a>
 326				<% end if %>
 327				</TD>
 328				<TD>
 329					<% 
 330
 331					set RST=Conn.Execute ("SELECT SUM((CONVERT(tinyint, dbo.InventoryLog.IsInput) - .5) * 2 * dbo.InventoryLog.Qtty) AS sumQtty, dbo.Accounts.AccountTitle FROM dbo.Orders INNER JOIN dbo.InventoryLog ON dbo.Orders.Customer = dbo.InventoryLog.owner INNER JOIN dbo.Accounts ON dbo.Orders.Customer = dbo.Accounts.ID WHERE (dbo.InventoryLog.ItemID = " & RSW("ItemID")  & " and dbo.InventoryLog.voided=0) GROUP BY dbo.Orders.ID, dbo.Accounts.AccountTitle HAVING (dbo.Orders.ID = " & RSW("order_ID")  & ")" )
 332					if not RST.EOF then
 333						
 334						if clng(RST("sumQtty")) < 0 then 
 335							response.write "<b>���!</b> ������ ����� ��� ����� ���� ���.�� ��� ��� ���� ����� ���� ���� ��ʿ!" 
 336							response.write "<INPUT TYPE='hidden' NAME='maxQtty'> <INPUT TYPE='hidden' NAME='CustomerHaveInvItem' value='-1'><INPUT TYPE='hidden' NAME='box'  value='0'>" 
 337						elseif clng(RST("sumQtty")) > 0 then  
 338							if RSW("CustomerHaveInvItem") then
 339								response.write "<INPUT TYPE='hidden' NAME='maxQtty' value='" & RST("sumQtty") & "'> <INPUT TYPE='checkbox' NAME='CustomerHaveInvItem' checked  value='" & RST("sumQtty") & "' onclick='boxChecked(this)'><INPUT TYPE='hidden' NAME='box'  value='1'> �� " & RST("sumQtty") & " " & RSW("unit") & " " &  RSW("ItemName") &  "  ������ " & RST("AccountTitle") & " ��� ��Ͽ"
 340							else 
 341								response.write "<INPUT TYPE='hidden' NAME='maxQtty'  value='" & RST("sumQtty") & "'> <INPUT TYPE='checkbox' NAME='CustomerHaveInvItem'  value='" & RST("sumQtty") & "'  onclick='boxChecked(this)'><INPUT TYPE='hidden' NAME='box'  value='0'> �� " & RST("sumQtty") & " " & RSW("unit") & " " & RSW("ItemName") & " ������ " & RST("AccountTitle") & " ��� ��Ͽ"
 342							end if 
 343						else
 344							response.write "<INPUT TYPE='hidden' NAME='maxQtty' > <INPUT TYPE='hidden' NAME='CustomerHaveInvItem'  value='-1'><INPUT TYPE='hidden' NAME='box'  value='0'>" 
 345						end if 
 346					else
 347						response.write "<INPUT TYPE='hidden' NAME='maxQtty' > <INPUT TYPE='hidden' NAME='CustomerHaveInvItem'  value='-1'><INPUT TYPE='hidden' NAME='box'  value='0'>" 
 348					end if
 349
 350					%>
 351				</TD>
 352			</TR>
 353			<% 
 354			RSW.moveNext
 355		Loop
 356		CreatedBy = RSY("CreatedBy")
 357		%>
 358		<TR bgcolor="eeeeee" >
 359			<TD align=center colspan=7 height=10></TD>
 360		</TR>
 361		<TR >
 362			<TD colspan=7 align=center><BR>������ �����: 
 363				<select name="GiveTo" class=inputBut  <% if RSY("Status")="done" then %> disabled <% end if %>>
 364				<% set RSV=Conn.Execute ("SELECT * FROM Users WHERE Display=1 ORDER BY RealName") 
 365				Do while not RSV.eof
 366				%>
 367					<option value="<%=RSV("ID")%>" <%
 368						if RSV("ID")=RSY("GiveTo") then
 369							response.write " selected "
 370						end if
 371						%>><%=RSV("RealName")%></option>
 372				<%
 373				RSV.moveNext
 374				Loop
 375				RSV.close
 376				%>
 377				</select><BR><BR>
 378				����� �����: <span dir=ltr bgcolor=red><%=RSY("CreationDate")%></span> - ���� <%=RSY("CreationTime")%>
 379				<BR><BR>
 380				�����: <%=RSY("Status")%>
 381				<BR><BR>
 382				<% if RSY("Printed")<>"0" then%>
 383				����� ����� �ǁ: <%=RSY("Printed")%>
 384				<% end if %>
 385				<BR><BR>
 386				<INPUT TYPE="submit"  class=inputBut Name="Submit" Value="����� �����"  style="width:100px;" tabIndex="14"  <% if RSY("Status")="done" then %> disabled <% end if %>  onclick="return conf()">
 387				<!INPUT TYPE="submit"  class=inputBut Name="Submit" Value="�ǁ �����"  style="width:100px;" tabIndex="14"  <% if RSY("Status")="done" then %> disabled <% end if %>>
 388			</TD>
 389		</TR>
 390		</FORM>
 391		</body>
 392		</html>
 393		<%
 394	end if 
 395	response.end
 396end if
 397
 398'-----------------------------------------------------------------------------------------------------
 399'-------------------------------------------------------------------- Inventory Item Pickuplist Submit
 400'-----------------------------------------------------------------------------------------------------
 401if request.form("Submit")="��� �����" then
 402'response.write "<br>" & replace(request.form,"&","<br>")
 403'esponse.end
 404
 405	response.write "<BR><BR><TABLE align=center style='border: solid 2pt black'><TR><TD>"
 406
 407	'===================================================
 408	'create an pickuplist item
 409	'===================================================
 410	GiveTo			=	request.form("GiveTo") 
 411	CreationDate	=	shamsiToday()
 412	CreationTime	=	currentTime10()
 413	CreatedBy		=	session("id")
 414	Status			=	"new"
 415
 416	set RST=Conn.Execute ("SELECT RealName FROM Users WHERE (ID = "& GiveTo & ")" )
 417	GiveToRealName = RST("RealName")
 418
 419	mysql = "INSERT INTO InventoryPickuplists (CreationTime, CreationDate, Status, CreatedBy, GiveTo) VALUES (N'"& CreationTime & "', N'"& CreationDate & "', N'new', "& CreatedBy & ", "& GiveTo & ")"
 420	Conn.Execute (mysql)
 421	'response.write mysql
 422	response.write "<li> ����� : " &  CreationDate & "  " & CreationTime
 423	response.write "<li> ������ �����: " & GiveToRealName
 424	response.write "<hr>"
 425	
 426
 427	'===================================================
 428	'create many pickuplist lines for an pickuplist item
 429	'===================================================
 430	set RSX=Conn.Execute ("SELECT * FROM InventoryPickuplists WHERE CreationTime = N'"& CreationTime & "' and CreationDate=N'" & CreationDate & "' and GiveTo=" & GiveTo )	
 431	pickupListID = RSX("id")
 432	RSX.close
 433
 434	for i=1 to request.form("ItemID").count
 435		ItemID		=	request.form("ItemID")(i)
 436		ItemName	=	request.form("ItemName")(i)
 437		unit		=	request.form("unit")(i)
 438		qtty		=	request.form("qtty")(i)
 439		order_ID	=	request.form("Related_order_ID")(i)
 440		RequestID	=	request.form("RequestID")(i)
 441		box			=	request.form("box")(i)
 442
 443		mysql = "INSERT INTO InventoryPickuplistItems (pickupListID, Order_ID, ItemName, ItemID, Qtty, unit, RequestID, CustomerHaveInvItem) VALUES ( "& pickupListID & ", "& order_ID & ", N'"& ItemName & "', "& ItemID & ", "& qtty & ", N'"& unit & "', "& RequestID & ", " &  box & ")"
 444		Conn.Execute (mysql)
 445		'response.write mysql
 446		response.write "<li> " & ItemName & " (" & Qtty & " " &  unit & ")"
 447		if box="1" then
 448			response.write "<b> ������ </b>" 
 449		end if
 450	next
 451
 452
 453	'===================================================
 454	'change status of related requests
 455	'===================================================
 456	for i=1 to request.form("RequestID").count
 457		RequestID	=	request.form("RequestID")(i)
 458
 459		mysql = "UPDATE InventoryItemRequests SET Status = N'pick' WHERE (ID = "& RequestID & ")"
 460		Conn.Execute (mysql)
 461		'response.write mysql
 462	next
 463
 464	response.write "</TD></TR></TABLE><center>"
 465	%>
 466	<form method=post action="default.asp?PickupListID=<%=pickupListID%>" ><br>
 467	<INPUT TYPE="submit"  class=inputBut Name="Submit" Value="�ǁ �����"  style="width:100px;" tabIndex="14">
 468	</form>
 469	<%
 470	response.write "<BR><BR>����� ���� ��.</center>"
 471	response.redirect "default.asp?show=" & PickupListID
 472	response.end
 473
 474end if
 475
 476'-----------------------------------------------------------------------------------------------------
 477'------------------------------------------------------------- Inventory Item Pickuplist Creation Form
 478'-----------------------------------------------------------------------------------------------------
 479if request("Submit")="��� �������" then
 480	if request("itemReq").count < 1 then%>
 481		<br><br>
 482		<%
 483		call showAlert("��� ��������  ���� ��� ������ ���� ���", CONST_MSG_ERROR)
 484	else
 485		for i=1 to request("itemReq").count
 486			myRequestID=request("itemReq")(i)
 487			set RSX=Conn.Execute ("SELECT * from [dbo].[InventoryItemRequests] where id=" & myRequestID)
 488			itemName = RSX("Qtty") & " " & RSX("unit") & " " & RSX("ItemName")
 489			CSR = RSX("CreatedBy")
 490			set RSX=Conn.Execute ("update [dbo].[InventoryItemRequests] set status='del' where id=" & myRequestID)
 491			call InformRequestDenied(itemName, CSR)
 492			response.write "<br><br><center><li> ������� " & itemName & " ��� ��. </center>"
 493		next
 494	end if
 495	'response.end
 496end if
 497'-----------------------------------------------------------------------------------------------------
 498'------------------------------------------------------------- Inventory Item Pickuplist Creation Form
 499'-----------------------------------------------------------------------------------------------------
 500if request("Submit")="���� ����� ����" or request("Submit")="sodoor" then
 501	if request("itemReq").count < 1 then%>
 502		<div align=center dir=rtl><br><br><br><br><br><br><b>���!!<br><h3>��� �������� ������ ���� ���</h3></b><br></div>
 503		</body>
 504		</html>
 505	<%	
 506	else
 507		%><br>
 508		<form method=post action="default.asp" onsubmit="return confirm('���� ����� ����� ��Ͽ')">
 509		<TABLE dir=rtl align=center width=600>
 510		<TR bgcolor="eeeeee" >
 511			<TD align=center colspan=7><B>����� ����� </B></TD>
 512		</TR>
 513		<TR bgcolor="eeeeee" >
 514				<TD style="width:160;">��� ����</TD>
 515				<TD style="width:70;">����� �������</TD>
 516				<TD style="width:70;">�����</TD>
 517				<TD style="width:60;">������</TD>
 518				<TD>����� �����</TD>
 519				<TD  style="width:160;">����� ������ </TD>
 520		</TR>
 521		<%
 522		tmpCounter=0
 523		totalQtty=0
 524		for i=1 to request("itemReq").count
 525			myRequestID=request("itemReq")(i)
 526			set RSX=Conn.Execute ("SELECT dbo.InventoryItems.OldItemID AS OldItemID, InventoryItems.name, dbo.InventoryItemRequests.*, dbo.Users.RealName AS RealName FROM dbo.InventoryItems INNER JOIN dbo.InventoryItemRequests ON dbo.InventoryItems.ID = dbo.InventoryItemRequests.ItemID INNER JOIN dbo.Users ON dbo.InventoryItemRequests.CreatedBy = dbo.Users.ID WHERE InventoryItemRequests.ID = "& myRequestID )	
 527			totalQtty = totalQtty + RSX("qtty")
 528			tmpCounter = tmpCounter + 1
 529			if tmpCounter mod 2 = 1 then
 530				tmpColor="#FFFFFF"
 531				tmpColor2="#FFFFBB"
 532			Else
 533				tmpColor="#FFFFFF"
 534				tmpColor2="#FFFFBB"
 535			End if 
 536			%>
 537			<TR bgcolor="<%=tmpColor%>" title="<% 
 538				response.write " �� ���� : " & RSX("OldItemID") & " - "
 539				Comment = RSX("Comment")
 540				if Comment<>"-" then
 541					response.write "�����: " & Comment
 542				else
 543					response.write "����� �����"
 544				end if
 545			%>">
 546				<TD >
 547					<INPUT TYPE="hidden" name=RequestID  value="<%=RSX("id")%>">
 548					<INPUT TYPE="hidden" name=itemID  value="<%=RSX("ItemID")%>">
 549					<INPUT TYPE="text" readonly NAME="itemName" value="<%=RSX("Name")%>" style="width:160; border:0">
 550					<br>
 551					<small>�� ����� ���: <%=RSX("ItemName")%></small>
 552				</TD>
 553				<TD align=center>
 554					<span dir=ltr><%=shamsidate(RSX("ReqDate"))%></span>
 555					<span dir=ltr><%=DatePart("h",RSX("ReqDate")) &":"& DatePart("n",RSX("ReqDate"))%></span>
 556				</TD>
 557				<TD>
 558					<INPUT TYPE="text" NAME="qtty" value="<%=RSX("qtty")%>"  size=7 style="width:45; border:0">  <%=RSX("unit")%>
 559					<INPUT TYPE="hidden" name=unit  value="<%=RSX("unit")%>">
 560				</TD>
 561				<TD><%=RSX("RealName")%></TD>
 562				<TD><INPUT TYPE="hidden" name="Related_order_ID"  value="<%=RSX("orderID")%>">
 563				<% if RSX("orderID")<>-1 then %>
 564				<a href="../order/order.asp?act=show&id=<%=RSX("orderID")%>">
 565				<%=RSX("orderID")%></a>
 566				<% end if %>
 567				</TD>
 568				<TD>
 569					<% 
 570
 571					set RST=Conn.Execute ("SELECT SUM((CONVERT(tinyint, dbo.InventoryLog.IsInput) - .5) * 2 * dbo.InventoryLog.Qtty) AS sumQtty, dbo.Accounts.AccountTitle FROM dbo.Orders INNER JOIN dbo.InventoryLog ON dbo.Orders.Customer = dbo.InventoryLog.owner INNER JOIN dbo.Accounts ON dbo.Orders.Customer = dbo.Accounts.ID WHERE (dbo.InventoryLog.ItemID = " & RSX("ItemID")  & " and dbo.InventoryLog.voided=0) GROUP BY dbo.Orders.ID, dbo.Accounts.AccountTitle HAVING (dbo.Orders.ID = " & RSX("orderID")  & ")" )
 572					if not RST.EOF then
 573						
 574						if clng(RST("sumQtty")) < 0 then 
 575							response.write "<b>���!</b> ������ ����� ��� ����� ���� ���.�� ��� ��� ���� ����� ���� ���� ��ʿ!" 
 576							response.write "<INPUT TYPE='hidden' NAME='maxQtty'> <INPUT TYPE='hidden' NAME='CustomerHaveInvItem' value='-1'><INPUT TYPE='hidden' NAME='box'  value='0'>" 
 577						elseif clng(RST("sumQtty")) > 0 then  
 578							if RSX("CustomerHaveInvItem") then
 579								response.write "<INPUT TYPE='hidden' NAME='maxQtty' value='" & RST("sumQtty") & "'> <INPUT TYPE='checkbox' NAME='CustomerHaveInvItem' checked  value='" & RST("sumQtty") & "' onclick='boxChecked(this)'><INPUT TYPE='hidden' NAME='box'  value='1'> �� " & RST("sumQtty") & " " & RSX("unit") & " " &  RSX("ItemName") &  "  ������ " & RST("AccountTitle") & " ��� ��Ͽ"
 580							else 
 581								response.write "<INPUT TYPE='hidden' NAME='maxQtty'  value='" & RST("sumQtty") & "'> <INPUT TYPE='checkbox' NAME='CustomerHaveInvItem'  value='" & RST("sumQtty") & "'  onclick='boxChecked(this)'><INPUT TYPE='hidden' NAME='box'  value='0'> �� " & RST("sumQtty") & " " & RSX("unit") & " " & RSX("ItemName") & " ������ " & RST("AccountTitle") & " ��� ��Ͽ"
 582							end if 
 583						else
 584							response.write "<INPUT TYPE='hidden' NAME='maxQtty' > <INPUT TYPE='hidden' NAME='CustomerHaveInvItem'  value='-1'><INPUT TYPE='hidden' NAME='box'  value='0'>" 
 585						end if 
 586					else
 587						response.write "<INPUT TYPE='hidden' NAME='maxQtty' > <INPUT TYPE='hidden' NAME='CustomerHaveInvItem'  value='-1'><INPUT TYPE='hidden' NAME='box'  value='0'>" 
 588					end if
 589
 590					%>
 591				</TD>
 592			</TR>
 593			<% 
 594			CreatedBy = RSX("CreatedBy")
 595			LastRSX_typeID = RSX("ItemID")
 596			RSX.moveNext
 597		next
 598		%>
 599		<TR bgcolor="eeeeee" >
 600			<TD align=center colspan=7 height=10></TD>
 601		</TR>
 602		<TR >
 603			<TD colspan=7 align=center><BR>������ �����: 
 604				<select name="GiveTo" class=inputBut>
 605				<% set RSV=Conn.Execute ("SELECT * FROM Users WHERE Display=1 ORDER BY RealName") 
 606				Do while not RSV.eof
 607				%>
 608					<option value="<%=RSV("ID")%>" <%
 609						if RSV("ID")=CreatedBy then
 610							response.write " selected "
 611						end if
 612						%>><%=RSV("RealName")%></option>
 613				<%
 614				RSV.moveNext
 615				Loop
 616				RSV.close
 617				%>
 618				</select><BR><BR>
 619				����� �����: <span dir=ltr bgcolor=red><%=shamsitoday()%></span> 
 620				<BR><BR>
 621				<INPUT TYPE="submit"  class=inputBut Name="Submit" Value="��� �����"  style="width:100px;" tabIndex="14" onclick="return conf()">
 622			</TD>
 623		</TR>
 624		</FORM>
 625		</body>
 626		</html>
 627		<%
 628	end if 
 629	response.end
 630end if
 631
 632if Request("act")="waste" then 
 633	if not Auth(5 , "K") then NotAllowdToViewThisPage()
 634 %>
 635<div class="inPage">
 636	<span>����� �����: </span>
 637	<input id="orderID" size="6" class="boot"/>
 638	<div id="message" class="well well-small"><ul></ul></div>
 639</div>
 640<div id="orderHeader" class="well"></div>
 641<div id="confirm">
 642	<h4></h4>
 643	<h5>���� ��� �� ���� ��� ������� ��� ����</h5>
 644	<input name="comment" type="text" size="20"/>
 645</div>
 646<script type="text/javascript">
 647$(document).ready(function(){
 648	$("#confirm").dialog({
 649		autoOpen: false,
 650		buttons: {"�����":function(){
 651			var thisLI = $("#message ul li input[name=add].btn-danger").closest("li");
 652			$.ajax({
 653				type:"POST",
 654				url:"/service/json_getInventory.asp",
 655				data:{
 656					act:"addWasteRequest",
 657					orderID:$("#orderID").val(),
 658					rowName: thisLI.find("input[name=rowName]").val(),
 659					rowID: thisLI.find("input[name=rowID]").val(),
 660					maxRowID: thisLI.find("input[name=maxRowID]").val(),
 661					groupName: thisLI.find("input[name=groupName]").val(),
 662					qtty: thisLI.find("input[name=qtty]").val(),
 663					reqID: thisLI.find("input[name=reqID]").val(),
 664					comment: $("#confirm input[name=comment]").val()
 665				},
 666				dataType:"json"
 667			}).done(function (data){
 668				$("#message").append(data.status);
 669				$(this).dialog("close");
 670			});
 671			//thisLI.find("input[name=add]").removeClass("btn-danger");
 672			//$("#message ul li input[name=add]").prop("disabled",false);
 673			
 674		}},
 675		title: "�����"
 676	});
 677	
 678	$("#orderID").blur(function(){
 679		var orderID = Number($("#orderID").val());
 680		$("#message ul").html("");
 681		if (!isNaN(orderID) && orderID!='') {
 682			loadXMLDoc("/service/xml_getOrderProperty.asp?act=showHead&id=" + orderID, function(orderXML){
 683				
 684				var isOrder = $(orderXML).find("status isOrder").text();
 685				var isClosed = $(orderXML).find("status isClosed").text();
 686				var isApproved = $(orderXML).find("status isApproved").text();
 687				var invoiceIssued = $(orderXML).find("status invoiceIssued").text();
 688				var invoiceApproved = $(orderXML).find("status invoiceApproved").text();
 689				var step = $(orderXML).find("status step").text();
 690				var dis="";
 691				if (isOrder=='0'){
 692					$("#message").html("������� �� ������ �����!!!!!");
 693					dis = "disabled='disabled'";
 694				} else
 695				if (isClosed!='0'){
 696					$("#message").html("����� ���� ���!");
 697					dis = "disabled='disabled'";
 698				} else if (isApproved=='0'){
 699					$("#message").html("����� ����� ����");
 700					dis = "";
 701				} else if (invoiceIssued!='0') {
 702					$("#message").html("����! ������ ���� ���!");
 703					dis = "disabled='disabled'";
 704				} else if (invoiceApproved!='0'){
 705					$("#message").html("������ ��� ����� ����� ���� ���� ��� � ���� �� �� ���� ����");
 706					dis = "disabled='disabled'";
 707				} else {
 708					dis = "";
 709				}	
 710				
 711				TransformXml(orderXML, "/xsl.<%=version%>/orderShowHeader.xsl", function(result){
 712					$("#orderHeader").html(result);	
 713					$('a#customerID').click(function(e){
 714						window.open('../CRM/AccountInfo.asp?act=show&selectedCustomer='+$('a#customerID').attr("myID"), 'showCustomer');
 715						e.preventDefault();
 716					});
 717				});
 718				loadXMLDoc("/service/xml_getOrderProperty.asp?act=editOrder&id=" + orderID, function(propXML){
 719					loadXMLDoc("/service/xml_getOrderProperty.asp?act=stock&id=" + orderID, function(stockXML){
 720						$(propXML).find("group[hasStock=yes]").each(function(i){
 721							var rowName = $(this).closest("rows").attr("name");
 722							var groupName = $(this).attr("name");
 723							var invoiceItem = $(this).attr("item");
 724							var rowID = $(this).closest("row").attr("id");
 725							var req = $(stockXML).find("req/invoiceItem:contains(" + invoiceItem + ")").find("rowID:contains(" + rowID + ")").parent().find("reqStatus:not(:contains('del'))").parent();
 726							if (req.size()!=0){
 727								$("#message ul").append("<li><span name='itemName'>" + $(req).find("ItemName").text() + 
 728									"</span><input name='qtty' value='" + $(req).find("Qtty").text() + 
 729									"' size='4'/><input name='add' " + dis + 
 730									" type='button' class='btn' value='��� �������' onclick='addRequest(this)'/><span name='unit'>" + 
 731									$(req).find("unit").text() + "</span><input type='hidden' name='rowName' value='" + 
 732									rowName + "'/><input type='hidden' name='reqID' value='" + $(req).find("ID").text() + 
 733									"'/><input type='hidden' name='groupName' value='" + groupName + 
 734									"'/><input type='hidden' name='rowID' value='" + rowID + 
 735									"'/><input type='hidden' name='maxRowID' value='0'/></li>");
 736							}
 737							
 738						});
 739						$("#message ul li").each(function(i){
 740							var rowName = $(this).find("input[name=rowName]").val();
 741							var rowID = parseInt($(this).find("input[name=rowID]").val());
 742							var maxRowID = parseInt($(this).find("input[name=maxRowID]").val());
 743							if (rowID > maxRowID)
 744								$("#message ul li input[name=rowName]").parent().find("input[name=maxRowID]").val(rowID);
 745						});
 746					});
 747				});
 748			});
 749		} 
 750	});
 751});
 752function addRequest(e){
 753	var thisLI = $(e).closest("li");
 754	$("#confirm h4").html("��� ������� ����� �� ���� " + thisLI.find("span[name=itemName]").text() + " " + thisLI.find("input[name=qtty]").val() + " " + thisLI.find("span[name=unit]").text() + " �� ���� �����/������ ������� ���Ͽ");
 755	thisLI.find("input[name=add]").addClass("btn-danger");
 756	$("#message ul li input[name=add]").prop("disabled",true);
 757	$("#confirm").dialog("open");
 758}
 759</script>
 760<%	
 761	Response.end
 762end if
 763
 764'-----------------------------------------------------------------------------------------------------
 765'--------------------------------------------------------------------- LIST Inventory Item Pickuplists
 766'-----------------------------------------------------------------------------------------------------
 767%>
 768<style>
 769	.changeItem{cursor: pointer;}
 770	td.delBtn {position: relative;}
 771	td.delBtn span {position: absolute;opacity: .6;cursor: pointer;top:2px;left: 20px;font-size: 8px;font-family: tahoma;}
 772</style>
 773<script type="text/javascript">
 774	$(document).ready(function(){
 775		$.ajaxSetup({
 776			cache: false
 777		});
 778		$("td.delBtn span").css('display','none');
 779		$("td.delBtn").mouseover(function(event){
 780			$(this).find("span").css("display","block");
 781		});
 782		$("td.delBtn").mouseout(function(event){
 783			$(this).find("span").css("display","none");
 784		});	
 785		$("td.delBtn span").click(function(){
 786			var requestID = $(this).closest("td").find("input[name=itemReq]").val();
 787			$("#comfirmDel input").val(requestID);
 788			if (parseInt($(this).closest("td").find("input[name=itemReq]").attr("invoiceitem")) > 0){
 789				$("#comfirmDel h3").html("����� �� ���� ����� ���� ����� ��� ������� �� ���� ������ ���� ����� ����� ��");
 790			} else {
 791				$("#comfirmDel h3").html("�� ��� ��� ������� ������� ����Ͽ");
 792			}
 793			$("#comfirmDel").dialog("open");
 794			
 795		});
 796		$('.changeItem').prop('title','��� �����/����� ���� ���� ����');
 797		$('.changeItem').click(function(){
 798			var myRow = $(this).closest("tr");
 799			var itemReq = myRow.find('input[name=itemReq]').val();
 800			var theInvoiceitem = myRow.find('input[name=itemReq]').attr('invoiceitem');
 801			$("#itemReq").val(itemReq);
 802			
 803			$.ajax({
 804				type:"POST",
 805				url:"/service/json_getInventory.asp",
 806				data:{act:"itemListFromInvoiceItem",invoiceItem:theInvoiceitem},
 807				dataType:"json"
 808			}).done(function (data){
 809				$("#itemID").children("option").remove();
 810				$.each(data,function(i,e){
 811					$("#itemID").append("<option value='" + e.inventoryItem + "' unit='" + e.unit + "'>" + e.name + "(" + e.unit + ")" + "</option>")
 812				});
 813			});
 814			$('#changeItemDlg').dialog("open");
 815		});
 816		$("#changeItemDlg").dialog({ 
 817			autoOpen: false,
 818			buttons: {"�����":function(){
 819				var invID=$("input[name=InvoiceID]").val();
 820				$.ajax({
 821					type:"POST",
 822					url:"/service/json_getInventory.asp",
 823					data:{act: "updateItemRequest" ,id: $("#itemReq").val(), unit: $("#itemID option:selected").attr("unit"), itemID:$("#itemID option:selected").val()},
 824					dataType:"json"
 825				}).done(function (data){
 826					if (data.status=="ok")
 827						$("[name=itemReq][value=" + $("#itemReq").val() + "]").prop("disabled",false);
 828					//location.reload();
 829				});
 830				$(this).dialog("close");
 831			}},
 832			title: "������ ����"
 833		});
 834		$("#comfirmDel").dialog({
 835			autoOpen: false,
 836			buttons: {"�����":function(){
 837				$.ajax({
 838					type:"POST",
 839					url:"/service/json_getInventory.asp",
 840					data:{act:"delInvRequest",id:$("#comfirmDel input").val()},
 841					dataType:"json"
 842				}).done(function(data){
 843					if (data.status=="ok")
 844						$("[name=itemReq][value=" + $("#comfirmDel input").val() + "]").closest("tr").remove();
 845				});
 846				$(this).dialog("close");
 847			}},
 848			title: "��� �������"
 849		});
 850	});
 851</script>
 852<div id='changeItemDlg'>
 853	<input type="hidden" id="itemReq"/>
 854	<select id='itemID'></select>
 855</div>
 856<div id='comfirmDel'>
 857	<h3></h3>
 858	<input type="hidden" name="reqID"/>
 859</div>
 860<BR><BR>
 861<br>
 862<FORM METHOD=POST ACTION="default.asp">
 863<%
 864
 865sortBy=request("s")
 866if sortBy="5" then 
 867	sB="orderID"
 868elseif sortBy="2" then 
 869	sB="ReqDate"
 870elseif sortBy="3" then 
 871	sB="Qtty"
 872elseif sortBy="4" then 
 873	sB="CreatedBy"
 874else 
 875	sB="ItemName"
 876end if
 877
 878if Auth(5 , 9) then
 879	set RSS=Conn.Execute ("SELECT dbo.InventoryItemRequests.*, dbo.Users.RealName AS RealName FROM dbo.InventoryItemRequests INNER JOIN dbo.Users ON dbo.InventoryItemRequests.CreatedBy = dbo.Users.ID WHERE (dbo.InventoryItemRequests.Status = 'new') AND (dbo.InventoryItemRequests.OrderID <> - 1) order by " & sB)
 880
 881	if not RSS.eof then
 882		%>
 883		<TABLE dir=rtl align=center width=600>
 884		<TR bgcolor="eeeeee" height=20>
 885			<TD align=center colspan=6><INPUT TYPE="hidden" name=color1 value="#FFFFFF"><INPUT TYPE="hidden" name=color2 value="#FFFFBB"><B>������� ���  ����� ����� �� ����� ��</B></TD>
 886		</TR>
 887		<TR bgcolor="eeeeee" >
 888			<TD><INPUT TYPE="checkbox" NAME="" disabled><INPUT TYPE="hidden" name=color1 value="#FFFFFF"><INPUT TYPE="hidden" name=color2 value="#FFFFBB"</TD>
 889			<TD><A HREF="default.asp?s=1"><SMALL>���  ����</SMALL></A></TD>
 890			<TD><A HREF="default.asp?s=2"><SMALL>����� �������</SMALL></A></TD>
 891			<TD><A HREF="default.asp?s=3"><SMALL>�����</SMALL></A></TD>
 892			<TD><A HREF="default.asp?s=4"><SMALL>������� �����</SMALL></A></TD>
 893			<TD><A HREF="default.asp?s=5"><SMALL>����� �����</SMALL></A></TD>
 894		</TR>
 895		<%
 896		tmpCounter=0
 897		Do while not RSS.eof
 898			tmpCounter = tmpCounter + 1
 899			if tmpCounter mod 2 = 1 then
 900				tmpColor="#FFFFFF"
 901				tmpColor2="#FFFFBB"
 902			Else
 903				tmpColor="#FFFFFF"
 904				tmpColor2="#FFFFBB"
 905				'tmpColor="#DDDDDD"
 906				'tmpColor2="#EEEEBB"
 907			End if 
 908
 909		%>
 910		<TR bgcolor="<%=tmpColor%>" >
 911			<TD class="delBtn">
 912				<INPUT TYPE="hidden" name=color1 value="<%=tmpColor%>"/>
 913				<INPUT TYPE="hidden" name=color2 value="<%=tmpColor2%>"/>
 914				<INPUT TYPE="checkbox"  onclick="setPrice(this)" <%if IsNull(rss("itemID")) then response.write "disabled='disabled'"%> invoiceItem="<%=rss("invoiceItem")%>" NAME="itemReq" VALUE="<%=RSS("id")%>"/>
 915				<span class="label label-important">X</span>
 916			</TD>
 917			<TD <%if not IsNull(rss("invoiceItem")) then Response.write " class='changeItem'"%>><%=RSS("ItemName")%></TD>
 918			<TD><%=shamsidate(RSS("ReqDate"))%></small></TD>
 919			<TD><%=RSS("Qtty")%> <%=rss("unit")%></TD>
 920			<TD><%=RSS("RealName")%></TD>
 921			<TD><a href="../order/order.asp?act=show&id=<%=RSS("orderID")%>"><%=RSS("orderID")%></a>
 922			<% if RSS("CustomerHaveInvItem") then	
 923				response.write " <b>  (������) </b>" 
 924			end if
 925			%>
 926			</small></TD>
 927		</TR>
 928		<!--TR bgcolor="<%=tmpColor%>" >
 929			<TD></TD>
 930			<TD colspan=5>�����: <%=RSS("comment")%></small></TD>
 931		</TR-->
 932			  
 933		<% 
 934		RSS.moveNext
 935		Loop
 936		%>
 937		<TR >
 938			<TD align=center colspan=6 height=50><INPUT TYPE="hidden" name=color1 value=""><INPUT TYPE="hidden" name=color2 value="">
 939				<center><INPUT TYPE="submit" Name="Submit" Value="��� �������"  style="width:150px;" tabIndex="14" class="btn" onclick="return confirm('��� ������ �� ������ ��� ������� �� ��� ���Ͽ')"> <INPUT TYPE="submit" Name="Submit" Value="���� ����� ����"  style="width:150px;" class="btn" tabIndex="14"> 
 940				</center>	<BR>
 941			</TD>
 942		</TR>
 943		</TABLE>
 944		<%
 945	end if 
 946end if 
 947
 948if Auth(5 , 1) then
 949	set RSS=Conn.Execute ("SELECT dbo.InventoryItemRequests.*, dbo.Users.RealName AS RealName FROM dbo.InventoryItemRequests INNER JOIN dbo.Users ON dbo.InventoryItemRequests.CreatedBy = dbo.Users.ID WHERE (dbo.InventoryItemRequests.Status = 'new') AND (dbo.InventoryItemRequests.OrderID = - 1) order by " & sB)
 950
 951	if not RSS.eof then
 952		%>
 953		<TABLE dir=rtl align=center width=600>
 954		<TR bgcolor="eeeeee" >
 955			<TD align=center colspan=6 height=20><INPUT TYPE="hidden" name=color1 value="#FFFFFF"><INPUT TYPE="hidden" name=color2 value="#FFFFBB"><B>������� ���  ����� ������</B></TD>
 956		</TR>
 957		<TR bgcolor="eeeeee" >
 958			<TD><INPUT TYPE="hidden" name=color1 value="#FFFFFF"><INPUT TYPE="hidden" name=color2 value="#FFFFBB"><INPUT TYPE="checkbox" NAME="" disabled></TD>
 959			<TD><A HREF="default.asp?s=1"><SMALL>���  ����</SMALL></A></TD>
 960			<TD><A HREF="default.asp?s=2"><SMALL>����� �������</SMALL></A></TD>
 961			<TD><A HREF="default.asp?s=3"><SMALL>�����</SMALL></A></TD>
 962			<TD><A HREF="default.asp?s=4"><SMALL>������� �����</SMALL></A></TD>
 963		</TR>
 964		<%
 965		tmpCounter = tmpCounter + 1
 966		Do while not RSS.eof
 967			tmpCounter = tmpCounter + 1
 968			if tmpCounter mod 2 = 1 then
 969				tmpColor="#FFFFFF"
 970				tmpColor2="#FFFFBB"
 971			Else
 972				tmpColor="#FFFFFF"
 973				tmpColor2="#FFFFBB"
 974				'tmpColor="#DDDDDD"
 975				'tmpColor2="#EEEEBB"
 976			End if 
 977
 978		%>
 979		<TR bgcolor="<%=tmpColor%>" >
 980			<TD><INPUT TYPE="hidden" name=color1 value="<%=tmpColor%>"><INPUT TYPE="hidden" name=color2 value="<%=tmpColor2%>"><INPUT TYPE="checkbox"  onclick="setPrice(this)"  NAME="itemReq" VALUE="<%=RSS("id")%>"></TD>
 981			<TD><%=RSS("ItemName")%></TD>
 982			<TD><%=shamsidate(RSS("ReqDate"))%></small></TD>
 983			<TD><%=RSS("Qtty")%> <%=rss("unit")%></TD>
 984			<TD><%=RSS("RealName")%></TD>
 985		</TR>
 986		<!--TR bgcolor="<%=tmpColor%>" >
 987			<TD></TD>
 988			<TD colspan=5>�����: <%=RSS("comment")%></small></TD>
 989		</TR-->
 990			  
 991		<% 
 992		RSS.moveNext
 993		Loop
 994		%>
 995		</TABLE><br>
 996		<center>
 997			<INPUT TYPE="submit" Name="Submit" Value="��� �������"  style="width:150px;" tabIndex="14" class="btn" onclick="return confirm('��� ������ �� ������ ��� ������� �� ��� ���Ͽ')"/> 
 998			<INPUT TYPE="submit" Name="Submit" Value="���� ����� ����"  style="width:150px;" tabIndex="14" class="btn"/>
 999			<a href="?act=waste" class="btn" style="width:150px;">���� ����� �ѐ���</a>
1000		</center>
1001		</form>
1002	<% end if %>
1003	<BR><BR>
1004	<TABLE align=center width=50%>
1005	<TR>
1006		<TD align=center style="border:solid 1pt black">
1007			<BR>
1008			<FORM METHOD=POST ACTION="default.asp">
1009			<B>���� ����� � ������� <BR></B><BR>
1010			����� ������� ���� : <INPUT TYPE="text" NAME="invoice_id" dir=ltr ><BR><BR> <INPUT TYPE="submit"  name="submit"  value="����� ����� �������">
1011			<BR>
1012			</FORM>
1013		</TD>
1014	</TR>
1015	</TABLE><BR>
1016	<%
1017end if 
1018%>
1019
1020<SCRIPT LANGUAGE="JavaScript">
1021
1022function setPrice(obj)
1023{
1024theTR = obj.parentNode.parentNode
1025ii = theTR.rowIndex -1
1026
1027if(obj.checked)
1028	{
1029	//alert(ii)
1030	theTR.setAttribute("bgColor",document.getElementsByName('color2')[ii].value)
1031	}
1032else
1033	{
1034	theTR.setAttribute("bgColor",document.getElementsByName('color1')[ii].value)
1035	}
1036}
1037
1038</SCRIPT>
1039
1040
1041<!--#include file="tah.asp" -->