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_CTRLFUEL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' C_CTRLFUEL
' los nombres de procedimientos o funciones que terminan en 2 se
' utilizan para Stock-Combustible, los otros para Precio-Combustible
' opciones que se encuentran dentrl del menú


Public Sub ActualizaTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                             ByVal strINVTIDSKU As String, ByVal dblSLS_PRICE As Double, ByVal dblSLS_PRICENEW As Double, _
                             ByVal dblQTYSALES As Double, ByVal dblTOTAL 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_CTRLFUELPRICEUpdProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    strINVTIDSKU & "'," & dblSLS_PRICE & "," & dblSLS_PRICENEW & "," & dblQTYSALES & "," & _
                                                    dblTOTAL
                                
    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_OP_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 dblSTOCKINITIAL As Double, ByVal dblQTYIMPUT As Double, _
                                ByVal dblQTYOUTPUT As Double, ByVal dblQTYSALES As Double, ByVal dblQTYAVAIL As Double, _
                                ByVal strSTKUINITID As String, ByVal dblVALUEUNIMED As Double, ByVal dblQTYPHISICAL As Double, _
                                ByVal dblQTYDIFFERENCE As Double, ByVal dblPORCENTDIFERENCE As Double, ByVal strREMARK As String, 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_CTRLFUELDETUpdProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    strINVTIDSKU & "'," & dblSTOCKINITIAL & "," & dblQTYIMPUT & "," & _
                                                    dblQTYOUTPUT & "," & dblQTYSALES & "," & dblQTYAVAIL & ",'" & _
                                                    strSTKUINITID & "'," & dblVALUEUNIMED & "," & dblQTYPHISICAL & "," & _
                                                    dblQTYDIFFERENCE & "," & dblPORCENTDIFERENCE & ",'" & strREMARK & "'"
                                
    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_OP_MANTENIMIENTOS.ActualizaTemporal2", Err.Description

End Sub

Public Sub ActualizaRegistro(ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                             ByVal strINVTIDSKU As String, ByVal dblSLS_PRICE As Double, _
                             ByVal dblSLS_PRICENEW As Double, ByVal dblQTYSALES As Double, ByVal strUSERID As String, Optional VarAux As Variant)
   
    Dim cmd As ADODB.Command
    Dim con As ADODB.Connection
    Dim strSQL As String

    On Error GoTo TrataError
    
    strSQL = " EXEC OP_CTRLFUELPRICEUpdProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    strINVTIDSKU & "'," & dblSLS_PRICE & "," & dblSLS_PRICENEW & "," & dblQTYSALES & ",'" & strUSERID & "'"
                                
    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_OP_MANTENIMIENTOS.ActualizaRegistro", Err.Description
End Sub

Public Sub AgregarCtrlFuel2(ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                            ByVal strUSERID As String, 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 GrabarCabCtrlFuelProc '" & strSITEID & "','" & Format(datDATEPROCE, "YYYY/DD/MM") & "','" & _
                                                strUSERID & "'," & 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_OP_MANTENIMIENTOS.AgregarCtrlFuel2", LStrMensajeError
     
End Sub

Public Sub AgregaAlTemporal(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 TMP_OP_CTRLFUELPRICEInsProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
    
    
    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_OP_MANTENIMIENTOS.AgregaAlTemporal", Err.Description

End Sub

Public Function VentasCombustible(ByVal lngCORRNBR As Long, 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 = " EXEC VENTASCOMBUSTIBLE_PROC '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
    
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set VentasCombustible = 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.VentasCombustible", Err.Description

End Function

Public Sub AgregaAlTemporalAutomatico(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 TMP_OP_CTRLFUELPRICEInsProcAutomatico " & lngCORRNBR & ",'" & strSITEID & "','" & datDATEPROCE & "'"
    
    
    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_OP_MANTENIMIENTOS.AgregaAlTemporalAutomatico", 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_CTRLFUELDET_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_OP_MANTENIMIENTOS.AgregaAlTemporal2", Err.Description

End Sub

Public Sub AgregaRegistros(ByVal lngCORRNBR As Long, ByVal strUSERID As String, ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal bytSERAFIN As Byte, Optional VarAux As Variant)
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC OP_CTRLFUELPRICEInsProc " & lngCORRNBR & ",'" & strUSERID & "','" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & bytSERAFIN
    
    
    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_OP_MANTENIMIENTOS.AgregaRegistros", LStrMensajeError

End Sub

Public Sub INSERTA_AJUSTES(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, ByVal bytSERAFIN As Byte, Optional VarAux As Variant)
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC TMP_OBTIENE_AJUSTES_Proc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'," & bytSERAFIN
    
    
    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_OP_MANTENIMIENTOS.OBTIENE_AJUSTES", LStrMensajeError

End Sub

Public Sub AgregaItemAlTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                                ByVal strINVTIDSKU As String, ByVal dblSLS_PRICE As Double, ByVal dblQTYSALES As Double, ByVal dblTOTAL As Double, Optional VarAux As Variant)
        
    Dim strSQL As String
    Dim con As ADODB.Connection
    
    On Error GoTo TrataError
    
    strSQL = " EXEC TMP_OP_CTRLFUELPRICEITEMInsProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    strINVTIDSKU & "'," & dblSLS_PRICE & "," & dblQTYSALES & "," & dblTOTAL
    
    
    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.AgregaItemAlTemporal", Err.Description

End Sub

Public Sub CopiarOriginalAlTemporal(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_OP_CTRLFUELPRICE_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_OP_MANTENIMIENTOS.CopiarOriginalAlTemporal", Err.Description

End Sub

Public Sub EliminarControlCombustible(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 EliminarControlCombustibleProc '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
    
    
    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.EliminarControlCombustible", 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_OP_CTRLFUEL_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_OP_MANTENIMIENTOS.CopiarOriginalAlTemporal2", Err.Description

End Sub

Public Sub EliminaEnTemporal(ByVal lngCORRNBR As Long, ByVal strSITEID As String, ByVal datDATEPROCE As Date, _
                             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_OP_CTRLFUELPRICEDelProc " & lngCORRNBR & ",'" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "','" & _
                                                    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_OP_MANTENIMIENTOS.EliminaEnTemporal", Err.Description
End Sub

Public Function ValidaEliminacion(ByVal strINVTIDSKU As String, Optional VarAux As Variant) As Boolean
   
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    ValidaEliminacion = False
    
    strSQL = " SELECT I.USER8 FROM IN_INVENTORYADJ AS A JOIN IN_INVENTORY AS I ON A.INVTIDSKU=I.INVTIDSKU WHERE A.INVTIDSKU='" & strINVTIDSKU & "'"

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
            
    If rs!user8 = 1 Then
        ValidaEliminacion = 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.ListarCtrlFuel", Err.Description

End Function

Public Function ObtieneDiferenciaGalonaje(ByVal strSITEID As String, ByVal datDATEPROCE As Date, Optional VarAux As Variant) As Double
   
    Dim strSQL As String
    Dim con As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    ObtieneDiferenciaGalonaje = 0
    
    strSQL = " EXEC COMPARA_GALONESVENDIDOS_PROC '" & strSITEID & "','" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
                                
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"

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

    ''GetObjectContext.SetComplete
    
    Exit Function
    
TrataError:
    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_MANTENIMIENTOS.ObtieneDiferenciaGalonaje", Err.Description

End Function

Public Function ListarCtrlFuel(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 A.SITEID as Almacen,A.DATEPROCE as Fech_Proce,A.INVTIDSKU as Codigo,I.DESCR as Descripcion,A.SLS_PRICE as Precio,A.QTY as Cantidad, CASE A.STATUS " & _
                 " WHEN 1 THEN 'CERRADO' WHEN 0 THEN 'NO CERRADO' END AS Estado " & _
                 " FROM OP_CTRLFUELPRICE AS A JOIN IN_INVENTORY AS I " & _
                 " ON A.INVTIDSKU=I.INVTIDSKU " & _
                 " WHERE A.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND A.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "'"
    Else
        
        strSQL = " SELECT A.SITEID as Almacen,A.DATEPROCE as Fech_Proce,A.INVTIDSKU as Codigo,I.DESCR as Descripcion,A.SLS_PRICE as Precio,A.QTY as Cantidad, CASE A.STATUS " & _
                 " WHEN 1 THEN 'CERRADO' WHEN 0 THEN 'NO CERRADO' END AS Estado " & _
                 " FROM OP_CTRLFUELPRICE AS A JOIN IN_INVENTORY AS I " & _
                 " ON A.INVTIDSKU=I.INVTIDSKU " & _
                 " WHERE A.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND A.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND A.SITEID='" & strSITEID & "'"
        
    End If


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

End Function

Public Function ListarCtrlFuel2(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 C.SITEID AS Almacen,C.DATEPROCE as Fech_Proce,C.INVTIDSKU as Cod,I.DESCR AS Descripcion,C.QTYAVAIL AS Teorico,C.QTYPHISICAL as Fisico,C.QTYDIFFERENCE as Diferencia " & _
                 " FROM OP_CTRLFUELDET as C JOIN IN_INVENTORY as I " & _
                 " ON C.INVTIDSKU=I.INVTIDSKU " & _
                 " WHERE C.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND C.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "'"
    Else
        
        strSQL = " SELECT C.SITEID AS Almacen,C.DATEPROCE as Fech_Proce,C.INVTIDSKU as Cod,I.DESCR AS Descripcion,C.QTYAVAIL AS Teorico,C.QTYPHISICAL as Fisico,C.QTYDIFFERENCE as Diferencia " & _
                 " FROM OP_CTRLFUELDET as C JOIN IN_INVENTORY as I " & _
                 " ON C.INVTIDSKU=I.INVTIDSKU " & _
                 " WHERE C.DATEPROCE>='" & Format(datFECHAINI, "DD/MM/YYYY") & "' AND C.DATEPROCE<='" & Format(datFECHAFIN, "DD/MM/YYYY") & "' AND C.SITEID='" & strSITEID & "'"
        
    End If


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

End Function

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

    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_OP_MANTENIMIENTOS.Registros", 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 OP_CTRLFUELALLUpdProc '" & 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_OP_MANTENIMIENTOS.Registros2", LStrMensajeError
     
End Sub

Public Function SeleccionaEnCabecera2(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 * " & _
             " FROM OP_CTRLFUEL WHERE SITEID='" & strSITEID & "' AND DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
        
    Set SeleccionaEnCabecera2 = 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.SeleccionaEnCabecera2", Err.Description

End Function

Public Function SeleccionaEnDetalle2(ByVal strSITEID As String, ByVal datDATEPROCE As Date, 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 T.INVTIDSKU AS Cod,I.DESCR as Descripcion,T.STOCKINITIAL as Inicial,T.QTYIMPUT as Ingreso,T.QTYOUTPUT as Salida," & _
             " T.QTYSALES as Venta,T.QTYAVAIL as Teorico,T.STKUINITID as Medida," & _
             " T.VALUEUNIMED as Valor,T.QTYPHISICAL as Fisico,T.QTYDIFFERENCE as Diferencia,T.PORCENTDIFERENCE as Porc_Dif, T.REMARK AS Observacion " & _
             " FROM OP_CTRLFUELDET AS T JOIN IN_INVENTORY AS I " & _
             " ON T.INVTIDSKU=I.INVTIDSKU " & _
             " WHERE T.SITEID='" & strSITEID & "' AND T.DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
    
    Set SeleccionaEnDetalle2 = 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.SeleccionaEnDetalle2", Err.Description

End Function

Public Function RegistroCerrado(ByVal strSITEID As String, ByVal datDATEPROCE As Date, Optional VarAux As Variant) As Boolean
    
    Dim strSQL As String
    Dim strVENDIDSS As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
       
    strSQL = " SELECT SITEID " & _
             " FROM OP_CTRLFUELPRICE " & _
             " WHERE SITEID='" & strSITEID & "' AND DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "' AND STATUS=1 "
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenStatic
    
    If rs.RecordCount = 0 Then
        RegistroCerrado = False
    Else
        RegistroCerrado = 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.RegistroCerrado", Err.Description

End Function

Public Function SeleccionaEnTemporal(ByVal lngCORRNBR As Long, 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 SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCR AS Descripcion,QTYSALES as Gal_Vendidos,SLS_PRICE as Precio_Gal," & _
             " TOTAL As Monto " & _
             " FROM TMP_OP_CTRLFUELPRICE AS T JOIN IN_INVENTORY AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKU " & _
             " 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_OP_MANTENIMIENTOS.SeleccionaEnTemporal", Err.Description

End Function

Public Function SeleccionaCombustibles(ByVal intValor, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT A.INVTIDSKU,I.DESCR FROM IN_INVENTORYADJ AS A JOIN IN_INVENTORY AS I ON A.INVTIDSKU=I.INVTIDSKU "
    
    If intValor = 1 Then
          strSQL = strSQL & " WHERE I.USER8=1 "
    End If
             
        
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaCombustibles = 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.SeleccionaCombustibles", Err.Description

End Function

Public Function SeleccionaEnTemporalAutomatico(ByVal lngCORRNBR As Long, 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 SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCR AS Descripcion," & _
             " QTYSALES as Gal_Vendidos,SLS_PRICE as Precio_Gal," & _
             " TOTAL As Monto " & _
             " FROM TMP_OP_CTRLFUELPRICE AS T JOIN IN_INVENTORY AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKU " & _
             " WHERE CORRNBR=" & lngCORRNBR
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient0
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaEnTemporalAutomatico = 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.SeleccionaEnTemporal", Err.Description

End Function

Public Function SeleccionaEnTemporal2(ByVal lngCORRNBR As Long, 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.STOCKINITIAL as Inicial,T.QTYIMPUT as Ingreso,T.QTYOUTPUT as Salida," & _
             " T.QTYSALES as Venta,T.QTYAVAIL as Teorico,T.STKUINITID as Medida," & _
             " T.VALUEUNIMED as Valor,T.QTYPHISICAL as Fisico,T.QTYDIFFERENCE as Diferencia,T.PORCENTDIFERENCE as Porc_Dif, T.REMARK AS Observacion " & _
             " FROM TMP_OP_CTRLFUELDET AS T JOIN IN_INVENTORY AS I " & _
             " ON T.INVTIDSKU=I.INVTIDSKU " & _
             " WHERE CORRNBR=" & lngCORRNBR
    
    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_OP_MANTENIMIENTOS.SeleccionaEnTemporal2", Err.Description

End Function
Public Function SeleccionaRegistros(ByVal strSITEID As String, ByVal datFecha As Date, 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 SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCR AS Descripcion,QTY as Gal_Vendidos,SLS_PRICE as Precio_Gal," & _
             " TOTALPEN As Monto " & _
             " FROM OP_CTRLFUELPRICE AS T JOIN IN_INVENTORY AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKU " & _
             " WHERE T.SITEID='" & strSITEID & "' AND  T.DATEPROCE='" & Format(datFecha, "DD/MM/YYYY") & "'"
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaRegistros = 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.SeleccionaRegistros", Err.Description

End Function

Public Function SeleccionaAjustesTmp(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 SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCRIPTION AS Descripcion,QTY as Gal_Vendidos,0 as Precio_Gal," & _
             " TOTALPENSALESADJUST As Monto " & _
             " FROM TMP_OP_CTRLFUELPRICESALESADJUST AS T JOIN IN_INVENTORYADJ AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKUADJ " & _
             " WHERE CORRNBR=" & lngCORRNBR
    
        
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaAjustesTmp = 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.SeleccionaAjustesTmp", Err.Description

End Function

Public Function SeleccionaVentas(ByVal strSITEID As String, ByVal datFecha As Date, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCR AS Descripcion,QTYSALES as Gal_Vendidos,SLS_PRICESALES as Precio_Gal," & _
             " TOTALPENSALES As Monto " & _
             " FROM OP_CTRLFUELPRICESALES AS T JOIN IN_INVENTORY AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKU " & _
             " WHERE T.SITEID='" & strSITEID & "' AND T.DATEPROCE='" & Format(datFecha, "DD/MM/YYYY") & "'"
    
        
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaVentas = 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.SeleccionaVentas", Err.Description

End Function

Public Function SeleccionaAjustes(ByVal strSITEID As String, ByVal datFecha As Date, Optional VarAux As Variant) As ADODB.Recordset
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCRIPTION AS Descripcion,QTY as Gal_Vendidos,0 as Precio_Gal," & _
             " TOTALPENSALESADJUST As Monto " & _
             " FROM OP_CTRLFUELPRICESALESADJUST AS T JOIN IN_INVENTORYADJ AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKUADJ " & _
             " WHERE T.SITEID='" & strSITEID & "' AND T.DATEPROCE='" & Format(datFecha, "DD/MM/YYYY") & "'"
    
        
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaAjustes = 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.SeleccionaAjustes", Err.Description

End Function

Public Function AjusteSerafin(ByVal strSITEID As String, ByVal datFecha As Date, Optional VarAux As Variant) As Byte
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    
    On Error GoTo TrataError
    
    strSQL = " SELECT SERAFIN FROM OP_CTRLFUELPRICESALESADJUST AS T" & _
             " WHERE T.SITEID='" & strSITEID & "' AND T.DATEPROCE='" & Format(datFecha, "DD/MM/YYYY") & "'"
    
        
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    If rs.RecordCount = 0 Then
        AjusteSerafin = 0
    Else
        AjusteSerafin = IIf(rs!SERAFIN, 1, 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_OP_MANTENIMIENTOS.AjusteSerafin", Err.Description

End Function
Public Function SeleccionaRegistrosVenta(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 SITEID AS Almacen,T.INVTIDSKU as Codigo,A.DESCR AS Descripcion,QTYSALES as Gal_Vendidos,SLS_PRICESALES as Precio_Gal," & _
             " TOTALPENSALES As Monto " & _
             " FROM OP_CTRLFUELPRICESALES AS T JOIN IN_INVENTORY AS A " & _
             " ON T.INVTIDSKU=A.INVTIDSKU " & _
             " WHERE T.SITEID='" & strSITEID & "' AND  T.DATEPROCE='" & Format(datDATEPROCE, "DD/MM/YYYY") & "'"
    
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSQL, "FILEDSN=conexionsies", adOpenUnspecified, adLockUnspecified, adCmdUnspecified
        
    Set SeleccionaRegistrosVenta = 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.SeleccionaRegistrosVenta", 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

