Add ServiceLogisticsCharge to visualization

(cherry picked from commit dd8a95ef4bf9e8bc47b411434136995a2df8b6f0)
This commit is contained in:
Sebastian Sieber
2024-11-05 12:32:43 +01:00
parent c54ad5c474
commit 500a25c3bd
3 changed files with 89 additions and 7 deletions

View File

@@ -1151,6 +1151,10 @@ function downloadData (element_id) {
<div class="boxtabelle boxabstandtop boxtabelleZweispaltig">
<xsl:apply-templates select="./xr:DOCUMENT_LEVEL_CHARGES"/>
</div>
<div class="boxtabelle boxabstandtop boxtabelleZweispaltig">
<xsl:apply-templates select="./xr:LOGISTICS_SERVICE_CHARGES"/>
</div>
<div class="boxtabelle boxabstandtop boxtabelleZweispaltig">
<xsl:apply-templates select="./xr:LOGISTICS_SERVICE_CHARGES"/>
@@ -1564,6 +1568,37 @@ function downloadData (element_id) {
</div>
<div class="boxabstand"></div>
</xsl:template>
<xsl:template name="uebersichtVersandkosten" match="xr:LOGISTICS_SERVICE_CHARGES">
<div class="boxzeile">
<div id="uebersichtVersandkosten" class="box">
<div id="BG-X-42" title="BG-X-42" class="boxtitel"><xsl:value-of select="$i18n.bgx42"/></div>
<div class="boxtabelle boxinhalt">
<div class="rechnungsZeile">
<div class="boxdaten rechnungSp1 bold"><xsl:value-of select="$i18n.btx274"/>: <span title="BT-X-274"><xsl:value-of select="xr:Logistics_service_charge_VAT_category_code"/></span></div>
<div class="boxdaten rechnungSp2"></div>
<div class="boxdaten rechnungSp3"></div>
</div>
<div class="rechnungsZeile">
<div class="boxdaten rechnungSp1"><xsl:value-of select="$i18n.btx272"/></div>
<div class="boxdaten rechnungSp2 color2">netto</div>
<div id="BT-X-272" title="BT-X-272" class="boxdaten rechnungSp3 bold"><xsl:value-of select="format-number(xr:Logistics_service_charge_amount,'###.##0,00','decimal')"/></div>
</div>
<div class="rechnungsZeile">
<div class="boxdaten rechnungSp1"><xsl:value-of select="$i18n.btx273"/></div>
<div class="boxdaten rechnungSp2 color2"></div>
<div id="BT-X-273" title="BT-X-273" class="boxdaten rechnungSp3"><xsl:value-of select="xr:Logistics_service_charge_VAT_rate"/></div>
</div>
</div>
<div class="grund">
<div><xsl:value-of select="$i18n.btx271"/>: <span id="BT-X-271" title="BT-X-271" class="bold"><xsl:value-of select="xr:Logistics_service_charge_description"/></span></div>
</div>
</div>
</div>
<div class="boxabstand"></div>
</xsl:template>
<xsl:template name="uebersichtVersandkosten" match="xr:LOGISTICS_SERVICE_CHARGES">

View File

@@ -66,6 +66,47 @@ public class VisualizationTest extends ResourceCase {
.replace(" ", "");
// remove linebreaks as well...
} catch (UnsupportedOperationException e) {
fail("UnsupportedOperationException should not happen: " + e.getMessage());
} catch (IllegalArgumentException e) {
fail("IllegalArgumentException should not happen: " + e.getMessage());
} catch (TransformerException e) {
fail("TransformerException should not happen: " + e.getMessage());
} catch (IOException e) {
fail("IOException should not happen: " + e.getMessage());
}
assertNotNull(result);
// Reading ZUGFeRD
assertEquals(expected, result);
}
public void testCIIVisualizationExtended() {
// the writing part
String sourceFilename = "factur-x-extended.xml";
File CIIinputFile = getResourceAsFile(sourceFilename);
String expected = null;
String result = null;
try {
ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer();
/* remove file endings so that tests can also pass after checking
out from git with arbitrary options (which may include CSRF changes)
*/
result = zvi.visualize(CIIinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.DE).replace("\r", "").replace("\n", "")
.replace("\t", "")
.replace(" ", "");
File expectedResult = getResourceAsFile("factur-x-vis-extended.de.html");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8)
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
// remove linebreaks as well...
} catch (UnsupportedOperationException e) {
fail("UnsupportedOperationException should not happen: " + e.getMessage());
} catch (IllegalArgumentException e) {
@@ -124,6 +165,7 @@ public class VisualizationTest extends ResourceCase {
}
assertNotNull(result);
// Reading ZUGFeRD
assertEquals(expected, result);
@@ -141,10 +183,18 @@ public class VisualizationTest extends ResourceCase {
/* remove file endings so that tests can also pass after checking
out from git with arbitrary options (which may include CSRF changes)
*/
result = zvi.visualize(UBLinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.EN).replace("\r", "").replace("\n", "").replace("\t", "").replace(" ", "");
result = zvi.visualize(UBLinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.EN)
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
File expectedResult = getResourceAsFile("factur-x-vis-ubl-creditnote.en.html");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r", "").replace("\n", "").replace("\t", "").replace(" ", "");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8)
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
// remove linebreaks as well...
} catch (UnsupportedOperationException e) {
@@ -162,12 +212,12 @@ public class VisualizationTest extends ResourceCase {
}
assertNotNull(result);
// Reading ZUGFeRD
assertEquals(expected, result);
}
public void testUBLVisualizationBasic() {
// the writing part
@@ -198,10 +248,6 @@ public class VisualizationTest extends ResourceCase {
fail("TransformerException should not happen: " + e.getMessage());
} catch (IOException e) {
fail("IOException should not happen: " + e.getMessage());
} catch (ParserConfigurationException e) {
fail("ParserConfigurationException should not happen: " + e.getMessage());
} catch (SAXException e) {
fail("SAXException should not happen: " + e.getMessage());
}

View File

@@ -2,6 +2,7 @@
<html xmlns:xr="urn:ce.eu:en16931:2017:xoev-de:kosit:standard:xrechnung-1" xmlns:xrv="http://www.example.org/XRechnung-Viewer" xmlns:xs="http://www.w3.org/2001/XMLSchema" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>XRechnung</title>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<style>