---
id: object/codeunit/28040-nz
type: object
title: Codeunit 28040 "WHTManagement" (NZ)
summary: Codeunit 28040 "WHTManagement" (NZ) in the NZ country layer (Microsoft.Finance.WithholdingTax). 41 public procedures. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - nz layer
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: f8443ba9e026bb5ef6dbcfa6744e3b209775534315c4934f9153d44680b37639
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/APAC/BaseApp/Local/FinancialMgt/WithholdingTax/WHTManagement.Codeunit.al
    title: src/Layers/APAC/BaseApp/Local/FinancialMgt/WithholdingTax/WHTManagement.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/nz
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 28040
name: WHTManagement
namespace: Microsoft.Finance.WithholdingTax
app: Base Application
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
country: NZ
counts:
  fields: 0
  procedures: 52
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
---

# Codeunit 28040 "WHTManagement" (NZ)

> Codeunit 28040 "WHTManagement" (NZ) in the NZ country layer (Microsoft.Finance.WithholdingTax). 41 public procedures. Introduced in BC29, still in BC30.

NZ country layer · Microsoft.Finance.WithholdingTax · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/APAC/BaseApp/Local/FinancialMgt/WithholdingTax/WHTManagement.Codeunit.al) · facts from BC29

An object of the [NZ localization](../../localizations/nz.md), not part of W1.

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "Cust. Ledger Entry" = rimd, TableData "Vendor Ledger Entry" = rimd, TableData "G/L Register" = rimd |

## Procedures

- `ApplyVendInvoiceWHT(var VendLedgerEntry: Record "Vendor Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `ApplyCustInvoiceWHT(var CustLedgerEntry: Record "Cust. Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `ApplyManualCustInvoiceWHT(var CustLedgerEntry: Record "Cust. Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `InsertVendInvoiceWHT(var PurchInvHeader: Record "Purch. Inv. Header")`
- `InsertVendCreditWHT(var PurchCreditHeader: Record "Purch. Cr. Memo Hdr."; AppliesID: Code[20])`
- `InsertCustInvoiceWHT(var SalesInvHeader: Record "Sales Invoice Header")`
- `InsertCustCreditWHT(var SalesCreditHeader: Record "Sales Cr.Memo Header"; AppliesID: Code[20])`
- `ProcessPayment(var GenJnlLine: Record "Gen. Journal Line"; TransactionNo: Integer; EntryNo: Integer; Source: Option Vendor,Customer; AmountWithDisc: Boolean): Integer`
- `ProcessManualReceipt(var GenJnlLine: Record "Gen. Journal Line"; TransactionNo: Integer; EntryNo: Integer; Source: Option Vendor,Customer): Integer`
- `InsertWHTPostingBuffer(var WHTEntryGL: Record "WHT Entry"; var GenJnlLine: Record "Gen. Journal Line"; Source: Option Payment,Refund; Oldest: Boolean)`
- `NextEntryNo(): Integer`
- `NextTempEntryNo(): Integer`
- `PrintWHTSlips(var GLReg: Record "G/L Register"; ScheduleInJobQueue: Boolean)`
- `InsertVendJournalWHT(var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `InsertCustJournalWHT(var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `InsertWHT(TransType: Option Purchase,Sale): Integer`
- `WHTAmountJournal(var GenJnlLine1: Record "Gen. Journal Line"; Post: Boolean): Decimal`
- `ApplyCustCalcWHT(var GenJnlLine: Record "Gen. Journal Line"): Decimal`
- `CalcWHT(var GenJnlLine: Record "Gen. Journal Line"; Source: Option Vendor,Customer): Decimal`
- `ApplyTempWHTEntry(var GenJnlLine: Record "Gen. Journal Line"; Source: Option Vendor,Customer): Integer`
- `ApplyTempVendInvoiceWHT(var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `VoidCheck2(CheckLedgEntry: Record "Check Ledger Entry")`
- `ApplyVendInvoiceWHTPosted(var VendLedgerEntry: Record "Vendor Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"; TransNo: Integer): Integer`
- `ApplyCustInvoiceWHTPosted(var CustLedgerEntry: Record "Cust. Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"; TransNo: Integer; AppliedEntryTransNo: Integer): Integer`
- `ProcessPaymentPosted(var GenJnlLine: Record "Gen. Journal Line"; TransactionNo: Integer; EntryNo: Integer; Source: Option Vendor,Customer): Integer`
- `CheckPmtDisc(PostingDate: Date; PmtDiscDate: Date; Amount1: Decimal; Amount2: Decimal; Amount3: Decimal; Amount4: Decimal): Boolean`
- `PreprintingWHT(var GenJournalLine: Record "Gen. Journal Line")`
- `CheckApplicationSalesWHT(var SalesHeader: Record "Sales Header")`
- `CheckApplicationPurchWHT(var PurchHeader: Record "Purchase Header")`
- `CheckApplicationGenSalesWHT(var GenJnlLine: Record "Gen. Journal Line")`
- `CheckApplicationGenPurchWHT(var GenJnlLine: Record "Gen. Journal Line")`
- `CalcVendExtraWHTForEarliest(var GenJnlLine: Record "Gen. Journal Line"): Decimal`
- `CalcCustExtraWHTForEarliest(var GenJnlLine: Record "Gen. Journal Line"): Decimal`
- `InsertVendPrepaymentInvoiceWHT(var PurchInvHeader: Record "Purch. Inv. Header"; var PurchHeader: Record "Purchase Header")`
- `InsertPrepaymentUnrealizedWHT(TransType: Option Purchase,Sale): Integer`
- `InitWHTEntry(TempWHTEntry: Record "WHT Entry"; AppldAmount: Decimal; PaymentAmount1: Decimal; var WHTEntry3: Record "WHT Entry")`
- `CheckWHTCalculationRule(TotalInvoiceAmountLCY: Decimal; WHTPostingSetup: Record "WHT Posting Setup"): Boolean`
- `InsertVendPrepaymentCrMemoWHT(var PurchCrMemoHeader: Record "Purch. Cr. Memo Hdr."; var PurchHeader: Record "Purchase Header")`
- `ABSMin(Decimal1: Decimal; Decimal2: Decimal): Decimal`
- `CalcAppliedWHTAmount(var VendorLedgerEntry: Record "Vendor Ledger Entry"; AppliedAmountWHT: Decimal; WHTPercent: Decimal; ExitLoop: Boolean): Decimal`
- `RoundWHTAmount(Amount: Decimal): Decimal` (internal)

Plus 11 local procedures.

## Triggers

OnRun

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "WHTManagement")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.

A NZ country object, not part of W1: the default corpus does not have it; `bcatlas_list_countries` shows which countries the atlas has.
