Merge pull request #5880 from bcornwellmott/fixSalarySlip_TimeSheet_SQL

Added date filters for the Timesheet query in Salary Slip
This commit is contained in:
Rushabh Mehta 2016-07-27 08:22:29 +05:30 committed by GitHub
commit fd288f36ec

View File

@ -64,8 +64,8 @@ class SalarySlip(TransactionBase):
if self.salary_slip_based_on_timesheet and not self.get('timesheets'):
self.set("timesheets", [])
timesheets = frappe.db.sql(""" select * from `tabTimesheet` where employee = %(employee)s and (status = 'Submitted' or
status = 'Billed')""", {'employee': self.employee}, as_dict=1)
timesheets = frappe.db.sql(""" select * from `tabTimesheet` where employee = %(employee)s and start_date BETWEEN %(start_date)s AND %(end_date)s and (status = 'Submitted' or
status = 'Billed')""", {'employee': self.employee, 'start_date': self.start_date, 'end_date': self.end_date}, as_dict=1)
for data in timesheets:
self.append('timesheets', {