on 06-17-2008 3:13 AM
anyone can give some exam regarding this?
thanks
Erick,
for payment is it as (example from help)
Private Sub cmdTest_Click()
On Error GoTo ErrorHandler
Dim vCompany As SAPbobsCOM.Company
'create company object
Set vCompany = New SAPbobsCOM.Company
'set paras for connection
vCompany.CompanyDB = "SBODemo_US"
vCompany.Password = "manager"
vCompany.UserName = "manager"
vCompany.Server = "(local)"
'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
'Set the object's properties
Dim vPay As SAPbobsCOM.Payments
Set vPay = vCompany.GetBusinessObject(oIncomingPayments)
vPay.Address = "622-7"
vPay.ApplyVAT = 1
vPay.CardCode = "D10006"
vPay.CardName = "Card D10004"
vPay.CashAccount = "288000"
vPay.CashSum = 0 '5620.85
vPay.CheckAccount = "280001"
vPay.ContactPersonCode = 2
vPay.DocCurrency = "Eur"
vPay.DocDate = Now
vPay.DocRate = 0
vPay.DocTypte = 0
vPay.HandWritten = 0
vPay.JournalRemarks = "Incoming - D10004"
vPay.LocalCurrency = 0
vPay.Printed = 0
vPay.Reference1 = 14
vPay.Series = 0
vPay.SplitTransaction = 0
vPay.TaxDate = Now
vPay.TransferAccount = "10100"
vPay.TransferDate = Now
vPay.TransferSum = 0 '
vPay.Invoices.AppliedFC = 0
vPay.Invoices.AppliedSys = 5031.2
vPay.Invoices.DocEntry = 8
vPay.Invoices.DocLine = 0
vPay.Invoices.DocRate = 0
vPay.Invoices.InvoiceType = it_Invoice
vPay.Invoices.LineNum = 0
vPay.Invoices.SumApplied = 5031.2
vPay.Checks.AccounttNum = "384838"
vPay.Checks.BankCode = "CB"
vPay.Checks.Branch = "Branch"
vPay.Checks.CheckNumber = 3838383
vPay.Checks.CheckSum = 4031.2
vPay.Checks.Currency = "Eur"
vPay.Checks.Details = "test1"
vPay.Checks.DueDate = CDate("31/12/2002")
vPay.Checks.LineNum = 0
vPay.Checks.Trnsfrable = 0
Call vPay.Checks.Add
Call vPay.Checks.SetCurentLine(1)
vPay.Checks.AccounttNum = "384838"
vPay.Checks.BankCode = "CB"
vPay.Checks.Branch = "Branch"
vPay.Checks.CheckNumber = "3838383"
vPay.Checks.CheckSum = 1000
vPay.Checks.Currency = "EUR"
vPay.Checks.Details = "test2"
vPay.Checks.DueDate = Now
vPay.Checks.LineNum = 1
vPay.Checks.Trnsfrable = 0
If (vPay.Add() <> 0) Then
MsgBox ("Failed to add a payment")
End If
'check for errors
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
Set vCompany = Nothing
Exit Sub
ErrorHandler:
MsgBox ("Exception:" + Err.Description)
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks Petr,
i noticed the example after i post
still doesn't understand it though because the example use this line
vPay.Address = "622-7"
vPay.ApplyVAT = 1
vPay.CardCode = "D10006"
vPay.CardName = "Card D10004"
vPay.CashAccount = "288000"
vPay.CashSum = 0 '5620.85
vPay.CheckAccount = "280001"
vPay.ContactPersonCode = 2
vPay.DocCurrency = "Eur"
vPay.DocDate = Now
vPay.DocRate = 0
vPay.DocTypte = 0
vPay.HandWritten = 0
vPay.JournalRemarks = "Incoming - D10004"
vPay.LocalCurrency = 0
vPay.Printed = 0
vPay.Reference1 = 14
vPay.Series = 0
vPay.SplitTransaction = 0
vPay.TaxDate = Now
vPay.TransferAccount = "10100"
vPay.TransferDate = Now
vPay.TransferSum = 0 '
vPay.Invoices.AppliedFC = 0
vPay.Invoices.AppliedSys = 5031.2
vPay.Invoices.DocEntry = 8
vPay.Invoices.DocLine = 0
vPay.Invoices.DocRate = 0
vPay.Invoices.InvoiceType = it_Invoice
vPay.Invoices.LineNum = 0
vPay.Invoices.SumApplied = 5031.2
while i'm just using Checks, it is suppose to be just use this line?
vPay.Checks.AccounttNum = "384838"
vPay.Checks.BankCode = "CB"
vPay.Checks.Branch = "Branch"
vPay.Checks.CheckNumber = 3838383
vPay.Checks.CheckSum = 4031.2
vPay.Checks.Currency = "Eur"
vPay.Checks.Details = "test1"
vPay.Checks.DueDate = CDate("31/12/2002")
vPay.Checks.LineNum = 0
vPay.Checks.Trnsfrable = 0
i'm still trying it,
confuse,
this is the one i use but i received error no matching records found?
why?
.CardCode = ColCode2_UDS.ValueEx
.CardName = ColName2_UDS.ValueEx
.CashSum = 0 'ColAmount2_UDS.ValueEx
.CheckAccount = ColAuAcc2_UDS.ValueEx
oRs = oSBObob.Format_StringToDate(ColDate2_UDS.ValueEx)
.TaxDate = oRs.Fields.Item(0).Value
.DocDate = oRs.Fields.Item(0).Value
.DocType = SAPbobsCOM.BoRcptTypes.rCustomer
.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
.Invoices.DocEntry = ColEntry2_UDS.ValueEx
.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
.Invoices.SumApplied = ColTotal2_UDS.ValueEx
.Checks.AccounttNum = ColAcc2_UDS.ValueEx
.Checks.BankCode = "BCA"
.Checks.CheckNumber = ColBilyet2_UDS.ValueEx
.Checks.CheckSum = ColAmount2_UDS.ValueEx
.Checks.DueDate = Today.Date
.Checks.Trnsfrable = 0
Petr,
when i use CashSum = 0, it got an error too..i'll inform about it later coz this addon must finish quickly
i use this code, and it work fine
just a TRICK: when added .CheckAccount, it can't use HouseBank FormatCode, it must use AcctCode (the one with _Sysxxxxxxx) otherwise u'll receive an error "No Matching Record Found"
.CardCode = ColCode2_UDS.ValueEx
.CardName = ColName2_UDS.ValueEx
sHouseBank = ColAuAcc2_UDS.ValueEx
sHouseBank = Replace(sHouseBank, ".", "", , , CompareMethod.Text)
sSQL = "SELECT AcctCode FROM OACT WHERE FormatCode = '" & sHouseBank & "'"
oRs.DoQuery(sSQL)
.CheckAccount = oRs.Fields.Item(0).Value
oRs = oSBObob.Format_StringToDate(ColDate2_UDS.ValueEx)
.TaxDate = oRs.Fields.Item(0).Value
.DocDate = oRs.Fields.Item(0).Value
.DocType = SAPbobsCOM.BoRcptTypes.rCustomer
.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
.Series = 0
.Invoices.DocEntry = ColEntry2_UDS.ValueEx
.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
.Invoices.SumApplied = ColPaymen2_UDS.ValueEx
.Invoices.DiscountPercent = ColDisc2_UDS.ValueEx
.Checks.AccounttNum = ColAcc2_UDS.ValueEx
.Checks.CheckNumber = ColBilyet2_UDS.ValueEx
.Checks.CheckSum = ColAmount2_UDS.ValueEx
.Checks.DueDate = Today.Date
.Checks.Trnsfrable = 0
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.