diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 1af853887..08e03eb7a 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3981,7 +3981,7 @@ Partial Class Ventas Dim TipoEstatus As Integer = GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {CveEstatus}").ToEntero() - If UsuarioActual.Empresa.Funcionalidad(135) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso TipoEstatus = 5 Then + If UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso TipoEstatus = 5 Then If UsuarioActual.TienePermisoProceso(159) Then Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) If TienePermiso <> "" Then @@ -4087,7 +4087,7 @@ Partial Class Ventas End If - + 'SI LA AUTORIZACION ES POR SUPERVISOR, BUSCA EL SUPERVISOR QUE TIENE EL VENDEDOR If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then 'Reviso cuales son los supervisores Dim Objeto As New ClsVtaVendedores @@ -4104,7 +4104,7 @@ Partial Class Ventas If TipoEstatus = 2 Then LkCotizacionAutorizar.Visible = False - ElseIf TipoEstatus = 2 Then + ElseIf TipoEstatus = 5 Then LkCotizacionAutorizar.Visible = False End If End If @@ -4113,8 +4113,18 @@ Partial Class Ventas Objeto.Dispose() End If - String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString()) - + 'SI LA AUTORIZACION ES POR PERMISO, BUSCA QUE EL USUARIO TENGA EL PERMISO PARA AUTORIZAR + If UsuarioActual.Empresa.Funcionalidad(135) = "2" Then + 'Reviso cuales son los supervisores + If UsuarioActual.TienePermisoProceso(116) Then + LkCotizacionAutorizar.Visible = True + If TipoEstatus = 2 Then + LkCotizacionAutorizar.Visible = False + ElseIf TipoEstatus = 5 Then + LkCotizacionAutorizar.Visible = False + End If + End If + End If Case "Ant" Trsaldo.Visible = True @@ -4872,30 +4882,47 @@ Partial Class Ventas 'Verifico si tiene la funcionalidad (135) - If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135) = "1" Then - 'Reviso cuales son los supervisores - Dim ObjVendedores As New ClsVtaVendedores + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then - If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then - Dim DTVendedores As New DataTable - If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then - DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor)) - End If + Select Case UsuarioActual.Empresa.Funcionalidad(135) + Case "1" ' POR SUPERVISOR + Dim ObjVendedores As New ClsVtaVendedores - 'Verifico si es su supervisor asignado - If DTVendedores.Rows.Count > 0 Then - If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then - BtnsFacturar.Visible = True - BtnGenerarRemision.Visible = True - Else - BtnsFacturar.Visible = False - BtnGenerarRemision.Visible = False + If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then + Dim DTVendedores As New DataTable + If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then + DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor)) + End If + + 'Verifico si es su supervisor asignado + If DTVendedores.Rows.Count > 0 Then + If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then + BtnsFacturar.Visible = True + BtnGenerarRemision.Visible = True + Else + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If + End If + + DTVendedores.Dispose() End If - End If + ObjVendedores.Dispose() + + Case "2" ' POR PERMISO + If UsuarioActual.TienePermisoProceso(116) Then + If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then + BtnsFacturar.Visible = True + BtnGenerarRemision.Visible = True + Else + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If + End If + + End Select + - DTVendedores.Dispose() - End If - ObjVendedores.Dispose() End If If DdlTipoComprobante.SelectedValue = "Cot" Then @@ -15478,7 +15505,7 @@ Partial Class Ventas TrAlmacenAsignado.Visible = False TrAlmacenOrigen.Visible = False - If DdlTipoComprobante.SelectedValue = "Cot" And UsuarioActual.Empresa.Funcionalidad(135) = "1" Then + If DdlTipoComprobante.SelectedValue = "Cot" And UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then Alert("Se ocupa una autorización.", TipoMensaje.MsgAdvertencia) TrDireccion.Visible = False TrCiudad.Visible = False @@ -21210,8 +21237,14 @@ Partial Class Ventas ObjVentas.Dispose() If ActualizoEstatus Then - 'GeneraPDFCotizacion(True) - Alert("La cotización ha sido enviada al correo de nuestro cliente:" & Mail) + + If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then + GeneraPDFCotizacion(True) + Alert("La cotización ha sido enviada al correo de nuestro cliente:" & Mail) + ElseIf UsuarioActual.Empresa.Funcionalidad(135) = "2" Then + Alert("La cotización ha sido autorizada.") + End If + Else Alert("No se pudo autorizar la cotización", TipoMensaje.MsgError) End If