Hi, i am developing software in asp.net using vb coding and MS ACCESS database.
I created a crystal report for printing sales bill.
Now i need to convert currency into words and need to print. ex: 3,250 as "Three Thousand Two Hundred and Fifty only".
How can i write codings and make to print using crystal report.
Thanks in advance.
13 12470
Hi, i am developing software in asp.net using vb coding and MS ACCESS database.
I created a crystal report for printing sales bill.
Now i need to convert currency into words and need to print. ex: 3,250 as "Three Thousand Two Hundred and Fifty only".
How can i write codings and make to print using crystal report.
Thanks in advance.
crystal report has nothing to do your conversion.....you have to convert Currency in Words through code in your application....Then pass the string(e.g--"Three Thousand Two Hundred and Fifty only".) to crystal report as a parameter....
to convert your currency to word search google...many vb.net classes are available on NET for this conversion.....
Hi Perumal,
I used a formula field for this conversion. type the following code in it and try.
All the best. -
if Split (cstr(Sum ({ExportView.Amount})),".")[2]="00" then
-
-
{ExportView.CurrencyName} + " " + ToWords (Sum ({ExportView.Amount}),0) + " Only "
-
-
else
-
{ExportView.CurrencyName} + " " + ToWords (Sum ({ExportView.Amount}),0) + " and "
-
+ ToWords ((Round(Sum ({ExportView.Amount}),2)
-
- Int(Sum ({ExportView.Amount}))) * 100, 0) + " " + {ExportView.DecimalPart} + " only "
sudha
Hi Perumal,
i used a decimal number rounded to two decimal places and so used the above code which is perplexing. if you dont want to check the paise part ur code is like this. - "Rupees " + ToWords (Sum ({ExportView.Amount}),0) + " Only "
or else you find in the below url
"http://www.eggheadcafe.com/community/aspnet/14/10016490/convert-number-to-words.aspx"
with regards,
sudha
Hi Sudha,
Thanks for your reply.
I implemented your coding in my crystal report. but i am getting error in part + " " + before ToWords
And also i am not aware of Exportiew.Amount and ExportView.Currency.
could you please tell me the details of those fields.
Thanks.
Its working fine.
TRY THIS CODE -
if split(cstr({tablename.fieldname)),".")[2]="00" then
-
replace(ToWords({tablename.fieldname},0)+ " only","-"," ")
-
else
-
replace(ToWords(cdbl((tablename.fieldname})-cdbl(split(cstr({tablename.fieldname}),"."[2]/100),0) + " and " + ToWords(cdblsplit(cstr({tablename.fieldname}),"."[2]),0) + " paise only","-"," ")
Hi
I tried ur code and got error message as "The ) is missing". So, can u please tell me wat could be wrong.
Regards,
Pavithra.C
Hi pavithra,
Now try the following code -
if split(cstr({tablename.fieldname}),".")[2]="00" then
-
replace(ToWords({tablename.fieldname},0)+ " only","-"," ")
-
else
-
replace(ToWords(cdbl({tablename.fieldname})-cdbl(split(cstr({tablename.fieldname}),"."[2]/100),0)) + " and " + ToWords(cdblsplit(cstr({tablename.fieldname}),"."[2]),0) + " paise only","-"," ")
- if split(cstr({tablename.fieldname}),".")[2]="00" then
-
replace(ToWords({tablename.fieldname},0)+ " only","-"," ")
-
else
-
replace(ToWords(cdbl({tablename.fieldname})-cdbl(split(cstr({tablename.fieldname}),"."[2]/100),0)) + " and " + ToWords(cdblsplit(cstr({tablename.fieldname}),"."[2]),0) + " paise only","-"," ")
I have try your code but still there is error showing ) is missing out please sort out it's urgent
Hi
You try this code now -
if split(cstr({tablename.fieldname}),".")[2]="00" then replace(ToWords({tablename.fieldname},0)+" only","-"," ")
-
else
-
replace(Towords((cdbl({tablename.fieldname})-cdbl(split(cstr({tablename.fieldname}),".")[2])/100),0)+" and " +ToWords(cdbl(split(cstr({tablename.fieldname}),".")[2]),0)+" paise only","-"," ")
Hope it will work.
If not you just mail me to perumalvps@gmail.com
hai
I am santhanam
I need number to word convertion in crystal report for 100041.22
(one Lakh forty one and twentytwo only)
hai
I am santhanam
I need a code for number to word convertion for 100041.22
It is worthless to post now but still for the sake of others who come to this link on searching.
You can do the same in the code behind as follows for ASP.NET
ASPX page: - <form id="form1" runat="server">
-
<div>
-
<asp:TextBox ID="TextBox1" runat="server">
-
</asp:TextBox><asp:Button ID="Button1" runat="server" Text="Button" />
-
</div>
-
</form>
Code behind: - Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Response.Write(NumberToWords(CDbl(TextBox1.Text)))
-
End Sub
-
Public Function NumberToWords(ByVal OrigNum As Long) As String
-
'This function converts numbers to words. For example 101 -> One hundred and one
-
'It uses standard english notation and will only accept positive long numbers
-
Dim billionpart As Long
-
Dim millionpart As Long
-
billionpart = Int(OrigNum / 10000000)
-
millionpart = OrigNum Mod 10000000
-
NumberToWords = HundredsToWords(billionpart) & IIf(billionpart <> 0, " Crore", "")
-
If millionpart > 99 Then
-
NumberToWords = NumberToWords & IIf(millionpart <> 0 And billionpart <> 0, " ", "") & millionstowords(millionpart)
-
Else
-
NumberToWords = NumberToWords & IIf(millionpart <> 0 And billionpart <> 0, " and ", "") & millionstowords(millionpart)
-
End If
-
End Function
-
-
Public Function millionstowords(ByVal millionnumber As Long)
-
Dim millionpart As Long
-
Dim thousandpart As Long
-
millionpart = Int(millionnumber / 100000)
-
thousandpart = millionnumber Mod 100000
-
millionstowords = HundredsToWords(millionpart) & IIf(millionpart <> 0, " Lac", "")
-
If thousandpart > 99 Then
-
millionstowords = millionstowords & IIf(thousandpart <> 0 And millionpart <> 0, " ", "") & thousandstowords(thousandpart)
-
Else
-
millionstowords = millionstowords & IIf(thousandpart <> 0 And millionpart <> 0, " and ", "") & thousandstowords(thousandpart)
-
End If
-
End Function
-
-
-
Public Function thousandstowords(ByVal thousandnumber As Long) As String
-
Dim thousandpart As Long
-
Dim HundredPart As Long
-
HundredPart = thousandnumber Mod 1000
-
thousandpart = Int(thousandnumber / 1000)
-
thousandstowords = HundredsToWords(thousandpart) & IIf(thousandpart <> 0, " thousand", "")
-
If HundredPart > 99 Then
-
thousandstowords = thousandstowords & IIf(HundredPart <> 0 And thousandpart <> 0, " ", "") & HundredsToWords(HundredPart)
-
Else
-
thousandstowords = thousandstowords & IIf(HundredPart <> 0 And thousandpart <> 0, " and ", "") & HundredsToWords(HundredPart)
-
End If
-
End Function
-
-
-
Public Function HundredsToWords(ByVal HundredNumber As Long) As String
-
'This function converts a three digit long to the hundred wording
-
Dim TensPart As Long
-
Dim HundredPart As Long
-
TensPart = HundredNumber Mod 100
-
HundredPart = Int(HundredNumber / 100)
-
Select Case HundredPart
-
Case 0
-
HundredsToWords = TensToWords(TensPart)
-
Case Else
-
HundredsToWords = SingleToWord(HundredPart) & " Hundred" & IIf(TensPart <> 0, " and ", "") & TensToWords(TensPart)
-
End Select
-
End Function
-
-
-
Public Function TensToWords(ByVal TensNumber As Long) As String
-
'This function converts a two digit long to a two digit wording
-
Dim tens As Long
-
Dim Singles As Long
-
tens = Int(TensNumber / 10)
-
Singles = TensNumber Mod 10
-
Select Case tens
-
Case 0
-
TensToWords = SingleToWord(Singles)
-
Case 1
-
TensToWords = teens(TensNumber)
-
Case 2
-
TensToWords = "Twenty" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 3
-
TensToWords = "Thirty" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 4
-
TensToWords = "Fourty" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 5
-
TensToWords = "Fifty" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 6
-
TensToWords = "Sixty" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 7
-
TensToWords = "Seventy" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 8
-
TensToWords = "Eighty" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
Case 9
-
TensToWords = "Ninety" & IIf(Singles <> 0, " ", "") & SingleToWord(Singles)
-
End Select
-
End Function
-
-
-
Public Function SingleToWord(ByVal SingleDigit As Long) As String
-
Select Case SingleDigit
-
Case 1
-
SingleToWord = "One"
-
Case 2
-
SingleToWord = "Two"
-
Case 3
-
SingleToWord = "Three"
-
Case 4
-
SingleToWord = "Four"
-
Case 5
-
SingleToWord = "Five"
-
Case 6
-
SingleToWord = "Six"
-
Case 7
-
SingleToWord = "Seven"
-
Case 8
-
SingleToWord = "Eight"
-
Case 9
-
SingleToWord = "Nine"
-
Case 0
-
SingleToWord = ""
-
End Select
-
End Function
-
-
-
Public Function teens(ByVal TeenNumber As Long) As String
-
Select Case TeenNumber
-
Case 10
-
teens = "Ten"
-
Case 11
-
teens = "Eleven"
-
Case 12
-
teens = "Twelve"
-
Case 13
-
teens = "Thirteen"
-
Case 14
-
teens = "Fourteen"
-
Case 15
-
teens = "Fifteen"
-
Case 16
-
teens = "Sixteen"
-
Case 17
-
teens = "Seventeen"
-
Case 18
-
teens = "Eighteen"
-
Case 19
-
teens = "Nineteen"
-
End Select
-
End Function
-
As far as I tested it wont work over 999999999 (1 Hundred Crores) but you can modify it accordingly and set limitations
Modified from <link snipped>
See Ya!
Thx a lot CandorZ for writing whole code.it help a lot to me.
Here I have done this Code in C#.NET,hope it will help to others who wants code in C#. - Protected Sub Button1_Click(object sender, EventArgs e)
-
{
-
Response.Write(NumberToWords(CDbl(TextBox1.Text)));
-
}
-
-
Public string NumberToWords(Long OrigNum)
-
{
-
'This function converts numbers to words. For example 101 -> One hundred and one
-
'It uses standard english notation and will only accept positive long numbers
-
Long bilionpart;
-
Long millionpart;
-
-
billionpart = Convert.ToInt32(OrigNum / 10000000);
-
millionpart = OrigNum Mod 10000000;
-
NumberToWords = HundredsToWords(billionpart) & IIf(billionpart <> 0, " Crore", "")
-
If( millionpart > 99)
-
NumberToWords = NumberToWords & IIf(millionpart <> 0 And billionpart <> 0, " ", "") & millionstowords(millionpart);
-
Else
-
NumberToWords = NumberToWords & IIf(millionpart <> 0 And billionpart <> 0, " and ", "") & millionstowords(millionpart);
-
return NumberToWords;
-
}
-
-
Public void millionstowords(Long millionnumber)
-
{
-
Long millionpart;
-
Long thousandpart;
-
millionpart = Convert.ToInt32(millionnumber / 100000);
-
thousandpart = millionnumber Mod 100000;
-
millionstowords = HundredsToWords(millionpart) & IIf(millionpart <> 0, " Lac", "");
-
If (thousandpart > 99)
-
millionstowords = millionstowords & IIf(thousandpart <> 0 And millionpart <> 0, " ", "") & thousandstowords(thousandpart);
-
Else
-
millionstowords = millionstowords & IIf(thousandpart <> 0 And millionpart <> 0, " and ", "") & thousandstowords(thousandpart);
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ave |
last post by:
Hi
I am hoping someone can help me or even point me in the
right direction, this problem has been doing my head in,
I have a report which has 3 groups say currency, payment
method and bankable,...
|
by: oscar |
last post by:
is there a way of integrating mysql databases into the .net crystal reports?
in the report wizard i have options for sql databases, but nothing for
mysql. is there a plugin i'm missing for it?
...
|
by: John H. |
last post by:
Hi,
Why if set a DataTable in Crystal Report Net Table with method
SetDataSource, 'ReportDocument.SetDataSource(oDataTable)', lost the Number
and Currency format with the decimal digits and...
|
by: Zoury |
last post by:
Hi there ! :O)
I'm having a two strange behaviors with Crystal Report which seems to have
the same cause..
All the fields used in the reports comes from some SQL Server views.
*** 1st...
|
by: blackdevil1979 |
last post by:
Hello,
Is there a way to format the data when it is passed into the Crystal
Report(CR).. for example.. In the original table, a number may be
left aligned, how to change it to right alignment?.....
|
by: Agnes |
last post by:
I got this error when I preview report in Vb.net "Unknown query Engine
Error"
Is that my crystal report got something wrong ???
or my SQL server is too slow to response ??
Thanks a lot
From...
|
by: jmar |
last post by:
I posted a week ago and received one response. I'm looking for the
opinion of several experienced .NET people before I proceed so I'm
posting again. Sorry for the repost...
I am updating a...
|
by: LataChavan |
last post by:
I have tried to look for a solution to the problem of sending parameters to stored procedures through crystal report.
Following is the code:
Now what happens is that if i do not apply the logon...
|
by: amiga500 |
last post by:
Hello,
I am developing a crystal report called Expense Report (I am not an
expert Crystal Report designer) if someone could help me in this
problem I would be greatly appreciate it. The report...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |