Commit eba29405 authored by Jérome Perrin's avatar Jérome Perrin

sort aggregated_social_contribution_dict

parent d80b2ec5
......@@ -50,7 +50,7 @@ leave_period_type_set = set(portal_categories.use.social_declaration.l10n.fr.lea
# Create dict containing a DSN leave blocs, grouped by employee
leave_dict = {}
for period in leave_period_list:
for period in sorted(leave_period_list, key=lambda lp: lp.getCreationDate()):
# some leave periods don't have to be reported in DSN
period_resource = period.getResourceValue()
assert period_resource is not None, 'No type set on Leave Request %s' % period.absolute_url()
......@@ -59,7 +59,7 @@ for period in leave_period_list:
continue
# Let's make a DSN Bloc for this leave period
leave_category = leave_category.pop()
if period.getDestinationValue() in leave_dict.keys():
if period.getDestinationValue() in leave_dict.keys(): # TODO: bug here, we check with getDestinationValue and set with getDestination
leave_dict[period.getDestination()].append(getLeaveBlocAsDict(period, leave_category))
else:
leave_dict[period.getDestination()] = [getLeaveBlocAsDict(period, leave_category),]
......
import six
from Products.ERP5Type.Message import translateString
from erp5.component.module.DateUtils import addToDate, getNumberOfDayInMonth
......@@ -172,7 +173,7 @@ if len(payment_transaction_list):
start_date=social_contribution_start_date,
stop_date=social_contribution_stop_date,
amount=amount))
for ctp_code in aggregated_social_contribution_dict:
for ctp_code in sorted(aggregated_social_contribution_dict):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.23',
target=aggregated_social_contribution_dict[ctp_code]))
else:
......@@ -205,7 +206,7 @@ elif len(paysheet_list):
start_date=first_date_of_month,
stop_date=last_date_of_month,
amount=amount))
for ctp_code in aggregated_social_contribution_dict:
for ctp_code in sorted(aggregated_social_contribution_dict):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.23',
target=aggregated_social_contribution_dict[ctp_code]))
......@@ -227,12 +228,12 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
contract_change_block_list = []
if employee in change_block_dict:
for rubric_root, change_date_block in change_block_dict[employee].iteritems():
for rubric_root, change_date_block in sorted(six.iteritems(change_block_dict[employee])):
if rubric_root == 'S21.G00.31':
for date, change_block in change_date_block.iteritems():
for date, change_block in sorted(six.iteritems(change_date_block)):
dsn_file.append(getDSNBlockDict(block_id=rubric_root, change_block=change_block, change_date=date))
elif rubric_root == 'S21.G00.41':
for date, change_block in change_date_block.iteritems():
for date, change_block in sorted(six.iteritems(change_date_block)):
contract_change_block_list.append(getDSNBlockDict(block_id=rubric_root, change_block=change_block, change_date=date))
employee_data_dict['contract']['S21.G00.40.019'] = establishment_registration_code
......@@ -240,7 +241,7 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
dsn_file.extend(contract_change_block_list)
if employee in leave_period_dict:
for leave_period in leave_period_dict[employee]:
for leave_period in sorted(leave_period_dict[employee]):
leave_block = {rubric: leave_period.get(rubric, None)
for rubric in ('S21.G00.60.001',
'S21.G00.60.002',
......@@ -256,7 +257,7 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
leaving_employee_list.append(employee)
disenrollment_record = portal.restrictedTraverse(employee).Person_getCareerRecord('DSN Disenrollment Record')
dsn_file.append({rubric: value
for rubric, value in getDSNBlockDict("S21.G00.62", enrollment_record=enrollment_record, disenrollment_record=disenrollment_record).items()
for rubric, value in sorted(getDSNBlockDict("S21.G00.62", enrollment_record=enrollment_record, disenrollment_record=disenrollment_record).items())
if rubric in ('S21.G00.62.001',
'S21.G00.62.002',
'S21.G00.62.006',
......@@ -269,7 +270,7 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
# which are of the form : (contribution_category, contract_id)
insurance_contract_id_list = set([x[1] for x in paysheet_data_dict['taxable_base']])
for insurance_contract_id in insurance_contract_id_list:
for insurance_contract_id in sorted(insurance_contract_id_list):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.70',
enrollment_record=enrollment_record,
contract_id=insurance_contract_id))
......@@ -280,16 +281,16 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
net_salary=paysheet_data_dict['net_salary'],
net_taxable_salary=paysheet_data_dict['net_taxable_salary']))
for remuneration_block in paysheet_data_dict['remuneration']:
for remuneration_block in sorted(paysheet_data_dict['remuneration']):
dsn_file.append(remuneration_block)
for bonus_category in paysheet_data_dict['other_bonus'].itervalues():
for bonus_category in sorted(six.itervalues(paysheet_data_dict['other_bonus'])):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.52', target=bonus_category))
for bonus_category in paysheet_data_dict['other_income'].itervalues():
for bonus_category in sorted(six.itervalues(paysheet_data_dict['other_income'])):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.54', target=bonus_category))
for taxable_base_category in paysheet_data_dict['taxable_base'].itervalues():
for taxable_base_category in sorted(six.itervalues(paysheet_data_dict['taxable_base'])):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.78', target=taxable_base_category))
if taxable_base_category['code'] == '02': # Assiette Brute plafonnee
if ('063', '') in paysheet_data_dict['individual_contribution']:
......@@ -323,21 +324,21 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
dsn_file.append(getDSNBlockDict(block_id='S21.G00.81', target=paysheet_data_dict['individual_contribution'][('059', taxable_base_category['contract_id'])]))
del paysheet_data_dict['individual_contribution'][('059', taxable_base_category['contract_id'])]
for taxable_base_component_category in paysheet_data_dict['taxable_base_component'].itervalues():
for taxable_base_component_category in sorted(six.itervalues(paysheet_data_dict['taxable_base_component'])):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.79', target=taxable_base_component_category))
if ('03', '') in taxable_base_component_category:
dsn_file.append(getDSNBlockDict(block_id='S21.G00.81', target=paysheet_data_dict['individual_contribution'][('064', '')]))
del paysheet_data_dict['individual_contribution'][('064', '')]
for individual_contribution_category in paysheet_data_dict['individual_contribution'].itervalues():
for individual_contribution_category in sorted(six.itervalues(paysheet_data_dict['individual_contribution'])):
dsn_file.append(getDSNBlockDict(block_id='S21.G00.81', target=individual_contribution_category))
dsn_file.append(employee_data_dict['seniority'])
# Add leave event DSN if needed
if len(leave_period_dict):
for employee in leave_period_dict:
for period in leave_period_dict[employee]:
for employee in sorted(leave_period_dict):
for period in sorted(leave_period_dict[employee]):
#leave_date_as_string = period['S21.G00.60.002']
#year = int(leave_date_as_string[4:])
#month = int(leave_date_as_string[2:4])
......
......@@ -85,39 +85,39 @@ S21.G00.22.002,'44004750400020'
S21.G00.22.003,'01012015'
S21.G00.22.004,'31012015'
S21.G00.22.005,'5158.42'
S21.G00.23.001,'260'
S21.G00.23.002,'920'
S21.G00.23.004,'10278.00'
S21.G00.23.001,'479'
S21.G00.23.002,'920'
S21.G00.23.004,'275.00'
S21.G00.23.001,'772'
S21.G00.23.002,'920'
S21.G00.23.004,'9163.00'
S21.G00.23.001,'100'
S21.G00.23.002,'920'
S21.G00.23.003,'1.10'
S21.G00.23.004,'9163.00'
S21.G00.23.001,'100'
S21.G00.23.002,'921'
S21.G00.23.004,'8505.00'
S21.G00.23.001,'260'
S21.G00.23.002,'920'
S21.G00.23.004,'10278.00'
S21.G00.23.001,'332'
S21.G00.23.002,'921'
S21.G00.23.004,'8505.00'
S21.G00.23.001,'900'
S21.G00.23.001,'400'
S21.G00.23.002,'920'
S21.G00.23.003,'2.00'
S21.G00.23.004,'9163.00'
S21.G00.23.006,'59378'
S21.G00.23.004,'5335.00'
S21.G00.23.001,'430'
S21.G00.23.002,'920'
S21.G00.23.004,'6913.00'
S21.G00.23.001,'400'
S21.G00.23.001,'479'
S21.G00.23.002,'920'
S21.G00.23.004,'5335.00'
S21.G00.23.004,'275.00'
S21.G00.23.001,'671'
S21.G00.23.002,'921'
S21.G00.23.005,'32.00'
S21.G00.23.001,'100'
S21.G00.23.002,'921'
S21.G00.23.004,'8505.00'
S21.G00.23.001,'772'
S21.G00.23.002,'920'
S21.G00.23.004,'9163.00'
S21.G00.23.001,'900'
S21.G00.23.002,'920'
S21.G00.23.003,'2.00'
S21.G00.23.004,'9163.00'
S21.G00.23.006,'59378'
S21.G00.30.001,'1930259017323'
S21.G00.30.002,'Beginner'
S21.G00.30.004,'Usertest'
......@@ -130,10 +130,10 @@ S21.G00.30.013,'01'
S21.G00.30.014,'59'
S21.G00.30.015,'FR'
S21.G00.30.018,'info@nexedi.com'
S21.G00.31.001,'01012015'
S21.G00.31.011,'07071950'
S21.G00.31.001,'12012015'
S21.G00.31.009,'Beginnnner'
S21.G00.31.001,'01012015'
S21.G00.31.011,'07071950'
S21.G00.40.001,'01012015'
S21.G00.40.002,'04'
S21.G00.40.003,'01'
......@@ -174,6 +174,9 @@ S21.G00.71.002,'RETC'
S21.G00.50.001,'26012015'
S21.G00.50.002,'1845.43'
S21.G00.50.004,'1655.21'
S21.G00.53.001,'01'
S21.G00.53.002,'151.67'
S21.G00.53.003,'10'
S21.G00.51.001,'01012015'
S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
......@@ -184,9 +187,6 @@ S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
S21.G00.51.011,'002'
S21.G00.51.013,'2250.00'
S21.G00.53.001,'01'
S21.G00.53.002,'151.67'
S21.G00.53.003,'10'
S21.G00.51.001,'01012015'
S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
......@@ -197,20 +197,14 @@ S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
S21.G00.51.011,'010'
S21.G00.51.013,'2250.00'
S21.G00.54.001,'18'
S21.G00.54.002,'23.00'
S21.G00.54.003,'01012015'
S21.G00.54.004,'31012015'
S21.G00.54.001,'17'
S21.G00.54.002,'100.80'
S21.G00.54.003,'01012015'
S21.G00.54.004,'31012015'
S21.G00.78.001,'02'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'2250.00'
S21.G00.81.001,'063'
S21.G00.81.004,'219.38'
S21.G00.54.001,'18'
S21.G00.54.002,'23.00'
S21.G00.54.003,'01012015'
S21.G00.54.004,'31012015'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -220,27 +214,16 @@ S21.G00.79.001,'20'
S21.G00.79.004,'97.16'
S21.G00.81.001,'059'
S21.G00.81.004,'97.16'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'0.00'
S21.G00.78.005,'2'
S21.G00.79.001,'11'
S21.G00.79.004,'2250.00'
S21.G00.81.001,'059'
S21.G00.81.004,'15.75'
S21.G00.78.001,'04'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'2305.53'
S21.G00.78.001,'13'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'94.91'
S21.G00.78.001,'07'
S21.G00.78.001,'02'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'2250.00'
S21.G00.81.001,'063'
S21.G00.81.004,'219.38'
S21.G00.78.001,'03'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -253,6 +236,23 @@ S21.G00.81.001,'226'
S21.G00.81.002,'75367340900011'
S21.G00.81.003,'2250.00'
S21.G00.81.005,'59378'
S21.G00.78.001,'07'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'2250.00'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'0.00'
S21.G00.78.005,'2'
S21.G00.79.001,'11'
S21.G00.79.004,'2250.00'
S21.G00.81.001,'059'
S21.G00.81.004,'15.75'
S21.G00.78.001,'04'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'2305.53'
S21.G00.81.001,'018'
S21.G00.81.002,'75367340900011'
S21.G00.81.003,'2250.00'
......@@ -308,6 +308,9 @@ S21.G00.71.002,'RETC'
S21.G00.50.001,'26012015'
S21.G00.50.002,'2505.64'
S21.G00.50.004,'2300.93'
S21.G00.53.001,'01'
S21.G00.53.002,'151.67'
S21.G00.53.003,'10'
S21.G00.51.001,'01012015'
S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
......@@ -318,9 +321,6 @@ S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
S21.G00.51.011,'002'
S21.G00.51.013,'3085.28'
S21.G00.53.001,'01'
S21.G00.53.002,'151.67'
S21.G00.53.003,'10'
S21.G00.51.001,'01012015'
S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
......@@ -335,12 +335,6 @@ S21.G00.54.001,'17'
S21.G00.54.002,'62.40'
S21.G00.54.003,'01012015'
S21.G00.54.004,'31012015'
S21.G00.78.001,'02'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3085.28'
S21.G00.81.001,'063'
S21.G00.81.004,'300.81'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -350,27 +344,16 @@ S21.G00.79.001,'20'
S21.G00.79.004,'97.16'
S21.G00.81.001,'059'
S21.G00.81.004,'97.16'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'0.00'
S21.G00.78.005,'2'
S21.G00.79.001,'11'
S21.G00.79.004,'3085.28'
S21.G00.81.001,'059'
S21.G00.81.004,'21.60'
S21.G00.78.001,'04'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'4125.36'
S21.G00.78.001,'13'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'94.07'
S21.G00.78.001,'07'
S21.G00.78.001,'02'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3085.28'
S21.G00.81.001,'063'
S21.G00.81.004,'300.81'
S21.G00.78.001,'03'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -381,6 +364,23 @@ S21.G00.81.001,'226'
S21.G00.81.002,'75367340900011'
S21.G00.81.003,'3085.28'
S21.G00.81.005,'59378'
S21.G00.78.001,'07'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3085.28'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'0.00'
S21.G00.78.005,'2'
S21.G00.79.001,'11'
S21.G00.79.004,'3085.28'
S21.G00.81.001,'059'
S21.G00.81.004,'21.60'
S21.G00.78.001,'04'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'4125.36'
S21.G00.86.001,'01'
S21.G00.86.002,'02'
S21.G00.86.003,'11'
......@@ -432,6 +432,9 @@ S21.G00.71.002,'RETC'
S21.G00.50.001,'26012015'
S21.G00.50.002,'3116.21'
S21.G00.50.004,'2899.22'
S21.G00.53.001,'01'
S21.G00.53.002,'151.67'
S21.G00.53.003,'10'
S21.G00.51.001,'01012015'
S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
......@@ -442,9 +445,6 @@ S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
S21.G00.51.011,'002'
S21.G00.51.013,'3827.86'
S21.G00.53.001,'01'
S21.G00.53.002,'151.67'
S21.G00.53.003,'10'
S21.G00.51.001,'01012015'
S21.G00.51.002,'31012015'
S21.G00.51.010,'00000'
......@@ -459,12 +459,6 @@ S21.G00.54.001,'17'
S21.G00.54.002,'67.20'
S21.G00.54.003,'01012015'
S21.G00.54.004,'31012015'
S21.G00.78.001,'02'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3170.00'
S21.G00.81.001,'063'
S21.G00.81.004,'323.55'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -474,6 +468,16 @@ S21.G00.79.001,'20'
S21.G00.79.004,'97.16'
S21.G00.81.001,'059'
S21.G00.81.004,'97.16'
S21.G00.78.001,'13'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'86.36'
S21.G00.78.001,'02'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3170.00'
S21.G00.81.001,'063'
S21.G00.81.004,'323.55'
S21.G00.78.001,'31'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -485,18 +489,6 @@ S21.G00.79.001,'13'
S21.G00.79.004,'657.86'
S21.G00.81.001,'059'
S21.G00.81.004,'29.29'
S21.G00.78.001,'04'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3847.23'
S21.G00.78.001,'13'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'86.36'
S21.G00.78.001,'07'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3827.86'
S21.G00.78.001,'03'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
......@@ -507,6 +499,14 @@ S21.G00.81.001,'226'
S21.G00.81.002,'75367340900011'
S21.G00.81.003,'3827.86'
S21.G00.81.005,'59378'
S21.G00.78.001,'07'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3827.86'
S21.G00.78.001,'04'
S21.G00.78.002,'01012015'
S21.G00.78.003,'31012015'
S21.G00.78.004,'3847.23'
S21.G00.86.001,'01'
S21.G00.86.002,'02'
S21.G00.86.003,'11'
......
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