How can I create complex math logic in FreshBooks integration or another automated invoicing solution?