cancel
Showing results for 
Search instead for 
Did you mean: 

Generar orden de venta que sea de tipo articulo

Former Member
0 Kudos
433

Hola a toda la comunidad:

Espero me puedan ayudar, estoy generando una orden de venta, que es de Servicio, todo esta bien y ya la genera, pero el tipo de documento que genera es de servicio y lo que necesito es que sea de articulo. Espero me puedan ayudar, aqui dejo un fragmento del codigo con el que estoy trabajando:

Dim Lo_SBOBob As SAPbobsCOM.SBObob

Dim Lo_RecordSet As SAPbobsCOM.Recordset

Dim Lo_RecordSetCC As SAPbobsCOM.Recordset

Dim Lo_SocioNegocio As SAPbobsCOM.BusinessPartners

Dim Lo_Impuesto As SAPbobsCOM.SalesTaxCodes

Dim Lo_Cuentas As SAPbobsCOM.ChartOfAccounts

Dim Bo_Company As SAPbobsCOM.Company

Lo_SBOBob = Mo_Compañia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)

'Inicializamos el objeto Recordset, para realizar consultas

Lo_RecordSet = Mo_Compañia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

Lo_RecordSetCC = Mo_Compañia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

Lo_SocioNegocio = Mo_Compañia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)

Lo_Impuesto = Mo_Compañia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesTaxCodes)

Lo_Cuentas = Mo_Compañia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oChartOfAccounts)

Lo_Orden.CardCode = Lo_SocioNegocio.CardCode

Lo_Orden.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO

Lo_Orden.DocNum = Li_DocNum

Lo_Orden.DocDate = Now.Date 'Posting date

Lo_Orden.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service

Lo_Orden.DocCurrency = Ls_TipoMoneda

Lo_Orden.Series = Li_Serie

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hola Paola, vi que abriste otro Thread

en esta linea le estas diciendo que sea del tipo Servicio

Lo_Orden.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service

y deberia ser del tipo Item para articulos

Lo_Orden.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items

ademas de agregar las lineas del articulo.

extraido de la ayuda del SDK

'****************************************************************************
' This function creates an Invoice that uses the DownPayment
'****************************************************************************
Private Sub CreateInvoice()
    Dim oInvoice As SAPbobsCOM.Documents

    ' Add invoice
    oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
    oInvoice.CardCode = Card Code With DownPayment Invoice
    oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
    oInvoice.DocDate = Document Date
    oInvoice.Lines.ItemCode = Some Item Code
    oInvoice.Lines.Price = Item Price
    oInvoice.Lines.Quantity = Quantity
    oInvoice.Lines.TaxCode = Tax Code If needed
    oInvoice.Lines.VatGroup = Vat Code If needed

    ' Add the Invoice with Down Payment
    Dim dpToDraw As SAPbobsCOM.DownPaymentsToDraw

    dpToDraw = oInvoice.DownPaymentsToDraw

    'oDPM is an object that contains an existing DownPayment Invoice
    dpToDraw.AmountToDraw = oDPM.DownPaymentAmount

    lRetCode = oInvoice.Add()

    If lRetCode <> 0 Then
            oCompany.GetLastError(lErrCode, sErrMsg)
            MsgBox(lErrCode & " " & sErrMsg) ' Display error message
    Else

            MsgBox("Invoice with Downpayment created, the process of using a downpayment invoice succeeded", MsgBoxStyle.Information, "Invoice Paid")

            cmdInv.Enabled = False

     End If
End Sub

cuando termines de ocupar los objetos del tipo recordset u otro tipo, es mejor liberarlos.

suerte

saludos, Jorge

Answers (0)