---
id: change/bcapps/9222
type: change
title: "#9222 [Main]- When issuing a prepayment invoice with an invoice discount applied, the prepayment amount does not take into account the total amount including tax."
summary: Fixed an issue where prepayment invoices with invoice discounts applied were not correctly including tax when the prepayment include tax setting was enabled. The reconciliation logic now uses the tax-inclusive amount as the target when calculating the prepayment difference.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit sales-post prepayments
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:12:56.512Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 60101de0dafe1856d00b98d3a38bc4b5dd02b6f6
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9222
    title: "microsoft/BCApps#9222: [Main]- When issuing a prepayment invoice with an invoice discount applied, the prepayment amount does not take into account the total amount including tax."
    date: "2026-07-14"
    commit: 60101de0dafe1856d00b98d3a38bc4b5dd02b6f6
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/442
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9222
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9222
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-14T10:05:12Z"
author: DhavalMore88
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 166
  deletions: 3
  al: 1
apps:
  - Base Application
objects_touched:
  - key: codeunit/442
    page: codeunit/442
    type: codeunit
    id: 442
    name: Sales-Post Prepayments
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 641621
systems:
  - sales
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9222 [Main]- When issuing a prepayment invoice with an invoice discount applied, the prepayment amount does not take into account the total amount including tax.

> Fixed an issue where prepayment invoices with invoice discounts applied were not correctly including tax when the prepayment include tax setting was enabled. The reconciliation logic now uses the tax-inclusive amount as the target when calculating the prepayment difference.

[Pull request](https://github.com/microsoft/BCApps/pull/9222) · merged into `main` (BC30) on 2026-07-14 by DhavalMore88 (community contribution) · 3 files (+166 -3), 1 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Prepayment amount calculation now properly accounts for tax when invoice discount is applied
- The UpdateDifferenceAmount procedure uses tax-inclusive amount for reconciliation when Prepmt. Include Tax is true
- Issue only affected the invoice-discount code path; non-discount and non-include-tax scenarios unaffected
- Added test cases for Canada and US locales to verify correct tax handling
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 442 "Sales-Post Prepayments"](../../objects/codeunit/442.md), Base Application (CA layer): modified

## Context

- Work items: AB#641621
- Labels: ADO: Sync, From Fork, Team: Finance
- Systems: sales

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).
