support basisquantity in items
This commit is contained in:
@@ -15,7 +15,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class Item implements IZUGFeRDExportableItem {
|
public class Item implements IZUGFeRDExportableItem {
|
||||||
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
|
protected BigDecimal price, quantity, basisQuantity, tax, grossPrice, lineTotalAmount;
|
||||||
protected Date detailedDeliveryPeriodFrom=null, detailedDeliveryPeriodTo=null;
|
protected Date detailedDeliveryPeriodFrom=null, detailedDeliveryPeriodTo=null;
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String referencedLineID=null;
|
protected String referencedLineID=null;
|
||||||
@@ -118,6 +118,17 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getBasisQuantity() {
|
||||||
|
return basisQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Item setBasisQuantity(BigDecimal basis) {
|
||||||
|
this.basisQuantity = basis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal getQuantity() {
|
public BigDecimal getQuantity() {
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
for (int i = 0; i < nodes.getLength(); i++) {
|
for (int i = 0; i < nodes.getLength(); i++) {
|
||||||
|
|
||||||
String price = "0";
|
String price = "0";
|
||||||
|
String basisQuantity = "1";
|
||||||
String name = "";
|
String name = "";
|
||||||
String description = "";
|
String description = "";
|
||||||
SchemedID gid = null;
|
SchemedID gid = null;
|
||||||
@@ -260,6 +261,11 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
price = netChilds.item(netIndex).getTextContent();// ChargeAmount
|
price = netChilds.item(netIndex).getTextContent();// ChargeAmount
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if ((netChilds.item(netIndex).getLocalName() != null)
|
||||||
|
&& (netChilds.item(netIndex).getLocalName().equals("BasisQuantity"))) {
|
||||||
|
basisQuantity = netChilds.item(netIndex).getTextContent();// ChargeAmount
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,6 +357,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
p.addGlobalID(gid);
|
p.addGlobalID(gid);
|
||||||
}
|
}
|
||||||
Item it = new Item(p, prc, qty);
|
Item it = new Item(p, prc, qty);
|
||||||
|
it.setBasisQuantity(new BigDecimal(basisQuantity));
|
||||||
if (rdocs != null) {
|
if (rdocs != null) {
|
||||||
for (ReferencedDocument rdoc : rdocs) {
|
for (ReferencedDocument rdoc : rdocs) {
|
||||||
it.addReferencedDocument(rdoc);
|
it.addReferencedDocument(rdoc);
|
||||||
|
|||||||
@@ -165,9 +165,10 @@ public abstract class MustangReaderTestCase extends TestCase implements IExporta
|
|||||||
this.price = price;
|
this.price = price;
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
this.product = product;
|
this.product = product;
|
||||||
|
this.basisQuantity = BigDecimal.ONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal price, quantity;
|
private BigDecimal price, quantity, basisQuantity;
|
||||||
private IZUGFeRDExportableProduct product;
|
private IZUGFeRDExportableProduct product;
|
||||||
private String addReference=null;
|
private String addReference=null;
|
||||||
|
|
||||||
@@ -193,6 +194,15 @@ public abstract class MustangReaderTestCase extends TestCase implements IExporta
|
|||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getBasisQuantity() {
|
||||||
|
return basisQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBasisQuantity(BigDecimal quantity) {
|
||||||
|
this.basisQuantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableProduct getProduct() {
|
public IZUGFeRDExportableProduct getProduct() {
|
||||||
return product;
|
return product;
|
||||||
|
|||||||
@@ -200,8 +200,10 @@ public class ZF2EdgeTest extends MustangReaderTestCase implements IExportableTra
|
|||||||
|
|
||||||
Item design=new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
|
Item design=new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
|
||||||
design.setAddReference("1825");
|
design.setAddReference("1825");
|
||||||
|
design.setBasisQuantity(new BigDecimal(100));
|
||||||
allItems[0] = design;
|
allItems[0] = design;
|
||||||
allItems[1] = new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
|
allItems[1] = new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
|
||||||
|
|
||||||
allItems[2] = new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
|
allItems[2] = new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
|
||||||
return allItems;
|
return allItems;
|
||||||
}
|
}
|
||||||
@@ -320,7 +322,7 @@ public class ZF2EdgeTest extends MustangReaderTestCase implements IExportableTra
|
|||||||
assertTrue(resultXML.contains("<ram:IssuerAssignedID>123</ram:IssuerAssignedID>"));
|
assertTrue(resultXML.contains("<ram:IssuerAssignedID>123</ram:IssuerAssignedID>"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals("496.00", zi.getAmount());
|
assertEquals("337.60", zi.getAmount());;
|
||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getForeignReference(), getNumber());
|
assertEquals(zi.getForeignReference(), getNumber());
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user