<%@ page language="C#" masterpagefile="MyShopMasterPage.master" autoeventwireup="true" inherits="Shop_Member_Shop_InvoiceView, WebApp_deploy" title=" 发 票 信 息 列 表" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<div class="pageTitle">开发票记录</div>
<br />
    <table class="SearchTableStyle">
         <tr>
            <td> 客户：</td>
            <td><asp:TextBox ID="TxtUserName" runat="server" Height="16px"/></td>
            <td>起始日期：</td>
            <td><asp:TextBox ID="TxtBeginDate" Text="2006-01-01" runat="server" Height="16px"/></td>
            <td>结束日期：</td>
            <td><asp:TextBox ID="TxtEndDate" Text="2500-01-01" runat="server" Height="16px"/></td>
            <td><asp:Button ID="QuickSearchBtn" runat="server" Text="查询" OnClick="Query" /></td>
        </tr>
    </table>
    <br />
    <table class="SearchTableStyle">
        <tr>
            <td>
        你现在查看的是：<asp:DropDownList ID="DropInvoiceType" runat="server" OnSelectedIndexChanged="Query" AutoPostBack="true">
                   <asp:ListItem Value="-1" Text="所有" Selected="true"/>
                   <asp:ListItem Value="0" Text="地税普通发票"/>
                   <asp:ListItem Value="1" Text="国税普通发票"/>
                   <asp:ListItem Value="2" Text="增值税发票"/>
                </asp:DropDownList>
    </td></tr></table>
    <br />
    <asp:UpdatePanel ID="UpdatePanel4" runat="server" >
        <ContentTemplate>
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" OnDataBound="GridView2_DataBound"  AllowPaging="True" PageSize="15" CssClass="tableHead">
                <Columns>
                    <asp:TemplateField HeaderText="客户">
                        <EditItemTemplate>
                         <a href="../../Shop/index.aspx?id=<%#Eval("UserID") %>" target="_blank">  <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("UserName") %>'></asp:TextBox></a>
                        </EditItemTemplate>
                        <ItemTemplate>
                           <a href="../../Shop/index.aspx?id=<%#Eval("UserID") %>" target="_blank">    <asp:Label ID="Label1" runat="server" Text='<%# Bind("UserName") %>'></asp:Label></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="InvoiceDate" HeaderText="日期" HeaderStyle-Width="8%"　/>
                    <asp:BoundField DataField="InvoiceType" HeaderText="发票类型" HeaderStyle-Width="10%"　 />
                    <asp:BoundField DataField="InvoiceNum" HeaderText="发票号码" HeaderStyle-Width="10%"　 />
                    <asp:BoundField DataField="Invoicetitle" HeaderText="抬头" HeaderStyle-Width="10%"　/>
                    <asp:HyperLinkField DataNavigateUrlFields="OrderFormNum" DataNavigateUrlFormatString="shop_buyorder.aspx?OrderFormNum={0}"
                        DataTextField="OrderFormNum" HeaderText="订单" HeaderStyle-Width="14%"　 />
                    <asp:BoundField DataField="Drawer" HeaderText="开票人" HeaderStyle-Width="10%"　/>
                    <asp:BoundField DataField="Inputer" HeaderText="录入员" HeaderStyle-Width="10%"　/>
                    <asp:BoundField DataField="totalmoney" HeaderText="金额" HeaderStyle-Width="10%"　/>
                    
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <a href='<%#"javascript:showDetail(\""+Eval("InvoiceID")+"\",\""+Eval("InvoiceType")+"\",\""+Eval("InvoiceNum")+"\",\""+Eval("Drawer")+"\",\""+Eval("Inputer")+"\",\""+Eval("totalmoney")+"\",\""+Eval("InvoiceContent")+"\");" %>'>修改</a>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                 <EmptyDataTemplate >                   
                      <table class="tableHead" ><tr><th style="width:8%" scope="col">日期</th><th style="width:10%" scope="col">发票类型</th><th style="width:10%" scope="col">发票号码</th><th style="width:10%" scope="col">抬头</th><th style="width:14%" scope="col">订单</th><th style="width:10%" scope="col">开票人</th><th style="width:10%" scope="col">录入员</th>
                      <th style="width:10%" scope="col">金额</th><th style="width:8%" scope="col">录入时间</th></tr>
                      <tr><td colspan="9">没有符合查询条件的记录</td></tr>
                      </table>
                    </EmptyDataTemplate> 
            </asp:GridView>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="DropInvoiceType"/>
            <asp:AsyncPostBackTrigger ControlID="QuickSearchBtn"/>
            <asp:AsyncPostBackTrigger ControlID="btnConfirm"/>
        </Triggers>
    </asp:UpdatePanel>
    
    <table class="SearchTableStyle" id="showEditTb" style="margin-top:30px; display:none;" cellpadding="3" cellspacing="3">
        <tr>
            <td style="margin-top:15px">发票类型</td>
            <td>
                <asp:DropDownList ID="ddlInvoiceType" runat="server">
                    <asp:ListItem Text="地税普通发票" Value="0" />
                    <asp:ListItem Text="国税普通发票" Value="1" />
                    <asp:ListItem Text="增值税发票" Value="2" />
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>发票号码：</td>
            <td><asp:TextBox ID="txtInvoiceNum" runat="Server" />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^[A-Za-z0-9]+$" ControlToValidate="TxtInvoiceNum" ErrorMessage="发票号码格式不对！"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>开票人：</td>
            <td><asp:TextBox ID="txtInvoiceDrawer" runat="Server" /></td>
        </tr>
        <tr>
            <td>录入人：</td>
            <td><asp:TextBox ID="txtInputer" runat="Server" /></td>
        </tr>
        <tr>
            <td>发票内容：</td>
            <td>
                <asp:TextBox ID="txtContent" runat="Server" TextMode="MultiLine" Columns="10" Width="250px" />
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align:center; vertical-align:middle">
                <asp:Button ID="btnConfirm" Text="修改" OnClick="Button_Edit" runat="Server" />&nbsp;&nbsp;
                <input type="button" value="取消" onclick="hideDetail()" />
                <asp:HiddenField ID="hfHidenId" runat="Server" /></td>
        </tr>
    </table>
    
    <script type="text/javascript">
        var hfHidenId="<%=hfHidenId.ClientID %>";
        var ddlInvoiceType="<%=ddlInvoiceType.ClientID %>";
        var txtInvoiceNum="<%=txtInvoiceNum.ClientID %>";
        var txtInvoiceDrawer="<%=txtInvoiceDrawer.ClientID %>";
        var txtInputer="<%=txtInputer.ClientID %>";
        var txtContent="<%=txtContent.ClientID %>";
        function showDetail(id,type,num,draw,inputer,monery,content){
            document.getElementById('showEditTb').style.display="";
            document.getElementById(hfHidenId).value=id;
            document.getElementById(ddlInvoiceType).value=type;
            document.getElementById(txtInvoiceNum).value=num;
            document.getElementById(txtInvoiceDrawer).value=draw;
            document.getElementById(txtInputer).value=inputer;
            document.getElementById(txtContent).value=content;
        }
        function hideDetail(){
            document.getElementById('showEditTb').style.display="none";
        }
    
    </script>
</asp:Content>

