remove ApplicablePercent for Category Code O since its not allowed
This commit is contained in:
@@ -135,7 +135,7 @@ public class VATAmount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public VATAmount add(VATAmount v) {
|
public VATAmount add(VATAmount v) {
|
||||||
return new VATAmount(basis.add(v.getBasis()), calculated.add(v.getCalculated()), this.categoryCode, this.dueDateTypeCode).setVatExemptionReasonText(v.getVatExemptionReasonText());
|
return new VATAmount(basis.add(v.getBasis()), calculated.add(v.getCalculated()), this.categoryCode, this.dueDateTypeCode).setVatExemptionReasonText(v.getVatExemptionReasonText() != null ? v.getVatExemptionReasonText(): this.vatExemptionReasonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VATAmount subtract(VATAmount v) {
|
public VATAmount subtract(VATAmount v) {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import org.mustangproject.FileAttachment;
|
|||||||
import org.mustangproject.IncludedNote;
|
import org.mustangproject.IncludedNote;
|
||||||
import org.mustangproject.XMLTools;
|
import org.mustangproject.XMLTools;
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
||||||
|
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -149,12 +150,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
if (profile == Profiles.getByName("Minimum")) {
|
if (profile == Profiles.getByName("Minimum")) {
|
||||||
xml += "<ram:ID>" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
xml += "<ram:ID>" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
||||||
} else {
|
} else {
|
||||||
String schemeAttribute="";
|
String schemeAttribute = "";
|
||||||
if ((party.getLegalOrganisation().getSchemedID().getScheme()!=null)&&(party.getLegalOrganisation().getSchemedID().getScheme().length()>0)) {
|
if ((party.getLegalOrganisation().getSchemedID().getScheme() != null) && (party.getLegalOrganisation().getSchemedID().getScheme().length() > 0)) {
|
||||||
schemeAttribute="schemeID=\"" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getScheme())+"\"";
|
schemeAttribute = "schemeID=\"" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getScheme()) + "\"";
|
||||||
|
|
||||||
}
|
}
|
||||||
xml += "<ram:ID "+schemeAttribute+">" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
xml += "<ram:ID " + schemeAttribute + ">" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (party.getLegalOrganisation().getTradingBusinessName() != null) {
|
if (party.getLegalOrganisation().getTradingBusinessName() != null) {
|
||||||
@@ -394,20 +395,20 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "</rsm:ExchangedDocumentContext>"
|
+ "</rsm:ExchangedDocumentContext>"
|
||||||
+ "<rsm:ExchangedDocument>"
|
+ "<rsm:ExchangedDocument>"
|
||||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>";
|
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>";
|
||||||
if (profile == Profiles.getByName("Extended") && trans.getDocumentName() != null) {
|
if (profile == Profiles.getByName("Extended") && trans.getDocumentName() != null) {
|
||||||
xml += "<ram:Name>" + XMLTools.encodeXML(trans.getDocumentName()) + "</ram:Name>";
|
xml += "<ram:Name>" + XMLTools.encodeXML(trans.getDocumentName()) + "</ram:Name>";
|
||||||
}
|
}
|
||||||
xml += "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
xml += "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||||
+ "<ram:IssueDateTime>" + DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
+ "<ram:IssueDateTime>" + DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
||||||
+ buildNotes(trans)
|
+ buildNotes(trans)
|
||||||
+ "</rsm:ExchangedDocument>"
|
+ "</rsm:ExchangedDocument>"
|
||||||
+ "<rsm:SupplyChainTradeTransaction>";
|
+ "<rsm:SupplyChainTradeTransaction>";
|
||||||
int lineID = 0;
|
int lineID = 0;
|
||||||
for (final IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
for (final IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||||
lineID++;
|
lineID++;
|
||||||
String lineIDStr = Integer.toString(lineID);
|
String lineIDStr = Integer.toString(lineID);
|
||||||
if (currentItem.getId()!=null) {
|
if (currentItem.getId() != null) {
|
||||||
lineIDStr=currentItem.getId();
|
lineIDStr = currentItem.getId();
|
||||||
}
|
}
|
||||||
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
||||||
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||||
@@ -534,10 +535,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "<ram:ApplicableTradeTax>"
|
+ "<ram:ApplicableTradeTax>"
|
||||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||||
+ exemptionReason
|
+ exemptionReason
|
||||||
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>";
|
||||||
+ "<ram:RateApplicablePercent>"
|
if (!currentItem.getProduct().getTaxCategoryCode().equals(TaxCategoryCodeTypeConstants.UNTAXEDSERVICE)) {
|
||||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
xml += "<ram:RateApplicablePercent>"
|
||||||
+ "</ram:ApplicableTradeTax>";
|
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>";
|
||||||
|
}
|
||||||
|
xml += "</ram:ApplicableTradeTax>";
|
||||||
|
|
||||||
if ((currentItem.getDetailedDeliveryPeriodFrom() != null) || (currentItem.getDetailedDeliveryPeriodTo() != null)) {
|
if ((currentItem.getDetailedDeliveryPeriodFrom() != null) || (currentItem.getDetailedDeliveryPeriodTo() != null)) {
|
||||||
xml += "<ram:BillingSpecifiedPeriod>";
|
xml += "<ram:BillingSpecifiedPeriod>";
|
||||||
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
||||||
@@ -723,9 +727,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ exemptionReasonTextXML
|
+ exemptionReasonTextXML
|
||||||
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
||||||
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
||||||
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "")
|
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "");
|
||||||
+ "<ram:RateApplicablePercent>"
|
if (!amountCategoryCode.equals(TaxCategoryCodeTypeConstants.UNTAXEDSERVICE)) {
|
||||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent></ram:ApplicableTradeTax>";
|
xml += "<ram:RateApplicablePercent>"
|
||||||
|
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>";
|
||||||
|
}
|
||||||
|
xml += "</ram:ApplicableTradeTax>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -741,7 +748,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
|
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
|
||||||
if ((profile == Profiles.getByName("XRechnung")) || (profile == Profiles.getByName("EN16931")) || (profile == Profiles.getByName("EXTENDED"))) {
|
if ((profile == Profiles.getByName("XRechnung")) || (profile == Profiles.getByName("EN16931")) || (profile == Profiles.getByName("EXTENDED"))) {
|
||||||
for (IZUGFeRDAllowanceCharge charge : trans.getZFCharges()) {
|
for (IZUGFeRDAllowanceCharge charge : trans.getZFCharges()) {
|
||||||
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
"<ram:ChargeIndicator>" +
|
"<ram:ChargeIndicator>" +
|
||||||
@@ -757,7 +764,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
xml += "<ram:CategoryTradeTax>" +
|
xml += "<ram:CategoryTradeTax>" +
|
||||||
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
||||||
"<ram:CategoryCode>" + charge.getCategoryCode() + "</ram:CategoryCode>";
|
"<ram:CategoryCode>" + charge.getCategoryCode() + "</ram:CategoryCode>";
|
||||||
if (charge.getTaxPercent() != null) {
|
if (charge.getTaxPercent() != null && !charge.getCategoryCode().equals(TaxCategoryCodeTypeConstants.UNTAXEDSERVICE)) {
|
||||||
xml += "<ram:RateApplicablePercent>" + vatFormat(charge.getTaxPercent()) + "</ram:RateApplicablePercent>";
|
xml += "<ram:RateApplicablePercent>" + vatFormat(charge.getTaxPercent()) + "</ram:RateApplicablePercent>";
|
||||||
}
|
}
|
||||||
xml += "</ram:CategoryTradeTax>" +
|
xml += "</ram:CategoryTradeTax>" +
|
||||||
@@ -832,7 +839,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
if (paymentTermsDescription != null) {
|
if (paymentTermsDescription != null) {
|
||||||
xml += "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
xml += "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trans.getDueDate() != null) {
|
if (trans.getDueDate() != null) {
|
||||||
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||||
+ DATE.udtFormat(trans.getDueDate())
|
+ DATE.udtFormat(trans.getDueDate())
|
||||||
@@ -900,12 +907,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
if (trans.getInvoiceReferencedDocuments() != null) {
|
if (trans.getInvoiceReferencedDocuments() != null) {
|
||||||
for (var doc : trans.getInvoiceReferencedDocuments()) {
|
for (var doc : trans.getInvoiceReferencedDocuments()) {
|
||||||
xml += "<ram:InvoiceReferencedDocument>"
|
xml += "<ram:InvoiceReferencedDocument>"
|
||||||
+ "<ram:IssuerAssignedID>"
|
+ "<ram:IssuerAssignedID>"
|
||||||
+ XMLTools.encodeXML(doc.getIssuerAssignedID()) + "</ram:IssuerAssignedID>";
|
+ XMLTools.encodeXML(doc.getIssuerAssignedID()) + "</ram:IssuerAssignedID>";
|
||||||
if (doc.getFormattedIssueDateTime() != null) {
|
if (doc.getFormattedIssueDateTime() != null) {
|
||||||
xml += "<ram:FormattedIssueDateTime>"
|
xml += "<ram:FormattedIssueDateTime>"
|
||||||
+ DATE.qdtFormat(doc.getFormattedIssueDateTime())
|
+ DATE.qdtFormat(doc.getFormattedIssueDateTime())
|
||||||
+ "</ram:FormattedIssueDateTime>";
|
+ "</ram:FormattedIssueDateTime>";
|
||||||
}
|
}
|
||||||
xml += "</ram:InvoiceReferencedDocument>";
|
xml += "</ram:InvoiceReferencedDocument>";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/** **********************************************************************
|
/**
|
||||||
*
|
* *********************************************************************
|
||||||
|
* <p>
|
||||||
* Copyright 2018 Jochen Staerk
|
* Copyright 2018 Jochen Staerk
|
||||||
*
|
* <p>
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
* use this file except in compliance with the License. You may obtain a copy
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*
|
* <p>
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
* <p>
|
||||||
*********************************************************************** */
|
* **********************************************************************
|
||||||
|
*/
|
||||||
package org.mustangproject.ZUGFeRD.model;
|
package org.mustangproject.ZUGFeRD.model;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -31,5 +33,5 @@ public class TaxCategoryCodeTypeConstants {
|
|||||||
public static final String INTRACOMMUNITY = "K";
|
public static final String INTRACOMMUNITY = "K";
|
||||||
public static final String FREEEXPORT = "G";
|
public static final String FREEEXPORT = "G";
|
||||||
|
|
||||||
public static Set<String> CATEGORY_CODES_WITH_EXEMPTION_REASON = Stream.of(INTRACOMMUNITY, REVERSECHARGE, TAXEXEMPT, FREEEXPORT).collect(Collectors.toSet());
|
public static Set<String> CATEGORY_CODES_WITH_EXEMPTION_REASON = Stream.of(INTRACOMMUNITY, REVERSECHARGE, TAXEXEMPT, FREEEXPORT, UNTAXEDSERVICE).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user