VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "C_Correlativos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'Enrique Franco
'Clase C_Correlativos
'Propiedades :
'             ObtenerCorrelativo
'             ObtenerSecuencia
'             SgteItemEnDetalleFormula

'****************************************************************************************************
'Funcionalidad : Proporcionar un Correltaivo único para grabar en los Detalles
'Parametros de Entrada : El código del Usuario
'Parametros de Retorno : Un número único de tipo Double
'****************************************************************************************************

Public Function ObtenerCorrelativo(ByVal struserid As String, Optional VarAux As Variant) As Double
Dim cmd As ADODB.Command
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

On Error GoTo ErrorHandler
 
Set cmd = New ADODB.Command
cmd.CommandText = "ObtenerCorrelativoProcUtil '" & struserid & "'"

Set con = New ADODB.Connection
con.Open "FILEDSN=conexionsies"

Set cmd.ActiveConnection = con
Set rs = cmd.Execute

ObtenerCorrelativo = rs!correlativo

'GetObjectContext.SetComplete

Exit Function
         
ErrorHandler:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
    
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     
     If Not rs Is Nothing Then
        Set rs = Nothing
     End If

     If Not con Is Nothing Then
        LStrMensajeError = con.Errors(con.Errors.Count - 2).Description
        LVarNumeroError = con.Errors(con.Errors.Count - 2).NativeError
        Set con = Nothing
     End If
     
     ''GetObjectContext.SetAbort
     
     Err.Raise LVarNumeroError, "DB_CORRELATIVO.ObtenerCorrelativo", LStrMensajeError
         
End Function

' Para obtener la secuencia de los registros en tabla temporal de detalle
' (TMP_IN_INTRAITEM)
' Edgar Cancho Ruiz
' Fecha 20/09/2002

Public Function ObtenerSecuencia(intCORRNBR As Long, Optional VarAux As Variant) As Long
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim prm As ADODB.Parameter

    On Error GoTo ErrorHandler
 
    Set cmd = New ADODB.Command
    cmd.CommandText = "IN_ObtieneSecuenciaProc"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    
    Set cmd.ActiveConnection = con
        
    cmd.CommandType = adCmdStoredProc
    Set prm = cmd.CreateParameter("Retorno", adInteger, adParamReturnValue, , 0)
    cmd.Parameters.Append prm
    
    Set prm = cmd.CreateParameter("@CORRNBR", adInteger, adParamInput, , intCORRNBR)
    cmd.Parameters.Append prm
    cmd.Execute
    
    ObtenerSecuencia = cmd("Retorno")
    
    'GetObjectContext.SetComplete
    
    Exit Function
        
ErrorHandler:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
    
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not prm Is Nothing Then
        Set prm = Nothing
     End If
     If Not con Is Nothing Then
        LStrMensajeError = con.Errors(con.Errors.Count - 2).Description
        LVarNumeroError = con.Errors(con.Errors.Count - 2).NativeError
        Set con = Nothing
     End If
     
     ''GetObjectContext.SetAbort
     
     Err.Raise LVarNumeroError, "DB_CORRELATIVO.ObtenerSecuencia", LStrMensajeError
         
End Function

' Para obtener la secuencia de los registros en tabla temporal de detalle
' (TMP_IN_KITCOMPONENT)
' Edgar Cancho Ruiz
' Fecha 11/10/2002

Public Function SgteItemEnDetalleFormula(intCORRNBR As Long, Optional VarAux As Variant) As Long
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim prm As ADODB.Parameter

    On Error GoTo ErrorHandler
 
    Set cmd = New ADODB.Command
    cmd.CommandText = "IN_SgteItemEnDetalleFormulaProc"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    
    Set cmd.ActiveConnection = con
        
    cmd.CommandType = adCmdStoredProc
    Set prm = cmd.CreateParameter("Retorno", adInteger, adParamReturnValue, , 0)
    cmd.Parameters.Append prm
    
    Set prm = cmd.CreateParameter("@CORRNBR", adInteger, adParamInput, , intCORRNBR)
    cmd.Parameters.Append prm
    cmd.Execute
    
    SgteItemEnDetalleFormula = cmd("Retorno")
    
    'GetObjectContext.SetComplete
    
    Exit Function
        
