# PEPPOL-EN16931-R046

Source: https://xmlvalid.com/rules/PEPPOL-EN16931-R046

> Item net price MUST equal (Gross price - Allowance amount) when gross price is provided.

- Level: error
- Rule sets: Peppol BIS Billing 3.0 rules 3.0.21, XRechnung 3.0 rules (UBL) 2.6.0
- Context: `cac:Price/cac:AllowanceCharge`
- Test: `not(cbc:BaseAmount) or xs:decimal(../cbc:PriceAmount) = xs:decimal(cbc:BaseAmount) - xs:decimal(cbc:Amount)`

> Item net price MUST equal (Gross price - Allowance amount) when gross price is provided.

- Level: error
- Rule sets: XRechnung 3.0 rules (CII) 2.6.0
- Context: `rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice`
- Test: `not(ram:ChargeAmount) or xs:decimal(../ram:NetPriceProductTradePrice/ram:ChargeAmount) = xs:decimal(ram:ChargeAmount) - u:decimalOrZero(ram:AppliedTradeAllowanceCharge/ram:ActualAmount[1])`

## Why it fails

- The line gives a gross price (`cac:AllowanceCharge/cbc:BaseAmount` in `cac:Price`) and a price discount, but the net price isn't gross price minus discount.

## How to fix it

- Make `cbc:PriceAmount` equal the gross price minus the price discount amount.

Validate a document against these rules: https://xmlvalid.com/validate
