Exemple #1
0
def timeformat(value):

    if value == '':
        return ''

    if value is None:
        return '0s'
    if value < 60:
        return '%ss' % intcomma(int(value))
    # less than 1 hour
    elif value < 3600:
        v = int(value / 60)
        return '%sm' % intcomma(v)
    # less than 1 day
    # elif value < 86400:
    #    v = int(value/3600)
    #    return '%sh' % intcomma(v)
    # less than a month
    # elif value < 2592000:
    #    v = int(value/86400)
    #    return '%sd' % intcomma(v)
    # less than 1 year
    # elif value < 31104000:
    #    v = int(value/2592000)
    #    return '%smonth' % intcomma(v)
    else:
        v = int(value / 3600)
        return '%sh' % intcomma(v)
    def create_release_notes_file(self):
        """
        ===================================================================
        RNAcentral Release {release_date}
        ===================================================================

        RNAcentral is an online resource for organising data
        about non-protein coding RNA genes.

        This release consists of {sequence_count} unique RNA sequences
        with {xrefs_count} cross-references to {database_count} Expert Databases.

        The release data are stored in subdirectories in this folder. Large data files
        are compressed with Gzip. Small uncompressed example files are also provided.
        Each folder contains a readme file with data description.

        RNAcentral is available online at http://rnacentral.org.
        For more ways of downloading the data go to http://rnacentral.org/downloads.
        """
        text = self.create_release_notes_file.__doc__
        text = self.format_docstring(text)

        release_date = time.strftime("%d/%m/%Y")
        sequence_count = intcomma(Rna.objects.count())
        xrefs_count = intcomma(Xref.objects.count())
        database_count = intcomma(Database.objects.count())

        text = text.format(release_date=release_date,
                           sequence_count=sequence_count,
                           database_count=database_count,
                           xrefs_count=xrefs_count)
        f = open(self.get_output_filename('release_notes_template.txt'), 'w')
        f.write(text)
        f.close()
Exemple #3
0
def venue_map_data(request):
    venue_set = Venue.objects.exclude(ltlng='')
    venue_set = [v for v in venue_set if v.shows.all()]
    venues = sorted(venue_set, key=lambda v: v.first_show)
    venue_data = []
    for venue in venues:
        venue_ltlng = list([float(x) for x in venue.ltlng.split(',')])
        venue_image_url = None
        venue_net = 0
        venue_average = 0
        shows = venue.shows.all()
        net_shows = [show for show in shows if show.net]
        if venue.venue_image:
            venue_image_url = venue.venue_image.url
        if net_shows:
            venue_net = int(sum([show.net for show in net_shows]))
            venue_average = int(sum([show.net for show in net_shows])) / len(net_shows)
        venue_data.append({
            'coordinates': venue_ltlng,
            'name': venue.venue_name,
            'city': venue.city,
            'state': venue.state,
            'image': venue_image_url,
            'shows': [show.date.strftime('%m/%d/%Y') for show in shows],
            'net_display': intcomma(venue_net),
            'net': max(venue_net, 0),
            'average': max(venue_average, 0),
            'average_display': intcomma(venue_average),
            'num_shows': len(shows),
            'first_show_year': venue.first_show_year
        })

    return HttpResponse(json.dumps(venue_data), content_type="application/json")
Exemple #4
0
def growth(object, attr):
    word = " points" if attr[:4] != "size" else " roids"
    diff = getattr(object, attr+"_growth") or 0
    pc = str(round(getattr(object, attr+"_growth_pc") or 0,1)) + "%"
    ret = '<div class="growth_%s">%s</div>'
    ret = ret*2 %("pc", change(pc, diff, intcomma(diff)+word), "diff", change(intcomma(diff), diff, pc),)
    return ret
Exemple #5
0
 def get_current_sum_display(self):
     if self.current_sum < 0:
         return '<span class="txt-color-green">{}</span>'.format(intcomma(floatformat(-self.current_sum, 2)))
     elif self.current_sum > 0:
         return '<span class="txt-color-red">{}</span>'.format(intcomma(floatformat(-self.current_sum, 2)))
     else:
         return '0.00'
