// Add the estimate line item to the estimate
$Estimate->addEstimateLine($EstimateLine1);
// Queue up the request to be sent to QuickBooks
$priority_of_add_estimate_request = 10;
// Make sure this is lower than the customer add it depends on
if ($API->addEstimate($Estimate, '_quickbooks_ca_estimate_add_callback', $primary_key_of_estimate_in_your_application, $priority_of_add_estimate_request)) {
    print 'Queued up a request to add estimate #' . $primary_key_of_estimate_in_your_application . ' to QuickBooks!' . "\n";
}
// Journal entry
$JournalEntry = new QuickBooks_Object_JournalEntry();
$JournalEntry->setTransactionDate('January 2, 2009');
$DebitLine = new QuickBooks_Object_JournalEntry_JournalDebitLine();
$DebitLine->setAmount(45.0);
$DebitLine->setAccountName('Test Bank Account');
$JournalEntry->addDebitLine($DebitLine);
$CreditLine = new QuickBooks_Object_JournalEntry_JournalCreditLine();
$CreditLine->setAmount(45.0);
$CreditLine->setAccountName('Automobile Expense');
$JournalEntry->addCreditLine($CreditLine);
if ($API->addJournalEntry($JournalEntry, '_quickbooks_ca_journalentry_add_callback')) {
    print 'Queued up an add journal entry request to QuickBooks!' . "\n";
}
// Adding a payment for a customer
$Payment = new QuickBooks_Object_ReceivePayment();
$Payment->setCustomerApplicationID($primary_key_of_customer_in_your_application);
$Payment->setRefNumber(1234);
$Payment->setTxnDate(date('Y-m-d'));
$Payment->setTotalAmount(50.0);
$Payment->setIsAutoApply(true);
$priority_of_add_payment_request = 5;
// Make sure this is lower than the customer add it depends on
Пример #2
0
$driver_options = array();
if (!QuickBooks_Utilities::initialized($api_driver_dsn)) {
    QuickBooks_Utilities::initialize($api_driver_dsn);
    QuickBooks_Utilities::createUser($api_driver_dsn, 'api', 'password');
}
$API = new QuickBooks_API($api_driver_dsn, $user, $source_type, $source_dsn, $api_options, $source_options, $driver_options);
$dac = $_REQUEST["dac"];
$dam = $_REQUEST["dam"];
$cac = $_REQUEST["cac"];
$cam = $_REQUEST["cam"];
//-------------------------------------------------------------------------------------------------------------------------------
// Journal entry
$JournalEntry = new QuickBooks_Object_JournalEntry();
$dDate = date("F d, Y");
//$JournalEntry->setTransactionDate('July 23, 2012');
$JournalEntry->setTransactionDate($dDate);
$DebitLine = new QuickBooks_Object_JournalEntry_JournalDebitLine();
//$DebitLine->setAccountName('Travel Expense');
//$JournalEntry->addDebitLine($DebitLine);
$DebitLine->setAccountName($dac);
$DebitLine->setAmount($dam);
$JournalEntry->addDebitLine($DebitLine);
$CreditLine = new QuickBooks_Object_JournalEntry_JournalCreditLine();
//$CreditLine->setAccountName('Bank Account XYZ');
//$JournalEntry->addCreditLine($CreditLine);
$CreditLine->setAccountName($cac);
$CreditLine->setAmount($cam);
$JournalEntry->addCreditLine($CreditLine);
if ($API->addJournalEntry($JournalEntry, '_quickbooks_ca_journalentry_add_callback')) {
    print 'Queued up an add journal entry request to QuickBooks!' . "\n";
}
$Line->setItemName('Keiths Item');
$SalesReceipt->addSalesReceiptLine($Line);
print_r($SalesReceipt);
print $SalesReceipt->asQBXML(QUICKBOOKS_ADD_SALESRECEIPT);
exit;
$JournalEntry = new QuickBooks_Object_JournalEntry();
$JournalEntry->setTransactionDate('2009-02-02');
$DebitLine = new QuickBooks_Object_JournalEntry_JournalDebitLine();
$DebitLine->setAmount(45.0);
$DebitLine->setAccountName('Test');
$JournalEntry->addDebitLine($DebitLine);
$CreditLine1 = new QuickBooks_Object_JournalEntry_JournalCreditLine();
$CreditLine1->setAmount(25.0);
$CreditLine1->setAccountName('Services');
$JournalEntry->addCreditLine($CreditLine1);
$CreditLine2 = new QuickBooks_Object_JournalEntry_JournalCreditLine();
$CreditLine2->setAmount(20.0);
$CreditLine2->setAccountName('Sales');
$JournalEntry->addCreditLine($CreditLine2);
//print_r($JournalEntry);
print $JournalEntry->asQBXML(QUICKBOOKS_ADD_JOURNALENTRY);
exit;
$Customer = new QuickBooks_Object_Customer();
$Customer->setFirstName('Keith');
$Customer->set('LastName', 'Palmer');
$Customer->set('ShipAddress Addr1', '56 Cowles Road');
$Customer->setShipAddress('56 Cowles Road', '', '', '', '', 'Willington', 'CT');
$defaults = array('ShipAddress Addr2' => 'bla', 'ShipAddress Country' => 'United States');
//print_r($Customer->getShipAddress(null, $defaults));
//print($Customer->asXML(QUICKBOOKS_OBJECT_XML_DROP, "\t", 'CustomerAdd'));
print "\n\n";
<?php

require_once '../QuickBooks.php';
$JE = new QuickBooks_Object_JournalEntry();
$JE->setTxnDate('2011-01-01');
$JE->setMemo('test memo');
$CreditLine = new QuickBooks_Object_JournalEntry_JournalCreditLine();
$CreditLine->setAccountName('test');
$JE->addCreditLine($CreditLine);
print $JE->asQBXML(QUICKBOOKS_ADD_JOURNALENTRY);