コード例 #1
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
// Get the existing invoice first (you need the latest SyncToken value)
$invoices = $InvoiceService->query($Context, $realm, "SELECT * FROM Invoice WHERE Id = '34' ");
$Invoice = $invoices[0];
$Line = $Invoice->getLine(0);
$Line->setDescription('Update of my description on ' . date('r'));
print_r($Invoice);
$Invoice->setTxnDate(date('Y-m-d'));
// Update the invoice date to today's date
if ($resp = $InvoiceService->update($Context, $realm, $Invoice->getId(), $Invoice)) {
    print '&nbsp; Updated!<br>';
} else {
    print '&nbsp; ' . $InvoiceService->lastError() . '<br>';
}
/*
print('<br><br><br><br>');
print("\n\n\n\n\n\n\n\n");
print('Request [' . $IPP->lastRequest() . ']');
print("\n\n\n\n");
print('Response [' . $IPP->lastResponse() . ']');
print("\n\n\n\n\n\n\n\n\n");
*/
コード例 #2
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$ItemService = new QuickBooks_IPP_Service_Item();
$invoices = $InvoiceService->query($Context, $realm, "SELECT *, Line.* FROM Invoice STARTPOSITION 1 MAXRESULTS 5");
//print_r($customers);
foreach ($invoices as $Invoice) {
    $num_lines = $Invoice->countLine();
    // How many line items are there?
    for ($i = 0; $i < $num_lines; $i++) {
        $Line = $Invoice->getLine($i);
        // Let's find out what item this uses
        if ($Line->getDetailType() == 'SalesItemLineDetail') {
            $Detail = $Line->getSalesItemLineDetail();
            $item_id = $Detail->getItemRef();
            print 'Item id is: ' . $item_id . "\n";
            $items = $ItemService->query($Context, $realm, "SELECT * FROM Item WHERE Id = '" . QuickBooks_IPP_IDS::usableIDType($item_id) . "' ");
            print '   That item is named: ' . $items[0]->getName() . "\n";
        }
    }
    print "\n\n\n";
}
/*
print("\n\n\n\n");
コード例 #3
0
// Print the credentials we're using
//print_r($creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context()) {
    // Set the IPP version to v3
    $IPP->version(QuickBooks_IPP_IDS::VERSION_3);
    $CustomerService = new QuickBooks_IPP_Service_Customer();
    $InvoiceService = new QuickBooks_IPP_Service_Invoice();
    $customers = $CustomerService->query($Context, $realm, "SELECT * FROM Customer WHERE FamilyName = 'Palmer' ");
    //print_r($customers);
    if (count($customers)) {
        foreach ($customers as $Customer) {
            print 'Customer Id=' . $Customer->getId() . ' is named: ' . $Customer->getFullyQualifiedName() . '<br>';
            $invoices = $InvoiceService->query($Context, $realm, "SELECT * FROM Invoice WHERE CustomerRef = '" . QuickBooks_IPP_IDS::usableIDType($Customer->getId()) . "' ");
            /*
            print("\n\n\n\n");
            print('Request [' . $IPP->lastRequest() . ']');
            print("\n\n\n\n");
            print('Response [' . $IPP->lastResponse() . ']');
            print("\n\n\n\n");
            exit;
            */
            if (count($invoices)) {
                foreach ($invoices as $Invoice) {
                    print ' &nbsp; &nbsp; Invoice #' . $Invoice->getDocNumber() . ' on date ' . $Invoice->getTxnDate() . '<br>';
                }
            } else {
                print ' &nbsp; &nbsp; This customer has no invoices.<br>';
            }