Thursday, June 16, 2011

Crystal Report toWords() function display amount in words with decimal values


I have to display amount in Words with decimal values in my report for achieving this i wrote small formula in Crystal Report 

here is the formula:





numbervar Value;
numbervar deciValue;
Value:={ES_RPT_SP_AdvPaymentPRC;1.RECEIVED_AMOUNT};
deciValue:= Value- Truncate(Value);  //separate decimal value
Value := truncate(Value);
deciValue:= deciValue* 100;
if deciValue= 0 then
propercase(ToWords (Value,0) +' only')
else
propercase(ToWords (Value,0) + ' And '+ToWords(deciValue,0) + ' Paisas Only ')

here is the output for 2222.44

2 comments: