diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/DebitorStatistikController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/DebitorStatistikController.java index 2e73e40..7518c29 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/DebitorStatistikController.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/DebitorStatistikController.java @@ -26,6 +26,7 @@ import org.imixs.workflow.ItemCollection; import org.imixs.workflow.engine.DocumentService; import org.imixs.workflow.exceptions.QueryException; import org.imixs.workflow.faces.data.WorkflowController; +import org.imixs.workflow.office.views.SearchController; /** * Der InvoiceAnalyseController dient zur Auswertung der Sachprüfungs WOrklfow @@ -49,14 +50,23 @@ public class DebitorStatistikController implements Serializable { @Inject protected WorkflowController workflowController; - public int getZahlungsmoral() { + @Inject + protected SearchController searchController; + public int getZahlungsmoral() { return 0; } + /* + * Gesamt + */ + public String getQueryRechnungen() { + String query = "(type:workitem OR type:workitemarchive) AND dbtr.number:" + getDbtNr() + + " AND $workflowgroup:\"Rechnungsausgang\""; + return "/pages/workitems/worklist?title=Rechnungen " + getDbtNr() + " gesamt&query=" + query; + } public int getRechnungen() { int result = 0; - try { result = documentService .count("(type:workitem OR type:workitemarchive) AND dbtr.number:" + getDbtNr() @@ -67,19 +77,35 @@ public class DebitorStatistikController implements Serializable { return result; } + /* + * Bezahlt + */ + public String getQueryRechnungenBezahlt() { + String query = "(type:workitem OR type:workitemarchive) AND dbtr.number:" + getDbtNr() + + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5900 TO 5999])"; + return "/pages/workitems/worklist?title=Rechnungen " + getDbtNr() + " bezahlt&query=" + query; + } public int getRechnungenBezahlt() { int result = 0; try { result = documentService .count("(type:workitem OR type:workitemarchive) AND dbtr.number:" + getDbtNr() - + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5900 TO 5999])"); + + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5900 TO 5999])"); } catch (QueryException e) { logger.severe("Failed to get statistic: " + e.getMessage()); } return result; } + /* + * Offen + */ + public String getQueryRechnungenOffen() { + String query = "(type:workitem) AND dbtr.number:" + getDbtNr() + + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5000 TO 5099])"; + return "/pages/workitems/worklist?title=Rechnungen " + getDbtNr() + " offen&query=" + query; + } public int getRechnungenOffen() { int result = 0; @@ -93,9 +119,16 @@ public class DebitorStatistikController implements Serializable { return result; } + /* + * Fällig + */ + public String getQueryRechnungenFaellig() { + String query = "(type:workitem) AND dbtr.number:" + getDbtNr() + + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5100 TO 5199])"; + return "/pages/workitems/worklist?title=Rechnungen " + getDbtNr() + " fällig&query=" + query; + } public int getRechnungenFaellig() { int result = 0; - try { result = documentService .count("(type:workitem) AND dbtr.number:" + getDbtNr() @@ -106,9 +139,16 @@ public class DebitorStatistikController implements Serializable { return result; } + /* + * In Mahnung + */ + public String getQueryRechnungenGemahnt() { + String query = "(type:workitem) AND dbtr.number:" + getDbtNr() + + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5200 TO 5299])"; + return "/pages/workitems/worklist?title=Rechnungen " + getDbtNr() + " in Mahnung&query=" + query; + } public int getRechnungenGemahnt() { int result = 0; - try { result = documentService .count("(type:workitem ) AND dbtr.number:" + getDbtNr() @@ -119,6 +159,14 @@ public class DebitorStatistikController implements Serializable { return result; } + /* + * Inkasso + */ + public String getQueryRechnungenInkasso() { + String query = "(type:workitem) AND dbtr.number:" + getDbtNr() + + " AND $workflowgroup:\"Rechnungsausgang\" AND ($taskid:[5300 TO 5399])"; + return "/pages/workitems/worklist?title=Rechnungen " + getDbtNr() + " in Inkasso&query=" + query; + } public int getRechnungenInkasso() { int result = 0; @@ -145,6 +193,34 @@ public class DebitorStatistikController implements Serializable { return dbtNr; } + public long getDurchschnittZahlungsziel() { + getStats(); + int count = 0; + long gesamt = 0; + for (Map.Entry entry : stats.entrySet()) { + DebitorStatistikData statData = entry.getValue(); + if (statData.count > 0) { + gesamt = gesamt + statData.getAverageDueDays(); + count++; + } + } + return Math.round((double) gesamt / count); + } + + public long getDurchschnittZahlungsdauer() { + getStats(); + int count = 0; + long gesamt = 0; + for (Map.Entry entry : stats.entrySet()) { + DebitorStatistikData statData = entry.getValue(); + if (statData.count > 0) { + gesamt = gesamt + statData.getAveragePaymentDays(); + count++; + } + } + return Math.round((double) gesamt / count); + } + /** * Sucht alle Rechnugnen aus einem Zeitraum und sammelt Zahlungsziel und * Zahlungszeitspanne gruppiert nach monaten @@ -409,7 +485,8 @@ public class DebitorStatistikController implements Serializable { // Datasets 1 result = result + "{label: 'Zahlungsziel',borderWidth: 1,"; - result = result + " \"backgroundColor\" : [\"#3B6B82\"],"; + result = result + " borderColor: [\"#3B6B82\"],"; + result = result + " \"backgroundColor\" : [\"#CFE9F5\"], fill: true,tension: 0.5,"; result = result + "data: ["; for (Map.Entry entry : stats.entrySet()) { @@ -422,14 +499,11 @@ public class DebitorStatistikController implements Serializable { // Datasets 2 result = result + "{label: 'Zahldauer',borderWidth: 1,"; - result = result + " \"backgroundColor\" : [\"#CFE9F5\" ],"; + result = result + " borderColor: [\"#E73B65\"],\"backgroundColor\" : [\"#70B088\" ], tension: 0.5,fill: true,"; result = result + " trendlineLinear: { colorMin: \"red\", colorMax: \"green\", lineStyle: \"dotted\", width: 2 , projection: true },"; - // result = result - // + "trendlineLinear: {colorMin: \"red\",colorMax: \"green\", lineStyle: - // \"dotted\",width: 2,projection: true},"; result = result + "data: ["; for (Map.Entry entry : stats.entrySet()) { diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_debitor_statistic.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_debitor_statistic.xhtml index ec6853a..d298aa2 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_debitor_statistic.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_debitor_statistic.xhtml @@ -11,52 +11,82 @@
-
Anzahl Rechnungen
+
+ Anzahl Rechnungen gesamt +
#{debitorStatistikController.rechnungen}
-
Anzahl Offen
+
+ Anzahl Rechnungen offen +
#{debitorStatistikController.rechnungenOffen}
-
Anzahl Offen
+
+ Anzahl Rechnungen fällig +
#{debitorStatistikController.rechnungenFaellig}
-
Anzahl Rechnungen in Mahnung
+
+ Anzahl Rechnungen in Mahnung +
#{debitorStatistikController.rechnungenGemahnt}
-
Anzahl Rechnungen in Inkasso
+
+ Anzahl Rechnungen in Inkasso +
#{debitorStatistikController.rechnungenInkasso}
-
Anzahl Rechnungen Bezahlt
+
+ Anzahl Rechnungen bezahlt +
#{debitorStatistikController.rechnungenBezahlt}
+
+
Durchschnitt Zahlungsziel
+
+ #{debitorStatistikController.durchschnittZahlungsziel} +
+
+
+
Durchschnitt Zahlungsdauer
+
+ #{debitorStatistikController.durchschnittZahlungsdauer} +
+
- + asdf
- +