fixes in employee leave balance report
diff --git a/hr/doctype/leave_control_panel/leave_control_panel.py b/hr/doctype/leave_control_panel/leave_control_panel.py
index a2d4fee..c81575c 100644
--- a/hr/doctype/leave_control_panel/leave_control_panel.py
+++ b/hr/doctype/leave_control_panel/leave_control_panel.py
@@ -49,7 +49,7 @@
emp_query = "select name from `tabEmployee` "
if flag == 1:
emp_query += condition
- e = sql(emp_query)
+ e = sql(emp_query, debug=1)
return e
# ----------------
diff --git a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py
index cb82210..5b8ed08 100644
--- a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py
+++ b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py
@@ -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 @@
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 @@
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:
diff --git a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql
index 50811c0..454772a 100644
--- a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql
+++ b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql
@@ -6,14 +6,13 @@
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