neue Rundungsfunktion
This commit is contained in:
parent
1127211706
commit
41c6ac7cbf
7 changed files with 28 additions and 28 deletions
|
|
@ -0,0 +1,10 @@
|
|||
package com.alexanderlogistics;
|
||||
|
||||
public class InvoiceUtil {
|
||||
|
||||
public static double round(double value) {
|
||||
value = value * 100;
|
||||
long tmp = Math.round(value);
|
||||
return (double) tmp / 100;
|
||||
}
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ public class OPListController implements Serializable {
|
|||
}
|
||||
|
||||
// rond with 2 digits
|
||||
workitem.replaceItemValue("payment.total", Math.round(paymentTotal * 100.0) / 100.0);
|
||||
workitem.replaceItemValue("payment.total", InvoiceUtil.round(paymentTotal));
|
||||
// update childitems
|
||||
workitem.replaceItemValue(ZahlungseingangService.ITEM_PAYMENT_DETAILS, mapInvoiceItems);
|
||||
// Update $workitemref
|
||||
|
|
@ -296,7 +296,7 @@ public class OPListController implements Serializable {
|
|||
result = result + invoice.getItemValueDouble("invoice.total");
|
||||
}
|
||||
// rond with 2 digits
|
||||
return Math.round(result * 100.0) / 100.0;
|
||||
return InvoiceUtil.round(result);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ public class OPListController implements Serializable {
|
|||
}
|
||||
}
|
||||
// rond with 2 digits
|
||||
return Math.round(result * 100.0) / 100.0;
|
||||
return InvoiceUtil.round(result);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ public class OPListController implements Serializable {
|
|||
|
||||
logger.fine("...new PaymentDifference=" + result);
|
||||
// rond with 2 digits
|
||||
return Math.round(result * 100.0) / 100.0;
|
||||
return InvoiceUtil.round(result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -354,7 +354,7 @@ public class OPListController implements Serializable {
|
|||
}
|
||||
}
|
||||
// rond with 2 digits
|
||||
return Math.round(result * 100.0) / 100.0;
|
||||
return InvoiceUtil.round(result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -223,12 +223,12 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
|||
// EUR
|
||||
row.getCell(6).setCellValue(total);
|
||||
row.getCell(7).setCellValue(currency);
|
||||
saldoEUR = roundD(saldoEUR + total);
|
||||
saldoEUR = InvoiceUtil.round(saldoEUR + total);
|
||||
} else {
|
||||
// USD
|
||||
row.getCell(8).setCellValue(total);
|
||||
row.getCell(9).setCellValue(currency);
|
||||
saldoUSD = roundD(saldoUSD + total);
|
||||
saldoUSD = InvoiceUtil.round(saldoUSD + total);
|
||||
}
|
||||
row.getCell(10).setCellValue(invoice.getItemValueString("$workflowstatus"));
|
||||
|
||||
|
|
@ -388,11 +388,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private double roundD(double wert) {
|
||||
return Math.round(wert * 100.0f) / 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isOverdue(Date date, int taskid) {
|
||||
Date now = new Date();
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class ZahlungsavisController implements Serializable {
|
|||
}
|
||||
}
|
||||
// rond with 2 digits
|
||||
return Math.round(result * 100.0) / 100.0;
|
||||
return InvoiceUtil.round(result);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
|
|||
if (paymentWarning.isEmpty()) {
|
||||
// falls mehr einzelsummen eingeben wurden als der oben angegeben Total Pamyment
|
||||
// dann soll eine Warnung ausgegen werden.
|
||||
if ( roundD(masterPaymentAmount+masterPaymentDifference) != roundD(einzelPayments)) {
|
||||
if ( InvoiceUtil.round(masterPaymentAmount+masterPaymentDifference) != InvoiceUtil.round(einzelPayments)) {
|
||||
document.setItemValue("payment.warning", "invalid saldo");
|
||||
throw new PluginException(PluginException.class.getName(),
|
||||
ZahlungseingangService.ERROR_PAYMENT_BOOKING_FAILED,
|
||||
|
|
@ -122,12 +122,12 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
|
|||
!invoiceCurrency.equals(paymentCurrency) && invoiceRate != 0) {
|
||||
invoicePaymentAmount = invoicePaymentAmount*invoiceRate;
|
||||
// runde auf 2 Stellen
|
||||
invoicePaymentAmount =roundF(invoicePaymentAmount);
|
||||
invoicePaymentAmount =(float) InvoiceUtil.round(invoicePaymentAmount);
|
||||
}
|
||||
|
||||
|
||||
// vergeiche Restsaldo mit payment für diese Rechnung
|
||||
if (Math.abs(invoicePaymentAmount) > Math.abs(invoiceSaldo)) {
|
||||
if (Math.abs(invoicePaymentAmount) > Math.abs(InvoiceUtil.round(invoiceSaldo))) {
|
||||
throw new PluginException(PluginException.class.getName(),
|
||||
ZahlungseingangService.ERROR_PAYMENT_BOOKING_FAILED,
|
||||
"Der Zahlungseingang kann nicht verbucht werden, da der Restsaldo der Rechnung "
|
||||
|
|
@ -152,10 +152,4 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
|
|||
|
||||
}
|
||||
|
||||
private float roundF(float wert) {
|
||||
return Math.round(wert * 100.0f) / 100.0f;
|
||||
}
|
||||
private double roundD(double wert) {
|
||||
return Math.round(wert * 100.0f) / 100.0f;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ import org.imixs.workflow.exceptions.PluginException;
|
|||
import org.imixs.workflow.exceptions.ProcessingErrorException;
|
||||
import org.imixs.workflow.exceptions.QueryException;
|
||||
|
||||
import com.alexanderlogistics.InvoiceUtil;
|
||||
import com.alexanderlogistics.KreditorDebitorService;
|
||||
|
||||
/**
|
||||
|
|
@ -406,6 +407,7 @@ public class DatevCargosoftImportAdapter implements SignalAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
total=InvoiceUtil.round(total);
|
||||
invoiceWorkitem.setItemValue("invoice.total", total);
|
||||
invoiceWorkitem.setItemValue("invoice.saldo", total);
|
||||
// implode die Splitbuchungen
|
||||
|
|
@ -455,12 +457,8 @@ public class DatevCargosoftImportAdapter implements SignalAdapter {
|
|||
workflowService.processWorkItem(invoiceWorkitem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void updateSpaceRef(ItemCollection invoice) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the List of ItemCollections back into a List of Map elements
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import org.imixs.workflow.ItemCollection;
|
|||
import org.imixs.workflow.engine.DocumentService;
|
||||
import org.imixs.workflow.faces.data.WorkflowController;
|
||||
|
||||
import com.alexanderlogistics.InvoiceUtil;
|
||||
|
||||
/**
|
||||
* Der InkassoController dient dazu eine bereits zugewiesene Rechnung
|
||||
* wieder aus dem Inkasso zu entfernen.
|
||||
|
|
@ -58,7 +60,7 @@ public class InkassoController implements Serializable {
|
|||
}
|
||||
}
|
||||
// rond with 2 digits
|
||||
return Math.round(result * 100.0) / 100.0;
|
||||
return InvoiceUtil.round(result);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue