Skip to content

Commit

Permalink
Merge pull request ZUGFeRD#292 from StefanSchmaltz/master
Browse files Browse the repository at this point in the history
Vielen lieben Dank, sieht sehr gut aus, über Details müssen wir noch reden (bspw `<CrossIndustryDocument` ohne namespace prefix )
  • Loading branch information
jstaerk authored Oct 13, 2022
2 parents 7183cef + 589e94a commit d604427
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 250 deletions.
38 changes: 33 additions & 5 deletions library/src/main/java/org/mustangproject/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@
*/
package org.mustangproject;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.mustangproject.ZUGFeRD.*;
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;

import org.mustangproject.ZUGFeRD.IExportableTransaction;
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
import org.mustangproject.ZUGFeRD.IZUGFeRDPaymentTerms;
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

/***
* An invoice, with fluent setters
* @see IExportableTransaction if you want to implement an interface instead
Expand All @@ -39,6 +45,8 @@ public class Invoice implements IExportableTransaction {
protected String documentName = null, documentCode = null, number = null, ownOrganisationFullPlaintextInfo = null, referenceNumber = null, shipToOrganisationID = null, shipToOrganisationName = null, shipToStreet = null, shipToZIP = null, shipToLocation = null, shipToCountry = null, buyerOrderReferencedDocumentID = null, invoiceReferencedDocumentID = null, buyerOrderReferencedDocumentIssueDateTime = null, ownForeignOrganisationID = null, ownOrganisationName = null, currency = null, paymentTermDescription = null;
protected Date issueDate = null, dueDate = null, deliveryDate = null;
protected BigDecimal totalPrepaidAmount = null;
protected BigDecimal grandTotalAmount = null;
protected BigDecimal duePayableAmount = null;
protected TradeParty sender = null, recipient = null, deliveryAddress = null;
@JsonDeserialize(contentAs=Item.class)
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
Expand Down Expand Up @@ -433,6 +441,24 @@ public Invoice setTotalPrepaidAmount(BigDecimal totalPrepaidAmount) {
return this;
}

public BigDecimal getGrandTotalAmount() {
return grandTotalAmount;
}

public Invoice setGrandTotalAmount(BigDecimal grandTotalAmount) {
this.grandTotalAmount = grandTotalAmount;
return this;
}

public BigDecimal getDuePayableAmount() {
return duePayableAmount;
}

public Invoice setDuePayableAmount(BigDecimal duePayableAmount) {
this.duePayableAmount = duePayableAmount;
return this;
}

@Override
public IZUGFeRDExportableTradeParty getSender() {
return sender;
Expand All @@ -445,6 +471,7 @@ public IZUGFeRDExportableTradeParty getSender() {
* @param ownContact the sender contact
* @return fluent setter
*/
@Deprecated
public Invoice setOwnContact(Contact ownContact) {
this.sender.setContact(ownContact);
return this;
Expand Down Expand Up @@ -689,4 +716,5 @@ public Invoice setSpecifiedProcuringProjectName(String specifiedProcuringProject
this.specifiedProcuringProjectName = specifiedProcuringProjectName;
return this;
}

}
25 changes: 18 additions & 7 deletions library/src/main/java/org/mustangproject/TradeParty.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.mustangproject.ZUGFeRD.*;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
import org.mustangproject.ZUGFeRD.IZUGFeRDLegalOrganisation;
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementDebit;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/***
* A organisation, i.e. usually a company
*/
Expand Down Expand Up @@ -136,11 +141,17 @@ public TradeParty(NodeList nodes) {
if (taxChilds.item(taxChildIndex).getLocalName() != null) {
if ((taxChilds.item(taxChildIndex).getLocalName().equals("ID"))) {
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID") != null) {
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("VA")) {
setVATID(taxChilds.item(taxChildIndex).getFirstChild().getNodeValue());
}
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("FC")) {
setTaxID(taxChilds.item(taxChildIndex).getFirstChild().getNodeValue());
Node firstChild = taxChilds.item(taxChildIndex).getFirstChild();
if (firstChild != null)
{
if (taxChilds.item(taxChildIndex).getAttributes()
.getNamedItem("schemeID").getNodeValue().equals("VA")) {
setVATID(firstChild.getNodeValue());
}
if (taxChilds.item(taxChildIndex).getAttributes()
.getNamedItem("schemeID").getNodeValue().equals("FC")) {
setTaxID(firstChild.getNodeValue());
}
}
}
}
Expand Down
Loading

0 comments on commit d604427

Please sign in to comment.