Exemple #6
0
def fund_transaction(request, FundModel, transaction_flow='in', delta_days=0):
    transaction_flow = (0 if transaction_flow == 'in' else (1 if transaction_flow == 'out' else 3))
    FundModel = Fund(FundModel)
    if delta_days > 0:
        today = date.today() + timedelta(days=1)
        delta = timedelta(days=delta_days)
        past = today - delta
        if transaction_flow < 2:  # transaction in
            result = FundModel.objects.filter(done_at__lte=today, done_at__gt=past, transaction=transaction_flow).aggregate(total=Sum('value'))['total']
            result = result if result else 0
            return intcomma(result)
        else:  # balance inquiry
            total_in = FundModel.objects.filter(done_at__range=(past, today), transaction=0).aggregate(total=Sum('value'))['total']
            total_out = FundModel.objects.filter(done_at__range=(past, today), transaction=1).aggregate(total=Sum('value'))['total']
            total_in = total_in if total_in else 0
            total_out = total_out if total_out else 0
            return intcomma(total_in - total_out)

    else:
        if transaction_flow < 2:  # transaction in
            result = FundModel.objects.filter(transaction=transaction_flow).aggregate(total=Sum('value'))['total']
            result = result if result else 0
            return intcomma(result)
        else:  # balance inquiry
            total_in = FundModel.objects.filter(transaction=0).aggregate(total=Sum('value'))['total']
            total_out = FundModel.objects.filter(transaction=1).aggregate(total=Sum('value'))['total']
            total_in = total_in if total_in else 0
            total_out = total_out if total_out else 0
            return intcomma(total_in - total_out)
Exemple #7
0
def invoice_detail(request, invoice_id, template_name='invoice_detail.html'):
    invoice = Invoice.objects.get(pk=invoice_id)
    items = Item.objects.filter(invoice=invoice)
    client = invoice.client
    emission_date = invoice.emission_date
    invoice_total_value = 0
    precision = 2

    for item in items:

        invoice_total_value += item.value
        item.value = floatformat(item.value, precision)
        item.value, decimal = force_unicode(item.value).split('.')
        item.value = intcomma(item.value)
        item.value = item.value.replace(',', '.') + ',' + decimal

    invoice_total_value = floatformat(invoice_total_value, precision)
    invoice_total_value, decimal = force_unicode(invoice_total_value)\
        .split('.')
    invoice_total_value = intcomma(invoice_total_value)
    invoice_total_value = invoice_total_value.replace(',', '.') + ',' + decimal

    context = {
        'invoice_total_value': invoice_total_value,
        'invoice': invoice,
        'items': items,
        'client': client,
        'emission_date': emission_date,
    }
    return render(request, template_name, context)
Exemple #8
0
def beneficios_reporte_periodo(request):
	if request.user.has_perm('beneficios.ver_periodo_beneficios'):
		if request.is_ajax():
			try:
				s = HistoBeneficios.objects.filter(anio=request.GET['periodo']).values('anio','nivel_educativo__nombre','codigo_beneficio__descripcion_beneficio','monto_cheque').order_by('nivel_educativo__nombre','codigo_beneficio__descripcion_beneficio').annotate(n=Count('codigo_beneficio__descripcion_beneficio'))
				info = {}
				data = []
				acum_1, acum_2 = 0,0
				acums = {}
				for a in s:
					info['anio']=a['anio']
					info['nivel_educativo']=a['nivel_educativo__nombre']
					info['beneficio']=a['codigo_beneficio__descripcion_beneficio']
					info['beneficiados']=intcomma(a['n'])
					info['monto']=intcomma(a['monto_cheque'])
					info['total']=intcomma(a['monto_cheque']*a['n'])
					acum_1 += a['n']
					acum_2 += a['monto_cheque']*a['n']
					data.append(info)
					info = {}
				acums['t1'] = intcomma(acum_1)
				acums['t2'] = intcomma(acum_2)
				data.append(acums)
				return HttpResponse(simplejson.dumps(data), mimetype='application/json')
			except Exception, e:
				#print e
				pass
Exemple #9
0
 def __unicode__(self):
     if self.output and self.input:
         return u'{}: {} (-{}/+{})'.format(self.date, self.text, intcomma(floatformat(self.output, 2)), intcomma(floatformat(self.input, 2)))
     elif self.output:
         return u'{}: {} (-{})'.format(self.date, self.text, intcomma(floatformat(self.output, 2)))
     else:
         return u'{}: {} (+{})'.format(self.date, self.text, intcomma(floatformat(self.input, 2)))
