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 is His slave and Messenger.
It is religiously permissible to endeavor to achieve the means of happiness in matters of religion and worldly affairs. Moreover, there are some means to achieve worldly happiness that are obligatory for a person to obtain, like faith and the obligatory good deeds, as these are amongst the most important reasons of achieving happiness.
Also, it is religiously permissible to endeavor to achieve things that are beneficial for a person in regard to the good of this worldly life and that of the Hereafter. However, one should not neglect doing good for others according to his ability, as this leads to his happiness as well.
The Prophet informed us in an authentic narration that the most beloved people to Allah, are the most beneficial to other people, and that the most beloved action to Allah, is making a fellow Muslim happy. The Prophet also informed us that he who relieves a hard-pressed person from a hardship he faces, Allah will make things easy for him in this world and the Hereafter, and that Allah supports a person as long as he supports his fellow Muslim.
Allah Knows best.