Idea: Time period - year to date

Idea: Add a “Start of financial year” to Manager’s preferences (below “First Day of Week”).

Use: several reports require year to date totals. This is currently done by the user explicitly specifying the Year-to-date-period in addition the main reporting period. A system localization parameter specifying the local start of the financial year would enable the Year-to-date-period to be calculated and result in a cleaner user interface.

In pseudo code

  • Extract the month and day of the start of the financial year
  • Combine above month & day with user report specified year
  • If that’s after the end of the users period go back 1 year (ie this financial year started last calendar year)

Approximate Liquid code

{% assign FinancialMonthDayStart = Business.YearStart | date  -%m-%d %}
{% assign YearStart = report.Periods[0].End | date  %Y | append: FinancialMonthDayStart %}

{% if YearStart  >  report.Periods[0].End | date %F %}
   {% assign YearStart = (report.Periods[0].End | date  %Y | minus: 1 | append: FinancialMonthDayStart %}
{% endif %}

The Year-to-date-period can then be constructed from YearStart to report.Periods[0].End

Note there may well be better ways of doing date arithmetic and comparisons in Liquid

For localization reports, start of the financial year could be hard coded into the report. For core Manager reports like pay slips the above approach would enable a universal “Show totals for year to date” checkbox.