コード例 #1
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions

    conditions = get_event_conditions("Opportunity", filters)

    data = frappe.db.sql(
        """
		select
			distinct `tabOpportunity`.name, `tabOpportunity`.customer_name, `tabOpportunity`.opportunity_amount,
			`tabOpportunity`.title, `tabOpportunity`.contact_date
		from
			`tabOpportunity`
		where
			(`tabOpportunity`.contact_date between %(start)s and %(end)s)
			{conditions}
		""".format(conditions=conditions),
        {
            "start": start,
            "end": end
        },
        as_dict=True,
        update={"allDay": 0},
    )
    return data
コード例 #2
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    filters = json.loads(filters)
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Timesheet", filters)

    return frappe.db.sql("""SELECT `tabTimesheet Detail`.name as name,
			`tabTimesheet Detail`.docstatus as status,
			`tabTimesheet Detail`.parent as parent,
			employee_name,
			`tabTimesheet`.from_date as from_date,
			`tabTimesheet`.total_hours as hours,
			activity,
			`tabTimesheet`.project,
			`tabTimesheet`.to_date as to_date,
			CONCAT(employee_name,' \n Projekt: ',`tabTimesheet`.project,'\n Aktivita: ',activity,' \n Úloha: ',`tabTimesheet`.task_name,'\n', ' (', ROUND(total_hours,2),' hrs)') as title
		FROM `tabTimesheet`, `tabTimesheet Detail`
		WHERE `tabTimesheet Detail`.parent = `tabTimesheet`.name
			AND `tabTimesheet`.docstatus < 2
			AND (from_date <= %(end)s and to_date >= %(start)s) {conditions} {match_cond}
		ORDER BY employee_name
		""".format(conditions=conditions, match_cond=get_match_cond('Timesheet')), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})
コード例 #3
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Patient Appointment", filters)

    data = frappe.db.sql("""
		select
		`tabPatient Appointment`.name, `tabPatient Appointment`.patient,
		`tabPatient Appointment`.practitioner, `tabPatient Appointment`.status,
		`tabPatient Appointment`.duration,
		timestamp(`tabPatient Appointment`.appointment_date, `tabPatient Appointment`.appointment_time) as 'start',
		`tabAppointment Type`.color
		from
		`tabPatient Appointment`
		left join `tabAppointment Type` on `tabPatient Appointment`.appointment_type=`tabAppointment Type`.name
		where
		(`tabPatient Appointment`.appointment_date between %(start)s and %(end)s)
		and `tabPatient Appointment`.status != 'Cancelled' and `tabPatient Appointment`.docstatus < 2 {conditions}"""
                         .format(conditions=conditions), {
                             "start": start,
                             "end": end
                         },
                         as_dict=True,
                         update={"allDay": 0})

    for item in data:
        item.end = item.start + datetime.timedelta(minutes=item.duration)

    return data
コード例 #4
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Patient Appointment", filters)

    data = frappe.db.sql("""select name, patient, practitioner, status,
		duration, timestamp(appointment_date, appointment_time) as
		'appointment_date' from `tabPatient Appointment` where
		(appointment_date between %(start)s and %(end)s)
		and docstatus < 2 {conditions}""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})

    for item in data:
        item.appointment_datetime = item.appointment_date + datetime.timedelta(
            minutes=item.duration)

    return data
コード例 #5
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Restaurant Reservation", filters)

    data = frappe.db.sql("""select name, reservation_time,
			reservation_end_time, customer_name, status, no_of_people
		from
			`tabRestaurant Reservation`
		where
			((ifnull(reservation_time, '0000-00-00')!= '0000-00-00') \
				and (reservation_time <= %(end)s) \
			or ((ifnull(reservation_end_time, '0000-00-00')!= '0000-00-00') \
				and reservation_end_time >= %(start)s))
		{conditions}""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})

    return data
