![]() |
![]() |
This is an old revision of the document!
getAccounts($filters = array(), $or = false, $fields = array(), $start = 0, $max = -1, $order = array())
//-------------------------------------------------------------------------------------------------- //Get 15 accounts, sorted by name, starting at result 500 $Accounts = $QB->getAccounts(array(), QUICKBOOKS_SQL_API_AND, array(), 500, 15, array( array("Name", "ASC") )); foreach($Accounts as $Account) echo " ".$Account->Name."<br />";
//-------------------------------------------------------------------------------------------------- //Get all accounts who's FullName starts with "Ax" $filters = array( "FullName" => array("LIKE", "Ax%") ); $Accounts = $QB->getAccounts($filters); foreach($Accounts as $Account) echo " ".$Account->Name."<br />";
//-------------------------------------------------------------------------------------------------- //Get all accounts who are active, and have a balance greater than zero. $filters = array( "IsActive" => "1", "Balance" => array( ">", "0" ) ); $Accounts = $QB->getAccounts($filters); foreach($Accounts as $Account) echo "Name: ".$Account->Name."<br /> Fax: ".$Account->Balance."<br />";
Entries in the array can have several forms: $field_name => $value -- Equivalent to: "WHERE $field_name = $value " $field_name => "IS NULL" -- Equivalent to: "WHERE $field_name IS NULL " $field_name => "IS NOT NULL" -- Equivalent to: "WHERE $field_name IS NOT NULL " $field_name => array( $operator, $value ) -- Equivalent to: "WHERE $field_name $operator $value " Example: array( "ListID" => "12345-6789", "Balance" => array( ">", "0") )
Each entry in the array must be another array with this structure: array( "Field_Name", "ASC") -- Equivalent to: "ORDER BY $field_name ASC " array( "Field_Name", "DESC") -- Equivalent to: "ORDER BY $field_name DESC " Example: array( array( "LastName", "ASC" ), array( "FirstName", "DESC" ) ) Equivalent to: "ORDER BY LastName ASC, FirstName DESC "
public function getAccounts($filters = array(), $or = false, $fields = array(), $start = 0, $max = -1, $order = array()) { //get($tables, $filters = array(), $or = false, $union = false, $fields = array(), $start = 0, $max = -1, $order = array()) $this->DB->get("qb_account", $filters, $or, false, $fields, $start, $max, $order); return $this->DB->allToObjects(); }