Exemple #10
0
def countries_ongoing(request, country_slug, values_type):
    try:
        country = Country.objects.get(slug=country_slug)
        actual_quarter = CountryOperation.get_actual_quarter(country=country)

        if values_type == 'disbursement':
            actual = actual_quarter.it_disbursements_actual
            planned = actual_quarter.it_disbursements_planned
        elif values_type == 'execution':
            actual = actual_quarter.it_execution_actual
            planned = actual_quarter.it_execution_planned

        if planned == 0:
            percentage = 0
            dpi = 0
        else:
            percentage = float("%.2f" % ((actual / planned) * 100))
            dpi = float("%.1f" % (actual / planned))

        values = {
            'accumulated': intcomma(int(actual)),
            'percentage': percentage,
            'dpi': dpi,
            'dv':  intcomma(int(actual) - int(planned))
        }

        return HttpResponse(json.dumps(values),
                            content_type="application/json")

    except Country.DoesNotExist:
        raise Http404
Exemple #11
0
def currency_format(cents):
    """Format currency with symbol and decimal points.

    >> currency_format(-600)
    - $6.00

    TODO: Add localization support.
    """
    try:
        cents = int(cents)
    except ValueError:
        return cents

    negative = (cents < 0)
    if negative:
        cents = -1 * cents

    if cents < 100:
        dollars = 0
    else:
        dollars = cents / 100
        cents = cents % 100

    centstr = str(cents)
    if len(centstr) < 2:
        centstr = '0' + centstr

    if negative:
        return "- $%s.%s" % (intcomma(dollars), centstr)
    return "$%s.%s" % (intcomma(dollars), centstr)
    def handle(self, *args, **kwargs):
        """
        Make it happen.
        """
        # Loop through all the models and find any fields without docs
        field_count = 0
        missing_list = []
        for m in get_model_list():
            field_list = m().get_field_list()
            field_count += len(field_list)
            for f in field_list:
                if not self.has_docs(f):
                    self.log("Missing: %s.%s.%s" % (
                            m().klass_group,
                            m().klass_name,
                            f
                        )
                    )
                    missing_list.append((m, f))

        # If everything is done, declare victory
        if not missing_list:
            self.success("All %s fields documented!" % field_count)
            return False

        # If not, loop through the missing and create issues
        missing_count = len(missing_list)
        self.failure(
            "%s/%s (%d%%) of fields lack documentation" % (
                intcomma(missing_count),
                intcomma(field_count),
                calculate.percentage(missing_count, field_count)
            )
        )
Exemple #13
0
def format_rate(i):
    if i > 0:
        ret = u"+%s" % intcomma(i)
    elif i < 0:
        ret = u"&minus;%s" % intcomma(abs(i))
    else:
        ret = "0"
    return mark_safe(ret)
Exemple #14
0
def detalles(request):
	num_socio = request.GET.get('num_socio')
	
	socios = socio.objects.select_related()
	socios = socios.get(num_socio=num_socio)

	
 
	domicilios = domicilio.objects.select_related().values()
	domicilios = domicilios.filter(socio_id=socios.socio_id)
	dom = []
	for i in domicilios:

		dom += [{
			'tipo': tipo[i["tipo_id"]],
			'domicilio': i["domicilio"],
			'cod_postalC': i["cod_postalC"],
			'localidad': local[i["localidad_id"]],
			'provincia': prov[local[i["localidad_id"]]["provincia_id"]],
		}]
	

	emails = email.objects.select_related().values()
	emails = emails.filter(socio_id=socios.socio_id)
	mail = []
	for i in emails:
		mail += [{
			'tipo': tipo[i["tipo_id"]],
			'email': i["email"],
		}]
	
	telefonos = telefono.objects.select_related().values()
	telefonos = telefonos.filter(socio_id=socios.socio_id)
	tel = []
	for i in telefonos:
		tel += [{
			'tipo': tipo[i["tipo_id"]],
			'telefono': i["telefono"],
		}]


	socios.documento = "%s" % intcomma(socios.documento) 
	socios.tutor_documento = "%s" % intcomma(socios.tutor_documento)

	numero_format = ''
	for i in socios.cobranza_numero:
		numero_format += str(i)
		if (len(numero_format.replace(' ', '')) % 4) == 0:
			numero_format += ' '

	socios.cobranza_numero = numero_format

	return render_to_response('socios_detalles.html', { 
		'socio': socios,
		'domicilios': dom,
		'emails': mail,
		'telefonos': tel,
		}, context_instance=RequestContext(request, processors=[custom_proc]))
 def balances(self):
     total = self.total_charges()
     diff = self.amount - total
     if self.amount == total:
         return "Exact"
     elif diff > 0:
         return "$%s short" % str(intcomma(floatformat(diff, 2)))
     else:
         return "$%s over" % str(intcomma(floatformat(-1 * diff, 2)))
