diff --git a/App_Code/ClsSisNotificaciones.vb b/App_Code/ClsSisNotificaciones.vb index 3ef308c1f..91485aa7d 100644 --- a/App_Code/ClsSisNotificaciones.vb +++ b/App_Code/ClsSisNotificaciones.vb @@ -152,7 +152,10 @@ Public Class ClsSisNotificaciones #Region "N O T I F I C A C I O N E S" Public Shared Sub EnviarAlerta(Titulo As String, Mensaje As String, CveUsuario As String, Optional Tipo As TipoNotificacion = TipoNotificacion.AlertaVentanaNoOcultar, Optional TimeOut As Integer = 0) Dim hub = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)() - hub.Clients.Client(Notificaciones.UsuariosConexiones(CveUsuario)).alertaVentana(Titulo, Mensaje, DirectCast(Tipo, Integer), TimeOut) + 'VERIFICA SI EXISTE LA CONEXION DEL USUARIO + If Notificaciones.UsuariosConexiones.Keys.Any(Function(key) key = CveUsuario) Then + hub.Clients.Client(Notificaciones.UsuariosConexiones(CveUsuario)).alertaVentana(Titulo, Mensaje, DirectCast(Tipo, Integer), TimeOut) + End If End Sub diff --git a/Sistemas/SessionesActivas.aspx b/Sistemas/SessionesActivas.aspx index a61a989a3..312a880fb 100644 --- a/Sistemas/SessionesActivas.aspx +++ b/Sistemas/SessionesActivas.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="SessionesActivas.aspx.vb" Inherits="SessionesActivas" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="SessionesActivas.aspx.vb" Inherits="SessionesActivas" EnableEventValidation="false" %> diff --git a/Sistemas/SessionesActivas.aspx.vb b/Sistemas/SessionesActivas.aspx.vb index 65f8bb5f8..8e1823580 100644 --- a/Sistemas/SessionesActivas.aspx.vb +++ b/Sistemas/SessionesActivas.aspx.vb @@ -190,7 +190,9 @@ Partial Class SessionesActivas RegistraScript("$(""#DivMensaje"").modal();") End Sub Protected Sub LnkEnviar_Click(sender As Object, e As EventArgs) - ClsSisNotificaciones.EnviarAlerta("Aviso", TxtMensaje.Text.Trim(), RCveUsuario, Tipo:=TipoNotificacion.ToastInformacionB) + + Dim mensaje = TxtMensaje.Text.Trim() + "
Liga" + ClsSisNotificaciones.EnviarAlerta("Aviso", mensaje, RCveUsuario, Tipo:=TipoNotificacion.ToastInformacionB) RegistraScript($"$(""#DivMensaje"").modal('hide');console.log('{Decripta(Context.User.Identity.Name)}')") End Sub diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 34e7e9e20..6995a4d14 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10052,22 +10052,25 @@ Partial Class Ventas 'If (UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 81, 83) And UsuarioActual.CveUsuario = 100) Or UsuarioActual.CveEmpresa.Contiene(80, 83) Or UsuarioActual.CveUsuario = 100 Then If (Archivo.Exists Or Archivo2.Exists Or ArchivoSti.Exists Or ArchivoSti2.Exists Or ArchivoSti3.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then - HplDownPDF.Visible = True - HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) - If UsuarioActual.TienePermisoProceso(359) Then - HplRenerarPDF.Visible = True - HplRenerarPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR=1", CveVenta))) - End If + If Not UsuarioActual.TienePermisoProceso(380) Then + HplDownPDF.Visible = True + HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) - If UsuarioActual.CveRol = 1 Then - LnkDescargaDirecta.Visible = True + If UsuarioActual.TienePermisoProceso(359) Then + HplRenerarPDF.Visible = True + HplRenerarPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR=1", CveVenta))) + End If - HplImprimirPDFStimulsoft.Visible = True - HplImprimirPDFStimulsoft.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=0&STIMULSOFT=1", CveVenta))) + If UsuarioActual.CveRol = 1 Then + LnkDescargaDirecta.Visible = True - HplImprimirTicket.Visible = True - HplImprimirTicket.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1®ENERAR=1", CveVenta))) + HplImprimirPDFStimulsoft.Visible = True + HplImprimirPDFStimulsoft.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=0&STIMULSOFT=1", CveVenta))) + + HplImprimirTicket.Visible = True + HplImprimirTicket.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1®ENERAR=1", CveVenta))) + End If End If End If @@ -10895,9 +10898,11 @@ Partial Class Ventas ' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA If SeTimbro Then - Dim ArchivoXML As String = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) - If File.Exists(ArchivoXML) Then - MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto))) + If Not UsuarioActual.TienePermisoProceso(380) Then + Dim ArchivoXML As String = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) + If File.Exists(ArchivoXML) Then + MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto))) + End If End If 'MANDA CORREO Try @@ -10928,21 +10933,24 @@ Partial Class Ventas 'DESCARGA PDF - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant", "Egs", "Dev", "Ped") Then - 'If Not ImprimeAlert Then + If Not UsuarioActual.TienePermisoProceso(380) Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant", "Egs", "Dev", "Ped") Then + 'If Not ImprimeAlert Then - Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta)) - Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta)) - Dim ArchivoRem As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta)) - Dim ArchivoEgs As New System.IO.FileInfo(String.Format("{0}Formatos/NotaCredito.rdlc", UsuarioActual.Empresa.Ruta)) + Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta)) + Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta)) + Dim ArchivoRem As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta)) + Dim ArchivoEgs As New System.IO.FileInfo(String.Format("{0}Formatos/NotaCredito.rdlc", UsuarioActual.Empresa.Ruta)) - If ArchivoIng.Exists Or ArchivoRem.Exists Or ArchivoIngPyMe.Exists Or ArchivoEgs.Exists Then - MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) - Else - MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") + If ArchivoIng.Exists Or ArchivoRem.Exists Or ArchivoIngPyMe.Exists Or ArchivoEgs.Exists Then + MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) + Else + MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") + End If End If End If + 'CRM If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then @@ -11018,31 +11026,34 @@ Partial Class Ventas ' End If 'End If - If DdlTipoComprobante.SelectedValue = "Cot" Then + If Not UsuarioActual.TienePermisoProceso(380) Then + If DdlTipoComprobante.SelectedValue = "Cot" Then - If Not CveEmpresaCRM > 0 Then - 'EN EMPRESA DE ACUMULADORES NO DESCARGAR EL PDF - If UsuarioActual.Empresa.Funcionalidad(531) <> "1" Then - If CveVenta > 0 Then MensajeAlert = New StringBuilder + If Not CveEmpresaCRM > 0 Then + 'EN EMPRESA DE ACUMULADORES NO DESCARGAR EL PDF + If UsuarioActual.Empresa.Funcionalidad(531) <> "1" Then + If CveVenta > 0 Then MensajeAlert = New StringBuilder - Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta)) - Dim ArchivoCotizacionMrt As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.mrt", UsuarioActual.Empresa.Ruta)) + Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta)) + Dim ArchivoCotizacionMrt As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.mrt", UsuarioActual.Empresa.Ruta)) - If Opcion = "Cot" And UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - MensajeAlert.AppendFormat("Facturar

", CveVenta) + If Opcion = "Cot" And UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + MensajeAlert.AppendFormat("Facturar

", CveVenta) + End If + + If ArchivoCotizacion.Exists Or ArchivoCotizacionMrt.Exists Then + MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0&GUARDAR=1", CveVenta))) + Else + MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") + End If End If - If ArchivoCotizacion.Exists Or ArchivoCotizacionMrt.Exists Then - MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0&GUARDAR=1", CveVenta))) - Else - MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") - End If + GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO End If - - GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO End If End If + 'ENVIA CORREO CON DETALLE DEL CONTRATO If DdlTipoComprobante.SelectedValue.Contiene("DPe", "Ped") Then If Not String.IsNullOrEmpty(CorreoNotificacionPedDev) Then