imprimir reporte de dispositivos

This commit is contained in:
Antonio Gonzalez
2020-05-09 13:52:09 -07:00
parent fe43ffb0f0
commit 293b637246
3 changed files with 1035 additions and 12 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -291,6 +291,17 @@
</Triggers> </Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UpReporteGpsExcel" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkReporteExcel" Visible="False" OnClick="GenerarReporteExcel" data-toggle="tooltip" data-placement="left" runat="server" Text="<i class='fa fa-file-excel-o'></i> Dispositivos GPS"></asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkReporteExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
<asp:Literal ID="LtlTitulo" runat="server" Text="Registro de Clientes"></asp:Literal>&nbsp;<asp:Literal ID="LtlCliente" runat="server"></asp:Literal> <asp:Literal ID="LtlTitulo" runat="server" Text="Registro de Clientes"></asp:Literal>&nbsp;<asp:Literal ID="LtlCliente" runat="server"></asp:Literal>

View File

@@ -677,6 +677,7 @@ Partial Class Clientes
TabOtros.Visible = False TabOtros.Visible = False
TabCuentasEquipos.Visible = True TabCuentasEquipos.Visible = True
ReporteDispositivos.Visible = True ReporteDispositivos.Visible = True
LnkReporteExcel.Visible = True
TabCuentasEquipos.HeaderText = "Equipos GPS" TabCuentasEquipos.HeaderText = "Equipos GPS"
TabRH.Visible = False TabRH.Visible = False
TabUsuarios.Visible = True TabUsuarios.Visible = True
@@ -3733,22 +3734,33 @@ Partial Class Clientes
End Sub End Sub
Protected Sub GenerarReporte(sender As Object, e As EventArgs) Protected Sub GenerarReporte(sender As Object, e As EventArgs)
GenerarRepCrystal() GenerarRepCrystal("PDF")
End Sub End Sub
Private Sub GenerarRepCrystal()
Dim Archivo As New FileInfo(Server.MapPath("~/Empresas/Grales/Formatos/EquiposGPS.rpt")) Protected Sub GenerarReporteExcel(sender As Object, e As EventArgs)
Dim lista = New List(Of CrystalParametro) GenerarRepCrystal("Excel")
lista.Add(New CrystalParametro("NombreEmpresa", UsuarioActual.Empresa.Empresa)) End Sub
lista.Add(New CrystalParametro("NombreUsuario", UsuarioActual.Nombre))
Private Sub GenerarRepCrystal(Formato As String)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim params As New List(Of ReportParameter)
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("NombreUsuario", UsuarioActual.Usuario))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
Dim ObjGPS As New ClsGPS Dim ObjGPS As New ClsGPS
Dim tablaReporte As DataTable Dim tablaReporte As DataTable
If ObjGPS.DispositivosGet(-1, Estatus, CveCliente) Then If ObjGPS.DispositivosGet(-1, DdlEstatusDispositivos.SelectedValue.ToEntero(), CveCliente) Then
tablaReporte = ObjGPS.DtResultados tablaReporte = ObjGPS.DtResultados
Dim VistaFiltro As DataView = New DataView(tablaReporte)
Dim reporteDatos As DataTable = VistaFiltro.ToTable("Selected", False, "TipoDispositivoDisplay", "Display", "Modelo", "Serie", "IMEI", "NumeroTelefono", "FechaIng") ImprimirPDF("Empresas/Grales/Formatos/EquiposGPS.rdlc", tablaReporte, params, "Equipo GPS", Formato)
Dim file As Byte() = ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/EquiposGPS.rpt"), reporteDatos, lista)
ImprimirbytesPDF(file)
Else Else
Alert("No hay lista de dispositivos para imprimir") Alert("No hay lista de dispositivos para imprimir")
End If End If