verbesserungen mahnlauf

This commit is contained in:
Ralph Soika 2022-10-19 12:13:13 +02:00
parent 1a603847f3
commit a035998513
5 changed files with 58 additions and 178 deletions

View file

@ -1,6 +1,7 @@
package com.alexanderlogistics;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -278,4 +279,16 @@ public class OPListController implements Serializable {
}
/**
* Returns true if the reminder date is today or in the past
* @param uniqueid
* @return
*/
public boolean isInDue(String uniqueid) {
ItemCollection invoice=workflowService.getWorkItem(uniqueid);
LocalDate date = invoice.getItemValueLocalDate("invoice.reminder");
return date.compareTo(LocalDate.now())<=0;
}
}

View file

@ -1,5 +1,6 @@
package com.alexanderlogistics.mahnlauf;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -62,34 +63,37 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
// get all Invoices of this Mahnlauf
List<Map<String, List<Object>>> invoiceList = new ArrayList<Map<String, List<Object>>>();
List<String> refList = mahnLaufWorkitem.getItemValue("$workitemref");
double saldo=0;
String currency="";
double saldo = 0;
String currency = "";
for (String uniqueId : refList) {
ItemCollection invoice = workflowService.getWorkItem(uniqueId);
if (invoice != null && (invoice.getTaskID() >= MahnlaufService.TASK_MAHNLAUF_START
&& invoice.getTaskID() <= MahnlaufService.TASK_MAHNLAUF_END)) {
// set new invoice.reminder date
// first fetch the event of the invoice to be processed
try {
Model invoiceModel;
invoiceModel = this.modelService.getModel(invoice.getModelVersion());
ItemCollection invoiceEvent = invoiceModel.getEvent(invoice.getTaskID(),
MahnlaufService.EVENT_MAHNLAUF_EXECUTE);
if (invoiceEvent != null) {
ItemCollection eventDunningConfig = this.workflowService.evalWorkflowResult(invoiceEvent,
"dunning", invoice);
int period = eventDunningConfig.getItemValueInteger("period");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, period);
invoice.setItemValue("invoice.reminder", cal.getTime());
}
// set new invoice.reminder date only if we in due
if (isInDue(invoice)) {
try {
// first fetch the event of the invoice to be processed
Model invoiceModel;
invoiceModel = this.modelService.getModel(invoice.getModelVersion());
ItemCollection invoiceEvent = invoiceModel.getEvent(invoice.getTaskID(),
MahnlaufService.EVENT_MAHNLAUF_EXECUTE);
if (invoiceEvent != null) {
ItemCollection eventDunningConfig = this.workflowService.evalWorkflowResult(invoiceEvent,
"dunning", invoice);
int period = eventDunningConfig.getItemValueInteger("period");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, period);
invoice.setItemValue("invoice.reminder", cal.getTime());
}
} catch (ModelException e) {
e.printStackTrace();
} catch (ModelException e) {
e.printStackTrace();
}
mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE));
}
mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE));
// create a workitem stub for the mail message
ItemCollection invoiceStub = new ItemCollection();
@ -103,9 +107,9 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
invoiceList.add(invoiceStub.getAllItems());
// store currency in mahnlauf
currency= invoice.getItemValueString("invoice.currency");
currency = invoice.getItemValueString("invoice.currency");
saldo=saldo+invoice.getItemValueDouble("invoice.saldo");
saldo = saldo + invoice.getItemValueDouble("invoice.saldo");
}
}
@ -117,4 +121,15 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
return mahnLaufWorkitem;
}
/**
* Returns true if the reminder date is today or in the past
* @param uniqueid
* @return
*/
public boolean isInDue(ItemCollection invoice) {
LocalDate date = invoice.getItemValueLocalDate("invoice.reminder");
return date.compareTo(LocalDate.now())<=0;
}
}

View file

@ -81,9 +81,8 @@
<!-- CheckBox -->
<td style="text-align: center;">
<ui:fragment rendered="#{invoice.taskID ge 5100 and invoice.taskID lt 5299}">
<h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
<h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
value="#{invoice.item['selected']}"
onclick="initInvoicePayment(this)">
<f:ajax event="change" execute="#{opListContainer.clientId}"
@ -150,17 +149,7 @@
var prevTD=$(currentTD).prev().prev();
var amountValue=$(prevTD).text();
var amountTD=$(currentTD).prev();
//var amountInput=$("input",amountTD);
// wenn wir noch keinen wert dann betrag übernehmen
/* if (element.checked) {
if ($(amountInput).val()=='' || $(amountInput).val()=='0,00') {
$(amountInput).val(amountValue);
}
} else {
// clear value
$(amountInput).val("");
} */
}
// This method refreshs the layout of the invoice checkboxes

View file

