Multi-Currency Converter Component

If you use multi-currency in your Salesforce instance and need a specific amount shown in your email templates, you may create a Salesforce Component to do the job.

public class currencyComponentController {
    public String RecordId{get; set;}
    public String ObjectName{get;set;}
    public String FieldName{get;set;}
    public Decimal getConvertedAmount() {
        try{
            SObject obj = Database.query('Select convertCurrency(' + FieldName + ') From ' + objectName + ' Where Id='' + RecordId +'' Limit 1');
            return (Decimal)obj.get('Total_Amount__c');
        }catch(Exception e){
            return 0;
        }

    }
}