Buenas gente, les comento un problema que tengo.
Necesito hacer el ingreso de Ordenes de Venta, Pagos recibidos y Depósitos a Sap Bussines One mediante una aplicación en .net
Actualmente logre hacer el ingreso de Ordenes de venta gracias a una función publicada en este mismo sitio web la cual adjuntare mas abajo
También encontré una función para pagos pero esta me dejo muchas dudas a diferencia de la de ordenes ya que los pagos no se como indicarle a cual factura van a afectar y aun no logro conseguir nada de depósitos por lo que este post es para ver si me ayudan o aconsejan como lograr mi meta de ingresar de forma correcta las Ordenes de venta de clientes , los pagos recibidos y depósitos
Continuación muestro las funciones que tengo
FUNCIÓN INSERTAR ORDENES DE VENTA DESDE .NET
Sub AddOrderClient()
Try
Dim RetVal As Long
Dim ErrCode As Long
Dim ErrMsg As String
Dim oCompany As SAPbobsCOM.Company
Dim lRetCode, ErrorCode As Long
Dim ErrorMessage As String
'PARAMETROS DE CONEXION A SAP
oCompany = New SAPbobsCOM.Company
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008
oCompany.DbUserName = "USER"
oCompany.DbPassword = "CLAVEUSER"
oCompany.Server = "SAP"
oCompany.CompanyDB = "Pruebas"
oCompany.UserName = "MANAGER"
oCompany.Password = "CLAVEMANAGER"
oCompany.UseTrusted = False
'CONECTA
lRetCode = oCompany.Connect()
'Create the Documents object CREAREMOS UN DOCUMENTO DE VENTA
'Crear un pedido de cliente:
Dim oOrder As SAPbobsCOM.Documents
oOrder = oCompany.GetBusinessObject(BoObjectTypes.oOrders)
' '////////////////////////////////////// ENCABEZADO DE LA ORDEN DE VENTA /////////////////////////////////////////////
oOrder.DocNum = 25030000
oOrder.Series = 0
'codigo del cliente
oOrder.CardCode = "C502-0147"
'Escritor a mano
oOrder.HandWritten = 1
'codigo del grupo de pago (credito de 8 ,15 o los dias que tenga)
oOrder.PaymentGroupCode = "1"
'Fecha del creacion del documento
oOrder.DocDate = "02/8/2013"
oOrder.DocDueDate = "02/8/2013"
'Monto total del documento
oOrder.DocTotal = 264.6
'////////////////////////////////////// DETALLE DE LA ORDEN DE VENTA /////////////////////////////////////////////
'Invoice Lines - Set values to the first line
'Codigo del articulo
oOrder.Lines.ItemCode = "052022004"
'descripcion del articulo
oOrder.Lines.ItemDescription = "TONOS MAIZ DULCE 75gr 1X48 [003169]"
'Precio después de IVA(impuesto de venta)
oOrder.Lines.PriceAfterVAT = 374.3125
'cantidad
oOrder.Lines.Quantity = 5
'moneda
oOrder.Lines.Currency = "COL"
'% de descuento
oOrder.Lines.DiscountPercent = 10
'Invoice Lines - Set values to the second line
oOrder.Lines.Add() ' LINEA IMPORTANTE PARA AGREGAR MAS LINEAS
oOrder.Lines.ItemCode = " 052022003"
oOrder.Lines.ItemDescription = "TONOS MAIZ DULCE 185gr 1X24 [002056]"
oOrder.Lines.PriceAfterVAT = 259.9
oOrder.Lines.Quantity = 1
oOrder.Lines.Currency = "COL"
oOrder.Lines.DiscountPercent = 5
'Add the Invoice
RetVal = oOrder.Add
'Check the result
If RetVal <> 0 Then
oCompany.GetLastError(ErrCode, ErrMsg)
MsgBox(ErrCode & " " & ErrMsg)
End If
'se desconecta de SAP
oCompany.Disconnect()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
FUNCIÓN INSERTAR PAGOS RECIBOS DESDE .NET
'INSERTAR PAGO RECIBIDO EJEMPLO DE http://scn.sap.com/thread/1642944
Public Sub cmdTest_Click()
On Error GoTo ErrorHandler
Dim vCompany As SAPbobsCOM.Company
'create company object
vCompany = New SAPbobsCOM.Company
'PARAMETROS DE CONEXION A SAP
vCompany = New SAPbobsCOM.Company
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008
vCompany.DbUserName = "sa"
vCompany.DbPassword = "Bourn3"
vCompany.Server = "SAP"
vCompany.CompanyDB = "Pruebas_BD_BOURNE"
vCompany.UserName = "vfallas"
vCompany.Password = "Nvtr0520"
vCompany.UseTrusted = False
'connect to database server
If (0 <> vCompany.Connect()) Then
MsgBox("Failed to connect")
Exit Sub
End If
Dim nErr As Long
Dim errMsg As String
'ENCABEZADP DE´PAGO RECIBODO
Dim vPay As SAPbobsCOM.Payments
vPay = vCompany.GetBusinessObject(BoObjectTypes.oIncomingPayments)
vPay.DocNum = 19015000
vPay.Address = "622-7"
vPay.ApplyVAT = 1
vPay.CardCode = "C502-1003"
vPay.CardName = "ABASTECEDOR EL HIGUERON ((LAS JUNTAS))"
vPay.CashAccount = "10100101001"
vPay.CashSum = 0
'vPay.CheckAccount = "280001"
vPay.ContactPersonCode = 1
vPay.DocCurrency = "COL"
vPay.DocDate = Now
vPay.DocRate = 0
vPay.DocTypte = 0
vPay.HandWritten = 0
vPay.JournalRemarks = "Incoming - D10004"
vPay.LocalCurrency = BoYesNoEnum.tYES
'vPay.Printed = 0
vPay.Reference1 = 8
vPay.Series = 0
'vPay.SplitTransaction = 0
vPay.TaxDate = Now
vPay.DocNum = 1
'TRANSFEREMCOA INFO
vPay.TransferAccount = "10100101001"
vPay.TransferDate = Now
vPay.TransferSum = 5031.2
vPay.TransferReference = "Refenecia de transferencia"
'CHEQUE1 INFO
vPay.Checks.CheckNumber = 1
vPay.CheckAccount = "10100101002"
vPay.Checks.CheckSum = 23.2
vPay.Checks.CountryCode = "CR"
vPay.Checks.Details = "Detalle del cheque"
vPay.Checks.DueDate = Now
'vPay.Checks.LineNum = CInt(0)
vPay.Checks.BankCode = "BCR"
vPay.Checks.Add()
'CHEQUE 2 INFO
vPay.Checks.CheckNumber = 1
vPay.CheckAccount = "3343"
vPay.Checks.CheckSum = 23.2
vPay.Checks.CountryCode = "CR"
vPay.Checks.Details = "Detalle del cheque"
vPay.Checks.DueDate = Now
'vPay.Checks.LineNum = CInt(0)
vPay.Checks.BankCode = "BCR"
If (vPay.Add() <> 0) Then
MsgBox("Failed to add a payment")
End If
'Check Error
Call vCompany.GetLastError(nErr, errMsg)
If (0 <> nErr) Then
MsgBox("Found error:" + Str(nErr) + "," + errMsg)
Else
MsgBox("Succeed in payment.add")
End If
'disconnect the company object, and release resource
Call vCompany.Disconnect()
vCompany = Nothing
Exit Sub
ErrorHandler:
MsgBox("Exception:" + Err.Description)
End Sub
FUNCIÓN INSERTAR DEPÓSITOS DESDE .NET
aun no logro encontrar una guía para este
como ven ya tengo la mayoría pero tengo muchas dudas les agrade seria demasiado si me ayudan con ejemplo o con links de donde pueda auto capacitarme
Desde ya muchas gracias a los que me colaboren