Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'============================================================================================================
Function ChkAmount2Text(ByVal tnAmt As Decimal, Optional ByVal tcCurrency As String = "Dollars") As String
'============================================================================================================
' Purpose : Converts the given amount into a string.
' Description : Checks the given amount parameter for zero and less than one amounts, if so - formats the string and returns it.
' If 1 and greater, calls the NumberToText() to convert the integer part into a string and adds the decimals' string.
' Parameters : Amount to convert;
' Currency name.
' Returns : Formatted check amount .
' Side effects : None.
' Notes : 1. Generic.
' 2. Complies with .NET Framework ver. 1.1 and higher, .NET ver. Core 1.0 and higher.
' 3. No parameters' verification, presumed valid.
' 4. Calls the NumberToText() function to get the integral part.
' Author : Ilya I. Rabyy
' Revisions : by Ilya on 2024-12-11 - completed 1st draft.
'============================================================================================================
If tnAmt <= 0 Then
Return "0 and 00/100 " + tcCurrency
ElseIf Between(tnAmt, 0.00d, 0.99d) Then
tnAmt = Math.Round(tnAmt, 2)
Return "0 and " + Strings.Format(Int(tnAmt * 100), "00") + "/100 " + tcCurrency
End If
Dim lsRet As String = "", lsIntPart As String = "", lsDecimals As String = "", lnDecimals As Decimal
lsIntPart = NumberToText(Int(tnAmt))
lnDecimals = tnAmt - Int(tnAmt)
lsDecimals = Strings.Format(lnDecimals*100, "00") & "/100 " & tcCurrency
lsRet = lsIntPart + " and " + lsDecimals
Return lsRet
End Function
'============================================================================================================