This commit is contained in:
rakcsle
2021-11-30 23:22:20 -07:00
15 changed files with 855 additions and 339 deletions

View File

@@ -46,27 +46,45 @@ Public Class ClsSisNotificaciones
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'PARA REGISTRAR CONEXION
Private CveConexion As Integer = 0
Private CveConexion As Integer = 0
#End Region
#Region "P R O P I E D A D E S"
'Public ReadOnly Property FirebaseWebService As String
' Get
' Return ConfigurationManager.AppSettings("FirebaseWebService").ToString()
' End Get
'End Property
'Public ReadOnly Property FirebaseServerKey As String
' Get
' Return ConfigurationManager.AppSettings("FirebaseServerKey").ToString()
' End Get
'End Property
'Public ReadOnly Property SenderID As String
' Get
' Return ConfigurationManager.AppSettings("SenderID").ToString()
' End Get
'End Property
'Push Notifications
'Public ReadOnly Property FirebaseWebService As String
' Get
' Return ConfigurationManager.AppSettings("FirebaseWebService").ToString()
' End Get
'End Property
'Public ReadOnly Property FirebaseServerKey As String
' Get
' Return ConfigurationManager.AppSettings("FirebaseServerKey").ToString()
' End Get
'End Property
'Public ReadOnly Property SenderID As String
' Get
' Return ConfigurationManager.AppSettings("SenderID").ToString()
' End Get
'End Property
'Push Notifications
ReadOnly Property GlobalDTUsuarios(Optional CveUsuario As Integer = -1, Optional CveEmpresa As Integer = -1, Optional CveCliente As Integer = -1, Optional CveProveedor As Integer = -1) As DataTable
Get
Dim Str As New StringBuilder
If CveUsuario <> -1 Then Str.AppendFormat("CveUsuario = {0}", CveUsuario)
If CveEmpresa <> -1 Then Str.AppendFormat(" {0} CveEmpresa = {1}", If(Str.Length > 0, "AND", ""), CveEmpresa)
If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente)
If CveProveedor <> -1 Then Str.AppendFormat(" {0} CveProveedor = {1}", If(Str.Length > 0, "AND", ""), CveProveedor)
If CveUsuario <> -1 OrElse CveEmpresa <> -1 Then
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTUsuarios"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
GlobalDTUsuarios = Dv.ToTable
Dv.Dispose()
Else
GlobalDTUsuarios = DirectCast(HttpContext.Current.Application("GlobalDTUsuarios"), DataTable)
End If
End Get
End Property
Public Const FirebaseWebService As String = "https://fcm.googleapis.com/fcm/send"
Public Const FirebaseServerKey As String = "AAAAqx0xsBA:APA91bHip_JcMGhNQiIzdnodY9ynkHIjX9wEc4TrLkepXK0Lz1QEar5dys6sa3ourPLGiEJD4fGGnSzrk2M_9aJuQo55LjvSJs2c1bU74u-yArMcbI0F_cKzbYAcOMRc8pbRknuWGsXX"
Public Const SenderID As String = "734929203216"
@@ -141,10 +159,11 @@ Public Class ClsSisNotificaciones
End If
End Sub
End Sub
#End Region
#Region "N O T I F I C A C I O N E S"
Public Sub DispararNotificacion(CveNotificacion As Integer, CvesFiltro As List(Of Object), CveEmpresa As Integer)
_CveNotificacion = CveNotificacion
_CveEmpresa = CveEmpresa
@@ -228,12 +247,48 @@ Public Class ClsSisNotificaciones
OnError("Ocurrió error al mandar el Mail", ex)
End Try
ObjNotificacion.Dispose()
End Sub
End Sub
#End Region
#Region "V A L I D A - U S U A R I O"
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
Dim UsuarioActual As Usuario = Nothing
Dim ObjUsuarios As New ClsSisUsuarios
If ObjUsuarios.GetUsuarios(100) Then
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa)
UsuarioActual.CveEmpresa = CveEmpresa
CreaObjetoEmpresa(UsuarioActual)
End If
End If
ObjUsuarios.Dispose()
Return UsuarioActual
End Function
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
Dim ObjEmpresa As New ClsSisEmpresas()
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
Dim EmpresasFuncionalidades As New HybridDictionary
For Each Row As Data.DataRow In dttmp.Rows
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
Next
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
End If
UsuarioActual.Empresa = ObjEmpresa.Empresa
End If
ObjEmpresa.Dispose()
End Sub
#End Region
#Region "N O T I F I C A C I O N E S - M E T O D O S G E N E R A L E S"
Public Function ObtenerNotificaciones() As Boolean
If Not GetNotificacionesBitacoraPendientes(1000) Then
@@ -260,21 +315,31 @@ Public Class ClsSisNotificaciones
End Function
Public Sub ArmarReportesProgramados()
Try
Try
For Each RowReporte As DataRow In DTReportesProgramados.Rows
Dim CveReporteProgramado As Integer = RowReporte("CveReporteProgramado").ToString.ToEntero
Dim CveNotificacionBitacora As Integer = RowReporte("CveNotificacionBitacora").ToString.ToEntero
Dim Correos As String = RowReporte("Correos").ToString
Dim NombreCliente As String = RowReporte("Cliente").ToString
Dim FechaI As DateTime = RowReporte("FechaI").ToString.ToDateTime
Dim FechaF As DateTime = RowReporte("FechaF").ToString.ToDateTime
Dim CveReporte As Integer = RowReporte("CveReporte").ToString.ToEntero
Dim CveCliente As Integer = RowReporte("CveCliente").ToString.ToEntero
Dim CveEmpresa As Integer = RowReporte("CveEmpresa").ToString.ToEntero
Dim DtExtras As DataTable = Nothing
Dim DtDispositivos As DataTable = Nothing
Dim Formato As String = RowReporte("Formato").ToString
Dim UsuarioActual As Usuario = ValidaUsuarioSistema(CveEmpresa)
Dim ObjGPS As New ClsGPS
If CveReporte.Contiene(1, 2, 3, 4, 5, 6, 7, 8) Then
If CveReporte.Contiene(1, 2, 3, 4, 5, 6, 7, 8, 10) Then
If ObjGPS.ReportesProgramadosDispositivosGet(CveReporteProgramado) Then
DtDispositivos = ObjGPS.DtResultados.Copy()
End If
@@ -286,7 +351,7 @@ Public Class ClsSisNotificaciones
End If
ObjGPS.Dispose()
EnviarReporteProgramado(CveCliente, Formato, Correos, FechaI, FechaF, CveReporte, CveNotificacionBitacora, DtDispositivos, DtExtras)
EnviarReporteProgramado(CveCliente, NombreCliente, Formato, Correos, FechaI, FechaF, CveReporte, CveNotificacionBitacora, DtDispositivos, DtExtras, UsuarioActual)
If DtExtras IsNot Nothing Then
DtExtras.Clear()
@@ -297,6 +362,10 @@ Public Class ClsSisNotificaciones
DtDispositivos.Clear()
DtDispositivos.Dispose()
End If
If UsuarioActual IsNot Nothing Then
UsuarioActual = Nothing
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al enviar el reporte programado", ex)
@@ -311,11 +380,12 @@ Public Class ClsSisNotificaciones
' Return New DataTable()
'End Function
Public Sub EnviarReporteProgramado(CveCliente As Integer, Formato As String, Correos As String, FechaI As DateTime, FechaF As DateTime, CveReporte As Integer, CveNotificacionBitacora As Integer, DtDispositivos As DataTable, DtExtras As DataTable)
Public Sub EnviarReporteProgramado(CveCliente As Integer, NombreCliente As String, Formato As String, Correos As String, FechaI As DateTime, FechaF As DateTime, CveReporte As Integer, CveNotificacionBitacora As Integer, DtDispositivos As DataTable, DtExtras As DataTable, UsuarioActual As Usuario)
Dim CveDispositivo As Integer = -1
Dim NombreVehiculo As String = ""
Dim RutaReporte As String
Dim retorno As Byte() = Nothing
Select Case CveReporte
Case 1 'Ultima Posicion
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
@@ -397,7 +467,7 @@ Public Class ClsSisNotificaciones
GuardaLog(String.Format("Ocurrio un error al obtener las direcciones {0}", ex))
End Try
If Formato = "PDF" Then
retorno = GenerarReporteHistorico(ObjGPS.DtResultados, RutaReporte, FechaI, FechaF, Correos, NombreReporte)
retorno = GenerarReporteHistorico(ObjGPS.DtResultados, RutaReporte, FechaI, FechaF, Correos, NombreReporte, NombreCliente, UsuarioActual)
ElseIf Formato = "Excel" Then
ObjGPS.DtResultados.TableName = NombreVehiculo
DataSource.Tables.Add(ObjGPS.DtResultados)
@@ -496,7 +566,7 @@ Public Class ClsSisNotificaciones
Next
Dim NombreArchivo As String = ""
If Formato = "Excel" Then
retorno = GenerarReporteEventosExcel(ObjGPS.DtResultados, FechaI, FechaF, Correos)
retorno = GenerarReporteEventosExcel(DtDispositivos, ObjGPS.DtResultados, FechaI, FechaF, Correos)
NombreArchivo = "ReporteEventos.xlsx"
ElseIf Formato = "PDF" Then
retorno = GenerarReporteEventos(ObjGPS.DtResultados, RutaReporte, FechaI, FechaF, Correos)
@@ -642,96 +712,162 @@ Public Class ClsSisNotificaciones
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try
ObjGPS.Dispose()
'Case 8 ' Subida/Bajada de Pasajeros
' Dim PasajerosEntrada, PasajerosSalida, Ascensos, Descensos As Integer
' PasajerosSalida = 0
' PasajerosEntrada = 0
' Ascensos = 0
' Descensos = 0
' If GetCambioPasajeros(RowNotificacion("Valor").ToString.ToEntero, RowNotificacion("CveDispositivoGPS").ToString.ToEntero, RowNotificacion("CveUsuario")) Then
' If DtResultados.Rows.Count > 0 Then
' Dim ObjMail As New ClsSisMail()
' Dim SBuilder As New StringBuilder
' SBuilder.Append($"<div>")
' SBuilder.Append($"<div><h5><b>Reporte de pasajeros del dispositivo {DtResultados(0)("NoEconomico").ToString}.</b></a></h5></div>")
' SBuilder.Append($"<div><table>")
' For Each row In DtResultados.Rows
' If row("CveEvento").ToString.ToEntero = 103 Then
' PasajerosEntrada = row("Pasajeros")
' Ascensos = row("Ascensos").ToString.ToEntero
' Descensos = row("Descensos").ToString.ToEntero
' SBuilder.Append($"<tr><td>Fecha: {row("FechaEvento").ToString} &emsp; {row("Evento").ToString} '{row("GeoReferencia").ToString}' &emsp; <b>Pasajeros: {row("Pasajeros")}</b></td></tr>")
' Else
' PasajerosSalida = row("Pasajeros") + PasajerosEntrada
' Ascensos = row("Ascensos").ToString.ToEntero
' Descensos = row("Descensos").ToString.ToEntero
' SBuilder.Append($"<tr><td>Fecha: {row("FechaEvento").ToString} &emsp; {row("Evento").ToString} '{row("GeoReferencia").ToString}' &emsp; <b>Pasajeros: {PasajerosSalida}</b></td></tr>")
' End If
' Next
' If PasajerosEntrada <> PasajerosSalida Then
' SBuilder.Append($"<tr>Hubo un {If(PasajerosSalida > PasajerosEntrada, "aumento", "decremento")} de {PasajerosSalida - PasajerosEntrada} pasajeros ({Ascensos} ascenso(s), {Descensos} descenso(s)) </tr>")
' Else
' SBuilder.Append($"<tr>No hubo cambios en el número de pasajeros </tr>")
' End If
' SBuilder.Append($"</table></div><div></div></div>")
' Dim ResultadoMail As Integer = 0
' If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, DtResultados(0)("Correo").ToString, $"Reporte de pasajeros. Geocerca {DtResultados(0)("GeoReferencia").ToString}", SBuilder.ToString) Then
' UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
' End If
' End If
' End If
'Case 9 'Reporte de Rutas
' If ArmarReporteProgramadoParadas(CveNotificacionBitacora) AndAlso DtResultados.Rows.Count > 0 Then
' RutaReporte = "Empresas/Grales/ReportesProgramados/RPTParadas.rdlc"
' Dim ObjEmpresa As New ClsSisEmpresas()
' Dim ObjGPS As New ClsGPS
' Try
' Dim RowParada As DataRow = DtResultados.Rows(0)
' Dim RptParametro As List(Of ReportParameter) = New List(Of ReportParameter)
' If ObjGPS.GetRepParadas(RowParada("CveGrupo").ToString.ToEntero, RowParada("FechaInicio").ToString.ToDateTime, RowParada("FechaNotificacion").ToString.ToDateTime, RowParada("CveCliente").ToString.ToEntero) Then
' If ObjGPS.DtResultados.Rows.Count > 0 Then
' RptParametro.Add(New ReportParameter("FechaInicio", RowParada("FechaInicio").ToString))
' RptParametro.Add(New ReportParameter("FechaFin", RowParada("FechaNotificacion").ToString))
' RptParametro.Add(New ReportParameter("UsuarioImprimio", RowParada("UsuarioImprimio").ToString))
' RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
' RptParametro.Add(New ReportParameter("Grupo", RowParada("Grupo").ToString))
' Dim RowRep As DataRow = ObjGPS.DtResultados.FiltroPrimero("TipoColumna=1")
' Dim MejorC As String = ObjGPS.DtResultados.FiltroPrimeroValor("Conductor", "CveConductor IS NOT NULL AND TotalEventos IS NOT NULL", "TotalEventos ASC")
' RptParametro.Add(New ReportParameter("TotalGeneral", RowRep("Importe").ToString.ToDecimal))
' RptParametro.Add(New ReportParameter("NumEventos", RowRep("TotalEventos").ToString.ToEntero))
' RptParametro.Add(New ReportParameter("MejorConductor", MejorC))
' retorno = StreamPDF(RutaReporte, ObjGPS.DtResultados, RptParametro, "ReporteProgramado", "PDF", MR:=Nothing, RDSName:="DsOC")
' End If
' End If
' Dim ObjMail As New ClsSisMail()
' Dim ResultadoMail As Integer = 0
' Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
' LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = retorno, .NombreArchivo = "ReporteProgramado.pdf"})
' If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, DtResultados(0)("Correos").ToString, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
' UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
' End If
' Catch ex As Exception
' GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
' End Try
' ObjGPS.Dispose()
' End If
Case 10 'Reporte de Ignicion
Dim ObjGPS As New ClsGPS
Try
RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPIgnicion.rdlc"
Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0
Dim Archivos As New List(Of ClsSisMail.ArchivoMail)
Dim NombreReporte As String = "Reporte"
Dim DataSource As DataSet = Nothing
If Formato = "Excel" Then
DataSource = New DataSet()
End If
For Each RowDisp As DataRow In DtDispositivos.Rows
CveDispositivo = RowDisp("CveDispositivo").ToString().ToEntero
NombreVehiculo = RowDisp("NombreVehiculo").ToString()
NombreReporte = $"Reporte_Ignicion_{NombreVehiculo}_{FechaI.ToString("yyyy_MM_dd_HH_mm_ss")}_{ FechaF.ToString("yyyy_MM_dd_HH_mm_ss")}"
Dim DireccionesInicial As JArray = Nothing, DireccionesFinal As JArray = Nothing
If ObjGPS.GetRepIgnicion(CveDispositivo, FechaI, FechaF, CveCliente) Then
Try
DireccionesInicial = ConsultarDireccionesIgnicion(ObjGPS.DtResultados, "CveTramaEncendido", "LatitudInicial", "LongitudInicial")
DireccionesFinal = ConsultarDireccionesIgnicion(ObjGPS.DtResultados, "CveTramaApagado", "LatitudFinal", "LongitudFinal")
For Each Dir As JObject In DireccionesInicial
ObjGPS.DtResultados.Rows(Dir("Indice").ToEntero())("DireccionInical") = Dir("Direccion").ToString()
Next
For Each Dir As JObject In DireccionesFinal
ObjGPS.DtResultados.Rows(Dir("Indice").ToEntero())("DireccionFinal") = Dir("Direccion").ToString()
Next
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al obtener las direcciones {0}", ex))
End Try
If Formato = "PDF" Then
retorno = GenerarReporteIgnicion(ObjGPS.DtResultados, RutaReporte, FechaI, FechaF, Correos, NombreReporte)
ElseIf Formato = "Excel" Then
ObjGPS.DtResultados.TableName = NombreVehiculo
DataSource.Tables.Add(ObjGPS.DtResultados)
End If
End If
If retorno IsNot Nothing Then
Archivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = retorno, .NombreArchivo = $"{NombreReporte}.pdf"})
End If
Next
If DataSource IsNot Nothing Then
NombreReporte = $"Reporte_Ignicion_{FechaI.ToString("yyyy_MM_dd_HH_mm_ss")}_{ FechaF.ToString("yyyy_MM_dd_HH_mm_ss")}"
retorno = GenerarReporteIgnicionExcel(DataSource, RutaReporte, FechaI, FechaF, Correos, NombreReporte)
If retorno IsNot Nothing Then
Archivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = retorno, .NombreArchivo = $"{NombreReporte}.xlsx"})
End If
End If
If Archivos.Count > 0 Then
If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", $"Se adjunta el {Formato} en el Reporte Programado.", "", Archivos) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If
End If
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try
ObjGPS.Dispose()
'Case 8 ' Subida/Bajada de Pasajeros
' Dim PasajerosEntrada, PasajerosSalida, Ascensos, Descensos As Integer
' PasajerosSalida = 0
' PasajerosEntrada = 0
' Ascensos = 0
' Descensos = 0
' If GetCambioPasajeros(RowNotificacion("Valor").ToString.ToEntero, RowNotificacion("CveDispositivoGPS").ToString.ToEntero, RowNotificacion("CveUsuario")) Then
' If DtResultados.Rows.Count > 0 Then
' Dim ObjMail As New ClsSisMail()
' Dim SBuilder As New StringBuilder
' SBuilder.Append($"<div>")
' SBuilder.Append($"<div><h5><b>Reporte de pasajeros del dispositivo {DtResultados(0)("NoEconomico").ToString}.</b></a></h5></div>")
' SBuilder.Append($"<div><table>")
' For Each row In DtResultados.Rows
' If row("CveEvento").ToString.ToEntero = 103 Then
' PasajerosEntrada = row("Pasajeros")
' Ascensos = row("Ascensos").ToString.ToEntero
' Descensos = row("Descensos").ToString.ToEntero
' SBuilder.Append($"<tr><td>Fecha: {row("FechaEvento").ToString} &emsp; {row("Evento").ToString} '{row("GeoReferencia").ToString}' &emsp; <b>Pasajeros: {row("Pasajeros")}</b></td></tr>")
' Else
' PasajerosSalida = row("Pasajeros") + PasajerosEntrada
' Ascensos = row("Ascensos").ToString.ToEntero
' Descensos = row("Descensos").ToString.ToEntero
' SBuilder.Append($"<tr><td>Fecha: {row("FechaEvento").ToString} &emsp; {row("Evento").ToString} '{row("GeoReferencia").ToString}' &emsp; <b>Pasajeros: {PasajerosSalida}</b></td></tr>")
' End If
' Next
' If PasajerosEntrada <> PasajerosSalida Then
' SBuilder.Append($"<tr>Hubo un {If(PasajerosSalida > PasajerosEntrada, "aumento", "decremento")} de {PasajerosSalida - PasajerosEntrada} pasajeros ({Ascensos} ascenso(s), {Descensos} descenso(s)) </tr>")
' Else
' SBuilder.Append($"<tr>No hubo cambios en el número de pasajeros </tr>")
' End If
' SBuilder.Append($"</table></div><div></div></div>")
' Dim ResultadoMail As Integer = 0
' If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, DtResultados(0)("Correo").ToString, $"Reporte de pasajeros. Geocerca {DtResultados(0)("GeoReferencia").ToString}", SBuilder.ToString) Then
' UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
' End If
' End If
' End If
'Case 9 'Reporte de Rutas
' If ArmarReporteProgramadoParadas(CveNotificacionBitacora) AndAlso DtResultados.Rows.Count > 0 Then
' RutaReporte = "Empresas/Grales/ReportesProgramados/RPTParadas.rdlc"
' Dim ObjEmpresa As New ClsSisEmpresas()
' Dim ObjGPS As New ClsGPS
' Try
' Dim RowParada As DataRow = DtResultados.Rows(0)
' Dim RptParametro As List(Of ReportParameter) = New List(Of ReportParameter)
' If ObjGPS.GetRepParadas(RowParada("CveGrupo").ToString.ToEntero, RowParada("FechaInicio").ToString.ToDateTime, RowParada("FechaNotificacion").ToString.ToDateTime, RowParada("CveCliente").ToString.ToEntero) Then
' If ObjGPS.DtResultados.Rows.Count > 0 Then
' RptParametro.Add(New ReportParameter("FechaInicio", RowParada("FechaInicio").ToString))
' RptParametro.Add(New ReportParameter("FechaFin", RowParada("FechaNotificacion").ToString))
' RptParametro.Add(New ReportParameter("UsuarioImprimio", RowParada("UsuarioImprimio").ToString))
' RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
' RptParametro.Add(New ReportParameter("Grupo", RowParada("Grupo").ToString))
' Dim RowRep As DataRow = ObjGPS.DtResultados.FiltroPrimero("TipoColumna=1")
' Dim MejorC As String = ObjGPS.DtResultados.FiltroPrimeroValor("Conductor", "CveConductor IS NOT NULL AND TotalEventos IS NOT NULL", "TotalEventos ASC")
' RptParametro.Add(New ReportParameter("TotalGeneral", RowRep("Importe").ToString.ToDecimal))
' RptParametro.Add(New ReportParameter("NumEventos", RowRep("TotalEventos").ToString.ToEntero))
' RptParametro.Add(New ReportParameter("MejorConductor", MejorC))
' retorno = StreamPDF(RutaReporte, ObjGPS.DtResultados, RptParametro, "ReporteProgramado", "PDF", MR:=Nothing, RDSName:="DsOC")
' End If
' End If
' Dim ObjMail As New ClsSisMail()
' Dim ResultadoMail As Integer = 0
' Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
' LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = retorno, .NombreArchivo = "ReporteProgramado.pdf"})
' If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, DtResultados(0)("Correos").ToString, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
' UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
' End If
' Catch ex As Exception
' GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
' End Try
' ObjGPS.Dispose()
' End If
End Select
End Sub
End Sub
#Region "G E N E R A R - R E P O R T E"
Private Function GenerarReporteUltimaPosicion(DataSource As DataTable, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String) As Byte()
Dim Retorno As Byte() = Nothing
@@ -785,10 +921,15 @@ Public Class ClsSisNotificaciones
Return Retorno.ToArray()
End Function
Private Function GenerarReporteHistorico(DataSource As DataTable, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String, NombreReporte As String) As Byte()
Private Function GenerarReporteHistorico(DataSource As DataTable, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String, NombreReporte As String, NombreCliente As String, UsuarioActual As Usuario) As Byte()
Dim Retorno As Byte() = Nothing
Try
Dim RptParametro As New List(Of CrystalParametro)
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
RptParametro.Add(New CrystalParametro("FechaInicio", FechaI.ToString))
RptParametro.Add(New CrystalParametro("FechaFin", FechaF.ToString))
RptParametro.Add(New CrystalParametro("UsuarioImprimio", Correos))
@@ -797,7 +938,16 @@ Public Class ClsSisNotificaciones
RptParametro.Add(New CrystalParametro("KMRecorridos", $"{DataSource.Rows(0)("KMRecorridos")} KM"))
Else
RptParametro.Add(New CrystalParametro("KMRecorridos", "0 KM"))
End If
RptParametro.Add(New CrystalParametro("NombreEmpresa", NombreCliente))
If Imagen.Exists Then
RptParametro.Add(New CrystalParametro("LogoPath", logouri))
Else
RptParametro.Add(New CrystalParametro("LogoPath", ""))
End If
Retorno = StreamPDFCrystal(Liga, DataSource, RptParametro, NombreReporte, "PDF")
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
@@ -855,7 +1005,82 @@ Public Class ClsSisNotificaciones
DataSet.Dispose()
End If
Return Retorno.ToArray()
End Function
Private Function GenerarReporteIgnicion(DataSource As DataTable, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String, NombreReporte As String) As Byte()
Dim Retorno As Byte() = Nothing
Try
Dim RptParametro As New List(Of ReportParameter)
RptParametro.Add(New ReportParameter("FechaInicio", FechaI.ToString))
RptParametro.Add(New ReportParameter("FechaFin", FechaF.ToString))
RptParametro.Add(New ReportParameter("UsuarioImprimio", Correos))
RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
Retorno = StreamPDF(Liga, DataSource, RptParametro, "ReporteIgnicion", "PDF", MR:=Nothing, RDSName:="DsOC")
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try
Return Retorno
End Function
Private Function GenerarReporteIgnicionExcel(DataSource As DataSet, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String, NombreReporte As String) As Byte()
Dim Retorno As New MemoryStream()
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim FileExcel As ExcelFile = New ExcelFile
For Each Dt As DataTable In DataSource.Tables
Dt.Columns.Remove("CveDispositivo")
Dt.Columns.Remove("CveTramaEncendido")
Dt.Columns.Remove("CveTramaApagado")
Dt.Columns("Vehiculo").SetOrdinal(0)
Dt.Columns("Vehiculo").ColumnName = "Vehículo"
Dt.Columns("VMedia").ColumnName = "Velocidad Media"
Dt.Columns("VMax").ColumnName = "Velocidad Maxima"
Dt.Columns("FechaEncendido").ColumnName = "Fecha Encendido"
Dt.Columns("FechaApagado").ColumnName = "Fecha Apagado"
Dt.Columns("LatitudInicial").ColumnName = "Latitud Inicial"
Dt.Columns("LatitudFinal").ColumnName = "Latitud Final"
Dt.Columns("LongitudInicial").ColumnName = "Longitud Inicial"
Dt.Columns("LongitudFinal").ColumnName = "Longitud Final"
Dt.Columns("Duracion").ColumnName = "Duración"
Dt.Columns("DireccionInical").SetOrdinal(Dt.Columns.Count - 1)
Dt.Columns("DireccionInical").ColumnName = "Dirección Inicial"
Dt.Columns("DireccionFinal").SetOrdinal(Dt.Columns.Count - 1)
Dt.Columns("DireccionFinal").ColumnName = "Dirección Final"
Dim item = FileExcel.Worksheets.Add(Dt.TableName)
item.InsertDataTable(Dt, 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
Next
FileExcel.Save(Retorno, SaveOptions.XlsxDefault)
If DataSet IsNot Nothing Then
DataSet.Clear()
DataSet.Dispose()
End If
Return Retorno.ToArray()
End Function
Private Function GenerarReporteTiempoMuerto(DataSource As DataTable, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String, NombreReporte As String) As Byte()
Dim Retorno As Byte() = Nothing
Try
@@ -953,7 +1178,7 @@ Public Class ClsSisNotificaciones
End Function
Private Function GenerarReporteEventos(DataSource As DataTable, Liga As String, FechaI As DateTime, FechaF As DateTime, Correos As String) As Byte()
Dim Retorno As Byte() = Nothing
If DataSource IsNot Nothing AndAlso DataSource.Rows.Count > 0 Then
If DataSource IsNot Nothing Then
Try
Dim RptParametro As New List(Of CrystalParametro)
RptParametro.Add(New CrystalParametro("FechaInicio", FechaI.ToString))
@@ -970,15 +1195,16 @@ Public Class ClsSisNotificaciones
End If
Return Retorno
End Function
Private Function GenerarReporteEventosExcel(DataSource As DataTable, FechaI As DateTime, FechaF As DateTime, Correos As String) As Byte()
Private Function GenerarReporteEventosExcel(DtDispositivos As DataTable, DataSource As DataTable, FechaI As DateTime, FechaF As DateTime, Correos As String) As Byte()
Dim Retorno As New MemoryStream()
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim FileExcel As ExcelFile = New ExcelFile
Dim DtDispositivos As DataTable = DataSource.FiltraParametros("", "", {"CveDispositivo", "Unidad"})
'Dim DtDispositivos As DataTable = DataSource.FiltraParametros("", "", {"CveDispositivo", "Unidad"})
For Each Dr As DataRow In DtDispositivos.Rows
Dim CveDispositivo As Integer = Dr("CveDispositivo").ToString().ToEntero()
Dim NombreVehiculo = Dr("Unidad").ToString()
Dim NombreVehiculo = Dr("NombreVehiculo").ToString()
Dim FilterRows = DataSource.FiltraParametros($"CveDispositivo = {CveDispositivo}")
Dim Dt = GenerarDTEventos(NombreVehiculo, FilterRows)
@@ -1209,18 +1435,21 @@ Public Class ClsSisNotificaciones
dt.Columns.Add("Conductor", Type.GetType("System.String"))
dt.Columns.Add("Dirección", Type.GetType("System.String"))
For Each Row As DataRow In rows.Rows
Dim dr = dt.NewRow()
dr("Vehículo") = Row("Unidad").ToString()
dr("Fecha") = Row("Fecha").ToString().ToDateTime()
dr("Evento") = Row("Evento").ToString()
dr("Latitud") = Row("Lat").ToString().ToDouble()
dr("Longitud") = Row("Lon").ToString().ToDouble()
dr("Conductor") = Row("Conductor").ToString()
dr("Dirección") = Row("Direccion").ToString()
If rows IsNot Nothing Then
For Each Row As DataRow In rows.Rows
Dim dr = dt.NewRow()
dr("Vehículo") = Row("Unidad").ToString()
dr("Fecha") = Row("Fecha").ToString().ToDateTime()
dr("Evento") = Row("Evento").ToString()
dr("Latitud") = Row("Lat").ToString().ToDouble()
dr("Longitud") = Row("Lon").ToString().ToDouble()
dr("Conductor") = Row("Conductor").ToString()
dr("Dirección") = Row("Direccion").ToString()
dt.Rows.Add(dr)
Next
End If
dt.Rows.Add(dr)
Next
Return dt
End Function
@@ -2057,10 +2286,45 @@ Public Class ClsSisNotificaciones
End Try
End Using
Return retorno
End Function
End Function
Public Function ConsultarDireccionesIgnicion(Dt As DataTable, StrCveTrama As String, StrLatitud As String, StrLongitud As String) As JArray
Dim retorno As JArray = Nothing
Dim posicionesArray = New JArray(From Row As DataRow In Dt
Let index = Dt.Rows().IndexOf(Row)
Select New JObject(
New JProperty("indice", index),
New JProperty("cveTrama", Row(StrCveTrama).ToString.ToEntero),
New JProperty("lat", Row(StrLatitud).ToString.ToDouble),
New JProperty("lon", Row(StrLongitud).ToString.ToDouble)
))
Dim Base64array = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(posicionesArray.ToString()))
Using wc As New HttpClient()
Try
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")
Dim response = wc.PostAsync(Url, content).Result
Dim result = response.Content.ReadAsStringAsync().Result
retorno = JArray.Parse(result)
response.Dispose()
content = Nothing
Url = Nothing
FormStuff = Nothing
Catch ex As Exception
OnError("Ocurrió un error al obtener las direcciones", ex)
End Try
End Using
Return retorno
End Function
#Region " IDisposable Support "
' IDisposable
' IDisposable
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then

