To get only the quantity of employee between joining date and relieving date you can use the following:
in .js file:
frappe.query_reports["Your Report Name"] = {
"filters": [
{
"fieldname":"date_of_joining",
"label": __("Date of Joining"),
"fieldtype": "Date",
"default": frappe.datetime.get_today()
},
{
"fieldname":"relieving_date",
"label": __("Relieving Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today()
},
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
}
]
}
and in .py file:
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
data = get_employees(filters)
return columns, data
def get_columns():
return [
_("Employee QTY between Dates") + ":Data:120"
]
def get_employees(filters):
return frappe.db.sql("""SELECT COUNT(`name`) FROM `tabEmployee`
WHERE `date_of_joining` >= '{date_of_joining}'
AND (`relieving_date` <= '{relieving_date}' OR `relieving_date` IS NULL)
AND `company` = '{company}'""".format(date_of_joining=filters['date_of_joining'], relieving_date=filters['relieving_date'], company=filters['company']), as_list=1)
but for this case, a script report is too much for my mind, you can easely just filter the list view of employee and see the qty of records