Attribute VB_Name = "Module1"
Public Function ListarTransacPendientesDetTemp(ByVal MDblCorrelativo As Double, ByVal MStrProductoSKU As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim StrSql As String
   Dim rs As ADODB.Recordset
   Dim cmd As ADODB.Recordset

   On Error GoTo errhandler
   
   StrSql = " select SEQUENCE " & _
            " from TMP_OP_SALESDET where CORRNBR='" & MDblCorrelativo & "' and INVTIDSKU='" & MStrProductoSKU & "'"
   
   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open StrSql, "FILEDSN=conexionsies", adOpenStatic
                
   Set ListarTransacPendientesDetTemp = rs
      
   'GetObjectContext.SetComplete
   Exit Function
errhandler:
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If

   GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_OP_FACTURACION.ListarTransacPendientesDetTemp", Err.Description
End Function




Public Function ActualizarRegistroCreditoTemporal(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, _
                                                    ByVal IntSecuencia As Integer, ByVal DBlPorcentajeIgv As Double, _
                                                    ByVal DBlPorcentajeISC As Double, ByVal DblTotalBase As Double, ByVal DblTotalExt As Double, _
                                                    ByVal MontoImpuestoBase As Double, ByVal MontoImpuestoExt As Double, _
                                                    ByVal DESCI As Integer, ByVal DESCD As Integer, DESCIDP As Integer, _
                                                    ByVal DISCMTOPEN As Double, ByVal DISCMTOUSD As Double, ByVal DISCMTOPENd As Double, ByVal DISCMTOUSDd As Double, ByVal DISCDSCTO1 As Double, Optional VarAux As Variant)
                                                    
Dim cmd As ADODB.Command
Dim con As ADODB.Connection
Dim ERROR As ADODB.ERROR

On Error GoTo ErrorHandler
 
Set cmd = New ADODB.Command

cmd.CommandText = " Op_ActualizarCreditoTempProc " & DblCorrelativo & ",'" & StrCodigoArticulo & "'," & _
                                                                IntSecuencia & "," & DBlPorcentajeIgv & "," & _
                                                                DBlPorcentajeISC & "," & DblTotalBase & "," & DblTotalExt & "," & _
                                                                MontoImpuestoBase & "," & MontoImpuestoExt & "," & _
                                                                DESCI & "," & DESCD & "," & DESCIDP & "," & DISCMTOPEN & "," & DISCMTOUSD & "," & DISCMTOPENd & "," & DISCMTOUSDd & "," & DISCDSCTO1 & ""



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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Function
    
ErrorHandler:

Dim LStrMensajeError As String
Dim LVarNumeroError As Variant
    
    If Not cmd Is Nothing Then
        Set cmd = 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_FACTURACION.ActualizarRegistroCreditoTemporal", LStrMensajeError

End Function




