From 9bf62c39d7dc92de7b3c8288774721de8047dadb Mon Sep 17 00:00:00 2001 From: vra Date: Mon, 11 Oct 2010 11:40:58 +0530 Subject: [PATCH] [FIX][IMP]hr_payroll : Fixed and improved the employee detail and year report. bzr revid: vra@tinyerp.com-20101011061058-djvd4zijs2b9s2rn --- .../report/report_employees_detail.py | 17 +++-- .../report/report_employees_detail.rml | 75 +++++++++---------- .../hr_payroll/report/report_year_report.rml | 60 +++++++-------- .../hr_payroll/report/report_year_salary.py | 16 ++-- 4 files changed, 86 insertions(+), 82 deletions(-) diff --git a/addons/hr_payroll/report/report_employees_detail.py b/addons/hr_payroll/report/report_employees_detail.py index f3ecb56aa0b..fe4b0537896 100644 --- a/addons/hr_payroll/report/report_employees_detail.py +++ b/addons/hr_payroll/report/report_employees_detail.py @@ -48,10 +48,14 @@ class employees_salary_report(rml_parse.rml_parse): m = datetime.date(cy, cm, 1).strftime('%b') mnth_name.append(m) self.mnths.append(str(cm)+'-'+str(cy)) + if cm == 12: cm = 0 cy = ly cm = cm +1 + for c in range(0,(12-no_months)): + mnth_name.append('None') + self.mnths.append('None') return [mnth_name] def get_employee(self,form): @@ -134,11 +138,14 @@ class employees_salary_report(rml_parse.rml_parse): category_name = self.pool.get('hr.allounce.deduction.categoty').read(self.cr, self.uid, [category],['name','type'])[0] result.append(category_name['name']) for mnth in self.mnths: - if len(mnth) != 7: - mnth = '0' + str(mnth) - query = "select id from hr_payslip where employee_id = "+str(emp_id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " - self.cr.execute(query) - payslip_id = self.cr.dictfetchone() + if mnth <> 'None': + if len(mnth) != 7: + mnth = '0' + str(mnth) + query = "select id from hr_payslip where employee_id = "+str(emp_id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " + self.cr.execute(query) + payslip_id = self.cr.dictfetchone() + else: + payslip_id = False if payslip_id: payslip_obj = self.pool.get('hr.payslip').browse(self.cr, self.uid, payslip_id['id']) if not category: diff --git a/addons/hr_payroll/report/report_employees_detail.rml b/addons/hr_payroll/report/report_employees_detail.rml index e1bd6c3b3c8..b4e577e1f22 100644 --- a/addons/hr_payroll/report/report_employees_detail.rml +++ b/addons/hr_payroll/report/report_employees_detail.rml @@ -184,6 +184,20 @@ + + + + + + + + + + + + + + @@ -329,46 +343,46 @@
[[ repeatIn(get_periods(data['form']),'m') ]] [[ get_employee_detail(o) ]] - + Title - [[ m[0] ]] + [[ m[0] != 'None' and m[0] or '' ]] - [[ m[1] ]] + [[ m[1] != 'None' and m[1] or '' ]] - [[ m[2] ]] + [[ m[2] != 'None' and m[2] or '' ]] - [[ m[3] ]] + [[ m[3] != 'None' and m[3] or '' ]] - [[ m[4] ]] + [[ m[4] != 'None' and m[4] or '' ]] - [[ m[5] ]] + [[ m[5] != 'None' and m[5] or '' ]] - [[ m[6] ]] + [[ m[6] != 'None' and m[6] or '' ]] - [[ m[7] ]] + [[ m[7] != 'None' and m[7] or '' ]] - [[ m[8] ]] + [[ m[8] != 'None' and m[8] or '' ]] - [[ m[9] ]] + [[ m[9] != 'None' and m[9] or '' ]] - [[ m[10] ]] + [[ m[10] != 'None' and m[10] or '' ]] - [[ m[11] ]] + [[ m[11] != 'None' and m[11] or '' ]] Total @@ -379,9 +393,6 @@
- - - @@ -390,8 +401,8 @@
- [[ repeatIn(get_allow(),'e1') ]] - + [[ repeatIn(get_allow(),'e1') ]] + [[ e1[0] ]] @@ -437,9 +448,6 @@ - - -
@@ -449,8 +457,8 @@
- [[ repeatIn(get_deduct(),'e2') ]] - + [[ repeatIn(get_deduct(),'e2') ]] + [[ e2[0] ]] @@ -496,9 +504,6 @@ - - -
@@ -508,8 +513,8 @@
- [[ repeatIn(get_other(),'e3') ]] - + [[ repeatIn(get_other(),'e3') ]] + [[ e3[0] ]] @@ -555,18 +560,9 @@ - - -
- - -
- - - - + [[ get_monthly_total()[0] ]] @@ -616,9 +612,6 @@
- - - diff --git a/addons/hr_payroll/report/report_year_report.rml b/addons/hr_payroll/report/report_year_report.rml index 052af6f4701..527491552aa 100755 --- a/addons/hr_payroll/report/report_year_report.rml +++ b/addons/hr_payroll/report/report_year_report.rml @@ -63,11 +63,24 @@ + + + + + + + + + + + + + + - @@ -133,58 +146,55 @@
- [[ repeatIn(get_periods(data['form']),'m') ]] + [[ repeatIn(get_periods(data['form']),'m') ]] Name - [[ m[0] ]] + [[ m[0] != 'None' and m[0] or '' ]] - [[ m[1] ]] + [[ m[1] != 'None' and m[1] or '' ]] - [[ m[2] ]] + [[ m[2] != 'None' and m[2] or '' ]] - [[ m[3] ]] + [[ m[3] != 'None' and m[3] or '' ]] - [[ m[4] ]] + [[ m[4] != 'None' and m[4] or '' ]] - [[ m[5] ]] + [[ m[5] != 'None' and m[5] or '' ]] - [[ m[6] ]] + [[ m[6] != 'None' and m[6] or '' ]] - [[ m[7] ]] + [[ m[7] != 'None' and m[7] or '' ]] - [[ m[8] ]] + [[ m[8] != 'None' and m[8] or '' ]] - [[ m[9] ]] + [[ m[9] != 'None' and m[9] or '' ]] - [[ m[10] ]] + [[ m[10] != 'None' and m[10] or '' ]] - [[ m[11] ]] + [[ m[11] != 'None' and m[11] or '' ]] Total - - -
- [[ repeatIn(get_employee(data['form']),'e') ]] + [[ repeatIn(get_employee(data['form']),'e') ]] @@ -231,19 +241,10 @@ - - -
- - -
- - -
- [[ repeatIn(get_months_tol(),'t') ]] + [[ repeatIn(get_months_tol(),'t') ]] @@ -294,8 +295,5 @@
- - - diff --git a/addons/hr_payroll/report/report_year_salary.py b/addons/hr_payroll/report/report_year_salary.py index b23effbeccb..6c830b80941 100755 --- a/addons/hr_payroll/report/report_year_salary.py +++ b/addons/hr_payroll/report/report_year_salary.py @@ -43,6 +43,9 @@ class year_salary_report(rml_parse.rml_parse): cm = 0 cy = ly cm = cm +1 + for c in range(0,(12-no_months)): + mnth_name.append('None') + self.mnths.append('None') return [mnth_name] def get_employee(self,form): @@ -58,11 +61,14 @@ class year_salary_report(rml_parse.rml_parse): ls1.append(emp_id.name) tol = 0.0 for mnth in self.mnths: - if len(mnth) != 7: - mnth = '0' + str(mnth) - query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " - self.cr.execute(query) - sal = self.cr.fetchall() + if mnth <> 'None': + if len(mnth) != 7: + mnth = '0' + str(mnth) + query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " + self.cr.execute(query) + sal = self.cr.fetchall() + else: + sal = [(0.0,)] try: ls1.append(sal[0][0]) except: