As you mentioned that "a person worked for two years in a company and left. He joins back and works for eight years." Obviously, once any employee leaves the company, he/she ceases to be an employee of the company. However, ensure that the company has a valid resignation copy of the employee and all F&F procedures completed when he left the company after two years. If the company has a valid resignation and F&F documents and the new joining procedures are done, then definitely you have to pay only 8 years of Gratuity from the date of the new joining to the new resignation date.