Also list item level charge/allowance reason in according profile (i.e., extended)
This commit is contained in:
@@ -110,6 +110,7 @@ Validator 0.9.0
|
||||
- added Symtrax signature
|
||||
- paymenttermsdescription skonto xrechnung ?
|
||||
- occurencedate vs deliverydate
|
||||
- exception on invoice import if wrong
|
||||
|
||||
|
||||
Mustangproject 1.7.6
|
||||
|
||||
@@ -68,10 +68,14 @@ as artifact ID. "validator" includes the library functionality but is >20 MB
|
||||
bigger due to it's dependencies.
|
||||
|
||||
|
||||
### Update from 1.x to 2.0
|
||||
### Update from Mustang 1.x to 2.0
|
||||
|
||||
ZF2 was possible with Mustang 1 but it is default in Mustang 2, so
|
||||
you will need to `.setZUGFeRDVersion(1)` if you don't want ZUGFeRD 2 files.
|
||||
|
||||
In the commandline, all actions will have to be invoked via --action=<theaction>, so
|
||||
--combine changes to --action=combine.
|
||||
|
||||
`PDFattachZugferdFile` is now called `setTransaction` and instead of
|
||||
a `ZUGFeRDExporterFromA1Factory` the `ZUGFeRDExporterFromA1` will now return a
|
||||
a class implementing `IZUGFeRDExporter` instead of a `ZUGFeRDExporter`.
|
||||
@@ -86,6 +90,8 @@ changes to
|
||||
|
||||
```
|
||||
|
||||
Instead of `Profile.EXTENDED` use `Profiles.getByName("Extended")`.
|
||||
|
||||
The old Contact class has been corrected to TradeParty. The TradeParty class
|
||||
can now refer to a (human) Contact from the new Contact() class.
|
||||
|
||||
|
||||
@@ -175,6 +175,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* returns the XML for a charge or allowance on item level
|
||||
* @param allowance
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
protected String getAllowanceChargeStr(IZUGFeRDAllowanceCharge allowance, IAbsoluteValueProvider item) {
|
||||
String percentage = "";
|
||||
String chargeIndicator = "false";
|
||||
@@ -186,7 +192,16 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
chargeIndicator = "true";
|
||||
}
|
||||
|
||||
String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" + chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage + "<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount></ram:AppliedTradeAllowanceCharge>";
|
||||
String reason="";
|
||||
if ((allowance.getReason()!=null)&&(profile==Profiles.getByName("Extended"))) {
|
||||
// only in extended profile
|
||||
reason="<ram:Reason>"+XMLTools.encodeXML(allowance.getReason())+"</ram:Reason>";
|
||||
}
|
||||
String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||
reason+
|
||||
"</ram:AppliedTradeAllowanceCharge>";
|
||||
return allowanceChargeStr;
|
||||
}
|
||||
|
||||
|
||||
@@ -256,10 +256,18 @@ public class ZF2PushTest extends TestCase {
|
||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||
.load(SOURCE_PDF)) {
|
||||
|
||||
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID)).setOwnVATID("DE0815").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(16)), price, new BigDecimal(1.0)).addNote("item level 1/1"))
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID)).setOwnVATID("DE0815").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(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))))
|
||||
.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)))
|
||||
.setOccurrenceDate(sdf.parse("2020-01-01"))
|
||||
.setDeliveryDate(sdf.parse("2020-02-02"))
|
||||
);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String theXML = new String(ze.getProvider().getXML());
|
||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||
|
||||
Reference in New Issue
Block a user