if you work with mysql 5 change in line 78...

tep_db_input($enddate) . "23:59:59

to (space before the 23:59:59)

tep_db_input($enddate) . " 23:59:59...

just a fix, spend a hour...

More...