kreditoren statistik

This commit is contained in:
Ralph Soika 2023-07-24 14:43:06 +02:00
parent 520c0e996c
commit 2742379b37
2 changed files with 19 additions and 9 deletions

View file

@ -409,7 +409,7 @@ public class DebitorStatistikController implements Serializable {
// Datasets 1 // Datasets 1
result = result + "{label: 'Zahlungsziel',borderWidth: 1,"; result = result + "{label: 'Zahlungsziel',borderWidth: 1,";
result = result + " \"backgroundColor\" : [\"#EBA05F\"],"; result = result + " \"backgroundColor\" : [\"#3B6B82\"],";
result = result + "data: ["; result = result + "data: [";
for (Map.Entry<String, DebitorStatistikData> entry : stats.entrySet()) { for (Map.Entry<String, DebitorStatistikData> entry : stats.entrySet()) {
@ -422,7 +422,7 @@ public class DebitorStatistikController implements Serializable {
// Datasets 2 // Datasets 2
result = result + "{label: 'Zahldauer',borderWidth: 1,"; result = result + "{label: 'Zahldauer',borderWidth: 1,";
result = result + " \"backgroundColor\" : [\"#70B088\" ],"; result = result + " \"backgroundColor\" : [\"#CFE9F5\" ],";
result = result result = result
+ " trendlineLinear: { colorMin: \"red\", colorMax: \"green\", lineStyle: \"dotted\", width: 2 , projection: true },"; + " trendlineLinear: { colorMin: \"red\", colorMax: \"green\", lineStyle: \"dotted\", width: 2 , projection: true },";

View file

@ -13,9 +13,11 @@ public class DebitorStatistikData {
int month; int month;
int year; int year;
int count = 0; long count = 0;
int averageDueDays; // Zahlungsziel long averageDueDays; // Zahlungsziel
int averagePaymentDays; // Tatsächliche Zahlung long averagePaymentDays; // Tatsächliche Zahlung
long totalDueDays;
long totalPaymentDays;
public DebitorStatistikData(Date date) { public DebitorStatistikData(Date date) {
// Create a Calendar instance and set the date // Create a Calendar instance and set the date
@ -57,7 +59,10 @@ public class DebitorStatistikData {
long diffMilliseconds = milliseconds2 - milliseconds1; long diffMilliseconds = milliseconds2 - milliseconds1;
long dueTime = diffMilliseconds / (24 * 60 * 60 * 1000); long dueTime = diffMilliseconds / (24 * 60 * 60 * 1000);
logger.info("...Fälligkeit in tagen= " + dueTime); logger.info("...Fälligkeit in tagen= " + dueTime);
averageDueDays = (int) (averageDueDays + dueTime / count);
totalDueDays = totalDueDays + dueTime;
// averageDueDays = (long) (totalDueDays / count);
averageDueDays = Math.round((double) totalDueDays / count);
// Bezahlt nach Tagen // Bezahlt nach Tagen
milliseconds1 = invoiceDate.getTime(); milliseconds1 = invoiceDate.getTime();
@ -65,16 +70,21 @@ public class DebitorStatistikData {
// Berechnen Sie die Differenz in Millisekunden // Berechnen Sie die Differenz in Millisekunden
diffMilliseconds = milliseconds2 - milliseconds1; diffMilliseconds = milliseconds2 - milliseconds1;
long paymentTime = diffMilliseconds / (24 * 60 * 60 * 1000); long paymentTime = diffMilliseconds / (24 * 60 * 60 * 1000);
// Fix differenz
// paymentTime = paymentTime - dueTime;
logger.info("...Zahlung erfolgte nach tagen= " + paymentTime); logger.info("...Zahlung erfolgte nach tagen= " + paymentTime);
averagePaymentDays = (int) (averagePaymentDays + paymentTime / count); totalPaymentDays = totalPaymentDays + paymentTime;
// averagePaymentDays = (long) (totalPaymentDays / count);
averagePaymentDays = Math.round((double) totalPaymentDays / count);
} }
public int getAverageDueDays() { public long getAverageDueDays() {
return averageDueDays; return averageDueDays;
} }
public int getAveragePaymentDays() { public long getAveragePaymentDays() {
return averagePaymentDays; return averagePaymentDays;
} }