ASP控制每页打印行数实例
来源:CSDN 发布时间:2008-04-13 06:48:00
标签:打印,实例,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>
0
投稿
猜你喜欢
- 对于什么是好设计,一万个人那里至少有一万零一个答案。每个人都有自己的答案,有的人还不止一个答案。老师说,一定要在设计里灌注自己的思想,有了自
- 一). ubuntu下mysql安装布局:/usr/bin  
- 上文: 《IE7的web标准之道——1:前言(兼目录)》IE历来被web标准的拥护者所诟病,而当FireFox横空出世以后,更多的网页制作者
- 之前看到很多人一直都问CSS 中DIV垂直居中的问题,看来对此的需求还不少。现在就把我经验拿出来分享一下,希望大家鼓鼓掌。因为在 CSS 中
- 运行以下代码: Dim com As ADODB.Command Dim rst
- 作用:用ASP程序将页面中的电话号码生成图片格式。 代码如下:<% Call Com_CreatValidCode
- PERCONA PERFORMANCE CONFERENCE 2009上,来自雅虎的几位工程师带来了一篇”Efficient Paginat
- 通常我们会在一些javascript的书籍上看到,使用Javascript保留字作为标识符(变量名、函数名、循环标记等)时,会引起程序报错!
- 什么是MySql数据库?通常意义上,数据库也就是数据的集合,具体到计算机上数据库可以是存储器上一些文件的集合或者一些内存数据的集合。我们通常
- 1.如果每页都增加打印时间,又如何设置?打印时间的,你可以参考 for(var i=0;i<page.length;i++)
- 最近笔者学会了用FrontPage XP做网页,心理特高兴,非常想把我在制作主页过程中的一些经验和大家交流交流、切磋切磋,我们一起来看看吧。
- 去年淘宝做了个“胖子”项目,就是把网页的默认宽度从780提升到了950。也就是说,基本放弃了800×600的用户(没有完全放弃,如果你仔细研
- staytime.asp<% If Request.QueryString("time")&n
- 很多的网站都有记数器,用来记录网站的访问量,这给网站管理员即时了解本网站的运行及访问情况提供了很多的方便。笔者研究过很多用ASP编写的计数器
- Oracle 背景资料 在介绍 Oracle9i 之前我们先介绍一些关于Oracle 公司的资料,让各位朋友更多了解 Oracle。 197
- 上期回顾:亚马逊购物用户体验分析 (二)方便的导航元素任何网上商店的成功,至关重要的一点,就是用户可以简单轻松地使用导航条。基本店铺分类,用
- 很简单的一个函数,就是根据当前的日期生成一个随机数。<% Function getRnd() '**********
- XML是一个精简的SGML,它将SGML的丰富功能与HTML的易用性结合到Web的应用中。XML保留了SGML的可扩展功能,这使XML从根本
- 网站设计时,有一个最常用的指导性原则:页面长度原则上不超过3屏,宽度不超过1屏。这个原则明显是从用户的体验出发,特别是宽度不超过一屏,其最基
- 方法一 <%dim total(7,3) total(1,0)="ASP之家"&n