def plusminus_int(number):
    try:
        num = int(number)
        if num >= 0:
            return "+" + intcomma(str(num))
        else:
            return intcomma(str(num))
    except:
        return ""
Exemple #17
0
def currency(val, type):
	if isinstance(val, (int, float)):
		if type == "pound" or type == "sterling" or type == "quid":
			return u'\u00A3'+str(intcomma(val))
		elif type == "dollars":
			return u'\u0024'+str(intcomma(val))	
		else:
			return val;	
	else:
		return val;
Exemple #18
0
def moneydiff(value):
    """Return monetary value like money, but including a + sign when needed.
    """
    try:
        rounded = round(value)
    except:  # Yes, a bare except: filters should not raise exceptions
        return value
    if rounded > 0:
        return mark_safe('<tt>+%s</tt>' % intcomma(rounded))
    return mark_safe('<tt>%s</tt>' % intcomma(rounded))
Exemple #19
0
 def model_db_counts(self, model):
     'Model name, count in each db, and difference'
     from_count = model.objects.using(self.src_db).count()
     to_count = model.objects.using(self.dest_db).count()
     return [
         model._meta.verbose_name,
         intcomma(to_count, use_l10n=False),
         intcomma(from_count, use_l10n=False),
         intcomma(to_count - from_count, use_l10n=False)
     ]
Exemple #20
0
def tabla(request, anio):
    anio_actual = date.today().year

    if not anio:
        anio = request.GET.get('anio', anio_actual)

    anio = int(anio)

    lugares = Lugar.objects.values('numero', 'id', 'titular__apellido', 'titular__id', 'titular__nombres', 'fecha_ocupacion')
    pagos = {}

    for lugar in lugares:
        pagos_lugar = {}

        for periodo in range(1, 13):
            pagos_lugar.update({int(periodo): Pago.objects.filter(lugar_id=lugar['id'], periodo__year=anio, periodo__month=periodo).values('importe', 'id', 'fecha_pago').first()})

        titular_contactos = Contacto.objects.filter(titular_id=lugar['titular__id']).values_list('valor')

        titular_datos = (
            u'Titular: {} {}<br>'
            'Desde: {}'
            '<br>Contactos: {}'
        ).format(
            lugar['titular__nombres'] if lugar['titular__nombres'] else 'Desocupado',
            lugar['titular__apellido'] if lugar['titular__apellido'] else '',
            lugar['fecha_ocupacion'].strftime('%d/%m/%Y') if lugar['fecha_ocupacion'] else 'n/d',
            ', '.join([item[0] for item in titular_contactos]),
        )

        pagos.update({
            int(lugar['numero']): {
                'datos': {'lugar_id': lugar['id'], 'titular': titular_datos},
                'periodos': pagos_lugar
            }
        })

    total_pagos = Pago.objects.aggregate(Sum('importe'))['importe__sum']
    total_gastos = Gasto.objects.exclude(categoria=3).aggregate(Sum('importe'))['importe__sum']
    total_retiros = Gasto.objects.filter(categoria=3).aggregate(Sum('importe'))['importe__sum']

    template = loader.get_template('cochera/tabla.html')

    context = RequestContext(request, {
        'title': 'Pagos {}'.format(anio),
        'anio': anio,
        'rango_anios': range(anio_actual - 5, anio_actual + 1),
        'pagos': pagos,
        'total_pagos': humanize.intcomma(total_pagos),
        'total_gastos': humanize.intcomma(total_gastos),
        'total_retiros': humanize.intcomma(total_retiros),
        'total': humanize.intcomma(total_pagos - total_gastos - total_retiros),
    })

    return HttpResponse(template.render(context))
Exemple #21
0
 def get_string(self,value):
     """docstring for get_string"""
     if isinstance(value, list):
         if value[0] == 0:
             return '< ${0}'.format(intcomma(value[1]))
         elif value[1] == 0:
             return '> ${0}'.format(intcomma(value[0]))
         else:
             return '${0} - ${1}'.format(intcomma(value[0]), intcomma(value[1]))
     else:
         return ''
