be able to refer to contract id
This commit is contained in:
@@ -126,6 +126,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal getAllowances() {
|
private BigDecimal getAllowances() {
|
||||||
BigDecimal res = new BigDecimal(0);
|
BigDecimal res = new BigDecimal(0);
|
||||||
IZUGFeRDAllowanceCharge[] allowances = trans.getZFAllowances();
|
IZUGFeRDAllowanceCharge[] allowances = trans.getZFAllowances();
|
||||||
@@ -136,6 +137,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal getTotal() {
|
private BigDecimal getTotal() {
|
||||||
BigDecimal res = new BigDecimal(0);
|
BigDecimal res = new BigDecimal(0);
|
||||||
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||||
@@ -203,7 +205,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return hm;
|
return hm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,8 +219,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
// and ShipToTradeParty, but not both. Prefer seller assigned ID for now.
|
// and ShipToTradeParty, but not both. Prefer seller assigned ID for now.
|
||||||
if (party.getID() != null) {
|
if (party.getID() != null) {
|
||||||
xml += " <ram:ID>" + XMLTools.encodeXML(party.getID()) + "</ram:ID>\n";
|
xml += " <ram:ID>" + XMLTools.encodeXML(party.getID()) + "</ram:ID>\n";
|
||||||
}
|
} else if ((party.getGlobalIDScheme() != null) && (party.getGlobalID() != null)) {
|
||||||
else if ((party.getGlobalIDScheme()!=null)&&(party.getGlobalID()!=null)) {
|
|
||||||
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
||||||
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>\n";
|
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>\n";
|
||||||
}
|
}
|
||||||
@@ -273,6 +273,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
return xml;
|
return xml;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateXML(IExportableTransaction trans) {
|
public void generateXML(IExportableTransaction trans) {
|
||||||
this.trans = trans;
|
this.trans = trans;
|
||||||
@@ -386,7 +387,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
xml = xml + " <ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
||||||
+ " <ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
+ " <ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||||
+ "</ram:Description>\n"
|
+ "</ram:Description>\n"
|
||||||
@@ -460,6 +460,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||||
}
|
}
|
||||||
|
if (trans.getContractReferencedDocument() != null) {
|
||||||
|
xml = xml + " <ram:ContractReferencedDocument>\n"
|
||||||
|
+ " <ram:IssuerAssignedID>"
|
||||||
|
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>\n"
|
||||||
|
+ " </ram:ContractReferencedDocument>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
xml = xml + " </ram:ApplicableHeaderTradeAgreement>\n"
|
xml = xml + " </ram:ApplicableHeaderTradeAgreement>\n"
|
||||||
+ " <ram:ApplicableHeaderTradeDelivery>\n";
|
+ " <ram:ApplicableHeaderTradeDelivery>\n";
|
||||||
if (this.trans.getDeliveryAddress() != null) {
|
if (this.trans.getDeliveryAddress() != null) {
|
||||||
@@ -595,7 +603,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String allowanceTotalLine = "<ram:AllowanceTotalAmount>" + currencyFormat(getAllowances()) + "</ram:AllowanceTotalAmount>";
|
String allowanceTotalLine = "<ram:AllowanceTotalAmount>" + currencyFormat(getAllowances()) + "</ram:AllowanceTotalAmount>";
|
||||||
|
|
||||||
String chargesTotalLine = "<ram:ChargeTotalAmount>" + currencyFormat(getCharges()) + "</ram:ChargeTotalAmount>";
|
String chargesTotalLine = "<ram:ChargeTotalAmount>" + currencyFormat(getCharges()) + "</ram:ChargeTotalAmount>";
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ public class ZF2PushTest extends TestCase {
|
|||||||
String number = "123";
|
String number = "123";
|
||||||
String amountStr = "1.00";
|
String amountStr = "1.00";
|
||||||
BigDecimal amount = new BigDecimal(amountStr);
|
BigDecimal amount = new BigDecimal(amountStr);
|
||||||
|
String occurenceFrom="20201001";
|
||||||
|
String occurenceTo="20201005";
|
||||||
|
String contractID="376zreurzu0983";
|
||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
||||||
|
|
||||||
@@ -57,7 +60,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
try {
|
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))));
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument(contractID).setOccurrencePeriod(new SimpleDateFormat("yyyyMMdd").parse(occurenceFrom), new SimpleDateFormat("yyyyMMdd").parse(occurenceTo)).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) {
|
} catch (ParseException ex) {
|
||||||
throw new RuntimeException("Parse exception");
|
throw new RuntimeException("Parse exception");
|
||||||
}
|
}
|
||||||
@@ -74,6 +77,9 @@ public class ZF2PushTest extends TestCase {
|
|||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
|
||||||
assertTrue(zi.getUTF8().contains("EUR"));
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
assertTrue(zi.getUTF8().contains(occurenceFrom));
|
||||||
|
assertTrue(zi.getUTF8().contains(occurenceTo));
|
||||||
|
assertTrue(zi.getUTF8().contains(contractID));
|
||||||
assertTrue(zi.getUTF8().contains("0815"));
|
assertTrue(zi.getUTF8().contains("0815"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
|
|||||||
Reference in New Issue
Block a user