View File

@@ -2086,7 +2086,7 @@ Namespace Extensiones
End Sub
<Runtime.CompilerServices.Extension()>
Public Sub ExportToExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, FechaIMes As String, FechaFMes As String, Titulo As String, SubProyecto As String, Divisor As Integer, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional DatoTituloExtra As String = "")
Public Sub ExportToExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional DatoTituloExtra As String = "", Optional DatosFiltros As String = "", Optional AnchoImagen As Integer = 100, Optional AlturaImagen As Integer = 100)
Dim sw1 As New StringWriter()
Dim htw1 As New HtmlTextWriter(sw1)
@@ -2117,7 +2117,7 @@ Namespace Extensiones
If Usuario IsNot Nothing Then
Dim TotalRowHeader As Integer = 8
Dim TotalRowHeader As Integer = 6
Dim TotalRowFooter As Integer = 2
@@ -2143,50 +2143,44 @@ Namespace Extensiones
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 DatoTituloExtra.Length > 0 Then
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = DatoTituloExtra
RangoDatoTituloExtra.Style.Font.Size = 20 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
End If
If DatosFiltros.Length > 0 Then
Dim Arreglo As String() = DatosFiltros.Split("|"c)
worksheet.Rows.InsertEmpty(TotalRowHeader, Arreglo.Count)
For Each TextoFiltro As String In Arreglo
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = TextoFiltro
RangoDatoTituloExtra.Style.Font.Size = 12 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
TotalRowHeader += 1
Next
End If
TotalRowHeader += 2
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)
worksheet.Rows(TotalRowHeader).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(TotalRowHeader).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(TotalRowHeader).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(TotalRowHeader).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(TotalRowHeader).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
If i > 0 Then
Try
@@ -2221,7 +2215,7 @@ Namespace Extensiones
If I > 0 Then
If Divisor = 1 Then
If 1 = 1 Then
worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
Else
worksheet.Columns(I + 1).Style.NumberFormat = "#,##"

