[#31] generate an invoice on activity page and save it to system, refactor invoice to generate id before insert