2016-01-13 11:42
Nataly777
taip, ten dar Litus į EUR reikia pakeisti, bandžiau, bet kreivai gaunasi.
Kodas toks:
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 LITŲ "
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 = "LITŲ "
Case Else
Select Case v
Case "0"
r2 = "LITŲ "
Case "1"
r2 = "LITAS "
Case Else
r2 = "LITAI "
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