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_ARTICULO"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'Modificado el 27/08/2003

'Enrique Franco
'Clase C_Articulo
'Funciones Básicas del Maestro de Artículos
'Propiedades :
'             AgregarArtículo
'             EliminarArtículo
'             ActualizarArtículo
'             ListarArtículo

'****************************************************************************************************
'Funcionalidad : Muestra los Datos Grabados en IN_SOLINVENTORY
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : Conjunto de Registros
'****************************************************************************************************

Public Function MostrarDetalleIN_SOLINVENTORY(ByVal StrCodigoArticulo As String, Optional VarAux As Variant)
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = "IN_MostrarDetalleIN_SOLINVENTORYProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set MostrarDetalleIN_SOLINVENTORY = rs

   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:

   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleIN_SOLINVENTORY", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad : Muestra los Datos Grabados en IN_INVENTORYDES/DESENSAMBLE
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : Conjunto de Registros
'****************************************************************************************************
Public Function MostrarDetalleIN_INVENTORYDES(ByVal StrCodigoArticulo As String, Optional VarAux As Variant)

   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler


   strSql = " IN_MostrarDetalleIN_INVENTORYDESProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set MostrarDetalleIN_INVENTORYDES = rs

   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If

   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleIN_INVENTORYDES", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad : Muestra la descripción del Artículo
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : la descripción del Artículo
'****************************************************************************************************

