Move repeat login into page instead of template.
Use invoice id instead of invoice_num.