first implementation of header allowances
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015 AlexanderSchmidt.
|
||||||
|
*
|
||||||
|
* 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 of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author AlexanderSchmidt
|
||||||
|
*/
|
||||||
|
public interface IZUGFeRDAllowanceCharge {
|
||||||
|
BigDecimal getAmount();
|
||||||
|
|
||||||
|
String getReason();
|
||||||
|
|
||||||
|
BigDecimal getTaxPercent();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -45,6 +45,10 @@ public interface IZUGFeRDExportableTransaction {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Date getDueDate();
|
Date getDueDate();
|
||||||
|
|
||||||
|
IZUGFeRDAllowanceCharge[] getZFAllowances();
|
||||||
|
IZUGFeRDAllowanceCharge[] getZFCharges();
|
||||||
|
IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges();
|
||||||
|
|
||||||
IZUGFeRDExportableItem[] getZFItems();
|
IZUGFeRDExportableItem[] getZFItems();
|
||||||
|
|
||||||
|
|||||||
@@ -476,6 +476,7 @@ public class ZUGFeRDExporter {
|
|||||||
tradeSettlement.getSpecifiedTradeSettlementPaymentMeans().add(this.getPaymentData());
|
tradeSettlement.getSpecifiedTradeSettlementPaymentMeans().add(this.getPaymentData());
|
||||||
tradeSettlement.getApplicableTradeTax().addAll(this.getTradeTax());
|
tradeSettlement.getApplicableTradeTax().addAll(this.getTradeTax());
|
||||||
tradeSettlement.getSpecifiedTradePaymentTerms().addAll(this.getPaymentTerms());
|
tradeSettlement.getSpecifiedTradePaymentTerms().addAll(this.getPaymentTerms());
|
||||||
|
tradeSettlement.getSpecifiedTradeAllowanceCharge().addAll(this.getHeaderAllowances());
|
||||||
tradeSettlement.setSpecifiedTradeSettlementMonetarySummation(this.getMonetarySummation());
|
tradeSettlement.setSpecifiedTradeSettlementMonetarySummation(this.getMonetarySummation());
|
||||||
|
|
||||||
return tradeSettlement;
|
return tradeSettlement;
|
||||||
@@ -545,6 +546,43 @@ public class ZUGFeRDExporter {
|
|||||||
return tradeTaxTypes;
|
return tradeTaxTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Collection<TradeAllowanceChargeType> getHeaderAllowances() {
|
||||||
|
List<TradeAllowanceChargeType> headerAllowances = new ArrayList<TradeAllowanceChargeType>();
|
||||||
|
|
||||||
|
for (IZUGFeRDAllowanceCharge iAllowance : trans.getZFAllowances()) {
|
||||||
|
|
||||||
|
TradeAllowanceChargeType allowance = xmlFactory.createTradeAllowanceChargeType();
|
||||||
|
|
||||||
|
IndicatorType chargeIndicator = xmlFactory.createIndicatorType();
|
||||||
|
chargeIndicator.setIndicator(false);
|
||||||
|
allowance.setChargeIndicator(chargeIndicator);
|
||||||
|
|
||||||
|
TextType reason = xmlFactory.createTextType();
|
||||||
|
reason.setValue(iAllowance.getReason());
|
||||||
|
allowance.setReason(reason);
|
||||||
|
|
||||||
|
TradeTaxType tradeTax = xmlFactory.createTradeTaxType();
|
||||||
|
|
||||||
|
PercentType vatPercent = xmlFactory.createPercentType();
|
||||||
|
vatPercent.setValue(iAllowance.getTaxPercent());
|
||||||
|
tradeTax.setApplicablePercent(vatPercent);
|
||||||
|
|
||||||
|
TaxCategoryCodeType taxType = xmlFactory.createTaxCategoryCodeType();
|
||||||
|
taxType.setValue(TaxCategoryCodeType.STANDARDRATE);
|
||||||
|
tradeTax.setCategoryCode(taxType);
|
||||||
|
|
||||||
|
TaxTypeCodeType taxCode = xmlFactory.createTaxTypeCodeType();
|
||||||
|
taxCode.setValue(TaxTypeCodeType.SALESTAX);
|
||||||
|
tradeTax.setTypeCode(taxCode);
|
||||||
|
|
||||||
|
allowance.getCategoryTradeTax().add(tradeTax);
|
||||||
|
headerAllowances.add(allowance);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return headerAllowances;
|
||||||
|
}
|
||||||
|
|
||||||
private Collection<TradePaymentTermsType> getPaymentTerms() {
|
private Collection<TradePaymentTermsType> getPaymentTerms() {
|
||||||
List<TradePaymentTermsType> paymentTerms = new ArrayList<TradePaymentTermsType>();
|
List<TradePaymentTermsType> paymentTerms = new ArrayList<TradePaymentTermsType>();
|
||||||
|
|
||||||
@@ -564,7 +602,7 @@ public class ZUGFeRDExporter {
|
|||||||
paymentTerms.add(paymentTerm);
|
paymentTerms.add(paymentTerm);
|
||||||
|
|
||||||
return paymentTerms;
|
return paymentTerms;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TradeSettlementMonetarySummationType getMonetarySummation() {
|
private TradeSettlementMonetarySummationType getMonetarySummation() {
|
||||||
TradeSettlementMonetarySummationType monetarySummation = xmlFactory.createTradeSettlementMonetarySummationType();
|
TradeSettlementMonetarySummationType monetarySummation = xmlFactory.createTradeSettlementMonetarySummationType();
|
||||||
|
|||||||
Reference in New Issue
Block a user