📚 SAP Business One SDK Help

Create a Down Payment Document
See Also
Private Sub cmdCreateDownPaymentInv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreateDownPaymentInv.Click
    Try
        'Create DownPayment Invoice Object
        oDPM = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDownPayments)

        'Set Down Payment Header Values
        oDPM.CardCode = Some Card code
        oDPM.DocDueDate = Suitable Date
        oDPM.DownPaymentPercentage = Numeric value (Double)

        oDPM.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptInvoice

        'Set Down Payment Line Values
        oDPM.Lines.ItemCode = Some Item Code
        oDPM.Lines.Quantity = Quantity
        oDPM.Lines.Price = Item Price

        lRetCode = oDPM.Add ' Try to add the invoice to the database
        If lRetCode <> 0 Then
             oCompany.GetLastError(lErrCode, sErrMsg)
             MsgBox(lErrCode & " " & sErrMsg) ' Display error message
        Else
             MsgBox("Down Paymeny Invoice Added to DataBase", MsgBoxStyle.Information, "Invoice Added")
        End If

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

End Sub