Add CalculationPercent (BT-101) and BasisAmount (BT-100) to allowances/charges on document level.
This commit is contained in:
@@ -811,8 +811,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
"<ram:ChargeIndicator>" +
|
"<ram:ChargeIndicator>" +
|
||||||
"<udt:Indicator>true</udt:Indicator>" +
|
"<udt:Indicator>true</udt:Indicator>" +
|
||||||
"</ram:ChargeIndicator>" +
|
"</ram:ChargeIndicator>";
|
||||||
"<ram:ActualAmount>" + currencyFormat(charge.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
if (charge.getPercent() != null && (profile == Profiles.getByName("EN16931") || (profile == Profiles.getByName("EXTENDED")))) {
|
||||||
|
xml += "<ram:CalculationPercent>" + vatFormat(charge.getPercent()) + "</ram:CalculationPercent>";
|
||||||
|
}
|
||||||
|
if (charge.getBasisAmount() != null && (profile == Profiles.getByName("EN16931") || (profile == Profiles.getByName("EXTENDED")))) {
|
||||||
|
xml += "<ram:BasisAmount>" + currencyFormat(charge.getBasisAmount()) + "</ram:BasisAmount>";
|
||||||
|
}
|
||||||
|
xml += "<ram:ActualAmount>" + currencyFormat(charge.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
||||||
if (charge.getReasonCode() != null) {
|
if (charge.getReasonCode() != null) {
|
||||||
xml += "<ram:ReasonCode>" + charge.getReasonCode() + "</ram:ReasonCode>";
|
xml += "<ram:ReasonCode>" + charge.getReasonCode() + "</ram:ReasonCode>";
|
||||||
}
|
}
|
||||||
@@ -855,14 +861,20 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
"<ram:ChargeIndicator>" +
|
"<ram:ChargeIndicator>" +
|
||||||
"<udt:Indicator>false</udt:Indicator>" +
|
"<udt:Indicator>false</udt:Indicator>" +
|
||||||
"</ram:ChargeIndicator>" +
|
"</ram:ChargeIndicator>";
|
||||||
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
if (allowance.getPercent() != null) {
|
||||||
if (allowance.getReason() != null) {
|
xml += "<ram:CalculationPercent>" + vatFormat(allowance.getPercent()) + "</ram:CalculationPercent>";
|
||||||
xml += "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
|
||||||
}
|
}
|
||||||
|
if (allowance.getBasisAmount() != null) {
|
||||||
|
xml += "<ram:BasisAmount>" + currencyFormat(allowance.getBasisAmount()) + "</ram:BasisAmount>";
|
||||||
|
}
|
||||||
|
xml += "<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
||||||
if (allowance.getReasonCode() != null) {
|
if (allowance.getReasonCode() != null) {
|
||||||
xml += "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
|
xml += "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
|
||||||
}
|
}
|
||||||
|
if (allowance.getReason() != null) {
|
||||||
|
xml += "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
||||||
|
}
|
||||||
xml += "<ram:CategoryTradeTax>" +
|
xml += "<ram:CategoryTradeTax>" +
|
||||||
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
||||||
"<ram:CategoryCode>" + allowance.getCategoryCode() + "</ram:CategoryCode>";
|
"<ram:CategoryCode>" + allowance.getCategoryCode() + "</ram:CategoryCode>";
|
||||||
|
|||||||
@@ -763,8 +763,9 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setNumber(number)
|
.setNumber(number)
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(19)), price, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(19)), price, new BigDecimal(1.0)))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(19)), price, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(19)), price, new BigDecimal(1.0)))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(19)), price, new BigDecimal(1.0))).addCharge(new Charge().setPercent(new BigDecimal(50)).setTaxPercent(new BigDecimal(19)).setReasonCode("ABK"))
|
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(19)), price, new BigDecimal(1.0)))
|
||||||
.addAllowance(new Allowance().setPercent(new BigDecimal(50)).setTaxPercent(new BigDecimal(19)).setReason("Mengenrabatt"))
|
.addCharge(new Charge().setPercent(new BigDecimal(50)).setBasisAmount(price).setTaxPercent(new BigDecimal(19)).setReasonCode("ABK").setReason("Verschiedenes"))
|
||||||
|
.addAllowance(new Allowance().setPercent(new BigDecimal(50)).setTaxPercent(new BigDecimal(19)).setReasonCode("95").setReason("Mengenrabatt"))
|
||||||
);
|
);
|
||||||
String theXML = new String(ze.getProvider().getXML(), StandardCharsets.UTF_8);
|
String theXML = new String(ze.getProvider().getXML(), StandardCharsets.UTF_8);
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
|
|||||||
Reference in New Issue
Block a user