fixes in employee leave balance report
This commit is contained in:
parent
1ad42f09df
commit
abe9d7be0b
@ -49,7 +49,7 @@ class DocType:
|
||||
emp_query = "select name from `tabEmployee` "
|
||||
if flag == 1:
|
||||
emp_query += condition
|
||||
e = sql(emp_query)
|
||||
e = sql(emp_query, debug=1)
|
||||
return e
|
||||
|
||||
# ----------------
|
||||
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
leave_types = sql("""
|
||||
SELECT name FROM `tabLeave Type`
|
||||
WHERE
|
||||
@ -57,7 +58,7 @@ try:
|
||||
if d[3] in colnames:
|
||||
# If exists, then append the leave type data
|
||||
if exists:
|
||||
res[ind][colnames.index(d[3])] = d[4] - d[5]
|
||||
res[ind][colnames.index(d[3])] = flt(d[4]) - flt(d[5])
|
||||
res[ind][len(colnames)-1] = sum(res[ind][3:-1])
|
||||
# Else create a new row in res
|
||||
else:
|
||||
@ -65,7 +66,7 @@ try:
|
||||
new_row[0] = d[0]
|
||||
new_row[1] = d[1]
|
||||
new_row[2] = d[2]
|
||||
new_row[colnames.index(d[3])] = d[4] - d[5]
|
||||
new_row[colnames.index(d[3])] = flt(d[4]) - flt(d[5])
|
||||
new_row[len(colnames)-1] = sum(new_row[3:-1])
|
||||
res.append(new_row)
|
||||
except Exception, e:
|
||||
|
@ -6,14 +6,13 @@ SELECT
|
||||
leave_alloc.total_leaves_allocated AS 'total_leaves_allocated',
|
||||
SUM(leave_app.total_leave_days) AS 'total_leaves_applied'
|
||||
FROM
|
||||
`tabLeave Allocation` AS leave_alloc,
|
||||
`tabLeave Application` AS leave_app
|
||||
WHERE
|
||||
leave_alloc.employee=leave_app.employee AND
|
||||
`tabLeave Allocation` AS leave_alloc LEFT JOIN `tabLeave Application` AS leave_app
|
||||
ON leave_alloc.employee=leave_app.employee AND
|
||||
leave_alloc.leave_type=leave_app.leave_type AND
|
||||
leave_alloc.fiscal_year=leave_app.fiscal_year AND
|
||||
leave_alloc.docstatus=1 AND
|
||||
leave_app.docstatus=1 AND
|
||||
leave_app.docstatus=1
|
||||
WHERE
|
||||
leave_alloc.docstatus=1 AND
|
||||
leave_alloc.fiscal_year LIKE '%(fiscal_year)s%%' AND
|
||||
leave_alloc.employee_name LIKE '%(employee_name)s%%'
|
||||
GROUP BY
|
||||
|
Loading…
Reference in New Issue
Block a user