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
Private Sub CargaDatos()
Dim gps As New ClsGPS
If gps.PuntoDeInteresGrupoGet(-1, 1) Then
GvGrupos.DataSource = gps.DtResultados
Else
GvGrupos.DataSource = Nothing
Dim ObjGPS As New ClsGPS
If ObjGPS.PuntoDeInteresGrupoGet(UsuarioActual.CveCliente, 1) Then
GvGrupos.DataSource = ObjGPS.DtResultados
End If
If gps.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GvPuntos.DataSource = gps.DtResultados
GVPuntosInteres.DataSource = gps.DtResultados
Else
GvPuntos.DataSource = Nothing
GVPuntosInteres.DataSource = Nothing
If ObjGPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GvPuntos.DataSource = ObjGPS.DtResultados
GVPuntosInteres.DataSource = ObjGPS.DtResultados
End If
gps.Dispose()
ObjGPS.Dispose()
GvGrupos.DataBind()
GvPuntos.DataBind()
GVPuntosInteres.DataBind()
UpEditar.Update()
End Sub
@@ -65,7 +64,6 @@ Partial Class GPS_PuntosDeInteres
End If
End Sub
Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click
Dim GPS As New ClsGPS
GPS.IniciaTransacSQL()
@@ -110,7 +108,7 @@ Partial Class GPS_PuntosDeInteres
Alert("Es necesario seleccionar un grupo de puntos", TipoMensaje.MsgAdvertencia)
Exit Sub
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 = ""
For Each row As DataRow In GPS.DtResultados.Rows
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" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<link href="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.css" rel="stylesheet" />
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: calc(100% - 51px);
margin: 0;
padding: 0;
}
#map {
position: fixed !important;
}
.pac-container.pac-logo {
z-index: 100000;
}
<%@ 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>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<link href="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.css" rel="stylesheet" />
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: calc(100% - 51px);
margin: 0;
padding: 0;
}
#map {
position: fixed !important;
}
.pac-container.pac-logo {
z-index: 100000;
}
#showdiv1 {
left: 0 !important;
width: 100% !important;
}
}
#ShowDiv3:hover {
line-height: 34px !important;
-webkit-transition: line-height ease 1s;
-moz-transition: line-height ease 1s;
-o-transition: line-height ease 1s;
transition: line-height ease 1s;
}
}
.ADScroller-body {
max-height: 400px;
}
@@ -53,7 +53,7 @@
margin-bottom: 10px;
}
#iw-container .iw-title {
#iw-container .iw-title {
font-family: 'Open Sans Condensed', sans-serif;
font-size: 22px;
font-weight: 400;
@@ -62,9 +62,9 @@
color: white;
margin: 0;
border-radius: 2px 2px 0 0;
}
}
#iw-container .iw-content {
#iw-container .iw-content {
font-size: 13px;
line-height: 18px;
font-weight: 400;
@@ -73,7 +73,7 @@
max-height: 140px;
overflow-y: auto;
overflow-x: hidden;
}
}
.iw-content img {
float: right;
@@ -158,135 +158,160 @@
.form-horizontal .control-label {
text-align: left;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<div id="map"></div>
<div id="dvConsulta" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UPConsulta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="H1" runat="server">Consultar Reporte de Puntos</h4>
</div>
<div class="modal-body">
<ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px; margin-bottom: 20px;">
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<div id="map"></div>
<div id="dvConsulta" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UPConsulta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="H1" runat="server">Consultar Reporte de Puntos</h4>
</div>
<div class="modal-body">
<ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px; margin-bottom: 20px;">
<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>
<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>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
<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>
<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>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
<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>
<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>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
</ul>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px">
<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;" />
<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">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<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>
<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>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
</ul>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px">
<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;" />
<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">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<HeaderTemplate>
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickGR" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkGR" CssClass="ChkAllGR" />
</ItemTemplate>
</asp:TemplateField>
<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" />
</Columns>
</asp:GridView>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<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;" />
<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>
<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>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkGR" CssClass="ChkAllGR" />
</ItemTemplate>
</asp:TemplateField>
<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" />
</Columns>
</asp:GridView>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<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;" />
<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>
<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>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<HeaderTemplate>
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickDisp" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkDis" CssClass="ChkAllDisp" />
</ItemTemplate>
</asp:TemplateField>
<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="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" />
</Columns>
</asp:GridView>
</div>
<div class="modal-footer">
<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>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1">
<ContentTemplate>
<asp:HiddenField runat="server" ID="HdnPunto" ClientIDMode="static" Value="0" />
<asp:HiddenField runat="server" ID="HdnDispositivo" ClientIDMode="static" Value="0" />
<div id="dvHistorico" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpHistorico" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="H2" runat="server"><i class="fa fa-bell-o"></i>Historial Visitas: </h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UpdatePanel3">
<ContentTemplate>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px">
<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;" />
<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>
</div>
<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>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkDis" CssClass="ChkAllDisp" />
</ItemTemplate>
</asp:TemplateField>
<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="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" />
</Columns>
</asp:GridView>
</div>
<div class="modal-footer">
<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>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1">
<ContentTemplate>
<asp:HiddenField runat="server" ID="HdnPunto" ClientIDMode="static" Value="0" />
<asp:HiddenField runat="server" ID="HdnDispositivo" ClientIDMode="static" Value="0" />
<div id="dvHistorico" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpHistorico" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="H2" runat="server"><i class="fa fa-bell-o"></i>Historial Visitas: </h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UpdatePanel3">
<Triggers>
<asp:PostBackTrigger ControlID="LnkImprimirEXCELVisita" />
</Triggers>
<ContentTemplate>
<div class="row">
<div class="col-md-3">
<asp:Label runat="server" Text="Punto de Interés:"></asp:Label>
<br />
<b>
<asp:Label ID="LblPU" runat="server" Text=""></asp:Label></b>
</div>
<div class="col-md-4">
<asp:Label runat="server" Text="Vehículo:"></asp:Label>
<br />
<b>
<asp:Label ID="LblUnidad" runat="server" Text=""></asp:Label></b>
</div>
<div class="col-md-1">
<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>
</div>
<div class="col-md-4">
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px">
<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;" />
<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>
</div>
</div>
</div>
<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-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">
@@ -307,8 +332,9 @@
<Columns>
<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="Visitas" ItemStyle-Width="20%" 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="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:HyperLinkField HeaderText="Posición" Text="Ver en google maps" ItemStyle-Width="10%" DataNavigateUrlFields="LigaMapa" Target="_blank" />
</Columns>
<PagerSettings Mode="NextPrevious" Visible="true" Position="Top" />
</asp:GridView>
@@ -319,19 +345,19 @@
</div>
</div>
</div>
</div>
</div>
<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="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>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server">
<li>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server">
<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>
</li>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<script>
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', '.ChkAllClickDisp input', function () { $(".ChkAllDisp input").not(this).prop('checked', $('.ChkAllClickDisp input').is(':checked')); });
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 19.4326, lng: -99.13329 },
zoom: 8
zoom: 8
});
var ShowDiv1 = document.createElement('div');
@@ -364,16 +390,16 @@
map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var pos = {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
lng: position.coords.longitude
};
map.setCenter(pos);
}, function () {
handleLocationError(true, infoWindow, map.getCenter());
});
map.setCenter(pos);
}, function () {
handleLocationError(true, infoWindow, map.getCenter());
});
}
//CargaPickers();
////directionsService = new google.maps.DirectionsService;
@@ -567,43 +593,43 @@
}
}
function CargaDivs(Tipo) {
if (Tipo === "PointGroup") {
function CargaDivs(Tipo) {
if (Tipo === "PointGroup") {
$("#C_TxtNombre").val("")
$("#C_TxtDescripcion").val("")
$('#divAgregarTipo').modal();
$("#HdnTipo").val(Tipo)
$("#lblPuntos").text("Nombre Grupo de Puntos")
$("#dvEventos").css("display", "none")
$("#dvAdd").css("display", "")
$("#dvAdd").css("display", "")
}
else if (Tipo === "Point") {
if (markers.length > 0) {
else if (Tipo === "Point") {
if (markers.length > 0) {
$('#divAgregarTipo').modal();
$("#C_TxtNombre").val("")
$("#C_TxtDescripcion").val("")
$("#HdnTipo").val(Tipo)
$("#lblPuntos").text("Nombre Punto(s) de Interés")
$("#dvEventos").css("display", "")
$("#dvAdd").css("display", "")
} else { DeleteMarkers(); alert('Haga click en el mapa para dibujar puntos de interés') }
$("#dvAdd").css("display", "")
} else { DeleteMarkers(); alert('Haga click en el mapa para dibujar puntos de interés') }
}
else if (Tipo === "GroupRoute") {
else if (Tipo === "GroupRoute") {
DeleteMarkers();
$("#C_TxtNombre").val("1")
$("#C_TxtDescripcion").val("1")
$('#divAgregarTipo').modal();
$("#HdnTipo").val(Tipo)
$("#dvEventos").css("display", "")
$("#dvAdd").css("display", "none")
$("#dvAdd").css("display", "none")
}
else if (Tipo === "Route") {
else if (Tipo === "Route") {
DeleteMarkers();
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
} else if (Tipo === "Rep") {
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
} else if (Tipo === "Rep") {
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
CargaPickers();
}
CargaPickers();
}
}
@@ -618,85 +644,85 @@
// center: coords,
// radius: 15
//});
var Circle = new google.maps.Marker({
var Circle = new google.maps.Marker({
position: coords,
icon: {
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 10,
fillColor: color,
fillOpacity: 0.35,
strokeWeight: 2,
strokeColor: color,
strokeOpacity: 0.8
strokeOpacity: 0.8
},
map: map
map: map
});
circles.push(Circle);
circles.push(Circle);
}
function DeleteMarkers() {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
function DeleteMarkers() {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
markers = [];
for (var i = 0; i < circles.length; i++) {
circles[i].setMap(null);
for (var i = 0; i < circles.length; i++) {
circles[i].setMap(null);
}
circles = [];
markers = [];
markers = [];
}
function CreaMarcador(coords, nomPunto, ContentString) {
var marker = new google.maps.Marker({
function CreaMarcador(coords, nomPunto, ContentString) {
var marker = new google.maps.Marker({
position: coords,
title: nomPunto,
map: map
map: map
});
var infowindow = new google.maps.InfoWindow({
content: ContentString
var infowindow = new google.maps.InfoWindow({
content: ContentString
});
marker.addListener('click', function () {
marker.addListener('click', function () {
closeLastOpenedInfoWindow();
infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow;
lastOpenedInfoWindow = infowindow;
});
markers.push(marker);
if (markers.length > 1) {
fitBoundsToVisibleMarkers()
} else if (markers.length === 1) {
if (markers.length > 1) {
fitBoundsToVisibleMarkers()
} else if (markers.length === 1) {
map.setZoom(15);
map.setCenter(coords);
}
map.setCenter(coords);
}
}
function closeLastOpenedInfoWindow() {
if (lastOpenedInfoWindow) {
lastOpenedInfoWindow.close();
}
function closeLastOpenedInfoWindow() {
if (lastOpenedInfoWindow) {
lastOpenedInfoWindow.close();
}
}
function fitBoundsToVisibleMarkers() {
function fitBoundsToVisibleMarkers() {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) {
if (markers[i].getVisible()) {
bounds.extend(markers[i].getPosition());
}
for (var i = 0; i < markers.length; i++) {
if (markers[i].getVisible()) {
bounds.extend(markers[i].getPosition());
}
}
map.fitBounds(bounds);
map.fitBounds(bounds);
}
function CargaPickers() {
function CargaPickers() {
$.datetimepicker.setLocale('es');
$('input.ADDateTimePicker').each(function () {
$('input.ADDateTimePicker').each(function () {
var TThis = $(this);
if (Tthis.siblings().length <= 2) {
TThis.datetimepicker({
if (Tthis.siblings().length <= 2) {
TThis.datetimepicker({
dayOfWeekStart: 1,
lang: 'es',
format: 'd/m/Y H:i',
formatDate: 'd/m/Y H:i',
step: 30
step: 30
});
var Div = TThis.parent()
var boton = document.createElement('span');
@@ -705,25 +731,25 @@
var subboton = document.createElement('a')
subboton.className = "btn default"
subboton.innerHTML = "<i class='fa fa-calendar'></i>"
subboton.addEventListener('click', function () {
TThis.datetimepicker('show')
subboton.addEventListener('click', function () {
TThis.datetimepicker('show')
});
boton.appendChild(subboton)
Div[0].appendChild(boton)
}
});
Div[0].appendChild(boton)
}
});
}
function CargaGV(CveDispositivo, CvePunto) {
function CargaGV(CveDispositivo, CvePunto) {
$("#HdnPunto").val(CvePunto + '')
$("#HdnDispositivo").val(CveDispositivo + '')
$("#C_BtnCargarGV").click()
$("#C_BtnCargarGV").click()
}
</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>
<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/components-color-pickers.min.js"></script>
</asp:Content>
<script src="../Metronic/assets/global/plugins/jquery-minicolors/components-color-pickers.min.js"></script>
</asp:Content>

View File

@@ -3,6 +3,7 @@
Imports Extensiones
Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports GemBox.Spreadsheet
Partial Class GPS_RepPuntosDeInteres
Inherits ClsPaginas
@@ -24,6 +25,14 @@ Partial Class GPS_RepPuntosDeInteres
ViewState("DtDatosReporte") = value
End Set
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
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -32,6 +41,7 @@ Partial Class GPS_RepPuntosDeInteres
End If
End Sub
Private Sub CargaDatos()
DtDatosReporte = Nothing
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
txtFechaI.Text = Now.AddDays(-7).ToString("dd/MM/yyyy")
@@ -66,6 +76,11 @@ Partial Class GPS_RepPuntosDeInteres
End Sub
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 SBBody As New StringBuilder
@@ -83,11 +98,15 @@ Partial Class GPS_RepPuntosDeInteres
Try
For Each row As GridViewRow In GvPuntos.Rows
SBBody.Clear()
If row.FCCheckBox("chkGR").Checked Then
If ObjGPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
DtDatosReporte = ObjGPS.DtResultados.Copy()
GvBarra.DataSource = DtDatosReporte
If DtDatosReporte IsNot Nothing Then
DtDatosReporte.Merge(ObjGPS.DtResultados)
Else
DtDatosReporte = ObjGPS.DtResultados.Copy()
End If
Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT")
SBBody.Append($"<div>")
@@ -98,7 +117,7 @@ Partial Class GPS_RepPuntosDeInteres
SBBody.Append($"<div><table>")
For Each Cve As String In DispositivosLista
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>")
End If
Next
@@ -111,7 +130,11 @@ Partial Class GPS_RepPuntosDeInteres
RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres"))
End If
End If
Next
GvBarra.DataSource = DtDatosReporte
GvBarra.DataBind()
Catch ex As Exception
OnError("Ocurrió un error al consultar los puntos de interes", ex)
End Try
@@ -162,13 +185,32 @@ Partial Class GPS_RepPuntosDeInteres
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()
DtVisitas = Nothing
Dim ObjGPS As New ClsGPS
Try
Dim PuntoInteres As String = "", Vehiculo As String = ""
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()
UpdatePanel3.Update()
RegistraScript("$('#dvHistorico').modal()")
@@ -192,21 +234,215 @@ Partial Class GPS_RepPuntosDeInteres
End Sub
Public Sub EnviarReporteProgramado(Format As String)
Dim RutaReporte = "Empresas/Grales/ReportesProgramados/RPTPuntosInteres.rdlc"
Dim NombreReporte = "ReportePuntosInteres"
Try
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))
If Format = "EXCEL" Then
Dim filtros As String = $"Fecha Inicio: {txtFechaI.Text}, Fecha Fin: {txtFechaF.Text}"
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)
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try
End Sub
DtImprimir.Columns.Remove(DtImprimir.Columns("CveDispositivo"))
DtImprimir.Columns("PuntoDeInteres").SetOrdinal(0)
DtImprimir.Columns("Vehiculo").SetOrdinal(1)
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