'Amr bin Shu'aib narrated from his grandfather 'Abdullah bin 'Amr, that the Messenger of Allah (s.a.w) said:
"There are two traits, whoever has them in him, Allah writes him down as grateful and patient. And whoever does not have them, Allah does not write him down as grateful, nor patient. Whoever looks to one above him for his religion, and follows him in it, and whoever looks to one who is below him in worldly matters, and praises Allah for the blessings He has favored the one who is above him with, then Allah writes him down as grateful and patient. And whoever looks to one who is below him for his religion, and looks to one who is above him for worldly matters, and grieves over what missed him of it, Allah does not write him down as grateful nor as patient."(Another chain reaching to) 'Amr bin Shu'aib, from his father, from his grandfather from the Prophet (s.a.w) with similar narration.
English reference: Vol. 4, Book 11, Hadith 2512
Arabic reference: Book 37, Hadith 2701