本文へ移動
cccskills
無料GitHub で公開

trygdeavgift

Expert knowledge of trygdeavgift (social insurance charge) domain in melosys-api. Use when: (1) Understanding avgift calculation for different member types, (2) Debugging årsavregning (annual reconciliation) processing, (3) Understanding fakturering flow to OEBS/faktureringskomponenten, (4) Investigating avgiftssatser and calculation rules per year, (5) Understanding skatteforhold and inntektskilder, (6) Debugging trygdeavgiftsperiode generation and storage, (7) Understanding the 25% rule and minstebeløp calculations.

日本語の概要は準備中です。原文の説明を表示しています。

インストール方法を見る

含まれるファイル(5)

  • SKILL.md11.3 KB
  • references/aarsavregning.md8.8 KB
  • references/beregning.md5.6 KB
  • references/debugging.md7.0 KB
  • references/fakturering.md6.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Trygdeavgift Domain

Trygdeavgift (social insurance charge) is the domain handling calculation, collection, and reconciliation of social security contributions for members of Norwegian folketrygden. This includes advance invoicing (forskuddsfakturering), annual reconciliation (årsavregning), and integration with OEBS.

Quick Reference

Domain Model Hierarchy

Behandlingsresultat
├── trygdeavgiftType: Trygdeavgift_typer
├── trygdeavgiftFritekst: String?
├── medlemskapsperioder: MutableSet<Medlemskapsperiode>
│   └── trygdeavgiftsperioder: Set<Trygdeavgiftsperiode>
├── lovvalgsperioder: MutableSet<Lovvalgsperiode>
│   └── trygdeavgiftsperioder: Set<Trygdeavgiftsperiode>
├── helseutgiftDekkesPerioder: MutableList<HelseutgiftDekkesPeriode>
│   └── trygdeavgiftsperioder: Set<Trygdeavgiftsperiode>
├── årsavregning: Årsavregning?
└── fakturaserieReferanse: String?

Trygdeavgiftsperiode
├── id: Long
├── periodeFra: LocalDate
├── periodeTil: LocalDate?
├── trygdeavgiftsbeløpMd: Penger
├── trygdesats: BigDecimal
├── grunnlagMedlemskapsperiode: Medlemskapsperiode?
├── grunnlagLovvalgsPeriode: Lovvalgsperiode?
├── grunnlagHelseutgiftDekkesPeriode: HelseutgiftDekkesPeriode?
├── grunnlagInntekstperiode: Inntektsperiode
└── grunnlagSkatteforholdTilNorge: SkatteforholdTilNorge

Årsavregning
├── id: Long
├── aar: Int
├── behandlingsresultat: Behandlingsresultat?      # @MapsId — shares PK with Behandlingsresultat
├── tidligereBehandlingsresultat: Behandlingsresultat?   # object reference, not an Id
├── tidligereFakturertBeloep: BigDecimal?
├── beregnetAvgiftBelop: BigDecimal?
├── tilFaktureringBeloep: BigDecimal?
├── harInnbetaltTrygdeavgift: Boolean?
├── innbetaltTrygdeavgift: BigDecimal?
├── manueltAvgiftBeloep: BigDecimal?
├── endeligAvgiftValg: EndeligAvgiftValg?
└── harSkjoennsfastsattInntektsgrunnlag: Boolean

Key Enums

EnumValuesDescription
Trygdeavgift_typerFORELØPIG, ENDELIGWhether the avgift is provisionally or finally set
AvgiftsdekningHELSEDEL_UTEN_SYKEPENGER, HELSEDEL_MED_SYKEPENGER, PENSJONSDEL_UTEN_YRKESSKADETRYGD, PENSJONSDEL_MED_YRKESSKADETRYGDCoverage affecting calculation
SkatteplikttypeSKATTEPLIKTIG, IKKE_SKATTEPLIKTIGWhether the person is skattepliktig til Norge (drives NAV vs Skatteetaten collection)
EndeligAvgiftValgOPPLYSNINGER_ENDRET, OPPLYSNINGER_ENDRET_MED_PERIODE_FRA_AVGIFTSSYSTEMET, OPPLYSNINGER_UENDRET, MANUELL_ENDELIG_AVGIFTHow the final avgift for an årsavregning is determined
BetalingstypeFAKTURA, TREKKPayment method choice (stored on Fagsak.betalingsvalg)

Avgift Calculation Flow

┌─────────────────────┐
│ Vedtaksfatting      │
│ (fattVedtak)        │
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐
│ TrygdeavgiftsService│
│ beregnOgLagre()     │
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐     ┌─────────────────────┐
│ melosys-trygdeavgift│────►│ Trygdeavgiftsperiode│
│ -beregning          │     │ created & stored    │
└─────────────────────┘     └─────────┬───────────┘
                                      │
                                      ▼
                            ┌─────────────────────┐
                            │ OPPRETT_FAKTURASERIE│
                            │ (saksflyt steg)     │
                            └─────────┬───────────┘
                                      │
                                      ▼
                            ┌─────────────────────┐
                            │ Fakturerings-       │
                            │ komponenten/OEBS    │
                            └─────────────────────┘

Service Layer

TrygdeavgiftsberegningService

Location: service/src/main/kotlin/.../avgift/TrygdeavgiftsberegningService.kt

Key operations:

  • beregnOgLagreTrygdeavgift() - Calculate and persist avgift periods
  • lagNyeTrygdeavgiftsperioder() - Create new avgift periods (private helper)
  • beregnTrygdeavgift() - Call external beregning module
  • finnFakturamottakerNavn() - Resolve the invoice recipient's name
  • sjekkTrygdeavgiftSkalBetalesTilNav() - Determine if NAV collects avgift (private)

TrygdeavgiftService

Location: service/src/main/kotlin/.../avgift/TrygdeavgiftService.kt

Key operations:

  • harFagsakBehandlingerMedTrygdeavgift() - Check for avgift on case
  • harFakturerbarTrygdeavgift() - Check if avgift should be invoiced
  • harTrygdeavgift() - Check if behandling has avgift

ÅrsavregningService

Location: service/src/main/kotlin/.../avgift/aarsavregning/ÅrsavregningService.kt

Key operations:

  • opprettÅrsavregning() - Create annual reconciliation
  • hentTidligereTrygdeavgiftsgrunnlag() - Get previous year's basis
  • hentNyttTrygdeavgiftsgrunnlag() - Get new basis
  • hentGjeldendeBehandlingsresultaterForÅrsavregning() - Get results for year

TrygdeavgiftMottakerService

Location: service/src/main/kotlin/.../avgift/TrygdeavgiftMottakerService.kt

Key operations:

  • skalBetalesTilNav() - Determine if avgift is collected by NAV
  • getTrygdeavgiftMottaker() - Find invoice recipient (overloaded for behandlingID / trygdeavgiftsperioder / behandlingsresultat)

Saksflyt Integration

Fakturering Steps

ProsessStegDescription
OPPRETT_FAKTURASERIECreate invoice series in faktureringskomponenten
KANSELLER_FAKTURASERIECancel existing invoice series
OPPDATER_FAKTURAMOTTAKERUpdate invoice recipient
SEND_FAKTURA_AARSAVREGNINGSend annual reconciliation invoice
BEREGN_OG_SEND_FAKTURACalculate and send invoice (satsendring)

Vedtak Flow with Avgift

IVERKSETT_VEDTAK_FTRL:
  LAGRE_MEDLEMSKAPSPERIODE_MEDL →
  OPPRETT_FAKTURASERIE →          # Creates invoice in OEBS
  AVSLUTT_SAK_OG_BEHANDLING →
  SEND_MELDING_OM_VEDTAK →
  RESET_ÅPNE_ÅRSAVREGNINGER

