function - display company name based on selected contact

function - display company name based on selected contact

Hi,
The quotes module which is part of the crm has some tabs which I cannot remove so I've decided to create my own module similar to the quotes.
I have created and added all the necesary fields.
Now my issues is when I select the contact person it doesn't automatically lookup for the company to which the account belongs.

I have been looking all over trying to understand how to do the same function to pickup the company in lookup field when a contact is selected, and I have no been able to understand this yet.

Can anyone please give a bit of help here how the function code should look like?

Thank you