If your Residence Permit is expired, then you have 90 days to get it renewed.

If your Residence Permit is cancelled, then you have 07 days, means you should leave Qatar within 07 days from the date of RP cancellation.

If your Work Visa approval is expired, then the sponsor/employer should get it extended and then renew the RP.