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_CARAS_VENDEDOR"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' Clase C_CARAS_VENDEDOR
' Funciones Básicas de Mantenimiento
'               AgregarCarasVendedor
'               EliminarCarasVendedor
'               ActualizarCarasVendedor

Option Explicit

Public Sub AgregaCarasVendedor(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal datDATESALES As Date, ByVal intNUMBERTURN As Integer, _
                               ByVal strSALESPERID As String, ByVal lngCORRNBR As Long, ByVal BitSTATUS As Byte, Optional VarAux As Variant)

    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
        
    
    strSQL = " EXEC OP_TURNVSSIDEInsProc '" & strSITEID & "','" & Format(datDATEPROCE, "YYYY/DD/MM") & "','" & Format(datDATESALES, "YYYY/DD/MM") & "'," & intNUMBERTURN & ",'" & _
                                              strSALESPERID & "'," & lngCORRNBR & ", " & BitSTATUS
                                                    
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    Dim LStrMensajeError As String
    Dim LVarNumeroError As Variant

     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_OP_MANTENIMIENTOS.AgregaCarasVendedor", LStrMensajeError
End Sub

Public Sub AgregaEnTemporal(ByVal lngCORRNBR As Long, ByVal strSIDE As String, Optional VarAux As Variant)

    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
        
    
    strSQL = " EXEC TMP_TURNSIDEInsProc " & lngCORRNBR & ",'" & strSIDE & "'"
                                                    
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    Dim LStrMensajeError As String
    Dim LVarNumeroError As Variant

     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_OP_MANTENIMIENTOS.AgregaEnTemporal", LStrMensajeError
End Sub

Public Sub EliminarCarasVendedor(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal intNUMBERTURN As Integer, _
                               ByVal strSALESPERID As String, ByVal strSIDE As String, Optional VarAux As Variant)

    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
        
    
    strSQL = " EXEC OP_TURNVSSIDEDelProc '" & strSITEID & "','" & Format(datDATEPROCE, "YYYY/DD/MM") & "'," & intNUMBERTURN & ",'" & _
                                              strSALESPERID & "','" & strSIDE & "'"
                                                    
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    Dim LStrMensajeError As String
    Dim LVarNumeroError As Variant

     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_OP_MANTENIMIENTOS.EliminarCarasVendedor", LStrMensajeError
End Sub

Public Sub EliminaCarasVendedor(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal datDATESALES As Date, ByVal intNUMBERTURN As Integer, _
                               ByVal strSALESPERID As String, Optional VarAux As Variant)

    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
                    
    strSQL = " EXEC OP_TURNVSSIDEEliProc '" & strSITEID & "','" & Format(datDATEPROCE, "YYYY/DD/MM") & "','" & Format(datDATESALES, "YYYY/DD/MM") & "'," & intNUMBERTURN & ",'" & _
                                              strSALESPERID & "'"
                                                    
        
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    ''GetObjectContext.SetComplete
    
    Exit Sub
    
TrataError:
    Dim LStrMensajeError As String
    Dim LVarNumeroError As Variant

     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_OP_MANTENIMIENTOS.AgregaCarasVendedor", LStrMensajeError
End Sub


Public Sub AgregaEnTemporalCarasVendedor(ByVal intCORRNBR As Integer, ByVal strSIDE As String, Optional VarAux As Variant)

    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
        
    
    strSQL = " EXEC TMP_OP_TURNVSSIDEInsProc " & intCORRNBR & ",'" & strSIDE & "'"
                                                    
    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_OP_MANTENIMIENTOS.AgregaEnTemporalCarasVendedor", Err.Description

End Sub

Public Sub EliminarEnTemporalCarasVendedor(ByVal intCORRNBR As Integer, ByVal strSIDE As String, Optional VarAux As Variant)

    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
        
    
    strSQL = " EXEC TMP_OP_TURNVSSIDEDelProc " & intCORRNBR & ",'" & strSIDE & "'"
                                                    
    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_OP_MANTENIMIENTOS.EliminarEnTemporalCarasVendedor", Err.Description

End Sub


