Question

Photo of Kenneth Roach

0

How change the date range for Contribution Reports?

How can I change the Contribution Statement functionality so that when a user clicks on '2018' for a Contribution Statement, it picks up all transactions between 4/1/2017 and 3/31/2018?

It looks like the current functionality is using just 'year' values (1/1/yyy - 12/31/yyy) for the selection.


The financial year in New Zealand goes from 1 April through to 31 March.

Other countries also have start and end dates for their fiscal year that are different to the calendar year.   

(See https://en.wikipedia.org/wiki/Fiscal_year#Operation_in_various_countries/region.)


The logic would be to record an end date for the country's fiscal year as a global attribute (e.g. '3/31' /yyyy),

then the date range would be  (3/31 + 1) / (yyyy-1) to 3/31/yyyy.


Example (New Zealand):

Global Attribute Setting: fiscal-year-ends-on = 3/31  (31 March)

yyyy = the year requesting the statement for = 2018

fiscal year start = ( fiscal-year-ends-on/yyyy + 1 day) - 1 year = ((3/31/2018+1 day) - 1 year) = ((4/1/2018) - 1 year) = 4/1/2017

fiscal year end = (fiscal-year-ends-on/yyyy) = 3/31/2018

Select transactions for the Contribution Statement between the dates 4/1/2017 and 3/31/2017.


This logic is required behind the "Available Contribution Statements" year buttons on the Giving History page.






  • Photo of Shawn Ross

    1

    Ken, I can't dive completely into a full set of directions at the moment, but here's what I'd try if I was you:

    • As you've discovered, the Lava used for the Contribution Statement function can be customized
    • You can customize the lava used to use the date range of your choice. For example, you can open this page on demo and edit the lava in Zone A2 for the block Contribution Statement List Lava. It's conceivable you could take the stock lava and change the way the date filter is used. You may be able to simply rework the lava on the actual contribution statement page to 'combine' both your Month and Day parts with the 'year' that is passed in the query string parameter

    If that doesn't work, you could go the route of 'calculating' it:

    • Create an attribute so you can define the date that the fiscal year ends on (as you mentioned using a Global Attribute).
    • Use the lava Date Filters for calculating the range if you need to calculate it for a link, page load, etc.

    It's also worth jumping over to Rocket Chat and joining the #lava channel when you're ready to build out your lava and need some real-time help

  • Photo of Shawn Ross

    0

    Ken, I'm really glad you figured out a solution. Way to go!

    Would you consider writing up what you did over at the Community Recipe page? I think it would be helpful to other organizations that have similar needs to yours.