View File

@@ -148,23 +148,23 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
If Not IsNothing(obj) Then
nombre = obj.ToString()
End If
obj = context.Request("Correo")
obj = context.Request("Correo").Trim()
If Not IsNothing(obj) Then
correo = obj.ToString()
End If
obj = context.Request("Asunto")
obj = context.Request("Asunto").Trim()
If Not IsNothing(obj) Then
asunto = obj.ToString()
End If
obj = context.Request("Cuerpo")
obj = context.Request("Cuerpo").Trim()
If Not IsNothing(obj) Then
cuerpo = obj.ToString().Replace("< ", "<")
cuerpo = obj.ToString().Replace("< ", "<").Trim()
End If
Dim Body As String = String.Format("Prospecto : {0}<br/>Correo : {1}<br/>Asunto : {2}<br/><br/>{3}", nombre, correo, asunto, cuerpo)
Dim para As String = "contacto@localizacionprecisa.com;caudillo.90d@gmail.com;"
'para = ""
Dim Mail As New ClsSisMail()
If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "NotificaciónProspecto", Body) Then
If (nombre.Length > 0 Or correo.Length > 0) AndAlso Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "Notificación prospecto", Body) Then
retorno = "true"
Else
retorno = "false"
@@ -180,25 +180,25 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Dim cuerpo As String = ""
Dim obj = context.Request("Nombre") 'Nombre=' + $('#Nombre').val() +'Correo=' + $('#Correo').val() +'Sitio=' + $('#Sitio').val() +'Cuerpo=' + $('#Cuerpo').val() +
If Not IsNothing(obj) Then
nombre = obj.ToString()
nombre = obj.ToString().Trim()
End If
obj = context.Request("Correo")
If Not IsNothing(obj) Then
correo = obj.ToString()
correo = obj.ToString().Trim()
End If
obj = context.Request("Phone")
If Not IsNothing(obj) Then
Phone = obj.ToString()
Phone = obj.ToString().Trim()
End If
obj = context.Request("Cuerpo")
If Not IsNothing(obj) Then
cuerpo = obj.ToString().Replace("< ", "<")
cuerpo = obj.ToString().Replace("< ", "<").Trim()
End If
Dim Body As String = String.Format("Solicitó : {0}<br/>Correo : {1}<br/>Telefono : {2}<br/><br/>{3}", nombre, correo, Phone, cuerpo)
Dim para As String = "paola@adssistemas.mx;caudillo.90d@gmail.com;"
'para = ""
Dim Mail As New ClsSisMail()
If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "NotificaciónProspecto", Body) Then
If (nombre.Length > 0 Or correo.Length > 0) AndAlso Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "Notificación contacto pagina", Body) Then
retorno = "true"
Else
retorno = "false"
@@ -214,25 +214,25 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Dim cuerpo As String = ""
Dim obj = context.Request("Nombre") 'Nombre=' + $('#Nombre').val() +'Correo=' + $('#Correo').val() +'Sitio=' + $('#Sitio').val() +'Cuerpo=' + $('#Cuerpo').val() +
If Not IsNothing(obj) Then
nombre = obj.ToString()
nombre = obj.ToString().Trim()
End If
obj = context.Request("Correo")
obj = context.Request("Correo").Trim()
If Not IsNothing(obj) Then
correo = obj.ToString()
End If
obj = context.Request("Sitio")
obj = context.Request("Sitio").Trim()
If Not IsNothing(obj) Then
sitio = obj.ToString()
End If
obj = context.Request("Cuerpo")
obj = context.Request("Cuerpo").Trim()
If Not IsNothing(obj) Then
cuerpo = obj.ToString().Replace("< ", "<")
cuerpo = obj.ToString().Replace("< ", "<").Trim()
End If
Dim Body As String = String.Format("Prospecto : {0}<br/>Correo : {1}<br/>Sitio : {2}<br/><br/>{3}", nombre, correo, sitio, cuerpo)
Dim para As String = "rene.molina@adssistemas.mx,sig.buzon@gmail.com,julian@adssistemas.mx;paola@adssistemas.mx;caudillo.90d@gmail.com;"
'para = ""
Dim Mail As New ClsSisMail()
If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "NotificaciónProspecto", Body) Then
If (nombre.Length > 0 Or correo.Length > 0) AndAlso Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "NotificaciónProspecto", Body) Then
retorno = "true"
Else
retorno = "false"