コード例 #6
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters like workstation, project etc.
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Time Log", filters)

    data = frappe.db.sql("""select name, from_time, to_time,
		activity_type, task, project, production_order, workstation from `tabTime Log`
		where docstatus < 2 and ( from_time between %(start)s and %(end)s or to_time between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})

    for d in data:
        d.title = d.name + ": " + (d.activity_type or d.production_order or "")
        if d.task:
            d.title += " for Task: " + d.task
        if d.project:
            d.title += " for Project: " + d.project

    return data
コード例 #7
0
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Meeting", filters)

	data = frappe.db.sql("""
		select
		`tabMeeting`.title,
		`tabMeeting`.user,
		`tabMeeting`.adviser,
		`tabMeeting`.date_time as 'start'
		from
		`tabMeeting`
		where
		(`tabMeeting`.date_time between %(start)s and %(end)s)
		and `tabMeeting`.docstatus < 2 {conditions}""".format(conditions=conditions),
		{"start": start, "end": end}, as_dict=True, update={"allDay": 0})

	for item in data:
		item.end = item.start + datetime.timedelta(minutes = 60)

	return data
コード例 #8
0
ファイル: production_order.py プロジェクト: nhannv/erpnext
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions

    conditions = get_event_conditions("Production Order", filters)

    data = frappe.db.sql(
        """select name, production_item, planned_start_date,
		planned_end_date, status
		from `tabProduction Order`
		where ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
				and (planned_start_date between %(start)s and %(end)s) \
			or ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
				and planned_end_date between %(start)s and %(end)s)) {conditions}
		""".format(
            conditions=conditions
        ),
        {"start": start, "end": end},
        as_dict=True,
        update={"allDay": 0},
    )
    return data
コード例 #9
0
def get_course_schedule_events(start, end, filters=None):
	"""Returns events for Course Schedule Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Course Schedule", filters)

	data = frappe.db.sql("""select name, title, 
			timestamp(schedule_date, from_time) as from_datetime, 
			timestamp(schedule_date, to_time) as to_datetime, 
			room, student_group, 0 as 'allDay'
		from `tabCourse Schedule`
		where ( schedule_date between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions), {
			"start": start,
			"end": end
			}, as_dict=True, update={"allDay": 0})
	
	
	for d in data:
		d.title += " \n for " + d.student_group + " in Room "+ d.room
	
	return data
コード例 #10
0
ファイル: training_event.py プロジェクト: emmuchira/kps_erp
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Training Event", filters)

    data = frappe.db.sql("""
		select
			name, event_name, event_status, start_time, end_time
		from
			`tabTraining Event`
		where (ifnull(start_time, '0000-00-00')!= '0000-00-00') \
			and (start_time between %(start)s and %(end)s)
			and docstatus < 2
			{conditions}
		""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})
    return data
コード例 #11
0
def get_events(start, end, filters=None):
    table = None
    if filters:
        filters = json.loads(filters)
        if "table" in filters:
            table = filters.get("table")
            del filters["table"]
        filters = json.dumps(filters)

    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Table Booking", filters)
    data = frappe.db.sql("""select name, customer_name, booking_date, status
		from `tabTable Booking`
		where (ifnull(booking_date, '0000-00-00')!= '0000-00-00')
				and (booking_date between %(start)s and %(end)s)
				and docstatus <= 2
				{conditions}
		""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True)
    # if table:
    # 	pass

    return data
コード例 #12
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Sales Order", filters)

    data = frappe.db.sql("""
		select
			distinct `tabSales Order`.name, `tabSales Order`.customer_name, `tabSales Order`.status,
			`tabSales Order`.delivery_status, `tabSales Order`.billing_status,
			`tabSales Order Item`.delivery_date
		from
			`tabSales Order`, `tabSales Order Item`
		where `tabSales Order`.name = `tabSales Order Item`.parent
			and (ifnull(`tabSales Order Item`.delivery_date, '0000-00-00')!= '0000-00-00') \
			and (`tabSales Order Item`.delivery_date between %(start)s and %(end)s)
			and `tabSales Order`.docstatus < 2
			{conditions}
		""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})
    return data
コード例 #13
0
ファイル: sales_order.py プロジェクト: Aptronics/erpnext
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Sales Order", filters)

	data = frappe.db.sql("""
		select
			distinct `tabSales Order`.name, `tabSales Order`.customer_name, `tabSales Order`.status,
			`tabSales Order`.delivery_status, `tabSales Order`.billing_status,
			`tabSales Order Item`.delivery_date
		from
			`tabSales Order`, `tabSales Order Item`
		where `tabSales Order`.name = `tabSales Order Item`.parent
			and (ifnull(`tabSales Order Item`.delivery_date, '0000-00-00')!= '0000-00-00') \
			and (`tabSales Order Item`.delivery_date between %(start)s and %(end)s)
			and `tabSales Order`.docstatus < 2
			{conditions}
		""".format(conditions=conditions), {
			"start": start,
			"end": end
		}, as_dict=True, update={"allDay": 0})
	return data
