update sepa bank millenium

This commit is contained in:
Ralph Soika 2025-08-21 16:34:12 +02:00
parent a44424fcf1
commit c6e73ac111
3 changed files with 410 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,199 @@
<?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>
<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>
<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
-->
<!-- 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>
<PmtTpInf>
<InstrPrty>NORM</InstrPrty>
</PmtTpInf>
<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>
<ChrgBr>SHAR</ChrgBr>
<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, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 /-?:().,''+''{}.', ''),''), 1, 70)" />
</Nm>
<PstlAdr>
<Ctry>
<xsl:choose>
<xsl:when test="not(item[@name='invoice.country'])">PL</xsl:when>
<xsl:when test="item[@name='invoice.country']/value = ''">PL</xsl:when>
<xsl:otherwise>
<xsl:value-of select="item[@name='invoice.country']/value" />
</xsl:otherwise>
</xsl:choose>
</Ctry>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>
<xsl:value-of select="replace(item[@name='cdtr.iban']/value, ' ', '')" />
</IBAN>
</Id>
</CdtrAcct>
<Purp>
<Prtry>FRGN</Prtry>
</Purp>
<RmtInf>
<!-- Max140Text -->
<Ustrd>
<xsl:variable name="sequenceNumber" select="item[@name='sequencenumber']/value" />
<xsl:variable name="invoiceNumber" select="item[@name='invoice.number']/value" />
<xsl:variable name="combinedInfo">
<xsl:value-of select="$sequenceNumber" />
<xsl:if
test="$sequenceNumber != '' and $invoiceNumber != ''">/</xsl:if>
<xsl:value-of
select="$invoiceNumber" />
</xsl:variable>
<xsl:value-of
select="substring(translate(
normalize-space($combinedInfo),
translate($combinedInfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 /-?:().,''+''{}.', ''),''), 1, 140)" />
</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</xsl:template>
</xsl:stylesheet>

View file

@ -54,7 +54,7 @@
</bpmn2:participant> </bpmn2:participant>
<bpmn2:participant id="Participant_2" name="SEPA-Export Pool" processRef="eingangsrechnung-de"/> <bpmn2:participant id="Participant_2" name="SEPA-Export Pool" processRef="eingangsrechnung-de"/>
</bpmn2:collaboration> </bpmn2:collaboration>
<bpmn2:process id="eingangsrechnung-de" isExecutable="false" name="SEPA-Export"> <bpmn2:process id="eingangsrechnung-de" isExecutable="false" name="SEPA-Export" processType="Public">
<bpmn2:textAnnotation id="TextAnnotation_1"> <bpmn2:textAnnotation id="TextAnnotation_1">
<bpmn2:text>The linked invoice workitem will be added to thhe $workitemref</bpmn2:text> <bpmn2:text>The linked invoice workitem will be added to thhe $workitemref</bpmn2:text>
<bpmn2:documentation id="documentation_H3rYOA"/> <bpmn2:documentation id="documentation_H3rYOA"/>
@ -64,7 +64,7 @@
</bpmn2:association> </bpmn2:association>
<bpmn2:documentation id="documentation_FFzgqw"/> <bpmn2:documentation id="documentation_FFzgqw"/>
</bpmn2:process> </bpmn2:process>
<bpmn2:process definitionalCollaborationRef="Collaboration_1" id="Process_1" isExecutable="false" name="SEPA-Export"> <bpmn2:process definitionalCollaborationRef="Collaboration_1" id="Process_1" isExecutable="false" name="SEPA-Export" processType="Private">
<bpmn2:laneSet id="LaneSet_1" name="Lane Set 1"> <bpmn2:laneSet id="LaneSet_1" name="Lane Set 1">
<bpmn2:lane id="Lane_1" name="Buchhaltung"> <bpmn2:lane id="Lane_1" name="Buchhaltung">
<bpmn2:flowNodeRef>IntermediateCatchEvent_6</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>IntermediateCatchEvent_6</bpmn2:flowNodeRef>
@ -579,7 +579,7 @@ result.isValid=true;
<imixs:value><![CDATA[false]]></imixs:value> <imixs:value><![CDATA[false]]></imixs:value>
</imixs:item> </imixs:item>
<imixs:item name="txtreportname" type="xs:string"> <imixs:item name="txtreportname" type="xs:string">
<imixs:value><![CDATA[sepa]]></imixs:value> <imixs:value><![CDATA[sepa_millennium]]></imixs:value>
</imixs:item> </imixs:item>
<imixs:item name="namownershipnames" type="xs:string"> <imixs:item name="namownershipnames" type="xs:string">
<imixs:value/> <imixs:value/>
@ -608,6 +608,9 @@ result.isValid=true;
<imixs:item name="rtfmailbody" type="xs:string"> <imixs:item name="rtfmailbody" type="xs:string">
<imixs:value><![CDATA[<bpmn2:message>SEPA-Body</bpmn2:message>]]></imixs:value> <imixs:value><![CDATA[<bpmn2:message>SEPA-Body</bpmn2:message>]]></imixs:value>
</imixs:item> </imixs:item>
<imixs:item name="txtreporttarget" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
</bpmn2:extensionElements> </bpmn2:extensionElements>
<bpmn2:documentation id="Documentation_2"><![CDATA[Start SEPA run]]></bpmn2:documentation> <bpmn2:documentation id="Documentation_2"><![CDATA[Start SEPA run]]></bpmn2:documentation>
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@ -688,7 +691,7 @@ result.isValid=true;
<imixs:value>false</imixs:value> <imixs:value>false</imixs:value>
</imixs:item> </imixs:item>
<imixs:item name="txtreportname" type="xs:string"> <imixs:item name="txtreportname" type="xs:string">
<imixs:value><![CDATA[sepa]]></imixs:value> <imixs:value><![CDATA[sepa_millennium]]></imixs:value>
</imixs:item> </imixs:item>
<imixs:item name="txtbusinessrule" type="CDATA"> <imixs:item name="txtbusinessrule" type="CDATA">
<imixs:value><![CDATA[var result={}; <imixs:value><![CDATA[var result={};
@ -715,6 +718,9 @@ result.isValid=true;
<imixs:item name="keymailreceiverfields" type="xs:string"> <imixs:item name="keymailreceiverfields" type="xs:string">
<imixs:value><![CDATA[process.manager]]></imixs:value> <imixs:value><![CDATA[process.manager]]></imixs:value>
</imixs:item> </imixs:item>
<imixs:item name="txtreporttarget" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
</bpmn2:extensionElements> </bpmn2:extensionElements>
<bpmn2:documentation id="Documentation_11"><![CDATA[Run SEPA again and regenerate SEPA file]]></bpmn2:documentation> <bpmn2:documentation id="Documentation_11"><![CDATA[Run SEPA again and regenerate SEPA file]]></bpmn2:documentation>
<bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
@ -928,7 +934,7 @@ result.isValid=true;
<bpmndi:BPMNShape bpmnElement="ExclusiveGateway_1" id="BPMNShape_ExclusiveGateway_1" isMarkerVisible="true"> <bpmndi:BPMNShape bpmnElement="ExclusiveGateway_1" id="BPMNShape_ExclusiveGateway_1" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="720.0" y="349.0"/> <dc:Bounds height="50.0" width="50.0" x="720.0" y="349.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_34" labelStyle="BPMNLabelStyle_1"> <bpmndi:BPMNLabel id="BPMNLabel_34" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="20.0" width="100.0" x="688.0" y="388.0"/> <dc:Bounds height="20.0" width="100.0" x="695.0" y="402.0"/>
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="TextAnnotation_2" id="BPMNShape_TextAnnotation_2"> <bpmndi:BPMNShape bpmnElement="TextAnnotation_2" id="BPMNShape_TextAnnotation_2">
@ -1066,7 +1072,7 @@ result.isValid=true;
<bpmndi:BPMNLabel id="BPMNLabel_6"/> <bpmndi:BPMNLabel id="BPMNLabel_6"/>
<di:waypoint x="1030.0" y="284.0"/> <di:waypoint x="1030.0" y="284.0"/>
<di:waypoint x="1074.0" y="284.0"/> <di:waypoint x="1074.0" y="284.0"/>
<di:waypoint x="1119.0277992443885" y="284.0"/> <di:waypoint x="1119.0" y="284.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_5" id="BPMNEdge_SequenceFlow_5" sourceElement="BPMNShape_Task_1" targetElement="BPMNShape_IntermediateCatchEvent_7"> <bpmndi:BPMNEdge bpmnElement="SequenceFlow_5" id="BPMNEdge_SequenceFlow_5" sourceElement="BPMNShape_Task_1" targetElement="BPMNShape_IntermediateCatchEvent_7">
<bpmndi:BPMNLabel id="BPMNLabel_8"/> <bpmndi:BPMNLabel id="BPMNLabel_8"/>