Automatically use the quote number as reference in the invoice

OK, how can I use this to print the quote number in the invoice template?