- make Line Calculation, e.g. total line net amount, accessible via JSON using getCalculation
This commit is contained in:
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.mustangproject.ZUGFeRD.IReferencedDocument;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
|
||||
import org.mustangproject.ZUGFeRD.LineCalculator;
|
||||
import org.mustangproject.util.NodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class DAPullProvider extends ZUGFeRD2PullProvider {
|
||||
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
||||
// exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||
}
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
final LineCalculator lc = currentItem.getCalculation();
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
|
||||
@@ -205,4 +205,6 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
|
||||
default String getAccountingReference() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default LineCalculator getCalculation() {return new LineCalculator(this); };
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
// exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||
}
|
||||
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
final LineCalculator lc = currentItem.getCalculation();
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
|
||||
@@ -195,7 +195,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
percent = currentItem.getProduct().getVATPercent();
|
||||
}
|
||||
if (percent != null) {
|
||||
LineCalculator lc = new LineCalculator(currentItem);
|
||||
LineCalculator lc = currentItem.getCalculation();
|
||||
VATAmount itemVATAmount = new VATAmount(lc.getItemTotalNetAmount(), lc.getItemTotalVATAmount(),
|
||||
currentItem.getProduct().getTaxCategoryCode(), vatDueDateTypeCode);
|
||||
String reasonText = currentItem.getProduct().getTaxExemptionReason();
|
||||
@@ -265,7 +265,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
}
|
||||
if (percent != null)
|
||||
{
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
final LineCalculator lc = currentItem.getCalculation();
|
||||
final VATAmount itemVATAmount = new VATAmount(lc.getItemTotalNetAmount(), lc.getItemTotalVATAmount(),
|
||||
currentItem.getProduct().getTaxCategoryCode(), vatDueDateTypeCode, percent);
|
||||
final String reasonText = currentItem.getProduct().getTaxExemptionReason();
|
||||
|
||||
@@ -344,7 +344,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider {
|
||||
}
|
||||
|
||||
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
final LineCalculator lc = currentItem.getCalculation();
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
|
||||
@@ -415,7 +415,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (currentItem.getId() != null) {
|
||||
lineIDStr = currentItem.getId();
|
||||
}
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
final LineCalculator lc = currentItem.getCalculation();
|
||||
if ((getProfile() != Profiles.getByName("Minimum")) && (getProfile() != Profiles.getByName("BasicWL"))) {
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
|
||||
@@ -1146,7 +1146,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
try {
|
||||
moreDetails = " with tax basis " + tc.getTaxBasis() + " and with positions " + tc.getTotal() + " = "
|
||||
+ Stream.of(tc.trans.getZFItems())
|
||||
.map(item -> new LineCalculator(item).getItemTotalNetAmount().toPlainString())
|
||||
.map(item -> item.getCalculation().getItemTotalNetAmount().toPlainString())
|
||||
.collect(Collectors.joining(" + "));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user