Reporte de unidades
This commit is contained in:
97
GPS/RepUnidades.aspx.vb
Normal file
97
GPS/RepUnidades.aspx.vb
Normal file
@@ -0,0 +1,97 @@
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class GPS_RepUnidades
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
DdlEmpresa.DataSource = GlobalDTEmpresas().FiltraParametros("CvePlataforma = 3")
|
||||
DdlEmpresa.DataBind()
|
||||
DdlEmpresa.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
|
||||
DdlCliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
Else
|
||||
DdlEmpresa.DataSource = GlobalDTEmpresas().FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {UsuarioActual.CveEmpresa}")
|
||||
DdlEmpresa.DataBind()
|
||||
|
||||
CargaClientes()
|
||||
End If
|
||||
|
||||
UPFiltros.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Select Case e.Row.DBCampo("TipoFila")
|
||||
Case "1"
|
||||
e.Row.CssClass = "Totales"
|
||||
Case "2"
|
||||
e.Row.CssClass = "SubTotales"
|
||||
Case "3"
|
||||
If e.Row.DBCampo("CveEstatus") = "0" Then
|
||||
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-danger"
|
||||
Else
|
||||
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-success"
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim FechaI As DateTime = MinFecha, FechaF As DateTime = MaxFecha
|
||||
|
||||
If Not String.IsNullOrEmpty(txtFechaI.Text) Then
|
||||
FechaI = txtFechaI.Text.ToDateTime()
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrEmpty(txtFechaF.Text) Then
|
||||
FechaF = txtFechaF.Text.ToDateTime()
|
||||
End If
|
||||
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetRepUnidades(DdlEmpresa.SelectedValue.ToEntero(), DdlCliente.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF, CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then
|
||||
GvDatos.DataSource = ObjGPS.DtResultados
|
||||
|
||||
Dim DtUnidades As DataTable = ObjGPS.DtResultados.FiltraParametros("CveDispositivo > 0", DistinctColumns:={"CveDispositivo", "CveEstatus"})
|
||||
|
||||
LtlTotalUnidades.Text = DtUnidades.Rows.Count.ToString()
|
||||
LtlActivas.Text = DtUnidades.COUNT("CveDispositivo", "CveEstatus = 1").ToString()
|
||||
LtlInactivas.Text = DtUnidades.COUNT("CveDispositivo", "CveEstatus = 0").ToString()
|
||||
|
||||
End If
|
||||
End Using
|
||||
|
||||
GvDatos.DataBind()
|
||||
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlEmpresa_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaClientes()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaClientes()
|
||||
If DdlEmpresa.SelectedValue.ToEntero() > 0 Then
|
||||
DdlCliente.DataSource = GlobalDTCliente(DdlEmpresa.SelectedValue.ToEntero())
|
||||
Else
|
||||
DdlCliente.DataSource = Nothing
|
||||
End If
|
||||
DdlCliente.DataBind()
|
||||
DdlCliente.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user