程序员的部落

导航

打印报表数据

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <style type="text/css">
        .style1
        {
            width: 100%;
            height: 320px;
        }
        .style2
        {
            height: 255px;
        }
        .style3
        {
            height: 75px;
        }
    </style>
<script language="javascript" type="text/javascript">
// <!CDATA[

function btnPrint_onclick() {

         bdhtml=window.document.body.innerHTML;
         sprnstr="<!--startprint-->";
         eprnstr="<!--endprint-->";
         prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
         prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
         window.document.body.innerHTML=prnhtml;
         window.print();
}

// ]]>
</script>
</head>
<body>
    <form id="form1" runat="server">
     <!--startprint-->
    <div>
   
        <table class="style1">
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:Button ID="Button2" runat="server" Text="导 出" onclick="Button2_Click" />
                </td>
                <td>
                    <input id="btnPrint" type="button" value="打 印" onclick="return btnPrint_onclick()" /></td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    城市:&nbsp;
                    <asp:DropDownList ID="dropcity" runat="server"
                        onselectedindexchanged="dropcity_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
                <td>
                    酒店:&nbsp;
                    <asp:DropDownList ID="drophotel" runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                    时间段:&nbsp;
                    <asp:DropDownList ID="droptime1" runat="server">
                    </asp:DropDownList>
                    至<asp:DropDownList ID="droptime2" runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                    状态:&nbsp;
                    <asp:DropDownList ID="dropstate" runat="server">
                        <asp:ListItem>客房预订但为查看</asp:ListItem>
                        <asp:ListItem>客房预定</asp:ListItem>
                        <asp:ListItem>酒店方确认</asp:ListItem>
                        <asp:ListItem>取消</asp:ListItem>
                        <asp:ListItem>已结清正常完成</asp:ListItem>
                        <asp:ListItem>已经作废</asp:ListItem>
                        <asp:ListItem>已经过期</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Button ID="Button1" runat="server" Text="查看" onclick="Button1_Click1" />
                </td>
                <td class="style3">
                    </td>
                <td class="style3">
                    </td>
                <td class="style3">
                    </td>
                <td class="style3">
                    </td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:Repeater ID="Repeater1" runat="server">
                    <HeaderTemplate >
                       <table>
                                    <tr align="center">
                                    <td align="left" width="10%">
                                       订单ID
                                    </td>
                                    <td align="center" width="10%">
                                        房间号
                                    </td>
                                    <td align="center" width="15%">
                                        下单时间
                                    </td>
                                    <td align="center" width="10%">
                                        酒店名称
                                    </td>
                                    <td align="center" width="10%">
                                        订单状态
                                    </td>
                                    <td align="center" width="10%">
                                        订单价格
                                    </td>
                                    <td align="center" width="15%">
                                        有效时间
                                    </td>
                                    <td align="center" width="20%">
                                        订单备注
                                    </td>
                                </tr>
                    </HeaderTemplate>
                    <ItemTemplate >
                      
                            <tr>
                                <td align="center"><asp:Label ID="lblbookid" runat="server" Text='<%#Eval("bookid").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblroomno" runat="server" Text='<%#Eval("roomno").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblboktime" runat="server" Text='<%#Eval("booktime").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblhotelname" runat="server" Text='<%#Eval("hotelname").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblstatus" runat="server" Text='<%#Eval("status").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblbookprice" runat="server" Text='<%#Eval("bookprice").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblinvalidtime" runat="server" Text='<%#Eval("invalidtime").ToString()%>'>&nbsp;</asp:Label></td>
                                <td align="center"><asp:Label ID="lblbookcom" runat="server" Text='<%#Eval("bookcom").ToString()%>'>&nbsp;</asp:Label></td>
                       
                            </tr>
                     
                   
                    </ItemTemplate>
                    <FooterTemplate >
                   
                         <tr></tr>
                    </table>
                    </FooterTemplate>
                    </asp:Repeater>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2" colspan="5">
                    &nbsp;</td>
            </tr>
        </table>
   
    </div>
     <!--endprint-->
    </form>
</body>
</html>

posted on 2009-04-02 10:13  程序员的部落  阅读(175)  评论(0编辑  收藏  举报