All of this is pretty much what we call "spaghetti code"... 

I am not sure what should the flags 0,1,2 represent at all. What does it mean, when status is 0 or 1 or 2?

The fact is that rejected event should not be possible to go to approved or pending state for that matter. Once rejected, stays rejected!