Unlike the Arab styling of numbers which places a comma on each thousand (1000’s), the Indian way of styling numbers is different and is used only by India, Nepal, Pakistan, Bangladesh and Sri Lanka.
Currently, NAV does not support the Indian Numbering Style on Reports or must I say that RDLC doesn’t have any provision.
The following piece of code enables you to format Amounts in Indian Style of Numbering.
______________________________________________________________________
Variables
Name | DataType | Subtype | Length |
AmtInText | Text | 50 | |
DecPlaces | Text | 3 | |
Stop | Boolean | ||
DummyAmt | Decimal | ||
DummAmtInText | Text | 50 | |
i | Integer | ||
DivBy | Integer |
_____________________________________________________________________
Code
Code
DecPlaces := ‘.00’;
AmtInText := FORMAT(Amt);
AmtInText := DELCHR(AmtInText,’=’,’,’);
IF STRPOS(AmtInText,’.’) 0 THEN BEGIN
AmtInText := COPYSTR(AmtInText,1,STRPOS(AmtInText,’.’)-1);
DecPlaces := COPYSTR(AmtInText,STRPOS(AmtInText,’.’),STRLEN(AmtInText));
END;
RetAmtVal := FORMAT(Amt);
RetAmtVal := DELCHR(RetAmtVal,’=’,’,’);
i := 1;
DivBy := 1000;
REPEAT
CLEAR(DummAmtInText);
CLEAR(DummyAmt);
IF i = 1 THEN BEGIN
DummyAmt := Amt/DivBy;
i +=1;
END ELSE BEGIN
DivBy := DivBy * 100;
DummyAmt := Amt/DivBy;
i +=1;
END;
IF DummyAmt < 1 THEN
Stop := TRUE
ELSE BEGIN
DummAmtInText := FORMAT(DummyAmt);
DummAmtInText := DELCHR(DummAmtInText,’=’,’,’);
IF STRPOS(DummAmtInText,’.’) 0 THEN
DummAmtInText := COPYSTR(DummAmtInText,1,STRPOS(DummAmtInText,’.’)-1);
RetAmtVal := INSSTR(RetAmtVal,’,’,STRLEN(DummAmtInText) + 1);
END;
UNTIL Stop;
RetAmtVal := RetAmtVal + DecPlaces;
AmtInText := FORMAT(Amt);
AmtInText := DELCHR(AmtInText,’=’,’,’);
IF STRPOS(AmtInText,’.’) 0 THEN BEGIN
AmtInText := COPYSTR(AmtInText,1,STRPOS(AmtInText,’.’)-1);
DecPlaces := COPYSTR(AmtInText,STRPOS(AmtInText,’.’),STRLEN(AmtInText));
END;
RetAmtVal := FORMAT(Amt);
RetAmtVal := DELCHR(RetAmtVal,’=’,’,’);
i := 1;
DivBy := 1000;
REPEAT
CLEAR(DummAmtInText);
CLEAR(DummyAmt);
IF i = 1 THEN BEGIN
DummyAmt := Amt/DivBy;
i +=1;
END ELSE BEGIN
DivBy := DivBy * 100;
DummyAmt := Amt/DivBy;
i +=1;
END;
IF DummyAmt < 1 THEN
Stop := TRUE
ELSE BEGIN
DummAmtInText := FORMAT(DummyAmt);
DummAmtInText := DELCHR(DummAmtInText,’=’,’,’);
IF STRPOS(DummAmtInText,’.’) 0 THEN
DummAmtInText := COPYSTR(DummAmtInText,1,STRPOS(DummAmtInText,’.’)-1);
RetAmtVal := INSSTR(RetAmtVal,’,’,STRLEN(DummAmtInText) + 1);
END;
UNTIL Stop;
RetAmtVal := RetAmtVal + DecPlaces;