Nikki rašė:
RADAU :) Viskas puikiai veikia. Gal kam nors prireiks:
Function Suma_zodziais(NumberArg As Double, Optional intCase As Integer = 0) As String
Dim strSuma As String
Dim strMilijonai As String
Dim strTukstanciai As String
Dim strSimtai As String
Dim m1 As String
Dim m2 As String
Dim t1 As String
Dim t2 As String
Dim r1 As String
Dim r2 As String
Dim v As String
Dim d As String
Dim strRezultatas As String
strSuma = Format(NumberArg, "000,000,000.00")
strMilijonai = Mid(strSuma, 1, 3)
strTukstanciai = Mid(strSuma, 5, 3)
strSimtai = Mid(strSuma, 9, 3)
If NumberArg < 1 Then
strRezultatas = "NULIS EURØ "
GoTo pabaiga
End If
If strMilijonai <> "000" Then
m1 = TrysSkaitmenys(strMilijonai)
d = Mid(strMilijonai, 2, 1)
v = Right(strMilijonai, 1)
Select Case d
Case "1"
m2 = "MILIJONØ "
Case Else
Select Case v
Case "0"
m2 = "MILIJONØ "
Case "1"
m2 = "MILIJONAS "
Case Else
m2 = "MILIJONAI "
End Select
End Select
End If
If strTukstanciai <> "000" Then
t1 = TrysSkaitmenys(strTukstanciai)
d = Mid(strTukstanciai, 2, 1)
v = Right(strTukstanciai, 1)
Select Case d
Case "1"
t2 = "TÛKSTANÈIØ "
Case Else
Select Case v
Case "0"
t2 = "TÛKSTANÈIØ "
Case "1"
t2 = "TÛKSTANTIS "
Case Else
t2 = "TÛKSTANÈIAI "
End Select
End Select
End If
r1 = TrysSkaitmenys(strSimtai)
d = Mid(strSimtai, 2, 1)
v = Right(strSimtai, 1)
Select Case d
Case "1"
r2 = "EURØ "
Case Else
Select Case v
Case "0"
r2 = "EURØ "
Case "1"
r2 = "EURAS "
Case Else
r2 = "EURAI "
End Select
End Select
strRezultatas = m1 + m2 + t1 + t2 + r1 + r2 + " "
pabaiga:
Select Case intCase
Case 0
Suma_zodziais = UCase(Left(strRezultatas, 1)) + LCase(Mid(strRezultatas, 2)) + Right(strSuma, 2) + " ct"
Case 1
Suma_zodziais = UCase(strRezultatas + Right(strSuma, 2) + " ct")
Case 2
Suma_zodziais = LCase(strRezultatas + Right(strSuma, 2) + " ct")
End Select
End Function
Private Function TrysSkaitmenys(strNum3 As String) As String
Dim s1 As String * 1 'ðimtai
Dim d1 As String * 1 'deðimtys
Dim d2 As String * 2 'deðimtys ir vienetai
Dim v1 As String * 1 'vienetai
Dim s3 As String
Dim v3 As String
s1 = Left(strNum3, 1)
d1 = Mid(strNum3, 2, 1)
d2 = Mid(strNum3, 2, 2)
v1 = Right(strNum3, 1)
Select Case s1
Case "1"
s3 = "VIENAS ÐIMTAS "
Case "2"
s3 = "DU ÐIMTAI "
Case "3"
s3 = "TRYS ÐIMTAI "
Case "4"
s3 = "KETURI ÐIMTAI "
Case "5"
s3 = "PENKI ÐIMTAI "
Case "6"
s3 = "ÐEÐI ÐIMTAI "
Case "7"
s3 = "SEPTYNI ÐIMTAI "
Case "8"
s3 = "AÐTUONI ÐIMTAI "
Case "9"
s3 = "DEVYNI ÐIMTAI "
End Select
Select Case d1
Case "1"
Select Case d2
Case "10"
d3 = "DEÐIMT "
Case "11"
d3 = "VIENUOLIKA "
Case "12"
d3 = "DVYLIKA "
Case "13"
d3 = "TRYLIKA "
Case "14"
d3 = "KETURIOLIKA "
Case "15"
d3 = "PENKIOLIKA "
Case "16"
d3 = "ÐEÐIOLIKA "
Case "17"
d3 = "SEPTYNIOLIKA "
Case "18"
d3 = "AÐTUONIOLIKA "
Case "19"
d3 = "DEVYNIOLIKA "
End Select
Case "2"
d3 = "DVIDEÐIMT "
Case "3"
d3 = "TRISDEÐIMT "
Case "4"
d3 = "KETURIASDEÐIMT "
Case "5"
d3 = "PENKIASDEÐIMT "
Case "6"
d3 = "ÐEÐIASDEÐIMT "
Case "7"
d3 = "SEPTYNIASDEÐIMT "
Case "8"
d3 = "AÐTUONIASDEÐIMT "
Case "9"
d3 = "DEVYNIASDEÐIMT "
End Select
If d1 <> "1" Then
Select Case v1
Case "1"
v3 = "VIENAS "
Case "2"
v3 = "DU "
Case "3"
v3 = "TRYS "
Case "4"
v3 = "KETURI "
Case "5"
v3 = "PENKI "
Case "6"
v3 = "ÐEÐI "
Case "7"
v3 = "SEPTYNI "
Case "8"
v3 = "AÐTUONI "
Case "9"
v3 = "DEVYNI "
End Select
End If
TrysSkaitmenys = s3 + d3 + v3
End Function
Sitas geras, tik nepamirskyte sulietuvinti ;)
Jeigu tiesiog nukopinsite, nebus lietuvisku raidziu....