ErrorHandler:
  
Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
    
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not prm Is Nothing Then
        Set prm = Nothing
     End If
     If Not con Is Nothing Then
        LStrMensajeError = con.Errors(con.Errors.Count - 2).Description
        LVarNumeroError = con.Errors(con.Errors.Count - 2).NativeError
        Set con = Nothing
     End If
     
     ''GetObjectContext.SetAbort
     
     Err.Raise LVarNumeroError, "DB_CORRELATIVO.SgteItemEnDetalleFormula", LStrMensajeError
              
End Function

' Para obtener la secuencia de los registros en tabla temporal de detalle
' (TMP_IN_PRICELEVELTEMDET ) Historial de Precios de Inventario
' Edgar Cancho Ruiz
' Fecha 08/11/2002

Public Function SgteItemEnDetalleHistPreInv(intCORRNBR As Long, Optional VarAux As Variant) As Long
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim prm As ADODB.Parameter

    On Error GoTo ErrorHandler
 
    Set cmd = New ADODB.Command
    cmd.CommandText = "IN_SgteItemEnDetalleHistPreInvProc"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    
    Set cmd.ActiveConnection = con
        
    cmd.CommandType = adCmdStoredProc
    Set prm = cmd.CreateParameter("Retorno", adInteger, adParamReturnValue, , 0)
    cmd.Parameters.Append prm
    
    Set prm = cmd.CreateParameter("@CORRNBR", adInteger, adParamInput, , intCORRNBR)
    cmd.Parameters.Append prm
    cmd.Execute
    
    SgteItemEnDetalleHistPreInv = cmd("Retorno")
    
    'GetObjectContext.SetComplete
    
    Exit Function
        
ErrorHandler:
  
Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
    
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not prm Is Nothing Then
        Set prm = Nothing
     End If
     If Not con Is Nothing Then
        LStrMensajeError = con.Errors(con.Errors.Count - 2).Description
        LVarNumeroError = con.Errors(con.Errors.Count - 2).NativeError
        Set con = Nothing
     End If
     
     ''GetObjectContext.SetAbort
     
     Err.Raise LVarNumeroError, "DB_CORRELATIVO.SgteItemEnDetalleHistPreInv", LStrMensajeError
              
End Function

Public Function SgteItemEnDetalleHistPrecCli(intCORRNBR As Long, Optional VarAux As Variant) As Long
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim prm As ADODB.Parameter

    On Error GoTo ErrorHandler
 
    Set cmd = New ADODB.Command
    cmd.CommandText = "IN_SgteItemEnDetalleHistPrecCliProc"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    
    Set cmd.ActiveConnection = con
        
    cmd.CommandType = adCmdStoredProc
    Set prm = cmd.CreateParameter("Retorno", adInteger, adParamReturnValue, , 0)
    cmd.Parameters.Append prm
    
    Set prm = cmd.CreateParameter("@CORRNBR", adInteger, adParamInput, , intCORRNBR)
    cmd.Parameters.Append prm
    cmd.Execute
    
    SgteItemEnDetalleHistPrecCli = cmd("Retorno")
    
    'GetObjectContext.SetComplete
    
    Exit Function
        
ErrorHandler:
  
Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
    
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not prm Is Nothing Then
        Set prm = Nothing
     End If
     If Not con Is Nothing Then
        LStrMensajeError = con.Errors(con.Errors.Count - 2).Description
        LVarNumeroError = con.Errors(con.Errors.Count - 2).NativeError
        Set con = Nothing
     End If
     
     ''GetObjectContext.SetAbort
     
     Err.Raise LVarNumeroError, "DB_CORRELATIVO.SgteItemEnDetalleHistPrecCli", LStrMensajeError
              
End Function


Public Function Auxiliar1(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar1", Err.Description
End Function

Public Function Auxiliar2(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar2", Err.Description
End Function

Public Function Auxiliar3(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar3", Err.Description
End Function

Public Function Auxiliar4(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar4", Err.Description
End Function

Public Function Auxiliar5(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar5", Err.Description
End Function


Public Function Auxiliar6(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar6", Err.Description
End Function

Public Function Auxiliar7(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar7", Err.Description
End Function

Public Function Auxiliar8(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar8", Err.Description
End Function

Public Function Auxiliar9(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar9", Err.Description
End Function

Public Function Auxiliar10(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    ' Funcion
    
    On Error GoTo errhandler
    
    
    
    'GetObjectContext.SetComplete
    
    Exit Function
errhandler:
    ''GetObjectContext.SetAbort
    Err.Raise Err.Number, "DB_CORRELATIVO.C_Correlativos.Auxiliar10", Err.Description
End Function


