Commit inicial Ventas Productivo
This commit is contained in:
156
GPS/RepPuntosDeInteres.aspx.vb
Normal file
156
GPS/RepPuntosDeInteres.aspx.vb
Normal file
@@ -0,0 +1,156 @@
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Partial Class GPS_RepPuntosDeInteres
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "P R O P I E D A D E S "
|
||||
Private Property DispositivosLista As List(Of String)
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DispositivosLista")), Nothing, CType(ViewState("DispositivosLista"), List(Of String)))
|
||||
End Get
|
||||
Set(value As List(Of String))
|
||||
ViewState("DispositivosLista") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
CargaDispositivos()
|
||||
Dim gps As New ClsGPS
|
||||
'If gps.PuntoDeInteresGrupoGet(-1, 1) Then
|
||||
' GvGrupos.DataSource = gps.DtResultados
|
||||
'Else
|
||||
' GvGrupos.DataSource = Nothing
|
||||
'End If
|
||||
If gps.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
|
||||
GvPuntos.DataSource = gps.DtResultados
|
||||
Else
|
||||
GvPuntos.DataSource = Nothing
|
||||
End If
|
||||
gps.Dispose()
|
||||
'GvGrupos.DataBind()
|
||||
GvPuntos.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDispositivos()
|
||||
GvDispositivos.DataSource = GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario).FiltraParametros("Estatus = 1 ")
|
||||
GvDispositivos.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
Dim sb As New StringBuilder
|
||||
DispositivosLista = New List(Of String)
|
||||
RegistraScript("DeleteMarkers();", "0")
|
||||
For Each row As GridViewRow In GvDispositivos.Rows
|
||||
If row.FCCheckBox("chkDis").Checked Then
|
||||
sb.Append($"{row.DataKey("CveDispositivo").ToString},")
|
||||
DispositivosLista.Add(row.DataKey("CveDispositivo").ToString)
|
||||
End If
|
||||
Next
|
||||
ReportePuntos(sb.ToString)
|
||||
RegistraScript("$('#dvConsulta').modal('hide');", "00")
|
||||
End Sub
|
||||
|
||||
Private Sub ReportePuntos(Dispositivos As String)
|
||||
Dim GPS As New ClsGPS
|
||||
Dim FechaI, FechaF As Date
|
||||
Dim SBBody As New StringBuilder
|
||||
Dim CoordsPoligono = ""
|
||||
Dim Coords = ""
|
||||
Dim Titulo = ""
|
||||
Dim Info = ""
|
||||
Dim COUNT = 0
|
||||
Dim GeoCercas = ""
|
||||
Dim Color = ""
|
||||
FechaI = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDate)
|
||||
FechaF = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.Trim.ToDate)
|
||||
For Each row As GridViewRow In GvPuntos.Rows
|
||||
SBBody.Clear()
|
||||
If row.FCCheckBox("chkGR").Checked Then
|
||||
If GPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
|
||||
Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT")
|
||||
SBBody.Append($"<div>")
|
||||
SBBody.Append($"<div><h5><b> Punto: {row.DataKey("PuntoDeInteres")}</b></h5></div>")
|
||||
|
||||
If GPS.DtResultados.Rows.Count > 0 Then
|
||||
Color = "#26C281"
|
||||
SBBody.Append($"<div><table>")
|
||||
For Each Cve As String In DispositivosLista
|
||||
If GPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then
|
||||
SBBody.Append($"<tr><td><b>{GPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}:</b> <a onclick=""CargaGV({Cve}, {row.DataKey("CvePuntoDeInteres")} )"">{GPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas<a></td></tr>")
|
||||
SBBody.Append($"<tr><td>Última Visita: {GPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}</td></tr>")
|
||||
End If
|
||||
Next
|
||||
SBBody.Append($"</table></div>")
|
||||
Else
|
||||
Color = "#e82929"
|
||||
SBBody.Append($"<tr><td><b>Este punto de interés no fue visitado en las fechas seleccionadas.</b></td></tr>")
|
||||
End If
|
||||
SBBody.Append($"</div>")
|
||||
RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres"))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
GPS.Dispose()
|
||||
End Sub
|
||||
|
||||
'If GPS.GeoReferenciasEntradasSalidas(GVRow.DataKey("CveDispositivo").ToString.ToEntero, row.DataKey("CveGeoReferencia").ToString.ToEntero, FechaI, FechaF) Then
|
||||
' SBBody.Append($"<div><table>")
|
||||
' SBBody.Append($"<tr><td>Fecha : {rr("FechaTrama").ToString}</td></tr>")
|
||||
' SBBody.Append($"<tr><td>Conductor : {rr("Conductor").ToString}</td></tr>")
|
||||
' SBBody.Append($"<tr><td>Serie Vehículo: {GVRow.DataKey("SerieVehiculo").ToString}</td></tr>")
|
||||
' If GPS.DtResultados.Rows.Count > 0 Then
|
||||
' CoordsPoligono = SQLToGmaps(row.DataKey("Coordenadas").ToString, "POLYGON")
|
||||
' For Each rr As DataRow In GPS.DtResultados.Rows
|
||||
' Coords = SQLToGmaps(rr("Posicion").ToString, "POINT")
|
||||
' SBBody.Clear()
|
||||
' SBBody.Append($"<div>")
|
||||
' SBBody.Append($"<div><h4><b>{rr("Evento")}</b></h4></div>")
|
||||
' SBBody.Append($"</table></div><div></div></div>")
|
||||
' Info = SBBody.ToString
|
||||
' RegistraScript($"CreaMarcador({Coords},'{GVRow.DataKey("SerieVehiculo").ToString}', '{Info}');", $"{rr("CveDispositivoEvento").ToString}{COUNT.ToString}")
|
||||
' COUNT += 1
|
||||
' Next
|
||||
' RegistraScript($"creaPoligono([{CoordsPoligono}], '{row.DataKey("Color").ToString}')", $"{row.DataKey("CveGeoReferencia").ToString.ToEntero}{COUNT.ToString}")
|
||||
' Else
|
||||
' GeoCercas = $"{GeoCercas} {row.DataKey("GeoReferencia").ToString},"
|
||||
' End If
|
||||
' End If
|
||||
|
||||
Private Function SQLToGmaps(CoordsSQL As String, Tipo As String) As String
|
||||
Dim CoordsPoligono As String = CoordsSQL.Replace($"{Tipo}", "").Replace(")", "").Replace("(", "")
|
||||
Dim CoordsPuntos() As String = CoordsPoligono.Split(","c)
|
||||
Dim Var As String = ""
|
||||
For Each coordenada As String In CoordsPuntos
|
||||
If coordenada Is CoordsPuntos.Last Then
|
||||
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
||||
Var = $"{Var}{{lat: {latlng(1)}, lng: {latlng(0)} }}"
|
||||
Else
|
||||
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
||||
Var = $"{Var}{{lat: {latlng(1)}, lng: {latlng(0)} }},"
|
||||
End If
|
||||
Next
|
||||
Return Var
|
||||
End Function
|
||||
|
||||
|
||||
Protected Sub BtnCargarGV_Click(sender As Object, e As EventArgs) Handles BtnCargarGV.Click
|
||||
Dim GPS As New ClsGPS
|
||||
If GPS.RepPuntosDetalleGet(HdnPunto.Value.ToEntero, HdnDispositivo.Value.ToEntero, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
|
||||
GVHistorico.DataSource = GPS.DtResultados.FiltraParametros("CveEvento = 106")
|
||||
Else
|
||||
GVHistorico.DataSource = Nothing
|
||||
End If
|
||||
GPS.Dispose()
|
||||
GVHistorico.DataBind()
|
||||
UpdatePanel3.Update()
|
||||
RegistraScript("$('#dvHistorico').modal()")
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user