forked from julzelements/tech-challenge-js-candidate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3_spendTargetReport.ts
50 lines (47 loc) · 1.32 KB
/
3_spendTargetReport.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Invoice, Plan, SpendTargetReportItem, TargetCategory } from "./types";
const spendTargetReport = (plan: Plan, invoices: Invoice[]): SpendTargetReportItem[] => {
/**
* TODO
*
* Given a plan and invoices.
*
* We need you to generate a spending report for the period JAN through MAR
* to calculate whether we have under spent, over spent or on track for each of our plan items.
*
* For example:
* [
{
category: "Core Supports",
categorySpend: 1380,
code: 1,
initialBudget: 4800,
remainingBudget: 3420,
target: "OVERSPEND",
},
{
category: "Home Care",
categorySpend: 618,
code: 3,
initialBudget: 2400,
remainingBudget: 1782,
target: "ON_TRACK",
},
{
category: "transport",
categorySpend: 312,
code: 15,
initialBudget: 1560,
remainingBudget: 1248,
target: "UNDERSPEND",
},
];
*
*
*
*
* Run `npm test` to test your solution
*
*/
return null;
};
export default spendTargetReport;