feat(dashboard): Add Time Grain filter
diff --git a/erpnext/accounts/dashboard.py b/erpnext/accounts/dashboard.py
index df152f0..b9cb22e 100644
--- a/erpnext/accounts/dashboard.py
+++ b/erpnext/accounts/dashboard.py
@@ -9,11 +9,16 @@
 from erpnext.accounts.report.general_ledger.general_ledger import execute
 
 
-def get(filters=None):
+def get(filters= None):
+    print(filters)
+    timespan = filters.get("timespan")
+    timegrain = filters.get("timegrain")
+    from_date = get_from_date_from_timespan(timespan)
+    to_date = nowdate()
     filters = frappe._dict({
         "company": "Gadget Technologies Pvt. Ltd.",
-        "from_date": get_from_date_from_timespan(filters.get("timespan")),
-        "to_date": "2020-12-12",
+        "from_date": from_date,
+        "to_date": to_date,
         "account": "Cash - GTPL",
         "group_by": "Group by Voucher (Consolidated)"
     })
@@ -33,6 +38,8 @@
 
     results = add_missing_dates(results, from_date, to_date)
 
+    results = granulate_results(results, from_date, to_date, timegrain)
+
     return {
         "labels": [result[0] for result in results],
         "datasets": [{
@@ -67,3 +74,23 @@
             last_balance = results_dict[date]
         results.append([date, last_balance])
     return results
+
+def get_dates_from_timegrain(from_date, to_date, timegrain):
+    days = months = years = 0
+    if "Daily" == timegrain:
+        days = 1
+    elif "Weekly" == timegrain:
+        days = 7
+    elif "Monthly" == timegrain:
+        months = 1
+    elif "Quarterly" == timegrain:
+        months = 3
+
+    dates = [from_date]
+    while dates[-1] <= to_date:
+        dates.append(add_to_date(dates[-1], years=years, months=months, days=days))
+    return dates
+
+def granulate_results(incomplete_results, from_date, to_date, timegrain):
+    dates = set(get_dates_from_timegrain(getdate(from_date), getdate(to_date), timegrain))
+    return list(filter(lambda x: x[0] in dates,incomplete_results))