ASP control the number of rows per page _ Application Tips

Source: Internet
Author: User

<%
Pagenum=55 ' Specifies the number of lines to print
%>
<HTML>
<HEAD>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<TITLE> Sales Profit Detail report print </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 page &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& "to" &kdname2
End If
End If
%>
<table border= "0" cellspacing= "0" cellpadding= "0" align= "center" width= "740" height= ">"
<tr>
<TD align= "Center" > Sales Profit Summary report </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 (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>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Sales number </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Product name (SPEC) </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" 121 "> Customer </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Quantity </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Unit </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Sales price </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Fold%</td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" "> Purchase price </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Subtotal </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Profit </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Payment </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Sales Date </td>
</tr>
</table>
<%
Moncount2=0
Moncount5=0
Do as 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")) = "arrears" Then
Moncount6=csng (Rs1 ("lirun1"))
Moncount5=moncount5+moncount6
Else
Moncount3=csng (Rs1 ("lirun1"))
Moncount2=moncount2+moncount3
End If
%>
<tr>
&LT;TD height= "Width=" > <%=rs1 ("sellautoid")%></td>
&LT;TD height= "width=" ><%=decode (rs1 ("ProductName"))%> <%=rs1 ("Productsize")%></td>
&LT;TD height= "A" width= "121" ><%=left (rs1 ("Gongshang"), 9)%></td>
&LT;TD height= "width=" align= "Center" ><%=rs1 ("Productnum")%></td>
&LT;TD height= "width=" align= "Center" ><%=rs1 ("Productdan")%></td>
&LT;TD height= "width=" align= "right" ><%=formatnumber (Rs1 ("Chaoshi"), varnum,-1)%></td>
&LT;TD height= "width=" align= "Center" ><%=rs1 ("Youhui")%></td>
&LT;TD height= "width=" align= "right" ><%=formatnumber (Rs1 ("Productjia"), varnum,-1)%></td>
&LT;TD height= "width=" align= "right" ><%=formatnumber (Rs1 ("Moncount1"), varnum,-1)%></td>
&LT;TD height= "width=" align= "right" ><%=formatnumber (Rs1 ("lirun1"), varnum,-1)%></td>
&LT;TD align= "center" height= "width=" ><%if Trim (rs1 ("Fukuan")) = "Arrears" Then%><font color=blue> <%=rs1 ("Fukuan")%></font><%else%><%=rs1 ("Fukuan")%><%end if%></td>
&LT;TD height= "width=" ><%=rs1 ("Indate")%></td>
</tr>
<%
Rs1.movenext
End If
Next
%>
</table>
<%
If not rs1.eof and i=pagenum+1 then ' add page mark
%>
<div class= "Break" > </div>
<table border= "0" cellpadding= "0" cellspacing= "0" width= "740" height= "" align= "center" ><tr><td height= "></td></tr></table>"
<table border= "1" cellspacing= "0" cellpadding= "0" align= "center" width= "740" style= "Border-collapse:collapse" Bordercolor= "#000000" >
<tr>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Sales number </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Product name (SPEC) </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" 121 "> Customer </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Quantity </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Unit </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Sales price </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Fold%</td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" "> Purchase price </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Subtotal </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Profit </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Payment </td>
&LT;TD align= "center" height= "bgcolor=" #BDCBEE "width=" > Sales Date </td>
</tr>
<%
End If
Loop
Rs1.close
Set rs1=nothing
%>
</table>
<table border= "1" cellpadding= "0" cellspacing= "0" width= "740" "height=" align= "center" style= "Border-collapse: Collapse "bordercolor=" #000000 ">
<tr>
<td><font color= "#FF0000" ><b> Cash profit: </b></font><b><%=formatnumber ( moncount2,varnum,-1)%></b> <%if moncount5<> "Then%><b><font color=" #FF0000 "> Arrears profit </font>:<%=formatnumber (moncount5,varnum,-1)%></b><%end if%> <%if "" Then%><b><font color= "#FF0000" Total > Gross margin: </font><%=formatnumber (moncount5+moncount2,varnum,- 1)%></b><%end if%></td>
</tr>
</table>
<%
End If
Conn.close
Set conn=nothing
%>

</BODY>
</HTML>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.