Sorry for not responding earlier...been on leave.
I think you want tomething like this... I haven't exactly tested this thoroughly, but off the top of my head, you want to call this function, passing in the date (and time) of the ticket dispatch, and the severity level as a number, e.g...