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_PRECIOS_COMP"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Public Sub ActualizaTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal strCOMPETITIONID As String, _
                             ByVal strINVTIDSKU As String, ByVal dblSLS_PRICE As Double, Optional VarAux As Variant)
                                
                                
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim strSQL As String

    On Error GoTo TrataError
    
    strSQL = " EXEC TMP_IN_COMPETITIONPRICEDETUpdProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & strCOMPETITIONID & "','" & _
                                                    strINVTIDSKU & "'," & dblSLS_PRICE
                                
    Set cmd = New ADODB.Command
    cmd.CommandText = strSQL
      
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    cmd.ActiveConnection = con
    cmd.Execute
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    If Not cmd Is Nothing Then
        Set cmd = Nothing
    End If
    If Not con Is Nothing Then
        Set con = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.ActualizaTemporal", Err.Description

End Sub

Public Sub ActualizaTemporal2(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                             ByVal strINVTIDSKU As String, ByVal dblPRICESUGGESTED As Double, Optional VarAux As Variant)
                                
                                
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim strSQL As String

    On Error GoTo TrataError
    
    strSQL = " EXEC TMP_IN_COMPETITIONPRICEUpdProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    strINVTIDSKU & "'," & dblPRICESUGGESTED
                                
    Set cmd = New ADODB.Command
    cmd.CommandText = strSQL
      
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    cmd.ActiveConnection = con
    cmd.Execute
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    If Not cmd Is Nothing Then
        Set cmd = Nothing
    End If
    If Not con Is Nothing Then
        Set con = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.ActualizaTemporal2", Err.Description

End Sub

Public Sub AgregarRegistro(lngCORREL As Long, Optional VarAux As Variant)
                             
   
    Dim con As ADODB.Connection
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " EXEC IN_COMPETITIONPRICEInsProc " & lngCORREL
                                

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

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, con, adOpenStatic
    
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
     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_MA_MANTENIMIENTOS.AgregarRegistro", LStrMensajeError
     
End Sub

Public Sub AgregarRegistro2(ByVal lngCORREL As Long, Optional VarAux As Variant)
                             
   
    Dim con As ADODB.Connection
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " EXEC IN_COMPETITIONPRICEInsProc " & lngCORREL
                                

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

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, con, adOpenStatic
    
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
     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_MA_MANTENIMIENTOS.AgregarRegistro2", LStrMensajeError
     
End Sub

Public Sub AgregaAlTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal strCOMPETITIONID As String, Optional VarAux As Variant)
    
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC CARGA_TMP_IN_COMPETITIONPRICEDET_PROC '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & strCOMPETITIONID & "'," & lngCORRNBR
    
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    If Not con Is Nothing Then
        Set con = Nothing
    End If
    
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.AgregaAlTemporal", Err.Description

End Sub

Public Sub AgregaAlTemporal2(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, Optional VarAux As Variant)
    
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC CARGA_TMP_IN_COMPETITIONPRICE_PROC '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & lngCORRNBR
    
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    If Not con Is Nothing Then
        Set con = Nothing
    End If
    
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.AgregaAlTemporal2", Err.Description

End Sub

Public Sub CopiarOriginalAlTemporal(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal strCOMPETITIONID As String, ByVal lngCORRNBR As Long, Optional VarAux As Variant)
    
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC Copiar_IN_COMPETITIONPRICEDET_AlTemporalProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & strCOMPETITIONID & "'," & lngCORRNBR
    
    
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    If Not con Is Nothing Then
        Set con = Nothing
    End If
    
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.CopiarOriginalAlTemporal", Err.Description

End Sub

Public Sub CopiarOriginalAlTemporal2(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal lngCORRNBR As Long, Optional VarAux As Variant)
    
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC Copiar_IN_COMPETITIONPRICE_AlTemporalProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & lngCORRNBR
    
    
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    If Not con Is Nothing Then
        Set con = Nothing
    End If
    
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.CopiarOriginalAlTemporal2", Err.Description

End Sub

Public Function ExisteRegistro(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal strCOMPETITIONID As String, Optional VarAux As Variant) As Boolean
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    ExisteRegistro = False
    
    strSQL = " SELECT *  FROM IN_COMPETITIONPRICEDET " & _
             " WHERE DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND SITEID='" & strSITEID & "' AND COMPETITIONID='" & strCOMPETITIONID & "'"

    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    If rs.RecordCount > 0 Then
        ExisteRegistro = True
    End If
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_OP_MANTENIMIENTOS.ExisteRegistro", Err.Description

