Merge remote-tracking branch 'remotes/origin/master' into Improvements

This commit is contained in:
Sebastian Sieber
2020-11-27 12:53:01 +01:00
14 changed files with 234 additions and 18 deletions

View File

@@ -40,6 +40,7 @@ public class Invoice implements IExportableTransaction {
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
protected ArrayList<String> notes = null;
protected String contractReferencedDocument = null;
protected ArrayList<FileAttachment> xmlEmbeddedFiles=null;
protected Date detailedDeliveryDateStart = null;
protected Date detailedDeliveryPeriodEnd = null;
@@ -78,6 +79,22 @@ public class Invoice implements IExportableTransaction {
return this;
}
public Invoice embedFileInXML(FileAttachment fa) {
if (xmlEmbeddedFiles == null) {
xmlEmbeddedFiles=new ArrayList<FileAttachment>();
}
xmlEmbeddedFiles.add(fa);
return this;
}
public FileAttachment[] getAdditionalReferencedDocuments() {
if (xmlEmbeddedFiles == null) {
return null;
}
return xmlEmbeddedFiles.toArray(new FileAttachment[0]);
}
@Override
public String getNumber() {

View File

@@ -10,6 +10,8 @@ import java.math.BigDecimal;
public class Product implements IZUGFeRDExportableProduct {
protected String unit, name, description, sellerAssignedID, buyerAssignedID;
protected BigDecimal VATPercent;
protected boolean isReverseCharge=false;
protected boolean isIntraCommunitySupply=false;
/***
* default constructor
@@ -54,6 +56,37 @@ public class Product implements IZUGFeRDExportableProduct {
return this;
}
@Override
public boolean isReverseCharge() {
return isReverseCharge;
}
@Override
public boolean isIntraCommunitySupply() {
return isIntraCommunitySupply;
}
/***
* sets reverse charge(=delivery to outside EU)
* @return fluent setter
*/
public Product setReverseCharge() {
isReverseCharge=true;
setVATPercent(BigDecimal.ZERO);
return this;
}
/***
* sets intra community supply(=delivery outside the country inside the EU)
* @return fluent setter
*/
public Product setIntraCommunitySupply() {
isIntraCommunitySupply=true;
setVATPercent(BigDecimal.ZERO);
return this;
}
@Override
public String getUnit() {
return unit;

View File

@@ -108,10 +108,16 @@ public interface IZUGFeRDExportableProduct {
return false;
}
default boolean isReverseCharge() {
return false;
}
default String getTaxCategoryCode() {
if (isIntraCommunitySupply()) {
return "K";
} else if (getVATPercent().equals(new BigDecimal(0))) {
return "K"; // within europe
} else if (isReverseCharge()) {
return "AE"; // to out of europe...
} else if (getVATPercent().equals(BigDecimal.ZERO)) {
return "Z"; // zero rated goods
} else {
return "S"; // one of the "standard" rates (not neccessarily a default rate, even a deducted VAT is standard calculation)
@@ -119,8 +125,11 @@ public interface IZUGFeRDExportableProduct {
}
default String getTaxExemptionReason() {
if (isIntraCommunitySupply())
if (isIntraCommunitySupply()) {
return "Intra-community supply";
} else if (isReverseCharge()) {
return "Reverse Charge";
}
return null;
}
}

View File

@@ -442,7 +442,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " <ram:TypeCode>916</ram:TypeCode>\n"
+ " <ram:Name>" + f.getDescription() + "</ram:Name>\n"
+ " <ram:AttachmentBinaryObject mimeCode=\"" + f.getMimetype() + "\"\n"
+ " filename=\"" + f.getFilename() + "\">" + documentContent + "\n"
+ " filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>\n"
+ " </ram:AdditionalReferencedDocument>\n";
}
}