Final db script and teeda's update on invoice