this is my web page and i have a script that is executed even if the page is refreshed the asp page:
the script where marked as \**/needs to be executed only when a button is clicked can some one help
Code:
<%@ LANGUAGE="VBSCRIPT" %>
<%
''
'' Contracts Detail
''
'' Taken from LifeCycle Management and edited for Contracts Management Phase II
''
'' Updated 20001012 by Vincent Leung
'' - Added "flexible showing of barcode columns", so that if recordset has
'' no barcodes at all, then hide column. --VL
%>
<!--#INCLUDE FILE="../include/Constants.asp"-->
<!--#INCLUDE FILE="../include/commoninc_restrict.asp"-->
<%
' get Client Manager details
' check if already have Client Manager details
' if Session("rstStaffContact") is nothing then
set Session("rstAsset_edit") = nothing
sql = "SELECT distinct Staff.Staff_Name," & _
" Staff.Staff_phone," & _
" Staff.Staff_fax," & _
" Staff.Staff_cell," & _
" Staff.Staff_email" & _
" from Staff inner join " & _
" Customer_Detail on Staff.Staff_id = Customer_Detail.Customer_Staff_id " & _
" where Customer_Detail.Customer_id = " & Session(CUSTOMER_ID)
Set objRIMSConn = Server.CreateObject("ADODB.Connection")
objRIMSConn.Open RIMS_CONNECT
Set rstStaffContact = Server.CreateObject("ADODB.Recordset")
rstStaffContact.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
Set Session("rstStaffContact") = rstStaffContact ' Store for fast retrieval later on.
'end if
' check if already in contract review session
if Session("rstContract") is nothing then
sql = "SELECT DISTINCT Contract_Detail.Contract_no," & _
" Contract_Detail.Contract_Commence_Date," & _
" Contract_Detail.Contract_Expiry_Date," & _
" Contract_Detail.Contract_rental," & _
" Contract_Detail.Contract_assetmgmt," & _
" Contract_Detail.Contract_term," & _
" Contract_Detail.Contract_frequency," & _
" Contract_Detail.Contract_disc_date," & _
" Contract_Detail.Contract_disc_rec," & _
" isNull(Contract_Detail.Contract_asset_value,0) Contract_asset_value " & _
" FROM Contract_Detail" & _
" WHERE Contract_Detail.Contract_Customer_id = " & Session(CUSTOMER_ID)
sql = sql & " ORDER BY Contract_Detail.Contract_no"
Set objRIMSConn = Server.CreateObject("ADODB.Connection")
objRIMSConn.Open RIMS_CONNECT
Set rstContract = Server.CreateObject("ADODB.Recordset")
rstContract.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
rstContract.PageSize = CONTRACT_LIST_PAGE_SIZE ' Number of records to display per page.
Set Session("rstContract") = rstContract ' Store for fast retrieval later on.
Session("ContPage") = 1 ' Start on the first page.
else
' Contract information already exists, retrieve it from the session object.
Set rstContract = Session("rstContract")
end if
' check if already have CustomerNotice
' if Session("CustomerNotice") is nothing then
sql = "SELECT Customer_Detail.CustomerNotice" & _
" from Customer_Detail " & _
" where Customer_Detail.Customer_id = " & Session(CUSTOMER_ID)
Set objRIMSConn = Server.CreateObject("ADODB.Connection")
objRIMSConn.Open RIMS_CONNECT
Set rstCustomerNotice = Server.CreateObject("ADODB.Recordset")
rstCustomerNotice.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
Set Session("CustomerNotice") = rstCustomerNotice("CustomerNotice") ' Store for fast retrieval later on.
' end if
Set objRIMSConn = Server.CreateObject("ADODB.Connection")
objRIMSConn.Open RIMS_CONNECT
' else
' Contact information already exists, retrieve it from the session object.
' Set rstCustContact = Session("rstCustContact")
' end if
response.write("<!--<br> debug: session-cont-sort-item (before): " & Session("ContSortItem"))
response.write("<br> debug: req-cont-sort-item (before): " & request("ContSortItem") & "-->")
' Process any sort requests.
If not(IsEmpty( Request("ContSortItem") ) or Request("ContSortItem")="") then
set Session("rstAsset") = nothing
Session("ContSortItem") = "<!--<br> Request of session-cont-sort-item: " & Session("ContSortItem") & "-->"
end if
'' Research disabled for ContractManagement2. And for sake of the Edit Assets page,
'' Following code Disabled and Session("FilterSQL") ALWAYS set to "" --VL20001018
Session("FilterSQL") = ""
''' Process any research requests
'' If (Request("Research") <>"") AND (Request("Research") <> Session("FilterSQL")) then
'' set Session("rstAsset") = nothing
'' Session("FilterSQL") = Request("Research")
''' Session("FilterDisplay") = Request("FilterDisplay")
'' end if
' Process any pagesize requests
if (Request("pageSize") <> Session("ASSET_LIST_PAGE_SIZE")) and (Request("pageSize") <> "") then
Session("ASSET_LIST_PAGE_SIZE") = Request("pageSize")
set Session("rstAsset") = nothing
''response.write("<br> debug: session-cont-sort-item: " & Session("ContSortItem"))
end if
''response.write("<br>session-contract_no: " & session("Contract_no"))
''response.write("<br>req-contract_no: " & request("Contract_no"))
' Process Contract request
If not(IsEmpty(Request("Contract_no")) or Request("Contract_no")="" ) then
Session("Contract_no") = Request("Contract_no")
LogTransaction "" ,"MLog Contract Viewed : " & Session("Contract_no"),"",""
''response.write("<br>Session-Cont_no updated!!!")
set Session("rstAsset") = nothing
else
if Session("Contract_no") = "" then
Response.Redirect "contlist_contract2.asp"
end if
end if
' Generate sql for search
if Session("rstAsset") is nothing then
sql = " SELECT isnull(userdatacomment,'NONE') as comment,Asset_Detail.Asset_id, Asset_Detail.Asset_serial_no,Asset_Detail.Asset_id, " &_
" Asset_Detail.Asset_barcode_no, " &_
" Asset_Detail.Asset_description, Asset_Type.Asset_type_description, " &_
" assettypesub.assettypesubdesc, " &_
" Asset_Detail.Asset_contract_no,Asset_Detail.Asset_Rental,Asset_Detail.Asset_type_id, " &_
" state.statedesc,Asset_Detail.Asset_purchase_date,Asset_Detail.Asset_PO_no, " &_
" isnull(Asset_Detail.Asset_purchase_price,0) Asset_purchase_price," &_
" Supplier_Detail.Supplier_Name, invoice.invoice_date,Invoice.Invoice_no, " &_
" Customer_User.User_Name,Customer_User.User_code,Cost_Centre.Cost_Centre_Code,Cost_Centre.Cost_Centre_Description, " &_
" Department.Department_Code, Department.Department_Desc " &_
" FROM Asset_Detail left JOIN user_data on userdataassetid = asset_detail.asset_id " &_
" inner join Contract_detail ON Asset_Detail.Asset_contract_no = Contract_detail.Contract_no " &_
" left JOIN Department ON Asset_Detail.Asset_Department_Id = Department.Department_Id " &_
" left JOIN Customer_User ON Customer_User.User_Id = Asset_Detail.Asset_User_Id " &_
" left JOIN ( select * from Cost_Centre where Cost_Centre_Active <> 0) Cost_Centre ON " &_
" Cost_Centre.Cost_Centre_ID = Asset_Detail.Asset_CostCentre_Id " &_
" LEFT JOIN Invoice ON Asset_Detail.Asset_invoice_id = Invoice.Invoice_id " &_
" left JOIN state ON asset_detail.asset_TO_stateID=state.stateid " &_
" LEFT JOIN Asset_Type ON Asset_Detail.Asset_type_id = Asset_Type.Asset_type_id " &_
" LEFT JOIN AssetTypesub on Asset_detail.asset_subtype=assettypesub.assetTypesubId " &_
" LEFT JOIN Asset_Category ON Asset_Category.Asset_category_id = Asset_Type.Asset_type_Category_id " &_
" LEFT JOIN Supplier_Detail ON Invoice.Invoice_supplier_id = Supplier_Detail.Supplier_id " &_
" WHERE Contract_detail.Contract_customer_id = " & Session(CUSTOMER_ID) & _
" AND ISNULL(Asset_Detail.Asset_Active,0) <> 0"
if Session("FilterSQL") <> "" then
' If a filter has been applied, then include the where clause for this.
sql = sql & " AND " & Session("FilterSQL")
end if
' add contract filter
tmpsql = " Asset_Detail.Asset_contract_no = '" & Session("Contract_no") & "'"
sql = sql & " and " & tmpsql
session("filtersql") = session("filtersql") & tmpsql
if IsEmpty(Session("ContSortItem")) OR (Session("ContSortItem") = "") then
Session("ContSortItem") = "Asset_description desc"
end if
sql = sql & " ORDER BY " & Session("ContSortItem")
if objRIMSConn is nothing then
Set objRIMSConn = Server.CreateObject("ADODB.Connection")
objRIMSConn.Open RIMS_CONNECT
end if
'response.write sql
' response.write sql
' response.end
Set rstAsset = Server.CreateObject("ADODB.Recordset")
rstAsset.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
'rstAsset.Open sql, objRimsConn, adOpenKeyset, adLockOptimistic
rstAsset.PageSize = Session("ASSET_LIST_PAGE_SIZE") ' Number of records to display per page.
' rstAsset.PageSize = ASSET_LIST_PAGE_SIZE ' Number of records to display per page.
Set Session("rstAsset") = rstAsset ' Store for fast retrieval later on.
Session("Page") = 1 ' Start on the first page.
else
' Asset information already exists, retrieve it from the session object.
Set rstAsset = Session("rstAsset")
end if
' Determine whether there is no data in the recordset at this stage. Must check for BOF
' as well as we could be on the last page of the data, and in this case EOF would be true.
bolNoData = rstAsset.EOF and rstAsset.BOF
%>
<!--#INCLUDE FILE="checknulls_contract2.asp"-->
<%
' Process any paging move requests.
Select Case Trim(Request("PagingMove"))
Case "requery"
rstAsset.Requery
Case "prev"
If Session("Page") > 1 Then
Session("Page") = Session("Page") - 1
End If
Case "first"
Session("Page") = 1
Case "next"
if Session("Page") < rstAsset.PageCount then
Session("Page") = Session("Page") + 1
end if
Case "last"
Session("Page") = rstAsset.PageCount
End Select
' what is this? nbs 20/1/00
on Error resume next
rstAsset.AbsolutePage = Session("Page")
on error goto 0
' ' Check if there is only 1 asset, if so go straight to the item details page
' if (rstAsset.RecordCount = 1) then
' Response.Redirect "item.asp?AssetID=" & rstAsset("Asset_Id")
' end if
Set rstContract = Session("rstContract")
on Error resume next
rstContract.AbsolutePage = 1
on error goto 0
TotalAssetValue=0
Do While Not rstContract.EOF
if rstContract("Contract_no") = Session("Contract_no") then
TotalAssetValue = rstContract("Contract_Asset_Value")
ContractExpiryDate = rstContract("Contract_expiry_date")
ContractTerm = rstContract("Contract_term")
ContractStarted = rstContract("Contract_commence_date")
end if
rstContract.MoveNext
Loop
on Error resume next
rstContract.AbsolutePage = Session("Page")
on error goto 0
' calculate total asset value
on Error resume next
rstAsset.AbsolutePage = 1
on error goto 0
on Error resume next
rstAsset.AbsolutePage = Session("Page")
on error goto 0
sql = "SELECT ControlValue " & _
" from ControlData where argument = 'GST'"
Set rstVat = Server.CreateObject("ADODB.Recordset")
rstVat.Open sql, objRIMSConn, adOpenKeyset, adLockOptimistic
%>
<!--<SCRIPT LANGUAGE='JavaScript'>
<!--hide from old browsers
function order_by(column_order)
{
document.sortform.ContSortItem.value=column_order;
document.sortform.submit()
}
function Count_rows(){
var Value=new Array(200)
var k =0
var a=0
detailsTable = document.getElementsByName('Table_Data');
detailsRow = detailsTable.getElementsByTagName('td')[rownumber];
value=document.getElementById('Table_Data').getElementsByTagName('td').length;
document.sortform.submit()
count=document.getElementById('Table_Data').rows.length
for(var i=14;i<=document.getElementById('Table_Data').getElementsByTagName('td').length;i++)
{
name=detailsRow.getElementsbyTagName("td")[0];
}
document.sortform.submit()
document.write(""+Value[i]"<br/>");
}
function Submit()
{
document.sortform.submit()
document.write("hello");
}
/**function research_using(column_clause,equals_clause,display_clause)
{
document.sortform.Research.value=column_clause + "'" + equals_clause + "'";
document.sortform.FilterDisplay.value=display_clause + " = " + equals_clause;
document.sortform.submit()
}
function research_using_int(column_clause,equals_clause,display_clause,display_value)
{
document.sortform.Research.value=column_clause + equals_clause ;
document.sortform.FilterDisplay.value=display_clause + " = " + display_value;
document.sortform.submit()
}*/
function first_page()
{
document.paging.PagingMove.value="first";
document.paging.submit()
}
function prev_page()
{
document.paging.PagingMove.value="prev";
document.paging.submit()
}
function next_page()
{
document.paging.PagingMove.value="next";
document.paging.submit()
}
function last_page()
{
document.paging.PagingMove.value="last";
document.paging.submit()
}
function refresh_page()
{
document.paging.PagingMove.value="requery";
document.paging.submit()
}
function displayResult()
{
var namelist = "";
with(document.sortform) {
for(var i = 0; i < same.length; i++){
if(same[i].checked) {
namelist += same[i].value + "\n";
}
}
}
if(namelist == "") {
alert("select names");
} else {
alert (namelist);
}
return false;
}
alert("hi");
}
//end of javascript
</SCRIPT>-->
<!--#INCLUDE FILE="..\include\header.asp"-->
<% If Session(ALLOW_LIFECYCLE) then %>
<title>Lifecycle Management Asset Search</title>
<% Else %>
<title>Contract Management Asset Search</title>
<% End if %>
<!--#INCLUDE FILE="..\include\header.asp"-->
<script language="javascript">
function displayResult()
{
var namelist = "";
with(document.sortform) {
for(var i = 0; i < same.length; i++){
if(same[i].checked) {
namelist += same[i].value + ";";
}
}
}
if(namelist == "") {
alert("select names");
} else {
//alert (namelist);
var myArray = new Array();
myArray= namelist.split(";");
for(var i=0;i<myArray.length-1;i++)
{
//alert(myArray[i]);
}
}
return false;
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
function first_page()
{
document.paging.PagingMove.value="first";
document.paging.submit()
}
function prev_page()
{
document.paging.PagingMove.value="prev";
document.paging.submit()
}
function next_page()
{
document.paging.PagingMove.value="next";
document.paging.submit()
}
function last_page()
{
document.paging.PagingMove.value="last";
document.paging.submit()
}
function refresh_page()
{
document.paging.PagingMove.value="requery";
document.paging.submit()
}
function Lock()
{
with(document.sortform) {
for(var i = 0; i < same.length; i++){
if(same[i].checked) {
document.sortform.Date.disabled=true;
}
}
}
return false;
}
</script>
<!--<script type="text/javascript">
/** $(document).ready(function () {
//assigning alternative row style
$("#Table_Data tr:even").addClass("evenrow");
$("#Table_Data tr:odd").addClass("oddrow");
$("#Table_Data tr:#clickME").click(function(){
$(this).find(':checkbox').attr('checked', ! $(this).find(':checkbox').attr('checked'));
if($(this).find(':checkbox').attr('checked'))
{
$('#Table_Data td:nth-child(2)').click(function() {
html = $(this).text();
document.cookie=html;
var Cook=document.cookie.split(";");
alert(Cook);
});
}
else
{
$(this).removeClass('highlight');
$(this).addClass('evenrow');
}
});
/**$("#Table_Data tr:odd").click(function(){
$(this).find(':checkbox').attr('checked', !$(this).find(':checkbox').attr('checked'));
if($(this).find(':checkbox').attr('checked'))
{
$(this).removeClass('oddrow');
$(this).addClass('highlight');
}
else
{
$(this).removeClass('highlight');
$(this).addClass('oddrow');
}
});
});*/
function Check(){
dim falg as int
alert(document.getElementsByName("Che").item(0,0);
}
</script>-->
<style type="text/css">
.highlight
{
background-color:Red;
}
.oddrow { background-color:#eee; }
.evenrow { background-color:#fff; }
table.pretty {
background: whitesmoke;
border-collapse: collapse;
}
table.pretty th, table.pretty td {
border: 1px silver solid;
padding: 0.2em;
}
table.pretty th {
background: gainsboro;
text-align: left;
}
table.pretty caption {
margin-left: inherit;
margin-right: inherit;
}
</style>
<% Session("active_nav")="Contract" %>
<link rel="stylesheet" href="stylemain.css">
<!--#INCLUDE FILE="..\include\body.asp"-->
<TABLE border=0 bordercolor="red" cellPadding=0 cellSpacing=0 width=100% height="135">
<TBODY>
<TR>
<TD width="167" vAlign=top><img src="http://bytes.com/images/nav/logo_b.gif" width="166" height="135"><br></TD>
<TD align=center vAlign=top height="130" width=100%>
<table border=0 bordercolor="blue" cellpadding=0 cellspacing=0 align="center">
<tbody>
<tr>
<td bgcolor=silver width=15 height="111"> </td>
<td bgcolor=silver width="51%" valign="top" height="111" align="right">
<table width=100% border="0" bordercolor="orange" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="right"></td>
<td bgcolor=silver align=center> <br>
<table border=0 cellpadding=0 cellspacing=0 bgcolor=silver>
<tbody>
<tr bgcolor=silver>
<th align=left nowrap colspan="2"> <font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif"> <b>
Contract No: <%=Session("Contract_no")%>
</b></font> </th>
</tr>
<tr>
<td align=left nowrap> <font face="Verdana, Arial, Helvetica, sans-serif">
Number of assets: </font> </td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" >
<%=rstAsset.RecordCount%> </font> </td>
</tr>
<tr>
<td align=left> <font face="Verdana, Arial, Helvetica, sans-serif" >
Total asset value: </font> </td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" >
<%
if trim(TotalAssetValue) = "" or isnull(TotalAssetValue) then
TotalAssetValue = 0
end if
%>
<%=session("CountryCurrency")%> <%=formatnumber(TotalAssetValue)%>
</font> </td>
</tr>
<tr>
<td align=left> <font face="Verdana, Arial, Helvetica, sans-serif" >
Contract started: </font> </td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" >
<%
if trim(ContractStarted) <> "" then
StartDay = Day(FormatDateTime(ContractStarted,vbShortDate))
if len(StartDay) = 1 then
StartDay = "0" & StartDay
end if
StartMonth = Month(FormatDateTime(ContractStarted,vbShortDate))
if len(StartMonth) = 1 then
StartMonth = "0" & StartMonth
end if
StartYear = Year(FormatDateTime(ContractStarted,vbShortDate))
StartDate = StartDay & "/" & StartMonth & "/" & StartYear
else
startdate = "TBA"
end if
%>
<% if ContractStarted Then %>
<%=StartDate%>
<% end if %>
</font> </td>
</tr>
<tr>
<td align=left> <font face="Verdana, Arial, Helvetica, sans-serif">
Expiry date: </font> </td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif">
<%
if trim(ContractExpiryDate) <> "" then
ExpiryDay = Day(FormatDateTime(ContractExpiryDate,vbShortDate))
if len(ExpiryDay) = 1 then
ExpiryDay = "0" & ExpiryDay
end if
ExpiryMonth = Month(FormatDateTime(ContractExpiryDate,vbShortDate))
if len(ExpiryMonth) = 1 then
ExpiryMonth = "0" & ExpiryMonth
end if
ExpiryYear = Year(FormatDateTime(ContractExpiryDate,vbShortDate))
ExpiryDate = ExpiryDay & "/" & ExpiryMonth & "/" & ExpiryYear
else
ExpiryDate = "TBA"
end if
%>
<% if ContractExpiryDate Then%>
<%=ExpiryDate%>
<% end if %>
</font> </td>
</tr>
<tr>
<td align=left> <font face="Verdana, Arial, Helvetica, sans-serif">
Term: </font> </td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif">
<%=ContractTerm%> months </font> </td>
</tr>
<tr>
<td align=left height="2"> <font face="Verdana, Arial, Helvetica, sans-serif" >
Notice: </font> </td>
<td height="2"> <font face="Verdana, Arial, Helvetica, sans-serif" >
<%=Session("CustomerNotice")%> days</font> </td>
</tr>
</tbody>
</table>
</td>
<td width="3%" valign="top" align="left"></td>
</tr>
<tr>
<td colspan="3" align="center"><img src="http://bytes.com/submit/images/transparent.gif" width="200" height="8" border="0"></td>
</tr>
</table>
</td>
<td bgcolor=silver width="23" valign="top" height="111"> </td>
<td bgcolor=silver width="507" height="109" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4%" align="right" valign="top"></td>
<td width="92%" bgcolor=silver valign="top"> <br>
<table border=0 cellpadding=0 cellspacing=0
width="100%" bgcolor=silver class="SmallText">
<tr bgcolor=silver align="center">
<th align=left nowrap width="100%" colspan="2"> <font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" > <b>To
Contact Us</b></font> </th>
</tr>
<tbody>
<tr>
<td width=50> <font face="Verdana, Arial, Helvetica, sans-serif"> Name:</font>
</td>
<td > <font face="Verdana, Arial, Helvetica, sans-serif">
<%
if rstStaffContact.EOF then
name = "TBA"
else
name = rstStaffContact("Staff_Name")
pos = instr(1,rstStaffContact("Staff_Name"),",")
if pos <> -1 then
'name = right(rstStaffContact("Staff_Name"),len(rstStaffContact("Staff_Name"))-pos) + " " + left(rstStaffContact("Staff_Name"),pos - 1)
end if
end if
%>
<%= name %> </font> </td>
</tr>
<tr>
<td width=50> <font face="Verdana, Arial, Helvetica, sans-serif"> Phone:</font>
</td>
<%
if rstStaffContact.EOF then
staff_phone = "+91 22 6761 6400"
else
if isnull((rstStaffContact("Staff_phone"))) then
staff_phone = "+91 22 6761 6400"
else
staff_phone = rstStaffContact("Staff_phone")
end if
end if
%>
<td> <font face="Verdana, Arial, Helvetica, sans-serif"><%= staff_phone %></font>
</td>
</tr>
<tr>
<td width=50> <font face="Verdana, Arial, Helvetica, sans-serif"> Fax:</font>
</td>
<%
if rstStaffContact.EOF then
staff_fax = "+91 22 6695 0590"
else
if isnull((rstStaffContact("Staff_fax"))) then
staff_fax = "+91 22 6695 0590"
else
staff_fax = rstStaffContact("Staff_fax")
end if
end if
%>
<%
if rstStaffContact.EOF <> TRUE THEN
%>
<td> <font face="Verdana, Arial, Helvetica, sans-serif"><%= staff_fax %></font>
</td>
</tr>
<tr>
<td width=50> <font face="Verdana, Arial, Helvetica, sans-serif"> Mobile:</font>
</td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif"><%= rstStaffContact("Staff_cell") %></font>
</td>
</tr>
<tr>
<td width=50> <font face="Verdana, Arial, Helvetica, sans-serif"> Email:</font>
</td>
<td> <a href="mailto:<%= rstStaffContact("staff_email")%>"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="Navy"><%= rstStaffContact("Staff_email")%></font></b></a>
</td>
</tr>
<tr>
<td width=50>
<p><font face="Verdana, Arial, Helvetica, sans-serif"></font></p>
</td>
<td>
<p><font face="Verdana, Arial, Helvetica, sans-serif"></font></p>
<%
END IF
%>
</td>
</tr>
</tbody>
</table>
</td>
<td width="4%" valign="top" align="left"></td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<form name="paging" action="../contract/Asset_Returned_result.asp" method="POST">
<input type="hidden" name="PagingMove">
</form>
<td bgcolor=white colspan="4" align="right" >
<table bgcolor="#EFEFEF" cellpadding="0" cellspacing="0" align="right" width="518">
<tr>
<td height="20">
<div align="right"><a href="Assetlst_Returned.asp"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">Home</font></b></font></a>
| <a href="javascript:window.print()"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">Print</font></b></font></a>
<% If not bolNoData Then %>
| <a href="javascript:first_page();"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">First</font></b></font></a>
| <a href="javascript:prev_page();"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">Previous</font></b></font></a>
| <a href="javascript:next_page()"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">Next</font></b></font></a>
| <a href="javascript:last_page()"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">Last</font></b></font></a>
<% End If %>
| <a href="contlist_contract2.asp" <%'onClick="javascript:changeHeader()%>><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#2C85B1">Contract
Summary</font></b></font></a> | <b><a href="http://bytes.com/submit/Structure/edit_assets.asp"><b><font color="#2C85B1" face="Verdana, Arial, Helvetica, sans-serif" size="1">Edit
Assets</font></b></a></b> | <a href="Javascript:refresh_page()"><b><font color="#2C85B1" face="Verdana, Arial, Helvetica, sans-serif" size="1">Refresh</font></b></a></div>
</td>
</tr>
</table>
</tr>
</tbody>
</table>
</TD>
</TR>
</TBODY>
</TABLE>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height=82%>
<tr>
<td width="165" valign="top" height=100%>
<table width="166" background="../../images/nav/new_b.jpg" border="0" cellspacing="0" cellpadding="0" height=100%>
<tr>
<td width="166" height="100%"valign=top>
<!-- navbar begin -->
<!-- left navigation -->
<!--#INCLUDE FILE="../include/inc_menu.asp"-->
</td>
</tr>
</table>
</td>
<td colspan="2" valign="top">
<p> <br>
<form name="sortform" ACTION="Asset_Returned_result.asp" METHOD="POST" ID="Form1">
<input type="hidden" name="ContSortItem" value = "">
<!--input type="hidden" name="Research" value = ""-->
<input type="hidden" name="FilterDisplay" value = "">
<%cmboBox=request.Form("cboCustomerID") %>
<%
if cmboBox<>"" then
Session("EotAction")=cmboBox
'Response.Write("<p>"& Session("EotAction")&"</p>")
end if
%>
//The Insert script starts from here
\*<%
dim i
dim checkboxValue
dim TextBoxValue
dim Count
dim Count1
dim postion
dim postion1
position=0
postion1=0
i=0
Checkbox1= Request.Form("same")
strdate=Request.Form("Date")
a=Split(strdate ,",")
b=Split(Checkbox1,",")
if strdate<>"" and Checkbox1<>"" then
TextBoxValue=UBound(a)
checkboxValue=UBound(b)
'Response.Write(TextBoxValue)
if TextBoxValue > checkboxValue then
for i=0 to checkboxValue
objRIMSConn.Execute "Insert into Eot_returned (Asset_id,Date) values ("+ b(i) +", '" + a(i)+ "');"
next
else
for i=0 to TextBoxValue
objRIMSConn.Execute "Insert into Eot_returned (Asset_id,Date) values ("+ b(i) +", '" + a(i) +"');"
next
end if
Response.Write("<script language='javascript' type='text/javascript'> alert('The value hass been Inserted'); </script>")
else
Response.Write("<script language='javascript' type='text/javascript'> alert('Do you want to return any asset'); </script>")
end if
%>*/
<%if bolNoData then%>
</p>
<table width=80%>
<tr>
<td>
<div align="center"><br>
<b> Sorry, there are no assets to display for this contract. </b>
</div>
</td>
<%else %>
<table CELLPADDING="2" CELLSPACING="1" BORDER="0">
<tr>
<td> <font face="Arial" size="3" color="#808080"><strong>Assets under this contract</strong></font> </td>
<td nowrap VALIGN="left" ALIGN="left"> <nobr>Page <%=Session("Page") %>
of <%=rstAsset.PageCount%></nobr>, rows per page =
<SELECT NAME="pageSize" onChange='Javascript:document.sortform.submit();'>
<OPTION VALUE="10" <% if rstAsset.PageSize = 10 then %>selected<% end if %> >10
<OPTION VALUE="20" <% if rstAsset.PageSize = 20 then %>selected<% end if %> >20
<OPTION VALUE="30" <% if rstAsset.PageSize = 30 then %>selected<% end if %> >30
<OPTION VALUE="40" <% if rstAsset.PageSize = 40 then %>selected<% end if %> >40
<OPTION VALUE="50" <% if rstAsset.PageSize = 50 then %>selected<% end if %> >50
<OPTION VALUE="60" <% if rstAsset.PageSize = 60 then %>selected<% end if %> >60
<OPTION VALUE="9999" <% if rstAsset.PageSize = 9999 then %>selected<% end if %> >no
limit
</SELECT><a href="Assetlst_Returned.asp" ><img src="http://bytes.com/submit/images/button/button_small_search.gif" alt="Back to the search page" border="0" valign="middle" width="62" height="15" align="absmiddle"></a>
</td>
<td>
<input id="Hidden1" type="hidden" />
</td>
<br />
<%
sql = "SELECT EOTAction_ID,EOTActionName FROM EOTAction " & _
"WHERE EOTAction.EOTAction_ID In (4,5,3)ORDER BY EOTAction.EOTActionName"
%>
<td>
<b><span>Action to be taken </span></b><select name="cboCustomerID" id="cboCustomerID" style="width:250" size="1" onchange="displayResult()">
<option></option>
<%
Set rstCust = Server.CreateObject("ADODB.Recordset")
rstCust.Open sql, objRIMSConn, adOpenForwardOnly
Do Until rstCust.EOF
'Response.Write( "<option value=" & Chr(34) & rstCust("EOTAction_ID") & Chr(34) )
'Response.Write( ">" & rstCust("EOTActionName") & "</option>" & vbCrLf )
%>
<option value="<%= rstCust("EOTActionName")%>"><%=rstCust("EOTActionName")%>
</option>
<%rstCust.MoveNext
Loop %>
</select></td>
</tr>
<!--#INCLUDE FILE="rpt_header.asp"-->
</table>
<br>
<table CELLPADDING="2" CELLSPACING="1" WIDTH="100%" BORDER="0" id="Table_Data">
<tr>
<td><input type="button" name="CheckAll" value="Check All" onclick="checkAll(document.sortform.same)"/></td>
<td><input type="button" name="UnCheckAll" value="Uncheck All"onclick="uncheckAll(document.sortform.same)"/></td>
<td><input type="button" name="UnCheckAll" value="Submit"onclick='Javascript:document.sortform.submit();'/></td>
<tr>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4">
<br>
<b>Select</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4">
<b>Asset_id</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("invoice.invoice_date asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Invoice in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("invoice.invoice_date desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Invoice in descending order" align="middle" border="0" ></a>
<br>
<b>Invoice no.</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("invoice.invoice_date asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Invoice in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("invoice.invoice_date desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Invoice in descending order" align="middle" border="0" ></a>
<br>
<b>Invoice Date</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Supplier_Detail.Supplier_Name asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Supplier in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("Supplier_Detail.Supplier_Name desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Supplier in descending order" align="middle" border="0" ></a>
<br>
<b>Vendor name</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Asset_type.Asset_type_description asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Supplier in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("Asset_type.Asset_type_description desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Supplier in descending order" align="middle" border="0" ></a>
<br>
<b>Asset type</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("assettypesub.assettypesubdesc asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Type in ascending order" align="middle" border="0" ></a>
<a href='Javascript:order_by("assettypesub.assettypesubdesc desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Type in descending order" align="middle" border="0" ></a>
<br>
<b>Asset Sub type</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Asset_Detail.Asset_Description asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Description in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("Asset_Detail.Asset_Description desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Description in descending order" align="middle" border="0"></a>
<br>
<b>Asset Description</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Asset_Detail.Asset_Serial_no asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Serial No in ascending order" align="middle" border="0" ></a>
<a href='Javascript:order_by("Asset_Detail.Asset_Serial_no desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Serial No in descending order" align="middle" border="0" ></a>
<br>
<b>Serial No.</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Asset_Detail.Asset_barcode_no asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Barcode in ascending order" align="middle" border="0" ></a>
<a href='Javascript:order_by("Asset_Detail.Asset_barcode_no desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Barcode in descending order" align="middle" border="0" ></a>
<br>
<b>Barcode No.</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Asset_Detail.Asset_purchase_price asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Purchase Price in ascending order" align="middle" border="0" ></a>
<a href='Javascript:order_by("Asset_Detail.Asset_purchase_price desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Purchase Price in descending order" align="middle" border="0" ></a>
<br>
<b>Asset Value</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("state.statedesc asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by Description in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("state.statedesc desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by Description in descending order" align="middle" border="0"></a>
<br>
<b>State</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Department.Department_Desc asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by PO number in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("Department.Department_Desc desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by PO number in descending order" align="middle" border="0" ></a>
<br>
<b>Branch Location Name</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4"> <a href='Javascript:order_by("Cost_Centre.Cost_Centre_Code asc")'><img src="http://bytes.com/submit/images/up_arrow.gif" alt="Click to sort by PO number in ascending order" align="middle" border="0"></a>
<a href='Javascript:order_by("Cost_Centre.Cost_Centre_Code desc")'><img src="http://bytes.com/submit/images/down_arrow.gif" alt="Click to sort by PO number in descending order" align="middle" border="0" ></a>
<br>
<b>Cost Center</b> </td>
<td ALIGN="center" NOWRAP class="colhead" bgcolor="#B0C5D4">
<br>
<b>Date to be returned</b> </td>
<%
BgColour = BGColourA
intRecordsPrinted = 0
intRecordNo = ((Session("Page") - 1) * rstAsset.PageSize) + 1
Do While Not rstAsset.EOF
If intRecordsPrinted = rstAsset.PageSize then ' Printed all assets in this page.
exit do
End If%>
<tr>
</tr>
<tr id="clickME">
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>" NOWRAP><input id="Checkbox1" name="same" type="checkbox" value="<%=rstAsset("Asset_id")%>" /></td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>" NOWRAP><%=rstAsset("Asset_id") %> </td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>" NOWRAP><%=rstAsset("invoice_no")%> </td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>"> <%= rstAsset("invoice_date") %> </td>
<td ALIGN="left" VALIGN="top" NOWRAP bgcolor="<%=BgColour%>"><%=rstAsset("Supplier_Name")%> </td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>" NOWRAP><%=rstAsset("Asset_type_description")%> </td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>"> <%= rstAsset("assettypesubdesc") %> </td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>"> <%= rstAsset("Asset_description") %> </td>
<td ALIGN="left" VALIGN="top" NOWRAP bgcolor="<%=BgColour%>"> <%=rstAsset("Asset_Serial_no")%> </td>
<td ALIGN="left" VALIGN="top" NOWRAP bgcolor="<%=BgColour%>"><%=rstAsset("Asset_barcode_no")%> </td>
<td ALIGN="right" VALIGN="top" NOWRAP bgcolor="<%=BgColour%>"> <%=Formatnumber(rstAsset("Asset_purchase_price"))%></td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>"> <%= ucase(rstAsset("statedesc")) %> </td>
<td ALIGN="left" VALIGN="top" bgcolor="<%=BgColour%>"> <%= ucase(rstAsset("Department_Desc")) %> </td>
<td ALIGN="left" VALIGN="top" NOWRAP bgcolor="<%=BgColour%>"> <%=rstAsset("Cost_Centre_Code")%> </td>
<td ALIGN="left" VALIGN="top" NOWRAP bgcolor="<%=BgColour%>"> <input id="Text1" name="Date" type="text" /></td>
<%
if BgColour = BGColourA then
BgColour = BGColourB
else
BgColour = BGColourA
end if
intRecordsPrinted = intRecordsPrinted + 1
intRecordNo = intRecordNo + 1
rstAsset.MoveNext
Loop
end if%>
</table>
</table>
</form>
<td width="29"></td>
</tr>
<tr>
<td>
</form>
</td>
</tr>
</table>
<%
'objRIMSConn.Close
'Set objRIMSConn = nothing
%>
<!-- START OF HOTKEY SCRIPT (HOTKEY = Enter ) -->
<!--<script language="JavaScript1.2">
Hide script from old browsers
var hotkey=13
var destination="Asset_Returned.asp"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
// End hiding script from old browsers
</script>
END OF HOTKEY SCRIPT -->