View File

@@ -77,15 +77,6 @@ Public Class TareasProgramadas : Implements IHttpHandler
URLParametros = Parametros(context.Request("var"))
metodo = URLParametros("metodo")
'SI TRAE UN JSON COMO PARAMETRO
ElseIf context.Request.Headers("Content-Type") IsNot Nothing AndAlso context.Request.Headers("Content-Type").Contains("json") AndAlso context.Request.InputStream IsNot Nothing AndAlso (context.Request("var") Is Nothing AndAlso context.Request("metodo") IsNot Nothing) Then
context.Response.ContentType = "application/json"
Using reader As New StreamReader(context.Request.InputStream)
Dim json = reader.ReadToEnd()
Dim JsonRequest As JObject = JObject.Parse(json)
If JsonRequest IsNot Nothing Then
metodo = JsonRequest("Metodo").ToString
End If
End Using
ElseIf context.Request("metodo") IsNot Nothing Then
metodo = context.Request("metodo").ToString()
If context.Request("FechaEnvio") IsNot Nothing Then
@@ -422,7 +413,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
Dim CveVendedor As Integer = -1
Dim Grupo As Integer = 5
Dim TipoCambio As Integer = 1
Dim TipoDocto As String = "-1"
Dim TipoDocto As String = "Ing"
Dim FechaCorte As DateTime = New DateTime(Now.Year, 12, 31)
If ObjMov.GetCxC(FechaI, FechaF, CveCliente, CveSubProyecto, CveVendedor, -1, -1, "-1", UsuarioActual.CveEmpresa, Grupo, -1, TipoCambio, TCEspecifico, TipoDocto, FechaVI, FechaVF, FechaCorte:=FechaCorte,
@@ -436,7 +427,8 @@ Public Class TareasProgramadas : Implements IHttpHandler
If DTClientes IsNot Nothing OrElse EnviarPendientes Then
'DTClientes = DTClientes.FiltraParametros("CveCliente IN (227289,227429,227733,227838,228181,228544,229176,229481,230029,230432,230860,230911,230918,231197,231576,232173,232185,233055,233295,233357,233588,236379,236460,237161,237635,238285,238530,238622,238724,239033,239099,239865,239895,239903,240202,240235,240236,240238,240303,240340,262404,262517,264765,264806,264825,264848,264930,265063,265180,265213,265214,265236,265344,265492,265555,265669,265797,265952,265963,266156,266182,268346,268396,268488,268535,268539,268558,268562,268706,268726,268787,268868,268889,268910,268925,269023,269081,269089,272066,272070,272657,273080,273084,275627,276259,276587,281115,283110,284664,285392,287653,288711,291374,292444,295578,296375,296598,302728,303936,306897,307183,311007,320060,320685,320800,323520,323772,325237,326996,327801,330630,331741,332118,337105,340502,341796,342807,343858,355862,358123,365794,371524,375391,377122,377948,378267,380167,381210,381878,383098,383250,383339,383650,384472,385321,385585,386630,387114,388987,396341,396405,396541,401995,404175,408306,416386,416819,420275,438732,447566,447636,450284,464150,464376,468051,475172,475932,476984,477997,478426)")
DTClientes = DTClientes.FiltraParametros("CveCliente NOT IN (228080,228565,228910,233126,231465,232730,232697,227338)")
Dim DtNotificaciones As DataTable = Nothing
Dim TieneErrorRegistro As Boolean = False
@@ -478,7 +470,10 @@ Public Class TareasProgramadas : Implements IHttpHandler
End If
End If
ObjMovimientos.Dispose()
DTClientes.Dispose()
If DTClientes IsNot Nothing Then
DTClientes.Dispose()
End If
Try
If DtNotificaciones IsNot Nothing Then
@@ -557,7 +552,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
Dim ContaAnt As Integer = 0
Dim FechaCorte As Date = ("9999/01/01").ToDate
Dim TipoDocto2 As String = "'Ing','NC','Dev'"
Dim TipoDocto2 As String = "'Ing'"
Dim FechaVencimientoI As String = "-1"
Dim FechaVencimientoF As String = "-1"
Dim FI As String = "-1"

View File

@@ -567,7 +567,7 @@
}
function SumaValores() {
function SumaValores(aplicaTC) {
var Importe = 0;
var Comision = 0.00;
@@ -581,7 +581,13 @@
if (textBoxes[i].value != '') {
idd = textBoxes[i].id.replace('C_GvCxP_TxtAbonar_', '');
Facturas = Facturas + (Importe == 0 ? '' : ', ') + $get("C_GvCxP_HplF_" + idd).innerText;
Importe = parseFloat(Importe) + parseFloat(textBoxes[i].value.split(',').join(''));
let importeFactura = 0;
if (aplicaTC && $get('TxtTC') != null) {
importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join(''));
} else {
importeFactura = parseFloat(textBoxes[i].value.split(',').join(''));
}
Importe = parseFloat(Importe) + importeFactura;
}
}
if (textBoxes[i].id.indexOf('C_GvCxP_TxtComision') >= 0) {
@@ -641,13 +647,15 @@
}
function CambiaPesosDolares() {
$get('TxtImporte').value = FormatoNumero(SumaValores(), 2);
$('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2))
let ImporteDolares = SumaValores(true);
$get('TxtImporte').value = FormatoNumero(ImporteDolares, 2);
$('#LtlTotalMXN').text(FormatoNumero(ImporteDolares, 2))
if ($("#LbImporteME").length) {
$get('LbImporteME').innerHTML = '$ ' + $get('TxtImporte').value + ' USD';
$get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) * ToDouble($get('TxtTC').value), 2);
$get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTC').value), 2);
$get('LbImporteME').innerHTML = '$ ' + FormatoNumero(SumaValores(false),2) + ' USD';
$get('TxtImporte').value = FormatoNumero(ToDouble(ImporteDolares), 2);
$get('LtlTotalMXN').value = FormatoNumero(ToDouble(ImporteDolares), 2);
}
if ($get('TxtTotal') != null) {

View File

@@ -471,18 +471,29 @@ public partial class GPS_WizardDispositivos : ClsPaginas
{
ClsGPS ObjGPS = new ClsGPS();
ObjGPS.ProveedoresComunicacionCuentasGet(-1, UsuarioActual.CveEmpresa);
DdlLineaTelefono.SelectedIndex = -1;
DdlLineaTelefono.DataSource = ObjGPS.DtResultados.FiltraParametros($"CveDispositivo is NULL OR CveDispositivo = {CveDispositivo}");
DataTable DtProveedores = ObjGPS.DtResultados.FiltraParametros($"CveDispositivo IS NULL OR CveDispositivo = {CveDispositivo}");
DdlLineaTelefono.DataSource = DtProveedores;
ObjGPS.Dispose();
DdlLineaTelefono.DataBind();
DdlLineaTelefono.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlLineaTelefono.SelectedValue = "-1";
DataRow drow = ObjGPS.DtResultados.FiltroPrimero($"CveDispositivo is NULL OR CveDispositivo = {CveDispositivo}");
DataRow drow = DtProveedores.FiltroPrimero($"CveDispositivo IS NULL OR CveDispositivo = {CveDispositivo}");
if (drow != null)
{
DdlLineaTelefono.SelectedValue = drow["CveProveedorComunicacionCuenta"].ToString();
DdlLineaTelefono.SelectedValueExist(drow["CveProveedorComunicacionCuenta"].ToString());
}
if (DtProveedores != null)
{
DtProveedores.Dispose();
DtProveedores = null;
}
upLinea.Update();
UpModelo.Update();
}
protected void DdlProveedorComunicacion_SelectedIndexChanged1(object sender, EventArgs e)
{

View File

@@ -141,16 +141,48 @@
</asp:GridView>
</div>
<div id="DivMedRin" style="overflow-y: auto; width: 765px; height: 325px;" runat="server" visible="False">
<asp:GridView ID="GvMedRin" Width="100%" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros" ToolTip="Listado de Contratos encontrados." CssClass="table table-striped table-hover" GridLines="None">
<asp:GridView ID="GvMedRin" Width="100%" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros" CssClass="table table-striped table-hover" GridLines="None">
<Columns>
<asp:BoundField DataField="Almacen" HeaderText="Almacén" />
<asp:BoundField DataField="UnidadMedida" HeaderText="Unidad de Medida" />
<%--<asp:BoundField DataField="UnidadMedida" HeaderText="Unidad" />--%>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="LblUMH" runat="server" ToolTip="Unidad de Medida" Text="U.M"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblUM" runat="server" Text='<%# Eval("UnidadMedida") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Existencia" ItemStyle-HorizontalAlign="Right" HeaderText="Existencia" DataFormatString="{0:#,###.######}" />
<asp:BoundField DataField="PendientePorSurtir" ItemStyle-HorizontalAlign="Right" HeaderText="Pendiente Por Surtir" DataFormatString="{0:#,###.######}" />
<%--<asp:BoundField DataField="PendientePorSurtir" ItemStyle-HorizontalAlign="Right" HeaderText="Pendiente Por Surtir" DataFormatString="{0:#,###.######}" /> --%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label ID="LblPPPH" runat="server" ToolTip="Pendiente Por Surtir" Text="Pendiente <br/> Por Surtir"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblPP" runat="server" Text='<%# String.Format("{0:#,###.######}", Eval("PendientePorSurtir")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ExistenciaFinal" ItemStyle-HorizontalAlign="Right" HeaderText="Existencia Real" DataFormatString="{0:#,###.######}" />
<asp:BoundField DataField="Importe" ItemStyle-HorizontalAlign="Right" HeaderText="Precio Neto" DataFormatString="{0:N2}"/>
<asp:BoundField DataField="ImportePromocion" ItemStyle-HorizontalAlign="Right" HeaderText="Precio Promoción" DataFormatString="{0:N2}"/>
<asp:BoundField DataField="CantidadMinimaPromo" ItemStyle-HorizontalAlign="Right" HeaderText="Cant. Min. Promo" DataFormatString="{0:N0}"/>
<%--<asp:BoundField DataField="ImportePromocion" ItemStyle-HorizontalAlign="Right" HeaderText="Precio Promoción" DataFormatString="{0:N2}"/>--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label ID="LblPH" runat="server" ToolTip="Precio Promoción" Text="Precio <br/> Promoción"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblP" runat="server" Text='<%# String.Format("{0:N2}", Eval("ImportePromocion")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:BoundField DataField="CantidadMinimaPromo" ItemStyle-HorizontalAlign="Right" HeaderText="Cant. Min. Promo" DataFormatString="{0:N0}"/>--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label ID="LblCMPH" runat="server" ToolTip="Cantidad Mínima Promoción" Text="Cant. Min. <br/> Promoción"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblCMP" runat="server" Text='<%# String.Format("{0:N0}", Eval("CantidadMinimaPromo")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CantidadDisponibleInv" ItemStyle-HorizontalAlign="Right" HeaderText="Pendiente Por Recibir" DataFormatString="{0:#,###.######}" Visible="false"/>
</Columns>
</asp:GridView>

View File

@@ -268,7 +268,8 @@
<ItemTemplate>
<asp:Label ID="LblC" runat="server" Font-Size="6pt"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
@@ -325,7 +326,8 @@
<ItemTemplate>
<asp:Label ID="LblC" runat="server" Font-Size="6pt"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
@@ -375,7 +377,8 @@
<ItemTemplate>
<asp:Label ID="LblC" runat="server" Font-Size="6pt"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
@@ -474,7 +477,8 @@
<ItemTemplate>
<asp:CheckBox ID="ChkPSFaltante" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />

View File

@@ -1,11 +1,13 @@
Imports System.Data
Imports System.IO
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
Partial Class Inventarios_RepAnomalias
Inherits ClsPaginas
Inherits ClsPaginas
#Region "Propiedades"
Public Property CveInventarioFisico As Integer
Get
@@ -57,10 +59,10 @@ Partial Class Inventarios_RepAnomalias
Set(value As Boolean)
ViewState("CreandoNuevoInventario") = value
End Set
End Property
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
@@ -73,12 +75,12 @@ Partial Class Inventarios_RepAnomalias
End If
End If
End Sub
End Sub
#Region " CARGA DATOS "
Private Sub CargaDatos(CveInventarioFisico As Integer)
Dim Inventario As New ClsInventarios
Dim dt As DataTable = Nothing
@@ -272,15 +274,15 @@ Partial Class Inventarios_RepAnomalias
DVGrupos.Visible = True
If DdlGPO.SelectedValue.ToEntero = 2 Then
GvGrupos.Columns(4).Visible = False
GvGrupos.Columns(5).Visible = False
GvGrupos.Columns(6).Visible = False
GvGrupos.Columns(7).Visible = False
GvGrupos.Columns(8).Visible = False
Else
GvGrupos.Columns(4).Visible = True
GvGrupos.Columns(5).Visible = True
GvGrupos.Columns(6).Visible = True
GvGrupos.Columns(7).Visible = True
GvGrupos.Columns(8).Visible = True
End If
If DdlGPO.SelectedValue.ToEntero = 2 Then
@@ -327,10 +329,10 @@ Partial Class Inventarios_RepAnomalias
UPAcciones.Update()
End Sub
End Sub
#End Region
#Region " FINALIZAR "
Protected Sub btnFin_Click(sender As Object, e As EventArgs) Handles btnFin.Click
Dim Inventarios As New ClsInventarios
@@ -351,11 +353,11 @@ Partial Class Inventarios_RepAnomalias
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos(CveInventarioFisico)
End Sub
End Sub
#End Region
Protected Sub GVF_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvF.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -393,16 +395,16 @@ Partial Class Inventarios_RepAnomalias
End If
End If
End Sub
End Sub
#Region " IMPRIMIR "
'Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
' GvF.ExportToExcel("IF_Faltantes_" & Now.ToShortDateString())
'End Sub
'Protected Sub LnkExportaSobrantes_Click(sender As Object, e As EventArgs) Handles LnkExportaSobrantes.Click
' GvS.ExportToExcel("IF_Sobrantes_" & Now.ToShortDateString())
'End Sub
'Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
' GvF.ExportToExcel("IF_Faltantes_" & Now.ToShortDateString())
'End Sub
'Protected Sub LnkExportaSobrantes_Click(sender As Object, e As EventArgs) Handles LnkExportaSobrantes.Click
' GvS.ExportToExcel("IF_Sobrantes_" & Now.ToShortDateString())
'End Sub
Private Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPDF.Click
ImprimirbytesPDF(Imprimir, Formato:="PDF")
End Sub
@@ -466,10 +468,27 @@ Partial Class Inventarios_RepAnomalias
For Each GvRow As GridViewRow In GvTemp.Rows
GvRow.BackColor = Drawing.ColorTranslator.FromHtml("white")
Next
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
GvTemp.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
Next
Dim SbFiltros As New StringBuilder()
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos que Faltan", DatosFiltros:=SbFiltros.ToString())
End Sub
@@ -478,10 +497,27 @@ Partial Class Inventarios_RepAnomalias
For Each GvRow As GridViewRow In GvTemp.Rows
GvRow.BackColor = Drawing.ColorTranslator.FromHtml("white")
Next
Next
Dim SbFiltros As New StringBuilder()
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos que Sobran " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos que Sobran", DatosFiltros:=SbFiltros.ToString())
'GvS.ExportToExcel("Reporte de Inventario Fisico - Productos que Sobran " & Now.ToShortDateString)
GvTemp.ExportToExcel("Reporte de Inventario Fisico - Productos que Sobran " & Now.ToShortDateString)
End Sub
@@ -490,27 +526,62 @@ Partial Class Inventarios_RepAnomalias
For Each GvRow As GridViewRow In GvTemp.Rows
GvRow.BackColor = Drawing.ColorTranslator.FromHtml("white")
Next
'GvC.ExportToExcel("Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString)
GvTemp.ExportToExcel("Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString)
Next
Dim SbFiltros As New StringBuilder()
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos Coincidentes", DatosFiltros:=SbFiltros.ToString())
End Sub
Private Sub LnkDescarExcelGrupos_Click(sender As Object, e As EventArgs) Handles LnkDescarExcelGrupos.Click
GvGrupos.ExportToExcelGembox("Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "", "", "Inventario:" & lbTitulo.Text, "", 1)
'Dim Filtros As String = "Almacenes:aASDSAF|Clasificaciones:sdfasf|Fecha:12/12/2323"
'GvGrupos.ExportToExcelGembox("Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "Inventario:" & lbTitulo.Text, "", DatosFiltros:=Filtros)
Dim SbFiltros As New StringBuilder()
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
ExportarExcelGembox(GvGrupos, "Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico", DatosFiltros:=SbFiltros.ToString())
End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
End Sub
#End Region
Private Sub BanderaSerieLoteCad(Gv As GridView, resultado As DataTable)
If resultado IsNot Nothing Then
Gv.Columns(5).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0
Gv.Columns(6).Visible = resultado.MAX("Serie") <> ""
Gv.Columns(7).Visible = resultado.MAX("Lote") <> ""
Gv.Columns(8).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
Gv.Columns(6).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0
Gv.Columns(7).Visible = resultado.MAX("Serie") <> ""
Gv.Columns(8).Visible = resultado.MAX("Lote") <> ""
Gv.Columns(9).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
End If
End Sub
@@ -709,5 +780,162 @@ Partial Class Inventarios_RepAnomalias
End If
End Sub
Public Sub ExportarExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional DatoTituloExtra As String = "", Optional DatosFiltros As String = "", Optional AnchoImagen As Integer = 100, Optional AlturaImagen As Integer = 100)
Dim sw1 As New StringWriter()
Dim htw1 As New HtmlTextWriter(sw1)
GridView.RenderControl(htw1)
Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString()))
htmlStream1.Position = 0
Dim sr1 As New StreamReader(htmlStream1)
Dim myStr1 = sr1.ReadToEnd()
sr1.Dispose()
htmlStream1.Dispose()
sw1.Dispose()
Dim HtmlCompleto As String = myStr1
HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "")
Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto))
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
Dim excel As GemBox.Spreadsheet.ExcelFile
excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options)
If Usuario IsNot Nothing Then
Dim TotalRowHeader As Integer = 6
Dim TotalRowFooter As Integer = 2
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
RangoNombreEmpresa.Value = Usuario.Empresa.Empresa
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 DatoTituloExtra.Length > 0 Then
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = DatoTituloExtra
RangoDatoTituloExtra.Style.Font.Size = 20 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
End If
If DatosFiltros.Length > 0 Then
Dim Arreglo As String() = DatosFiltros.Split("|"c)
worksheet.Rows.InsertEmpty(TotalRowHeader, Arreglo.Count)
For Each TextoFiltro As String In Arreglo
Dim RangoDatosFiltro = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
RangoDatosFiltro.Merged = True
RangoDatosFiltro.Style.WrapText = True
RangoDatosFiltro.Value = TextoFiltro
RangoDatosFiltro.Style.Font.Size = 12 * 20
RangoDatosFiltro.Style.Font.Name = "Calibri Light"
RangoDatosFiltro.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoDatosFiltro.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
TotalRowHeader += 1
Next
End If
'TotalRowHeader += 2
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
worksheet.Rows(TotalRowHeader).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(TotalRowHeader).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(TotalRowHeader).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(TotalRowHeader).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(TotalRowHeader).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 = GridView.Rows.Count + TotalRowHeader + TotalRowFooter
worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.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", Usuario.Empresa.Ruta))
If Imagen.Exists Then
Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
Using sr As New StreamReader(Ruta)
Dim ms As New MemoryStream()
sr.BaseStream.CopyTo(ms)
worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
End Using
End If
For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
If I > 0 Then
'If 1 = 1 Then
' worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
'Else
' worksheet.Columns(I + 1).Style.NumberFormat = "#,##"
'End If
worksheet.Columns(I + 1).Style.NumberFormat = "@"
Try
worksheet.Columns(I).AutoFit(1)
Catch ex As Exception
End Try
End If
Next
End If
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
End Sub
End Class

