ASP控制每页打印行数的方法
在日常工作中,打印文档经常要使用,但是网页打印起来大部分都是不能控制的,这里分享一个用 ASP控制每页打印行数的方法。也许对你有一点点的启发哦!<%
pagenum=55′指定打印行数
%>
<HTML>
<HEAD>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<TITLE>销售利润明细报表打印</TITLE>
<style type=”text/css”>
td {font-size:9pt; color:#000000}
A{text-decoration:none}
A:hover{color:#FF0000;text-decoration:derline}
.break{page-break-before:always}
</style>
</HEAD>
<script language=”javascript”>
window.print()
</script>
<BODY style=”border:none” topmargin=”0″ leftmargin=”6″ onload=”javascrpt:pagesetup_default();”>
<script language=”VbScript”>
dim hkey_root,hkey_path,hkey_key
hkey_root=”HKEY_CURRENT_USER”
hkey_path=”\Software\Microsoft\Internet Explorer\PageSetup”
function pagesetup_default()
on error resume next
Set RegWsh = CreateObject(“WScript.Shell”)
hkey_key=”\header”
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,”&b页&p/&P”
hkey_key=”\footer”
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,”"
end function
</script>
<%
kdname1=trim(request(“kdname1″))
kdname2=trim(request(“kdname2″))
keyword1=trim(request(“keyword1″))
keyword2=trim(request(“keyword2″))
if keyword1<>”" then
today=keyword1
else
if kdname1=”" then
today=year(date())&”-”&month(date())
else
today=kdname1&”至”&kdname2
end if
end if
%>
<table border=”0″ cellspacing=”0″ cellpadding=”0″ align=”center” width=”740″ height=”30″>
<tr>
<td align=”center”>销售利润汇总报表</td>
</tr>
</table>
<%
strSQL=”select autoid,sellautoid,productxili,productname,productsize,productnum,productdan,productjia,chaoshi,tiaoma,youhui,fukuan,moncount1,gongshang,lirun1,username,indate,fudate from sell where officename=’”&trim(request.cookies(“Myoffice”))&”‘ and monthjie=’0′ and (year(indate)=year(getdate()) and month(indate)=month(getdate())) and zhuofei is null order by autoid desc”
set rs1=server.createobject(“adodb.recordset”)
rs1.open strSQL,conn,1,1
%>
<table border=”1″ cellspacing=”0″ cellpadding=”0″ align=”center” style=”border-collapse: collapse” bordercolor=”#000000″ width=”740″>
<tr>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”70″ >销售单号</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”168″ >商品名称(规格)</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”121″ >客户</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”30″ >数量</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”24″ >单位</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”50″ >销售价</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”23″ >折%</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”52″ >进货价</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”55″ >小计</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”45″ >利润</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”25″ >付款</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”61″ >销售日期</td>
</tr>
</table>
<%
moncount2=0
moncount5=0
Do while not rs1.eof
%>
<table border=”1″ cellpadding=”0″ cellspacing=”0″ width=”740″ align=”center” style=”border-collapse:collapse; font-size:10pt;color:#000000″ bordercolor=”#000000″>
<%
for i=1 to pagenum
if not rs1.eof then
if trim(rs1(“fukuan”))=”欠款” then
moncount6=Csng(rs1(“lirun1″))
moncount5=moncount5+moncount6
else
moncount3=Csng(rs1(“lirun1″))
moncount2=moncount2+moncount3
end if
%>
<tr>
<td height=”18″ width=”70″> <%=rs1(“sellautoid”)%></td>
<td height=”18″ width=”168″><%=Decode(rs1(“productname”))%> <%=rs1(“productsize”)%></td>
<td height=”18″ width=”121″><%=left(rs1(“gongshang”),9)%></td>
<td height=”18″ width=”30″ align=”center”><%=rs1(“productnum”)%></td>
<td height=”18″ width=”24″ align=”center”><%=rs1(“productdan”)%></td>
<td height=”18″ width=”50″ align=”right”><%=formatNumber(rs1(“chaoshi”),varnum,-1)%></td>
<td height=”18″ width=”23″ align=”center”><%=rs1(“youhui”)%></td>
<td height=”18″ width=”52″ align=”right”><%=formatNumber(rs1(“productjia”),varnum,-1)%></td>
<td height=”18″ width=”55″ align=”right”><%=formatNumber(rs1(“moncount1″),varnum,-1)%></td>
<td height=”18″ width=”45″ align=”right”><%=formatNumber(rs1(“lirun1″),varnum,-1)%></td>
<td align=”center” height=”18″ width=”25″><%if trim(rs1(“fukuan”))=”欠款” then%><font color=blue><%=rs1(“fukuan”)%></font><%else%><%=rs1(“fukuan”)%><%end if%></td>
<td height=”18″ width=”61″><%=rs1(“indate”)%></td>
</tr>
<%
rs1.movenext
end if
next
%>
</table>
<%
if not rs1.eof and i=pagenum+1 then ‘添加分页标记
%>
<div class=”break”> </div>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”740″ height=”12″ align=”center”><tr><td height=”12″></td></tr></table>
<table border=”1″ cellspacing=”0″ cellpadding=”0″ align=”center” width=”740″ style=”border-collapse: collapse” bordercolor=”#000000″>
<tr>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”70″ >销售单号</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”168″ >商品名称(规格)</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”121″ >客户</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”30″ >数量</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”24″ >单位</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”50″ >销售价</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”23″ >折%</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”52″ >进货价</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”55″ >小计</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”45″ >利润</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”25″ >付款</td>
<td align=”center” height=”20″ bgcolor=”#BDCBEE” width=”61″ >销售日期</td>
</tr>
<%
end if
loop
rs1.close
set rs1=nothing
%>
</table>
<table border=”1″ cellpadding=”0″ cellspacing=”0″ width=”740″ height=”20″ align=”center” style=”border-collapse: collapse” bordercolor=”#000000″>
<tr>
<td><font color=”#FF0000″><b>现金利润:</b></font><b><%=formatNumber(moncount2,varnum,-1)%></b> <%if moncount5<>”" then%><b><font color=”#FF0000″>欠款利润</font>:<%=formatNumber(moncount5,varnum,-1)%></b><%end if%> <%if moncount5<>”" then%><b><font color=”#FF0000″>毛利合计:</font><%=formatNumber(moncount5+moncount2,varnum,-1)%></b><%end if%></td>
</tr>
</table>
<%
end if
conn.close
set conn=nothing
%>
</BODY>
</HTML>
ASP动态显示页面的锚链接
锚点是“top”,可以放在页面的任何位置,一般是页首。程序红色部分是关键,就是对锚点出现的判断,我设置的数值是4,意思是出现4个动态数据就出现一个锚点,少于4个时因为还在同一个页面,就不需要有锚点出现,这个数值可以根据实际情况进行修改。为了对页面进行进行美化,可以把锚点的文字用图形。
<a name=”top”></a>
……(具体内容省略)
<%
While ((Repeat2__numRows <> 0) AND (NOT rsp.EOF))
%>
……(具体内容省略)
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
if Repeat2__numRows < 4 then
Response.Write(“<table width=400 border=0 cellpadding=0 cellspacing=1><tr><td align=right><a href=#top>top</a></td></tr></table>”)
else
Response.Write(“<table width=400 border=0 cellpadding=0 cellspacing=1><tr><td align=right>a</td></tr></table>”)
end if
rsp.MoveNext()
Wend
%>
初识“微软ISA认证”
【简 介】
随着网络安全行业的升温,微软继思科成功推出安全认证专家(CCSP)后,又新增两门安全类专业方向的认证–MCSA: Security和MCSE: Security,继此,又推出ISA认证。 function goforum(){ var ff=document.all.forum.options[document.all.forum.selectedIndex].value; window.location.href=ff; return false; } 它是针对那些部署和管理部门级应用程序、组件、Web或桌面系统客户端及网络安全服务的专业人员而提供的。其工作角色涵盖了从需求实现到解决方案建立、部署与维护在内的各种任务。大家也许对它还比较陌生,下面我们进行一下简单的介绍:
业界评论
微软ISA(Internet Security and Acceleration ) SERVER 2000软件,是微软推出的防火墙服务器软件,堪称网络安全与速度的完美结合。目前,业界使用这个软件的企业越来越多通过这门认证,可得到MCP(产品专家)证书。
认识ISA
ISA Server通过集成一个可扩展的多层企业级防火墙和一个可伸缩的高性能Web缓存,从而实现合二为一的网络安全和加速服务器。
ISA Server有很强的自定义和扩展性。它包括一个综合的软件开发包(SDK)和应用程序接口 (API),方便本地合作伙伴能够快速、方便地为企业扩展其安全和缓存解决方案。
ISA Server能够帮助企业发布Exchange和IIS,同时,还集成了入侵检测功能、H.323(关守)等模块。
关于考试
考试号:70-227
考试科目(中文) :安装、配置和管理微软Internet安全和加速(ISA)服务器2000企业版
考试题数:50道题
考试时间:170分钟
满分:1000

