Eligibility for Gratuity Based on Service Continuity
It depends on the second appointment order. If the service continuity (earlier from 15th June 2012) is acknowledged in the second appointment (normally by a change of management, do mention a clause about the service continuity), he has completed five years of continuous service and is eligible for Gratuity. If the clause is not mentioned, you are not eligible. You should have clarified this at the time of receiving the ABC appointment order.
However, if you have proper evidence and can present it before the Controller under the Payment of Gratuity Act that both XYZ company and ABC company are one and the same, and the owners/proprietors/directors are the same, and the name of the company has been changed for other reasons, you may have the case to your advantage.