Commit Graph

2526 Commits

Author SHA1 Message Date
Philipp
dd32514938 Fix percentage-based allowance/charge calculations (EN16931 compliance)
Two arithmetic bugs caused wrong line totals when percentage-based allowances
or charges were used:

Bug A — Product-level (product.allowances): The percent discount was computed
as (price * pct/100) * quantity (line total), then subtracted from the unit
price and multiplied by quantity again — discount applied twice.

Bug B — Item-level (itemAllowances) with basisQuantity != 1: The percent was
applied to price * quantity instead of price * quantity / basisQuantity.

Fix: LineCalculator and XML pull providers now pass context-appropriate
IAbsoluteValueProvider wrappers (perUnitProvider for product-level,
itemBasisProvider for item-level). Allowance.java uses RoundingMode.HALF_UP
in getPercent().divide(100). BasisAmount in XML is formatted via
currencyFormat().

Files changed:
- LineCalculator.java: perUnitProvider, itemBasisProvider in allowance/charge loops
- Allowance.java: RoundingMode.HALF_UP, scale 18
- ZUGFeRD2PullProvider.java: correct providers, format BasisAmount
- OXPullProvider.java, DAPullProvider.java: perUnitProvider for product-level
- CalculationTest.java: @Test on 5 methods, 4 new regression tests

Verification: mvn test -pl library -Dtest=CalculationTest

Full PR description with before/after XML proof: see .project/PR-allowance-charge-fix.md
(Test evidence files in C:\temp\mustang-test\ are for PR attachment only, not in repo.)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-04-27 18:09:13 +02:00
Philip Helger
751d6ccf0b Version bump 2026-04-26 23:15:56 +02:00
Philip Helger
3531e8c7c8 Updated 2026-04-26 23:04:05 +02:00
langfr
ce60fa42d2 Merge branch 'philippfischer143-issue/1095' 2026-04-25 14:41:09 +01:00
langfr
ef45d25fce Merge branch 'issue/1095' of https://github.com/philippfischer143/mustangproject into philippfischer143-issue/1095 2026-04-25 14:39:04 +01:00
langfr
edddec1320 Merge branch 'langfr-feature/1022' 2026-04-25 14:26:13 +01:00
langfr
2490d1caf9 Add BasisAmount to CashDiscount. 2026-04-25 14:20:27 +01:00
langfr
15c696c54a Merge branch 'langfr-bugfix/1022' 2026-04-25 13:23:16 +01:00
langfr
6e9b5a1223 Merge branch 'bugfix/1022' of https://github.com/langfr/mustangproject into langfr-bugfix/1022 2026-04-25 13:20:19 +01:00
langfr
019412d8bd Merge branch 'PhilippGoetje-fix/cen-schematron-1.3.15' 2026-04-25 13:14:05 +01:00
langfr
a67a415aed Merge branch 'fix/cen-schematron-1.3.15' of https://github.com/PhilippGoetje/mustangproject into PhilippGoetje-fix/cen-schematron-1.3.15 2026-04-25 13:06:30 +01:00
langfr
5b67d75711 Merge branch 'langfr-bugfix/DespatchDelivery' 2026-04-25 12:58:12 +01:00
langfr
f5150d962a Merge branch 'bugfix/DespatchDelivery' of https://github.com/langfr/mustangproject into langfr-bugfix/DespatchDelivery 2026-04-25 12:55:29 +01:00
Frank Langelage
7a917b7a7e Merge pull request #1065 from langfr/bugfix/1062
Move getNamespaceForVersion and getPrefixForVersion to inheriting class.
2026-04-25 13:39:13 +02:00
Frank Langelage
bd69a3f32d Merge branch 'master' into bugfix/1062 2026-04-25 12:58:10 +02:00
Jochen Stärk
7db3b1fa0e [maven-release-plugin] prepare for next development iteration 2026-04-23 18:02:33 +02:00
Jochen Stärk
443771cce5 [maven-release-plugin] prepare release core-2.23.0 2026-04-23 18:02:31 +02:00
Jochen Stärk
6418c811bc corrected history, test 2026-04-23 17:46:59 +02:00
Jochen Stärk
d0d6d99192 Added Extended-CTC-FR to profiles for commandline 2026-04-23 17:42:13 +02:00
Jochen Stärk
568898b9e8 updated history 2026-04-17 17:41:00 +02:00
Jochen Stärk
ca392054e5 corrected tests 2026-04-16 13:53:44 +02:00
Jochen Stärk
3040687147 corrected a test 2026-04-16 13:24:21 +02:00
Jochen Stärk
56e4be84bf removed debug output 2026-04-16 13:23:55 +02:00
Jochen Stärk
0f6fdb7d76 added history entry 2026-04-16 13:23:34 +02:00
Philipp Fischer
27f827c097 Fixes #1095: ZF_240 XSLT monetary sums to cast inputs to xs:decimal before aggregation 2026-04-16 10:30:35 +02:00
Philipp Fischer
e09723f82f Fixes #1095 (validator): avoid floating-point artifacts in ZF_240 FACTUR-X_EXTENDED CO-10/CO-13 2026-04-16 09:20:04 +02:00
Philipp
18e0b1c691 #814 upgrade CEN EN16931 Schematron from v1.3.12 to v1.3.15
Replace EN16931-CII-validation.xslt and EN16931-UBL-validation.xslt with
the v1.3.15 release. Fixes BR-DEC-23 XPath bug and aligns with KoSIT
XRechnung 3.0.2 validator (v2026-01-31). Adds regression test.

