<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyTickets.aspx.cs" Inherits="TruxWebPortal.MyTickets" %>
<%@ Register TagPrefix="ucHeader" TagName="truxHeader" Src="header.ascx" %>
<%@ Register TagPrefix="ucFooter" TagName="truxFooter" Src="footer.ascx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="HeadMyTickets" runat="server">
        <title>My Tickets</title>
        <link rel="stylesheet" type="text/css" href="_style/stylesheet.css" title="TRUX7" />
        <script src="styleswitch.js" type="text/javascript"> </script>
        <script src="js/jquery/jquery-1.11.2.min.js" type="text/javascript"> </script>
        <script src="js/jqueryUI/jquery-ui.min.js" type="text/javascript"> </script> 
        <link rel="Stylesheet" href="_style/css/jquery-ui-1.8.24.custom.css" />  

        <script type="text/javascript">

            function generateTicket(ticketID) {
                window.open("Handlers/DownloadHandler.ashx?method=generateTicketStream&ticketID=" + ticketID);
            }

            function BindEvents() {

                $(document).ready(function() {
                    if ($("#CheckBox1").attr("checked") == "checked") {
                        $("#invoice_header").text("All Invoices");
                    } else {
                        $("#invoice_header").text("Outstanding Invoices");
                    }
                });
            }

            BindEvents();
        </script>
    </head>
    <body>
        <ucHeader:truxHeader id="Hdr1" runat="server"></ucHeader:truxHeader>
    
        <div id="main_area">
            <div id="work_area">

                <form id="form1" runat="server" autocomplete="off">
                    <h1>My Tickets</h1>
                    <p><span id="Span19"><asp:Label ID="lblDesc" runat="server"></asp:Label><a href="_help/my_tickets.aspx" target="_blank"><img alt="help" style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" /></a>                    

                       </span></p>
                    <%--Aging Backet--%>

                    <asp:ScriptManager ID="ScriptManager1" runat="server" />
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <script type="text/javascript">
                                Sys.Application.add_load(BindEvents);
                            </script>
                            <div style="clear: both">
                                <asp:CheckBox ID="CheckBox1" runat="server" 
                                              oncheckedchanged="CheckBox1_CheckedChanged" AutoPostBack="true"  />
                                <p style="display: inline">Show All Tickets</p><asp:Label ID="lblInvoicePeriod" runat="server" Text="(* Months)"></asp:Label>
                            </div>
    
                            <%--Invoice List--%>


                            <asp:GridView ID="gvTicketList" runat="server" AutoGenerateColumns="False"  
                                          GridLines="None" CssClass="mGrid" 
                                          AllowSortng="True" ToolTip="Ticket List" DataKeyNames="ticketID" EnableModelValidation="True" OnDataBound="gvTicketList_DataBound">
                                <Columns>
                                    <asp:BoundField DataField="ticketID" HeaderText="Ticket ID" ReadOnly="True" SortExpression="ticketID" Visible="False" />
                                    <asp:BoundField DataField="ticketNumber" HeaderText="Ticket Number" >
                                                                               <HeaderStyle CssClass="money" />
                                        <ItemStyle cssClass="money" />
                                    </asp:BoundField>                
                                    <asp:BoundField DataField="facility" HeaderText="Facility" />
                                    <asp:BoundField DataField="ticketDate" HeaderText="Date" 
                                                    DataFormatString="{0:MM/dd/yyyy}" >
                                    </asp:BoundField>
                                    <asp:BoundField DataField="vehicle" HeaderText="Vehicle" >
                                    </asp:BoundField>
                                    <asp:BoundField DataField="materialSubtotal" HeaderText="Material Subtotal" 
                                                    DataFormatString="{0:c2}" >
                                        <HeaderStyle CssClass="money" />
                                        <ItemStyle cssClass="money" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="materialtaxtotal" DataFormatString="{0:c2}" 
                                                    HeaderText="Material Tax Total">
                                        <HeaderStyle CssClass="money" />
                                        <ItemStyle CssClass="money" HorizontalAlign="Right" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="miscSubtotal" HeaderText="Misc. Subtotal" 
                                                    DataFormatString="{0:c2}" >
                                        <HeaderStyle CssClass="money" />
                                        <ItemStyle cssClass="money" />
                                    </asp:BoundField >  
                                    <asp:BoundField DataField="miscTaxtotal" DataFormatString="{0:c2}" HeaderText="Misc. Tax Total" >
                                        <HeaderStyle CssClass="money" />
                                    <ItemStyle cssClass="money" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="ticketTotal" DataFormatString="{0:c2}" HeaderText="Ticket Total" >
                                        <HeaderStyle CssClass="money" />
                                    <ItemStyle cssClass="money" />
                                    </asp:BoundField>    
                                    <asp:TemplateField>
                                         <ItemTemplate>
                                             <asp:Image ID="Image1" width="16px" class="pdf" src="_images/pdf.png"  runat="server"/>
                                         </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:Button ID="Download" runat="server" Visible='<%# Eval("hasAttachments") %>' CssClass="gridButton pdf" Text="See Ticket Attachment(s)" UseSubmitBehavior="False" OnClientClick='<%# @"window.open(""Handlers/TicketAttachments.ashx?ticketId=" + Eval("ticketID") + @"&ticketNumber=" + Eval("ticketNumber") + @"&disposalFacility=" + Eval("facility") + @""");return false" %>' CausesValidation="False" />
                                        </ItemTemplate>
                                        <ItemStyle CssClass="gridButtonColumn" />
                                    </asp:TemplateField>                                  
                                </Columns>
                                <headerstyle CssClass="col_headers"></headerstyle> 
                                <AlternatingRowStyle CssClass="alt_row" />
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>

                   
                </form>
            </div><!-- close work_area -->
        </div><!-- close main_area -->

  
        <ucfooter:truxfooter id="Ftr1" runat="server"></ucfooter:truxfooter> 
 
    
    </body>
</html>