instead of rebuilding the wheel so to speak
this website has numerous free templates
http://www.vertex42.com/Calculators/...lculators.html

im sure you can find something there you can use or base off