Commit b4ad51f5 authored by Kevin Deldycke's avatar Kevin Deldycke

Remove junk code

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10912 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5aafbcc8
......@@ -333,179 +333,10 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
\n
\n
\n
##########################################\n
# TODO: insert code here to get yearly totals\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
# for pay_sheet_line in object_list:\n
# variation_list = pay_sheet_line.getVariationCategoryList()\n
# range_variation = []\n
# for variation in variation_list:\n
# if variation.find(\'salary_range\') == 0:\n
# if not variation in range_variation: # Extra checking because\n
# # get VariationCategoryList returns\n
# # the same 1 items 2 times\n
# # This is normally no longer true, I fix this bug years ago (!)\n
# range_variation += [variation]\n
# for range in range_variation:\n
# pay_sheet_dict = {}\n
# pay_sheet_dict[\'id\'] = pay_sheet_line.getId()\n
# pay_sheet_dict[\'title\'] = pay_sheet_line.getResourceTitle()\n
# for cell in pay_sheet_line.objectValues():\n
# cat_list = cell.getCategoryList()\n
# if range in cat_list:\n
# pay_sheet_dict[\'base_name\'] = context.portal_categories.resolveCategory(range).getTitleOrId()\n
# for category in cat_list:\n
# # BUG: why cell.getTotalPrice() use the method from Amount instead of the one defined in Movement ?\n
# cell_price = cell.getPrice()\n
# cell_quantity = cell.getQuantity()\n
# cell_total_price = r_(cell_price * cell_quantity)\n
# # Hack to not display things added to the gross salary\n
# if cell_total_price != 0 or cell.getResourceId() not in (\'primes\', \'retenue_maladie\'):\n
# if category.find(\'employee_share\') >= 0:\n
# pay_sheet_dict[\'base\'] = -cell_quantity # change the sign to beautify\n
# pay_sheet_dict[\'employee_share\'] = -cell_total_price\n
# pay_sheet_dict[\'employee_share_rate\'] = cell_price * 100\n
# # here we decide if a resource is taxable\n
# if str(pay_sheet_line.getResource())[-14:] == \'non_deductible\' or \\\n
# str(pay_sheet_line.getResource())[-4:] == \'crds\' or \\\n
# str(pay_sheet_line.getResource())[-7:] == \'taxable\':\n
# pay_sheet_dict[\'taxable\'] = \'yes\'\n
# elif str(pay_sheet_line.getResource())[-10:] == \'deductible\':\n
# pay_sheet_dict[\'taxable\'] = \'no\'\n
# else:\n
# pay_sheet_dict[\'taxable\'] = \'no\'\n
# if pay_sheet_dict[\'taxable\'] == \'yes\':\n
# if pay_sheet_dict[\'employee_share\'] not in (\'\', None):\n
# total_taxable_employee_share = r_(total_taxable_employee_share + r_(pay_sheet_dict[\'employee_share\']))\n
# elif category.find(\'employer_share\') >= 0:\n
# pay_sheet_dict[\'base\'] = -cell_quantity # change the sign for the beautification effect\n
# pay_sheet_dict[\'employer_share\'] = -cell_total_price\n
# pay_sheet_dict[\'employer_share_rate\'] = cell_price * 100\n
# if pay_sheet_dict[\'employer_share\'] not in (\'\', None):\n
# total_employer_share = r_(total_employer_share + r_(pay_sheet_dict[\'employer_share\']))\n
# if range.endswith(\'forfait\'):\n
# pay_sheet_dict[\'base\'] = \'\'\n
# pay_sheet_dict[\'employer_share_rate\'] = \'\'\n
# pay_sheet_dict[\'employee_share_rate\'] = \'\'\n
# for key in [\'employee_share\',\'employee_share_rate\',\'employer_share\',\'employer_share_rate\']:\n
# if not (pay_sheet_dict.has_key(key)):\n
# pay_sheet_dict[key] = \'\' # so that we can display nothing\n
#\n
# # find the category of the current pay sheet line\n
# cat_id = None\n
# cat_path = None\n
# for var in variation_list:\n
# sub_cat = var.split(\'/\')\n
# if sub_cat[0] == \'tax_category\':\n
# cat_id = sub_cat[1]\n
# cat_path = sub_cat[0] + \'/\' + sub_cat[1]\n
# break\n
# if cat_id == None:\n
# cat_id = \'no_cat\'\n
# # add the current pay sheet line to its category\n
# if not paysheet_cat.has_key(cat_id):\n
# paysheet_cat[cat_id] = {}\n
# paysheet_cat[cat_id][\'lines\'] = []\n
# if cat_path != None:\n
# paysheet_cat[cat_id][\'title\'] = context.portal_categories.resolveCategory(cat_path).getTitleOrId()\n
# paysheet_cat[cat_id][\'lines\'].append(pay_sheet_dict)\n
\n
\n
# get all paysheet transaction to calculate the sum of different value in a year\n
# accounting_folder = context.aq_parent\n
# paysheet_transactions = accounting_folder.searchFolder(portal_type=\'Pay Sheet Transactionss\')\n
#\n
# # initialize every yearly variable\n
# yearly_net_salary = 0.0\n
# yearly_gross_salary = 0.0\n
# yearly_csg_salary = 0.0\n
# yearly_ceiling_salary = 0.0\n
# yearly_slice_a_salary = 0.0\n
# yearly_slice_b_salary = 0.0\n
# yearly_slice_c_salary = 0.0\n
# yearly_employee_share = 0.0\n
# yearly_employer_share = 0.0\n
# yearly_taxable_net_salary = 0.0\n
#\n
# # get the current paysheet start date and employee\n
# from DateTime import DateTime\n
# start_date = context.getStartDate()\n
# start_date = DateTime("%i/01/01" % start_date.year())\n
# stop_date = context.getStopDate()\n
# employee = context.restrictedTraverse(context.getDestinationSectionRelativeUrl())\n
#\n
# #start_date = start_date.strftime(\'%Y-%m-%d\')\n
# #stop_date = start_date.strftime(\'%Y-%m-%d\')\n
# #yearly_employee_share = -float(context.PaySheetTransaction_zGetDetailedTotal(start_date=start_date,stop_date=stop_date,tax_category=\'employee_share\')[0].total)\n
# #yearly_employer_share = -float(context.PaySheetTransaction_zGetDetailedTotal(start_date=start_date,stop_date=stop_date,tax_category=\'employer_share\')[0].total)\n
#\n
# #try:\n
# # yearly_employer_share = -float(context.PaySheetTransaction_zGetDetailedTotal(start_date=start_date,stop_date=stop_date,tax_category=\'employer_share\')[0].total)\n
# #except KeyError:\n
# # pass\n
#\n
# # browse through paysheet transaction\n
# for paysheet_obj in paysheet_transactions:\n
# # ignore the current paysheet to avoid infinite loop\n
# if paysheet_obj.getId() != context.getId():\n
# # the paysheet must have the same employee\n
# if (employee == None) or \\\n
# (employee != None and \\\n
# context.restrictedTraverse(paysheet_obj.getDestinationSectionRelativeUrl()) == employee):\n
# # check the date\n
# if (start_date == None) or \\\n
# (start_date != None and \\\n
# paysheet_obj.getStartDate() != None and \\\n
# start_date.year() == paysheet_obj.getStartDate().year() and \\\n
# paysheet_obj.getStartDate() <= start_date):\n
# # get all detailed values of the paysheet\n
# old_ps = paysheet_obj.PaySheetTransaction_getDetails()\n
# # sum of yearly values\n
# yearly_net_salary = r_(yearly_net_salary + r_(old_ps[\'net_salary\']))\n
# yearly_gross_salary = r_(yearly_gross_salary + r_(old_ps[\'gross_salary\']))\n
# yearly_csg_salary = r_(yearly_csg_salary + r_(old_ps[\'csg_salary\']))\n
# yearly_ceiling_salary = r_(yearly_ceiling_salary + r_(old_ps[\'ceiling_salary\']))\n
# yearly_slice_a_salary = r_(yearly_slice_a_salary + r_(old_ps[\'slice_a_salary\']))\n
# yearly_slice_b_salary = r_(yearly_slice_b_salary + r_(old_ps[\'slice_b_salary\']))\n
# yearly_slice_c_salary = r_(yearly_slice_c_salary + r_(old_ps[\'slice_c_salary\']))\n
# yearly_employee_share = r_(yearly_employee_share + r_(old_ps[\'total_employee_share\']))\n
# yearly_employer_share = r_(yearly_employer_share + r_(old_ps[\'total_employer_share\']))\n
# yearly_taxable_net_salary = r_(yearly_taxable_net_salary + r_(old_ps[\'taxable_net_salary\']))\n
#\n
# # save the total share values in the exported dict\n
# details[\'net_salary\'] = net_salary\n
# details[\'gross_salary\'] = gross_salary\n
# details[\'csg_salary\'] = csg_salary\n
# details[\'ceiling_salary\'] = ceiling_salary\n
# details[\'slice_a_salary\'] = slice_a_salary\n
# details[\'slice_b_salary\'] = slice_b_salary\n
# details[\'slice_c_salary\'] = slice_c_salary\n
# details[\'paysheet_categories\'] = paysheet_cat\n
# details[\'total_employee_share\'] = total_employee_share\n
# details[\'total_employer_share\'] = total_employer_share\n
# details[\'total_taxable_employee_share\'] = -total_taxable_employee_share # change the sign for the beautification effect\n
# details[\'taxable_net_salary\'] = r_(total_taxable_employee_share + r_(details[\'net_salary\']))\n
#\n
# # don\'t forget to add the current values to the yearly sum\n
# details[\'yearly_net_salary\'] = r_(yearly_net_salary + r_(details[\'net_salary\']))\n
# details[\'yearly_gross_salary\'] = r_(yearly_gross_salary + r_(details[\'gross_salary\']))\n
# details[\'yearly_csg_salary\'] = r_(yearly_csg_salary + r_(details[\'csg_salary\']))\n
# details[\'yearly_ceiling_salary\'] = r_(yearly_ceiling_salary + r_(details[\'ceiling_salary\']))\n
# details[\'yearly_slice_a_salary\'] = r_(yearly_slice_a_salary + r_(details[\'slice_a_salary\']))\n
# details[\'yearly_slice_b_salary\'] = r_(yearly_slice_b_salary + r_(details[\'slice_b_salary\']))\n
# details[\'yearly_slice_c_salary\'] = r_(yearly_slice_c_salary + r_(details[\'slice_c_salary\']))\n
# details[\'yearly_employee_share\'] = r_(yearly_employee_share + r_(details[\'total_employee_share\']))\n
# details[\'yearly_employer_share\'] = r_(yearly_employer_share + r_(details[\'total_employer_share\']))\n
# details[\'yearly_taxable_net_salary\'] = r_(yearly_taxable_net_salary + r_(details[\'taxable_net_salary\']))\n
\n
\n
############################\n
### END OF JUNK CODE ###\n
############################\n
\n
\n
details[\'totals\'][\'gross_salary\'] = gross_salary\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