VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Cls_recepcion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Public Function rutarecepcion(Optional VarAux As Variant) As String
    Dim StrSql As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    

    StrSql = " SELECT receppath FROM SETUP  "
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open StrSql, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
        
    rutarecepcion = rs!recepPATH
    
    GetObjectContext.SetComplete
        
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "lib_trasmision.general.rutatransferencia", Err.Description

End Function

Public Function existemetatabla(ByVal Strtabla As String, Optional VarAux As Variant) As Boolean
    Dim StrSql As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    

    StrSql = " existemetatabla '" & Strtabla & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open StrSql, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    If rs!existe = 0 Then
        existemetatabla = False
    Else
        existemetatabla = 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, "lib_trasmision.cls_envios", Err.Description

End Function
Public Function obtenerpk(ByVal Strtabla As String, Optional VarAux As Variant) As ADODB.Recordset
    Dim StrSql As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError

    StrSql = " sp_pkeys '" & Strtabla & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open StrSql, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
    
    Set obtenerpk = rs
        
    GetObjectContext.SetComplete
        
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "lib_trasmision.cls_envios", Err.Description

End Function
Public Sub FLAGRECEPCION(ByVal str_site As Integer, ByVal str_idtabla As String, _
                         ByVal STR_FECHA As String, ByVal str_userid As String, _
                         ByVal str_filename As String, Optional VarAux As Variant)
    
    Dim StrSql As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
StrSql = " SH_FLAGRECEPCION '" & str_site & "','" & str_idtabla & "','" & "20020101" & "','" & _
                            str_userid & "','" & str_filename & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open StrSql, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
    
    GetObjectContext.SetComplete
        
    Exit Sub
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "lib_trasmision.cls_envios flagrecepcion ", Err.Description

End Sub
Function EXISTEDATOSFECHATRANSACCION(ByVal str_tabladestino As String, ByVal STR_CAMPOFECHA As String, _
                                     ByVal STR_FECHA As String, ByVal StrAlmacen As String, Optional VarAux As Variant) As Boolean


Dim StrSql As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    StrSql = " SELECT TOP 1 * FROM " & str_tabladestino & " WHERE " & STR_CAMPOFECHA & "='" & STR_FECHA & "' and " & _
             " SITEID='" & StrAlmacen & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open StrSql, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
    
    If rs.EOF Or rs.RecordCount = 0 Then
        EXISTEDATOSFECHATRANSACCION = False
    Else
        EXISTEDATOSFECHATRANSACCION = 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, "lib_trasmision.cls_envios", Err.Description

End Function

Function EXISTERECEPCIONARCHIVO(ByVal str_filename As String, Optional VarAux As Variant) As Boolean

Dim StrSql As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    StrSql = " SELECT TOP 1 * FROM  SH_RECEPTIONS  WHERE  FILENAME ='" & str_filename & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open StrSql, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
    
    If rs.EOF Or rs.RecordCount = 0 Then
        EXISTERECEPCIONARCHIVO = False
    Else
        EXISTERECEPCIONARCHIVO = 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, "lib_trasmision.cls_envios", 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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.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, "lib_trasmision.Cls_recepcion.Auxiliar10", Err.Description
End Function

