$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"; $arr = array('ModifiedDateRangeFilter' => array('FromModifiedDate' => 'test'), 'ModifiedDateRangeFilter ToModifiedDate' => 'test'); $Invoice = new QuickBooks_Object_Invoice($arr); $qbxml = $Invoice->asQBXML('InvoiceQueryRq'); print $qbxml; print "\n\n"; /* $xml = ' <XML> <Customer> <FirstName>Keith</FirstName> </Customer> </XML> '; $Parser = new QuickBooks_XML($xml); $errnum = 0; $errmsg = ''; $Doc = $Parser->parse($errnum, $errmsg);
// into account field length limits or data types from the qbXML // specification, you'll need to do that yourself. Support for this may be // added in the future. For now, you can use the QuickBooks_Cast::cast() // method to cast values to the correct type and length before setting them // in the object. // // $value = 'Keith Palmer'; // $xpath = 'Name'; // // Makes sure the $value will fit in a QuickBooks Customer Name field // $Name = QuickBooks_Cast::cast(QUICKBOOKS_OBJECT_CUSTOMER, $xpath, $value); // // $value = '56 Cowles Road'; // $xpath = 'ShipAddress/Addr1'; // Makes sure the $value will fit in a QuickBooks Customer ShipAddress/Addr1 field // $ShipAddress_Addr1 = QuickBooks_Cast::cast(QUICKBOOKS_OBJECT_CUSTOMER, $xpath, $value); $qbxml = $Invoice->asQBXML(QUICKBOOKS_ADD_INVOICE); print $qbxml; // Prints the following XML: /* <InvoiceAddRq> <InvoiceAdd> <CustomerRef> <FullName>The Company Name Here</FullName> </CustomerRef> <RefNumber>A-123</RefNumber> <Memo>This invoice was created using the QuickBooks PHP API!</Memo> <InvoiceLineAdd> <ItemRef> <FullName>Item Type 1</FullName> </ItemRef> <Quantity>3</Quantity>