Create date filter for dynamic www page using frappe.db.sql

Hi,

I would like to add a date filter to a dynamic page created in the www folder using the frappe.db.sql with the following code

context.customers = frappe.db.sql("""SELECT FORMAT(SUM(total),0) as total, customer FROM  
                   `tabSales Invoice` 
                    WHERE docstatus = 1 AND MONTH(posting_date) = MONTH(CURDATE()) 
                    GROUP BY customer WITH ROLLUP""", as_dict=True, formatted=True)

How and where would a filter to change the Date Range for example be included.

Any help would be appreciated.

Thanks

No Takers ? :wink: :slight_smile:

Can you please Elaborate the issue??

@hereabdulla

The sql above returns a table with a list of customers & total purchases.

I want to be able to change the MONTH(posting_date) = MONTH(CURDATE()) into a variable that can be filtered via dropdown box or entering the date into an input box

Thanks
Said