Commit Graph

2503 Commits

Author SHA1 Message Date
langfr
448bd0b356 Merge branch 'dont-emit-empty-node-for-definedTradeContact' of https://github.com/WorkProg/mustangproject into WorkProg-dont-emit-empty-node-for-definedTradeContact 2026-05-14 21:30:40 +01:00
langfr
078bb49c87 Merge branch 'langfr-feature/UltimateShipToTradeParty' 2026-05-14 13:32:03 +01:00
langfr
7ebd1b61a5 Merge branch 'feature/UltimateShipToTradeParty' of https://github.com/langfr/mustangproject into langfr-feature/UltimateShipToTradeParty 2026-05-14 13:30:17 +01:00
langfr
ea6dace318 Merge branch 'langfr-feature/DeliveryTypeCode' 2026-05-14 13:28:11 +01:00
langfr
3655c1de7a Support <ram:DeliveryTypeCode/> 2026-05-13 22:15:02 +01:00
langfr
04d06b14f0 Support <ram:UltimateShipToTradeParty/> 2026-05-13 19:35:35 +01:00
Jochen Stärk
0544f3a866 closes #1108 2026-05-13 14:15:13 +02:00
Roland Fredenhagen
dcd9012cd0 dont emit empty node for definedTradeContact 2026-05-12 13:39:44 +02:00
Jochen Staerk
13a85809da Merge pull request #1043 from PhilippGoetje/fix/allowance-charge-percent
Fix percentage-based allowance/charge calculations (EN16931 compliance)
2026-05-12 12:33:56 +02:00
Jochen Stärk
42df52275d Revert "Merge pull request #1067 from phax/java17-base"
This reverts commit f6b6c0a36e, reversing
changes made to d8313dae20.
2026-05-07 13:24:02 +02:00
Jochen Staerk
f6b6c0a36e Merge pull request #1067 from phax/java17-base
Set Java 17 as base + dependency updates + test fix
2026-05-07 13:22:43 +02:00
Jochen Stärk
d8313dae20 Merge branch 'master' of github.com:ZUGFeRD/mustangproject 2026-05-07 13:15:19 +02:00
langfr
6989cf02be Merge branch 'Marcel-Aimpulse-feature-fix-xml-description' 2026-05-05 13:55:28 +01:00
langfr
ad46e97bba Merge branch 'feature-fix-xml-description' of https://github.com/Marcel-Aimpulse/mustangproject into Marcel-Aimpulse-feature-fix-xml-description 2026-05-05 13:53:44 +01:00
langfr
6fbf023ed8 Merge branch 'langfr-bugfix/XMP_null' 2026-05-05 13:45:14 +01:00
langfr
189bbda416 Avoid NPE by checking zi.getXMP() is not null. 2026-05-05 13:36:58 +01:00
Marcel Westenberg Aimpulse
1af1e2f14a Added variable for XML_DESCRIPTION string 2026-05-04 15:59:52 +02:00
Marcel Westenberg Aimpulse
81a3e857e2 Added correct link to ZUGFeRD documentation 2026-05-04 15:47:51 +02:00
Philip Helger
51a216bb94 Merge branch 'ZUGFeRD-master' into java17-base 2026-05-01 20:29:46 +02:00
Philip Helger
1b51a4d0ce Version bump 2026-05-01 20:27:50 +02:00
Philip Helger
1abbccc878 Auto-close 2026-05-01 20:26:47 +02:00
Philip Helger
5ec6f460fc Even newer versions 2026-05-01 20:26:47 +02:00
Philip Helger
54c65d9947 Action update 2026-05-01 20:26:47 +02:00
Philip Helger
8722399455 Github to run with Java 17 as well 2026-05-01 20:26:47 +02:00
Philip Helger
8f484dfc2c Added @TestMethodOrder to honour @Ordered annotation 2026-05-01 20:25:57 +02:00
Philip Helger
48c5c8b5cb Updated to Java 17 + version bumps 2026-05-01 20:25:52 +02:00
Philipp
73b5952c1d Fix line-level SpecifiedTradeAllowanceCharge BasisAmount (BT-137/BT-142)
The line-level BasisAmount in SpecifiedTradeAllowanceCharge must equal
the value the percentage is applied to (BT-137/BT-142 semantic
definition, EN 16931-1:2017+A1:2019). For an item with basisQuantity != 1
that value is (price / basisQuantity) * quantity = the line subtotal, not
the per-unit price/basisQuantity value.

Also matches the line-net formula confirmed for EN 16931-1:2026 (BR-67,
ConnectingEurope/eInvoicing-EN16931 issue #445).

- ZUGFeRD2PullProvider.getItemTotalAllowanceChargeStr: emit
  currencyFormat(item.getValue().multiply(item.getQuantity())).
- getAllowanceChargeStr (product-level, BG-29 GrossPrice path) is
  intentionally NOT changed: there BasisAmount is the gross unit price
  per BT-148, which is per-unit by definition.
- CalculationTest: two new XML-level regression tests asserting
  BasisAmount and ActualAmount in emitted CII XML for allowance and
  charge cases with basisQuantity != 1 (Extended profile).

Fixes #925 (Extended profile), related to #948.

Made-with: Cursor
2026-04-27 18:13:56 +02:00
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