---
id: object/codeunit/5616
type: object
title: Codeunit 5616 "Depreciation Calculation"
summary: Codeunit 5616 "Depreciation Calculation" in Base Application (Microsoft.FixedAssets.Depreciation). 28 public procedures, 12 events. Present since at least BC23, still in BC30, changed in BC24-25, BC27-28.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "28"
  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: 885f1f919011400ca8c1b49939cc900a322ce09a631d898af94bd13fc44aa634
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
    title: src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/gb
    - localization/ru
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9662
object_type: codeunit
object_id: 5616
name: Depreciation Calculation
namespace: Microsoft.FixedAssets.Depreciation
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "25"
  - "27"
  - "28"
source_major: "29"
obsolete: null
countries:
  - gb
  - ru
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 48
  events: 12
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 1
  called_by: 21
  implements: 0
---

# Codeunit 5616 "Depreciation Calculation"

> Codeunit 5616 "Depreciation Calculation" in Base Application (Microsoft.FixedAssets.Depreciation). 28 public procedures, 12 events. Present since at least BC23, still in BC30, changed in BC24-25, BC27-28.

Base Application · Microsoft.FixedAssets.Depreciation · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "FA Ledger Entry" = r, TableData "FA Posting Type Setup" = r, TableData "Maintenance Ledger Entry" = r |

## Events published

- `OnAfterAdjustDepr(DeprBookCode: Code[10]; BookValue: Decimal; MaxValue: Decimal; var Depreciation: Decimal)` (integration)
- `OnAfterCalcDepreciation(DeprBookCode: Code[10]; var Depreciation: Decimal; BookValue: Decimal)` (integration)
- `OnAfterDeprDays(StartingDate: Date; EndingDate: Date; var NumberOfDeprDays: Integer; Year365Days: Boolean)` (integration)
- `OnAfterGetDeprPeriod(FANo: Code[20]; DeprBookCode: Code[10]; UntilDate: Date; var StartingDate: Date; var EndingDate: Date; var NumberOfDays: Integer; Year365Days: Boolean)` (integration)
- `OnBeforeCalcRounding(DeprBook: Record "Depreciation Book"; OrigDeprAmount: Decimal; var DeprAmount: Decimal; var IsHandled: Boolean)` (integration)
- `OnBeforeFindMaxDate(var FALedgEntry: Record "FA Ledger Entry"; EntryDates: array[4] of Date; Year365Days: Boolean; var MaxDate: Date; var IsHandled: Boolean)` (integration)
- `OnBeforeGetFirstDeprDate(FixedAssetNo: Code[20]; DepreciationBookCode: Code[10]; Year365Days: Boolean; var LocalDate: Date; var IsHandled: Boolean)` (integration)
- `OnBeforeUseDeprStartingDate(FANo: Code[20]; DeprBookCode: Code[10]; var Result: Boolean; var IsHandled: Boolean)` (integration)
- `OnAfterGetFAPostingTypeSetup(var FAPostingTypeSetup: Record "FA Posting Type Setup"; Type: Option IncludeInDeprCalc,IncludeInGainLoss,DepreciationType,ReverseType)` (integration)
- `OnCalcEntryAmountsOnAfterSetFALedgEntryFilters(var FALedgerEntry: Record "FA Ledger Entry"; I: Integer)` (integration)
- `OnGetFirstDeprDateOnAfterSetFAFilter(var FALedgerEntry: Record "FA Ledger Entry")` (integration)
- `OnAfterSetFAFilter(var FALedgerEntry: Record "FA Ledger Entry")` (integration)

## Procedures

