Allah has told us in the Quran that whatever calamity befalls on us it is due to our sins. but at other side is the hadith which says that when calamity befalls on you say 'qadarallhu wa ma shaa a fala'.And this hadith also tells us that 'if any difficuly or calamity befalls on you then don’t say as “if i did this then this might happen for it will pave the way for shaytan”. So is the calamity is due to our sins as mentioned in the Quran or are we destined for it as projected in hadith . for example if I applied for a job and despite my utmost effort I am not selected for that then this is it due to my sins or I was destined for it .
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
There is no contradiction between the Book of Allah and the Sunnah of His Prophet . Whatever strikes us of disaster, it is due to the sins that we have earned. Also, it occurs according to the Preordainments that Allah, The Almighty, has decreed. Allah, The Almighty, has linked the causes such as sins with their effects which are the disasters related to religion and worldly life. Disasters related to religion are like the other sins caused by the previous sins. Disasters related to the worldly life are like losing one's child, wealth, crop and the like. Allah, The Almighty, says (what means): {And whatever strikes you of disaster - it is for what your hands have earned; but He pardons much.} [Quran 42:30]
Ibn Al-Qayyim said in Shifaa' Al-‘Aleel: "If Allah, The Almighty, by saying (what means): {But what comes to you of evil, [O man], is from yourself.}[Quran 4:79], has made the evil (that befalls one) a punishment of the sin that the slave does; then the deed that entailed punishment is more appropriate to have been done by the slave himself. Thus, there is no contradiction that evil and punishment come from the person himself. Also, there is no contradiction that all of them occur according to the Decree and Preordainment of Allah, The Almighty. However, coming from Allah, they all imply justice, wisdom and goodness to the slave; and coming from the slave, they all imply sin and evil." [End quote]
As for not being accepted in the job you have applied for and that you have used all the possible means to get it, this may be due to a previous sin and may also be due to other causes than sins, such as testing your patience, or that this work may involve evils that you do not know about and thus, Allah, The Almighty, has kept you away from it.
The most important thing is to know that Allah, The Almighty, has linked causes to effects for great wisdoms: we may know some of them but we may not know most of them. So, we are to strive to do what will benefit us and seek the help of Allah, and not feel helpless. If anything befalls anyone of us, let him not say ‘If only I had done (such and such), then such and such would have happened,’ rather he should say: ‘Allah has decreed and what He wills He does,’ for ‘if only’ opens the door to the work of the Shaytaan (devil)”; meaning it causes sadness and fear that harm and do not benefit at all; rather, you have to believe that "Whatever befalls you could not have missed you and whatever missed you could not have befallen you," as the Prophet stated. [Muslim]
Allah Knows best.
You can search for fatwa through many choices