116 lines
4.4 KiB
VB.net
116 lines
4.4 KiB
VB.net
Imports Extensiones
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class AF_RepPlacas
|
|
Inherits ClsPaginas
|
|
|
|
Private Property DTDatos As DataTable
|
|
Get
|
|
|
|
If ViewState("DTDatos") Is Nothing Then
|
|
Return New DataTable
|
|
Else
|
|
Return DirectCast(ViewState("DTDatos"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTDatos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
txtFechaEI.Text = Now.FirstDayOfMonth.ToShortDateString
|
|
txtFechaEF.Text = Now.LastDayOfMonth.ToShortDateString
|
|
txtFechaVI.Text = Now.FirstDayOfMonth.ToShortDateString
|
|
txtFechaVF.Text = Now.LastDayOfMonth.ToShortDateString
|
|
CargaDispositivos()
|
|
CargaPlacas()
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjAF As New ClsAF
|
|
If ObjAF.GetRepPlacas(DdlPlaca.SelectedValue.ToEntero, -1, -1, txtFechaEI.Text.ToDateTime, txtFechaEF.Text.ToDateTime, txtFechaVI.Text.ToDateTime, txtFechaVF.Text.ToDateTime, DdlDispositivo.SelectedValue.ToEntero, UsuarioActual.CveCliente) Then
|
|
GvDatos.DataSource = ObjAF.DtResultados
|
|
GvDatos.DataBind()
|
|
DTDatos = ObjAF.DtResultados
|
|
End If
|
|
ObjAF.Dispose()
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
#Region "C O M B O S"
|
|
|
|
|
|
Private Sub CargaDispositivos()
|
|
Dim GPS As New ClsGPS
|
|
|
|
If GPS.DispositivosGet(-1, -1, UsuarioActual.CveCliente) AndAlso GPS.DtResultados.Rows.Count > 0 Then
|
|
DdlDispositivo.DataSource = GPS.DtResultados
|
|
End If
|
|
GPS.Dispose()
|
|
DdlDispositivo.DataBind()
|
|
DdlDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End Sub
|
|
|
|
Private Sub CargaPlacas()
|
|
Dim ObjAF As New ClsAF
|
|
If ObjAF.GetPlacas(-1, -1, UsuarioActual.CveEmpresa) Then
|
|
DdlPlaca.DataSource = ObjAF.DtResultados
|
|
DdlPlaca.DataBind()
|
|
DdlPlaca.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todos", "-1"))
|
|
End If
|
|
ObjAF.Dispose()
|
|
End Sub
|
|
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "I M P R I M I R P D F/Excel"
|
|
|
|
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
GenerarPDF("Excel")
|
|
End Sub
|
|
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
|
GenerarPDF()
|
|
End Sub
|
|
|
|
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
|
If DTDatos.Rows.Count > 0 Then
|
|
Dim params As New List(Of ReportParameter)
|
|
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 StrFiltro As New StringBuilder
|
|
If DdlDispositivo.SelectedValue <> "-1" Then StrFiltro.AppendFormat("<b>Vehiculo</b>: {0}", DdlDispositivo.SelectedItem.Text)
|
|
If DdlPlaca.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Placa</b>: {0}", DdlPlaca.SelectedItem.Text)
|
|
StrFiltro.AppendFormat($"<b>Filtros: </b> Fecha Expedicion: {txtFechaEI.Text} y {txtFechaEF.Text} Fecha Vencimiento: {txtFechaVI.Text} y {txtFechaVF.Text}")
|
|
|
|
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
|
|
|
If Imagen.Exists Then
|
|
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
ImprimirPDF("Empresas\Grales\Formatos\RepPlacas.rdlc", DTDatos, params, "ReportePlacas", Formato:=Formato)
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
End Class
|