PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/purchase/otherRequests.asp

http://github.com/khaneh/Orders
ASP | 169 lines | 136 code | 22 blank | 11 comment | 19 complexity | e55c9778257a3c643539e3f12b701157 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Purchase (4)
  3PageTitle="������� ���� �������� �� � �����"
  4SubmenuItem=2
  5if not Auth(4 , 2) then NotAllowdToViewThisPage()
  6
  7'OutService Page Request
  8'By Alix - Last changed: 81/01/13
  9%>
 10<!--#include file="top.asp" -->
 11<!--#include File="../include_farsiDateHandling.asp"-->
 12<!--#include File="../include_JS_InputMasks.asp"-->
 13<SCRIPT LANGUAGE="JavaScript">
 14<!--
 15function hideIT()
 16{
 17if(document.all.tavafogh.checked) 
 18	{
 19		document.all.priceTavafoghi.style.visibility= 'visible'
 20	}
 21	else
 22	{
 23		document.all.price.value= ''
 24		document.all.priceComment.value= ''
 25		document.all.priceTavafoghi.style.visibility= 'hidden'
 26	}
 27}
 28
 29function hideIT2()
 30{
 31if(document.all.tavafogh2.checked) 
 32	{
 33		document.all.priceTavafoghi2.style.visibility= 'visible'
 34	}
 35	else
 36	{
 37		document.all.orderID.value= ''
 38		document.all.priceTavafoghi2.style.visibility= 'hidden'
 39	}
 40}
 41
 42//-->
 43</SCRIPT>
 44
 45<%
 46catItem1 = request("catItem")
 47if catItem1="" then catItem1="-1"
 48
 49
 50'-----------------------------------------------------------------------------------------------------
 51'--------------------------------------------------- Delete an Inventory Request for Buy from an order
 52'-----------------------------------------------------------------------------------------------------
 53if request("di")="y" then		
 54	myRequestID=request("i")
 55	set RSX=Conn.Execute ("SELECT * FROM purchaseRequests WHERE id = "& myRequestID )	
 56	if RSX("status")="new" then
 57	Conn.Execute ("update purchaseRequests SET status = 'del' where id = "& myRequestID )	
 58	end if
 59	response.redirect "otherRequests.asp?radif=" & request("r")
 60end if
 61
 62'-----------------------------------------------------------------------------------------------------
 63'------------------------------------------------------------ Submit an Inventory Item request For Buy
 64'-----------------------------------------------------------------------------------------------------
 65if request.form("Submit")="��� �������  ���� ����" then
 66	priceComment = request.form("priceComment")
 67	otypeName = request.form("typeName")
 68	comment = request.form("comment")
 69	price = request.form("price")
 70	CreatedBy = session("id")
 71	qtty = request.form("qtty")
 72	DueDate = request.form("DueDate")
 73	orderID = request.form("orderID")
 74
 75	if  comment="" then
 76		comment = "-"
 77	end if
 78
 79	if  qtty="" then
 80		qtty = "0"
 81	end if
 82
 83	if  price="" then
 84		price = "0"
 85	end if
 86
 87	if  priceComment="" then
 88		priceComment = "-"
 89	end if
 90
 91	if  otypeName="" then
 92		response.write "error"
 93		response.end
 94	end if
 95
 96	if  orderID="" then
 97		orderID = "-1"
 98	end if
 99
100	mySql="INSERT INTO purchaseRequests (orderID, typeName, typeID, comment, price,priceComment, CreatedBy, qtty, DueDate, IsService) VALUES ( "& orderID & " , N'"& otypeName & "', 0 , N'"& comment & "', "& price & ",N'"& priceComment & "', "& CreatedBy & ", "& qtty & " , dbo.udf_date_solarToDate(" & mid(DueDate,1,4) & "," & mid(DueDate,6,2) & "," & mid(DueDate,9,2) & "), 1)"	
101	conn.Execute mySql
102	'RS1.close
103
104	response.write "<center><br><br>������� ��� �� </center><br>"
105end if
106%>
107<center>
108	<BR><BR>
109	<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" width="350" >
110	<TR  >
111		<TD align="right" colspan=2><H3>������� ���� ���� ������ � �����</H3></TD>
112	</TR>
113		<TR bgcolor="dddddd" ><td colspan=2>
114
115		<FORM METHOD=POST ACTION="otherRequests.asp">
116			��� ���� �� ����: <INPUT TYPE="text" name="typeName" size=31><br><br>
117			�����: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="text" NAME="qtty" size=40 onKeyPress="return maskNumber(this);" dir="LTR"><br><br>
118			<INPUT TYPE="checkbox" onclick="hideIT()" name="tavafogh">����� ���� ���� ���� ����� ���<BR>
119			<div name="priceTavafoghi" id="priceTavafoghi" style="visibility:'hidden'">����: &nbsp;<INPUT TYPE="text" NAME="price" ID="price" size=5 onKeyPress="return maskNumber(this);"> ���: <INPUT TYPE="text" NAME="priceComment" id="priceComment" size=26 ></div>
120
121			<INPUT TYPE="checkbox" onclick="hideIT2()" name="tavafogh2">��� ������� ����� �� ����� ���� ���<BR>
122			<div name="priceTavafoghi2" id="priceTavafoghi2" style="visibility:'hidden'">����� �����: &nbsp;<INPUT TYPE="text" NAME="orderID" ID="orderID" size=10 onKeyPress="return maskNumber(this);"> </div>
123
124			������ �� ���� ���� ���� ���: <INPUT dir=ltr TYPE="text" NAME="DueDate" size=15 value="<%=shamsiToday()%>" onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10"><br><br>
125		�������: <TEXTAREA NAME="comment" ROWS="7" COLS="32"></TEXTAREA>
126			<br><center>
127			<INPUT class=inputBut TYPE="submit" Name="Submit" Value="��� �������  ���� ����" style="width:125px;" tabIndex="14">
128			</center>
129		</FORM>
130
131		</FONT></TD>
132	</TR>
133	<%
134	'Gets Request for services list from DB
135	set RS3=Conn.Execute ("SELECT * FROM purchaseRequests WHERE (status='new' and TypeID=0)")
136	%>
137		<%
138		Do while not RS3.eof
139		%>
140		<TR bgcolor="#CCCCCC" title="<% 
141			Comment = RS3("Comment")
142			if Comment<>"-" then
143				response.write "�����: " & Comment
144			else
145				response.write "����� �����"
146			end if
147		%>">
148			<TD align="right" valign=top><FONT COLOR="black">
149			<INPUT TYPE="checkbox" NAME="outReq" VALUE="<%=RS3("id")%>" <%
150			if RS3("status") = "new" then
151				response.write " checked disabled "
152			else 
153				response.write " disabled "
154			end if
155			%>><B><%=RS3("TypeName")%></B>  <small dir=ltr>(<%=RS3("ReqDate")%>)</small></td>
156			<td align=left width=5%><%
157			if RS3("status") = "new" then
158			%><a href="otherRequests.asp?di=y&i=<%=RS3("id")%>&r=<%=request("radif")%>"><b>���</b></a><%
159			end if %></td>
160		</tr>
161		<% 
162		RS3.moveNext
163		Loop
164		%>
165
166	</table><br>
167	
168
169<!--#include file="tah.asp" -->