Merge pull request #119 from swsch/tpa

Implement TotalPrepaidAmount
This commit is contained in:
Jochen Staerk
2019-08-01 11:43:19 +02:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ package org.mustangproject.ZUGFeRD;
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
import java.math.BigDecimal;
import java.util.Date;
public interface IZUGFeRDExportableTransaction {
@@ -257,4 +258,12 @@ public interface IZUGFeRDExportableTransaction {
* @return the IssueDateTime in format CCYY-MM-DDTHH:MM:SS
*/
default String getBuyerOrderReferencedDocumentIssueDateTime() { return null; }
/**
* get the TotalPrepaidAmount located in SpecifiedTradeSettlementMonetarySummation (v1) or
* SpecifiedTradeSettlementHeaderMonetarySummation (v2)
* @return the total sum (incl. VAT) of prepayments, i.e. the difference between GrandTotalAmount
* and DuePayableAmount
*/
default BigDecimal getTotalPrepaidAmount() { return BigDecimal.ZERO; }
}

View File

@@ -659,9 +659,14 @@ class ZUGFeRDTransactionModelConverter {
grandTotalAmount.setValue(currencyFormat(totals.getTotalGross()));
monetarySummation.getGrandTotalAmount().add(grandTotalAmount);
AmountType totalPrepaidAmount = xmlFactory.createAmountType();
totalPrepaidAmount.setCurrencyID(currency);
totalPrepaidAmount.setValue(currencyFormat(trans.getTotalPrepaidAmount()));
monetarySummation.getTotalPrepaidAmount().add(totalPrepaidAmount);
AmountType duePayableAmount = xmlFactory.createAmountType();
duePayableAmount.setCurrencyID(currency);
duePayableAmount.setValue(currencyFormat(totals.getTotalGross()));
duePayableAmount.setValue(currencyFormat(totals.getTotalGross().subtract(trans.getTotalPrepaidAmount())));
monetarySummation.getDuePayableAmount().add(duePayableAmount);
return monetarySummation;