Made-with: Cursor
2026-04-14 17:36:38 +02:00
Philip Helger
4068bbad65 Version bump 2026-04-13 11:18:11 +02:00
Jochen Staerk
a366e6bb26 Merge pull request #1089 from meparis/validator-france-10
Add France schematron ruleset
2026-04-10 17:01:33 +02:00
Jochen Stärk
98e3168d1d Adding quotes around Strings sometimes helps... 2026-04-10 15:43:05 +02:00
Jochen Stärk
d67be286f4 Merge branch 'master' of github.com:ZUGFeRD/mustangproject 2026-04-10 15:42:01 +02:00
Jochen Stärk
dc20846349 updated changes 2026-04-10 15:41:52 +02:00
Jochen Staerk
406f3c83d9 Merge pull request #1037 from pgjacobs/zugferd_pdf_xml_compression
Compress attachments
2026-04-10 15:38:23 +02:00
Jochen Staerk
a6946755a3 Merge pull request #1039 from xedaniel/master
fix: #1038
2026-04-10 15:35:49 +02:00
Jochen Staerk
b475a43ac1 Merge pull request #1029 from erras-it/patch-2
Added a breaking change notice regarding the removal of hardcoded values in #729
2026-04-10 15:32:49 +02:00
Philip Helger
07f0e32a6a Auto-close 2026-04-10 13:53:25 +02:00
Zahi YOUSFI
bcfec257b1 Add France schematron ruleset 2026-04-10 11:03:37 +02:00
Jochen Staerk
64512f1ead Merge pull request #1077 from langfr/bugfix/XMPParser
Remove leading characters from extracted XMP metadata.
2026-04-09 11:27:52 +02:00
Jochen Staerk
1bcca05fc5 Merge pull request #1083 from truearken/feature-pdf-langs
PDF Visualizations in English and French
2026-04-09 11:22:16 +02:00
Jochen Staerk
6b9961d3e9 Merge pull request #1084 from Marcel-Aimpulse/fix-xml-description
Fix xml description
2026-04-08 16:20:28 +02:00
Jochen Staerk
edb032310d Merge pull request #1055 from langfr/bugfix/ApplicableTradeTax
Correct order of ApplicableTradeTax sub-elements.
2026-04-08 16:17:13 +02:00
Jochen Staerk
060cf623be Merge pull request #1052 from langfr/bugfix/1048
Remove parsing OriginatorDocumentReference.ID as date.
2026-04-08 16:05:39 +02:00
Jochen Staerk
d705f06f95 Merge pull request #1073 from kschwank/feature/hierarchical-positions-xml-export
add hierarchical invoice positions in CII XML export for EXTENDED pro…
2026-04-08 15:52:31 +02:00
Marcel Westenberg Aimpulse
b0f43c0bb5 Extracted local constant for XML description 2026-04-07 18:01:36 +02:00
Marcel Westenberg Aimpulse
e880bf7f6e Changed old invalid link to new ZUGFeRD/factur-x link 2026-04-07 17:31:42 +02:00
Jochen Staerk
7fcf1e93cb Merge pull request #1050 from klaus0x7c4/validation-report-pdf-with-validator-info
Add validator information to PDF report (name and version)
2026-04-07 15:56:59 +02:00
Jochen Staerk
cfb1f9f7a8 Merge pull request #1060 from meparis/fix-bt18-referenceTypeCode
Add ReferenceTypeCode for BT-18 AdditionalReferencedDocument
2026-04-07 15:55:25 +02:00
Jochen Staerk
cc4b8ab55c Merge pull request #1046 from meparis/feature/bt23-settable
Add configurable BT-23 business process ID for CII export
2026-04-07 15:52:55 +02:00
Jochen Staerk
e4a139a815 Merge pull request #1061 from langfr/feature/TestIndicator
Add ability to mark an Invoice as a test invoice.
2026-04-07 15:50:28 +02:00
Jochen Staerk
8f85f3f9d1 Merge pull request #1082 from langfr/feature/xmlTools
Centralize and secure DocumentBuilder creation.
2026-04-07 15:46:11 +02:00