add document level billing period
This commit is contained in:
@@ -516,6 +516,18 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-2$
|
+ "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-2$
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if ((trans.getOccurrencePeriodFrom()!=null) || (trans.getOccurrencePeriodTo()!=null)) {
|
||||||
|
xml=xml+"<ram:BillingSpecifiedPeriod>";
|
||||||
|
if (trans.getOccurrencePeriodFrom()!=null) {
|
||||||
|
xml=xml+"<ram:StartDateTime><udt:DateTimeString format='102'>"+zugferdDateFormat.format(trans.getOccurrencePeriodFrom())+"</udt:DateTimeString></ram:StartDateTime>";
|
||||||
|
}
|
||||||
|
if (trans.getOccurrencePeriodTo()!=null) {
|
||||||
|
xml=xml+"<ram:EndDateTime><udt:DateTimeString format='102'>"+zugferdDateFormat.format(trans.getOccurrencePeriodTo())+"</udt:DateTimeString></ram:EndDateTime>";
|
||||||
|
}
|
||||||
|
xml=xml+"</ram:BillingSpecifiedPeriod>";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((trans.getZFCharges()!=null)&&(trans.getZFCharges().length>0)) {
|
if ((trans.getZFCharges()!=null)&&(trans.getZFCharges().length>0)) {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.mustangproject.*;
|
import org.mustangproject.*;
|
||||||
@@ -54,10 +56,15 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument("0815").setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE").addBankDetails(new BankDetails("777666555","DE4321"))).setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new TradeParty("Franz Müller","teststr.12", "55232", "Entenhausen", "DE").setContact(new Contact("nameRep", "phoneRep", "emailRep@test.com"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0))));
|
try {
|
||||||
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOccurrencePeriod(new SimpleDateFormat("yyyy-MM-dd").parse("2020-10-01"), new SimpleDateFormat("yyyy-MM-dd").parse("2020-10-05")).setContractReferencedDocument("0815").setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addBankDetails(new BankDetails("777666555", "DE4321"))).setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setContact(new Contact("nameRep", "phoneRep", "emailRep@test.com"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0))));
|
||||||
|
} catch (ParseException ex) {
|
||||||
|
throw new RuntimeException("Parse exception");
|
||||||
|
}
|
||||||
String theXML = new String(ze.getProvider().getXML());
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
assertTrue(theXML.contains("777666555")); //the iban
|
assertTrue(theXML.contains("777666555")); //the iban
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
|
|
||||||
ze.export(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
fail("IOException should not be raised in testEdgeExport");
|
fail("IOException should not be raised in testEdgeExport");
|
||||||
|
|||||||
Reference in New Issue
Block a user