Commit d314ef06 authored by Kevin Deldycke's avatar Kevin Deldycke

Fix gross salary / base salary mix.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10915 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1ed48d15
...@@ -156,8 +156,7 @@ if context.getTitle() in (\'\', None):\n ...@@ -156,8 +156,7 @@ if context.getTitle() in (\'\', None):\n
# This list contain all paysheet items, indexed by service\n # This list contain all paysheet items, indexed by service\n
paysheet_items = {}\n paysheet_items = {}\n
\n \n
# Initialise the user preview line index\n gross_salary = 0.0\n
user_line_index = 0\n
total_employee_share = 0.0\n total_employee_share = 0.0\n
\n \n
# Scan every preview line to create an item for each service\n # Scan every preview line to create an item for each service\n
...@@ -199,6 +198,10 @@ for line in listbox:\n ...@@ -199,6 +198,10 @@ for line in listbox:\n
, "base" : -base\n , "base" : -base\n
, "rate" : share\n , "rate" : share\n
}\n }\n
# Update the gross salary\n
# The payroll service "setup convention" require that the fixed value should be defined on \'employer_share\'\n
if salary_range.endswith(\'/fixed/gross\'):\n
gross_salary = r_(gross_salary + share)\n
if cat.endswith(\'/employee_share\') and employee_share not in (None, \'\'):\n if cat.endswith(\'/employee_share\') and employee_share not in (None, \'\'):\n
share = float(employee_share)\n share = float(employee_share)\n
new_cell = { "x" : cat\n new_cell = { "x" : cat\n
...@@ -206,8 +209,7 @@ for line in listbox:\n ...@@ -206,8 +209,7 @@ for line in listbox:\n
, "base" : -base\n , "base" : -base\n
, "rate" : share\n , "rate" : share\n
}\n }\n
#context.log("PaySheetTransaction_postCalculation","cat=%s base=%s rate=%s" % (cat, base, rate))\n # Update the total employee share\n
\n
total_employee_share = r_(total_employee_share + r_(base * float(share)))\n total_employee_share = r_(total_employee_share + r_(base * float(share)))\n
# Add the cell to the conresponding paysheet item\n # Add the cell to the conresponding paysheet item\n
if new_cell != None:\n if new_cell != None:\n
...@@ -234,8 +236,6 @@ if labour_service is None:\n ...@@ -234,8 +236,6 @@ if labour_service is None:\n
if labour_service is None:\n if labour_service is None:\n
raise ValueError, "Unable to find `labour` service"\n raise ValueError, "Unable to find `labour` service"\n
\n \n
gross_salary = r_(context.getGrossSalary())\n
\n
labour_employee_share_category = None\n labour_employee_share_category = None\n
labour_employer_share_category = None\n labour_employer_share_category = None\n
for c in labour_service.getCategoryList():\n for c in labour_service.getCategoryList():\n
...@@ -245,6 +245,9 @@ for c in labour_service.getCategoryList():\n ...@@ -245,6 +245,9 @@ for c in labour_service.getCategoryList():\n
if c.startswith(\'salary_range\'):\n if c.startswith(\'salary_range\'):\n
labour_salary_range = c\n labour_salary_range = c\n
\n \n
base_salary = r_(context.getGrossSalary())\n
gross_salary = r_(gross_salary + r_(context.getGrossSalary()))\n
\n
createPaySheetItem( title = \'Salary\' # labour_service.getTitleOrId()\n createPaySheetItem( title = \'Salary\' # labour_service.getTitleOrId()\n
, res = labour_service.getRelativeUrl()\n , res = labour_service.getRelativeUrl()\n
, dest_org = context.getDestinationSection()\n , dest_org = context.getDestinationSection()\n
...@@ -256,7 +259,7 @@ createPaySheetItem( title = \'Salary\' # labour_service.getTitleOrId()\n ...@@ -256,7 +259,7 @@ createPaySheetItem( title = \'Salary\' # labour_service.getTitleOrId()\n
{ "x" : labour_employer_share_category\n { "x" : labour_employer_share_category\n
, "y" : labour_salary_range\n , "y" : labour_salary_range\n
, "base" : -1.0\n , "base" : -1.0\n
, "rate" : gross_salary\n , "rate" : base_salary\n
}]\n }]\n
)\n )\n
\n \n
...@@ -335,7 +338,7 @@ if not(kw.has_key(\'skip_redirect\') and kw[\'skip_redirect\'] == True):\n ...@@ -335,7 +338,7 @@ if not(kw.has_key(\'skip_redirect\') and kw[\'skip_redirect\'] == True):\n
<string>payroll_date</string> <string>payroll_date</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>paysheet_items</string> <string>paysheet_items</string>
<string>user_line_index</string> <string>gross_salary</string>
<string>total_employee_share</string> <string>total_employee_share</string>
<string>line</string> <string>line</string>
<string>service_id</string> <string>service_id</string>
...@@ -353,11 +356,11 @@ if not(kw.has_key(\'skip_redirect\') and kw[\'skip_redirect\'] == True):\n ...@@ -353,11 +356,11 @@ if not(kw.has_key(\'skip_redirect\') and kw[\'skip_redirect\'] == True):\n
<string>item</string> <string>item</string>
<string>labour_service</string> <string>labour_service</string>
<string>ValueError</string> <string>ValueError</string>
<string>gross_salary</string>
<string>labour_employee_share_category</string> <string>labour_employee_share_category</string>
<string>labour_employer_share_category</string> <string>labour_employer_share_category</string>
<string>c</string> <string>c</string>
<string>labour_salary_range</string> <string>labour_salary_range</string>
<string>base_salary</string>
<string>True</string> <string>True</string>
<string>ZTUtils</string> <string>ZTUtils</string>
<string>make_query</string> <string>make_query</string>
......
2006-10-24 Kevin
* Support dynamic update of gross salary calculation on pay sheet preview.
2006-10-23 Kevin 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. * 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. * Use Paysheet currency for precision rounding.
......
58 65
\ No newline at end of file \ No newline at end of file
0.1.14 0.1.15
\ No newline at end of file \ 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