diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index 274b51195..8c9c1da2b 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -1,3440 +1,3440 @@ -Option Strict On -Option Explicit On - -Imports System.Data -Imports System.Data.SqlClient -Imports Extensiones -Imports System -Imports System.Configuration - -Public Class ClsAF - Implements IDisposable - -#Region "Campos" - 'SQL - Private SqlConexion As SqlConnection - Private SqlAdapter As SqlDataAdapter - Private SqlCommand As SqlCommand - Private SqlTransacc As SqlTransaction - Private Data As DataTable - Private DSet As New DataSet - - Private disposedValue As Boolean = False ' Para detectar llamadas redundantes - 'REGISTRAR CONEXIÓN - Private CveConexion As Integer = 0 +Option Strict On +Option Explicit On + +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones +Imports System +Imports System.Configuration + +Public Class ClsAF + Implements IDisposable + +#Region "Campos" + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + Private SqlCommand As SqlCommand + Private SqlTransacc As SqlTransaction + Private Data As DataTable + Private DSet As New DataSet + + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + 'REGISTRAR CONEXIÓN + Private CveConexion As Integer = 0 Private EsTransaccionCompartida As Boolean = False Public CveMetricaValor As Integer = 0 -#End Region +#End Region -#Region "Propiedades" - Public ReadOnly Property DtResultados() As DataTable - Get - DtResultados = Data - End Get +#Region "Propiedades" + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get End Property Public ReadOnly Property DSResultados() As DataSet Get DSResultados = DSet End Get - End Property - - Public Property CveActivoFijo As Integer - Public Property Codigo As String - Public Property Descripcion As String - Public Property CveCompra As Integer - Public Property ValorCompra As Double - Public Property FechaCompra As Date - Public Property CuentaInicial As Integer - Public Property CveTipoActivoFijo As Integer - Public Property TipoActivoFijo As String - Public Property CveSubTipoActivoFijo As Integer - Public Property SubTipoActivoFijo As String - Public Property CveModeloActivoFijo As Integer - Public Property ModeloActivoFijo As String - Public Property CveMarcaActivoFijo As Integer - Public Property MarcaActivoFijo As String - Public Property CvePersonaResponsable As Integer - Public Property Responsable As String - Public Property NoSerie As String - Public Property Año As Integer - Public Property CveSubProyecto As Integer - Public Property SubProyecto As String - Public Property CveProyecto As Integer - Public Property Proyecto As String - Public Property Cuenta As Integer - Public Property CveEstadoActivoFijo As Integer - Public Property EstadoActivoFijo As String - Public Property IdCtaContDepreciacion As Integer - Public Property PorDepreciacion As Double - Public Property FechaUltimaDepreciacion As DateTime - Public Property Observaciones As String - Public Property FechaIng As Date - Public Property CveUsuario As Integer - Public Property Usuario As String - Public Property CveEmpresa As Integer - Public Property FolioVale As Integer - Public Property FolioResguardo As Integer - Public Property MesesDepreciacion As Integer - Public Property CveCliente As Integer - Public Property NombreCliente As String - Public Property MedidaUso As String - Public Property CveMovimientoInv As Integer - Public Property FolioInv As String - Public Property AlmacenInv As String - Public Property CveMarcaAF As Integer - Public Property CveModeloAF As Integer - Public Property CveGrupoAF As Integer - Public Property CveAFPadre As Integer - Public Property CveDispositivo As Integer + End Property + + Public Property CveActivoFijo As Integer + Public Property Codigo As String + Public Property Descripcion As String + Public Property CveCompra As Integer + Public Property ValorCompra As Double + Public Property FechaCompra As Date + Public Property CuentaInicial As Integer + Public Property CveTipoActivoFijo As Integer + Public Property TipoActivoFijo As String + Public Property CveSubTipoActivoFijo As Integer + Public Property SubTipoActivoFijo As String + Public Property CveModeloActivoFijo As Integer + Public Property ModeloActivoFijo As String + Public Property CveMarcaActivoFijo As Integer + Public Property MarcaActivoFijo As String + Public Property CvePersonaResponsable As Integer + Public Property Responsable As String + Public Property NoSerie As String + Public Property Año As Integer + Public Property CveSubProyecto As Integer + Public Property SubProyecto As String + Public Property CveProyecto As Integer + Public Property Proyecto As String + Public Property Cuenta As Integer + Public Property CveEstadoActivoFijo As Integer + Public Property EstadoActivoFijo As String + Public Property IdCtaContDepreciacion As Integer + Public Property PorDepreciacion As Double + Public Property FechaUltimaDepreciacion As DateTime + Public Property Observaciones As String + Public Property FechaIng As Date + Public Property CveUsuario As Integer + Public Property Usuario As String + Public Property CveEmpresa As Integer + Public Property FolioVale As Integer + Public Property FolioResguardo As Integer + Public Property MesesDepreciacion As Integer + Public Property CveCliente As Integer + Public Property NombreCliente As String + Public Property MedidaUso As String + Public Property CveMovimientoInv As Integer + Public Property FolioInv As String + Public Property AlmacenInv As String + Public Property CveMarcaAF As Integer + Public Property CveModeloAF As Integer + Public Property CveGrupoAF As Integer + Public Property CveAFPadre As Integer + Public Property CveDispositivo As Integer Public Property MedidaVehicular As Integer Public Property CveTipoServicio As Integer Public Property CveOrdenTrabajo As Integer Public Property FolioOT As Integer -#End Region +#End Region - Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) - - If TransaccionCompartida Is Nothing Then - SqlConexion = New SqlConnection - SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString - Try - SqlConexion.Open() - Catch ex As Exception - OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) - End Try - Else - SqlConexion = TransaccionCompartida.Connection - SqlTransacc = TransaccionCompartida - EsTransaccionCompartida = True - End If - - SqlAdapter = New SqlDataAdapter("", SqlConexion) - ConexionAdd() - End Sub - Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlAdapter.SelectCommand - .Parameters.Clear() - .CommandText = StrSQL - .CommandType = TipoComando - End With - If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc - Data = New DataTable - End Sub -#Region "Conexiones" - - Private Sub ConexionAdd() - If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - Try - DataAdapter("PA_Sis_RegistrarConexion") - With SqlAdapter.SelectCommand.Parameters - .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name - .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) - .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output - End With - SqlAdapter.Fill(Data) - CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero - Catch ex As Exception - OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - End If - End Sub - - Private Sub ConexionClose() - If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - - DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) - - Try - SqlAdapter.Fill(Data) - - Catch ex As Exception - OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - CveConexion = 0 - End If - - End Sub -#End Region - Public Function IniciaTransacSQL() As SqlTransaction - If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() - Return SqlTransacc - End Function - Public Sub RollBack() - SqlTransacc.Rollback() - End Sub - Public Sub Commit() - SqlTransacc.Commit() - End Sub - - -#Region "A C T I V O S- F I J O S" - - Public Function GetRepActivosFijos(CveActivoFijo As Integer, CveEmpresa As Integer, Codigo As String, Descripcion As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, NoSerie As String, Año As Integer, CvePersonaResponsable As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CaracteristicaValor As String, Optional BuscaGrupoEmpresa As Integer = -1, Optional Agrupador As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_AFGetRep") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Codigo", SqlDbType.VarChar).Value = Codigo - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie - .Add("@Año", SqlDbType.Int).Value = Año - .Add("@CvePersonaResponsable", SqlDbType.Int).Value = CvePersonaResponsable - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - .Add("@CaracteristicaValor", SqlDbType.VarChar).Value = CaracteristicaValor - .Add("@BuscaGrupoEmpresa", SqlDbType.Int).Value = BuscaGrupoEmpresa - .Add("@Gpo", SqlDbType.Int).Value = Agrupador - - End With - Try - SqlAdapter.Fill(Data) - - If CveActivoFijo > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then - Me.CveActivoFijo = Data.Rows(0)("CveActivoFijo").ToString.ToEntero - - Me.Codigo = Data.Rows(0)("Codigo").ToString - Me.Descripcion = Data.Rows(0)("Descripcion").ToString - Me.CuentaInicial = Data.Rows(0)("Conta_CuentaInicial").ToString.ToEntero - Me.CveTipoActivoFijo = Data.Rows(0)("CveTipoActivoFijo").ToString.ToEntero - Me.TipoActivoFijo = Data.Rows(0)("TipoActivoFijo").ToString - Me.CveSubTipoActivoFijo = Data.Rows(0)("CveSubTipoActivoFijo").ToString.ToEntero - Me.SubTipoActivoFijo = Data.Rows(0)("SubTipoActivoFijo").ToString - Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero - Me.ValorCompra = Data.Rows(0)("ValorCompra").ToString.ToDouble - Me.FechaCompra = Data.Rows(0)("FechaCompra").ToString.ToDate - Me.CvePersonaResponsable = Data.Rows(0)("CvePersonaResponsable").ToString.ToEntero - Me.Responsable = Data.Rows(0)("Responsable").ToString - Me.NoSerie = Data.Rows(0)("NoSerie").ToString - Me.Año = Data.Rows(0)("Año").ToString.ToEntero - Me.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero - Me.SubProyecto = Data.Rows(0)("SubProyecto").ToString - Me.CveProyecto = Data.Rows(0)("CveProyecto").ToString.ToEntero - Me.Proyecto = Data.Rows(0)("Proyecto").ToString - Me.Cuenta = Data.Rows(0)("Cuenta").ToString.ToEntero - Me.CveEstadoActivoFijo = Data.Rows(0)("CveEstadoActivoFijo").ToString.ToEntero - Me.EstadoActivoFijo = Data.Rows(0)("EstadoActivoFijo").ToString - Me.IdCtaContDepreciacion = Data.Rows(0)("IdCtaContDepreciacion").ToString.ToEntero - Me.PorDepreciacion = Data.Rows(0)("PorDepreciacion").ToString.ToDouble - Me.Observaciones = Data.Rows(0)("Observaciones").ToString - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero - Me.Usuario = Data.Rows(0)("Usuario").ToString - Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetActivosFijosProyectos(CveEmpresa As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosUsuarioGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetRepActivosFijosDepreciacion(CveEmpresa As Integer, Fecha As Date) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_DepreciacionesGetRep") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Fecha", SqlDbType.Date).Value = Fecha - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Depreciaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetActivosFijos(CveActivoFijo As Integer, CveEmpresa As Integer, Codigo As String, Descripcion As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, NoSerie As String, Año As Integer, CvePersonaResponsable As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CaracteristicaValor As String, CveCliente As Integer, Optional BuscaGrupoEmpresa As Integer = -1, Optional BuscaPorAFPadre As Integer = -1, Optional CveGrupo As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Codigo", SqlDbType.VarChar).Value = Codigo - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie - .Add("@Año", SqlDbType.Int).Value = Año - .Add("@CvePersonaResponsable", SqlDbType.Int).Value = CvePersonaResponsable - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - .Add("@CaracteristicaValor", SqlDbType.VarChar).Value = CaracteristicaValor - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@BuscaGrupoEmpresa", SqlDbType.Int).Value = BuscaGrupoEmpresa - .Add("@CveAFPadre", SqlDbType.Int).Value = BuscaPorAFPadre - .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo - End With - Try - SqlAdapter.Fill(Data) - - If CveActivoFijo > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then - Me.CveActivoFijo = Data.Rows(0)("CveActivoFijo").ToString.ToEntero - - Me.Codigo = Data.Rows(0)("Codigo").ToString - Me.Descripcion = Data.Rows(0)("Descripcion").ToString - Me.CuentaInicial = Data.Rows(0)("Conta_CuentaInicial").ToString.ToEntero - Me.CveTipoActivoFijo = Data.Rows(0)("CveTipoActivoFijo").ToString.ToEntero - Me.TipoActivoFijo = Data.Rows(0)("TipoActivoFijo").ToString - Me.CveSubTipoActivoFijo = Data.Rows(0)("CveSubTipoActivoFijo").ToString.ToEntero - Me.SubTipoActivoFijo = Data.Rows(0)("SubTipoActivoFijo").ToString - Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero - Me.ValorCompra = Data.Rows(0)("ValorCompra").ToString.ToDouble - Me.FechaCompra = Data.Rows(0)("FechaCompra").ToString.ToDate - Me.CvePersonaResponsable = Data.Rows(0)("CvePersonaResponsable").ToString.ToEntero - Me.Responsable = Data.Rows(0)("Responsable").ToString - Me.NoSerie = Data.Rows(0)("NoSerie").ToString - Me.Año = Data.Rows(0)("Año").ToString.ToEntero - Me.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero - Me.SubProyecto = Data.Rows(0)("SubProyecto").ToString - Me.CveProyecto = Data.Rows(0)("CveProyecto").ToString.ToEntero - Me.Proyecto = Data.Rows(0)("Proyecto").ToString - Me.Cuenta = Data.Rows(0)("Cuenta").ToString.ToEntero - Me.CveEstadoActivoFijo = Data.Rows(0)("CveEstadoActivoFijo").ToString.ToEntero - Me.EstadoActivoFijo = Data.Rows(0)("EstadoActivoFijo").ToString - Me.IdCtaContDepreciacion = Data.Rows(0)("IdCtaContDepreciacion").ToString.ToEntero - Me.PorDepreciacion = Data.Rows(0)("PorDepreciacion").ToString.ToDouble - Me.Observaciones = Data.Rows(0)("Observaciones").ToString - Me.MesesDepreciacion = Data.Rows(0)("MesesDepreciacion").ToString.ToEntero - Me.CveCliente = Data.Rows(0)("CveCliente").ToString.ToEntero - Me.NombreCliente = Data.Rows(0)("NombreCliente").ToString - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero - Me.Usuario = Data.Rows(0)("Usuario").ToString - Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero - Me.MedidaUso = Data.Rows(0)("MedidaUso").ToString - Me.CveMovimientoInv = Data.Rows(0)("CveMovimientoInv").ToString.ToEntero - Me.FolioInv = Data.Rows(0)("FolioInv").ToString - Me.AlmacenInv = Data.Rows(0)("AlmacenInv").ToString - Me.CveMarcaActivoFijo = Data.Rows(0)("CveMarcaActivoFijo").ToString.ToEntero - Me.CveModeloActivoFijo = Data.Rows(0)("CveModeloActivoFijo").ToString.ToEntero - Me.CveGrupoAF = Data.Rows(0)("CveGrupo").ToString.ToEntero - Me.CveAFPadre = Data.Rows(0)("CveAFPadre").ToString.ToEntero - Me.CveDispositivo = Data.Rows(0)("CveDispositivo").ToString.ToEntero - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - 'Public Function AddActivosFijos(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, - ' CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, Cuenta As Integer, - ' CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, PorDeduccion As Double, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_AF_ActivosFijosAdd") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@Codigo", SqlDbType.VarChar).Value = Codigo - ' .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - ' .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - ' .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra - ' .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra - ' .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable - ' .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie - ' .Add("@Año", SqlDbType.Int).Value = Año - ' .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - ' .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = Cuenta - ' .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - ' .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion - ' .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion - ' .Add("@PorDeduccion", SqlDbType.Float).Value = PorDeduccion - ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al Guardar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - ' Catch ex As Exception - - ' End Try - - ' Return Retorno - 'End Function - Public Function AddActivosFijos(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, - CveSubProyecto As Integer, Cuenta As Integer, CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, Observaciones As String, CveCliente As Integer, - CveMovimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveModelo As Integer = -1, Optional CveGrupo As Integer = -1, - Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_AF_ActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Codigo", SqlDbType.VarChar).Value = Codigo - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra - .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra - .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable - .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie - .Add("@Año", SqlDbType.Int).Value = Año - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = Cuenta - .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion - .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion - '.Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento - .Add("@CveMarca", SqlDbType.Int).Value = CveMarca - .Add("@CveModelo", SqlDbType.Int).Value = CveModelo - .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo - .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - - .Add("@CveActivoFijo", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue - End With - - Try - SqlAdapter.Fill(Data) - CveActivoFijo = SqlAdapter.SelectCommand.Parameters("@CveActivoFijo").Value.ToString.ToEntero - 'Dim RetValue As Integer = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero - Retorno = CveActivoFijo - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - If Ex1.Message.Contains("UN_ActivoFijo") Then - Alert("El Codigo ya se encuentra registrado", TipoMensaje.MsgAdvertencia) - Else - Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) - End If - - Else - Me.OnError("Ocurrió un error al Guardar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - - End Try - - Return Retorno - End Function - Public Function UpdateActivosFijos(CveActivoFijo As Integer, Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, - CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, IdCtaContActivoFijo As Integer, - CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, Observaciones As String, CveCliente As Integer, - CveUsuarioModifico As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveModelo As Integer = -1, Optional CveGrupo As Integer = -1, - Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@Codigo", SqlDbType.VarChar).Value = Codigo - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra - .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra - '.Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo - '.Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo - .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable - .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie - .Add("@Año", SqlDbType.Int).Value = Año - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = IdCtaContActivoFijo - .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion - .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion - .Add("@PorDeduccion", SqlDbType.Float).Value = -1 - .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveMarca", SqlDbType.Int).Value = CveMarca - .Add("@CveModelo", SqlDbType.Int).Value = CveModelo - .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo - .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveActivosFijos(CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosRemove") - SqlAdapter.SelectCommand.Parameters.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateActivosFijosCompra(CveActivoFijo As Integer, CveCompraDetalle As Integer, TipoAF As Integer, ValorCompra As Double, FechaCompra As Date) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosCompraUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle - .Add("@TipoAF", SqlDbType.Int).Value = TipoAF - .Add("@ValorCompra", SqlDbType.Float).Value = ValorCompra - .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateActivosFijosCuentaAC(CveActivoFijo As Integer, IdCuentaContable As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosCtaContableUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@IdCuentaContable", SqlDbType.Int).Value = IdCuentaContable - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - -#End Region - -#Region "A C T I V O S - F I J O S- B I T A C O R A S" - Public Function GetActivosFijosBitacora(CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosBitacoraGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Bitacora.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddActivosFijosBitacora(CveActivoFijo As Integer, Observacion As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosBitacoraAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar la Bitacora del Activo Fijo ", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region - -#Region "A C T I V O S - F I J O S - C A R A C T E R I S T I C A S" - - Public Function GetActivosFijosCaracteristicas(CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosCaracteristicasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region "A C T I V O S- F I J O S - H I S T O R I A L" - Public Function GetActivosFijosHistorial(CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosHistorialGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Historial.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddActivosFijosHistorial(CveActivoFijo As Integer, CveConceptoHistorialActivoFijo As Integer, Actual As String, Anterior As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosHistorialAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo - .Add("@Actual", SqlDbType.VarChar).Value = Actual - .Add("@Anterior", SqlDbType.VarChar).Value = Anterior - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Historial del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region - -#Region "A C T I V O S- F I J O S - I M A G E N E S" - Public Function GetActivosFijosImagenes(CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosImagenesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Imagenes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddActivosFijosImagenes(CveActivoFijo As Integer, URL As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosImagenesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@URL", SqlDbType.VarChar).Value = URL - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe una Imagen en Fijo Imagenes con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar la Imagen en Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar la Imagen en Activo Fijo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function RemoveActivosFijosImagenes(CveImagenActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivosFijosImagenesRemove") - SqlAdapter.SelectCommand.Parameters.Add("@CveImagenActivoFijo", SqlDbType.Int).Value = CveImagenActivoFijo - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("La Imagen del Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar la Imagen del Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Imagen del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "A C T I V O S - F I J O S - R E S G U A R D O S" - Public Function GetActivosFijosResguardos(CveActivoFijo As Integer, CveActivoFijoResguardo As Integer, CveResponsable As Integer, CveResguardo As Integer, Optional CveEmpresa As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional Folio As Integer = -1, Optional CveResguardo2 As Integer = -1, Optional UsuarioImprimio As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosResguardosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo - .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable - .Add("@CveResguardo", SqlDbType.Int).Value = CveResguardo - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveResguardo2", SqlDbType.Int).Value = CveResguardo2 - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@UsuarioImprimio", SqlDbType.Int).Value = UsuarioImprimio - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Resguardos.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function ActivoFijoResguardoADD(FechaInicio As Date, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveActivoFijo As Integer, TipoDocto As String, Tipo As Integer, CveEmpresa As Integer, Optional Observaciones As String = " ", Optional CveResguardo As Integer = -1) As Boolean - 'Dim CveResguardo As Integer = -1 - Dim Retorno = False - DataAdapter("PA_AF_ActivosFijosResguardosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@CveResguardo", SqlDbType.Int).Value = CveResguardo - .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output - End With - Try - SqlAdapter.Fill(Data) - FolioResguardo = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString().ToEntero() - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al guardar el resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function ActivoFijoResguardoGpo() As Integer - Dim CveResguardo As Integer = -1 - DataAdapter("PA_AF_ActivosFijosResguardosGpo") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveResguardo", SqlDbType.Int).Direction = ParameterDirection.Output - End With - Try - SqlAdapter.Fill(Data) - CveResguardo = SqlAdapter.SelectCommand.Parameters("@CveResguardo").Value.ToString().ToEntero() - Catch ex As Exception - OnError("Ocurrió un error al obtener el grupo del resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return CveResguardo - End Function - Public Function UpdateActivosFijosResguardos(FechaFin As String, Observaciones As String, URL As String, CveActivoFijoResguardo As Integer, CveActivoFijo As Integer, Optional URL2 As String = "-1", Optional CveResguardo2 As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosResguardosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaFin", SqlDbType.VarChar).Value = FechaFin - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@URL", SqlDbType.VarChar).Value = URL - .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@URL2", SqlDbType.VarChar).Value = URL2 - .Add("@CveResguardo2", SqlDbType.Int).Value = CveResguardo2 - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateEstatusResguardo(EstatusResguardo As Integer, CveEmpresa As Integer, CveActivoFijo As Integer, Optional CveSubProyecto As Integer = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_UpdateEstatusResguardo") - 'ESTATUS RESGUARDO: 1- Disponible, 2- En Traslado, 3- Asignado - With SqlAdapter.SelectCommand.Parameters - .Add("@EstatusResguardo", SqlDbType.Int).Value = EstatusResguardo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateActivosFijosResguardosURL(URL As String, URL2 As String, CveActivoFijoResguardo As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosResguardosUrlUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@URL", SqlDbType.VarChar).Value = URL - .Add("@URL2", SqlDbType.VarChar).Value = URL2 - .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateActivosFijosResguardosURLGpo(URL As String, URL2 As String, CveResguardo As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosResguardosGpoUrl") - - With SqlAdapter.SelectCommand.Parameters - .Add("@URL", SqlDbType.VarChar).Value = URL - .Add("@URL2", SqlDbType.VarChar).Value = URL2 - .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveResguardo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetActivosFijosHijos(CveEmpresa As Integer, CveAFPadre As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosHijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al obtener los AF Hijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - -#End Region - -#Region "A C T I V O S - F I J O S - COMPRAS " - Public Function GetActivosFijosCompras(CveActivoFijo As Integer, Optional CveClasificacion As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivosFijosCompras") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As Exception - OnError("Ocurrió un error al obtener las Compras del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function -#End Region - -#Region " ************************************************ C A R A C T E R I S T I C A S ************************************************ " - -#Region "ClasificacionesCaracteristicas" - - Public Function GetCaracteristicasClasificaciones(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasClasificacionesGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Data.TableName = "CaracteristicasClasificaciones" - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Clasificaciones de Características.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddClasificacionesCaracteristicas(CaracteristicaClasificacion As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasClasificacionesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CaracteristicaClasificacion", SqlDbType.VarChar).Value = CaracteristicaClasificacion - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al Guardar la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateClasificacionesCaracteristicas(CaracteristicaClasificacion As String, Estatus As Boolean, CveCaracteristicaClasificacion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasClasificacionesUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CaracteristicaClasificacion", SqlDbType.VarChar).Value = CaracteristicaClasificacion - '.Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - '.Add("@Orden", SqlDbType.Int).Value = Orden - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe una Clasificacion de Caracteristica con el mismo nombre: " & CaracteristicaClasificacion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en la Clasificacion de Caracteristica", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveClasificacionesCaracteristicas(CveCaracteristicaClasificacion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasClasificacionesRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion - SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("La Clasificacion de Caracteristica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar la Clasificacion de Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - - -#Region "Características" - Public Function GetCaracteristicas(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasGet") - - SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - Try - SqlAdapter.Fill(Data) - Data.TableName = "Caracteristicas" - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Características.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - - Return Retorno - End Function - Public Function AddCaracteristica(Caracteristica As String, CveCaracteristicaClasificacion As Integer, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, TipoCampo As Integer, Longitud As Integer, Requerido As Integer, Orden As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@TipoCampo", SqlDbType.TinyInt).Value = TipoCampo - .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion - .Add("@Longitud", SqlDbType.Int).Value = Longitud - .Add("@Requerido", SqlDbType.Int).Value = Requerido - .Add("@Orden", SqlDbType.Int).Value = Orden - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe una Característica con el mismo nombre: " & Caracteristica & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar la Característica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCaracteristica(CveCaracteristicaClasificacion As Integer, Caracteristica As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, TipoCampo As Integer, Longitud As Integer, Requerida As Boolean, Orden As Integer, Estatus As Boolean, CveEmpresa As Integer, CveCaracteristica As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCaracteristica", SqlDbType.VarChar).Value = CveCaracteristica - .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica - .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@TipoCampo", SqlDbType.TinyInt).Value = TipoCampo - .Add("@Longitud", SqlDbType.Int).Value = Longitud - .Add("@Orden", SqlDbType.Int).Value = Orden - .Add("@Requerida", SqlDbType.Bit).Value = Requerida - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe una Caracteristica con el mismo nombre: " & Caracteristica & ".", TipoMensaje.MsgAdvertencia) - ElseIf Ex1.Message.Contains("Número: 547;") Then - Alert("La Característica tiene Opciones que están siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en la Característica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveCaracteristica(CveCaracteristica As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("La Característica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Característica de Tipo de Cuenta y/o Equipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - - -#Region "CaracteristicasOpciones" - - Public Function GetCaracteristicasOpciones(CveCaracteristica As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasOpcionesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Data.TableName = "CaracteristicasOpciones" - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las Opciones para las Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetCaracteristicasOpcionesSubTipo(CveCaracteristica As Integer, CveSubTipoActivoFijo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasOpcionesSubTipoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Data.TableName = "CaracteristicasOpciones" - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las Opciones para las Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddCaracteristicasOpciones(CaracteristicaOpcion As String, CveCaracteristica As Integer, Orden As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasOpcionesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CaracteristicaOpcion", SqlDbType.VarChar).Value = CaracteristicaOpcion - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@Orden", SqlDbType.Int).Value = Orden - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe una Opcion para la Caracteristica con el mismo nombre: " & CaracteristicaOpcion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCaracteristicasOpciones(CveCaracteristica As Integer, CaracteristicaOpcion As String, Orden As Integer, Estatus As Boolean, CveCaracteristicaOpcion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasOpcionesUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CaracteristicaOpcion", SqlDbType.VarChar).Value = CaracteristicaOpcion - .Add("@Orden", SqlDbType.Int).Value = Orden - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveCaracteristicaOpcion", SqlDbType.Int).Value = CveCaracteristicaOpcion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe una Opcion para la Caracteristica con el mismo nombre: " & CaracteristicaOpcion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveCaracteristicasOpciones(CveCaracteristicaOpcion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasOpcionesRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCaracteristicaOpcion", SqlDbType.Int).Value = CveCaracteristicaOpcion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("La Opcion para la Caracteristica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - - -#Region "A C T I V O S V A L O R E S" - Public Function GetActivosFijosValores(CveActivoFijo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ActivoFijoValoresGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Valores de Activos Fijos .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivoFijoValoresAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion - .Add("@Valor", SqlDbType.VarChar).Value = Valor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - Me.OnError("Ocurrió un error al Guardar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - - End Try - - Return Retorno - End Function - - Public Function AddUpdActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivoFijoValoresAddUpd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion - .Add("@Valor", SqlDbType.VarChar).Value = Valor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - Me.OnError("Ocurrió un error al Guardar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - - End Try - - Return Retorno - End Function - - Public Function UpdateActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer, CveValor As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivoFijoValoresUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion - .Add("@Valor", SqlDbType.VarChar).Value = Valor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveValor", SqlDbType.Int).Value = CveValor - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - Me.OnError("Ocurrió un error al guardar los cambios en el Valor del Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Valor del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveActivosFijosValores(CveActivoFijo As Integer, CveValor As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActivoFijoValoresRemove") - SqlAdapter.SelectCommand.Parameters.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - SqlAdapter.SelectCommand.Parameters.Add("@CveValor", SqlDbType.Int).Value = CveValor - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Valor de Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Valor de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region -#End Region - -#Region "Subtipos Activos Fijos" - - Public Function GetSubTiposActivosFijos(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_SubTiposActivosFijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Subtipos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddSubTiposActivosFijos(CveTipoActivoFijo As Integer, SubTipoActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer, Optional AplicaGPS As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_SubTiposActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@SubTipoActivoFijo", SqlDbType.VarChar).Value = SubTipoActivoFijo - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@AplicaGPS", SqlDbType.Bit).Value = AplicaGPS - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Subtipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateSubTiposActivosFijos(CveSubTipoActivoFijo As Integer, CveTipoActivoFijo As Integer, SubTipoActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_SubTiposActivosFijosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@SubTipoActivoFijo", SqlDbType.VarChar).Value = SubTipoActivoFijo - .Add("@Estado", SqlDbType.Bit).Value = Estado - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Subtipo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveSubTiposActivosFijos(CveSubTiposActivosFijos As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_SubTiposActivosFijosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTiposActivosFijos - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar el Subtipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "Tipos Activos Fijos" - - Public Function GetTiposActivosFijos(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposActivosFijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Tipos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddTiposActivosFijos(TipoActivoFijo As String, CuentaInicial As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional PorDepreciacion As Decimal = 0, Optional MedidaVehicular As Integer = 1, Optional AutoFolio As Boolean = False, Optional Contable As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoActivoFijo", SqlDbType.VarChar).Value = TipoActivoFijo - .Add("@CuentaInicial", SqlDbType.VarChar).Value = CuentaInicial - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@PorDepreciacion", SqlDbType.Money).Value = PorDepreciacion - .Add("@MedidaVehicular", SqlDbType.TinyInt).Value = MedidaVehicular - .Add("@AutoFolio", SqlDbType.Bit).Value = AutoFolio - .Add("@Contable", SqlDbType.Bit).Value = Contable - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Tipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateTiposActivosFijos(CveTipoActivoFijo As Integer, TipoActivoFijo As String, CuentaInicial As Integer, Estado As Boolean, Optional PorDepreciacion As Decimal = 0, Optional MedidaVehicular As Integer = 1, Optional AutoFolio As Boolean = False, Optional Contable As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposActivosFijosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@TipoActivoFijo", SqlDbType.VarChar).Value = TipoActivoFijo - .Add("@CuentaInicial", SqlDbType.VarChar).Value = CuentaInicial - .Add("@Estado", SqlDbType.Bit).Value = Estado - .Add("@PorDepreciacion", SqlDbType.Money).Value = PorDepreciacion - .Add("@MedidaVehicular", SqlDbType.TinyInt).Value = MedidaVehicular - .Add("@AutoFolio", SqlDbType.Bit).Value = AutoFolio - .Add("@Contable", SqlDbType.Bit).Value = Contable - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Tipo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveTiposActivosFijos(CveTiposActivosFijos As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposActivosFijosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTiposActivosFijos - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar el tipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "A C T I V O S - S U B T I P O S " - - Public Function GetSubTiposCaracteristicas(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_SubTiposCaracteristicasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de caracteristicas de Subtipos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddSubTipoCaracteristica(CveSubTipoActivoFijo As Integer, CveCaracteristica As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_SubTiposCaracteristicasAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Subtipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveSubTipoCaracteristica(CveSubTipoActivosFijos As Integer, CveCaracteristica As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_SubTiposCaracteristicasRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivosFijos - .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica - End With - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar el Subtipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "ESTATUS DE ACTIVOS FIJOS" - Public Function GetEstatusActivoFijo() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_EstatusActivoFijoGet") - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddEstatusActivoFIjo(EstadoActivoFijo As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_EstatusActivoFijoAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@EstadoActivoFijo", SqlDbType.Int).Value = EstadoActivoFijo - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Departamento", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateEstatusActivoFijo(CveEstadoActivoFIjo As Integer, EstadoActivoFijo As Integer, Estado As Boolean) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_EstatusActivoFijoUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@EstadoActivoFijo", SqlDbType.Int).Value = EstadoActivoFijo - .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFIjo - .Add("@Estado", SqlDbType.Bit).Value = Estado - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al guardar los cambios en el Estado del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - Return Retorno - End Function - Public Function RemoveEstatusActivoFijo(CveEstadoActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_EstatusActivoFijoRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Departamento no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Departamento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Departamento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "ClsAFModelosActivosFijos" - Public Function GetModelosActivosFijos(CveEmpresa As Integer, CveMarca As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ModelosActivosFijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveMarca", SqlDbType.Int).Value = CveMarca - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Modelos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddModelosActivosFijos(ModeloActivoFijo As String, CveMarcaAF As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ModelosActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@ModeloActivoFijo", SqlDbType.VarChar).Value = ModeloActivoFijo - .Add("@CveMarcaAF", SqlDbType.Int).Value = CveMarcaAF - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Modelo del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateModelosActivosFijos(CveModeloActivoFijo As Integer, ModeloActivoFijo As String, CveMarcaAF As Integer, Estado As Boolean, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ModelosActivosFijosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo - .Add("@ModeloActivoFijo", SqlDbType.VarChar).Value = ModeloActivoFijo - .Add("@CveMarcaAF", SqlDbType.Int).Value = CveMarcaAF - .Add("@Estado", SqlDbType.Bit).Value = Estado - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Modelo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveModelosActivosFijos(CveModelosActivosFijos As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ModelosActivosFijosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModelosActivosFijos - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar el Modelo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "ClsAFMarcasActivosFijos" - Public Function GetMarcasActivosFijos(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_MarcasActivosFijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Marcas de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddMarcasActivosFijos(MarcaActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MarcasActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@MarcaActivoFijo", SqlDbType.VarChar).Value = MarcaActivoFijo - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar la Marca del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateMarcasActivosFijos(CveMarcaActivoFijo As Integer, MarcaActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MarcasActivosFijosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo - .Add("@MarcaActivoFijo", SqlDbType.VarChar).Value = MarcaActivoFijo - .Add("@Estado", SqlDbType.Bit).Value = Estado - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en la Marca del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveMarcasActivosFijos(CveMarcaActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MarcasActivosFijosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar la Marca del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "AF G R U P O S" - Public Function GetGrupoAF(CveGrupo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_GruposGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Grupos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddGrupoAF(Grupo As String, CveUsuario As Integer, CveEmpresa As Integer) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_AF_GruposAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Grupo", SqlDbType.VarChar).Value = Grupo - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveGrupo", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@CveGrupo").Value.ToString.ToEntero - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Grupo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateGrupoAF(Grupo As String, Estatus As Boolean, CveGrupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_GruposUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Grupo", SqlDbType.VarChar).Value = Grupo - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Actualizar el Grupo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function RemoveGrupoAF(CveEmpresa As Integer, CveGrupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_GruposRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Eliminar el Grupo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region - -#Region "ClsAFConceptosHistorial" - - Public Function GetConceptosHistorial() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ConceptosHistorialGet") - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo Historial de Conceptos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddConceptosHistorial(ConceptoHistorialActivoFijo As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ConceptosHistorialAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@ConceptoHistorialActivoFijo", SqlDbType.VarChar).Value = ConceptoHistorialActivoFijo - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar el Concepto del Historial", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateDepartamento(CveConceptoHistorialActivoFijo As Integer, ConceptoHistorialActivoFijo As String, Estado As Boolean) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_RH_DepartamentoUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo - .Add("@ConceptoHistorialActivoFijo", SqlDbType.VarChar).Value = ConceptoHistorialActivoFijo - .Add("@Estado", SqlDbType.Bit).Value = Estado - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al guardar los cambios en el Concepto del Historial.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveConceptosHistorialRemove(CveConceptoHistorialActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ConceptosHistorialRemove") - SqlAdapter.SelectCommand.Parameters.Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar el Concepto del Historial.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "ClsAFCaracteristicasActivosFijos" - - Public Function GetCaracteristicasActivosFijos(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CaracteristicasActivosFijos") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Características de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddCaracteristicasActivosFijos(CveActivoFijo As Integer, Caracteristica As String, EsRequerido As Boolean, EsUnico As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo - .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica - .Add("@EsRequerido", SqlDbType.Bit).Value = EsUnico - .Add("@EsUnico", SqlDbType.Bit).Value = EsRequerido - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al Guardar la Característica del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCaracteristicasActivosFijos(CveTipoActivoFijo As Integer, Caracteristica As String, EsRequerido As Boolean, EsUnico As Boolean, CveEmpresa As Integer, CveCaracteristicaActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasActivosFijosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoActivoFijo", SqlDbType.VarChar).Value = CveTipoActivoFijo - .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica - .Add("@EsRequerido", SqlDbType.Bit).Value = EsUnico - .Add("@EsUnico", SqlDbType.Bit).Value = EsRequerido - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCaracteristicaActivoFijo", SqlDbType.VarChar).Value = CveCaracteristicaActivoFijo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - OnError("Ocurrió un error al guardar los cambios en la Característica del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveCaracteristicasActivosFijos(CveCaracteristicaActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CaracteristicasActivosFijosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristicaActivoFijo", SqlDbType.Int).Value = CveCaracteristicaActivoFijo - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex As SqlException - Me.OnError("Ocurrió un error al eliminar la Característica del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region "O P E R A D O R E S" - Public Function GetTipoOperadores(CveTipoOperador As String, CveEmpresa As Integer, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_TipoOperadoresGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoOperador", SqlDbType.VarChar).Value = CveTipoOperador - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Tipo Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddOperador(Operador As String, CveTipoOperador As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CveTransportista As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_OperadoresAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@Operador", SqlDbType.VarChar).Value = Operador - .Add("@CveTipoOperador", SqlDbType.VarChar).Value = CveTipoOperador - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateOperador(CveOperador As Integer, Operador As String, CveTipoOperador As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, Optional CveTransportista As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_OperadoresUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOperador", SqlDbType.Int).Value = CveOperador - .Add("@Operador", SqlDbType.VarChar).Value = Operador - .Add("@CveTipoOperador", SqlDbType.VarChar).Value = CveTipoOperador - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el chofer.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveOperador(CveOperador As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_OperadoresRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOperador", SqlDbType.Int).Value = CveOperador - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetOperadores(CveOperador As Integer, CveEmpresa As Integer, Estatus As Integer, Optional CveTransportista As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_OperadoresGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOperador", SqlDbType.Int).Value = CveOperador - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el chofer.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "T I P O S C O M B U S T I B L E S" - Public Function GetTiposCombustible(CveTipoCombustible As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposCombustibleGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTiposCombustible", SqlDbType.VarChar).Value = CveTipoCombustible - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Tipos de combustible", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddTipoCombustible(TipoCombustible As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposCombustibleAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoCombustible", SqlDbType.VarChar).Value = TipoCombustible - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el tipo de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateTipoCombustible(CveTipoCombustible As Integer, TipoCombustible As String, Estatus As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposCombustibleUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible - .Add("@TipoCombustible", SqlDbType.VarChar).Value = TipoCombustible - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el tipo de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveTipoCombustible(CveTipoCombustible As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_OperadoresRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "C O M B U S T I B L E S" - Public Function GetCombustibles(CveCombustible As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CombustiblesGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddCombustible(Combustible As String, CveTipoCombustible As Integer, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CombustiblesAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@Combustible", SqlDbType.VarChar).Value = Combustible - .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateCombustible(CveCombustible As Integer, Combustible As String, CveTipoCombustible As Integer, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CombustiblesUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible - .Add("@Combustible", SqlDbType.VarChar).Value = Combustible - .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveCombustible(CveCombustible As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CombustiblesRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "C A R G A S C O M B U S T I B L E S " - Public Function GetCargasCombustible(CveAF As Integer, CveProveedor As Integer, CveTipoAF As Integer, CveSubProyecto As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer, Optional CveCargaCombustible As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CargaCombustibleGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa - .Add("@CveCargaCombustible", SqlDbType.Int).Value = CveCargaCombustible - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las cargas de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddCargaCombustible(CveCombustible As Integer, CveProveedor As Integer, CveAF As Integer, Folio As String, FechaCarga As DateTime, TanqueLleno As Integer, Cantidad As Double, CostoUnitario As Double, Odometro As Double, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_CargaCombustiblesAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Folio", SqlDbType.VarChar).Value = Folio - .Add("@FechaCarga", SqlDbType.DateTime).Value = FechaCarga - .Add("@TanqueLleno", SqlDbType.Int).Value = TanqueLleno - .Add("@Cantidad", SqlDbType.Float).Value = Cantidad - .Add("@CostoUnitario", SqlDbType.SmallMoney).Value = CostoUnitario - .Add("@Odometro", SqlDbType.SmallMoney).Value = Odometro - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la carga de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetRepCargasCombustible(FechaI As String, FechaF As String, CveTipoAF As Integer, CveSubProyecto As Integer, GPO As Integer, CveProveedor As Integer, CveEstatus As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_RepCargasCombustibleGet") - - With SqlAdapter.SelectCommand.Parameters - '.Add("@CveVenta", SqlDbType.Int).Value = CveVenta - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@GPO", SqlDbType.Int).Value = GPO - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Flotillas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region - -#Region "P L A C A S" - Public Function GetPlacas(CvePlaca As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PlacasGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Placas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddPlacas(CveAF As Integer, Placa As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", - Optional FechaExpedicion As String = "-1", Optional FechaVencimiento As String = "-1") As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PlacasAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Placa", SqlDbType.VarChar).Value = Placa - .Add("@FechaExpedicion", SqlDbType.VarChar).Value = FechaExpedicion - .Add("@FechaVencimiento", SqlDbType.VarChar).Value = FechaVencimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la placa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdatePlacas(CvePlaca As Integer, Placa As String, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional FechaExpedicion As Date = MinFecha, Optional FechaVencimiento As Date = MinFecha) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PlacasUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca - .Add("@Placa", SqlDbType.VarChar).Value = Placa - .Add("@FechaExpedicion", SqlDbType.Date).Value = FechaExpedicion - .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la placa", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemovePlaca(CvePlaca As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PlacasRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar la placa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetRepPlacas(CvePlaca As Integer, CveAF As Integer, CveEmpresa As Integer, FechaExpedicionI As DateTime, FechaExpedicionF As DateTime, FechaVencimientoI As DateTime, FechaVencimientoF As DateTime, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_RepPlacas") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@FechaExpedicionI", SqlDbType.DateTime).Value = FechaExpedicionI - .Add("@FechaExpedicionF", SqlDbType.DateTime).Value = FechaExpedicionF - .Add("@FechaVencimientoI", SqlDbType.DateTime).Value = FechaVencimientoI - .Add("@FechaVencimientoF", SqlDbType.DateTime).Value = FechaVencimientoF - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Placas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "L I C E N C I A S" - Public Function GetLicencias(CveLicencia As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_LicenciasGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Licencias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetLicenciasVencidas(CveLicencia As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional Estatus As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_LicenciasVencidasGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Licencias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetLicenciasRep(CveLicencia As Integer, CveAF As Integer, CveEmpresa As Integer, FechaEI As DateTime, FechaEF As DateTime, FechaVI As DateTime, FechaVF As DateTime, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Estatus As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_LicenciasRepGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@FechaEI", SqlDbType.DateTime).Value = FechaEI - .Add("@FechaEF", SqlDbType.DateTime).Value = FechaEF - .Add("@FechaVI", SqlDbType.DateTime).Value = FechaVI - .Add("@FechaVF", SqlDbType.DateTime).Value = FechaVF - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveCliente", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Licencias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddLicencia(CveAF As Integer, Licencia As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional CvePersonal As Integer = -1, Optional Estatus As Boolean = True) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_LicenciasAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Licencia", SqlDbType.VarChar).Value = Licencia - .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion - .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la licencia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateLicencia(CveLicencia As Integer, Licencia As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional Estatus As Boolean = True) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_LicenciasUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia - .Add("@Licencia", SqlDbType.VarChar).Value = Licencia - .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion - .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la licencia", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveLicencia(CveLicencia As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_LicenciasRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar la licencia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "P O L I Z A S S E G U R O S " - Public Function GetPolizasSeguro(CvePoliza As Integer, CveAF As Integer, CveProveedor As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PolizasSeguroGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePoliza", SqlDbType.Int).Value = CvePoliza - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Pólizas de seguro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetRepPolizaSeguro(CveAF As Integer, CveProveedor As Integer, FechaExpedicionI As DateTime, FechaExpedicionF As DateTime, FechaVencimientoI As DateTime, FechaVencimientoF As DateTime, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_RepPolizaSeguroGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaExpedicionI", SqlDbType.DateTime).Value = FechaExpedicionI - .Add("@FechaExpedicionF", SqlDbType.DateTime).Value = FechaExpedicionF - .Add("@FechaVencimientoI", SqlDbType.DateTime).Value = FechaVencimientoI - .Add("@FechaVencimientoF", SqlDbType.DateTime).Value = FechaVencimientoF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Polizas de Seguros.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddPolizasSeguro(CveAF As Integer, CveProveedor As Integer, PolizaSeguro As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional Proveedor As String = "-1") As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PolizasSegurosAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@PolizaSeguro", SqlDbType.VarChar).Value = PolizaSeguro - .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion - .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto - .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la póliza de seguro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdatePolizaSeguro(CvePoliza As Integer, CveProveedor As Integer, PolizaSeguro As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional Proveedor As String = "-1") As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PolizasSegurosUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePoliza", SqlDbType.Int).Value = CvePoliza - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@PolizaSeguro", SqlDbType.VarChar).Value = PolizaSeguro - .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion - .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento - .Add("@Observacion", SqlDbType.VarChar).Value = Observacion - .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto - .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la póliza de seguro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemovePoliza(CvePoliza As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_PolizasSeguroRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePoliza", SqlDbType.Int).Value = CvePoliza - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar la póliza de seguro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "I N C I D E N T E S " - Public Function GetIncidentes(CveIncidente As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_IncidentesGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Incidentes", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetIncidentesRep(CveIncidente As Integer, CveAF As Integer, CveEmpresa As Integer, FechaInicio As String, FechaFin As String, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_IncidentesRepGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@FechaInicial", SqlDbType.VarChar).Value = FechaInicio - .Add("@FechaFinal", SqlDbType.VarChar).Value = FechaFin - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Incidentes", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddIncidente(CveAF As Integer, Asunto As String, Descripcion As String, Odometro As Double, Horometro As Double, Prioridad As Integer, FechaIncidente As DateTime, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_IncidentesAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@Odometro", SqlDbType.Float).Value = Odometro - .Add("@Horometro", SqlDbType.Float).Value = Horometro - .Add("@FechaIncidente", SqlDbType.DateTime).Value = FechaIncidente - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el incidente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateIncidente(CveIncidente As Integer, Asunto As String, Descripcion As String, Odometro As Double, Horometro As Double, Prioridad As Integer, FechaIncidente As DateTime) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_IncidentesUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@Odometro", SqlDbType.Float).Value = Odometro - .Add("@Horometro", SqlDbType.Float).Value = Horometro - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@FechaIncidente", SqlDbType.DateTime).Value = FechaIncidente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el incidente", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveIncidente(CveIncidente As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_IncidenteRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el incidente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "F A L L A S / A C C I D E N T E S " - Public Function GetTipoFallas(CveTipoFalla As Integer, CveEmpresa As Integer, ClasificacionTipoFalla As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_TipoFallasGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@ClasificacionTipoFalla", SqlDbType.Int).Value = ClasificacionTipoFalla - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Tipo Fallas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetFallas(CveFalla As Integer, CveAF As Integer, CveEmpresa As Integer, CveTipoFalla As Integer, ClasificacionTipoFalla As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_FallasGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveFalla", SqlDbType.Int).Value = CveFalla - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla - .Add("@ClasificacionTipoFalla", SqlDbType.Int).Value = ClasificacionTipoFalla - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Fallas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddFalla(CveAF As Integer, Asunto As String, Descripcion As String, AFMedida As Integer, Prioridad As Integer, FechaFalla As DateTime, CveUsuario As Integer, CveEmpresa As Integer, CveTipoFalla As Integer, CorreoNotificacion As String) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_FallasAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@AFMedida", SqlDbType.Int).Value = AFMedida - .Add("@FechaFalla", SqlDbType.DateTime).Value = FechaFalla - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla - .Add("@CorreoNotificacion", SqlDbType.VarChar).Value = CorreoNotificacion - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al Registrar la Falla.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateFalla(CveFalla As Integer, Asunto As String, Descripcion As String, AFMedida As Integer, Prioridad As Integer, FechaFalla As DateTime, CveTipoFalla As Integer, CorreoNotificacion As String) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_FallasUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveFalla", SqlDbType.Int).Value = CveFalla - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion - .Add("@AFMedida", SqlDbType.Int).Value = AFMedida - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@FechaFalla", SqlDbType.DateTime).Value = FechaFalla - .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla - .Add("@CorreoNotificacion", SqlDbType.VarChar).Value = CorreoNotificacion - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la falla", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveFalla(CveFalla As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_FallasRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveFalla", SqlDbType.Int).Value = CveFalla - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar la falla.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region -#Region "S E R V I C I O S" - Public Function GetServicios(CveServicio As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ServiciosGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveServicio", SqlDbType.Int).Value = CveServicio - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Servicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetServiciosTotal(CveServicio As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ServiciosTotalCompraGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveServicio", SqlDbType.Int).Value = CveServicio - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Servicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddServicio(CveAF As Integer, CveTipoServicio As Integer, FechaServicio As DateTime, CveProveedor As Integer, CveCompra As Integer, Horometro As Double, Observaciones As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Proveedor As String = "-1", Optional Importe As Double = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ServiciosAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@Horometro", SqlDbType.Float).Value = Horometro - .Add("@FechaServicio", SqlDbType.DateTime).Value = FechaServicio - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor - .Add("@Importe", SqlDbType.Float).Value = Importe - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateServicio(CveServicio As Integer, CveTipoServicio As Integer, FechaServicio As DateTime, CveProveedor As Integer, CveCompra As Integer, Horometro As Double, Observaciones As String, Optional Proveedor As String = "-1", Optional Importe As Double = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ServiciosUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveServicio", SqlDbType.Int).Value = CveServicio - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@FechaServicio", SqlDbType.DateTime).Value = FechaServicio - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@Horometro", SqlDbType.Float).Value = Horometro - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor - .Add("@Importe", SqlDbType.Float).Value = Importe - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el servicio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveServicio(CveServicio As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ServiciosRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveServicio", SqlDbType.Int).Value = CveServicio - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetRepServicios(CveAF As Integer, CveEmpresa As Integer, CveTipoServicio As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_RepServicios") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de servicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "E V E N T O S P R O G R A M A D O S " - Public Function GetRepEventosProgramados(CveAF As Integer, CveTipoAF As Integer, CveSubTipoAF As Integer, Asunto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_RepEventosProgramadosGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF - .Add("@CveSubTipoAF", SqlDbType.Int).Value = CveSubTipoAF - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Eventos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "ValesCombustible" - Public Function AddValesCombustible(FolioUsuario As Integer, CveCompra As Integer, CveProveedor As Integer, CveAF As Integer, CvePersonal As Integer, Fecha As Date, NombreRecibe As String, CveSubProyecto As Integer, Observaciones As String, Odometro As Integer, CveCombustible As Integer, Litros As Double, TipoVale As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional Recibo As Integer = -1, Optional Importe As Integer = -1) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_AF_ValesCombustibleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FolioUsuario", SqlDbType.Int).Value = FolioUsuario - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@NombreRecibe", SqlDbType.VarChar).Value = NombreRecibe - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@Odometro", SqlDbType.Int).Value = Odometro - .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible - .Add("@Litros", SqlDbType.Float).Value = Litros - .Add("@Recibo", SqlDbType.Float).Value = Recibo - .Add("@Importe", SqlDbType.Float).Value = Importe - .Add("@TipoVale", SqlDbType.Int).Value = TipoVale - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveVale", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - FolioVale = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero - Retorno = SqlAdapter.SelectCommand.Parameters("@CveVale").Value.ToString.ToEntero - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Vale de Combustible con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Vale de Combustible.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - - End Try - - Return Retorno - - End Function - Public Function GetValesCombustible(CveCompra As Integer, CveValeCombustible As Integer, Folio As Integer, CveProveedor As Integer, CveAF As Integer, CveSubProyecto As Integer, Odometro As Integer, CveCombustible As Integer, Litros As Double, CvePersonal As Integer, CveUsuario As Integer, CveEmpresa As Integer, Recibo As Integer, Importe As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_AF_ValesCombustibleGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveValeCombustible", SqlDbType.Int).Value = CveValeCombustible - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Odometro", SqlDbType.Int).Value = Odometro - .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible - .Add("@Litros", SqlDbType.Float).Value = Litros - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Recibo", SqlDbType.Int).Value = Recibo - .Add("@Importe", SqlDbType.Int).Value = Importe - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Vales Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateValeCombustible(CveVale As Integer, CveCompra As Integer, CveProveedor As Integer, NombreRecibe As String, Litros As Double, Recibo As Integer, Importe As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ValesCombustibleUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveVale", SqlDbType.Int).Value = CveVale - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@NombreRecibe", SqlDbType.VarChar).Value = NombreRecibe - .Add("@Litros", SqlDbType.Float).Value = Litros - .Add("@Recibo", SqlDbType.Int).Value = Recibo - .Add("@Importe", SqlDbType.Int).Value = Importe - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region -#Region "M E T R I C A S" + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) - Public Function GetMetricas(CveMetrica As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddMetricas(Metrica As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Metrica", SqlDbType.Int).Value = Metrica - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function DeleteMetricas(CveMetrica As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable + End Sub +#Region "Conexiones" + + Private Sub ConexionAdd() + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If + End Sub + + Private Sub ConexionClose() + If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + CveConexion = 0 + End If + + End Sub +#End Region + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc End Function + Public Sub RollBack() + SqlTransacc.Rollback() + End Sub + Public Sub Commit() + SqlTransacc.Commit() + End Sub +#Region "A C T I V O S- F I J O S" - Public Function GetMetricasRegistro(CveSubProyecto As Integer, CveEmpresa As Integer, Fecha As Date) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasRegistroGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + Public Function GetRepActivosFijos(CveActivoFijo As Integer, CveEmpresa As Integer, Codigo As String, Descripcion As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, NoSerie As String, Año As Integer, CvePersonaResponsable As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CaracteristicaValor As String, Optional BuscaGrupoEmpresa As Integer = -1, Optional Agrupador As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_AFGetRep") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Fecha", SqlDbType.Date).Value = Fecha - End With - - Try - SqlAdapter.Fill(DSet) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - - Public Function GetMetricasValores(CveMetricaValor As Integer, CveAF As Integer, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, FechaI As Date, FechaF As Date, - CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasValoresGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo - .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CvePersonaResponsable", SqlDbType.Int).Value = CvePersonaResponsable + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CaracteristicaValor", SqlDbType.VarChar).Value = CaracteristicaValor + .Add("@BuscaGrupoEmpresa", SqlDbType.Int).Value = BuscaGrupoEmpresa + .Add("@Gpo", SqlDbType.Int).Value = Agrupador + + End With + Try + SqlAdapter.Fill(Data) + + If CveActivoFijo > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then + Me.CveActivoFijo = Data.Rows(0)("CveActivoFijo").ToString.ToEntero + + Me.Codigo = Data.Rows(0)("Codigo").ToString + Me.Descripcion = Data.Rows(0)("Descripcion").ToString + Me.CuentaInicial = Data.Rows(0)("Conta_CuentaInicial").ToString.ToEntero + Me.CveTipoActivoFijo = Data.Rows(0)("CveTipoActivoFijo").ToString.ToEntero + Me.TipoActivoFijo = Data.Rows(0)("TipoActivoFijo").ToString + Me.CveSubTipoActivoFijo = Data.Rows(0)("CveSubTipoActivoFijo").ToString.ToEntero + Me.SubTipoActivoFijo = Data.Rows(0)("SubTipoActivoFijo").ToString + Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero + Me.ValorCompra = Data.Rows(0)("ValorCompra").ToString.ToDouble + Me.FechaCompra = Data.Rows(0)("FechaCompra").ToString.ToDate + Me.CvePersonaResponsable = Data.Rows(0)("CvePersonaResponsable").ToString.ToEntero + Me.Responsable = Data.Rows(0)("Responsable").ToString + Me.NoSerie = Data.Rows(0)("NoSerie").ToString + Me.Año = Data.Rows(0)("Año").ToString.ToEntero + Me.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero + Me.SubProyecto = Data.Rows(0)("SubProyecto").ToString + Me.CveProyecto = Data.Rows(0)("CveProyecto").ToString.ToEntero + Me.Proyecto = Data.Rows(0)("Proyecto").ToString + Me.Cuenta = Data.Rows(0)("Cuenta").ToString.ToEntero + Me.CveEstadoActivoFijo = Data.Rows(0)("CveEstadoActivoFijo").ToString.ToEntero + Me.EstadoActivoFijo = Data.Rows(0)("EstadoActivoFijo").ToString + Me.IdCtaContDepreciacion = Data.Rows(0)("IdCtaContDepreciacion").ToString.ToEntero + Me.PorDepreciacion = Data.Rows(0)("PorDepreciacion").ToString.ToDouble + Me.Observaciones = Data.Rows(0)("Observaciones").ToString + Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate + Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero + Me.Usuario = Data.Rows(0)("Usuario").ToString + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetActivosFijosProyectos(CveEmpresa As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosUsuarioGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetRepActivosFijosDepreciacion(CveEmpresa As Integer, Fecha As Date) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_DepreciacionesGetRep") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Fecha", SqlDbType.Date).Value = Fecha + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Depreciaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetActivosFijos(CveActivoFijo As Integer, CveEmpresa As Integer, Codigo As String, Descripcion As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, NoSerie As String, Año As Integer, CvePersonaResponsable As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CaracteristicaValor As String, CveCliente As Integer, Optional BuscaGrupoEmpresa As Integer = -1, Optional BuscaPorAFPadre As Integer = -1, Optional CveGrupo As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CvePersonaResponsable", SqlDbType.Int).Value = CvePersonaResponsable + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CaracteristicaValor", SqlDbType.VarChar).Value = CaracteristicaValor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@BuscaGrupoEmpresa", SqlDbType.Int).Value = BuscaGrupoEmpresa + .Add("@CveAFPadre", SqlDbType.Int).Value = BuscaPorAFPadre + .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo + End With + Try + SqlAdapter.Fill(Data) + + If CveActivoFijo > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then + Me.CveActivoFijo = Data.Rows(0)("CveActivoFijo").ToString.ToEntero + + Me.Codigo = Data.Rows(0)("Codigo").ToString + Me.Descripcion = Data.Rows(0)("Descripcion").ToString + Me.CuentaInicial = Data.Rows(0)("Conta_CuentaInicial").ToString.ToEntero + Me.CveTipoActivoFijo = Data.Rows(0)("CveTipoActivoFijo").ToString.ToEntero + Me.TipoActivoFijo = Data.Rows(0)("TipoActivoFijo").ToString + Me.CveSubTipoActivoFijo = Data.Rows(0)("CveSubTipoActivoFijo").ToString.ToEntero + Me.SubTipoActivoFijo = Data.Rows(0)("SubTipoActivoFijo").ToString + Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero + Me.ValorCompra = Data.Rows(0)("ValorCompra").ToString.ToDouble + Me.FechaCompra = Data.Rows(0)("FechaCompra").ToString.ToDate + Me.CvePersonaResponsable = Data.Rows(0)("CvePersonaResponsable").ToString.ToEntero + Me.Responsable = Data.Rows(0)("Responsable").ToString + Me.NoSerie = Data.Rows(0)("NoSerie").ToString + Me.Año = Data.Rows(0)("Año").ToString.ToEntero + Me.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero + Me.SubProyecto = Data.Rows(0)("SubProyecto").ToString + Me.CveProyecto = Data.Rows(0)("CveProyecto").ToString.ToEntero + Me.Proyecto = Data.Rows(0)("Proyecto").ToString + Me.Cuenta = Data.Rows(0)("Cuenta").ToString.ToEntero + Me.CveEstadoActivoFijo = Data.Rows(0)("CveEstadoActivoFijo").ToString.ToEntero + Me.EstadoActivoFijo = Data.Rows(0)("EstadoActivoFijo").ToString + Me.IdCtaContDepreciacion = Data.Rows(0)("IdCtaContDepreciacion").ToString.ToEntero + Me.PorDepreciacion = Data.Rows(0)("PorDepreciacion").ToString.ToDouble + Me.Observaciones = Data.Rows(0)("Observaciones").ToString + Me.MesesDepreciacion = Data.Rows(0)("MesesDepreciacion").ToString.ToEntero + Me.CveCliente = Data.Rows(0)("CveCliente").ToString.ToEntero + Me.NombreCliente = Data.Rows(0)("NombreCliente").ToString + Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate + Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero + Me.Usuario = Data.Rows(0)("Usuario").ToString + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + Me.MedidaUso = Data.Rows(0)("MedidaUso").ToString + Me.CveMovimientoInv = Data.Rows(0)("CveMovimientoInv").ToString.ToEntero + Me.FolioInv = Data.Rows(0)("FolioInv").ToString + Me.AlmacenInv = Data.Rows(0)("AlmacenInv").ToString + Me.CveMarcaActivoFijo = Data.Rows(0)("CveMarcaActivoFijo").ToString.ToEntero + Me.CveModeloActivoFijo = Data.Rows(0)("CveModeloActivoFijo").ToString.ToEntero + Me.CveGrupoAF = Data.Rows(0)("CveGrupo").ToString.ToEntero + Me.CveAFPadre = Data.Rows(0)("CveAFPadre").ToString.ToEntero + Me.CveDispositivo = Data.Rows(0)("CveDispositivo").ToString.ToEntero + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + 'Public Function AddActivosFijos(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, + ' CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, Cuenta As Integer, + ' CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, PorDeduccion As Double, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_AF_ActivosFijosAdd") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + ' .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + ' .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + ' .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra + ' .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + ' .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable + ' .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + ' .Add("@Año", SqlDbType.Int).Value = Año + ' .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + ' .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = Cuenta + ' .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + ' .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion + ' .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion + ' .Add("@PorDeduccion", SqlDbType.Float).Value = PorDeduccion + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al Guardar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + ' Catch ex As Exception + + ' End Try + + ' Return Retorno + 'End Function + Public Function AddActivosFijos(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, + CveSubProyecto As Integer, Cuenta As Integer, CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, Observaciones As String, CveCliente As Integer, + CveMovimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveModelo As Integer = -1, Optional CveGrupo As Integer = -1, + Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_AF_ActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = Cuenta + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion + .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion + '.Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@CveModelo", SqlDbType.Int).Value = CveModelo + .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo + .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + + .Add("@CveActivoFijo", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue + End With + + Try + SqlAdapter.Fill(Data) + CveActivoFijo = SqlAdapter.SelectCommand.Parameters("@CveActivoFijo").Value.ToString.ToEntero + 'Dim RetValue As Integer = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero + Retorno = CveActivoFijo + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + If Ex1.Message.Contains("UN_ActivoFijo") Then + Alert("El Codigo ya se encuentra registrado", TipoMensaje.MsgAdvertencia) + Else + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + End If + + Else + Me.OnError("Ocurrió un error al Guardar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + + End Try + + Return Retorno + End Function + Public Function UpdateActivosFijos(CveActivoFijo As Integer, Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, + CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, IdCtaContActivoFijo As Integer, + CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, Observaciones As String, CveCliente As Integer, + CveUsuarioModifico As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveModelo As Integer = -1, Optional CveGrupo As Integer = -1, + Optional CveAFPadre As Integer = -1, Optional CveDispositivo As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + '.Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo + '.Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo + .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = IdCtaContActivoFijo + .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion + .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion + .Add("@PorDeduccion", SqlDbType.Float).Value = -1 + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@CveModelo", SqlDbType.Int).Value = CveModelo + .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo + .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveActivosFijos(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosCompra(CveActivoFijo As Integer, CveCompraDetalle As Integer, TipoAF As Integer, ValorCompra As Double, FechaCompra As Date) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosCompraUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle + .Add("@TipoAF", SqlDbType.Int).Value = TipoAF + .Add("@ValorCompra", SqlDbType.Float).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosCuentaAC(CveActivoFijo As Integer, IdCuentaContable As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosCtaContableUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@IdCuentaContable", SqlDbType.Int).Value = IdCuentaContable + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + +#End Region + +#Region "A C T I V O S - F I J O S- B I T A C O R A S" + Public Function GetActivosFijosBitacora(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosBitacoraGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Bitacora.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddActivosFijosBitacora(CveActivoFijo As Integer, Observacion As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosBitacoraAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar la Bitacora del Activo Fijo ", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S - F I J O S - C A R A C T E R I S T I C A S" + + Public Function GetActivosFijosCaracteristicas(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosCaracteristicasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region "A C T I V O S- F I J O S - H I S T O R I A L" + Public Function GetActivosFijosHistorial(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosHistorialGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Historial.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddActivosFijosHistorial(CveActivoFijo As Integer, CveConceptoHistorialActivoFijo As Integer, Actual As String, Anterior As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosHistorialAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo + .Add("@Actual", SqlDbType.VarChar).Value = Actual + .Add("@Anterior", SqlDbType.VarChar).Value = Anterior + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Historial del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S- F I J O S - I M A G E N E S" + Public Function GetActivosFijosImagenes(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosImagenesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Imagenes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddActivosFijosImagenes(CveActivoFijo As Integer, URL As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosImagenesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Imagen en Fijo Imagenes con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Imagen en Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Imagen en Activo Fijo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveActivosFijosImagenes(CveImagenActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosImagenesRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveImagenActivoFijo", SqlDbType.Int).Value = CveImagenActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Imagen del Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Imagen del Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Imagen del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S - F I J O S - R E S G U A R D O S" + Public Function GetActivosFijosResguardos(CveActivoFijo As Integer, CveActivoFijoResguardo As Integer, CveResponsable As Integer, CveResguardo As Integer, Optional CveEmpresa As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional Folio As Integer = -1, Optional CveResguardo2 As Integer = -1, Optional UsuarioImprimio As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo + .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable + .Add("@CveResguardo", SqlDbType.Int).Value = CveResguardo + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveResguardo2", SqlDbType.Int).Value = CveResguardo2 + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@UsuarioImprimio", SqlDbType.Int).Value = UsuarioImprimio + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Resguardos.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function ActivoFijoResguardoADD(FechaInicio As Date, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveActivoFijo As Integer, TipoDocto As String, Tipo As Integer, CveEmpresa As Integer, Optional Observaciones As String = " ", Optional CveResguardo As Integer = -1) As Boolean + 'Dim CveResguardo As Integer = -1 + Dim Retorno = False + DataAdapter("PA_AF_ActivosFijosResguardosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@CveResguardo", SqlDbType.Int).Value = CveResguardo + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + FolioResguardo = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString().ToEntero() + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar el resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function ActivoFijoResguardoGpo() As Integer + Dim CveResguardo As Integer = -1 + DataAdapter("PA_AF_ActivosFijosResguardosGpo") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveResguardo", SqlDbType.Int).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + CveResguardo = SqlAdapter.SelectCommand.Parameters("@CveResguardo").Value.ToString().ToEntero() + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo del resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return CveResguardo + End Function + Public Function UpdateActivosFijosResguardos(FechaFin As String, Observaciones As String, URL As String, CveActivoFijoResguardo As Integer, CveActivoFijo As Integer, Optional URL2 As String = "-1", Optional CveResguardo2 As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaFin", SqlDbType.VarChar).Value = FechaFin + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@URL2", SqlDbType.VarChar).Value = URL2 + .Add("@CveResguardo2", SqlDbType.Int).Value = CveResguardo2 + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateEstatusResguardo(EstatusResguardo As Integer, CveEmpresa As Integer, CveActivoFijo As Integer, Optional CveSubProyecto As Integer = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_UpdateEstatusResguardo") + 'ESTATUS RESGUARDO: 1- Disponible, 2- En Traslado, 3- Asignado + With SqlAdapter.SelectCommand.Parameters + .Add("@EstatusResguardo", SqlDbType.Int).Value = EstatusResguardo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosResguardosURL(URL As String, URL2 As String, CveActivoFijoResguardo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosUrlUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@URL2", SqlDbType.VarChar).Value = URL2 + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateActivosFijosResguardosURLGpo(URL As String, URL2 As String, CveResguardo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosGpoUrl") + + With SqlAdapter.SelectCommand.Parameters + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@URL2", SqlDbType.VarChar).Value = URL2 + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveResguardo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetActivosFijosHijos(CveEmpresa As Integer, CveAFPadre As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosHijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAFPadre", SqlDbType.Int).Value = CveAFPadre + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al obtener los AF Hijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + +#End Region + +#Region "A C T I V O S - F I J O S - COMPRAS " + Public Function GetActivosFijosCompras(CveActivoFijo As Integer, Optional CveClasificacion As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosCompras") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As Exception + OnError("Ocurrió un error al obtener las Compras del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region + +#Region " ************************************************ C A R A C T E R I S T I C A S ************************************************ " + +#Region "ClasificacionesCaracteristicas" + + Public Function GetCaracteristicasClasificaciones(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasClasificacionesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Data.TableName = "CaracteristicasClasificaciones" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Clasificaciones de Características.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddClasificacionesCaracteristicas(CaracteristicaClasificacion As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasClasificacionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaClasificacion", SqlDbType.VarChar).Value = CaracteristicaClasificacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateClasificacionesCaracteristicas(CaracteristicaClasificacion As String, Estatus As Boolean, CveCaracteristicaClasificacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasClasificacionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaClasificacion", SqlDbType.VarChar).Value = CaracteristicaClasificacion + '.Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + '.Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Clasificacion de Caracteristica con el mismo nombre: " & CaracteristicaClasificacion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Clasificacion de Caracteristica", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveClasificacionesCaracteristicas(CveCaracteristicaClasificacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasClasificacionesRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Clasificacion de Caracteristica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Clasificacion de Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "Características" + Public Function GetCaracteristicas(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasGet") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + Try + SqlAdapter.Fill(Data) + Data.TableName = "Caracteristicas" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Características.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + + Return Retorno + End Function + Public Function AddCaracteristica(Caracteristica As String, CveCaracteristicaClasificacion As Integer, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, TipoCampo As Integer, Longitud As Integer, Requerido As Integer, Orden As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@TipoCampo", SqlDbType.TinyInt).Value = TipoCampo + .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + .Add("@Longitud", SqlDbType.Int).Value = Longitud + .Add("@Requerido", SqlDbType.Int).Value = Requerido + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Característica con el mismo nombre: " & Caracteristica & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Característica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCaracteristica(CveCaracteristicaClasificacion As Integer, Caracteristica As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, TipoCampo As Integer, Longitud As Integer, Requerida As Boolean, Orden As Integer, Estatus As Boolean, CveEmpresa As Integer, CveCaracteristica As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristica", SqlDbType.VarChar).Value = CveCaracteristica + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@TipoCampo", SqlDbType.TinyInt).Value = TipoCampo + .Add("@Longitud", SqlDbType.Int).Value = Longitud + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Requerida", SqlDbType.Bit).Value = Requerida + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Caracteristica con el mismo nombre: " & Caracteristica & ".", TipoMensaje.MsgAdvertencia) + ElseIf Ex1.Message.Contains("Número: 547;") Then + Alert("La Característica tiene Opciones que están siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Característica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveCaracteristica(CveCaracteristica As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Característica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Característica de Tipo de Cuenta y/o Equipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "CaracteristicasOpciones" + + Public Function GetCaracteristicasOpciones(CveCaracteristica As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasOpcionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Data.TableName = "CaracteristicasOpciones" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Opciones para las Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetCaracteristicasOpcionesSubTipo(CveCaracteristica As Integer, CveSubTipoActivoFijo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasOpcionesSubTipoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Data.TableName = "CaracteristicasOpciones" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Opciones para las Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCaracteristicasOpciones(CaracteristicaOpcion As String, CveCaracteristica As Integer, Orden As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasOpcionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaOpcion", SqlDbType.VarChar).Value = CaracteristicaOpcion + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Opcion para la Caracteristica con el mismo nombre: " & CaracteristicaOpcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCaracteristicasOpciones(CveCaracteristica As Integer, CaracteristicaOpcion As String, Orden As Integer, Estatus As Boolean, CveCaracteristicaOpcion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasOpcionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaOpcion", SqlDbType.VarChar).Value = CaracteristicaOpcion + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveCaracteristicaOpcion", SqlDbType.Int).Value = CveCaracteristicaOpcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Opcion para la Caracteristica con el mismo nombre: " & CaracteristicaOpcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveCaracteristicasOpciones(CveCaracteristicaOpcion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasOpcionesRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristicaOpcion", SqlDbType.Int).Value = CveCaracteristicaOpcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Opcion para la Caracteristica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "A C T I V O S V A L O R E S" + Public Function GetActivosFijosValores(CveActivoFijo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivoFijoValoresGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Valores de Activos Fijos .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al Guardar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + + End Try + + Return Retorno + End Function + + Public Function AddUpdActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresAddUpd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al Guardar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer, CveValor As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveValor", SqlDbType.Int).Value = CveValor + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al guardar los cambios en el Valor del Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Valor del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveActivosFijosValores(CveActivoFijo As Integer, CveValor As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + SqlAdapter.SelectCommand.Parameters.Add("@CveValor", SqlDbType.Int).Value = CveValor + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Valor de Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Valor de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region +#End Region + +#Region "Subtipos Activos Fijos" + + Public Function GetSubTiposActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_SubTiposActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Subtipos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddSubTiposActivosFijos(CveTipoActivoFijo As Integer, SubTipoActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer, Optional AplicaGPS As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@SubTipoActivoFijo", SqlDbType.VarChar).Value = SubTipoActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@AplicaGPS", SqlDbType.Bit).Value = AplicaGPS + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Subtipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateSubTiposActivosFijos(CveSubTipoActivoFijo As Integer, CveTipoActivoFijo As Integer, SubTipoActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@SubTipoActivoFijo", SqlDbType.VarChar).Value = SubTipoActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Subtipo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveSubTiposActivosFijos(CveSubTiposActivosFijos As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTiposActivosFijos + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Subtipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "Tipos Activos Fijos" + + Public Function GetTiposActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TiposActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Tipos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddTiposActivosFijos(TipoActivoFijo As String, CuentaInicial As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional PorDepreciacion As Decimal = 0, Optional MedidaVehicular As Integer = 1, Optional AutoFolio As Boolean = False, Optional Contable As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoActivoFijo", SqlDbType.VarChar).Value = TipoActivoFijo + .Add("@CuentaInicial", SqlDbType.VarChar).Value = CuentaInicial + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@PorDepreciacion", SqlDbType.Money).Value = PorDepreciacion + .Add("@MedidaVehicular", SqlDbType.TinyInt).Value = MedidaVehicular + .Add("@AutoFolio", SqlDbType.Bit).Value = AutoFolio + .Add("@Contable", SqlDbType.Bit).Value = Contable + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Tipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposActivosFijos(CveTipoActivoFijo As Integer, TipoActivoFijo As String, CuentaInicial As Integer, Estado As Boolean, Optional PorDepreciacion As Decimal = 0, Optional MedidaVehicular As Integer = 1, Optional AutoFolio As Boolean = False, Optional Contable As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@TipoActivoFijo", SqlDbType.VarChar).Value = TipoActivoFijo + .Add("@CuentaInicial", SqlDbType.VarChar).Value = CuentaInicial + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@PorDepreciacion", SqlDbType.Money).Value = PorDepreciacion + .Add("@MedidaVehicular", SqlDbType.TinyInt).Value = MedidaVehicular + .Add("@AutoFolio", SqlDbType.Bit).Value = AutoFolio + .Add("@Contable", SqlDbType.Bit).Value = Contable + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Tipo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveTiposActivosFijos(CveTiposActivosFijos As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTiposActivosFijos + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el tipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S - S U B T I P O S " + + Public Function GetSubTiposCaracteristicas(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_SubTiposCaracteristicasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de caracteristicas de Subtipos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddSubTipoCaracteristica(CveSubTipoActivoFijo As Integer, CveCaracteristica As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposCaracteristicasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Subtipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveSubTipoCaracteristica(CveSubTipoActivosFijos As Integer, CveCaracteristica As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposCaracteristicasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivosFijos + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + End With + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Subtipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ESTATUS DE ACTIVOS FIJOS" + Public Function GetEstatusActivoFijo() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_EstatusActivoFijoGet") + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddEstatusActivoFIjo(EstadoActivoFijo As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusActivoFijoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstadoActivoFijo", SqlDbType.Int).Value = EstadoActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Departamento", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateEstatusActivoFijo(CveEstadoActivoFIjo As Integer, EstadoActivoFijo As Integer, Estado As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_EstatusActivoFijoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstadoActivoFijo", SqlDbType.Int).Value = EstadoActivoFijo + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFIjo + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al guardar los cambios en el Estado del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function RemoveEstatusActivoFijo(CveEstadoActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusActivoFijoRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Departamento no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Departamento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Departamento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFModelosActivosFijos" + Public Function GetModelosActivosFijos(CveEmpresa As Integer, CveMarca As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ModelosActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Modelos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddModelosActivosFijos(ModeloActivoFijo As String, CveMarcaAF As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ModelosActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ModeloActivoFijo", SqlDbType.VarChar).Value = ModeloActivoFijo + .Add("@CveMarcaAF", SqlDbType.Int).Value = CveMarcaAF + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Modelo del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateModelosActivosFijos(CveModeloActivoFijo As Integer, ModeloActivoFijo As String, CveMarcaAF As Integer, Estado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ModelosActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo + .Add("@ModeloActivoFijo", SqlDbType.VarChar).Value = ModeloActivoFijo + .Add("@CveMarcaAF", SqlDbType.Int).Value = CveMarcaAF + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Modelo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveModelosActivosFijos(CveModelosActivosFijos As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ModelosActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModelosActivosFijos + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Modelo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFMarcasActivosFijos" + Public Function GetMarcasActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_MarcasActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Marcas de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddMarcasActivosFijos(MarcaActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MarcasActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@MarcaActivoFijo", SqlDbType.VarChar).Value = MarcaActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar la Marca del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateMarcasActivosFijos(CveMarcaActivoFijo As Integer, MarcaActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MarcasActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo + .Add("@MarcaActivoFijo", SqlDbType.VarChar).Value = MarcaActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Marca del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveMarcasActivosFijos(CveMarcaActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MarcasActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar la Marca del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "AF G R U P O S" + Public Function GetGrupoAF(CveGrupo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_GruposGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Grupos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddGrupoAF(Grupo As String, CveUsuario As Integer, CveEmpresa As Integer) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_AF_GruposAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Grupo", SqlDbType.VarChar).Value = Grupo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveGrupo", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveGrupo").Value.ToString.ToEntero + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Grupo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateGrupoAF(Grupo As String, Estatus As Boolean, CveGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_GruposUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Grupo", SqlDbType.VarChar).Value = Grupo + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Actualizar el Grupo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveGrupoAF(CveEmpresa As Integer, CveGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_GruposRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveGrupo", SqlDbType.Int).Value = CveGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Eliminar el Grupo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFConceptosHistorial" + + Public Function GetConceptosHistorial() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ConceptosHistorialGet") + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo Historial de Conceptos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddConceptosHistorial(ConceptoHistorialActivoFijo As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ConceptosHistorialAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ConceptoHistorialActivoFijo", SqlDbType.VarChar).Value = ConceptoHistorialActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Concepto del Historial", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateDepartamento(CveConceptoHistorialActivoFijo As Integer, ConceptoHistorialActivoFijo As String, Estado As Boolean) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_RH_DepartamentoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo + .Add("@ConceptoHistorialActivoFijo", SqlDbType.VarChar).Value = ConceptoHistorialActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al guardar los cambios en el Concepto del Historial.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveConceptosHistorialRemove(CveConceptoHistorialActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ConceptosHistorialRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Concepto del Historial.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFCaracteristicasActivosFijos" + + Public Function GetCaracteristicasActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasActivosFijos") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Características de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCaracteristicasActivosFijos(CveActivoFijo As Integer, Caracteristica As String, EsRequerido As Boolean, EsUnico As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@EsRequerido", SqlDbType.Bit).Value = EsUnico + .Add("@EsUnico", SqlDbType.Bit).Value = EsRequerido + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar la Característica del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCaracteristicasActivosFijos(CveTipoActivoFijo As Integer, Caracteristica As String, EsRequerido As Boolean, EsUnico As Boolean, CveEmpresa As Integer, CveCaracteristicaActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoActivoFijo", SqlDbType.VarChar).Value = CveTipoActivoFijo + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@EsRequerido", SqlDbType.Bit).Value = EsUnico + .Add("@EsUnico", SqlDbType.Bit).Value = EsRequerido + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCaracteristicaActivoFijo", SqlDbType.VarChar).Value = CveCaracteristicaActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al guardar los cambios en la Característica del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveCaracteristicasActivosFijos(CveCaracteristicaActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristicaActivoFijo", SqlDbType.Int).Value = CveCaracteristicaActivoFijo + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar la Característica del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region "O P E R A D O R E S" + Public Function GetTipoOperadores(CveTipoOperador As String, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TipoOperadoresGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoOperador", SqlDbType.VarChar).Value = CveTipoOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Tipo Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddOperador(Operador As String, CveTipoOperador As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CveTransportista As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_OperadoresAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@Operador", SqlDbType.VarChar).Value = Operador + .Add("@CveTipoOperador", SqlDbType.VarChar).Value = CveTipoOperador + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateOperador(CveOperador As Integer, Operador As String, CveTipoOperador As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, Optional CveTransportista As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_OperadoresUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@Operador", SqlDbType.VarChar).Value = Operador + .Add("@CveTipoOperador", SqlDbType.VarChar).Value = CveTipoOperador + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el chofer.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveOperador(CveOperador As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_OperadoresRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetOperadores(CveOperador As Integer, CveEmpresa As Integer, Estatus As Integer, Optional CveTransportista As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_OperadoresGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el chofer.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "T I P O S C O M B U S T I B L E S" + Public Function GetTiposCombustible(CveTipoCombustible As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TiposCombustibleGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTiposCombustible", SqlDbType.VarChar).Value = CveTipoCombustible + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Tipos de combustible", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddTipoCombustible(TipoCombustible As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TiposCombustibleAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoCombustible", SqlDbType.VarChar).Value = TipoCombustible + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateTipoCombustible(CveTipoCombustible As Integer, TipoCombustible As String, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TiposCombustibleUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible + .Add("@TipoCombustible", SqlDbType.VarChar).Value = TipoCombustible + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveTipoCombustible(CveTipoCombustible As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_OperadoresRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Operador.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "C O M B U S T I B L E S" + Public Function GetCombustibles(CveCombustible As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CombustiblesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddCombustible(Combustible As String, CveTipoCombustible As Integer, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CombustiblesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@Combustible", SqlDbType.VarChar).Value = Combustible + .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateCombustible(CveCombustible As Integer, Combustible As String, CveTipoCombustible As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CombustiblesUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@Combustible", SqlDbType.VarChar).Value = Combustible + .Add("@CveTipoCombustible", SqlDbType.Int).Value = CveTipoCombustible + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveCombustible(CveCombustible As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CombustiblesRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "C A R G A S C O M B U S T I B L E S " + Public Function GetCargasCombustible(CveAF As Integer, CveProveedor As Integer, CveTipoAF As Integer, CveSubProyecto As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer, Optional CveCargaCombustible As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CargaCombustibleGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + .Add("@CveCargaCombustible", SqlDbType.Int).Value = CveCargaCombustible + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las cargas de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddCargaCombustible(CveCombustible As Integer, CveProveedor As Integer, CveAF As Integer, Folio As String, FechaCarga As DateTime, TanqueLleno As Integer, Cantidad As Double, CostoUnitario As Double, Odometro As Double, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CargaCombustiblesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@FechaCarga", SqlDbType.DateTime).Value = FechaCarga + .Add("@TanqueLleno", SqlDbType.Int).Value = TanqueLleno + .Add("@Cantidad", SqlDbType.Float).Value = Cantidad + .Add("@CostoUnitario", SqlDbType.SmallMoney).Value = CostoUnitario + .Add("@Odometro", SqlDbType.SmallMoney).Value = Odometro + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la carga de combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetRepCargasCombustible(FechaI As String, FechaF As String, CveTipoAF As Integer, CveSubProyecto As Integer, GPO As Integer, CveProveedor As Integer, CveEstatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_RepCargasCombustibleGet") + + With SqlAdapter.SelectCommand.Parameters + '.Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@GPO", SqlDbType.Int).Value = GPO + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Flotillas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "P L A C A S" + Public Function GetPlacas(CvePlaca As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PlacasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Placas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddPlacas(CveAF As Integer, Placa As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", + Optional FechaExpedicion As String = "-1", Optional FechaVencimiento As String = "-1") As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PlacasAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Placa", SqlDbType.VarChar).Value = Placa + .Add("@FechaExpedicion", SqlDbType.VarChar).Value = FechaExpedicion + .Add("@FechaVencimiento", SqlDbType.VarChar).Value = FechaVencimiento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la placa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdatePlacas(CvePlaca As Integer, Placa As String, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional FechaExpedicion As Date = MinFecha, Optional FechaVencimiento As Date = MinFecha) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PlacasUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca + .Add("@Placa", SqlDbType.VarChar).Value = Placa + .Add("@FechaExpedicion", SqlDbType.Date).Value = FechaExpedicion + .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la placa", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemovePlaca(CvePlaca As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PlacasRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la placa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetRepPlacas(CvePlaca As Integer, CveAF As Integer, CveEmpresa As Integer, FechaExpedicionI As DateTime, FechaExpedicionF As DateTime, FechaVencimientoI As DateTime, FechaVencimientoF As DateTime, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_RepPlacas") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePlaca", SqlDbType.Int).Value = CvePlaca + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaExpedicionI", SqlDbType.DateTime).Value = FechaExpedicionI + .Add("@FechaExpedicionF", SqlDbType.DateTime).Value = FechaExpedicionF + .Add("@FechaVencimientoI", SqlDbType.DateTime).Value = FechaVencimientoI + .Add("@FechaVencimientoF", SqlDbType.DateTime).Value = FechaVencimientoF + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Placas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "L I C E N C I A S" + Public Function GetLicencias(CveLicencia As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_LicenciasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Licencias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetLicenciasVencidas(CveLicencia As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional Estatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_LicenciasVencidasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Licencias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetLicenciasRep(CveLicencia As Integer, CveAF As Integer, CveEmpresa As Integer, FechaEI As DateTime, FechaEF As DateTime, FechaVI As DateTime, FechaVF As DateTime, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Estatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_LicenciasRepGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaEI", SqlDbType.DateTime).Value = FechaEI + .Add("@FechaEF", SqlDbType.DateTime).Value = FechaEF + .Add("@FechaVI", SqlDbType.DateTime).Value = FechaVI + .Add("@FechaVF", SqlDbType.DateTime).Value = FechaVF + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveCliente", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Licencias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddLicencia(CveAF As Integer, Licencia As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional CvePersonal As Integer = -1, Optional Estatus As Boolean = True) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_LicenciasAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Licencia", SqlDbType.VarChar).Value = Licencia + .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion + .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la licencia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateLicencia(CveLicencia As Integer, Licencia As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional Estatus As Boolean = True) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_LicenciasUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia + .Add("@Licencia", SqlDbType.VarChar).Value = Licencia + .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion + .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la licencia", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveLicencia(CveLicencia As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_LicenciasRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLicencia", SqlDbType.Int).Value = CveLicencia + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la licencia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "P O L I Z A S S E G U R O S " + Public Function GetPolizasSeguro(CvePoliza As Integer, CveAF As Integer, CveProveedor As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PolizasSeguroGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePoliza", SqlDbType.Int).Value = CvePoliza + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Pólizas de seguro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetRepPolizaSeguro(CveAF As Integer, CveProveedor As Integer, FechaExpedicionI As DateTime, FechaExpedicionF As DateTime, FechaVencimientoI As DateTime, FechaVencimientoF As DateTime, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_RepPolizaSeguroGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaExpedicionI", SqlDbType.DateTime).Value = FechaExpedicionI + .Add("@FechaExpedicionF", SqlDbType.DateTime).Value = FechaExpedicionF + .Add("@FechaVencimientoI", SqlDbType.DateTime).Value = FechaVencimientoI + .Add("@FechaVencimientoF", SqlDbType.DateTime).Value = FechaVencimientoF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Polizas de Seguros.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddPolizasSeguro(CveAF As Integer, CveProveedor As Integer, PolizaSeguro As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional Proveedor As String = "-1") As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PolizasSegurosAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@PolizaSeguro", SqlDbType.VarChar).Value = PolizaSeguro + .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion + .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la póliza de seguro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdatePolizaSeguro(CvePoliza As Integer, CveProveedor As Integer, PolizaSeguro As String, FechaExpedicion As DateTime, FechaVencimiento As DateTime, Optional Observacion As String = "-1", Optional Adjunto As String = "-1", Optional Proveedor As String = "-1") As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PolizasSegurosUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePoliza", SqlDbType.Int).Value = CvePoliza + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@PolizaSeguro", SqlDbType.VarChar).Value = PolizaSeguro + .Add("@FechaExpedicion", SqlDbType.DateTime).Value = FechaExpedicion + .Add("@FechaVencimiento", SqlDbType.DateTime).Value = FechaVencimiento + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la póliza de seguro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemovePoliza(CvePoliza As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_PolizasSeguroRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePoliza", SqlDbType.Int).Value = CvePoliza + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la póliza de seguro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "I N C I D E N T E S " + Public Function GetIncidentes(CveIncidente As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_IncidentesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Incidentes", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetIncidentesRep(CveIncidente As Integer, CveAF As Integer, CveEmpresa As Integer, FechaInicio As String, FechaFin As String, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_IncidentesRepGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaInicial", SqlDbType.VarChar).Value = FechaInicio + .Add("@FechaFinal", SqlDbType.VarChar).Value = FechaFin + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Incidentes", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddIncidente(CveAF As Integer, Asunto As String, Descripcion As String, Odometro As Double, Horometro As Double, Prioridad As Integer, FechaIncidente As DateTime, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_IncidentesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@Odometro", SqlDbType.Float).Value = Odometro + .Add("@Horometro", SqlDbType.Float).Value = Horometro + .Add("@FechaIncidente", SqlDbType.DateTime).Value = FechaIncidente + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el incidente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateIncidente(CveIncidente As Integer, Asunto As String, Descripcion As String, Odometro As Double, Horometro As Double, Prioridad As Integer, FechaIncidente As DateTime) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_IncidentesUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@Odometro", SqlDbType.Float).Value = Odometro + .Add("@Horometro", SqlDbType.Float).Value = Horometro + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaIncidente", SqlDbType.DateTime).Value = FechaIncidente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el incidente", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveIncidente(CveIncidente As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_IncidenteRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIncidente", SqlDbType.Int).Value = CveIncidente + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el incidente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "F A L L A S / A C C I D E N T E S " + Public Function GetTipoFallas(CveTipoFalla As Integer, CveEmpresa As Integer, ClasificacionTipoFalla As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TipoFallasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@ClasificacionTipoFalla", SqlDbType.Int).Value = ClasificacionTipoFalla + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Tipo Fallas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetFallas(CveFalla As Integer, CveAF As Integer, CveEmpresa As Integer, CveTipoFalla As Integer, ClasificacionTipoFalla As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_FallasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFalla", SqlDbType.Int).Value = CveFalla + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla + .Add("@ClasificacionTipoFalla", SqlDbType.Int).Value = ClasificacionTipoFalla + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Fallas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddFalla(CveAF As Integer, Asunto As String, Descripcion As String, AFMedida As Integer, Prioridad As Integer, FechaFalla As DateTime, CveUsuario As Integer, CveEmpresa As Integer, CveTipoFalla As Integer, CorreoNotificacion As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_FallasAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@AFMedida", SqlDbType.Int).Value = AFMedida + .Add("@FechaFalla", SqlDbType.DateTime).Value = FechaFalla + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla + .Add("@CorreoNotificacion", SqlDbType.VarChar).Value = CorreoNotificacion + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Registrar la Falla.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateFalla(CveFalla As Integer, Asunto As String, Descripcion As String, AFMedida As Integer, Prioridad As Integer, FechaFalla As DateTime, CveTipoFalla As Integer, CorreoNotificacion As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_FallasUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFalla", SqlDbType.Int).Value = CveFalla + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@AFMedida", SqlDbType.Int).Value = AFMedida + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaFalla", SqlDbType.DateTime).Value = FechaFalla + .Add("@CveTipoFalla", SqlDbType.Int).Value = CveTipoFalla + .Add("@CorreoNotificacion", SqlDbType.VarChar).Value = CorreoNotificacion + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la falla", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveFalla(CveFalla As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_FallasRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFalla", SqlDbType.Int).Value = CveFalla + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la falla.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region +#Region "S E R V I C I O S" + Public Function GetServicios(CveServicio As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ServiciosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveServicio", SqlDbType.Int).Value = CveServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Servicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetServiciosTotal(CveServicio As Integer, CveAF As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ServiciosTotalCompraGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveServicio", SqlDbType.Int).Value = CveServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Servicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddServicio(CveAF As Integer, CveTipoServicio As Integer, FechaServicio As DateTime, CveProveedor As Integer, CveCompra As Integer, Horometro As Double, Observaciones As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1, Optional Proveedor As String = "-1", Optional Importe As Double = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ServiciosAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Horometro", SqlDbType.Float).Value = Horometro + .Add("@FechaServicio", SqlDbType.DateTime).Value = FechaServicio + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor + .Add("@Importe", SqlDbType.Float).Value = Importe + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateServicio(CveServicio As Integer, CveTipoServicio As Integer, FechaServicio As DateTime, CveProveedor As Integer, CveCompra As Integer, Horometro As Double, Observaciones As String, Optional Proveedor As String = "-1", Optional Importe As Double = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ServiciosUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveServicio", SqlDbType.Int).Value = CveServicio + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@FechaServicio", SqlDbType.DateTime).Value = FechaServicio + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@Horometro", SqlDbType.Float).Value = Horometro + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor + .Add("@Importe", SqlDbType.Float).Value = Importe + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el servicio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveServicio(CveServicio As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ServiciosRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveServicio", SqlDbType.Int).Value = CveServicio + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetRepServicios(CveAF As Integer, CveEmpresa As Integer, CveTipoServicio As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, Optional CveDispositivo As Integer = -1, Optional CveCliente As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_RepServicios") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor .Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(DSet) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddMetricasValores(CveAF As Integer, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, Fecha As Date, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - CveMetricaValor = -1 - - DataAdapter("PA_AF_MetricasValoresAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de servicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "E V E N T O S P R O G R A M A D O S " + Public Function GetRepEventosProgramados(CveAF As Integer, CveTipoAF As Integer, CveSubTipoAF As Integer, Asunto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_RepEventosProgramadosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + .Add("@CveSubTipoAF", SqlDbType.Int).Value = CveSubTipoAF + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Eventos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ValesCombustible" + Public Function AddValesCombustible(FolioUsuario As Integer, CveCompra As Integer, CveProveedor As Integer, CveAF As Integer, CvePersonal As Integer, Fecha As Date, NombreRecibe As String, CveSubProyecto As Integer, Observaciones As String, Odometro As Integer, CveCombustible As Integer, Litros As Double, TipoVale As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional Recibo As Integer = -1, Optional Importe As Integer = -1) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_AF_ValesCombustibleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FolioUsuario", SqlDbType.Int).Value = FolioUsuario + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@NombreRecibe", SqlDbType.VarChar).Value = NombreRecibe + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Odometro", SqlDbType.Int).Value = Odometro + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@Litros", SqlDbType.Float).Value = Litros + .Add("@Recibo", SqlDbType.Float).Value = Recibo + .Add("@Importe", SqlDbType.Float).Value = Importe + .Add("@TipoVale", SqlDbType.Int).Value = TipoVale + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveVale", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + FolioVale = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero + Retorno = SqlAdapter.SelectCommand.Parameters("@CveVale").Value.ToString.ToEntero + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Vale de Combustible con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Vale de Combustible.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + + End Try + + Return Retorno + + End Function + Public Function GetValesCombustible(CveCompra As Integer, CveValeCombustible As Integer, Folio As Integer, CveProveedor As Integer, CveAF As Integer, CveSubProyecto As Integer, Odometro As Integer, CveCombustible As Integer, Litros As Double, CvePersonal As Integer, CveUsuario As Integer, CveEmpresa As Integer, Recibo As Integer, Importe As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ValesCombustibleGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveValeCombustible", SqlDbType.Int).Value = CveValeCombustible + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Odometro", SqlDbType.Int).Value = Odometro + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@Litros", SqlDbType.Float).Value = Litros + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Recibo", SqlDbType.Int).Value = Recibo + .Add("@Importe", SqlDbType.Int).Value = Importe + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Vales Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateValeCombustible(CveVale As Integer, CveCompra As Integer, CveProveedor As Integer, NombreRecibe As String, Litros As Double, Recibo As Integer, Importe As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ValesCombustibleUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVale", SqlDbType.Int).Value = CveVale + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@NombreRecibe", SqlDbType.VarChar).Value = NombreRecibe + .Add("@Litros", SqlDbType.Float).Value = Litros + .Add("@Recibo", SqlDbType.Int).Value = Recibo + .Add("@Importe", SqlDbType.Int).Value = Importe + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region +#Region "M E T R I C A S" + + Public Function GetMetricas(CveMetrica As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddMetricas(Metrica As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Metrica", SqlDbType.Int).Value = Metrica + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteMetricas(CveMetrica As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function GetMetricasRegistro(CveSubProyecto As Integer, CveEmpresa As Integer, Fecha As Date) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasRegistroGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Fecha", SqlDbType.Date).Value = Fecha + End With + + Try + SqlAdapter.Fill(DSet) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetMetricasValores(CveMetricaValor As Integer, CveAF As Integer, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, FechaI As Date, FechaF As Date, + CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasValoresGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(DSet) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddMetricasValores(CveAF As Integer, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, Fecha As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + CveMetricaValor = -1 + + DataAdapter("PA_AF_MetricasValoresAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@Fecha", SqlDbType.Date).Value = Fecha .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveMetricaValor", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - CveMetricaValor = SqlAdapter.SelectCommand.Parameters("@CveMetricaValor").Value.ToString.ToEntero - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el valor de métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveMetricasValores(CveMetricaValor As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasValoresRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el valor de métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetMetricasValoresDetalle(CveEmpresa As Integer, Optional CveMetricaValor As Integer = -1, Optional CveMetrica As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasValoresDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor - .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + End With + + Try + SqlAdapter.Fill(Data) + CveMetricaValor = SqlAdapter.SelectCommand.Parameters("@CveMetricaValor").Value.ToString.ToEntero + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el valor de métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveMetricasValores(CveMetricaValor As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasValoresRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el valor de métrica de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetMetricasValoresDetalle(CveEmpresa As Integer, Optional CveMetricaValor As Integer = -1, Optional CveMetrica As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MetricasValoresDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor + .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function Public Function AddMetricasValoresDetalle(CveMetricaValor As Integer, CveMetrica As Integer, Valor As Decimal) As Boolean @@ -3456,723 +3456,724 @@ Public Class ClsAF End Try Return Retorno - End Function - - Public Function DeleteMetricasValoresDetalle(Optional CveMetricaValor As Integer = -1, Optional CveMetrica As Integer = -1, Optional Valor As String = "-1") As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_MetricasValoresDetalleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor - .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica - .Add("@Valor", SqlDbType.VarChar).Value = Valor - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el detalle de los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno End Function -#End Region + Public Function DeleteMetricasValoresDetalle(Optional CveMetricaValor As Integer = -1, Optional CveMetrica As Integer = -1, Optional Valor As String = "-1") As Boolean + Dim Retorno As Boolean = False -#Region "TIPO SERVICIO" + DataAdapter("PA_AF_MetricasValoresDetalleAdd") - Public Function GetTiposServicios(CveTipoServicio As Integer, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServicioGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddTiposServicios(Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - CveTipoServicio = -1 - DataAdapter("PA_AF_TiposServicioAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMetricaValor", SqlDbType.Int).Value = CveMetricaValor + .Add("@CveMetrica", SqlDbType.Int).Value = CveMetrica + .Add("@Valor", SqlDbType.VarChar).Value = Valor + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el detalle de los valores de métricas de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + +#End Region + +#Region "TIPO SERVICIO" + + Public Function GetTiposServicios(CveTipoServicio As Integer, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServicios(Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + CveTipoServicio = -1 + DataAdapter("PA_AF_TiposServicioAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - - CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServicioUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function DeleteTiposServicios(CveTipoServicio As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServicioDelete") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetTiposServiciosActividades(CveTipoServicioActividad As Integer, CveTipoServicio As Integer, CveActividad As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosActividadesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad - .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddTiposServiciosActividades(CveActividad As Integer, CveTipoServicio As Integer, Duracion As Decimal, Observaciones As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosActividadesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion - .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateTiposServiciosActividades(CveTipoServicioActividad As Integer, CveActividad As Integer, Duracion As Decimal, Observaciones As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosActividadesUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad - .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion - .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function DeleteTiposServiciosActividades(CveTipoServicioActividad As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosActividadesDelete") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosMaterialGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los materiales de los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddTiposServiciosMaterial(CveTipoServicio As Integer, Cantidad As Decimal, CveUM As Integer, CvePS As Integer, - Tipo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosMaterialAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@Cantidad", SqlDbType.Money).Value = Cantidad - .Add("@CveUM", SqlDbType.Int).Value = CveUM - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, Cantidad As Decimal, CveUM As Integer, CvePS As Integer, - Tipo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosMaterialUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@Cantidad", SqlDbType.Money).Value = Cantidad - .Add("@CveUM", SqlDbType.Int).Value = CveUM - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function DeleteTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposServiciosMaterialDelete") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + End With + + Try + SqlAdapter.Fill(Data) + + CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function GetTiposMantenimiento(CveTipoMantenimiento As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_TiposMantenimientoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los tipos de mantenimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function GetActividades(CveActividad As Integer, CvePuesto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActividadesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function DeleteTiposServicios(CveTipoServicio As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function AddActividades(Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActividadesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre - .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto - .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + + Public Function GetTiposServiciosActividades(CveTipoServicioActividad As Integer, CveTipoServicio As Integer, CveActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function UpdateActividades(CveActividad As Integer, Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActividadesUpdate") - + Public Function AddTiposServiciosActividades(CveActividad As Integer, CveTipoServicio As Integer, Duracion As Decimal, Observaciones As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesAdd") + With SqlAdapter.SelectCommand.Parameters .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre - .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto - .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion + .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function DeleteActividades(CveActividad As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_ActividadesDelete") - + Public Function UpdateTiposServiciosActividades(CveTipoServicioActividad As Integer, CveActividad As Integer, Duracion As Decimal, Observaciones As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesUpdate") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion + .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function GetCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListGrupoGet") - + Public Function DeleteTiposServiciosActividades(CveTipoServicioActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesDelete") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function AddCheckListActividadGrupo(CheckListActividadGrupo As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListGrupoAdd") - + Public Function GetTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialGet") + With SqlAdapter.SelectCommand.Parameters - .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los materiales de los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function UpdateCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CheckListActividadGrupo As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListGrupoUpdate") - + Public Function AddTiposServiciosMaterial(CveTipoServicio As Integer, Cantidad As Decimal, CveUM As Integer, CvePS As Integer, + Tipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@CveUM", SqlDbType.Int).Value = CveUM + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, Cantidad As Decimal, CveUM As Integer, CvePS As Integer, + Tipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@CveUM", SqlDbType.Int).Value = CveUM + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetTiposMantenimiento(CveTipoMantenimiento As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposMantenimientoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los tipos de mantenimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetActividades(CveActividad As Integer, CvePuesto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddActividades(Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividades(CveActividad As Integer, Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividades(CveActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoGet") + With SqlAdapter.SelectCommand.Parameters .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo - .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function DeleteCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListGrupoDelete") - + Public Function AddCheckListActividadGrupo(CheckListActividadGrupo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoAdd") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function GetCheckListTipo(CveCheckListTipo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListTipoGet") - + Public Function UpdateCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CheckListActividadGrupo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoUpdate") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function AddCheckListTipo(CheckListTipo As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListTipoAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function + Public Function DeleteCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoDelete") - Public Function UpdateCheckListTipo(CveCheckListTipo As Integer, CheckListTipo As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListTipoUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo - .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function DeleteCheckListTipo(CveCheckListTipo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListTipoDelete") - + Public Function GetCheckListTipo(CveCheckListTipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoGet") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListActividadGet") - + Public Function AddCheckListTipo(CheckListTipo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoAdd") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function AddCheckListActividad(CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListActividadAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad - .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function + Public Function UpdateCheckListTipo(CveCheckListTipo As Integer, CheckListTipo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoUpdate") - Public Function UpdateCheckListActividad(CveCheckListActividad As Integer, CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListActividadUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad - .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function DeleteCheckListActividad(CveCheckListActividad As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListActividadDelete") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function DeleteCheckListTipo(CveCheckListTipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function AddCheckListActividad(CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function UpdateCheckListActividad(CveCheckListActividad As Integer, CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function - Public Function DeleteCheckList(CveCheckList As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_CheckListDelete") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + Public Function DeleteCheckListActividad(CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckList(CveCheckList As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno End Function @@ -4185,176 +4186,176 @@ Public Class ClsAF Public Function GetOrdenesTrabajoEstatus(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoEstatusGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los estatus", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoEstatusGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los estatus", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetOrdenesTrabajo(CveOrdenTrabajo As Integer, CveTipoServicio As Integer, Folio As Integer, CveAF As Integer, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - '.Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal - .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + '.Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al consultar las ordenes de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar las ordenes de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function 'Public Function GetOrdenesTrabajoAsignacion(CveSubProyecto As Integer, CveAF As Integer, CveTipoServicio As Integer, FechaInicio As Date, FechaFin As Date, Prioridad As Integer, CveEmpresa As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_AF_OrdenesTrabajoAsignacionGet") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_AF_OrdenesTrabajoAsignacionGet") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - ' .Add("@CveAF", SqlDbType.Int).Value = CveAF - ' .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - ' .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - ' .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + ' .Add("@CveAF", SqlDbType.Int).Value = CveAF + ' .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + ' .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + ' .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio '' .Add("@FechaFin", SqlDbType.Date).Value = FechaFin ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al consultar las ordenes de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - - ' Return Retorno - + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al consultar las ordenes de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function Public Function AddOrdenesTrabajo(CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Servicio", SqlDbType.VarChar).Value = Servicio - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal - .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - .Add("@CveOrdenTrabajo", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output - - End With - - Try + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output + + End With + + Try SqlAdapter.Fill(Data) CveOrdenTrabajo = SqlAdapter.SelectCommand.Parameters("@CveOrdenTrabajo").Value.ToString.ToEntero - FolioOT = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString.ToEntero - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + FolioOT = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function UpdateOrdenesTrabajo(CveOrdenTrabajo As Integer, CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CvePersonal As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoUpdate") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoUpdate") + With SqlAdapter.SelectCommand.Parameters .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@Servicio", SqlDbType.VarChar).Value = Servicio - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal - .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function UpdateOrdenesTrabajoOC(CveOrdenTrabajo As Integer, CveOrdenCompra As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoOCUpdate") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoOCUpdate") + With SqlAdapter.SelectCommand.Parameters @@ -4362,76 +4363,76 @@ Public Class ClsAF .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetOrdenesTrabajoMateriales(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoMaterialesGet") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoMaterialesGet") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los materiales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los materiales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetOrdenesTrabajoActividades(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoActividadesGet") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoActividadesGet") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function UpdateOrdenesTrabajoActividades(CveOrdenTrabajoActividad As Integer, Valor As String, Terminado As Integer, Observaciones As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoActividadesUpdate") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoActividadesUpdate") + With SqlAdapter.SelectCommand.Parameters .Add("@CveOrdenTrabajoActividad", SqlDbType.Int).Value = CveOrdenTrabajoActividad @@ -4440,104 +4441,104 @@ Public Class ClsAF .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetOrdenesTrabajoCheckList(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoCheckListGet") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoCheckListGet") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function UpdateOrdenesTrabajoCheckList(CveOrdenTrabajoCheckList As Integer, Valor As String, Terminado As Integer, Observaciones As String, Estatus As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_AF_OrdenesTrabajoCheckListUpdate") - + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoCheckListUpdate") + With SqlAdapter.SelectCommand.Parameters .Add("@CveOrdenTrabajoCheckList", SqlDbType.Int).Value = CveOrdenTrabajoCheckList .Add("@Valor", SqlDbType.VarChar).Value = Valor .Add("@Terminado", SqlDbType.Int).Value = Terminado .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try + End With + + Try SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function #End Region -#End Region +#End Region -#Region " IDisposable Support " +#Region " IDisposable Support " ' IDisposable - Protected Overridable Sub Dispose(ByVal disposing As Boolean) - If Not disposedValue Then - If disposing Then - ' TODO: Liberar otro estado (objetos administrados). - SqlConexion.Close() - SqlConexion.Dispose() - If Not Data Is Nothing Then Data.Dispose() - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() - - End If - - ' TODO: Liberar su propio estado (objetos no administrados). - ' TODO: Establecer campos grandes como Null. - End If - disposedValue = True - End Sub - - ' Visual Basic agregó este código para implementar correctamente el modelo descartable. - Public Sub Dispose() Implements IDisposable.Dispose - ' No cambie este código. Coloque el código de limpieza en Dispose (ByVal que se dispone como Boolean). - ConexionClose() - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region -End Class + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not disposedValue Then + If disposing Then + ' TODO: Liberar otro estado (objetos administrados). + SqlConexion.Close() + SqlConexion.Dispose() + If Not Data Is Nothing Then Data.Dispose() + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() + + End If + + ' TODO: Liberar su propio estado (objetos no administrados). + ' TODO: Establecer campos grandes como Null. + End If + disposedValue = True + End Sub + + ' Visual Basic agregó este código para implementar correctamente el modelo descartable. + Public Sub Dispose() Implements IDisposable.Dispose + ' No cambie este código. Coloque el código de limpieza en Dispose (ByVal que se dispone como Boolean). + ConexionClose() + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region +End Class diff --git a/Empresas/132/Formatos/Cotizacion.rdlc b/Empresas/132/Formatos/Cotizacion.rdlc index dfb898aac..82acf3e6f 100644 --- a/Empresas/132/Formatos/Cotizacion.rdlc +++ b/Empresas/132/Formatos/Cotizacion.rdlc @@ -738,43 +738,10 @@ - Soluciones en Telemediciones JAR SA de CV - - - - - - - - - - + + + + contacto@soteljar.com + + + + + @@ -214,7 +228,7 @@ Textbox4 0.03532cm 1.48781in - 0.51102in + 0.58046in 4.09641in 4 - - true - - - - - DOMICILIO FISCAL - - - - - - - - - PASEO FLORIDO No.Ext: 62, No.Int: A, Col: NUEVA GALICIA, CP: 83245, HERMOSILLO,SONORA, MEXICO - - - - - - - Textbox10 - 0.52493in - 1.48781in - 0.65513in - 2.06754in - 8 - - - 2pt - 2pt - 2pt - 2pt - - - - true - - - - - LUGAR DE EXPEDICIÓN - - - - - - - - - =Parameters!DomicilioSucursal.Value - - - - - - - Textbox10 - 0.52493in - 3.64748in - 0.65513in - 1.93674in - 9 - - - Top - - true true @@ -436,7 +350,7 @@ 0.14361cm 0.22222in 0.81128in - 10 + 8 @@ -891,7 +805,7 @@ 5.67684in 0.16667in 2.22969in - 21 + 19 @@ -924,7 +838,7 @@ 5.67684in 0.16939in 2.22714in - 22 + 20 @@ -957,7 +871,7 @@ 5.68204in 0.17784in 2.22193in - 23 + 21 @@ -1016,6 +930,13 @@ 7pt + + , lugar de expedición C.P. 83245 Hermosillo, Sonora, México. + + @@ -1053,11 +974,11 @@ Textbox63 - 6.72543in + 6.81293in 2.52292in 0.25in 3.69856in - 25 + 23 @@ -1860,7 +1781,7 @@ 0.08093cm 4.04843cm 20.06179cm - 26 + 24 = (Parameters!AplicaPagare.Value="0" ORelse Parameters!AplicaPagare.Value="") @@ -2496,7 +2417,7 @@ 0.11468cm 1.01949cm 20.01064cm - 27 + 25 @@ -2535,7 +2456,7 @@ 5.662in 0.20317in 2.26391in - 28 + 26 @@ -2937,7 +2858,7 @@ 14.56464cm 0.6cm 5.58343cm - 30 + 28 @@ -3553,7 +3474,7 @@ 0.11468cm 5.76188cm 14.34413cm - 31 + 29 @@ -3596,7 +3517,7 @@ 0.04404in 0.36457in 7.87931in - 32 + 30 @@ -3615,7 +3536,7 @@ 0.13016cm 2.85467cm 3.50777cm - 33 + 31 @@ -3736,7 +3657,7 @@ 0.08093cm 2.03294cm 9.97751cm - 34 + 32 @@ -3822,7 +3743,7 @@ 10.05844cm 2.03294cm 10.08428cm - 35 + 33 diff --git a/Empresas/132/Formatos/NotaDevolucion.rdlc b/Empresas/132/Formatos/NotaDevolucion.rdlc index f72b1bc6d..c2c58c45f 100644 --- a/Empresas/132/Formatos/NotaDevolucion.rdlc +++ b/Empresas/132/Formatos/NotaDevolucion.rdlc @@ -195,6 +195,20 @@ Center + + + + contacto@soteljar.com + + + + + @@ -214,7 +228,7 @@ Textbox4 0.03532cm 1.48781in - 0.51102in + 0.66099in 4.09641in 4 - - true - - - - - Domicilio Fiscal - - - - - - - - - Paseo Florido, 62-A, Col.: Nueva Galicia, C.P.: 83245, Hermosillo, Sonora, México. - - - - - - - Textbox10 - 0.52493in - 1.48781in - 0.65513in - 2.06754in - 8 - - - 2pt - 2pt - 2pt - 2pt - - - - true - - - - - Lugar de Expedición - - - - - - - - - =Parameters!DomicilioSucursal.Value - - - - - - - Textbox10 - 0.52493in - 3.64748in - 0.65513in - 1.93674in - 9 - - - Top - - true true @@ -436,7 +350,7 @@ 0.14361cm 0.22222in 0.81128in - 10 + 8 @@ -891,7 +805,7 @@ 5.69622in 0.16667in 2.22969in - 21 + 19 @@ -924,7 +838,7 @@ 5.69622in 0.16939in 2.22714in - 22 + 20 @@ -957,7 +871,7 @@ 5.70142in 0.17784in 2.22193in - 23 + 21 @@ -1016,6 +930,13 @@ 7pt + + , lugar de expedición C.P. 83245 Hermosillo, Sonora, México. + + @@ -1053,11 +974,11 @@ Textbox63 - 5.98585in + 6.09835in 2.5423in 0.25in 3.69856in - 25 + 23 @@ -1860,7 +1781,7 @@ 0.13016cm 4.04843cm 20.06179cm - 26 + 24 = (Parameters!AplicaPagare.Value="0" ORelse Parameters!AplicaPagare.Value="") @@ -2496,7 +2417,7 @@ 0.11468cm 1.01949cm 20.01064cm - 27 + 25 @@ -2535,7 +2456,7 @@ 5.662in 0.20317in 2.26391in - 28 + 26 @@ -2937,7 +2858,7 @@ 14.56464cm 0.6cm 5.58343cm - 30 + 28 @@ -3553,7 +3474,7 @@ 0.11468cm 5.76188cm 14.34413cm - 31 + 29 @@ -3596,7 +3517,7 @@ 0.04404in 0.36457in 7.87931in - 32 + 30 @@ -3615,7 +3536,7 @@ 0.13016cm 2.85467cm 3.50777cm - 33 + 31 diff --git a/Empresas/132/Formatos/OC.rdlc b/Empresas/132/Formatos/OC.rdlc index dccb4d848..d39e756de 100644 --- a/Empresas/132/Formatos/OC.rdlc +++ b/Empresas/132/Formatos/OC.rdlc @@ -55,34 +55,6 @@ - - - - - - - NUEVA GALICIA - - - - - @@ -93,7 +65,9 @@ - @@ -115,6 +89,18 @@ + + + + + + + contacto@soteljar.com + + + + + Textbox4 1.77165in - 0.50583in + 0.57533in 4.00199in 5 - - - - Paseo Florido, #62-A, - - - - - - - - - Col.: Nueva Galicia Son, C.P. 83245 Hermosillo, - - - - - - - - - Sonora, México - - - - - Textbox10 - 0.50583in - 2.84624in - 0.75234in + 0.64477in + 2.84635in + 0.25114in 1.93508in 6 @@ -213,8 +212,8 @@ Textbox4 0.03532cm - 1.48781in - 0.51102in + 1.49615in + 0.66099in 4.09641in 4 - - true - - - - - Domicilio Fiscal - - - - - - - - - Paseo Florido, 62-A, Col.: Nueva Galicia, C.P.: 83245, Hermosillo, Sonora, México. - - - - - - - Textbox10 - 0.52493in - 1.48781in - 0.65513in - 2.06754in - 8 - - - 2pt - 2pt - 2pt - 2pt - - - - true - - - - - Lugar de Expedición - - - - - - - - - =Parameters!DomicilioSucursal.Value - - - - - - - Textbox10 - 0.52493in - 3.64748in - 0.65513in - 1.93674in - 9 - - - Top - - true true @@ -436,7 +335,7 @@ 0.14361cm 0.22222in 0.81128in - 10 + 8 @@ -891,7 +790,7 @@ 5.69622in 0.16667in 2.22969in - 21 + 19 @@ -924,7 +823,7 @@ 5.69622in 0.16939in 2.22714in - 22 + 20 @@ -957,7 +856,7 @@ 5.70142in 0.17784in 2.22193in - 23 + 21 @@ -1016,6 +915,13 @@ 7pt + + , lugar de expedición C.P. 83245 Hermosillo, Sonora, México. + + @@ -1053,11 +959,11 @@ Textbox63 - 5.98585in + 6.11085in 2.5423in 0.25in 3.69856in - 25 + 23 @@ -1860,7 +1766,7 @@ 0.13016cm 4.04843cm 20.06179cm - 26 + 24 = (Parameters!AplicaPagare.Value="0" ORelse Parameters!AplicaPagare.Value="") @@ -2496,7 +2402,7 @@ 0.11468cm 1.01949cm 20.01064cm - 27 + 25 @@ -2535,7 +2441,7 @@ 5.662in 0.20317in 2.26391in - 28 + 26 @@ -2937,7 +2843,7 @@ 14.56464cm 0.6cm 5.58343cm - 30 + 28 @@ -3553,7 +3459,7 @@ 0.11468cm 5.76188cm 14.34413cm - 31 + 29 @@ -3596,7 +3502,7 @@ 0.04404in 0.36457in 7.87931in - 32 + 30 @@ -3615,7 +3521,7 @@ 0.13016cm 2.85467cm 3.50777cm - 33 + 31 diff --git a/TareasProgramadas/Tareas119.ashx b/TareasProgramadas/Tareas119.ashx index d9a93a4e3..c573d0a37 100644 --- a/TareasProgramadas/Tareas119.ashx +++ b/TareasProgramadas/Tareas119.ashx @@ -30,25 +30,7 @@ public class TareasJam : IHttpHandler break; case "EjecutaThalamus": - try - { - if (context.Application["EjecutaThalamusRuning"].ToEntero() == 1) - { - retorno = true; - } - else - { - context.Application["EjecutaThalamusRuning"] = 1; - System.Threading.Thread.Sleep(500); - retorno = EjecutaThalamus(CveEmpresa, context); - context.Application["EjecutaThalamusRuning"] = 0; - } - - } - catch { - retorno = false; - context.Application["EjecutaThalamusRuning"] = 0; - } + retorno = EjecutaThalamus(CveEmpresa, context); break; default: @@ -393,6 +375,7 @@ public class TareasJam : IHttpHandler ErrorProceso = true; Respuesta = false; } + if (!ErrorProceso) { @@ -516,7 +499,13 @@ public class TareasJam : IHttpHandler this.GuardaLog($"EjecutaThalamus: Enviado correo. "); - MandaCorreo(Cuerpo, Respuesta, RutaProductos, RutaVentas, RutaClientes, RutaAlmacenes); + + + if (Respuesta) + { + MandaCorreo(Cuerpo, Respuesta, RutaProductos, RutaVentas, RutaClientes, RutaAlmacenes); + } + this.GuardaLog($"EjecutaThalamus: Tarea terminada se regresa respuesta {Respuesta.ToString()}. "); return Respuesta;