IVERKSETT_VEDTAK_AARSAVREGNING:
  SEND_FAKTURA_AARSAVREGNING →    # Annual reconciliation invoice
  VARSLE_PENSJONSOPPTJENING →
  AVSLUTT_SAK_OG_BEHANDLING →
  SEND_MELDING_OM_VEDTAK

Integration with External Systems

Faktureringskomponenten

Location: integrasjon/src/main/kotlin/.../faktureringskomponenten/

  • REST API integration for invoice management
  • Creates fakturaserie with periods and amounts
  • Handles kansellering of existing series
  • Returns fakturaserieReferanse stored on Behandlingsresultat

OEBS

  • Faktureringskomponenten handles integration with OEBS
  • OEBS manages actual billing and payment collection
  • Manglende innbetaling events sent via Kafka

Skatteetaten (Sigrun)

  • Annual income data retrieved for årsavregning
  • Skattehendelser processed via Kafka consumer
  • Used for 25% rule calculations

Debugging Queries

Find Trygdeavgiftsperioder for Behandling

SELECT t.*, mp.id as medlemskap_id, lp.id as lovvalg_id
FROM trygdeavgiftsperiode t
LEFT JOIN medlemskapsperiode mp ON t.medlemskapsperiode_id = mp.id
LEFT JOIN lovvalg_periode lp ON t.lovvalg_periode_id = lp.id
WHERE mp.behandlingsresultat_id = :behandlingsresultatId
   OR lp.beh_resultat_id = :behandlingsresultatId;

Check Fakturaserie Status

SELECT br.behandling_id, br.fakturaserie_referanse, b.status, f.saksnummer
FROM behandlingsresultat br
JOIN behandling b ON br.behandling_id = b.id
JOIN fagsak f ON b.saksnummer = f.saksnummer
WHERE br.fakturaserie_referanse IS NOT NULL
AND f.saksnummer = :saksnummer;

Find Årsavregning for Year

SELECT aa.*, br.behandling_id as behandlingsresultat_id, b.id as behandling_id
FROM aarsavregning aa
JOIN behandlingsresultat br ON aa.behandlingsresultat_id = br.behandling_id
JOIN behandling b ON br.behandling_id = b.id
WHERE aa.aar = :year
AND b.saksnummer = :saksnummer;

Check Manglende Innbetaling

SELECT pi.*, b.id as behandling_id, f.saksnummer
FROM prosessinstans pi
JOIN behandling b ON pi.behandling_id = b.id
JOIN fagsak f ON b.saksnummer = f.saksnummer
WHERE pi.prosess_type = 'OPPRETT_NY_BEHANDLING_MANGLENDE_INNBETALING'
ORDER BY pi.registrert_dato DESC;

Common Issues

IssueSymptomsInvestigation
Avgift not calculatedMissing trygdeavgiftsperioderCheck TrygdeavgiftsberegningService logs
Wrong avgift amountUnexpected invoice amountVerify satser, inntekt, dekning
Fakturaserie not createdNo fakturaserieReferanseCheck OPPRETT_FAKTURASERIE step
Årsavregning missingNo reconciliation for yearCheck skattehendelser received
Double invoicingMultiple fakturaseriereferanserCheck prosessinstans for duplicate vedtak
25% rule not appliedAvgift too highCap is enforced in the external melosys-trygdeavgift-beregning service; verify request/response there

Calculation Rules

Avgiftssatser (2024)

Rates are defined per year and depend on:

  • Avgiftsdekning (helsedel/pensjonsdel, med/uten sykepenger)
  • Member type (frivillig/pliktig, yrkesaktiv/pensjonist)
  • Whether the person is skattepliktig til Norge (Skatteplikttype)

