you would nee to create a joined query to return the order information form both the orders and order details:
SELECT orders., orderdetails.*
INNER JOIN orederdetails
ON orders.orderID = orderdetails.orderID
WHERE orders.orderID = 1
you could then use this recordset to create the invoice,
this is very similar to creating an order history, see the order history tutorial on the eCart support page for details.