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_IMPRIMEVIÑETAS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Public Function CargaTablaListaImpresion(Optional ByVal impTodos As Integer, _
                                    Optional ByVal codArticulo As String) As Boolean
On Error GoTo TrataError

'Permite registrar en la tabla OP_VIÑETAS LOS ARTICULOS que imprimira sus viñetas
    Dim con As ADODB.Connection
    Dim strSQL As String
    
    On Error GoTo TrataError
    
    'GneraCodgoBarraViñeta()
    strSQL = " EXEC IN_IMPRIMEVIÑETAS " & impTodos & ",'" & codArticulo & "'"
    
    Set con = New ADODB.Connection
    con.Open "FILEDSN=conexionsies"
    con.Execute strSQL
    
    CargaTablaListaImpresion = True
    'GetObjectContext.SetComplete
    
    Exit Function

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
     CargaTablaListaImpresion = False
     ''GetObjectContext.SetAbort
     
     Err.Raise LVarNumeroError, "DB_INV_MANTENIMIENTOS.CargaTablaListaImpresion", LStrMensajeError

End Function


Public Function GneraCodgoBarraViñeta(ByVal codArticulo As String) As String
''Permite formatear el codigo del articulo para convertirlo en codigo de barra para viñeta IMPRIMIBLE
'On Error GoTo Error
'Dim nCarctersCodArticulo As Integer
'Dim nuevCodgoBrrasViñetas As String
'
'nCarctersCodArticulo = Len(codArticulo)
'
'Select Case nCarctersCodArticulo
'    Case 13         'EAN - 13
'        nuevCodgoBrrasViñetas = Left(codArticulo, nCarctersCodArticulo - 1)
'    Case 8          'EAN - 8
'        nuevCodgoBrrasViñetas = Left(codArticulo, nCarctersCodArticulo - 1)
'    Case 12         'UPC - A
'        nuevCodgoBrrasViñetas = Left(codArticulo, nCarctersCodArticulo - 1)
'    Case 8          'UPC - E
'        nuevCodgoBrrasViñetas = Mid(codArticulo, 2, nCarctersCodArticulo - 1)
'    Case 3 To 5     'CODE 39
'        nuevCodgoBrrasViñetas = codArticulo
'End Select
'
'GneraCodgoBarraViñeta = nuevCodgoBrrasViñetas
'
'Exit Function
'
'Error:
'      MsgBox "Error Nº: " & CStr(Err.Number) & Chr(13) & _
'             "Descripcion: " & Err.Description, vbInformation, "Ha ocurrido un error"

End Function


