📄 htlist.asp
字号:
<%@ CodePage = 936 LCID = 2052 %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<%
ewCurSec = 0 ' Initialise
' User levels
Const ewAllowAdd = 1
Const ewAllowDelete = 2
Const ewAllowEdit = 4
Const ewAllowView = 8
Const ewAllowList = 8
Const ewAllowReport = 8
Const ewAllowSearch = 8
Const ewAllowAdmin = 16
%>
<%
' Initialize common variables
x_ID = Null
x_5408540C53F7 = Null
x_5BA26237540D79F0 = Null
x_4EA754C1578B53F7 = Null
x_657091CF = Null
x_4EF7683C = Null
x_91D1989D = Null
x_67085EA6 = Null
x_4EA4671F = Null
x_627F529E = Null
x_59076CE8 = Null
x_53CD998862A5916C = Null
%>
<%
sExport = Request.QueryString("export") ' Load Export Request
If sExport = "html" Then
' Printer Friendly
End If
If sExport = "excel" Then
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=ht.xls"
End If
If sExport = "word" Then
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader "Content-Disposition:", "attachment; filename=ht.doc"
End If
If sExport = "xml" Then
Response.ContentType = "text/xml"
Response.AddHeader "Content-Disposition:", "attachment; filename=ht.xml"
End If
If sExport = "csv" Then
Response.ContentType = "application/csv"
Response.AddHeader "Content-Disposition:", "attachment; filename=ht.csv"
End If
%>
<!--#include file="db.asp"-->
<!--#include file="aspmkrfn.asp"-->
<%
nStartRec = 0
nStopRec = 0
nTotalRecs = 0
nRecCount = 0
nRecActual = 0
sKeyMaster = ""
sDbWhereMaster = ""
sSrchAdvanced = ""
sSrchBasic = ""
sSrchWhere = ""
sDbWhere = ""
sDefaultOrderBy = ""
sDefaultFilter = ""
sWhere = ""
sGroupBy = ""
sHaving = ""
sOrderBy = ""
sSqlMaster = ""
nDisplayRecs = 20
nRecRange = 10
' Set up records per page dynamically
SetUpDisplayRecs()
' Open connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
' Handle Reset Command
ResetCmd()
' Get Search Criteria for Advanced Search
SetUpAdvancedSearch()
' Get Search Criteria for Basic Search
SetUpBasicSearch()
' Build Search Criteria
If sSrchAdvanced <> "" Then
sSrchWhere = sSrchAdvanced ' Advanced Search
ElseIf sSrchBasic <> "" Then
sSrchWhere = sSrchBasic ' Basic Search
End If
' Save Search Criteria
If sSrchWhere <> "" Then
Session("ht_searchwhere") = sSrchWhere
' Reset start record counter (new search)
nStartRec = 1
Session("ht_REC") = nStartRec
Else
sSrchWhere = Session("ht_searchwhere")
End If
' Build WHERE condition
sDbWhere = ""
If sDbWhereMaster <> "" Then
sDbWhere = sDbWhere & "(" & sDbWhereMaster & ") AND "
End If
If sSrchWhere <> "" Then
sDbWhere = sDbWhere & "(" & sSrchWhere & ") AND "
End If
If Len(sDbWhere) > 5 Then
sDbWhere = Mid(sDbWhere, 1, Len(sDbWhere)-5) ' Trim rightmost AND
End If
' Build SQL
sSql = "SELECT * FROM [ht]"
' Load Default Filter
sDefaultFilter = ""
sGroupBy = ""
sHaving = ""
' Load Default Order
sDefaultOrderBy = "[合同号] DESC"
sWhere = ""
If sDefaultFilter <> "" Then
sWhere = sWhere & "(" & sDefaultFilter & ") AND "
End If
If sDbWhere <> "" Then
sWhere = sWhere & "(" & sDbWhere & ") AND "
End If
If Right(sWhere, 5) = " AND " Then sWhere = Left(sWhere, Len(sWhere)-5)
If sWhere <> "" Then
sSql = sSql & " WHERE " & sWhere
End If
If sGroupBy <> "" Then
sSql = sSql & " GROUP BY " & sGroupBy
End If
If sHaving <> "" Then
sSql = sSql & " HAVING " & sHaving
End If
' Set Up Sorting Order
sOrderBy = ""
SetUpSortOrder()
If sOrderBy <> "" Then
sSql = sSql & " ORDER BY " & sOrderBy
End If
'Session("ewmsg") = sSql ' Uncomment to show SQL for debugging
' Export Data only
If sExport = "xml" Or sExport = "csv" Then
Call ExportData(sExport, sSql)
conn.Close ' Close Connection
Set conn = Nothing
Response.End
End If
%>
<% If sExport <> "word" And sExport <> "excel" Then %>
<!--#include file="header.asp"-->
<script type="text/javascript" src="ew.js"></script>
<script type="text/javascript">
<!--
EW_dateSep = "/"; // set date separator
//-->
</script>
<% End If %>
<%
' Set up Record Set
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, conn, 1, 2
nTotalRecs = rs.RecordCount
If nDisplayRecs <= 0 Then ' Display All Records
nDisplayRecs = nTotalRecs
End If
nStartRec = 1
SetUpStartRec() ' Set Up Start Record Position
%>
<p><span class="aspmaker"><% If sExport = "" Then %>
<a href="htlist.asp?export=excel"><img src="images/exportxls.gif" width="16" height="16" border="0">导入Excel</a>
<a href="htlist.asp?export=word"><img src="images/exportdoc.gif" width="16" height="16" border="0">导入Word</a>
<a href="htlist.asp?export=xml"><img src="images/exportxml.gif" width="16" height="16" border="0">导入Xml</a>
<a href="htlist.asp?export=csv"><img src="images/exportcsv.gif" width="16" height="16" border="0">导入Excel逗号分隔值</a>
<% End If %>
</span></p>
<% If sExport = "" Then %>
<form action="htlist.asp">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><span class="aspmaker"> </span><span class="aspmaker">
<input type="radio" name="psearchtype" value="" checked>
模糊查询
<input type="radio" name="psearchtype" value="AND">
所有关键字
<input type="radio" name="psearchtype" value="OR">
单一关键字
<input type="text" name="psearch" size="20">
<input type="Submit" name="Submit" value="查询">
<a href="htlist.asp?cmd=reset"><br>
<br>
显示所有</a> <a href="htsrch.asp">高级查询</a></span></div></td>
</tr>
</table>
</form>
<% End If %>
<% If sExport = "" Then %>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="aspmaker"><a href="htadd.asp">合同添加</a></span></td>
</tr>
</table>
<p>
<% End If %>
<%
If Session("ewmsg") <> "" Then
%>
<p><span class="aspmaker" style="color: Red;"><%= Session("ewmsg") %></span></p>
<%
Session("ewmsg") = "" ' Clear message
End If
%>
<form method="post">
<table border="0" cellspacing="1" cellpadding="0" width="98%" bgcolor="B0C8EA" align="center">
<% If nTotalRecs > 0 Then %>
<!-- Table header -->
<tr align="center" valign="middle" bgcolor="D7E8F8">
<td width="65" height="30"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
合同号
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("合同号") %>" style="color: #2b486a;">合同号<% If Session("ht_x_5408540C53F7_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_5408540C53F7_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<td width="65" height="30"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
客户名称
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("客户名称") %>" style="color: #2b486a;">客户名称<% If Session("ht_x_5BA26237540D79F0_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_5BA26237540D79F0_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<td width="65" height="30" bgcolor="D7E8F8"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
产品型号
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("产品型号") %>" style="color: #2b486a;">产品型号<% If Session("ht_x_4EA754C1578B53F7_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_4EA754C1578B53F7_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<td width="35" height="30"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
数量
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("数量") %>" style="color: #2b486a;">数量<% If Session("ht_x_657091CF_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_657091CF_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<td width="65" height="30"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
产品价格
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("价格") %>" style="color: #2b486a;">产品价格<% If Session("ht_x_4EF7683C_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_4EF7683C_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<td width="65" height="30"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
成交金额
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("金额") %>" style="color: #2b486a;">成交金额<% If Session("ht_x_91D1989D_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_91D1989D_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<td width="40" height="30"><div align="center"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
交期
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("交期") %>" style="color: #2b486a;">交期
<% If Session("ht_x_4EA4671F_Sort") = "ASC" Then %>
<img src="images/sortup.gif" width="10" height="9" border="0">
<% ElseIf Session("ht_x_4EA4671F_Sort") = "DESC" Then %>
<img src="images/sortdown.gif" width="10" height="9" border="0">
<% End If %>
</a>
<% End If %>
</span></div></td>
<td width="50" height="30"><span style="color: #2b486a; font-size: 12px;">
<% If sExport <> "" Then %>
承办人
<% Else %>
<a href="htlist.asp?order=<%= Server.URLEncode("承办") %>" style="color: #2b486a;">承办人<% If Session("ht_x_627F529E_Sort") = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("ht_x_627F529E_Sort") = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
<% End If %>
</span></td>
<% If sExport = "" Then %>
<td height="30"> </td>
<td height="30"> </td>
<td height="30"> </td>
<% End If %>
</tr>
<% End If %>
<%
' Avoid starting record > total records
If CLng(nStartRec) > CLng(nTotalRecs) Then
nStartRec = nTotalRecs
End If
' Set the last record to display
nStopRec = nStartRec + nDisplayRecs - 1
' Move to first record directly for performance reason
nRecCount = nStartRec - 1
If Not rs.Eof Then
rs.MoveFirst
rs.Move nStartRec - 1
End If
Dim tot_x_91D1989D
tot_x_91D1989D = 0 ' Initialise total to zero for aggregation
nRecActual = 0
Do While (Not rs.Eof) And (nRecCount < nStopRec)
nRecCount = nRecCount + 1
If CLng(nRecCount) >= CLng(nStartRec) Then
nRecActual = nRecActual + 1
' Set row color
sItemRowClass = " bgcolor=""#FFFFFF"""
' Display alternate color for rows
If nRecCount Mod 2 <> 0 Then
sItemRowClass = " bgcolor=""#EBF3FC"""
End If
' Load Key for record
sKey = rs("ID")
x_ID = rs("ID")
x_5408540C53F7 = rs("合同号")
x_5BA26237540D79F0 = rs("客户名称")
x_4EA754C1578B53F7 = rs("产品型号")
x_657091CF = rs("数量")
x_4EF7683C = rs("价格")
x_91D1989D = rs("金额")
tot_x_91D1989D = tot_x_91D1989D + x_91D1989D ' Accumulate Total
x_67085EA6 = rs("月度")
x_4EA4671F = rs("交期")
x_627F529E = rs("承办")
x_59076CE8 = rs("备注")
x_53CD998862A5916C = rs("反馈报酬")
%>
<!-- Table body -->
<tr align="center"<%=sItemRowClass%>>
<!-- ID -->
<!-- 合同号 -->
<td><span class="aspmaker">
<a href="<% If Not IsNull(sKey) Then Response.Write "htview.asp?key=" & Server.URLEncode(sKey) Else Response.Write "javascript:alert('Invalid Record! Key is null');" End If %>"><% Response.Write x_5408540C53F7 %></a>
</span></td>
<!-- 客户名称 -->
<td><span class="aspmaker">
<% Response.Write x_5BA26237540D79F0 %>
</span></td>
<!-- 产品型号 -->
<td><span class="aspmaker">
<% Response.Write x_4EA754C1578B53F7 %>
</span></td>
<!-- 数量 -->
<td><span class="aspmaker">
<% Response.Write x_657091CF %>
</span></td>
<!-- 价格 -->
<td><span class="aspmaker">
<% Response.Write x_4EF7683C %>
</span></td>
<!-- 金额 -->
<td><span class="aspmaker">
<% Response.Write x_91D1989D %>
</span></td>
<!-- 月度 -->
<!-- 交期 -->
<td><div align="center"><span class="aspmaker">
<% Response.Write x_4EA4671F %>
</span></div></td>
<!-- 承办 -->
<td><span class="aspmaker">
<% Response.Write x_627F529E %>
</span></td>
<!-- 备注 -->
<!-- 反馈报酬 -->
<% If sExport = "" Then %>
<td><span class="aspmaker"><a href="<% If Not IsNull(sKey) Then Response.Write "htedit.asp?key=" & Server.URLEncode(sKey) Else Response.Write "javascript:alert('Invalid Record! Key is null');" End If %>"><img src="images/edit.gif" alt="修改" width="16" height="16" border="0"></a></span></td>
<td><span class="aspmaker"><a href="<% If Not IsNull(sKey) Then Response.Write "htadd.asp?key=" & Server.URLEncode(sKey) Else Response.Write "javascript:alert('Invalid Record! Key is null');" End If %>"><img src="images/copy.gif" alt="复制" width="16" height="16" border="0"></a></span></td>
<td><span class="aspmaker"><a href="<% If Not IsNull(sKey) Then Response.Write "htdelete.asp?key=" & Server.URLEncode(sKey) Else Response.Write "javascript:alert('Invalid Record! Key is null');" End If %>"><img src="images/delete.gif" alt="删除" width="16" height="16" border="0"></a></span></td>
<% End If %>
</tr>
<%
End If
rs.MoveNext
Loop
%>
<%
x_91D1989D = tot_x_91D1989D
%>
<% If nTotalRecs > 0 Then %>
<!-- Table footer -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -