Stands corrected:
Line 146 in reporting/rep107.php:
$result = get_customer_trans_details(ST_SALESINVOICE, $row['trans_no']);
gets the line items from the function (defined in sales/includes/db/cust_trans_details_db.inc) used above like:
SELECT line.*,
line.unit_price+line.unit_tax AS FullUnitPrice,
line.description AS StockDescription,
item.units, item.mb_flag
FROM 1_debtor_trans_details line,1_stock_master item
WHERE (
(debtor_trans_no=1) -- 1st Transaction in Demo Co
AND debtor_trans_type=10 -- ST_SALESINVOICE
AND item.stock_id=line.stock_id
)
ORDER BY id
This result having the invoice's line items are cycled through from lines 148 to 181 in reporting/rep107.php.