You should read a book on basic business bookkeeping, or consult with a bookkeeper.
I use OnTheJob (Mac only) to track my time & issue invoices. It or similar software will be helpful. There's lots of web apps out there now that do the same thing.
When you want advance payment, you should invoice your client specifically for a retainer. You should generally also have given them an itemized estimate at that point.
At the end of the job, you issue an invoice detailing the work done (ie. explain what they're paying for: general job areas such as design, production, etc. is sufficient, along with time spent, and any expenses), and apply a positive credit for the amount of the retainer, reducing the total invoice to the amount outstanding.
You should also speak to a bookkeeper or accountant about what you need to do to be legit regarding your taxes.
I use On the Job (Mac-only, unfortunately), which keeps track of my time as I work (stoping automatically if I walk away from my Mac for a specified period) and outputs time to a nice invoice manager (which I've yet to use, but seems to work well).
I use On the Job. It's got a great interface for invoicing and tracking. But it's a breeze to start-up and turn-off. In fact, it's in my menu bar waiting for my return to productivity as we speak.
I use a mac program called On The Job I had a hard time with the web based solitons like harvest or the self-hosted pancake app - I just felt like they made me click too much and jump through too many hoops to change jobs or clients or manually input time/quantaties/hourly rates. OTJ is super simple, makes nice invoices, and is only a one time fee.
I use On the Job for Mac - http://stuntsoftware.com/onthejob
It's folder based so it's up to you to organize clients, invoices, and time sheets. I organize by Client then individual folders for each year, and in each year are invoices and time sheets.