Merge branch 'ZUGFeRD:master' into master

This commit is contained in:
Kemal Taskin
2024-12-05 09:21:56 +01:00
committed by GitHub
4 changed files with 21 additions and 3 deletions

View File

@@ -182,7 +182,6 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
});
itemMap.getAsString("Note").ifPresent(this::addNote);
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
List<IncludedNote> includedNotes = new ArrayList<>();
adld.getAllNodes("IncludedNote").forEach(item -> {
@@ -233,6 +232,11 @@ public class Item implements IZUGFeRDExportableItem {
return lineTotalAmount;
}
public Item setNotesWithSubjectCode(List<IncludedNote> theList) {
includedNotes=theList;
return this;
}
/**
* should only be set by calculator classes or maybe when reading from XML
*
@@ -378,6 +382,13 @@ public class Item implements IZUGFeRDExportableItem {
notes = new ArrayList<>();
}
notes.add(text);
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.unspecifiedNote(text));
return this;
}

View File

@@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.mustangproject.*;
import org.junit.FixMethodOrder;
@@ -138,6 +139,7 @@ public class ZF2PushTest extends TestCase {
String senderDescription = "Kleinunternehmer";
String taxID = "9990815";
String theNote="oh lala";
BigDecimal price = new BigDecimal(priceStr);
try {
InputStream SOURCE_PDF = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
@@ -155,7 +157,7 @@ public class ZF2PushTest extends TestCase {
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711")
.setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE")))
.setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)).setTaxExemptionReason("Kleinunternehmer gemäß §19 UStG").setTaxCategoryCode("E"), price, new BigDecimal(1.0)))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)).setTaxExemptionReason("Kleinunternehmer gemäß §19 UStG").setTaxCategoryCode("E"), price, new BigDecimal(1.0)).addNote(theNote))
);
String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
@@ -172,6 +174,8 @@ public class ZF2PushTest extends TestCase {
} catch (ParseException e) {
throw new RuntimeException(e);
}
assertEquals(i.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(),theNote);
assertEquals(senderDescription, i.getSender().getDescription());
// now check the contents (like MustangReaderTest)

View File

@@ -124,6 +124,8 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
// Reading ZUGFeRD
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
assertEquals(3, invoice.getZFItems().length);
assertEquals(invoice.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(),"Something");
assertEquals(invoice.getZFItems()[0].getNotesWithSubjectCode().size(),1);
assertEquals("400", invoice.getZFItems()[1].getQuantity().toString());
assertEquals("AB321", invoice.getReferenceNumber());

View File

@@ -123,6 +123,7 @@
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:Note>Something</cbc:Note>
<cbc:InvoicedQuantity unitCode="HUR">1</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">160</cbc:LineExtensionAmount>
<cac:Item>
@@ -178,4 +179,4 @@
<cbc:BaseQuantity unitCode="LTR">1</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
</Invoice>
</Invoice>