Handle NULL tkt
Streamlined logic.
Used table variable for testing to take advantage of intellisense (not available on remote db connection).
added filters to query.
Do not use this. From now on use the - perm tables - version