@ -93,7 +93,6 @@ th { font-weight: bold;}
<bpmn2:flowNodeRef>IntermediateCatchEvent_2</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_6</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>Task_3</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_8</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_7</bpmn2:flowNodeRef>
</bpmn2:lane>
</bpmn2:laneSet>
@ -131,7 +130,6 @@ th { font-weight: bold;}
<bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_16</bpmn2:outgoing>
</bpmn2:task>
<bpmn2:sequenceFlow id="SequenceFlow_10" sourceRef="Task_2" targetRef="EndEvent_3"/>
<bpmn2:endEvent id="EndEvent_3" name="End">
@ -174,7 +172,6 @@ th { font-weight: bold;}
<bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
</bpmn2:task>
@ -704,12 +701,6 @@ result.isValid=true;
<bpmn2:sequenceFlow id="SequenceFlow_3" sourceRef="Task_1" targetRef="IntermediateCatchEvent_7"/>
<bpmn2:sequenceFlow id="SequenceFlow_5" sourceRef="IntermediateCatchEvent_7" targetRef="Task_3"/>
<bpmn2:sequenceFlow id="SequenceFlow_13" sourceRef="Task_3" targetRef="EndEvent_3"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_8" imixs:activityid="162" name="Intermediate Catch Event 8">
<bpmn2:incoming>SequenceFlow_16</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_16" sourceRef="Task_2" targetRef="IntermediateCatchEvent_8"/>
<bpmn2:sequenceFlow id="SequenceFlow_17" sourceRef="IntermediateCatchEvent_8" targetRef="Task_1"/>
<bpmn2:association id="Association_2" sourceRef="DataObject_1" targetRef="Task_1"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram">
@ -824,12 +815,6 @@ result.isValid=true;
<dc:Bounds height="14.0" width="57.0" x="622.0" y="453.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_IntermediateCatchEvent_8" bpmnElement="IntermediateCatchEvent_8">
<dc:Bounds height="36.0" width="36.0" x="692.0" y="162.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_24">
<dc:Bounds height="28.0" width="79.0" x="671.0" y="198.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="BPMNShape_Task_2" targetElement="BPMNShape_EndEvent_2">
<di:waypoint xsi:type="dc:Point" x="872.0" y="319.0"/>
<di:waypoint xsi:type="dc:Point" x="896.0" y="319.0"/>
@ -928,18 +913,6 @@ result.isValid=true;
<di:waypoint xsi:type="dc:Point" x="956.0" y="319.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_15"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="BPMNShape_Task_2" targetElement="BPMNShape_IntermediateCatchEvent_8">
<di:waypoint xsi:type="dc:Point" x="798.0" y="294.0"/>
<di:waypoint xsi:type="dc:Point" x="798.0" y="180.0"/>
<di:waypoint xsi:type="dc:Point" x="728.0" y="180.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_27"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="SequenceFlow_17" sourceElement="BPMNShape_IntermediateCatchEvent_8" targetElement="BPMNShape_Task_1">
<di:waypoint xsi:type="dc:Point" x="692.0" y="180.0"/>
<di:waypoint xsi:type="dc:Point" x="363.0" y="180.0"/>
<di:waypoint xsi:type="dc:Point" x="363.0" y="294.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_31"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
<dc:Font name="arial" size="9.0"/>

View file

@ -114,7 +114,6 @@ th { font-weight: bold;}
<bpmn2:flowNodeRef>IntermediateCatchEvent_5000-20</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_1</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_18</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_5</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>Task_8</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateCatchEvent_7</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>EndEvent_3</bpmn2:flowNodeRef>
@ -187,7 +186,7 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keypublicresult" type="xs:string">
<imixs:value><![CDATA[1]]></imixs:value>
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyownershipfields" type="xs:string">
<imixs:value><![CDATA[process.team]]></imixs:value>
@ -391,7 +390,6 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
<bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_46</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_37</bpmn2:outgoing>
@ -1748,101 +1746,6 @@ Betrag: <itemvalue>invoice.total</itemvalue> <itemvalue>invoice.currency</itemva
<bpmn2:sequenceFlow id="SequenceFlow_32" sourceRef="EventBasedGateway_2" targetRef="IntermediateCatchEvent_5000-20"/>
<bpmn2:sequenceFlow id="SequenceFlow_34" sourceRef="Task_1" targetRef="IntermediateCatchEvent_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_4" sourceRef="IntermediateCatchEvent_8" targetRef="Task_1"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_5" imixs:activityid="25" name="Mahnlauf erstellen">
<bpmn2:extensionElements>
<imixs:item name="keylogtimeformat" type="xs:string">
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keyarchive" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="txtmailsubject" type="xs:string">
<imixs:value><![CDATA[]]></imixs:value>
</imixs:item>
<imixs:item name="keyaccessmode" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyscheduledactivity" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="rtfmailbody" type="xs:string">
<imixs:value><![CDATA[]]></imixs:value>
</imixs:item>
<imixs:item name="keymailreceiverfields" type="xs:string"/>
<imixs:item name="keyversion" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyaddwritefields" type="xs:string">
<imixs:value><![CDATA[process.manager]]></imixs:value>
<imixs:value><![CDATA[process.team]]></imixs:value>
<imixs:value><![CDATA[space.manager]]></imixs:value>
</imixs:item>
<imixs:item name="numnextactivityid" type="xs:int">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyfollowup" type="xs:string">
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keypublicresult" type="xs:string">
<imixs:value><![CDATA[1]]></imixs:value>
</imixs:item>
<imixs:item name="keylogdateformat" type="xs:string">
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keyownershipfields" type="xs:string"/>
<imixs:item name="numnextid" type="xs:int">
<imixs:value><![CDATA[5005]]></imixs:value>
</imixs:item>
<imixs:item name="txtnextprocesstree" type="xs:string">
<imixs:value><![CDATA[]]></imixs:value>
</imixs:item>
<imixs:item name="txtactivityresult" type="xs:string">
<imixs:value><![CDATA[<mahnlauf name="modelversion">mahnlauf-de-1.0</mahnlauf>
<mahnlauf name="task">1000</mahnlauf>
<mahnlauf name="event">100</mahnlauf>
<item name="action">/pages/workitems/workitem.jsf?id=<itemvalue>dunning.ref</itemvalue></item>
]]></imixs:value>
</imixs:item>
<imixs:item name="txtname" type="xs:string">
<imixs:value><![CDATA[Freigabe einholen]]></imixs:value>
</imixs:item>
<imixs:item name="keyownershipmode" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="rtfresultlog" type="xs:string">
<imixs:value><![CDATA[Mahnlauf eingeleitet]]></imixs:value>
</imixs:item>
<imixs:item name="keyupdateacl" type="xs:boolean">
<imixs:value>false</imixs:value>
</imixs:item>
<imixs:item name="txtbusinessrule" type="CDATA">
<imixs:value><![CDATA[var result={};
var refField="dbtr.mail";
result.isValid=true;
if ( ( workitem.get(refField) == null || ''==workitem.get(refField)[0]) ) {
result.isValid=false;
result.errorMessage='Zu diesem Debitor wurde noch keine E-Mail Adresse erfasst. Bitte pflegen Sie diese in der Debitoren Verwaltung.';
}]]></imixs:value>
</imixs:item>
<imixs:item name="namaddreadaccess" type="xs:string">
<imixs:value><![CDATA[{process:?:member}]]></imixs:value>
<imixs:value><![CDATA[{space:?:member}]]></imixs:value>
</imixs:item>
<imixs:item name="keyaddreadfields" type="xs:string"/>
</bpmn2:extensionElements>
<bpmn2:documentation id="Documentation_30"><![CDATA[Rechnung zur Sachprüfung übernehmen.]]></bpmn2:documentation>
<bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
<bpmn2:dataOutput id="DataOutput_2" name="Signal_2_Output"/>
<bpmn2:dataOutputAssociation id="DataOutputAssociation_2">
<bpmn2:sourceRef>DataOutput_2</bpmn2:sourceRef>
</bpmn2:dataOutputAssociation>
<bpmn2:outputSet id="OutputSet_3" name="Output Set 2">
<bpmn2:dataOutputRefs>DataOutput_2</bpmn2:dataOutputRefs>
</bpmn2:outputSet>
<bpmn2:signalEventDefinition id="SignalEventDefinition_3" signalRef="Signal_4"/>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_22" sourceRef="IntermediateCatchEvent_5" targetRef="Task_2"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_9" imixs:activityid="300" name="[Mahnlauf]">
<bpmn2:extensionElements>
<imixs:item name="keyarchive" type="xs:string">
@ -2777,12 +2680,6 @@ Wiedervorlage wird um 7 bzw. 5 Tage erhöht</bpmn2:text>
<dc:Bounds height="50.0" width="50.0" x="338.0" y="360.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_77" labelStyle="BPMNLabelStyle_1"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_IntermediateCatchEvent_7" bpmnElement="IntermediateCatchEvent_5">
<dc:Bounds height="36.0" width="36.0" x="290.0" y="391.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_75">
<dc:Bounds height="28.0" width="54.0" x="281.0" y="427.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_IntermediateCatchEvent_8" bpmnElement="IntermediateCatchEvent_9">
<dc:Bounds height="36.0" width="36.0" x="341.0" y="770.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_84">
@ -3135,13 +3032,6 @@ Wiedervorlage wird um 7 bzw. 5 Tage erhöht</bpmn2:text>
<di:waypoint xsi:type="dc:Point" x="305.0" y="573.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_19"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_22" bpmnElement="SequenceFlow_22" sourceElement="BPMNShape_IntermediateCatchEvent_7" targetElement="BPMNShape_Task_5">
<di:waypoint xsi:type="dc:Point" x="308.0" y="391.0"/>
<di:waypoint xsi:type="dc:Point" x="308.0" y="346.0"/>
<di:waypoint xsi:type="dc:Point" x="344.0" y="346.0"/>
<di:waypoint xsi:type="dc:Point" x="344.0" y="330.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_83"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_35" sourceElement="BPMNShape_Task_3" targetElement="BPMNShape_IntermediateCatchEvent_8">
<di:waypoint xsi:type="dc:Point" x="341.0" y="598.0"/>
<di:waypoint xsi:type="dc:Point" x="341.0" y="684.0"/>