A common requirement for most financial related applications is the need to create reports. This can be anything from Profit/Loss (P&L) Statements, Income Statements, Budgeting, Forecasting and Projections, and many more. The common factor for all these is data, and the need for spreadsheets to crunch the numbers.
In this article, we'll show you how to use SpreadJS, our enterprise JavaScript spreadsheet, to create a typical Aged Receivables Report that focuses specifically on how the end-user can easily filter that data.
This report will show all outstanding payments along with the customer's information. We'll then filter out the data and show the age of the past due payments along with that customer's details. The user of this type of reports can be a manager, an accountant, or director.
Creating the Financial Report
There are four different ways we can create this report using SpreadJS's built-in and custom features. These options include:
- Using Slicers
- Using Custom Filters
- Using Array Formulas
- Using Table Filters
Note: to create these reports, we have used static JSON data and use the same data for different sections.
We've divided each part into separate article, so we'll have a series of four articles to demonstrate all options.
Here, we'll discuss creating the aging report with Slicers.
We will be creating this report with ReactJS. Learn more about how to use SpreadJS with ReactJS
For this application, we've a created a custom component in our react application using Spread.Sheets to demonstrate the slicers in SpreadJS.
Slicers are used to filter the data quickly in a very visual intuitive way. They work differently from a traditional filter where you need to select from the dropdown. With slicers you see the result of the filter as soon as you click on the slicer item (a condition that you want to filter with). You can further customize the slicers by setting the style and data.
Here we have created a custom react component with Spread.Sheets where we will be using Table Slicers to generate the report.
- Set the style for Spread.Sheet rows in constructor:
- Fetch data in component's state in a variable named 'records.'
- We will need three sheets to have the customer data, lookup formula data, and to show the slicer report.
- Now we will write the body of these methods to initialize each sheet. We are going to use the pre-existing JSON data as data source for SpreadJS sheets. This shows the financial data of customers.
The output appears as follows:
- We'll create another sheet with some pre-defined values. These will be used to create slicers to give a better user experience. We have used vLoopUp formula to group values for slicers:
The sheet looks as follows:
- Once we have the data in a workbook let's create the slicer sheet with a table to filter the data as per the user selection.
- We have created a few rules to color the number of days red, green, and orange based on the value.
- In the sheet above, the code to add the slicers based on a hidden column (i.e. Column5) is as follows:
To set the style and formatting for the overall slicer worksheet:
- We have applied the data bar rule to the 'Balance' column. This column shows databar for amount in the cell.
- The code for rendering the component generated with the above code is as follows:
The outcome of the report renders as below:
As demonstrated in the image, the Spread.Sheets shows two slicers: one for 'category' and another for 'customer.' The user can click on the slicer category or customer, and the table displays the filtered records from the financial data from the data sheet.
The 'DaysLate' column shows data in different colors: red, green, and orange. The red color is for invoices older than 90 days, the orange color is for invoices that are less than 90 days old and more than 30, whereas the green color is for invoices less than 30 days old.
There are also Print and Save buttons in the toolbar at top. You can use these buttons to print the report and export the report to Excel format.
Please continue reading about the other options available with Spread.Sheets while working with financial data.
Happy coding, be sure to leave any thoughts or comments below.