@@ -14,6 +14,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
|
protected BigDecimal price, quantity, 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 Product product;
|
protected Product product;
|
||||||
protected ArrayList<String> notes = null;
|
protected ArrayList<String> notes = null;
|
||||||
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
|
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
|
||||||
@@ -31,6 +32,21 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
this.product = product;
|
this.product = product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Item addReferencedLineID(String s) {
|
||||||
|
referencedLineID=s;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* BT 132 (issue https://github.com/ZUGFeRD/mustangproject/issues/247)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getBuyerOrderReferencedDocumentLineID() {
|
||||||
|
return referencedLineID;
|
||||||
|
}
|
||||||
|
|
||||||
public BigDecimal getLineTotalAmount() {
|
public BigDecimal getLineTotalAmount() {
|
||||||
return lineTotalAmount;
|
return lineTotalAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,15 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* BT 132 (issue https://github.com/ZUGFeRD/mustangproject/issues/247)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default String getBuyerOrderReferencedDocumentLineID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The price of one item excl. taxes
|
* The price of one item excl. taxes
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -350,8 +350,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "</ram:Description>\n"
|
+ "</ram:Description>\n"
|
||||||
+ " </ram:SpecifiedTradeProduct>\n"
|
+ " </ram:SpecifiedTradeProduct>\n"
|
||||||
|
|
||||||
+ " <ram:SpecifiedLineTradeAgreement>\n"
|
+ " <ram:SpecifiedLineTradeAgreement>\n";
|
||||||
+ " <ram:GrossPriceProductTradePrice>\n"
|
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
|
||||||
|
xml = xml + " <ram:BuyerOrderReferencedDocument> \n"
|
||||||
|
+ " <ram:LineID>"+XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID())+"</ram:LineID>\n"
|
||||||
|
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
xml = xml + " <ram:GrossPriceProductTradePrice>\n"
|
||||||
+ " <ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
+ " <ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
||||||
+ "</ram:ChargeAmount>\n" //currencyID=\"EUR\"
|
+ "</ram:ChargeAmount>\n" //currencyID=\"EUR\"
|
||||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||||
@@ -512,17 +518,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||||
final VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
|
final VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
|
||||||
if (amount != null) {
|
if (amount != null) {
|
||||||
final String amountCategoryCode = amount.getCategoryCode();
|
final String amountCategoryCode = amount.getCategoryCode();
|
||||||
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
|
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
|
||||||
xml += " <ram:ApplicableTradeTax>\n"
|
xml += " <ram:ApplicableTradeTax>\n"
|
||||||
+ " <ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
+ " <ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
||||||
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
|
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
|
||||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||||
+ (displayExemptionReason ? exemptionReason : "")
|
+ (displayExemptionReason ? exemptionReason : "")
|
||||||
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
|
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
|
||||||
+ " <ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
|
+ " <ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
|
||||||
+ " <ram:RateApplicablePercent>"
|
+ " <ram:RateApplicablePercent>"
|
||||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n" ;
|
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {
|
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setDeliveryAddress(new TradeParty("just the other side of the street", "teststr.12a", "55232", "Entenhausen", "DE").addVATID("DE47110"))
|
.setDeliveryAddress(new TradeParty("just the other side of the street", "teststr.12a", "55232", "Entenhausen", "DE").addVATID("DE47110"))
|
||||||
.setContractReferencedDocument(contractID)
|
.setContractReferencedDocument(contractID)
|
||||||
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setID("0008734").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE").setFax("++49555123456")).setAdditionalAddress("Hinterhaus 3"))
|
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setID("0008734").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE").setFax("++49555123456")).setAdditionalAddress("Hinterhaus 3"))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(16)), price, new BigDecimal(1.0)).addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))).setDetailedDeliveryPeriod(sdf.parse("2020-01-13"), sdf.parse("2020-01-15")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(16)), price, new BigDecimal(1.0)).addReferencedLineID("xxx").addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))).setDetailedDeliveryPeriod(sdf.parse("2020-01-13"), sdf.parse("2020-01-15")))
|
||||||
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
|
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
|
||||||
.addAllowance(new Allowance(new BigDecimal(0.2)).setReason("discount").setTaxPercent(new BigDecimal(16)))
|
.addAllowance(new Allowance(new BigDecimal(0.2)).setReason("discount").setTaxPercent(new BigDecimal(16)))
|
||||||
.setDeliveryDate(sdf.parse("2020-11-02")).setOwnVATID("DE0815").setNumber(number)
|
.setDeliveryDate(sdf.parse("2020-11-02")).setOwnVATID("DE0815").setNumber(number)
|
||||||
@@ -399,6 +399,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
assertTrue(zi.getUTF8().contains("Hinterhaus"));
|
assertTrue(zi.getUTF8().contains("Hinterhaus"));
|
||||||
assertTrue(zi.getUTF8().contains("0009845"));
|
assertTrue(zi.getUTF8().contains("0009845"));
|
||||||
assertTrue(zi.getUTF8().contains("0008734"));
|
assertTrue(zi.getUTF8().contains("0008734"));
|
||||||
|
assertTrue(zi.getUTF8().contains("ram:BuyerOrderReferencedDocument"));
|
||||||
assertTrue(zi.getUTF8().contains(occurrenceFrom));
|
assertTrue(zi.getUTF8().contains(occurrenceFrom));
|
||||||
assertTrue(zi.getUTF8().contains(occurrenceTo));
|
assertTrue(zi.getUTF8().contains(occurrenceTo));
|
||||||
assertTrue(zi.getUTF8().contains(contractID));
|
assertTrue(zi.getUTF8().contains(contractID));
|
||||||
|
|||||||
@@ -99,6 +99,24 @@ public class LibraryTest extends ResourceCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLibraryPushEdge() {
|
||||||
|
File tempFile = new File("../library/target/testout-ZF2PushEdge.pdf");
|
||||||
|
assertTrue(tempFile.exists());
|
||||||
|
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
|
||||||
|
|
||||||
|
String res = zfv.validate(tempFile.getAbsolutePath());
|
||||||
|
|
||||||
|
|
||||||
|
assertThat(res).valueByXPath("/validation/pdf/summary/@status")
|
||||||
|
.isEqualTo("valid");
|
||||||
|
|
||||||
|
assertThat(res).valueByXPath("/validation/xml/summary/@status")
|
||||||
|
.isEqualTo("valid");
|
||||||
|
|
||||||
|
assertThat(res).valueByXPath("/validation/summary/@status")
|
||||||
|
.isEqualTo("valid");
|
||||||
|
|
||||||
|
}
|
||||||
public void testLibraryPushAllowances() {
|
public void testLibraryPushAllowances() {
|
||||||
File tempFile = new File("../library/target/testout-ZF2PushChargesAllowances.pdf");
|
File tempFile = new File("../library/target/testout-ZF2PushChargesAllowances.pdf");
|
||||||
assertTrue(tempFile.exists());
|
assertTrue(tempFile.exists());
|
||||||
|
|||||||
Reference in New Issue
Block a user