Merge branch 'master' into issues/764
# Conflicts: # library/src/main/java/org/mustangproject/Charge.java # library/src/main/java/org/mustangproject/Item.java # library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java
This commit is contained in:
@@ -56,7 +56,7 @@ public class Invoice implements IExportableTransaction {
|
||||
|
||||
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<>(),
|
||||
Charges = new ArrayList<>(), LogisticsServiceCharges = new ArrayList<>();
|
||||
protected IZUGFeRDPaymentTerms paymentTerms = null;
|
||||
protected ArrayList<IZUGFeRDPaymentTerms> paymentTerms = new ArrayList<>();
|
||||
|
||||
protected String invoiceReferencedDocumentID = null;
|
||||
protected Date invoiceReferencedIssueDate;
|
||||
@@ -646,15 +646,43 @@ public class Invoice implements IExportableTransaction {
|
||||
|
||||
@Override
|
||||
public IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||
return paymentTerms;
|
||||
if (!paymentTerms.isEmpty()) {
|
||||
return paymentTerms.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerms) {
|
||||
this.paymentTerms = paymentTerms;
|
||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerm) {
|
||||
if (paymentTerms.isEmpty()) {
|
||||
paymentTerms.add(paymentTerm);
|
||||
}
|
||||
else {
|
||||
paymentTerms.set(0, paymentTerm);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZUGFeRDPaymentTerms[] getExtendedPaymentTerms() {
|
||||
return paymentTerms.toArray(new IZUGFeRDPaymentTerms[0]);
|
||||
}
|
||||
|
||||
public Invoice setExtendedPaymentTerms(IZUGFeRDPaymentTerms[] paymentTerms) {
|
||||
this.paymentTerms.clear();
|
||||
this.paymentTerms.addAll(Arrays.asList(paymentTerms));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set multiple payment terms when using the EXTENDED profile.
|
||||
* @return
|
||||
*/
|
||||
public Invoice addPaymentTerms(IZUGFeRDPaymentTerms paymentTerm) {
|
||||
paymentTerms.add(paymentTerm);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getPaymentReference() {
|
||||
return paymentReference;
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
|
||||
.ifPresent(product::setTaxExemptionReason);
|
||||
|
||||
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
|
||||
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
||||
String isChargeString = ci.getAsString("Indicator").get();
|
||||
@@ -210,7 +211,6 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
|
||||
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
|
||||
.flatMap(cnm -> cnm.getAsBigDecimal("LineTotalAmount"))
|
||||
@@ -228,6 +228,36 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
});
|
||||
});
|
||||
|
||||
itemMap.getAllNodes("AllowanceCharge").map(NodeMap::new).forEach(stac -> { //UBL
|
||||
|
||||
String isChargeString = stac.getAsString("ChargeIndicator").get();
|
||||
String percentString = stac.getAsStringOrNull("MultiplierFactorNumeric");
|
||||
String amountString = stac.getAsStringOrNull("Amount");
|
||||
String reason = stac.getAsStringOrNull("AllowanceChargeReason");
|
||||
Charge izac = new Charge();
|
||||
if (isChargeString.equalsIgnoreCase("false")) {
|
||||
izac = new Allowance();
|
||||
} else {
|
||||
izac = new Charge();
|
||||
}
|
||||
if (amountString != null) {
|
||||
izac.setTotalAmount(new BigDecimal(amountString));
|
||||
}
|
||||
if (percentString != null) {
|
||||
izac.setPercent(new BigDecimal(percentString));
|
||||
}
|
||||
if (reason != null) {
|
||||
izac.setReason(reason);
|
||||
}
|
||||
|
||||
if (isChargeString.equalsIgnoreCase("false")) {
|
||||
addAllowance(izac);
|
||||
} else {
|
||||
addCharge(izac);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
|
||||
List<IncludedNote> includedNotes = new ArrayList<>();
|
||||
adld.getAllNodes("IncludedNote").forEach(item -> {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class LegalOrganisation implements IZUGFeRDLegalOrganisation {
|
||||
|
||||
public LegalOrganisation(SchemedID schemedID, String tradingBusinessName) {
|
||||
this.schemedID = schemedID;
|
||||
this.tradingBusinessName=tradingBusinessName;
|
||||
this.tradingBusinessName = tradingBusinessName;
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -54,8 +54,8 @@ public class LegalOrganisation implements IZUGFeRDLegalOrganisation {
|
||||
this.setSchemedID(gid);
|
||||
}
|
||||
}
|
||||
if (currentItemNode.getLocalName().equals("TradingBusinessName")) {
|
||||
setTradingBusinessName(currentItemNode.getFirstChild().getNodeValue());
|
||||
if ((currentItemNode.getLocalName().equals("TradingBusinessName")) && (currentItemNode.getFirstChild() != null)) {
|
||||
setTradingBusinessName(currentItemNode.getFirstChild().getNodeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,8 +305,7 @@ public interface IExportableTransaction {
|
||||
}
|
||||
|
||||
/**
|
||||
* get payment terms. if set, getPaymentTermDescription() and getDueDate() are
|
||||
* ignored
|
||||
* get payment terms. if set, getPaymentTermDescription() and getDueDate() are ignored
|
||||
*
|
||||
* @return the IZUGFeRDPaymentTerms of the invoice
|
||||
*/
|
||||
@@ -318,6 +317,14 @@ public interface IExportableTransaction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get payment terms for the EXTENDED profile (multiple terms are allowed)
|
||||
* @return
|
||||
*/
|
||||
default IZUGFeRDPaymentTerms[] getExtendedPaymentTerms() {
|
||||
return new IZUGFeRDPaymentTerms[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if a rebate agreements exists
|
||||
*
|
||||
|
||||
@@ -56,7 +56,6 @@ public class LineCalculator {
|
||||
}
|
||||
BigDecimal multiplicator = vatPercent.divide(BigDecimal.valueOf(100));
|
||||
|
||||
|
||||
BigDecimal quantity=BigDecimal.ZERO;
|
||||
if ((currentItem!=null)&&(currentItem.getQuantity()!=null)) {
|
||||
quantity=currentItem.getQuantity();
|
||||
@@ -72,8 +71,8 @@ public class LineCalculator {
|
||||
BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0
|
||||
? BigDecimal.ONE.setScale(4)
|
||||
: currentItem.getBasisQuantity();
|
||||
itemTotalNetAmount = quantity.multiply(currentItem.getPrice()).divide(basisQuantity, 18, RoundingMode.HALF_UP)
|
||||
.subtract(allowanceItemTotal).subtract(allowance).add(charge).setScale(2, RoundingMode.HALF_UP);
|
||||
itemTotalNetAmount = quantity.multiply(price).divide(basisQuantity, 18, RoundingMode.HALF_UP)
|
||||
.subtract(allowanceItemTotal).setScale(2, RoundingMode.HALF_UP);
|
||||
itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator);
|
||||
}
|
||||
|
||||
|
||||
@@ -506,36 +506,44 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
|
||||
final IZUGFeRDPaymentTerms paymentTerms = trans.getPaymentTerms();
|
||||
if (paymentTerms == null) {
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||
|
||||
String paymentTermsXml = "";
|
||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||
return "";
|
||||
}
|
||||
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
final IZUGFeRDPaymentDiscountTerms discountTerms = paymentTerms.getDiscountTerms();
|
||||
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
|
||||
if (discountTerms != null) {
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
final String currency = trans.getCurrency();
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
for (IZUGFeRDPaymentTerms pt : paymentTerms)
|
||||
{
|
||||
paymentTermsXml += "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
final IZUGFeRDPaymentDiscountTerms discountTerms = pt.getDiscountTerms();
|
||||
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
|
||||
if (discountTerms != null)
|
||||
{
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
final String currency = trans.getCurrency();
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
|
||||
if (discountTerms.getBaseDate() != null) {
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(baseDate);
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
if (discountTerms.getBaseDate() != null)
|
||||
{
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(baseDate);
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
return paymentTermsXml;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -65,6 +66,24 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
return sumAllowanceCharge(percent, charges);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns information about every tax that is involved in the current transaction.
|
||||
*
|
||||
* @return transaction taxes.
|
||||
*/
|
||||
public Set<VATAmount> getTaxDetails() {
|
||||
return getVATPercentAmountMap().entrySet().stream()
|
||||
.map(entry ->
|
||||
new VATAmount(
|
||||
entry.getValue().getBasis(),
|
||||
entry.getValue().getCalculated(),
|
||||
entry.getValue().getCategoryCode()
|
||||
).setCalculated(entry.getKey())
|
||||
)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private BigDecimal sumAllowanceCharge(BigDecimal percent, IZUGFeRDAllowanceCharge[] charges) {
|
||||
BigDecimal res = BigDecimal.ZERO;
|
||||
if ((charges != null) && (charges.length > 0)) {
|
||||
|
||||
@@ -433,44 +433,57 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider {
|
||||
}
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||
|
||||
final IZUGFeRDPaymentTerms paymentTerms = trans.getPaymentTerms();
|
||||
final IZUGFeRDPaymentDiscountTerms discountTerms = paymentTerms.getDiscountTerms();
|
||||
final Date dueDate = paymentTerms.getDueDate();
|
||||
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {
|
||||
throw new IllegalStateException(
|
||||
String paymentTermsXml = "";
|
||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||
return paymentTermsXml;
|
||||
}
|
||||
|
||||
for (IZUGFeRDPaymentTerms pt : paymentTerms)
|
||||
{
|
||||
paymentTermsXml += "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
final IZUGFeRDPaymentDiscountTerms discountTerms = pt.getDiscountTerms();
|
||||
final Date dueDate = pt.getDueDate();
|
||||
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null)
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
||||
}
|
||||
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
|
||||
if (dueDate != null) {
|
||||
paymentTermsXml += "<ram:DueDateDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(dueDate);
|
||||
paymentTermsXml += "</ram:DueDateDateTime>";
|
||||
}
|
||||
|
||||
if (discountTerms != null) {
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
final String currency = trans.getCurrency();
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
|
||||
if (discountTerms.getBaseDate() != null) {
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(baseDate);
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
}
|
||||
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
|
||||
if (dueDate != null)
|
||||
{
|
||||
paymentTermsXml += "<ram:DueDateDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(dueDate);
|
||||
paymentTermsXml += "</ram:DueDateDateTime>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
}
|
||||
if (discountTerms != null)
|
||||
{
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
final String currency = trans.getCurrency();
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
if (discountTerms.getBaseDate() != null)
|
||||
{
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(baseDate);
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
}
|
||||
return paymentTermsXml;
|
||||
}
|
||||
|
||||
|
||||
@@ -969,56 +969,76 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
final IZUGFeRDPaymentTerms paymentTerms = trans.getPaymentTerms();
|
||||
if (paymentTerms == null) {
|
||||
|
||||
ArrayList<IZUGFeRDPaymentTerms> paymentTerms = new ArrayList<IZUGFeRDPaymentTerms>(Arrays.asList(trans.getExtendedPaymentTerms()));
|
||||
|
||||
IZUGFeRDPaymentTerms izpt= trans.getPaymentTerms();
|
||||
if (izpt!=null) {
|
||||
paymentTerms.add(izpt);
|
||||
}
|
||||
|
||||
String paymentTermsXml = "";
|
||||
if (paymentTerms.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
final IZUGFeRDPaymentDiscountTerms discountTerms = paymentTerms.getDiscountTerms();
|
||||
final Date dueDate = paymentTerms.getDueDate();
|
||||
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {
|
||||
throw new IllegalStateException(
|
||||
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
||||
}
|
||||
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
|
||||
for (IZUGFeRDPaymentTerms pt : paymentTerms)
|
||||
{
|
||||
|
||||
if (dueDate != null) {
|
||||
paymentTermsXml += "<ram:DueDateDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(dueDate);
|
||||
paymentTermsXml += "</ram:DueDateDateTime>";
|
||||
}
|
||||
paymentTermsXml += "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
for (final IZUGFeRDTradeSettlement payment : trans.getTradeSettlement()) {
|
||||
if ((payment != null) && (payment instanceof IZUGFeRDTradeSettlementDebit)) {
|
||||
paymentTermsXml += payment.getPaymentXML();
|
||||
final IZUGFeRDPaymentDiscountTerms discountTerms = pt.getDiscountTerms();
|
||||
final Date dueDate = pt.getDueDate();
|
||||
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null)
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
||||
}
|
||||
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
|
||||
|
||||
if (dueDate != null)
|
||||
{
|
||||
paymentTermsXml += "<ram:DueDateDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(dueDate);
|
||||
paymentTermsXml += "</ram:DueDateDateTime>";
|
||||
}
|
||||
|
||||
if (trans.getTradeSettlement() != null)
|
||||
{
|
||||
for (final IZUGFeRDTradeSettlement payment : trans.getTradeSettlement())
|
||||
{
|
||||
if ((payment != null) && (payment instanceof IZUGFeRDTradeSettlementDebit))
|
||||
{
|
||||
paymentTermsXml += payment.getPaymentXML();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (discountTerms != null) {
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
final String currency = trans.getCurrency();
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
if (discountTerms != null)
|
||||
{
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
final String currency = trans.getCurrency();
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
|
||||
if (discountTerms.getBaseDate() != null) {
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(baseDate);
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
if (discountTerms.getBaseDate() != null)
|
||||
{
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += DATE.udtFormat(baseDate);
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
return paymentTermsXml;
|
||||
}
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
|
||||
|
||||
try {
|
||||
if (getVersion() == 1) {
|
||||
nl = getNodeListByPath("//*[localname() = 'CrossIndustryDocument']//*[local-name() = 'SpecifiedSupplyChainTradeTransaction']/*[local-name() = 'ApplicableSupplyChainTradeAgreement']//*[local-name() = 'BuyerTradeParty']//*[local-name() = 'PostalTradeAddress']");
|
||||
nl = getNodeListByPath("//*[local-name() = 'CrossIndustryDocument']//*[local-name() = 'SpecifiedSupplyChainTradeTransaction']/*[local-name() = 'ApplicableSupplyChainTradeAgreement']//*[local-name() = 'BuyerTradeParty']//*[local-name() = 'PostalTradeAddress']");
|
||||
} else {
|
||||
nl = getNodeListByPath("//*[local-name() = 'CrossIndustryInvoice']//*[local-name() = 'SupplyChainTradeTransaction']//*[local-name() = 'ApplicableHeaderTradeAgreement']//*[local-name() = 'BuyerTradeParty']//*[local-name() = 'PostalTradeAddress']");
|
||||
}
|
||||
|
||||
@@ -449,8 +449,8 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"ExchangedDocument\"]|//*[local-name()=\"HeaderExchangedDocument\"]");
|
||||
NodeList ExchangedDocumentNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"GrandTotalAmount\"]|//*[local-name()=\"PayableAmount\"]");
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"GrandTotalAmount\"]|//*[local-name()=\"TaxInclusiveAmount\"]");
|
||||
BigDecimal expectedGrandTotal = null;
|
||||
NodeList totalNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
if (totalNodes.getLength() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user