converted to stored proc
improved usibility of date selection