25% Rule (hjemmel: folketrygdloven § 23-3 fjerde ledd)

  • Avgift cannot exceed 25% of the part of income that exceeds the minstebeløp (not 25% of total income)
  • Applies to pliktig medlemskap, frivillig medlemskap and EØS-pensjonister (applied differently per group)
  • The cap (MAKS_PROSENTDEL_AV_INNTEKT = 0.25) is enforced in the external melosys-trygdeavgift-beregning service, not in melosys-api. TotalbeløpBeregner in this repo only aggregates avgift and inntekt across periods for årsavregning.

Minstebeløp (hjemmel: folketrygdloven § 23-3 fjerde ledd)

  • Minimum amount threshold; the 25% cap applies to income above this amount
  • Defined per year in the external beregning service

Detailed Documentation

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Expert knowledge of Altinn A1 application processing for posted workers in melosys-api. Use when: (1) Understanding Altinn søknad/skjema processing, (2) Debugging MedlemskapArbeidEOS form mapping, (3) Understanding SoeknadMapper transformations, (4) Investigating posted worker application issues, (5) Understanding the MOTTAK_SOKNAD_ALTINN saga flow.

日本語の概要は準備中です。原文の説明を表示しています。

navikt/melosys-api22026年10月21日 更新

Expert knowledge of Employer/Employment integration (EREG/AAREG) in melosys-api. Use when: (1) Working with organization data from EREG (Enhetsregisteret), (2) Working with employment data from AAREG (Arbeidsforhold), (3) Understanding employer/organization lookup, (4) Debugging employer or employment issues, (5) Understanding the mapping between register data and domain models. Triggers: orgnummer, arbeidsforhold, EREG, AAREG, Enhetsregisteret, registeropplysninger, ansettelsesperiode, saksopplysning.

日本語の概要は準備中です。原文の説明を表示しています。

navikt/melosys-api22026年10月21日 更新

Modular monolith architecture overview for melosys-api. Use when needing to understand module structure, dependencies between modules, where to place new code, or when changes in one module might affect others. Triggers: "architecture", "module dependencies", "where should I put", "which modules", "dependency graph".

日本語の概要は準備中です。原文の説明を表示しています。

navikt/melosys-api22026年10月21日 更新

Expert knowledge of Behandling (case treatment) domain in melosys-api. Use when: (1) Understanding the behandling lifecycle and status transitions, (2) Debugging issues with behandling creation, status changes, or closure, (3) Understanding relationships between Fagsak, Behandling, and Behandlingsresultat, (4) Investigating why a behandling is stuck or has wrong status, (5) Understanding Behandlingstyper, Behandlingstema, Behandlingsstatus enums, (6) Debugging journalføring or SED-triggered behandling creation, (7) Understanding behandling creation via saksflyt sagas.

日本語の概要は準備中です。原文の説明を表示しています。

navikt/melosys-api22026年10月21日 更新

Expert knowledge of Behandlingsresultat (treatment result) domain in melosys-api. Use when: (1) Understanding result types and their meaning (FASTSATT_LOVVALGSLAND, MEDLEM_I_FOLKETRYGDEN, etc.), (2) Working with periods - Lovvalgsperiode, Medlemskapsperiode, Anmodningsperiode, Utpekingsperiode, (3) Debugging vedtak/decision metadata, criteria evaluation, or social insurance charges, (4) Understanding EU/EEA coordination logic and Article 16 exception handling, (5) Working with trygdeavgift (social insurance charge) calculations.

日本語の概要は準備中です。原文の説明を表示しています。

navikt/melosys-api22026年10月21日 更新

brev

無料

Expert knowledge of Brev (letter generation) in melosys-api. Use when: (1) Producing letters and decision documents (vedtaksbrev), (2) Understanding Dokgen templates and mapping, (3) Configuring letter recipients and distribution, (4) Debugging letter generation issues, (5) Adding new letter types or templates.

日本語の概要は準備中です。原文の説明を表示しています。

navikt/melosys-api22026年10月21日 更新

navikt のスキルをすべて見る

このスキルの問題を報告する