some refactoring of invoice printing code
Add support to overwrite an existing invoice
Add support to print an invoice directly from the invoice edit page