Ответить на сообщение
Вернуться к теме
Вы отвечаете на сообщение:
ник: Seryoga204 Подскажите. для перевода чисел в прописные использую данный код
Function MoneyText(Digit0 As Currency, Currenc As String) As String b.Flag = 0 b.dd = "" b.Digit = Abs(Digit0) b.kop = CInt((b.Digit - Int(b.Digit)) * 100) b.kop2 = CInt((b.Digit - Int(b.Digit)) * 1000) b.Digit = Int(b.Digit) b.HungredMillion = Int(b.Digit / 100000000) b.d = b.HungredMillion * 100 GoSub Subr b.TenMillion = Int((Int(b.Digit / 1000000) - b.HungredMillion * 100) / 10) * 10 b.d = b.TenMillion GoSub Subr b.Million = Int(b.Digit / 1000000) - b.HungredMillion * 100 - b.TenMillion b.d = b.Million GoSub Subr If b.Million <> 0 Then b.d = b.Million * 1000000 Else If b.TenMillion <> 0 Then b.d = b.TenMillion * 10000000 Else If b.HungredMillion <> 0 Then b.d = b.HungredMillion * 100000000 End If End If End If GoSub Subr If b.Million <> 0 Then b.d = b.Million Else If b.TenMillion <> 0 Then b.d = b.TenMillion Else If b.HungredMillion <> 0 Then b.d = b.HungredMillion * 100 End If End If End If Select Case b.d Case 1 Case 2 To 4: b.dd = b.dd + "а" Case 5 To 20: b.dd = b.dd + "ов" Case Else Select Case b.d '- Int(b.d / 10) * 10 Case 0, 1 Case 2 To 4: b.dd = b.dd + "а" Case 5 To 20: b.dd = b.dd + "ов" Case Else: b.dd = b.dd + "ов" End Select End Select '-------1000---------- b.Thousand = Int(b.Digit / 100000) - Int(b.Digit / 1000000) * 10 b.d = b.Thousand * 100 GoSub Subr b.Hungred = Int(b.Digit / 1000) - b.Thousand * 100 - Int(b.Digit / 1000000) * 1000 If b.Hungred >= 20 Then b.d = Int(b.Hungred / 10) * 10 GoSub Subr 'b.d, b.Hungred, b.dd b.d = b.Hungred - b.d GoSub Subr 'b.d, b.Hungred, b.dd Else b.d = b.Hungred GoSub Subr End If b.d = b.Hungred * 1000 GoSub Subr Select Case b.Hungred Case 1: b.dd = b.dd + "а" Case 2 To 4 Select Case Currenc Case "USD", "RUR", "UAH", "BYR": b.dd = b.dd + "и" Case "грн", "грн0": b.dd = b.dd + "i" Case Else: b.dd = b.dd + "и" End Select Case 5 To 20 Case Else Select Case b.Hungred - Int(b.Hungred / 10) * 10 Case 1: b.dd = b.dd + "а" Case 2 To 4 Select Case Currenc Case "USD", "RUR", "UAH", "BYR": b.dd = b.dd + "и" Case "грн", "грн0": b.dd = b.dd + "i" Case Else: b.dd = b.dd + "и" End Select Case 5 To 20 End Select End Select If b.Thousand <> 0 And b.Hungred = 0 And b.Flag = 0 Then ' b.d = 10000 GoSub Subr End If b.dd2 = b.HungredMillion * 1000000 + b.TenMillion * 10000 + b.Million * 10000 + b.Thousand * 1000 + b.Hungred * 10 b.d2 = Int(b.Digit / 100) - b.dd2 b.d = b.d2 * 100 b.Hungred = -1 GoSub Subr ', b.Hungred, b.dd b.d1 = b.Digit - b.dd2 * 100 - b.d2 * 100 Select Case b.d1 Case 0: Select Case Currenc Case "USD": b.GrDop = " долларов " Case "RUR": b.GrDop = " рублей " Case "BYR": b.GrDop = " бел.рублей " Case "грн", "UAH": b.GrDop = " гривень " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case 1 b.d = Int(b.d1): b.Hungred = -1 GoSub Subr 'b.d, 1, b.dd Select Case Currenc Case "USD": b.GrDop = " доллар " Case "RUR": b.GrDop = " рубль " Case "BYR": b.GrDop = " бел.рубль " Case "грн", "UAH": b.GrDop = " гривня " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case 2 To 4 b.d = Int(b.d1): b.Hungred = -1 GoSub Subr 'b.d, 1, b.dd b.GrDop = " доллара " Select Case Currenc Case "USD": b.GrDop = " доллара " Case "RUR": b.GrDop = " рубля " Case "BYR": b.GrDop = " бел.рубля " Case "UAH": b.GrDop = " гривни " Case "грн": b.GrDop = " гривні " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case 5 To 10 b.Hungred = 0 b.d = Int(b.d1 / 10) * 10: GoSub Subr 'b.d, 0, b.dd b.Hungred = -1 b.d = b.d1 - b.d: GoSub Subr 'b.d, 1, b.dd Select Case b.d Case 0, Is >= 5 Select Case Currenc Case "USD": b.GrDop = " долларов " Case "RUR": b.GrDop = " рублей " Case "BYR": b.GrDop = " бел.рублей " Case "UAH", "грн": b.GrDop = " гривень " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case 1 Select Case Currenc Case "USD": b.GrDop = " доллар " Case "RUR": b.GrDop = " рубль " Case "BYR": b.GrDop = " бел.рубль " Case "UAH", "грн": b.GrDop = " гривня " Case Else: b.GrDop = " " + Currenc + " " End Select Case 2 To 4 Select Case Currenc Case "USD": b.GrDop = " доллара " Case "RUR": b.GrDop = " рубля " Case "UAH": b.GrDop = " гривни " Case "BYR": b.GrDop = " бел.рубля " Case "грн": b.GrDop = " гривні " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select End Select Case 11 To 19 b.d = b.d1 b.Hungred = 0 GoSub Subr 'b.d1, 0, b.dd Select Case Currenc Case "USD": b.GrDop = " долларов " Case "RUR": b.GrDop = " рублей " Case "BYR": b.GrDop = " бел.рублей " Case "UAH", "грн": b.GrDop = " гривень " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case Is > 19 b.d = Int(b.d1 / 10) * 10: b.Hungred = 0 GoSub Subr b.d = b.d1 - b.d GoSub Subr Select Case b.d Case 0, Is >= 5 Select Case Currenc Case "USD": b.GrDop = " долларов " Case "RUR": b.GrDop = " рублей " Case "BYR": b.GrDop = " бел.рублей " Case "UAH", "грн": b.GrDop = " гривень " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case 1 Select Case Currenc Case "USD": b.GrDop = " доллар " Case "RUR": b.GrDop = " рубль " Case "BYR": b.GrDop = " бел.рубль " Case "UAH", "грн": b.GrDop = " гривня " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select Case 2 To 4 Select Case Currenc Case "USD": b.GrDop = " доллара " Case "RUR": b.GrDop = " рубля " Case "BYR": b.GrDop = " бел.рубля " Case "UAH": b.GrDop = " гривни " Case "грн": b.GrDop = " гривні " Case "грн0": b.GrDop = " " Case Else: b.GrDop = " " + Currenc + " " End Select End Select End Select If b.Digit = 0 Then b.GrDop = "ноль " + b.GrDop b.Grv = b.dd '=========================Є®Їi©ЄЁ================================= b.kk = "" If Currenc = "USD" Or Currenc = "UAH" Or Currenc = "RUR" Or Currenc = "BYR" Or Currenc = "грн" Or Currenc = "грн0" Then If b.kop <> 0 Then b.kk = Mid(Str(b.kop), 2) If Len(b.kk) = 1 Then b.kk = "0" + b.kk If Len(b.kk) > 2 Then b.kk = Mid(b.kk, 1, 2) Else b.kk = "00" End If If Currenc = "USD" Then b.kk = b.kk + " центов " Else b.kk = b.kk + " коп." If Currenc = "USD" Then b.kk = b.kk + "США" Else If b.kop2 <> 0 Then b.kk = Mid(Str(b.kop2), 2) If Len(b.kk) = 1 Then b.kk = b.kk + "00" If Len(b.kk) = 2 Then b.kk = b.kk + "0" b.kk = b.kk + " коп." End If End If b.Grv = LTrim$(b.Grv) b.Grv = UCase$(Mid$(b.Grv, 1, 1)) + Mid$(b.Grv, 2) MoneyText = b.Grv + b.GrDop + b.kk Exit Function Subr: '===============S U B R ====================== 'If Currenc = "USD" Or Currenc = "RUR" Or Currenc = "UAH" Or Currenc = "BYR" Then If Currenc <> "грн" And Currenc <> "грн0" Then Select Case b.d Case 0: b.ds = "" Case 1: If b.Hungred = 0 Then b.ds = "один" Else b.ds = "одна" If Currenc = "UAH" Then b.ds = "одна" Case 2: If b.Hungred = 0 Then b.ds = "два" Else b.ds = "две" If Currenc = "UAH" Then b.ds = "две" Case 3: b.ds = "три" Case 4: b.ds = "четыре" Case 5: b.ds = "пять" Case 6: b.ds = "шесть" Case 7: b.ds = "семь" Case 8: b.ds = "восемь" Case 9: b.ds = "девять" Case 10: b.ds = "десять" Case 11: b.ds = "одинадцать" Case 12: b.ds = "двенадцать" Case 13: b.ds = "тринадцать" Case 14: b.ds = "четырнадцать" Case 15: b.ds = "пятнадцать" Case 16: b.ds = "шестнадцать" Case 17: b.ds = "семнадцать" Case 18: b.ds = "восемнадцать" Case 19: b.ds = "девятнадцать" Case 20: b.ds = "двадцать" Case 30: b.ds = "тридцать" Case 40: b.ds = "сорок" Case 50: b.ds = "пятьдесят" Case 60: b.ds = "шестьдесят" Case 70: b.ds = "семьдесят" Case 80: b.ds = "восемьдесят" Case 90: b.ds = "девяносто" Case 100: b.ds = "сто" Case 200: b.ds = "двести" Case 300: b.ds = "триста" Case 400: b.ds = "четыреста" Case 500: b.ds = "пятьсот" Case 600: b.ds = "шестьсот" Case 700: b.ds = "семьсот" Case 800: b.ds = "восемьсот" Case 900: b.ds = "девятьсот" Case 1000 To 999999: b.ds = "тысяч": b.Flag = -1 Case 1000000! To 1000000000# - 999 b.ds = "миллион" Case Is >= 1000000000#: b.ds = "миллард" End Select Else Select Case b.d Case 0: b.ds = "" Case 1: b.ds = "одна" Rem If b.Hungred = 0 Then b.ds = "одна" Else b.ds = "один" Case 2: b.ds = "двi" Case 3: b.ds = "три" Case 4: b.ds = "чотири" Case 5: b.ds = "п'ять" Case 6: b.ds = "шiсть" Case 7: b.ds = "сiм" Case 8: b.ds = "вiсiм" Case 9: b.ds = "дев'ять" Case 10: b.ds = "десять" Case 11: b.ds = "одинадцять" Case 12: b.ds = "дванадцять" Case 13: b.ds = "тринадцять" Case 14: b.ds = "чотирнадцять" Case 15: b.ds = "п'ятнадцять" Case 16: b.ds = "шiстнадцять" Case 17: b.ds = "сiмнадцять" Case 18: b.ds = "вiсiмнадцять" Case 19: b.ds = "дев'ятнадцять" Case 20: b.ds = "двадцять" Case 30: b.ds = "тридцять" Case 40: b.ds = "сорок" Case 50: b.ds = "п'ятьдесят" Case 60: b.ds = "шiстьдесят" Case 70: b.ds = "сiмдесят" Case 80: b.ds = "вiсiмдесят" Case 90: b.ds = "дев'яносто" Case 100: b.ds = "сто" Case 200: b.ds = "двiстi" Case 300: b.ds = "триста" Case 400: b.ds = "чотиреста" Case 500: b.ds = "п'ятсот" Case 600: b.ds = "шiстсот" Case 700: b.ds = "сiмсот" Case 800: b.ds = "вiсiмсот" Case 900: b.ds = "дев'ятсот" Case 1000 To 999999: b.ds = "тисяч" Case 1000000! To 1000000000# - 999: b.ds = "миллион" Case Is >= 1000000000#: b.ds = "миллард" End Select End If If b.ds <> "" Then b.dd = b.dd + " " + b.ds Return End Function
Ваше имя:
Пароль:
Сообщение:
Прикрепить:
Для вставки смайлов в текст щелкните по значку.