Skip to content

Instantly share code, notes, and snippets.

@v1shwa
Created February 12, 2016 14:08
Show Gist options
  • Save v1shwa/caf39a1c3e0f282cb363 to your computer and use it in GitHub Desktop.
Save v1shwa/caf39a1c3e0f282cb363 to your computer and use it in GitHub Desktop.
Quickbooks Invoice with Tax using Consolibyte's SDK
<?php
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$Invoice = new QuickBooks_IPP_Object_Invoice();
$Invoice->setDocNumber('st-100002'); // doc number (optional)
$Invoice->setTxnDate('2016-02-12');
$Invoice->setCustomerRef( 1 ); // customer Id
// Create a New line
$Line = new QuickBooks_IPP_Object_Line();
$Line->setDetailType('SalesItemLineDetail');
$Line->setAmount(180);
$Line->setDescription('A Demo Invoice');
// Add product
$SalesItemLineDetail = new QuickBooks_IPP_Object_SalesItemLineDetail();
$SalesItemLineDetail->setItemRef('1');
$SalesItemLineDetail->setUnitPrice(60);
$SalesItemLineDetail->setQty(3);
// Tax
$SalesItemLineDetail->setTaxCodeRef('14');
// Add product to Line
$Line->addSalesItemLineDetail($SalesItemLineDetail);
// Append line to the invoice
$Invoice->addLine($Line);
// Send Request
$resp = $InvoiceService->add($this->Context, $this->realm, $Invoice)
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment