Filtro y correciones en reporte de georeferencias
This commit is contained in:
@@ -84,16 +84,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GVGeoreferencias" runat="server" GridLines="None" data-height="200" DataKeyNames="Coordenadas,CveGeoReferencia,GeoReferencia, CveDispositivo,Tipo,Color,Estatus,FechaInicio,FechaFin,AplicaLunes,AplicaMartes,AplicaMiercoles,AplicaJueves,AplicaViernes,AplicaSabado,AplicaDomingo, HoraInicio, HoraFin, Tolerancia" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
||||
<asp:GridView ID="GVGeoreferencias" runat="server" PageSize="300" GridLines="None" data-height="200" DataKeyNames="Coordenadas,CveGeoReferencia,GeoReferencia, CveDispositivo,Tipo,Color,Estatus,FechaInicio,FechaFin,AplicaLunes,AplicaMartes,AplicaMiercoles,AplicaJueves,AplicaViernes,AplicaSabado,AplicaDomingo, HoraInicio, HoraFin, Tolerancia" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
||||
<Columns>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="5%">
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox runat="server" ID="chkGR" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="Tipo" ItemStyle-Width="20%" HeaderText="Tipo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="GeoReferencia" ItemStyle-Width="20%" HeaderText="GeoReferencia" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField HeaderText="Color" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center">
|
||||
<asp:BoundField DataField="Tipo" ItemStyle-Width="10%" HeaderText="Tipo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="GeoReferencia" ItemStyle-Width="50%" HeaderText="GeoReferencia" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField HeaderText="Color" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgColor" HeaderText="Color" runat="server" Style="height: 20px;" Enabled="false" CausesValidation="False" CssClass="btn btn-circle btn-sm green" />
|
||||
</ItemTemplate>
|
||||
@@ -115,6 +115,16 @@
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<div id="DivPaginacion" runat="server" visible="false" class="row">
|
||||
<div class="col-md-8">
|
||||
<asp:Label ID="LblRegistros" runat="server" Style="display: inline-block;"></asp:Label>
|
||||
</div>
|
||||
<div class="col-md-4" style="display: inline-block; position: relative; text-align:end">
|
||||
<asp:HiddenField ID="HdnIndexPage" runat="server" ClientIDMode="Static" Value="0" />
|
||||
<asp:LinkButton ID="btnPagePrev" runat="server" Style="vertical-align: top;" Text="<i class='fa fa-angle-left' style='font-size:24px' aria-hidden='true'></i> Anterior" OnClick="btnPagePrev_Click" Enabled="false" />
|
||||
<asp:LinkButton ID="btnPageNext" runat="server" Style="vertical-align: top;" Text="Siguiente <i class='fa fa-angle-right' aria-hidden='true' style='font-size:24px'></i>" OnClick="btnPageNext_Click" />
|
||||
</div>
|
||||
</div>
|
||||
<asp:UpdatePanel runat="server" ID="UpUp" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="form-group form-md-line-input input-iconright v-center">
|
||||
@@ -190,6 +200,7 @@
|
||||
</div>
|
||||
<ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px;">
|
||||
<li>Fecha I.:
|
||||
|
||||
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
|
||||
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
@@ -202,6 +213,7 @@
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</li>
|
||||
<li>Fecha F.:
|
||||
|
||||
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
|
||||
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
|
||||
@@ -13,6 +13,14 @@ Partial Class GPS_RepGeoReferencias
|
||||
ViewState("CveGeoReferencia") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtGeoReferencias As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtGeoReferencias"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtGeoReferencias") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtPosiciones As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtPosiciones"), DataTable)
|
||||
@@ -49,13 +57,27 @@ Partial Class GPS_RepGeoReferencias
|
||||
|
||||
Private Sub CargaGeoReferencias()
|
||||
Dim Estatus = If(ChkEstatusGeocerca.Checked, 1, 0)
|
||||
Dim GPS As New ClsGPS
|
||||
|
||||
Using GPS As New ClsGPS
|
||||
If GPS.GeoReferenciaGet(-1, Estatus, "-1", UsuarioActual.CveCliente) Then
|
||||
GVGeoreferencias.DataSource = GPS.DtResultados
|
||||
Else
|
||||
GVGeoreferencias.DataSource = Nothing
|
||||
DtGeoReferencias = GPS.DtResultados.Copy()
|
||||
End If
|
||||
GPS.Dispose()
|
||||
End Using
|
||||
|
||||
If DtGeoReferencias IsNot Nothing Then
|
||||
Dim TotalRegistros As Integer = DtGeoReferencias.Rows.Count
|
||||
Dim TotalRowsPage As Integer = GVGeoreferencias.PageSize
|
||||
If TotalRegistros > TotalRowsPage Then
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias.FiltraPorIndices(0, TotalRowsPage - 1)
|
||||
DivPaginacion.Visible = True
|
||||
LblRegistros.Text = $"Distribución de datos desde 0 hasta {TotalRowsPage.ToString().ToDecimal().FormatoNumero(0)}. Total de registros: {TotalRegistros.ToString().ToDecimal().FormatoNumero(0)}"
|
||||
Else
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias
|
||||
End If
|
||||
Else
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias
|
||||
End If
|
||||
|
||||
GVGeoreferencias.DataBind()
|
||||
End Sub
|
||||
Private Sub CargaDispositivos()
|
||||
@@ -191,15 +213,10 @@ Partial Class GPS_RepGeoReferencias
|
||||
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetReferenciaDetalle(-1, CveGeoReferencia, -1, UsuarioActual.CveCliente) Then
|
||||
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
DtDetalle = ObjGPS.DtResultados
|
||||
GvEquiposDetalle.DataSource = DtDetalle
|
||||
Else
|
||||
DtDetalle = Nothing
|
||||
DtDetalleEliminar = Nothing
|
||||
GvEquiposDetalle.DataSource = Nothing
|
||||
End If
|
||||
DtDetalle = ObjGPS.DtResultados.Copy()
|
||||
DtDetalleEliminar = ObjGPS.DtResultados.Copy()
|
||||
|
||||
GvEquiposDetalle.DataSource = DtDetalle
|
||||
End If
|
||||
End Using
|
||||
GvEquiposDetalle.DataBind()
|
||||
@@ -240,26 +257,21 @@ Partial Class GPS_RepGeoReferencias
|
||||
|
||||
If ObjGPS.GeoReferenciaUpdate(CveGeoReferencia, TxtNombre.Text, -1, chkEstatus.Checked, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, chkLunes.Checked, chkMartes.Checked, chkMiercoles.Checked, chkJueves.Checked, chkViernes.Checked,
|
||||
chkSabado.Checked, chkDomingo.Checked, HoraI, HoraF, TxtTolerancia.Text.ToEntero, UsuarioActual.CveCliente) Then
|
||||
If Not TieneError Then
|
||||
For Each DrE As DataRow In DtDetalleEliminar.Rows
|
||||
If DrE("CveDispositivoGeoreferenciaDetalle").ToString.ToEntero > 0 Then
|
||||
TieneError = Not ObjGPS.RemoveferenciaDetalle(DrE("CveDispositivoGeoreferenciaDetalle").ToString.ToEntero)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In DtDetalle.Rows
|
||||
Dim CveGeoReferenciaDetalle = Dr("CveDispositivoGeoreferenciaDetalle").ToString.ToEntero
|
||||
If CveGeoReferenciaDetalle > 0 Then
|
||||
If Not ObjGPS.UpdateReferenciaDetalle(CveGeoReferenciaDetalle, CveGeoReferencia, Dr("CveDispositivo").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
If Not ObjGPS.AddGeoReferenciaDetalle(CveGeoReferencia, Dr("CveDispositivo").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If Not TieneError Then
|
||||
For Each DrE As DataRow In DtDetalleEliminar.Rows
|
||||
TieneError = Not ObjGPS.RemoveferenciaDetalle(DrE("CveDispositivoGeoreferenciaDetalle").ToString.ToEntero)
|
||||
Next
|
||||
End If
|
||||
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
@@ -336,13 +348,14 @@ Partial Class GPS_RepGeoReferencias
|
||||
Dim Dr As DataRow = DtDetalle.Rows(e.RowIndex)
|
||||
Dim CveGeoReferenciaDetalle = Dr("CveDispositivoGeoreferenciaDetalle").ToString.ToEntero
|
||||
If CveGeoReferenciaDetalle > 0 Then
|
||||
|
||||
If DtDetalleEliminar.COUNT("CveDispositivo", $"CveDispositivoGeoreferenciaDetalle={CveGeoReferenciaDetalle}") <= 0 Then
|
||||
Dim DrEliminar = DtDetalleEliminar.NewRow
|
||||
DrEliminar("CveDispositivoGeoreferenciaDetalle") = CveGeoReferenciaDetalle
|
||||
DrEliminar("CveDispositivo") = Dr("CveDispositivo").ToString.ToEntero
|
||||
DrEliminar("NoEconomico") = Dr("NoEconomico").ToString
|
||||
DtDetalleEliminar.Rows.Add(DrEliminar)
|
||||
DtDetalleEliminar.AcceptChanges()
|
||||
End If
|
||||
|
||||
End If
|
||||
DtDetalle.Rows.RemoveAt(e.RowIndex)
|
||||
@@ -416,4 +429,62 @@ Partial Class GPS_RepGeoReferencias
|
||||
Protected Sub ChkEstatusGeocerca_CheckedChanged(sender As Object, e As EventArgs)
|
||||
CargaGeoReferencias()
|
||||
End Sub
|
||||
|
||||
Protected Sub btnPagePrev_Click(sender As Object, e As EventArgs)
|
||||
Dim TotalRegistros As Integer = DtGeoReferencias.Rows.Count
|
||||
Dim TotalRowsPage As Integer = GVGeoreferencias.PageSize
|
||||
Dim PrevIndex As Integer = HdnIndexPage.Value.ToEntero - 1
|
||||
Dim CurrentIndex As Integer = PrevIndex + 1
|
||||
|
||||
Dim PrevIndexDT As Integer = (TotalRowsPage) * PrevIndex
|
||||
Dim CurrentIndexDT As Integer = (TotalRowsPage) * CurrentIndex
|
||||
|
||||
HdnIndexPage.Value = PrevIndex.ToString
|
||||
|
||||
If Not btnPageNext.Enabled Then
|
||||
btnPageNext.Enabled = True
|
||||
End If
|
||||
|
||||
If PrevIndexDT <= 0 Then
|
||||
btnPagePrev.Enabled = False
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias.FiltraPorIndices(0, CurrentIndexDT)
|
||||
LblRegistros.Text = $"Distribución de datos desde 0 hasta {CurrentIndexDT.ToString.FormatoNumero(0)}. Total de registros: {DtGeoReferencias.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
Else
|
||||
LblRegistros.Text = $"Distribución de datos desde {PrevIndexDT.ToString.FormatoNumero(0)} hasta {CurrentIndexDT.ToString.FormatoNumero(0)}. Total de registros: {DtGeoReferencias.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias.FiltraPorIndices(PrevIndexDT, CurrentIndexDT)
|
||||
End If
|
||||
|
||||
GVGeoreferencias.DataBind()
|
||||
UPGV.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub btnPageNext_Click(sender As Object, e As EventArgs)
|
||||
Dim TotalRegistros As Integer = DtGeoReferencias.Rows.Count
|
||||
Dim TotalRowsPage As Integer = GVGeoreferencias.PageSize
|
||||
Dim Index As Integer = HdnIndexPage.Value.ToEntero + 1
|
||||
Dim NextIndex As Integer = Index + 1
|
||||
|
||||
Dim CurrentIndexDT As Integer = (TotalRowsPage) * Index
|
||||
Dim NextIndexDT As Integer = (TotalRowsPage) * NextIndex
|
||||
|
||||
HdnIndexPage.Value = Index.ToString
|
||||
|
||||
If Not btnPagePrev.Enabled Then
|
||||
btnPagePrev.Enabled = True
|
||||
End If
|
||||
|
||||
If NextIndexDT >= TotalRegistros Then
|
||||
btnPageNext.Enabled = False
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias.FiltraPorIndices(CurrentIndexDT, TotalRegistros - 1)
|
||||
LblRegistros.Text = $"Distribución de datos desde {CurrentIndexDT.ToString.FormatoNumero(0)} hasta {DtGeoReferencias.Rows.Count.ToString.FormatoNumero(0)}. Total de registros: {DtGeoReferencias.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
Else
|
||||
GVGeoreferencias.DataSource = DtGeoReferencias.FiltraPorIndices(CurrentIndexDT, NextIndexDT)
|
||||
LblRegistros.Text = $"Distribución de datos desde {CurrentIndexDT.ToString.FormatoNumero(0)} hasta {NextIndexDT.ToString.FormatoNumero(0)}. Total de registros: {DtGeoReferencias.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
End If
|
||||
|
||||
GVGeoreferencias.DataBind()
|
||||
UPGV.Update()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user