Wednesday, June 26, 2013
Tuesday, June 11, 2013
CRYSTAL REPORTS - SHOW NUMBERS IN WORDS - IN LAKHS & CRORES FORMAT
We can use toWords() Function in crystal reports to show numbers in words. But it does not supports South Asian numbering system (in Lakh & Crore). The following Crystal reports function helps to show amounts in Lakh & Crore.
Create a new formula field and place following script in it.
numbervar pVal:=0;
numbervar Amount:=0;
numbervar frPart:=0;
stringvar InWords :="Rupees ";
Amount := 10000000.75; [Assign your amount here]
if Amount > 10000000 then pVal := truncate(Amount/10000000);
if Amount = 10000000 then pVal := 1;
if pVal = 1 then
InWords := InWords + " " + towords(pVal,0) + " crore"
else
if pVal > 1 then InWords := InWords + " " + towords(pVal,0) + " crores";
Amount := Amount - pVal * 10000000;
pVal := 0;
if Amount > 100000 then pVal := truncate(Amount/100000);
if Amount = 100000 then pVal := 1;
if pVal = 1 then
InWords := InWords + " " + towords(pVal,0) + " lakhs"
Else
If pVal > 1 then InWords := InWords + " " + ToWords(pVal,0) + " Lakhs";
Amount := Amount - pVal * 100000;
if Amount >= 1 then InWords := InWords + " " + towords(truncate(Amount),0);
frPart := (Amount - truncate(Amount)) * 100;
if frPart > 0 then
InWords := InWords + " and " + towords(frPart,0) + " paisa only"
else
InWords := InWords + " only";
ProperCase(InWords)
Create a new formula field and place following script in it.
numbervar pVal:=0;
numbervar Amount:=0;
numbervar frPart:=0;
stringvar InWords :="Rupees ";
Amount := 10000000.75; [Assign your amount here]
if Amount > 10000000 then pVal := truncate(Amount/10000000);
if Amount = 10000000 then pVal := 1;
if pVal = 1 then
InWords := InWords + " " + towords(pVal,0) + " crore"
else
if pVal > 1 then InWords := InWords + " " + towords(pVal,0) + " crores";
Amount := Amount - pVal * 10000000;
pVal := 0;
if Amount > 100000 then pVal := truncate(Amount/100000);
if Amount = 100000 then pVal := 1;
if pVal = 1 then
InWords := InWords + " " + towords(pVal,0) + " lakhs"
Else
If pVal > 1 then InWords := InWords + " " + ToWords(pVal,0) + " Lakhs";
Amount := Amount - pVal * 100000;
if Amount >= 1 then InWords := InWords + " " + towords(truncate(Amount),0);
frPart := (Amount - truncate(Amount)) * 100;
if frPart > 0 then
InWords := InWords + " and " + towords(frPart,0) + " paisa only"
else
InWords := InWords + " only";
ProperCase(InWords)
Thursday, June 6, 2013
ERROR - BulletedList and AJAX Toolkit
Error : Generation of designer file failed: The server tag 'asp:BulletedList' is ambiguous....
(if an Ajax Toolkit Manager and a BulletedList placed in same page(.aspx))
Reason: Same "TagPrefix" 'asp' to AJAX toolkit controls and ASP.NET controls
Solution:
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
//Modify like this.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajx" %>
<ajx:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajx:ToolkitScriptManager>
Subscribe to:
Posts (Atom)