I think it would be best to have a checkbox to “Include Active Visits” under the date pickers.
I have added a selector to switch between include active visits and exclude active visits from the report. Actually we need to deal only with the endDate property to include and exclude the active visits (Active visits doesn’t have the end date property until the end). So I have added a condition to the SQL statement as follows,
...... v.date_started >= :startDate AND (v.date_stopped <= :endDate OR True= :activeVisits)
- If activeVisits is true, then It will not consider the endDate (Active visits will be included into the reports)
- If activeVisits is false, then it will consider the results of endDate (Active visits will be excluded from the reports)
I’d change the end date selector to use 11:59 PM instead of 12:00 AM by default.
By the default, We only deal with the Date in the module. It will automatically consider the date format of the DateTime for the selection here. So I configured the date time picker to send the end date with an extra day. So If the user selects “2018-07-04”, then it will be considered as “2018-07-05” for the report selection.
Please let me know, if there are any changes required in the above methods.