adaption from https://github.com/krismp/angular-invoicing