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_DEPOSITOS"
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 intSEQUENCE As Integer, _
                             ByVal datDATEDEPOSIT As Date, ByVal strCURYID As String, _
                             ByVal dblTOTALPEN As Double, ByVal dblTOTALUSD 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_OP_DEPOSITSITEDETUpdProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & intSEQUENCE & ",'" & _
                                                    Format(datDATEDEPOSIT, "DD/MM/YYYY") & "','" & strCURYID & "'," & _
                                                    dblTOTALPEN & "," & dblTOTALUSD
                                
    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 Function AgregarDeposito(ByVal strSITEID As String, ByVal datDATEPROCES As Date, _
                                ByVal dblTOTALPEN As Double, ByVal dblTOTALUSD As Double, _
                                ByVal strUSERID As String, ByVal lngCORREL As Long, Optional VarAux As Variant) As String
                             
   
    Dim con As ADODB.Connection
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " EXEC GrabarCabDepositoProc '" & strSITEID & "','" & Format(datDATEPROCES, "YYYY/DD/MM") & "'," & _
                                                dblTOTALPEN & "," & dblTOTALUSD & ",'" & _
                                                strUSERID & "'," & lngCORREL
                                

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

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, con, adOpenStatic
    
    AgregarDeposito = rs!NUMERODEPOSITO
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
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.AgregarDeposito", LStrMensajeError
     
End Function

Public Function AgregaAlTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                            ByVal strCUSTIDSS As String, ByVal dblREFERENCE As Double, ByVal strDEPOSITPASSWORD As String, _
                            ByVal datDATEDEPOSIT As Date, ByVal strCURYID As String, ByVal dblCURYRATE As Double, _
                            ByVal dblTOTALPEN As Double, ByVal dblTOTALUSD As Double, ByVal strDEBEHABER As String, ByVal strUSERID As String, Optional VarAux As Variant) As Integer
        
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strSQL As String

    On Error GoTo TrataError
 
    strSQL = " EXEC TMP_OP_DEPOSITSITEDETInsProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    strCUSTIDSS & "'," & dblREFERENCE & ",'" & strDEPOSITPASSWORD & "','" & _
                                                    Format(datDATEDEPOSIT, "DD/MM/YYYY") & "','" & strCURYID & "'," & dblCURYRATE & "," & _
                                                    dblTOTALPEN & "," & dblTOTALUSD & ",'" & strDEBEHABER & "','" & strUSERID & "'"
 
 
    Set cmd = New ADODB.Command
    cmd.CommandText = strSQL

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

    Set cmd.ActiveConnection = con
    Set rs = cmd.Execute
        
    AgregaAlTemporal = rs!SECUENCIA
    
       
    ''GetObjectContext.SetComplete
    
    Exit Function
    
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 Function

Public Sub AgregaReferenciasAlTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                                        ByVal intSEQUENCE As Integer, ByVal strDOCSUMMARYTYPEID As String, ByVal strNBRDOCSUMMARY As String, Optional VarAux As Variant)
        
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strSQL As String

    On Error GoTo TrataError
 
    strSQL = " EXEC TMP_OP_NBRDOCSUMMARYInsProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & _
                                                   intSEQUENCE & ",'" & strDOCSUMMARYTYPEID & "','" & strNBRDOCSUMMARY & "'"
 
    Set cmd = New ADODB.Command
    cmd.CommandText = strSQL

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

    Set cmd.ActiveConnection = con
    Set rs = cmd.Execute
    
       
    ''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.AgregaReferenciasAlTemporal", Err.Description

End Sub

Public Function ListarTipos_Doc(Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT DOCSUMMARYTYPEID,DESCRDOCSUMMARYTYPE FROM OP_DOCSUMMARYTYPE"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ListarTipos_Doc = 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.ListarTipos_Doc", Err.Description

End Function

Public Function ListarDepositos(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 SITEID as Almacen,BATNBRDEPOSITSITE as Deposito,DATEPROCE as Fech_Proc,TotalPEN,TotalUSD,CASE STATUS " & _
                 " WHEN 1 THEN 'CERRADO' WHEN 0 THEN 'NO CERRADO' END AS Estado " & _
                 " FROM OP_DEPOSITSITE " & _
                 " WHERE DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "'"
    Else
        
        strSQL = " SELECT SITEID as Almacen,BATNBRDEPOSITSITE as Deposito,DATEPROCE as Fech_Proc,TotalPEN,TotalUSD,CASE STATUS " & _
                 " WHEN 1 THEN 'CERRADO' WHEN 0 THEN 'NO CERRADO' END AS Estado " & _
                 " FROM OP_DEPOSITSITE " & _
                 " WHERE DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND SITEID='" & strSITEID & "'"
        
    End If


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

End Function

Public Function ListarNumerosPhantom(ByVal strCUSTIDSS As String, ByVal bytFLAG As Byte, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    If bytFLAG = 0 Then ' SOLO NUMEROS NO SELECCIONADOS
    strSQL = " SELECT DOCSUMMARYTYPEID,NBRDOCSUMMARY " & _
             " FROM OP_DOCSUMMARY " & _
             " WHERE DOCSUMMARYTYPEID='01' AND custidss='" & strCUSTIDSS & "' AND NBRDOCSUMMARY NOT IN (SELECT NBRDOCSUMMARY FROM OP_NBRDOCSUMMARY) "
    Else ' TODOS LOS NUMEROS
    strSQL = " SELECT DOCSUMMARYTYPEID,NBRDOCSUMMARY " & _
             " FROM OP_DOCSUMMARY " & _
             " WHERE DOCSUMMARYTYPEID='01' AND custidss='" & strCUSTIDSS & "'"
    End If
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    Set ListarNumerosPhantom = 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.ListarNumerosPhantom", Err.Description

End Function

Public Sub EliminaEnTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                             ByVal intSEQUENCE As Integer, Optional VarAux As Variant)
                             
    Dim cmd As Command
    Dim con As Connection
    Dim strSQL As String

    On Error GoTo TrataError
    
    strSQL = " EXEC TMP_OP_DEPOSITSITEDETDelProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & _
                                                    intSEQUENCE
                                
    Set cmd = New Command
    cmd.CommandText = strSQL
      
    Set con = New 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.EliminaEnTemporal", Err.Description
End Sub

Public Function ExisteRegistro(ByVal strSITEID As String, ByVal datDATEPROCE As Date, Optional VarAux As Variant) As Long

    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    ExisteRegistro = 0
    
    strSQL = " SELECT *  FROM OP_DEPOSITSITE " & _
             " 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
        ExisteRegistro = rs!BATNBRDEPOSITSITE
    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 ObtieneTipoCambio(ByVal datDATEPROCE As Date, ByVal strMONEDA As String, Optional VarAux As Variant) As Double
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT RATE AS RATE FROM CURYRATE WHERE CURYDATE=(SELECT MAX(CURYDATE) FROM CURYRATE WHERE CURYTYPEID=(SELECT CURYTYPEIDSALES FROM SETUP)) AND FROMCURYID='" & strMONEDA & "' AND CURYTYPEID=(SELECT CURYTYPEIDSALES FROM SETUP) "
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    If Not rs.EOF Then
        ObtieneTipoCambio = rs!Rate
    Else
        ObtieneTipoCambio = 0
    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_MA_MANTENIMIENTOS.ObtieneTipoCambio", Err.Description

End Function

Public Sub CopiarOriginalAlTemporal(ByVal lngBATNBRDEPOSITSITE As Long, ByVal strSITEID 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_OP_DEPOSITSITEDET_AlTemporalProc " & lngBATNBRDEPOSITSITE & ",'" & strSITEID & "'," & 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 Function ObtieneTotales(ByVal lngCORRNBR As Long, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SUM(TOTALPEN) AS TOTPEN,SUM(TOTALUSD) AS TOTUSD FROM TMP_OP_DEPOSITSITEDET " & _
             " WHERE CORRNBR=" & lngCORRNBR
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
     Set ObtieneTotales = 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.ObtieneTotales", Err.Description

End Function

Public Function ObtieneTotales2(ByVal strSITEID As String, ByVal lngBATNBRDEPOSITSITE As Long, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SUM(TOTALPEN) AS TOTPEN,SUM(TOTALUSD) AS TOTUSD FROM TMP_OP_DEPOSITSITEDET " & _
             " WHERE SITEID='" & strSITEID & "' AND BATNBRDEPOSITSITE=" & lngBATNBRDEPOSITSITE
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
     Set ObtieneTotales2 = 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.ObtieneTotales2", Err.Description

End Function
Public Sub ModificarDeposito(ByVal lngBATNBRDEPOSITSITE As Long, ByVal strSITEID As String, ByVal dblTOTALPEN As Double, _
                             ByVal dblTOTALUSD As Double, 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 Copiar_Temporal_A_OP_DEPOSITSITEDETProc " & lngBATNBRDEPOSITSITE & ",'" & strSITEID & "'," & dblTOTALPEN & "," & dblTOTALUSD & "," & 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.ModificarDeposito", LStrMensajeError
     
End Sub

Public Function SeleccionaEnCabecera(ByVal strSITEID As String, ByVal lngBATNBRDEPOSITSITE As Long, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT * " & _
             " FROM OP_DEPOSITSITE WHERE SITEID='" & strSITEID & "' AND BATNBRDEPOSITSITE=" & lngBATNBRDEPOSITSITE
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    Set SeleccionaEnCabecera = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_INV_MOVIMIENTOS.SeleccionaEnCabecera", Err.Description

End Function

Public Function ObtieneDescrCliente(ByVal strCUSTIDSS As String, Optional VarAux As Variant) As String
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT CUSTNAME FROM CUSTOMER WHERE CUSTIDSS='" & strCUSTIDSS & "'"
             
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    ObtieneDescrCliente = rs!CUSTNAME
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_INV_MOVIMIENTOS.ObtieneDescrCliente", Err.Description

End Function

Public Function SeleccionaEnDetalle(ByVal strSITEID As String, ByVal lngBATNBRDEPOSITSITE As Long, Optional VarAux As Variant) As ADODB.Recordset
    
    Dim strSQL As String
    Dim strVENDIDSS As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
       
    strSQL = " SELECT SEQUENCE AS Item,DEPOSITPASSWORD as Clave,DATEDEPOSIT as Fecha,CURYID as Moneda," & _
             " TOTALPEN As Monto_PEN, TOTALUSD As Monto_USD,CUSTIDSS AS Cliente" & _
             " FROM OP_DEPOSITSITEDET " & _
             " WHERE SITEID='" & strSITEID & "' AND BATNBRDEPOSITSITE=" & lngBATNBRDEPOSITSITE
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
    
    Set SeleccionaEnDetalle = rs
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

    'GetObjectContext.SetAbort
    
    Err.Raise Err.Number, "DB_INV_MOVIMIENTOS.SeleccionaEnDetalle", Err.Description

End Function

Public Function SeleccionaEnTemporal(ByVal lngCORRNBR As Long, Optional VarAux As Variant) As ADODB.Recordset
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SEQUENCE AS Item,DEPOSITPASSWORD as Clave,DATEDEPOSIT as Fecha,CURYID as Moneda," & _
             " TOTALPEN As Monto_PEN, TOTALUSD As Monto_USD,CUSTIDSS AS Cliente" & _
             " FROM TMP_OP_DEPOSITSITEDET " & _
             " WHERE CORRNBR=" & lngCORRNBR
    
    Set rs = New 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 SeleccionaEnTemporalDeReferencias(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal intSEQUENCE As Integer, Optional VarAux As Variant) As ADODB.Recordset
    
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT NBRDOCSUMMARY " & _
             " FROM TMP_OP_NBRDOCSUMMARY " & _
             " WHERE CORRNBR=" & lngCORRNBR & " AND SITEID='" & strSITEID & "' AND SEQUENCE=" & intSEQUENCE
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnTemporalDeReferencias = 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.SeleccionaEnTemporalDeReferencias", Err.Description

End Function

Public Function Auxiliar1(Optional ByVal VarAux1 As Variant, Optional ByVal VarAux2 As Variant) As Variant
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT USER1 FROM OP_SETUP "
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Auxiliar1 = rs!USER1
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    '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
    Dim cmd As Command
    Dim con As Connection
    Dim strSQL As String

    On Error GoTo TrataError
    
    strSQL = " OP_EliminarDepositos_Proc '" & VarAux1(1, 1) & "'," & VarAux1(1, 2) & ",'" & VarAux1(1, 3) & "'"
                                                    
                                
    Set cmd = New Command
    cmd.CommandText = strSQL
      
    Set con = New Connection
    con.Open "FILEDSN=conexionsies"
    cmd.ActiveConnection = con
    cmd.Execute
    
    ''GetObjectContext.SetComplete
    
    Exit Function
    
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_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