- `DeprDays(StartingDate: Date; EndingDate: Date; Year365Days: Boolean): Integer`
- `DeprDays(StartingDate: Date; EndingDate: Date; Year365Days: Boolean; UseAccountingPeriod: Boolean): Integer`
- `ToMorrow(ThisDate: Date; Year365Days: Boolean): Date`
- `ToMorrow(ThisDate: Date; Year365Days: Boolean; UseAccountingPeriod: Boolean): Date`
- `Yesterday(ThisDate: Date; Year365Days: Boolean): Date`
- `Yesterday(ThisDate: Date; Year365Days: Boolean; UseAccountingPeriod: Boolean): Date`
- `SetFAFilter(var FALedgEntry: Record "FA Ledger Entry"; FANo: Code[20]; DeprBookCode: Code[10]; FAPostingTypeOrder: Boolean)`
- `CalcEntryAmounts(FANo: Code[20]; DeprBookCode: Code[10]; StartingDate: Date; EndingDate: Date; var EntryAmounts: array[4] of Decimal)`
- `UseDeprStartingDate(FANo: Code[20]; DeprBookCode: Code[10]): Boolean`
- `GetFirstDeprDate(FANo: Code[20]; DeprBookCode: Code[10]; Year365Days: Boolean): Date`
- `GetFirstDeprDate(FANo: Code[20]; DeprBookCode: Code[10]; Year365Days: Boolean; UseAccountingPeriod: Boolean): Date`
- `GetMinusBookValue(FANo: Code[20]; DeprBookCode: Code[10]; StartingDate: Date; EndingDate: Date): Decimal`
- `GetUnpostedBonusDepreciationForCalc(var FADepreciationBook: Record "FA Depreciation Book"; StartingDate: Date; EndingDate: Date): Decimal` (internal)
- `AdjustDepr(DeprBookCode: Code[10]; var Depreciation: Decimal; BookValue: Decimal; SalvageValue: Decimal; EndingBookValue: Decimal; FinalRoundingAmount: Decimal)`
- `AdjustCustom1(DeprBookCode: Code[10]; var DeprAmount: Decimal; var Custom1Amount: Decimal; BookValue: Decimal; SalvageValue: Decimal; EndingBookValue: Decimal; FinalRoundingAmount: Decimal)`
- `GetSign(BookValue: Decimal; DeprBasis: Decimal; SalvageValue: Decimal; MinusBookValue: Decimal): Integer`
- `GetCustom1Sign(BookValue: Decimal; AcquisitionCost: Decimal; Custom1: Decimal; SalvageValue: Decimal; MinusBookValue: Decimal): Integer`
- `GetNewSigns(var BookValue: Decimal; var DeprBasis: Decimal; var SalvageValue: Decimal; var MinusBookValue: Decimal)`
- `GetNewCustom1Signs(var BookValue: Decimal; var AcquisitionCost: Decimal; var Custom1: Decimal; var SalvageValue: Decimal; var MinusBookValue: Decimal)`
- `CalcRounding(DeprBookCode: Code[10]; DeprAmount: Decimal): Decimal`
- `CalculateDeprInPeriod(FANo: Code[20]; DeprBookCode: Code[10]; EndingDate: Date; CalculatedDepr: Decimal; Sign: Integer; var NewBookValue: Decimal; var DeprBasis: Decimal; var SalvageValue: Decimal; var MinusBookValue: Decimal)`
- `GetDeprPeriod(FANo: Code[20]; DeprBookCode: Code[10]; UntilDate: Date; var StartingDate: Date; var EndingDate: Date; var NumberOfDays: Integer; Year365Days: Boolean)`
- `GetDeprPeriod(FANo: Code[20]; DeprBookCode: Code[10]; UntilDate: Date; var StartingDate: Date; var EndingDate: Date; var NumberOfDays: Integer; Year365Days: Boolean; UseAccountingPeriod: Boolean)`
- `DeprInFiscalYear(FANo: Code[20]; DeprBookCode: Code[10]; StartingDate: Date): Decimal`
- `GetPartOfCalculation(Type: Option IncludeInDeprCalc,IncludeInGainLoss,DepreciationType,ReverseType; PostingType: Option "Write-Down",Appreciation,"Custom 1","Custom 2"; DeprBookCode: Code[10]): Boolean`
- `FAName(var FA: Record "Fixed Asset"; DeprBookCode: Code[10]): Text[200]`
- `FADeprBookName(DeprBookCode: Code[10]): Text[200]`
- `DeprDays365(StartingDate: Date; EndingDate: Date): Integer`

Plus 8 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 5617 "FA Date Calculation"](../codeunit/5617.md) (1 call: `DeprInFiscalYear → GetFiscalYear`)

## Called by

