---
id: change/bcapps/13503
type: change
title: "#13503 [Main]-Prepayment amounts are incorrectly recalculated in statistics after partial posting when Prepmt. Amt. to Deduct Excl. VAT is manually adjusted"
summary: Fixed the Sales Line prepayment recalculation so Prepmt. Line Amount no longer grows past the invoiced prepayment after a partial posting where Prepmt Amt to Deduct was raised manually. Statistics now show stable values, and the remaining quantity can be posted.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - table sales line
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-11-21T00:56:47.755Z"
  flags: []
generated:
  at: "2026-11-30T13:33:07.232Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 72f70f6eb0f18c8a8967ba9983a889a43a11b454
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/13503
    title: "microsoft/BCApps#13503: [Main]-Prepayment amounts are incorrectly recalculated in statistics after partial posting when Prepmt. Amt. to Deduct Excl. VAT is manually adjusted"
    date: "2026-11-18"
    commit: 72f70f6eb0f18c8a8967ba9983a889a43a11b454
    t: null
    quote: Prepayment amounts are incorrectly recalculated in statistics after partial posting when Prepmt. Amt. to Deduct Excl. VAT is manually adjusted.
links:
  learn: []
  objects:
    - object/table/37
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/LocalFunctionality/Australia/how-to-calculate-goods-and-services-tax-on-prepayments
      title: Calculate goods and services tax on prepayments (AU)
      label: possibly related
      why: Documents prepayment GST calculation, relevant to prepayment amount recalculation issues.
      by: model
number: 13503
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/13503
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-18T13:08:37Z"
author: DhavalMore88
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Ownership: Manual"
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 14
  additions: 322
  deletions: 0
  al: 12
apps:
  - Base Application
objects_touched:
  - key: table/37
    page: table/37
    type: table
    id: 37
    name: Sales Line
    app: Base Application
    status: modified
objects_unjoined:
  - path: src/Layers/BE/BaseApp/Sales/Document/SalesLine.Table.al
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 657599
systems:
  - sales
quote: Prepayment amounts are incorrectly recalculated in statistics after partial posting when Prepmt. Amt. to Deduct Excl. VAT is manually adjusted.
joined_against:
  major: "30"
  commit: f53bb0f1ecd89fde9f133f9dcaf5bf43cf5f2671
---

# #13503 [Main]-Prepayment amounts are incorrectly recalculated in statistics after partial posting when Prepmt. Amt. to Deduct Excl. VAT is manually adjusted

> Fixed the Sales Line prepayment recalculation so Prepmt. Line Amount no longer grows past the invoiced prepayment after a partial posting where Prepmt Amt to Deduct was raised manually. Statistics now show stable values, and the remaining quantity can be posted.

[Pull request](https://github.com/microsoft/BCApps/pull/13503) · merged into `main` (BC30) on 2026-11-18 by DhavalMore88 (community contribution) · 14 files (+322 -0), 12 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Added local procedure CapPrepmtLineAmountAfterOverDeduction, called in UpdatePrepmtAmounts after the Prepmt. Line Amount recalculation
- When an amount was deducted and the recalculated value exceeds both Prepmt. Amt. Inv. and the line's total prepayment, it is capped at the larger of the two
- Fixes the false 'prepayment invoices not posted' error when posting the remaining quantity
- Recalculation was triggered on closing Statistics via ReleaseSalesDocument.CalcAndUpdateVATOnLines and UpdateVATOnLines
- Applied in W1 and 11 localization layers, with regression tests in W1 and RU
- Behaviour changes for users or extensions.

## AL objects touched

- [Table 37 "Sales Line"](../../objects/table/37.md), Base Application: modified
- `src/Layers/BE/BaseApp/Sales/Document/SalesLine.Table.al`: modified, not in the BC30 snapshot

## Context

- Work items: AB#657599
- Labels: ADO: Sync, From Fork, Ownership: Manual, Team: Finance
- Systems: sales
- From the description: "Prepayment amounts are incorrectly recalculated in statistics after partial posting when Prepmt. Amt. to Deduct Excl. VAT is manually adjusted."

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Calculate goods and services tax on prepayments (AU)](https://learn.microsoft.com/dynamics365/business-central/LocalFunctionality/Australia/how-to-calculate-goods-and-services-tax-on-prepayments) — possibly related: Documents prepayment GST calculation, relevant to prepayment amount recalculation issues. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
