berechnung steuer salden

This commit is contained in:
Ralph Soika 2024-09-19 18:46:32 +02:00
parent c6799ff6b5
commit 620dbbcc28
5 changed files with 1534 additions and 24 deletions

View file

@ -1,6 +1,7 @@
package com.alexanderlogistics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
@ -45,8 +46,83 @@ public class SteuerbescheidPlugin extends AbstractPlugin {
@Override
public ItemCollection run(ItemCollection workitem, ItemCollection event) throws PluginException {
// Update Fälligkeit
updateFaelligkeit(workitem);
// Update Salden
updateTotalEustZoll(workitem);
updateInvoiceSaldo(workitem);
return workitem;
}
/**
* Aktualisiert die EUST/ZOLL Summen
*
*/
protected void updateTotalEustZoll(ItemCollection workitem) {
double saldoEust = 0;
double saldoZoll = 0;
List<ItemCollection> positionsTabelle = InvoiceUtil.explodeChildList(workitem);
for (ItemCollection pos : positionsTabelle) {
if ("EUST".equalsIgnoreCase(pos.getItemValueString("activity.type"))) {
saldoEust = saldoEust + pos.getItemValueDouble("amount");
}
if ("ZOLL".equalsIgnoreCase(pos.getItemValueString("activity.type"))) {
saldoZoll = saldoZoll + pos.getItemValueDouble("amount");
}
}
workitem.setItemValue("steuer.eust", saldoEust);
workitem.setItemValue("steuer.zoll", saldoZoll);
}
/**
* Aktualisiert die EUST/ZOLL Fälligkeiten in den Detailtabellen
* Die Daten kommen von der KI und werden auf die Positionsnummern gemappt.
*
*/
protected void updateFaelligkeit(ItemCollection workitem) {
Date datEust = workitem.getItemValueDate("steuer.eust.due");
Date datZoll = workitem.getItemValueDate("steuer.zoll.due");
List<ItemCollection> rows = InvoiceUtil.explodeChildList(workitem);
boolean update = false;
for (ItemCollection pos : rows) {
if (datZoll != null) {
if ("ZOLL".equalsIgnoreCase(pos.getItemValueString("activity.type"))
&& pos.getItemValueDate("duedate") == null) {
pos.setItemValue("duedate", datZoll);
update = true;
}
}
if (datEust != null) {
if ("EUST".equalsIgnoreCase(pos.getItemValueString("activity.type"))
&& pos.getItemValueDate("duedate") == null) {
pos.setItemValue("duedate", datEust);
update = true;
}
}
}
if (update) {
InvoiceUtil.implodeChildList(workitem, rows);
}
}
/**
* Aktualisiert den invoice.saldo anhand der ausgehenden Rechnungen zu einer ATC
* Nummer
*
*/
protected void updateInvoiceSaldo(ItemCollection workitem) {
String atcNummer = workitem.getItemValueString("invoice.atc.number");
logger.info("Verify ATC-Nr.: " + atcNummer);
logger.fine("Verify ATC-Nr.: " + atcNummer);
double amount = workitem.getItemValueDouble("invoice.total.net");
List<ItemCollection> invoices = findInvoices(atcNummer);
@ -70,7 +146,6 @@ public class SteuerbescheidPlugin extends AbstractPlugin {
// Update Saldo
workitem.setItemValue("invoice.saldo", InvoiceUtil.round(saldo));
return workitem;
}
/*

View file

@ -9,7 +9,7 @@
<tr>
<th style="">Positionsnummer</th>
<th style="">Art</th>
<th style="">Steuer</th>
<th style="width: 100px;">Fälligkeit</th>
<th style="">Betrag</th>
</tr>
@ -22,8 +22,10 @@
<td style="text-align: center;">
#{row.item['activity.type']}
</td>
<td>
#{row.item['tax.code']}
<td style="text-align: center;">
<h:outputText value="#{row.item['duedate']}">
<f:convertDateTime pattern=" #{message.datePatternShort}" timeZone="#{message.timeZone}" />
</h:outputText>
</td>
@ -38,6 +40,24 @@
</tr>
</ui:repeat>
<tr>
<td />
<td />
<td style="text-align: right;"><strong>Summe: </strong></td>
<td style="text-align: right;">
<strong>
<h:outputText value="#{workitem.item['invoice.total.net']}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
<h:outputText value=" #{workflowController.workitem.item['invoice.currency']}" />
</strong>
</td>
</tr>
</table>

View file

@ -38,7 +38,23 @@
</td>
</tr>
</ui:repeat>
<tr>
<td />
<td style="text-align: right;"><strong>Saldo: </strong></td>
<td style="text-align: right;">
<strong>
<h:outputText value="#{workitem.item['invoice.saldo']}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
<h:outputText value=" #{workflowController.workitem.item['invoice.currency']}" />
</strong>
</td>
</tr>
</table>
</h:panelGroup>

File diff suppressed because it is too large Load diff

View file

@ -123,6 +123,7 @@ th { font-weight: bold;}
<bpmn2:flowNodeRef>dataObject_P0BaVA</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>event_2I6HNw</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>event_rxM0Nw</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>event_zZMlig</bpmn2:flowNodeRef>
</bpmn2:lane>
</bpmn2:laneSet>
<bpmn2:startEvent id="StartEvent_1" name="Start">
@ -255,7 +256,11 @@ th { font-weight: bold;}
<bpmn2:dataObject id="DataObject_2" name="Form">
<bpmn2:documentation id="Documentation_5"><![CDATA[<?xml version="1.0"?>
<imixs-form>
<imixs-form-section columns="3" label="Rechnungsdaten">
<imixs-form-section columns="1" label="Rechnungsdaten">
<item name="steuer.anmelder" type="text" label="Anmelder:" readonly="true"/>
</imixs-form-section>
<imixs-form-section columns="3" >
<item name="invoice.booking_text" type="text" label="Text:" readonly="true"/>
<item name="cdtr.name" type="text" label="Kreditor:" readonly="true"/>
<item name="cdtr.number" type="text" label="Kreditor-Nummer:" readonly="true"/>
@ -266,14 +271,15 @@ th { font-weight: bold;}
<item name="invoice.atc.number" type="date" label="ATC Nr.:" readonly="true" />
<item name="invoice.date" type="date" label="Beleg Datum:" readonly="true"/>
<item name="invoice.booking_date" type="date" label="Buchungs Datum:" readonly="true"/>
<item name="steuer.zoll.due" type="date" label="Fälligkeit Zoll:" readonly="true"/>
<item name="steuer.eust.due" type="date" label="Fälligkeit EUSt:" readonly="true"/>
</imixs-form-section>
<imixs-form-section columns="3" label="">
<item name="invoice.currency" type="text" label="Währung:" readonly="true" />
<item name="invoice.total.net" type="currency" label="Summe Zoll/EUSt:" readonly="true" />
<item name="invoice.saldo" type="currency" label="Saldo:" readonly="true"/>
<item name="steuer.zoll" type="currency" label="Summe Zoll:" readonly="true" />
<item name="steuer.eust" type="currency" label="Summe Eust:" readonly="true" />
</imixs-form-section>
<imixs-form-section>
@ -585,12 +591,6 @@ if (workitem.getItemValueString('txtcomment') == '' ) {
<imixs:item name="txtmailsubject" type="xs:string">
<imixs:value><![CDATA[Steuerbescheid <itemvalue>invoice.atc.number</itemvalue> wurde noch nicht abgerechnet!]]></imixs:value>
</imixs:item>
<imixs:item name="keymailreceiverfields" type="xs:string">
<imixs:value><![CDATA[space.manager]]></imixs:value>
</imixs:item>
<imixs:item name="keymailreceiverfieldscc" type="xs:string">
<imixs:value><![CDATA[process.manager]]></imixs:value>
</imixs:item>
<imixs:item name="txtactivityresult" type="xs:string">
<imixs:value><![CDATA[<item name="reminder" type="date"><itemvalue>$lasteventdate</itemvalue></item>
<item name="interval">
@ -716,12 +716,6 @@ if (workitem.getItemValueString('txtcomment') == '' ) {
<imixs:item name="txtmailsubject" type="xs:string">
<imixs:value><![CDATA[Steuerbescheid <itemvalue>invoice.atc.number</itemvalue> wurde wiederholt noch nicht abgerechnet!]]></imixs:value>
</imixs:item>
<imixs:item name="keymailreceiverfields" type="xs:string">
<imixs:value><![CDATA[space.manager]]></imixs:value>
</imixs:item>
<imixs:item name="keymailreceiverfieldscc" type="xs:string">
<imixs:value><![CDATA[process.manager]]></imixs:value>
</imixs:item>
<imixs:item name="txtactivityresult" type="xs:string">
<imixs:value><![CDATA[<item name="interval">
<ref>reminder</ref>
@ -865,7 +859,7 @@ if (workitem.getItemValueString('txtcomment') == '' ) {
<imixs-ai name="PROMPT">
<endpoint>https://llama.cpp.imixs.com/</endpoint>
<result-event>XML</result-event>
<debug>true</debug>
<debug>false</debug>
</imixs-ai>]]></imixs:value>
</imixs:item>
</bpmn2:extensionElements>
@ -936,6 +930,7 @@ if (workitem.getItemValueString('txtcomment') == '' ) {
<bpmn2:incoming>sequenceFlow_8NjTWw</bpmn2:incoming>
<bpmn2:outgoing>sequenceFlow_GmmBvA</bpmn2:outgoing>
<bpmn2:outgoing>sequenceFlow_zXpIXw</bpmn2:outgoing>
<bpmn2:incoming>sequenceFlow_za0Rkw</bpmn2:incoming>
</bpmn2:task>
<bpmn2:sequenceFlow id="sequenceFlow_8NjTWw" sourceRef="event_x7R5Sw" targetRef="task_Em0QgQ">
<bpmn2:documentation id="documentation_Av207A"/>
@ -1039,6 +1034,21 @@ Beachte: Gib nur das XML Objekt aus. Füge keine Erklärungen oder Kommentare hi
<bpmn2:sequenceFlow id="sequenceFlow_wJgRIg" sourceRef="event_rxM0Nw" targetRef="task_Xtwzqw">
<bpmn2:documentation id="documentation_T6d7Bg"/>
</bpmn2:sequenceFlow>
<bpmn2:intermediateCatchEvent id="event_zZMlig" imixs:activityid="10" name="Speichern">
<bpmn2:extensionElements>
<imixs:item name="rtfresultlog" type="CDATA">
<imixs:value><![CDATA[Aktualisiert]]></imixs:value>
</imixs:item>
</bpmn2:extensionElements>
<bpmn2:documentation id="documentation_DpR2Cw"/>
<bpmn2:outgoing>sequenceFlow_za0Rkw</bpmn2:outgoing>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="sequenceFlow_za0Rkw" sourceRef="event_zZMlig" targetRef="task_Em0QgQ">
<bpmn2:documentation id="documentation_Nx2zuQ"/>
</bpmn2:sequenceFlow>
<bpmn2:association id="association_0EDyqw" sourceRef="DataObject_2" targetRef="task_Em0QgQ">
<bpmn2:documentation id="documentation_WWO0hQ"/>
</bpmn2:association>
</bpmn2:process>
<bpmn2:message id="message_2vpUVQ" name="Mahnung">
<bpmn2:documentation id="documentation_tX0UnQ"><![CDATA[<p>Hallo,</p>
@ -1458,8 +1468,8 @@ Einen Überblick über alle überflälligen noch offenen Steuerbescheide finden
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_72aV2Q" id="BPMNEdge_d4DO0g" sourceElement="BPMNShape_w5E7eQ" targetElement="BPMNShape_EIUoMQ">
<di:waypoint x="1710.0" y="345.0"/>
<di:waypoint x="1496.9413452148438" y="345.0"/>
<di:waypoint x="1496.9413452148438" y="641.8547973632812"/>
<di:waypoint x="1496.94140625" y="345.0"/>
<di:waypoint x="1496.94140625" y="641.8547973632812"/>
<di:waypoint x="1283.8826904296875" y="641.8547973632812"/>
<di:waypoint x="1283.8826904296875" y="635.0"/>
<di:waypoint x="1283.0" y="635.0"/>
@ -1486,6 +1496,23 @@ Einen Überblick über alle überflälligen noch offenen Steuerbescheide finden
<di:waypoint x="479.0" y="517.8547973632812"/>
<di:waypoint x="479.0" y="370.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape bpmnElement="event_zZMlig" id="BPMNShape_Cu04bg">
<dc:Bounds height="36.0" width="36.0" x="867.0" y="237.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_k6VtEw">
<dc:Bounds height="20.0" width="100.0" x="835.0" y="276.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_za0Rkw" id="BPMNEdge_PFvmpA" sourceElement="BPMNShape_Cu04bg" targetElement="BPMNShape_uIl0wA">
<di:waypoint x="885.0" y="273.0"/>
<di:waypoint x="885.0" y="296.5"/>
<di:waypoint x="915.0" y="296.5"/>
<di:waypoint x="915.0" y="320.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="association_0EDyqw" id="BPMNEdge_TDP9hQ" sourceElement="BPMNShape_DataObject_2" targetElement="BPMNShape_uIl0wA">
<di:waypoint x="1250.0" y="225.0"/>
<di:waypoint x="959.0" y="225.0"/>
<di:waypoint x="959.0" y="320.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
<dc:Font name="arial" size="9.0"/>