In accounting we often talk about the “Financial Year” of a company. This is when the company finishes it’s year for tax purposes. For instance the financial year of a company might begin at the start of April and end at the end of March.
For reporting purpose it is useful to be able to translate dates into the financial year representatiuon. This module is a simple example of doing this.
Using the Code [top]
- Import the Financial Month/Year channel from the Builtin: Iguana Date/Time repository
- Experiment with the code to find out how it works
- Then add the module to your Translator project
- Copy the require statement from the channel and add it at the top of your script
Note: This module uses require to return a single function
- Adapt the code to your own requirements
- Interactive scripting help is included for this module
This is the github code for the main module:
How it works [top]
The module returns the single function
Convert(), this is assigned to the convert field of the calendar_financial table (before the main function).
main() two scenarios are demonstrated: Financial year starting in February (
start_month = 2) and financial year starting in June (
start_month = 6). The
Convert() function (
calendar_financial.convert) is used to return the financial year information for each of the 12 months of the year (financial year, quarter, month, and month order within the quarter).