$EstimateLine1 = new QuickBooks_Object_Estimate_EstimateLine();
$EstimateLine1->setItemName('Item Type 1');
$EstimateLine1->setRate(14.95);
$EstimateLine1->setQuantity(5);
// 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'));
Ejemplo n.º 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";
}