End Function

Public Function ExisteRegistro2(ByVal strSITEID As String, ByVal datDATEPROCE As Date, Optional VarAux As Variant) As Boolean
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    ExisteRegistro2 = False
    
    strSQL = " SELECT *  FROM IN_COMPETITIONPRICE " & _
             " WHERE DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND SITEID='" & strSITEID & "'"

    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    If rs.RecordCount > 0 Then
        ExisteRegistro2 = True
    End If
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_OP_MANTENIMIENTOS.ExisteRegistro2", Err.Description

End Function

Public Function ListarCtrlPrecios(ByVal strSITEID As String, ByVal datFECHAINI As Date, ByVal datFECHAFIN As Date, _
                                  ByVal bytAlmacen As Byte, Optional VarAux As Variant) As ADODB.Recordset
                               
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    If bytAlmacen = 1 Then  'TODOS LOS ALMACENES
        strSQL = " SELECT I.SITEID as Almacen,I.DATEPROCE as Fech_Proce,I.COMPETITIONID as CodComp, " & _
                 " C.COMPETITIONNAME AS Competencia,I.INVTIDSKU as CodArt,A.DESCR as Articulo,I.SLS_PRICE as Precio " & _
                 " FROM (IN_COMPETITIONPRICEDET AS I JOIN COMPETITION AS C  " & _
                 " ON I.COMPETITIONID=C.COMPETITIONID) JOIN IN_INVENTORY AS A " & _
                 " ON I.INVTIDSKU=A.INVTIDSKU " & _
                 " WHERE I.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND I.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' ORDER BY I.INVTIDSKU "
    Else
        
        strSQL = " SELECT I.SITEID as Almacen,I.DATEPROCE as Fech_Proce,I.COMPETITIONID as CodComp, " & _
                 " C.COMPETITIONNAME AS Competencia,I.INVTIDSKU as CodArt,A.DESCR as Articulo,I.SLS_PRICE as Precio " & _
                 " FROM (IN_COMPETITIONPRICEDET AS I JOIN COMPETITION AS C  " & _
                 " ON I.COMPETITIONID=C.COMPETITIONID) JOIN IN_INVENTORY AS A " & _
                 " ON I.INVTIDSKU=A.INVTIDSKU " & _
                 " WHERE I.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND I.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND I.SITEID='" & strSITEID & "' ORDER BY I.INVTIDSKU "
        
    End If


    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ListarCtrlPrecios = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_OP_MANTENIMIENTOS.ListarCtrlPrecios", Err.Description

End Function

Public Function ListarCtrlPrecios2(ByVal strSITEID As String, ByVal datFECHAINI As Date, ByVal datFECHAFIN As Date, _
                                   ByVal bytAlmacen As Byte, Optional VarAux As Variant) As ADODB.Recordset
                               
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    If bytAlmacen = 1 Then  'TODOS LOS ALMACENES
        strSQL = " SELECT I.SITEID as Almacen,I.DATEPROCE as Fech_Proce, " & _
                 " I.INVTIDSKU as CodArt,A.DESCR as Articulo,I.PRICESUGGESTED as Sugerido,I.PRICECURRENT AS Actual,I.PRICEPREVIOUS AS Anterior " & _
                 " FROM IN_COMPETITIONPRICE AS I  JOIN IN_INVENTORY AS A " & _
                 " ON I.INVTIDSKU=A.INVTIDSKU " & _
                 " WHERE I.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND I.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' ORDER BY I.INVTIDSKU "
    Else
        
        strSQL = " SELECT I.SITEID as Almacen,I.DATEPROCE as Fech_Proce, " & _
                 " I.INVTIDSKU as CodArt,A.DESCR as Articulo,I.PRICESUGGESTED as Sugerido,I.PRICECURRENT AS Actual,I.PRICEPREVIOUS AS Anterior " & _
                 " FROM IN_COMPETITIONPRICE AS I  JOIN IN_INVENTORY AS A " & _
                 " ON I.INVTIDSKU=A.INVTIDSKU " & _
                 " WHERE I.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND I.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND I.SITEID='" & strSITEID & "' ORDER BY I.INVTIDSKU "
        
    End If


    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ListarCtrlPrecios2 = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_OP_MANTENIMIENTOS.ListarCtrlPrecios2", Err.Description

End Function

Public Sub ModificarRegistros(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal strCOMPETITIONID As String, ByVal lngCORRNBR As Long, Optional VarAux As Variant)
                             
    Dim con As ADODB.Connection
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " EXEC IN_COMPETITIONPRICEDETUpdProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & strCOMPETITIONID & "'," & lngCORRNBR
                                

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

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, con, adOpenStatic
    

    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
     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_MA_MANTENIMIENTOS.ModificarRegistros", LStrMensajeError
     
End Sub

Public Sub ModificarRegistros2(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal lngCORRNBR As Long, Optional VarAux As Variant)
                             
    Dim con As ADODB.Connection
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " EXEC IN_COMPETITIONPRICEUpdProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & lngCORRNBR
                                

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

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, con, adOpenStatic
    

    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
     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_MA_MANTENIMIENTOS.ModificarRegistros2", LStrMensajeError
     
End Sub

Public Function SeleccionaEnOriginal(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal strCOMPETITIONID As String, Optional VarAux As Variant) As ADODB.Recordset

    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT T.INVTIDSKU AS Cod,I.DESCR as Descripcion,T.SLS_PRICE as Precio " & _
             " FROM IN_COMPETITIONPRICEDET AS T JOIN IN_INVENTORY AS I " & _
             " ON T.INVTIDSKU=I.INVTIDSKU " & _
             " WHERE T.SITEID='" & strSITEID & "' AND T.DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND T.COMPETITIONID='" & strCOMPETITIONID & "' ORDER BY T.INVTIDSKU "
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnOriginal = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.SeleccionaEnOriginal", Err.Description

End Function

Public Function SeleccionaEnOriginal2(ByVal strSITEID As String, ByVal datDATEPROCE As Date, Optional VarAux As Variant) As ADODB.Recordset
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT T.INVTIDSKU AS Cod,I.DESCR as Descripcion,T.PRICESUGGESTED as Sugerido,T.PRICECURRENT as Actual,T.PRICEPREVIOUS as Anterior " & _
             " FROM IN_COMPETITIONPRICE AS T JOIN IN_INVENTORY AS I " & _
             " ON T.INVTIDSKU=I.INVTIDSKU " & _
             " WHERE T.SITEID='" & strSITEID & "' AND T.DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' ORDER BY T.INVTIDSKU "
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnOriginal2 = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.SeleccionaEnOriginal2", Err.Description

End Function

Public Function SeleccionaEnTemporal(ByVal intCORRNBR As Integer, ByVal intREDONDEO As Integer, Optional VarAux As Variant) As ADODB.Recordset
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT T.INVTIDSKU AS Cod,I.DESCR as Descripcion,T.SLS_PRICE as Precio " & _
             " FROM TMP_IN_COMPETITIONPRICEDET AS T JOIN IN_INVENTORY AS I " & _
             " ON T.INVTIDSKU=I.INVTIDSKU " & _
             " WHERE CORRNBR=" & intCORRNBR & " ORDER BY T.INVTIDSKU "
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnTemporal = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.SeleccionaEnTemporal", Err.Description

End Function

Public Function SeleccionaEnTemporal2(ByVal intCORRNBR As Integer, ByVal intREDONDEO As Integer, Optional VarAux As Variant) As ADODB.Recordset
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT T.INVTIDSKU AS Cod,I.DESCR as Descripcion,T.PRICESUGGESTED as Sugerido,T.PRICECURRENT as Actual,T.PRICEPREVIOUS as Anterior " & _
             " FROM TMP_IN_COMPETITIONPRICE AS T JOIN IN_INVENTORY AS I " & _
             " ON T.INVTIDSKU=I.INVTIDSKU " & _
             " WHERE CORRNBR=" & intCORRNBR & " ORDER BY T.INVTIDSKU "
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnTemporal2 = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_MA_MANTENIMIENTOS.SeleccionaEnTemporal2", Err.Description

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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.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_OP_FACTURACION.C_CIERRE.Auxiliar10", Err.Description
End Function


