MT#5879 Attempt to fix invoice/template

Also configuration of cancel button on confirm modal.
Fix contract-balance getting.
Fix page numbers in generated invoice.