Advertisement
Guest User

Untitled

a guest
Feb 27th, 2014
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. Public Function SpellNumberIND(ByVal Numb As Double) As String
  2. Dim intPoint As Integer
  3. Dim mantissa As Double
  4. Dim expo As Double
  5. Dim StrNum, strTemp As String
  6. Dim strLen As Integer
  7. Dim lenman As Integer
  8. Dim tempExpo As Integer
  9. StrNum = Format(Numb.ToString)
  10. If InStr(1, StrNum, "+") > 0 Then
  11. SpellNumberIND = "HUNDRED CRORE +"
  12. Exit Function
  13. End If
  14. strLen = Len(StrNum)
  15. intPoint = InStr(1, StrNum, ".")
  16. If intPoint = 0 Then GoTo expozero
  17. mantissa = Val(Mid(StrNum, 1, intPoint - 1))
  18. lenman = Len(Mid(StrNum, 1, intPoint))
  19. expo = Val(Mid(StrNum, lenman + 1, intPoint + 2))
  20. tempExpo = Left(expo, 2)
  21. strTemp = Mid(StrNum, lenman + 1, intPoint + 2)
  22. If LeftStr(strTemp, 1) <> "0" Then
  23. If Len(tempExpo.ToString) = 1 Then
  24. tempExpo = tempExpo & 0
  25. End If
  26. End If
  27. GoTo mantzero
  28. expozero:
  29. mantissa = StrNum
  30. mantzero:
  31. 'If frmNoToWords.chkPrefix.CheckState = CheckState.Checked Then
  32. If mantissa = 0 And expo = 0 Then
  33. 'MsgBox("ZERO AMOUNT")
  34. SpellNumberIND = "ZERO ONLY."
  35. Exit Function
  36. End If
  37. If mantissa = 0 And expo <> 0 Then
  38. SpellNumberIND = UCase(" PAISE" & ToWord(tempExpo) & " ONLY.")
  39. Exit Function
  40. End If
  41. If expo = 0 Then
  42. SpellNumberIND = UCase("RUPEES " & ToWord(mantissa) & " ONLY.")
  43. ElseIf expo <> 0 Then
  44. SpellNumberIND = UCase("RUPEES " & ToWord(mantissa) & "" & " AND" & IIf(tempExpo = 0, "", " PAISE " & ToWord(tempExpo) & "") & " ONLY.")
  45. Else
  46. SpellNumberIND = UCase("RUPEES " & ToWord(mantissa) & " ONLY.")
  47. End If
  48. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement