I always recommend stored procedures, if you can do them as crystal is looking at 1 line of data at a time. Pulling the month and year out of the invoice date isn't hard, but pulling only 1 record that matches....
pulling the date parts (in a formula):
shared numbervar mnth := month({invoicedatefield});
shared numbervar yr := year({invoicedatefield});
getting the line items is more problematic, as I can't manipulate things...
if you could, I would suggest creating a stored proc or a view as you have much more flexibilty in creating your data row.
Hope this helps, or at least gives you a path to pursue