creer to_percent(x, d)
This commit is contained in:
@@ -23,8 +23,8 @@ class GlobalLayout(object):
|
|||||||
def to_euro(self, x):
|
def to_euro(self, x):
|
||||||
return to_euro(x)
|
return to_euro(x)
|
||||||
|
|
||||||
def to_percent(self, x):
|
def to_percent(self, x, d):
|
||||||
return to_percent(x)
|
return to_percent(x, d)
|
||||||
|
|
||||||
def isAnonymous(self):
|
def isAnonymous(self):
|
||||||
user = authenticated_userid(self.request)
|
user = authenticated_userid(self.request)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<table class="table table-condensed table-striped table-bordered">
|
<table class="table table-condensed table-striped table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th class=text-center"">MAISON</th>
|
<th class="text-center">MAISON</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr tal:repeat="ligne docs_maison">
|
<tr tal:repeat="ligne docs_maison">
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
<tr tal:repeat="item items">
|
<tr tal:repeat="item items">
|
||||||
<td class="${item.bg_color}">${item.classe}</td>
|
<td class="${item.bg_color}">${item.classe}</td>
|
||||||
<td class="text-right">${item.pc_cible} %</td>
|
<td class="text-right">${item.pc_cible} %</td>
|
||||||
<td class="text-right">${layout.to_percent(item.pc_atteint)}</td>
|
<td class="text-right">${layout.to_percent(item.pc_atteint,1)}</td>
|
||||||
<td tal:condition="(item.pc_atteint - item.pc_cible)>=0" class="text-right" style="color: green;">${layout.to_percent(item.pc_atteint - item.pc_cible)}</td>
|
<td tal:condition="(item.pc_atteint - item.pc_cible)>=0" class="text-right" style="color: green;">${layout.to_percent(item.pc_atteint - item.pc_cible,1)}</td>
|
||||||
<td tal:condition="(item.pc_atteint - item.pc_cible) <0" class="text-right" style="color: red;">${layout.to_percent(item.pc_atteint - item.pc_cible)}</td>
|
<td tal:condition="(item.pc_atteint - item.pc_cible) <0" class="text-right" style="color: red;">${layout.to_percent(item.pc_atteint - item.pc_cible,1)}</td>
|
||||||
<td class="text-right">${layout.to_euro(item.valeur)}</td>
|
<td class="text-right">${layout.to_euro(item.valeur)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<th class="text-right">% de +/-</th>
|
<th class="text-right">% de +/-</th>
|
||||||
<th class="text-right">% PF</th>
|
<th class="text-right">% PF</th>
|
||||||
<th class="text-right">TER</th>
|
<th class="text-right">TER</th>
|
||||||
<th class="text-right">Rendement</th>
|
<th class="text-right">Rdt</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -55,17 +55,17 @@
|
|||||||
<td class="text-right">${layout.to_euro(ligne.valeur)}</td>
|
<td class="text-right">${layout.to_euro(ligne.valeur)}</td>
|
||||||
<td tal:condition="ligne.plus_value>=0" class="text-right" style="color: green;">${layout.to_euro(ligne.plus_value)}</td>
|
<td tal:condition="ligne.plus_value>=0" class="text-right" style="color: green;">${layout.to_euro(ligne.plus_value)}</td>
|
||||||
<td tal:condition="ligne.plus_value <0" class="text-right" style="color: red;">${layout.to_euro(ligne.plus_value)}</td>
|
<td tal:condition="ligne.plus_value <0" class="text-right" style="color: red;">${layout.to_euro(ligne.plus_value)}</td>
|
||||||
<td tal:condition="ligne.pc_plusvalue>=0" class="text-right" style="color: green;">${layout.to_percent(ligne.pc_plusvalue)}</td>
|
<td tal:condition="ligne.pc_plusvalue>=0" class="text-right" style="color: green;">${layout.to_percent(ligne.pc_plusvalue,1)}</td>
|
||||||
<td tal:condition="ligne.pc_plusvalue <0" class="text-right" style="color: red;">${layout.to_percent(ligne.pc_plusvalue)}</td>
|
<td tal:condition="ligne.pc_plusvalue <0" class="text-right" style="color: red;">${layout.to_percent(ligne.pc_plusvalue,1)}</td>
|
||||||
<td class="text-right">${ligne.pc_allocation} %</td>
|
<td class="text-right">${ligne.pc_allocation} %</td>
|
||||||
<td class="text-right">${layout.to_percent(ligne.ter)}</td>
|
<td class="text-right">${layout.to_percent(ligne.ter,2)}</td>
|
||||||
<td class="text-right">${layout.to_percent(ligne.rdt)}</td>
|
<td class="text-right">${layout.to_percent(ligne.rdt,1)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"></td>
|
<td colspan="2"></td>
|
||||||
<td class="text-right">${layout.to_euro(total_valeur)}</td>
|
<td class="text-right">${layout.to_euro(total_valeur)}</td>
|
||||||
<td class="text-right">${layout.to_euro(total_pv)}</td>
|
<td class="text-right">${layout.to_euro(total_pv)}</td>
|
||||||
<td class="text-right">${layout.to_percent(total_pc_value)}</td>
|
<td class="text-right">${layout.to_percent(total_pc_value,1)}</td>
|
||||||
<td class="text-right">100 %</td>
|
<td class="text-right">100 %</td>
|
||||||
<td colspan="2"></td>
|
<td colspan="2"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li><a href="${request.application_url}/actifs_list">ACTIFS</a></li>
|
<li><a href="${request.application_url}/actifs_list">ACTIFS</a></li>
|
||||||
<li><a href="${request.application_url}/allocation_list">ALLOCATION</a></li>
|
<li><a href="${request.application_url}/allocation_list">ALLOCATION</a></li>
|
||||||
<li><a href="${request.application_url}/doc_list">DOCS</a></li>
|
|
||||||
<li><a href="${request.application_url}/histo_list">HISTORIQUE</a></li>
|
<li><a href="${request.application_url}/histo_list">HISTORIQUE</a></li>
|
||||||
|
<li><a href="${request.application_url}/doc_list">DOCS</a></li>
|
||||||
${panel('dropdown_menu_panel')}
|
${panel('dropdown_menu_panel')}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,9 +62,19 @@ def to_int(x):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def to_percent(x):
|
def to_percent(x, d):
|
||||||
"""Takes a float and returns a string"""
|
"""Takes a float and returns a string"""
|
||||||
return (u"%.1f " % x).replace('.', ',') + "%"
|
if x == 0:
|
||||||
|
pc = ''
|
||||||
|
elif d == 2:
|
||||||
|
pc = u"%.2f " % x
|
||||||
|
elif d == 3:
|
||||||
|
pc = u"%.3f " % x
|
||||||
|
else:
|
||||||
|
pc = u"%.1f " % x
|
||||||
|
if len(pc) > 0:
|
||||||
|
pc += "%"
|
||||||
|
return pc.replace('.', ',')
|
||||||
|
|
||||||
|
|
||||||
@view_config(route_name='home', renderer='../templates/home.pt', permission='view')
|
@view_config(route_name='home', renderer='../templates/home.pt', permission='view')
|
||||||
|
|||||||
Reference in New Issue
Block a user