update
This commit is contained in:
parent
90eb86f9f6
commit
2ec5ed7988
7 changed files with 4525 additions and 12 deletions
|
|
@ -391,6 +391,8 @@ public class CargosoftXMLInvoiceImportService {
|
||||||
|
|
||||||
readXMLValue(doc, "/Invoices/Invoice/InvoiceHeader/InvoiceType/Codes/Code",
|
readXMLValue(doc, "/Invoices/Invoice/InvoiceHeader/InvoiceType/Codes/Code",
|
||||||
workitem, "invoice.type", String.class);
|
workitem, "invoice.type", String.class);
|
||||||
|
readXMLValue(doc, "/Invoices/Invoice/InvoiceHeader/InvoiceType/Description",
|
||||||
|
workitem, "invoice.type.description", String.class);
|
||||||
|
|
||||||
// Rechnungssumme errechnen.....
|
// Rechnungssumme errechnen.....
|
||||||
readXMLValue(doc, "/Invoices/Invoice/InvoiceHeader/InvoiceAmount/NetAmount/Amount/Value",
|
readXMLValue(doc, "/Invoices/Invoice/InvoiceHeader/InvoiceAmount/NetAmount/Amount/Value",
|
||||||
|
|
@ -407,8 +409,8 @@ public class CargosoftXMLInvoiceImportService {
|
||||||
workitem.setItemValue("invoice.total", _total);
|
workitem.setItemValue("invoice.total", _total);
|
||||||
workitem.setItemValue("invoice.saldo", _total);
|
workitem.setItemValue("invoice.saldo", _total);
|
||||||
|
|
||||||
// Bei Gutschrift Wert negieren...
|
// Bei Gutschrift und Stornorechnung Wert negieren...
|
||||||
if ("G".equals(workitem.getItemValueString("invoice.type"))) {
|
if (isGutschrift(workitem)) {
|
||||||
workitem.setItemValue("invoice.saldo", -workitem.getItemValueDouble("invoice.total"));
|
workitem.setItemValue("invoice.saldo", -workitem.getItemValueDouble("invoice.total"));
|
||||||
workitem.setItemValue("invoice.total", -workitem.getItemValueDouble("invoice.total"));
|
workitem.setItemValue("invoice.total", -workitem.getItemValueDouble("invoice.total"));
|
||||||
}
|
}
|
||||||
|
|
@ -618,7 +620,7 @@ public class CargosoftXMLInvoiceImportService {
|
||||||
double basisUmsatz = dUmsatz / dKurs;
|
double basisUmsatz = dUmsatz / dKurs;
|
||||||
double gerundeterBasisUmsatz = Math.round(basisUmsatz * 100) / 100.0;
|
double gerundeterBasisUmsatz = Math.round(basisUmsatz * 100) / 100.0;
|
||||||
|
|
||||||
if ("G".equals(workitem.getItemValueString("invoice.type"))) {
|
if (isGutschrift(workitem)) {
|
||||||
_baseAmount = _baseAmount - gerundeterBasisUmsatz;
|
_baseAmount = _baseAmount - gerundeterBasisUmsatz;
|
||||||
} else {
|
} else {
|
||||||
_baseAmount = _baseAmount + gerundeterBasisUmsatz;
|
_baseAmount = _baseAmount + gerundeterBasisUmsatz;
|
||||||
|
|
@ -630,8 +632,9 @@ public class CargosoftXMLInvoiceImportService {
|
||||||
String activityType = (String) netActivityTypeExpr.evaluate(rowNode, XPathConstants.STRING);
|
String activityType = (String) netActivityTypeExpr.evaluate(rowNode, XPathConstants.STRING);
|
||||||
childItemCol.setItemValue("category", activityType);
|
childItemCol.setItemValue("category", activityType);
|
||||||
|
|
||||||
|
// Bei G = Gutschrift oder SR = Stornorechnung müssen wir das vorzeichen ändern
|
||||||
// Invoice Type S/H
|
// Invoice Type S/H
|
||||||
if ("G".equals(workitem.getItemValueString("invoice.type"))) {
|
if (isGutschrift(workitem)) {
|
||||||
// Gutschrift
|
// Gutschrift
|
||||||
childItemCol.setItemValue("datev.shzeichen", "S");
|
childItemCol.setItemValue("datev.shzeichen", "S");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -659,6 +662,17 @@ public class CargosoftXMLInvoiceImportService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bei G = Gutschrift oder SR = Stornorechnung müssen wir das vorzeichen ändern
|
||||||
|
* dies wird über den Invoice.Type geprüft
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isGutschrift(ItemCollection workitem) {
|
||||||
|
String type = workitem.getItemValueString("invoice.type");
|
||||||
|
return ("G".equals(type) || "SR".equals(type));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method attache the pdf file and the XML file to the workitem.
|
* This method attache the pdf file and the XML file to the workitem.
|
||||||
* The method removes the file content first form the xml tree and attache the
|
* The method removes the file content first form the xml tree and attache the
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class TestSEPATransform {
|
||||||
@Test
|
@Test
|
||||||
public void testBankPolski() throws IOException {
|
public void testBankPolski() throws IOException {
|
||||||
String MODEL_PATH_XML = "sepa/beispiel-daten.xml";
|
String MODEL_PATH_XML = "sepa/beispiel-daten.xml";
|
||||||
String MODEL_PATH_XSL = "sepa/sepa-2.0.7-pl.xsl";
|
String MODEL_PATH_XSL = "sepa/sepa-2.0.8-pl.xsl";
|
||||||
try {
|
try {
|
||||||
XSLTester.transform(MODEL_PATH_XML, MODEL_PATH_XSL, "../reports/sepa/result_sepa02.xml");
|
XSLTester.transform(MODEL_PATH_XML, MODEL_PATH_XSL, "../reports/sepa/result_sepa02.xml");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
<value xsi:type="xs:string">DE74 5555 0000 0000 0282 73</value>
|
<value xsi:type="xs:string">DE74 5555 0000 0000 0282 73</value>
|
||||||
</item>
|
</item>
|
||||||
<item name="cdtr.name">
|
<item name="cdtr.name">
|
||||||
<value xsi:type="xs:string">Supplier 1
|
<value xsi:type="xs:string">Supplier 1 MIK-TRANS" JAN SLABY
|
||||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Eyy XXXXXXXXX</value>
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Eyy XXXXXXXXX</value>
|
||||||
</item>
|
</item>
|
||||||
<item name="dbtr.bic">
|
<item name="dbtr.bic">
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<CstmrCdtTrfInitn>
|
<CstmrCdtTrfInitn>
|
||||||
<GrpHdr>
|
<GrpHdr>
|
||||||
<MsgId>bf073e72asdf512c4d60af7740872036</MsgId>
|
<MsgId>bf073e72asdf512c4d60af7740872036</MsgId>
|
||||||
<CreDtTm>2024-06-19T11:35:23</CreDtTm>
|
<CreDtTm>2024-06-27T14:48:35</CreDtTm>
|
||||||
<NbOfTxs>3</NbOfTxs>
|
<NbOfTxs>3</NbOfTxs>
|
||||||
<CtrlSum>655.90</CtrlSum>
|
<CtrlSum>655.90</CtrlSum>
|
||||||
<InitgPty>
|
<InitgPty>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<Cd>SEPA</Cd>
|
<Cd>SEPA</Cd>
|
||||||
</SvcLvl>
|
</SvcLvl>
|
||||||
</PmtTpInf>
|
</PmtTpInf>
|
||||||
<ReqdExctnDt>2024-06-19</ReqdExctnDt>
|
<ReqdExctnDt>2024-06-27</ReqdExctnDt>
|
||||||
<Dbtr>
|
<Dbtr>
|
||||||
<Nm>Targo Bank</Nm>
|
<Nm>Targo Bank</Nm>
|
||||||
</Dbtr>
|
</Dbtr>
|
||||||
|
|
@ -51,8 +51,7 @@
|
||||||
</FinInstnId>
|
</FinInstnId>
|
||||||
</CdtrAgt>
|
</CdtrAgt>
|
||||||
<Cdtr>
|
<Cdtr>
|
||||||
<Nm>Supplier 1 mody trans
|
<Nm>Supplier 1 młody trans xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Nm>
|
||||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Nm>
|
|
||||||
</Cdtr>
|
</Cdtr>
|
||||||
<CdtrAcct>
|
<CdtrAcct>
|
||||||
<Id>
|
<Id>
|
||||||
|
|
@ -76,8 +75,7 @@
|
||||||
</FinInstnId>
|
</FinInstnId>
|
||||||
</CdtrAgt>
|
</CdtrAgt>
|
||||||
<Cdtr>
|
<Cdtr>
|
||||||
<Nm>Supplier 1
|
<Nm>Supplier 1 MIK-TRANS JAN SLABY xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Nm>
|
||||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Nm>
|
|
||||||
</Cdtr>
|
</Cdtr>
|
||||||
<CdtrAcct>
|
<CdtrAcct>
|
||||||
<Id>
|
<Id>
|
||||||
|
|
|
||||||
196
reports/sepa/sepa-2.0.8-pl.imixs-report
Normal file
196
reports/sepa/sepa-2.0.8-pl.imixs-report
Normal file
File diff suppressed because one or more lines are too long
196
reports/sepa/sepa-2.0.8-pl.xsl
Normal file
196
reports/sepa/sepa-2.0.8-pl.xsl
Normal file
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
|
version="2.0">
|
||||||
|
<xsl:strip-space elements="*" />
|
||||||
|
<xsl:output method="xml" indent="yes" encoding="UTF-8" standalone="yes" />
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:variable name="now" select="current-dateTime()" />
|
||||||
|
|
||||||
|
<Document
|
||||||
|
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd">
|
||||||
|
<CstmrCdtTrfInitn>
|
||||||
|
|
||||||
|
<!-- generate header info -->
|
||||||
|
<!-- compute count of invoices -->
|
||||||
|
<xsl:variable name="count"
|
||||||
|
select="count(/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]/item[@name='$uniqueid']/value)" />
|
||||||
|
<!-- compute total amount -->
|
||||||
|
<xsl:variable name="totalsum"
|
||||||
|
select="xs:decimal(sum(/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]/item[@name='invoice.total']/value))" />
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:variable name="total"
|
||||||
|
select="format-number(xs:decimal(round-half-to-even($totalsum, 2)), '0.00')" />
|
||||||
|
|
||||||
|
<!-- shortcut for the sepa export document -->
|
||||||
|
<xsl:variable name="exportWorkitem"
|
||||||
|
select="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'SEPA-Export']" />
|
||||||
|
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='$uniqueid']/value, '-', '')" />
|
||||||
|
</MsgId>
|
||||||
|
<CreDtTm>
|
||||||
|
<xsl:value-of
|
||||||
|
select="format-dateTime($now, '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]')" />
|
||||||
|
</CreDtTm>
|
||||||
|
<NbOfTxs>
|
||||||
|
<xsl:value-of select="$count" />
|
||||||
|
</NbOfTxs>
|
||||||
|
<CtrlSum>
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:value-of select="$total" />
|
||||||
|
</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>
|
||||||
|
<xsl:value-of
|
||||||
|
select="$exportWorkitem/item[@name='dbtr.name']/value" />
|
||||||
|
</Nm>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='$uniqueid']/value, '-', '')" />
|
||||||
|
<xsl:text>-1</xsl:text>
|
||||||
|
</PmtInfId>
|
||||||
|
<PmtMtd>TRF</PmtMtd>
|
||||||
|
<NbOfTxs>
|
||||||
|
<xsl:value-of select="$count" />
|
||||||
|
</NbOfTxs>
|
||||||
|
<CtrlSum>
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:value-of select="$total" />
|
||||||
|
</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdExctnDt>
|
||||||
|
<xsl:value-of
|
||||||
|
select="format-dateTime($now, '[Y0001]-[M01]-[D01]')" />
|
||||||
|
</ReqdExctnDt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>
|
||||||
|
<xsl:value-of
|
||||||
|
select="$exportWorkitem/item[@name='dbtr.name']/value" />
|
||||||
|
</Nm>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='dbtr.iban']/value, ' ', '')" />
|
||||||
|
</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='dbtr.bic']/value, ' ', '')" />
|
||||||
|
</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<!--
|
||||||
|
SHAR – Charges are shared between debtor and creditor
|
||||||
|
SLEV – Charges are handled according to service level
|
||||||
|
-->
|
||||||
|
<ChrgBr>SHAR</ChrgBr>
|
||||||
|
<!-- generate CdtTrfTxInf for each invoice -->
|
||||||
|
<xsl:apply-templates
|
||||||
|
select="/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]" />
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrCdtTrfInitn>
|
||||||
|
</Document>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- This template builds sepa header info -->
|
||||||
|
<xsl:template
|
||||||
|
match="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'SEPA-Export']">
|
||||||
|
<!-- not in use -->
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- This template builds sepa payment info for each invoice -->
|
||||||
|
<xsl:template
|
||||||
|
match="/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]">
|
||||||
|
|
||||||
|
<!-- round to 2 digits - geht nur mit sum funktion -->
|
||||||
|
<xsl:variable
|
||||||
|
name="wert2"
|
||||||
|
select="format-number(xs:decimal(round-half-to-even(item[@name='invoice.total']/value, 2)), '0.00')" />
|
||||||
|
|
||||||
|
<CdtTrfTxInf
|
||||||
|
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>NOTPROVIDED</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<Amt>
|
||||||
|
<InstdAmt>
|
||||||
|
<xsl:attribute name="Ccy"><xsl:value-of
|
||||||
|
select="item[@name='invoice.currency']/value" /></xsl:attribute>
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:value-of select="$wert2" />
|
||||||
|
</InstdAmt>
|
||||||
|
</Amt>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>
|
||||||
|
<xsl:value-of select="replace(item[@name='cdtr.bic']/value, ' ', '')" />
|
||||||
|
</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<Cdtr>
|
||||||
|
<!-- MAX70 -->
|
||||||
|
<Nm>
|
||||||
|
<!-- <xsl:value-of select="substring(item[@name='cdtr.name']/value, 1, 70)" /> -->
|
||||||
|
<!-- entfernen der non ascii zeichen
|
||||||
|
<xsl:value-of
|
||||||
|
select="substring(replace(item[@name='cdtr.name']/value, '\P{IsBasicLatin}', ''), 1, 70)" />
|
||||||
|
-->
|
||||||
|
|
||||||
|
<xsl:value-of
|
||||||
|
select="substring(translate(
|
||||||
|
normalize-space(item[@name='cdtr.name']/value),
|
||||||
|
translate(item[@name='cdtr.name']/value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZĄĆĘŁÓŚŹŻŃabcdefghijklmnopqrstuvwxyząćęłóśźżń0123456789 /-?:().,''+''{}.', ''),''), 1, 70)" />
|
||||||
|
</Nm>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>
|
||||||
|
<xsl:value-of select="replace(item[@name='cdtr.iban']/value, ' ', '')" />
|
||||||
|
</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<!-- Max140Text -->
|
||||||
|
<Ustrd>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="string-length(item[@name='numsequencenumber']/value) > 0">
|
||||||
|
<!-- neues format buchungsnummer / rechn.nr -->
|
||||||
|
<xsl:value-of
|
||||||
|
select="item[@name='numsequencenumber']/value" /><xsl:text> / </xsl:text><xsl:value-of
|
||||||
|
select="item[@name='invoice.number']/value" />
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<!-- fallback -->
|
||||||
|
<xsl:value-of
|
||||||
|
select="substring(item[@name='$workflowsummary']/value, 1, 140)" />
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</CdtTrfTxInf>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
4109
workflow/rechnungsausgang-de-1.0.9.bpmn
Normal file
4109
workflow/rechnungsausgang-de-1.0.9.bpmn
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue