GPS. Mejores reporte de punto de interes

This commit is contained in:
2021-04-30 10:42:36 -07:00
parent 32f8681ef9
commit a9909397c8
3 changed files with 545 additions and 285 deletions

View File

@@ -39,23 +39,22 @@ Partial Class GPS_PuntosDeInteres
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
Dim gps As New ClsGPS Dim ObjGPS As New ClsGPS
If gps.PuntoDeInteresGrupoGet(-1, 1) Then If ObjGPS.PuntoDeInteresGrupoGet(UsuarioActual.CveCliente, 1) Then
GvGrupos.DataSource = gps.DtResultados GvGrupos.DataSource = ObjGPS.DtResultados
Else
GvGrupos.DataSource = Nothing
End If End If
If gps.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GvPuntos.DataSource = gps.DtResultados If ObjGPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GVPuntosInteres.DataSource = gps.DtResultados GvPuntos.DataSource = ObjGPS.DtResultados
Else GVPuntosInteres.DataSource = ObjGPS.DtResultados
GvPuntos.DataSource = Nothing
GVPuntosInteres.DataSource = Nothing
End If End If
gps.Dispose()
ObjGPS.Dispose()
GvGrupos.DataBind() GvGrupos.DataBind()
GvPuntos.DataBind() GvPuntos.DataBind()
GVPuntosInteres.DataBind() GVPuntosInteres.DataBind()
UpEditar.Update() UpEditar.Update()
End Sub End Sub
@@ -65,7 +64,6 @@ Partial Class GPS_PuntosDeInteres
End If End If
End Sub End Sub
Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click
Dim GPS As New ClsGPS Dim GPS As New ClsGPS
GPS.IniciaTransacSQL() GPS.IniciaTransacSQL()
@@ -110,7 +108,7 @@ Partial Class GPS_PuntosDeInteres
Alert("Es necesario seleccionar un grupo de puntos", TipoMensaje.MsgAdvertencia) Alert("Es necesario seleccionar un grupo de puntos", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
If GPS.PuntoDeInteresGet(-1, -1, 1, HdnGrupo.Value.ToEntero) AndAlso GPS.DtResultados.Rows.Count > 0 Then If GPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, HdnGrupo.Value.ToEntero) AndAlso GPS.DtResultados.Rows.Count > 0 Then
Dim ruta As String = "" Dim ruta As String = ""
For Each row As DataRow In GPS.DtResultados.Rows For Each row As DataRow In GPS.DtResultados.Rows
ruta += row("Punto").ToString.Replace("POINT (", "").Replace(")", ",") ruta += row("Punto").ToString.Replace("POINT (", "").Replace(")", ",")

View File

@@ -1,46 +1,46 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="RepPuntosDeInteres.aspx.vb" Inherits="GPS_RepPuntosDeInteres" %> <%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="RepPuntosDeInteres.aspx.vb" Inherits="GPS_RepPuntosDeInteres" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<link href="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.css" rel="stylesheet" /> <link href="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.css" rel="stylesheet" />
<style> <style>
html, body { html, body {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#map { #map {
width: 100%; width: 100%;
height: calc(100% - 51px); height: calc(100% - 51px);
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#map { #map {
position: fixed !important; position: fixed !important;
} }
.pac-container.pac-logo { .pac-container.pac-logo {
z-index: 100000; z-index: 100000;
} }
#showdiv1 { #showdiv1 {
left: 0 !important; left: 0 !important;
width: 100% !important; width: 100% !important;
} }
#ShowDiv3:hover { #ShowDiv3:hover {
line-height: 34px !important; line-height: 34px !important;
-webkit-transition: line-height ease 1s; -webkit-transition: line-height ease 1s;
-moz-transition: line-height ease 1s; -moz-transition: line-height ease 1s;
-o-transition: line-height ease 1s; -o-transition: line-height ease 1s;
transition: line-height ease 1s; transition: line-height ease 1s;
} }
.ADScroller-body { .ADScroller-body {
max-height: 400px; max-height: 400px;
} }
@@ -53,7 +53,7 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
#iw-container .iw-title { #iw-container .iw-title {
font-family: 'Open Sans Condensed', sans-serif; font-family: 'Open Sans Condensed', sans-serif;
font-size: 22px; font-size: 22px;
font-weight: 400; font-weight: 400;
@@ -62,9 +62,9 @@
color: white; color: white;
margin: 0; margin: 0;
border-radius: 2px 2px 0 0; border-radius: 2px 2px 0 0;
} }
#iw-container .iw-content { #iw-container .iw-content {
font-size: 13px; font-size: 13px;
line-height: 18px; line-height: 18px;
font-weight: 400; font-weight: 400;
@@ -73,7 +73,7 @@
max-height: 140px; max-height: 140px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
} }
.iw-content img { .iw-content img {
float: right; float: right;
@@ -158,135 +158,160 @@
.form-horizontal .control-label { .form-horizontal .control-label {
text-align: left; text-align: left;
} }
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<div id="map"></div> <div id="map"></div>
<div id="dvConsulta" class="modal ADS fade" role="dialog"> <div id="dvConsulta" class="modal ADS fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<asp:UpdatePanel ID="UPConsulta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPConsulta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" id="H1" runat="server">Consultar Reporte de Puntos</h4> <h4 class="modal-title" id="H1" runat="server">Consultar Reporte de Puntos</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px; margin-bottom: 20px;"> <ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px; margin-bottom: 20px;">
<li>Fecha Inicio: <li>Fecha Inicio:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy hh:mm" >
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox> <div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy hh:mm">
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator> <asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator>
</div> <ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender>
</li> </div>
</li>
<li>Fecha Fin: <li>Fecha Fin:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox> <div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy">
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator> <asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator>
</div> <ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender>
</li> </div>
</ul> </li>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left"> </ul>
<div style="margin-right: 15px"> <div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<input type="text" id="TxtBusquedaEventos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <div style="margin-right: 15px">
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <input type="text" id="TxtBusquedaEventos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
</div> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
<asp:GridView ID="GvPuntos" runat="server" GridLines="None" DataKeyNames="Punto,PuntoDeInteres,CvePuntoDeInteres" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-height="150" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros"> </div>
<Columns> <asp:GridView ID="GvPuntos" runat="server" GridLines="None" DataKeyNames="Punto,PuntoDeInteres,CvePuntoDeInteres" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-height="150" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%"> <Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<HeaderTemplate> <HeaderTemplate>
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickGR" /> <asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickGR" />
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox runat="server" ID="chkGR" CssClass="ChkAllGR" /> <asp:CheckBox runat="server" ID="chkGR" CssClass="ChkAllGR" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="45%" HeaderText="Punto De Interés" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="45%" HeaderText="Punto De Interés" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Descripcion" ItemStyle-Width="45%" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Descripcion" ItemStyle-Width="45%" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left"> <div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px"> <div style="margin-right: 15px">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" data-height="150" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" data-height="150" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
</div> </div>
<asp:GridView ID="GvDispositivos" runat="server" GridLines="None" DataKeyNames="CveDispositivo,SerieVehiculo,DevID,NoEconomico,NombreVehiculo" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-heighterror="800" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros"> <asp:GridView ID="GvDispositivos" runat="server" GridLines="None" DataKeyNames="CveDispositivo,SerieVehiculo,DevID,NoEconomico,NombreVehiculo" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-heighterror="800" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<Columns> <Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%"> <asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<HeaderTemplate> <HeaderTemplate>
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickDisp" /> <asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickDisp" />
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox runat="server" ID="chkDis" CssClass="ChkAllDisp" /> <asp:CheckBox runat="server" ID="chkDis" CssClass="ChkAllDisp" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="NoEconomico" ItemStyle-Width="25%" HeaderText="Número Económico" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="NoEconomico" ItemStyle-Width="25%" HeaderText="Número Económico" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="ModeloVehiculo" ItemStyle-Width="25%" HeaderText="Modelo Vehículo" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="ModeloVehiculo" ItemStyle-Width="25%" HeaderText="Modelo Vehículo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="AñoVehiculo" ItemStyle-Width="25%" HeaderText="Año Vehículo" ItemStyle-HorizontalAlign="center" /> <asp:BoundField DataField="AñoVehiculo" ItemStyle-Width="25%" HeaderText="Año Vehículo" ItemStyle-HorizontalAlign="center" />
<asp:BoundField DataField="PlacasVehiculo" ItemStyle-Width="25%" HeaderText="Placas Vehículo" ItemStyle-HorizontalAlign="center" /> <asp:BoundField DataField="PlacasVehiculo" ItemStyle-Width="25%" HeaderText="Placas Vehículo" ItemStyle-HorizontalAlign="center" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:LinkButton ID="BtnConsultar" runat="server" Text="Consultar Reporte" ValidationGroup="GrpFechas" CssClass="btn btn-primary"></asp:LinkButton> <asp:LinkButton ID="BtnConsultar" runat="server" Text="Consultar Reporte" ValidationGroup="GrpFechas" CssClass="btn btn-primary"></asp:LinkButton>
<button data-dismiss="modal" class="btn btn-default">Cancelar</button> <button data-dismiss="modal" class="btn btn-default">Cancelar</button>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
</div> </div>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1"> <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1">
<ContentTemplate> <ContentTemplate>
<asp:HiddenField runat="server" ID="HdnPunto" ClientIDMode="static" Value="0" /> <asp:HiddenField runat="server" ID="HdnPunto" ClientIDMode="static" Value="0" />
<asp:HiddenField runat="server" ID="HdnDispositivo" ClientIDMode="static" Value="0" /> <asp:HiddenField runat="server" ID="HdnDispositivo" ClientIDMode="static" Value="0" />
<div id="dvHistorico" class="modal ADS fade" role="dialog"> <div id="dvHistorico" class="modal ADS fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<asp:UpdatePanel ID="UpHistorico" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpHistorico" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" id="H2" runat="server"><i class="fa fa-bell-o"></i>Historial Visitas: </h4> <h4 class="modal-title" id="H2" runat="server"><i class="fa fa-bell-o"></i>Historial Visitas: </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UpdatePanel3"> <asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UpdatePanel3">
<ContentTemplate> <Triggers>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left"> <asp:PostBackTrigger ControlID="LnkImprimirEXCELVisita" />
<div style="margin-right: 15px"> </Triggers>
<input type="text" id="TxtBusquedaHist" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <ContentTemplate>
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <div class="row">
</div> <div class="col-md-3">
</div> <asp:Label runat="server" Text="Punto de Interés:"></asp:Label>
<asp:GridView ID="GVHistorico" runat="server" GridLines="None" DataKeyNames="CveDispositivoEvento" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-heightfijo="100" data-height="100" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros"> <br />
<Columns> <b>
<asp:BoundField DataField="Conductor" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Conductor" ItemStyle-HorizontalAlign="left" /> <asp:Label ID="LblPU" runat="server" Text=""></asp:Label></b>
<asp:BoundField DataField="FechaEntrada" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Fecha Visita" ItemStyle-HorizontalAlign="center" /> </div>
<asp:BoundField DataField="Duracion" DataFormatString="{0} Minutos" HeaderStyle-HorizontalAlign="center" HeaderText="Duración" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="center" /> <div class="col-md-4">
</Columns> <asp:Label runat="server" Text="Vehículo:"></asp:Label>
</asp:GridView> <br />
</ContentTemplate> <b>
</asp:UpdatePanel> <asp:Label ID="LblUnidad" runat="server" Text=""></asp:Label></b>
</div> </div>
<div class="modal-footer"> <div class="col-md-1">
<asp:UpdatePanel runat="server" ID="uphidden"> <asp:LinkButton ID="LnkImprimirEXCELVisita" runat="server" OnClick="LnkImprimirEXCELVisita_Click" CssClass="btn btn-circle btn-sm green"><i class='fa fa-file-excel-o' aria-hidden='true'></i></asp:LinkButton>
<ContentTemplate> </div>
<asp:Button Style="display: none" ID="BtnCargarGV" runat="server" /> <div class="col-md-4">
</ContentTemplate> <div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
</asp:UpdatePanel> <div style="margin-right: 15px">
</div> <input type="text" id="TxtBusquedaHist" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
</ContentTemplate> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</asp:UpdatePanel> </div>
</div> </div>
</div> </div>
</ContentTemplate> </div>
</asp:UpdatePanel>
<asp:GridView ID="GVHistorico" runat="server" GridLines="None" DataKeyNames="CveDispositivoEvento" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-heightfijo="100" data-height="100" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<Columns>
<asp:BoundField DataField="Conductor" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Conductor" ItemStyle-HorizontalAlign="left" />
<asp:BoundField DataField="FechaEntrada" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Fecha Visita" ItemStyle-HorizontalAlign="center" />
<asp:BoundField DataField="Duracion" DataFormatString="{0} Minutos" HeaderStyle-HorizontalAlign="center" HeaderText="Duración" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="center" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server" ID="uphidden">
<ContentTemplate>
<asp:Button Style="display: none" ID="BtnCargarGV" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="modal fade bottom in" style="bottom: unset; z-index: 539" id="h"> <div class="modal fade bottom in" style="bottom: unset; z-index: 539" id="h">
<div class="modal-dialog" style="position: fixed; bottom: 0; margin: 0px,0px,0px,0px; width: 100%; padding: 0px, 0px, 0px, 0px; border-style: solid; border-color: rgb(68, 77, 88); z-index: 539;"> <div class="modal-dialog" style="position: fixed; bottom: 0; margin: 0px,0px,0px,0px; width: 100%; padding: 0px, 0px, 0px, 0px; border-style: solid; border-color: rgb(68, 77, 88); z-index: 539;">
<div class="modal-content"> <div class="modal-content">
@@ -307,8 +332,9 @@
<Columns> <Columns>
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="30%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Vehiculo" ItemStyle-Width="30%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="30%" HeaderText="Punto De Interes" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="30%" HeaderText="Punto De Interes" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Visitas" ItemStyle-Width="20%" DataFormatString="{0} Visitas" HeaderText="Visitas" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField DataField="Visitas" ItemStyle-Width="10%" DataFormatString="{0} Visitas" HeaderText="Visitas" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="UltimaVisita" ItemStyle-Width="20%" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Ultima Visita" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField DataField="UltimaVisita" ItemStyle-Width="20%" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Ultima Visita" ItemStyle-HorizontalAlign="Center" />
<asp:HyperLinkField HeaderText="Posición" Text="Ver en google maps" ItemStyle-Width="10%" DataNavigateUrlFields="LigaMapa" Target="_blank" />
</Columns> </Columns>
<PagerSettings Mode="NextPrevious" Visible="true" Position="Top" /> <PagerSettings Mode="NextPrevious" Visible="true" Position="Top" />
</asp:GridView> </asp:GridView>
@@ -319,19 +345,19 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div runat="server" class="row" style="margin: 0px 0px 10px 0px; display: none"> <div runat="server" class="row" style="margin: 0px 0px 10px 0px; display: none">
<asp:Button runat="server" OnClick="btnImprimir_Click" ID="btnImprimir" CommandArgument="PDF" ToolTip="Imprimir en PDF" CssClass="btn btn-circle btn-sm grey" Text="<i class='fa fa-print' aria-hidden='true'></i>"></asp:Button> <asp:Button runat="server" OnClick="btnImprimir_Click" ID="btnImprimir" CommandArgument="PDF" ToolTip="Imprimir en PDF" CssClass="btn btn-circle btn-sm grey" Text="<i class='fa fa-print' aria-hidden='true'></i>"></asp:Button>
<asp:Button runat="server" OnClick="btnImprimir_Click" ID="BtnImprimirEX" CommandArgument="EXCEL" ToolTip="Imprimir en EXCEL" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-file-excel-o' aria-hidden='true'></i>"></asp:Button> <asp:Button runat="server" OnClick="btnImprimir_Click" ID="BtnImprimirEX" CommandArgument="EXCEL" ToolTip="Imprimir en EXCEL" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-file-excel-o' aria-hidden='true'></i>"></asp:Button>
</div> </div>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server">
<li> <li>
<asp:LinkButton ID="BtnRep" OnClientClick="CargaDivs('Rep');return false;" Text="<i class='fa fa-location-arrow'></i><span>Reporte de puntos</span>" runat="server"> <asp:LinkButton ID="BtnRep" OnClientClick="CargaDivs('Rep');return false;" Text="<i class='fa fa-location-arrow'></i><span>Reporte de puntos</span>" runat="server">
</asp:LinkButton> </asp:LinkButton>
</li> </li>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<script> <script>
function doScaledCLick(boton) { function doScaledCLick(boton) {
@@ -350,10 +376,10 @@
$('body').on('click', '.ChkAllClickGR input', function () { $(".ChkAllGR input").not(this).prop('checked', $('.ChkAllClickGR input').is(':checked')); }); $('body').on('click', '.ChkAllClickGR input', function () { $(".ChkAllGR input").not(this).prop('checked', $('.ChkAllClickGR input').is(':checked')); });
$('body').on('click', '.ChkAllClickDisp input', function () { $(".ChkAllDisp input").not(this).prop('checked', $('.ChkAllClickDisp input').is(':checked')); }); $('body').on('click', '.ChkAllClickDisp input', function () { $(".ChkAllDisp input").not(this).prop('checked', $('.ChkAllClickDisp input').is(':checked')); });
function initMap() { function initMap() {
map = new google.maps.Map(document.getElementById('map'), { map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 19.4326, lng: -99.13329 }, center: { lat: 19.4326, lng: -99.13329 },
zoom: 8 zoom: 8
}); });
var ShowDiv1 = document.createElement('div'); var ShowDiv1 = document.createElement('div');
@@ -364,16 +390,16 @@
map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1); map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1);
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) { navigator.geolocation.getCurrentPosition(function (position) {
var pos = { var pos = {
lat: position.coords.latitude, lat: position.coords.latitude,
lng: position.coords.longitude lng: position.coords.longitude
}; };
map.setCenter(pos); map.setCenter(pos);
}, function () { }, function () {
handleLocationError(true, infoWindow, map.getCenter()); handleLocationError(true, infoWindow, map.getCenter());
}); });
} }
//CargaPickers(); //CargaPickers();
////directionsService = new google.maps.DirectionsService; ////directionsService = new google.maps.DirectionsService;
@@ -567,43 +593,43 @@
} }
} }
function CargaDivs(Tipo) { function CargaDivs(Tipo) {
if (Tipo === "PointGroup") { if (Tipo === "PointGroup") {
$("#C_TxtNombre").val("") $("#C_TxtNombre").val("")
$("#C_TxtDescripcion").val("") $("#C_TxtDescripcion").val("")
$('#divAgregarTipo').modal(); $('#divAgregarTipo').modal();
$("#HdnTipo").val(Tipo) $("#HdnTipo").val(Tipo)
$("#lblPuntos").text("Nombre Grupo de Puntos") $("#lblPuntos").text("Nombre Grupo de Puntos")
$("#dvEventos").css("display", "none") $("#dvEventos").css("display", "none")
$("#dvAdd").css("display", "") $("#dvAdd").css("display", "")
} }
else if (Tipo === "Point") { else if (Tipo === "Point") {
if (markers.length > 0) { if (markers.length > 0) {
$('#divAgregarTipo').modal(); $('#divAgregarTipo').modal();
$("#C_TxtNombre").val("") $("#C_TxtNombre").val("")
$("#C_TxtDescripcion").val("") $("#C_TxtDescripcion").val("")
$("#HdnTipo").val(Tipo) $("#HdnTipo").val(Tipo)
$("#lblPuntos").text("Nombre Punto(s) de Interés") $("#lblPuntos").text("Nombre Punto(s) de Interés")
$("#dvEventos").css("display", "") $("#dvEventos").css("display", "")
$("#dvAdd").css("display", "") $("#dvAdd").css("display", "")
} else { DeleteMarkers(); alert('Haga click en el mapa para dibujar puntos de interés') } } else { DeleteMarkers(); alert('Haga click en el mapa para dibujar puntos de interés') }
} }
else if (Tipo === "GroupRoute") { else if (Tipo === "GroupRoute") {
DeleteMarkers(); DeleteMarkers();
$("#C_TxtNombre").val("1") $("#C_TxtNombre").val("1")
$("#C_TxtDescripcion").val("1") $("#C_TxtDescripcion").val("1")
$('#divAgregarTipo').modal(); $('#divAgregarTipo').modal();
$("#HdnTipo").val(Tipo) $("#HdnTipo").val(Tipo)
$("#dvEventos").css("display", "") $("#dvEventos").css("display", "")
$("#dvAdd").css("display", "none") $("#dvAdd").css("display", "none")
} }
else if (Tipo === "Route") { else if (Tipo === "Route") {
DeleteMarkers(); DeleteMarkers();
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
} else if (Tipo === "Rep") {
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false }); $('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
} else if (Tipo === "Rep") { CargaPickers();
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false }); }
CargaPickers();
}
} }
@@ -618,85 +644,85 @@
// center: coords, // center: coords,
// radius: 15 // radius: 15
//}); //});
var Circle = new google.maps.Marker({ var Circle = new google.maps.Marker({
position: coords, position: coords,
icon: { icon: {
path: google.maps.SymbolPath.CIRCLE, path: google.maps.SymbolPath.CIRCLE,
scale: 10, scale: 10,
fillColor: color, fillColor: color,
fillOpacity: 0.35, fillOpacity: 0.35,
strokeWeight: 2, strokeWeight: 2,
strokeColor: color, strokeColor: color,
strokeOpacity: 0.8 strokeOpacity: 0.8
}, },
map: map map: map
}); });
circles.push(Circle); circles.push(Circle);
} }
function DeleteMarkers() { function DeleteMarkers() {
for (var i = 0; i < markers.length; i++) { for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null); markers[i].setMap(null);
} }
markers = []; markers = [];
for (var i = 0; i < circles.length; i++) { for (var i = 0; i < circles.length; i++) {
circles[i].setMap(null); circles[i].setMap(null);
} }
circles = []; circles = [];
markers = []; markers = [];
} }
function CreaMarcador(coords, nomPunto, ContentString) { function CreaMarcador(coords, nomPunto, ContentString) {
var marker = new google.maps.Marker({ var marker = new google.maps.Marker({
position: coords, position: coords,
title: nomPunto, title: nomPunto,
map: map map: map
}); });
var infowindow = new google.maps.InfoWindow({ var infowindow = new google.maps.InfoWindow({
content: ContentString content: ContentString
}); });
marker.addListener('click', function () { marker.addListener('click', function () {
closeLastOpenedInfoWindow(); closeLastOpenedInfoWindow();
infowindow.open(map, marker); infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow; lastOpenedInfoWindow = infowindow;
}); });
markers.push(marker); markers.push(marker);
if (markers.length > 1) { if (markers.length > 1) {
fitBoundsToVisibleMarkers() fitBoundsToVisibleMarkers()
} else if (markers.length === 1) { } else if (markers.length === 1) {
map.setZoom(15); map.setZoom(15);
map.setCenter(coords); map.setCenter(coords);
} }
} }
function closeLastOpenedInfoWindow() { function closeLastOpenedInfoWindow() {
if (lastOpenedInfoWindow) { if (lastOpenedInfoWindow) {
lastOpenedInfoWindow.close(); lastOpenedInfoWindow.close();
} }
} }
function fitBoundsToVisibleMarkers() { function fitBoundsToVisibleMarkers() {
var bounds = new google.maps.LatLngBounds(); var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) { for (var i = 0; i < markers.length; i++) {
if (markers[i].getVisible()) { if (markers[i].getVisible()) {
bounds.extend(markers[i].getPosition()); bounds.extend(markers[i].getPosition());
} }
} }
map.fitBounds(bounds); map.fitBounds(bounds);
} }
function CargaPickers() { function CargaPickers() {
$.datetimepicker.setLocale('es'); $.datetimepicker.setLocale('es');
$('input.ADDateTimePicker').each(function () { $('input.ADDateTimePicker').each(function () {
var TThis = $(this); var TThis = $(this);
if (Tthis.siblings().length <= 2) { if (Tthis.siblings().length <= 2) {
TThis.datetimepicker({ TThis.datetimepicker({
dayOfWeekStart: 1, dayOfWeekStart: 1,
lang: 'es', lang: 'es',
format: 'd/m/Y H:i', format: 'd/m/Y H:i',
formatDate: 'd/m/Y H:i', formatDate: 'd/m/Y H:i',
step: 30 step: 30
}); });
var Div = TThis.parent() var Div = TThis.parent()
var boton = document.createElement('span'); var boton = document.createElement('span');
@@ -705,25 +731,25 @@
var subboton = document.createElement('a') var subboton = document.createElement('a')
subboton.className = "btn default" subboton.className = "btn default"
subboton.innerHTML = "<i class='fa fa-calendar'></i>" subboton.innerHTML = "<i class='fa fa-calendar'></i>"
subboton.addEventListener('click', function () { subboton.addEventListener('click', function () {
TThis.datetimepicker('show') TThis.datetimepicker('show')
}); });
boton.appendChild(subboton) boton.appendChild(subboton)
Div[0].appendChild(boton) Div[0].appendChild(boton)
} }
}); });
} }
function CargaGV(CveDispositivo, CvePunto) { function CargaGV(CveDispositivo, CvePunto) {
$("#HdnPunto").val(CvePunto + '') $("#HdnPunto").val(CvePunto + '')
$("#HdnDispositivo").val(CveDispositivo + '') $("#HdnDispositivo").val(CveDispositivo + '')
$("#C_BtnCargarGV").click() $("#C_BtnCargarGV").click()
} }
</script> </script>
<script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places&callback=initMap", Extensiones.GOOGLE_MAPS_API_KEY) %>"></script> <script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places&callback=initMap", Extensiones.GOOGLE_MAPS_API_KEY) %>"></script>
<script src="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.min.js"></script> <script src="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.min.js"></script>
<script src="../Metronic/assets/global/plugins/jquery-minicolors/components-color-pickers.min.js"></script> <script src="../Metronic/assets/global/plugins/jquery-minicolors/components-color-pickers.min.js"></script>
</asp:Content> </asp:Content>

View File

@@ -3,6 +3,7 @@
Imports Extensiones Imports Extensiones
Imports System.Data Imports System.Data
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Imports GemBox.Spreadsheet
Partial Class GPS_RepPuntosDeInteres Partial Class GPS_RepPuntosDeInteres
Inherits ClsPaginas Inherits ClsPaginas
@@ -24,6 +25,14 @@ Partial Class GPS_RepPuntosDeInteres
ViewState("DtDatosReporte") = value ViewState("DtDatosReporte") = value
End Set End Set
End Property End Property
Private Property DtVisitas As DataTable
Get
Return If(IsNothing(ViewState("DtVisitas")), Nothing, CType(ViewState("DtVisitas"), DataTable))
End Get
Set(value As DataTable)
ViewState("DtVisitas") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -32,6 +41,7 @@ Partial Class GPS_RepPuntosDeInteres
End If End If
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
DtDatosReporte = Nothing
txtFechaF.Text = Now.ToString("dd/MM/yyyy") txtFechaF.Text = Now.ToString("dd/MM/yyyy")
txtFechaI.Text = Now.AddDays(-7).ToString("dd/MM/yyyy") txtFechaI.Text = Now.AddDays(-7).ToString("dd/MM/yyyy")
@@ -66,6 +76,11 @@ Partial Class GPS_RepPuntosDeInteres
End Sub End Sub
Private Sub ReportePuntos(Dispositivos As String) Private Sub ReportePuntos(Dispositivos As String)
'LIMPIAR REPORTE
If DtDatosReporte IsNot Nothing Then
DtDatosReporte.Dispose()
DtDatosReporte = Nothing
End If
Dim FechaI, FechaF As Date Dim FechaI, FechaF As Date
Dim SBBody As New StringBuilder Dim SBBody As New StringBuilder
@@ -83,11 +98,15 @@ Partial Class GPS_RepPuntosDeInteres
Try Try
For Each row As GridViewRow In GvPuntos.Rows For Each row As GridViewRow In GvPuntos.Rows
SBBody.Clear() SBBody.Clear()
If row.FCCheckBox("chkGR").Checked Then If row.FCCheckBox("chkGR").Checked Then
If ObjGPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then If ObjGPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
DtDatosReporte = ObjGPS.DtResultados.Copy() If DtDatosReporte IsNot Nothing Then
GvBarra.DataSource = DtDatosReporte DtDatosReporte.Merge(ObjGPS.DtResultados)
Else
DtDatosReporte = ObjGPS.DtResultados.Copy()
End If
Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT") Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT")
SBBody.Append($"<div>") SBBody.Append($"<div>")
@@ -98,7 +117,7 @@ Partial Class GPS_RepPuntosDeInteres
SBBody.Append($"<div><table>") SBBody.Append($"<div><table>")
For Each Cve As String In DispositivosLista For Each Cve As String In DispositivosLista
If ObjGPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then If ObjGPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then
SBBody.Append($"<tr><td><b>{ObjGPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}:</b> <a onclick=""CargaGV({Cve}, {row.DataKey("CvePuntoDeInteres")} )"">{ObjGPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas<a></td></tr>") SBBody.Append($"<tr><td><b>{ObjGPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}:</b> <a onclick=""CargaGV({Cve}, {row.DataKey("CvePuntoDeInteres")})"">{ObjGPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas<a></td></tr>")
SBBody.Append($"<tr><td>Última Visita: {ObjGPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}</td></tr>") SBBody.Append($"<tr><td>Última Visita: {ObjGPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}</td></tr>")
End If End If
Next Next
@@ -111,7 +130,11 @@ Partial Class GPS_RepPuntosDeInteres
RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres")) RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres"))
End If End If
End If End If
Next Next
GvBarra.DataSource = DtDatosReporte
GvBarra.DataBind()
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al consultar los puntos de interes", ex) OnError("Ocurrió un error al consultar los puntos de interes", ex)
End Try End Try
@@ -162,13 +185,32 @@ Partial Class GPS_RepPuntosDeInteres
Protected Sub BtnCargarGV_Click(sender As Object, e As EventArgs) Handles BtnCargarGV.Click Protected Sub BtnCargarGV_Click(sender As Object, e As EventArgs) Handles BtnCargarGV.Click
Dim GPS As New ClsGPS DtVisitas = Nothing
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") Dim ObjGPS As New ClsGPS
Else Try
GVHistorico.DataSource = Nothing Dim PuntoInteres As String = "", Vehiculo As String = ""
End If
GPS.Dispose() If ObjGPS.PuntoDeInteresGet(HdnPunto.Value.ToEntero, UsuarioActual.CveCliente, 1, -1) Then
PuntoInteres = ObjGPS.DtResultados.FiltroPrimeroValor("PuntoDeInteres")
End If
Vehiculo = GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("NoEconomico", $"CveDispositivo={HdnDispositivo.Value.ToEntero}")
LblPU.Text = PuntoInteres
LblUnidad.Text = Vehiculo
If ObjGPS.RepPuntosDetalleGet(HdnPunto.Value.ToEntero, HdnDispositivo.Value.ToEntero, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
DtVisitas = ObjGPS.DtResultados.FiltraParametros("CveEvento = 106")
GVHistorico.DataSource = DtVisitas
Else
GVHistorico.DataSource = Nothing
End If
Catch ex As Exception
OnError("Ocurrió un error al cargar las visitas", ex)
End Try
ObjGPS.Dispose()
GVHistorico.DataBind() GVHistorico.DataBind()
UpdatePanel3.Update() UpdatePanel3.Update()
RegistraScript("$('#dvHistorico').modal()") RegistraScript("$('#dvHistorico').modal()")
@@ -192,21 +234,215 @@ Partial Class GPS_RepPuntosDeInteres
End Sub End Sub
Public Sub EnviarReporteProgramado(Format As String) Public Sub EnviarReporteProgramado(Format As String)
Dim RutaReporte = "Empresas/Grales/ReportesProgramados/RPTPuntosInteres.rdlc"
Dim NombreReporte = "ReportePuntosInteres"
Try If Format = "EXCEL" Then
Dim RptParametro As New List(Of ReportParameter) Dim filtros As String = $"Fecha Inicio: {txtFechaI.Text}, Fecha Fin: {txtFechaF.Text}"
RptParametro.Add(New ReportParameter("FechaInicio", txtFechaI.Text))
RptParametro.Add(New ReportParameter("FechaFin", txtFechaF.Text))
RptParametro.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
Dim retorno = StreamPDF(RutaReporte, DtDatosReporte, RptParametro, $"{NombreReporte}{Date.Now.ToShortDateString}", Format, MR:=Nothing, RDSName:="DsOC") Dim DtImprimir As DataTable = DtDatosReporte.Copy()
ImprimirbytesPDF(retorno, $"{NombreReporte}{Date.Now.ToShortDateString}", Format) DtImprimir.Columns.Remove(DtImprimir.Columns("CveDispositivo"))
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) DtImprimir.Columns("PuntoDeInteres").SetOrdinal(0)
End Try DtImprimir.Columns("Vehiculo").SetOrdinal(1)
End Sub DtImprimir.Columns("UltimaVisita").SetOrdinal(2)
DtImprimir.Columns("Visitas").SetOrdinal(3)
DtImprimir.Columns("PuntoDeInteres").ColumnName = "Punto de Interés"
DtImprimir.Columns("Vehiculo").ColumnName = "Vehículo"
DtImprimir.Columns("UltimaVisita").ColumnName = "Última Visita"
ImprimirExcelG(DtImprimir, "ReportePuntosInteres.xlsx", "Reporte de Puntos de Interés", filtros, NombreHoja:="ReportePuntosInteres")
Else
Dim RutaReporte = "Empresas/Grales/ReportesProgramados/RPTPuntosInteres.rdlc"
Dim NombreReporte = "ReportePuntosInteres"
Try
Dim Nombre As String = ""
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then Nombre = ObjClientes.DtResultados.FiltroPrimeroValor("Nombre")
ObjClientes.Dispose()
Dim RptParametro As New List(Of ReportParameter)
RptParametro.Add(New ReportParameter("FechaInicio", txtFechaI.Text))
RptParametro.Add(New ReportParameter("FechaFin", txtFechaF.Text))
RptParametro.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
RptParametro.Add(New ReportParameter("Cliente", Nombre))
'Dim MR = New ReportViewer
'MR.LocalReport.EnableHyperlinks = True
'MR.HyperlinkTarget = "_blank"
Dim retorno = StreamPDF(RutaReporte, DtDatosReporte, RptParametro, $"{NombreReporte}{Date.Now.ToShortDateString}", Format, MR:=Nothing, RDSName:="DsOC")
ImprimirbytesPDF(retorno, $"{NombreReporte}{Date.Now.ToShortDateString}", Format)
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try
End If
End Sub
Protected Sub LnkImprimirEXCELVisita_Click(sender As Object, e As EventArgs)
Dim filtros As String = $"Punto de Interés: {LblPU.Text}, Vehículo: {LblUnidad.Text}"
Dim DtImprimir As DataTable = DtVisitas.Copy()
DtImprimir.Columns.Remove(DtImprimir.Columns("CveDispositivoEvento"))
DtImprimir.Columns.Remove(DtImprimir.Columns("CveEvento"))
DtImprimir.Columns.Remove(DtImprimir.Columns("FechaEvento"))
DtImprimir.Columns("FechaEntrada").ColumnName = "Fecha Visita"
DtImprimir.Columns("Duracion").ColumnName = "Duración (min)"
ImprimirExcelG(DtImprimir, "HistorialVistas.xlsx", "Historial de vistas", filtros, NombreHoja:="Historial")
End Sub
Private Sub ImprimirExcelG(DtDatos As DataTable, Archivo As String, Titulo As String, Filtros As String, Optional NombreHoja As String = "Hoja1")
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excel As ExcelFile = New ExcelFile
Dim TotalRowHeader As Integer = 8
Dim TotalRowFooter As Integer = 2
Dim item = excel.Worksheets.Add(NombreHoja)
item.InsertDataTable(DtDatos, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
.StartRow = 0,
.StartColumn = 0
})
item.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
item.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
Dim columnCount = item.CalculateMaxUsedColumns()
For i = 0 To columnCount
item.Columns(i).AutoFit(1, item.Rows(i), item.Rows(item.Rows.Count - 1))
Next
Dim worksheet = excel.Worksheets(0)
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
celdasConTexto.Style.Font.Name = "Calibri Light"
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
RangoNombreEmpresa.Merged = True
Dim Nombre As String = ""
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then Nombre = ObjClientes.DtResultados.FiltroPrimeroValor("Nombre")
ObjClientes.Dispose()
RangoNombreEmpresa.Value = Nombre
RangoNombreEmpresa.Style.Font.Size = 18 * 20
RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
RangoTitulo.Merged = True
RangoTitulo.Value = Titulo
RangoTitulo.Style.Font.Size = 20 * 20
RangoTitulo.Style.Font.Name = "Calibri Light"
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
'If FechaIMes.Trim.Length > 0 And FechaFMes.Trim.Length > 0 Then
' Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
' RangoFechas.Merged = True
' RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}"
' RangoFechas.Style.Font.Size = 15 * 20
' RangoFechas.Style.Font.Name = "Calibri Light"
' RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
' RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
'End If
'If SubProyecto.Length > 0 Then
' Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
' RangoSubProyecto.Merged = True
' RangoSubProyecto.Value = SubProyecto
' RangoSubProyecto.Style.Font.Size = 20 * 20
' RangoSubProyecto.Style.Font.Name = "Calibri Light"
' RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
' RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
'End If
If Not String.IsNullOrEmpty(Filtros) Then
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = Filtros
RangoDatoTituloExtra.Style.Font.Size = 15 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
End If
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
If i > 0 Then
Try
worksheet.Columns(i).AutoFit(1)
Catch ex As Exception
End Try
End If
Next
Dim IndexEndTable As Integer = DtDatos.Rows.Count + TotalRowHeader + TotalRowFooter
worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = UsuarioActual.Nombre
worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión"
worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy")
'Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
'If Imagen.Exists Then
' Dim Ruta As String = String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)
' Using sr As New StreamReader(Ruta)
' Dim ms As New MemoryStream()
' sr.BaseStream.CopyTo(ms)
' worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", 100, 100, LengthUnit.Pixel)
' End Using
'End If
For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
If I > 0 Then
'If Divisor = 1 Then
' worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
'Else
' worksheet.Columns(I + 1).Style.NumberFormat = "#,##"
'End If
Try
worksheet.Columns(I).AutoFit(1)
Catch ex As Exception
End Try
End If
Next
excel.Save(Me.Response, Archivo, SaveOptions.XlsxDefault)
End Sub
End Class End Class