Note: This appears to work for my use case, but I can't say with confidence that it's a catch-all solution.
Since I need to present itemised statements to customers, I'm using a TransactionQuery to import all the transactions from QuickBooks.
Subsequently filtering the transactions for the account name "Accounts Receivable" seems to accurately list all the transactions which contribute to the customer's balance and can be used either to calculate the balance by summing the "Amount" column or to further query the same transaction table for individual line items. See the example queries below:
/* Calculate balance from transactions */
SELECT SUM(Amount)
FROM quickbooks_transaction
WHERE EntityRefListID = '$customer_listid'
AND AccountRefFullName = 'Accounts Receivable';
/* Retrieve line items for a transaction */
SELECT *
FROM quickbooks_transaction
WHERE TxnID = '$transaction_id'
AND TxnLineID != '';
I suppose you could even SUM the amounts of the line items to calculate a balance if you really wanted to, but you'd have to make sure not to include the parent transactions in the SUM.