<% @Import Namespace="Seven.Front" %>
<% @Import Namespace="Seven.Front.Globals" %>
<% @Import Namespace="Seven.Front.Objects" %>
<%@ Page Language="C#" MasterPageFile="Model.Master" AutoEventWireup="true" CodeBehind="DebugImpresoras.aspx.cs" Inherits="Seven.Front.DebugImpresoras" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cpHeader" runat="server">

    <% try{ %>

    <title><%=L.TIT("DebugImpresoras") %></title>
    
    <script type="text/javascript">

        function ImprimirListado() {
            window.open("Informe.aspx?r=7000000", "_blank")
        }
        
    </script>
    
    <script type="text/javascript">

        $(document).ready(function () {

            $("#dlgEliminar").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 167,
                width: 500,
                modal: true
            });

            $("#dlgInformation").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 167,
                width: 500,
                modal: true
            });

            $("#SevenMenu").accordion("option", "active", 0);

            $('btnEliminar').attr('disabled', true);
            $('btnGuardar').attr('disabled', true);
            $('btnCancelar').attr('disabled', true);

        });
    </script>

    <% } catch { } %>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="cpPrincipal" runat="server">

    <% try{ %>

    <div id="SevenBreadcrumb" class="ui-state-default">
        <table style="width: 100%; white-space: nowrap;">
            <tr>
                <td>
                    <a href="Inicio.aspx"><%=L.LBL("LblGENInicio") %></a>
                    <img src="img/arrow.png" alt="" />
                    <a href="DebugImpresoras.aspx"><%=L.TIT("DebugImpresoras") %></a>
                </td>
                <td style="width: 100%;"></td>
                <td>
                    <%=L.LBL("LblGENLanguage") %>
                </td>
                <td>
                    <!-- #include file="LanguageCombo.html" -->
                </td>
            </tr>
        </table>
    </div>
            
    <div id="SevenPrincipal">
                
        <div id="SevenMedio">
                    
            <div id="SevenInterno" style="width: 700px;">

                <div id="dlgEliminar" title="<%=L.LBL("LblGENDelete") %>" style="text-align: center;padding-top: 25px">
                    <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>¿Desea eliminar este elemento?
                </div>

                <div id="dlgInformation" title="<%=L.LBL("LblGENInformation") %>" style="text-align: center;padding-top: 25px">
                    
                </div>

                <table>
                    <tr>
                        <td>
                            <span class="SevenTitulo"><%=L.TIT("DebugImpresoras") %></span>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                        <td>
                            <div class="SevenEnlaces">
                                <table>
                                    <tr>
                                        <td>
                                            <a href="#" onclick="ImprimirListado();" id="A2" ><img src="img/printer.png" /> <%=L.LBL("LblGENPrint") %></a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>

                <% 
                    if (CorrectoIns)
                    {    
                %>

                    <p class="SevenMsgExito"><%=L.LBL("LblGENMSG_SavedData") %></p>

                <%  } %>

                <% 
                    if (CorrectoMod)
                    {    
                %>

                    <p class="SevenMsgExito"><%=L.LBL("LblGENMSG_UpdatedData") %></p>

                <%  } %>

                <% 
                    if (CorrectoEli)
                    {    
                %>

                    <p class="SevenMsgExito"><%=L.LBL("LblGENMSG_DeletedData") %></p>

                <%  } %>

                <% 
                    if (!String.IsNullOrEmpty(ErrorMsg))
                    {    
                %>

                    <p class="SevenMsgError"><%=ErrorMsg %></p>

                <%  } %>

                <br />
                            
                <%
                    System.Drawing.Printing.PrintDocument printDoc = new System.Drawing.Printing.PrintDocument();

                    foreach (string impresora in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
                    {
                        Response.Write("<h2>" + impresora + "</h2>");

                        Response.Write("<table style=\"width: 100%;\"><tr>" + 
                            "<th class=\"ui-state-default\">Paper Name</th>" + 
                            "<th class=\"ui-state-default\">Kind</th>" + 
                            "<th class=\"ui-state-default\">Raw Kind</th>" + 
                            "<th class=\"ui-state-default\">Width</th>" + 
                            "<th class=\"ui-state-default\">Height</th></tr>");

                        printDoc.PrinterSettings.PrinterName = impresora;
                        printDoc.DefaultPageSettings.Landscape = false;

                        IEnumerable<System.Drawing.Printing.PaperSize> paperSizes = printDoc.PrinterSettings.PaperSizes.Cast<System.Drawing.Printing.PaperSize>();

                        foreach(System.Drawing.Printing.PaperSize size in paperSizes)
                        {
                            Response.Write("<tr><td class=\"ui-widget-content\">" + size.PaperName + "</td>" + 
                                "<td class=\"ui-widget-content\">" + size.RawKind + "</td>" + 
                                "<td class=\"ui-widget-content\">" + size.Kind + "</td>" + 
                                "<td class=\"ui-widget-content\">" + size.Width +"</td>" + 
                                "<td class=\"ui-widget-content\">" + size.Height + "</td></tr>");
                        }

                        Response.Write("</table>");
                    }

                %>
                            
            </div>
                    
        </div>
                
    </div>

    <% } catch { } %>

</asp:Content>

