а... чего это, некропостим по-маленьку?
Код:

function levels {
#((n-10^k*(n//10^k))//(10^(k-1))
param ([decimal]$number, [int]$degree)
[decimal]::truncate(($number-([math]::pow(10,$degree))*
[decimal]::truncate($number/[math]::pow(10,$degree)))/
[math]::pow(10,$degree-1))
}
function Amount {
param ([bigint]$argument)
if($argument -lt -999999999999 -or $argument -gt 999999999999){
return $argument
} elseif ($argument -eq 0){
return 'ноль'
} elseif ($argument -lt 0){$argument=[bigint]::abs($argument);$m = 'минус '}
$arg1 = @('','один ','два ','три ','четыре ','пять ','шесть ','семь ','восемь ','девять ')
$arg2 = @('','десять ','двадцать ','тридцать ','сорок ','пятьдесят ','шестьдесят ',
'семьдесят ','восемьдесят ','девяносто ')
$arg3 = @('','сто ','двести ','триста ','четыреста ','пятьсот ','шестьсот ','семьсот ',
'восемьсот ','девятьсот ')
$arg4 = @('','одна ','две ','три ','четыре ','пять ','шесть ','семь ',
'восемь ', 'девять ')
$arg5 = @('десять ','одиннадцать ','двенадцать ','тринадцать ','четырнадцать ',
'пятнадцать ','шестнадцать ','семнадцать ','восемнадцать ','девятнадцать ')
$units = levels -n $argument -d 1
$dicker = levels -n $argument -d 2
$hundred = levels -n $argument -d 3
$thousand = levels -n $argument -d 4
$dicker_thousand = levels -n $argument -d 5
$hundred_thousand = levels -n $argument -d 6
$millions = levels -n $argument -d 7
$dicker_millions = levels -n $argument -d 8
$hundred_millions = levels -n $argument -d 9
$billions = levels -n $argument -d 10
$dicker_billions = levels -n $argument -d 11
$hundred_billions = levels -n $argument -d 12
$units_t = $arg1[$units]
switch -r ($dicker){
1 {$units_t = $arg5[$units]}
'[2-9]' {$dicker_t = $arg2[$dicker]}
}
$hundred_t = $arg3[$hundred]
switch -r ($thousand){
0 { if ($dicker_thousand -gt 0) { $thousand_t = $arg4[$thousand] + 'тысяч '}}
1 {$thousand_t = $arg4[$thousand] + 'тысяча '}
'[2-4]' {$thousand_t = $arg4[$thousand] + 'тысячи '}
'[5-9]' {$thousand_t = $arg4[$thousand] + 'тысяч '}
}
switch -r ($dicker_thousand){
1 {$thousand_t = $arg5[$thousand] + 'тысяч '; break}
'[2-9]' {$dicker_thousand_t = $arg2[$dicker_thousand]}
}
$hundred_thousand_t = $arg3[$hundred_thousand]
if (($dicker_thousand -eq 0) -and ($thousand -eq 0) -and ($hundred_thousand -gt 0)) {
$hundred_thousand_t = $hundred_thousand_t + 'тысяч '
}
switch -r ($millions) {
0{if($dicker_millions -gt 0){$millions_t=$arg1[$millions]+'миллионов '}}
1 {$millions_t = $arg1[$millions] + 'миллион '}
'[2-4]' {$millions_t = $arg1[$millions] + 'миллиона '}
'[5-9]' {$millions_t = $arg1[$millions] + 'миллионов '}
}
switch -r ($dicker_millions) {
1 {$millions_t = $arg5[$millions] + 'миллионов '; break}
'[2-9]' {$dicker_millions_t = $arg2[$dicker_millions]}
}
$hundred_millions_t = $arg3[$hundred_millions]
if (($dicker_millions -eq 0) -and ($millions -eq 0) -and ($hundred_millions -gt 0)) {
$hundred_millions_t = $hundred_millions_t + 'миллионов '
}
switch -r ($billions) {
0 {if($dicker_billions -gt 0){$billions_t=$arg1[$millions]+'миллиардов '}}
1 {$billions_t = $arg1[$billions] + 'миллиард '}
'[2-4]' {$billions_t = $arg1[$billions] + 'миллиарда '}
'[5-9]' {$billions_t = $arg1[$billions] + 'миллиардов '}
}
switch -r ($dicker_billions) {
1 {$billions_t = $arg5[$billions] + 'миллардов '; break}
'[2-9]' {$dicker_billions_t = $arg2[$dicker_billions]}
}
$hundred_billions_t = $arg3[$hundred_billions]
if (($dicker_billions -eq 0) -and ($billions -eq 0) -and ($hundred_billions -gt 0)) {
$hundred_billions_t = $hundred_billions_t + 'миллиардов '
}
$amount = $m+$hundred_billions_t+$dicker_billions_t+$billions_t+$hundred_millions_t+
$dicker_millions_t+$millions_t+$hundred_thousand_t+$dicker_thousand_t+$thousand_t+
$hundred_t+$dicker_t+$units_t
return $amount
}
amount $args[0]