updated sql to handle currently open trips
added Date output to logging
handle open trips better
added Date output to logging