638 lines
32 KiB
Plaintext
638 lines
32 KiB
Plaintext
<%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="EntradasSalidasGR.aspx.vb" Inherits="GPS_Rastreo" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
|
<link href="../Metronic/assets/layouts/layout3/css/jquery.datetimepicker.css" rel="stylesheet" />
|
|
<style type="text/css">
|
|
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;
|
|
}
|
|
|
|
#iw-container {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
#iw-container .iw-title {
|
|
font-family: 'Open Sans Condensed', sans-serif;
|
|
font-size: 22px;
|
|
font-weight: 400;
|
|
padding: 10px;
|
|
background-color: #48b5e9;
|
|
color: white;
|
|
margin: 0;
|
|
border-radius: 2px 2px 0 0;
|
|
}
|
|
|
|
#iw-container .iw-content {
|
|
font-size: 13px;
|
|
line-height: 18px;
|
|
font-weight: 400;
|
|
margin-right: 1px;
|
|
padding: 15px 5px 20px 15px;
|
|
max-height: 140px;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
.iw-content img {
|
|
float: right;
|
|
margin: 0 5px 5px 10px;
|
|
}
|
|
|
|
.iw-subTitle {
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
padding: 5px 0;
|
|
}
|
|
|
|
.iw-bottom-gradient {
|
|
position: absolute;
|
|
width: 326px;
|
|
height: 25px;
|
|
bottom: 10px;
|
|
right: 18px;
|
|
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
|
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
|
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
|
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
|
}
|
|
</style>
|
|
</asp:Content>
|
|
<asp:Content ContentPlaceHolderID="H" ID="Content9" runat="server">
|
|
<li>
|
|
<a id="BtnConsulta" onclick="CargaDiv();">
|
|
<i class='fa fa-exchange'></i><span>Rep. Entradas y Salidas</span>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<asp:LinkButton ID="LnkKM" OnClientClick="javascript:$('#DvDescargar').modal('show'); return false;" CommandArgument="KM" Text="<i class='fa fa-line-chart'></i><span>Imprimir PDF</span>" runat="server">
|
|
</asp:LinkButton>
|
|
</li>
|
|
</asp:Content>
|
|
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
|
<div id="map"></div>
|
|
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UPModalBusqueda">
|
|
<ContentTemplate>
|
|
<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">×</span>
|
|
</button>
|
|
<h4 class="modal-title" id="myModalLabel2" runat="server">Reporte de Entrada y Salidas de Geocercas</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<asp:UpdatePanel runat="server" ID="upFechas" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<div runat="server" id="dvFechas">
|
|
<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>
|
|
<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: 15px;">
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnUltimas2" OnClientClick="ConsultaFecha('2'); return false;" CssClass="btn default" Text="Últimas dos horas" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnUltimas8" OnClientClick="ConsultaFecha('8'); return false;" CssClass="btn default" Text="Últimas ocho horas" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnHoy" OnClientClick="ConsultaFecha('24'); return false;" CssClass="btn default" Text="Hoy" />
|
|
</div>
|
|
</div>
|
|
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 25px;">
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnAyer" OnClientClick="ConsultaFecha('48'); return false;" CssClass="btn default" Text="Ayer" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnSemana" OnClientClick="ConsultaFecha('Week'); return false;" CssClass="btn default" Text="Última Semana" />
|
|
</div>
|
|
<div class="col-md-4">
|
|
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnMes" OnClientClick="ConsultaFecha('Month'); return false;" CssClass="btn default" Text="Mes en Curso" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
<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) %>" 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-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%">
|
|
<ItemTemplate>
|
|
<asp:CheckBox runat="server" ID="chkDis" />
|
|
</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>
|
|
<asp:UpdatePanel ID="upEventos" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<div id="dvEventos" runat="server">
|
|
<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}')", GVGeoreferencias.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GVGeoreferencias.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
|
</div>
|
|
</div>
|
|
<asp:GridView ID="GVGeoreferencias" runat="server" GridLines="None" DataKeyNames="Coordenadas,CveGeoReferencia,GeoReferencia,CveDispositivo,Tipo,Color,Estatus,FechaInicio,FechaFin,AplicaLunes,AplicaMartes,AplicaMiercoles,AplicaJueves,AplicaViernes,AplicaSabado,AplicaDomingo, HoraInicio, HoraFin, Tolerancia" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-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%">
|
|
<ItemTemplate>
|
|
<asp:CheckBox runat="server" ID="chkGR" />
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
<asp:BoundField DataField="Tipo" ItemStyle-Width="20%" HeaderText="Tipo" ItemStyle-HorizontalAlign="Left" />
|
|
<asp:BoundField DataField="GeoReferencia" ItemStyle-Width="20%" HeaderText="GeoReferencia" ItemStyle-HorizontalAlign="Left" />
|
|
<asp:TemplateField HeaderText="Color" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Center">
|
|
<ItemTemplate>
|
|
<asp:LinkButton ID="imgColor" HeaderText="Color" runat="server" Style="height: 20px;" Enabled="false" CausesValidation="False" CssClass="btn btn-circle btn-sm green" />
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
</Columns>
|
|
</asp:GridView>
|
|
</div>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<asp:LinkButton ID="BtnRastrear" runat="server" Text="Rastreo" CssClass="btn btn-primary"></asp:LinkButton>
|
|
<button data-dismiss="modal" class="btn btn-default">Cancelar</button>
|
|
</div>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
</div>
|
|
</div>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
<div id="DvDescargar" class="modal ADS fade" role="dialog">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content rowpadding">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
<h4 class="modal-title" id="H1" runat="server">Imprimir Reporte de Entrada y Salidas de Geocercas</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<asp:LinkButton ID="LnkPDF" OnClick="LnkPDF_Click" CommandArgument="KM" Text="<i class='fa fa-line-chart'></i><span>Descargar PDF</span>" runat="server">
|
|
</asp:LinkButton>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<asp:LinkButton ID="LnkPDFDetallado" OnClick="LnkPDFDetallado_Click" CommandArgument="KM" Text="<i class='fa fa-line-chart'></i><span>Descargar PDF Detallado</span>" runat="server">
|
|
</asp:LinkButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button data-dismiss="modal" class="btn btn-danger">Cancelar</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</asp:Content>
|
|
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
|
<script src="../Metronic/assets/layouts/layout3/scripts/jquery.datetimepicker.full.js"></script>
|
|
<script>
|
|
var image = '/Imagenes/rsz_11rsz_car.png';
|
|
var geocoder;
|
|
var map;
|
|
var directionsService;
|
|
var directionsDisplay;
|
|
|
|
|
|
|
|
|
|
function initMap() {
|
|
map = new google.maps.Map(document.getElementById('map'), {
|
|
center: { lat: 29.0730, lng: -110.9559 },
|
|
zoom: 10
|
|
});
|
|
|
|
if (navigator.geolocation) {
|
|
navigator.geolocation.getCurrentPosition(function (position) {
|
|
var pos = {
|
|
lat: position.coords.latitude,
|
|
lng: position.coords.longitude
|
|
};
|
|
map.setCenter(pos);
|
|
}, function () {
|
|
handleLocationError(true, infoWindow, map.getCenter());
|
|
});
|
|
}
|
|
|
|
geocoder = new google.maps.Geocoder();
|
|
|
|
google.maps.event.addListener(map, "click", function (event) {
|
|
closeLastOpenedInfoWindow();
|
|
});
|
|
|
|
}
|
|
|
|
var polylines = [];
|
|
|
|
function creaPolyline(coords, color, info, lastcoord, nomequipo, Imagen) {
|
|
var lineSymbol = {
|
|
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
|
|
strokeWeight: 1,
|
|
strokeOpacity: 1,
|
|
scale: 3,
|
|
fillOpacity: 0.6
|
|
};
|
|
var polyline = new google.maps.Polyline({
|
|
path: coords,
|
|
strokeColor: color,
|
|
strokeOpacity: 0.6,
|
|
strokeWeight: 6,
|
|
fillOpacity: 0.35,
|
|
icons: [{
|
|
icon: lineSymbol,
|
|
offset: '0',
|
|
repeat: '80px'
|
|
}]
|
|
});
|
|
polyline.setMap(map);
|
|
polylines.push(polyline);
|
|
CreaMarcador(lastcoord, nomequipo, info, Imagen);
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
initMap();
|
|
});
|
|
var markers = [];
|
|
var lastOpenedInfoWindow;
|
|
|
|
|
|
function CreaMarcador(coords, nomEquipo, ContentString, imagen) {
|
|
if (typeof imagen === 'undefined') { imagen = image; }
|
|
var marker = new google.maps.Marker({
|
|
position: coords,
|
|
title: nomEquipo,
|
|
map: map,
|
|
icon: imagen
|
|
});
|
|
var infowindow = new google.maps.InfoWindow({
|
|
content: ContentString
|
|
});
|
|
marker.addListener('click', function () {
|
|
closeLastOpenedInfoWindow();
|
|
GetDirecciones(coords, infowindow, marker);
|
|
infowindow.open(map, marker);
|
|
lastOpenedInfoWindow = infowindow;
|
|
});
|
|
markers.push(marker);
|
|
//map.setCenter(coords);
|
|
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());
|
|
}
|
|
}
|
|
|
|
map.fitBounds(bounds);
|
|
|
|
}
|
|
|
|
var polygons = [];
|
|
|
|
function creaPoligono(coords, color) {
|
|
var polygon = new google.maps.Polygon({
|
|
paths: coords,
|
|
strokeColor: color,
|
|
strokeOpacity: 0.8,
|
|
strokeWeight: 2,
|
|
fillColor: color,
|
|
fillOpacity: 0.35
|
|
});
|
|
polygon.setMap(map);
|
|
polygons.push(polygon);
|
|
//map.setCenter(coords[0]);
|
|
}
|
|
|
|
function closeLastOpenedInfoWindow() {
|
|
if (lastOpenedInfoWindow) {
|
|
lastOpenedInfoWindow.close();
|
|
}
|
|
}
|
|
|
|
var marker2;
|
|
function CreaMarcadorHistorico(coords, nomEquipo, ContentString, imagen, imagen2) {
|
|
if (typeof imagen === 'undefined') { imagen = image; }
|
|
var icon = {
|
|
url: imagen, // url
|
|
scaledSize: new google.maps.Size(12.5, 12.5), // scaled size
|
|
// origin: new google.maps.Point(0, 0), // origin
|
|
//anchor: new google.maps.Point(0, 0) // anchor
|
|
};
|
|
var marker = new google.maps.Marker({
|
|
position: coords,
|
|
title: nomEquipo,
|
|
map: map,
|
|
icon: icon
|
|
});
|
|
var infowindow2 = new google.maps.InfoWindow({
|
|
content: ContentString
|
|
});
|
|
marker.addListener('click', function () {
|
|
if (typeof marker2 != 'undefined') { marker2.setMap(null); }
|
|
marker2 = new google.maps.Marker({
|
|
position: coords,
|
|
title: nomEquipo,
|
|
map: map,
|
|
icon: imagen2
|
|
});
|
|
marker2.addListener('click', function () {
|
|
closeLastOpenedInfoWindow();
|
|
infowindow2.open(map, marker2);
|
|
lastOpenedInfoWindow = infowindow2;
|
|
});
|
|
infowindow2.open(map, marker2);
|
|
lastOpenedInfoWindow = infowindow2;
|
|
});
|
|
markers.push(marker);
|
|
map.setCenter(coords);
|
|
}
|
|
|
|
function DeleteMarkers() {
|
|
for (var i = 0; i < markers.length; i++) {
|
|
markers[i].setMap(null);
|
|
}
|
|
markers = [];
|
|
for (var i = 0; i < polylines.length; i++) {
|
|
polylines[i].setMap(null);
|
|
}
|
|
polylines = [];
|
|
|
|
for (var i = 0; i < polygons.length; i++) {
|
|
polygons[i].setMap(null);
|
|
}
|
|
polygons = [];
|
|
}
|
|
|
|
|
|
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());
|
|
}
|
|
}
|
|
|
|
map.fitBounds(bounds);
|
|
|
|
}
|
|
|
|
function CargaDiv() {
|
|
$("#C_txtFechaI").val("")
|
|
$("#C_txtFechaF").val("")
|
|
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
|
|
|
|
}
|
|
|
|
function ConsultaFecha(Opcion) {
|
|
var today = new Date();
|
|
switch (Opcion) {
|
|
case "2":
|
|
var FechaI = addDate(today, "hour", -2);
|
|
var FechaF = today;
|
|
|
|
$("#C_txtFechaI").val(dateFormat(FechaI, "dd/mm/yyyy HH:mm"));
|
|
$("#C_txtFechaF").val(dateFormat(FechaF, "dd/mm/yyyy HH:mm"));
|
|
break;
|
|
case "8":
|
|
var FechaI = addDate(today, "hour", -8);
|
|
var FechaF = today;
|
|
|
|
$("#C_txtFechaI").val(dateFormat(FechaI, "dd/mm/yyyy HH:mm"));
|
|
$("#C_txtFechaF").val(dateFormat(FechaF, "dd/mm/yyyy HH:mm"));
|
|
break;
|
|
case "24":
|
|
$("#C_txtFechaI").val(dateFormat(today, "dd/mm/yyyy") + " 0:00");
|
|
$("#C_txtFechaF").val(dateFormat(today, "dd/mm/yyyy") + " 23:59");
|
|
break;
|
|
case "48":
|
|
var FechaI = addDate(today, "day", -1);
|
|
|
|
$("#C_txtFechaI").val(dateFormat(FechaI, "dd/mm/yyyy") + " 0:00");
|
|
$("#C_txtFechaF").val(dateFormat(FechaI, "dd/mm/yyyy") + " 23:59");
|
|
break;
|
|
case "Week":
|
|
var FechaI = addDate(today, "day", -7);
|
|
|
|
$("#C_txtFechaI").val(dateFormat(FechaI, "dd/mm/yyyy") + " 0:00");
|
|
$("#C_txtFechaF").val(dateFormat(today, "dd/mm/yyyy HH:mm"));
|
|
break;
|
|
case "Month":
|
|
//var FechaI = addDate(today, "month", -1);
|
|
var FechaI = '01/' + (today.getMonth() + 1) + '/' + today.getFullYear() + " 0:00";
|
|
$("#C_txtFechaI").val(FechaI);
|
|
$("#C_txtFechaF").val(dateFormat(today, "dd/mm/yyyy HH:mm"));
|
|
break;
|
|
|
|
default:
|
|
}
|
|
}
|
|
|
|
//REGION F U N C I O N E S - F E C H A S
|
|
function addDate(date, interval, units) {
|
|
var ret = new Date(date); //don't change original date
|
|
var checkRollover = function () { if (ret.getDate() != date.getDate()) ret.setDate(0); };
|
|
switch (interval.toLowerCase()) {
|
|
case 'year': ret.setFullYear(ret.getFullYear() + units); checkRollover(); break;
|
|
case 'quarter': ret.setMonth(ret.getMonth() + 3 * units); checkRollover(); break;
|
|
case 'month': ret.setMonth(ret.getMonth() + units); checkRollover(); break;
|
|
case 'week': ret.setDate(ret.getDate() + 7 * units); break;
|
|
case 'day': ret.setDate(ret.getDate() + units); break;
|
|
case 'hour': ret.setTime(ret.getTime() + units * 3600000); break;
|
|
case 'minute': ret.setTime(ret.getTime() + units * 60000); break;
|
|
case 'second': ret.setTime(ret.getTime() + units * 1000); break;
|
|
default: ret = undefined; break;
|
|
}
|
|
return ret;
|
|
}
|
|
var dateFormat = function () {
|
|
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
|
|
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
|
|
timezoneClip = /[^-+\dA-Z]/g,
|
|
pad = function (val, len) {
|
|
val = String(val);
|
|
len = len || 2;
|
|
while (val.length < len) val = "0" + val;
|
|
return val;
|
|
};
|
|
|
|
// Regexes and supporting functions are cached through closure
|
|
return function (date, mask, utc) {
|
|
var dF = dateFormat;
|
|
|
|
// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
|
|
if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
|
|
mask = date;
|
|
date = undefined;
|
|
}
|
|
|
|
// Passing date through Date applies Date.parse, if necessary
|
|
date = date ? new Date(date) : new Date;
|
|
if (isNaN(date)) throw SyntaxError("invalid date");
|
|
|
|
mask = String(dF.masks[mask] || mask || dF.masks["default"]);
|
|
|
|
// Allow setting the utc argument via the mask
|
|
if (mask.slice(0, 4) == "UTC:") {
|
|
mask = mask.slice(4);
|
|
utc = true;
|
|
}
|
|
|
|
var _ = utc ? "getUTC" : "get",
|
|
d = date[_ + "Date"](),
|
|
D = date[_ + "Day"](),
|
|
m = date[_ + "Month"](),
|
|
y = date[_ + "FullYear"](),
|
|
H = date[_ + "Hours"](),
|
|
M = date[_ + "Minutes"](),
|
|
s = date[_ + "Seconds"](),
|
|
L = date[_ + "Milliseconds"](),
|
|
o = utc ? 0 : date.getTimezoneOffset(),
|
|
flags = {
|
|
d: d,
|
|
dd: pad(d),
|
|
ddd: dF.i18n.dayNames[D],
|
|
dddd: dF.i18n.dayNames[D + 7],
|
|
m: m + 1,
|
|
mm: pad(m + 1),
|
|
mmm: dF.i18n.monthNames[m],
|
|
mmmm: dF.i18n.monthNames[m + 12],
|
|
yy: String(y).slice(2),
|
|
yyyy: y,
|
|
h: H % 12 || 12,
|
|
hh: pad(H % 12 || 12),
|
|
H: H,
|
|
HH: pad(H),
|
|
M: M,
|
|
MM: pad(M),
|
|
s: s,
|
|
ss: pad(s),
|
|
l: pad(L, 3),
|
|
L: pad(L > 99 ? Math.round(L / 10) : L),
|
|
t: H < 12 ? "a" : "p",
|
|
tt: H < 12 ? "am" : "pm",
|
|
T: H < 12 ? "A" : "P",
|
|
TT: H < 12 ? "AM" : "PM",
|
|
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
|
|
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
|
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
|
|
};
|
|
|
|
return mask.replace(token, function ($0) {
|
|
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
|
|
});
|
|
};
|
|
}();
|
|
|
|
// Some common format strings
|
|
dateFormat.masks = {
|
|
"default": "ddd mmm dd yyyy HH:MM:ss",
|
|
shortDate: "m/d/yy",
|
|
mediumDate: "mmm d, yyyy",
|
|
longDate: "mmmm d, yyyy",
|
|
fullDate: "dddd, mmmm d, yyyy",
|
|
shortTime: "h:MM TT",
|
|
mediumTime: "h:MM:ss TT",
|
|
longTime: "h:MM:ss TT Z",
|
|
isoDate: "yyyy-mm-dd",
|
|
isoTime: "HH:MM:ss",
|
|
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
|
|
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
|
|
};
|
|
|
|
// Internationalization strings
|
|
dateFormat.i18n = {
|
|
dayNames: [
|
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
|
|
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
|
],
|
|
monthNames: [
|
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
|
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
|
]
|
|
};
|
|
//END REGION
|
|
function GetDirecciones(posicion, infowindow, marker) {
|
|
if (marker.formatted_address) { return false; }
|
|
else if (marker.formatted_addressrow) {
|
|
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'>" + "Dirección: " + marker.formatted_addressrow + "</div>");
|
|
marker.formatted_address = marker.formatted_addressrow
|
|
}
|
|
else {
|
|
var lat = posicion.lat
|
|
var lng = posicion.lng
|
|
var url = '<%= ClsPaginas.UrlDirecciones%>' + '/nominatim/reverse.php?format=jsonv2&lat=' + lat + '&lon=' + lng;
|
|
$.getJSON(url, function (data) {
|
|
if (typeof (data.error) === 'undefined') {
|
|
marker.formatted_address = data.display_name
|
|
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'>" + "Dirección: " + data.display_name + "</div>");
|
|
|
|
} else {
|
|
marker.formatted_address = "Dirección no encontrada";
|
|
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'> Dirección: No Encontrada </div>");
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
<script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places", Extensiones.GOOGLE_MAPS_API_KEY) %>"</script>
|
|
</asp:Content>
|
|
|