View File

@@ -3838,7 +3838,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
/*
string SalarioDiariop = "";
string FechaIngreso = "", Nombre = "", DiasLaborados = "";*/
paragraphh = new GemBox.Document.Paragraph(document, string.Format("{1} : {0}", drow2["Nombre"].ToString(), drow2["Codigo"].ToString())); cell.Blocks.Add(paragraphh);
paragraphh = new GemBox.Document.Paragraph(document, string.Format("{1} : {0} Centro de costos: {2}", drow2["Nombre"].ToString(), drow2["Codigo"].ToString(), drow2["SubProyecto"])); cell.Blocks.Add(paragraphh);
paragraphh.ParagraphFormat.Style = styilostrong;
//
DataRow drh = dtpersonas.FiltroPrimero(string.Format("CvePersonal ={0}", CvePersonal));
@@ -3849,7 +3849,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
paragraphh = new GemBox.Document.Paragraph(document, string.Format("Fecha Ingr:{0:dd/MM/yyyy}, S.D.:{1:N2}, S.D.I.:{2:N2}, S.B.C.:{3:N2} ", drow2["FechaIngreso"], drow2["SalarioDiario"], drow2["SalarioDiarioIntegrado"], drow2["SalarioDiarioIMSS"])); cell.Blocks.Add(paragraphh);
paragraphh.ParagraphFormat.Style = styilo;
paragraphh = new GemBox.Document.Paragraph(document, string.Format("Días pagados:{0}, Retardos: {1}, Ausencias:{2},Incapacidad:{4}, Centro de costos: {3}", drow2["DiasLaborados"], drow2["DiasRetardos"], drow2["DiasFaltados"], drow2["SubProyecto"], drow2["DiasIncapacidad"])); cell.Blocks.Add(paragraphh);
paragraphh = new GemBox.Document.Paragraph(document, string.Format("Días pagados:{0}, Retardos: {1}, Ausencias:{2},Incapacidad:{3},Vacaciones Disfrutadas:{4},Vacaciones Pagadas:{5} ", drow2["DiasLaborados"], drow2["DiasRetardos"], drow2["DiasFaltados"], drow2["DiasIncapacidad"], drow2["DiasVacaciones"], drow2["DiasVacacionesPorPagar"])); cell.Blocks.Add(paragraphh);
paragraphh.ParagraphFormat.Style = styilo;
row = new GemBox.Document.Tables.TableRow(document);
@@ -5383,7 +5383,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
int chkImporteValor = 1;
string[] getcolumnas = new string[] { "CvePersonal", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" };
DataTable dtr = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0", FiltroCvePersonal), "", getcolumnas);
DataTable dtr = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0 AND SumaPercepciones > 0", FiltroCvePersonal), "", getcolumnas);
DataTable dtconp = null;
//int CvePeriodoSeleccionado = DdlPeriodo.SelectedValue.ToEntero();//cambiar reparar

View File

@@ -107,6 +107,7 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
else
{
Alert("Error en la aceptación: " + resp.Descripcion, ModExtensiones.TipoMensaje.MsgError);
this.GuardaLog(resp.Descripcion);
}
//}
//else
@@ -118,7 +119,8 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
}
catch (Exception ex)
{
Alert(ex.ToString(), ModExtensiones.TipoMensaje.MsgError);
this.OnError("Ocurrió un error al aceptar la cancelación", ex);
//Alert(ex.ToString(), ModExtensiones.TipoMensaje.MsgError);
}
}
protected void btnRechazar_Click(object sender, EventArgs e)
@@ -152,12 +154,14 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
else
{
Alert("Error en la aceptación: " + resp.Descripcion, ModExtensiones.TipoMensaje.MsgError);
this.GuardaLog(resp.Descripcion);
}
}
}
catch (Exception ex)
{
Alert(ex.ToString(), ModExtensiones.TipoMensaje.MsgError);
//Alert(ex.ToString(), ModExtensiones.TipoMensaje.MsgError);
this.OnError("Ocurrió un error al rechazar la cancelación", ex);
}
}
private string DecodeBase64(string strXMLCodificado)

View File

@@ -89,7 +89,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total);
if (resp.EnviarAcuse)
{
Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();");
Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();",TextoConfirmacion:"Enviar",TextoSegundoBoton:"Cancelar");
}
else
{

View File

@@ -10,7 +10,7 @@
padding: 0px 5px;
}
.nolineheight {line-height: 1;
.nolineheight { line-height: 1;
}
.claseesconder {
@@ -1048,7 +1048,6 @@
<asp:Literal Text="" runat="server" ID="LtlClienteMsg"></asp:Literal>
</p>
</div>
</th>
<%--<th style="text-align: center;">
<asp:LinkButton ID="LbVerInventario" ClientIDMode="Static" runat="server" CssClass="btn btn-circle btn-sm purple" Text="<i class='icon-magnifier'></i>"></asp:LinkButton>
@@ -6438,9 +6437,6 @@
DataKeyNames="CveVenta,CveMetodoPago33,CveFormaPago33" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="ChkAllCxC" CssClass="gvcxcAllChe" onclick="chkSeleccionarNC();" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="ChkCxC" CssClass="gvcxcChe" runat="server" />
</ItemTemplate>
@@ -7658,12 +7654,6 @@
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
<script type="text/javascript">
//$('body').on('click', '.gvcxcAllChe input', function () { });
function chkSeleccionarNC() {
$(".gvcxcChe input").not(this).click();
}
//FUNCIONES PARA COMERCIO EXTERIOR
function CalculaTotalUSD(TotalUSD, ValorUnitario, TxtCantidad) {
TotalUSD.innerText = FormatoNumero(ToDouble(ValorUnitario.value) * ToDouble(TxtCantidad.value), 2);
@@ -8315,17 +8305,6 @@
Entro = 1;
}
<%-- if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
let ImporteRestante = ToDouble($get('TxtImportesRemisionesNC').value) - ToDouble($get('TxtNCImporte').value)
if (ImporteRestante > 0) {
if (ImporteRestante < ImporteNuevo) {
ImporteNuevo = ImporteRestante;
}
Entro = 1;
}else {
ImporteNuevo = 0;
}
}--%>
if (ImporteNuevo > Saldo) {
ImporteNuevo = Saldo;

View File

@@ -2471,15 +2471,15 @@ Partial Class Ventas
LnkImprimirFormatoTelcel.Visible = True
End If
'If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
' Dim ObjInventario As New ClsInventarios
' If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
' If ObjInventario.DtResultados.Rows.Count > 0 Then
' DivDevAlm.Visible = True
' End If
' End If
' ObjInventario.Dispose()
'End If
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
Dim ObjInventario As New ClsInventarios
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
DivDevAlm.Visible = True
End If
End If
ObjInventario.Dispose()
End If
End If
@@ -2806,7 +2806,7 @@ Partial Class Ventas
CargaFormatoSucursal()
InicializaDevolucionAlmacen()
'CargaOtrosConceptos()
CargaOtrosConceptos()
CargaFacturaOC()
'SELECCIONA SUCURSAL DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE
@@ -5652,6 +5652,7 @@ Partial Class Ventas
EnviarCorreoCliente = ObjCliente.EnviarFactura
EstatusCliente = ObjCliente.Estatus
Me.PermiteCredito = ObjCliente.PermiteCredito
LnkAgregarCliente.Visible = False
ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString())
@@ -5744,17 +5745,10 @@ Partial Class Ventas
ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal
'ViewState("NumCtaPago") = ObjCliente.NumCtaPago
ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS
ViewState("ClienteNODesglosaIVA") = ObjCliente.NoDesglosaIVA
If Not ClienteDesglosaIEPS Then
DivClienteMsg.Visible = True
LtlClienteMsg.Text = "Cálculo sin desglose de IEPS"
End If
If ClienteNODesglosaIVA Then
DivClienteMsg.Visible = True
LtlClienteMsg.Text += "Cálculo NO desglosa IVA"
End If
ViewState("CargoUsado") = ObjCliente.CargoUsados
Dim dr As DataRow = Nothing
@@ -5772,7 +5766,7 @@ Partial Class Ventas
End If
'HABILITA LA OPCION DE DIRECCION DE ENVIO
If UsuarioActual.CveEmpresa.Contiene(1, 72, 119, 140) Then
If UsuarioActual.CveEmpresa.Contiene(1, 72, 119) Then
trDireccionEnvio.Visible = True
CargaDireccionesEnvio()
End If
@@ -6006,7 +6000,7 @@ Partial Class Ventas
TrAtencionA.Visible = True
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
Me.PermiteCredito = ObjCliente.PermiteCredito
LbAgregar.Enabled = True
LnkAgregarPyME.Enabled = True
@@ -6086,6 +6080,8 @@ Partial Class Ventas
UpModalRemisionesNC.Update()
End If
CargaFacturasARelacionar()
If RequiereOC Then
Dim Documentacion As String = ""
'RegistraScript("$('#DivDocsCliente').modal({ backdrop: 'static', keyboard: false });", "ModalArchivos")
@@ -6352,7 +6348,9 @@ Partial Class Ventas
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
End If
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
If Opcion = 1 Then
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
If Opcion = 1 AndAlso (Not DdlTipoComprobante.SelectedValue.Contiene("PA")) Then
BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
@@ -6361,6 +6359,7 @@ Partial Class Ventas
LnkCotizaciones.Visible = False
LnkOCs.Visible = False
End If
Else
' el cliente tiene crédito disponible, no tiene bloqueo
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
@@ -6511,9 +6510,10 @@ Partial Class Ventas
Vta.Dispose()
If Opcion > 0 Then
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
End If
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
End If
End If
@@ -6868,7 +6868,7 @@ Partial Class Ventas
Dim CveSATNC = "84111506"
Dim dtt As New DataTable
dtt = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CodigoSATPS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
dtt = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
If dtt IsNot Nothing Then
DdlNCPS.DataSource = dtt
@@ -12577,7 +12577,7 @@ Partial Class Ventas
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
Else
@@ -12601,7 +12601,7 @@ Partial Class Ventas
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
Else
@@ -13612,7 +13612,7 @@ Partial Class Ventas
Exit For
End If
If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 141}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString().ToEntero() < 1 Then
If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119,140}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString().ToEntero() < 1 Then
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
If Existencia < Cantidad Then
OcurrioError = True
@@ -16875,7 +16875,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then
'VALIDA EXISTENCIA
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153,140}) Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
Return False
@@ -21621,19 +21621,17 @@ Partial Class Ventas
If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjInv.DtResultados.Rows.Count > 0 Then
CargaGVInv(ObjInv.DtResultados)
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
DivDevAlm.Visible = True
End If
End If
End If
ObjInv.Dispose()
'si es la empresa 119, Candado, no permiter refacturar, si no se ha surtido, para que cancele la factura mejor.
If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 Then
'si es la empresa 119, Candado, no permite refacturar, si no se ha surtido y que no sea refacturación, para que cancele la factura mejor.
If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 And CveVentaPadre <= 0 Then
LkRefacturacion.Visible = False
End If
If UsuarioActual.CveEmpresa = 119 AndAlso CveVenta = 620098 Then
LkRefacturacion.Visible = True
End If
End Sub
Private Sub CargaGVInv(DtTemporal As DataTable)
@@ -21781,7 +21779,7 @@ Partial Class Ventas
DdlDireccionEnvio.Items.Clear()
If ObjClientes.DireccionEnvioGet(-1, CveCliente, CveClienteSucursal) Then
DdlDireccionEnvio.DataSource = ObjClientes.DtResultados.FiltraParametros(String.Format("Estatus = 1"))
DdlDireccionEnvio.DataBind()
'DdlDireccionEnvio.Items.Insert(0, New ListItem("Seleccione", "-1"))
TmpDTEnvioDireccion = ObjClientes.DtResultados
Else
@@ -21793,7 +21791,6 @@ Partial Class Ventas
End If
ObjClientes.Dispose()
DdlDireccionEnvio.DataBind()
UpCliente.Update()
End Sub
@@ -23559,15 +23556,13 @@ Partial Class Ventas
End If
DdlMarca.Items.Clear()
DdlMarcaPSDes.Items.Clear()
Dim dt As DataTable = GlobalDTGralMarcas(UsuarioActual.CveEmpresa)
DdlMarca.DataSource = dt
DdlMarcaPSDes.DataSource = dt
Dim ObjMarcas As New ClsProductosServicios
ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa)
DdlMarca.DataSource = ObjMarcas.DtResultados
DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados
ObjMarcas.Dispose()
DdlMarca.DataBind()
DdlMarcaPSDes.DataBind()
dt.Dispose()
End If
DdlMarca.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlMarcaPSDes.Items.Insert(0, New ListItem("Seleccione", "-1"))

View File

@@ -364,6 +364,8 @@