Exportar Historico Excel, liga gps
This commit is contained in:
@@ -551,7 +551,7 @@
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="15%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:BoundField DataField="Fecha" ItemStyle-Width="15%" HeaderText="Fecha Reporte" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:TemplateField ItemStyle-Width="30%" HeaderText="Dirección" ItemStyle-HorizontalAlign="center">
|
||||
<asp:TemplateField ItemStyle-Width="30%" HeaderText="Dirección" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:Literal runat="server" Text="Haga click para ver Dirección" ID="ltlDireccion"></asp:Literal>
|
||||
</ItemTemplate>
|
||||
@@ -1796,7 +1796,7 @@
|
||||
var largo;
|
||||
var url = '<%= ClsPaginas.UrlDirecciones%>' + 'nominatim/reverse.php?format=jsonv2&lat=' + lat + '&lon=' + lng;
|
||||
|
||||
if ($("#HdnOpcion").val() === 'All' || $("#HdnOpcion").val() === 'TPS') { largo = 37 } else { largo = 74 }
|
||||
if ($("#HdnOpcion").val() === 'All' || $("#HdnOpcion").val() === 'TPS') { largo = 150 } else { largo = 150 }
|
||||
if ($())
|
||||
$.getJSON(url, function (data) {
|
||||
if (typeof (data.error) === 'undefined') {
|
||||
@@ -1880,7 +1880,7 @@
|
||||
if (indice > -1) {
|
||||
if (data.display_name.length > 74) {
|
||||
if (typeof (tr) !== 'undefined') {
|
||||
tr.cells[2].innerHTML = data.display_name.substring(0, 74) + '...'
|
||||
tr.cells[2].innerHTML = data.display_name.substring(0, 150) + '...'
|
||||
}
|
||||
} else {
|
||||
if (typeof (tr) !== 'undefined') {
|
||||
|
||||
@@ -1599,9 +1599,9 @@ Partial Class GPS_Rastreo
|
||||
End If
|
||||
ElseIf Opcion = "Last" AndAlso Format = "EXCEL" Then
|
||||
GenerarReporteUltimaPosicionExcel("UltimaPosicion.xlsx")
|
||||
ElseIf Opcion = "All" Then
|
||||
ElseIf Opcion = "All" AndAlso Format = "PDF" Then
|
||||
If GvBarra.Rows.Count > 0 Then
|
||||
RutaReporte = "Empresas/Grales/ReportesProgramados/RPTHistorico.rdlc"
|
||||
RutaReporte = ""
|
||||
NombreReporte = "ReporteHistorico"
|
||||
Try
|
||||
ImprimirCrystal(NombreReporte, Format)
|
||||
@@ -1610,6 +1610,19 @@ Partial Class GPS_Rastreo
|
||||
End Try
|
||||
Else
|
||||
Alert("No se pudo imprimir el pdf, ya que no se ha hecho una consulta, o ésta no arrojó resultados.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ElseIf Opcion = "All" AndAlso Format = "EXCEL" Then
|
||||
If GvBarra.Rows.Count > 0 Then
|
||||
RutaReporte = ""
|
||||
NombreReporte = "ReporteHistorico"
|
||||
Try
|
||||
ImprimirExcelGembox("Reporte Historico", NombreReporte, txtFechaI.Text, txtFechaF.Text)
|
||||
Catch ex As Exception
|
||||
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
|
||||
End Try
|
||||
Else
|
||||
Alert("No se pudo imprimir el pdf, ya que no se ha hecho una consulta, o ésta no arrojó resultados.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ElseIf Opcion = "Speed" Then
|
||||
RutaReporte = "Empresas/Grales/ReportesProgramados/RPVelocidad.rdlc"
|
||||
@@ -1882,6 +1895,157 @@ Partial Class GPS_Rastreo
|
||||
|
||||
ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/ReportesProgramados/RPTHistorico.rpt"), DtDatos, RptParametro, NombreReporte, Format), NombreReporte, Format)
|
||||
DtDatos.Clear()
|
||||
End Sub
|
||||
|
||||
Private Sub ImprimirExcelGembox(Titulo As String, NombreReporte As String, FechaI As String, FechaF As String)
|
||||
|
||||
Dim DtDatos As New DataTable()
|
||||
|
||||
DtDatos.Columns.Add("Vehiculo", GetType(String))
|
||||
DtDatos.Columns.Add("Fecha", GetType(String))
|
||||
DtDatos.Columns.Add("Direccion", GetType(String))
|
||||
DtDatos.Columns.Add("TiempoDetenido", GetType(String))
|
||||
DtDatos.Columns.Add("Conductor", GetType(String))
|
||||
DtDatos.Columns.Add("Velocidad", GetType(String))
|
||||
DtDatos.Columns.Add("Evento", GetType(String))
|
||||
DtDatos.Columns.Add("LatLng", GetType(String))
|
||||
|
||||
Try
|
||||
Dim Direcciones As JArray = ConsultarDirecciones(DtPosiciones)
|
||||
For Each row As DataRow In DtPosiciones.Rows
|
||||
Dim DrNew = DtDatos.NewRow()
|
||||
DrNew("Vehiculo") = row("Vehiculo")
|
||||
DrNew("Fecha") = row("Fecha")
|
||||
DrNew("TiempoDetenido") = row("TiempoDetenido")
|
||||
DrNew("Evento") = row("Evento")
|
||||
DrNew("Velocidad") = row("Velocidad")
|
||||
DrNew("Direccion") = "Dirección no encontrada"
|
||||
DrNew("LatLng") = row("Posicion").ToString.Replace("{", "").Replace("}", "")
|
||||
DtDatos.Rows.Add(DrNew)
|
||||
Next
|
||||
For Each Dir As JObject In Direcciones
|
||||
DtDatos.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString()
|
||||
Next
|
||||
Catch ex As Exception
|
||||
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
|
||||
End Try
|
||||
|
||||
Dim DtExcel As DataTable = DtDatos.Copy()
|
||||
|
||||
If DtExcel.Rows.Count < 1 Then
|
||||
Alert("No hay resutados en la busqueda.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
DtExcel.TableName = "Historico"
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim Divisor As Integer = 1
|
||||
|
||||
Dim FileExcel As New ExcelFile()
|
||||
|
||||
Dim worksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
|
||||
Dim TotalRowHeader As Integer = 8
|
||||
Dim TotalRowFooter As Integer = 2
|
||||
|
||||
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
|
||||
RangoNombreEmpresa.Value = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=UsuarioActual.CveCliente).FiltroPrimeroValor("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 FechaI.Length > 0 And FechaF.Length > 0 Then
|
||||
Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
|
||||
RangoFechas.Merged = True
|
||||
RangoFechas.Value = $"Fechas: {FechaI} a {FechaF}"
|
||||
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
|
||||
|
||||
|
||||
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 = DtExcel.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 As Integer = 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
|
||||
|
||||
FileExcel.Save(Response, $"{NombreReporte}.xlsx", SaveOptions.XlsxDefault)
|
||||
End Sub
|
||||
Private Sub ImprimirRDLC(NombreReporte As String, Format As String, RutaReporte As String)
|
||||
Dim RptParametro As New List(Of ReportParameter)
|
||||
@@ -2233,6 +2397,7 @@ Partial Class GPS_Rastreo
|
||||
|
||||
Using wc As New HttpClient()
|
||||
Try
|
||||
wc.Timeout = New TimeSpan(0, 6, 0)
|
||||
Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones))
|
||||
Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array)
|
||||
Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded")
|
||||
|
||||
@@ -576,12 +576,18 @@ Partial Class Sistemas_PopUpAddUsuario
|
||||
Application("GlobalDTUsuarioResponsable") = ObjUsuarios.DtResultados.FiltraParametros("ProveedoresResponsables > 0")
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "MANDAR CORREOS"
|
||||
Private Function EnviaCorreo(Liga As String, LigaActivar As String) As String
|
||||
Dim Retorno As String = ""
|
||||
Try
|
||||
Dim URL As String = UrlSitio
|
||||
|
||||
If UsuarioActual.Empresa.CvePlataforma = 3 Then
|
||||
URL = "https://gps.signalsgps.com/"
|
||||
End If
|
||||
|
||||
Dim Para = TxtEmail.Text.Trim
|
||||
Dim Asunto = ""
|
||||
If CveCliente > 0 Then
|
||||
@@ -621,7 +627,7 @@ Partial Class Sistemas_PopUpAddUsuario
|
||||
SBBody.Append("<div Class='nota'>")
|
||||
SBBody.Append("Nota Favor de NO responder este correo. ")
|
||||
SBBody.Append("</div><br/><br/>")
|
||||
SBBody.AppendFormat("<div class='logo'><img src='{0}Imagenes/LogoSinFondo.png' style='width:30px;'/>ADSistemas </div>", UrlSitio)
|
||||
SBBody.AppendFormat("<div class='logo'><img src='{0}Imagenes/LogoSinFondo.png' style='width:30px;'/>ADSistemas </div>", URL)
|
||||
SBBody.Append("</div>")
|
||||
SBBody.Append("</div>")
|
||||
'Termino Cuerpo del correo
|
||||
|
||||
Reference in New Issue
Block a user