Talk to an attorney who deals with contractors. Our state requires licensure, so there is a lot of regulation surrounding it that a lawyer should be familiar with. Your state may have specific requirements for warranties.
A lot of what you ask about (terms & invoicing) is governed by the UCC...