Public Function SeleccionaEnTemporalCarasVendedor(ByVal intCORRNBR As Integer, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT 'Cara ' + SIDE as CARAS" & _
             " FROM TMP_OP_TURNVSSIDE " & _
             " WHERE CORRNBR=" & intCORRNBR & " ORDER BY SIDE ASC "
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnTemporalCarasVendedor = 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.SeleccionaEnTemporalCarasVendedor", Err.Description

End Function

Public Function ListarCarasVendedor(ByVal strSITEID As String, ByVal strSALESPERID As String, ByVal datFECHAINI As Date, ByVal datFECHAFIN As Date, _
                                   ByVal bytAlmacen As Byte, ByVal bytVendedor 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 And bytVendedor = 1 Then 'TODOS LOS ALMACENES
        strSQL = " SELECT OP_TURNVSSIDE.SITEID as Almacen,OP_TURNVSSIDE.SALESPERID as CodVendedor,SALESPERNAME AS Vendedor,DATEPROCE as Fech_Proc,DATESALES AS Fech_Vta,NUMBERTURN as Turno,SIDE as Cara,CASE STATUS " & _
                 " WHEN 1 THEN 'APROBADO' WHEN 0 THEN 'PENDIENTE' END AS Estado " & _
                 " FROM OP_TURNVSSIDE INNER JOIN OP_SALESPERSON " & _
                 " ON OP_TURNVSSIDE.SALESPERID=OP_SALESPERSON.SALESPERID " & _
                 " WHERE DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "'"
    End If
    
    If bytAlmacen = 1 And bytVendedor = 0 Then 'TODOS LOS ALMACENES
        strSQL = " SELECT OP_TURNVSSIDE.SITEID as Almacen,OP_TURNVSSIDE.SALESPERID as CodVendedor,SALESPERNAME AS Vendedor,DATEPROCE as Fech_Proc,DATESALES AS Fech_Vta,NUMBERTURN as Turno,SIDE as Cara,CASE STATUS " & _
                 " WHEN 1 THEN 'APROBADO' WHEN 0 THEN 'PENDIENTE' END AS Estado " & _
                 " FROM OP_TURNVSSIDE INNER JOIN OP_SALESPERSON " & _
                 " ON OP_TURNVSSIDE.SALESPERID=OP_SALESPERSON.SALESPERID " & _
                 " WHERE DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND OP_TURNVSSIDE.SALESPERID='" & strSALESPERID & "'"
    End If
    
    If bytAlmacen = 0 And bytVendedor = 1 Then 'TODOS LOS ALMACENES
        strSQL = " SELECT OP_TURNVSSIDE.SITEID as Almacen,OP_TURNVSSIDE.SALESPERID as CodVendedor,SALESPERNAME AS Vendedor,DATEPROCE as Fech_Proc,DATESALES AS Fech_Vta,NUMBERTURN as Turno,SIDE as Cara,CASE STATUS " & _
                 " WHEN 1 THEN 'APROBADO' WHEN 0 THEN 'PENDIENTE' END AS Estado " & _
                 " FROM OP_TURNVSSIDE INNER JOIN OP_SALESPERSON " & _
                 " ON OP_TURNVSSIDE.SALESPERID=OP_SALESPERSON.SALESPERID " & _
                 " WHERE DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND OP_TURNVSSIDE.SITEID='" & strSITEID & "'"
    End If

    If bytAlmacen = 0 And bytVendedor = 0 Then 'TODOS LOS ALMACENES
        strSQL = " SELECT OP_TURNVSSIDE.SITEID as Almacen,OP_TURNVSSIDE.SALESPERID as CodVendedor,SALESPERNAME AS Vendedor,DATEPROCE as Fech_Proc,DATESALES AS Fech_Vta,NUMBERTURN as Turno,SIDE as Cara,CASE STATUS " & _
                 " WHEN 1 THEN 'APROBADO' WHEN 0 THEN 'PENDIENTE' END AS Estado " & _
                 " FROM OP_TURNVSSIDE INNER JOIN OP_SALESPERSON " & _
                 " ON OP_TURNVSSIDE.SALESPERID=OP_SALESPERSON.SALESPERID " & _
                 " WHERE DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND OP_TURNVSSIDE.SITEID='" & strSITEID & "' AND OP_TURNVSSIDE.SALESPERID='" & strSALESPERID & "'"
    End If

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ListarCarasVendedor = 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.ListarCarasVendedor", Err.Description

End Function

Public Function ListarCarasVendedorOnLine(ByVal strSITEID As String, ByVal datFECHAINI As Date, ByVal datDATESALES As Date, Optional VarAux As Variant) As ADODB.Recordset
                               
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    

        strSQL = " SELECT OP_TURNVSSIDE.SITEID as Almacen,OP_TURNVSSIDE.SALESPERID as CodVendedor,SALESPERNAME AS Vendedor,DATEPROCE as Fech_Proc,NUMBERTURN as Turno,SIDE as Cara,CASE STATUS " & _
                 " WHEN 1 THEN 'APROBADO' WHEN 0 THEN 'PENDIENTE' END AS Estado " & _
                 " FROM OP_TURNVSSIDE INNER JOIN OP_SALESPERSON " & _
                 " ON OP_TURNVSSIDE.SALESPERID=OP_SALESPERSON.SALESPERID " & _
                 " WHERE DATEPROCE='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATESALES='" & Format(datDATESALES, "DD/MM/YYYY") & "' AND OP_TURNVSSIDE.SITEID='" & strSITEID & "' ORDER BY NUMBERTURN,SIDE "

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ListarCarasVendedorOnLine = 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.ListarCarasVendedorOnLine", Err.Description

End Function

Public Function ObtenerCarasVendedor(ByVal strSITEID As String, ByVal datFECHAINI As Date, ByVal datDATESALES As Date, _
                                   ByVal strSALESPERID As String, ByVal intNUMBERTURN As Integer, Optional VarAux As Variant) As ADODB.Recordset
                               
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    

        strSQL = " SELECT SIDE " & _
                 " FROM OP_TURNVSSIDE " & _
                 " WHERE DATEPROCE='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATESALES='" & Format(datDATESALES, "DD/MM/YYYY") & "' AND OP_TURNVSSIDE.SITEID='" & strSITEID & _
                 "' AND SALESPERID='" & strSALESPERID & "' AND NUMBERTURN=" & intNUMBERTURN & " ORDER BY SIDE "

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ObtenerCarasVendedor = 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.ObtenerCarasVendedor", Err.Description

End Function

Public Function CargaVendedores(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal intNUMBERTURN As Integer, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT DISTINCT SALESPERID,SALESPERNAME FROM VW_TURNOS_VENDEDOR " & _
             " WHERE DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND SITEID='" & strSITEID & "' AND NUMBERTURN=" & intNUMBERTURN & " AND STATUS=0"

    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    Set CargaVendedores = 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.CargaVendedores", Err.Description

End Function

Public Function SeleccionTemporal(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal intNUMBERTURN As Integer, ByVal strSALESPERID As String, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT DISTINCT Cara" & _
             " FROM VW_TURNOS_VENDEDOR " & _
             " WHERE DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND SITEID='" & strSITEID & "' AND NUMBERTURN=" & intNUMBERTURN & " and SALESPERID='" & strSALESPERID & "'"
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionTemporal = 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.SeleccionTemporal", Err.Description

End Function

Public Function ObtienePassWordVendedor(ByVal strSALESPERID As String, Optional VarAux As Variant) As String
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT PASSWORD FROM OP_SALESPERSON WHERE SALESPERID='" & strSALESPERID & "'"
  
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    If rs.EOF Then
      ObtienePassWordVendedor = Empty
    Else
      ObtienePassWordVendedor = rs!Password
    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.ObtienePassWordVendedor", Err.Description

End Function

Public Sub ConfirmarTurno(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal intNUMBERTURN As Integer, ByVal strSALESPERID As String, Optional VarAux As Variant)
    Dim con As ADODB.Connection
    Dim strSQL As String
    
    On Error GoTo TrataError
    
    strSQL = " EXEC ConfirmarTurnoProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & intNUMBERTURN & ",'" & strSALESPERID & "'"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    '''GetObjectContext.SetComplete
    
    Exit Sub

TrataError:
Dim LStrMensajeError As String
Dim LVarNumeroError As Variant

     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.ConfirmarTurno", LStrMensajeError

End Sub

Public Function CargaVendedoresR(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal intNUMBERTURN As Integer, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SALESPERID,SALESPERNAME FROM OP_SALESPERSON WHERE SALESPERID NOT IN (SELECT DISTINCT SALESPERID FROM VW_TURNOS_VENDEDOR " & _
             " WHERE DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND SITEID='" & strSITEID & "' AND NUMBERTURN=" & intNUMBERTURN & " )"

    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    Set CargaVendedoresR = 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.CargaVendedoresR", Err.Description

End Function

Public Sub ReemplazarTurno(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal intNUMBERTURN As Integer, ByVal strSALESPERID As String, ByVal strSALESPERIDOLD As String, Optional VarAux As Variant)
    Dim con As ADODB.Connection
    Dim strSQL As String
    
    On Error GoTo TrataError
    
    strSQL = " EXEC ReemplazoTurnoProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & intNUMBERTURN & ",'" & strSALESPERID & "','" & strSALESPERIDOLD & "'"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    '''GetObjectContext.SetComplete
    
    Exit Sub

TrataError:
Dim LStrMensajeError As String
Dim LVarNumeroError As Variant

     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.ReemplazarTurno", LStrMensajeError

End Sub

Public Function BuscaRegistro(ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal datDATESALES As Date, ByVal intNUMBERTURN As Integer, _
                              ByVal strSIDE As String, Optional VarAux As Variant) As Boolean
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    BuscaRegistro = False
    
    strSQL = " SELECT SITEID FROM OP_TURNVSSIDE WHERE SITEID='" & strSITEID & "' AND DATEPROCE='" & Format(datDATEPROCE, "YYYY/DD/MM") & "' AND DATESALES='" & Format(datDATESALES, "YYYY/DD/MM") & "' AND NUMBERTURN=" & intNUMBERTURN & " AND SIDE='" & strSIDE & "'"
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
    
    If rs.RecordCount > 0 Then
        BuscaRegistro = 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.BuscaRegistro", 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
