diff --git a/src/lib/calculation.ts b/src/lib/calculation.ts index d63b8922..d6b4c2b3 100644 --- a/src/lib/calculation.ts +++ b/src/lib/calculation.ts @@ -34,6 +34,12 @@ export const CHILD_RATE_FIFTEEN_AND_OLDER_FROM_JULY = 40 const ZIVOTNE_MINIMUM_44_NASOBOK = 9638.25 +export const SPODNA_SADZBA_PRE_PREDDAVKY = 5000 +export const VRCHNA_SADZBA_PRE_PREDDAVKY = 16600 + +const POCET_KVARTALOV = 4 +const POCET_MESIACOV = 12 + // 63,4-násobok platného životného minima const ZVYHODNENIE_NA_PARTNERA = 13_825 export const TAX_YEAR = 2022 @@ -705,6 +711,7 @@ export function buildSummary(form: TaxForm): Summary { zakladDane: form.r080_zaklad_dane_celkovo, danovyPreplatok: form.r136_danovy_preplatok, danNaUhradu: form.r135_dan_na_uhradu, + zaplatenePreddavky: form.r133, } } @@ -903,3 +910,11 @@ export const monthKeyValues = (months: string[]): optionWithValue[] => { export const donateOnly3Percent = (form: TaxForm): boolean => { return form.canDonateTwoPercentOfTax && (form.suma_2_percenta.toNumber() < MIN_2_PERCENT_CALCULATED_DONATION) } + +export const countPreddavky = (form: TaxForm): Number => { + if (Number(form.r135_dan_na_uhradu) > VRCHNA_SADZBA_PRE_PREDDAVKY) { + return Number(round((form.r055.mul(DAN_Z_PRIJMU_SADZBA).div(POCET_MESIACOV)))) + } else if (Number(form.r135_dan_na_uhradu) > SPODNA_SADZBA_PRE_PREDDAVKY) { + return Number(round((form.r055.mul(DAN_Z_PRIJMU_SADZBA).div(POCET_KVARTALOV)))) + } +} diff --git a/src/pages/vysledky.tsx b/src/pages/vysledky.tsx index 02ac29ad..985eb2af 100644 --- a/src/pages/vysledky.tsx +++ b/src/pages/vysledky.tsx @@ -2,11 +2,18 @@ import React from 'react' import { formatCurrency } from '../lib/utils' import { TaxFormUserInput } from '../types/TaxFormUserInput' import { Page } from '../components/Page' +import { Warning } from '../components/Warning' import Decimal from 'decimal.js' import { BackLink } from '../components/BackLink' import Link from 'next/link' import { buildSummary } from '../lib/calculation' -import { TAX_YEAR } from '../lib/calculation' +import { countPreddavky } from '../lib/calculation' +import { + TAX_YEAR, + SPODNA_SADZBA_PRE_PREDDAVKY, + VRCHNA_SADZBA_PRE_PREDDAVKY, +} from '../lib/calculation' + interface SummaryRow { key: string @@ -114,6 +121,12 @@ const Vysledky: Page> = ({ }, ] + const monthlyPrepayment = Number(summary.danNaUhradu) > VRCHNA_SADZBA_PRE_PREDDAVKY + + const quarterlyPrepayment = Number(summary.danNaUhradu) > SPODNA_SADZBA_PRE_PREDDAVKY + + const prePayments = monthlyPrepayment || quarterlyPrepayment + return ( <> @@ -122,6 +135,16 @@ const Vysledky: Page> = ({

Stručný prehľad

+ + { + prePayments && + + + Predpokladané {monthlyPrepayment ? 'mesačné' : 'kvartálne'} preddavky na daň z príjmov v roku {TAX_YEAR+1} budú {countPreddavky(taxForm)}€ (výpočet má informatívny charakter). Pre viac informácií navštívte web Finančnej správy. + + + } +