CalculateIncomeExpenseSummary

Calculates the monthly income, total income, average monthly income, monthly expense, total expense, average monthly expense from a list of income and expenses provided.

Signature

call(String action, Map<String, Object> args

Return Value

Returns income and expense details.

Examples

Input and output JSON example of the actions are as follows.

Input format:

1[
2    {
3        "Duration": "12",
4        "PartyExpenseList": [
5            {
6                "Name": "PE-0000000004",
7                "UsageType": "CashFlow",
8                "RecurrenceInterval": "Monthly",
9                "Type": "Child Care",
10                "Id": "2n3SG000007dkzpYAA",
11                "TotalAmount": 999.99,
12                "PartyId": "001SG000004TCczYAG",
13                "Status": "Active",
14                "StartDate": "2024-01-29T08:00:00.000Z"
15            }
16        ],
17        "PartyIncomeList": [
18            {
19                "Name": "PI-0000000003",
20                "UsageType": "CashFlow",
21                "IncomeFrequency": "Monthly",
22                "IncomeType": "Salary",
23                "Id": "2m3SG000007dkzpYAA",
24                "IncomeAmount": 999.99,
25                "PartyId": "001SG000004TCczYAG",
26                "IncomeStatus": "Active",
27                "StartDate": "2024-01-29T08:00:00.000Z"
28            }
29        ]
30    }
31]
32

Output format:

1[
2    {
3        "MonthlyIncome": {
4            "Nov 2023": 0,
5            "Aug 2024": 999.99,
6            "Oct 2023": 0,
7            "Jan 2024": 96.7732258064516,
8            "Mar 2024": 999.99,
9            "Jul 2024": 999.99,
10            "Apr 2024": 999.99,
11            "Dec 2023": 0,
12            "Jun 2024": 999.99,
13            "Sep 2024": 999.99,
14            "Feb 2024": 999.99,
15            "May 2024": 999.99
16        },
17        "MonthlyExpense": {
18            "Nov 2023": 0,
19            "Aug 2024": 999.99,
20            "Oct 2023": 0,
21            "Jan 2024": 96.7732258064516,
22            "Mar 2024": 999.99,
23            "Jul 2024": 999.99,
24            "Apr 2024": 999.99,
25            "Dec 2023": 0,
26            "Jun 2024": 999.99,
27            "Sep 2024": 999.99,
28            "Feb 2024": 999.99,
29            "May 2024": 999.99
30        },
31        "AvgMonthlyExpense": 674.72,
32        "TotalIncome": 8096.69,
33        "TotalSurplus": 0,
34        "AvgMonthlyIncome": 674.72,
35        "AvgMonthlySurplus": 0,
36        "TotalExpense": 8096.69
37    }
38]
39