Skip to content

Commit

Permalink
[b] wrong calculations, tests fails, bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ormi committed Nov 1, 2024
1 parent 303dc8b commit 2e3e75e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
7 changes: 1 addition & 6 deletions src/lib/calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@ export function calculate(input: TaxFormUserInput): TaxForm {
r037: round(new Decimal(
parseInputNumber(input?.uhrnPovinnehoPoistnehoNaSocialnePoistenie ?? '0'),
).plus(
new Decimal(
parseInputNumber(
input?.uhrnPovinnehoPoistnehoNaSocialnePoistenie ?? '0',
),
).plus(
new Decimal(
parseInputNumber(
input?.uhrnPovinnehoPoistnehoNaZdravotnePoistenie ?? '0',
Expand All @@ -331,7 +326,7 @@ export function calculate(input: TaxFormUserInput): TaxForm {
input?.uhrnPovinnehoPoistnehoNaZdravotnePoistenieDohody ?? '0',
),
),
)),
),
get vydavkyPoistPar6ods11_ods1a2() {
return round(this.priloha3_r11_socialne.plus(this.priloha3_r13_zdravotne))
},
Expand Down
8 changes: 4 additions & 4 deletions src/pages/dohoda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DohodaUserInput, FormErrors } from '../types/PageUserInputs'
import { numberInputRegexp } from '../lib/utils'
import { ErrorSummary } from '../components/ErrorSummary'
import { Page } from '../components/Page'
import { employmentUserInputInitialValues } from '../lib/initialValues'
import { dohodaUserInputInitialValues } from '../lib/initialValues'
import { BackLink } from '../components/BackLink'
import { TAX_YEAR } from '../lib/calculation'

Expand All @@ -26,7 +26,7 @@ const Dohoda: Page<DohodaUserInput> = ({
const userInput = values.dohoda
? values
: {
...employmentUserInputInitialValues,
...dohodaUserInputInitialValues,
dohoda: false,
}
setTaxFormUserInput(userInput)
Expand All @@ -53,13 +53,13 @@ const Dohoda: Page<DohodaUserInput> = ({
name="uhrnPovinnehoPoistnehoNaSocialnePoistenieDohody"
type="number"
label="Úhrn sociálneho poistného"
hint={`Tento údaj nájdete v riadok 02a.`}
hint={`Tento údaj nájdete v riadku 02a.`}
/>
<Input
name="uhrnPovinnehoPoistnehoNaZdravotnePoistenieDohody"
type="number"
label="Úhrn zdravotného poistného"
hint={`Tento údaj nájdete v riadok 02b.`}
hint={`Tento údaj nájdete v riadku 02b.`}
/>
<Input
name="uhrnPreddavkovNaDanDohody"
Expand Down
48 changes: 42 additions & 6 deletions src/pages/suhrn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ const Suhrn: Page<TaxFormUserInput> = ({
currency: true,
allignRight: true,
},
{
title: 'Úhrn príjmov zo všetkých dohôd',
value: taxFormUserInput.uhrnPrijmovZoVsetkychDohod,
currency: true,
allignRight: true,
},
{
title: 'Úhrn sociálneho poistného',
value:
Expand Down Expand Up @@ -184,6 +178,48 @@ const Suhrn: Page<TaxFormUserInput> = ({
]
}
/>
<Summary
title={`Dohody v SR pre rok ${TAX_YEAR}`}
href={'/dohoda'}
rows={
taxFormUserInput.dohoda
? [
{
title: 'Úhrn príjmov zo všetkých dohôd',
value: taxFormUserInput.uhrnPrijmovZoVsetkychDohod,
currency: true,
allignRight: true,
},
{
title: 'Úhrn sociálneho poistného z dohôd',
value:
taxFormUserInput.uhrnPovinnehoPoistnehoNaSocialnePoistenie,
currency: true,
allignRight: true,
testId: 'r039_socialne',
},
{
title: 'Úhrn zdravotného poistného z dohôd',
value:
taxFormUserInput.uhrnPovinnehoPoistnehoNaZdravotnePoistenie,
currency: true,
allignRight: true,
testId: 'r039_zdravotne',
},
{
title: 'Úhrn preddavkov na daň z dohôd',
value: taxFormUserInput.uhrnPreddavkovNaDan,
currency: true,
allignRight: true,
},
]
: [
{
title: `V roku ${TAX_YEAR} som nepracoval na dohodu`,
},
]
}
/>
<Summary
title="Zvýhodnenie na manželku / manžela"
href={'/partner'}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/zamestnanie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ const Zamestnanie: Page<EmployedUserInput> = ({
name="uhrnPovinnehoPoistnehoNaSocialnePoistenie"
type="number"
label="Úhrn sociálneho poistného"
hint={`Tento údaj nájdete v riadok 02a.`}
hint={`Tento údaj nájdete v riadku 02a.`}
/>
<Input
name="uhrnPovinnehoPoistnehoNaZdravotnePoistenie"
type="number"
label="Úhrn zdravotného poistného"
hint={`Tento údaj nájdete v riadok 02b.`}
hint={`Tento údaj nájdete v riadku 02b.`}
/>
<Input
name="uhrnPreddavkovNaDan"
Expand Down

0 comments on commit 2e3e75e

Please sign in to comment.