Commit 407f8d9a authored by Kevin Deldycke's avatar Kevin Deldycke

Use Paysheet currency for precision rounding.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10896 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6faefa2b
......@@ -83,7 +83,7 @@ portal = context.getPortalObject()\n
gross_salary = 0.0\n
net_salary = 0.0\n
total_employer_share = 0.0\n
total_employee_share = 0.0 # total_employee_share = r_(gross_salary - net_salary)\n
total_employee_share = 0.0 # Alternative: total_employee_share = r_(gross_salary - net_salary)\n
taxable_net_salary = 0.0\n
\n
\n
......@@ -235,7 +235,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
##############################################################################\n
\n
# Get Precision and precise rounding methods\n
precision = context.Base_getPreferredPrecision()\n
precision = context.getResourceValue().getQuantityPrecision()\n
r_ = lambda x: context.Base_getRoundValue(x, precision)\n
\n
# Scan each pay sheet line and save it in the right place in the data structure\n
......@@ -271,7 +271,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
updateSubLine( group_id = cell_group_id\n
, subline_id = cell_subline_id\n
, property = \'employee_share\'\n
, value = \'%.2f\' % cell_value #TODO: the "%.2f" format should be based on currency precision\n
, value = cell_value\n
)\n
gross_salary = r_(gross_salary + cell_value)\n
# Do not display base type for non-base salary\n
......@@ -284,7 +284,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
\n
### Net Salary handling\n
elif share_type == \'employee\':\n
net_salary = \'%.2f\' % cell_value #TODO: the "%.2f" format should be based on currency precision\n
net_salary = cell_value\n
\n
### Addendum group handling\n
elif range_type.startswith("fixed/addendum"):\n
......@@ -304,7 +304,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
updateSubLine( group_id = cell_group_id\n
, subline_id = cell_subline_id\n
, property = \'%s_share\' % share_type\n
, value = \'%.2f\' % cell_share #TODO: the "%.2f" format should be based on currency precision\n
, value = cell_share\n
)\n
\n
### Other Pay Sheet Lines (= variable)\n
......@@ -318,12 +318,12 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
updateSubLine( group_id = cell_group_id\n
, subline_id = cell_subline_id\n
, property = \'base\'\n
, value = \'%.2f\' % r_(cell_base) #TODO: the "%.2f" format should be based on currency precision\n
, value = r_(cell_base)\n
)\n
updateSubLine( group_id = cell_group_id\n
, subline_id = cell_subline_id\n
, property = \'%s_share\' % share_type\n
, value = \'%.2f\' % cell_share #TODO: the "%.2f" format should be based on currency precision\n
, value = cell_share\n
)\n
# Sum up employee and employer share grand total\n
if share_type == \'employee\':\n
......@@ -334,10 +334,9 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
\n
\n
\n
\n
\n
\n
\n
#####################\n
### JUNK CODE ###\n
#####################\n
\n
# # Sort the list by id since lines are already ordered by id.\n
# object_list.sort(lambda x, y: cmp(int(x.getId()), int(y.getId())))\n
......@@ -504,7 +503,11 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
# details[\'yearly_taxable_net_salary\'] = r_(yearly_taxable_net_salary + r_(details[\'taxable_net_salary\']))\n
\n
\n
#TODO: the "%.2f" format should be based on currency precision\n
############################\n
### END OF JUNK CODE ###\n
############################\n
\n
\n
details[\'totals\'][\'gross_salary\'] = gross_salary\n
details[\'totals\'][\'net_salary\'] = net_salary\n
details[\'totals\'][\'taxable_net_salary\'] = taxable_net_salary\n
......
......@@ -81,7 +81,7 @@ portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
# Get Precision\n
precision = context.Base_getPreferredPrecision()\n
precision = context.getResourceValue().getQuantityPrecision()\n
r_ = lambda x: context.Base_getRoundValue(x, precision)\n
\n
# Delete all objects in the paysheet\n
......
2006-10-23 Kevin
* Change category structure to support additional lines beside base salary to constitute the gross salary. Now the gross salary can be composed of several lines, variable or fixed.
* Use Paysheet currency for precision rounding.
2006-10-20 Kevin
* Change matrix box rendering dynamically depending of the type of the contribution.
......
56
\ No newline at end of file
58
\ No newline at end of file
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