コード例 #14
0
ファイル: holiday_list.py プロジェクト: khrlzhfr/erpnext
def get_events(start, end, filters=None):
	import json
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Holiday List", filters)
	
	fiscal_year = None
	if filters:
		fiscal_year = json.loads(filters).get("fiscal_year")
		
	if not fiscal_year:
		fiscal_year = frappe.db.get_value("Global Defaults", None, "current_fiscal_year")
	
	yr_start_date, yr_end_date = get_fy_start_end_dates(fiscal_year)

	data = frappe.db.sql("""select hl.name, hld.holiday_date, hld.description 
		from `tabHoliday List` hl, tabHoliday hld 
		where hld.parent = hl.name 
		and (ifnull(hld.holiday_date, "0000-00-00") != "0000-00-00" 
			and hld.holiday_date between %(start)s and %(end)s)
		{conditions}""".format(conditions=conditions), {
			"start": yr_start_date,
			"end": yr_end_date
		}, as_dict=True, update={"allDay": 1})

	return data
コード例 #15
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    filters = json.loads(filters)
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Timesheet", filters)

    return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
			`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
			from_time as start_date, hours, activity_type,
			`tabTimesheet Detail`.project, to_time as end_date,
			CONCAT(`tabTimesheet Detail`.parent, ' (', ROUND(hours,2),' hrs)') as title
		from `tabTimesheet Detail`, `tabTimesheet`
		where `tabTimesheet Detail`.parent = `tabTimesheet`.name
			and `tabTimesheet`.docstatus < 2
			and (from_time <= %(end)s and to_time >= %(start)s) {conditions} {match_cond}
		""".format(conditions=conditions, match_cond=get_match_cond('Timesheet')), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})
コード例 #16
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions

    conditions = get_event_conditions("Task", filters)

    data = frappe.db.sql(
        """select name, exp_start_date, exp_end_date,
		subject, status, project from `tabTask`
		where ((ifnull(exp_start_date, '0000-00-00')!= '0000-00-00') \
				and (exp_start_date <= %(end)s) \
			or ((ifnull(exp_end_date, '0000-00-00')!= '0000-00-00') \
				and exp_end_date >= %(start)s))
		{conditions}""".format(
            conditions=conditions
        ),
        {"start": start, "end": end},
        as_dict=True,
        update={"allDay": 0},
    )

    return data
コード例 #17
0
def get_events(start, end, filters=None):
    import json
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Holiday List", filters)

    fiscal_year = None
    if filters:
        fiscal_year = json.loads(filters).get("fiscal_year")

    if not fiscal_year:
        fiscal_year = frappe.db.get_value("Global Defaults", None,
                                          "current_fiscal_year")

    yr_start_date, yr_end_date = get_fy_start_end_dates(fiscal_year)

    data = frappe.db.sql("""select hl.name, hld.holiday_date, hld.description
		from `tabHoliday List` hl, tabHoliday hld
		where hld.parent = hl.name
		and (ifnull(hld.holiday_date, "0000-00-00") != "0000-00-00"
			and hld.holiday_date between %(start)s and %(end)s)
		{conditions}""".format(conditions=conditions), {
        "start": yr_start_date,
        "end": yr_end_date
    },
                         as_dict=True,
                         update={"allDay": 1})

    return data
コード例 #18
0
def get_course_schedule_events(start, end, filters=None):
    """Returns events for Course Schedule Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions

    conditions = get_event_conditions("Course Schedule", filters)

    data = frappe.db.sql(
        """select name, course, color,
			timestamp(schedule_date, from_time) as from_time,
			timestamp(schedule_date, to_time) as to_time,
			room, student_group, 0 as 'allDay'
		from `tabCourse Schedule`
		where ( schedule_date between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions),
        {
            "start": start,
            "end": end
        },
        as_dict=True,
        update={"allDay": 0},
    )

    return data
コード例 #19
0
ファイル: time_log.py プロジェクト: JacksonIsaac/erpnext
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters like workstation, project etc.
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Time Log", filters)

	data = frappe.db.sql("""select name, from_time, to_time,
		activity_type, task, project, production_order, workstation from `tabTime Log`
		where docstatus < 2 and ( from_time between %(start)s and %(end)s or to_time between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions), {
			"start": start,
			"end": end
			}, as_dict=True, update={"allDay": 0})

	for d in data:
		d.title = d.name + ": " + (d.activity_type or d.production_order or "")
		if d.task:
			d.title += " for Task: " + d.task
		if d.project:
			d.title += " for Project: " + d.project

	return data
コード例 #20
0
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Patient Appointment", filters)

	data = frappe.db.sql("""
		select
		`tabPatient Appointment`.name, `tabPatient Appointment`.patient,
		`tabPatient Appointment`.practitioner, `tabPatient Appointment`.status,
		`tabPatient Appointment`.duration,
		timestamp(`tabPatient Appointment`.appointment_date, `tabPatient Appointment`.appointment_time) as 'start',
		`tabAppointment Type`.color
		from
		`tabPatient Appointment`
		left join `tabAppointment Type` on `tabPatient Appointment`.appointment_type=`tabAppointment Type`.name
		where
		(`tabPatient Appointment`.appointment_date between %(start)s and %(end)s)
		and `tabPatient Appointment`.status != 'Cancelled' and `tabPatient Appointment`.docstatus < 2 {conditions}""".format(conditions=conditions),
		{"start": start, "end": end}, as_dict=True, update={"allDay": 0})

	for item in data:
		item.end = item.start + datetime.timedelta(minutes = item.duration)

	return data
コード例 #21
0
def get_events(start, end, filters=None):
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Appointment", filters)

    emp = frappe.db.get_all(
        "Appointment",
        fields=["name", "starts_on", "ends_on", "status", "color"])
    return emp
コード例 #22
0
ファイル: appointment.py プロジェクト: omirajkar/saloon_erp
def get_events(start, end, filters=None):
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Appointment", filters)

    emp = frappe.db.get_all("Employee",
                            filters={"status": "Active"},
                            fields=["name", "employee_name"])
    return emp
コード例 #23
0
def get_events(start, end, filters=None):
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Midwife Appointment", filters)
    data = frappe.db.sql(
        """select name, patient_record, appointment_type, color, start_dt, end_dt from `tabMidwife Appointment` where (start_dt between %(start)s and %(end)s) and docstatus < 2 {conditions}"""
        .format(conditions=conditions), {
            "start": start,
            "end": end
        },
        as_dict=True,
        update={"allDay": 0})
    return data
コード例 #24
0
ファイル: time_log.py プロジェクト: RicardoJohann/erpnext
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters like workstation, project etc.
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Time Log", filters)

	if (cint(get_defaults("fs_simplified_time_log"))):
		date_cond = "date_worked between %(start)s and %(end)s"
	else:
		date_cond = "( from_time between %(start)s and %(end)s or to_time between %(start)s and %(end)s )"
	
	data = frappe.db.sql("""select name, from_time, to_time,
		activity_type, task, project, production_order, workstation, date_worked, employee, hours from `tabTime Log`
		where docstatus < 2 and {date_cond}
		{conditions}""".format(conditions=conditions,date_cond=date_cond), {
			"start": start,
			"end": end
			}, as_dict=True, update={"allDay": 0})
	#aligns the assorted time logs so they are layed out sequentially
	if(cint(get_defaults("fs_simplified_time_log"))):
		slist = {}
		for idx,da in enumerate(data):
			if (da.employee not in slist):
				slist[da.employee]={}
			if (da.date_worked not in slist[da.employee]):
				slist[da.employee][da.date_worked]=[]
			slist[da.employee][da.date_worked].append([idx,da.from_time,da.to_time,da.hours])	
		for e in slist:
			for d in slist[e]:
				temp = slist[e][d][0]
				temp[1]= datetime.combine(d,get_time("8:00:00"))
				temp[2]= temp[1] + timedelta(hours=temp[3])
				for idx,l in enumerate(slist[e][d][1:]):
					data[l[0]]["from_time"]= l[1] = slist[e][d][idx][2]
					data[l[0]]["to_time"] = l[2] = l[1]+ timedelta(hours=l[3])
				l= slist[e][d][0]
				data[temp[0]]["from_time"]= slist[e][d][0][1]
				data[temp[0]]["to_time"] =  slist[e][d][0][2]

	for d in data:
		d.title = d.name + ": " + (d.activity_type or d.production_order or "")
		if d.task:
			d.title += " for Task: " + d.task
		if d.project:
			d.title += " for Project: " + d.project

	return data
コード例 #25
0
def get_filter_event(start, end, filters=None):
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Appointment", filters)

	events = frappe.db.sql("""select name, employee, starts_on, ends_on, status from `tabAppointment` where((
	 	(date(starts_on) between date('%(start)s') and date('%(end)s'))
	 	or (date(ends_on) between date('%(start)s') and date('%(end)s'))
	 	or (date(starts_on) <= date('%(start)s') and date(ends_on) >= date('%(end)s')) ))
	 	%(condition)s
	 	order by starts_on """ % {
		"condition": conditions,
		"start": start,
		"end": end
		}, as_dict=1)
	return events
コード例 #26
0
def get_filter_event(start, end, filters=None):
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Appointment", filters)

	events = frappe.db.sql("""select name,color, starts_on, ends_on, status from `tabAppointment` where((
	 	(date(starts_on) between date('%(start)s') and date('%(end)s'))
	 	or (date(ends_on) between date('%(start)s') and date('%(end)s'))
	 	or (date(starts_on) <= date('%(start)s') and date(ends_on) >= date('%(end)s')) ))
	 	%(condition)s
	 	order by starts_on """ % {
		"condition": conditions,
		"start": start,
		"end": end
		}, as_dict=1)
	return events
コード例 #27
0
ファイル: shift_assignment.py プロジェクト: ankush/erpnext
def get_events(start, end, filters=None):
	from frappe.desk.calendar import get_event_conditions

	employee = frappe.db.get_value(
		"Employee", {"user_id": frappe.session.user}, ["name", "company"], as_dict=True
	)
	if employee:
		employee, company = employee.name, employee.company
	else:
		employee = ""
		company = frappe.db.get_value("Global Defaults", None, "default_company")

	conditions = get_event_conditions("Shift Assignment", filters)
	events = add_assignments(start, end, conditions=conditions)
	return events
コード例 #28
0
ファイル: course_schedule.py プロジェクト: yashodhank/schools
def get_events(start, end, filters=None):
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Course Schedule", filters)

	data = frappe.db.sql("""select name, title, from_time, to_time, room, student_group
		from `tabCourse Schedule`
		where ( from_time between %(start)s and %(end)s or to_time between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions), {
			"start": start,
			"end": end
			}, as_dict=True, update={"allDay": 0})
	
	for d in data:
		d.title += " \n for " + d.student_group + " in Room "+ d.room

	return data
コード例 #29
0
def get_course_schedule_events(start, end, filters=None):

    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Course Schedule", filters)

    data = frappe.db.sql(""" SELECT name, course, color,
					timestamp(schedule_date, from_time) as from_datetime,
					timestamp(schedule_date, to_time) as to_datetime,
					room, student_group, 0 as 'all_day'
			FROM `tabCourse Schedule`
			WHERE ( schedule_date between %(start)s and %(end)s )
			{conditions}""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})
    return data
コード例 #30
0
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Patient Appointment", filters)
	data = frappe.db.sql("""select name, patient, physician, status,
		duration, timestamp(appointment_date, appointment_time) as
		'start' from `tabPatient Appointment` where
		(appointment_date between %(start)s and %(end)s)
		and docstatus < 2 {conditions}""".format(conditions=conditions),
		{"start": start, "end": end}, as_dict=True, update={"allDay": 0})
	for item in data:
		item.end = item.start + datetime.timedelta(minutes = item.duration)
	return data
コード例 #31
0
ファイル: appointment.py プロジェクト: zsinnersinned/smarte
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Appointment", filters)
	data = frappe.db.sql("""select name, patient, physician, appointment_type, department, status, start_dt, end_dt
		from `tabAppointment`
		where (start_dt between %(start)s and %(end)s)
				and docstatus < 2
				{conditions}
		""".format(conditions=conditions), {
			"start": start,
			"end": end
		}, as_dict=True, update={"allDay": 0})
	return data
コード例 #32
0
def get_appointment_schedule_events(start, end, filters=None):
	"""Returns events for Course Schedule Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Appointments", filters)

	data = frappe.db.sql("""select name,
			timestamp(schedule_date, time) as from_datetime,
			timestamp(schedule_date, to_time) as to_datetime,
			CONCAT_WS(' ',first_name,last_name,telephone_no,lanugage) as language, 0 as 'allDay'
		from `tabAppointments`
		where ( schedule_date between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions), {
			"start": start,
			"end": end
			}, as_dict=True, update={"allDay": 0})

	return data
コード例 #33
0
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Production Order", filters)

	data = frappe.db.sql("""select name, production_item, planned_start_date,
		planned_end_date, status
		from `tabProduction Order`
		where ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
				and (planned_start_date <= %(end)s) \
			and ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
				and planned_end_date >= %(start)s)) {conditions}
		""".format(conditions=conditions), {
			"start": start,
			"end": end
		}, as_dict=True, update={"allDay": 0})
	return data
コード例 #34
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Operation Schedule", filters)

    data = frappe.db.sql("""select name, operation, planned_start_time,
		planned_end_time, status
		from `tabOperation Schedule`
		where ((ifnull(planned_start_time, '0000-00-00')!= '0000-00-00') \
				and (planned_start_time <= '{end}') \
			and ((ifnull(planned_start_time, '0000-00-00')!= '0000-00-00') \
				and planned_end_time >= '{start}')) {conditions}
		""".format(start=start, end=end, conditions=conditions),
                         as_dict=True,
                         update={"allDay": 0})
    return data
コード例 #35
0
ファイル: job_control.py プロジェクト: zenny/service
def get_events(start, end, filters=None):
        """Returns events for Gantt / Calendar view rendering.

        :param start: Start date-time.
        :param end: End date-time.
        :param filters: Filters (JSON).
        """
        from frappe.desk.calendar import get_event_conditions
        conditions = get_event_conditions("Job Control", filters)

        data = frappe.db.sql("""select name, technician as description, planned_start_date,
                planned_end_date, status
                from `tabJob Control`
                where ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
                                and (planned_start_date between %(start)s and %(end)s) \
                        or ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
                                and planned_end_date between %(start)s and %(end)s)) {conditions}
                """.format(conditions=conditions), {
                        "start": start,
                        "end": end
                }, as_dict=True, update={"allDay": 0})
        return data
コード例 #36
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Commission Agent Report", filters)

    data = frappe.db.sql("""
		select
			distinct `tabCommission Agent Report`.name, `tabSCommission Agent Report`.customer_name, `tabCommission Agent Report`.status,
			`tabCommission Agent Report`.billing_status
		from
			`tabCommission Agent Report`
		where `tabCommission Agent Report`.docstatus < 2
			{conditions}
		""".format(conditions=conditions),
                         as_dict=True,
                         update={"allDay": 0})
    return data
コード例 #37
0
def get_events(start, end, filters=None):
	table = None
	if filters:
		filters = json.loads(filters)
		if "table" in filters:
			table = filters.get("table")
			del filters["table"]
		filters = json.dumps(filters)

	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Table Booking", filters)
	data = frappe.db.sql("""select name, customer_name, booking_date, status
		from `tabTable Booking`
		where (ifnull(booking_date, '0000-00-00')!= '0000-00-00')
				and (booking_date between %(start)s and %(end)s)
				and docstatus <= 2
				{conditions}
		""".format(conditions=conditions), {"start": start, "end": end}, as_dict=True)
	# if table:
	# 	pass

	return data
コード例 #38
0
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.

	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Task", filters)

	data = frappe.db.sql("""select name, exp_start_date, exp_end_date,
		subject, status, project from `tabTask`
		where ((ifnull(exp_start_date, '0000-00-00')!= '0000-00-00') \
				and (exp_start_date between %(start)s and %(end)s) \
			or ((ifnull(exp_start_date, '0000-00-00')!= '0000-00-00') \
				and exp_end_date between %(start)s and %(end)s))
		{conditions}""".format(conditions=conditions), {
			"start": start,
			"end": end
		}, as_dict=True, update={"allDay": 0})

	return data
コード例 #39
0
def get_events(start, end, filters=None):
    """Returns events for Gantt / Calendar view rendering.

    :param start: ETA date-time.
    :param end: ETD date-time.
    :param filters: Filters (JSON).
    """

    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions('Booking Request', filters)

    data = frappe.db.sql("""
        SELECT
        `tabBooking Request`.name, `tabBooking Request`.eta_date,
       `tabBooking Request`.etd_date, `tabBooking Request`.status, `tabBooking Request Status`.color
       FROM
       `tabBooking Request`
       LEFT JOIN `tabBooking Request Status` ON `tabBooking Request`.status = `tabBooking Request Status`.name
       WHERE
       (`tabBooking Request`.docstatus < 2)""",
                         as_dict=True)

    return data
コード例 #40
0
def get_events(start, end, filters=None):
    """Returns events for Course Schedule Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Tickets", filters)

    data = frappe.db.sql("""select name, status, ticket_title, category,
			timestamp(ticket_date, time) as ticket_date,
			timestamp(ticket_date, time) as ticket_date,
			0 as 'allDay'
		from `tabTickets`
		where ( ticket_date between %(start)s and %(end)s )
		{conditions}""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                         as_dict=True,
                         update={"allDay": 0})

    return data
コード例 #41
0
def get_events(start, end, filters=None):
    """
	Returns events for Gantt / Calendar view rendering.

	Args:
		start (str): Start date-time.
		end (str): End date-time.
		filters (str, optional): Filters (JSON). Defaults to None.

	Returns:
		list of dict: The list of Contract events
	"""

    filters = json.loads(filters)
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Contract", filters)

    events = frappe.db.sql("""
		SELECT
			name,
			start_date,
			end_date
		FROM
			`tabContract`
		WHERE
			(start_date <= %(end)s
				AND end_date >= %(start)s)
				AND docstatus < 2
				{conditions}
		""".format(conditions=conditions), {
        "start": start,
        "end": end
    },
                           as_dict=True,
                           update={"allDay": 0})
    return events
コード例 #42
0
def get_meetings(start, end, filters=None):
    if not frappe.has_permission("Meeting", "read"):
        raise frappe.PermissionError

    filters = json.loads(filters)
    from frappe.desk.calendar import get_event_conditions
    conditions = get_event_conditions("Meeting", filters)

    return frappe.db.sql("""select
		start,
		end,
		name,
		title,
		status,
		all_day,
		meeting_location,
		(SELECT color FROM `tabMeeting Location` WHERE name = meeting_location) color
	from `tabMeeting` 
	where start >= %(start)s and end <= %(end)s {conditions}""".format(
        conditions=conditions), {
            "start": start,
            "end": end,
        },
                         as_dict=True)
コード例 #43
0
def get_events(start, end, filters=None):
	"""Returns events for Gantt / Calendar view rendering.
	:param start: Start date-time.
	:param end: End date-time.
	:param filters: Filters (JSON).
	"""
	filters = json.loads(filters)
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Timesheet", filters)

	return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
			`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
			from_time as start_date, hours, activity_type,
			`tabTimesheet Detail`.project, to_time as end_date,
			CONCAT(`tabTimesheet Detail`.parent, ' (', ROUND(hours,2),' hrs)') as title
		from `tabTimesheet Detail`, `tabTimesheet`
		where `tabTimesheet Detail`.parent = `tabTimesheet`.name
			and `tabTimesheet`.docstatus < 2
			and (from_time <= %(end)s and to_time >= %(start)s) {conditions} {match_cond}
		""".format(conditions=conditions, match_cond = get_match_cond('Timesheet')),
		{
			"start": start,
			"end": end
		}, as_dict=True, update={"allDay": 0})
コード例 #44
0
def get_events(start, end, filters=None):
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Appointment", filters)

	emp = frappe.db.get_all("Employee",None)
	return emp
コード例 #45
0
def get_events(start, end, filters=None):
	from frappe.desk.calendar import get_event_conditions
	conditions = get_event_conditions("Appointment", filters)

	emp = frappe.db.get_all("Employee",filters={"status": "Active"},fields=["name","employee_name"])
	return emp