@ossy/consultancy 3.26.0 → 3.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/consultancy",
|
|
3
3
|
"description": "Consultancy feature package — schemas, forecasts UI, and assignment margins",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.27.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"module": "./src/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ossy/email": "^3.
|
|
28
|
+
"@ossy/email": "^3.27.0",
|
|
29
29
|
"@ossy/event-store": "^3.26.0",
|
|
30
30
|
"@ossy/organisation": "^3.26.0",
|
|
31
|
-
"@ossy/schema": "^3.
|
|
32
|
-
"@ossy/spend": "^3.
|
|
31
|
+
"@ossy/schema": "^3.27.0",
|
|
32
|
+
"@ossy/spend": "^3.27.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@ossy/calendar": "*",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"jest": "^30.2.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f72042c42723468c010d0d9744ad69257143d0b9"
|
|
48
48
|
}
|
package/src/forecast-panels.jsx
CHANGED
|
@@ -19,6 +19,8 @@ const KPI_SERIES = [
|
|
|
19
19
|
{ key: 'actualIncome', label: 'consultancy.forecasts.actualIncome', legendLabel: 'consultancy.forecasts.income', color: 'var(--surface-info, hsl(199, 89%, 43%))' },
|
|
20
20
|
{ key: 'monthlyCostOfEmployees', label: 'consultancy.forecasts.salaryCost', color: 'var(--surface-warning, hsl(38, 92%, 50%))' },
|
|
21
21
|
{ key: 'moneyOut', label: 'consultancy.forecasts.costs', color: 'var(--surface-danger, hsl(0, 89%, 43%))' },
|
|
22
|
+
{ key: 'revenue', label: 'consultancy.forecasts.forecastRevenue', legendLabel: 'consultancy.forecasts.revenue', color: 'var(--surface-accent, hsl(167, 89%, 43%))', dashed: true },
|
|
23
|
+
{ key: 'actualRevenue', label: 'consultancy.forecasts.actualRevenue', legendLabel: 'consultancy.forecasts.revenue', color: 'var(--surface-accent, hsl(167, 89%, 43%))' },
|
|
22
24
|
]
|
|
23
25
|
|
|
24
26
|
const HOURS_COLOR = 'var(--surface-accent, hsl(167, 89%, 43%))'
|
package/src/spend-for-month.js
CHANGED
|
@@ -58,10 +58,15 @@ export function monthResult ({ income = 0, salary = 0, spend = 0 } = {}) {
|
|
|
58
58
|
export function attachSpend (months, spendByMonth) {
|
|
59
59
|
return (Array.isArray(months) ? months : []).map((month) => {
|
|
60
60
|
const spend = spendForMonth(spendByMonth, month)
|
|
61
|
+
const salary = month.monthlyCostOfEmployees
|
|
61
62
|
return {
|
|
62
63
|
...month,
|
|
63
64
|
spend,
|
|
64
|
-
moneyOut: moneyOutOf(
|
|
65
|
+
moneyOut: moneyOutOf(salary, spend),
|
|
66
|
+
revenue: monthResult({ income: month.projectedIncome, salary, spend }),
|
|
67
|
+
actualRevenue: month.actualIncome == null
|
|
68
|
+
? null
|
|
69
|
+
: monthResult({ income: month.actualIncome, salary, spend }),
|
|
65
70
|
}
|
|
66
71
|
})
|
|
67
72
|
}
|
|
@@ -19,17 +19,25 @@ describe('spend for a forecast month', () => {
|
|
|
19
19
|
expect(spendForMonth(null, { year: 2026, monthNumber: '01' })).toBe(0)
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
it('attaches spend
|
|
23
|
-
const [january] = attachSpend(
|
|
24
|
-
[
|
|
22
|
+
it('attaches spend and sets result to income minus salary minus invoices', () => {
|
|
23
|
+
const [january, february] = attachSpend(
|
|
24
|
+
[
|
|
25
|
+
{ year: 2026, monthNumber: '01', projectedIncome: 10000, monthlyCostOfEmployees: 4000, actualIncome: 8000 },
|
|
26
|
+
{ year: 2026, monthNumber: '02', projectedIncome: 5000, monthlyCostOfEmployees: 4000, actualIncome: null },
|
|
27
|
+
],
|
|
25
28
|
spendByMonth,
|
|
26
29
|
)
|
|
27
|
-
expect(january).
|
|
28
|
-
|
|
29
|
-
monthNumber: '01',
|
|
30
|
-
projectedIncome: 10,
|
|
30
|
+
expect(january).toMatchObject({
|
|
31
|
+
projectedIncome: 10000,
|
|
31
32
|
spend: 1490,
|
|
32
|
-
moneyOut:
|
|
33
|
+
moneyOut: 5490,
|
|
34
|
+
revenue: 4510,
|
|
35
|
+
actualRevenue: 2510,
|
|
36
|
+
})
|
|
37
|
+
expect(february).toMatchObject({
|
|
38
|
+
spend: 0,
|
|
39
|
+
revenue: 1000,
|
|
40
|
+
actualRevenue: null,
|
|
33
41
|
})
|
|
34
42
|
})
|
|
35
43
|
|