From f7fa1a010c6d976e72d6ea04cc56484d3e1d0590 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 27 Jul 2021 16:28:58 -0700 Subject: [PATCH] Exportar reporte a Excel --- GPS/RepIgnicion.aspx | 259 +++++++++++++++++++++------------------- GPS/RepIgnicion.aspx.cs | 17 ++- 2 files changed, 147 insertions(+), 129 deletions(-) diff --git a/GPS/RepIgnicion.aspx b/GPS/RepIgnicion.aspx index 39b17bfa0..ef1abbef3 100644 --- a/GPS/RepIgnicion.aspx +++ b/GPS/RepIgnicion.aspx @@ -1,126 +1,139 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIgnicion.aspx.cs" Inherits="GPS_RepIgnicion" %> - - - - - - - Reporte de Ignición - - - - -
  • - - - Imprimir PDF - - - - - -
  • -
    - - - - - -
    -
    -
    - -
    -
    -
      +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIgnicion.aspx.cs" Inherits="GPS_RepIgnicion" %> + + + + + + + Reporte de Ignición + + + + +
    • + + + Imprimir PDF + + + + + +
    • +
    • + + + Imprimir EXCEL + + + + + +
    • +
      + + + + + +
      +
      +
      + +
      +
      +
      • Vehículo: - - - - - -
      • + + + + + + +
      • Fecha Inicio: -
        - - - -
        -
      • + +
        + + + +
        +
      • Fecha Fin: -
        - - - -
        -
      • -
      -
      -
      -
      -
      -
      - - -
      -
      -
      - - Igniciones -
      -
      -
      -
      -
      -
      - -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      - - - + +
      + + + +
      + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + Igniciones +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    + + + diff --git a/GPS/RepIgnicion.aspx.cs b/GPS/RepIgnicion.aspx.cs index d22b84c96..080c37105 100644 --- a/GPS/RepIgnicion.aspx.cs +++ b/GPS/RepIgnicion.aspx.cs @@ -58,7 +58,8 @@ public partial class GPS_RepIgnicion : ClsPaginas DtIgniciones = ObjGPS.DtResultados; GvIgnicion.DataSource = DtIgniciones; GvIgnicion.DataBind(); - LnkImprimirPDF.Visible = true; + LnkImprimirPDF.Visible = true; + LnkImprimirEXCEL.Visible = true; } } UpDatos.Update(); @@ -104,14 +105,18 @@ public partial class GPS_RepIgnicion : ClsPaginas protected void LnkImprimirPDF_Click(object sender, EventArgs e) { - EnviarReporteProgramado(); + EnviarReporteProgramado("PDF"); + } + protected void LnkImprimirEXCEL_Click(object sender, EventArgs e) + { + EnviarReporteProgramado("EXCEL"); } - public void EnviarReporteProgramado() + public void EnviarReporteProgramado(string Formato = "PDF") { if (DtIgniciones != null) { byte[] retorno; - string RutaReporte = "Empresas/Grales/ReportesProgramados/RPIgnicion.rdlc"; + string RutaReporte = ModExtensiones.DirectorioBaseEmpresas + "Empresas/Grales/ReportesProgramados/RPIgnicion.rdlc"; try { @@ -121,10 +126,10 @@ public partial class GPS_RepIgnicion : ClsPaginas RptParametro.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)); RptParametro.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy HH:mm tt"))); - retorno = StreamPDF(RutaReporte, DtIgniciones, RptParametro, "ReporteEventos", "PDF", "DsOC"); + retorno = StreamPDF(RutaReporte, DtIgniciones, RptParametro, "ReporteEventos", Formato, "DsOC"); // TODO: Labeled Arguments not supported. Argument: 6 := 'MR' // TODO: Labeled Arguments not supported. Argument: 7 := 'RDSName' - ImprimirbytesPDF(retorno, "ReporteEventos"); + ImprimirbytesPDF(retorno, "ReporteEventos", Formato: Formato); } catch (Exception ex) {