'Returns list of active employees based on selected criteria
and for which salary structure exists'

def get_emp_list(self):

    cond = self.get_filter_condition()
    cond += self.get_joining_releiving_condition()
    condition = u''
    if self.payroll_frequency:
        condition = (u"and    payroll_frequency    =    '%(payroll_frequency)s'" % {u'payroll_frequency': self.payroll_frequency})
    sal_struct = frappe.db.sql(u"\n DCTB  DCTB  DCTB  DCTB select\n DCTB  DCTB  DCTB  DCTB  DCTB name    from    `tabSalary    Structure`\n DCTB  DCTB  DCTB  DCTB where\n DCTB  DCTB  DCTB  DCTB  DCTB docstatus    !=    2    and\n DCTB  DCTB  DCTB  DCTB  DCTB is_active    =    'Yes'\n DCTB  DCTB  DCTB  DCTB  DCTB and    company    =    %(company)s    and\n DCTB  DCTB  DCTB  DCTB  DCTB ifnull(salary_slip_based_on_timesheet,0)    =    %(salary_slip_based_on_timesheet)s\n DCTB  DCTB  DCTB  DCTB  DCTB {condition}".format(condition=condition), {u'company': self.company, u'salary_slip_based_on_timesheet': self.salary_slip_based_on_timesheet})
    if sal_struct:
        cond += u'and    t2.parent    IN    %(sal_struct)s    '
        emp_list = frappe.db.sql((u'\n DCTB  DCTB  DCTB  DCTB select\n DCTB  DCTB  DCTB  DCTB  DCTB t1.name\n DCTB  DCTB  DCTB  DCTB from\n DCTB  DCTB  DCTB  DCTB  DCTB `tabEmployee`    t1,    `tabSalary    Structure    Employee`    t2\n DCTB  DCTB  DCTB  DCTB where\n DCTB  DCTB  DCTB  DCTB  DCTB t1.docstatus!=2\n DCTB  DCTB  DCTB  DCTB  DCTB and    t1.name    =    t2.employee\n DCTB  DCTB  DCTB %s    ' % cond), {u'sal_struct': sal_struct})
        return emp_list
