//	the example shown above), by their ListID (a primary key within QuickBooks)
//	or, if you've created a mapping between the customer's primary key within
//	your application and the customer in QuickBooks, you can refer to them by
//	the primary key within your application, and the framework will map this
//	value to a ListID for you.
//
// 	For this example, we're going to refer to them by their mapped primar key,
//	because the callback function "_quickbooks_ca_customer_add_callback" that
//	we used above when adding Shannon creates this mapping for us.
$Invoice->setCustomerApplicationID($primary_key_of_customer_in_your_application);
// $Invoice->setCustomerName('The Company Name Here');
// $Invoice->setCustomerListID($ListID_from_QuickBooks);
// Invoice #125
$Invoice->setRefNumber($primary_key_of_invoice_in_your_application);
// Set some other fields...
$Invoice->setMemo('This invoice was created using the QuickBooks PHP API!');
// Now, we need to build each invoice line for the invoice. Each invoice line
//	will contain at least a reference to an item, and probably a quantity or
//	the item ordered, and either a total amount or a rate (price per item).
//
// As with customers above, the items need to be present in QuickBooks before
//	we can add an invoice that depends on them. You can again refer to the item
//	in three different ways:
//	- Name/FullName
//	- ListID
//	- a mapped primary key from your application
//
// 	For this example, we're going to refer to the items by name, so the items
//	must already be present in QuickBooks for this invoice to be added.
// 3 items of type "Item Type 1" at $10.00 per item
$InvoiceLine1 = new QuickBooks_Object_Invoice_InvoiceLine();
Example #2
0
$API = new QuickBooks_API($api_driver_dsn, $user, $source_type, $source_dsn, $api_options, $source_options, $driver_options);
// CUSTOMERS
$fname = 'Shannon ' . mt_rand();
$lname = 'Daniels';
$Customer = new QuickBooks_Object_Customer();
$Customer->setFirstName($fname);
$Customer->setLastName($lname);
$Customer->setShipAddress('56 Cowles Road', '', '', '', '', 'Willington', 'CT');
$Customer->setMiddleName('R');
$Customer->setSalutation('Mr.');
$Customer->setPhone('1.860.634.1602');
$API->addCustomer($Customer, '_quickbooks_customer_add_callback', 15);
// INVOICES
$Invoice = new QuickBooks_Object_Invoice();
//$Invoice->setOther('test of other');		// for some reason this field doesn't work...
$Invoice->setMemo('test of a memo');
$Invoice->setCustomerApplicationID(15);
$Invoice->setRefNumber(125);
$InvoiceLine1 = new QuickBooks_Object_Invoice_InvoiceLine();
$InvoiceLine1->setItemApplicationID(12);
$InvoiceLine1->setAmount(300.0);
$InvoiceLine1->setQuantity(3);
$InvoiceLine2 = new QuickBooks_Object_Invoice_InvoiceLine();
$InvoiceLine2->setItemApplicationID(11);
$InvoiceLine2->setAmount(225.0);
$InvoiceLine2->setQuantity(5);
$Invoice->addInvoiceLine($InvoiceLine1);
$Invoice->addInvoiceLine($InvoiceLine2);
$API->addInvoice($Invoice, '_quickbooks_invoice_add_callback', 20);
// VENDORS
$Vendor = new QuickBooks_Object_Vendor();