ACCOUNTS RECEIVABLE
Public Sub CreateARInvoice()

Dim oInvoice As CARInvoice
Set oInvoice = New CARInvoice

With oInvoice
.Init FE_Application.SessionContext
.Fields(ARINVOICES_fld_AR7CLIENTSID) = 1
.Fields(ARINVOICES_fld_INVOICEDATE) = "04/18/2013"
.Fields(ARINVOICES_fld_ONHOLD) = False
.Fields(ARINVOICES_fld_ASSESSFINANCECHARGES) = -1
.Fields(ARINVOICES_fld_TERMSID) = 1
.Fields(ARINVOICES_fld_DUEDATE) = "05/18/2013"
.Fields(ARINVOICES_fld_ORDEREDONDATE) = "04/18/2013"
.Fields(ARINVOICES_fld_COMMENT) = "Marc's Test"
.Fields(ARINVOICES_fld_DELETED) = 0
.Fields(ARINVOICES_fld_RECURRINGINVOICESTATUS) = 0
.Fields(ARINVOICES_fld_BILLTOADDRESS) = 4
.Fields(ARINVOICES_fld_SHIPTOADDRESS) = 4

.ApplyClientDefaults
.Validate
.Save
.CloseDown
End With
 
Set oInvoice = Nothing
End Sub

ACCOUNTS PAYABLE
Public Sub CreateAPInvoice()

   Dim oInvoice As CAPInvoice
   Set oInvoice = New CAPInvoice

   With oInvoice
       .Init FE_Application.SessionContext
       .Fields(APINVOICES_fld_AP7VENDORSID) = 1   
       .Fields(APINVOICES_fld_REMITTO) = 1 'AP7VENDORCONTACTSID

       .Fields(APINVOICES_fld_POSTDATE) = Date
       .Fields(APINVOICES_fld_DESCRIPTION) = "Marc's Test"
       .Fields(APINVOICES_fld_PAYMENTMETHOD) = "Check"
       .Fields(APINVOICES_fld_INVOICEAMOUNT) = "$1.00"
       .Fields(APINVOICES_fld_INVOICEDATE) = "12/1/2003"

       With .Distribution.Add
          .Fields(BBDISTRIBUTIONS_fld_DEBITACCTNUM) = "01-1000-00"
          .Fields(BBDISTRIBUTIONS_fld_CREDITACCTNUM) = "01-2000-00"
          .Fields(BBDISTRIBUTIONS_fld_AMOUNT) = "1"
          'Add description of distribution - Note: this is not enumerated
          .Fields(32) = "Distribution Description test"
       End With

       .ApplyVendorDefaults False
       .Validate
       .Save
       .CloseDown
   End With

   Set oInvoice = Nothing
End Sub


Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.