Exemple #22
0
def db_prices(event, **kwargs):
    tickets = filter_tickets(event, **kwargs)
    tickets = tickets.aggregate(
        total_price=Sum("price"), price_without_tax=Sum(F("price") / (1 + F("tax") / 100.0), output_field=FloatField())
    )
    if tickets and tickets["total_price"]:
        tax = intcomma("{total_price:.2f}".format(**tickets))
        notax = intcomma("{price_without_tax:.2f}".format(**tickets))
        return "{0} / {1}".format(tax, notax)

    return "--"
def floatcomma(value, arg=-1):
    
    try:
        value = float(value)
    except ValueError:
        return ""
    
    formatted = floatformat(value, arg)
    if '.' in formatted:
        return '%s.%s' % (intcomma(int(value)), formatted.split('.')[1])
    else:
        return intcomma(int(value))
Exemple #24
0
def cancel_production(request, prod_id):
    planet = request.user.get_profile()
    shipyard = get_object_or_404(ShipYard, planet=planet, id=prod_id)
    
    metal, cristal, gold = shipyard.cancel_prod()
    
    shipyard.delete()
    
    messages.add_message(request, messages.INFO, u"Foram devolvidas %s unidades de metal \
    %s unidades de cristal e %s unidades de ouro." % (intcomma(metal), intcomma(cristal), intcomma(gold)))
    
    return redirect("production")
Exemple #25
0
def two_num(n_min, n_max):
    result = ''
    if n_min and n_max:
        if n_min != n_max:     
            result = u'от %s до %s' % (intcomma(n_min),intcomma(n_max))
        else:
            result = '%s' % intcomma(n_max)    
    elif n_min and not n_max:
        result = u'более %s' % (intcomma(n_min))
    elif n_max and not n_min:
        result = u'менее %s' % (intcomma(n_max))
    return result             
Exemple #26
0
def xhr_runerrquery(request, id=None):
	'''
	Runs the queries from the error panel for the dashboard to display
	'''
	response_dict = {'success' : False}
	
	response_dict['qry_id'] = int(id)
	query_id = int(id)
	query = QueryData.objects.filter(id=query_id)[0].qry_txt
	response_dict['query_desc'] = QueryData.objects.filter(id=query_id)[0].qry_desc
	response_dict['warning_threshold'] = 0
	response_dict['fatal_threshold'] = 1
	system = QueryData.objects.filter(id=query_id)[0].system_id
	system_db = QueryData.objects.filter(id=query_id)[0].system.database_name
	system_active = QueryData.objects.filter(id=query_id)[0].system.is_active
	args = {}
	response_dict['params'] = args
	querydata = Query(qrystr=query, **args)
	query = querydata.QueryString
	if is_dashsuperuser(request.user) or is_dashadmin(request.user):
		response_dict['query'] = query
	
		# Start Query
	try:
		myCursor = connections[system_db].cursor()
		results = myCursor.execute(query)
		
		if type(connections[system_db]) == django.db.backends.oracle.base.DatabaseWrapper:
			resultcount = results.fetchall()
			response_dict['resultsetcount'] = intcomma(len(resultcount))
			response_dict['resultset'] = resultcount
			response_dict['cols'] = [d[0] for d in results.description] 
			response_dict['success'] = True 
		elif type(connections[system_db]) == django.db.backends.mysql.base.DatabaseWrapper:
			resultcount = myCursor.fetchall()
			response_dict['resultsetcount'] = intcomma(len(resultcount))
			response_dict['resultset'] = resultcount
			response_dict['cols'] = [d[0] for d in myCursor.description] 
			response_dict['success'] = True 
		elif type(connections[system_db]) == sqlserver_ado.base.DatabaseWrapper:
			resultcount = myCursor.fetchall()
			response_dict['resultsetcount'] = intcomma(len(resultcount))
			response_dict['resultset'] = resultcount
			response_dict['cols'] = [d[0] for d in myCursor.description] 
			response_dict['success'] = True 
		else:
			print "None selected"
	except (cx_Oracle.DatabaseError, DatabaseError, MySQLdb.OperationalError) as e:
		response_dict['resultsetcount'] = 0	
		if is_dashsuperuser(request.user) or is_dashadmin(request.user):
			response_dict['errorMsg'] = "Error while executing query:\nError message: {0}".format(e)		

	return render_to_response('dashboard/querydetails.html', {'results': response_dict}, context_instance=RequestContext(request))
