예제 #1
0
 def rubles(self, sum):
     "Transform sum number in rubles to text"
     text_rubles = numeral.rubles(int(sum))
     copeck = round((sum - int(sum)) * 100)
     text_copeck = numeral.choose_plural(
         int(copeck), (u"копейка", u"копейки", u"копеек"))
     return ("%s %02d %s") % (text_rubles, copeck, text_copeck)
예제 #2
0
def rubles(amount, zero_for_kopeck=False):
    """Converts float value to in-words representation (for money)"""
    try:
        res = numeral.rubles(amount, zero_for_kopeck)
    except Exception, err:
        # because filter must die silently
        res = default_value % {'error': err, 'value': str(amount)}
예제 #3
0
def rubles(amount, zero_for_kopeck=False):
    """Converts float value to in-words representation (for money)"""
    try:
        res = numeral.rubles(amount, zero_for_kopeck)
    except Exception, err:
        # because filter must die silently
        res = default_value % {'error': err, 'value': str(amount)}
예제 #4
0
파일: documents.py 프로젝트: Ratmir15/hz
def generateNakl(order, order_date, order_price, request, t):
    template_filename = 'torg12_0.xls'
    fullname = str('ООО санаторий "Хопровские зори"')
    vendor = str('КПП 581701001 ') + fullname + str(' Пензенская обл., п.Колышлей, ул.Лесная 1а')
    if order.patient.address is None:
        client = order.patient.fio()
    else:
        client = order.patient.fio() + ',' + order.patient.address
    dir = gavnetso.getEmployerByRoleNameAndDate('Директор', order.start_date).__unicode__()
    gb = gavnetso.getEmployerByRoleNameAndDate('Главный бухгалтер', order.start_date).__unicode__()
    kassir = gavnetso.getEmployerByRoleNameAndDate('Кассир', order.start_date).__unicode__()
    rub = numeral.rubles(float(order_price), True)
    tel = {'PORTRAIT': False, 'NUMPAGES': 1, 'PIZDEZ': fullname, 'NUMBER': order.code,
           'FILENAME': 'nakladnaya-' + str(order.code),
           'CLIENT': client, 'VENDOR': vendor,
           'DIRECTOR': dir,
           'GBUH': gb,
           'KASSIR': kassir,
           'SP': rub,
           'DATE': order_date,
           'QTYSUM': 1,
           'AMOUNTSUM': order_price,
           'AMOUNTNDSSUM': order_price, 'ALLAMOUNTSUM': order_price,
           'TOVAR': t}
    return fill_excel_template(template_filename, tel, request)
예제 #5
0
def rubles(amount, zero_for_kopeck=False):
    """Converts float value to in-words representation (for money)"""
    try:
        ures = numeral.rubles(amount, zero_for_kopeck)
        res = pseudo_str(ures, encoding, default_value)
    except Exception, err:
        # because filter must die silently
        res = default_value % {"error": err, "value": str(amount)}
예제 #6
0
 def spellTotal(total):
     template = u"{rubles} {kopnum:02d} {kopstr}"
     from pytils import numeral
     n = {}
     n['rubles'] = numeral.rubles(int(total)).capitalize()
     n['kopnum'] = int(total * 100) - int(total) * 100
     n['kopstr'] = numeral.choose_plural(
         n['kopnum'], (u"копейка", u"копейки", u"копеек"))
     return template.format(**n)
예제 #7
0
def _get_amount_in_words(self, cr, uid, ids, field_name, arg, context=None):
    res = {}

    for row in self.browse(cr, uid, ids, context):
        rubles = numeral.rubles(int(row.amount_total))
        copek_num = round(row.amount_total - int(row.amount_total))
        copek = numeral.choose_plural(int(copek_num), (u"копейка", u"копейки", u"копеек"))
        res[row.id] = ("%s %02d %s")%(rubles, copek_num, copek)

    return res
예제 #8
0
 def spellTotal(total):
     template = u"{rubles} {kopnum:02d} {kopstr}"
     from pytils import numeral
     n = {}
     n['rubles'] = numeral.rubles(int(total)).capitalize()
     n['kopnum'] = int(total * 100) - int(total)*100
     n['kopstr'] = numeral.choose_plural(
             n['kopnum'], 
             (u"копейка", u"копейки", u"копеек")
             )
     return template.format(**n)
예제 #9
0
 def get_rubles(self):
     return rubles(self.pay, True)
예제 #10
0
def print_(s):
    # pytils всегда возвращает юникод (строка в Py3.x)
    # обычно это ОК выводить юникод в терминал
    # но если это неинтерактивный вывод
    # (например, использования модуля subprocess)
    # то для Py2.x нужно использовать перекодировку в utf-8
    from pytils.third import six
    if six.PY3:
        out = s
    else:
        out = s.encode('UTF-8')
    print(out)


# rubles служит для формирования строк с деньгами

print_(numeral.rubles(10))
#-> десять рублей

# если нужно, то даже 0 копеек можно записать словами
print_(numeral.rubles(10, zero_for_kopeck=True))
#-> десять рублей ноль копеек

print_(numeral.rubles(2.35))
#-> два рубля тридцать пять копеек

# в случае чего, копейки округляются
print_(numeral.rubles(3.95754))
#-> три рубля девяносто шесть копеек
예제 #11
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pytils import numeral

# rubles служит для формирования строк с деньгами :)

print numeral.rubles(10)
#-> десять рублей

# если нужно, то даже 0 копеек можно записать словами
print numeral.rubles(10, zero_for_kopeck=True)
#-> десять рублей ноль копеек

print numeral.rubles(2.35)
#-> два рубля тридцать пять копеек

# в случае чего, копейки округляются
print numeral.rubles(3.95754)
#-> три рубля девяносто шесть копеек
예제 #12
0
def rubles(self, sum):
    "Transform sum number in rubles to text"
    text_rubles = numeral.rubles(int(sum))
    copeck = round((sum - int(sum))*100)
    text_copeck = numeral.choose_plural(int(copeck), (u"копейка", u"копейки", u"копеек"))
    return ("%s %02d %s")%(text_rubles, copeck, text_copeck)
예제 #13
0
파일: pdf.py 프로젝트: kataev/bkz
 def rubles(self):
     return rubles(self.in_total)
예제 #14
0
def print_(s):
    # pytils всегда возвращает юникод (строка в Py3.x)
    # обычно это ОК выводить юникод в терминал
    # но если это неинтерактивный вывод
    # (например, использования модуля subprocess)
    # то для Py2.x нужно использовать перекодировку в utf-8
    from pytils.third import six
    if six.PY3:
        out = s
    else:
        out = s.encode('UTF-8')
    print(out)


# rubles служит для формирования строк с деньгами

print_(numeral.rubles(10))
#-> десять рублей

# если нужно, то даже 0 копеек можно записать словами
print_(numeral.rubles(10, zero_for_kopeck=True))
#-> десять рублей ноль копеек

print_(numeral.rubles(2.35))
#-> два рубля тридцать пять копеек

# в случае чего, копейки округляются
print_(numeral.rubles(3.95754))
#-> три рубля девяносто шесть копеек