- [Codeunit 5611 "Calculate Normal Depreciation"](../codeunit/5611.md) (23 calls: `CalcDB1Amount → DeprInFiscalYear`, `CalcHalfYearConventionDepr → DeprDays`, `CalcHalfYearConventionDepr → Yesterday`, …)
- [Codeunit 5612 "Calculate Custom 1 Depr."](../codeunit/5612.md) (14 calls: `CalcDB1Amount → DeprInFiscalYear`, `CalcSLAmount → DeprDays`, `CalcSLAmount → Yesterday`, …)
- [Report 5607 "Fixed Asset - Projected Value"](../report/5607.md) (7 calls: `CalculateFirstDeprAmount → DeprInFiscalYear`, `GetNextDate → ToMorrow`, `GetPeriodEndingDate → DeprDays`, …)
- [Codeunit 5605 "Calculate Disposal"](../codeunit/5605.md) (5 calls: `CalcGainLoss → CalcEntryAmounts`, `CalcGainLoss → GetPartOfCalculation`, `CalcReverseAmounts → CalcEntryAmounts`, …)
- [Codeunit 5601 "FA Insert G/L Account"](../codeunit/5601.md) (3 calls: `CalcLastDisposal → SetFAFilter`, `CorrectBookValueEntry → SetFAFilter`, `InsertBufferBalAcc → CalcRounding`)
- [Codeunit 5606 "FA Check Consistency"](../codeunit/5606.md) (3 calls: `CreateDisposedError → FAName`, `FADeprBookName → FADeprBookName`, `FAName → FAName`)
- [Codeunit 5618 "Table Depr. Calculation"](../codeunit/5618.md) (3 calls: `CreateTableBuffer → DeprDays`, `CreateTableBuffer → Yesterday`, `GetTablePercent → DeprDays`)
- [Codeunit 5642 "FA Reclass. Transfer Line"](../codeunit/5642.md) (3 calls: `FAName → FAName`, `InsertFAJnlLine → CalcRounding`, `InsertGenJnlLine → CalcRounding`)
- [Table 5612 "FA Depreciation Book"](../table/5612.md) (3 calls: `CalcDeprPeriod → DeprDays`, `CalcEndingDate → Yesterday`, `ShowBookValueAfterDisposal → SetFAFilter`)
- [Codeunit 5613 "Calculate Acq. Cost Depr."](../codeunit/5613.md) (2 calls: `CreateError → FAName`, `DeprCalc → CalcRounding`)
- [Codeunit 5600 "FA Insert Ledger Entry"](../codeunit/5600.md) (1 call: `FAName → FAName`)
- [Codeunit 5610 "Calculate Depreciation"](../codeunit/5610.md) (1 call: `CheckDeprDaysInFiscalYear → DeprDays`)
- [Codeunit 5626 "FA General Report"](../codeunit/5626.md) (1 call: `GetLastDate → SetFAFilter`)
- [Codeunit 5631 "FA Jnl.-Check Line"](../codeunit/5631.md) (1 call: `CheckFADepAcrossFiscalYear → ToMorrow`)
- [Codeunit 5632 "FA Jnl.-Post Line"](../codeunit/5632.md) (1 call: `FAName → FAName`)
- [Codeunit 5634 "FA Jnl.-Show Entries"](../codeunit/5634.md) (1 call: `OnRun → SetFAFilter`)
- [Codeunit 6283 "Sust. FA Journal Subscriber"](../codeunit/6283.md) (1 call: `FAName → FAName`)
- [Page 5666 "FA Depreciation Books Subform"](../page/5666.md) (1 call: `ShowFALedgEntries → SetFAFilter`)
- [Report 5611 "FA Posting Group - Net Change"](../report/5611.md) (1 call: `CalcNetDisposalMethod → SetFAFilter`)
- [Table 179 "Reversal Entry"](../table/179.md) (1 call: `CheckFA → FAName`)
- [Table 5640 "Main Asset Component"](../table/5640.md) (1 call: `CreateError → FAName`)

## Recent changes

- 2026-07-24 [#9662 [Master]-Fixed Asset: Declining-Balance method - wrong calculation when running depreciation](../../changes/bcapps/9662.md) (main, BC30, fix)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24-25, BC27-28

## Countries that replace it

[GB](../../localizations/gb.md), [RU](../../localizations/ru.md)

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). The call sections above are our own, per object, from the BC29 call graph. 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: "Depreciation Calculation")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