Exemple #27
0
def change(text, diff, title=""):
    text = text or 0
    diff = diff or 0
    ret = '<span class='
    if diff < 0:
        ret += '"red"'
    elif diff > 0:
        ret += '"green"'
    else:
        ret += '"yellow"'
    if title:
        ret += ' title="%s"'%(intcomma(title),)
    ret += '>%s</span></div>'%(intcomma(text),)
    return ret
Exemple #28
0
def total_recibo_plan_pago_ajax(request):
    if request.is_ajax():
        dic={}
        checks= request.GET.getlist('checks[]')
        ids = map(int, checks)
        checks_desc= request.GET.getlist('descuentos[]')
        ids_desc = map(int, checks_desc)
        planes = PlanPago.objects.filter(pk__in=ids)
        descuentos = Descuento.objects.filter(pk__in=ids_desc)
        total = sumarTotalesPlanPago(planes)
        dic['total_planes'] = intcomma(int(total))

        if descuentos: dic['total_descuentos'] = intcomma(int(restarDescuento(total, descuentos)))
        else: dic['total_descuentos'] = dic['total_planes']
        return HttpResponse(json.dumps(dic))
Exemple #29
0
def init_build(request, branch):
    planet = request.user.get_profile()

    try:

        branch = int(branch)
        planet.build(branch)
        messages.add_message(
            request,
            messages.INFO,
            u"Construção iniciada com sucesso. Foram descontados dos nossos cofres %s unidades de cada recurso. Dentro de %i horas teremos o resultado."
            % (intcomma(planet.building_cost()), planet.current_building_time),
        )

    except OutOfResourcesException:
        messages.add_message(
            request, messages.ERROR, u"Você não possui recursos suficientes para iniciar uma construção."
        )
    except OutOfSpaceException:
        messages.add_message(
            request,
            messages.ERROR,
            u"Não existem mais espaços disponíveis para construção no nosso Planeta. Tente pesquisar mais.",
        )
    # except:
    #    messages.add_message(request, messages.ERROR, u'Não foi possível iniciar a construção.')

    return redirect("build")
Exemple #30
0
def facebook_telephones():
    try:
        item = Telephone.objects.filter(
            published=True, 
            pub_date__range=[datetime.datetime.now()-datetime.timedelta(hours=3*24), 
                             datetime.datetime.now()]
        ).exclude(image_1='').order_by('-pub_date')[0]
    except IndexError as e:
        return

    try:
        social.FacebookPost.objects.get(item=item)
    except social.FacebookPost.DoesNotExist:
        pass
    else:
        return

    data = {'comment': u'Ежедневная подборка: {0} {1}'.format(item.brand, 
                                                              item.model),
            'name': u'{0} {1}'.format(item.brand, item.model),
            'link': BASEURL + item.get_absolute_url(),
            'caption': u'Цена: {0} c.'.format(humanize.intcomma(item.price)),
            'picture': BASEURL + item.image_1.url}

    if item.desc:
        data['description'] = item.desc
    else:
        data['description'] = u'Продаётся телефон {0} {1} стандарта {2}.'\
                              .format(item.brand, 
                                      item.model, 
                                      item.conn_type.upper())

    social.FacebookPost.objects.create(item=item)
    post_to_fb(**data)
Exemple #31
0
 def recargos(self, obj, row):
     return "$" + intcomma(round(obj.recargos, 2))
Exemple #32
0
def intcomma(source):
    return humanize.intcomma(source)
Exemple #33
0
 def calcular_hora_dominical_extra_nocturna(self, obj, row):
     return "$" + intcomma(
         round(obj.calcular_hora_dominical_extra_nocturna, 2))
Exemple #34
0
 def reputasi_toko(self, obj):
     return format_html("<img src='{url}'/> {level} &nbsp; {point} poin",
                        url=obj.toko_reputasi_badge_url,
                        point=intcomma(obj.toko_reputasi_score),
                        level=obj.get_toko_reputasi_level_display())
Exemple #35
0
def currency(dollars):
    if (dollars == None) or (dollars == ''):
        dollars = 0
    else:
        dollars = int(dollars)
    return "$ {}".format(intcomma(dollars))
