ASP控制每页打印行数

所属分类: 网络编程 / ASP编程 阅读数: 1531
收藏 0 赞 0 分享
 

<%
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">&nbsp;<%=rs1("sellautoid")%></td>            
      <td height="18" width="168"><%=Decode(rs1("productname"))%>&nbsp;<%=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">&nbsp;</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>&nbsp;&nbsp;&nbsp;<%if moncount5<>"" then%><b><font color="#FF0000">欠款利润</font>:<%=formatNumber(moncount5,varnum,-1)%></b><%end if%>&nbsp;&nbsp;&nbsp;<%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知识整理笔记4(问答模式)

这是关于asp知识整理的最后一份笔记,希望大家仔细阅读。
收藏 0 赞 0 分享

ASP基础知识VBScript基本元素讲解

这篇文章主要介绍了ASP基础知识VBScript基本元素的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP编码和解码函数详解

这篇文章主要介绍了ASP编码和解码函数的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP显示页面执行时间的方法

这篇文章主要介绍了ASP显示页面执行时间的方法,在本地测试一下输出页面需要多少时间,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP基础入门第一篇(ASP技术简介)

本文将以 Active Server Pages 为中心,向你全面展示制作动态商业网站的步骤和技巧并通过大量的实例,让你在不断的理论和实践之中笑傲“网络”……
收藏 0 赞 0 分享

ASP基础入门第二篇(ASP基础知识)

这篇文章是ASP基础入门第二篇,第一篇展示了ASP动态网站设计的一些最基本的方法,相信通过实践各位对 ASP 已经有了最基本的了解,本文将进一步介绍ASP动态网站的一些基本技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP基础入门第三篇(ASP脚本基础)

通过前两篇的学习,相信各位已经对 ASP 的动态网站设计有了一个基本的概念和整体的印象。从本篇开始作者将从脚本语言的使用着手,由浅入深地带领大家探索 ASP 动态网站设计的真正奥秘。
收藏 0 赞 0 分享

ASP基础入门第四篇(脚本变量、函数、过程和条件语句)

大家在学习了脚本语言 VBScript 的变量、常量和过程的基本概念后,本期将继续向各位介绍 VBScript 的函数和语法。
收藏 0 赞 0 分享

ASP基础入门第五篇(ASP脚本循环语句)

在本文上两篇中,我们学习了脚本语言 VBScript 的变量、函数、过程和条件语句,本篇将继续给大家介绍 VBScipt 的循环语句,并对脚本语言在 ASP 中的应用加以总结。  
收藏 0 赞 0 分享

ASP基础入门第六篇(ASP内建对象Request)

从本篇开始作者从 ASP 内建对象着手,为大家详细剖析 ASP 的六个内建对象和各种组件的特性和方法,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多