He bought the gun a month ago. That’s when a “plan” began.
The plan started when he was denied and then had to fight for leave to go home to bury his mother. And then I bet they did not want to pay for his leave because it happened when BamBam shut down the government or due to sequestration which is the excuse for a lot of things. I am guessing, of course.
Self-styled mujahadeen do not leave people guessing about their motives. Hassan made his motives quite explicit before he bought his weapons and after his terrorist atrocity - even if he had died in the process. The media uncovered a ton of evidence about him even before it was clear that he would survive.