Even when paying the ex-gratia, you should be very careful. Bonus is a statutory obligation; hence, whether your company is running with profits or losses, you should pay a minimum bonus, but not in the case of ex-gratia. Unfortunately, there is a critical word in English - "practice" - that plays a vital role. Therefore, when you are paying the ex-gratia, you should take an undertaking from each employee that they should not quote this as a precedent and demand the same next year.
If the company is profitable, they will pay the ex-gratia, but unlike the bonus, there is no obligation for ex-gratia.
Regards,
Kamesh