Wenche.MvaMeldingXml (wenche v0.3.0)

Copy Markdown View Source

XML generation for MVA-melding (VAT return) submission to Skatteetaten via Altinn 3.

Generates two XML documents:

  1. mvaMeldingInnsending — the envelope (konvolutt)
  2. mvaMeldingDto — the actual VAT return data

Summary

Functions

Generates the mvaMeldingInnsending (konvolutt/envelope) XML.

Generates the mvaMeldingDto (the actual VAT return) XML.

Builds the <periode> element contents for the given mva_data, choosing between the bimonthly (skattleggingsperiodeToMaaneder) and annual (skattleggingsperiodeAar) variants based on :filing_frequency.

Maps a termin number (1-6) to the skattleggingsperiodeToMaaneder string.

Functions

generer_konvolutt_xml(mva_data)

Generates the mvaMeldingInnsending (konvolutt/envelope) XML.

The mva_data map must contain:

  • :org_nummer — organization number
  • :termin — 1-6 (bimonthly) or 1 (annual)
  • :year — tax year
  • :system_name — name of the submitting system (default "Kontira")
  • :filing_frequency:bimonthly (default) or :annual. Annual filers are companies with taxable turnover ≤ 1 000 000 NOK approved by Skatteetaten for one-termin-per-year filing.

generer_melding_xml(mva_data)

Generates the mvaMeldingDto (the actual VAT return) XML.

The mva_data map must contain:

  • :org_nummer — organization number
  • :termin — 1-6 (bimonthly) or 1 (annual)
  • :year — tax year
  • :linjer — list of %{mva_kode: integer, grunnlag: number, sats: number, merverdiavgift: number}
  • :fastsatt_merverdiavgift — total MVA amount
  • :system_name — name of the submitting system (default "Kontira")
  • :filing_frequency:bimonthly (default) or :annual

periode_element(mva_data)

Builds the <periode> element contents for the given mva_data, choosing between the bimonthly (skattleggingsperiodeToMaaneder) and annual (skattleggingsperiodeAar) variants based on :filing_frequency.

Defaults to :bimonthly when the key is absent so existing callers keep working unchanged.

periode_tekst(termin)

Maps a termin number (1-6) to the skattleggingsperiodeToMaaneder string.