page 50323 CustomerInfo
{
ApplicationArea = All;
Caption = 'CustomerInfo';
PageType = List;
SourceTable = Customer;
UsageCategory = Lists;
//InsertAllowed = true;
//Permissions = tabledata Customer = R;
InsertAllowed = true;
DeleteAllowed = true;
ModifyAllowed = true;
actions
{
area(Processing)
{
group(Home)
{
action(/Get Number to words/)
{
trigger OnAction()
var
myInt: Integer;
Words: Text;
begin
myInt := 45;
Words := ConvertNumberToWords(myInt);
MESSAGE('Number in Words: %1', Words);
end;
}
}
}
}
local procedure AmountToWords(Amount: Integer): Text
var
Word: Text;
begin
Word := FormatAmountInWords(Amount);
exit(Word);
end;
local procedure FormatAmountInWords(Amount: Integer): Text
var
WholePart: Integer;
FractionPart: Integer;
Words: Text;
begin
WholePart := Amount;
//FractionPart := Round((Amount - WholePart) * 100);
Words := ConvertNumberToWords(WholePart) + ' Rupees';
// if FractionPart > 0 then
// Words := Words + ' and ' + ConvertNumberToWords(FractionPart) + ' Paise';
exit(Words);
end;
local procedure ConvertNumberToWords(Number: Integer): Text
var
Units: array[19] of Text[10];
Tens: array[10] of Text[10];
Hundreds: array[5] of Text[10];
Result: Text;
HValue: Integer;
TValue: Integer;
begin
Units[0] := 'Zero';
Units[1] := 'One';
Units[2] := 'Two';
Units[3] := 'Three';
Units[4] := 'Four';
Units[5] := 'Five';
Units[6] := 'Six';
Units[7] := 'Seven';
Units[8] := 'Eight';
Units[9] := 'Nine';
Units[10] := 'Ten';
Units[11] := 'Eleven';
Units[12] := 'Twelve';
Units[13] := 'Thirteen';
Units[14] := 'Fourteen';
Units[15] := 'Fifteen';
Units[16] := 'Sixteen';
Units[17] := 'Seventeen';
Units[18] := 'Eighteen';
Units[19] := 'Nineteen';
Tens[2] := 'Twenty';
Tens[3] := 'Thirty';
Tens[4] := 'Forty';
Tens[5] := 'Fifty';
Tens[6] := 'Sixty';
Tens[7] := 'Seventy';
Tens[8] := 'Eighty';
Tens[9] := 'Ninety';
if Number < 20 then
Result := Units[Number]
else if (Number < 100) and (Number > 19) then
Result := Tens[Number DIV 10] + ' ' + Units[Number MOD 10]
else if (Number > 100) and (Number < 999) then
HValue := Number MOD 100;
Result := Units[Number DIV 100] + 'Hundred' + ConvertNumberToWords(HValue);
if (Number > 999) and (Number < 9999) then
TValue := Number MOD 1000;
HValue := HValue MOD 100;
Result := Units[Number DIV 1000] + 'Thousand' + ConvertNumberToWords(TValue) + ConvertNumberToWords(HValue);
exit(Result);
end;
}