Debitor Analyse - Zahlungsmoral
This commit is contained in:
parent
e8219ca579
commit
ae7b7abf8e
3 changed files with 71 additions and 11 deletions
|
|
@ -78,6 +78,9 @@ public class AGLAnalyticControllerDebitor implements Serializable {
|
||||||
double totalDunningCurrency1 = 0;
|
double totalDunningCurrency1 = 0;
|
||||||
double totalDunningCurrency2 = 0;
|
double totalDunningCurrency2 = 0;
|
||||||
|
|
||||||
|
double averagePaymentDue = 0;
|
||||||
|
double averagePaymentDays = 0;
|
||||||
|
|
||||||
String chartData = "";
|
String chartData = "";
|
||||||
|
|
||||||
public void onEvent(@Observes AnalyticEvent event) {
|
public void onEvent(@Observes AnalyticEvent event) {
|
||||||
|
|
@ -100,7 +103,7 @@ public class AGLAnalyticControllerDebitor implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
String link = "/pages/workitems/worklist.xhtml" + "?phrase=" + getDbtNr();
|
String link = "/pages/workitems/worklist.xhtml" + "?phrase=" + getDbtNr();
|
||||||
logger.info("process ref=" + workflowController.getWorkitem().getItemValueString("process.ref"));
|
logger.fine("process ref=" + workflowController.getWorkitem().getItemValueString("process.ref"));
|
||||||
ItemCollection process = documentService
|
ItemCollection process = documentService
|
||||||
.load(workflowController.getWorkitem().getItemValueString("process.ref"));
|
.load(workflowController.getWorkitem().getItemValueString("process.ref"));
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
|
|
@ -138,10 +141,25 @@ public class AGLAnalyticControllerDebitor implements Serializable {
|
||||||
event.setLink(link);
|
event.setLink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("analytic.payment.avg.due".equals(event.getKey())) {
|
||||||
|
event.setValue("" + averagePaymentDue);
|
||||||
|
event.setLabel("days");
|
||||||
|
event.setDescription("Average terms of credit in the last 12 months.");
|
||||||
|
event.getWorkitem().setItemValue("payment.avg.due", event.getValue());
|
||||||
|
event.setLink(link);
|
||||||
|
}
|
||||||
|
if ("analytic.payment.avg.days".equals(event.getKey())) {
|
||||||
|
event.setValue("" + averagePaymentDays);
|
||||||
|
event.setLabel("days");
|
||||||
|
event.setDescription("Average duration for payment during the last 12 months.");
|
||||||
|
event.getWorkitem().setItemValue("payment.avg.days", event.getValue());
|
||||||
|
event.setLink(link);
|
||||||
|
}
|
||||||
|
|
||||||
if ("analytic.invoices.trend".equals(event.getKey())) {
|
if ("analytic.invoices.trend".equals(event.getKey())) {
|
||||||
event.setValue(chartData);
|
event.setValue(chartData);
|
||||||
event.setLabel("Zahlung Tage");
|
event.setLabel("Payment duration in days");
|
||||||
event.setDescription("Zahlungsmoral nach KW");
|
event.setDescription("Payment practice by week");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,24 +265,56 @@ public class AGLAnalyticControllerDebitor implements Serializable {
|
||||||
totalDunningCurrency2 = InvoiceUtil.round(totalDunningCurrency2);
|
totalDunningCurrency2 = InvoiceUtil.round(totalDunningCurrency2);
|
||||||
|
|
||||||
chartData = buildChartData();
|
chartData = buildChartData();
|
||||||
System.out.println(chartData);
|
// System.out.println(chartData);
|
||||||
|
|
||||||
|
getDurchschnittZahlungsziel();
|
||||||
|
getDurchschnittZahlungsdauer();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getDurchschnittZahlungsziel() {
|
||||||
|
if (stats == null) {
|
||||||
|
averagePaymentDue = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
long gesamt = 0;
|
||||||
|
for (Map.Entry<String, DebitorStatistikData> entry : stats.entrySet()) {
|
||||||
|
DebitorStatistikData statData = entry.getValue();
|
||||||
|
if (statData.count > 0) {
|
||||||
|
gesamt = gesamt + statData.getAverageDueDays();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
averagePaymentDue = Math.round((double) gesamt / count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getDurchschnittZahlungsdauer() {
|
||||||
|
if (stats == null) {
|
||||||
|
averagePaymentDays = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
long gesamt = 0;
|
||||||
|
for (Map.Entry<String, DebitorStatistikData> entry : stats.entrySet()) {
|
||||||
|
DebitorStatistikData statData = entry.getValue();
|
||||||
|
if (statData.count > 0) {
|
||||||
|
gesamt = gesamt + statData.getAveragePaymentDays();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
averagePaymentDays = Math.round((double) gesamt / count);
|
||||||
|
}
|
||||||
|
|
||||||
private String formatCurrency(Double value) {
|
private String formatCurrency(Double value) {
|
||||||
|
|
||||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
|
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
|
||||||
symbols.setGroupingSeparator('.');
|
symbols.setGroupingSeparator('.');
|
||||||
symbols.setDecimalSeparator(',');
|
symbols.setDecimalSeparator(',');
|
||||||
|
|
||||||
DecimalFormat formatter = new DecimalFormat("#,##0.00", symbols);
|
DecimalFormat formatter = new DecimalFormat("#,##0.00", symbols);
|
||||||
|
|
||||||
return formatter.format(value);
|
return formatter.format(value);
|
||||||
|
|
||||||
// %, => local-specific thousands separator
|
|
||||||
// .2f => positions after decimal point
|
|
||||||
// return String.format("%,.2f", value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ th { font-weight: bold;}
|
||||||
<bpmn2:task id="Task_2" imixs:processid="1900" name="Archived">
|
<bpmn2:task id="Task_2" imixs:processid="1900" name="Archived">
|
||||||
<bpmn2:extensionElements>
|
<bpmn2:extensionElements>
|
||||||
<imixs:item name="txtworkflowsummary" type="xs:string">
|
<imixs:item name="txtworkflowsummary" type="xs:string">
|
||||||
<imixs:value><![CDATA[<itemvalue format="EEE. dd. MMM. yyyy">$lasteventdate</itemvalue>]]></imixs:value>
|
<imixs:value><![CDATA[<itemvalue>dbtr.name</itemvalue> - <itemvalue format="EEE. dd. MMM. yyyy">$lasteventdate</itemvalue>]]></imixs:value>
|
||||||
</imixs:item>
|
</imixs:item>
|
||||||
<imixs:item name="keyupdateacl" type="xs:boolean">
|
<imixs:item name="keyupdateacl" type="xs:boolean">
|
||||||
<imixs:value>true</imixs:value>
|
<imixs:value>true</imixs:value>
|
||||||
|
|
@ -179,6 +179,10 @@ th { font-weight: bold;}
|
||||||
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Offene Rechnungen:" />
|
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Offene Rechnungen:" />
|
||||||
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Fällige Rechnungen:" />
|
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Fällige Rechnungen:" />
|
||||||
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Rechnungen in Mahnung:" />
|
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Rechnungen in Mahnung:" />
|
||||||
|
|
||||||
|
<item name="analytic.payment.avg.due" type="custom" path="alexander/analyze_plain" label="Average term of credit:" />
|
||||||
|
<item name="analytic.payment.avg.days" type="custom" path="alexander/analyze_plain" label="Average payment duration:" />
|
||||||
|
|
||||||
</imixs-form-section>
|
</imixs-form-section>
|
||||||
|
|
||||||
<imixs-form-section columns="1" label="Trend Zahlungsmoral">
|
<imixs-form-section columns="1" label="Trend Zahlungsmoral">
|
||||||
|
|
@ -368,6 +372,8 @@ th { font-weight: bold;}
|
||||||
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Offene Rechnungen:" />
|
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Offene Rechnungen:" />
|
||||||
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Fällige Rechnungen:" />
|
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Fällige Rechnungen:" />
|
||||||
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Rechnungen in Mahnung:" />
|
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Rechnungen in Mahnung:" />
|
||||||
|
<item name="analytic.payment.avg.due" type="custom" path="alexander/analyze_plain" label="Average term of credit:" />
|
||||||
|
<item name="analytic.payment.avg.days" type="custom" path="alexander/analyze_plain" label="Average payment duration:" />
|
||||||
</imixs-form-section>
|
</imixs-form-section>
|
||||||
|
|
||||||
<imixs-form-section columns="1" label="Trend Zahlungsmoral">
|
<imixs-form-section columns="1" label="Trend Zahlungsmoral">
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ th { font-weight: bold;}
|
||||||
<bpmn2:task id="Task_2" imixs:processid="1900" name="Archived">
|
<bpmn2:task id="Task_2" imixs:processid="1900" name="Archived">
|
||||||
<bpmn2:extensionElements>
|
<bpmn2:extensionElements>
|
||||||
<imixs:item name="txtworkflowsummary" type="xs:string">
|
<imixs:item name="txtworkflowsummary" type="xs:string">
|
||||||
<imixs:value><![CDATA[<itemvalue format="EEE. dd. MMM. yyyy">$lasteventdate</itemvalue>]]></imixs:value>
|
<imixs:value><![CDATA[<textblock><itemvalue>$workflowgroup</itemvalue> - <itemvalue format="EEE. dd. MMM. yyyy">$lasteventdate</itemvalue>]]></imixs:value>
|
||||||
</imixs:item>
|
</imixs:item>
|
||||||
<imixs:item name="keyupdateacl" type="xs:boolean">
|
<imixs:item name="keyupdateacl" type="xs:boolean">
|
||||||
<imixs:value>true</imixs:value>
|
<imixs:value>true</imixs:value>
|
||||||
|
|
@ -179,6 +179,8 @@ th { font-weight: bold;}
|
||||||
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Open Invoices open:" />
|
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Open Invoices open:" />
|
||||||
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Invoices in due:" />
|
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Invoices in due:" />
|
||||||
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Invoices in dunning:" />
|
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Invoices in dunning:" />
|
||||||
|
<item name="analytic.payment.avg.due" type="custom" path="alexander/analyze_plain" label="Average term of credit:" />
|
||||||
|
<item name="analytic.payment.avg.days" type="custom" path="alexander/analyze_plain" label="Average payment duration:" />
|
||||||
</imixs-form-section>
|
</imixs-form-section>
|
||||||
|
|
||||||
<imixs-form-section columns="1" label="Trend Payment Practices">
|
<imixs-form-section columns="1" label="Trend Payment Practices">
|
||||||
|
|
@ -368,6 +370,8 @@ th { font-weight: bold;}
|
||||||
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Open Invoices open:" />
|
<item name="analytic.invoices.count.open" type="custom" path="alexander/analyze_plain" label="Open Invoices open:" />
|
||||||
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Invoices in due:" />
|
<item name="analytic.invoices.count.due" type="custom" path="alexander/analyze_plain" label="Invoices in due:" />
|
||||||
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Invoices in dunning:" />
|
<item name="analytic.invoices.count.dunning" type="custom" path="alexander/analyze_plain" label="Invoices in dunning:" />
|
||||||
|
<item name="analytic.payment.avg.due" type="custom" path="alexander/analyze_plain" label="Average term of credit:" />
|
||||||
|
<item name="analytic.payment.avg.days" type="custom" path="alexander/analyze_plain" label="Average payment duration:" />
|
||||||
</imixs-form-section>
|
</imixs-form-section>
|
||||||
|
|
||||||
<imixs-form-section columns="1" label="Trend Payment Practices">
|
<imixs-form-section columns="1" label="Trend Payment Practices">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue