Skip to content

Commit

Permalink
Merge pull request #6112 from espoon-voltti/voucher-report-split
Browse files Browse the repository at this point in the history
Palveluseteliraportille lasketaan erikseen perusosa ja tuen tarpeen korotusosa (feature flagin takana)
  • Loading branch information
akheron authored Dec 12, 2024
2 parents 7e6f332 + 0e0e62d commit 574e4d3
Show file tree
Hide file tree
Showing 9 changed files with 319 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
import { H2, H3 } from 'lib-components/typography'
import { defaultMargins, Gap } from 'lib-components/white-space'
import colors from 'lib-customizations/common'
import { featureFlags } from 'lib-customizations/employee'
import { faHome, faLockAlt } from 'lib-icons'

import ReportDownload from '../../components/reports/ReportDownload'
Expand Down Expand Up @@ -274,6 +275,14 @@ export default React.memo(function VoucherServiceProviderUnit() {
r.serviceVoucherFinalCoPayment,
true
),
realizedAmountBeforeAssistanceNeed: formatCents(
r.realizedAmountBeforeAssistanceNeed,
true
),
realizedAssistanceNeedAmount: formatCents(
r.realizedAmount - r.realizedAmountBeforeAssistanceNeed,
true
),
realizedAmount: formatCents(r.realizedAmount, true)
})),
{
Expand All @@ -288,6 +297,8 @@ export default React.memo(function VoucherServiceProviderUnit() {
assistanceNeedCapacityFactor: null,
serviceVoucherValue: null,
serviceVoucherFinalCoPayment: null,
realizedAmountBeforeAssistanceNeed: null,
realizedAssistanceNeedAmount: null,
realizedAmount: formatCents(
sortedReport.value.voucherTotal,
true
Expand Down Expand Up @@ -346,6 +357,22 @@ export default React.memo(function VoucherServiceProviderUnit() {
.serviceVoucherFinalCoPayment,
key: 'serviceVoucherFinalCoPayment'
},
...(featureFlags.voucherValueSeparation
? [
{
label:
i18n.reports.voucherServiceProviderUnit
.serviceVoucherRealizedValueBeforeAssistanceNeed,
key: 'realizedAmountBeforeAssistanceNeed' as const
},
{
label:
i18n.reports.voucherServiceProviderUnit
.serviceVoucherRealizedAssistanceNeedValue,
key: 'realizedAssistanceNeedAmount' as const
}
]
: []),
{
label:
i18n.reports.voucherServiceProviderUnit
Expand Down Expand Up @@ -392,6 +419,22 @@ export default React.memo(function VoucherServiceProviderUnit() {
.serviceVoucherFinalCoPayment
}
</StyledTh>
{featureFlags.voucherValueSeparation && (
<>
<StyledTh>
{
i18n.reports.voucherServiceProviderUnit
.serviceVoucherRealizedValueBeforeAssistanceNeed
}
</StyledTh>
<StyledTh>
{
i18n.reports.voucherServiceProviderUnit
.serviceVoucherRealizedAssistanceNeedValue
}
</StyledTh>
</>
)}
<StyledTh>
{
i18n.reports.voucherServiceProviderUnit
Expand Down Expand Up @@ -465,6 +508,23 @@ export default React.memo(function VoucherServiceProviderUnit() {
<Td data-qa="co-payment">
{formatCents(row.serviceVoucherFinalCoPayment, true)}
</Td>
{featureFlags.voucherValueSeparation && (
<>
<Td>
{formatCents(
row.realizedAmountBeforeAssistanceNeed,
true
)}
</Td>
<Td>
{formatCents(
row.realizedAmount -
row.realizedAmountBeforeAssistanceNeed,
true
)}
</Td>
</>
)}
<Td data-qa="realized-amount">
{formatCents(row.realizedAmount, true)}
</Td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { FixedSpaceRow } from 'lib-components/layout/flex-helpers'
import { H2 } from 'lib-components/typography'
import { defaultMargins, Gap } from 'lib-components/white-space'
import colors from 'lib-customizations/common'
import { featureFlags } from 'lib-customizations/employee'
import { faLockAlt, faSearch } from 'lib-icons'

import ReportDownload from '../../components/reports/ReportDownload'
Expand Down Expand Up @@ -139,13 +140,28 @@ export default React.memo(function VoucherServiceProviders() {
.filter(({ unit }) =>
unit.name.toLowerCase().includes(unitFilter.toLowerCase())
)
.map(({ unit, childCount, monthlyPaymentSum }) => ({
unitId: unit.id,
unitName: unit.name,
areaName: unit.areaName,
childCount: childCount,
sum: formatCents(monthlyPaymentSum, true)
}))
.map(
({
unit,
childCount,
monthlyPaymentSumBeforeAssistanceNeed,
monthlyPaymentSum
}) => ({
unitId: unit.id,
unitName: unit.name,
areaName: unit.areaName,
childCount: childCount,
sumBeforeAssistanceNeed: formatCents(
monthlyPaymentSumBeforeAssistanceNeed,
true
),
assistanceNeedSum: formatCents(
monthlyPaymentSum - monthlyPaymentSumBeforeAssistanceNeed,
true
),
sum: formatCents(monthlyPaymentSum, true)
})
)
.sort((l, r) => l.unitName.localeCompare(r.unitName, 'fi'))
),
[report, unitFilter]
Expand Down Expand Up @@ -243,6 +259,22 @@ export default React.memo(function VoucherServiceProviders() {
label: i18n.reports.voucherServiceProviders.childCount,
key: 'childCount'
},
...(featureFlags.voucherValueSeparation
? [
{
label:
i18n.reports.voucherServiceProviders
.sumBeforeAssistanceNeed,
key: 'sumBeforeAssistanceNeed' as const
},
{
label:
i18n.reports.voucherServiceProviders
.assistanceNeedSum,
key: 'assistanceNeedSum' as const
}
]
: []),
{
label: i18n.reports.voucherServiceProviders.unitVoucherSum,
key: 'sum'
Expand All @@ -262,6 +294,19 @@ export default React.memo(function VoucherServiceProviders() {
<Th>{i18n.reports.common.careAreaName}</Th>
<Th>{i18n.reports.common.unitName}</Th>
<Th>{i18n.reports.voucherServiceProviders.childCount}</Th>
{featureFlags.voucherValueSeparation && (
<>
<Th>
{
i18n.reports.voucherServiceProviders
.sumBeforeAssistanceNeed
}
</Th>
<Th>
{i18n.reports.voucherServiceProviders.assistanceNeedSum}
</Th>
</>
)}
<Th>{i18n.reports.voucherServiceProviders.unitVoucherSum}</Th>
</Tr>
</Thead>
Expand All @@ -282,6 +327,12 @@ export default React.memo(function VoucherServiceProviders() {
</Link>
</StyledTd>
<StyledTd data-qa="child-count">{row.childCount}</StyledTd>
{featureFlags.voucherValueSeparation && (
<>
<StyledTd>{row.sumBeforeAssistanceNeed}</StyledTd>
<StyledTd>{row.assistanceNeedSum}</StyledTd>
</>
)}
<StyledTd data-qa="child-sum">{row.sum}</StyledTd>
</Tr>
))}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib-common/generated/api-types/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ export interface ServiceVoucherValueRow {
isNew: boolean
numberOfDays: number
realizedAmount: number
realizedAmountBeforeAssistanceNeed: number
realizedPeriod: FiniteDateRange
serviceNeedDescription: string
serviceVoucherCoPayment: number
Expand All @@ -910,6 +911,7 @@ export interface ServiceVoucherValueRow {
export interface ServiceVoucherValueUnitAggregate {
childCount: number
monthlyPaymentSum: number
monthlyPaymentSumBeforeAssistanceNeed: number
unit: UnitData
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3992,10 +3992,13 @@ export const fi = {
filters: {
areaPlaceholder: 'Valitse palvelualue',
allAreas: 'Kaikki alueet',
unitPlaceholder: 'Hae yksikön nimellä'
unitPlaceholder: 'Hae yksikön nimellä',
separate: 'Perus- ja korotusosat erikseen'
},
locked: 'Raportti lukittu',
childCount: 'PS-lasten lkm',
sumBeforeAssistanceNeed: 'Perusosan summa / kk',
assistanceNeedSum: 'Korotusosan summa / kk',
unitVoucherSum: 'PS summa / kk',
average: 'Keskiarvo',
breakdown: 'Erittely'
Expand All @@ -4013,6 +4016,8 @@ export const fi = {
start: 'Alkaen',
end: 'Päättyen',
serviceVoucherValue: 'Ps korkein arvo',
serviceVoucherRealizedValueBeforeAssistanceNeed: 'Perusosa / kk',
serviceVoucherRealizedAssistanceNeedValue: 'Korotusosa / kk',
serviceVoucherRealizedValue: 'Ps arvo / kk',
serviceVoucherFinalCoPayment: 'Omavastuu',
serviceNeed: 'Palveluntarve',
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib-customizations/espoo/featureFlags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const features: Features = {
feeDecisionPreschoolClubFilter: false,
placementGuarantee: true,
voucherUnitPayments: true,
voucherValueSeparation: true,
assistanceNeedDecisionsLanguageSelect: true,
staffAttendanceTypes: true,
extendedPreschoolTerm: true,
Expand Down Expand Up @@ -71,6 +72,7 @@ const features: Features = {
personDuplicate: false,
citizenAttendanceSummary: false,
voucherUnitPayments: false,
voucherValueSeparation: true,
intermittentShiftCare: false,
noAbsenceType: false,
discussionReservations: true,
Expand Down Expand Up @@ -106,6 +108,7 @@ const features: Features = {
personDuplicate: false,
citizenAttendanceSummary: false,
voucherUnitPayments: false,
voucherValueSeparation: false,
intermittentShiftCare: false,
noAbsenceType: false,
discussionReservations: true,
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lib-customizations/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ interface BaseFeatureFlags {
*/
voucherUnitPayments: boolean

/**
* Whether to show voucher value sums before assistance need factor and the effect of
* assistance need factor as separate columns in voucher value report.
*/
voucherValueSeparation: boolean

/**
* Enable language selection for assistance need decisions
*/
Expand Down
Loading

0 comments on commit 574e4d3

Please sign in to comment.