Public Function ObtenerDescripcion(ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As String

 Dim strSql As String
 Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler


   strSql = "IN_ObtenerDescripcionaInventoryProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   If Not rs.EOF Then
     ObtenerDescripcion = rs!descr
   Else
     ObtenerDescripcion = Empty
   End If

   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:

   If Not rs Is Nothing Then
      Set rs = Nothing
   End If

   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.ObtenerDescripcion", Err.Description


End Function

'****************************************************************************************************
'Funcionalidad : Muestra los Datos Grabados en Inventory_dat
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : Conjunto de Registros
'****************************************************************************************************

Public Function MostrarDetalleIN_INVENTORYALTER(ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler


   strSql = "IN_MostrarDetalleIN_INVENTORYALTERProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies", adOpenStatic

   Set MostrarDetalleIN_INVENTORYALTER = rs

   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If

   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleIN_INVENTORYALTER", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad : Muestra los Datos Grabados en IN_VENDORINVT
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : Conjunto de Registros
'****************************************************************************************************

Public Function MostrarDetalleTEMPINVENTORYVENDORINVT(ByVal StrCodigoArticulo As String, _
                                                      ByVal DblCorrelativo As Double, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

    strSql = "IN_MostrarDetalleTEMPINVENTORYVENDORINVTProc '" & StrCodigoArticulo & "'," & DblCorrelativo


    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSql, "FILEDSN=" & "conexionsies"
    Set MostrarDetalleTEMPINVENTORYVENDORINVT = rs

    'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If

    'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleTEMPINVENTORYVENDORINVT", Err.Description


End Function

'****************************************************************************************************
'Funcionalidad : Muestra los Datos Grabados en IN_VENDORINVT
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : Conjunto de Registros
'****************************************************************************************************

Public Function MostrarDetalleIN_INVENTORYVENDORINVT(ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

    strSql = " IN_MostrarDetalleIN_INVENTORYVENDORINVTProc '" & StrCodigoArticulo & "'"


    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open strSql, "FILEDSN=" & "conexionsies"
    Set MostrarDetalleIN_INVENTORYVENDORINVT = rs

    'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If

   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleIN_INVENTORYVENDORINVT", Err.Description


End Function

'****************************************************************************************************
'Funcionalidad : Muestra los Datos Grabados en Inventory_dat
'Parametros de Entrada : El código del Artículo
'Parametros de Retorno : Conjunto de Registros
'****************************************************************************************************

Public Function MostrarDetalleInventoryDat(ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler


   strSql = "IN_MostrarDetalleInventoryDatProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=conexionsies", adOpenStatic

   Set MostrarDetalleInventoryDat = rs
   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleInventoryDat", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad :         Selecciona los Datos del Temporal TMP_InventoryDat
'Parametros de Entrada : El código del Artículo , y el identificador
'                        asignado a la transaccion
'****************************************************************************************************

Public Function MostrarDetalleTempInventoryDat(ByVal StrCodigoArticulo As String, _
                                               ByVal DblCorrelativo As Double, Optional VarAux As Variant) As ADODB.Recordset


Dim strSql As String
Dim cmd As ADODB.Command
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

On Error GoTo ErrorHandler

Set rs = New ADODB.Recordset

rs.CursorLocation = adUseClient
Set cmd = New ADODB.Command

strSql = "IN_MostrarDetalleTempInventoryDatProc '" & StrCodigoArticulo & "'," & DblCorrelativo

rs.Open strSql, "Filedsn=conexionsies"

Set MostrarDetalleTempInventoryDat = rs

'GetObjectContext.SetComplete

Exit Function

ErrorHandler:
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not con Is Nothing Then
        Set con = Nothing
     End If
     If Not rs Is Nothing Then
        Set rs = Nothing
     End If

     'GetObjectContext.SetAbort

     Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleTempInventoryDatt", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad :         Selecciona los Datos del Temporal TMP_InventoryAlter
'Parametros de Entrada : El código del Artículo , y el identificador
'                        asignado a la transaccion
'****************************************************************************************************

Public Function MostrarDetalleTempInventoryAlter(ByVal StrCodigoArticulo As String, _
                                                 ByVal DblCorrelativo As Double, Optional VarAux As Variant) As ADODB.Recordset

Dim cmd As ADODB.Command
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

On Error GoTo ErrorHandler

Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command

strSql = " IN_MostrarDetalleTempInventoryAlterProc '" & StrCodigoArticulo & "'," & DblCorrelativo
rs.CursorLocation = adUseClient
rs.Open strSql, "Filedsn=conexionsies", adOpenStatic

Set MostrarDetalleTempInventoryAlter = rs

'GetObjectContext.SetComplete

Exit Function

ErrorHandler:
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not con Is Nothing Then
        Set con = Nothing
     End If
     If Not rs Is Nothing Then
        Set rs = Nothing
     End If
     'GetObjectContext.SetAbort

     Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleTempInventoryAlter", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad : Pasa los Datos de IN_INVENTORYALTER a TEMP_IN_INVENTORYALTER
'Parametros de Entrada : El código del Artículo , y el identificador
'                        asignado a la transaccion
'****************************************************************************************************

Public Sub CargaInventoryAlteraTemp(ByVal StrCodigoArticulo As String, _
                                    ByVal DblCorrelativo As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection


On Error GoTo ErrorHandler


Set cmd = New ADODB.Command

cmd.CommandText = "IN_CargaInventoryAlterDataTempProc " & DblCorrelativo & ",'" & StrCodigoArticulo & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete

Exit Sub

ErrorHandler:
     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_INV_ARTICULO.CargaInventoryAlteraTemp", Err.Description
End Sub

'****************************************************************************************************
'Funcionalidad : Pasa los Datos de IN_INVENDORINVT a TEMP_IN_INVENDORINVT
'Parametros de Entrada : El código del Artículo , y el identificador
'                        asiganado a la transaccion
'****************************************************************************************************

Public Sub CargaInventoryVendorInvaTemp(ByVal StrCodigoArticulo As String, _
                                        ByVal DblCorrelativo As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection


On Error GoTo ErrorHandler


Set cmd = New ADODB.Command

cmd.CommandText = "IN_CargaInventoryVendorInvTempProc " & DblCorrelativo & ",'" & StrCodigoArticulo & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.CargaInventoryVendorInvaTemp", Err.Description
End Sub

'****************************************************************************************************
'Funcionalidad : Pasa los Datos de IN_INVENTORYDAT a TEMP_IN_INVENTORYDAT
'Parametros de Entrada : El código del Artículo , y el identificador
'                        asiganado a la transaccion
'****************************************************************************************************

Public Sub CargaInventoryDataTemp(ByVal StrCodigoArticulo As String, _
                                  ByVal DblCorrelativo As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection


On Error GoTo ErrorHandler


Set cmd = New ADODB.Command

cmd.CommandText = "IN_CargaInventoryDataTempProc " & DblCorrelativo & ",'" & StrCodigoArticulo & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.CargaInventoryDataTemp", Err.Description
End Sub

'****************************************************************************************************
'Funcionalidad : Procedimiento que Invoca al procedimiento almacenado IN_INVENTORYInsProc,
'                el cual genera una transacción que graba conjuntamente los detalles
'****************************************************************************************************

Public Sub AgregarArticulo(ByVal StrCodigoArticulo As String, ByVal StrCodigoMarca As String, ByVal StrDescripcionArticulo As String, _
                           ByVal DblEquivalencia As Double, ByVal BytVentaPlaya As Byte, _
                           ByVal BytVentaTienda As Byte, ByVal BytVentaOtroTipo As Byte, _
                           ByVal BytInventariable As Byte, ByVal BytFormula As Byte, ByVal StrUnidadMedida As String, _
                           ByVal StrCategoria As String, ByVal StrSubCategoria As String, ByVal StrTipo As String, ByVal StrIgv As String, _
                           ByVal StrISC As String, ByVal DblMargenUtil As Double, ByVal BytBloqueaCompra As Byte, _
                           ByVal BytBloqueaVenta As Byte, ByVal BytEstado As Byte, ByVal BytConsignacion As Byte, ByVal BytDesensamble As Byte, ByVal DblCorrelativo As Double, _
                           ByVal StrCodigoDesesamble As String, ByVal IntFactor As Integer, ByVal StrCodigoUsuario As String, _
                           ByVal impViñeta As String, ByVal desc_cortaArticulo As String, ByVal numCopias As Integer, ByVal Desc As Integer, 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 = " IN_INVENTORYInsProc '" & StrCodigoArticulo & "','" & StrCodigoMarca & "','" & StrDescripcionArticulo & "'," & DblEquivalencia & "," & BytVentaPlaya & "," & _
                           BytVentaTienda & "," & BytVentaOtroTipo & "," & BytInventariable & "," & BytFormula & ",'" & StrUnidadMedida & "','" & _
                           StrCategoria & "','" & StrSubCategoria & "','" & StrTipo & "','" & StrIgv & "','" & _
                           StrISC & "'," & DblMargenUtil & "," & BytBloqueaCompra & "," & _
                           BytBloqueaVenta & "," & BytEstado & "," & BytConsignacion & "," & BytDesensamble & "," & DblCorrelativo & ",'" & _
                           StrCodigoDesesamble & "'," & IntFactor & ",'" & StrCodigoUsuario & "'," & _
                           "'" & impViñeta & "','" & desc_cortaArticulo & "'," & numCopias & "," & Desc & "," & VarAux(1, 2) & "," & VarAux(1, 1)

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

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_INV_ARTICULO.AgregarArticulo", LStrMensajeError

End Sub

Public Sub EliminarArticulo(ByVal StrCodigoArticulo As String, Optional VarAux As Variant)
Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " XXXXX '" & StrCodigoArticulo & "'"

Set con = New ADODB.Connection
con.Open "FILEDSN=" & filedsn

Set cmd.ActiveConnection = con
cmd.Execute

Exit Sub

ErrorHandler:
     If Not cmd Is Nothing Then
        Set cmd = Nothing
     End If
     If Not con Is Nothing Then
        Set con = Nothing
     End If

     Err.Raise Err.Number, "DB_INV_ARTICULO.EliminarArticulo", Err.Description

End Sub

'****************************************************************************************************
'Funcionalidad : Procedimiento que Invoca al procedimiento almacenado IN_INVENTORYUpdProc,
'                el cual genera una transacción que graba conjuntamente los detalles
'****************************************************************************************************

Public Sub ActualizarArticulo(ByVal StrCodigoArticulo As String, ByVal StrCodigoMarca As String, ByVal StrDescripcionArticulo As String, _
                              ByVal DblEquivalencia As Double, ByVal BytVentaPlaya As Byte, _
                              ByVal BytVentaTienda As Byte, ByVal BytVentaOtroTipo As Byte, _
                              ByVal BytInventariable As Byte, ByVal BytFormula As Byte, ByVal StrUnidadMedida As String, _
                              ByVal StrCategoria As String, ByVal StrSubCategoria As String, ByVal StrTipo As String, ByVal StrIgv As String, _
                              ByVal StrISC As String, ByVal DblMargenUtil As Double, ByVal BytBloqueaCompra As Byte, _
                              ByVal BytBloqueaVenta As Byte, ByVal BytEstado As Byte, ByVal BytConsignacion As Byte, ByVal BytDesensamble As Byte, ByVal DblCorrelativo As Double, _
                              ByVal StrCodigoDesesamble As String, ByVal IntFactor As Integer, _
                              ByVal impViñeta As String, ByVal desc_cortaArticulo As String, ByVal numCopias As Integer, ByVal Desc As Integer, _
                              Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_INVENTORYUpdProc '" & StrCodigoArticulo & "','" & StrCodigoMarca & "','" & StrDescripcionArticulo & "'," & DblEquivalencia & "," & BytVentaPlaya & "," & _
                           BytVentaTienda & "," & BytVentaOtroTipo & "," & BytInventariable & "," & BytFormula & ",'" & StrUnidadMedida & "','" & _
                           StrCategoria & "','" & StrSubCategoria & "','" & StrTipo & "','" & StrIgv & "','" & _
                           StrISC & "'," & DblMargenUtil & "," & BytBloqueaCompra & "," & _
                           BytBloqueaVenta & "," & BytEstado & "," & BytConsignacion & "," & BytDesensamble & "," & DblCorrelativo & ",'" & _
                           StrCodigoDesesamble & "'," & IntFactor & "," & _
                           "'" & impViñeta & "','" & desc_cortaArticulo & "'," & numCopias & "," & Desc & "," & _
                           "" & VarAux(1, 2) & "," & VarAux(1, 1)

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete

Exit Sub
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_INV_ARTICULO.ActualizarArticulo", LStrMensajeError

End Sub

'****************************************************************************************************
'Funcionalidad : Procedimiento que retorna un recordset con todos los articulos
'****************************************************************************************************

Public Function BuscarArticulos(Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = "Select * from VW_BuscarArticulos"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set BuscarArticulos = rs
   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.BuscarArticulos", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad : Procedimiento que retorna un recordset con todos  los articulos
'****************************************************************************************************

Public Function ListarArticulos(Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = "select *  from VW_ListarArticulos"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set ListarArticulos = rs

   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.ListarArticulo", Err.Description

End Function
Public Sub EliminarProveedor(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, ByVal StrCodigoProveedor As String, _
                             ByVal StrCodigoAlmacen As String, Optional VarAux As Variant)
Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_EliminarCodProveedorTempProc  " & DblCorrelativo & ",'" & StrCodigoProveedor & _
                  "','" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.EliminarProveedor", Err.Description

End Sub
Public Sub ActualizarProveedor(ByVal StrCodigoArticulo As String, ByVal StrCodigoProveedor As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " XXXXX '" & StrCodigoArticulo & "','" & StrCodigoProveedor & "'"

Set con = New ADODB.Connection
con.Open "FILEDSN=" & filedsn

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.ActualizarProveedor", Err.Description

End Sub
Public Sub EliminarCodigoAlternativo(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, ByVal StrCodigodeBarra As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_EliminarCodAlternativoTempProc " & DblCorrelativo & ",'" & StrCodigoArticulo & "','" & StrCodigodeBarra & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.GrabarCodigoAlterenTemp", LStrMensajeError
End Sub
Public Sub GrabarCodigoAlterenTemp(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, ByVal StrCodigodeBarra As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " TEMP_IN_INVENTORYALTERInsProc " & DblCorrelativo & ",'" & StrCodigodeBarra & "','" & StrCodigoArticulo & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:

     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_INV_ARTICULO.GrabarCodigoAlterenTemp", LStrMensajeError

End Sub

'****************************************************************************************************
'Funcionalidad : Procedimiento que invoca al procedimiento almacenado TEMP_IN_VENDORINVTUpdProc
'                para actulizar el Temporal de IN_VENDORINVT
'****************************************************************************************************

Public Sub ActualizarCodigoCompraenTemp(ByVal DblCorrelativo As Double, ByVal StrCodigoProveedor As String, _
                                        ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, ByVal StrCodcompra As String, _
                                        ByVal StrDescripcion As String, ByVal StrCodMoneda As String, ByVal DblCosto As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " TEMP_IN_VENDORINVTUpdProc " & DblCorrelativo & ",'" & StrCodigoProveedor & "','" & _
                                                 StrCodigoArticulo & "','" & StrCodigoAlmacen & "','" & StrCodcompra & "','" & _
                                                 StrDescripcion & "','" & StrCodMoneda & "'," & _
                                                 DblCosto

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.ActualizarCodigoCompraenTemp", Err.Description
End Sub

'****************************************************************************************************
'Funcionalidad : Procedimiento que Invoca al procedimiento almacenado IN_INVENTORYUpdProc,
'                el cual genera una transacción que graba conjuntamente los detalles
'****************************************************************************************************
Public Sub GrabarCodigoCompraenTemp(ByVal DblCorrelativo As Double, ByVal StrCodigoProveedor As String, _
                                    ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, ByVal StrCodcompra As String, _
                                    ByVal StrDescripcion As String, ByVal StrCodMoneda As String, ByVal DblCosto As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " TEMP_IN_VENDORINVTnsProc " & DblCorrelativo & ",'" & StrCodigoProveedor & "','" & _
                                               StrCodigoArticulo & "','" & StrCodigoAlmacen & "','" & StrCodcompra & "','" & _
                                               StrDescripcion & "','" & StrCodMoneda & "'," & _
                                               DblCosto

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.GrabarCodigoCompraenTemp", Err.Description
End Sub

Public Sub EliminarAlmacen(ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, ByVal DblCorrelativo As Double, Optional VarAux As Variant)

  Dim cmd As ADODB.Command
  Dim con As ADODB.Connection

  On Error GoTo ErrorHandler

  Set cmd = New ADODB.Command
  cmd.CommandText = " IN_ELIMINARALMACENDETMP '" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'," & DblCorrelativo

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

  Set cmd.ActiveConnection = con
  cmd.Execute
  'GetObjectContext.SetComplete
  Exit Sub

ErrorHandler:
      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_INV_ARTICULO.EliminarAlmacen", Err.Description

End Sub
Public Sub ActualizarAlmacen(ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, _
                             ByVal DblStockMin As Double, ByVal DblStockMax As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " XXXXX '" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'," _
                             & DblStockMin & "," & DblStockMax


Set con = New ADODB.Connection
con.Open "FILEDSN=" & filedsn

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.ActualizarAlmacen", Err.Description

End Sub
Public Sub AsignarAlmacen(ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, _
                          ByVal DblStockMin As Double, ByVal DblStockMax As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler


Set cmd = New ADODB.Command
cmd.CommandText = " XXXXX '" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'," _
                             & DblStockMin & "," & DblStockMax


Set con = New ADODB.Connection
con.Open "FILEDSN=" & filedsn

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.AsignarAlmacen", Err.Description

End Sub

'****************************************************************************************************
'Funcionalidad :Muestra a que Almacenes Pertenece un Artículo
'Parametro de Entrada : El código del Artículo
'****************************************************************************************************

Public Function PertenecealosAlmacenes(ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = " IN_PertenecealosAlmacenesProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set PertenecealosAlmacenes = rs
   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.PertenecealosAlmacenes", Err.Description

End Function

'****************************************************************************************************
'Funcionalidad :Muestra los Almacenes con status=1 a los que no pertenece un Artículo
'****************************************************************************************************

Public Function NoPertenecealosAlmacenes(ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = " IN_NoPertenecealosAlmacenesProc '" & StrCodigoArticulo & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set NoPertenecealosAlmacenes = rs
   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.NoPertenecealosAlmacenes", Err.Description

End Function

Public Sub ReplicarTempInventoryDat(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, _
                                    ByVal DblStkMin As Double, ByVal DblStkMax As Double, ByVal StrCodSolomonInv As String, ByVal StrCodSolomonNoInv As String, _
                                    ByVal DblMontoPrecio As Double, ByVal StrTipoPrecio As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = "TEMP_IN_INVENTORYDATReplicaProc '" & DblCorrelativo & "','" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'," & _
                   DblStkMin & "," & DblStkMax & ",'" & StrCodSolomonInv & "','" & StrCodSolomonNoInv & "'," & DblMontoPrecio & ",'" & StrTipoPrecio & "'"


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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.ReplicarTempInventoryDat", Err.Description

End Sub

Public Sub ActualizarTempInventoryDat(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, _
                                      ByVal DblStkMin As Double, ByVal DblStkMax As Double, ByVal StrCodigoTipoPrecio As String, ByVal DblPrecioVenta, _
                                      ByVal StrCodigoInventariable As String, ByVal StrCodigoNoInventariable As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " TEMP_IN_INVENTORYDATUpdProc '" & DblCorrelativo & "','" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'," & _
                   DblStkMin & "," & DblStkMax & ",'" & StrCodigoTipoPrecio & "'," & DblPrecioVenta & ",'" & StrCodigoInventariable & "','" & _
                   StrCodigoNoInventariable & "'"


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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.ActualizarTempInventoryDat", Err.Description

End Sub

'****************************************************************************************************
'Funcionalidad : Procedimiento que Invoca al procedimiento almacenado IN_INVENTORYUpdProc,
'                el cual genera una transacción que graba conjuntamente los detalles
'****************************************************************************************************
Public Sub EliminarCodigoDesensamble(ByVal StrCodigoArticulo As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_INVENTORYDESDelProc '" & StrCodigoArticulo & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.EliminarCodigoDesensamble", Err.Description
End Sub

Public Function ListarArticulosayuda(Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = "select INVTIDSKU,descr  from in_inventory"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=conexionsies"

   Set ListarArticulosayuda = rs

   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.ListarArticulo", Err.Description

End Function

Public Sub BorrarTemporales(ByVal DblCorrelativo As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = "IN_LIMPIARTEMPORALES " & DblCorrelativo

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.BorrarTemporales", Err.Description

End Sub

'****************************************************************************************
Public Function ObtenerSaldodelPeriodo(ByVal StrCodigoArticulo As String, ByVal StrCodigoAlmacen As String, Optional VarAux As Variant) As Double

 Dim strSql As String
 Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler


   strSql = "IN_ObtenerSaldodelPeriodo '" & StrCodigoArticulo & "','" & StrCodigoAlmacen & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   If Not rs.EOF Then
     ObtenerSaldodelPeriodo = rs!SALDO
   Else
     ObtenerSaldodelPeriodo = 0
   End If

   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:

   If Not rs Is Nothing Then
      Set rs = Nothing
   End If

   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.ObtenerSaldodelPeriodo", Err.Description


End Function

Public Function ListarArticulosporSiteidProved(ByVal StrCodigoAlmacen As String, ByVal StrCodigoProveedor As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = " select in_vendorinvt.INVTIDSKU as Código,in_inventory.descr as Descripción" & _
            " from in_vendorinvt inner join in_inventory on " & _
            " in_inventory.INVTIDSKU = in_vendorinvt.INVTIDSKU " & _
            " where VENDIDSS ='" & StrCodigoProveedor & "' and  SITEID='" & StrCodigoAlmacen & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=conexionsies"

   Set ListarArticulosporSiteidProved = rs

   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.ListarArticulosporSiteidProved", Err.Description

End Function

Public Sub GrabarArticuloenTMP_IN_VENDORINVTREL(ByVal DblCorrelativo As Double, ByVal StrCodigodeProveedor As String, ByVal StrCodigoArticulo As String, _
                                                ByVal StrCodigoCompra As String, ByVal StrDescripcion As String, ByVal StrMoneda As String, Optional VarAux As Variant)
Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " TEMP_IN_VENDORINVTRELInsProc " & DblCorrelativo & ",'" & StrCodigodeProveedor & "','" & StrCodigoArticulo & "','" & _
                                                     StrCodigoCompra & "','" & StrDescripcion & "','" & StrMoneda & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

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_INV_ARTICULO.GrabarArticuloenTMP_IN_VENDORINVTREL", LStrMensajeError
End Sub

Public Function MostrarDetalleTMP_IN_VENDORINVTREL(ByVal DblCorrelativo As Double, ByVal StrCodigoProveedor As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = " select TMP_IN_VENDORINVTREL.INVTIDSKU as Código,in_inventory.descr as Artículo,BUYCOD as Cod_Compra," & _
            " TMP_IN_VENDORINVTREL.DESCR as Descripción" & _
            " from TMP_IN_VENDORINVTREL inner join in_inventory " & _
            " on TMP_IN_VENDORINVTREL.INVTIDSKU=in_inventory.INVTIDSKU " & _
            " where corrnbr=" & DblCorrelativo & " and VENDIDSS='" & StrCodigoProveedor & "'"

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=conexionsies"

   Set MostrarDetalleTMP_IN_VENDORINVTREL = rs

   'GetObjectContext.SetComplete
   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort
   Err.Raise Err.Number, "DB_INV_ARTICULO.MostrarDetalleTMP_IN_VENDORINVTREL", Err.Description

End Function

Public Sub GrabarRelacionProvArt(ByVal DblCorrelativo As Double, ByVal StrCodigoAlmacen As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_GrabaRelacionProvArtProc " & DblCorrelativo & ",'" & StrCodigoAlmacen & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute

'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.GrabarRelacionProvArt", Err.Description
End Sub

Public Sub BorrarTMP_IN_VENDORINVTREL(ByVal DblCorrelativo As Double, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_LimpiarTempProvArtProc " & DblCorrelativo

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

Set cmd.ActiveConnection = con
cmd.Execute
'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.BorrarTMP_IN_VENDORINVTREL", Err.Description

End Sub

Public Sub AsignarProveedor(ByVal StrCodigoProveedor As String, ByVal StrCodigoArticulo As String, ByVal StrDescripcion As String, _
                            ByVal StrCodigoMoneda As String, ByVal StrCodigoAlmacen As String, Optional VarAux As Variant)

Dim cmd As ADODB.Command
Dim con As ADODB.Connection

On Error GoTo ErrorHandler

Set cmd = New ADODB.Command
cmd.CommandText = " IN_GrabarProvArtAlmProc '" & StrCodigoProveedor & "','" & StrCodigoArticulo & "','" & StrDescripcion & "','" & _
                                                 StrCodigoMoneda & "','" & StrCodigoAlmacen & "'"

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

Set cmd.ActiveConnection = con
cmd.Execute


'GetObjectContext.SetComplete
Exit Sub

ErrorHandler:
     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_INV_ARTICULO.AsignarProveedor", Err.Description

End Sub

Public Function VerificarCodigoSolomonenTemp(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, Optional VarAux As Variant) As ADODB.Recordset
   Dim strSql As String
   Dim rs As ADODB.Recordset

   On Error GoTo ErrorHandler

   strSql = " Select tmp_in_inventorydat.siteid as cod,[name] as almacen " & _
            " from tmp_in_inventorydat inner join site on tmp_in_inventorydat.siteid=site.siteid " & _
            " where INVTIDSKU='" & StrCodigoArticulo & "' and CORRNBR=" & DblCorrelativo & " and (rtrim(ltrim(INVTIDSTK))='' OR INVTIDSTK IS NULL) "

   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open strSql, "FILEDSN=" & "conexionsies"

   Set VerificarCodigoSolomonenTemp = rs

   'GetObjectContext.SetComplete

   Exit Function
ErrorHandler:
   If Not rs Is Nothing Then
      Set rs = Nothing
   End If
   'GetObjectContext.SetAbort

   Err.Raise Err.Number, "DB_INV_ARTICULO.VerificarCodigoSolomon", Err.Description

End Function
Public Sub AperturarAlmacenes(ByVal DblCorrelativo As Double, ByVal StrCodigoArticulo As String, Optional VarAux As Variant)
 Dim cmd As ADODB.Command
 Dim con As ADODB.Connection

 On Error GoTo ErrorHandler

 Set cmd = New ADODB.Command
 cmd.CommandText = " IN_APERTURAAlMACENESProc " & DblCorrelativo & ",'" & StrCodigoArticulo & "'"

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

 Set cmd.ActiveConnection = con
 cmd.Execute

 'GetObjectContext.SetComplete
 Exit Sub

ErrorHandler:

     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_INV_ARTICULO.AperturarAlmacenes", LStrMensajeError

End Sub



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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.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_INV_ARTICULO.C_ARTICULO.Auxiliar10", Err.Description
End Function