Exemple #36
0
def total_networth(base='EUR'):
    # rates = get_rates(base)
    # total = breakdown.get('total',0.0)/rates['EUR']
    total = 200.50
    return intcomma(round(total, 2))
 def company_admission_fee_intcomma(self):
     return intcomma(self.company_admission_fee())
Exemple #38
0
    value = round(int(value), 0)
    return value


@register.filter
def default_exchange_rate_formated(country):
    '''
    extend this to format to default currency
    '''
    to_curr = 'ugx'
    try:
        to_curr = CURRENCIES[country]
    except Exception, e:
        pass
    value = get_default_exchange_rate(country)
    return "%s %s" % (to_curr, intcomma(int(value)))


def get_total_to_recipient(value, country):
    exchange = get_default_exchange_rate(country)
    value = int(exchange) * int(value)
    return value


@register.filter
def total_to_recipient(value, country):
    '''
    extend this to format to default currency
    '''
    dollars = get_total_to_recipient(value, country)
    try:
Exemple #39
0
    def price_format(self, obj):
        price = intcomma(obj.price)

        return f'{price}원'
Exemple #40
0
 def total_pagar(self, obj, row):
     return "$" + intcomma(round(obj.total_pagar, 2))
Exemple #41
0
 def neto(self, obj, row):
     return "$" + intcomma(round(obj.neto, 2))
Exemple #42
0
 def bonificacion(self, obj, row):
     return "$" + intcomma(round(obj.bonificacion, 2))
Exemple #43
0
 def total(self, obj, row):
     return "$" + intcomma(round(obj.total, 2))
Exemple #44
0
def total_debits(base='EUR'):
    # rates = get_rates(base)
    # total = breakdown.get('debits',0.0)/rates['EUR']
    total = 30.50
    return intcomma(round(total, 2))
Exemple #45
0
def make_display_price(price):
    dollars = round(price, 2)
    return "$%s%s" % (intcomma(int(dollars)), ("%0.2f" % dollars)[-3:])
Exemple #46
0
 def render(self,value):
     return "$" + str(intcomma(value))
Exemple #47
0
def currency(dollars):
    if dollars is None:
        dollars = float(0.00)
    else:
        dollars = round(float(dollars), 2)
    return "$%s%s" % (intcomma(int(dollars)), ("% 0.2f" % dollars)[-3:])
Exemple #48
0
 def render(self,value):
     return intcomma(value)
Exemple #49
0
def currency(dollars):
    print dollars
    if dollars is None:
        return "None"
    dollars = round(float(dollars), 2)
    return "$%s%s" % (intcomma(int(dollars)), ("%0.2f" % dollars)[-3:])
Exemple #50
0
 def get_total_display(self):
     return '{} PLN'.format(intcomma(round(Decimal(self.total / 100), 2)))
Exemple #51
0
def percent_format(number):
    return pgettext("Translated percents", "%(percent)s%%") % {
        "percent": intcomma(int(number))
    }
Exemple #52
0
 def amount_html(self):
     return mark_safe('<div style="float: right;">{0}</div>'.format(
         intcomma(self.amount)))
Exemple #53
0
 def descuento_salud(self, obj, row):
     return "$" + intcomma(round(obj.descuento_salud, 2))
def prepend_dollars(dollars):
    if dollars:
        dollars = round(float(dollars), 2)
        return "$%s%s" % (intcomma(int(dollars)), ("%0.2f" % dollars)[-3:])
    else:
        return ''
Exemple #55
0
 def calcular_hora_extra_diurna(self, obj, row):
     return "$" + intcomma(round(obj.calcular_hora_extra_diurna, 2))
Exemple #56
0
 def total_deducido(self, obj, row):
     return "$" + intcomma(round(obj.total_deducido, 2))
Exemple #57
0
 def subsidio_transporte(self, obj, row):
     return "$" + intcomma(round(obj.subsidio_transporte, 2))
Exemple #58
0
 def descuentos_adicionales(self, obj, row):
     return "$" + intcomma(round(obj.descuento, 2))
Exemple #59
0
 def descuento_bonificacion(self, obj, row):
     return "$" + intcomma(round(obj.descuento_bonificacion, 2))
Exemple #60
0
 def adelanto(self, obj, row):
     return "$" + intcomma(round(obj.adelanto, 2))