on 09-28-2007 5:13 AM
Hi,
Can anyone tell me how to create Delevery Notes and Invoice Based on Sales Order using DIAPI .
regards,
Chaminda ratnayake
Hi Chamnida,
There is an example called '05.OrderAndInvoice' from SDK Samples. I coped function from that example. You same logic to created Deliver Note also.
Private Sub CreateInvoice()
' init the invoice object
oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oInvoice.CardCode = cmbCustomer.Text
Dim sNewObjCode As String
Dim i As Integer
' Get last added document number (the order that was added)
oCompany.GetNewObjectCode(sNewObjCode)
' this loop adds the different items to the invoice object
i = 0
Do
oInvoice.Lines.BaseEntry = sNewObjCode
oInvoice.Lines.BaseLine = i
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.TaxCode = TableLines.Rows(i).Item(4)
i += 1
If i <> TableLines.Rows.Count Then
oInvoice.Lines.Add()
End If
Loop Until i = TableLines.Rows.Count
' Try to add the invoice object to the database
lRetCode = oInvoice.Add()
If lRetCode <> 0 Then ' If the addition failed
oCompany.GetLastError(lErrCode, sErrMsg)
MsgBox(lErrCode & " " & sErrMsg) ' Display error message
Else
cmdInvoice.Enabled = True
MsgBox("inv Added to DataBase", MsgBoxStyle.Information, "Order Added")
End If
End Sub
HTH
B Ravi Shankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
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.