Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions vhrs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from frappe.model.document import Document
from frappe.model.naming import make_autoname
from frappe.utils.data import today
from frappe.utils import cint, fmt_money
from datetime import date
from frappe.utils import cint, fmt_money, formatdate, getdate, add_months, date_diff, add_days, flt, cstr
import requests


Expand Down Expand Up @@ -39,7 +40,7 @@ def mark_absent():

@frappe.whitelist()
def mark_territory():
projects = frappe.db.sql("""
projects = frappe.db.sql("""
select name,customer from tabProject where territory is null
""", as_dict=1)
for project in projects:
Expand Down Expand Up @@ -476,3 +477,19 @@ def update_status(doc, method):
else:
frappe.db.set_value(
"Customer", customer.name, "status", "Active")


@frappe.whitelist()
def send_daily_report():
custom_filter = {'date': today(), "status": ("order_by" "Late")}
report = frappe.get_doc('Report', "Employee Day Attendance")
columns, data = report.get_data(
limit=500 or 500, filters=custom_filter, as_dict=True)
html = frappe.render_template(
'frappe/templates/includes/print_table.html', {'columns': columns, 'data': data})
frappe.sendmail(
recipients=['prabavathi.d@voltechgroup.com'],
subject='Employee Attendance Report - ' +
formatdate(add_days(today(), -1)),
message=html
)
7 changes: 4 additions & 3 deletions vhrs/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@
# ],
"daily": [
"vhrs.utils.update_status"

],
"hourly": [
"vhrs.custom.send_daily_report"
],
# "hourly": [
# "vhrs.tasks.hourly"
# ],
# "weekly": [
# "vhrs.tasks.weekly"
# ]
Expand Down
Loading