All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Whoever has not prayed the Thuhr (noon) prayer and enters the mosque and finds that the congregation is praying 'Asr (mid-afternoon), has to individually pray Thuhr first, and then pray 'Asr with the congregation if they have not yet finished the prayer; otherwise he should pray 'Asr individually, too.
It is permissible for him as well to join the congregation with the intention of Thuhr and then pray 'Asr later, as it is permissible for him to join the congregation with the intention of 'Asr and then make up the prayer of Thuhr, but the first option is more appropriate.
As regards whoever has already prayed Maghrib and enters the mosque and finds that the congregation is praying Maghrib, he should join the congregation with the intention of a supererogatory prayer. It is reported that two men were once traveling and did not pray with the congregation, and so the Prophet asked them as to why they did not pray with the congregation. They replied that they had already prayed during a rest-stop. He told them: "If you had already prayed during a rest-stop and then come to the mosque while the congregation is praying, then you should pray with them, and it will be considered as an optional prayer for you." [Ahmad, Abu-Daawood, At-Tirmithi and An-Nasaa'i]
As regards praying with your colleague, this is something permissible and it is considered as a form of charity from you. Imaam Ahmad reported that Abu Sa'eed Al-Khudri narrated that a man entered the mosque and found that the Prophet had concluded the prayer. So the Prophet said: "Is anyone prepared to give charity (i.e. by praying with this man)?" So a man among the congregation stood up and prayed with him.
Allaah Knows best.