Commit f43d86b2 authored by Kevin Deldycke's avatar Kevin Deldycke

Print total payment on PDF.

Format PDF values according currency/

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10950 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f83d80fa
...@@ -353,6 +353,45 @@ details[\'totals\'][\'taxable_net_salary\'] = taxable_net_salary\n ...@@ -353,6 +353,45 @@ details[\'totals\'][\'taxable_net_salary\'] = taxable_net_salary\n
details[\'totals\'][\'total_employer_share\'] = total_employer_share\n details[\'totals\'][\'total_employer_share\'] = total_employer_share\n
details[\'totals\'][\'total_employee_share\'] = total_employee_share\n details[\'totals\'][\'total_employee_share\'] = total_employee_share\n
details[\'totals\'][\'total_addendum\'] = total_addendum\n details[\'totals\'][\'total_addendum\'] = total_addendum\n
details[\'totals\'][\'total_employee_payment\'] = r_(net_salary + total_addendum)\n
\n
\n
\n
##############################################################################\n
# Transform every float value to a string representation according the currency.\n
##############################################################################\n
\n
# There is 2 kind of numbers to format: rates and amounts.\n
rate_propertie_list = [\'employer_rate\', \'employee_rate\']\n
amount_propertie_list = [\'base\', \'employer_share\', \'employee_share\']\n
\n
# The "three decimals" format is arbitrary. "3" was choose because there is no rate with\n
# precision above 3. Feel free to update dynamiccaly this format if required.\n
RATE_PRECISION = 3\n
\n
# Format each "normal" lines\n
for group_id in getPSLGroupIdList():\n
for subline_id in getGroupSubLineIdList(group_id=group_id):\n
subline = getSubLine(group_id=group_id, subline_id=subline_id)\n
for (property, value) in subline.items():\n
if same_type(value, 1.0) or same_type(value, 1):\n
new_value = None\n
if property in rate_propertie_list:\n
new_value = (\'%.\' + str(RATE_PRECISION) + \'f\') % value\n
elif property in amount_propertie_list:\n
new_value = (\'%.\' + str(precision) + \'f\') % value\n
if new_value != None:\n
updateSubLine( group_id = group_id\n
, subline_id = subline_id\n
, property = property\n
, value = new_value\n
)\n
\n
# Format totals\n
for (key, value) in details[\'totals\'].items():\n
if same_type(value, 1.0) or same_type(value, 1):\n
details[\'totals\'][key] = (\'%.\' + str(precision) + \'f\') % value\n
\n
\n \n
return details\n return details\n
...@@ -457,6 +496,16 @@ return details\n ...@@ -457,6 +496,16 @@ return details\n
<string>cell_rate</string> <string>cell_rate</string>
<string>cell_base</string> <string>cell_base</string>
<string>cell_share</string> <string>cell_share</string>
<string>rate_propertie_list</string>
<string>amount_propertie_list</string>
<string>RATE_PRECISION</string>
<string>subline</string>
<string>property</string>
<string>value</string>
<string>same_type</string>
<string>new_value</string>
<string>str</string>
<string>key</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -191,6 +191,11 @@ ...@@ -191,6 +191,11 @@
condition="python: details[\'totals\'].has_key(\'net_salary\')"/> </td>\n condition="python: details[\'totals\'].has_key(\'net_salary\')"/> </td>\n
</tr>\n </tr>\n
</table>\n </table>\n
\n
<!-- This table act as a spacer -->\n
<table rowheight="0.6cm"><tr><td> </td></tr></table>\n
\n
<h1>Payment</h1>\n
\n \n
<tal:block repeat="group python: details[\'groups\']">\n <tal:block repeat="group python: details[\'groups\']">\n
<table splitbyrow="1" rowheight=\'0.4cm\' repeatrows="1" repeatcols="0" style="decompte"\n <table splitbyrow="1" rowheight=\'0.4cm\' repeatrows="1" repeatcols="0" style="decompte"\n
...@@ -204,6 +209,16 @@ ...@@ -204,6 +209,16 @@
<td colwidth="2.397cm"> </td>\n <td colwidth="2.397cm"> </td>\n
<td colwidth="1.959cm">Montant</td>\n <td colwidth="1.959cm">Montant</td>\n
</tr>\n </tr>\n
<tr tal:attributes="stylecmd boldstyle">\n
<td>Salaire Net</td>\n
<td> </td>\n
<td> </td>\n
<td> </td>\n
<td> </td>\n
<td> </td>\n
<td><tal:block replace="python: details[\'totals\'][\'net_salary\']"\n
condition="python: details[\'totals\'].has_key(\'net_salary\')"/> </td>\n
</tr>\n
<tr tal:attributes="stylecmd boldstyle">\n <tr tal:attributes="stylecmd boldstyle">\n
<td tal:content="python: group[\'title\']"> </td>\n <td tal:content="python: group[\'title\']"> </td>\n
<td> </td>\n <td> </td>\n
...@@ -228,7 +243,7 @@ ...@@ -228,7 +243,7 @@
condition="python: line[\'employee_share\'] != None"/> </td>\n condition="python: line[\'employee_share\'] != None"/> </td>\n
</tr>\n </tr>\n
<tr tal:attributes="stylecmd boldstyle">\n <tr tal:attributes="stylecmd boldstyle">\n
<td>Total</td>\n <td>Total Addendum</td>\n
<td> </td>\n <td> </td>\n
<td> </td>\n <td> </td>\n
<td> </td>\n <td> </td>\n
...@@ -237,6 +252,16 @@ ...@@ -237,6 +252,16 @@
<td><tal:block replace="python: details[\'totals\'][\'total_addendum\']"\n <td><tal:block replace="python: details[\'totals\'][\'total_addendum\']"\n
condition="python: details[\'totals\'].has_key(\'total_addendum\')"/> </td>\n condition="python: details[\'totals\'].has_key(\'total_addendum\')"/> </td>\n
</tr>\n </tr>\n
<tr tal:attributes="stylecmd boldstyle">\n
<td>Paiement Final</td>\n
<td> </td>\n
<td> </td>\n
<td> </td>\n
<td> </td>\n
<td> </td>\n
<td><tal:block replace="python: details[\'totals\'][\'total_employee_payment\']"\n
condition="python: details[\'totals\'].has_key(\'total_employee_payment\')"/> </td>\n
</tr>\n
</table>\n </table>\n
</tal:block>\n </tal:block>\n
\n \n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment