2010-10-15 11:43:59 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#-*- coding:utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
|
|
|
# d$
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2010-10-28 06:54:18 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
2010-10-15 11:43:59 +00:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-10-28 06:54:18 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2010-10-15 11:43:59 +00:00
|
|
|
#
|
2010-10-28 06:54:18 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-10-15 11:43:59 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2010-06-06 16:30:23 +00:00
|
|
|
import time
|
2010-09-29 08:05:01 +00:00
|
|
|
from datetime import datetime
|
2010-06-06 16:30:23 +00:00
|
|
|
from report import report_sxw
|
|
|
|
|
|
|
|
class report_payroll_register(report_sxw.rml_parse):
|
|
|
|
def __init__(self, cr, uid, name, context):
|
|
|
|
super(report_payroll_register, self).__init__(cr, uid, name, context)
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-06-06 16:30:23 +00:00
|
|
|
self.total_amount = 0.00
|
|
|
|
self.total_bysal = 0.00
|
|
|
|
self.localcontext.update({
|
|
|
|
'time': time,
|
|
|
|
'get_month': self.get_month,
|
|
|
|
'get_no': self.get_no,
|
|
|
|
'get_basic':self.get_basic,
|
|
|
|
'get_other':self.get_other,
|
|
|
|
'get_allow':self.get_allow,
|
|
|
|
'get_grows':self.get_grows,
|
|
|
|
'get_deduct':self.get_deduct,
|
|
|
|
'get_net':self.get_net,
|
|
|
|
'add_line':self.add_line,
|
|
|
|
})
|
|
|
|
self.no = 0
|
|
|
|
self.basic = 0.0
|
|
|
|
self.other = 0.0
|
|
|
|
self.allow = 0.0
|
|
|
|
self.grows = 0.0
|
|
|
|
self.deduct = 0.0
|
|
|
|
self.net = 0.0
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-06-06 16:30:23 +00:00
|
|
|
def add_line(self, line):
|
|
|
|
self.basic += line.basic
|
|
|
|
self.other += line.other_pay
|
|
|
|
self.allow += line.allounce
|
|
|
|
self.grows += line.grows
|
|
|
|
self.deduct += line.deduction
|
|
|
|
self.net += line.net
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-10-08 13:53:53 +00:00
|
|
|
def get_basic(self,obj):
|
|
|
|
for line in obj.line_ids:
|
|
|
|
self.basic += line.basic
|
2010-06-06 16:30:23 +00:00
|
|
|
return self.basic
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-10-08 13:53:53 +00:00
|
|
|
def get_other(self,obj):
|
|
|
|
for line in obj.line_ids:
|
|
|
|
self.other += line.other_pay
|
2010-06-06 16:30:23 +00:00
|
|
|
return self.other
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-10-08 13:53:53 +00:00
|
|
|
def get_allow(self,obj):
|
|
|
|
for line in obj.line_ids:
|
|
|
|
self.allow += line.allounce
|
2010-06-06 16:30:23 +00:00
|
|
|
return self.allow
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-10-08 13:53:53 +00:00
|
|
|
def get_grows(self,obj):
|
|
|
|
for line in obj.line_ids:
|
|
|
|
self.grows += line.grows
|
2010-06-06 16:30:23 +00:00
|
|
|
return self.grows
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-10-08 13:53:53 +00:00
|
|
|
def get_deduct(self,obj):
|
|
|
|
for line in obj.line_ids:
|
|
|
|
self.deduct += line.deduction
|
2010-06-06 16:30:23 +00:00
|
|
|
return self.deduct
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-10-08 13:53:53 +00:00
|
|
|
def get_net(self,obj):
|
|
|
|
for line in obj.line_ids:
|
|
|
|
self.net += line.net
|
2010-06-06 16:30:23 +00:00
|
|
|
return self.net
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-06-06 16:30:23 +00:00
|
|
|
def get_month(self, indate):
|
2010-09-29 08:05:01 +00:00
|
|
|
new_date = datetime.strptime(indate, '%Y-%m-%d')
|
2010-06-06 16:30:23 +00:00
|
|
|
out_date = new_date.strftime('%B')+'-'+new_date.strftime('%Y')
|
|
|
|
return out_date
|
|
|
|
|
|
|
|
def get_no(self):
|
|
|
|
self.no += 1
|
|
|
|
return self.no
|
2010-10-15 11:43:59 +00:00
|
|
|
|
2010-06-06 16:30:23 +00:00
|
|
|
report_sxw.report_sxw(
|
2010-10-15 11:43:59 +00:00
|
|
|
'report.hr.payroll.register.sheet',
|
|
|
|
'hr.payroll.register',
|
|
|
|
'hr_payroll/report/payroll_register.rml',
|
2010-06-06 16:30:23 +00:00
|
|
|
parser=report_payroll_register
|
2010-10-15 11:43:59 +00:00
|
|
|
)
|
2010-10-15 06:06:46 +00:00
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|