Attribute VB_Name = "Module1"
Public Sub Actualizar_Datos_LuegodeCierreX(StrNroPtoVta As String, IntLugar As Integer, _
                                    IntTurno As Integer, datFechaCierre As Date, StrSalesperId As String)
                                    
Dim cmd As ADODB.Command
Dim strSQL As String
        
On Error GoTo errhandler

    strSQL = "ACTUALIZA_DATOS_LUEGODECIERREX '" & StrNroPtoVta & "'," & IntLugar & "," & IntTurno & ",'" & StrSalesperId & "','" & Format(datFechaCierre, "DD/MM/YYYY") & "'"
        
    Set cmd = New ADODB.Command
        
    cmd.CommandText = strSQL
    cmd.ActiveConnection = "FILEDSN=conexionsies"
    cmd.Execute

    'GetObjectContext.SetComplete
    
    Exit Sub
        
errhandler:

    If Not cmd Is Nothing Then
        Set cmd = Nothing
    End If
    
    'GetObjectContext.SetAbort
    Err.Raise Err.Number, "CierreX.Actualizar_Datos_LuegodeCierreX", Err.Description
End Sub



Public Function Auxiliar1(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    
    Dim con As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strSQL As String

    
On Error GoTo errhandler
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    strSQL = "OP_SECUENCIA_CIERREX_PROC '" & VarAux1 & "'"
        
    rs.Open strSQL, con, adOpenStatic
                
    Set Auxiliar1 = rs
    
        
    'GetObjectContext.SetComplete
    Exit Function
    
errhandler:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    If Not con Is Nothing Then
        Set con = Nothing
    End If
    
    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_OP_FACTURACION.C_CIERRE.Auxiliar1", 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

