twocool
04-23-2003, 02:18 AM
i have this code... when users have to approve or reject a request.... and they have to write the reasons for rejection.... i cant get the sql working.. need yr help.??
approve_request.asp
<!--
function submit_form(ReqNo,ReqStatus,RejRemarks,action)
{
document.form2.ReqNo.value = ReqNo;
document.form2.ReqStatus.value = ReqStatus;
document.form2.RejRemarks.value = RejRemarks;
document.form2.dataAction.value = action;
document.form2.submit();
}
//-->
</script>
<% sql= "SELECT * from Requests WHERE ReqtrEmail = '"&Request.ServerVariables("LOGON_USER")&"@singtel.com' "
set rs = MSCS.Execute(sql)%>
<form name="form2" method="post" action="approve_action.asp">
<table width="100%" border="0" cellspacing=0 align="center">
<%Do While Not rs.EOF%>
<tr style="background-color:#EEEEEE;" class="header3">
<td width="15%" height="22">Request No</td>
<td width="25%" height="22">Requestor Name</td>
<td width="15%" height="22">Application System</td>
<td width="20%" height="22">Request Title</td>
<td width="10%" height="22">Request Date</td>
<td width="10%" height="22">Desired Date</td>
<td width="15%" height="22">Action</td>
</tr>
<tr style="background-color:#FFFFCC;" onmouseover="this.style.backgroundColor='#ffcc99';" onmouseout="this.style.backgroundColor='#FFFFCC';" class="text">
<td width="15%"><a href="approve_display.asp?ReqNo=<%=rs("ReqNo")%>" target="_blank", width=500,height=400><%=rs("ReqNo")%></a></td>
<input type="hidden" name="vReqNo" value="<%=ReqNo%>">
<td width="25%"><span class="txtblack12"><%=rs("Reqtr")%></span></td>
<td width="15%"><span class="txtblack12"><%=rs("AppnId")%></span></td>
<td width="20%"><span class="txtblack12"><%=rs("ReqTitle")%></span></td>
<td width="10%"><span class="txtblack12"><%=rs("ReqDt")%></span></td>
<td width="10%"><span class="txtblack12"><%=rs("DesiredDt")%></span></td>
<td width="15%">
<select name = "Status">
<option value="2" <%if trim(rs("ReqStatus")) = "2" then%>selected<%end if%>>Approve</option>
<option value="98" <%if trim(rs("ReqStatus")) = "98" then%>selected<%end if%>>Reject</option>
</select>
</td>
</tr>
<tr>
<td width="15%">Reasons For Rejection:</td>
<td width="25%">
<textarea rows="3" cols="45" name="RejRemarks_<%=ReqNo%>" onKeyUp="max_count();" class="txtblack12"></textarea>
</td>
<td width="13%">
<input type="submit" onclick="javascript:submit_form('<%=rs("ReqNo")%>','<%=rs("ReqStatus")%>','<%=rs("RejRemarks")%>','update')" name=Edit value="Submit">
<!--input type="submit" name="Submit" value="Submit"-->
</td>
</tr>
<%rs.MoveNext%>
<%loop%>
</table></form>
<%
rs.close
set rs=nothing
%>
after submitting it will go to the action page
approve_action.asp
<%
Session.LCID
vReqNo = Request("ReqNo")
vAppnId = Request("AppnId")
'vStatus = Request("Status")
'vRejRemarks = Request("RejRemarks")
%>
<%
sql="SELECT * from Requests WHERE ReqNo = '" & vReqNo & "'"
set rs = MSCS.Execute(sql)
rs.close
set rs=nothing
sql="EXEC UpdateApprove '" & vReqNo & "','" &_
trim(Request("Status")) & "','" &_
trim(Request("RejRemarks")) & "'"
MSCS.execute(sql)
Response.Write sql
Response.End
'sql="EXEC UpdateApprove '" & ("vStatus") & "' , '"&("vRejRemarks")&"' "
'sql=sql & "('" & vStatus & "',"
'sql=sql & "'" & vRejRemarks & "')"
'MSCS.execute(sql)
'rs.close
'set rs=nothing
redirecturl = "approve_request.asp"
%>
pls help me?:( :confused: :confused:
approve_request.asp
<!--
function submit_form(ReqNo,ReqStatus,RejRemarks,action)
{
document.form2.ReqNo.value = ReqNo;
document.form2.ReqStatus.value = ReqStatus;
document.form2.RejRemarks.value = RejRemarks;
document.form2.dataAction.value = action;
document.form2.submit();
}
//-->
</script>
<% sql= "SELECT * from Requests WHERE ReqtrEmail = '"&Request.ServerVariables("LOGON_USER")&"@singtel.com' "
set rs = MSCS.Execute(sql)%>
<form name="form2" method="post" action="approve_action.asp">
<table width="100%" border="0" cellspacing=0 align="center">
<%Do While Not rs.EOF%>
<tr style="background-color:#EEEEEE;" class="header3">
<td width="15%" height="22">Request No</td>
<td width="25%" height="22">Requestor Name</td>
<td width="15%" height="22">Application System</td>
<td width="20%" height="22">Request Title</td>
<td width="10%" height="22">Request Date</td>
<td width="10%" height="22">Desired Date</td>
<td width="15%" height="22">Action</td>
</tr>
<tr style="background-color:#FFFFCC;" onmouseover="this.style.backgroundColor='#ffcc99';" onmouseout="this.style.backgroundColor='#FFFFCC';" class="text">
<td width="15%"><a href="approve_display.asp?ReqNo=<%=rs("ReqNo")%>" target="_blank", width=500,height=400><%=rs("ReqNo")%></a></td>
<input type="hidden" name="vReqNo" value="<%=ReqNo%>">
<td width="25%"><span class="txtblack12"><%=rs("Reqtr")%></span></td>
<td width="15%"><span class="txtblack12"><%=rs("AppnId")%></span></td>
<td width="20%"><span class="txtblack12"><%=rs("ReqTitle")%></span></td>
<td width="10%"><span class="txtblack12"><%=rs("ReqDt")%></span></td>
<td width="10%"><span class="txtblack12"><%=rs("DesiredDt")%></span></td>
<td width="15%">
<select name = "Status">
<option value="2" <%if trim(rs("ReqStatus")) = "2" then%>selected<%end if%>>Approve</option>
<option value="98" <%if trim(rs("ReqStatus")) = "98" then%>selected<%end if%>>Reject</option>
</select>
</td>
</tr>
<tr>
<td width="15%">Reasons For Rejection:</td>
<td width="25%">
<textarea rows="3" cols="45" name="RejRemarks_<%=ReqNo%>" onKeyUp="max_count();" class="txtblack12"></textarea>
</td>
<td width="13%">
<input type="submit" onclick="javascript:submit_form('<%=rs("ReqNo")%>','<%=rs("ReqStatus")%>','<%=rs("RejRemarks")%>','update')" name=Edit value="Submit">
<!--input type="submit" name="Submit" value="Submit"-->
</td>
</tr>
<%rs.MoveNext%>
<%loop%>
</table></form>
<%
rs.close
set rs=nothing
%>
after submitting it will go to the action page
approve_action.asp
<%
Session.LCID
vReqNo = Request("ReqNo")
vAppnId = Request("AppnId")
'vStatus = Request("Status")
'vRejRemarks = Request("RejRemarks")
%>
<%
sql="SELECT * from Requests WHERE ReqNo = '" & vReqNo & "'"
set rs = MSCS.Execute(sql)
rs.close
set rs=nothing
sql="EXEC UpdateApprove '" & vReqNo & "','" &_
trim(Request("Status")) & "','" &_
trim(Request("RejRemarks")) & "'"
MSCS.execute(sql)
Response.Write sql
Response.End
'sql="EXEC UpdateApprove '" & ("vStatus") & "' , '"&("vRejRemarks")&"' "
'sql=sql & "('" & vStatus & "',"
'sql=sql & "'" & vRejRemarks & "')"
'MSCS.execute(sql)
'rs.close
'set rs=nothing
redirecturl = "approve_request.asp"
%>
pls help me?:( :confused: :confused: